summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* 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.
* Bundle Cygnal version of Cygwin DLL.Kaz Kylheku2016-07-021-1/+1
| | | | | | * inst.nsi: Copy cygwin1.dll from win subdirectory rather than c:\cygwin\bin. The cygwin1.dll is placed there prior to generating the installer.
* The cmdwrap sh.exe hack is no longer needed.Kaz Kylheku2016-06-303-23/+0
| | | | | | | | | | | The Cygnal library uses cmd.exe for popen: problem solved. * Makefile (sh.exe): Target removed. * cmdwrap.c: File removed. * inst.nsi: Do not install sh.exe.
* Dynamically determine whether shell is cmd.exe.Kaz Kylheku2016-06-301-1/+18
| | | | | | | | | | | * stream.c (shell, shell_arg): New variables. (sh): Use shell and shell_arg, rather than hard-coded "/bin/sh" and "-c". (stream_init): Initialize shell and shell_arg to POSIX values. On Cygwin, call getusershell, and if it reports cmd.exe, use that instead, and adjust shell_arg to "/c". This will happen if the Cygwin DLL being used is the Cygnal version.
* Version 144.txr-144Kaz Kylheku2016-06-296-644/+686
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Fix command spawning on Cygwin-based standalone image.Kaz Kylheku2016-06-293-0/+23
| | | | | | | | | | | | | | | | In the standalone image, we need a /bin/sh interpreter for the sh and open-command functions to work. The / path resolves to the installation directory, thanks to some sysrooting logic in the Cygwin DLL. Thus, we just need a sh.exe program in the bin directory, side by side with txr.exe. This sh.exe program can translate the "sh -c command" invocation to "cmd.exe /c command". * Makefile (sh.exe): New target, built from cmdwrap.c. * cmdwrap.c: New file. * inst.nsi: Install sh.exe.
* We would like the Windows port of TXR to open files in textKaz Kylheku2016-06-282-0/+9
| | | | | | | | | | | | | | | | mode by default, such that "\r\n" is converted to "\n". Cygwin's stdio streams aren't doing this. This is fine when working in the Cygwin world, but not fine when we are making a "native" Windows program with the help of the Cygwin DLL. However, Cygwin supports the "t" mode letter in fopen, and that forces a text mode which does the conversion. * stream.c (format_mode): On Cygwin, if the mode isn't binary, add the 't' letter to the normalized mode string, unless compatibility <= 143 is requested. * txr.1: Added compat notes.
* Update compatibility notes.Kaz Kylheku2016-06-281-0/+3
| | | | | | * txr.1: The big switch to Lisp evaluation throughut the pattern language needs mentioning in the compatibility notes.
* Handle two possible home dir locations on Cygwin.Kaz Kylheku2016-06-271-1/+27
| | | | | | | | | | | | | | | | | Under the Cygwin port, if we are running in the Cygwin shell enviroment, there is a HOME variable which contains a POSIX path like /home/kaz. This path works fine and we use that. If we are not running in the Cygwin environment, but running as an application that uses the Cygwin DLL, then the HOME variable is still defined, but the path doesn't resolve. We must detect this, and fall back on the USERPROFILE environment variable, which holds something like C:\Users\kaz. * parser.c (get_home_path): New static function, defined separately for Cygwin and other platforms. (repl): Use get_home_path to determine home directory.
* Handle nonexistent HOME env var in repl.Kaz Kylheku2016-06-271-3/+3
| | | | | | | * parser.c (repl): If home is nil, don't try to extract UTF-8 string from histfile, which is also nil. Use the UTF-8 pointer for subsequent checks, since it is that pointer's use which is subject to those checks.
* Re-target Windows installer to Cygwin.Kaz Kylheku2016-06-271-0/+8
| | | | | | | * inst.nsi: New second license page informs about Cygwin. The cygwin1.dll and cyggcc_s-1.dll objects are added to the installer, placed into TXR's installation bin directory.
* Preparations for bundling Cygwin library.Kaz Kylheku2016-06-273-11/+33
| | | | | | | | | | * LICENSE-CYG: New file. * METALICENSE: Include a note about the use of Cygwin in accordance with LGPL. * txr.c (license): Use glob to iterate over all files in the txr share directory which match the LICENSE* pattern.
* Consistent capitalization of (C).Kaz Kylheku2016-06-271-2/+2
|
* Revamp documentation of expressions in pattern language.Kaz Kylheku2016-06-261-104/+341
| | | | | | | | * txr.1: Rewrote and rearranged sections that introduce compound expressions. Introduced "bind expressions" as a concept and applied throughout. Revised faulty documentation of @(bind). Documented Lisp evaluation where it now occurs.
* Separator expression in @(cat) evaluated as Lisp.Kaz Kylheku2016-06-261-1/+1
| | | | * match.c (v_cat): Use tleval_144 instead of txeval.
* Use Lisp eval for :var inits in collect and gather.Kaz Kylheku2016-06-261-1/+1
| | | | * match.c (vars_to_bindings): Use tleval_144 instead of txeval.
* Wrong section macro on from-list.Kaz Kylheku2016-06-171-1/+1
| | | | * txr.1: Introduce function with .coNP not .SS.
* Bugfix: unsafe num_fast in repeat/rep :counter code.Kaz Kylheku2016-06-171-6/+6
| | | | | | | * match.c (do_output_line): Use num(i) rather than num_fast(i), because i is not guaranteed to be in the fixnum range. It's less than c_num(max_depth), which could be a bignum that is in the cnum range.
* Address silly uses of fixnump.Kaz Kylheku2016-06-171-26/+22
| | | | | | | | | | | | | | * match.c (h_var): Check modifier for integerp rather than fixnump. (h_skip, h_coll, v_collect): Substitute zero only for nil values of various numeric parameters, not for values that are not fixnump. (v_skip): Likewise, and check success for integerp rather than fixnump. Even if the code can't handle bignums, we need to steer into that case so it can do he right thing and throw an exception. (freeform_prepare): Use weaker integerp type test rather than fixnump on arguments, for same reason as in v_skip.
* Rename EXTRA_DEBUGGING to CONFIG_EXTRA_DEBUGGING.Kaz Kylheku2016-06-174-10/+10
| | | | | | | | * configure: Generate #define CONFIG_EXTRA_DEBUGGING 1 in config.h header, rather than EXTRA_DEBUGGING. * gc.c, gc.h, hash.c: Change references to EXTRA_DEBUGGING preprocessor symbol to CONFIG_EXTRA_DEBUGGING.
* Print valgrind backtraces for break_obj.Kaz Kylheku2016-06-171-2/+28
| | | | | | | | | | | | * gc.c (more): Under EXTRA_DEBUGGING, call breakpt() here also, when it is detected that break_obj is added to the free list for the firts time. Print a message and backtrace using VALGRIND_PRINTF_BACKTRACE. (make_obj): Likewise, for an object that is pulled out of the free list and returned. (mark_obj, sweep_one): Print backtrace with Valgrind for break_obj, in addition to calling breakpt().
* Useful assertion in make_obj.Kaz Kylheku2016-06-171-0/+1
| | | | | * gc.c (make_obj): Assert that the object we are pulling from the free list is marked FREE.
* Tidy up some vector object initializations.Kaz Kylheku2016-06-171-7/+7
| | | | | | | * lib.c (vector, copy_vec, sub_vec, cat_vec): Set the type field of the object sooner. Do not malloc between obtaining the object, and initializing it, because that could throw, leaving an uninitialized object in the heap space.
* gc bugfix: maintain free_tail properly.Kaz Kylheku2016-06-161-5/+6
| | | | | | | | | | | | | * gc.c (more): Only set the free_tail if the new memory is being added to an empty free_list. Otherwise free_tail is valid. (make_obj): If we empty the free_list, then reset the free_tail pointer, so it doesn't continue pointing into the object we are returning. (sweep): Remove defensive code which tries to reset the free_tail in the empty free_list case, but assumes that free_tail is correct in the non-empty case.
* Remove more vestiges of the mark_makefresh hack.Kaz Kylheku2016-06-161-16/+3
| | | | | | | | | | * gc.c (sweep_one): Don't check for gen == -1; no reachable object can have that at this stage, since mark flips -1 objects to gen 0. (sweep): Do not clear freshobj_idx here; completely revert the mark_markfresh code. (gc): Clear freshobj_idx here., as before the mark_makefresh hack.
* Bogus gc marking code in syslog module.Kaz Kylheku2016-06-151-2/+0
| | | | | | | | | | * syslog.c (syslog_mark): Remove incorrect stray code, which passes a pointer to a non-gc-object to the gc_mark function. This code was left behind in the change which introduced struct syslog_strm, git hash e44c113ee17c7cf15e8b1891f4d51ec03b16bc24 "Deriving streams from the same base", July 29, 2015.
* Replace most TXR eval with Lisp eval.Kaz Kylheku2016-06-143-45/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * match.c (tlist_k): New keyword symbol variable. (tleval_144): New static function. (h_skip): evaluate min and max arguments as Lisp. (h_coll): Evaluate all numeric keyword arguments as Lisp: :min, :max, :gap, :times, :maxtimes, :mintimes, :chars. (h_call): Evaluate function expression as Lisp. (do_output_line, do_output): Evaluate n and m parameters in @(modlast) and @(mod) as Lisp. (v_skip): Evaluate min and max as Lisp. (v_fuzz): Evaluate m and n as Lisp. (v_freeform): Evaluate arguments as Lisp. (v_next): Support new argument, :tlist, which is like :list, but with TXR style evaluation. From now on :list uses Lisp evaluation, unless compatibility is set to 143 or lower. Also, evaluate the :string argument as Lisp. (v_collect): Evaluate all numeric keyword arguments as Lisp: :min, :max, :gap, :times, :maxtimes, :mintimes, :lines. (v_output): Evaluate stream in :continue or :finish expression as Lisp. (v_load): Evaluate load target as Lisp. (v_close): Evaluate stream argument as Lisp. (v_call): Evaluate function expression as Lisp. (syms_init): Initialize tlist_k variable. * tests/007/except-1.txr: Use :tlist instead of :list, since argument is a TXR list expression. * tests/010/block.txr: Likewise.
* Rename Lisp eval wrappers and change arg order.Kaz Kylheku2016-06-131-41/+32
| | | | | | | | | | | * match.c (eval_with_bindings, eval_progn_with_bindings): Change static function names to the shorter tleval and tleval_progn. The first and second arguments swapped around to match the convention used by txeval. (dest_bind, h_coll, tx_subst_vars, do_txeval, extract_bindings, do_output_line, do_output_line, do_output, v_next, v_collect, v_output, v_do, v_require, v_if, h_do): Follow rename.