| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Use new symbol variable mod_s instead
of calling intern.
* match.c (mod_s, modlast_s): Symbol variables defined.
(do_output_line): mod and modlast directives implemented under rep.
(do_output): likewise under repeat.
(syms_init): Initialize new symbol variables.
* match.h (mod_s, modlast_s): Declared.
* parser.l (MOD, MODLAST): Parse new token types.
* parser.y (MOD, MODLAST): New tokens.
(repeat_parts_opt, rep_parts_opt): New syntax.
(repeat_rep_helper): Handle mod and modlast syntax.
* txr.1: Updated.
* txr.vim: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c:x (lazy_flatten_scan, lazy_flatten_func): New static functions.
(lazy_flatten): New function.
* lib.h (lazy_flatten): Declared.
* match.c (v_next): Use lazy_flatten instead of flatten for
processing a :list source. This means that @(next :list ...)
can be used to process infinite lazy lists.
* txr.1: Documented lazy-flatten.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c: Includes rand.h header.
(eval_init): New variable and functions from rand module registered.
* lib.c: Includes rand.h header.
(init): Call rand_init.
* rand.c: New file.
* rand.h: New file.
|
|
|
|
|
|
|
|
| |
* lib.c (cat_vec): New function.
* lib.h (cat_vec): Declared.
* txr.1: Documentation stub.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (op_unwind_protect): Use uw_simple_catch_begin,
and remove the uw_catch (exsym, exvals) clause. Put
explicit braces around the unwind code even though it
is only one statement.
* match.c (do_txeval): Got rid of empty uw_unwind clause.
This is not needed any longer.
(v_try): Got rid of explicit uw_do_unwind calls.
* unwind.h (uw_simple_catch_begin): New macro.
(uw_do_unwind): Macro removed.
(uw_catch): Added goto uw_unwind_label at the front.
This way if the previous clause falls through,
control goes to the unwind logic.
(uw_unwind): Got rid of initial break. Previous
clause should fall through to unwind logic,
whether it is the main clause, or one of the catches.
(uw_catch_end): Default case aborts, because
we don't expect this.
|
|
|
|
|
|
|
|
| |
* lib.c (copy_vec, sub_vec): New functions.
* lib.h (copy_vec, sub_vec): Declared.
* txr.1: Stub sections created.
|
|
|
|
|
|
|
|
|
|
| |
functions.
(expand): New case for quasiliterals.
(eval_init): Register quasi literal as special operator.
* match.c (format_field): Linkage changed to external.
* match.h (format_field): Declared. Declarations rearranged.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(eval_init): Registered new functions: symbol-function,
func-get-form, func-get-env, functionp, interp-fun-p.
* lib.c (nappend2, getplist_f, improper_plist_to_alist):
tail variable renamed to avoid clash in macro.
(func_get_form, func_get_env, interp_fun_p): New functions.
* lib.h (func_get_form, func_get_env, interp_fun_p): Declared.
(list_collect): Fix macro not to throw error, but handle the case.
* match.c (vars_to_bindings, extract_bindings): tail variable
renamed to avoid clash in macro.
* txr.1: Documentation stubs.
|
|
|
|
| |
expand on a list of forms.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (copy_list): Use list_collect_append rather than
list_collect_terminate.
(append2, appendv): Simplified using new list_collect_append.
(nappend2): Simplified using new list_collect_nconc.
* lib.h (list_collect): Added check for accidental usage
of list_collect after list_append, since PTAIL has different
semantics.
(list_collect_nconc, list_collect_append): Semantics fixed so that
append collecting works more like the Common Lisp append function,
allowing trailing atoms or a lone atom. The meaning of PTAIL is
changed, however. Now PTAIL actually tracks the head of the most
recently appended segment. Each append operation has to first
traverse the previously added piece to get to the end.
(list_collect_terminate): Macro removed.
* match.c (v_gather): Removed useless use of list_collect_terminate.
* parser.y: Some headers added that are needed by list_collect.
* txr.1: Documented append, list, atom, null, not, consp, make-lazy-cons,
lcons-fun, listp, proper-listp, length-list, mapcar, mappend, and apply.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
* txr.1: Finished documenting special operators.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): New functions interned.
* lib.c (num_chr, chr_num): New functions.
* lib.h (num_chr, chr_num): Declared.
* txr.1: Documentation stubs.
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): New functions registered as intrisics.
* lib.h (exptmod, gcd): Declared.
* txr.1: Documentation stubs added.
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): New functions registered as intrinsics.
* lib.h (evenp, oddp): Declared.
* txr.1: Documentation stub updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(abso, isqrt): New functions.
(isqrt_fixnum): New static function.
* eval.c (eval_init): Registered abs, sqrt and numberp instrinsics.
* lib.c (numberp): New function.
* lib.h (numberp, abso, isqrt): Declared.
* mpi-patches/series: New patch added.
* mpi-patches/faster-square-root: New patch added.
* txr.1: Documentation stubs for new functions.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Registering new intrinsic functions,
reduce-left, reduce-right and expt.
* lib.c (minusv): Return one instead of num(1).
(exptv, reduce_right): New functions.
* lib.h (expt, exptv, reduce_right): Declared.
* txr.1: Blank sections for new functions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
with bignum support.
* eval.c (eval_init): Added bignump and zerop as intrinsic function.
Renamed numberp to fixnump.
* lib.c (zerop, gt, lt, ge, le): Functions removed.
(numeq): Unused function removed.
* lib.h (numeq): Declaration removed.
* txr.1: Sections for zerop and bignump created. Changed reference
to numberp to fixnump.
|
|
|
|
|
|
|
|
| |
* 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.c (and_s, or_s): Redundant variables removed.
* match.h (do_s): extern storage class specifier added.
|
|
|
|
|
|
|
|
| |
a named block around it, thereby imitating a Common Lisp feature.
(op_for): Establish an anonymous block around the loop body,
test form and increment forms.
* txr.1: Documented named block in defun. Documented for and for *.
|
|
|
|
|
|
|
| |
the arguments. We want (push item list) for compatibility with CL.
(expand): Bugfix: some of the cases were constructing new
forms using unexpanded pieces from the original form.
Added separate case for push, which handles the reversed arguments.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Enter stopped working. This was broken by recent bugfixes in the
string splitting functions, which introduced a semantics change.
* eval.c (flip_s, vecref_s): New symbol variables.
(op_modplace): New places (vecref ...) and (flip ...). Bugfix: dec
operator was incrementing.
(expand_place): Handle vecref and flip. Bugfix: pop has no
third argument and so is now handled by the same case as flip.
Bugfix: if a modify form has no third argument, then do not
resynthesize it with a nil third argument.
(eval_init): Initialize new symbol variables.
Register new flip operator. Register new list_vectory function
as intrinsic.
* lib.c (rplacd): When modifying the cdr field of a lazy cons,
then lapse the lazy function to nil! This is needed by user-defined
lazy conses, and it makes sense to do it this way rather than
put in some explicit interface.
(list_vector): New function.
* lib.h (list_vector): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(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.
|
|
|
|
|
|
| |
* lib.c (chr_toupper, chr_tolower): New functions.
* lib.h (chr_toupper, chr_tolower): New functions declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (c_num): Generalized to convert characters to numbers also.
This allows functions like gt and lt to work with characters.
(chr_isalnum, chr_isalpha, chr_isascii, chr_iscntrl, chr_isdigit,
chr_isgraph, chr_islower, chr_isprint, chr_ispunct, chr_isspace,
chr_isupper, chr_isxdigit): New functions added.
* lib.h: (chr_isalnum, chr_isalpha, chr_isascii, chr_iscntrl,
* chr_isdigit, chr_isgraph, chr_islower, chr_isprint, chr_ispunct,
* chr_isspace, chr_isupper, chr_isxdigit): New functions declared.
(c_true): New macro.
|
| |
|
|
|
|
|
|
|
| |
(op_progn): New static function.
(eval_init): Initialize new variable, register progn operator.
* txr.1: progn documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
warning.
(eval_init): New functions registered: typeof and vector functions,
as well as length_list.
* lib.c (length): Function renamed to length_list, because it is
list specific.
(length_vec, size_vec, vector_list): New functions.
(length): New function, generic over lists, vectors and strings.
* lib.h (length_list, length_vec, size_vec, vector_list): Declared.
* match.c (h_var, h_fun, robust_length, v_deffilter, v_fun): Use
length_list instead of length.
* parser.l: Introduced # token.
* parser.y (vector): New nonterminal.
(expr): vector is a kind of expr.
(chrlist): Bugfix: single-character syntax was not working;
for instance #\x to denote the charcter x.
(lit_char_helper): Use length_list instead of length.
* stream.c (string_in_get_line): Bugfix: this was using
the wrong length function: length was being applied to a string.
The genericity of length makes that correct now, but changing
to length_str anyway.
* txr.1: Blank sections created for functions. Vector syntax
documented.
|
|
|
|
|
|
|
|
|
|
| |
(eval_init): Use existing function objects car_f, cdr_f,
eq_f, eql_f and equal_f. Added identity to function table.
* lib.h (eql_f): Missing declaration added.
* txr.1: Documented cond, and, if, or, defun, inc, dec,
set, push and pop.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(expand_qquote): Bugfix: missing case added to handle directly quoted
quasiquote.
(eval_init): Error-catching pseudo-operators registered in
op_table.
* parser.y (force_regular_quotes): New function.
(list): Quotes within unquotes and splices are regular.
* txr.1: Clarified new rules. Removed description of ,'form and ,*'form
special syntax.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): New intrinsic functions.
* lib.c (rplaca, rplacd, lcons_fun): New functions.
(make_lazycons): Renamed to make_lazy_cons, relocated
and turned into external function.
(lazy_stream_func, lazy_stream_cons): Follow rename
of make_lazycons.
* lib.h (rplaca, rplacd, make_lazy_cons, lcons_fun):
Declared.
* txr.1: Stub sections created.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
variables.
(op_unwind_protect, op_block, op_return, op_return_from):
New static functions.
(expand): Removed case for call, if, and, and or. These operators
evaluate all their arguments, so the code walker can treat them
as a function calls.
Added case for block and return-from.
(eval_init): New symbols interned. New operator functions
registered in op_table.
* txr.1: Blank sections added.
|
|
|
|
|
|
| |
exposed as intrinsics.
* txr.1: Blank sections created.
|
|
|
|
|
|
| |
available:
* lib.h (sym_name): Dangling declaration removed.
|
|
|
|
|
|
| |
and processing of regular quote form. This broke nested
backquote processing, and quasiquote forms containing
non-quasi-quotes like like '(a 'b ,c).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
the sequencing! Making it an inline function broke the tests.
But we can't have multiple evaluation either, so it's going to use
a temporary lexical variable.
(uses_or2): Macro which declares the lexical variable needed by or2.
* debug.c (debug): add uses_or2.
* eval.c (eval_intrinsic, op_modplace): Likewise.
* lib.c (lazy_str, lazy_str_force_upto, lazy_str_get_trailing_list):
Likewise.
* match.c (h_parallel, v_freeform, v_parallel, v_output): Likewise.
* parser.y (unquotes_occur): Likewise.
* stream.c (format): Likewise.
|
|
|
|
|
|
|
|
| |
increment value. Separate new value and increment value, and check
number of arguments.
* lib.h (or2): Turned into inline function due to multiple
argument evaluation.
|
| |
|
|
|
|
|
|
|
| |
(op_dohash): New static function
(expand): New case for dohash_s.
Bugfix for do_s: expand was used rather than expand_forms.
(eval_init): dohash_s initialized and entered into op_table.
|
|
|
|
|
|
| |
* hash.c (maphash): New function.
* hash.h (maphash): Declared.
|
|
|
|
| |
of the form var, only (var initform).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (car_s, cdr_s): New symbol variables.
(op_modplace): Cases for car and cdr added.
(expand_place): Likewise. Calls abort should the
cases fall through rather than returning 42.
(expand): Bugfix: for and for* case not propagating
source location info. Bugfix: expansion for do added.
(eval_init): car_s and cdr_s initialized and used
in place of previous intern calls.
* parser.y (elem): Removed wrong logic for expanding the
do form. It was expanding only the first argument.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(env_replace_vbind, bindings_helper): New static functions.
(op_let): Refactored to allow for let* form. Code for setting
up bindings moved into bindings helper, shared by for loop.
(op_for, expand_vars): New static functions.
(expand): Bugfix: let case was neglecting to walk the var
initialization forms. This is done via expand_vars now.
let_star_s added to this case to handle let* and let at
the same time. New case added for for and for*.
(eval_init): let_star_s, for_s, and for_star_s initialized,
and entered into op_table.
|
|
|
|
| |
* txr.vim: More highlighting.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (op_let): Bugfix: was not evaluating var init forms.
(reg_var): New static function.
(eval_init): Registered numerous stream functions and the
three standard streams.
* lib.c (obj_print, obj_pprint): Modified to return a value.
(init): eval_init called after stream_init, because eval
needs the three standrad streams prepared.
* lib.h (obj_print, obj_pprint): Declarations updated.
* stream.c (format): Support t as a shorthand for standard output.
(formatv, open_directory, open_file, open_pipe): New functions.
(w_opendir): New static function.
* stream.h (formatv, open_directory, open_file, open_pipe):
Declared.
* txr.vim: set iskeyword such that keyword can contain special
characters. Set b:current_syntax to "lisp".
(txl_keyword): New keyword category populated with TXR Lisp keywords
defined as separate category.
(txr_list): Contains txl_keyword.
(txr_meta): Contains txl_keyword and txr_list.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
fun operator.
* eval.c (apply_s): New symbol variable.
(apply): Handle functions specified as symbols. Use symbol from context
form in error reporting.
(apply_intrinsic): New function.
(interp_fun): Bugfix: removed evaluation of arguments, since
arguments are already evaluated.
(op_call): Simplified by not having to handle symbols,
since apply does.
(op_fun): New function.
(expand): Handle special form fun.
(mapcarv, mappendv): New functions.
(eval_init): Initialize apply_s. Register op_fun function
in op_table. Register mapcar, mappend and apply functions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
New functions list, append and eval. Code walking framework for
expanding quasiquotes. quotes right now.
* eval.c (let_s, lambda_s, call_s, cond_s, if_s, and_s, or_s
defvar_s, defun_s, list_s, append_s): New symbol variables.
(eval_intrinsic, op_quote, expand_forms, expand_cond_pairs,
expand_place, expand_qquote): New static functions.
(expand): New external function.
(eval_init): Initialize new symbol variables. Use newly defined symbol
variables to register functions. Also, new functions: quote, append,
list and eval.
* eval.h (expand): Declared.
* lib.c (appendv): New function.
(obj_init): quote and splice operator symbols moved into system
package.
(obj_print, obj_pprint): Support for printing quotes and splices.
* lib.h (appendv): Declared.
* match.c (do_s): New symbol variable.
(syms_init): New variable initialized.
(dir_tales_init): New variable used instead of intern.
* match.h (do_s): Declared.
* parser.y (elem): @(do) form recognized and its argument passed
through the new expander.
(o_elem, quasi_item): Pass list through expander.
(list): Use choose_quote to decide whether to put
regular quote or quasiquote on quoted list.
(meta_expr): Fixed abstract syntax so the expression is a single
argument of the sys:expr, rather than multiple arguments.
(unquotes_occur, choose_quote): New static function.
|
|
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,
|