summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* * 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.
* * eval.c (giterate_func, giterate): New static functions.Kaz Kylheku2014-07-273-2/+62
| | | | | | (eval_init): Registered giterate as intrinsic. * txr.1: Documented giterate.
* * unwind.h (uw_block_begin): Get rid of the unused typedef trick,Kaz Kylheku2014-07-262-3/+11
| | | | | | | replace with do { } while (0), since we don't have any instances of a uw_block_begin followed by declarations. (uw_catch_begin): Move SYMVAR and EXCVAR inside the do/while block, so that the expansion doesn't begin with a declaration.
* * txr.1: Corrections in "status and error reporting"Kaz Kylheku2014-07-251-13/+20
| | | | section and notes on regular expressions.
* * Makefile, arith.c, arith.h, combi.c, combi.h, configure, debug.c,Kaz Kylheku2014-07-2340-631/+636
| | | | | | | | debug.h, eval.c, eval.h, filter.c, filter.h, gc.c, gc.h, hash.c, hash.h, lib.c, lib.h, match.c, match.h, parser.h, parser.l, parser.y, rand.c, rand.h, regex.c, regex.h, signal.c, signal.h, stream.c, stream.h, syslog.c, syslog.h, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h: Synchronize license header with LICENSE.
* * match.c (subst_vars): Bugfix: I neglected to apply theKaz Kylheku2014-07-222-1/+7
| | | | | filter which is in effect to the result of interpolating a TXR Lisp expression, oops!
* * parser.y (METANUM): Forgotten %right declaration for thisKaz Kylheku2014-07-222-1/+6
| | | | token has been resulting in a shift-reduce conflict.
* * configure: Add a check, in the case that we cannot make anKaz Kylheku2014-07-227-6/+76
| | | | | | | | | | | | | | | | | executable, whether this is due to being required to use C99. For instance, the Solaris environment requires compilation using the C99 dialect if _XOPEN_SOURCE is set to 600 or higher. * debug.c: When compiling as C99, we have to obey the special C99 conventions for instantiating inline functions. * hash.c: Likewise. * lib.c: Likewise. * parser.y: Likewise. * unwind.c: Likewise.
* * RELNOTES: Updated.Kaz Kylheku2014-07-227-46/+103
| | | | | | | | * configure, txr.1: Bumped version. * share/txr/stdlib/ver.txr: Likewise * arith.c (log2): Change to static.
* * eval.c (me_case): Fix quoting issue in expansion.Kaz Kylheku2014-07-222-1/+7
|
* * signal.c (set_sig_handler): Set up and tear down alternateKaz Kylheku2014-07-202-2/+11
| | | | | | | | stack for SIGBUS also, not only for SIGSEGV. On Linux, when stack growth collides with another memory mapping, it triggers a SIGBUS not SIGSEGV, which occurs when the process limit on stack size is exceeded. In either situation, we need an alternative stack.
* * eval.c (caseq_s, caseql_s, casequal_s, memq_s, memql_s, memqual_s,Kaz Kylheku2014-07-203-6/+130
| | | | | | | | | | | eq_s, eql_s, equal_s): New symbol variables. (me_case): New static function. (eval_init): Initialize new variables. Register caseq, caseql and casequal macros. Re-register memq, memql, memqual, eq, eql and equal using new symbol variables. * txr.1: Document case, caseql and casequal.
* * eval.c (eval_init): Register juxt as intrinsic.Kaz Kylheku2014-07-205-0/+58
| | | | | | | | | * lib.c (do_juxt): New static function. (juxtv): New function. * lib.h (juxtv): Declared. * txr.1: Documented juxt.
* * arith.c (divi): Support one-argument form.Kaz Kylheku2014-07-204-8/+26
| | | | | | | | | Use "/" name in error reporting, not "divi". * eval.c (eval_init): Change registration of / so only one argument is required out of two. * txr.1: Document one-argument division.
* * genvim.txr: Fixed highlighting issues in numbers followed by newline.Kaz Kylheku2014-07-203-94/+101
| | | | * txr.vim: Regenerated.
* * lib.c (search_str): Support negative starting index.Kaz Kylheku2014-07-193-6/+27
| | | | | | Hoist uselessly repeated c_str operation out of loop. * txr.1: Document negative starting index for search-str.
* * hash.c (hash_construct): Nullify the pairs argument so thatKaz Kylheku2014-07-193-0/+27
| | | | | | it works correctly with an empty vector. * txr.1: Write missing documentation for hash-construct.
* * eval.c (mapdov): New function.Kaz Kylheku2014-07-195-5/+81
| | | | | | | | | | | (eval_init): Register mapdo intrinsic. * lib.c (mapdo): New function. * lib.h (mapdo): Declared. * txr.1: Documented mapdo. Documented zero-argument case for mapcar, mapcar*, mappend and mappend*.
* * stream.c (put_strings, put_lines): New functions.Kaz Kylheku2014-07-194-5/+65
| | | | | | | | (stream_init): Registered new functions as intrinsics. * stream.h (put_strings, put_lines): Declared. * txr.1: Documented.
* * eval.c (eval_init): Register get-lines as a synonym for lazy-stream-cons.Kaz Kylheku2014-07-195-1/+72
| | | | | | | | | | | * stream.c (get_string): New function. * stream.h (get_string): Declared. (stream_init): get_string registered as get-string intrinsic. * txr.1: Documented get-string, and get-lines as a synonym for lazy-stream-cons. Documented the behavioral difference of lazy-stream-cons lazy lists for real-time and non-real-time streams.
* * txr.1: wording: arguments are omitted, not parameters.Kaz Kylheku2014-07-191-3/+3
|
* * Makefile (conftest, conftest2): Link mathKaz Kylheku2014-07-187-4/+76
| | | | | | | | | | | | | | | | | | | library so we can test for math functions. * arith.c (log2_init): New static function. (log2, logtwo): New functions. (l2): New static variable. (arith_init): Call log2_init. * configure (lang_flags): Switching _XOPEN_SOURCE from 500 to 600 to reveal log2. Adding test for log2. * eval.c (eval_init): Register log2 intrinsic. * lib.h (logtwo): Declared. * txr.1: Documented log2.
* * match.c (v_do, v_require): Set up and tear down environment frame,Kaz Kylheku2014-07-152-2/+19
| | | | | | | like other situations that evaluate TXR Lisp from the pattern language. Otherwise obscure things will go wrong. (h_do): Same as above, and additionally, add the forgotten call to install the bindings into the match context.
* * match.c (h_eol): Fix broken horizontal @(eol).Kaz Kylheku2014-07-152-1/+7
| | | | | It should be returning next_spec_k, rather than bindings, which indicate a complete match.
* * tests/001/query-1.txr: Remove bogus public domain header.Kaz Kylheku2014-07-156-20/+12
| | | | | | | | | | * tests/001/query-2.txr: Likewise. * tests/001/query-3.txr: Likewise. * tests/001/query-4.txr: Likewise. * tests/002/query-1.txr: Likewise.
* Fix old, known syntax highlighting problems between symbols,Kaz Kylheku2014-07-153-16/+36
| | | | | | | | | | | | | | | integers and floating literals. * genvin.txr (txr_num): The general solution is to over-match a number by one character: a non-token constituent, and then subtract that from the highlight region using me=e-1. This solves the prefix ambiguities between numbers and symbols. (txr_badnum): New match: matches floating literals with trailing junk, which are highlighted as errors. (txr_directive, txr_list, txr_bracket, txr_mlist, txr_mbracket): All of these contain a txr_badnum. * txr.vim: Regenerated.
* Fix broken regex highlighting.Kaz Kylheku2014-07-153-97/+109
| | | | | | | * genvim.txr (txl_regex): Missing syntactic region added. (txr_regex): Start pattern is just a slash; no optional # in front. * txr.vim: Regenerated.
* * txr.c (txr_main): Allow Lisp code executed via -e and -p options toKaz Kylheku2014-07-142-2/+7
| | | | see the bindings set up by prior -D options.
* * eval.c (eval_init): Register interpose and lconsp as intrinsics.Kaz Kylheku2014-07-145-0/+127
| | | | | | | | | * lib.c (lconsp, interpose): New functions. (lazy_interpose_func, lazy_interpose): New static functions. * lib.h (lconsp, interpose): Declared. * txr.1: Documented lconsp and interpose.
* * txr.1: Fix opening ( balanced by }.Kaz Kylheku2014-07-131-1/+1
|
* Version 92.txr-92Kaz Kylheku2014-07-105-4/+36
| | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version. * share/txr/stdlib/ver.txr: Likewise