summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* 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.
* Ported to Cygwin.Kaz Kylheku2011-10-097-260/+414
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TODO: there should be some type safety with the new wli macro so that if it is forgotten, there will be a diagnostic. * configure (lit_align): New configuration variable and configuration test. Generates LIT_ALIGN in config.h. Fixed the integer-holds-pointer test for the different output from the nm program on Cygwin. The arrays become common symbols marked C which do not show an offset attribute, only size: one less column. * filter.c (to_html_table, from_html_table): wrap wide string literals with the wli macro. This must be done from now on for all literals and initializes of arrays that are going to be directly converted to type tagged val-s. * lib.h (wli): New macro. (auto_str, static_str, litptr, lit_noex): Handle wide literals on platforms where they are aligned to only two bytes, such that we don't have two bits in the pointer. We can still add our 11 bit type tag, but then when recovering the pointer to the data, we have may have to fix up the pointer. * parser.l: Another portability issue here. Flex generates a scanner which has #include <unistd.h> in the middle, after the source file's own #includes which can introduce macros. On Cygwin, there is some hygiene problem whereby our "noreturn" macro causes the <unistd.h> header to generate bad syntax and fail to compile. Stupid Cygwin and even stupider flex! The workaround is to include <unistd.h> at the top in the flex source. * stream.c (string_out_put_char): This is one more place where the string literal handling hack spreads. * txr.c (version): Wrap string in wli.
* * dep.mk: Regenerated. Too easy to neglect this file.Kaz Kylheku2011-10-092-8/+13
|
* * match.c (vars_to_bindings): Regression fix: recent commitKaz Kylheku2011-10-092-1/+7
| | | | | caused test failure. An empty list not treated as a valid collect variable list.
* * configure: Fixed indentation.Kaz Kylheku2011-10-092-20/+24
|
* * txr.1: Removed references to obsolete @(next) variant.Kaz Kylheku2011-10-082-15/+6
|
* * match.c (vars_to_bindings): New function.Kaz Kylheku2011-10-083-23/+124
| | | | | | (match_line): keyword argument :vars implemented for coll. * txr.1: Documented :vars.
* * match.c (vars_k): New symbol variable.Kaz Kylheku2011-10-082-3/+48
| | | | | (match_files): Implemented :vars in collect. (match_init): New symbol variable initialized.
* * txr.1: Augment example of @/.*/ being used to skip to theKaz Kylheku2011-10-082-0/+11
| | | | | end of the line with @(skip) which is now better style, since it avoids reaching for regexes.
* * match.c (match_line): Skip directive bugfix. If skip is theKaz Kylheku2011-10-082-2/+10
| | | | | last item on the line, it must match the whole line by returning success.
* * match.c (mintimes_k, maxtimes_k): New keyword variables.Kaz Kylheku2011-10-083-20/+67
| | | | | | | | | (match_line): Implemented :mintimes and :maxtimes, changing the semantics of :times. (match_files): Likewise. (match_init): New keyword variables initialized. * txr.1: Updated.
* * HACKING: Formatting.Kaz Kylheku2011-10-081-0/+4
|
* * HACKING: Formatting.Kaz Kylheku2011-10-081-8/+10
|
* * match.c (match_files): Fixed spectacular bug in function calling,Kaz Kylheku2011-10-072-1/+10
| | | | | | | | dating back to before October 2009 when txr was put into git. Basically, unbound variables were not handled right after the function return, due to the increment step being wrongly written as ``piter = cdr(aiter)'' in the for loop that processes the ub_p_a_pairs. Evil cut and paste!
* * match.c (greedy_k): New keyword symbol variable.Kaz Kylheku2011-10-073-14/+78
| | | | | | | | (match_line): Greedy skip implemented. (match_files): Likewise. (match_init): New keyword symbol variable initialized. * txr.1: Updated.
* * lib.c (eol_s): New symbol variable.Kaz Kylheku2011-10-075-12/+108
| | | | | | | | | | | | | | | | | | | | | | | | (obj_init): New variable initialized. * lib.h (eol_s): Declared. * match.c (match_line): Implemented horizontal skip as and new eol directive. (match_lines): Vertical skip defers to horizontal skip if there is trailing material. * txr.1: Updated. * lib.c (eol_s): New symbol variable. (obj_init): New variable initialized. * lib.h (eol_s): Declared. * match.c (match_line): Implemented horizontal skip as and new eol directive. (match_lines): Vertical skip defers to horizontal skip if there is trailing material. * txr.1: Updated.
* * lib.c (flatten_helper): Function removed.Kaz Kylheku2011-10-072-6/+6
| | | | (flatten): Recurse directly, using func_n1.
* * txr.1: fxed wrong word.Kaz Kylheku2011-10-072-1/+5
|
* Extending syntax to allow for @VAR and @(...) forms insideKaz Kylheku2011-10-066-16/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | nested lists. This is in anticipation of future features. * lib.c (expr_s): New symbol variable. (obj_init): expr_s initialized. * lib.h (expr_s): Declared. * match.c (dest_bind): Now takes linenum. Tests for the meta-syntax denoted by the system symbols var_s and expr_s, and throws an error. (eval_form): Similar error checks added. Also, hack: do not add file and line number to an exception which begins with a '(' character; just re-throw it. This suppresses duplicate line number addition when this throw occurs across some nestings. (match_files): Updated calls to dest_bind. * parser.l (yybadtoken): Handle new token kind, METAVAR and METAPAR. (grammar): Refactoring among patterns: TOK broken into SYM and NUM, NTOK introduced, unused NUM_END removed. Rule for @( producing METAPAR in nested state. * parser.y (METAVAR, METAPAR): New tokens. (meta_expr): New nonterminal. (expr): meta_expr and META_VAR productions handled.
* Renaming the currying combinators according to new scheme.Kaz Kylheku2011-10-064-10/+25
| | | | | | | | | | * lib.c (bind2): Function renamed to curry_12_2. (bind2other): Function renamed to curry_12_1. (do_bind_2, do_bind2other): Helpers renamed likewise. (tree_find): Follows rename of bind2. * match.c (match_files): deffilter code follows bind2 rename to curry_12_2.