| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
* lib.c (nary_op): New function.
(plusv, mulv, logandv, logiorv): Use nary_op.
* lib.h (nary_op): Declared.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register trunc-rem intrinsic.
* lib.h (trunc_rem): Declared.
* txr.1: Documented trunc-rem.
* 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.
|
|
|
|
|
|
|
|
|
|
| |
* lib.h (cobj_ops_init): New macro.
* hash.c (hash_ops, hash_iter_ops): Initialize with cobj_ops_init.
* rand.c (random_state_ops): Likewise.
* regex.c (char_set_obj_ops, regex_obj_ops): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
| |
(sign_extend): New function.
* eval.c (eval_init): Register sign-extend intrinsic.
* lib.h (sign_extend): Declared.
* txr.1: Documented sign-extend.
* tl.vim, txr.vim: Updated.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
(plusp, minusp): New functions.
* eval.c (eval_init): Register plusp and minusp.
* lib.h (plusp, minusp): Declared.
* txr.1: Documented plusp and minusp, and the
handling of characters by zerop.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
aligned, affecting OS X port.
* configure: Detect a SIZEOF_WCHAR_T when detecting integer
type that will hold a pointer. In the lit_align test,
if we are on Apple Mac OSX, use a lit_align of 2,
so the logic kicks in for padding literals and handling
misalignment.
* lib.h (litptr): Add a case for LIT_ALIGN < 4 and
SIZEOF_WCHAR_T == 4. In this case we do the arithmetic
on the pointer using short *, and then convert to
wchar_t.
* HACKING: New section 2.4.3 about new wchar_t hack.
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (in): New function.
* lib.h (in): Declared.
* txr.1: Documented in.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Registered wrap and wrap* intrinsics.
* lib.h (wrap_star, wrap): Declared.
* txr.1: wrap and wrap* documented.
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register new functions as intrinsics.
* lib.h (succ, ssucc, sssucc, pred, ppred, pppred): Declared.
* txr.1: Documented.
|
|
|
|
|
|
| |
* lib.h (where): Declaration updated.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
* lib.c (do_chand): New static function.
(chandv): New function.
* lib.h (chandv): Declared.
* txr.1: Documented chand.
|
|
|
|
|
|
|
|
|
| |
(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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
to C++ style casts when compiling as C++.
* lib.h (strip_qual, convert, coerce): New casting macros.
(TAG_MASK, tag, type, wli_noex, auto_str, static_str,
litptr, num_fast, chr, lit_noex, nil, nao): Use cast macros.
* arith.c (mul, isqrt_fixnum, bit): Use cast macros.
* configure (INT_PTR_MAX): Define using cast macro.
* debug.c (debug_init): Use cast macro.
* eval.c (do_eval, expand_macro, reg_op, reg_mac, eval_init):
Use cast macros.
* filter.c (filter_init): Use cast macro.
* gc.c (more, mark_obj, in_heap, mark, sweep_one, unmark): Use
cast macros.
* hash.c (hash_double, equal_hash, eql_hash, hash_equal_op,
hash_hash_op, hash_print_op, hash_mark, make_hash, make_similar_hash,
copy_hash, gethash_c, gethash, gethash_f, gethash_n, remhash,
hash_count, get_hash_userdata, set_hash_userdata, hash_iter_destroy,
hash_iter_mark, hash_begin, hash_uni, hash_diff, hash_isec): Use
cast macros.
* lib.c (code2type, chk_malloc, chk_malloc_gc_more, chk_calloc,
chk_realloc, chk_strdup, num, c_num, string, mkstring, mkustring,
upcase_str, downcase_str, string_extend, sub_str, cat_str, trim_str,
c_chr, vector, vec_set_length, copy_vec, sub_vec, cat_vec,
cobj_print_op, obj_init): Likewise.
* match.c (do_match_line, hv_trampoline, match_files, dir_tables_init):
Likewise.
* parser.l (grammar): Likewise.
* parser.y (parse): Likewise.
* rand.c (make_state, make_random_state, random_fixnum, random):
Likewise.
* regex.c (CHAR_SET_L2_LO, CHAR_SET_L2_HI, CHAR_SET_L1_LO,
CHAR_SET_L1_HI, CHAR_SET_L0_LO, CHAR_SET_L0_HI, L0_full, L0_fill_range,
L1_full, L1_fill_range, L1_contains, L1_free, L2_full, L2_fill_range,
L2_contains, L2_free, L3_fill_range, L3_contains, L3_free,
char_set_create, char_set_cobj_destroy, nfa_state_accept,
nfa_state_empty, nfa_state_single, nfa_state_wild, nfa_state_set,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (cobj_print_op): In the format call, cast
the C pointer to val, since the ~p conversion now
takes a val rather than void *.
(cptr_equal_op, obj_print, obj_pprint): Remove cast to
void *, since obj now already has the type that ~p expects.
* lib.h (struct any): Use mem_t * instead of void *.
* parser.h (yyscan_t): Repeat the definition from inside
the Flex-generated lex.yy.c.
(yylex_init, yylex_destroy, yyget_extra, yyset_extra): Re-declare
using yyscan_t typedef in place of void *.
* parser.l (yyget_column, yyerrprepf): Re-declare using yyscan_t.
(grammar): Use yyg in place of yyscanner in calls to yyerrprepf.
* parser.y (yylex, %lex-param): Use yyscan_t instead of void *.
(parse): Use yyscan_t for local variable.
* signal.c (stack): Change type from void * to mem_t *.
* stream.c (vformat): Conversion specifier p extracts val
instead of void *.
(run): Use casts that only remove const, not all the way to void *.
* txr.1: Documented p conversion specifier of format.
* Makefile (OBJS-y): Initialize with := to make sure it is a
simple variable, and not a macro.
(SRCS): New variable, listing source files.
(enforce): New rule for enforcing coding conventions.
Currently checks for void * occurrences.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
zero, return the other operand.
(lcm): New function.
* eval.c (eval_init): Retarget registration of gcd to
variable argument gcdv function. Register lcm.
* lib.c (gcdv, lcmv): New functions.
* lib.h (gcdv, lcm, lcmv): Declared.
* txr.1: Re-document gcd with coverage of lcm.
* txr.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (gt_f, lt_f): Global variables removed.
(greater_f): New variable.
(greater): New function.
(find_max, pos_max): Use greater_f as default for testfun,
rather than gt_f.
(find_min, pos_min): Use less_f as default for testfun,
rather than lt_f.
(obj_init): Remove references to gt_f and lt_f.
GC-protect and initialize greater_f.
* lib.h (greater_f): Declared.
(gt_f, lt_f): Declarations removed.
* txr.1: Documented greater, and use of less and greater
in pos-min, pos-max, find-min and find-max.
* txr.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(eval_init): Register less as intrinsic. Retarget merge intrinsic to
merge_wrap for proper argument defaulting which is missing from merge,
and which we don't want to introduce there since internal calls
to merge don't erquire it. Change registration of sort so it has
only one required argument, not two.
* lib.c (less_f): New global variable.
(less_tab): New static array.
(less_tab_init): New static function.
(less): New function.
(sort): Default lessfun argument to the less function.
(obj_init): GC-protect the less_f variable.
Initialize it with a function object made from the less function.
(init): Call less_tab_init.
* lib.h (enum type): New enumeration member MAX_TYPE, an alias
for the largest type.
(less_f, less): Declared.
* txr.1: Documented new less function, and that the lessfun
argument in sort and merge is optional, defaulting to less.
* txr.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
intrinsics.
* lib.c (chr_isblank, chr_isunisp): New functions.
* lib.h (chr_isblank, chr_isunisp): Declared.
* regex.h (spaces): Declaration for existing variable added.
* txr.1: Documented chr-isblank and chr-isunisp.
* genvim.txr: Add missing sysif.c.
* txr.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
rather than the list-based notation for derivative-based
regexes, and an encapsulated COBJ for NFA-based regexes.
* lib.c (compiled_regex_s): Variable removed.
(obj_init): Initialization of compiled_regex_s removed.
* lib.h (compiled_regex_s): Declaration removed.
* regex.c (struct regex, regex_t): New type.
(regex_destroy): Object is now a regex_t, not nfa_t.
(regex_mark): New function.
(regex_obj_ops): Register regex_mark operation.
(reg_nullable, reg_derivative): Remove cases that handles
compiled_regex_s.
(regex_compile): Output of dv_compile_regex becomes
a cobj nwo. Output of nfa_compile_regex must be
embedded in regex_t structure.
(regexp): Drop the check for compiles_regex_s.
(regex_nfa): Function removed.
(regex_run, regex_machine_init): Use cobj_handle to retrieve regex_t *
pointer and dispatch appropriate code based on regex->kind.
|
|
|
|
|
|
|
|
|
| |
Returns minimum supported emulation.
* lib.h (compat_fixup): Declaration fixed.
* txr.c (compat): Replace hard-coded min version
by return value of compat_fixup.
|
|
|
|
|
|
|
|
|
| |
* lib.c (partition_star_func): New static function.
(partition_star): New function.
* lib.h (partition_star): Declared.
* txr.1: Documented partition*.
|
|
|
|
|
|
|
|
|
| |
* lib.c (partition_func): New static function.
(partition): New function.
* lib.h (partition): Declared.
* txr.1: Documented partition.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(obj_init): Change exception symbol names with underscores
to use friendly dashes instead.
(compat_fixup): New function.
* lib.h (compat_fixup): Declared.
* txr.1: Change occurrences of exception symbols from
underscores to dashes.
* txr.c (txr_main): Call compat_fixup when -C option
is processed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
to account for new parameter.
* lib.c (syntax_error_s): New symbol_variable.
(obj_init): New symbol variable initialized.
* lib.h (syntax_error_s): Declared.
* parser.h (lisp_parse): Declaration updated.
* parser.l (lisp_parse): Takes third parameter.
* txr.1: Third parameter of read described.
* txr.c (txr_main): Pass colon_k to third parameter of lisp_parse
to obtain exception throwing behavior.
* unwind.c (uw_init): Register syntax-error as subtype of error.
|
|
|
|
|
|
|
|
| |
* lib.c (uniq): New function.
* lib.h (uniq): Declared.
* txr.1: Documented uniq.
|
|
|
|
|
|
|
|
| |
* lib.c (nconcv): New function.
* lib.h (nconcv): Declared.
* txr.1: Documented nconc.
|
|
|
|
|
|
|
|
|
| |
* lib.c (partition_by_func): New static function.
(partition_by): New function.
* lib.h (partition_by): Declared.
* txr.1: Documented partition-by.
|
|
|
|
|
|
|
|
| |
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, parser.l, parser.y,
rand.c, rand.h, regex.c, regex.h, signal.c, signal.h, stream.c,
stream.h, syslog.c, syslog.h, txr.c, txr.h, unwind.c, unwind.h,
utf8.c, utf8.h: Synchronize license header with LICENSE.
|
|
|
|
|
|
|
|
|
| |
* lib.c (do_juxt): New static function.
(juxtv): New function.
* lib.h (juxtv): Declared.
* txr.1: Documented juxt.
|
|
|
|
|
|
|
|
|
|
|
| |
(eval_init): Register mapdo intrinsic.
* lib.c (mapdo): New function.
* lib.h (mapdo): Declared.
* txr.1: Documented mapdo. Documented zero-argument case
for mapcar, mapcar*, mappend and mappend*.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
library so we can test for math functions.
* arith.c (log2_init): New static function.
(log2, logtwo): New functions.
(l2): New static variable.
(arith_init): Call log2_init.
* configure (lang_flags): Switching _XOPEN_SOURCE
from 500 to 600 to reveal log2.
Adding test for log2.
* eval.c (eval_init): Register log2 intrinsic.
* lib.h (logtwo): Declared.
* txr.1: Documented log2.
|
|
|
|
|
|
|
|
|
| |
* lib.c (lconsp, interpose): New functions.
(lazy_interpose_func, lazy_interpose): New static functions.
* lib.h (lconsp, interpose): Declared.
* txr.1: Documented lconsp and interpose.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register bit as intrinsic.
* lib.h (bit): Declared.
* mpi-patches/add-bitops (mp_bit): New function.
* txr.1: Documented bit
|
|
|
|
|
|
|
|
|
|
|
|
| |
manipulate argument lists.
* eval.c (apply_frob_args): Rewrite to non-destructive
one-pass version.
(iapply): Likewise.
* lib.c (term): New function.
* lib.h (term): Declared.
|