summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Use random padding in PRNG rather than 0xAA.Kaz Kylheku2016-04-281-59/+59
| | | | | | | | | | | | | | | | | | | | | | | | The purpose is to eliminate any biases in the PRNG arising out of the regularity of that pattern, so that the behavior of successive values is good from the beginning. This doesn't solve the problem that a short warm-up period leads to a poor distribution of initial values relative to the seed space. In other words, that similar seeds lead to initially similar sequences. * rand.c (rand_tab): New static array. (make_random_state): Set uninitialized parts of state from the corresponding elements in rand_tab, rather than to the 0xAAAAAAAA values. (rand_compat_fixup): In 139 compatibility mode, clobber rand_tab with 0xAA bytes. * tests/013/maze.expected: Updated. * txr.1: Added some PRNG implementation notes, and also compatibility notes.
* Run IPv6 tests only on some operating systems.Kaz Kylheku2016-03-102-4/+11
| | | | | | | | | | * tests/014/dgram-stream.tl (test): Renamed to dgram-test since now this includes common.tl which has a macro called test. Only include af-inet6 in the family list if the OS is GNU/Linux, Darwin or Cygwin. * tests/common.tl (osname): New function.
* Dgram test: multiple transfers on one stream, IPv6.Kaz Kylheku2016-03-072-0/+39
| | | | | | * tests/014/dgram-stream.tl: New file. * tests/014/dgram-stream.expected: New file.
* Basic regression test case for sockets.Kaz Kylheku2016-03-073-0/+44
| | | | | | | | | | * Makefile: suppress --gc-debug for tst/tests/014 directory. * tests/014/socket-basic.tl: New file. * tests/014/socket-basic.expected: New file. * tests/sock-common.tl: New file.
* random: wrong mask width for power-of-two moduli.Kaz Kylheku2016-01-181-59/+59
| | | | | | | | | | | | | | | | | | | | | | | This mistake causes wasteful behavior for power-of-two moduli in the random function, in both the bignum and fixnum cases. For instance, the modulus 16 is taken to be 17 bits wide. But we really want the width 16: the number of bits needed for values in the range [0, 16). The result isn't wrong, but the loop generates 17-bit random numbers, and then throws away those which equal or exceed the modulus, which is wasteful. * mpi/mpi.c (mp_is_pow_two): New function. * mpi/mpi.h (mp_is_pow_two): Declared. * rand.c (random): In bignum case, after counting bits in the modulus, subtract 1 if the modulus is a power of two. In the fixnum case, subtract 1 from the modulus and then count the bits in the reduced value. * tests/013/maze.expected: regenerate due to different prng behavior.
* Useful feature: object post-initialization.Kaz Kylheku2015-12-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Structs can now have code which executes after an object is initialized, which is useful for doing work like registering objects in global lists and whatever, when those actions need access to the initialized slots of the object. * share/txr/stdlib/struct.tl (defstruct): Handle :posinit syntax, by generating lambda as eighth argument of sys:make-struct call. * struct.c (struct struct_type): New member, postinitfun. (struct_init): Adjust registrations of make_struct_type to account for new parameter. The user visible make-struct-type is registered as having one optional argument, for backward compat. (make_struct_type): New argument, postinitfun. Store this in the structure. For backward compatibility, the argument is defaulted. (struct_type_mark): Mark the new postinitfun member. (call_postinitfun_chain): New static function. (make_struct, lazy_struct_init): Call call_postinitfun_chain after slots are initialized, and after the boa function is called. * struct.h (make_struct_type): Declaration updated. * lib.c (time_init): Pass eighth argument to make_struct type. * sysif.c (sysif_init): Likewise. * unwind.c (uw_late_init): Likewise. * tests/012/struct.tl: Update defstruct expansion test case. * txr.1: Document new argument of make-struct-type, and clarify ordering of initfun with regard to other actions. Likewise, document :postinit, and clarify ordering of :init actions with regard to other actions.
* Add man or boy test, based on Knuth's Algol 60 code.Kaz Kylheku2015-11-232-0/+69
| | | | | | | | | | Seems like a good regression test case, combining structs, macros, lambdas, recursion, environments and syntactic places. * tests/012/man-or-boy.tl: New file. * tests/012/man-or-boy.expected: Likewise.
* Add amb test case for continuations.Kaz Kylheku2015-11-021-0/+20
| | | | | | * tests/012/cont.tl (amb-scope): New macro. (amb): New function. New test case using amb.
* New range type, distinct from cons cell.Kaz Kylheku2015-11-011-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * eval.c (eval_init): Register intrinsic functions rcons, rangep from and to. (eval_init): Register rangep intrinsic. * gc.c (mark_obj): Traverse RNG objects. (finalize): Handle RNG in switch. * hash.c (equal_hash, eql_hash): Hashing for for RNG objects. * lib.c (range_s, rcons_s): New symbol variables. (code2type): Handle RNG type. (eql, equal): Equality for ranges. (less_tab_init): Table extended to cover RNG. (less): Semantics defined for ranges. (rcons, rangep, from, to): New functions. (obj_init): range_s and rcons_s variables initialized. (obj_print_impl): Produce #R notation for ranges. (generic_funcall, dwim_set): Recognize range objects for indexing * lib.h (enum type): New enum member, RNG. MAXTYPE redefined to RNG value. (TYPE_SHIFT): Increased to 5 since there are now 16 type codes. (struct range): New struct type. (union obj): New member rn, of type struct range. (range_s, rcons_s, rcons, rangep, from, to): Declared. (range_bind): New macro. * parser.l (grammar): New rule for recognizing the #R sequence as HASH_R token. * parser.y (HASH_R): New terminal symbol. (range): New nonterminal symbol. (n_expr): Derives the new range symbol. The n_expr DOTDOT n_expr rule produces rcons expression rather than const. * match.c (format_field): Recognize rcons syntax in fields which is now what ranges translate to. Also recognize range object. * tests/013/maze.tl (neigh): Fix code which destructures range as a cons. That can't be done any more. * txr.1: Document ranges.
* Add some tests for continuations.Kaz Kylheku2015-10-282-0/+19
| | | | | | * tests/012/cont.tl: New file. * tests/012/cont.expected: New file.
* New test case for handle and frame introspection.Kaz Kylheku2015-10-172-0/+19
| | | | | | * tests/012/except.tl: New file. * tests/012/except.expected: New file.
* Tweaking expansions of when and until.Kaz Kylheku2015-10-091-4/+4
| | | | | | | * eval.c (me_when): Expand to if if there aren't multiple body forms. (me_unless): Simplify progn. * tests/012/struct.tl: Update string representation in struct test case.
* Optional arguments in boa construction.Kaz Kylheku2015-10-041-2/+2
| | | | | | | | | | | | * share/txr/stdlib/struct.tl (defstruct): Split boa arguments on colon and generate the lambda accordingly. The generated function detects which optional arguments are actually present and only performs the slot updates for those. * tests/012/struct.tl: Corrected boa test case. * txr.1: Documented.
* Optimize empty lambdas in defstruct.Kaz Kylheku2015-09-301-16/+14
| | | | | | | * share/txr/stdlib/struct.tl (defstruct): Don't generate lambdas with empty body; just generate nil, which make-struct-type accepts. * tests/012/struct.tl: Updated defstruct expansion test.
* Implementation of static slots for structures.Kaz Kylheku2015-09-291-12/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * share/txr/stdlib/struct.tl (sys:bad-slot-syntax): New helper function. (defstruct): Macro revamped with new slot specifier syntax for writing static slots as well as methods. * struct.c (STATIC_SLOT_BASE): New preprocessor symbol. (struct struct_type): New members, nstslots, stinitfun, stslot. (make_struct_type_compat): New static function. (struct_init): Register make-struct-type to make_struct_type_compat if compatibility is 117 or lower. Register new intrinsics static-slot, static-slot-set, call-super-method, call-super-fun, slot-p and static-slot-p. (call_stinitfun_chain): New static function. (make_struct_type): Two new arguments for specifying static slots and an initialization function for them. Logic added for setting up static slots and handling inheritance. (struct_type_destroy): New static function. (struct_type_mark): Mark the new stinitfun member of struct type. Also iterate over the static slots in the new stslot array and mark them. (lookup_slot): Altered to return a loc instead of a raw pointer, and also to accept the instance object as a member. Now resolves static slots: it can return a loc which references a static slot in the structure type, or an instance slot in the structure. (lookup_static_slot): New static function. (slot, slotset): Implementation adjusted due to new lookup_slot interface. (static_slot, static_slot_set, slot_p, static_slot_p): New functions. (call_super_method, call_super_fun): New static functions. (struct_inst_print): This function can no longer assume that the slots list lines up with the array of slots, since it contains a mixture of static and instance slots. Earnest slot lookup has to be performed. (struct_type_ops): Point the destroy function to struct_type_destroy instead of cobj_destroy_free_op. A structure type now has an array of static slots to free. * struct.h (make_struct_type): Declaration updated. (static_slot, static_slot_set, slot_p, static_slot_p): Declared. * lib.c (time_init): Update call to make_struct_type with new arguments. * sysif.c (sysif_init): Likewise. * tests/012/struct.tl: Update defstruct macro expansion test. * txr.1: Documented static slots and new functions.
* More tests for ifa/conda.Kaz Kylheku2015-09-271-0/+15
| | | | | | * tests/012/ifa.tl: New test cases which test the expansion when the it-form is a place and there are forms before and after it.
* More informative printed rep for functions.Kaz Kylheku2015-09-091-1/+1
| | | | | | | | | * lib.c (obj_print_impl): Print whether a function is interpreted or intrinsic, and include argument information. * tests/012/struct.tl: Test case relying on function printed rep updated.
* Adding struct tests.Kaz Kylheku2015-09-023-4/+148
| | | | | | | | | | | | * tests/common.tl (vtest): New macro based on test. Evaluates the expected expression. (test): Becomes a wrapper for vtest which quotes the expected expression. (stest): New macro for string-based comparison of output. * tests/012/struct.expected: New file. * tests/012/struct.tl: New file.
* Add maze generation to test suite.Kaz Kylheku2015-08-242-0/+152
| | | | | | | | | * Makefile (tst/tests/013/maze.out): Add TXR_ARGS. Disable gc-debugging for tests in new directory. * tests/013/maze.expected: New file. * tests/013/maze.tl: New file.
* Fix broken @@@<n>/@@@rest references in quasiliterals.Kaz Kylheku2015-08-191-0/+4
| | | | | | | | * parser.y (quasi_meta_helper): When obj is a sys:var, leave it alone; don't add another layer of var. Also, do the same if it is a sys:expr. * tests/012/quasi.tl: Added test case.
* Quasiquote regression from 110.Kaz Kylheku2015-08-191-0/+8
| | | | | | | | | | | | | | | | The problem is that one-argument function calls like @(whatever arg) in a quasiliteral being turned into sys:var items. * parser.y (quasi_meta_helper): Remove bogus check on length. The default case is now var, so the var_s check actually matters. The integerp check for the argument of a var form didn't do anything because the entire if statment conditionally selected a useless goto. Removing it for consistent treatment of var items. * tests/012/quasi.tl: Some new test cases involving @rest. These new tests pass whether or not we have that integerp(second(obj)) test in the quasi_meta_helper function. Either way @rest and @@rest produce the same thing.
* Count East Asian Wide and Full Fidth chars as two columns.Kaz Kylheku2015-08-101-2/+2
| | | | | | | | | | | | | | | | | * regex.c (create_wide_cs): New static function. (wide_display_char_p): New function. * regex.h (wide_display_char_p): Declared. * stream.c (put_string, put_char): Use wide_display_char_p to determine whether an extra column need be counted. Also bugfix: iswprint evidently cannot be relied to work over the entire Unicode range, at least not in the C locale. Glibc's version and is reporting valid Japanese characters as unprintable on Ubuntu. As a hack we instead check for control characters and invert the result: control chars are unprintable. * tests/009/json.expected: Updated.
* * stream.c (indent_mode_put_string): Function removed,Kaz Kylheku2015-08-041-47/+47
| | | | | | | logic hoisted into put_string. (put_string, put_char): Always count column, indent mode or not. * tests/009/json.expected: Updated.
* Multi-line, indented printing of structure.Kaz Kylheku2015-07-313-5/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * eval.c (op_error): New static function. (macro_form_p, fboundp): Static to external. (special_operator_p): New function. (eval_init): Register macrolet and symacrolet to op_error. These are recognized and processed by expand, but we want them in the op table so they are reported by special_operator_p. * eval.h (fboundp, macro_form_p, special_operator_p): Declared. * hash.c (print_key_val): Break long lines on spaces between pairs with stream_width_check. (hash_print_op): Implement split and indented printing. * lib.c (obj_print_impl): New static function, resulting from a merge of obj_print and obj_pprint. Fixes some wrong-way recursion bugs: obj_pprint recursed into obj_print in some places. Adds support for multi-line printing of vectors and lists, with indentation using the new interfaces in streams. * stream.c (strm_base_init): Update initializer. (put_indent, indent_mode_put_string): New static functions. (put_string): Use indent_mode_put_string in either of the two indent modes. (put_char): Implement indent mode. (get_indent_mode, test_set_indent_mode, set_indent_mode, get_indent, set_indent, inc_indent, width_check): New functions. * stream.h (enum indent_mode): New. (struct strm_base): indent_on member becomes indent_mode. New members data_width and code_width. (get_indent_mode, test_set_indent_mode, set_indent_mode, get_indent, set_indent, inc_indent, width_check): Declared. * tests/009/json.expected: Updated. * tests/010/seq.expected: Likewise. * tests/011/macros-2.expected: Likewise.
* Quasiliteral tests.Kaz Kylheku2015-07-252-0/+15
| | | | | | * tests/012/quasi.expected: New file. * tests/012/quasi.tl: New file.
* * tests/012/ifa.tl: New test for it being bound to a place.Kaz Kylheku2015-07-241-0/+5
|
* Split off test macros from ifa.tl into common file.Kaz Kylheku2015-07-232-14/+14
| | | | | | | | | | | * 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.
* * lisplib.c (ifa_set_entries): Add conda.Kaz Kylheku2015-06-211-10/+15
| | | | | | | | * share/txr/stdlib/ifa.tl (conda): New macro. * tests/012/ifa.tl: Adding test for conda. * txr.1: Documenting conda.
* Test ifa macro.Kaz Kylheku2015-06-192-0/+47
| | | | | | | | | * Makefile (TEST_OUT): Include .tl files. (tst/%.out): New rule variant, from .tl prerequisite. * tests/012/ifa.expected: New file. * tests/012/ifa.tl: New file.
* Crack down on redefinitions of built-ins.Kaz Kylheku2015-05-082-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | * eval.c (builtin, eval_initing): New global variable. (op_defun, op_defmacro): During initialization, record functions and macros in builtin hash. (builtin_reject_test): New static function. (expand_macrolet): Perform builtin reject test for fbind, lbind, and macrolet. (regfun, reg_mac): Add symbol to builtin hash. (eval_init): GC-protect new hash table variable and initialize it. Set eval_initing to true over eval initialization. The flip function is renamed fo flipargs. (eval_compat_fixup): New function, for dealing with the operator/function conflict over flip. * eval.h (eval_compat_fixup): Declared. * lib.c (compat_fixup): Call eval_compat_fixup. * tests/011/macros-2.txr: This test was defining a macro called while which is now illegal. Renamed to whilst. * tests/011/macros-2.expected: Regenerated. * txr.1: Function flip renamed to flipargs and documented in Compatibility section.
* New macro-based framework for assignment places.Kaz Kylheku2015-05-064-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The operators set, inc, dec, pop and others are now macros which generate code, rather than built-in special forms that use "C magic". Moreover, new such macros are easy to write, and several new ones are already available. Moreover, new kinds of assignable places are easy to create. * place.tl: New file. * lisplib.c, lisplib.h: New files. * Makefile (OBJS): New target, lisplib.o. (GEN_HDRS): New variable. (LISP_TO_C_STRING): New recipe macro, with rule. (clean): Remove generated headers named in $(GEN_HDRS). * eval.c (dec_s, push_s, pop_s, flip_s, del_s): Variables removed. (setq_s): New variable. (lookup_var, lokup_sym_lisp_1, lookup_var_l, lookup_fun, lookup_mac, lookup_symac, lookup_symac_lisp1): Trigger the delayed loading of libraries for undefined global symbols, and re-try the lookup. (op_modplace, dwim_loc, force_l): Static functions removed. (op_setq): New static function. (eval_init): Initialize setq_s; remove initializations of removed variables; remove registrations for op_modplace; add registration for sys:setq, sys:rplaca, sys:rplacd, sys:dwim-set and sys:dwim-del intrinsics. Call lisplib_init to initialize the dynamic library loading module. * lib.c (sys_rplaca, sys_rplacd): New functions, differing in return value from rplaca and rplacd. (ref, refset): Handle hash table. (dwim_set, dwim_del): New functions. * lib.h (sys_rplaca, sys_rplacd, dwim_set, dwim_del): Declared. * genvim.txr: Include place.tl in scan. * tests/010/seq.txr: The del operator test case no longer throws at run-time but at macro-expansion time, so the test case is simply removed. * tests/010/seq.expected: Updated output. * tests/011/macros-2.txr: Reset *gensym-counter* to zero, because the textual output of the test case includes gensyms, whose numberings fluctuate with the content of the new Lisp library material. * tests/011/macros-2.expected: Updated output.
* * tests/011/macros-1.txr: Add test for lexical functionKaz Kylheku2015-02-072-0/+7
| | | | | | shadowing symbol macro. * tests/011/macros-1.expected: Updated.
* * share/txr/stdlib/txr-case.txr: New file.Kaz Kylheku2014-10-212-0/+13
| | | | | | | | | | | | * txr.1: Document txr-if, txr-when and txr-case. * genvim.txr: Added new macro names. * tests/011/txr-case.expected: New file. * tests/011/txr-case.txr: New file. * txr.vim: Regenerated.
* Add test case for recent breakage.Kaz Kylheku2014-10-083-0/+324
| | | | | | | | | | * tests/006/freeform-3.expected: New file. * tests/006/freeform-3.txr: New file. * tests/006/passwd: New file. * Makefile (TXR_ARGS): Set up for new test case.
* * tests/001/query-1.txr: Remove bogus public domain header.Kaz Kylheku2014-07-155-20/+0
| | | | | | | | | | * tests/001/query-2.txr: Likewise. * tests/001/query-3.txr: Likewise. * tests/001/query-4.txr: Likewise. * tests/002/query-1.txr: Likewise.
* * tests/011/macros-2.txr: Added test for labels shadowing macro,Kaz Kylheku2014-07-102-2/+14
| | | | | | | | and let shadowing symacro. * tests/011/macros-2.expected: Regenerated * txr.vim: Regenerated.
* * parser.l: Allowing ^ to be a quote character, and adjusting definitionKaz Kylheku2014-03-035-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of identifiers to rule this out from being the first character of a symbol which has no prefix. Recognize the ^ character as a token in the NESTED state. * lib.c (obj_print, obj_pprint): Render sys:qquote as ^. * parser.y (choose_quote): Function removed. (n_expr): Recognize '^' as quasiquote. Removed all the "smart quote" hacks that try to make quote behave as quote or quasiquote, or try to cancel out unquotes and quotes. * tests/009/json.txr: Fixed to ^ quasiquote. * tests/010/reghash.txr: Likewise. * tests/011/macros-2.txr: Likewise. * tests/011/mandel.txr: Likewise. * tests/011/special-1.txr: Likewise. * txr.1: Updated docs. * genvim.txr: Revamped definitions for txr_ident and txl_ident so that unqualified identifiers cannot start with # or ^, but ones with @ or : in front can start with these characters. * txr.vim: Regenerated.
* * tests/011/special-1.txr: Add some coverage for evaluationKaz Kylheku2014-03-011-1/+2
| | | | | | of a re-bound special under the Lisp-1 evaluation of the [ ] notation. This test case would have failed three commits back.
* * tests/011/mandel.expected: New file.Kaz Kylheku2014-02-282-0/+123
| | | | * tests/011/mandel.txr: New file.
* Change in the design of how special variables work, to fix the brokenKaz Kylheku2014-02-282-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | re-binding. C code now has to go through the dynamic environment lookup to access things like *random-state*, or *stdout*. As part of this, I'm moving some intrinsic variable and function initializations out of eval.c and into their respective modules. Macros are are used to make global variables look like ordinary C variables. This is very similar to the errno trick in POSIX threads implementations. * eval.c (looup_var, lookup_var_l): Restructured to eliminate silly goto, the cobjp handling is gone. (reg_fun, reg_var): Internal function becomes external. reg_var registers a simple cons cell binding now, without any C pointer tricks to real C global variables. (c_var_mark): Static function removed. (c_var_ops): Static struct removed. (eval_init): Numerous initializations for streams, syslog, rand, signals and others moved to their respective modules. The new symbol variables user_package_s, keyword_package_s and system_package_s are interned here, and the variables are created in a special way. * eval.h (reg_var, reg_fun): Declared. * gc.c (prot1): Added assert that the loc pointer isn't null. This happened, and blew up during garbage collection. * lib.c (system_package, keyword_package, user_package): Variables removed these become macros. (system_package_var, keyword_package_var, user_package_var): New global variables. (system_package_s, keyword_package_s, user_package_s): New symbol globals. (get_user_package, get_system_package, get_keyword_package): New functions. (obj_init): Protect new variables. Initialization order of modules tweaked: the modules sig_init, stream_init, and rand_init are moved after eval_init because they register variables. * lib.h (keyword_package, system_pckage, user_package): Variables turned into macros. (system_package_var, keyword_package_var, user_package_var): Declared. (system_package_s, keyword_package_s, user_package_s): Declared. (get_user_package, get_system_package, get_keyword_package): Declared. * rand.c (struct random_state): Renamed to struct rand_state to avoid clash with new random_state macro. (random_state): Global variable removed. (random_state_s): New symbol global. (make_state, rand32, make_random_state, random_fixnum, random): Follow rename of struct random_state.
* * tests/010/output-clauses.expected: New file.Kaz Kylheku2014-02-282-0/+78
| | | | * tests/010/output-clauses.txr: New file.
* About time for some new regression tests.Kaz Kylheku2014-02-286-0/+74
| | | | | | | | | | | | | | * tests/011/macros-1.expected: New file. * tests/011/macros-1.txr: New file. * tests/011/macros-2.expected: New file. * tests/011/macros-2.txr: New file. * tests/011/special-1.expected: New file. * tests/011/special-1.txr: New file.
* * stream.c (vformat): Compensate for differences in printfKaz Kylheku2012-03-271-1/+1
| | | | | | | implementations with regard to printing floating point exponents. by deleting any plus sign and leading zeros after the 'e'. * tests/009/json.expected: Regenerated.
* * Makefile (TXR_ARGS): Pass new file to tests/009/json.txr test.Kaz Kylheku2012-03-233-17/+117
| | | | | | | | | | * tests/009/json.expected: Updated. * tests/009/json.txr: Updated source. Translates to a more native representation with vectors and hash tables. Numbers go to floating point instead of remaining as strings. * tests/009/pass1.json: New file: a test case from json.org.
* * tests/010/block.expected: New file.Kaz Kylheku2012-03-154-0/+14
| | | | | | | | * tests/010/block.txr: New file. * tests/010/reghash.expected: New file. * tests/010/reghash.txr: New file.
* * stream.c (string_out_byte_flush): Bugfix. Do not loop inside thisKaz Kylheku2012-03-132-0/+12
| | | | | | | | | | | | | | | | | | | | | | function. This must not flush out more than one character out of this small buffer, except when we are flushing out the last data. The correct operation is predicated on the assumption that a complete character can be pulled out. That's why we move the buffer to the front after consuming it, and do not automatically flush until there are four bytes. (string_out_put_string): We loop the call to string_out_byte_flush here because when a request comes in to write a Unicode character, we flush all the bytes, even if the tail of those bytes forms an incomplete sequence that turns into U+DCxx codes. (get_string_from_stream): Use the same loop termination test as in string_out_put_string, for consistency. In that function it is needed to prevent infinite looping in the case when the string_out_put_string is being called from string_out_byte_flush and is thus re-entering it. * tests/010/strstream.expected: New file. * tests/010/strstream.txr: New file.
* Fixing long-time (pre-GIT) bug. The object (nil) was stupidly used toKaz Kylheku2012-02-262-0/+24
| | | | | | | | | | | | | | | | | | | | | represent empty optional output clauses, distinguishing them from missing clauses. This creates an ambiguity, so that an @(output) block which puts out a single empty line is treated as empty. Present but empty clauses are now represented by t. * match.c (do_output_line): Check for t and bail. (do_output): Check for t instead of (nil) and bail. * parser.y (o_elems_opt2): Nonterminal deleted. (out_clauses_opt): Empty case generates nil. (req_parts_opt): o_elems_opt2 replaced by o_elems_opt. (repeat_rep_helper): Function now keeps track of which clauses were specified. For those that were specified, but empty, it substitutes t. * tests/008/empty-clauses.expected: New file. * tests/008/empty-clauses.txr: New file.
* * tests/008/filtenv.expected: New file.Kaz Kylheku2012-02-252-0/+7
| | | | * tests/008/filtenv.txr: New file.
* * tests/010/seq.txr: New file.Kaz Kylheku2012-02-222-0/+33
| | | | * tests/010/seq.expected: New file.
* This test case would have caught the prior regression.Kaz Kylheku2012-02-023-0/+54
| | | | | | | | | | * Makefile (TXR_ARGS): Defined for new test case. * tests/010/align-columns.dat: New file. * tests/010/align-columns.expected: New file. * tests/010/align-columns.txr: New file.