| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Remove all regex-related function
registrations from here.
* regex.c (regex_init): Move regex-related function
registrations here.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register split-str to split_str_keep,
with optional argument.
* lib.c (split_str_keep): New function, formed from
split_str, with third argument.
(split_str): Reduced to wrapper around split_str_keep.
Thus we don't have to update umpteen existing calls
with an extra nil parameter.
* lib.h (split_str_keep): Declared.
* txr.1: Documented new optional argument of split-str.
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (me_while, me_until, me_while_star, me_until_star):
Functions removed.
(me_while_until, me_while_until_star): New functions.
Here we just check the form symbol and add the negation
to the test. Also: use of (zap flag) in the while* and until*
expansion has been replaced with (set flag nil), because
zap wastefully arranges to yield the prior value, which
is not used at all.
|
|
|
|
|
| |
eval.c (me_while_star, me_until_star): for loop test must be a
sequence of forms, not a single form.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (weave_while): Pass third arg to remq as nil.
(eval_init): Update registrations of remq, remql and
remqual.
* lib.c (remq, remql, remqual): Implement key function
argument.
* lib.h (remq, remql, remqual): Declarations updated.
* sysif.c (at_exit_call): Pass third arg to remq as nil.
* debug.c (debug): Pass third argument to remqual as nil.
* txr.1: Documentation updated.
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register keepq, keepql and keepqual
intrinsic functions.
* lib.c (keepq, keepql, keepqual): New functions.
* lib.h (keepq, keepql, keepqual): Declared.
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (qquote_init): Stricter quote_form_p_f test
function: reject the quote form if it isn't a proper
list of two elements.
(optimize_qquote_form): Extract all arguments of list
forms and catenate them with mapcan, rather than
assuming that they have one argument. This wrong
assumption breaks ,,*(list ...) interpolation,
for instance.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (consp_f, second_f, list_form_p_f, quote_form_p_f,
xform_listed_quote_f): New static variables.
(qquote_init): New function.
(optimize_qquote_form): Use list_form_p_f, quote_form_p_f, and
second_f instead of constructing functions locally.
(optimize_qquote_args): Use xform_listed_quote_f instead
of locally constructed function.
(eval_init): Call qquote_init.
Register second function to second_f.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The surface motive here is to get better code than
forms like (append (list 'a) (list 'b) ...).
The ulterior motive is to suppress the memory
explosion when heavily nested forms like ^^^^^^^^^^^x
are expanded. This problem was uncovered by
AFL (fast).
* eval.c (optimize_qquote_form, optimize_qquote_args,
optimize_qquote): New static functions.
(expand_qquote_rec): New function.
(expand_qquote): Contents moved into expand_qquote_rec.
This function now optimizes the results of calling
expand_qquote_rec.
|
|
|
|
|
|
| |
* eval.c (list_star_s): New symbol variable.
(eval_init): Initialize list_star_s and use it for the
list* function registration.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The op transformer generates a lambda which has
as many arguments as the highest-valued metanumber
(@<digits> syntax) occurring in the form.
If this is a huge integer, it obligingly tries to
construct the argument list, running out of memory.
In this commit, we cap the value to 1024.
This issue was uncovered by the fuzzing utility
AFL (fast) 2.30b.
* eval.c (me_op): Throw error if max exceeds 1024,
preventing the call to supplement_op_syms to actually
generate an a formal parameter list of max symbols.
|
|
|
|
|
|
| |
* eval.c (me_def_variable): Check for sym not
being a bindable symbol. Otherwise we might call
mark_special on nil, which triggers an assertion.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Variables defined with defvarl or defparml are being marked
special, due to a mark_special call in the macro expander
which existed before they were introduced.
* eval.c (me_def_variable): We have to call mark_special
at macro-expansion-time for defparm and defvar, rather than
arrange for it to be called later, for the same reasons
that the (now incorrect) mark_special call had been introduced
in do_expand function for handling defvar.
(do_expand): Do not call mark_special, because the symbol
being handled here is defvarl: define lexical variable.
|
|
|
|
|
|
| |
* eval.c (do_expand): Throw error if defsymacro form
isn't a list of three elements, just like defparm
and defparml do.
|
|
|
|
|
|
| |
* eval.c (op_defvarl, op_defsymacro): Report correct
symbol in not-bindable-symbol error message rather
than reporting as let.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configure: Test for strptime.
* eval.c (eval_init): register time-parse intrinsic.
* lib.c (time_parse): New function.
* lib.h (time_parse): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (op_defsymacro): Remove sym from the special
hash, unless compatibility 143 or lower is requested.
* txr.1: Document effects of evaluating defsymacro
if a global variable of the same name exists, and the
behavior in lexical scopes where sym is bound.
Added compatibility notes covering the code change.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (unbound_s): New symbol variable.
(lookup_var): If a dynamic binding has the special sys:unbound
symbol as its value, then return nil, so the behavior
is as if there is no binding.
(makunbound): If the symbol exists in a dynamic environment,
then replace its value with sys:unbound, making it look
unbound.
(eval_init): Initialize unbound_s.
* lib.h (us_car, us_cdr): New inline functions.
* txr.1: New dialect notes under boundp.
Updated the makunbound documentation. Separated
makunbound documentation from fmakunbound and
mmakunbound. Added compatibility notes.
|
|
|
|
|
|
| |
* eval.c (format_field): Improve error messages; streamline
some code, report expression value rather than expression
itself for bad modifier.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (gethash_s): Global symbol variable removed,
due to being used only in one place.
(eval_init): Remove registration of make-hash, make-similar-hash,
copy-hash, hash, hash-construct, hash-from-pairs, hash-list, inhash,
sethash, pushhash, remhash, hash-count, get-hash-userdata,
set-hash-userdata, hashp, maphash, hash-eql, hash-equal, hash-keys,
hash-values, hash-pairs, hash-alist, hash-uni, hash-diff, hash-isec,
hash-subset, hash-proper-subset, group-by, group-reduce, hash-update,
hash-update-1, hash-revget, hash-begin, hash-next.
* hash.c (hash_init): Registrations removed from eval_init
moved here.
|
|
|
|
|
|
|
|
| |
* eval.c (me_op): We tell a little lie here, by indicating
that the "dwim body" is an expansion of the op operator.
Of course, the entire lambda containing that body
is that expansion. But in error messages, we need something
useful for the user.
|
|
|
|
|
|
| |
* eval.c (eval_init): Use sys_load_s variable
set up earlier in the function instead of redundant call to
intern.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (self_load_path_s): New symbol variable.
(sys_load): Save, set-up and restore self-load-path
around load.
(set_get_symacro): New function.
(eval_init): Register load function using sys_load_s instead
of redundant intern.
* eval.h (set_get_symacro): Declared.
* match.c (v_load): Save, set-up and restore self-load-path
macro.
* parser.c (load_rcfile): Likewise.
* txr.c (txr_main: Set up self-load-path when opening
file.
* txr.1: Documented self-load-path.
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Remove registration of
make-random-state, random-state-get-vec, random-state-p,
random-fixnup, random, and rand.
* rand.c (rand_init): Move registrations removed from
eval_init here.
|
|
|
|
|
|
|
|
| |
* eval.c (mapcarv, mappendv, mapdov): When done, we can
recycle the conses used for the temporary copy of the
list-of-lists, whose car-s are used for iterating over the
lists in paralle. This is safe because the temporary
list's conses aren't shared with any other function.
|
|
|
|
|
|
|
| |
* eval.c (sys_load): Use ~a format specifier rather than ~s
for the load path (if already known to be a string).
* match.c (v_load): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (sys_load): close stream in all cases.
* match.c (v_load): Likewise.
* parser.c (load_rcfile): Close stream in unwind
block, if open.
* txr.c (txr_main): Close stream after parsing
in all cases. If stream is std_input, or a string stream,
close_stream does nothing.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is really a gratuitous incompatibility with Common Lisp
and other dialects. Let's fix it internally also, but keep the
proper-listp function binding for backwards compatibility.
* eval.c (dot_to_apply, me_op): Update proper_listp
call to proper_list_p.
(eval_init): Register proper-list-p to the same C function as
proper-listp, and that C function is now called proper_list_p.
* lib.c (proper_listp): Renamed to proper_list_p.
* lib.h (proper_listp): Declaration updated.
* parser.y (define_transform): Update proper_listp call.
* txr.1: Replace all occurrences of proper-listp with
proper-list-p. Add note explaining the rename situation.
|
|
|
|
|
|
| |
* eval.c (error_trace): If an error occurs during the
expansion of a form, that form may be the result of
expansions. Dump those expansions.
|
|
|
|
|
|
|
|
|
|
|
| |
This fix is no longer that important, since due to the
previous commit, expand now tracks expansion origins
thoroughly, which hides this bug. However, expand_macro is
directly called from a few other functions, like macroexpand,
which don't benefit from that fix.
* eval.c (expand_macro): Add forgotten set_origin call
in the case when the native C expander is called.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This promotes better diagnostics. Simple test
case: [(ret @5) 1].
* eval.c (do_expand): Manual tail recursion via backwards goto
is removed; the function recurses now, and it recurses through
the expand wrapper rather than by calling itself. That is
needed in order to properly install the origin tracking for
each expansion.
(expand): Record origin for each expansion that already
doesn't have one.
|
|
|
|
|
|
|
|
|
| |
* eval.c (expand_symacrolet, do_expand): Don't expand the
replacement form of a global or lexical symbol macro at the
time it is bound to its symbol. This is almost certainly
wrong in situations where it makes a difference.
* txr.1: Noted in compatibility section.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The expander now actually produces apply forms for dot
position function call and dwim forms. This allows symbol
macros to work naturally.
* eval.c (sys_apply_s): New symbol variable.
(imp_list_to_list, dot_to_apply): New static functions.
(expand_forms, expand_forms_lisp1): We now throw an error if a
non-nil atom terminates a form, Except in compatibility mode
with TXR 137 or less, whereby we emulate the old behavior of
not expanding this atom.
(do_expand): Perform the dot_to_apply transformation
on the arguments of the dwim form.
Perform the dot_to_apply transformation on an
entire function call form.
(eval_init): Initialize sys_apply_s and register
sys:apply function (using the same function object that
is registered under apply).
* txr.1: Documented that both DWIM forms and regular
function call forms work as if by a transformation to apply form,
removing verbiage which separately described the DWIM
handling. Documented that symbol macros work properly in
dot position.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (expand_forms): If the forms list is an atom, then
don't just return it. Try to expand it as a macro.
If the macro produces a compound form, diagnose with
an exception, otherwise return the expansion.
* txr.1: Document the treatment of symbol macros in
function call dot position.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Registered intrinsics rmemq, rmemql,
rmemqual, rmember, rmember-if, rposqual, rposql, rposq,
rpos, rpos-if, rfind, rfind-if and rsearch.
* lib.c (rmemq, rmemql, rmemqual, rmember, rmember-if,
rposqual, rposql, rposq, rpos, rpos-if, rfind, rfind-if,
rsearch): New functions.
(rsearch_list): New static function.
(search): Omit unreachable return statement.
* lib.h (rmemq, rmemql, rmemqual, rmember, rmember-if,
rposqual, rposql, rposq, rpos, rpos-if, rfind, rfind-if,
rsearch): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
| |
* eval.c (do_expand, macroexpand_1): The original form
must have priority in providing source location info,
over the macro. Otherwise macro bodies may get reported as
locations of errors that occur in substituted code.
|
|
|
|
|
| |
* eval.c (op_each): Use list_collect_append not
list_collect_nconc. Ouch!
|
|
|
|
|
|
|
|
| |
* eval.c (expand_left, nexpand_left): New static functions.
(eval_init): Registered expand-left and nexpand-left
intrinsics.
* txr.1: Documented.
|
|
|
|
|
|
|
| |
* arith.c, cadr.c, debug.c, eval.c, filter.c, gencadr.txr, glob.c,
hash.c, linenoise/linenoise.c, lisplib.c, match.c, parser.c, rand.c,
regex.c, signal.c, stream.c, struct.c, sysif.c, syslog.c, txr.c,
unwind.c, utf8.c: Remove unncessary header files.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c: include <assert.h> that was previously coming
via "mpi.h".
* mpi/mpi.c: Includes of <stdio.h>, <ctype.h> and <assert.h>
moved here.
* mpi/mpi.h: Remove include of <stdio.h>, <ctype.h> and
<assert.h>. Keeping <limits.h> for now; needed for CHAR_BIT.
* mpi/mplogic.c: Needs <assert.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (UINT_PTR_MAX_MP): New static variable.
(biggnum_from_uintptr): New function.
(in_uint_ptr_range): New static function.
(c_uint_ptr_num): New function.
(arith_init): Initialize UINT_PTR_MAX_MP.
* arith.h (bignum_from_uintptr, c_uint_ptr_num): Declared.
* eval.c (eval_init): Register random-state-get-vec.
* mpi/mpi.c (mp_set_uintptr, mp_get_uintptr): New functions.
(mp_set_intptr, mp_get_intptr): Expressed in terms of
mp_set_uintptr and mp_get_uintptr.
* mpi/mpi.h (mp_set_uintptr, mp_get_uintptr): Declared.
* rand.c (make_random_state): Handle vector seed.
(random_state_get_vec): New function.
* rand.h (random_state_get_vec): Declared.
* txr.1: Documented new feature in make-random-state
and new random-state-get-vec function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register split*.
* lib.c (split_star_func): New static function.
(partition_split_common): Take pointer-to-function argument
instead of boolean. Hoist this C function into the lazy cons.
(partition): Pass pointer to partition_func ito
partition_split_common, intsead of a flag requesting the use
of partition_func.
(split): Pass apointer to split_func into
partition_split_common.
(split_star): New function.
* lib.h (split_star): Declared.
* txr.1: Documented split*.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register / function to divv instead of divi.
* lib.c (divv): New function.
* lib.h (divv): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
| |
* eval.c (do_expand): Add missing rlcp in the construction
of the return value of the clause which expands a dohash.
Let's make it a rlcp_tree. Test case: (dohash (a b c) d e)
with c unbound.
|
|
|
|
|
|
| |
* eval.c (eval_init): Register "use" as alias for identity.
* txr.1: Documented use function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Avoids consing up list of strings.
* lib.c (vscat): New static function.
(scat): New function.
(lazy_str): Use scat instead of cat_str.
* lib.h (scat): Declared.
* eval.c (format_field): Use scat instead of cat_str.
* parser.c (open_txr_file, read_eval_stream): Likewise.
|
|
|
|
|
|
|
| |
* eval.c (set_origin): Add form != origin
to the condition for recording the ancestry.
(expand_macro): Use set_origin function instead
of direct call to sethash.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It was a mistake to change the semantics of the return value
of chr-isdigit and chr-isdigit. It breaks code like
[partition-by chr-isdigit ...]. The behavior of chr-isdigit
and chr-isxdigit is restored to returning t and nil. New
chr-digit and chr-xdigit functions are introduced for
returning the digit value or nil.
* eval.c (eval_init): Register chr-digit and chr-xdigit
intrinsics.
* lib.c (chr_isdigit, chr_isxdigit): Restore old behavior.
(chr_digit, chr_xdigit): New functions.
* lib.h (chr_digit, chr_xdigit): Declared.
* txr.1: Everything documented.
|
|
|
|
|
| |
* eval.c (error_trace): Change "possibly triggered by"
to "during evaluation of".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We need this now, since file system errors aren't
handled in the pattern language any more, after
the complex_open refactoring.
* eval.c (set_last_form_evaled): New function.
* eval.h (set_last_form_evaled): Declared.
* match.c (do_match_line, match_files):
Save, set up and restore last_form_evaled
via set_last_form_evaled function.
|