summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* * 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
|
* No getppid on MinGW.Kaz Kylheku2014-08-073-0/+35
| | | | | | * configure: Add test for getppid. * eval.c (getppid_wrap, eval_init): use HAVE_GETPPID
* * parser.l (yyerr): Function removed; it is not used in the lexer,Kaz Kylheku2014-08-073-39/+47
| | | | | | | | | | and converted to a macro in the parser. * parser.y (define_transform): take a parser argument rather than scanner. Set up scnr local variable for yyerr macro. Remove scnr argument from macro calls. (yyerr): New macro. (grammar): Remove scnr argument from yyerr calls.
* Reentrant parser regression.Kaz Kylheku2014-08-074-75/+75
| | | | | | | | | | | * parser.y (yybadtok): New macro. (yybadtoken): Function must take parser argument. (grammar): Replace uses of yybadtoken with yybadtok. * parser.h (yybadtoken): Declaration updated. * parser.l (grammar): Fix incorrect yyprepf calls that are missing the yyscanner parameter.
* Version 94.txr-94Kaz Kylheku2014-08-057-79/+138
|
* * rand.c (make_random_state): Make the seeding behaviorKaz Kylheku2014-08-052-7/+20
| | | | | | portable when the seed is a fixnum or bignum. The goal is that the same values of seed should produce the same random sequences on any platform.
* * eval.c (eval_init): Fix incorrect registration ofKaz Kylheku2014-08-052-1/+7
| | | | | random-fixnum, which doesn't allow it to be called with no arguments.
* * parser.y: Back port from Berkeley Yacc to GNU Bison.Kaz Kylheku2014-08-053-1/+15
| | | | | | | | We need a prototype of yylex that is in scope of the grammar, but YYSTYPE is not defined there. * parser.l: Bison 3 declares yyparse in y.tab.h, so we have to reorder some #includes.
* Big switch to reentrant lexing and parsing.Kaz Kylheku2014-08-026-420/+513
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * parser.l (YY_INPUT): Stop relying on removed yyin_stream; refer to stream via yyextra. (yyin_stream, lineno, errors, spec_file_str, prepared_error_message): Global variables removed. (yyget_column, yyset_column): Missing prototypes not generated by flex in bison bridge mode have to be added by us to avoid warning. (yyerror): Takes parser and scanner as parameters. Prepared error message is now in the parser context. Calls to other error handling functions receive scanner context. (yyerr): New function. (yyerrorf, yyerrprepf): Takes scanner argument, chases extra data to get to parser, and refers to parser variables instead of globals. (num_esc): Scanner argument added. (%option reentrant, %option bison-bridge, %option extra-type): New flex options. (grammar): yyscanner added everywhere. (end_of_char): Takes scanner argument. (parse_init): Removed references to yyin_stream and prepared_error_message. (parse_reset): Function renamed to open_txr_file. Returns results via pointers instead of setting global variables. (regex_parse, lisp_parse): Use reentrant parser interface. * parser.y (yyerror): Prototype removed. (yylex): Prototype moved after grammar, with new arguments. (sym_helper, define_transform): Take scanner argument. (make_expr): Takes parser argument. (rlrec): New static function. (rl): Function turned into macro. (mkexp, symhlpr): New macros. (%purse-parser, %parse-param, %lex-param): New Yacc options. (grammar): Actions re-worked for reentrance. Parser and scanner contexts are passed down to helper functions, in some cases via the three new macros. The result of the parse is stored in the syntax_tree member of the parser_t structure instead of a global. The yylex function receives the scanner instance. (get_spec): Function removed. (parse): New function. * parser.h (lineno, errors, yyin_stream, spec_file_str): Declarations removed. (parser_t): New struct. (yyerr): New function declared. (yyparse, yyerror, yyerrorf, end_of_regex, end_of_char, yylex, yylex_destroy): Declarations updated.
* * signal.c (interrupt_count): New global variable.Kaz Kylheku2014-08-022-1/+13
| | | | | | | (sig_handler): Increment and decrement interrupt count. If the interrupt count is already positive, treat that as if async signals were not enabled: do not invoke handlers.
* * configure (have_sys_time): New variable.Kaz Kylheku2014-08-015-0/+136
| | | | | | | | | | | | | | Added check for setitimer/getitimer which also checks for <sys/time.h>. * signal.c (sig_init): Register itimer-real, itimer-virtual, itimer-prof variables and getitimer and setitimer functions. (tv_to_usec): New static function. (getitimer_wrap, setitimer_wrap): New functions. * signal.h (getitimer_wrap, setitimer_wrap): Declared. * txr.1: Documented itimers.
* * signal.c (set_sig_handler): Don't use SA_ONSTACKKaz Kylheku2014-08-013-3/+13
| | | | | | | | except for signals for which we use alt stack. * signal.h (sig_save_enable): Do sig_check before enabling async signals. This caused the !async_sig_enabled assertion to trip inside make_obj.
* * signal.c (sig_hup, sig_int, sig_quit, sig_ill, sig_trap, sig_abrt,Kaz Kylheku2014-08-013-14/+11
| | | | | | | | | | sig_bus, sig_fpe, sig_kill, sig_usr1, sig_segv, sig_usr2, sig_pipe, sig_alrm, sig_term, sig_chld, sig_cont, sig_stop, sig_tstp, sig_ttin, sig_ttou, sig_urg, sig_xcpu, sig_xfsz, sigtalrm, sig_prof, sig_poll, sig_sys, sig_winch, sig_iot, sig_stkflt, sig_io, sig_lost, sig_pwr): Remove unused global variables variables. * signal.h: Remove declarations thereof.
* * eval.c (getpid_wrap, getppid_wrap): New static functions.Kaz Kylheku2014-07-304-0/+62
| | | | | | | | | (eval_init): Registered getpid and getppid intrinsics. * signal.c (kill_wrap): New static function. (sig-init): Registered kill intrinsic function. * txr.1: Documented getpid, gettpid and kill.
* * parser.l: Allow unquotes and splices in QSPECIAL and BRACED states.Kaz Kylheku2014-07-306-7/+45
| | | | | | | | | * parser.y (quasi_item): Support splices as items. * genvim.txr: Syntax highlighting support for unquotes in quasiliterals. * txr.vim: Updated.
* * txr.vim: Updated.Kaz Kylheku2014-07-301-100/+101
|
* * eval.c (eval_init): Register uniq function.Kaz Kylheku2014-07-295-0/+61
| | | | | | | | * lib.c (uniq): New function. * lib.h (uniq): Declared. * txr.1: Documented uniq.
* * eval.c (repeatv): Renamed to repeat. Turned into functionKaz Kylheku2014-07-293-9/+27
| | | | | | | | | with one optional argument, reflecting existing behavior. (eval_init): Registration of repeat updated. * txr.1: Fixed incorrect documentation which falsely suggests that repeat takes multiple lists, and doesn't mention the optional count.
* * arith.c (plus, minus, mul): Fix missing breaksKaz Kylheku2014-07-292-0/+12
| | | | | to switch statements, leading to strange error messages when wrong types are passed in.
* * eval.c (eval_init): Register nconc as intrinsic.Kaz Kylheku2014-07-295-3/+32
| | | | | | | | * lib.c (nconcv): New function. * lib.h (nconcv): Declared. * txr.1: Documented nconc.
* * lib.c (reduce_left, reduce_right): Nullify incoming sequenceKaz Kylheku2014-07-292-0/+9
| | | | argument so empty vectors and strings can be processed.
* * eval.c (giterate_func, giterate): Adjusting semantics of giterate toKaz Kylheku2014-07-293-15/+21
| | | | | | | | include seed item in the sequence. The while test is applied to each item before it is passed through the function. Also, eliminated useless rplacd operation. * txr.1: Updated documentation of giterate.
* * eval.c (eval_init): Register partition-by intrinsic.Kaz Kylheku2014-07-285-0/+98
| | | | | | | | | * lib.c (partition_by_func): New static function. (partition_by): New function. * lib.h (partition_by): Declared. * txr.1: Documented partition-by.
* * arith.c (rising_product): Fix wrong m == n case,Kaz Kylheku2014-07-283-5/+12
| | | | | | which breaks the n_perm_k function for k == 1. * txr.1: Fix typo: n-choose-k written in place of n-perm-k.
* * txr.1: Fix bad non-floating-point constant examples.Kaz Kylheku2014-07-281-1/+3
|
* * txr.1: typo: List Literals not Lists. FixKaz Kylheku2014-07-281-2/+2
| | | | incorrect octal example.
* Fix 2014-02-05 safety regression: unchecked use of non-function objectsKaz Kylheku2014-07-272-5/+14
| | | | | | | | in some contexts that require functions. * lib.c (funcall, funcall1, funcall2, funcall3, funcall4): check type(fun) before dereferencing to see whether there are optional args.