diff options
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | txr.1 | 11 | ||||
-rw-r--r-- | txr.c | 20 | ||||
-rw-r--r-- | txr.h | 1 |
4 files changed, 40 insertions, 3 deletions
@@ -1,5 +1,16 @@ 2014-09-02 Kaz Kylheku <kaz@kylheku.com> + * txr.1: Document -C option. + + * txr.c (opt_compat): New global variable. + (help): Describe -C option. + (txr_main): Process -C, and set opt_compat. + Ensure -C does not clump. + + * txr.h (opt_compat): Declared. + +2014-09-02 Kaz Kylheku <kaz@kylheku.com> + * eval.c (eval_init): Update registration of lisp-parse and read to account for new parameter. @@ -191,6 +191,17 @@ Evaluates a TXR Lisp expression and prints its value. Can be specified more than once. The query-file argument becomes optional if -p is used at least once. +.IP "-C number" +Requests TXR to behave in a manner that is compatible with the specified +version of TXR. This makes a difference in situations when a release of +TXR breaks backward compatibility. If some version N+1 deliberately introduces +a change which is backward incompatible, then -C N can be used to request +the old behavior. The requested value of N can be too low, in which case TXR +will complain and exit with an unsuccessful termination status. This indicates +that TXR refuses to be compatible with such an old version. Users requiring +the behavior of that version will have to install an older version of TXR which +supports that behavior, or even that exact version. + .IP --help Prints usage summary on standard output, and terminates successfully. @@ -59,6 +59,7 @@ const wchli_t *version = wli(TXR_VER); const wchar_t *progname = L"txr"; static const char *progname_u8; static val progpath = nil; +int opt_compat; /* * Can implement an emergency allocator here from a fixed storage @@ -119,6 +120,8 @@ static void help(void) " option, instead of the query-file argument.\n" " This allows #! scripts to pass options through\n" " to the utility.\n" +"-C number Request backward-compatible behavior to the\n" +" specified version of TXR.\n" "--help You already know!\n" "--version Display program version\n" "--license Display software license\n" @@ -368,7 +371,7 @@ int txr_main(int argc, char **argv) return license(); if (memqual(arg, list(lit("-a"), lit("-c"), lit("-f"), - lit("-e"), lit("-p"), nao))) + lit("-e"), lit("-p"), lit("-C"), nao))) { val opt = chr_str(arg, one); @@ -383,6 +386,7 @@ int txr_main(int argc, char **argv) switch (c_chr(opt)) { case 'a': + case 'C': { val optval = int_str(arg, nil); @@ -393,8 +397,17 @@ int txr_main(int argc, char **argv) return EXIT_FAILURE; } - opt_arraydims = c_num(optval); - opt_print_bindings = 1; + if (opt == chr('a')) { + opt_arraydims = c_num(optval); + opt_print_bindings = 1; + } else { + if ((opt_compat = c_num(optval)) < 97) { + format(std_error, lit("~a: compatibility with versions " + "lower than 97 not supported by version ~a\n"), + prog_string, auto_str(version), nao); + return EXIT_FAILURE; + } + } } break; case 'c': @@ -489,6 +502,7 @@ int txr_main(int argc, char **argv) case 'e': case 'p': case 'f': + case 'C': case 'D': format(std_error, lit("~a: option -~a does not clump\n"), prog_string, opch, nao); @@ -33,5 +33,6 @@ extern int opt_gc_debug; extern int opt_vg_debug; #endif extern int opt_derivative_regex; +extern int opt_compat; extern const wchli_t *version; extern const wchar_t *progname; |