summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Version 78.txr-78Kaz Kylheku2014-02-066-72/+131
|
* * lib.c (int_str): Regression: handle base argument properly.Kaz Kylheku2014-02-062-1/+5
|
* * hash.c (hash_grow, make_hash, make_similar_hash, copy_hash):Kaz Kylheku2014-02-066-12/+30
| | | | | | | | | | | | | | | Pass second argument to vector. * lib.c (vector): Takes additional argument specifying the value for the slots of the vector. (vector_list, sub_vec): Pass second argument to vector. * lib.h (vector): Declaration updated. * eval.c (eval_init): Register vector as two-argument function with one required arg. * txr.1: Updated.
* * eval.c (op_dwim): Gutted down to just a few lines.Kaz Kylheku2014-02-064-92/+27
| | | | | | | | | | | | Basically the dwim operator is just a Lisp-1 version of the call operator now. It doesn't have to do anything funny with non-function objects, since they are callable. * lib.c (chr_str, chr_str_set, vecref, vecref_l): Replace inappropriate internal assertions with error exceptions. * unwind.h (numeric_assert, range_bug_unless): Unused macros removed.
* * lib.c (generic_funcall): If a cons cell is passed asKaz Kylheku2014-02-053-0/+43
| | | | | | | one argument to a sequence being used as a function, split it into two arguments. This is consistent with the DWIM operator behavior. * txr.1: Document callable objects.
* Allow sequences and hashes to be called as functions.Kaz Kylheku2014-02-054-25/+79
| | | | | | | | | | | | | | | | This is already supported in the DWIM operator. * eval.c (apply): If object isn't a function, gather the arguments into an array and delegate to generic_funcall. * lib.c (generic_funcall): Changed from static to external linkage. Supports sequences and hashes as functions. Error messages fixed not to refer to "funcall". (funcall, funcall1, funcall2, funcall3, funcall4): Do not throw exception if fun is not of FUN type; instead, delegate to generic_funcall. Error messages fixed not to refer to "funcall". * lib.h (generic_function): Declared.
* * arith.c (lognot): Conform to new scheme for defaulting optional args.Kaz Kylheku2014-02-0511-221/+223
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * eval.c (apply): Unconditionally use colon_k for missing optional args, for intrinsic functions. (eval_intrinsic, rangev, rangev_star, errno_wrap): Conform to new scheme for defaulting optional args. (reg_fun_mark): Function removed. (eval_init): Switch reduce_left and reduce_right back to reg_fun registration. * hash.c (gethash_n): Conform to new scheme for defaulting optional arguments. * lib.c (sub_list, replace_list, remove_if, keep_if, remove_if_lazy, keep_if_lazy, tree_find, count_if, some_satisfy, all_satisfy, none_satisfy, search_str, match_str, match_str_tree, sub_str, replace_str, cat_str, tok_str, intern, rehome_sym, sub_vec, replace_vec, lazy_str, sort, multi_sort, find, find_if, set_diff, obj_print, obj_pprint): Conform to new scheme for defaulting optional arguments. (func_f0, func_f1, func_f2, func_f3, func_f4, func_n0, func_n1, func_n2, func_n3, func_n4, func_n5, func_n6, func_n7, func_f0v, func_f1v, func_f2v, func_f3v, func_f4v, func_n0v, func_n1v, func_n2v, func_n3v, func_n4v, func_n5v, func_n6v, func_n7v): Remove references to removed mark_missing_args member of struct func. (func_set_mark_missing): Function removed. (generic_funcall): Unconditionally use colon_k for missing optional args, for intrinsic functions. * lib.h (struct func): mark_missing_args member removed. (func_set_mark_missing): Declaration removed. (default_arg, default_bool_arg): New inline functions. * rand.c (random): Left argument is not optional. (rnd): Conform to new scheme for defaulting optional arguments. * regex.c (search_regex, match_regex): Conform to new scheme for defaulting optional arguments. * stream.c (unget_char, unget_byte, put_string, put_char, put_byte, put_line): Conform to new scheme for defaulting optional arguments. * syslog.c (openlog_wrap): Conform to new scheme for defaulting optional arguments. * txr.1: Remove the specification that nil is a sentinel value in default arguments, where necessary. Use consistent syntax for specifying variable parts in argument lists. A few errors and omissions addressed.
* * eval.c (bind_args): Support optional parameters in theKaz Kylheku2014-02-053-16/+75
| | | | | | | | form (sym initform present-p-sym). Also, support the convention that a value of : explicitly passed for an optional argument produces the same behavior as if that argument value were missing. * txr.1: Document new conventions.
* * eval.c (apply): Pass missing optional arguments as colon_k.Kaz Kylheku2014-02-055-24/+107
| | | | | | | | | | | | | | | | | | | | | | | to functions for which this is requested. (reg_fun_mark): New static function. (eval_init): Register reduce_left and reduce_right as requiring marking for missing optionals. * lib.c (func_set_mark_missing): New function. (generic_funcall): Pass missing optional arguments as colon_k to functions for which this is requested. (reduce_left, reduce_right): Handle missing values of init and key. (func_f0, func_f1, func_f2, func_f3, func_f4, func_n0, func_n1, func_n2, func_n3, func_n4, func_n5, func_n6, func_n7, func_f0v, func_f1v, func_f2v, func_f3v, func_f4v, func_n0v, func_n1v, func_n2v, func_n3v, func_n4v, func_n5v, func_n6v, func_n7v): Initialize new mark_missing_args member of struct func. * lib.h (struct func): New bitfield member, mark_missing_args. (func_set_mark_missing): Declared. (missingp, null_or_missing_p): New inline functions. * txr.1: Updated descriptions of reduce-left and reduce-right.
* * lib.c (nullp): Function removed.Kaz Kylheku2014-02-033-7/+10
| | | | | * lib.h (nullp): New inline function. (eq): Removed useless parentheses: it's not a macro.
* * eval.c (op_modplace): Fixing a few argument count mismatchesKaz Kylheku2014-02-032-2/+7
| | | | in format calls.
* Tighten up environment visibility semantics of default argumentKaz Kylheku2014-02-033-23/+26
| | | | | | | | | | | | | | | init forms, while streamlining the implementation. * eval.c (bind_args): Get rid of opt_init_parm array hack; turns out we already have a useful function for extending an environment object, namely env_vbind: hitherto unused! We now make a blank environment upfront and extend it destructively with env_vbind. Except that after evaluating an init form, we create a new environment: this is in case a lexical closure was made by the init form, in which event we don't want to be destructively manipulating the environment any more. * txr.1: Clarified.
* * eval.c (eval_init): Fix incorrect registration ofKaz Kylheku2014-02-032-1/+6
| | | | list_star_intrinsic, diagnosed by compiler.
* * txr.1: Mention that regular expression character classes haveKaz Kylheku2014-02-021-0/+2
| | | | no locale-dependent silliness.
* Adding list* since we get it "for free" thanks to theKaz Kylheku2014-02-023-0/+52
| | | | | | | | | new helper function that supports apply. * eval.c (list_star_intrinsic): New static function. (eval_init): Register list_star_intrinsic as list*. * txr.1: Document list*.
* append can now take additional leading arguments before the list.Kaz Kylheku2014-02-025-21/+64
| | | | | | | | | | | | | * eval.c (apply_frob_args): New static function. (apply_intrinsic): Process arguments with apply_frob_args. (eval_init): apply_intrinsic registered differently, as a variadic function with one mandatory arg. * lib.c (lastcons): New function. * lib.h (lastcons): Declared. * txr.1: Updated append documentation.
* * txr.1: Clarify that arbitrary expressions cannot be usedKaz Kylheku2014-02-021-3/+11
| | | | in the dot position of a function call form.
* * eval.c (apply): Support string and vector arglist.Kaz Kylheku2014-02-025-13/+55
| | | | | | | | | | | (do_eval_args): Support string or vector in dot position. * lib.c (tolist): New function. * lib.h (tolist): Declared. * txr.1: Document how apply and dot position in compound forms supports strings as well as vectors.
* * eval.c (do_eval_args): If the dotted position of the argumentKaz Kylheku2014-02-023-4/+75
| | | | | | | list evaluates to a vector, then convert the vector to a list. * txr.1: Document compound forms, and how they allow the dotted position and how it may be a vector.
* * eval.c (eval_init): Register vector_list function a second timeKaz Kylheku2014-02-023-0/+20
| | | | | | under the name vec, as a variadic function. * txr.1: Document vec.
* * txr.1: Fix bad directives example. Regexes are prefixed by #.Kaz Kylheku2014-02-021-1/+1
|
* * txr.1: Fix bad grammar.Kaz Kylheku2014-02-021-3/+3
|
* * txr.1: Documented forbidden hash table configuration ofKaz Kylheku2014-02-011-0/+3
| | | | weak keys that are equal-based.
* * hash.c (hash_mark, hash_grow, make_similar_hash,Kaz Kylheku2014-02-013-41/+82
| | | | | | | | | | | | | | | copy_hash, gethash_l, gethash, gethash_f, gethash_n, hash_count, hash_next, hash_eql, hash_equal): Use num_fast instead of num. (make_hash): An attempt to make a weak-keys hash that has equal-based keys is nonsensical; it is now diagnosed with an exception. Use num_fast instead of num. (hash_process_weak): Call breakpt whenever the weak object(s) due to which entries are being deleted match the value in break_obj. Use num_fast instead of num. * parser.l (parse_init): Bugfix: the forms_to_ln_hash was equal-based, which makes no sense.
* Export break_obj.Kaz Kylheku2014-02-013-2/+15
| | | | | | | * gc.c (break_obj): Change to external linkage. (mark): Use t variable instead of re-evaluating obj->t.type. * gc.h (break_obj): Declared.
* * lib.c (d): Disable garbage collection around the dump.Kaz Kylheku2014-02-012-0/+9
| | | | | | It's importa for this function not to have the side effect of triggering garbage collection, when it is used for debugging issues that show up under --gc-debug.
* Whitespace.Kaz Kylheku2014-02-011-1/+1
|
* * configure: remove stray debugging printf from theKaz Kylheku2014-01-312-1/+5
| | | | GNU Make check. This was introduced in May 2012.
* * genvim.txr: Support floating-point constants.Kaz Kylheku2014-01-303-10/+21
| | | | | | Do not color embedded decimal integers in symbols as integers. * txr.vim: Regenerated.
* * eval.c (expand_op): When the variant is do, and the symbolKaz Kylheku2014-01-303-2/+17
| | | | | | | | | is an operator, then suppress the addition of the rest parameter in the dotted cons position at the end of the form, since this mechanism for applying additional arguments is only supported by function calls, not by special forms. * lib.h (and2, and3): New macros.
* * eval.c (expand_op): Fix broken do operator. In the case of the doKaz Kylheku2014-01-302-1/+9
| | | | | | | operator, we must feed the entire form to the expander, not the individual forms. That is to say (do operator arg) must expand the form (operator arg), whereas (op fun arg) just expands the forms fun and arg individually.
* Version 77txr-77Kaz Kylheku2014-01-296-64/+130
|
* * regex.c (match_regex_right): Fix not returning value.Kaz Kylheku2014-01-292-0/+6
|
* Default argument initializer scoping rule change, allowingKaz Kylheku2014-01-293-13/+50
| | | | | | | | | | | | | things like (defun foo (s : (l (length s))) ...). Default arguments can be initialized by expressions that refer to the arguments. * eval.c (bind_args): By means of a local array, defer the evaluation of optional argument init forms until the lexical environment, including all the parameters, is captured. Then valuates the forms in the array, and set the variable values. * txr.1: Clarify the new scoping rules.
* * eval.c (eval_init): Registered existing make_catenated_stream asKaz Kylheku2014-01-284-5/+95
| | | | | | | | | | | | | | intrinsic. * stream.c (cat_get_line, cat_get_char, cat_get_byte): Do not remove the last stream from the stream list, so that there is some stream object there which can take the unget-char or unget-byte operations. (cat_unget_byte, cat_unget_char): New static functions. (cat_stream_ops): unget_char and unget_byte function pointers filled in. * txr.1: Documented catenated-streams.
* * stream.c (struct stdio_handle): New member, is_rotated.Kaz Kylheku2014-01-282-17/+89
| | | | | | | | | | Moved mode member down. (make_stdio_stream_common): Initialize is_rotated. (tail_strategy): Substantially rewritten in order to address a possible race condition, when a file is rotated. The issue is that even when the file disappears, or when the file has been replaced, we must continue reading from the old stream until the end, and only then can we switch to the newly rotated file.
* * stream.c (remove_path, rename_path): New functions.Kaz Kylheku2014-01-286-1/+54
| | | | | | | | | | | * stream.h (remove_path, rename_path): Declared. * utf8.c (w_remove, w_rename): New functions. * utf8.h (w_remove, w_rename): Declared. * eval.c (eval_init): Registered remove_path and rename_path as intrinsics.
* * eval.c (meta_meta_p, meta_meta_strip): New static functions.Kaz Kylheku2014-01-287-104/+175
| | | | | | | | | | | | | | | (transform_op): Recognize compounded metas, and strip one level off. (eval_init): Intern sys:expand function so we have access to the form expander from TXR Lisp. * lib.c (obj_print, obj_pprint): Fix: wasn't rendering metanumbers. * parser.y (list): Support @ in front of anything. If it's an atom, treat it similarly to a metasymbol or metanumber. * txr.1: Documented meta-meta arguments in nested op. * genvim.txr, txr.vim: Support coloring for compounded meta syntax.
* * txr.vim, genvim.txr: There can now be whitespace in TXR LispKaz Kylheku2014-01-273-80/+84
| | | | like @ (a b c) and @ [1 2 3].
* Lexing and parsing improvements, leaving things less hacky than before,Kaz Kylheku2014-01-273-61/+60
| | | | | | | | | | | | | | | | | | | | | | | albeit hacky. * parser.l (BSYM, NSYM): Regex definitions gone. (BT0, BT1, BT2, NT0, NT1, NT2): New regex definitions. (BTREG, BTKEY, NTREG, NTKEY): Rewritten, so that they cannot match a lone @ character as a symbol name. (grammar): Rules for returning METAPAR, METABKT and METAQUO are gone. Instead, we just recognize a @ in the NESTED and BRACED states and return it as a token. * parser.y (METAPAR, METABKT, METAQUO): Token types removed. (meta_expr): Nonterminal symbol removed. ('@'): New token type. (list): Quotes and splices handling removed from this rule. The new token '@' is handled here, on the other hand, because there are places that reference the list rule that need to support @ expressions. (n_expr): Reference to meta_expr removed. Quote, unquote and splice added here. (yybadtoken): Removed references to METAPAR, METABKT and METAQUO.
* * parser.y (yybadtoken): Handle METAQUO in switch.Kaz Kylheku2014-01-272-0/+5
|
* * lib.c (reduce_left, reduce_right): changing the behavior so thatKaz Kylheku2014-01-273-22/+84
| | | | | | | | | the initial value is optional. this creates the possibility that the effective list of operands is empty, in which case the function must support a call with no arguments, just like in the common lisp reduce. * txr.1: rewrote reduce-left and reduce-right documentation.
* * regex.c (match_regex_right): Fix semantics of second argumentKaz Kylheku2014-01-273-11/+74
| | | | | | | | to something more useful. * regex.h (match_regex_right): Change name of parameter. * txr.1: Documented match-regex-right.
* * lib.c (obj_print, obj_pprint): Bugfix: there may beKaz Kylheku2014-01-272-2/+9
| | | | | | additional expressions forms in (sys:var <sym>) after the sym. These were not being printed. Such syntax occurs often in the TXR pattern language.
* * regex.c (match_regex_right): New function.Kaz Kylheku2014-01-264-0/+31
| | | | | | * regex.h (match_regex_right): Declared. * eval.c (eval_init): Register match_regex_right as instrinsic.
* Implementing more correct treatment of meta formsKaz Kylheku2014-01-262-36/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | like @[...] and @(...) occurring in the TXR pattern language. The previous behavior is that the parser always expands the interior of these forms when they occur. This is wrong. These forms only denote TXR Lisp (and so require expansion) when they occur in a directive, inside a sub-expression that is not already known to be Lisp. For instance in @(do @(op foo)), the inner @(op foo) should not be subject to expansion. The reason that the argument forms of @(do) are TXR Lisp. The @(op foo) form denotes (sys:expr foo), and that operator currently has no meaning; and so we should not expand it. The previous, buggy behavior would turn the @(op ..) into a @(lambda ...). Another example is @(bind a @(list @(op foo))) where @(list ...) denotes TXR Lisp and so the interior of the form should be expanded. However, the @(op foo) should not be expanded into @(lambda ...) Expanding @(...) forms is not currently harmful, but it interferes with code that wants to use the @(...) syntax for its own use, The solution involves adding shims in the parser so that the expansion is only applied when expressions are reduced to the top level within a directive, and then to walk the expressions, looking for the @ syntax and expanding only the outermost occurrence thereof. * parser.y (expand_meta): New static function. (n_exprs n_expr): New nonterminal symbols. (elem): The arguments of the list elem (representing a generic directive) now need to be put through expand_meta when it is not @(do ...) or @(require ...). (list): Use n_exprs instead of exprs. (meta_expr): Do not call expand, and use n_expr(s) instead of expr(s). (exprs, expr): These rules no become just a shim which expands the outer-most metas. The actual parsing is represented by n_expr and n_exprs ("n" stands for nested), which behave just like the old expr and exprs.
* Sigh; more lexical-syntactic hacks. This adds handlingKaz Kylheku2014-01-263-10/+41
| | | | | | | | | | for the @' combination, as in @(bind a @'(foo ,bar)) * parser.l: Handle the new METAQUO token. * parser.y (METAQUO): New token. (meta_expr): New "METAQUO expr" case. Added missing METABKT error handling case.
* * hash.c (hash_update): New function.Kaz Kylheku2014-01-247-0/+95
| | | | | | | | | | | | * 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.
* * eval.c (expand): Bugfix in expansion of dohash: neglectedKaz Kylheku2014-01-232-1/+8
| | | | to insert result form into the expanded output.
* Version 76txr-76Kaz Kylheku2014-01-238-92/+144
|