summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* * HACKING: Restore accidentally deleted document title.Kaz Kylheku2015-07-302-0/+9
|
* Deriving streams from the same base, soKaz Kylheku2015-07-294-124/+272
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | we can give streams some common slots. * stream.c (strm_base_init, strm_base_cleanup, strm_base_mark, stream_destroy_op, stream_mark_op): New functions. (null_ops): Switch to stream_destroy_op and stream_mark_op. (make_null_stream): Associate a strm_base instance with the cobj handle rather than a null pointer. (struct stdio_handle): Inherit struct strm_base. (stdio_stream_destroy): Clean up the strm_base part. (stdio_stream_mark): Mark the strm_base part. (make_stdio_stream_common): Initialize the strm_base part. (struct dir_handle): Inherit struct strm_base. (dir_destroy): Clean up the strm_base part. (dir_mark): Mark the strm_base part. (make_dir_stream): Initialize the strm_base part. (struct string_in): New structure. Replaces ad-hoc cons cell used for string input streams. (string_in_stream_mark): Mark new structure. (string_in_get_line, string_in_get_char, string_in_unget_char, string_in_get_prop, string_in_get_error, make_string_input_stream): Convert to new structure. (string_in_ops): Switch to stream_destroy_op. (struct byte_input): Inherit struct strm_base. (byte_in_stream_destroy): No need to check handle for null. No need to set handle to null after freeing: gc does it. Clean up the strm_base part. (byte_in_ops): Switch to stream_mark_op. (make_string_byte_input_stream): Initialize the strm_base part. (struct string_output): Inherit struct strm_base. (string_out_stream_destroy): No need to check handle for null since the logic elsewhere has changed. Clean up the strm_base part. No need to set handle to null. (string_out_ops): Switch to stream_mark_op. (make_string_output_stream): Initialize the strm_base part. (get_string_from_stream): Don't free the handle. Null out the buffer so->buf whose ownership passes to the string. (struct strlist_out): New structure. Replaces ad-hoc cons cell used for string list output stream. (strlist_mark): Renamed to strlist_out_mark. Mark the strm_base part. (strlist_out_put_string, strlist_out_put_char, make_strlist_output_stream, get_list_from_stream): Convert to new structure. (strlist_out_ops): Switch to stream_destroy_op. Follow rename of strlist_mark. (struct cat_strm): New structure, replacing ad-hoc list pointer
* * gc.c (finalize): Null out cobj handle after calling theKaz Kylheku2015-07-292-0/+6
| | | | destructor. This can catch some use-after-free errors.
* * stream.c (common_destroy): Function removed.Kaz Kylheku2015-07-292-7/+7
| | | | (stdio_stream_destroy, dir_destroy): Call close_stream directly.
* * stream.c: Rearranging definitions and declarations so thatKaz Kylheku2015-07-292-432/+438
| | | | | | code for each stream type is together. Moving catenated streams above utility functions, so they are together with other stream definitions.
* Centered fields in format.Kaz Kylheku2015-07-283-31/+96
| | | | | | | | | | | | * stream.c (enum align): New enum. (vformat_align_pre, vformat_align_post): New static functions. (vformat_num, vformat_str): Argument left renamed to align, and changed to enum align. vformat_align_pre and vformat_align_post are called to generate the correct padding for left, center and right alignment. (vformat): Two-valued local variable left turned into three-valued align. The ^ prefix on the width field is recognized. * txr.1: Documented ^ width prefix.
* * share/txr/stdlib/txr-case.tl (txr-case-impl): Bugfix,Kaz Kylheku2015-07-282-0/+6
| | | | handle nil case in recursion.
* * txr.1: In introduction of user-defined places, mentioningKaz Kylheku2015-07-282-2/+38
| | | | | placelet as a way of writing place update macros. Example added under placelet.
* * txr.1: Bad syntax in placelet example; bad font in headings.Kaz Kylheku2015-07-281-11/+9
|
* Version 110.txr-110Kaz Kylheku2015-07-257-331/+482
|
* * genvim.txr: Improved highlighting of items in quasiquote.Kaz Kylheku2015-07-252-5/+11
| | | | | Lists can be spliced and quoted. Metanums and metavars can be prefixed by multiple @'s.
* * genvim.txr: Do not refer to installed code via stdlib.Kaz Kylheku2015-07-252-3/+9
| | | | Refer to source tree.
* * txr.1: Notes about interaction between op and quasiliterals.Kaz Kylheku2015-07-251-1/+65
|
* Quasiliteral tests.Kaz Kylheku2015-07-253-0/+23
| | | | | | * tests/012/quasi.expected: New file. * tests/012/quasi.tl: New file.
* * Makefile (tst/tets/012/%): Disable --gc-debug forKaz Kylheku2015-07-252-0/+6
| | | | tests in this directory.
* * tests/012/ifa.tl: New test for it being bound to a place.Kaz Kylheku2015-07-242-0/+9
|
* Bugfix: place-form-p must expand place macros.Kaz Kylheku2015-07-243-7/+18
| | | | | | | | | * share/txr/stdlib/place.tl (place-form-p): Take environment parameter. Expand the place form using sys:pl-expand. * share/txr/stdlib/ifa.tl (ifa): Pass environment to place-form-p. (nthcdr): Pass environment down to place-form-p.
* * txr.1: Clarifications in ifa description.Kaz Kylheku2015-07-241-5/+5
|
* * eval.c (op_quote): Improved diagnostic.Kaz Kylheku2015-07-242-1/+5
|
* Set up blank top_srcdir if building in source directory.Kaz Kylheku2015-07-233-19/+48
| | | | | | | | | | | | | | | | | | This means short, relative names are used for C source files when compiling in the source directory. * Makefile (CFLAGS): Exclude -iquote $(top_srcdir) arguments if top_srcdir is blank. Remove slash after $(top_srcdir), since the variable includes it now, if its value is not blank. (SRCS, ABBREV, opt/%-win.o, lex.yy.c, y.tab.c, install): Remove slash after $(top_srcdir). (dbg/%.o, opt/%.o): Only include rules for depending on $(top_srcdir)%.c prerequisite if top_srcdir is not blank. In the blank case, the rules are redundant. * configure: if configuring in the root of the source tree, establish top_srcdir as blank, otherwise establish is as an absolute path with a trailing slash.
* Split off test macros from ifa.tl into common file.Kaz Kylheku2015-07-234-18/+30
| | | | | | | | | | | * Makefile (TESTS_OUT): Don't use find to hunt down tests; but rather wildcard. This way common.tl is not mistakenly identified as an independent test file. * tests/012/ifa.tl: Removed test code, placed in new file which is loaded. * tests/common.tl: New file.
* Fixes for building in separate dir.Kaz Kylheku2015-07-232-11/+28
| | | | | | | | | | | | | * Makefile (CFLAGS): Search for mpi header in $(top_srcdir). (ABBREV): Remove top_srcdir prefix from source names. (dbg/%.o, opt/%.o): Extra set of pattern rules for searching for prerequisites in $(top_srcdir) where primary C sources are found and in the local dir where some generated C is found. This way we don't rely on VPATH. (opt/%.res): Bogus target removed. (VPATH): Removed in favor of explicitly referencing $(top_srcdir). Was causing problems for tests. (lex.yy.c, y.tab.c): Prerequisites referenced in $(top_srcdir).
* * parser.l (grammar): Do not allow unescaped newline inKaz Kylheku2015-07-233-7/+48
| | | | | | | | | | | word list literals and word list quasiliterals, except in <= 109 compatibility mode. An escaped newline in these literals, together with surrounding whitespace, now produces a single space, except in <= 109 compatibility mode. * txr.1: Documented new rules for WLL's and QLL's, and added compatibility notes.
* * genvim.txr: Scan cadr.c, cadr.tl, with-resources.tl, txr-case.tl.Kaz Kylheku2015-07-232-7/+12
| | | | | Remove hard-coded txr-case symbols. Recognize operators registered with in-line intern.
* Adding with-resources macro.Kaz Kylheku2015-07-234-0/+114
| | | | | | | | | | * share/txr/stdlib/with-resources.tl: New file. * lisplib.c (with_resource_set_entries, with_resources_instantiate): New static functions. (lisplib_init): Register new functions under dlt_register. * txr.1: Document with-resources.
* Adding nthcdr as accessor.Kaz Kylheku2015-07-226-0/+109
| | | | | | | | | | | | * eval.c (eval_init): Register nthcdr function. * lib.c (nthcdr): New function. * lib.h (nthcdr): Declared. * share/txr/stdlib/place.tl (nthcdr): New defplace. * txr.1: Documented.
* * txr.1: Delete accidentally introduced bogus text.Kaz Kylheku2015-07-221-2/+1
|
* Improve bad argument diagnosis for place macros.Kaz Kylheku2015-07-224-3/+48
| | | | | | | | | | * eval.c (op_mac_param_bind): New static function. (eval_init): Register mac-param-bind operator. * share/txr/stdlib/place.tl (define-place-macro): Use mac-param-bind inside a lambda instead of tb macro. * txr.1: Document mac-param-bind.
* Implementing second through tenth as places.Kaz Kylheku2015-07-226-22/+96
| | | | | | | | | | | | | | | | | | * eval.c (eval_init): Register second through tenth as intrinsic. * gencadr.txr: New cadr.c changes encoded. * lib.c (second, third, fourth, fifth, sixth): Functions reimplemented using ref, so they are much more efficient for vectors and strings. (seventh, eighth, ninth, tenth): New functions. * lib.h (seventh, eighth, ninth, tenth): Declared. * share/txr/stdlib/place.tl: place macros defined for second through tenth. * txr.1: Documented.
* * lisplib.c (place_set_entries): Add *place-macro* andKaz Kylheku2015-07-224-16/+85
| | | | | | | | | | | | | | define-place-macro to list of names. * share/txr/stdlib/place.tl (*place-macro*): New global hash. (sys:tigger-load, sys:pl-expand): New functions. (call-update-expander, call-clobber-expander, call-delete-expander): Recognize and expand place macros. (define-place-macro): New macro. (first, rest): Places redefined using define-place-macro, replacing the old hack of copying the expanders from one table entry to another. * txr.1: Documented place macros.
* * lib.c (obj_print, obj_pprint): Bugfix: incorrectKaz Kylheku2015-07-222-2/+10
| | | | | value returned when printing dwim forms, due to mutating the obj variable.
* * share/txr/stdlib/place.tl: Indentation.Kaz Kylheku2015-07-221-20/+20
|
* Implementing caar, cadr, cdar and friends.Kaz Kylheku2015-07-2110-6/+1903
| | | | | | | | | | | | | | | | | | | | * lib.c (init): Call cadr_init. * lisplib.c (dl_table, set_dlt_entries, dlt_register): Externalize. * lisplib.h (dl_table, set_dlt_entries, dlt_register): Declared. * Makefile (OBJS): Add cadr.o. * cadr.c: New file. * cadr.h: New file. * gencadr.txr: New file. * share/txr/stdlib/cadr.tl: New file. * txr.1: Document cadr accessors.
* * share/txr/stdlib/place.tl (defplace cdr): Change deletionKaz Kylheku2015-07-213-8/+41
| | | | | | semantics so that (del (cdr x)) is symmetric with (del (car x)). * txr.1: Update documentation.
* * eval.c (eval_init): Register new split function.Kaz Kylheku2015-07-215-2/+155
| | | | | | | | | | | | * lib.c (split_func): New static function. (partition_split_common): New static function, based on on contents of partition function. (partition): Now a wrapper around partition_split_common. (split): New function. * lib.h (split): Documented. * txr.1: Documented split.
* * txr.1: Fixes in description of partition.Kaz Kylheku2015-07-211-8/+10
|
* * txr.1: Document place binding behavior of ifa.Kaz Kylheku2015-07-201-5/+13
|
* * parser.c (open_txr_file): Bugfix: the name of the parsedKaz Kylheku2015-07-132-1/+7
| | | | | stream should be the resolved name, not the abstract original, so that error messages correlate to the file.
* * share/txr/stdlib/ifa.tl (ifa): Use placelet toKaz Kylheku2015-07-122-4/+20
| | | | allow "it" to be mutable when it denotes a place form.
* * share/txr/stdlib/place.tl (place-form-p): New function.Kaz Kylheku2015-07-123-0/+12
| | | | * lisplib.c (place_set_entries): Add place-form-p to list of names.
* Expand away sys:lisp1-value based on lexical info.Kaz Kylheku2015-07-112-2/+37
| | | | | | | * eval.c (sys_lisp1_value_s): New global symbol variable. (expand_lisp1_value): New static function. (do_expand): Use expand_lisp1_value. (eval_init): Initialize sys_lisp1_value_s.
* Let's have placelet and placelet*.Kaz Kylheku2015-07-114-8/+46
| | | | | | | | * share/txr/stdlib/place.tl (placelet*): New macro. * lisplib.c (place_set_entries): Add placelet* to list of names. * txr.1: Updated to document placelet* and fix mistakes.
* * share/txr/stdlib/place.tl (defplace dwim): EliminateKaz Kylheku2015-07-112-8/+14
| | | | | | | ogetter-sym variable for caching the sequence; use the getter for the sequence place to access it. Again, this is for placelet, where the caching is visible. Another way to fix this is to clobber the cache variable when updating the sequence place.
* * eval.c (eval_init): Register bindable as intrinsic.Kaz Kylheku2015-07-103-1/+27
| | | | * txr.1: Documented.
* New placelet macro.Kaz Kylheku2015-07-104-11/+134
| | | | | | | | | | | | | | * lisplib.c (place_set_entries): Add placelet to list of names. * share/txr/stdlib/place.tl (sys:placelet1, placelet): New macros. (defplace dwim): Do not retrieve the place's value into a local variable and have the getter expand to that variable. Rather, have the getter retrieve the value. A getter that refers to a cached copy breaks the semantics of placelet, and any place operator which can evaluate the location after it is stored. * txr.1: Documented placelet.
* Handle setting of parse name through prime_parser.Kaz Kylheku2015-07-104-7/+22
| | | | | | | | | | | | * parser.c (prime_parser): Take name as argument, and install it into parser. (lisp_parser): Pass name to parse, instead of setting it in the parser object. * parser.y (parse): Take name as argument and pass down to prime_parser. * parser.h (prime_parser, parse): Declarations updated.
* Fix wrong name reported for errors in first top-level form.Kaz Kylheku2015-07-102-1/+9
| | | | | * parser.c (read_eval_stream): Get name of original stream, and pass that down to lisp_parse as the name argument.
* Fix off by one error line numbers for .tl files.Kaz Kylheku2015-07-102-3/+14
| | | | | * parser.c (read_eval_stream): Add terminating newline to the first line that was examined for hash bang.
* Remove unused "primer" member from parser_t.Kaz Kylheku2015-07-103-9/+18
| | | | | | | | | | | * parser.c (parser_mark, parser_common_init): Remove reference to primer. (parser): Don't take primer argument, remove reference to member. (ensure_parser): Don't take primer argument, don't pass to parser function. (lisp_parse): Don't pass primer string to ensure_parser. * parser.h (primer_t): Remove primer member. (parser): Declaration updated.
* Bugfix: lexer loses unmatched "hold char" between top-level forms.Kaz Kylheku2015-07-105-11/+39
| | | | | | | | | | | | | | | | | | Test case: file containing 4(prinl 3). Scanner consumes 4 and (. The ( is lost when the scanner is reset for the next call to yyparse, resulting in jut prinl being read and interpreted as a variable. * parser.c (prime_parser): If present, append hold byte to priming string. Takes parser_t * instead of parser, and returns void now. * parser.l (reset_scanner): Now returns int value, the value of the scanner's yy_hold_char variable which is nonzero when the scanner is hanging on to an unmatched byte of input. * parser.h (reset_scanner, prime_parser): Declarations updated. * parser.y (parse): Pass hold byte returned by reset_scanner to prime_parser.