summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* * match.c (consume_prefix): This memory optimization should onlyKaz Kylheku2012-02-282-6/+15
| | | | | | be done for lazy strings, otherwise it just causes unnecessary memory use by duplicating the line, and inefficiency via thanks to allocator churn.
* * lib.c (numberp): Fix bad type check: null pointer dereference whenKaz Kylheku2012-02-283-2/+15
| | | | | | | | | | object is nil. * match.c (do_match_line): Bugfix for incorrect treatment of long lines. Must return the absolute position from the start of the original line (plus(c->pos, c->base)), rather than just c->pos, which only measures from the start of a line that may have been chopped by consume_prefix.
* Bugfix: rlcp function was incorrect for new way of storingKaz Kylheku2012-02-283-1/+18
| | | | | | | | | line number info. * parser.h (rlset): Declared. (rlcp): Use rlset. * parser.y (rlset): New function.
* * debug.c (help, debug): New g command for tweaking log level.Kaz Kylheku2012-02-282-5/+20
|
* * debug.c: Missing d command implemented.Kaz Kylheku2012-02-284-3/+70
| | | | | | | | | | Condense the output to 8 times the screen width, for more context. Condense the output in vertical mode (when the entire input line is shown) not only character mode. * lib.c (remq, remql, remqual): New functions. * lib.h (remq, remql, remqual): Declared.
* Version 59txr-59Kaz Kylheku2012-02-285-4/+49
| | | | | | | | | | * txr.c (version): Bumped. * txr.1: Bumped version and set date. * configure (txr_ver): Bumped. * RELNOTES: Updated.
* * lib.c (sub_list, replace_list, lazy_sub_str, sub_str, replace_str,Kaz Kylheku2012-02-282-7/+13
| | | | | sub_vec, replace_vec): Regression: replace incorrect zerop(to) test with to == zero, because to is not necessarily a number.
* * txr.vim: Recognize backslash-newline break in regexes.Kaz Kylheku2012-02-272-3/+7
|
* * txr.vim: Substantially revised for better lexical accuracyKaz Kylheku2012-02-272-15/+31
| | | | and highlighting of errors.
* * match.c (extract): Check for negative value of opt_nobindings,Kaz Kylheku2012-02-274-9/+33
| | | | | | | | | | | which forces the printing. * txr.c (help): Under -b, mention that printing the word false is suppressed also. Added documentation for -B. (main): Implemented -B option. * txr.1: Documented -B option and added clarifying text under -b option explaining the conditions under which bindings are printed.
* Fix the issue properly, once and for all, of how to determineKaz Kylheku2012-02-276-22/+44
| | | | | | | | | | | | | | | | that output has taken place and suppress the printing of bindings. * debug.c (debug): std_output replaced with std_debug. * eval.c (eval_init): Registered new *stddebug* variable. * stream.c (std_debug): New variable. (stdio_put_string): Check that stream is other than std_debug, to determine that output has taken place. * stream.h (std_debug): Declared. * txr.1: Added *stddebug* to documentation stub heading.
* Fixing long-time (pre-GIT) bug. The object (nil) was stupidly used toKaz Kylheku2012-02-265-29/+88
| | | | | | | | | | | | | | | | | | | | | represent empty optional output clauses, distinguishing them from missing clauses. This creates an ambiguity, so that an @(output) block which puts out a single empty line is treated as empty. Present but empty clauses are now represented by t. * match.c (do_output_line): Check for t and bail. (do_output): Check for t instead of (nil) and bail. * parser.y (o_elems_opt2): Nonterminal deleted. (out_clauses_opt): Empty case generates nil. (req_parts_opt): o_elems_opt2 replaced by o_elems_opt. (repeat_rep_helper): Function now keeps track of which clauses were specified. For those that were specified, but empty, it substitutes t. * tests/008/empty-clauses.expected: New file. * tests/008/empty-clauses.txr: New file.
* Bug #35625Kaz Kylheku2012-02-264-473/+547
| | | | | | | | | | | | | | | | | | | | | | * parser.l (BSCHR, BSYM, BTOK): New lexical definitions. (BRACED): New state. (grammar): Refactored so that braced variables are now handled in the BRACED state, allowing for lexical differences between braced variables and Lisp. This allows us to have the /regex/ syntax in braces, but /regex/ is just a symbol in the Lisp. The new #/ token is recognized and returned as HASH_SLASH. All rules reformatted to a more easily maintainble convention. * parser.y (HASH_SLASH): New token. (modifiers, lisp_regex): New nonterminals. (var): Grammar changed to use modifiers nonterminal instead of exprs. (var_op): Rule moved closer to var. (expr): Produces lisp_regex rather than regex. (yybadtoken): Handle HASH_SLASH in the switch statement. Bugfix: HASH_BACKSLASH was not handled. * txr.1: Documented #/regex/ syntax.
* * arith.c: Updated copyright year.Kaz Kylheku2012-02-2528-27/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* * tests/008/filtenv.expected: New file.Kaz Kylheku2012-02-253-0/+13
| | | | * tests/008/filtenv.txr: New file.
* Bug #34652Kaz Kylheku2012-02-252-0/+16
| | | | | | | | * match.c (do_txeval): Establish a dynamic env frame around evaluation of quasiliteral and around embedded TXR Lisp expression (which may contain quasiliterals) and stick the bindings there via set_match_context. This way if filte functions are invoked through a quasiliteral, they can see bindings.
* * eval.c (eval_init): New put-byte function interned.Kaz Kylheku2012-02-254-0/+55
| | | | | | | | | | * stream.c (struct strm_ops): New member, put_byte. (stdio_put_byte): New function. (stdio_ops, pipe_ops, string_in_ops, byte_in_ops, string_out_ops, strlist_out_ops, dir_ops): Updated. (put_byte): New function. * stream.h (put_byte): Declared.
* * parser.l (num_esc): Skip octal indicator 'o' if present.Kaz Kylheku2012-02-253-4/+15
| | | | | | | This is needed for character constants. (CHRLIT): Fix broken hex constants, being treated as octal. * txr.1: Document octal character constants.
* Version 58txr-58Kaz Kylheku2012-02-258-7/+88
| | | | | | | | | | | | | | | | | * txr.c (version): Bumped. * txr.1: Bumped version and set date. * configure (txr_ver): Bumped. * RELNOTES: Updated. * eval.c (eval_init): Updated. * rand.c (rand): Function renamed to rnd due to a clash with standard C library (that does not show up when compiling as C++). * rand.h (rand): Declaration renamed to rnd.
* * parser.l (source_loc_str): Missing function re-written.Kaz Kylheku2012-02-253-2/+28
| | | | | | | | (Accidentally originally written in lex.yy.c file!) (parse_reset): If file can't be opened, try adding .txr suffix to it. * txr.1: Suffix-handling behavior documented.
* * parser.y (clause): "Doh" moment. We don't need the specialKaz Kylheku2012-02-253-12/+14
| | | | | | | | transformation of the load syntax because the parent location is already associated with the syntax. * match.c (v_load): Pull out source location info from the form itself.
* * debug.c (debug): Use new way of getting line number.Kaz Kylheku2012-02-248-9/+43
| | | | | | | | | | | | | | * eval.c (eval_error): Use source_loc_str to get source location. * match.c (debuglf, sem_err, file_err): Likewise. * parser.h (source_loc_str): Declared. * parser.l (parse_init): form_to_ln_hash must be equal based now. * parser.y (rl): Store new form of read-time source location info. * txr.1: Documented load.
* * match.c (v_load): Sanity checking on target path.Kaz Kylheku2012-02-242-2/+16
| | | | | Check if it is absolute and do not substitute parent file's directory.
* * match.c (h_var): Eliminated uses of rl function, in favor ofKaz Kylheku2012-02-242-12/+9
| | | | rlcp. Only the parser should use rl to establish location info.
* Remove wrong output.Kaz Kylheku2012-02-241-1/+1
|
* Ensuring all arguments to .IP that contain spaces are quoted.Kaz Kylheku2012-02-241-19/+19
|
* Eliminating unnecessary heading and associated indentation level.Kaz Kylheku2012-02-241-2/+0
|
* Found more broken headings requiring quoting.Kaz Kylheku2012-02-241-2/+2
|
* Clarification in until/last.Kaz Kylheku2012-02-241-6/+7
|
* Fixed nroff errors resulting in incorrect output text.Kaz Kylheku2012-02-241-2/+2
|
* Fixing disappearing backslash.Kaz Kylheku2012-02-241-1/+1
|
* First cut at @(load) directive. Incomplete: debug location infoKaz Kylheku2012-02-247-4/+79
| | | | | | | | | | | | | | | | | | | | | | | | needs to record file name, not only line number; absolute paths not handled, etc. * match.c (load_s): New symbol variable. (v_load): New static function. (syms_init): load_s initialized. (dir_tables_init): Load directive registered. * match.h (load_s): Declared. * parser.h (parse_reset): New function declared. * parser.l (spec_file_str): Global variable moved from txr.c. (parse_reset): New function. * parser.y (clause): Special handling for @(load ...) directive. parent file path inserted into the syntax at parse time, so when the load directive executes, it can load the file from the same directory as the parent file. * txr.c (spec_file_str): Global variable moved to parser.l.
* * tests/010/seq.txr: New file.Kaz Kylheku2012-02-223-0/+39
| | | | * tests/010/seq.expected: New file.
* * lib.c (sub_list, replace_list, lazy_sub_str, sub_str,Kaz Kylheku2012-02-223-6/+45
| | | | | | | | | replace_str, sub_vec, replace_vec): Implementing floating zero behavior. This is necessary so that the important case index .. (+ index 1) for selecting one element as a subrange works even if index is negative. * txr.1: Floating zero behavior for ranges documented.
* * eval.c (dwim_loc): del operator's return value is theKaz Kylheku2012-02-223-10/+26
| | | | | | | | deleted range of values. Missing del cases added for single index cases. * lib.c (quicksort): Fix pivot selection one more time. (length): Fix bad argument in "not a sequence" error.
* * lib.c (quicksort): Incorrect pivot selection.Kaz Kylheku2012-02-222-1/+5
|
* * eval.c (del_s): New symbol variable.Kaz Kylheku2012-02-224-37/+116
| | | | | | | | | | | | | | | | | | | (eval_error): nostatic added to suppress a g++ warning. (dwim_loc): Takes new value as the original unevaluated form so it can control evaluation. Support for del operator added. (op_modplace): Bugfixes: new value form was being unconditionally evaluated and out of order w.r.t. other forms. Now there is left to right order. The form is evaluated later, since for most operators it is on the right, with the exception of push. dwim places can now optionally control the evaluation of newform. del operator supported in gethash case as a special case. error case added for del: if it's not handled in gethash or dwim_loc, it is an error. (eval_init): del_s initialized, and del operator added to table. * txr.vim: syntax highlighting for del. * txr.1: Documented del.
* * lib.c (init): Hash bugfix: added missing call to hash_init.Kaz Kylheku2012-02-222-0/+7
| | | | | Previously this function did nothing, but now it interns some important symbols.
* * hash.c (remhash): Rewrote buggy function.Kaz Kylheku2012-02-222-3/+17
| | | | | | | It was decrementing the hash count without checking that something was deleted from the chain. The deletion was done incorrectly, without regard for the kind of comparison fucntion used by the hash table.
* * eval.c (eval_init): Intrinsic bindings for sub, ref, refsetKaz Kylheku2012-02-226-8/+95
| | | | | | | | | | | | | | | | and replace. * lib.c (do_sort): Static function renamed to sort_list. (swap, quicksort, sort_vec): New static functions. (sort): Made generic over lists, vectors and strings. (refset): New function. * lib.h (sort): Declaration updated (parameter name change). (refset): Declared. * txr.1: Mention refset. * txr.vim: Updated with refset.
* * eval.c (eval_init): Third argument of gethash becomes optional.Kaz Kylheku2012-02-212-1/+5
|
* Introducing optional arguments.Kaz Kylheku2012-02-2118-203/+449
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* * txr.1: Corrected misleading text in description of outputKaz Kylheku2012-02-192-16/+37
| | | | | variables. Lists do not have to be wrapped in @(repeat)/@(rep). Indexing notation works on strings and vectors.
* * lib.c (sub, ref, replace): New functions.Kaz Kylheku2012-02-196-8/+76
| | | | | | | | | | * lib.h (sub, ref, replace): Declared. * match.c (format_field): Generic indexing using new functions. * txr.1: Documentation stub. * txr.vim: Highlighting for new functions.
* * match.c (extract_vars): If a brace var is actually anKaz Kylheku2012-02-182-1/+11
| | | | | | expression, then recurse into the expression to find variables. This allows us to do things like @{`@x`} inside a @(repeat) or @(rep).
* Allow braced output variables to actually be arbitrary substitutions.Kaz Kylheku2012-02-186-51/+71
| | | | | | | | | | | | | | * eval.c (subst_vars): Treat the variable as an arbitrary expression rather than just a symbol. * match.c (subst_vars): Likewise. * parser.y (o_var): Further simplification. The first item in an output var is an expr and not an IDENT. * txr.1: Updated. * txr.vim: Likewise.
* * parser.y (o_var): Remove productions from grammar by using exprs_opt.Kaz Kylheku2012-02-182-10/+10
|
* Reimplementation of how TXR decides whether to dump bindingsKaz Kylheku2012-02-175-3/+23
| | | | | | | | | | | | | | | or not. This is now done right inside the standard output stream. * match.c (output_produced): Variable removed. (complex_open): Assignment to output_produced removed. * stream.c (output_produced): New global variable. (stdio_put_string, stdio_put_char): Set output_produced to t if the target of the output is stdout. * stream.h (output_produced): Declared. * txr.h (output_produced): Declaration removed.
* * eval.c (dwim_loc): 2012-02-13 fix didn't do it.Kaz Kylheku2012-02-172-6/+9
| | | | | Here is a simpler way. We can let nil be treated as a list with a simple goto. This solves all cases.
* * eval.c (eval_init): Register match-fun.Kaz Kylheku2012-02-168-1/+50
| | | | | | | | | | | | | | | * match.c (v_do): Store match context. (match_fun): New function. * match.h (match_fun): Declared. * stream.c (streamp): New function. * stream.h (streamp): Declared. * txr.1: Stub section for match-fun. * txr.vim: Highlight match-fun.