diff options
-rw-r--r-- | auto.def | 5 | ||||
-rw-r--r-- | jim.c | 26 | ||||
-rw-r--r-- | jim_tcl.txt | 2 |
3 files changed, 29 insertions, 4 deletions
@@ -21,6 +21,7 @@ options { maintainer => {Enable the [debug] command and JimPanic} full => "Enable some optional features: ipv6, ssl, math, utf8, and some extensions (see --extinfo)" allextmod => "Enable all non-default extensions as modules if prerequisites are found" + compat => "Enable some backward compatibility behaviour" extinfo => "Show information about available extensions" with-jim-shared shared => "Build a shared library instead of a static library" jim-regexp=1 => "Prefer POSIX regex if over the the built-in (Tcl-compatible) regex" @@ -432,6 +433,10 @@ if {[opt-bool references]} { msg-result "Enabling references" define JIM_REFERENCES } +if {[opt-bool compat]} { + msg-result "Enabling compatibility mode" + define JIM_COMPAT +} if {[opt-bool shared with-jim-shared]} { msg-result "Building shared library" } else { @@ -13598,11 +13598,31 @@ static int Jim_UplevelCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const * /* [expr] */ static int Jim_ExprCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { + int retcode; + if (argc == 2) { - return Jim_EvalExpression(interp, argv[1]); + retcode = Jim_EvalExpression(interp, argv[1]); } - Jim_WrongNumArgs(interp, 1, argv, "expression"); - return JIM_ERR; +#ifndef JIM_COMPAT + else { + Jim_WrongNumArgs(interp, 1, argv, "expression"); + retcode = JIM_ERR; + } +#else + else if (argc > 2) { + Jim_Obj *objPtr; + + objPtr = Jim_ConcatObj(interp, argc - 1, argv + 1); + Jim_IncrRefCount(objPtr); + retcode = Jim_EvalExpression(interp, objPtr); + Jim_DecrRefCount(interp, objPtr); + } + else { + Jim_WrongNumArgs(interp, 1, argv, "expression ?...?"); + return JIM_ERR; + } +#endif + return retcode; } /* [break] */ diff --git a/jim_tcl.txt b/jim_tcl.txt index aea64f4..49972b7 100644 --- a/jim_tcl.txt +++ b/jim_tcl.txt @@ -65,7 +65,7 @@ Changes since 0.80 8. `lsort -index` now supports multiple indices 9. Add support for `lsort -stride` 10. `open` now supports POSIX-style access arguments -11. TIP 526, `expr` now only allows a single argument +11. TIP 526, `expr` now only allows a single argument (unless --compat is enabled) Changes between 0.79 and 0.80 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |