| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
(obj_init): New variable initialized.
* lib.h (eof_s): Declared.
* match.c (match_files): New @(eof) directive explicitly
matches end of data.
* txr.1: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
chr function inlined.
* filter.c (trie_value_at, trie_lookup_feed_char): Handle function
case.
(build_filter): New parameter, compress_p.
(html_hex_continue, html_hex_handler): New functions.
(filter_init): Add a function-based node to the from_html trie.
* lib.c (chr): Function removed.
(functionp) New function.
* lib.h (chr): Declaration replaced with inline function.
(functionp): Declared.
* match.c (format_field): Bugfix: failed to apply filter
that came in as an argument.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bugfix in @(throw) when non-symbol is thrown: exception message
referred to the symbol throw rather than the erroneous object.
* filter.c (build_filter_from_list, register_filter): New functions.
* filter.h (register_filter): New function declared.
* lib.c (deffilter_s): New variable defined.
(chain): Function changed from single list argument to variable
argument list to reduce the complexity of use.
(do_and, and): New functions.
(obj_init): deffilter_s initializatio added.
* lib.h (deffilter_s, and): New declarations.
(chain): Declaration updated to new function signature.
(eq): Changed from macro to inline function.
* match.c (do_output_line): Simplified expression involving chain.
(do_output): Likewise.
(match_files): Bugfix in error handling of throw.
Implementation of deffilter.
* txr.1: Documented deffilter.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bugfix in typeof.
* filter.c (trie_compress): New function.
(trie_value_at, trie_lookup_feed_char, filter_string): Handle cons cell
nodes in trie.
(build_filter): Call trie_compress.
* gc.c (cobj_destroy_op): Function renamed to cobj_destroy_stub_op
since it doesn't do anything.
(cobj_destroy_free_op): New function.
* hash.c (struct hash_iter): New type.
(hash_destroy): Function removed.
(hash_ops): Reference to hash_destroy replaced with
cobj_destroy_free_op.
(hash_count, hash_iter_mark, hash_begin, hash_next): New functions.
(hash_iter_ops): New static structure.
* hash.h (hash_count, hash_begin, hash_next): New functions declared.
* lib.c (hash_iter_s): New symbol variable.
(typeof): Bugfix: TAG_LIT type tag not handled.
(vecref): New function.
(obj_init): Initialize hash_iter_s.
* lib.h (cobj_destroy_op): Declaration renamed.
(cobj_destroy_free_op, vecref): New functions declared.
(hash_iter_s): New variable declared.
* stream.c (string_in_ops, byte_in_ops): cobj_destroy_op
renamed to cobj_destroy_stub_op.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* filter.c, filter.h: New files.
* Makefile (OBJS): filter.o added.
* gc.c (mark_obj): Mark new alloc field of string objets.
* hash.c (struct hash): New member, userdata.
(hash_mark): Mark new userdata member of hash.
(make_hash): Initialize userdata.
(get_hash_userdata, set_hash_userdata, hashp): New functions.
* hash.h (get_hash_userdata, set_hash_userdata, hashp): New functions
declared.
* lib.c (getplist, string_extend, cobjp): New functions.
(string_own, string, string_utf8): Initialize new alloc field to nil.
(mkstring, mkustring): Initialize new alloc field to actual size.
(length_str): When length is computed and cached, also compute
and cache alloc.
(init): Call filter_init.
* lib.h (string string): New member, alloc.
(num_fast): Macro converted to inline function.
(getplist, string_extend, cobjp): New functions declared.
* match.c (match_line): Follows change of modifier s-exp syntax.
(format_field): New parameter, filter.
New modifier syntax parsed. Filter retrieved, and applied.
(subst_vars): New parameter, filter. Filter is either applied
in this function or passed to format_field, as needed.
(eval_form): Pass nil to new parameter of subst_vars.
(do_output_line): New parameter, filter. Passed down to subst_vars.
(do_output): New parameter, filter. Passed down to do_output_line.
(match_files): Pass nil filter to subst_vars in cat directive.
Output directive refactored to parse keywords, extract the
filter and pass down to do_output.
* parser.y (regex): Generate (sys:regex regex syntax ...)
instead of (regex syntax ...).
(elem, expr): Updated w.r.t. regex syntax change.
(var): Cases '{' IDENT regex '}' and '{' IDENT NUMBER '}'
are removed. new syntax '{' IDENT exprs '}' to handle these
more generally and allow for keywords.
* txr.1: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Vector code cleanup.
* lib.h (zero, one, two, negone, maxint, minint): Extern declarations
removed, macros introduced for these identifiers.
* lib.c (zero, one, two, negone, maxint, minint): File scope
definitions removed.
(vector): Use vec_alloc and vec_fill enums instead of constants.
(obj_init): Remove references to removed definitions.
|
|
|
|
|
|
| |
lib.h, match.c, match.h, parser.h, parser.l, parser.y, regex.c,
regex.h, stream.c, stream.h, txr.1, txr.c, txr.h, unwind.c, unwind.h,
utf8.c, utf8.h: Updated copyright year.
|
| |
|
|
|
|
|
|
|
|
| |
* lib.c (split_str, split_str_set): It is necessary to protect input
parameters against GC, because we cache their internal pointers,
after which we no longer refer to the objects themselves. Moreover,
we perform object allocation, and then keep using the internal
pointers.
|
|
|
|
| |
Added missing support for literal string type.
|
|
|
|
|
| |
of string must use postincrement on the index, otherwise the access
goes past the null terminator.
|
|
|
|
|
|
|
|
|
| |
* lib.c (split_str_sep): New function.
(split_str): Semantics changed; the second argument
is not a set of separator characters (like in split_str_sep)
but rather a separator string. Fixed bug: if the input
string is empty, the output list is empty. This caused
infinite looping behavior in @(freeform).
|
|
|
|
|
|
| |
that we don't clobber the null terminator in the target string, or try
read past the end of the source data. This affects the @(freeform)
directive.
|
|
|
|
|
|
|
|
| |
Exponential memory consumption behavior was observed when
matching the input aaaaaa....
against the regex a?a?a?a?....aaaa....
The fix is to eliminate common subexpressions
from the derivative for the or operator.
|
| |
|
| |
|
|\
| |
| |
| |
| | |
Conflicts:
ChangeLog
|
| |
| |
| |
| |
| |
| |
| |
| | |
in the middle of statement block.
* lib.h (TAG_MASK): Becomes type cnum rather than long.
(nao): Based off 1 rather than -1 to avoid left shift of
negative number.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This turns out to be easy to do in NFA land.
The complement of an NFA has exactly the same number
and configuration of states and transitions, except
that the states have an inverted meaning; and furthermore,
failed character transitions are routed to an extra
state (which in this impelmentation is permanently
allocated and shared by all regexes). The regex &
is implemented trivially using DeMorgan's.
Also, bugfix: regular expressions like A|B|C are allowed
now by the syntax, rather than constituting syntax error.
Previously, this would have been entered as (A|B)|C.
|
|
|
|
|
|
|
|
| |
* hash.h (sethash): Declared.
* lib.c (cobj_handle): New function.
* lib.h (cobj_handle): Declared.
|
|
|
|
|
|
| |
no null pointer check over struct cobj_ops operations.
New typechecking function for COBJ objects.
|
|
|
|
|
| |
from now on, which is compatible with unsigned char *.
No implicit conversion to or from this type, in C or C++.
|
|
|
|
| |
in regex module not exposed in header. Etc.
|
|
|
|
|
|
|
|
| |
to vector data; they point to element 0 which is actually the third
element of the vector. If an object is only referenced by interior
pointers, Valgrind reports it as possibly leaked. This change
conditionally adds a pointer to the true start of the vector,
if Valgrind support is enabled.
|
| |
|
| |
|
|
|
|
| |
can be taken advantage of for better diagnostics.
|
|
|
|
| |
have a _s suffix.
|
| |
|
|
|
|
| |
caught by gcc 4.1.1.
|
|
|
|
|
|
|
|
| |
can be converted to a type long and vice versa. The configure
script tries to detect the appropriate type to use. Also,
some run-time checking is performed in the streams module
to detect which conversions specifier strings to use for
printing numbers.
|
|
|
|
|
|
|
|
|
|
| |
a system package instead of being hacked with the $ prefix.
Keyword symbols are provided. In the matcher, evaluation
is tightened up. Keywords, nil and t are not bindeable, and
errors are thrown if attempts are made to bind them.
Destructuring in dest_bind is strict in the number of items.
String streams are exploited to print bindings to objects
that are not strings or characters. Numerous bugfixes.
|
|
|
|
|
|
| |
we have an unhandled exception too early in initialization.
Use C stream to print an error message and abort.
Using the nil stream variable will just cause a recursion bomb.
|
|
|
|
| |
should not map nil -> (nil), but nil -> nil.
|
|
|
|
|
| |
we wouldn't have to declare object variables at all, so why
use an obtuse syntax to do so?)
|
|
|
|
|
| |
The recent auto_str("byte str") error could have been caught
at compile time.
|
| |
|
|
|
|
|
|
| |
compiler. Idea: allocator functions return char * instead of void *,
like malloc did in classic pre-ANSI C. That way we are forced to
use a cast except when the target pointer is char * already.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
abstraction instead of directly using C standard I/O,
to eliminate most uses of C formatted I/O,
and fix numerous bugs, such variadic argument lists which
lack a terminating ``nao'' sentinel.
Bug 28033 is addressed by this patch, since streams no longer provide
printf-compatible formatting. The native formatter is extended with
some additional capabilities to take over.
The work on literal objects is expanded and they are now used
throughout the code base.
Fixed bad realloc in string output stream: reallocating by number
of wide chars rather than bytes.
|
|
|
|
|
| |
pointer to a C static string, intended for literals. We can now
treat literal strings as light-weight objects.
|
|
|
|
|
|
| |
(c_chr): Return wchar_t not int.
* lib.h (chr, c_chr): Declarations updated.
|
|
|
|
| |
Bumped version numbers, and cleaned up trailing whitespace from some files.
|
|
|
|
| |
Fix unsigned and plan char * mixing.
|
|
|
|
|
|
|
|
|
|
|
| |
(lazy_str): Fix for gc correctness: object from make_obj must be
completely intialized before any gc-triggering operation is invoked,
otherwise the garbage collector will be traversing an object
whose fields contain old garbage.
(lazy_str_force_upto): Off-by-one error. To force the object
up to index position N, means forcing up to length N+1.
This bug can make it look like a lazy string is much shorter
than it really is.
|
|
|
|
|
| |
use wide character functions so that there is no illicit
mixing. (But the goal is to replace this usage with txr streams).
|
|
|
|
|
|
|
|
|
| |
This is incomplete. There are too many dependencies on
wide character support from the C stream I/O library,
and implicit use of some encoding which may not be UTF-8.
The regex code does not handle wide characters properly.
Character type is still int in some places, rather than wchar_t.
Test suite passes though.
|
|
|
|
|
| |
Now numbers and characters fit into a cell. We lose one more bit
from the range of numbers.
|
|
|
|
|
|
|
|
| |
unboxed. If the lowest bit of the obj_t * pointer is 1, then
the remaining bits are a number. A lot of assumptions are made:
- the long type can be converted to and from a pointer
- two's complement.
- behavior of << and >> operators when the sign bit is involved.
|