summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* * eval.c (expand_qquote): Another bugfix: not recognizing a trailingKaz Kylheku2014-03-012-1/+10
| | | | | | 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).
* * eval.c (lookup_sym_lisp1): Bugfix: wasn't following the dynamicKaz Kylheku2014-03-012-25/+31
| | | | | environment at all, and still had vestiges of support for the the old cptr based global variables.
* * Makefile: Use target-specific assignmentKaz Kylheku2014-02-282-0/+8
| | | | | to suppress TXR_DBG_OPTS for tests under tests/011. The --gen-gc makes mandel.txr run too slow.
* * eval.c (self_evaluating_p, maybe_quote): New functions.Kaz Kylheku2014-02-282-1/+27
| | | | | (expand): Use maybe-quote form macro-time, to not quote result unnecessarily.
* * tests/011/mandel.expected: New file.Kaz Kylheku2014-02-283-0/+129
| | | | * tests/011/mandel.txr: New file.
* Turn *gensym-counter* into proper special variable.Kaz Kylheku2014-02-284-6/+26
| | | | | | | | | | | | | | | | | * 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.
* Change in the design of how special variables work, to fix the brokenKaz Kylheku2014-02-2818-386/+386
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* * eval.c (op_defvar): Remove the same-named symbol macro when aKaz Kylheku2014-02-282-0/+24
| | | | | | | | | | | | 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.
* * eval.c (expand_qquote): Fix broken '(,x . ,y) case, whichKaz Kylheku2014-02-282-2/+13
| | | | | | | | 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.
* * tests/010/output-clauses.expected: New file.Kaz Kylheku2014-02-283-0/+84
| | | | * tests/010/output-clauses.txr: New file.
* About time for some new regression tests.Kaz Kylheku2014-02-287-0/+90
| | | | | | | | | | | | | | * tests/011/macros-1.expected: New file. * tests/011/macros-1.txr: New file. * tests/011/macros-2.expected: New file. * tests/011/macros-2.txr: New file. * tests/011/special-1.expected: New file. * tests/011/special-1.txr: New file.
* Bugfixing semantics of symbol macro hiding by variable bindings.Kaz Kylheku2014-02-282-6/+31
| | | | | | | | | | | | | * 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.c (delay_s): Global variable removed.Kaz Kylheku2014-02-273-3/+13
| | | | | | | | (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.
* * txr.1: Improved documentation for the dwim operator.Kaz Kylheku2014-02-272-12/+32
|
* differently, not different.Kaz Kylheku2014-02-271-1/+1
|
* Fix naked backslashes to \e. I could have sworn I did this recently.Kaz Kylheku2014-02-271-18/+18
|
* Typos.Kaz Kylheku2014-02-271-2/+2
|
* Version 82.txr-82Kaz Kylheku2014-02-276-114/+174
|
* * txr.1: Typos, grammar and formatting fixes mailed inKaz Kylheku2014-02-272-11/+16
| | | | by Roman Mishin.
* * parser.l: Regression: valid floating-point literals taggedKaz Kylheku2014-02-272-9/+15
| | | | | as having trailing junk. The fix is to put the junk-matching rule after the valid rules.
* * lib.c (copy): New function.Kaz Kylheku2014-02-275-2/+57
| | | | | | | | * lib.h (copy): Declared. * eval.c (eval_init): Registered copy function as intrinsic. * txr.1: Added missing documentation for length. Documented copy.
* Make note of a recent change in semantics affecting mapcar over strings.Kaz Kylheku2014-02-271-4/+10
|
* Capitalization of TXR.Kaz Kylheku2014-02-272-3/+3
|
* * genvim.txr: Updated with regard to how operators are registered inKaz Kylheku2014-02-273-106/+115
| | | | | | | in eval_init. Also, scans reg_mac registrations now. * txr.vim: Refreshed. The previously missed "delay" operator is now listed, thanks to reg_mac.
* * eval.c (maybe_progn): New function.Kaz Kylheku2014-02-272-2/+14
| | | | | (expand_macrolet, expand_symacrolet): Use maybe_progn to eliminate unnecessary progn wrapping.
* * eval.c (gun_s): New global variable.Kaz Kylheku2014-02-263-2/+51
| | | | | | | | (me_gun): New static function. (eval_init): New gun symbol interened, me_gun registered as intrinsic macro. * txr.1: Documented gun.
* Converting expander special case code transformations intoKaz Kylheku2014-02-263-65/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.c (reg_op): New static function.Kaz Kylheku2014-02-262-45/+56
| | | | | (eval_init): Register operators with reg_op instead of direct sethash calls.
* * lib.c (make_like): If the first element of list isn'tKaz Kylheku2014-02-262-1/+10
| | | | | | a character, then don't try to make it into a string; keep it as a list. This allows [mapcar list "abc" "def"] to work intuitively rather than blow up.
* * lib.c (lit_s): New symbol.Kaz Kylheku2014-02-262-5/+16
| | | | | | | (code2type): Return lit_s for LIT type. (typeof): Return lit_s for TAG_LIT. (replace_str): Error message wording. (obj_init): lit_s interned.
* * eval.c (do_eval): Set last_form_evaled just beforeKaz Kylheku2014-02-262-2/+8
| | | | dispatching function, so it is not clobbered by argument evaluations.
* * eval.c (expand_op): Use rlcp_tree when constructing theKaz Kylheku2014-02-263-11/+27
| | | | | | | | | | | | 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.
* * parser.y (list): For @n_expr, get the source location infoKaz Kylheku2014-02-262-3/+13
| | | | | | | from the @ token. (n_expr): Bugfix: do not attribute a symbol with location info. (quasilit): Obtain location info from quasi_items, and only if that is unavailable, then from lineno.
* Version 81txr-81Kaz Kylheku2014-02-266-112/+214
| | | | | | | | | | * txr.c (version): Bumped. * txr.1: Bumped version and set date. * configure (txr_ver): Bumped. * RELNOTES, txr.vim: Updated.
* * parser.l (regex_parse, lisp_parse): Better formattingKaz Kylheku2014-02-262-2/+7
| | | | for the context string that serves in place of a filename.
* * eval.c (expand_place): Unnecessary, buggy function removed.Kaz Kylheku2014-02-262-78/+16
| | | | | | | | | | | | 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.
* * configure: Make it an error to have implicit function declarations byKaz Kylheku2014-02-253-10/+35
| | | | | | | | | | | means of -Werror=implicit-function-declarations. Fix broken mkdir and mknod tests. Regenerate config.make if we add -U__STRICT_ANSI__ to the compiler options, so that later tests benefit from this. Regenerate config.make right away if adding -D_DARWIN_C_SOURCE. This allows the makedev test to pass. * stream.c: Include <sys/types.h> for makedev. (mknod_wrap): Don't rely on makedev wrappers to be there; test.
* * parser.y (spec): Bugfix: SECRET_ESCAPE_E should use n_exprKaz Kylheku2014-02-252-12/+31
| | | | | | | | | | | | not expr. expr is subject to expand_meta. (n_expr): Do not associate source info with character literals. (expand_meta): Bugfix: when walking forms in a collecting loop, propagate the source info to them. Bugfix: attach source info to var and expr expansions. (rl): Rewritten in terms of rlset. (rlset): Only set source info for an object that doesn't already have it.
* * lib.c (obj_init): Revert qquote, unquote and spliceKaz Kylheku2014-02-253-22/+37
| | | | | | to the system namespace, for hygiene. * txr.1: Updated.
* * eval.c (eval_init): HAVE_MAKEDEV not HAVE_MKDEV.Kaz Kylheku2014-02-252-1/+5
|
* * stream.c (getcwd_wrap): Implement correct test of getcwd'sKaz Kylheku2014-02-252-1/+7
| | | | return value.
* * configure: Use -Werror= on the missing prototypes andKaz Kylheku2014-02-252-1/+6
| | | | strict prototypes warnings; these should be errors.
* * configure: Added feature tests for makedev, link/symlink/readlink,Kaz Kylheku2014-02-254-3/+138
| | | | | | | | | | | | | | 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.
* * debug.c (debug): Fix 2013-12-02 regression, which leaves theKaz Kylheku2014-02-242-1/+9
| | | | debugger not printing the current line of data.
* * eval.c (eval_init): Intern symlink_wrap, link_wrap, readlink_wrap.Kaz Kylheku2014-02-245-1/+110
| | | | | | | | * stream.c (symlink_wrap, link_wrap, readlink_wrap): New functions. * stream.h (symlink_wrap, link_wrap, readlink_wrap): Declared. * txr.1: Documented.
* * eval.c (eval_init): Register forgotten s_ifsock variable.Kaz Kylheku2014-02-245-5/+263
| | | | | | | | | | | | | | | | 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.
* * parser.l: Support octal and binary numbers.Kaz Kylheku2014-02-245-0/+65
| | | | | | * txr.1: Documented. * genvim.txr, txr.vim: Updated.
* * parser.y (modifiers): Bugfix: list element not subject to expansionKaz Kylheku2014-02-242-3/+24
| | | | | | of Lisp forms denoted by @. (expand_meta): Bugfix: failure to expand vars, which can be symbol macros now.
* * genvim.txr, txr.vim: Updated.Kaz Kylheku2014-02-242-102/+103
|
* * lib.c (obj_print, obj_pprint): Render quasi-quote hash andKaz Kylheku2014-02-243-8/+36
| | | | | | | | | | | | vector literals using their original notation. * parser.y (unquotes_occur): Takes new argument, level. Only finds quotes which are at the given quasiquoting level. Finally, this is the right semantics. In the first version of this function, we were not eager enough: we neglected to find unquotes that were wrapped in nested quasiquotes. Then we were too eager: finding any unquotes, even ones belonging to the inner backquotes. (vector, hash, choose_quote): Pass zero to unquotes_occur function.