| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* METALICENSE: 2020 copyrights bumped to 2021. Added note
about SHA-256 routines from Colin Percival.
* LICENSE, LICENSE-CYG, Makefile, alloca.h, args.c, args.h,
arith.c, arith.h, buf.c, buf.h, cadr.c, cadr.h, chksum.c,
chksum.h, chksums/crc32.c, chksums/crc32.h, combi.c, combi.h,
configure, debug.c, debug.h, eval.c, eval.h, ffi.c, ffi.h,
filter.c, filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c, glob.h,
hash.c, hash.h, itypes.c, itypes.h, jmp.S, lex.yy.c.shipped,
lib.c, lib.h, linenoise/linenoise.c, linenoise/linenoise.h,
lisplib.c, lisplib.h, match.c, match.h, parser.c, parser.h,
parser.l, parser.y, protsym.c, rand.c, rand.h, regex.c,
regex.h, share/txr/stdlib/asm.tl, share/txr/stdlib/awk.tl,
share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl,
share/txr/stdlib/compiler.tl, share/txr/stdlib/conv.tl,
share/txr/stdlib/copy-file.tl, share/txr/stdlib/debugger.tl,
share/txr/stdlib/defset.tl, share/txr/stdlib/doloop.tl,
share/txr/stdlib/each-prod.tl, share/txr/stdlib/error.tl,
share/txr/stdlib/except.tl, share/txr/stdlib/ffi.tl,
share/txr/stdlib/getopts.tl, share/txr/stdlib/getput.tl,
share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl,
share/txr/stdlib/keyparams.tl, share/txr/stdlib/op.tl,
share/txr/stdlib/package.tl, share/txr/stdlib/param.tl,
share/txr/stdlib/path-test.tl, share/txr/stdlib/place.tl,
share/txr/stdlib/pmac.tl, share/txr/stdlib/quips.tl,
share/txr/stdlib/save-exe.tl, share/txr/stdlib/socket.tl,
share/txr/stdlib/stream-wrap.tl, share/txr/stdlib/struct.tl,
share/txr/stdlib/tagbody.tl, share/txr/stdlib/termios.tl,
share/txr/stdlib/trace.tl, share/txr/stdlib/txr-case.tl,
share/txr/stdlib/type.tl, share/txr/stdlib/vm-param.tl,
share/txr/stdlib/with-resources.tl,
share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl,
signal.c, signal.h, socket.c, socket.h, stream.c, stream.h,
struct.c, struct.h, strudel.c, strudel.h, sysif.c, sysif.h,
syslog.c, syslog.h, termios.c, termios.h, time.c, time.h,
tree.c, tree.h, txr.1, txr.c, txr.h, unwind.c, unwind.h,
utf8.c, utf8.h, vm.c, vm.h, vmop.h, win/cleansvg.txr,
y.tab.c.shipped: Copyright year bumped to 2021.
|
|
|
|
|
|
|
|
|
|
|
| |
* hash.c (hash_uni): New functional argument map1fun and
map2fun. If present, values from hash1 and hash2,
respectively, are projected through these functions.
(hash_init): hash-uni registration updated.
* hash.h (hash_uni): Declaration updated.
* txr.1: Documented new arguments.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* LICENSE, LICENSE-CYG, METALICENSE, Makefile, alloca.h, args.c,
args.h, arith.c, arith.h, buf.c, buf.h, cadr.c, cadr.h,
chksum.c, chksum.h, chksums/crc32.c, chksums/crc32.h, combi.c,
combi.h, configure, debug.c, debug.h, eval.c, eval.h, ffi.c,
ffi.h, filter.c, filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c,
glob.h, hash.c, hash.h, itypes.c, itypes.h, jmp.S, lib.c,
lib.h, linenoise/linenoise.c, linenoise/linenoise.h,
lisplib.c, lisplib.h, match.c, match.h, parser.c, parser.h,
parser.l, parser.y, protsym.c, rand.c, rand.h, regex.c,
regex.h, share/txr/stdlib/asm.tl, share/txr/stdlib/awk.tl,
share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl,
share/txr/stdlib/compiler.tl, share/txr/stdlib/conv.tl,
share/txr/stdlib/debugger.tl, share/txr/stdlib/defset.tl,
share/txr/stdlib/doloop.tl, share/txr/stdlib/error.tl,
share/txr/stdlib/except.tl, share/txr/stdlib/ffi.tl,
share/txr/stdlib/getopts.tl, share/txr/stdlib/getput.tl,
share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl,
share/txr/stdlib/keyparams.tl, share/txr/stdlib/op.tl,
share/txr/stdlib/package.tl, share/txr/stdlib/param.tl,
share/txr/stdlib/path-test.tl, share/txr/stdlib/place.tl,
share/txr/stdlib/pmac.tl, share/txr/stdlib/save-exe.tl,
share/txr/stdlib/socket.tl, share/txr/stdlib/stream-wrap.tl,
share/txr/stdlib/struct.tl, share/txr/stdlib/tagbody.tl,
share/txr/stdlib/termios.tl, share/txr/stdlib/trace.tl,
share/txr/stdlib/txr-case.tl, share/txr/stdlib/type.tl,
share/txr/stdlib/vm-param.tl,
share/txr/stdlib/with-resources.tl,
share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl,
signal.c, signal.h, socket.c, socket.h, stream.c, stream.h,
struct.c, struct.h, strudel.c, strudel.h, sysif.c, sysif.h,
syslog.c, syslog.h, termios.c, termios.h, tree.c, tree.h,
txr.1, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h, vm.c,
vm.h, vmop.h, win/cleansvg.txr: Extended copyright notices
to 2020.
|
|
|
|
|
|
|
|
|
| |
* hash.c (hash_reset): New function.
(hash_init): hash-reset intrinsic registered.
* hash.h (hash_reset): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* hash.c (struct hash): Declaration removed from here.
(hash_iter_init, us_hash_iter_init, hash_iter_next,
hash_iter_peek): Functions switched to external linkage.
* hash.h (struct hash): Declared here now.
(hash_iter_init, us_hash_iter_init, hash_iter_next,
hash_iter_peek): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The code base contains a lot of irksome _func which should be
_fun, and also the public functions func-get-form and
func-get-name are irksomely named. As a first step, we can
fix parameters which carry this suffix.
* glob.c (global_wrap): errfunc argument renamed to errfun.
* glob.h (global_wrap): Likewise.
* hash.h (hash_uni, hash_isec): join_func argument renamed
to joinfun.
* hash.h (hash_uni, hash_isec): Likewise.
* txr.1: fixed gen-func typo. Arguments renamed in
descriptions of hash-uni, hash-isec, iff, iffi, glob,
and ftw.
|
|
|
|
|
|
|
|
|
| |
* hash.c (hash_invert): New function.
(hash_init): hash-invert intrinsic registered.
* hash.c (hash_invert): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We need eq based hash tables to fix a problem in *print-circle*.
* hash.c (enum hash_type, hash_type_t): New enum type.
(eq_based_k): New keyword variable.
(eq_hash, eq_hash_op): New static functions.
(hash_print_op): Ensure we print eq-based hashes with the
correct keyword.
(hash_assq, hash_aconsq_new_c): New static functions.
(hash_eq_ops): New static structure.
(do_make_hash): New function, made from previous contents of
make_seeded_hash.
(make_seeded_hash): Wrapper around do_make_hash now.
(make_eq_hash): New function.
(hashv): Parse out :eq-based argument. Use make_eq_hash if it
is present.
(hash_init): Initialize eq_based_k.
* hash.h (eq_based_k, make_eq_hash): Declared.
|
|
|
|
|
|
|
|
|
| |
* hash.c (hash_zip): New function.
(hash_init): hash-zip intrinsic registered.
* hash.h (hash_zip): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
| |
* hash.c (hash_peek): New function.
(hash_init): hash-peek intrinsic registered.
* hash.h (hash_peek): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
| |
* hash.c (us_hash_count): New function. Blindly assumes that
the argument is a hash.
* hash.h (us_hash_count): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Uses of gethash_f can be replaced with gethash_e, which
returns the hash cell directly rather than through a loc
argument. Code that needs the value can call cdr itself.
* hash.c (inhash, hash_isec, hash_update_1): Replace gethash_f
with gethash_e.
(gethash_f): Function removed.
* hash.h (gethash_f): Declaration removed.
* lib.c (use_sym, unuse_sym, find_symbol, unintern,
intern_fallback, in, sel, populate_obj_hash): Replace
gethash_f with gethash_e.
|
|
|
|
|
|
|
|
|
| |
* hash.c (hash_from_alist_v): New function.
(hash_init): Register hash-from-alist intrinsic.
* hash.h (hash_from_alist_v): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
| |
* hash.c (hash_symdiff): New function.
(hash_init): hash-symdiff intrinsic registered.
* hash.h (hash_symdiff): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* LICENSE, LICENSE-CYG, METALICENSE, Makefile, args.c, args.h,
arith.c, arith.h, buf.c, buf.h, cadr.c, cadr.h, combi.c,
combi.h, configure, debug.c, debug.h, eval.c, eval.h, ffi.c,
ffi.h, filter.c, filter.h, ftw.h, gc.c, gc.h, glob.c, glob.h,
hash.c, hash.h, itypes.c, itypes.h, jmp.S, lib.c, lib.h,
lisplib.c, lisplib.h, match.c, match.h, parser.c, parser.h,
parser.l, parser.y, protsym.c, rand.c, rand.h, regex.c,
regex.h, share/txr/stdlib/asm.tl, share/txr/stdlib/awk.tl,
share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl,
share/txr/stdlib/compiler.tl, share/txr/stdlib/conv.tl,
share/txr/stdlib/doloop.tl, share/txr/stdlib/error.tl,
share/txr/stdlib/except.tl, share/txr/stdlib/ffi.tl,
share/txr/stdlib/getopts.tl, share/txr/stdlib/getput.tl,
share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl,
share/txr/stdlib/keyparams.tl, share/txr/stdlib/op.tl,
share/txr/stdlib/package.tl, share/txr/stdlib/path-test.tl,
share/txr/stdlib/place.tl, share/txr/stdlib/pmac.tl,
share/txr/stdlib/socket.tl, share/txr/stdlib/stream-wrap.tl,
share/txr/stdlib/struct.tl, share/txr/stdlib/tagbody.tl,
share/txr/stdlib/termios.tl, share/txr/stdlib/trace.tl,
share/txr/stdlib/txr-case.tl, share/txr/stdlib/type.tl,
share/txr/stdlib/vm-param.tl, share/txr/stdlib/with-resources.tl,
share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl,
signal.c, signal.h, socket.c, socket.h, stream.c, stream.h,
struct.c, struct.h, strudel.c, strudel.h, sysif.c, sysif.h,
syslog.c, syslog.h, termios.c, termios.h, txr.1, txr.c, txr.h,
unwind.c, unwind.h, utf8.c, utf8.h, vm.c, vm.h, vmop.h,
win/cleansvg.txr: Extended Copyright line to 2018.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In this patch, the cobj_handle, cobj_ops and variants of
gethash get an additional argument to identify the caller.
Many functions are updated to pass this down.
* buf.c (buf_strm): Pass self name to cobj_handle.
* eval.c (env_fbind, env_vbind, rt_defvarl, me_case): Pass
self name to gethash_c or gethash_e.
(load): Pass self name to read_eval_stream and
read_compiled_file.
(reg_symacro): Pass situation-identifying string to gethash_c.
* ffi.c (ffi_type_struct_checked, ffi_closure_struct_checked,
ffi_call_desc_checked, uni_struct_checked):
Take self name parameter, and pass down to cobj_handle.
(ffi_get_type, ffi_get_lisp_type): Take self name and pass
down to ffi_type_struct_checked.
(union_get_ptr): Take self name and pass to
uni_struct_checked.
(ffi_union_in, ffi_union_put): Pass self name to union_get_ptr.
(ffi_type_compile): Pass self name to ffi_get_lisp_type.
(ffi_make_call_desc): Pass self name to
ffi_type_struct_checked, ffi_get_type and
ffi_call_desc_checked.
(ffi_make_closure): Pass self name to ffi_call_desc_checked.
(ffi_closure_get_fptr): Take self name, pass to
ffi_closure_struct_checked.
(ffi_typedef, ffi_size, ffi_alignof, ffi_offsetof,
ffi_arraysize, ffi_elemsize, ffi_elemtype, ffi_put_into,
ffi_put, ffi_in, ffi_get, ffi_out, make_carray): Pass self
name to ffi_closure_struct_checked.
(carray_struct_checked): Take self name, pass to cobj_handle.
(carray_set_length, carray_dup, carray_own, carray_free,
carray_type, length_carray, copy_carray, carray_ptr,
buf_carray, vec_carray, list_carray, carray_ref,
carray_refset, carray_sub, carray_replace, carray_get_common,
carray_put_common, unum_carray, num_carray, put_carray,
fill_carray): Pass self name to carray_struct_checked.
(carray_blank, carray_buf, carray_cptr): Pass self name
ffi_type_struct_checked.
(carray_pun): Pass self name to carray_struct_checked and
ffi_type_struct_checked.
(make_union): Pass self name to ffi_type_struct_checked.
(union_members, union_get, union_put, union_in, union_out):
Pass self name to uni_struct_checked.
(make_zstruct, zero_fill, put_obj, get_obj, fill_obj): Pass
self-name to ffi_type_struct_checked.
* ffi.h (ffi_closure_get_fptr, union_get_ptr): Declarations
updated.
* filter.c (trie_add): Pass self-name to gethash_l.
* hash.c (make_similar_hash, copy_hash, hash_count,
get_hash_userdata, set_hash_userdata, hash_begin, hash_next,
hash_uni, hash_diff, hash_isec): Pass self name
to cobj_handle.
(gethash_c, gethash_e): Take self name parameter and pass down
to cobj_handle.
(gethash_f): Take self parameter and pass down to gethash_e.
(gethash, inhash, gethash_n, sethash, pushhash, remhash,
clearhash, hash_update_1): Pass self name to gethash_e or gethash_c.
* hash.h (gethash_c, gethash_e, gethash_f): Declarations
updated.
(gethash_l): Take self name, and pass down to gethash_c.
* lib.c (class_check): Take self name parameter and use in
type mismatch diagnostic.
(use_sym, unuse_sym, symbol_needs_prefix, find_symbol,
intern, unintern, intern_fallback, unique, in, sel,
obj_print_impl, populate_obj_hash, obj_hash_merge): Pass self
name to gethash_f or gethash_l.
(symbol_visible, obj_init): Pass situation-identifying string
to gethash_e.
(cobj_handle, cobj_ops): Take self name parameter and pass
down to class_check.
* lib.h (class_check, cobj_handle, cobj_ops): Declarations
updated.
* match.c (v_load): Pass self name to read_compiled_file and
read_eval_stream.
* parser.c (get_parser_impl): Take self name and pass to
cobj_handle.
(ensure_parser): Pass situation-identifying string to
gethash_c.
(parser_circ_def): Pass self-name to gethash_c.
(lisp_parser_impl): Pass self name to get_parser_impl and
class_check.
(lisp_parse, nread, iread): Pass self-name to lisp_parser_impl.
(read_file_common): Take self name parameter and pass down to
get_parser_impl.
(read_eval_stream, read_compiled_file): Take self name and
pass down to read_file_common.
(load_rcfile): Pass situation-identifying string to
read_eval_streem.
(get_visible_syms): Pass situation-identifying string to
gethash_c.
(parser_errors, parser_eof): Pass self name to cobj_handle.
* parser.h (read_eval_stream, read_compiled_file):
Declarations updated.
* parser.y (rlset): Pass self name to gethash_c.
* rand.c (make_random_state, random_state_get_vec,l
random_fixnum, random_float): Pass self name to cobj_handle.
* regex.c (regex_source, regex_print, regex_run): Pass
self-name to cobj_handle.
(regex_machine_init): Take self name param and pass to
cobj_handle.
(search_regex, match_regex, match_regex_right,
regex_prefix_match, read_until_match): Pass self-name to
regex_machine_init.
* stream.c (stdio_get_fd): Pass self name to cobj_handle.
(generic_get_line): Get COBJ operations via unsafe, diret
object access rather than cobj_ops.
(set_mode_props): Get object handle via unsafe, direct object
access.
(stream_fd, sock_family, sock_type, sock_peer, set_sock_peer,
get_string_from_stream, get_list_from_stream, stream_set_prop,
stream_get_prop, close_stream, get_error, get_error_str,
clear_error, get_line, get_char, get_byte, unget_char,
unget_byte, put_buf, fill_buf, put_string, put_char, put_byte,
flush_stream, seek_stream, truncate_stream, get_indent_mode,
test_set_indent_mode, set_indent_mode, get_indent, set_indent,
inc_indent, width_check, force_break, get_set_ctx, get_ctx):
Pass self name to cobj_ops.
(make_delegate_stream): Take self name parameter, pass down to
cobj_ops.
(record_adapter): Pass self name down to make_delegate_stream.
(format): Pass self name to class_check.
* struct.c (stype_handle): Pass self name to cobj_handle.
(make_struct_type): Pass self name to class_check.
* txr.c (read_eval_stream_noerr): Take self name parameter,
pass to read_eval_stream.
(txr_main): Pass istuation-identifying string to
read_compiled_file and read_eval_stream_noerr.
* unwind.c (revive_cont): Pass self-name to cobj_handle.
* vm.c (vm_desc_struct): Take self name parameter, pass to
cobj_handle.
(vm_desc_nlevels, vm_desc_nregs, vm_desc_bytecode,
vm_desc_datavec, vm_desc_symvec, vm_execute_toplevel,
vm_execute_closure, vm_closure_entry): Pass self name to
vm_desc_struct.
(vm_closure_struct): Take self name parameter, pass to
cobj_handle.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Throughout the hashing framework, hashes are reduced into the
fixnum range, and returned as cnum. This is not necessary;
only the hash-eql and hash-equal functions need to reduce
hashes to fixnums. Let's make it ucnum everywhere else, using
its full range (no reduction into the [0, NUM_MAX) range).
* hash.c (struct hash_ops): hash_fun function pointer returns
ucnum instead of cnum.
(hash_double): Return unreduced ucnum. Obsolete #ifdef-s
removed; the ucnum type gives us a pointer-wide unsigned
integer on all platforms.
(equal_hash, eql_hash): Return ucnum. Don't reduce values to
fixnum range. Some of the way we combine hashes from recursive
calls changes; we multiply by at most 2 not to lose too many
bits.
(eql_hash_op, cobj_eq_hash_op, hash_hash_op): Return ucnum.
* hash.h (equal_hash): Declaration updated.
* lib.c (cobj_handle_hash_op): Return value changes to ucnum.
* lib.h (struct cobj_ops): Hash function pointer's return
type changes.
(cobj_eq_hash_op, cobj_handle_hash_op): Declarations updated.
* struct.c (struct_inst_hash): Return value changes to ucnum.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In this commit we feature-complete the seeded hashing
implementation. The *hash-seed* special variable is provided
from which newly created hashes take their seed. The
make-hash and hash-equal functions get an optional seed
argument. A function called gen-hash-seed is provided for
obtaining a randomized seed.
* hash.c (hash_seed): New macro.
(hash_seed_s): New symbol variable.
(make_seeded_hash): New function, made from make_hash.
(make_hash): Reduced to wrapper around make_seeded_hash.
(hash-equal): Take seed argument.
(gen_hash_seed): New function.
(hash_init): Initialize hash_seed_s and register *hash-seed*
special variable. Re-register make-hash with new optional
parameter, with regard to make_seeded_hash.
Re-register hash-equal with new optional parameter.
Register gen-hash-seed.
* hash.h (make_seeded_hash): Declared.
(hash_equal): Declaration updated.
* txr.1: Documented optional seed arguments of make-hash
and hash-equal. Documented new *hash-seed* variable
and gen-hash-seed function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Hashing of buffers and character strings is being replaced
with a seedable hash, providing a tool against denial of
service attacks against hash tables.
This commit lays most of the groundwork: most of the internal
interface changes, and a new hashing implementation. What is
missing is the mechanisms to do the seeding.
* hash.c (struct hash_ops): Hash operation now takes a seed
argument of type ucnum.
(struct hash): New member, seed.
(hash_str_limit): Default value changed to INT_MAX.
A short value opens the gateway to an obvious collision attack
whereby strings sharing the same 128 character prefix are
entered into the same hash table, which will defeat any
seedings strategy.
(randbox): New static array. Values come from the Kazlib hash
module, but are not used in exactly the same way.
(hash_c_str, hash_buf): Now take a seed argument, and are
rewritten.
(equal_hash): Takes a seed, and passes it to hash_c_str,
hash_buf and to recursive self calls.
(eql_hash_op): New static function. Adapts the eql_hash
operation, which doesn't take a seed, to the new interface
that calls for a seed.
(obj_eq_hash_op): Take a seed; ignore it.
(hash_hash_op): Take a seed, pass it down to equal_hash.
(hash_eql_ops): Wire hash functiono pointer to eql_hash_op
instead of eql_hash.
(make_hash): For now, intialize the hash's seed to zero.
(make_similar_hash): Copy original hash's seed.
(gethash_c, gethash_e, remhash): Pass hash table's seed to
the hashing function.
(hash_equal): Pass a seed of zero to equal_hash for now;
this function will soon acquire an optional parameter for the
seed.
* hash.h (equal_hash): Declaration updated.
* lib.c (cobj_handle_hash_op): Take seed argument, pass down.
* lib.h (cobj_ops): Hash operation now takes seed.
(cobj_eq_hash_op, cobj_handle_hash_op): Declarations updated.
* struct.c (struct_inst_hash): Take seed argument, pass down.
* tests/009/json.expected: Updated, because the hash table
included in this output is now printed in a different order.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* LICENSE, LICENSE-CYG, METALICENSE, Makefile, args.c, args.h,
arith.c, arith.h, buf.c, buf.h, cadr.c, cadr.h, combi.c,
combi.h, configure, debug.c, debug.h, eval.c, eval.h, ffi.c,
ffi.h, filter.c, filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c,
glob.h, hash.c, hash.h, itypes.c, itypes.h, jmp.S, lib.c,
lib.h, lisplib.c, lisplib.h, match.c, match.h, parser.c,
parser.h, parser.l, parser.y, protsym.c, rand.c, rand.h,
regex.c, regex.h, share/txr/stdlib/awk.tl,
share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl,
share/txr/stdlib/conv.tl, share/txr/stdlib/doloop.tl,
share/txr/stdlib/error.tl, share/txr/stdlib/except.tl,
share/txr/stdlib/ffi.tl, share/txr/stdlib/getopts.tl,
share/txr/stdlib/getput.tl, share/txr/stdlib/hash.tl,
share/txr/stdlib/ifa.tl, share/txr/stdlib/keyparams.tl,
share/txr/stdlib/op.tl, share/txr/stdlib/package.tl,
share/txr/stdlib/path-test.tl, share/txr/stdlib/place.tl,
share/txr/stdlib/pmac.tl, share/txr/stdlib/socket.tl,
share/txr/stdlib/stream-wrap.tl, share/txr/stdlib/struct.tl,
share/txr/stdlib/tagbody.tl, share/txr/stdlib/termios.tl,
share/txr/stdlib/txr-case.tl, share/txr/stdlib/type.tl,
share/txr/stdlib/with-resources.tl,
share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl,
signal.c, signal.h, socket.c, socket.h, stream.c, stream.h,
struct.c, struct.h, strudel.c, strudel.h, sysif.c, sysif.h,
syslog.c, syslog.h, termios.c, termios.h, txr.1, txr.c, txr.h,
unwind.c, unwind.h, utf8.c, utf8.h, win/cleansvg.txr:
Extended Copyright line to 2018.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* hash.c (eql_based_k): New keyword variable.
(equal_based_p): New static function.
(hashv): Use eql_based_p to determine whether to make an
equal-based hash table. Subject to opt_compat relative
to version 187.
(hash_init): Intern :eql-based keyword and store in new
variable.
* hash.h (eql_based_k, userdata_k): Declared.
* txr.1: Documentation updated, with compat notes too.
|
|
|
|
|
|
|
|
|
| |
* hash.c (gethash_e): New function. Just returns the entry cell if
found, or else nil. This should have been written first.
(gethash, gethash_f, gethash_n): Replace body with trivial one-liner
based on gethash_e.
* hash.h (gethash_e): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* LICENSE, LICENSE-CYG, METALICENSE, Makefile, args.c, args.h,
arith.c, arith.h, cadr.c, cadr.h, combi.c, combi.h, configure,
debug.c, debug.h, eval.c, eval.h, filter.c, filter.h, ftw.c,
ftw.h, gc.c, gc.h, glob.c, glob.h, hash.c, hash.h, jmp.S,
lib.c, lib.h, lisplib.c, lisplib.h, match.c, match.h,
parser.c, parser.h, parser.l, parser.y, rand.c, rand.h,
regex.c, regex.h, signal.c, signal.h, stream.c, stream.h,
struct.c, struct.h, sysif.c, sysif.h, syslog.c, syslog.h,
termios.c, termios.h, txr.1, txr.c, txr.h, unwind.c, unwind.h,
utf8.c, utf8.h, share/txr/stdlib/awk.tl,
share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl,
share/txr/stdlib/conv.tl, share/txr/stdlib/except.tl,
share/txr/stdlib/getopts.tl, share/txr/stdlib/getput.tl,
share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl,
share/txr/stdlib/package.tl, share/txr/stdlib/path-test.tl,
share/txr/stdlib/place.tl, share/txr/stdlib/socket.tl,
share/txr/stdlib/struct.tl, share/txr/stdlib/tagbody.tl,
share/txr/stdlib/termios.tl, share/txr/stdlib/txr-case.tl,
share/txr/stdlib/type.tl, share/txr/stdlib/with-resources.tl,
share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl:
Add 2017 to all copyright headers and strings.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is needed for an upcoming bugfix, so why not expose it as
an intrinsic.
* hash.c (clearhash): New function.
(hash_init): clearhash intrinsic registered.
* hash.h (clearhash): Declared.
* txr.1: Documented clearhash.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Makefile, args.c, args.h, arith.c, arith.h, cadr.c, cadr.h, combi.c,
combi.h, configure, debug.c, debug.h, eval.c, eval.h, filter.c,
filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c, glob.h, hash.c, hash.h,
jmp.S, lib.c, lib.h, lisplib.c, lisplib.h, match.c, match.h, parser.c,
parser.h, parser.l, parser.y, rand.c, rand.h, regex.c, regex.h,
share/txr/stdlib/awk.tl, share/txr/stdlib/build.tl,
share/txr/stdlib/cadr.tl, share/txr/stdlib/conv.tl,
share/txr/stdlib/except.tl, share/txr/stdlib/hash.tl,
share/txr/stdlib/ifa.tl, share/txr/stdlib/path-test.tl,
share/txr/stdlib/place.tl, share/txr/stdlib/socket.tl,
share/txr/stdlib/struct.tl, share/txr/stdlib/termios.tl,
share/txr/stdlib/txr-case.tl, share/txr/stdlib/type.tl,
share/txr/stdlib/with-resources.tl, share/txr/stdlib/with-stream.tl,
share/txr/stdlib/yield.tl, signal.c, signal.h, socket.c, socket.h,
stream.c, stream.h, struct.c, struct.h, sysif.c, sysif.h, syslog.c,
syslog.h, termios.c, termios.h, txr.1, txr.c, txr.h, unwind.c,
unwind.h, utf8.c, utf8.h: Revert to verbatim 2-Clause BSD.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Curtail traversal of objects and strings.
* hash.c (struct hash): hash_fun member takes int *
parameter now.
(HASH_STR_LIMIT, HASH_REC_LIMIT): New macros.
(hash_c_str): Hash only HASH_STR_LIMIT characters.
(equal_hash): Becomes extern function. Takes pointer-to-int
count argument, which is decremented. Function stops
recursing and returns zero when this hits zero.
(eql_hash): Also takes int * param, for compatibility
with function pointer in struct hash. This parameter
is not used, though.
(cobj_hash_op): Take pointer-to-count parameter,
but ignore it.
(hash_hash_op): Take pointer-to-count parameter,
decrement and check that it has not hit zero,
pass down to equal hash.
(hash_grow, gethash_c, gethash, gethash_f, gethash_n,
remhash): Initialize a counter to HASH_REC_LIMIT and
pass down to hashing function.
(hash_eql): Pass down a pointer to a dummy counter
to eql_hash.
(hash_equal): Initialize a counter to HASH_REC_LIMIT
and pass down to hash_equal.
* hash.h (equal_hash): Declared.
* lib.h (cobj_ops): hash member takes int * parameter.
(cobj_hash_op): Declaration updated with new param.
* struct.c (struct_inst_hash): Takes new int * parameter
for count. Calls equal_hash instead of hash_equal,
eliminating c_num calls; pointer to count is
passed to equal_hash.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* LICENSE, METALICENSE, Makefile, args.c, args.h, arith.c,
arith.h, cadr.c, cadr.h, combi.c, combi.h, configure,
debug.c, debug.h, eval.c, eval.h, filter.c, filter.h, gc.c,
gc.h, glob.c, glob.h, hash.c, hash.h, jmp.S, lib.c, lib.h,
lisplib.c, lisplib.h, match.c, match.h, parser.c, parser.h,
parser.l, parser.y, rand.c, rand.h, regex.c, regex.h,
share/txr/stdlib/cadr.tl, share/txr/stdlib/except.tl,
share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl,
share/txr/stdlib/path-test.tl, share/txr/stdlib/place.tl,
share/txr/stdlib/struct.tl, share/txr/stdlib/txr-case.tl,
share/txr/stdlib/type.tl, share/txr/stdlib/with-resources.tl,
share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl,
signal.c, signal.h, stream.c, stream.h, struct.c, struct.h,
sysif.c, sysif.h, syslog.c, syslog.h, txr.1, txr.c, txr.h,
unwind.c, unwind.h, utf8.c, utf8.h: Add 2016 copyright.
* linenoise/LICENSE, linenoise/linenoise.c,
linenoise/linenoise.h: Bump one principal author's copyright
from 2014 to 2015. The code is based on a snapshot of 2015
upstream work.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register group-reduce intrinsic.
* hash.c (group_reduce): New function.
* hash.h (group_reduce): Declared.
* txr.1: Documented group-reduce.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Function arguments are now allocated on the stack using alloca,
in conjunction with the struct alloc header structure.
The generic_funcall and apply functions are refactored
for this, as are most functions that take variadic arguments.
* args.c (args_add_list, args_cons_list): Functions removed.
(args_normalize, args_normalize_fill): New functions.
(args_get_checked): Draw arguments from list when array runs out.
(args_copy, args_copy_zap): New functions.
* args.h (ARGS_MAX): Reduced to 32.
(ARGS_MIN): New preprocessor symbol.
(args_init): Call args_init_list.
(args_add2, args_add3, args_add4): New inline functions.
(args_more): Take into account list, which may hold additional arguments.
(args_two_more): New inline function.
(args_normalize, args_normalize_fill): Declared.
(args_get_list): Normalize all arguments into one list and return it.
(args_get_rest, args_at, args_atz): New inline functions.
(args_get): Draw arguments from list when array runs out.
(args_clear): New inline function.
* arith.c (maskv): Convert to new args.
* eval.c (APPLY_ARGS): Preprocessor symbol removed.
(bind_args): Converted to accept struct args.
(apply): Function reduced down to trivial adapter which
converts a list of arguments to args, and calls the new
generic_funcall.
(applyv): New static function: struct args wrapper
around apply_intrinsic.
(iapply): Converted to struct args.
(call): Static function removed. The call intrinsic
function binding now goes directly to generic_funcall.
(list_star_intrinsic, interp_fun): Converted to struct args.
(op_catch): Adjustments for bind_args, which requires
a struct args arglist.
(me_op): Must use the new minl and maxl, since minv and maxv
don't take lists any more.
(mapcarv, mappendv, lazy_mapcarv, lazy_mappendv, mapdov,
weavev, or_fun, and_fun, tf, nilf, do_retf, do_apf,
do_ipf, callf, do_mapf, mapf): Converted.
(mapcarl): New function, like the old mapcarv.
(eval_init): call_f initialized from generic_funcall
rather than call. apply registered to applyv rather than
apply_intrinsic. Registrations for zip, hash_from_pairs, vec,
alist-remove, alist-nremove, and throw similarly updated to
new or renamed functions.
* eval.h (interp_fun, mapcarv): Declarations updated.
(mapcarl): Declard.
* hash.c (hashv): Converted to struct args.
(hashl): New function.
(hash_construct): Use hashl, not hashv.
(hash_from_pairs, hash_list, group_by): Converted.
* hash.h (hashv, hash_construct, hash_from_pairs, hash_list,
group_by): Declarations updated.
(hashl): Declared.
* lib.c (appendv, nconcv, lazy_appendv): Converted to
struct args.
(lazy_appendl): New function.
(multi): Converted.
(listv): New function.
(nary_op, plusv, mulv, logandv, logiorv, gtv, ltv, gev, lev,
numeqv, numneqv, maxv, minv): Converted.
(maxl, minl): New functions, like old maxv and minv.
(exptv, gcdv, lcmv, lessv, greaterv, lequalv, gequalv): Converted.
(func_f0v, func_f1v, func_f2v, func_f3v, func_f4v): Converted.
(func_n0v, func_n1v, func_n2v, func_n3v, func_n4v): Converted.
(func_n0v, func_n1v, func_n2v, func_n3v, func_n4v): Converted.
(func_n1ov, func_n2ov, func_n3ov): Converted.
(generic_funcall): Converted to take struct args.
(funcall, funcall1, funcall2, funcall4): Pass stack-allocated
struct args as trailing arguments to variadic functions, and to
generic_funcall.
(do_curry_12_1_v): New struct-args-based static function,
needed to implement curry_12_1_v now.
(curry_12_1_v): Converted.
(transposev): New function based on previous tranpose.
(transpose): Now a wrapper for transposev.
(do_chain, chainv, do_chand, chandv, do_juxt, juxtv,
do_and, andv, do_or, orv, do_not, do_iff): Converted.
(vectorv): New function. Implementation basis for vec intrinsic function.
(alist_removev, alist_nremovev): New functions.
(multi_sort): Switch from mapcarv to mapcarl.
(unique): Converted.
(uniq): Allocate struct args for calling unique.
(obj_init): list_f function now based on new listv, rather than
identity.
* list.h (varg): New typedef.
(struct func): All variadic function pointers converted to use
struct args.
(appendv, nconcv, lazy_appendv, multi, nary_op, plusv, minusv,
mulv, gtv, ltv, gev, lev, numeqv, numneqv, maxv, minv, exptv,
gcdv, lcmv, logadnv, logiorv, maskv, lessv, greaterv, lequalv,
gequalv, func_f0v, func_f1v, func_f2v, func_f3v, func_f4v,
func_n0v, func_n1v, func_n2v, func_n3v, func_n4v, func_n0v,
func_n1v, func_n2v, func_n3v, func_n4v, func_n1ov, func_n2ov,
func_n3ov, generic_funcall, chainv, chandv, juxtv, adnv, orv,
unique): Declarations updated.
(lazy_appendl, listv, maxl, minl, transposev,
vectorv, alist_removev, alist_nremovev): Declared.
* stream.c (make_catenated_stream_v): New function.
(aformat): Renamed to formatv. The recognition of the nil
and t streams (standard output and string) is done here now.
(vformat): Follow rename of aformat to formatv.
(formatv): Function removed. Nobody calls this anymore.
(stream_init): make-catenated-stream re-registered to new
make_catenated_stream_v function.
* stream.h (formatv): Declaration updated.
(make_catenated_v): Declared.
* syslog.c (syslog_init): syslog registred to syslog_wrapv.
(syslog_wrapv): New function based on syslog_wrap converted to struct
args.
(syslog_wrap): Now wrapper for syslog_wrapv.
* syslog.h (syslog_wrapv): Declared.
* unwind.h (uw_throwv): New function.
(uw_throwfv, uw_errorfv): Converted to struct args.
* unwind.h (uw_throwv): Declared.
(uw_throwfv, uw_errorfv): Declarations updated.
|
|
|
|
|
|
|
|
| |
* hash.h (hash_revget): Declared.
* eval.c (eval_init): Registered hash-revget intrinsic.
* txr.1: Documented hash-revget.
|
|
|
|
|
|
|
|
|
| |
* hash.h (hash_from_pairs, hash_list): Declared.
* eval.c (eval_init): Registered hash-from-pairs and hash-list
intrinsic.
* txr.1: Documented new functions.
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register hash-subset and hash-proper-subset
intrinsics.
* hash.c (hash_subset, hash_proper_subset): New functions.
* hash.h (hash_subset, hash_proper_subset): Declared.
* txr.1: New functions documented.
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
GC. The issue being solved here is the accuracy of the gc_set function.
The existing impelmentation is too conservative. It has no generation
information about the memory location being stored, and so it assumes
the worst: that it is a location in the middle of a gen 1 object.
This is sub-optimal, creating unacceptable pressure against the
checkobj array and, worse, as a consequence causing unreachable gen 0
objects to be tenured into gen 1.
To solve this problem, we replace "val *" pointers with a structure
of type "loc" which keeps track of the object too, which lets us
discover the generation.
I tried another approach: using just a pointer with a bitfield
indicating the generation. This turned out to have a serious issue:
such a bitfield goes stale when the object is moved to a different
generation. The object holding the memory location is in gen 1, but the
annotated pointer still indicates gen 0. The gc_set function then
makes the wrong decision, and premature reclamation takes place.
* combi.c (perm_init_common, comb_gen_fun_common,
rcomb_gen_fun_common, rcomb_list_gen_fun): Update to new interfaces
for managing mutation.
* debug.c (debug): Update to new interfaces for managing mutation.
Avoid loc variable name.
* eval.c (env_fbind, env_fbind): Update to new interfaces
for managing mutation.
(lookup_var_l, dwim_loc): Return loc type and update to new interfaces.
(apply_frob_args, op_modplace, op_dohash, transform_op, mapcarv,
mappendv, repeat_infinite_func, repeat_times_func): Update to new
interfaces for managing mutation.
* eval.h (lookup_var_l): Declaration updated.
* filter.c (trie_add, trie_compress, trie_compress_intrinsic,
* build_filter, built_filter_from_list, filter_init): Update to new
* interfaces.
* gc.c (gc_set): Rewritten to use loc type which provides the exact
generation. We do not need the in_malloc_range hack any more, since
we have the backpointer to the object.
(gc_push): Take loc rather than raw pointer.
* gc.h (gc_set, gc_push): Declarations updated.
* hash.c (struct hash): The acons* functions use loc instead
of val * now.
(hash_equal_op, copy_hash, gethash_c, inhash, gethash_n, pushhash,
Change to how locations are passed around, for the sake of generational
GC. The issue being solved here is the accuracy of the gc_set function.
The existing impelmentation is too conservative. It has no generation
information about the memory location being stored, and so it assumes
the worst: that it is a location in the middle of a gen 1 object.
This is sub-optimal, creating unacceptable pressure against the
checkobj array and, worse, as a consequence causing unreachable gen 0
objects to be tenured into gen 1.
To solve this problem, we replace "val *" pointers with a structure
of type "loc" which keeps track of the object too, which lets us
discover the generation.
I tried another approach: using just a pointer with a bitfield
indicating the generation. This turned out to have a serious issue:
such a bitfield goes stale when the object is moved to a different
generation. The object holding the memory location is in gen 1, but the
annotated pointer still indicates gen 0. The gc_set function then
makes the wrong decision, and premature reclamation takes place.
* combi.c (perm_init_common, comb_gen_fun_common,
rcomb_gen_fun_common, rcomb_list_gen_fun): Update to new interfaces
for managing mutation.
* debug.c (debug): Update to new interfaces for managing mutation.
Avoid loc variable name.
* eval.c (env_fbind, env_fbind): Update to new interfaces
for managing mutation.
(lookup_var_l, dwim_loc): Return loc type and update to new interfaces.
(apply_frob_args, op_modplace, op_dohash, transform_op, mapcarv,
mappendv, repeat_infinite_func, repeat_times_func): Update to new
interfaces for managing mutation.
* eval.h (lookup_var_l): Declaration updated.
* filter.c (trie_add, trie_compress, trie_compress_intrinsic,
* build_filter, built_filter_from_list, filter_init): Update to new
* interfaces.
* gc.c (gc_set): Rewritten to use loc type which provides the exact
generation. We do not need the in_malloc_range hack any more, since
we have the backpointer to the object.
(gc_push): Take loc rather than raw pointer.
* gc.h (gc_set, gc_push): Declarations updated.
* hash.c (struct hash): The acons* functions use loc instead
of val * now.
(hash_equal_op, copy_hash, gethash_c, inhash, gethash_n, pushhash,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
that return the new or old cons cell rather than a pointer
to its cdr field.
* eval.c (transform_op): use of acons_new_l replaced with
acons_new_c.
* hash.c (struct hash): acons_new_l_fun member replaced
with acons_new_c_fun.
(make_hash, make_similar_hash): initialize acons_new_l_fun
member using either acons_new_c or aconsql_new_c.
(gethash_l): function becomes an inline in hash.h.
(gethash_c): new function, based on gethash_l.
(inhash, gethash_n): updated w.r.t struct hash change.
* hash.h (gethash_c): declared.
(gethash_l): becomes an inline wrapper for gethash_c.
* lib.c (acons_new_l, aconsql_new_l): functions removed.
(acons_new_c, aconsql_new_c): new functions.
(obj_init): use gethash_c and rplacd instead of gethash_l
and set.
* lib.h (acons_new_l, aconsql_new_l): declarations removed.
(acons_new_c, aconsql_new_c): declared.
|
|
|
|
|
|
|
|
| |
* hash.c (hash_update_1): New function.
* hash.h (hash_update_1): Declared.
* txr.1: Documented hash-update-1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
for more flexible joining of data from the hash tables.
* eval.c (eval_init): Remove hash_guni and hash_gisec. Change
registration for hash_uni and hash_isec to three arguments with
one optional.
* hash.c (hash_uni): Third parameter introduced, join_func.
The default behavior changes: in the two argument case,
clashing keys prefer the value from hash1 rather than hash2.
For this reason, we now iterate over hash2 first, then hash1.
(hash_guni): Removed.
(hash_isec): Third parameter introduced, join_func.
(hash_gisec): Removed.
* hash.h (hash_uni, hash_isec): Declarations updated.
(hash_guni, hash_gisec): Delarations removed.
* txr.1: Documentation updated.
|
|
|
|
|
|
|
|
|
|
|
| |
* hash.c (hash_guni, hash_gisec): New functions.
(hash_isec): Bugfix: since gethash was naively used, keys in hash2
associated with the value nil were erroneously omitted from the
intersection.
* hash.h (hash_guni, hash_gisec): Declared.
* txr.1: Documented new functions.
|
|
|
|
|
|
|
|
|
| |
* hash.c (inhash): New function.
* hash.h (inhash): Declared.
* txr.1: Documented inhash. Also, added surprisingly missing
documentation for gethash!
|
|
|
|
|
|
|
|
|
|
|
|
| |
* hash.h (hash_update): Declared.
* lib.c (update): New function.
* lib.h (update): Declared.
* eval.c (eval_init): Register hash_update and update as intrinsics.
* txr.1: Documented.
|
|
|
|
|
|
|
|
| |
* hash.h (group_by): Declared.
* eval.c (eval_init): group_by registered as group-by intrinsic.
* txr.1: Documented.
|
|
|
|
| |
Fixing some errors in copyright comments.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
hash-uni, hash-diff, hash-isec.
* hash.c (make_similar_hash, copy_hash, hash_uni, hash_diff,
hash_isec): New functions.
* hash.h (make_similar_hash, copy_hash, hash_uni, hash_diff,
hash_isec): Declared.
* txr.1: Updated.
* txr.vim: Highlighting for these new functions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
can walk table content in different ways.
* eval.c (op_dohash): Follow interface change of hash_next.
(eval_init): hash-keys, hash-values, hash-pairs and hash-alist
intrinsics introduced.
* filter.c (trie_compress): Follow interface change of hash_next.
* hash.c (hash_next): Silly interface which takes a pointer to
the iterator has changed to just take the iterator. The function
unambiguously returns nil when the iteration ends, so there
is no need to set the iterator variable to nil.
(maphash): Follows interface change of hash_next.
(hash_keys_lazy, hash_values_lazy, hash_pairs_lazy, hash_alist_lazy):
New static functions.
(hash_keys, hash_values, hash_pairs, hash_alist): New functions.
* hash.h (hash_next): Declaration updated.
(hash_keys, hash_values, hash_pairs, hash_alist): Declared.
* lib.c (make_half_lazy_cons): New way of constructing lazy cons,
with the car field specified. It simplifies situations when the
previous cons computes the car of the next one. Why hadn't I thought of
this before?
* lib.h (make_half_lazy_cons): Declared.
* txr.1: Doc stubs for new hash functions.
* txr.vim: Highlighting for new hash functions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
quasiquoting. We cannot use the same symbol for the
literal form from the parser, and for the expanded form,
because this creates a confusion when there are multiple
nestings of quasiquote expansion.
* eval.c (vector_lit_s, vector_list_s, hash_lit_s): New symbol
variables.
(hash_construct_s): Relocated here from hash.c.
(expand_qquote): Part of bugfix: look for hash_lit_s
instead of has_construct_s. Translate to a hash_construct_s
form which is no longer recognizes as a hash literal.
Implementing recognition of a quasiquote vector literal,
handled similarly.
(eval_init): Initialize vector_lit_s, vector_list_s,
hash_list_s and hash_lit_s.
Use vector_list_s when registering vector_list function.
* eval.h (vector_lit_s, vector_list_s, hash_lit_s,
hash_constuct_s): Declared.
* hash.c (hash_construct_s): Variable removed
and relocated into eval.c.
(hash_init): Initialization of hash_construct_s removed.
* hash.h (hash_construct_s): Declaration removed.
* parser.y: (vector): Action updated to generate
a (vec-lit ...) form if the object contains unquotes,
otherwise generate a vector object.
(hash): Generate hash-lit form, not a
hash-construct form.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
to express dynamic hash table construction
* eval.c (expand_qquote): Recognize hash-construct
forms: expand the hash arguments and pairs separately,
then rewrite to a new hash-construct form.
(eval-init): hash-construct intrinsic function added.
* hash.c (hash_construct_s): New symbol variable.
(hash_construct): New function.
(hash_init): Initialize hash_construct_s.
* hash.h (hash_construct_s, hash_construct): Declared.
* parser.y (hash): Rule rewritten to emit either a literal
hash table object, or a hash-construct form, based on
whether quasiquote unquotes occur within the syntax.
(hash_from_notation): Function removed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.h: Likewise.
* debug.c: Added copyright header.
* debug.h: Updated copyright year.
* eval.c: Likewise.
* eval.h: Likewise.
* filter.c: Likewise.
* filter.h: Likewise.
* gc.c: Likewise.
* gc.h: Likewise.
* hash.c: Likewise.
* hash.h: Likewise.
* lib.c: Likewise.
* lib.h: Likewise.
* match.c: Likewise.
* match.h: Likewise.
* parser.h: Likewise.
* regex.c: Likewise.
* regex.h: Likewise.
* stream.c: Likewise.
* stream.h: Likewise.
* txr.c: Likewise, and e-mail address.
* txr.h: Updated copyright year.
* unwind.c: Likewise.
* unwind.h: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* debug.c (help, show_bindings): put_string arguments reversed.
* eval.c (bind_args): Support colon notation in interpreted
function lambda lists for optional arguments. Improved error checking.
(apply): Allow optional arguments to be left out.
(dwim_loc): Reversed arguments to replace_str, replace_vec,
replace_list.
(eval_init): Numerous intrinsics now have arguments that are optional.
New function rand introduced which reverses arguments relative to
random. New intrinsic function hash introduced for alternative
construction of hashes.
* gc.c (sweep): Reversed arguments to put_char.
* hash.c (weak_keys_k, weak_vals_k, equal_based_k): New keyword
symbol variables.
(hashv): New function.
(hash_init): Intern new symbols.
* hash.h (weak_keys_k, weak_vals_k, equal_based_k, hashv): Declared.
* lib.c (colon_k): New keyword symbol variable.
(replace_list, replace_str, replace_vec): Arguments rearranged.
(tree_find): testfun becomes optional argument.
(int_str): base becomes optional argument.
(func_f0, func_f1, func_f2, func_f3, func_f4, func_n0,
func_n1, func_n2, func_n3, func_n4, func_f0v, func_f1v,
func_f2v, func_f3v, func_f4v, func_n0v, func_n1v,
func_n2v, func_n3v, func_n4v, func_interp): Initialize optargs to zero.
(func_n0o, func_n1o, func_n2o, func_n3o, func_n4o): New functions.
(cobj_print_op): Reversed arguments to put_string.
(find): testfun and keyfun become optional arguments.
(replace): Parameters rearranged and arguments rearranged in calls to
replace_list, replace_str and replace_vec.
(obj_init): colon_k initialized.
(obj_print, obj_pprint): Arguments reversed, and stream defaults
to std_output. Arguments reversed in calls to put_char and put_string.
(dump): Arguments reversed in call to put_char.
* lib.h (struct func): sizes of minparam, fixparam bitfields
adjusted. New bitfield optargs. New unnamed bitfield added so
the previous ones add up to 16 bits.
(colon_k): Declared.
(func_n0o, func_n1o, func_n2o, func_n3o, func_n4o): Declared.
(replace_list, replace_str, replace_vec, replace): Declarations updated.
* match.c (debuglf, dump_shell_string, dump_byte_string, dump_var,
do_output_line, extract): Reversed arguments to put_char and
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
due to negative hashing values being reduced modulo table size
to a negative array index.
* hash.c (equal_hash, eql_hash): Ensure
that value returned is in the range [0,NUM_MAX].
(hash_obj): Unused function removed.
(cobj_hash_op): Use hashing similar to eql hash for
other kinds of references.
(hash_eql, hash_equal): Removed bogus % NUM_MAX reduction.
* hash.h (hash_obj): Declaration removed.
|