summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* * parser.y: Remove mention of nonexistent terminal \\Kaz Kylheku2011-10-252-1/+6
| | | | from %right associativity clause.
* * txr.1: Updated.Kaz Kylheku2011-10-252-2/+11
|
* * filter.c (fun_k): New keyword variable.Kaz Kylheku2011-10-253-5/+15
| | | | | | | (function_filter): Use :fun keyword symbol instead of fun. (filter_init): New keyword variable initialized. * filter.h (upcase_k, downcase_k, fun_k): Declared.
* * match.c (v_bind): Use sem_error to throw errors with line numberKaz Kylheku2011-10-252-4/+9
| | | | info.
* Bugs #34641, #34629.Kaz Kylheku2011-10-242-4/+22
| | | | | | | * lib.c (search_str_tree): If multiple strings from the needle tree matching within within the haystack string, then take the leftmost match. If there are multiple matches at the same leftmost position, take the longest one.
* * filter.c (function_filter): New function.Kaz Kylheku2011-10-247-91/+244
| | | | | | | | | | | | | | | | | | | | | | (get_filter): Handle (fun ...) syntax. * match.c (v_bind): Establish dynamic environment frame around dest_bind, and stash the bindings there so filters can have access to the bindings. (v_output): Likewise, around do_output calls. (v_fun): New function. (match_files): Function handling broken out into v_fun. (match_funcall): New function. * match.h (match_funcall): Declared. * unwind.c (uw_push_env): Initialize match_context. (uw_get_match_context, uw_set_match_context): New functions. * unwind.h (struct uw_dynamic_env): New member, match_context. (uw_get_match_context, uw_set_match_context): Declared. * txr.1: Documented function filters.
* Turning attention to some plumbing.Kaz Kylheku2011-10-243-18/+41
| | | | | | | | | | | | | * unwind.c (uw_env_stack): New static variable. (uw_unwind_to_exit_point): Maintain correct uw_env_stack during unwinding. (uw_find_env): Just retrieve the env stack pointer; no search. (uw_push_env): Store a pointer to the previous environmental frame and just initialize the bindings to nil. No need to cons up a copy of the bindings from the previous frame. (uw_get_func): Perform a search through the environment stack. * unwind.h (struct uw_dynamic_env): New member, up_env.
* * tests/007/except-1.txr: Use next :list insteadKaz Kylheku2011-10-232-1/+7
| | | | | of piping from echo command. As a result, this test case should run on MingW.
* * match.c (list_k, string_k): New keyword symbol variables.Kaz Kylheku2011-10-233-9/+59
| | | | | | | | (v_next): Implement :list and :string keywords. (syms_init): New keyword variables initialized. NOTE: the :var keyword is deprecated. * txr.1: Documented :list and :string.
* * match.c (h_skip): Bugfix: bad agument list in debugf call.Kaz Kylheku2011-10-232-1/+6
|
* Task #11474Kaz Kylheku2011-10-227-29/+135
| | | | | | | | | | | | | | | | | | | | | | | | * filter.c (filter_equal): Takes two filters instead of one. (lfilt_k, rfilt_k): New keyword variables. (filter_init): New keyword variables initialized. * filter.h (filter_equal): Declaration updated. (lfilt_k, rfilt_k): Declared. * lib.c (funcall4): New function. (do_curry_1234_34): New static function. (curry_1234_34): New function. (do_swap_12_21): New static function. (swap_12_21): New function. * lib.h (funcall4, curry_1234_34, swap_12_21): Declared. * match.c (dest_bind): Swap use the function argument swapping combinator when calling tree find such that the value being searched is on the left and pattern material is on the right. (v_bind): Implemented :lfilt and :rfilt. * txr.1: Documented :lfilt and :rfilt.
* * filter.c (get_filter_trie): Function renamed to get_filter. A filterKaz Kylheku2011-10-225-12/+68
| | | | | | | | | | | | | | is not necessarily a trie. (string_filter, compound_filter): New functions. (get_filter): Recognize a compound filters and return a function which implements it. * filter.h (get_filter_trie): Declaration renamed. * match.c (format_field, v_bind, v_output): Follow get_filter_trie rename. Error message text updated. * txr.1: Describe compound filters.
* Task #11474Kaz Kylheku2011-10-227-29/+167
| | | | | | | | | | | | | | | | | | | | | | | | * filter.c (filter_equal): New function. (upcase_k, downcase_k): New keyword variables. (filter_init): New keyword variables initialized, and new upcase and downcase filters registered. * filter.h (filter_equal): Declared. * lib.c (tree_find): Takes new argument, the equality test function. (upcase_str, downcase_str): New functions. (do_curry_123_23): New static function. (curry_123_23): New function. * lib.h (tree_find): Declaration updated. (upcase_str, downcase_str, curry_123_23): Declared. * match.c (dest_bind): Updated to take equality function. Uses it and passes it down to tree_find. (v_bind): Filter feature implemented. (h_var, v_try): Add equal_f to dest_bind argument list. * txr.1: Updated to describe new filters and bind arguments.
* Fix incorrect ChangeLog entry.Kaz Kylheku2011-10-211-3/+2
|
* * match.c (v_collect): Regression bugfix. Make it work like the commentKaz Kylheku2011-10-213-4/+55
| | | | | | | says: until/last clause has visibility to uncollated bindings from collect. * txr.1: Document behavior.
* * match.c (v_collect): Regression bugfix. Make it work like the commentKaz Kylheku2011-10-212-1/+7
| | | | | says: until/last clause has visibility to uncollated bindings from collect.
* Implementing @(set) directive for assigning to variablesKaz Kylheku2011-10-213-0/+95
| | | | | | | | | destructively. * match.c (dest_set, v_set): New static functions. (dir_tables_init): Add v_set to vertical directives hash table. * txr.1: Documented.
* * match.c (v_output): When appending output to a variable,Kaz Kylheku2011-10-213-4/+28
| | | | | | | flatten the previous contents so we can append to a single string, or to deeply nested list, etc. * txr.1: Documented these new extensions to next and output.
* New features. Strling list output streams in streamKaz Kylheku2011-10-216-19/+241
| | | | | | | | | | | | | | | | | | | | | | | | | | | library, allow output to be captured as a list of strings representing lines (in contrast to string streams which capture a single string). The output directive can output to a variable, and next can scan over a variable. * lib.c (span_str, compl_span_str, break_str): New functions. * lib.h (span_str, compl_span_str, break_str): New functions declared. * match.c (into_k, var_k): New keyword variables. (mf_file_data): New static function. (v_next): Refactored argument handling. Added support for :var keyword. (v_output): Added support for :into keyword. * stream.c (strlist_mark, strlist_out_put_string, strlist_out_put_char): New static functions. (strlist_out_ops): New static struct. (make_strlist_output_stream, get_list_from_stream): New functions. * stream.h (make_strlist_output_stream, get_list_from_stream): New functions declared.
* Whitespace.Kaz Kylheku2011-10-211-1/+1
|
* Whitespace.Kaz Kylheku2011-10-211-3/+3
|
* * lib.c (proper_plist_to_alist, improper_plist_to_alist): NewKaz Kylheku2011-10-215-19/+84
| | | | | | | | | | | | | | functions. * lib.h (proper_plist_to_alist, improper_plist_to_alist): New functions declared. * match.c (append_k): New keyword symbol variable. (complex_open): New append argument. (v_output): Streamlined parsing of keywords. Support :append keyword. * txr.1: Output directive's keyword documentation revised.
* Bug #34609Kaz Kylheku2011-10-202-1/+9
| | | | | | * match.c (v_block): Regression induced by rabid refactoring. Block must apply remaining directives to data, excluding itself, otherwise runaway recursion takes the place of correct behavior.
* Spelling.Kaz Kylheku2011-10-201-1/+1
|
* Version 040txr-040Kaz Kylheku2011-10-204-4/+30
|
* Task #11425Kaz Kylheku2011-10-192-430/+509
| | | | | | | | | | * match.c (repeat_spec_k): New symbol variable (h_match_func): New typedef. (elem_bind): New macro. (h_var, h_skip, h_coll, h_parallel, h_trailer, h_eol): New functions. (match_line): Remaining directives moved to functions. (syms_init): New symbol variable initialized. (dir_tables_init): New functions entered into hash table.
* Task #11425Kaz Kylheku2011-10-192-126/+166
| | | | | | | | | | | | | | | Refactoring match_files to make it easier to break up into subfunctions, similarly to what was done with match_files. * match.c (match_line_ctx): New struct type. (ml_all, ml_specline, ml_bindings_specline): New functions. (LOG_MISMATCH, LOG_MATCH): Macros moved outside of function, updated to refer to structure members rather than local variables. (match_line): Takes only one argument now. All recursive calls updated. (v_freeform): Call to match_line updated. (match_files): Likewise.
* Task #11425Kaz Kylheku2011-10-192-679/+755
| | | | | | | | | * match.c (v_accept_fail, v_next, v_parallel, v_collect, v_flatten, v_forget_local, v_merge, v_bind, v_cat, v_output, v_try, v_define, v_defex, v_throw, v_deffilter, v_eof): New functions. (match_files): Remaining directives moved to functions. (dir_tables_init): New functions entered into hash table.
* * hash.c (ll_hash): Hashing of pointers should take intoKaz Kylheku2011-10-192-1/+16
| | | | | | | | | account alignment, otherwise only values divisible by the alignment occur. This patch takes into considerations that val values are pointers to object descriptors in a heap which are four words wide, and so most likely aligned to 16 byte boundaries (32 bit systems) or 32 byte boundaries (64 bit). We need to shift.
* Task #11425Kaz Kylheku2011-10-182-15/+31
| | | | | * match.c (v_block): New function. (match_files): Block directive moved to function.
* Task #11425Kaz Kylheku2011-10-182-39/+58
| | | | | | | * match.c (spec_bind): New macro. (v_freeform): New function. (match_files): Freeform logic moved to function. (dir_tables_init): v_freeform entered into table.
* Task #11425Kaz Kylheku2011-10-182-25/+45
| | | | | | | | | | | | * match.c (same_data_k): Symbol variable renamed to next_spec_k. (v_skip): Restructured not to return next_spec_k when there are no more specs, but rather thread directly to what match_file will do anyway, namely return the bindings and data position. (v_trailer): New functions. (match_files): Trailer logic moved to function. (syms_init): Follows renaming of variable. (dir_tables_init): GC bugfix: did not protect global hash tables again, like in filter.c previously.
* Task #11425.Kaz Kylheku2011-10-184-78/+166
| | | | | | | | | | | | | | | | | | | | | | | Vertical skip directive moved into function dispatched via hash table. Test suite passes. * lib.c (cptr_s): New symbol variable. (cptr_equal_op): New static function. (cptr_equal_op, cptr, cptr_get): New functions. (cptr_ops): New static structure. (obj_init): New variable initialized. * lib.h (cptr_s, cptr, cptr_get): Declared. * match.c (decline_k, same_data_k): New symbol variables. (v_match_func): New typedef. (v_skip): New function. (match_files): Check symbol in v_directive_table and dispatch the associated function if an entry exists. Skip directive handling moved to v_skip function. (syms_init): Initialize new symbol variables. (dir_tables_init): Enter v_skip into v_directive_table under skip_s symbol.
* Quick and dirty port to MinGW.Kaz Kylheku2011-10-163-1/+37
| | | | | | | | | * configure: Test for presence of <sys/wait.h> added. Conditionally generates HAVE_SYS_WAIT variable in config.h. * stream.c: Include <sys/wait.h> conditionally. (pipe_close): Do not test ermination status with WIFEXITED, etc. if there is no <sys/wait.h> header.
* * configure: reduced post-configure advice to just pointKaz Kylheku2011-10-163-9/+232
| | | | | | to the INSTALL guide. * INSTALL: New file.
* * filter.c (trie_filter_string): Fix warning about uninitializedKaz Kylheku2011-10-162-1/+6
| | | | variable (not a bug, but compiler cannot prove that).
* Task #11425. Refactoring match_files to make it easier toKaz Kylheku2011-10-152-189/+253
| | | | | | | | | | | | | | | | break up into subfunctions. Arguments are packaged into a structure, so that subfunctions won't have to all have big argument lists. * match.c (h_directive_table, v_directive_table): New variables. (match_files_ctx): New structure. (mf_all, mf_args, mf_data, mf_spec, mf_spec_bindings): New functions. (match_files): Takes only one argument now, the context structure. data_lineno variable is a dynamic number. Recursive calls to match_files are handled by creating contexts as appropriate with the helper functions. The old local variable data is now part of the context. (syms_init, dir_tables_init): New functions. (match_init): Just calls syms_init and dir_tables_init.
* Fixed broken GC on x86_64 (Ubuntu 11, gcc 4.5.2).Kaz Kylheku2011-10-152-7/+46
| | | | | | | | | | | | | | | | | | | | | | | | The issues is that due to the aggressive function inlining in the gc module, the mark_mem_region function is not real subroutine. The address of its local variable &gc_stack_top ended up excluding the machine context saved by setjmp in the parent function. I.e. the buffer was not between the computed stack top and bottom. Thus registers were not being scanned for references to values. I added a little abstraction to the machine context in the process of fixing this. * gc.c (struct mach_context, mach_context_t): New type. (save_context): New macro. (mark): Takes two new arguments, pointer to the stack top and machine context. It scans the machine context explicitly rather than relying it to be on the stack, between the top and bottom. This context is in fact only object within the garbage collector part of the activation chain that we need to scan. (gc): Use new abstraction to save machine context. Local variable is used to derive the stack top here. The stack top is the top of the stack above the activation frames in the garbage collector itself. The gc has nothing on its stack that should be scanned, except for the machine context, which is now handled explicitly.
* * configure: POSIX Portability. Use = instead of ==Kaz Kylheku2011-10-152-2/+7
| | | | in test expressions. This was revealed by ubuntu's dash.
* * parser.y (elem): Amending previous change. A single spaceKaz Kylheku2011-10-133-5/+13
| | | | | | | | | should only denote multiple spaces, not mixtures of spaces and tabs. WE have to be careful with tabs because they can be semantically different from spaces (e.g. file with tab delimited fields which can be blank, empty or have leading or trailing spaces.) * txr.1: Updated.
* * Makefile (%.ok: %.txr): Use unified diff for showingKaz Kylheku2011-10-138-9/+800
| | | | | | | | | | | | | | | | | | | | | | | | | | differences between expected and actual test output. * parser.l (yybadtoken): Handle new terminal symbol, SPACE. New rule for producing SPACE token out of an extent of tabs and spaces. * parser.y (SPACE): New terminal symbol. (o_var): New nonterminal. I noticed that the var rule was being used for output elements, and the var rule refers to elem rather than o_elem. A new o_var rule is a simplified duplicate of var. (elem): Handle SPACE token. Transform to regex if it is a single space, otherwise to literal text. (o_elem): Handle SPACE token in output. * tests/001/query-2.txr: This query depends on matching single spaces and so needs to use escapes. * tests/001/query-4.txr, test/001/query-4.expected: New test case, based on query-2.txr. It produces the same output, but is simpler thanks to the new semantics of space. * txr.1: Documented.
* Bug #34538Kaz Kylheku2011-10-122-9/+12
| | | | | | | | | * lib.h (wli): This macro now does the pointer displacement by 1. (auto_str, static_str): #if/#else/#endif gone. These functions just add the type tag. The + 1 logic was incorrect; it should have been + sizeof(wchar_t). But even that was not right because other code expects a wchli_t * to point to the first character, such as the string_out_put_char function.
* Indentation.Kaz Kylheku2011-10-111-1/+1
|
* Improved support for broken unicode.Kaz Kylheku2011-10-103-1/+86
| | | | | | | | | | | | | | | | | | | | | | | | | Regex support for extra-large character sets not compiled in if wchar_t is not wide enough for it. The utf-8 properly throws exceptions when encountering characters that it cannot represent, instead of silently ignoring the situation and continuing with incorrectly computed data. * regex.c (FULL_UNICODE): New macro. (CHAR_SET_L3, CHAR_SET_L2_LO, CHAR_SET_L2_HI): Only defined if full unicde is available. (CHSET_XLARGE, cset_L3_t, struct xlarge_char_set, L2_full, L3_fill_range, L3_contains): Ditto. (unon char_set): Member x1 present only under FULL_UNICODE. (char_set_destroy, char_set_add, char_set_add_range, char_set_contains): CHSET_XLARGE cases only available on FULL_UNICODE. (char_set_compile): Default cst variable to CHSET_LARGE. * utf8.c (FULL_UNICODE): New macro. (conversion_error): New function. (utf8_from_uc): Throw error if not FULL_UNICODE and character is outside the BMP. (utf8_decode): Likewise.
* Fix section numbering mixup.Kaz Kylheku2011-10-101-2/+2
|
* * HACKING: Documented portability hacks for narrow wchar_t.Kaz Kylheku2011-10-102-1/+63
|
* Version 039txr-039Kaz Kylheku2011-10-104-5/+57
|
* One more swing at this with the axe.Kaz Kylheku2011-10-093-12/+16
| | | | | | | * lib.h (wini, wref): New macros. * stream.c (string_out_put_char): Rewritten with macros to eliminate preprocessor #if test.
* * lib.h (wli, lit_noex): We need null characters on both endsKaz Kylheku2011-10-092-2/+10
| | | | | | | so that this hack is correct for null strings. When recovering the wchar_t pointer from a null literal object, we wil increment unconditionally, since it always points to a null character. We end up skipping past null terminator #1, but safely landing on #2.
* Following up to previous commit's TODO.Kaz Kylheku2011-10-096-12/+39
| | | | | | | | | | | | | | | | | | | | | | * filter.c (struct filter_par): wchar_t becomes wchli_t. * lib.h (wchli_t): New type: an incomplete structure type, so that a pointer to this type is incompatible with anything else. (wli): Macro produces const wchli_t * pointer instead of const wchar_t *. (auto_str, static_str): Accept a const wchli_t * instead of const wchar_t *, making it impossible to misuse these functions by passing in a literal. * stream.c (string_out_put_char): These type changes showed this hack to have a bug. Confronted with the need to cast from const wchar_t * to const wchli_t *, it's obvious that the conversion has to be done properly with the + 1 in the one platform case, but not the other. * txr.c (version): Type changed to const wchli_t. * txr.h (version): Declaration updated.