| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(op_prof, me_pprof): New static functions.
(eval_init): Intern prof symbol, store in prof_s.
Captured interned + symbol in plus_s. Register prof operator and pprof
macro.
* gc.c (gc_bytes): New global variable.
(more): Use nse function chk_malloc_gc_more instead of chk_malloc.
(make_obj): Increment gc_bytes.
* lib.c (malloc_bytes): New global variable.
(chk_malloc, chk_realloc): Increment malloc_bytes.
(chk_calloc): Bugfix: incorrect size in recursion into oom_realloc.
Incorrect calculation of malloc_high_bound. Increment malloc_bytes.
(chk_malloc_gc_more): New function.
* lib.h (alloc_bytes_t): New typedef.
(malloc_bytes, gc_bytes): Declared.
(chk_malloc_gc_more): Declared.
* stream.c (format_s): New symbol global.
(stream_init): format_s inited.
format_s used to register formatv function.
* stream.h (format_s): Declared.
* txr.1: Documented prof and pprof.
* genvim.txr: Recognize reg_fun calls with intern
followed by a preceding assignment or other syntax.
* txr.vim: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
moved to filter.c.
* filter.c (trie_compress_intrinsic, html_encode, html_decode): New
static functions.
(filter_init): Register make_trie, trie_add, trie_compress_intrinsic,
filter_string_tree, filter_equal, html_encode and html_decode
as intrinsics. Move registration of url_encode and url_decode here.
* genvim.txr: Look for registrations in filter.c too.
* txr.1: Documented.
* txr.vim: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.h (apply_intrinsic, lazy_mapcar): Declarations added.
* stream.c (open_files, open_file_star): New functions.
(stream_init): Registered new functions as intrinsics.
* txr.1: Documented open-files and open-files*. Added to make-catenated-stream documentation.
* genvim.txr: Replace bunch of code with open-files.
* txr.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (env_k): Duplicate global variable definition removed.
* lib.c (vector, vec_set_length): Fixed signed/unsigned comparison
warnings.
* stream.h (stdin_s, stdout_s, stddebug_s, stderr_s, stdnull_s):
Declarations were definitions due to missing extern.
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): logten registered as intrinsic.
* lib.h (logten): Declared.
* txr.1: Documented.
|
|
|
|
|
|
| |
(eval_init): Register new intrinsics make-env, env-fbind and env-vbind.
* txr.1: Documented.
|
|
|
|
|
|
| |
the variable as special at expansion time. Without this, binding
forms in other parts of the tree won't be expanded properly
to bring about the special semantics.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
expander. One macro based on sys:qquote, sys:unquote and sys:splice,
and the other based on qquote, unquote and splice in the user package.
The read syntax puts out the sys: one.
* eval.c (expand_qquote): Takes three additional arguments: the
qquote, unquote and splice symbols to recognize.
The invalid splice diagnostic is adjusted based on which backquote
we are expanding.
(me_qquote): Look at the symbol in the first position of the form
and then expand either the internal quasiquote macro or the public one,
passing the right symbols into expand_qquote.
(eval_init): Register error-throwing stub functions
for the sys_qquote_s, sys_unquote_s and sys_splice_s symbols.
Register a macro for sys_qquote_s.
* lib.c (sys_qquote_s, sys_unquote_s, sys_splice_s): New symbol
variables.
(obj_init): Initialize new variables. Change qquote_s,
unquote_s and splice_s to user package.
(obj_print, obj_pprint): Convert only sys_qquote_s,
sys_unquote_s and sys_splice_s to the read syntax.
The quote_s, unquote_s and splice_s symbols are not
treated specially.
* lib.h (sys_qquote_s, sys_unquote_s, sys_splice_s): Declared.
* parser.y (n_expr): Use sys_qquote_s, sys_unquote_s and
sys_splice_s rather than qquote_s, unquote_s and splice_s.
(unquotes_occur): Likewise.
* txr.1: Documented.
|
|
|
|
|
|
| |
atom that comes out of recursive call, wrapped in (quote ...),
resulting in '(,a . b) expanding to (append 'a . quote b)
rather than (append (list 'a) (quote b)); i.e. (append (list 'a) 'b).
|
|
|
|
|
| |
environment at all, and still had vestiges of support for the the old
cptr based global variables.
|
|
|
|
|
| |
(expand): Use maybe-quote form macro-time, to not quote
result unnecessarily.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Save *gensym-counter* symbol in gensym_counter_s
symbol variable right after interning, and use zero as the inital value
rather than the gensym_counter variable which is removed now.
* lib.c (gensym_counter_s): New symbol variable.
(gensym_counter): Variable removed.
(gensym): Slight refactoring to avoid a double variable lookup.
Also, for generational GC correctness, use the set macro to update it,
since the variable could live inside heap object and the counter
could overflow to bignums which are heap objects.
(obj_init): Remove initialization of gensym_counter.
* lib.h (gensym_counter_s): Declared.
(gensym_counter): Declaration removed, replaced by macro.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
re-binding. C code now has to go through the dynamic environment lookup
to access things like *random-state*, or *stdout*. As part of this,
I'm moving some intrinsic variable and function initializations out of
eval.c and into their respective modules. Macros are are used to make
global variables look like ordinary C variables. This is very similar
to the errno trick in POSIX threads implementations.
* eval.c (looup_var, lookup_var_l): Restructured to eliminate silly
goto, the cobjp handling is gone.
(reg_fun, reg_var): Internal function becomes external.
reg_var registers a simple cons cell binding now, without any
C pointer tricks to real C global variables.
(c_var_mark): Static function removed.
(c_var_ops): Static struct removed.
(eval_init): Numerous initializations for streams, syslog, rand,
signals and others moved to their respective modules.
The new symbol variables user_package_s, keyword_package_s
and system_package_s are interned here, and the variables are
created in a special way.
* eval.h (reg_var, reg_fun): Declared.
* gc.c (prot1): Added assert that the loc pointer isn't null.
This happened, and blew up during garbage collection.
* lib.c (system_package, keyword_package, user_package): Variables
removed these become macros.
(system_package_var, keyword_package_var, user_package_var): New
global variables.
(system_package_s, keyword_package_s, user_package_s): New
symbol globals.
(get_user_package, get_system_package, get_keyword_package): New
functions.
(obj_init): Protect new variables. Initialization order of modules
tweaked: the modules sig_init, stream_init, and rand_init are moved
after eval_init because they register variables.
* lib.h (keyword_package, system_pckage, user_package): Variables
turned into macros.
(system_package_var, keyword_package_var, user_package_var): Declared.
(system_package_s, keyword_package_s, user_package_s): Declared.
(get_user_package, get_system_package, get_keyword_package): Declared.
* rand.c (struct random_state): Renamed to struct rand_state to
avoid clash with new random_state macro.
(random_state): Global variable removed.
(random_state_s): New symbol global.
(make_state, rand32, make_random_state, random_fixnum, random):
Follow rename of struct random_state.
|
|
|
|
|
|
|
|
|
|
|
|
| |
variable is defined.
(op_defsymacro): Remove the same-named variable when a symbol macro is
defined.
(op_defun): Throw excpetion if an attempt is made to define a
special operator as a function. Remove the same-named macro when a
function is defined.
(op_defmacro): Throw excpetion if an attempt is made to define a
special operator as a macro. REmove the same-named function
when a macro is defined.
|
|
|
|
|
|
|
|
| |
is generating (append (list x) . y) instead of (append (list x) y).
Also, added a nil case which is now necessary to prevent
'(,x) from generating (append (list x) nil), though this is
effectively an optimization, which is pointless, since
the expander isn't optimizing overall.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (expand_vars): Expand vars needs to know whether it's
handling a sequential (let*-like) or parallel (let-like) binding.
The init form of a variable sees the previous macro environment,
but that variable must, for the remaining variables, shadow any
previous symbol macro.
(expand): In expand we must inform expand_vars whether we have
a sequential or parallel binding construct. Moreover, there was
a huge bug here: the new_menv (with the shadows) was passed to
expand_vars, so that all the variables were hiding same-named
symbol macros from all their initforms.
|
|
|
|
|
|
|
|
| |
(eval_init): Initialiation of delay_s removed.
Symbol now interned in reg_mac call for registering me_delay .
* genvim.txr: Updated to recognize a reg_mac call
with intern.
|
|
|
|
|
|
|
|
| |
* lib.h (copy): Declared.
* eval.c (eval_init): Registered copy function as intrinsic.
* txr.1: Added missing documentation for length. Documented copy.
|
|
|
|
|
| |
(expand_macrolet, expand_symacrolet): Use maybe_progn
to eliminate unnecessary progn wrapping.
|
|
|
|
|
|
|
|
| |
(me_gun): New static function.
(eval_init): New gun symbol interened, me_gun registered
as intrinsic macro.
* txr.1: Documented gun.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
formal macros that are in the top_mb table, make their symbols
fboundp and can be expanded with macroexpand.
* eval.c (mefun_t): New typedef name.
(expand_macro): If the expander is a cobj, then pull out the C function
and call it, otherwise realize the interpreted macro as before.
(me_gen, me_delay): New static functions, replace expand_gen
and expand_delay.
(expand_qquote): Renamed to me_quote.
(expand_gen, expand_delay): Renamed to me_gen and me_delay,
with an interface adjustment and moved.
(expand_op): Renamed to me_op.
(expand): Removed qquote, gen, delay, op, and do handling, since
these operators are now macros.
Removed the unnecessary expansion of with-saved-vars.
(reg_op, reg_fun): Assert that the symbol is not nil, to catch
initialization order issues. One just showed up: op_do was
interned in match.c, which is initialized later.
(reg_mac): New static function
(eval_init): Intern do_s, because match.c hasn't done it yet
at this point. Register me_gen, me_delay, me_op (twice) and me_qquote
as intrinsic macros.
* txr.1: Documented those operators as macros.
|
|
|
|
|
| |
(eval_init): Register operators with reg_op instead of direct sethash
calls.
|
|
|
|
| |
dispatching function, so it is not clobbered by argument evaluations.
|
|
|
|
|
|
|
|
|
|
|
|
| |
dwim_body, since the append2 copies list structure.
* parser.y (n_exprs): propagate source loc info from both
constituents, giving precedence to the left one, rather than just taking
it from the left one and ignoring the second constituent. This fixes
cases of missing location info. The left constituent n_expr is often
a symbol, and those do not have location info. We want a case like
like ((x) y) to take from (x), and (x (y)) to take it from (y),
and so on.
|
|
|
|
|
|
|
|
|
|
|
|
| |
It was handling silly special cases with the net effect of being
nearly equivalent to just expand, while failing to expand places
which are compound macro calls. It did diagnose nonexistent place
types at expansion time, which isn't worth much.
(expand): All the expansions for the mutating operator sset, inc, dec,
push, pop and flip were also pointless and have been removed. they did
the precise equivalent of doing expand(rest(form)), and consing the
symbol to the front, which is the fallback case for function call
forms.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
mkdir and mknod.
* eval.c (eval_init): Wrap #ifdefs around the registrations of
the wrappers for these functions.
* stream.c (mkdir_wrap): Wrap in #ifdef HAVE_MKDIR, and
provide a Windows version if HAVE_MKDIR is missing, but
HAVE_WINDOWS_H is true.
(makedev_wrap, major_wrap, minor_wrap): Wrap with #if HAVE_MAKEDEV.
(mknod): Use #if HAVE_MKNOD.
(symlink_wrap, link_wrap, readlink_wrap): Wrap with #if HAVE_SYMLINK.
|
|
|
|
|
|
|
|
| |
* stream.c (symlink_wrap, link_wrap, readlink_wrap): New functions.
* stream.h (symlink_wrap, link_wrap, readlink_wrap): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Register mkdir_wrap, chdir_wrap, getcwd_wrap, makedev_wrap, minor_wrap,
major_wrap and mknod_wrap.
* stream.c (mkdir_wrap, chdir_wrap, getcwd_wrap, makedev_wrap,
minor_wrap, major_wrap, mknod_wrap): New functions.
(stream_init): Initialize forgotten variable s-ifsock.
* stream.h (s_ifsock): Declared.
(mkdir_wrap, chdir_wrap, getcwd_wrap, makedev_wrap,
minor_wrap, major_wrap, mknod_wrap): Declared.
* txr.1: Forgotten documentation for remove-path and rename-path
added. Forgotten mention of s-ifsock. Documented new Unix functions.
|
|
|
|
|
|
|
|
|
| |
in the dotted position: (qquote x1 .. xn . (unquote form)),
which looks like the structure (qquote x1 .. xn unquote form).
Fixed by a hack: after recursively expanding the (unquote form)
part (rest of the form), we check whether the unexpanded
version has unquote at the front. If so, we know the expansion is just
form, and use it to emit the suitable expansion.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (top_smb, defsymacro_s, symacrolet_s): New global variables.
(lookup_symac, get_opt_param_syms, get_param_syms, op_defsymacro,
expand_symacrolet, make_var_shadowing_env): New static functions.
(expand_tree_cases, expand_catch_clause): Install shadowing environment
so lexical bindings hide any symbol macrolets.
(expand_place): Fix neglect to expand an atomic form, which breaks
symbol macros used as places.
(expand): Expand symbol macros, expand symacrolet binding forms.
Make sure symbol macros are shadowed in the lexical binding
constructs. Take advantage of return value of rlcp_tree in a
few places.
(macro_form_p): Support for symbol macros; bugfix: not handling
default argument.
(macroexpand_1): Streamlined, and support added for symbol macros.
(eval_init): Protect top_smb from gc. Create new hash, stored in
top_smb. Initialize defsymacro_s and symacrolet_s.
Register op_defsymacro.
* parser.y (rlcp_tree): Return the to form instead of useless t and nil.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
a much more useful return value: the binding cell itself,
rather than the symbol.
(bind_args): Bugfix: env_vbind was still being called in one case,
leading to a neglect to bind a special variable properly.
(bindings_helper): Changed interface. Bugfix: in sequential binding,
actually bind the successive environments so closures will behave
100% correctly. Returns a list of the actual bindings, in which
special variables are not distinguished in any way.
(op_let, op_for): Conform to new bindings_helper interface. Use the
lexical environment that it returns instead of making a new one.
(op_each): Use the environment and list of bindings out of
bindings_helper. The bindings are used for stepping the lists,
and that includes stepping any special vars. The lexical environment
is used for evaluating the body. Thus, we need no special processing
for special vars here any more.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
rather than just assign to them. Got rid of the superfluous variable
saving array. Fixed the problem in recognizing the special_s symbol (it
is bindable).
(op_with_saved_vars): This simplifies, since it no longer needs
to save individual variables in an array, only to set up and
tear down a new dynamic environment frame.
(expand_vars): No longer returns two values with a cons.
Takes a form argument for error reporting and a pointer to a boolean
just to report whether there are special vars without listing them.
(expand_save_specials): The with-saved-specials form doesn't need
a var list any more, so the expander is updated not to stick them in.
(expand): Update calls to expand_vars to new interface.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
parameter lists.
There is a bugfix here too (see eval_init below).
* eval.c (special_s): New global variable. This symbol is used
as a marker in parameter lists denoting expander-generating
syntax that gives information about specials.
(lookup_var, looup_var_l): Bugfix: walk the dynamic chain properly.
Fallback from the lexical chain to the dynamic.
(env_vbind_special): New static function.
(bind_args, bind_macro_params): Detect special list in params. Use
env_vbind_special to bind variables either in the dynamic environment
or the lexical one.
(expand_opt_params, expand_params): Renamed to expand_opt_params_rec
and expand_params_rec, respectively. Now take extra argument for
accumulating list of special variables found in the param list.
(expand_params): New static function.
(set_dyn_env): New static function.
(interp_fun, expand_macro): Set up and tear down new dynamic
environment around parameter list evaluation and body evaluation. This
will take any new dynamic bindings.
(bindings_helper, op_each): The special_s symbol is now used instead of
colon_k for marking specials.
(op_defun): Recognize the specials added to the parameter list
so as not to t report that as not a bindable symbol.
(op_catch): Set up an tear down new dynamic environment around
the evaluation of the catch clause param binding and body.
(expand_vars): use colon_s symbol instead of colon_k for marking
special var.
(eval_init): Bugfix: gc-protect recently added dyn_env variable.
Intern special symbol into special_s variable.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Saving and restoring of individual variables is very silly
and it's making it difficult to implement function parameters
that are rebindings of special variables.
Let's have a global pointer to a dynamic environment called dyn_env.
Let's make it part of the extended_jmp_buf structure, so that it's
implicitly saved and restored across exception handling.
Special variable lookups go through the dyn_env chain, and fall back on
the global bindings.
To override some specials, we just push a new dynamic environment and
stick them there. (As a bonus, the bindings can even be repeated in the
lexical environment (i.e. the same objects), so they can be found
faster. We have to make sure we remove that environment when we
leave the scope in the normal way. If we unwind out, it is done
automatically by extended_longjmp mechanism.
* eval.c (dyn_env): New global variable.
(lookup_var, lookup_var_l): If env is nil, look in the dyn_env
first, and only if that fails, look in the global bindings top_vb.
* signal.h (extended_jmp_buf): New member, de, for saving/restoring
dyn_env. This structure is now used whether or not we have signals.
(extended_setjmp, extended_longjmp): Updated to save and restore
dyn_env, and to do it regardless of whether there is POSIX signal
support.
(dyn_env): Declared here.
|
|
|
|
|
|
|
|
|
|
|
| |
function lookup fails, and if that fails, retrieve the special
operator binding.
(fboundp): Report t if there is a global macro binding.
* txr.1: Use "global" rather than "toplevel". Added note that
the fun operator doesn't see macro bindings. Documented that
symbol-function and fboundp see global macro bindings,
and that symbol-function can retrieve a special operator binding.
|
|
|
|
|
|
| |
(eval_init): Registered as intrinsics.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
here if the env parameter is nil. The low level environment
lookup functions already handle nil.
(do_eval): Do not type check the env argument for the ENV type.
(expand_forms, expand): No need to default a missing menv to a
blank environment; just use nil.
(macro_form_p): Take menv parameter and switch to lookup_mac
from gethash.
(macroexpand_1, macroexpand): Use the environment parameter
by using lookup_mac rather than gethash.
(eval_init): Fix registration of macro_form_p to reflect new
optional argument.
* txr.1: Documented optional environment parameters in macro-form-p,
macroexpand-1 and macroexpand.
Documented macrolet.
|
|
|
|
|
|
|
|
|
| |
* eval.c (macrolet_s): New variable.
(lookup_mac, expand_macrolet): New static functions.
(expand): Recognize and expand macrolet form.
use lookup_mac to resolve macros rather than gethash,
since we have lexical macros now.
(eval_init): Intern macrolet symbol.
|
|
|
|
| |
Rename mac_env variable to menv for consistency.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
environment down through the expander call hierarchy.
* eval.c (expand_opt_params, expand_params, expand_tree_cases,
expand_tree_case, expand_forms, val expand_cond_pairs, val
expand_place, expand_qquote, expand_vars, expand_quasi, expand_op,
expand_catch_clause, expand_catch, expand): All expanders get new
parameter, menv. expand_forms and expand handle a nil value of menv.
(eval_intrinsic): Pass nil macro environment to expand.
(eval_init): Update intrinsic registration for expand.
* eval.h (expand, expand_forms): Declarations updated.
* parser.y (expand_meta): Gets macro env parameter.
(elem, o_elem, exprs, expr): Pass nil to expand_forms and expand_meta.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
with just using the == operator.
Removing cobj_equal_op since it's indistinguishable from eq.
Streamlining missingp and null_or_missing_p.
* eval.c (transform_op): eq to ==.
(c_var_ops): cobj_equal_op to eq.
* filter.c (trie_compress, trie_lookup_feed_char, filter_string_tree,
html_hex_continue, html_dec_continue): eq to ==.
* hash.c (hash_iter_ops): cobj_equal to eq.
* lib.c (countq, getplist, getplist_f, search_str_tree,
posq): eq to ==.
(cobj_equal_op): Function removed.
* lib.h (cobj_equal_op): Declaration removed.
(missingp): Becomes a simple macro that yields a C boolean instead
of t/nil val, because it's only used that way.
(null_or_missing_p): Becomes inline function returning int.
* match.c (v_output): eq to ==.
* rand.c (random_state_ops): cobj_equal_op to eq.
* regex.c (char_set_obj_ops, regex_obj_ops): cobj_equal_op to eq.
(reg_derivative): Silly if3 expression replaced by null.
(regexp): Redundant if2 expression wrapped around eq removed.
* stream.c (null_ops, stdio_ops, tail_ops, pipe_ops, string_in_ops,
byte_in_ops, string_out_ops, strlist_out_ops, dir_ops,
cat_stream_ops): cobj_equal_op to eq.
* syslog.c (syslog_strm_ops): cobj_equal_op to eq.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
used global variable null which holds a symbol becomes null_s.
A new macro called nilp is added that more efficiently checks whether
an object is nil, producing a C boolean value rather than t or nil.
Most of the uses of nullp in the codebase just become the more
streamlined nilp.
* debug.c (show_bindings): nullp to nilp
* eval.c (lookup_var, lookup_var_l, lookup_fun, lookup_sym_lisp1,
do_eval, expand_qquote, expand_quasi, expand_op): nullp to nilp.
(op_modplace): nullp to null.
(eval_init): Update registration of null and not from C function
nullp to null.
* filter.c (trie_compress, html_hex_continue): nullp to nil.
(filter_string_tree): null to null_s.
* hash.c (hash_next): nullp to nilp.
* lib.c (null): Variable renamed to null_s.
(code2type): null to null_s.
(lazy_flatten_scan, chainv, lazy_str, lazy_str_force_upto,
obj_print, obj_pprint):
nullp to nilp.
(obj_init): null to null_s; nullp to null.
* lib.h (null): declaration changed to null_s.
(nullp): Inline function renamed to null.
(nilp): New macro.
* match.c (do_match_line): nullp to nilp.
* rand.c (make_random_state): Likewise.
* regex.c (compile_regex): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
All predefined globals become special.
* eval.c (special, with_saved_vars_s): New global variables.
(mark_special, special_p): New functions.
(bindings_helper): Takes new argument, include_specials.
Now processes the special colon syntax for denoting special variables,
setting up their values, taking care to observe whether the
binding is parallel or sequential.
(op_let, op_for): Pass new argument to bindings_helper.
(op_each): Pass new argument to bindings_helper with a value of it,
and deal with the colon annotations that emerge in the bindings.
(op_defvar, regvar): Mark symbol as special.
(op_with_saved_vars): New static function.
(expand_vars): Takes new argument, returns a cons. Detects special
variables among the vars and produces the colon syntax.
(expand_catch_clause): Bugfix: this was using expand_vars on
a parameter list. Now properly uses expand_params.
(expand_save_specials): New static function.
(expand): For the operators that are binding constructs, handle
the new form of expand_vars which returns information about
special variables. If specials occur, then generate the
with-saved-vars form around the expansion which will save and restore
their values. The expansion of vars done by expand_vars, together
with the run-time actions of bindings_helper, do the rest.
Speaking of which, the new with-saved-vars operator form is now
expanded here too.
(eval_init): Protect new variables special and with_saved_vars_s.
Initialize special with new hash table. Store new interned
symbol in with_saved_vars_s. Register op_with_save_vars in op_table.
* txr.1: Documented specials.
|
|
|
|
|
|
| |
to eval_error call. This is a leftover from when this was cloned
from its counterpart in match.c. However, I can't think of a way
this call can ever be reached.
|
|
|
|
|
|
|
| |
functions.
(eval_init): Registered new functions.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(eval_init): Register env and env_hash functions. Register prog_args
and prog_args_full as *args* and *full-args*.
* lib.c (timegm_hack): Invalidate env_list, after mucking with
the environment via setenv and unsetenv.
* txr.c (prog_args_full, prog_args): New global variables.
(txr_main): Command-line processing converted to use TXR's
library. Populates prog_args_full and prog_args.
* txr.h (prog_args_full, prog_args): Declared.
* txr.1: Documented *args*, *full-args*, env and env-hash.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Change registration for open_file, open_tail
and open_command.
* stream.c (open_file, open_tail, open_command): mode_str argument
defaulted.
* txr.1: Updated.
|
|
|
|
| |
Fix sybol misspelling.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
intrinsic, rather than gensymv.
Register gensym_counter as *gensym-counter*.
* lib.c (gensym): Handle missing prefix argument by defaulting
the prefix to "g".
(gensymv): Function removed.
* lib.h (gensymv): Declaration removed.
* txr.1: Fixed omission: missing documentation for gensym.
Documented *gensym-counter*.
|