| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
* hash.c (equal_hash): Eliminating displacement from character
hashes. Simplifying some code.
(eql_hash): Handle fixnums, characters and literals specially,
rather than hashing all value types the same way. The shift
applicable for object pointers causes adjacent integers to clash.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Renamed vec_set_fill to vec-set-length.
* hash.c (equal_hash): vec_fill to vec_length name change.
(hash_grow, make_hash): No need to call vec_set_length.
* lib.c (equal, vecref, vec_push, length_vec, list_vector,
obj_print, obj_pprint): vec_fill to vec_length name change.
(vector): Argument now represents actual length, not just allocated
size.
(vec_get_fill): Function removed; did exactly the same thing
as length_vec.
(vec_set_fill): Function renamed to vec_set_length.
(vector_list): Allocate a 0 length vector initially.
* lib.h (enum vecindex): member changes name from vec_fill
to vec_length.
(vector): Parameter name changed.
(vec_set_fill): Redeclared.
(vec_get_fill): Declaration removed.
* txr.1: Doc stubs updated.
|
|
|
|
|
|
|
|
| |
* hash.c (hash_eql, hash_equal): New external functions.
* hash.h (hash_eql, hash_equal): Declared.
* txr.1: Sections added.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bignums, based on Michael Fromberger's MPI library, are integrated
into the input syntax, stream output, equality testing, the garbage
collector, and hashing.
The plus operation handles transitions between fixnums and bignums.
Other operations are still fixnum only.
* Makefile (CFLAGS): Add mpi directory to include file search.
(OBJS): Include new arith.o module and all of MPI_OBJS.
(MPI_OBJS, MPI_OBJS_BASE): New variables.
* configure (mpi_version, have_quilt, have_patch): New variables.
Script detects whether patch and quilt are available. Unpacks
mpi library, applies patches. Detects 128 bit integer type.
Records more information in config.h about the sizes of types.
* dep.mk: Updated.
* depend.txr: Make work with paths that have directory components.
* eval.c (eval_init): Rename of nump to fixnump.
* gc.c (finalize, mark_obj): Handle BGNUM case.
* hash.c: (hash_c_str): Changed to return unsigned long
instead of long.
(equal_hash): Handle BGNUM case.
(eql_hash): Handle bignums with equal-hash, but other
objects as eq.
* lib.c (num_s): Variable renamed to fixnum_s.
(bignum_s): New symbol variable.
(code2type): Follow rename of num_s. Handle BGNUM case.
(typeof): Follow rename of num_s.
(eql): Handle bignums using equal, and other types using eq.
(equal): Handle BGNUM case.
(chk_calloc): New function.
(c_num): Wording change in error message: is not a fixnum.
(nump): Renamed to fixnump.
(bignump): New function.
(plus): Function removed, reimplemented in arith.c.
(int_str): Handle integers which are too large for wcstol
using bignum conversion. Base 0 is no longer passed to
wcstol but converted to 10 because the special semantics
for 0 would be inconsistent for bignums.
(obj_init): Follow rename of num_s. Initialize bignum_s.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(eval_init): New intrinsics.
* hash.c (struct_hash): assoc_fun parameters reversed.
(gethash, gethash_f, gethash_n): Likewise.
* lib.c (assoc, assq): Reversing parameters.
(find_package, acons_new, acons_new_l, aconsq_new): Reversing
arguments to assoc adn assq.
* lib.h (assoc, assq): Declarations updated.
* match.c (dest_set, dest_bind, h_var, h_coll, h_parallel, h_fun,
subst_vars, do_txeval, v_next, v_parallel, v_gather, v_collect,
v_flatten, v_cat, v_output, v_filter, f_fun, match_funcall):
Reversing arguments to assoc.
* unwind.c (uw_get_func, uw_exception_subtype_p, uw_register_subtype):
Reversing arguments to assoc.
* txr.1: Blank sections created for new functions.
|
|
|
|
|
|
|
|
| |
in the the 2010-01-26 commit, prior to release 033. When processing a
table with weak values, this function was mistakenly testing the keys
rather than values for for reachability. I noticed this when a test
case that should run in constant memory showed unwarranted accumulation
of memory.
|
|
|
|
|
|
| |
* hash.c (maphash): New function.
* hash.h (maphash): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Lisp interpreter added.
* gc.c (finalize, mark_obj): Handle ENV objects.
* hash.c (struct hash): acons_new_l_fun function
pointer order of arguments change.
(equal_hash): Handle ENV.
(make_hash, gethash_l): Use cobj_handle for
type safety. Follow change in acons_new_l.
(gethash, gethash_f, remhash, hash_count,
hash_get_userdata, hash_set_userdata, hash_next): Use cobj_handle.
(gethash_n): New function.
* hash.h (gethash_n): Declared.
* lib.c (env_s): New symbol variable.
(code2type, equal): Handle ENV. (plusv, minusv, mul, mulv, trunc, mod,
gtv, ltv, gev, lev, maxv, minv, int_str): New functions.
(rehome_sym): New static function.
(func_f0, func_f1, func_f2, func_f3, func_f4, func_n0, func_n1,
func_n2, func_n3, func_n4): Initialize new fields of struct func.
(func_f0v, func_f1v, func_f2v, func_f3v, func_f4v,
func_n0v, func_n1v, func_n2v, func_n3v, func_n4v,
func_interp): New functions.
(apply): Function removed: sanely re-implemented in new eval.c file.
(funcall, funcall1, funcall2, funcall3, funcall4): Handle
variadic and interpreted functions.
(acons, acons_new, acons_new_l, aconsq_new, aconsq_new_l): Reordered
arguments for compatibility with Common Lisp acons.
(obj_init): Special hack to prepare hash_s symbol, which is
needed for type checking inside the hash table funtions invoked
by make_package, at a time when the symbol is not yet interned.
Initialize new env_s variable.
(obj_print, obj_pprint): Handle ENV. Fix confusing rendering of
of function type.
(init): Call new function eval_init.
* lib.h (enum type): New enumeration member ENV.
(struct func): functype member changed to bitfield.
New bitfied members minparam and variadic.
New members in f union: f0v, f1v, f2v, f3v,
f4v, n0v, n1v, n2v, n3v, n4v.
(struct env): New type.
(union obj): New member e of type struct env.
(env_s): Variable declared.
(plusv, minusv, mul, mulv, trunc, mod, gtv, ltv, gev, lev, maxv, minv,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
the garbage collector (uninitialized fields in function objects).
* Makefile: Defined TXR_ARGS and TXR_OPTS for new test case.
* hash.c (hash_begin): Construction of cobj modified to obey
the correct procedure described in HACKING.
* lib.c (func_n3, func_n4): These functions neglected to initialize
the env member of the function structure.
* tests/009/json.expected: New file.
* tests/009/json.txr: New file.
* tests/009/webapp.json: New file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
outside of the code, in hash tables.
* filter.c (make_trie, trie_add): Update to three-argument
make_hash.
* hash.c (struct hash): New members, hash_fun, assoc_fun
acons_new_l_fun.
(ll_hash): Renamed to equal_hash.
(eql_hash): New static function.
(cobj_hash_op): Follows ll_hash rename.
(hash_grow): Use new function indirection to call hashing function.
(make_hash): New argument to specify type of hashing. Initialize new
members of struct hash.
(gethash_l, gethash, remhash): Use function indirection for hashing and
chain search and update.
(pushhash): New function.
* hash.h (make_hash): Declaration updated with new parameter.
(pushhash): Declared.
* lib.c (eql_f): New global variable.
(eql, assq, aconsq_new, aconsq_new_l): New functions.
(make_package): Updated to new three-argument make_hash.
(obj_init): gc-protect and initialize new variable eql_f.
* lib.h (eql, assq, aconsq_new, aconsq_new_l): Declared.
* match.c (dir_tables_init): Updated to there-argument make_hash.
* parser.h (form_to_ln_hash, ln_to_forms_hash): Global variables
declared.
* parser.l (form_to_ln_hash, ln_to_forms_hash): New global variables.
(grammar): Set yylval.lineno for tokens that are classified to
that type in parser.y.
(parse_init): Initialize and gc-protect new global variables.
* parser.y (rl): New static helper function.
(%union): New member, lineno.
(ALL, SOME, NONE, MAYBE, CASES, CHOOSE, GATHER,
AND, OR, END, COLLECT, UNTIL, COLL, OUTPUT, REPEAT,
REP, SINGLE, FIRST, LAST, EMPTY, DEFINE,
TRY, CATCH, FINALLY, ERRTOK, '('): Reclassified as lineno type.
In the grammar, these keywords can thus provide a stable line number
from the lexer.
(grammar): Numerous rules updated to add constructs to the
line number hash tables via the rl helper.
* dep.mk: Updated.
* Makefile (depend): Use the installed, stable txr in the
system path to update dependencies rather than locally built ./txr, to
prevent the problem that txr is broken because out out-of-date
dependencies, and thus cannot regenerate dependencies.
|
|
|
|
|
| |
pointer hashing of identity-equal objects. Without this, if the
pointer size is not 4 or 8, we fall through to the next case.
|
|
|
|
|
|
|
|
|
| |
account alignment, otherwise only values divisible by the
alignment occur. This patch takes into considerations that
val values are pointers to object descriptors in a heap which
are four words wide, and so most likely aligned to 16 byte
boundaries (32 bit systems) or 32 byte boundaries (64 bit).
We need to shift.
|
|
|
|
|
|
| |
hash.h, lib.c, lib.h, match.c, match.h, parser.h, parser.l, parser.y,
regex.c, regex.h, stream.c, stream.h, txr.1, txr.c, txr.h, unwind.c,
unwind.h, utf8.c, utf8.h: Updated e-mail address.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bugfix in typeof.
* filter.c (trie_compress): New function.
(trie_value_at, trie_lookup_feed_char, filter_string): Handle cons cell
nodes in trie.
(build_filter): Call trie_compress.
* gc.c (cobj_destroy_op): Function renamed to cobj_destroy_stub_op
since it doesn't do anything.
(cobj_destroy_free_op): New function.
* hash.c (struct hash_iter): New type.
(hash_destroy): Function removed.
(hash_ops): Reference to hash_destroy replaced with
cobj_destroy_free_op.
(hash_count, hash_iter_mark, hash_begin, hash_next): New functions.
(hash_iter_ops): New static structure.
* hash.h (hash_count, hash_begin, hash_next): New functions declared.
* lib.c (hash_iter_s): New symbol variable.
(typeof): Bugfix: TAG_LIT type tag not handled.
(vecref): New function.
(obj_init): Initialize hash_iter_s.
* lib.h (cobj_destroy_op): Declaration renamed.
(cobj_destroy_free_op, vecref): New functions declared.
(hash_iter_s): New variable declared.
* stream.c (string_in_ops, byte_in_ops): cobj_destroy_op
renamed to cobj_destroy_stub_op.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* filter.c, filter.h: New files.
* Makefile (OBJS): filter.o added.
* gc.c (mark_obj): Mark new alloc field of string objets.
* hash.c (struct hash): New member, userdata.
(hash_mark): Mark new userdata member of hash.
(make_hash): Initialize userdata.
(get_hash_userdata, set_hash_userdata, hashp): New functions.
* hash.h (get_hash_userdata, set_hash_userdata, hashp): New functions
declared.
* lib.c (getplist, string_extend, cobjp): New functions.
(string_own, string, string_utf8): Initialize new alloc field to nil.
(mkstring, mkustring): Initialize new alloc field to actual size.
(length_str): When length is computed and cached, also compute
and cache alloc.
(init): Call filter_init.
* lib.h (string string): New member, alloc.
(num_fast): Macro converted to inline function.
(getplist, string_extend, cobjp): New functions declared.
* match.c (match_line): Follows change of modifier s-exp syntax.
(format_field): New parameter, filter.
New modifier syntax parsed. Filter retrieved, and applied.
(subst_vars): New parameter, filter. Filter is either applied
in this function or passed to format_field, as needed.
(eval_form): Pass nil to new parameter of subst_vars.
(do_output_line): New parameter, filter. Passed down to subst_vars.
(do_output): New parameter, filter. Passed down to do_output_line.
(match_files): Pass nil filter to subst_vars in cat directive.
Output directive refactored to parse keywords, extract the
filter and pass down to do_output.
* parser.y (regex): Generate (sys:regex regex syntax ...)
instead of (regex syntax ...).
(elem, expr): Updated w.r.t. regex syntax change.
(var): Cases '{' IDENT regex '}' and '{' IDENT NUMBER '}'
are removed. new syntax '{' IDENT exprs '}' to handle these
more generally and allow for keywords.
* txr.1: Updated.
|
|
|
|
|
|
| |
lib.h, match.c, match.h, parser.h, parser.l, parser.y, regex.c,
regex.h, stream.c, stream.h, txr.1, txr.c, txr.h, unwind.c, unwind.h,
utf8.c, utf8.h: Updated copyright year.
|
| |
|
|
|
|
|
|
| |
the type codes of spuriously reached nodes; reached objects
will not be removed by weak processing and so it's better
to just detect those situations and short-circuit.
|
| |
|
|
|
|
|
|
|
|
| |
* hash.h (sethash): Declared.
* lib.c (cobj_handle): New function.
* lib.h (cobj_handle): Declared.
|
|
|
|
|
|
| |
no null pointer check over struct cobj_ops operations.
New typechecking function for COBJ objects.
|
|
|
|
|
| |
from now on, which is compatible with unsigned char *.
No implicit conversion to or from this type, in C or C++.
|
|
|
|
| |
in regex module not exposed in header. Etc.
|
| |
|
|
|
|
| |
have a _s suffix.
|
|
|
|
|
|
|
|
| |
can be converted to a type long and vice versa. The configure
script tries to detect the appropriate type to use. Also,
some run-time checking is performed in the streams module
to detect which conversions specifier strings to use for
printing numbers.
|
|
|
|
|
|
|
|
|
|
| |
a system package instead of being hacked with the $ prefix.
Keyword symbols are provided. In the matcher, evaluation
is tightened up. Keywords, nil and t are not bindeable, and
errors are thrown if attempts are made to bind them.
Destructuring in dest_bind is strict in the number of items.
String streams are exploited to print bindings to objects
that are not strings or characters. Numerous bugfixes.
|
|
|
|
|
| |
we wouldn't have to declare object variables at all, so why
use an obtuse syntax to do so?)
|
| |
|
|
|
|
|
| |
pointer to a C static string, intended for literals. We can now
treat literal strings as light-weight objects.
|
|
|
|
| |
Bumped version numbers, and cleaned up trailing whitespace from some files.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
C structure contains obj_t * references, we should initialize
that C structure after allocating the cobj. If we initialize
the structure first, it may end up having the /only/ references
to the objects. In that case, the objects are invisible to the
garbage collector. The subsquent allocation of the cobj itself
then may invoke gc which will turn these objects into dust.
The result is a cobj which contains a handle structure that
contains references to free objects. The fix is to allocate
the handle structure, then the cobj which is associated with
that handle, and then initialize the handle, at which point it
is okay if the handle has the only references to some objects.
Care must be taken not to let a cobj escape with a partially
initialized handle structure, and not to trigger gc between
allocating the cobj, and initializing the fields.
|
|
|
|
|
|
|
|
|
| |
This is incomplete. There are too many dependencies on
wide character support from the C stream I/O library,
and implicit use of some encoding which may not be UTF-8.
The regex code does not handle wide characters properly.
Character type is still int in some places, rather than wchar_t.
Test suite passes though.
|
|
|
|
|
|
|
| |
in place, and thus having to pulling all conses into a big list.
TODO: avoid recomputing the hash function over the keys.
We could enhance cons cells with two more fields without using
additional storage.
|
|
|
|
|
| |
Now numbers and characters fit into a cell. We lose one more bit
from the range of numbers.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
unboxed. If the lowest bit of the obj_t * pointer is 1, then
the remaining bits are a number. A lot of assumptions are made:
- the long type can be converted to and from a pointer
- two's complement.
- behavior of << and >> operators when the sign bit is involved.
|
|
due to use of boxed numbers for vector access.
|