summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* New rslot macro to suport upcoming awk macro.Kaz Kylheku2016-09-072-1/+28
| | | | | | | | | | | | This provides a way to create lexical macros denoting slots, such that method are invoked when they are updated. * lisplib.c (struct_set_entries): Add rslot to list of auto-load symbols for struct.tl module. * share/txr/stdlib/struct.tl (sys:rslotset): New function. (rslot, rslot): New macro and place macro. (sys:rslot): New place kind.
* Bugfix: issue with expansion of place macros.Kaz Kylheku2016-09-072-4/+10
| | | | | | | | | | | | | | | | | | | The expansion of a place macro form should not be subject to a complete macro-expansion (as a regular macro form). Only one round of expansion should be performed, and the results should be re-tried as a place macro. Otherwise an opportunity to expland a place macro will be missed. * share/txr/stdlib/place.tl (sys:pl-expand): Use macroexpand-1 rather than macroexpand. * txr.1: Documentation updated to make the new behavior clear. It's unlikely that anything in the world depends on this, so no backward compatibility switch is being provded to the old behavior. In situations where this makes a difference, the old behavior is likely too wrong to be useful.
* Bugfix: x not macro-expanded in (set [x i] y).Kaz Kylheku2016-09-071-10/+13
| | | | | | | | | * share/txr/stdlib/place.tl (sys:l1-setq): Expand sym, because it might not be a symbol. If it isn't a symbol, just generate a set. (dwim): Unconditionally bind sys:*lisp1* to t, whether or not the unexpanded place is a symbol. It could expand to a symbol. The context is lisp-1 if it does that.
* Bugfix: nthcdr place not obtaining macro env.Kaz Kylheku2016-09-071-5/+9
| | | | | | | | | | | | * share/txr/stdlib/place.tl (sys:*pl-env*): New special variable for passing macro-expansion environment to expanders. (call-update-expander, call-clobber-expander, call-delete-expander): bind sys:*pl-env* with passed-in env argument, so if the expander needs to itself recursively expand a macro, it has the macro-time env. (nthcdr): Do not try to capture :env parameter, because this will always be nil. Refer to sys:*pl-env* instead.
* Regression: @(rep) wrongly diagnoses empty clause.Kaz Kylheku2016-09-061-2/+2
| | | | | | | Introduced on 2016-04-27 in 7afbcc19. * parser.y (elem): Check $4 phrase position for empty clauses, rather than $2. That's where they are.
* Version 148.txr-148Kaz Kylheku2016-09-016-72/+99
| | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise.
* doc: revised merge directive description.Kaz Kylheku2016-09-011-38/+73
| | | | | * txr.1: Substantially rewrote incorrect and incomplete description of merge directive.
* Address -c not working with --lisp.Kaz Kylheku2016-09-011-0/+6
| | | | | | | | | | | * txr.c (txr_main): the --lisp option causes the parse stream to be processed as Lisp, which is fine if it is a file stream. If it is a byte string input stream created by the -c option, it won't work due to missing character operations on the stream, resulting in a strange error message and termination. That issue isn't being fixed here; just providing a more meaningful error message when --lisp is combined with -c.
* installer: don't package man page.Kaz Kylheku2016-08-311-2/+1
| | | | | | | | * inst.nsi: Windows has no man page reading tools, and the PDF and HTML are packaged already, so don't bundle the txr.1 man page source. Furthermore, we need to remove this when updating over existing installations, else they will forever have a stale txr.1 file hanging around.
* installer: lower case txr dir.Kaz Kylheku2016-08-311-6/+6
| | | | | * inst.nsi: consistently specify installation directory with lower-case "txr" path component.
* doc: wording changes regarding usage of "query".Kaz Kylheku2016-08-311-41/+64
| | | | | | | | | | | | * txr.1: The term "query language" is retired; "pattern language" is used everywhere. The script argument can be TXR Lisp or TXR, so is referred to as "script-file" in all contexts where it could be either. Clarifications are added in a few places that the script could be Lisp or that some wording only applies when the script is TXR. Removing incorrect, obsolescent wording which specifies that the leading exclamation mark convention is honored in a file name argument.
* doc: warn about exit methods not saving history.Kaz Kylheku2016-08-301-0/+5
| | | | | | * txr.1: Under INTERACTIVE LISTENER, add remarks that using the exit function, or raising a fatal signal, will prevent the history from being saved.
* doc: revise synopsis; document listener invocation.Kaz Kylheku2016-08-301-2/+11
| | | | | | | | | | | * txr.1: Revise the synopsis so that it doesn't insinuate that the query-file or data-file arguments are mandatory. A formatting issue with the brackets around options is fixed. Under ARGUMENTS AND OPTIONS document that if no arguments are present, the interactive listener is launched. Under INTERACTIVE LISTENER, mention that not only does the -i option run the listener, but so does txr invocation with no arguments.
* doc: verb number agreement in Undo Editing.Kaz Kylheku2016-08-301-1/+1
| | | | | * txr.1: Fix plural subject "lines" paired with singular verb "has".
* doc: bad wording in path-private-to-me-pKaz Kylheku2016-08-301-1/+3
| | | | | * txr.1: Fix sentence talking about two functions, respectively, but just one function as its subject.
* Fix emulation of TXR 135 @(if) semantics.Kaz Kylheku2016-08-291-2/+4
| | | | | | | | | * parser.y (if_clause, elif_clauses_opt): The previous commit changes the emulation of old @(if) behavior, since expressions obtained via the n_exprs_opt grammar phrase are not subject to expand_meta. We can counteract this by calling expand_meta in the compatibility code.
* Fix broken expansion in @(if) and output @(repeat).Kaz Kylheku2016-08-291-5/+5
| | | | | | | | | * parser.y (if_clause, elif_clauses_opt, repeat_clause, rep_elem): Recognize argument expressions as n_exprs_opt rather than exprs_opt, so that expand_meta is not applied. They are Lisp expressions, which are broken by expand_meta. A failing test case is op syntax with @num metanum variables, e.g. @(if (foo (op bar @1.slot))).
* Fix bugs in new quasiquote optimization.Kaz Kylheku2016-08-281-2/+4
| | | | | | | | | | | * eval.c (qquote_init): Stricter quote_form_p_f test function: reject the quote form if it isn't a proper list of two elements. (optimize_qquote_form): Extract all arguments of list forms and catenate them with mapcan, rather than assuming that they have one argument. This wrong assumption breaks ,,*(list ...) interpolation, for instance.
* Precompute functions used by quasiquote optimizer.Kaz Kylheku2016-08-281-35/+46
| | | | | | | | | | | | * eval.c (consp_f, second_f, list_form_p_f, quote_form_p_f, xform_listed_quote_f): New static variables. (qquote_init): New function. (optimize_qquote_form): Use list_form_p_f, quote_form_p_f, and second_f instead of constructing functions locally. (optimize_qquote_args): Use xform_listed_quote_f instead of locally constructed function. (eval_init): Call qquote_init. Register second function to second_f.
* Fix runaway recursion in lazy struct initialization.Kaz Kylheku2016-08-282-2/+9
| | | | | | | | | | | | | | | | | | | | | Staci-blowing test case: (defstruct foo nil bar) (mlet ((f (lnew foo bar (not f.bar)))) (prinl f.bar)) * struct.c (lazy_struct_init): Do not flip the lazy flag to zero here. The problem is that it's being done after the funcall(so->slot[0]), and so the struct is still marked for lazy initialization while that function is running. We could detect the circularity (as done in the force function) but that would create inflexibilities in lazy struct initialization. (check_init_lazy_struct): Flip the lazy flag to zero in this function before calling lazy_struct_init. * txr.1: Document behavior of struct being freely accessible during lazy initialization.
* Optimize quasiquote code generation.Kaz Kylheku2016-08-271-9/+98
| | | | | | | | | | | | | | | | | The surface motive here is to get better code than forms like (append (list 'a) (list 'b) ...). The ulterior motive is to suppress the memory explosion when heavily nested forms like ^^^^^^^^^^^x are expanded. This problem was uncovered by AFL (fast). * eval.c (optimize_qquote_form, optimize_qquote_args, optimize_qquote): New static functions. (expand_qquote_rec): New function. (expand_qquote): Contents moved into expand_qquote_rec. This function now optimizes the results of calling expand_qquote_rec.
* Introduce symbol variable for list*.Kaz Kylheku2016-08-271-2/+3
| | | | | | * eval.c (list_star_s): New symbol variable. (eval_init): Initialize list_star_s and use it for the list* function registration.
* Fix formatting of list* syntax.Kaz Kylheku2016-08-261-1/+1
| | | | * txr.1: list* symbol was typeset as meta.
* Adding time-parse method.Kaz Kylheku2016-08-252-17/+117
| | | | | | | | | | | | | | | | | | | | * lib.c (time_parse_s): New symbol variable. (tm_to_time_struct): New static function, based on code moved out of broken_time_struct. (broken_time_struct): Bulk of code replaced with call to tm_to_time_struct. (time_struct_to_tm): New parameter, strict. Indicates whether nils in time struct are converted to zeros, or whether they trigger errors. (time_string_meth): Specify strict conversion of argument time struct to to struct tm when calling time_struct_to_tm. (time_parse_meth): New static function. (time_init): Initialize time_parse_s symbol variable; add time-parse static slot to time struct; initialize slot with new method. * txr.1: Document time-parse method.
* Put cap on @<digits> value in op/do syntax.Kaz Kylheku2016-08-241-0/+4
| | | | | | | | | | | | | | | | The op transformer generates a lambda which has as many arguments as the highest-valued metanumber (@<digits> syntax) occurring in the form. If this is a huge integer, it obligingly tries to construct the argument list, running out of memory. In this commit, we cap the value to 1024. This issue was uncovered by the fuzzing utility AFL (fast) 2.30b. * eval.c (me_op): Throw error if max exceeds 1024, preventing the call to supplement_op_syms to actually generate an a formal parameter list of max symbols.
* Error on non-bindable sym in defvar and defparm.Kaz Kylheku2016-08-241-0/+3
| | | | | | * eval.c (me_def_variable): Check for sym not being a bindable symbol. Otherwise we might call mark_special on nil, which triggers an assertion.
* Fix bug: global lexicals marked special anyway.Kaz Kylheku2016-08-241-9/+4
| | | | | | | | | | | | | | Variables defined with defvarl or defparml are being marked special, due to a mark_special call in the macro expander which existed before they were introduced. * eval.c (me_def_variable): We have to call mark_special at macro-expansion-time for defparm and defvar, rather than arrange for it to be called later, for the same reasons that the (now incorrect) mark_special call had been introduced in do_expand function for handling defvar. (do_expand): Do not call mark_special, because the symbol being handled here is defvarl: define lexical variable.
* Check arg count when expanding defsymacro.Kaz Kylheku2016-08-241-0/+3
| | | | | | * eval.c (do_expand): Throw error if defsymacro form isn't a list of three elements, just like defparm and defparml do.
* Misleading error message in defvarl and defsymacro.Kaz Kylheku2016-08-241-2/+2
| | | | | | * eval.c (op_defvarl, op_defsymacro): Report correct symbol in not-bindable-symbol error message rather than reporting as let.
* New time-string method on time struct.Kaz Kylheku2016-08-222-16/+74
| | | | | | | | | | | | | * lib.c (time_string_s): New symbol variable. (time_fields_to_tm, time_struct_to_tm): New static functions. (make_time_impl): Replace bunch of code with call to time_fields_to_tm. (time_string_meth): New static function. (time_init): Initialize time_string_s. Add time-string static slot to time struct. Register time-string method. * txr.1: Documented.
* Adding time-parse function: wrapper for strptime.Kaz Kylheku2016-08-225-0/+68
| | | | | | | | | | | | * configure: Test for strptime. * eval.c (eval_init): register time-parse intrinsic. * lib.c (time_parse): New function. * lib.h (time_parse): Declared. * txr.1: Documented.
* Version 147.txr-147Kaz Kylheku2016-08-123-3/+18
| | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise.
* Fix multi-arch build issue for txr.res.Kaz Kylheku2016-08-062-2/+2
| | | | | | | | | | | | | When building in a separate directory, we can't just symlink the win directory, because the txr.res output file is architecture dependent and cannot be shared between 32 and 64 bit builds. * Makefile (%.res): Convert .rc -> .res rule to use the top_srcdir pattern, so the prerequisite will be found without the aid of the win/ directory symlink. * configure: Do not create win -> $source_dir/win symlink in the build directory.
* Port exception handling to 64 bit Cygwin.Kaz Kylheku2016-08-062-2/+59
| | | | | | | | | | | | | * jmp.S (DEFUN): Separate definition for 64 bit Cygwin, which doesn't use leading underscores and has an unusual prologue. (jmp_save, jmp_restore): Separately defined for 64 bit Cygwin, due to use of Microsoft 64 bit calling conventions. * signal.h (struct jmp): In x86-64 version, only on Cygwin, new members: rsi and rdi. These registers are considered nonvolatile and so are saved and restored by jmp_save and jmp_restore.
* Fix issue in make dependency generation.Kaz Kylheku2016-08-061-1/+2
| | | | | | | * Makefile (DEPGEN): We must fold the backslash continuations before trying to delete the first dependency element, because if the target name is long, that first element may be on the following line, and we delete the backslash.
* Check for Cygnal when deciding where user home is.Kaz Kylheku2016-07-271-19/+9
| | | | | | | * parser.c (get_home_path): Do not try HOME first and then USERPROFILE. If running on Cygnal, use strictly USERPROFILE, and do not fall back on HOME. In all other situations, try the HOME variable only.
* Version 146.txr-146Kaz Kylheku2016-07-206-52/+72
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Print notation for quasi-strings and quasi-word-lists.Kaz Kylheku2016-07-201-0/+64
| | | | | | | * lib.c (out_quasi_str): New static function. (obj_print_impl): Handle sys:quasi and sys:quasilist forms, reproducing a syntax similar to their read notation.
* NFA regex optimization: use just one set array.Kaz Kylheku2016-07-191-48/+31
| | | | | | | | | | | | | | | | | | | | | | We don't have to flip between two arrays, since the nfa_closure and and nfa_move_closure can write the output set into the same array. * regex.c (struct nfa_machine): Replace flip and flop members with a single set. (nfa_closure, nfa_move_closure): out array parameter removed; in renamed to set. References to in and out simply replaced with set. (nfa_run): Allocate one set instead of two, plus the stack. Remove code to swap the two pointers on each iteration. (regex_machine_reset): Prepare initial closure in the one and only set array. (regex_machine_init): Allocate set array, rather than flip an flop. (regex_machine_cleanup): Free set array and null out pointer rather than flip and flop arrays. (regex_machine_feed): Pass just the set ot the nfa_move_closure function. Remove flip/flop pointer swapping
* NFA regex optimization: combine move and closure.Kaz Kylheku2016-07-191-37/+90
| | | | | | | | | | | | | | | | | | | | * regex.c (struct nfa_machine_t): Remove move and clos array pointers, replace with flip and flop. Remove nmove member. (nfa_move): Static function removed. (nfa_move_closure): New static function, based on nfa_move and logic from nfa_closure. (nfa_run): Use nfa_move_closure and flip between two arrays. (regex_machine_reset): Remove reference to nmove member in nfa_machine_t. Prepare initial closure in flip array. (regex_machine_init): Allocate flip and flop arrays, rather than removed move and clos. (regex_machine_cleanup): Free flip and flop arrays and zero out the pointers, rather than removed move and clos. (regex_machine_feed): Replace nfa_move and nfa_closure with combined nfa_move_closure from flip to flop, and exchange of flip and flop arrays.
* Replace 0 constant with nil.Kaz Kylheku2016-07-191-1/+1
| | | | | * lib.c (split_str): Fourth argument of search_regex is Lisp boolean, so nil should be used to specify false.
* Adding uname.Kaz Kylheku2016-07-193-0/+133
| | | | | | | | | | | | | * configure: Detect utsname and uname. * sysif.c (utsname_s, sysname_s, nodename_s, release_s, version_s, machine_s): New symbol variables. (uname_wrap): New static function. (sysif_init): Initialize new symbol variables. Instantiate utsname struct type. Register uname_wrap as uname intrinsic function. * txr.1: Documented.
* Don't open text files using "t" mode on Cygwin.Kaz Kylheku2016-07-122-5/+8
| | | | | | | | | | | | | | | | | Retracting the recent change to add the "t" mode when opening non-binary streams on Cygwin, which arranges for line ending conversion. This restores the Unix-like treatment of text files on Cygwin, which is expected of programs. The Windows native version of TXR will do line ending conversion thanks to the behavior of text streams in the Cygnal fork of Cygwin. * stream.c (format_mode): Only add the "t" option on Cygwin if compatibility with 144 and 145 is selected. * txr.1: Updated compatibility notes.
* Installer: correct path for deleting sh.exe.Kaz Kylheku2016-07-121-1/+1
| | | | * inst.nsi: delete sh.exe from bin directory, not root.
* Version 145.txr-145Kaz Kylheku2016-07-034-4/+28
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Rewrite Cygwin installer copyright note for Cygnal.Kaz Kylheku2016-07-031-4/+12
| | | | | * LICENSE-CYG: Describe Cygnal situation and point to Cygnal project. Also, treat the GCC runtime separately.
* Fix wrong function name: addrinfo isn't a function.Kaz Kylheku2016-07-031-1/+1
| | | | * txr.1: Heading fixed from addrinfo to getaddrinfo.
* Fix crash in getaddrinfo.Kaz Kylheku2016-07-031-2/+4
| | | | | | | * socket.c (getaddrinfo_wrap): Initialize alist to null, because getaddrinfo doesn't set it in the failure case! Then, avoid calling freeaddrinfo for null pointer; POSIX doesn't require that to work.
* Add shortcut to txr.exe to start menu.Kaz Kylheku2016-07-021-2/+3
| | | | | | | | * inst.nsi: the txr link now points to the executable rather than the directory. This is because the executable now does something meaningful: it brings up a console window with a working REPL. The link to the directory is renamed install-root.
* Installer deletes the sh.exe created by TXR 144.Kaz Kylheku2016-07-021-0/+1
| | | | | | * inst.nsi: Delete sh.exe. If unable, it's okay to leave it to the next reboot; it's not critical to remove sh.exe.