| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
calculation.
|
|
|
|
|
|
|
|
| |
the case when from is a vector, for consistency with the sel
function and the dwim operator.
* txr.1: Document that the third argument of select and replace may be
a vector.
|
|
|
|
|
| |
* lib.c (rem_lazy_func): Do not access the cdr field of
the lcons that we are in the middle of forcing!
|
|
|
|
|
|
| |
* lib.c (rplaca, rplacd): Use refset and replace
respectively to handle vectors and strings.
Adjust type mismatch error message.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (builtin, eval_initing): New global variable.
(op_defun, op_defmacro): During initialization, record functions
and macros in builtin hash.
(builtin_reject_test): New static function.
(expand_macrolet): Perform builtin reject test for fbind, lbind,
and macrolet.
(regfun, reg_mac): Add symbol to builtin hash.
(eval_init): GC-protect new hash table variable and initialize it.
Set eval_initing to true over eval initialization.
The flip function is renamed fo flipargs.
(eval_compat_fixup): New function, for dealing with the
operator/function conflict over flip.
* eval.h (eval_compat_fixup): Declared.
* lib.c (compat_fixup): Call eval_compat_fixup.
* tests/011/macros-2.txr: This test was defining a macro called
while which is now illegal. Renamed to whilst.
* tests/011/macros-2.expected: Regenerated.
* txr.1: Function flip renamed to flipargs and documented in
Compatibility section.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The operators set, inc, dec, pop and others are now macros
which generate code, rather than built-in special forms
that use "C magic". Moreover, new such macros are easy to write, and
several new ones are already available. Moreover, new kinds of
assignable places are easy to create.
* place.tl: New file.
* lisplib.c, lisplib.h: New files.
* Makefile (OBJS): New target, lisplib.o.
(GEN_HDRS): New variable.
(LISP_TO_C_STRING): New recipe macro, with rule.
(clean): Remove generated headers named in $(GEN_HDRS).
* eval.c (dec_s, push_s, pop_s, flip_s, del_s): Variables removed.
(setq_s): New variable.
(lookup_var, lokup_sym_lisp_1, lookup_var_l, lookup_fun, lookup_mac,
lookup_symac, lookup_symac_lisp1): Trigger the delayed loading of
libraries for undefined global symbols, and re-try the lookup.
(op_modplace, dwim_loc, force_l): Static functions removed.
(op_setq): New static function.
(eval_init): Initialize setq_s; remove initializations of
removed variables; remove registrations for op_modplace;
add registration for sys:setq, sys:rplaca, sys:rplacd,
sys:dwim-set and sys:dwim-del intrinsics.
Call lisplib_init to initialize the dynamic library loading module.
* lib.c (sys_rplaca, sys_rplacd): New functions, differing
in return value from rplaca and rplacd.
(ref, refset): Handle hash table.
(dwim_set, dwim_del): New functions.
* lib.h (sys_rplaca, sys_rplacd, dwim_set, dwim_del): Declared.
* genvim.txr: Include place.tl in scan.
* tests/010/seq.txr: The del operator test
case no longer throws at run-time but at macro-expansion time, so the
test case is simply removed.
* tests/010/seq.expected: Updated output.
* tests/011/macros-2.txr: Reset *gensym-counter* to zero, because
the textual output of the test case includes gensyms, whose numberings
fluctuate with the content of the new Lisp library material.
* tests/011/macros-2.expected: Updated output.
|
|
|
|
|
|
|
| |
* eval.c (op_quote): Throw error on bad syntax.
* lib.c (obj_print, obj_pprint): Do not hide bad quote syntax
using ' notation; print it using ordinary notation.
|
|
|
|
|
|
|
|
| |
* lib.c (init): Initialize parser, syslog and glob modules
here.
* txr.c (main): Remove initialization of parser, syslog and glob
modules from here.
|
|
|
|
|
| |
* lib.c (obj_print, obj_pprint): Fix mistake in the test for
properly formed lambda syntax whcih is printed specially.
|
|
|
|
|
| |
the user package directly, not the value of the *user-package*
variable.
|
|
|
|
|
|
|
|
|
|
| |
This tiny change yields a 165% (2.65X) speedup in the
tst/tests/011/mandel.txr test case.
* lib.c (keywordp): Use keyword_package_var instead of the
keyword_package macro which looks up the global environment.
* parser.y (sym_helper): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (setenv, unsetenv): Changed static functions to external.
Moved them out of the #if !HAVE_TIMEGM block.
* lib.h (setenv, unsetenv): Declared.
* sysif.c (getenv_wrap, setenv_wrap, unsetenv_wrap): New functions.
(sysif_init): Registered getenv, setenv and unsetenv.
* txr.1: Documented getenv, setenv and unsetenv.
* tl.vim, txr.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* gc.h (zap): New inline function.
(z): New macro.
* lib.c (generic_funcall, funcall1, funcall2, funcall4, do_not,
do_dup, do_iff): Use z macro to burn funargs with no next use.
* eval.c (apply, apply_frob_args, iapply, call, do_eval,
op_dwim, mapcarv, mappendv, lazy_mapcarv_func, mapdov, do_apf,
do_ipf, callf): Use z macro to burn funargs with no next use.
|
|
|
|
|
|
|
|
| |
argument.
* lib.c (lazy_stream_cons): Default the argument to std_input.
* txr.1: Document that the stream is optional in get-lines.
|
|
|
|
|
|
|
| |
radix is 16. Also, thrown an error if radix is not in the range
0 to 36.
* txr.1: Document int-str's radix range restriction.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (cobj_ops): New function.
* lib.h (cobj_ops): Declared.
* stream.c (null_ops): Initializer updated.
(struct stdio_handle): New member, err.
(stdio_stream_mark): Mark the err member.
(errno_to_string): New static function.
(stdio_maybe_read_error, stdio_maybe_error): Set persistent error
state. Use errno_to_string_function.
(stdio_put_string, stdio_put_char, stdio_put_byte, stdio_seek,
stdio_get_line): Set errno to zero, so that if the underlying
operations do not set errno on err, we don't misinterpret some pervious
errno value as pertaining to the failed stream operation.
(stdio_get_error, stdio_get_error_str, stdio_clear_error): New static
functions.
(stdio_ops, tail_ops, pipe_ops): Update initializer with new functions.
(string_in_get_error, string_in_get_error_str): New static functions.
(string_in_ops): Update initializer with new functions.
(byte_in_get_error, byte_in_get_error_str): New static functions.
(byte_in_ops): Update initializer with new functions.
(string_out_ops, strlist_out_ops): Update initializer with null
pointers for new functions.
(struct dir_handle): New struct type.
(dir_destroy, dir_mark): New functions.
(dir_get_line): Refactor for struct dir_handle context rather than DIR.
Persist error state.
(dir_close): Refactor for struct dir_handle.
(dir_get_error, dir_get_error_str, dir_clear_error): New static functions.
(dir_ops): Update initializer with new functions.
(make_stdio_stream_common): Initialize new err member.
(make_dir_stream): Refactor for struct dir_handle.
(get_error, get_error_str, clear_error): New functions.
(cat_get_error, cat_get_error_str, cat_clear_error): New static
functions.
(cat_stream_ops): Update initializer with new functions.
(stream_init): Register get-error, get-error-str, clear-error intrinsics.
* stream.h (struct strm_ops): New function pointer members, get_error,
get_error_str and clear_error.
(strm_ops_init): Macro extended with new arguments for new function pointers.
(get_error, get_error_str, clear_error): Declared.
* syslog.c (syslog_strm_ops): Update initializer with null
pointers for new functions.
* txr.1: Documented get-error, get-error-str and clear-error.
|
|
|
|
|
|
| |
messages about bad appends, do not show the list being
appended because it may be an infinite lazy list.
For instance (append* 3 lazy-list).
|
|
|
|
|
|
|
|
|
| |
was silently ignoring lists after the first atom, instead of
throwing an error. Also, it was not detecting the case that
the last argument is a list which should just be returned,
and instead trying to find its tail in preparation for the
next call to lazy_appendv_func, the consequences being runaway
iteration over an infinite list.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(uw_throw): In the unhandled case, check if *unhandled-hook* variable
has a function, and use it instead of the default logic. If it's not a
function, abort with an error message. Clear it so that if the hook
function re-enters this code, it will not be used. Always exit now on
unhandled exceptions; do not abort.
(uw_late_init): New function.
* unwind.h (uw_late_init): Declared.
* lib.c (init): Call uw_late_init.
* txr.1: Documented *unhandled-hook*.
* genvim.txr: Scan the unwind.c file, since it has a reg_var now.
* tl.vim, txr.vim: Updated.
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c, arith.h, combi.c, combi.h, debug.c, debug.h, eval.c, eval.h,
filter.c, filter.h, gc.c, gc.h, hash.c, hash.h, lib.c, lib.h,
match.c, match.h, parser.h, rand.c, rand.h, regex.c, regex.h,
signal.c, signal.h, stream.c, stream.h, sysif.c, sysif.h, syslog.c,
syslog.h, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h:
Update.
* LICENSE, METALICENSE: Likewise.
|
|
|
|
|
| |
A one element list being converted to a string
treated as an empty list, leading to empty string.
|
|
|
|
|
|
|
|
|
|
|
| |
the dup and flip intrinsics.
* lib.c (do_dup): New static function.
(dupl): New function.
* lib.h (dupl): Declared.
* txr.1: Documented dup and flip.
|
|
|
|
|
|
|
|
|
|
| |
must return the empty string, not nil. Only
lists of non-characters fail to convert to a string.
Since programs may depend on the hitherto wrong,
undocumented behavior, this is made subject to
compatibility.
* txr.1: Added compatibility note.
|
|
|
|
|
|
| |
sequence may be an infinite list in the case that the from argument
specifies a list of indices. We must avoid trying to calculate its
length before we have detected this case.
|
|
|
|
|
|
|
|
|
|
| |
if get_line returns nil.
* stream.c (cat_get_line, cat_get_char, cat_get_byte): The catenated
stream read operations close an exhausted stream before popping
to the next one.
* txr.1: Document closing behavior of catenated streams.
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (unique): New function.
(uniq): Becomes wrapper around unique.
* lib.h (unique): Declared.
* txr.1: Documented unique, and equivalence between uniq and unique.
* tl.vim, txr.vim: Regenerated.
|
|
|
|
| |
* lib.h (func_n1ov, func_n2ov, func_n3ov): Declared.
|
|
|
|
| |
* lib.h (func_n0o): Declaration removed.
|
|
|
|
|
|
| |
vi make_random_state.
* txr.1: Updated.
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (in): New function.
* lib.h (in): Declared.
* txr.1: Documented in.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
| |
so that a nil set element is handled properly.
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (lequal, gequal, lequalv, gequalv): New functions.
* lib.h (lequal, gequal, lequalv, gequalv): Declared.
* txr.1: Documented lequal and gequal.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
| |
the lessv and greaterv functions instead of less and greater.
* lib.c (lessv, greaterv): New functions.
* lib.h (lessv, greaterv): Declared.
* txr.1: Document variadic nature of less and greater.
|
|
|
|
|
|
|
|
| |
* lib.c (sort_group): New function.
* lib.h (sort_group): Declared.
* txr.1: Documented.
|
|
|
|
|
|
| |
too early, before the loop which adjusts its value.
Restructuring this slightly to avoid duplicated code, by moving the
!first check later.
|
|
|
|
|
| |
Remove unessential variable last, and move the next variable
into loop scope.
|
|
|
|
|
|
| |
* lib.h (where): Declaration updated.
* txr.1: Documented.
|
|
|
|
| |
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
then unless opt_compat is 100 or less, provide a more
consistent behavior, rather than splitting the string
into characters. This latter behavior was never documented.
* txr.1: Documented.
* dep.mk: Updated.
|
|
|
|
|
|
|
|
|
| |
for generic semantics.
* lib.h (max2, min2): Parameter names changed to avoid suggesting
that the operands are numbers.
* txr.1: Documentation for min and max updated.
|
|
|
|
|
|
| |
Fix cut and paste problem: type_mismatch argument expression
referring to the C function cons rather than the intended
object seq.
|
|
|
|
|
|
|
|
|
| |
* lib.c (do_chand): New static function.
(chandv): New function.
* lib.h (chandv): Declared.
* txr.1: Documented chand.
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register iff as requiring only one arg.
* lib.c (do_iff): Do not check thenfun for nil. Just call it.
(iff): Default thenfun to identity.
* txr.1: Documentation updated.
|
|
|
|
|
|
|
|
| |
argument, resulting in : symbol being called as a function.
* txr.1: Removing description of situation when the then-function
argument of iff or iffi is specified as nil. This is deprecated
behavior which can be obtained by using the false function.
|
|
|
|
|
|
|
|
|
| |
(string_extend): Use chk_grow_vec.
(vec_set_length): Avoid subtractions for comparing numbers.
* lib.h (chk_grow_vec): Declared.
* stream.c (snarf_line, string_out_put_string): Use chk_grow_vec.
|
|
|
|
|
|
|
| |
(throw_mismatch): New function.
* lib.h (throw_mismatch): Declared.
(type_mismatch): Declaration turned into inline function.
|
|
|
|
|
|
|
|
|
|
| |
(GREP_CHECK): New macro.
(enforce): Rewritten using GREP_CHECK, with new checks.
* arith.c, combi.c, debug.c, eval.c, filter.c, gc.c, hash.c, lib.c,
* lib.h, match.c, parser.l, parser.y, rand.c, regex.c, signal.c,
* signal.h, stream.c, syslog.c, txr.c, unwind.c, utf8.c: Remove
trailing spaces.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (do_not): New static function.
(notf): New function.
* lib.h (notf): Declared.
* txr.1: Documented notf.
* share/txr/stdlib/txr-case.txr (bindable): Eliminated.
(txr-if): Use functional expression, taking advantage of notf.
* txr.vim: Regenerated.
|