diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2023-06-27 19:47:35 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2023-06-27 19:47:35 -0700 |
commit | 010f5afe311b8a4f52597db2085a3aae49213c68 (patch) | |
tree | b7c55e79fcf7d3134dea2ff13c6d71ba0aaca0b5 | |
parent | c7b4483840f371ffe5a531c46492e2cf9c4c6e1e (diff) | |
download | txr-010f5afe311b8a4f52597db2085a3aae49213c68.tar.gz txr-010f5afe311b8a4f52597db2085a3aae49213c68.tar.bz2 txr-010f5afe311b8a4f52597db2085a3aae49213c68.zip |
eval: take macro environment.
With this change we fix the bug that the debugger commands
yield their Lisp forms rather than evaluating them.
* eval.c (eval_intrinsic): Takes one more argument,
the macro environment. This is passed into env_to_menv
as the root macro environment.
(eval_init): Update registration of eval intrinsic
to have two optional arguments.
* eval.h (eval_intrinsic): Declaration updated.
* parser.c (read_file_common, read_eval_ret_last): Pass
nil argument to new parameter of eval_intrinsic.
(repl): Pass the env parameter as the new menv
parameter of eval_intrinsic, rather than the existing
env parameter. This fixes the command dispatch in
the debugger, since the command table is consists of
symbol macros, and not variables. For instance the
backtrace command bt is a binding of the bt symbol
to the form (sys:print-backtrace), which has to be
substituted for it and executed. When that envrionment
is used as the ordinary environment, bt looks like
a variable whose value is the list (sys:backtrace).
* parser.y (elem, check_parse_time_action): Fix
eval_intrinsic calls.
* txr.c (txr_main): Likewise.
* txr.1: Documented.
* y.tab.c.shipped: Updated.
* stdlib/doc-syms.tl: Updated.
-rw-r--r-- | eval.c | 8 | ||||
-rw-r--r-- | eval.h | 2 | ||||
-rw-r--r-- | parser.c | 6 | ||||
-rw-r--r-- | parser.y | 4 | ||||
-rw-r--r-- | stdlib/doc-syms.tl | 262 | ||||
-rw-r--r-- | txr.1 | 42 | ||||
-rw-r--r-- | txr.c | 4 | ||||
-rw-r--r-- | y.tab.c.shipped | 4 |
8 files changed, 180 insertions, 152 deletions
@@ -1599,9 +1599,9 @@ static val expand_eval(val form, val env, val menv) static val macroexpand(val form, val menv); -val eval_intrinsic(val form, val env) +val eval_intrinsic(val form, val env, val menv_in) { - val menv = env_to_menv(default_null_arg(env), lit("eval"), nil); + val menv = env_to_menv(default_null_arg(env), lit("eval"), menv_in); val form_ex = macroexpand(form, menv); val op; @@ -1631,7 +1631,7 @@ val eval_intrinsic_noerr(val form, val env, val *error_p) uw_catch_begin (cons(t, nil), exsym, exvals); - result = eval_intrinsic(form, env); + result = eval_intrinsic(form, env, nil); uw_catch(exsym, exvals) { (void) exsym; (void) exvals; @@ -7388,7 +7388,7 @@ void eval_init(void) reg_var(intern(lit("*param-macro*"), user_package), pm_table); - reg_fun(intern(lit("eval"), user_package), func_n2o(eval_intrinsic, 1)); + reg_fun(intern(lit("eval"), user_package), func_n3o(eval_intrinsic, 1)); reg_fun(intern(lit("lisp-parse"), user_package), func_n5o(nread, 0)); reg_fun(intern(lit("read"), user_package), func_n5o(nread, 0)); reg_fun(intern(lit("iread"), user_package), func_n5o(iread, 0)); @@ -79,7 +79,7 @@ val apply(val fun, val arglist); val applyv(val fun, struct args *args); val eval_progn(val forms, val env, val ctx_form); val eval(val form, val env, val ctx_form); -val eval_intrinsic(val form, val env); +val eval_intrinsic(val form, val env, val menv); val eval_intrinsic_noerr(val form, val env, val *error_p); void trace_check(val name); val format_field(val string_or_list, val modifier, val filter, val eval_fun); @@ -874,7 +874,7 @@ static val read_file_common(val self, val stream, val error_stream, val compiled stream, form, nao); } } else { - (void) eval_intrinsic(form, nil); + (void) eval_intrinsic(form, nil, nil); } } @@ -1298,7 +1298,7 @@ static val read_eval_ret_last(val env, val counter, if (form == error_val) break; - value = eval_intrinsic(form, nil); + value = eval_intrinsic(form, nil, nil); } dyn_env = saved_dyn_env; @@ -1750,7 +1750,7 @@ val repl(val bindings, val in_stream, val out_stream, val env) counter = prev_counter; } else { val value = if3(form != read_k, - eval_intrinsic(cons(progn_s, forms), env), + eval_intrinsic(cons(progn_s, forms), nil, env), read_eval_ret_last(nil, prev_counter, in_stream, out_stream)); val pprin = cdr(pprint_var); @@ -501,7 +501,7 @@ elem : texts { $$ = rlc(cons(text_s, $1), $1); expand_forms(rest($1), nil)), $1); else if (sym == mdo_s) - { eval_intrinsic(cons(progn_s, cdr($1)), nil); + { eval_intrinsic(cons(progn_s, cdr($1)), nil, nil); $$ = cons(do_s, nil); } else { $$ = match_expand_elem($1); @@ -1998,7 +1998,7 @@ static val check_parse_time_action(val spec_rev) return nappend2(nreverse(include(line)), rest(spec_rev)); } if (sym == in_package_s) { - eval_intrinsic(elem, nil); + eval_intrinsic(elem, nil, nil); return nil; } } diff --git a/stdlib/doc-syms.tl b/stdlib/doc-syms.tl index e7cf5fa7..a46abbd0 100644 --- a/stdlib/doc-syms.tl +++ b/stdlib/doc-syms.tl @@ -4,7 +4,7 @@ ("%e%" "N-03F0FA9E") ("%fun%" "N-00719365") ("%pi%" "N-03F0FA9E") - ("*" "D-0039") + ("*" "D-0076") ("*args*" "N-03DEE18A") ("*args-eff*" "N-03DEE18A") ("*args-full*" "N-03DEE18A") @@ -53,8 +53,8 @@ ("*trace-output*" "N-0067A6AC") ("*tree-fun-whitelist*" "N-025AB9C9") ("*unhandled-hook*" "N-02B4A4FB") - ("+" "D-0045") - ("-" "D-004A") + ("+" "D-004F") + ("-" "D-0079") ("--" "N-0234C408") ("--rng" "N-01A056E4") ("--rng+" "N-01A056E4") @@ -64,29 +64,29 @@ ("-rng" "N-01A056E4") ("-rng+" "N-01A056E4") ("-rng-" "N-01A056E4") - ("/" "D-004B") + ("/" "D-0052") ("//" "N-0054C409") ("/=" "N-003BE40C") (":delegate" "N-037F664C") (":key" "N-01697547") (":mass-delegate" "N-000BBDEA") (":match" "N-03B92C0D") - ("<" "D-0058") + ("<" "D-007D") ("<!" "N-02B10DF9") ("<-" "N-02B10DF9") - ("<=" "D-0020") - ("=" "D-0079") - (">" "D-0063") - (">=" "D-0052") + ("<=" "D-0008") + ("=" "D-0064") + (">" "D-002F") + (">=" "D-007C") ("abort" "N-02F934F6") - ("abs" "D-0017") + ("abs" "D-001F") ("abs-path-p" "N-00477B23") - ("accept" "D-0043") + ("accept" "D-0011") ("acons" "N-02E9343D") ("acons-new" "N-0371BAFA") ("aconsql-new" "N-01E315BD") - ("acos" "D-0026") - ("acosh" "D-0042") + ("acos" "D-0022") + ("acosh" "D-0029") ("add" "N-03244398") ("add*" "N-03244398") ("add-suffix" "N-00AE9981") @@ -107,10 +107,10 @@ ("alignof" "N-000F730E") ("alist-nremove" "N-000CD07F") ("alist-remove" "N-001A53C4") - ("all" "D-0055") + ("all" "D-002D") ("all*" "N-00F6E2A2") ("allocate-struct" "N-03168BF2") - ("and" "D-006A") + ("and" "D-0081") ("andf" "N-01E7D2AD") ("ap" "N-011CFC0C") ("apf" "N-012A7E6A") @@ -129,20 +129,20 @@ ("array" "N-0117BE95") ("arraysize" "N-002129D6") ("as" "N-028B26DD") - ("ash" "D-0065") - ("asin" "D-003F") - ("asinh" "D-0001") - ("assert" "D-0061") + ("ash" "D-005A") + ("asin" "D-004D") + ("asinh" "D-001C") + ("assert" "D-0080") ("assoc" "N-00E9306D") ("assq" "N-00123702") ("assql" "N-00123702") ("at-exit-call" "N-003EEEF5") ("at-exit-do-not-call" "N-003EEEF5") - ("atan" "D-0051") - ("atan2" "D-0009") - ("atanh" "D-0024") + ("atan" "D-007B") + ("atan2" "D-001D") + ("atanh" "D-000B") ("atom" "N-0076C7BE") - ("awk" "D-0059") + ("awk" "D-0013") ("base-name" "N-02C01721") ("base64-decode" "N-01B05083") ("base64-decode-buf" "N-01B05083") @@ -157,15 +157,15 @@ ("bchar" "N-0008D7DC") ("bignum-len" "N-020294AB") ("bignump" "N-03E9D6E1") - ("bind" "D-006D") + ("bind" "D-0018") ("bindable" "N-0222F2E3") - ("bit" "D-004D") - ("bitset" "D-0038") + ("bit" "D-002B") + ("bitset" "D-0025") ("blkcnt-t" "N-01153D9E") ("blksize-t" "N-01153D9E") - ("block" "D-006F") + ("block" "D-0033") ("block*" "N-02F60DCE") - ("bool" "D-002C") + ("bool" "D-000C") ("boundp" "N-01FBF828") ("bracket" "N-02400F97") ("break-str" "N-00A9DB25") @@ -176,11 +176,11 @@ ("bstr" "N-0225F1EF") ("bstr-d" "N-0225F1EF") ("bstr-s" "N-0225F1EF") - ("buf" "D-0060") + ("buf" "D-0015") ("buf-alloc-size" "N-013A3727") ("buf-carray" "N-0022F54E") ("buf-compress" "N-02DB9DFB") - ("buf-d" "D-0014") + ("buf-d" "D-0040") ("buf-decompress" "N-02DB9DFB") ("buf-get-char" "N-03E9074A") ("buf-get-cptr" "N-00E90766") @@ -244,7 +244,7 @@ ("call-super-method" "N-016185D1") ("call-update-expander" "N-03B6BCE9") ("callf" "N-00192C21") - ("car" "D-0023") + ("car" "D-0021") ("carray" "N-0139F9ED") ("carray-blank" "N-00DD8DF1") ("carray-buf" "N-00D75AD6") @@ -281,7 +281,7 @@ ("cat-str" "N-00B6ACE3") ("cat-streams" "N-020BF082") ("cat-vec" "N-01AEB28B") - ("catch" "D-000F") + ("catch" "D-006C") ("catch*" "N-0211F3D3") ("catch**" "N-0211F3D3") ("catch-frame" "N-0233BAE3") @@ -292,8 +292,8 @@ ("cdar" "N-001FA3CB") ("cdddddr" "N-001FA3CB") ("cddr" "N-001FA3CB") - ("cdr" "D-007A") - ("ceil" "D-007F") + ("cdr" "D-001A") + ("ceil" "D-0037") ("ceil-rem" "N-02DE978F") ("ceil1" "N-02C8FF28") ("chain" "N-00C53CF7") @@ -332,7 +332,7 @@ ("clean-file" "N-001939D4") ("clear-cflags" "N-02061924") ("clear-dirty" "N-03AB857D") - ("clear-error" "D-000C") + ("clear-error" "D-003D") ("clear-iflags" "N-02061924") ("clear-lflags" "N-02061924") ("clear-mask" "N-0269D998") @@ -342,7 +342,7 @@ ("clocal" "N-01B1B5DF") ("clock-t" "N-01B6F219") ("clockid-t" "N-01153D9E") - ("close" "D-0015") + ("close" "D-006F") ("close-lazy-streams" "N-00B8ACD5") ("close-stream" "N-00596930") ("closedir" "N-01FEE88A") @@ -351,8 +351,8 @@ ("cmp-str" "N-0143A273") ("cmspar" "N-01B1B5DF") ("coded-length" "N-0167F423") - ("coll" "D-005B") - ("collect" "D-0030") + ("coll" "D-0058") + ("collect" "D-000E") ("collect-each" "N-0105F01D") ("collect-each*" "N-0105F01D") ("collect-each-prod" "N-02CA3C70") @@ -410,15 +410,15 @@ ("copy-tree" "N-015EB85E") ("copy-tree-iter" "N-025C3140") ("copy-vec" "N-010E7635") - ("cos" "D-0021") - ("cosh" "D-0083") + ("cos" "D-000A") + ("cosh" "D-0084") ("count" "N-00AE0CB6") ("count-if" "N-00AE0CB6") ("count-until-match" "N-00EFD668") ("countq" "N-01DF131F") ("countql" "N-01DF131F") ("countqual" "N-01DF131F") - ("cptr" "D-0013") + ("cptr" "D-006D") ("cptr-buf" "N-037139E3") ("cptr-carray" "N-02257F04") ("cptr-cast" "N-01A212ED") @@ -455,7 +455,7 @@ ("data" "N-03B6EA7D") ("dec" "N-03A0AABD") ("defer-warning" "N-001106AB") - ("defex" "D-005F") + ("defex" "D-0014") ("deffi" "N-00DCE51D") ("deffi-cb" "N-00C54FC8") ("deffi-cb-unsafe" "N-00C54FC8") @@ -485,7 +485,7 @@ ("defun-match" "N-02BF0F8C") ("defvar" "N-039DD0E7") ("defvarl" "N-03F36A75") - ("del" "D-0022") + ("del" "D-0042") ("del*" "N-0166445C") ("delay" "N-00DCE524") ("delcons" "N-03A1ABA8") @@ -507,7 +507,7 @@ ("dlsym-checked" "N-029063A0") ("dlvsym" "N-01B1E865") ("dlvsym-checked" "N-029063A0") - ("do" "D-0073") + ("do" "D-0062") ("doc" "N-0097F54C") ("dohash" "N-039105E8") ("doloop" "N-01FF4DDB") @@ -530,7 +530,7 @@ ("dump-deferred-warnings" "N-0335651E") ("dup" "N-0387F549") ("dupfd" "N-01F91AEF") - ("dwim" "D-001E") + ("dwim" "D-0071") ("e2big" "N-036B1BDB") ("eacces" "N-036B1BDB") ("each" "N-0105F01D") @@ -585,7 +585,7 @@ ("eisconn" "N-036B1BDB") ("eisdir" "N-036B1BDB") ("elemsize" "N-01D55CC4") - ("elemtype" "D-0006") + ("elemtype" "D-003C") ("eloop" "N-036B1BDB") ("emfile" "N-036B1BDB") ("emlink" "N-036B1BDB") @@ -645,11 +645,11 @@ ("eprototype" "N-036B1BDB") ("eq" "N-02550B35") ("eql" "N-02550B35") - ("equal" "D-007C") + ("equal" "D-0036") ("equot" "N-02ACCDDF") ("erange" "N-036B1BDB") ("erofs" "N-036B1BDB") - ("errno" "D-0078") + ("errno" "D-0035") ("error" "N-015466AD") ("espipe" "N-036B1BDB") ("esrch" "N-036B1BDB") @@ -660,7 +660,7 @@ ("etypecase" "N-033FBE77") ("eval" "N-0286C8B8") ("eval-only" "N-030BF4F5") - ("evenp" "D-0019") + ("evenp" "D-0007") ("ewouldblock" "N-036B1BDB") ("exception-subtype-map" "N-03ABFA6D") ("exception-subtype-p" "N-02E7F869") @@ -668,15 +668,15 @@ ("exec" "N-02D6C913") ("exit" "N-0006C92F") ("exit*" "N-03592671") - ("exp" "D-0035") + ("exp" "D-0075") ("expand" "N-00EBC996") ("expand*" "N-00EBC996") ("expand-left" "N-00E168FE") ("expand-right" "N-023B6B64") ("expand-with-free-refs" "N-0334827B") ("expander-let" "N-00DBD46D") - ("expt" "D-0076") - ("exptmod" "D-0036") + ("expt" "D-0082") + ("exptmod" "D-000F") ("extproc" "N-0072FF5E") ("f" "N-003BDFA9") ("f$" "N-000B5ACD") @@ -735,12 +735,12 @@ ("file-get-string" "N-02238370") ("file-put" "N-0041C2E5") ("file-put-buf" "N-02AE3A31") - ("file-put-json" "D-0029") - ("file-put-jsons" "D-0080") + ("file-put-json" "D-0023") + ("file-put-jsons" "D-0067") ("file-put-lines" "N-0041C2E5") ("file-put-string" "N-0041C2E5") ("fileno" "N-008ACF75") - ("fill-buf" "D-0028") + ("fill-buf" "D-0044") ("fill-buf-adjust" "N-00D142E1") ("fill-carray" "N-00737951") ("fill-obj" "N-0039A1D1") @@ -749,7 +749,7 @@ ("filter-equal" "N-03136087") ("filter-string-tree" "N-00C9EEB0") ("finalize" "N-01230613") - ("finally" "D-007B") + ("finally" "D-0065") ("find" "N-00C9DFF6") ("find-frame" "N-02B97226") ("find-frames" "N-02B97226") @@ -769,7 +769,7 @@ ("fixnump" "N-03E9D6E1") ("flatcar" "N-01FF2F12") ("flatcar*" "N-01FF2F12") - ("flatten" "D-000D") + ("flatten" "D-0004") ("flatten*" "N-0226672B") ("flet" "N-0209307D") ("flip" "N-0042153F") @@ -790,7 +790,7 @@ ("float" "N-03237030") ("floatp" "N-03E9D6E1") ("flock" "N-004E5B3E") - ("floor" "D-002A") + ("floor" "D-0073") ("floor-rem" "N-02DE978F") ("floor1" "N-01ED20D1") ("flow" "N-02B2153E") @@ -856,7 +856,7 @@ ("functionp" "N-00F6F5F8") ("fuzz" "N-03CAE17D") ("fw" "N-0357AE6F") - ("gather" "D-002B") + ("gather" "D-0045") ("gcd" "N-03D44645") ("gen" "N-0323BEBD") ("gen-hash-seed" "N-002CFA72") @@ -865,10 +865,10 @@ ("gequal" "N-00A3E42D") ("get" "N-03D9F55D") ("get-buf-from-stream" "N-02954B48") - ("get-byte" "D-0067") - ("get-char" "D-0064") - ("get-error" "D-0032") - ("get-error-str" "D-0011") + ("get-byte" "D-0031") + ("get-char" "D-005C") + ("get-error" "D-0024") + ("get-error-str" "D-006B") ("get-fd" "N-011D42AB") ("get-frames" "N-010405DA") ("get-hash-userdata" "N-030B41A7") @@ -876,7 +876,7 @@ ("get-indent-mode" "N-03F3170C") ("get-json" "N-014295FE") ("get-jsons" "N-0124D378") - ("get-line" "D-0018") + ("get-line" "D-0005") ("get-line-as-buf" "N-007FD2F9") ("get-lines" "N-00B65D06") ("get-list-from-stream" "N-021DF087") @@ -937,7 +937,7 @@ ("handle*" "N-03F7D8B5") ("handle-frame" "N-0233BAE3") ("handler-bind" "N-00A4ECC9") - ("hash" "D-0003") + ("hash" "D-003A") ("hash-alist" "N-00C9B125") ("hash-begin" "N-0225209D") ("hash-construct" "N-017E6F4C") @@ -983,7 +983,7 @@ ("identity*" "N-004834CC") ("ido" "N-011CFC0C") ("iexten" "N-0072FF5E") - ("if" "D-001D") + ("if" "D-0020") ("if-match" "N-01BE5C4A") ("ifa" "N-018F39B0") ("iff" "N-000E3A74") @@ -998,7 +998,7 @@ ("imaxbel" "N-02391683") ("improper-plist-to-alist" "N-006E31B5") ("in" "N-016BE41C") - ("in-package" "D-0074") + ("in-package" "D-0019") ("in-range" "N-02C56FB6") ("in-range*" "N-02C56FB6") ("in6addr-any" "N-026A2C3B") @@ -1057,13 +1057,13 @@ ("isec" "N-00DFDE76") ("isecp" "N-00DFDE76") ("isig" "N-0072FF5E") - ("isqrt" "D-0037") + ("isqrt" "D-0010") ("istrip" "N-02391683") - ("iter-begin" "D-002D") - ("iter-item" "D-0005") - ("iter-more" "D-003D") - ("iter-reset" "D-001F") - ("iter-step" "D-0072") + ("iter-begin" "D-0046") + ("iter-item" "D-0001") + ("iter-more" "D-0026") + ("iter-reset" "D-0009") + ("iter-step" "D-0061") ("iterable" "N-01156AE3") ("itimer-prof" "N-02B7882A") ("itimer-real" "N-02B7882A") @@ -1093,10 +1093,10 @@ ("kill" "N-0386CCD5") ("krs" "N-02D33A4D") ("labels" "N-0209307D") - ("lambda" "D-002F") + ("lambda" "D-0074") ("lambda-match" "N-031E43FF") ("lambda-set" "N-02FEBA97") - ("last" "D-0044") + ("last" "D-004E") ("lazy-str" "N-02AFF63D") ("lazy-str-force" "N-03269DEF") ("lazy-str-force-upto" "N-0212FED6") @@ -1114,7 +1114,7 @@ ("ldo" "N-03EF3A27") ("left" "N-020D5C1D") ("len" "N-03AD172A") - ("length" "D-0049") + ("length" "D-0051") ("length-buf" "N-0026D89A") ("length-carray" "N-03FF97BD") ("length-list" "N-01F8186A") @@ -1144,13 +1144,13 @@ ("listp" "N-03F70343") ("lnew" "N-0230059D") ("lnew*" "N-021E6FDC") - ("load" "D-0084") + ("load" "D-0039") ("load-args-process" "N-03D9382A") ("load-args-recurse" "N-03067356") ("load-for" "N-0020A085") - ("load-time" "D-0048") + ("load-time" "D-0078") ("loff-t" "N-01153D9E") - ("log" "D-0046") + ("log" "D-0050") ("log-alert" "N-035D75EC") ("log-auth" "N-0116F48F") ("log-authpriv" "N-0116F48F") @@ -1169,15 +1169,15 @@ ("log-pid" "N-02371913") ("log-user" "N-0116F48F") ("log-warning" "N-035D75EC") - ("log10" "D-0053") - ("log2" "D-0075") - ("logand" "D-000E") - ("logcount" "D-003B") - ("logior" "D-004C") - ("lognot" "D-0010") + ("log10" "D-0056") + ("log2" "D-0063") + ("logand" "D-001E") + ("logcount" "D-004B") + ("logior" "D-007A") + ("lognot" "D-003F") ("lognot1" "N-019541E2") ("logtest" "N-00B1548A") - ("logtrunc" "D-0077") + ("logtrunc" "D-0034") ("logxor" "N-02D5AF97") ("long" "N-0235F4E4") ("long-suffix" "N-00A3183A") @@ -1285,14 +1285,14 @@ ("meq" "N-020A0042") ("meql" "N-020A0042") ("mequal" "N-020A0042") - ("merge" "D-005A") + ("merge" "D-007E") ("merge-delete-package" "N-0160EA2C") ("meth" "N-02C216C3") ("method" "N-022200C1") ("mf" "N-036B6E55") ("min" "N-023C3643") ("minor" "N-02F0F482") - ("minusp" "D-0050") + ("minusp" "D-0055") ("mismatch" "N-03164F4F") ("mkdir" "N-00C543B8") ("mkdtemp" "N-026E4871") @@ -1303,7 +1303,7 @@ ("mlet" "N-008216E0") ("mmakunbound" "N-02964FC0") ("mmap" "N-03C6CE44") - ("mod" "D-0040") + ("mod" "D-0027") ("mode-t" "N-01153D9E") ("mprotect" "N-02805A83") ("ms-async" "N-01F782B2") @@ -1332,7 +1332,7 @@ ("new" "N-0230059D") ("new*" "N-021E6FDC") ("nexpand-left" "N-00E168FE") - ("next" "D-0070") + ("next" "D-005F") ("next-file" "N-00839D2F") ("nf" "N-0267AE6D") ("nil" "N-015134D8") @@ -1343,10 +1343,10 @@ ("nldly" "N-03BD477F") ("nlink-t" "N-01153D9E") ("noflsh" "N-0072FF5E") - ("none" "D-0071") + ("none" "D-005E") ("nor" "N-03662D87") ("norf" "N-00C18907") - ("not" "D-006B") + ("not" "D-0032") ("notf" "N-0026CE18") ("nr" "N-03A7AE6D") ("nreconc" "N-012FF2DC") @@ -1358,7 +1358,7 @@ ("nthcdr" "N-03D71D22") ("nthlast" "N-02FC66FA") ("null" "N-03C679D2") - ("nullify" "D-0008") + ("nullify" "D-0069") ("num-str" "N-028043AE") ("numberp" "N-03E9D6E1") ("nzerop" "N-0197FF9D") @@ -1385,7 +1385,7 @@ ("obtain*-block" "N-0102F0EB") ("obtain-block" "N-01C791D0") ("ocrnl" "N-03BD477F") - ("oddp" "D-003A") + ("oddp" "D-004A") ("ofdel" "N-03BD477F") ("off-t" "N-01153D9E") ("offsetof" "N-013D0A5C") @@ -1417,7 +1417,7 @@ ("opthelp-conventions" "N-010286EC") ("opthelp-types" "N-010286EC") ("opts" "N-01D911E8") - ("or" "D-001A") + ("or" "D-0070") ("orec" "N-0003ED2C") ("orf" "N-01E7D2AD") ("ors" "N-02D33A3D") @@ -1482,7 +1482,7 @@ ("placelet" "N-0393C970") ("placelet*" "N-0393C970") ("plist-to-alist" "N-006E31B5") - ("plusp" "D-0068") + ("plusp" "D-0016") ("poll" "N-0386D39D") ("poly" "N-026201AD") ("pop" "N-017F39D2") @@ -1502,7 +1502,7 @@ ("pprof" "N-018C92AB") ("pred" "N-038E636C") ("prinl" "N-02FCCE0D") - ("print" "D-0047") + ("print" "D-002A") ("prn" "N-01E7F5F7") ("prod" "N-0163FFE2") ("prof" "N-004C9B10") @@ -1529,25 +1529,25 @@ ("ptrdiff-t" "N-01B6F219") ("pure-rel-path-p" "N-019DEA44") ("purge-deferred-warning" "N-0077C4FE") - ("push" "D-007D") + ("push" "D-001B") ("push-after-load" "N-01F489FE") ("pushhash" "N-022660B2") ("pushnew" "N-02C37AB0") - ("put-buf" "D-0082") - ("put-byte" "D-002E") + ("put-buf" "D-0083") + ("put-byte" "D-000D") ("put-carray" "N-00737951") - ("put-char" "D-0002") + ("put-char" "D-003B") ("put-json" "N-009C27EF") ("put-jsonl" "N-009C27EF") ("put-jsons" "N-0124CAE6") ("put-line" "N-012163C3") ("put-lines" "N-0367B282") ("put-obj" "N-025DB229") - ("put-string" "D-007E") + ("put-string" "D-0066") ("put-strings" "N-0367B282") ("pwd" "N-0047F5F6") ("qquote" "N-01665185") - ("qref" "D-006E") + ("qref" "D-0060") ("quantile" "N-0318C018") ("quip" "N-03C6D422") ("quote" "N-0163F998") @@ -1624,8 +1624,8 @@ ("remqual" "N-000ECD82") ("remqual*" "N-00B85CD2") ("rename-path" "N-016EF40C") - ("rep" "D-004F") - ("repeat" "D-006C") + ("rep" "D-0054") + ("repeat" "D-0017") ("replace" "N-035991E1") ("replace-buf" "N-01C59E4E") ("replace-env" "N-03C59E3B") @@ -1634,7 +1634,7 @@ ("replace-struct" "N-01A8343B") ("replace-tree-iter" "N-01225FF3") ("replace-vec" "N-01F59E62") - ("require" "D-0081") + ("require" "D-0038") ("res" "N-03D33A57") ("reset-struct" "N-002A609F") ("rest" "N-02288559") @@ -1669,12 +1669,12 @@ ("rng-" "N-01A056E4") ("rot" "N-025DB962") ("rotate" "N-0166291D") - ("round" "D-0004") + ("round" "D-0068") ("round-rem" "N-02DE978F") ("round1" "N-03EA1351") ("rperm" "N-0188EBDE") - ("rplaca" "D-004E") - ("rplacd" "D-000A") + ("rplaca" "D-0053") + ("rplacd" "D-0003") ("rpoly" "N-026201AD") ("rpos" "N-01F68300") ("rpos-if" "N-01F68300") @@ -1722,7 +1722,7 @@ ("seq-next" "N-02E3D643") ("seq-reset" "N-01CA6912") ("seqp" "N-03C6CAE0") - ("set" "D-0016") + ("set" "D-006E") ("set-cflags" "N-02061924") ("set-hash-userdata" "N-030B40A7") ("set-iflags" "N-02061924") @@ -1804,10 +1804,10 @@ ("sig-winch" "N-0176430F") ("sig-xcpu" "N-0176430F") ("sig-xfsz" "N-0176430F") - ("sign-extend" "D-0033") - ("signum" "D-0012") - ("sin" "D-000B") - ("sinh" "D-0069") + ("sign-extend" "D-0047") + ("signum" "D-003E") + ("sin" "D-006A") + ("sinh" "D-005D") ("sixth" "N-01B0FA33") ("size-t" "N-01B6F219") ("size-vec" "N-01000634") @@ -1858,7 +1858,7 @@ ("sockaddr-un" "N-01DD05D2") ("socklen-t" "N-01153D9E") ("sol-socket" "N-031C01CB") - ("some" "D-0041") + ("some" "D-0028") ("some-false" "N-016BDF48") ("some-true" "N-016BDF48") ("sort" "N-03923640") @@ -1875,22 +1875,22 @@ ("split-str" "N-000386B4") ("split-str-set" "N-0296195B") ("spln" "N-026FC0BD") - ("sqrt" "D-0025") - ("square" "D-0031") + ("sqrt" "D-0072") + ("square" "D-0048") ("ssize-t" "N-01153D9E") ("ssort" "N-03923640") ("sspl" "N-0296195B") ("sssucc" "N-038E636C") ("ssucc" "N-038E636C") ("starts-with" "N-004955D4") - ("stat" "D-005C") + ("stat" "D-002E") ("static-slot" "N-02C47D17") ("static-slot-ensure" "N-02E71F31") ("static-slot-home" "N-01F88B0D") ("static-slot-p" "N-032FD510") ("static-slot-set" "N-0017D1B5") ("stdlib" "N-008E4BC2") - ("str" "D-005E") + ("str" "D-0059") ("str-addr" "N-02E1B78B") ("str-buf" "N-012BF6AD") ("str-d" "N-01736060") @@ -1919,7 +1919,7 @@ ("string-set-code" "N-01CF6D14") ("stringp" "N-00BB392B") ("strsignal" "N-00234BED") - ("struct" "D-001B") + ("struct" "D-0006") ("struct-from-args" "N-01515451") ("struct-from-plist" "N-01515451") ("struct-get-initfun" "N-03946F2A") @@ -1978,8 +1978,8 @@ ("take" "N-00F6D433") ("take-until" "N-01E42C4C") ("take-while" "N-01E42C4C") - ("tan" "D-003C") - ("tanh" "D-0062") + ("tan" "D-004C") + ("tanh" "D-0030") ("tb" "N-02AB6E53") ("tc" "N-029B6E53") ("tcdrain" "N-01AC4760") @@ -2012,14 +2012,14 @@ ("test-set-indent-mode" "N-01A1F89C") ("tf" "N-007E0508") ("third" "N-01B0FA33") - ("throw" "D-0054") + ("throw" "D-002C") ("throwf" "N-015466AD") - ("time" "D-0034") + ("time" "D-0049") ("time-fields-local" "N-00789418") ("time-fields-utc" "N-00789418") ("time-local" "N-001284ED") ("time-nsec" "N-03B6DB3D") - ("time-parse" "D-0066") + ("time-parse" "D-005B") ("time-parse-local" "N-00207C99") ("time-parse-utc" "N-00207C99") ("time-str-local" "N-01711783") @@ -2087,7 +2087,7 @@ ("trim-short-suffix" "N-03CAC692") ("trim-str" "N-00E6E63B") ("true" "N-00373D97") - ("trunc" "D-005D") + ("trunc" "D-007F") ("trunc-rem" "N-02DE978F") ("trunc1" "N-02E91F51") ("truncate" "N-0032FBF3") @@ -2123,8 +2123,8 @@ ("umeth" "N-02ECA31C") ("umethod" "N-000BCBC5") ("uname" "N-0308D954") - ("unget-byte" "D-0007") - ("unget-char" "D-0056") + ("unget-byte" "D-0002") + ("unget-char" "D-0012") ("uni" "N-00DFDE76") ("unintern" "N-01B6BFC2") ("union" "N-01C78B86") @@ -2138,7 +2138,7 @@ ("unless" "N-017EFAB6") ("unquote" "N-036B313D") ("unsetenv" "N-002E0364") - ("until" "D-0027") + ("until" "D-0043") ("until*" "N-01F7BF0B") ("untrace" "N-02833733") ("unuse-package" "N-024BF63F") @@ -2212,7 +2212,7 @@ ("while-match-case" "N-007220BC") ("while-true-match-case" "N-007220BC") ("whilet" "N-0154DC75") - ("width" "D-001C") + ("width" "D-0041") ("width-check" "N-01A9EA49") ("window-map" "N-015AFD48") ("window-mapdo" "N-015AFD48") @@ -2249,6 +2249,6 @@ ("zarray" "N-017039ED") ("zchar" "N-0008D7DC") ("zero-fill" "N-016D3BB5") - ("zerop" "D-003E") + ("zerop" "D-0077") ("zip" "N-03AA85AD") ("znew" "N-00B1FC38")))) @@ -19190,7 +19190,7 @@ replaced by .coNP Function @ eval .synb -.mets (eval < form <> [ env ]) +.mets (eval < form >> [ env <> [ menv ]]) .syne .desc The @@ -19199,12 +19199,36 @@ function treats the .meta form object as a Lisp expression, which is expanded and evaluated. The side effects implied by the form are performed, and the value -which it produces is returned. The optional +which it produces is returned. + +The optional +.meta env +argument specifies an environment for +resolving the function and variable references encountered in +.metn form . +If this argument is omitted, then evaluation takes place in the global +environment. + +The optional +.meta menv +object specifies a macro environment for expanding macros encountered in +.metn form . +If this argument is omitted, then +.meta form +may refer to only global macros. + +If both +.meta menv +and +.meta env +are specified, then +.meta env +takes precedence over +.metn menv , +behaving like a more nested scope. Definitions contained in .meta env -object specifies an environment for -resolving the function and variable references encountered in the expression. -If this argument is omitted, -then evaluation takes place in the global environment. +shadow same-named definitions in +.metn menv . The .meta form @@ -19214,7 +19238,11 @@ is not expanded all at once. Rather, it is treated by the following algorithm: First, if .meta form is a macro, it is macro-expanded as if by an application of the function -.codn macroexpand . +.code macroexpand +(with a suitable environment argument, calculated by a combination of +.meta env +and +.metn menv ). .IP 2. If the resulting expanded form is a .codn progn , @@ -1061,7 +1061,7 @@ int txr_main(int argc, char **argv) if (forms != colon_k) eval_intrinsic(cons(progn_s, forms), - make_env(bindings, nil, nil)); + make_env(bindings, nil, nil), nil); } evaled = t; @@ -1093,7 +1093,7 @@ int txr_main(int argc, char **argv) obj = eval_intrinsic(lisp_parse(arg, std_error, colon_k, lit("cmdline-expr"), colon_k), - make_env(bindings, nil, nil)); + make_env(bindings, nil, nil), nil); gc_hint(obj); pf(z(obj), std_output); diff --git a/y.tab.c.shipped b/y.tab.c.shipped index 50fb9410..31da32e7 100644 --- a/y.tab.c.shipped +++ b/y.tab.c.shipped @@ -4062,7 +4062,7 @@ yyreduce: expand_forms(rest((yyvsp[(1) - (1)].val)), nil)), (yyvsp[(1) - (1)].val)); else if (sym == mdo_s) - { eval_intrinsic(cons(progn_s, cdr((yyvsp[(1) - (1)].val))), nil); + { eval_intrinsic(cons(progn_s, cdr((yyvsp[(1) - (1)].val))), nil, nil); (yyval.val) = cons(do_s, nil); } else { (yyval.val) = match_expand_elem((yyvsp[(1) - (1)].val)); @@ -7715,7 +7715,7 @@ static val check_parse_time_action(val spec_rev) return nappend2(nreverse(include(line)), rest(spec_rev)); } if (sym == in_package_s) { - eval_intrinsic(elem, nil); + eval_intrinsic(elem, nil, nil); return nil; } } |