| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
during a traversal, which could cause items to be visited
twice or skipped.
* gc.c (full_gc): Changed from static to exter (full_gc): Changed to
internal linkage.
* gc.h (full_gc): Declared.
* hash.c (struct hash): New member, usecount.
(struct hash_iter): New member, next.
(reachable_iters): New static variable.
(hash_mark): Reset the usecount of every reachable hash table.
(hash_iter_mark): Add every reachable iterator to reachable_iters
list.
(make_hash, make_similar_hash, copy_hash): Initialize usecount.
(gethash_c): Do not call hash_grow if usecount is nonzero.
(hash_begin): Initialize next field of hash_iter to null.
Increment use count on hash table.
(hash_next): When traversal ends, release use count, and
null out the hash table reference.
(do_weak_tables): New static function.
(do_iters): New static function.
(hash_process_weak): Weak hash processing logic moved
to do_weak_tables. Also calls do_iters.
* txr.1: Describe hash table traversal, and the assurances
and caveats about inserting and deleting items.
|
|
|
|
|
| |
specials, then don't bother saving and restoring dynamic
env around the argument binding and evaluation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (do_not): New static function.
(notf): New function.
* lib.h (notf): Declared.
* txr.1: Documented notf.
* share/txr/stdlib/txr-case.txr (bindable): Eliminated.
(txr-if): Use functional expression, taking advantage of notf.
* txr.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* match.c (include_s): New symbol variable.
(v_load): Function extended to handle include semantics.
(include): External wrapper function for doing inclusion
via v_load.
(syms_init): include_s initialized.
* match.h (include_s): Declared.
(include): Declared.
* parser.y (check_for_include): New static function.
(clauses_rev): Use check_for_include to replace @(include ..)
directive.
* txr.1: Documented include.
* genvim.txr: Added include symbol.
* txr.vim: Regenerated.
|
|
|
|
|
|
|
|
|
| |
with debug_return. This causes a stray debug frame to be left
on the environment stack which turns to garbage, leading to
an invalid longjmp in another debug_return elsewhere
which tries to use that frame. This was diagnosed by valgrind
indicating accesses below the stack frame, and also by glibc
"longjmp causes uninitialized stack frame" abort.
|
|
|
|
|
|
|
|
|
| |
must be checked to be a stream before we plant it in place
of std_error, otherwise we will get a type exception thrown
lower down, which leads to runaway recursion as TXR tries
to print the error messages on std_error.
* dep.mk: Regenerated.
|
|
|
|
|
|
|
|
|
| |
left-recursive rules to avoid filling the yacc stack, and
returns the items in reverse order. The output of each
r_exprs-generating rule consists of a list which gives
the terminating atom, and then the list contents in reverse order.
(n_exprs): Becomes wrapper for r_exprs which deals with
the terminating atom, and reversed items.
|
|
|
|
|
|
|
|
|
|
|
| |
(clauses_rev): New grammar symbol. Uses a left-recursive rule that
does not consume an amount of parser stack proportional to the number
of clauses, and sticks to efficient consing, which means that
the list is built up in reverse.
(clauses): Now just a wrapper rule for clauses_rev which nreverses
its output.
(clauses_opt): Retargetted to use clauses_rev instead of clauses,
and reverse its output.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
of room. This could happen when parsing a really large TXR program,
since gc is disabled during parsing. Currently it asserts, which
is not acceptable.
* gc.c (make_obj): If after gc, the freshobj array has not been
emptied (obviously because gc is disabled), do not assert.
Rather, set the full_gc flag to request a full garbage collection
when gc is re-enabled. Furthermore, only place newly allocated objects
into freshobj if full_gc has not been set. Thus, if we exhaust the
freshobj array while gc is off, the full_gc flag is set, and we
discontinue use of that array. When gc is re-enabled, we will do a full
gc pass. A full gc pass ignores freshobj array, so it doesn't matter
that its use was discontinued.
|
|
|
|
|
|
|
|
|
|
|
| |
the corresponding member based on whether or not data is nil.
(do_match_line, mf_from_ml, match_filter, match_fun, extract):
Do not pass starting line number argument to mf_all.
This fixes a bug when the line number at @(eof) for an empty
file comes out as zero.
(mf_args, v_skip, v_fuzz, v_next, v_gather, v_collect,
open_data_source, match_files): Use zero and one instead of num(0) and
num(1).
|
|
|
|
|
| |
the remaining data is nil but when it is (nil). This
happens for interactive streams.
|
|
|
|
|
|
|
|
|
|
|
| |
@(expr ...) and @var on the left side of a bind. This
is useful, and necessary for @(line @(lisp expr)) to work:
matching computed line numbers and character positions.
* txr.1: Document use of Lisp on left hand side of bind,
that there is a restriction on the left hand side of a set,
and that Lisp can be used in a line or chr directive for
computed matches.
|
|
|
|
|
|
| |
Table of contents regenerated with line numbers.
* HACKING-toc.txr: New file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
to C++ style casts when compiling as C++.
* lib.h (strip_qual, convert, coerce): New casting macros.
(TAG_MASK, tag, type, wli_noex, auto_str, static_str,
litptr, num_fast, chr, lit_noex, nil, nao): Use cast macros.
* arith.c (mul, isqrt_fixnum, bit): Use cast macros.
* configure (INT_PTR_MAX): Define using cast macro.
* debug.c (debug_init): Use cast macro.
* eval.c (do_eval, expand_macro, reg_op, reg_mac, eval_init):
Use cast macros.
* filter.c (filter_init): Use cast macro.
* gc.c (more, mark_obj, in_heap, mark, sweep_one, unmark): Use
cast macros.
* hash.c (hash_double, equal_hash, eql_hash, hash_equal_op,
hash_hash_op, hash_print_op, hash_mark, make_hash, make_similar_hash,
copy_hash, gethash_c, gethash, gethash_f, gethash_n, remhash,
hash_count, get_hash_userdata, set_hash_userdata, hash_iter_destroy,
hash_iter_mark, hash_begin, hash_uni, hash_diff, hash_isec): Use
cast macros.
* lib.c (code2type, chk_malloc, chk_malloc_gc_more, chk_calloc,
chk_realloc, chk_strdup, num, c_num, string, mkstring, mkustring,
upcase_str, downcase_str, string_extend, sub_str, cat_str, trim_str,
c_chr, vector, vec_set_length, copy_vec, sub_vec, cat_vec,
cobj_print_op, obj_init): Likewise.
* match.c (do_match_line, hv_trampoline, match_files, dir_tables_init):
Likewise.
* parser.l (grammar): Likewise.
* parser.y (parse): Likewise.
* rand.c (make_state, make_random_state, random_fixnum, random):
Likewise.
* regex.c (CHAR_SET_L2_LO, CHAR_SET_L2_HI, CHAR_SET_L1_LO,
CHAR_SET_L1_HI, CHAR_SET_L0_LO, CHAR_SET_L0_HI, L0_full, L0_fill_range,
L1_full, L1_fill_range, L1_contains, L1_free, L2_full, L2_fill_range,
L2_contains, L2_free, L3_fill_range, L3_contains, L3_free,
char_set_create, char_set_cobj_destroy, nfa_state_accept,
nfa_state_empty, nfa_state_single, nfa_state_wild, nfa_state_set,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (cobj_print_op): In the format call, cast
the C pointer to val, since the ~p conversion now
takes a val rather than void *.
(cptr_equal_op, obj_print, obj_pprint): Remove cast to
void *, since obj now already has the type that ~p expects.
* lib.h (struct any): Use mem_t * instead of void *.
* parser.h (yyscan_t): Repeat the definition from inside
the Flex-generated lex.yy.c.
(yylex_init, yylex_destroy, yyget_extra, yyset_extra): Re-declare
using yyscan_t typedef in place of void *.
* parser.l (yyget_column, yyerrprepf): Re-declare using yyscan_t.
(grammar): Use yyg in place of yyscanner in calls to yyerrprepf.
* parser.y (yylex, %lex-param): Use yyscan_t instead of void *.
(parse): Use yyscan_t for local variable.
* signal.c (stack): Change type from void * to mem_t *.
* stream.c (vformat): Conversion specifier p extracts val
instead of void *.
(run): Use casts that only remove const, not all the way to void *.
* txr.1: Documented p conversion specifier of format.
* Makefile (OBJS-y): Initialize with := to make sure it is a
simple variable, and not a macro.
(SRCS): New variable, listing source files.
(enforce): New rule for enforcing coding conventions.
Currently checks for void * occurrences.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
zero, return the other operand.
(lcm): New function.
* eval.c (eval_init): Retarget registration of gcd to
variable argument gcdv function. Register lcm.
* lib.c (gcdv, lcmv): New functions.
* lib.h (gcdv, lcm, lcmv): Declared.
* txr.1: Re-document gcd with coverage of lcm.
* txr.vim: Regenerated.
|
|
|
|
| |
in fixnum range not normalized.
|
|
|
|
| |
mismatch.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* match.c (line_s): New variable.
(h_chr, v_line): New static functions.
(syms_init): line_s initialized.
(dir_tables_init): Register v_line and h_chr.
* match.h (line_s): Declared.
* txr.1: Document @(line) and @(chr) directives.
* txr.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
that evaluate to lists. For instance `@(list)` renders to the
string "nil", and `@(list 1 2)` renders as "(1 2)". The desired
behavior is "" and "1 2", respectively.
(do_output_line): In output directives, there is a similar problem.
A @(list) in the middle of an output block turns to nil, and
a @(list 1 2) renders in parentheses as (1 2). Furthermore,
there is the additional problem that no filtering is applied
to the interpolated value. These behaviors are subject to the
compatibility option, since they change the externally visible
behavior of TXR programs.
* txr.1: Document that empty lists in @(output) variable substitutions
turn into nothing. Document value of 100 for -C option, describing
the above issue.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* parser.h (scanner_t): New typedef. Cleverly, we use
yyguts_t as the basis for this, which pays off in
a few places, getting rid of conversions.
(parser_t): scanner member redeclared to scanner_t *.
(yyerror, yyerr, yyerrof, end_of_regex, end_of_char):
Declarations updated.
* parser.l (yyerror, yyerrorf, num_esc): scanner argument becomes
scanner_t * instead of void *.
(yyscanner): Occurrences replaced by yyg: why should we
refer to the type-unsafe void *yyscanner, when we know that
in the middle of the yylex function we have the properly
typed yyguts_t *yyg.
(end_of_regex, end_of_char): Argument changes to scanner_t * and name
strategically changes to yyg, eliminating the local variable and cast.
* parser.y (sym_helper): scanner argument becomes
scanner_t * instead of void *.
(%parse-param}: void *scnr becomes scanner_t *scnr.
(define-transform, yybadtoken): Use scanner_t * instead of void *.
(parse): Since yylex_init takes a void **, we use it to initialize
a local void *, and then assign it to the structure member.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TXR's support for compiling as C++ pays off: C++ compiler finds
serious bugs introduced in August 2 ("Big switch to reentrant lexing
and parsing"). The yyerror function was being misused; some of
the calls reversed the scanner and parser arguments. Since one
of the two parameters is void *, this reversal wasn't caught.
* parser.l (yyerror): Fix first two arguments being
reversed.
(num_esc): Change previously correct call to yyerror to follow reversed
arguments, so that it stays correct.
* parser.y (%parse-param): Change order of these directives
so that the scnr parameter is before the parser parameter.
This causes the yacc-generated calls to yyerror to have
the arguments in the correct order. It also has the
effect of changing the signature of yyparse, reversing its parameters.
(parse): Update call to yyparse to new argument order.
* parser.h (yyparse): Declaration removed.
(yyerror): Declaration updated.
* regex.c (regex_kind_t): New enum typedef.
(struct regex): Use regex_kind_t rather than an enum
inside the struct, which has different scoping rules
under C++.
* txr.c (get_self_path): Fix signed/unsigned warning.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (gt_f, lt_f): Global variables removed.
(greater_f): New variable.
(greater): New function.
(find_max, pos_max): Use greater_f as default for testfun,
rather than gt_f.
(find_min, pos_min): Use less_f as default for testfun,
rather than lt_f.
(obj_init): Remove references to gt_f and lt_f.
GC-protect and initialize greater_f.
* lib.h (greater_f): Declared.
(gt_f, lt_f): Declarations removed.
* txr.1: Documented greater, and use of less and greater
in pos-min, pos-max, find-min and find-max.
* txr.vim: Regenerated.
|
|
|
|
| |
since (sortuniq list) can be done as (sort (uniq list)).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(eval_init): Register less as intrinsic. Retarget merge intrinsic to
merge_wrap for proper argument defaulting which is missing from merge,
and which we don't want to introduce there since internal calls
to merge don't erquire it. Change registration of sort so it has
only one required argument, not two.
* lib.c (less_f): New global variable.
(less_tab): New static array.
(less_tab_init): New static function.
(less): New function.
(sort): Default lessfun argument to the less function.
(obj_init): GC-protect the less_f variable.
Initialize it with a function object made from the less function.
(init): Call less_tab_init.
* lib.h (enum type): New enumeration member MAX_TYPE, an alias
for the largest type.
(less_f, less): Declared.
* txr.1: Documented new less function, and that the lessfun
argument in sort and merge is optional, defaulting to less.
* txr.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
intrinsics.
* lib.c (chr_isblank, chr_isunisp): New functions.
* lib.h (chr_isblank, chr_isunisp): Declared.
* regex.h (spaces): Declaration for existing variable added.
* txr.1: Documented chr-isblank and chr-isunisp.
* genvim.txr: Add missing sysif.c.
* txr.vim: Regenerated.
|
|
|
|
|
|
|
| |
* stream.c (ap_regex): New static variable.
(abs_path_p): Remove local reg variable; replace
uses of reg with ap_regex.
(stream_init): gc-protect ap_regex.
|
|
|
|
|
|
|
|
|
| |
std_input, std_output, std_debug, std_error and std_null. These are
not ordinary variables but macros which expand to locations in the
variable binding environment that are already protected. This call was
actually doing nothing, because the symbol involved in the expression
std_input is not yet initialized and so &std_input yields a null
pointer which causes protect to bail.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
the eval and stream modules.
* Makefile (OBJS): Add sysif.o.
* dep.mk: Regenerated.
* eval.c (errno_wrap, daemon_wrap, exit_wrap, usleep_wrap, getpid_wrap,
getppid_wrap, env_hash): Functions moved to sysif.c and changed
to static functions.
(eval_init): Registrations of functions moved to sysif.c.
* lib.c (init): Call sysif_init.
* stream.c (w_stat, statf, mkdir_wrap, chdir_wrap, getcwd_wrap,
makedev_wrap, minor_wrap, major_wrap, mknod_wrap): Functions
moved to sysif.c and become static functions.
(stream_init): Registration of stat moved to sysif.c.
(open_files, open_files_star): Bugfix: no longer erroneously included
in #ifdef HAVE_UNISTD_H block.
* stream.h (mkdir_wrap, chdir_wrap, getcwd_wrap, makedev_wrap,
minor_wrap, major_wrap, mknod_wrap, symlink_wrap, link_wrap,
readlink_wrap): Declarations removed.
* sysif.c: New file.
* sysif.h: New file.
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
relies on lazy_str_get_trailing_list and the behavior
of that function changed because (split-str "" any-separator)
changed from returning nil to returning the empty string.
The resulting behavior change of lazy_str_get_trailing_list was later
described in the documentation, thereby codifying it.
This patch changes the lazy_str_get_trailing_list behavior,
which is poor, and causes infinite looping. We do not want
an extra empty string prepended, because it looks like
a spurious line.
* lib.c (lazy_str_get_trailing_list): if split_str produces
a the list (""), then just return the unmaterialized list from
the lazy string without prepending that one-element list to it.
* txr.1: Updated documentation for lazy-str-get-trailing-list.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version.
* share/txr/stdlib/ver.txr: Likewise
* Makefile: Improve binary packaging rules.
* regex.c: #include <stdarg.h> added.
|
|
|
|
|
|
|
|
| |
* regex.c (regex_print): New static function.
(regex_obj_ops): Registered regex_print. (print_class_char,
paren_print_rec, print_rec): New static functions.
* dep.mk: Regenerated.
|
|
|
|
|
|
|
|
|
| |
of pretty-printing. Fix object construction bugs.
* regex.c (struct regex): New member, source.
(regex_mark): Ensure source is visited by garbage collector.
(regex_compile): Store regex_sexp in source.
Fix violations of section 3.2 of HACKING document.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
expression objects in the syntax tree. The parser
just puts out a #<regex ...> instead of (#<regex ...> regex-syntax).
* eval.c (do_eval): We no longer need the hack of
treating (#<regex> ...) as a special form which
evaluates to #<regex>.
(expand): We no longer have to skip over regex syntax,
so the case is removed.
* match.c (h_var, do_txeval, do_match_line): regexp cases are no longer
subcases of consp but stand on their own. In do_match_line, we
introduce a COBJ case into the type switch for regexes.
* parser.y: regexes are now compiled in the regex and lisp_regex
grammar rules instead of the dependent rules, and are not wrapped in
extra syntax.
|
|
|
|
|
|
|
|
|
|
|
| |
commit. The incompleteness of that change broke the case of an unbound
variable followed by a bound variable. The value of the
second variable was still being wrapped in the old complicated
representation before being pushed to the front of the spec.
* txr.1: Replace bogus text which says that variables are not
bound to regexes, and so regex matches from variable substitutions
do not arise. This works fine after this change.
|
|
|
|
| |
now have config.make as a prerequisite.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
rather than the list-based notation for derivative-based
regexes, and an encapsulated COBJ for NFA-based regexes.
* lib.c (compiled_regex_s): Variable removed.
(obj_init): Initialization of compiled_regex_s removed.
* lib.h (compiled_regex_s): Declaration removed.
* regex.c (struct regex, regex_t): New type.
(regex_destroy): Object is now a regex_t, not nfa_t.
(regex_mark): New function.
(regex_obj_ops): Register regex_mark operation.
(reg_nullable, reg_derivative): Remove cases that handles
compiled_regex_s.
(regex_compile): Output of dv_compile_regex becomes
a cobj nwo. Output of nfa_compile_regex must be
embedded in regex_t structure.
(regexp): Drop the check for compiles_regex_s.
(regex_nfa): Function removed.
(regex_run, regex_machine_init): Use cobj_handle to retrieve regex_t *
pointer and dispatch appropriate code based on regex->kind.
|
|
|
|
|
| |
* txr.1: Avoid escapes at the end of a line; man2html doesn't
handle this properly.
|
|
|
|
| |
* txr.1: More formatting and wording fixes.
|
|
|
|
| |
a function that returns t, as documented.
|
| |
|
|
|
|
|
|
|
| |
and restructured in some places.
* genman.txr: No longer generate the whole document in
monospaced font. Add hyperlinks.
|
|
|
|
|
| |
lacking the semantics of returning the last value,
or the first true value, respectively.
|
| |
|
|
|
|
|
|
|
|
|
| |
Returns minimum supported emulation.
* lib.h (compat_fixup): Declaration fixed.
* txr.c (compat): Replace hard-coded min version
by return value of compat_fixup.
|
|
|
|
|
|
|
|
|
| |
(requires_arg, do_fixnum_opt, compat, array_dim, gc_delta): New static
functions.
(txr_main): Use do_fixnum_opt for handling options with integer
argument. Add --compat alias for -C.
* txr.1: Documented --compat. Added missing description of --debugger.
|
|
|
|
| |
Better checking for misused long options.
|