summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* * eval.c (merge_wrap): New static functionKaz Kylheku2014-10-126-100/+397
| | | | | | | | | | | | | | | | | | | | | | | | | | (eval_init): Register less as intrinsic. Retarget merge intrinsic to merge_wrap for proper argument defaulting which is missing from merge, and which we don't want to introduce there since internal calls to merge don't erquire it. Change registration of sort so it has only one required argument, not two. * lib.c (less_f): New global variable. (less_tab): New static array. (less_tab_init): New static function. (less): New function. (sort): Default lessfun argument to the less function. (obj_init): GC-protect the less_f variable. Initialize it with a function object made from the less function. (init): Call less_tab_init. * lib.h (enum type): New enumeration member MAX_TYPE, an alias for the largest type. (less_f, less): Declared. * txr.1: Documented new less function, and that the lessfun argument in sort and merge is optional, defaulting to less. * txr.vim: Regenerated.
* * eval.c (eval_init): Register chr_isblank and chr_isunisp asKaz Kylheku2014-10-118-139/+227
| | | | | | | | | | | | | | | | intrinsics. * lib.c (chr_isblank, chr_isunisp): New functions. * lib.h (chr_isblank, chr_isunisp): Declared. * regex.h (spaces): Declaration for existing variable added. * txr.1: Documented chr-isblank and chr-isunisp. * genvim.txr: Add missing sysif.c. * txr.vim: Regenerated.
* Fix gc safety issue in abs_path_p function.Kaz Kylheku2014-10-092-4/+16
| | | | | | | * stream.c (ap_regex): New static variable. (abs_path_p): Remove local reg variable; replace uses of reg with ap_regex. (stream_init): gc-protect ap_regex.
* * stream.c (stream_init): No need to gc-protectKaz Kylheku2014-10-092-1/+10
| | | | | | | | | std_input, std_output, std_debug, std_error and std_null. These are not ordinary variables but macros which expand to locations in the variable binding environment that are already protected. This call was actually doing nothing, because the symbol involved in the expression std_input is not yet initialized and so &std_input yields a null pointer which causes protect to bail.
* Moving system interface functions to separate module out ofKaz Kylheku2014-10-089-444/+550
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the eval and stream modules. * Makefile (OBJS): Add sysif.o. * dep.mk: Regenerated. * eval.c (errno_wrap, daemon_wrap, exit_wrap, usleep_wrap, getpid_wrap, getppid_wrap, env_hash): Functions moved to sysif.c and changed to static functions. (eval_init): Registrations of functions moved to sysif.c. * lib.c (init): Call sysif_init. * stream.c (w_stat, statf, mkdir_wrap, chdir_wrap, getcwd_wrap, makedev_wrap, minor_wrap, major_wrap, mknod_wrap): Functions moved to sysif.c and become static functions. (stream_init): Registration of stat moved to sysif.c. (open_files, open_files_star): Bugfix: no longer erroneously included in #ifdef HAVE_UNISTD_H block. * stream.h (mkdir_wrap, chdir_wrap, getcwd_wrap, makedev_wrap, minor_wrap, major_wrap, mknod_wrap, symlink_wrap, link_wrap, readlink_wrap): Declarations removed. * sysif.c: New file. * sysif.h: New file.
* Add test case for recent breakage.Kaz Kylheku2014-10-085-0/+337
| | | | | | | | | | * tests/006/freeform-3.expected: New file. * tests/006/freeform-3.txr: New file. * tests/006/passwd: New file. * Makefile (TXR_ARGS): Set up for new test case.
* Fix 2011-12-03 regression. The freeform directive codeKaz Kylheku2014-10-083-12/+42
| | | | | | | | | | | | | | | | | | | relies on lazy_str_get_trailing_list and the behavior of that function changed because (split-str "" any-separator) changed from returning nil to returning the empty string. The resulting behavior change of lazy_str_get_trailing_list was later described in the documentation, thereby codifying it. This patch changes the lazy_str_get_trailing_list behavior, which is poor, and causes infinite looping. We do not want an extra empty string prepended, because it looks like a spurious line. * lib.c (lazy_str_get_trailing_list): if split_str produces a the list (""), then just return the unmaterialized list from the lazy string without prepending that one-element list to it. * txr.1: Updated documentation for lazy-str-get-trailing-list.
* Version 99.txr-99Kaz Kylheku2014-10-057-15/+54
| | | | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version. * share/txr/stdlib/ver.txr: Likewise * Makefile: Improve binary packaging rules. * regex.c: #include <stdarg.h> added.
* * txr.1: Small fixes.Kaz Kylheku2014-10-051-2/+2
|
* Printing of regular expression objects implemented.Kaz Kylheku2014-10-043-2/+162
| | | | | | | | * regex.c (regex_print): New static function. (regex_obj_ops): Registered regex_print. (print_class_char, paren_print_rec, print_rec): New static functions. * dep.mk: Regenerated.
* Keep regex source code in regex objects, in anticipationKaz Kylheku2014-10-042-2/+23
| | | | | | | | | of pretty-printing. Fix object construction bugs. * regex.c (struct regex): New member, source. (regex_mark): Ensure source is visited by garbage collector. (regex_compile): Store regex_sexp in source. Fix violations of section 3.2 of HACKING document.
* Eliminating the extra list wrapping applied to regularKaz Kylheku2014-10-034-61/+73
| | | | | | | | | | | | | | | | | | | expression objects in the syntax tree. The parser just puts out a #<regex ...> instead of (#<regex ...> regex-syntax). * eval.c (do_eval): We no longer need the hack of treating (#<regex> ...) as a special form which evaluates to #<regex>. (expand): We no longer have to skip over regex syntax, so the case is removed. * match.c (h_var, do_txeval, do_match_line): regexp cases are no longer subcases of consp but stand on their own. In do_match_line, we introduce a COBJ case into the type switch for regexes. * parser.y: regexes are now compiled in the regex and lisp_regex grammar rules instead of the dependent rules, and are not wrapped in extra syntax.
* * match.c (h_var): Fix regression introduced in 2014-08-11Kaz Kylheku2014-10-033-6/+33
| | | | | | | | | | | commit. The incompleteness of that change broke the case of an unbound variable followed by a bound variable. The value of the second variable was still being wrapped in the old complicated representation before being pushed to the front of the spec. * txr.1: Replace bogus text which says that variables are not bound to regexes, and so regex matches from variable substitutions do not arise. This works fine after this change.
* * Makefile: rules that rely on values from config.makeKaz Kylheku2014-10-032-2/+9
| | | | now have config.make as a prerequisite.
* Using unified COBJ representation for both regex kinds,Kaz Kylheku2014-10-024-32/+69
| | | | | | | | | | | | | | | | | | | | | | | | rather than the list-based notation for derivative-based regexes, and an encapsulated COBJ for NFA-based regexes. * lib.c (compiled_regex_s): Variable removed. (obj_init): Initialization of compiled_regex_s removed. * lib.h (compiled_regex_s): Declaration removed. * regex.c (struct regex, regex_t): New type. (regex_destroy): Object is now a regex_t, not nfa_t. (regex_mark): New function. (regex_obj_ops): Register regex_mark operation. (reg_nullable, reg_derivative): Remove cases that handles compiled_regex_s. (regex_compile): Output of dv_compile_regex becomes a cobj nwo. Output of nfa_compile_regex must be embedded in regex_t structure. (regexp): Drop the check for compiles_regex_s. (regex_nfa): Function removed. (regex_run, regex_machine_init): Use cobj_handle to retrieve regex_t * pointer and dispatch appropriate code based on regex->kind.
* * genman.txr: Add PayPal donation button.Kaz Kylheku2014-09-303-42/+68
| | | | | * txr.1: Avoid escapes at the end of a line; man2html doesn't handle this properly.
* * genman.txr: TXR is now bolded in the title.Kaz Kylheku2014-09-303-349/+415
| | | | * txr.1: More formatting and wording fixes.
* * lib.c (do_and): Fix andf again: (andf) not producingKaz Kylheku2014-09-262-1/+6
| | | | a function that returns t, as documented.
* Version 98.txr-98Kaz Kylheku2014-09-267-69/+117
|
* * txr.1: Substantially revised with rich troff markup,Kaz Kylheku2014-09-263-10029/+18968
| | | | | | | and restructured in some places. * genman.txr: No longer generate the whole document in monospaced font. Add hyperlinks.
* * lib.c (do_and, do_or): Fix broken andf and orf,Kaz Kylheku2014-09-252-6/+14
| | | | | lacking the semantics of returning the last value, or the first true value, respectively.
* * Makefile (txr-manpage.pdf): New target.Kaz Kylheku2014-09-222-0/+7
|
* * txr.1: Fix version.Kaz Kylheku2014-09-131-1/+1
|
* * txr.1: Quoting issue, reported by groff.Kaz Kylheku2014-09-121-1/+1
|
* * lib.c (compat_fixup): void return changed to int.Kaz Kylheku2014-09-105-7/+28
| | | | | | | | | Returns minimum supported emulation. * lib.h (compat_fixup): Declaration fixed. * txr.c (compat): Replace hard-coded min version by return value of compat_fixup.
* * txr.c (help): List new --compat option.Kaz Kylheku2014-09-093-44/+85
| | | | | | | | | (requires_arg, do_fixnum_opt, compat, array_dim, gc_delta): New static functions. (txr_main): Use do_fixnum_opt for handling options with integer argument. Add --compat alias for -C. * txr.1: Documented --compat. Added missing description of --debugger.
* * txr.c (txr_main): Cleaning up option handling code.Kaz Kylheku2014-09-092-51/+86
| | | | Better checking for misused long options.
* * eval.c (eval_init): Register intrinsic partition* function.Kaz Kylheku2014-09-095-0/+131
| | | | | | | | | * lib.c (partition_star_func): New static function. (partition_star): New function. * lib.h (partition_star): Declared. * txr.1: Documented partition*.
* * eval.c (eval_init): Register intrinsic partition function.Kaz Kylheku2014-09-095-0/+110
| | | | | | | | | * lib.c (partition_func): New static function. (partition): New function. * lib.h (partition): Declared. * txr.1: Documented partition.
* * txr.c (help): Revised help text.Kaz Kylheku2014-09-092-4/+9
|
* * gc.c (MALLOC_DELTA_THRESH): Macro remaned to DFL_MALLOC_DELTA_THRESH.Kaz Kylheku2014-09-088-4/+116
| | | | | | | | | | | | | | | | | | | | | (opt_gc_delta): New global variable. (make_obj): Use opt_gc_delta rather than MALLOC_DELTA_THRESH. (gc_set_delta, gc_wrap): New static functions. (gc_late_init): New function. * gc.h (gc_late_init): Declared. * genvim.txr: scan gc.c also. * lib.c (init): call gc_late_init. * txr.1: Document new --gc-delta option and the functions gc and gc-set-delta. * txr.c (help): Help text for --gc-delta. (txr_main): Parse --gc-delta option. * txr.h (opt_gc_delta): Declared.
* Make the garbage collector aware of malloced bytes, toKaz Kylheku2014-09-062-3/+22
| | | | | | | | | | | prevent skyrocketing memory use when the program manipulates heap objects that have large amounts of malloc memory attached, like very large bignums. * gc.c (MALLOC_DELTA_THRESH): New preprocessor symbol. (prev_malloc_bytes): New static variable. (make_obj): when the value of malloc_bytes jumps by MALLOC_DELTA_THRESH or more since the last gc, trigger gc.
* * lib.c (symbol_setname): New static function.Kaz Kylheku2014-09-035-20/+85
| | | | | | | | | | | | | | (obj_init): Change exception symbol names with underscores to use friendly dashes instead. (compat_fixup): New function. * lib.h (compat_fixup): Declared. * txr.1: Change occurrences of exception symbols from underscores to dashes. * txr.c (txr_main): Call compat_fixup when -C option is processed.
* * txr.1: Document -C option.Kaz Kylheku2014-09-024-3/+40
| | | | | | | | | * txr.c (opt_compat): New global variable. (help): Describe -C option. (txr_main): Process -C, and set opt_compat. Ensure -C does not clump. * txr.h (opt_compat): Declared.
* * eval.c (eval_init): Update registration of lisp-parse and readKaz Kylheku2014-09-029-13/+44
| | | | | | | | | | | | | | | | | | | | to account for new parameter. * lib.c (syntax_error_s): New symbol_variable. (obj_init): New symbol variable initialized. * lib.h (syntax_error_s): Declared. * parser.h (lisp_parse): Declaration updated. * parser.l (lisp_parse): Takes third parameter. * txr.1: Third parameter of read described. * txr.c (txr_main): Pass colon_k to third parameter of lisp_parse to obtain exception throwing behavior. * unwind.c (uw_init): Register syntax-error as subtype of error.
* * arith.c (arith_init): Register some variables: *flo-dig*,Kaz Kylheku2014-09-016-160/+223
| | | | | | | | | | | | *flo-min*, *flo-max*, *flo-epsilon*, *pi* and *e*. * genvim.txr: Include arith.c in scan for symbols. * lib.c (init): arith_init() must now be called after eval_init(). * txr.1: Documented new variables.. * txr.vim: Updated.
* Version 97.txr-97Kaz Kylheku2014-08-295-3/+29
|
* * eval.c (expand_quasi): Regression: fix broken handlingKaz Kylheku2014-08-292-7/+8
| | | | | | of @{var mod} syntax triggering a bogus assertion. Mods are the third element in the abstract syntax now, not fourth. There is no next link. Removing bogus comment referring to a nonexistent function.
* * match.c (v_load): Fix regression introduced in 94: broken @(load).Kaz Kylheku2014-08-292-1/+5
|
* * gc.c (top): Renamed to gc_prot_top, turned extern.Kaz Kylheku2014-08-254-7/+25
| | | | | | | | | (prot1, rel1, mark): Follow rename. * gc.h (gc_prot_top): Declared. * signal.h (extended_jmp_buf): New member, gc_pt. (extended_setjmp): Save and restore gc_prot_top.
* GC correctness fixes: make sure we pin down objects for which we borrowKaz Kylheku2014-08-254-10/+59
| | | | | | | | | | | | | | | low level C pointers, while we execute code that can cons memory. * lib.c (list_str): Protect the str argument. (int_str): Likewise. * regex.c (search_regex): protect the haystack string, while using the h pointer to its data, since regex_run can use the derivative-based engine which conses. * stream.c (vformat_str): Protect str argument, since put_char might conceivably cons. (vformat): Protect fmtstr.
* Version 96.txr-96Kaz Kylheku2014-08-146-13/+46
|
* Uprooting stupidities in handling of output variables.Kaz Kylheku2014-08-134-65/+36
| | | | | | | | | | | | | | | | | | | | * parser.y (o_elems_transform): Remove useless function which was only unwrapping the strange parse of output vars. (o_elems_opt, rep_elem, quasilit, wordsqlit): Eliminate o_elems_transform call. (o_var, q_var): Eliminate the phrase structure rules which match an extra o_elem or quasi_item, and which incorporate them into the var syntax tree element. Place the modifiers into the third position, not fourth. * eval.c (subst_vars): Eliminate handling of "pat" element. Actually that was not even there thanks to o_elems_transform being applied: dead code. Pull modifiers from the third element of the var form now, not fourth. * match.c (subst_vars): Similar changes as in the match.c subst_vars function. Here the pat variable is even more obviously useless; if it is not nil, it is just punted back to the spec.
* Fix regression in previous change: we must match a compound textKaz Kylheku2014-08-133-34/+46
| | | | | | | | | | | | element whole, and not break it up. * match.c (search_match): Take a spec argument. (h_var): Turn a text element into a one-element spec and process with search_match. * txr.1: Updated text about matching of variables followed by a directive or function, and about consecutive variables via directive.
* When a variable is delimited by some form other thanKaz Kylheku2014-08-122-95/+131
| | | | | | | | | | | | | | | | | | | | the contents of a variable, fixed string or regex, we now use the entire tail of the specline to find the match. So for instance @var@(trailer)foo works as intuition might expect. * match.c (search_form): Static function removed. (search_match): New static function based on search_form. Does not handle regexes, and does not update c->bindings. (h_var): Renamed local variable pat to next. Added a few missing rlcp's. Combined the cases when pat is a cons to one block so consp isn't repeatedly tested. Function now handles a var followed by (sys:text ...) elements specially; the first element of the text block is pulled out and matched. Implemented "var delimiting spec" general case which matches the entire tail of the spec at successive character positions until a match is found, and the skipped text goes into the variable.
* First cut at restructuring how variable matching works in the patternKaz Kylheku2014-08-113-40/+36
| | | | | | | | | | | | | | | | | language. The goal is to remove the strict behavior of using only one element of context after a variable. variable form at parse time: we unravel that first. * parser.y (grammar): Simplifying the phrase structure rule for the var element. All the variants that have a trailing elem are removed. The abstract syntax changes; the modifier moves to the third position in the list. * match.c (h_var): Matching change: the element which follows a variable is now pulled from the specline rather than the variable syntax, which is how it should have been done in the first place. The modifiers are pulled from a different spot in the variable syntax.
* * filter.c (filter_init): Expose the trie-lookup-begin,Kaz Kylheku2014-08-093-0/+68
| | | | | | trie-value-at and trie-lookup-feed-char functions as intrinsics. * txr.1: Document exposed functions.
* Bugfix: ret operator does not generate functionsKaz Kylheku2014-08-083-2/+17
| | | | | | | | | that take any number of arguments. * eval.c (me_ret): Generate (op identity (progn @rest <expr>)) rather than of (op identity <expr>). * txr.1: Update misleading equivalence.
* Fix wrong date.Kaz Kylheku2014-08-081-1/+1
|
* Version 95.txr-95Kaz Kylheku2014-08-075-4/+24
|