summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* 2014-06-10 Kaz Kylheku <kaz@kylheku.com>Kaz Kylheku2014-06-104-22/+49
| | | | | | | | | | | | | | | * Makefile (PROG): Removing ./ prefix from variable name; adding it to invocations of $(PROG) in some rules. (txr.o): Pass several strings as macros on the command line: TXR_REL_PATH, EXE_SUFF and PROG_NAME. * configure (bindir, datadir, mandir): These variables become just relative paths from the prefix. * txr.c (sysroot): Use the TXR_REL_PATH, EXE_SUFF and PROG_NAME preprocessor symbols defined on the command line to avoid hard-coding strings like "bin/txr" and "bin/txr.exe" which actually should reflect the value of the bindir variable.
* * txr.c (get_self_path): Fix spelling of GetModuleFileName.Kaz Kylheku2014-06-102-3/+17
| | | | | | Add missing parentheses in expression. (sysroot_init): On Windows, filter progpath to change backslashes to forward slashes.
* * parser.l (yylex_destroy): The FLEX_ version are prefixed with YY_Kaz Kylheku2014-06-102-5/+8
| | | | in old flexes too.
* New variable stdlib, with a sysroot mechanism to computeKaz Kylheku2014-06-092-0/+89
| | | | | | | | | the path based on the "sysroot" where it is actually installed. * txr.c (progname_8u, progpath): New static variables. (get_self_path, sysroot_helper, sysroot, sysroot_init): New static functions. Sysroot creates a stdlib variable. (main): Initialize progname_u8 value, and call sysroot_init.
* * lib.c (match_str): Extended to suffix testing, with a negativeKaz Kylheku2014-06-093-13/+44
| | | | | | start argument. * txr.1: Documented.
* * Makefile: fix broken tests; numerous test cases outputKaz Kylheku2014-06-092-1/+14
| | | | | bindings, and need the -B option. One test case does not need the -l option which now implies -B.
* * txr.c (txr_main): New option --args.Kaz Kylheku2014-06-093-21/+77
| | | | | | Also, put in missing check for -f being erroneously clumped. * txr.1: Documented.
* * txr.1: Clarify that -B is needed in some examples.Kaz Kylheku2014-06-091-30/+30
|
* The dumping of bindings and printing of false must nowKaz Kylheku2014-06-098-78/+48
| | | | | | | | | | | | | | | | | | | | | | | | | be explicitly requested by the -B option. * match.c (opt_nobindings): Variable removed. (opt_print_bindings): New variable. (extract): Print bindings or "false" if opt_print_bindings is true. * stream.c (output_produced): Variable removed. (stdio_put_string, stdio_put_char, stdio_put_byte): Remove update of output_produced. * stream.h (output_produced): Declaration removed. * txr.1: Documentation updated. * txr.c (txr_main): Option 'b' does nothing. 'B', 'l', 'a', and '--lisp-bindings' set opt_print_bindings to 1. * txr.h (opt_nobindings): Declaration removed. (opt_print_bindings): Declared. * unwind.c (uw_throw): When exiting due to a query error or file error, print false when opt_print_bindings is true.
* Fixing issue with list-like iteration over generic sequences,Kaz Kylheku2014-06-065-22/+195
| | | | | | | | | | | | | | | | | | | | | | | | | | namely that empty strings and vectors are not nil. The nullify function is introduced. It is also exposed to users, as is the existing make_like function. * eval.c (mapcarv, mappendv, lazy_mapcar, lazy_mapcarv): Use nullify to handle non-list inputs correctly. (eval_init): Registering make_like and nullify as intrinsics. * lib.c (copy_list, to_seq, list_collect_nconc, list_collect_append, reverse, lazy_appendv_func, lazy_appendv, ldiff, memq, memql, memqual, remq, remql, remqual, remove_if, keep_if, rem_lazy_rec, remq_lazy, remql_lazy, remqual_lazy, remove_if_lazy, keep_if_lazy, countqual, countql, countq, count_if, some_satisfy, all_satisfy, none_satisfy, do_chain, chainv, do_and, andv, do_or, orv, cat_vec, assoc, assql, mapcar, mapcon, mappend, sort, multi_sort, find, find_if, posqual, posql, posq, pos, pos_if, set_diff, search): Use nullify for correctness. Some functions fixed so return sequence matches type of input sequence. (nullify): New function. * lib.h (nullify): Declared. * txr.1: Documented nullify and ake-like.
* * eval.c (eval_init): Register new search function as intrinsic.Kaz Kylheku2014-06-066-32/+164
| | | | | | | | | | | * lib.c (search_list): New static function. (search): New function. * lib.h (search): New function declared. * txr.1: Documented. * txr.vim: Regenerated.
* * configure: tabs to spaces.Kaz Kylheku2014-06-061-21/+21
|
* * parser.l: Adding an explicit lexical rule toKaz Kylheku2014-06-052-0/+12
| | | | | | catch backslashes occurring within a regex, not followed by a character. This can happen in dynamically parsed regexes such as "abc\\".
* * parser.l (yylex_destroy): Only rely on the FLEX_ versionKaz Kylheku2014-06-052-0/+8
| | | | | numbers if they are defined. In a newer flex, they are prefixed by YY_.
* * configure (lang_flags): Removing -D_BSD_SOURCEKaz Kylheku2014-06-052-2/+52
| | | | | | | | | | | | from lang_flags. Adding a test for determining which flag reveals BSD functions. This is due to the braindamaged way feature selection macros work on FreeBSD. There is no way to say "give me only the functions from a certain version of the Unix spec, plus traditional BSD functions", so we have to resort to using the internal symbol __BSD_VISIBLE. Also, changing the detection test for daemon function to the pointer-based approach.
* * configure (lang_flags): drop -D_POSIX_C_SOURCE=199309L.Kaz Kylheku2014-06-042-1/+6
| | | | This is subsumed by -D_XOPEN_SOURCE=500.
* * configure: Typo in diagnostic output: wspawnlp.Kaz Kylheku2014-06-042-1/+5
|
* Changes for FreeBSD 9.Kaz Kylheku2014-06-043-2/+23
| | | | | | | | | * configure: Use pointer-based test for timegm, because -Werror=implicit-function-declaration does not work in the gcc 4.2 used on FreeBSD 9. * parser.l: Check for Flex 2.5.9 and earlier which don't have yylex_destroy. Thanks to Marcus Breiing.
* * configure: Changes for building on Solaris 10 using theKaz Kylheku2014-06-042-7/+18
| | | | | | | | | /usr/bin/xpg4/sh shell. Solaris' /bin/sh does not like test -e. Adding break to the new shell existence testing loop so we use the first shell in the list. Solaris wants _XOPEN_SOURCE=500 to reveal certain functions. Fix breakage in the make utility detection, and also use the $make variable everywhere instead of make.
* * configure: Defend against legacy, non-POSIX /bin/sh implementations.Kaz Kylheku2014-06-042-0/+29
| | | | | | | We boostrap using #!/bin/sh, but try to detect a better shell and re-execute the script with that shell. Furthermore, we now set up the SHELL variable in config.make, so that make uses that shell for executing build recipes.
* * eval.c (eval_lisp1): Function removed.Kaz Kylheku2014-06-032-10/+12
| | | | | | (op_dwim, dwim_locs): Removing silly logic of separately calling eval_lisp1 on the functor, and eval_lisp1_args on its arguments, since lisp1 evaluation treats all position the same way.
* Documenting the return value of rplaca and rplacd, and changingKaz Kylheku2014-06-034-10/+33
| | | | | | | | | | | | it to be the cell, rather than the new value. * eval.c (transform_op): Fix use of rplacd that uses return value. (force): Likewise. * lib.c (rplaca, rplacd): Return cons. (rem_lazy_rec, obj_init): Fix use of rplacd that uses return value. * txr.1: Documented.
* The call operator should be a function!Kaz Kylheku2014-05-203-26/+20
| | | | | | | | * eval.c (call): New static function. (eval_args, op_call): Static functions removed. (eval_init): call_s registered as operator rather than function. * txr.1: Updated.
* Version 89txr-89Kaz Kylheku2014-05-106-5/+43
|
* String type related bugfixes: neglecting to handle all three kinds inKaz Kylheku2014-05-104-0/+26
| | | | | | | | | | | | | | | some places. In particular, the test case echo : | ./txr -c '@a:@a' - breaks because of neglected LIT in do_match_line. * arith.c (tofloat, toint): Handle LIT type in switch. * lib.c (ref, refset, replace, update): Handle LSTR type. * match.c (do_match_line, do_output_line): Handle LSTR and LIT objects in switch.
* * stream.c (get_line, get_char, get_byte): Fix outdated, incorrectKaz Kylheku2014-04-142-6/+8
| | | | optional argument defaulting logic.
* * eval.c, gc.c, rand.c, regex.c, signal.c: Remove inclusion of unneededKaz Kylheku2014-04-136-6/+5
| | | | headers.
* * eval.c (make_var_shadowing_env): Remove unnecessary test forKaz Kylheku2014-04-112-8/+9
| | | | colon symbol.
* * eval.c (rangev_func, range_star_v_func): Use numericKaz Kylheku2014-04-082-3/+8
| | | | equivalence comparison for end test, rather than eql.
* * lib.c (eql): Bugfix: not handling floating-point types!Kaz Kylheku2014-04-072-5/+19
| | | | | Two objects which are equal floating-point values must be considered eql even if they are distinct objects (not eq).
* Update year in --help message.Kaz Kylheku2014-04-071-1/+1
|
* Version 88txr-88Kaz Kylheku2014-04-046-25/+79
|
* * gc.c (CHECKOBJ_VEC_SIZE, FRESHOBJ_VEC_SIZE): IncreaseKaz Kylheku2014-03-292-2/+8
| | | | | to 8 * HEAP_SIZE from 2 * HEAP_SIZE to reduce frequency of garbage collections.
* * HACKING: Updating generational GC notes in light of changes.Kaz Kylheku2014-03-292-34/+47
|
* Change to how locations are passed around, for the sake of generationalKaz Kylheku2014-03-2919-348/+476
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GC. The issue being solved here is the accuracy of the gc_set function. The existing impelmentation is too conservative. It has no generation information about the memory location being stored, and so it assumes the worst: that it is a location in the middle of a gen 1 object. This is sub-optimal, creating unacceptable pressure against the checkobj array and, worse, as a consequence causing unreachable gen 0 objects to be tenured into gen 1. To solve this problem, we replace "val *" pointers with a structure of type "loc" which keeps track of the object too, which lets us discover the generation. I tried another approach: using just a pointer with a bitfield indicating the generation. This turned out to have a serious issue: such a bitfield goes stale when the object is moved to a different generation. The object holding the memory location is in gen 1, but the annotated pointer still indicates gen 0. The gc_set function then makes the wrong decision, and premature reclamation takes place. * combi.c (perm_init_common, comb_gen_fun_common, rcomb_gen_fun_common, rcomb_list_gen_fun): Update to new interfaces for managing mutation. * debug.c (debug): Update to new interfaces for managing mutation. Avoid loc variable name. * eval.c (env_fbind, env_fbind): Update to new interfaces for managing mutation. (lookup_var_l, dwim_loc): Return loc type and update to new interfaces. (apply_frob_args, op_modplace, op_dohash, transform_op, mapcarv, mappendv, repeat_infinite_func, repeat_times_func): Update to new interfaces for managing mutation. * eval.h (lookup_var_l): Declaration updated. * filter.c (trie_add, trie_compress, trie_compress_intrinsic, * build_filter, built_filter_from_list, filter_init): Update to new * interfaces. * gc.c (gc_set): Rewritten to use loc type which provides the exact generation. We do not need the in_malloc_range hack any more, since we have the backpointer to the object. (gc_push): Take loc rather than raw pointer. * gc.h (gc_set, gc_push): Declarations updated. * hash.c (struct hash): The acons* functions use loc instead of val * now. (hash_equal_op, copy_hash, gethash_c, inhash, gethash_n, pushhash, Change to how locations are passed around, for the sake of generational GC. The issue being solved here is the accuracy of the gc_set function. The existing impelmentation is too conservative. It has no generation information about the memory location being stored, and so it assumes the worst: that it is a location in the middle of a gen 1 object. This is sub-optimal, creating unacceptable pressure against the checkobj array and, worse, as a consequence causing unreachable gen 0 objects to be tenured into gen 1. To solve this problem, we replace "val *" pointers with a structure of type "loc" which keeps track of the object too, which lets us discover the generation. I tried another approach: using just a pointer with a bitfield indicating the generation. This turned out to have a serious issue: such a bitfield goes stale when the object is moved to a different generation. The object holding the memory location is in gen 1, but the annotated pointer still indicates gen 0. The gc_set function then makes the wrong decision, and premature reclamation takes place. * combi.c (perm_init_common, comb_gen_fun_common, rcomb_gen_fun_common, rcomb_list_gen_fun): Update to new interfaces for managing mutation. * debug.c (debug): Update to new interfaces for managing mutation. Avoid loc variable name. * eval.c (env_fbind, env_fbind): Update to new interfaces for managing mutation. (lookup_var_l, dwim_loc): Return loc type and update to new interfaces. (apply_frob_args, op_modplace, op_dohash, transform_op, mapcarv, mappendv, repeat_infinite_func, repeat_times_func): Update to new interfaces for managing mutation. * eval.h (lookup_var_l): Declaration updated. * filter.c (trie_add, trie_compress, trie_compress_intrinsic, * build_filter, built_filter_from_list, filter_init): Update to new * interfaces. * gc.c (gc_set): Rewritten to use loc type which provides the exact generation. We do not need the in_malloc_range hack any more, since we have the backpointer to the object. (gc_push): Take loc rather than raw pointer. * gc.h (gc_set, gc_push): Declarations updated. * hash.c (struct hash): The acons* functions use loc instead of val * now. (hash_equal_op, copy_hash, gethash_c, inhash, gethash_n, pushhash,
* Generational GC tweaks.Kaz Kylheku2014-03-292-19/+45
| | | | | | | | | | | | | | | | | | * gc.c (make_obj): If we have room in the freshobj array, but are out of objects, then call more. Without this, we don't take proper advantage of this nursing area. (gc): Set the full_gc flag after doing gc, in preparation for next time. If we know full GC is coming, we can adjust some behaviors. Increase the threshold for calling the more() function to be the same as in the non-generational case: less than 3/4 of the size of a heap scavenged. (gc_set): Now does nothing if it is known that a full gc is coming. Also, in the checkobj array overflow case when we invoke gc, there is no point in adding obj to the array, since it must have been promoted to the mature generation. (gc_mutated): Don't bother storing the object in the array if a full GC is coming.
* * lib.c (string_time): If possible, change the timezone in theKaz Kylheku2014-03-292-0/+11
| | | | | struct tm from "GMT" to "UTC", so that the time_string_utc function will use UTC for the %Z format.
* Fix a bug arising from putting generation 1 objects into theKaz Kylheku2014-03-273-24/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | checkobj array (via the mut macro that expands to gc_mutated). The garbage collector assumes that checkobj has only generation 0 objects, which all exist in the freshobj array, which is subject to a sweep. So gen 1 objects in checkobj are never cleaned up properly: they do not have their REACHABLE flag reset, or their generation restored to 1. To fix this, a new array for these objects is introduced separate from checkobj. * gc.c (MUTOBJ_VEC_SIZE): New preprocessor symbol. (mutobj, mutobj_idx): New static array and integer. (mark_obj): Check for REACHABLE flag before checking the full_gc flag and generation, since those cost additional memory accesses. (mark): Mark the objects in the new mutobj array. (sweep): Sweep the objects in the mutobj array. (gc): Reset mutobx_idx to zero after gc. (gc_set): Rearrange logic. In the case that the checkobj array is full and a gc is done to make room, there is no point in adding to the array: the gc pass moves all babies to generation 1, so the object that was passed into the function is no longer a baby. (gc_mutated): Rewrite in terms of mutobj rather than checkobj, fixing the bug. * HACKING: Improved documentation of GC. Describe mut macro and mutobj array.
* More generational GC fixes. One GC fix.Kaz Kylheku2014-03-275-20/+38
| | | | | | | | | | | | | | | * combi.c (perm_init_common, comb_gen_fun_common, rcomb_gen_fun_common): Use set macro instead of plain assignment. * hash.c (hash_grow, copy_hash, hash_update_1): Use set macro instead of plain assignment. * lib.c (nreverse, lazy_appendv_func, lazy_appendv, vec_push, refset): Use set macro instead of plain assignment. (make_package): Assign all fields of the newly created PKG object before calling a function which can trigger GC. * parser.y (rlset): Use set macro.
* Fix generational GC regression caused by fixesKaz Kylheku2014-03-272-12/+23
| | | | | | | | | | in in 2014-03-12, when prof was introduced. The attempt to fix a bug made things worse. * lib.c (adjust_bounds): New static function. (chk_malloc, chk_calloc, chk_realloc): Replace existing logic with call to adjust_bounds. (chk_malloc_gc_more): Bugfix: add missing call to adjust_bounds.
* * genvim.txr, txr.vim: Remove commented-out directives.Kaz Kylheku2014-03-262-4/+0
|
* * genvim.txr: Update for WLL's and QLL's.Kaz Kylheku2014-03-263-70/+62
| | | | * txr.vim: Regenerate.
* * eval.c (me_quasilist): New static function.Kaz Kylheku2014-03-258-52/+179
| | | | | | | | | | | | | | | | | | | | | | | | | | (eval_init): Register me_quasilist as quasilist macro expander. * lib.c (quasilist_s): New global variable. (obj_init): quasilist_s initialized. * lib.h (quasilist_s): Declared. * match.c (do_txreval): Handle quasilist syntax. * parser.l (QWLIT): New exclusive state. Extend lexical grammar to transition to QWLIT state upon the #` or #*` sequence which kicks off a word literal, and in that state, piecewise lexically analyze the QLL, mostly by borrowing rules from quasiliterals. * parser.y (QWORDS, QWSPLICE): New tokens. (n_exprs): Integrate splicing form of QLL syntax. (n_expr): Integrate non-splicing form of QLL syntax. (litchars): Propagate line number info. (quasilit): Fix "string literal" wording in error message. * txr.1: Introduced WLL abbreviation for word list literals, cleaned up the text a little, and documented QLL's.
* * eval.c (expand_quasi): Bugfix: incorrect logic, failingKaz Kylheku2014-03-252-8/+17
| | | | | to macro-expand the embedded forms in a quasiliteral except when they are the very first item.
* * parser.y (yybadtoken): Add missing cases for new tokenKaz Kylheku2014-03-252-0/+7
| | | | types WORDS and WSPLICE.
* Introducing word list literals.Kaz Kylheku2014-03-254-11/+102
| | | | | | | | | | | | | | | | * parser.l (WLIT): New exclusive start state. Extend lexical grammar to transition to WLIT state upon the #" or #*" sequence which kicks off a word literal, and in that state, piecewise lexically analyze the literal, mostly by borrowing rules from other literals. * parser.y (WORDS, WSPLICE): New tokens. (n_exprs): Integrate splicing form of word list literal syntax. (n_expr): Integrate non-splicit for of word list literal syntax. (litchars): Propagate line number info. (wordslit): New grammar rule. * txr.1: Updated.
* * txr.vim: regenerated.Kaz Kylheku2014-03-231-106/+107
|
* * eval.c (eval_init): Register last function as intrinsic.Kaz Kylheku2014-03-235-0/+34
| | | | | | | | * lib.c (last): New function. * lib.h (last): Declared. * txr.1: Documented last.
* * eval.c (eval_init): Register empty as intrinsic.Kaz Kylheku2014-03-235-3/+67
| | | | | | | | | | | | * lib.c (copy): Bugfix: handle lazy strings. Also, handle hash tables via copy_hash. (length): Bugifx: handle lazy strings. Also, handle hash tables via hash_count. (empty): New function. * lib.h (empty): Declared. * txr.1: Documented.
* * eval.c (not_s): New symbol var.Kaz Kylheku2014-03-233-5/+72
| | | | | | | (me_unless, me_while, m_until): New static functions. (eval_init): Register macros unless, while and until. * txr.1: Document unless, while and until.