| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The nfa_accept state label is re-introduced. This state type
has the same representation as nfa_empty; essentially, this
replaces the flag. This makes the state type smaller, and we
don't have to access the flag to tell if a state is an
acceptance state.
* regex.c (nfa_kind_t): New enum label, nfa_accept.
(struct nfa_state_empty): Member accept removed.
(nfa_accept_state_p): Macro tests only for nfa_accept type.
(nfa_empty_state_p): New macro.
(nfa_state_accept): Set type of new state to nfa_accept;
do not set accept flag.
(nfa_state_empty): Do not set accept flag.
(nfa_state_empty_convert): Do not clear accept flag.
(nfa_map_states): Handle nfa_accept in switch, in the
same case as nfa_empty.
(nfa_thread_epsilons): Don't test for accept state in
nfa_empty case; it would be always false now. Add nfa_accept
case to switch which only arranges for a traversal of the two
transitions. (Though these are expected to be null at the
stage of the graph when this function is applied).
(nfa_fold_accept): Switch type to nfa_accept rather than
setting accept flag.
(nfa_closure, nfa_move_closure): Use new macro for testing
whether a state is empty.
|
|
|
|
|
|
| |
* txr.1: The dual precedence of % leads to surprises;
when parentheses are used around % expressions, they don't
behave symmetrically on both sides.
|
|
|
|
|
|
|
| |
regex.c (regex_compile): Take the source code to be the
original code, rather than the version with AST-level
optimizations and expansions related to the nongreedy
operator.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This was broken by the July 16 commit
"regex: don't print superfluous parens around classes",
2411f779f47c441659720ad0ddcabf91df1d2529.
* regex.c (print_rec): If an (or ...) appears as
a compound element, it must be rendered in parentheses;
or_s must be handled here just like and_s. Prior to the
faulty commit, this was implicitly true because the logic was
inverted and wasn't ruling out or_s.
|
|
|
|
|
|
|
|
|
|
|
|
| |
In this optimization, we identify places in the NFA graph
where empty states transition to accept states.
We eliminate these transitions and turn the empty states
into accept states. Accept states which thereby become
unreachable from the start state are pruned away.
* regex.c (nfa_fold_accept): New static function.
(nfa_optimize): Add a pass which applies nfa_fold_accept
to all states.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Acceptance states are instead represented by adding an accept
flag to nfa_empty states. This will support an optimization
which eliminates accept states that are referenced only by
empty states.
* regex.c (nfa_kind_t): Enum member nfa_accept removed.
(struct nfa_state_accept): Renamed to nfa_state_any.
(struct nfa_state_empty): New member, accept.
(union nfa_state): Member a changes from struct
nfa_state_accept to struct nfa_state_any.
(nfa_accept_state_p): New macro.
(nfa_state_accept): Now makes an nfe_empty type state, with no
transitions out and the accept flag set.
(nfa_state_empty): Initialize accept flag to zero.
(nfa_state_empty_convert): Set the accept flag to zero.
(nfa_state_merge): Use new macro in assertion.
(nfa_map_states): Remove nfa_accept switch case.
(nfa_thread_epsilons): We must not eliminate an empty state which
is an acceptance state, even if it meets the other conditions.
(nfa_closure): Use a local variable to eliminate repetition of
set[i] expression. Test for accept state using new macro.
(nfa_move_closure): Test for accept state using new macro.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is something done for the sake of faster NFA simulation.
I think it's glossed over in regex literature because it
makes no difference in a NFA to DFA transformation.
Fewer states in the graph means less work in the
nfa_move_closure function at regex run time.
In the NFA graph, there can occur empty states which are
useless. These are states which hold only one epsilon
transition. Those states can be replaced by whatever state
their epsilon transition points to. The terminology is
inspired by "jump threading" in code optimization, whereby if
a branch takes place to an instruction which holds an
unconditional branch, the original branch can be retargetted
to go to the ultimate target.
I.e. we turn:
x e
S0 ---> S1 ----> S2
where e denotes an epsilon transition, and x represents
any kind of transition to:
x
S0 ---> S2
We can also eliminate empty states which have no transition;
those can be replaced by a null pointer. I suspect these do
not actually occur.
* regex.c (nfa_thread_epsilons, nfa_noop, nfa_optimize): New
static functions.
(regex_compile): Invoke nfa_optimize on the results of
nfa_compile_regex.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* regex.c (nfa_run): Start with the existing value of the
visited counter and pre-increment it when calling nfa_closure
and nfa_move_closure. Thus it is incremented only as many
times as those functions are called: one fewer than before.
(regex_machine_reset): regm->n.visited is already incremented,
since 1 was added to the prior value; there is no need to
increment it again.
(nfa_handle_wraparound): More prudent approach here.
If we get within 8 increments of wraparound, we
fast forward to UINT_MAX and then 0.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This goes back to November 2, 2009 commit,
"Start of implementation for freestyle matching",
6191fbb2ca7a9ac339dd3994bdea8273ceb0a24d
It is exposed if we perform an epsilon threading
optimization on the NFA graph.
* regex.c (regex_machine_feed): We must pass the new,
incremented value of the visited counter, to nfa_move_closure.
States have already been tagged with the old value before
the call to regex_machine_feed, so we risk failing to
visit some states and include them in the closure.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This new function allows a program to determine whether a
given string is the prefix of any of the strings denoted by a
regular expression; or, in alternative words, whether a given
string is the prefix of a possibly longer string which matches
a regular expression.
* regex.c (regex_machine_infer_init_state): New static
function.
(regex_prefix_match): New function.
(regex_init): regex-prefix-match intrinsic registered.
regex.h (regex_prefix_match): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reject states are no longer explicitly represented in the NFA
graph. Any transition that previously would have led to a
reject state is just a null pointer now: no transition.
This just means we have to check one place for a null pointer.
This change fixes a flaw in nfa_closure: the function was
propagating nfa_reject states to the closure set. When
the input set consisted only of reject states (or rather
exactly one reject state in that special case), it would
add it to the output set and return 1, making it seem as
if the regex is one that can potentially match something.
* regex.c (nfa_kind_t): Enum member nfa_reject removed.
(nfa_state_reject): Static function removed.
(nfa_compile_regex): Compile a t regex (match nothing)
to a NFA graph with no transition at all into any start
state; effectively an empty graph with no state nodes.
(nfa_map_states): Remove nfa_reject case from switch. Also,
stylistic change; state pointers are tested as Booleans
elsewhere rather than by comparison to null pointer.
(nfa_count_states, nfa_handle_wraparound): Handle null state
pointer.
(nfa_move_closure): Test the mov transition for null;
anything can potentially now have a null transition,
not only epsilon nodes.
(nfa_run, regex_machine_reset): Handle nfa.start being null
indicating an empty NFA graph. In that case we don't have to
calculate the closure; we just have an empty set of states and
set nfa.nclos to zero. The visited disambiguation counter is
irrelevant since there are no states to visit.
(regex_machine_feed): Don't try to propagate visited counter
stored in regex machine to empty NFA graph which has no states.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The problem is that a.b .. c.d parses as (qref a b..c d),
which is useless and counterintuitive.
Let's fix it, but with a backward compatibility switch to give
more leeway to any hapless people out there whose code happens
to depend on this unfortunate situation.
We basically use two token numbers for the .. token:
OLD_DOTDOT, and DOTDOT. Both are wired into the grammar. In
backward compatibility mode, the lexer pumps out OLD_DOTDOT.
Otherwise DOTDOT.
* parser.l (grammar): When .. is scanned, return OLD_DOTDOT
when in compatibility with 185 or earlier. Otherwise DOTDOT.
* parser.y (OLD_DOTDOT): New terminal symbol; introduced at
the same high precedence previously occupied by DOTDOT.
(DOTDOT): Changes precedence to lower than '.' and UREFDOT.
(n_expr): Two productions added involving OLD_DOTDOT.
These are copy and paste of the existing productions involving
DOTDOT; the only difference is that OLD_DOTDOT replaces
DOTDOT.
(yybadtoken): Handle OLD_DOTDOT.
* txr.1: Compat notes added.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When a line of input is incomplete and the cursor is at the
end of that line, hitting Enter causes an uncomfortable
ambiguity. Although the cursor moves to the next line, it is
not clear whether that is because the input is being accepted,
or whether the expression which was entered is executing.
For instance, these appear to behave the same way:
> (while t[Enter][Enter]...
> (while t)[Enter][Enter]...
One is just waiting for more input; the other is sitting in
an infinite loop just echoing the newline characters.
To partially address this issue, we introduce a visual
feedback mechanism. When Enter is issued at the end of an
incomplete line, then immediately after the insertion of
Enter, the character ! is flashed twice, alerting the user
that the line is incomplete.
In other situations, there isn't any feedback. An infinite
loop or lengthy calculation like (while t) looks the same as
code which is reading input like (get-line).
* linenoise/linenoise.c (LINNOISE_FLASH_DELAY): New macro.
(flash): New static function.
(edit): Call flash to flash the ! character when Enter is
issued at the end of an incomplete line, and we are not in
paste mode.
|
|
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (edit): If Enter is processed while in
Ctrl-X extended command mode, that mode must be explicitly
canceled by resetting the extended local flag. Not doing this
became an issue when the Enter callback mechanism was
introduced to detect incomplete lines. At that point, entering
Ctrl-X Enter on an incomplete line caused linenoise
to insert a newline, but stay in extended mode.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If an error is thrown while parsing a .txr file
or while reading and evaluating the forms of a .tl
file.
* parser.y (parse_once, parse): Wording change in message when
exception is caught. Only exceptions derived from error are
caught.
* txr.c (parse_once_noerr, read_eval_stream_noerr): New static
functions.
(txr_main): Use parse_once_noerr and read_eval_stream_noerr
instead of parse_once and read_eval_stream.
Don't exit if a TXR file has parser errors; in that situation,
exit only if interactive mode is not requested, otherwise
go interactive. Make sure *self-path* is registered to the
name of the input source in this case also.
* unwind.h (ignerr_func_body): New macro.
|
|
|
|
|
|
|
|
|
| |
* arith.c (poly, rpoly): New functions.
(arith_init): Registered intrinsics poly and rpoly.
* arith.h (poly, rpoly): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (do_macroexpand_1, do_macroexpand): New static
functions; take symbol macro lookup function poiner as
argument.
(macroexpand_1): Reimplemented as wrapper around
do_macroexpand_1.
(macroexpand): Reimplemented as wrapper around
do_macroexpand.
(macroexpand_1_lisp1, macroexpand_lisp1): New static
functions.
(eval_init): Registered intrinsics macroexpand-1-lisp1
and macroexpand-lisp1.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (inv_cum_norm): New function.
* arith.h (inv_cum_norm): Declared.
* eval.c (eval_init): Register inv-cum-norm intrinsic.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/place.tl (sys:l1-val): Use the expanded
version of the place in the resulting form, because some
of the operators like sys:lisp1-value will not expand it.
Previously we were getting away with (sys:l1-val @1)
expanding to (sys:lisp1-value @1) because the op expander
would traverse through this blindly and replace @1.
|
|
|
|
|
| |
* txr.1: Fix syntax synopsis for unique identifying
the function as uniq.
|
|
|
|
| |
* txr.1: Fix run-on period included in .meta formatting.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new implementation treats the @1, @2 ... @rest
op arguments as local macros, leveraging the power of the
macro expander to perform the substitution which renames these
to gensyms.
As a result, the implementation is correct.
The old implementation blindly walks the tree
structure doing the substitution, so that @1 is substituted
even though it is in a quoted literal:
[(op list '(@1)) 42] -> ((#:arg-01-0166))
under the new implementation, '(@1) is left alone:
[(op list '(@1)) 42] -> ((@1) 42)
* eval.c (expand_quasi): Because the new op macro doesn't
rudely reach into quasi forms to substitute sys:var
elements, relying on macro expansion, we must now macro-expand
sys:var elements. The sys:var macro created by op is
smart enough to skip the compound ones that have modifiers;
they are handled via the inner expansion of the symbol.
That is to say, `@@1` contains the structure
(sys:var (sys:var 1)). The sys:var macro ignores the outer
sys:var. But existing behavior in expand_quasi expands the
inner (sys:var 1), so the substitution takes place.
(eval_init): Do not register the hacky old op and do macros,
except in compatibility mode with 184 or older.
* lisplib.c (op_set_entries, op_instantiate): New functions.
(dlt_register): Register auto-loads for op and do macros via
new functions, except when in compatibility mode with 184
or older, in which case we want the old build-in hacky op
to be used.
* share/txr/stdlib/op.tl: New file.
* txr.1: Fixed or removed no-longer-true text which hints at
special hacks implemented in the op expander. Added
compatibility notes for all new compat-switched op behaviors.
|
|
|
|
|
|
| |
* txr.1: the quasiliteral `rest: @rest` and `rest: @@rest`
in fact produce the same result. Remove text which claims
that the second one is erroneous.
|
|
|
|
|
| |
* eval.c (builtin_reject_test): Suppress warning if
the symbol is sys:var or sys:expr.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The dot-to-apply transformation is now applied when
meta-expressions like @foo and @(bar) apparently occur in the
dot position.
This change is made in anticipation of a rewrite of the op
macro, in which the @1, @2, and @rest arguments will be
implemented as macrolets, rather than the ad-hoc, hacky code
walk currently performed in the transform_op function.
* eval.c (dot_meta_list_p): New static function.
(dot_to_apply): Detect the presence of a sys:var or
sys:expr argument in a form. If found, then turn
it and the remaining forms into a single compound
form which replaces them.
* txr.1: Update doc under Dot Position in Function Calls.
|
|
|
|
|
|
|
|
| |
* filter.c (trie_filter_string): If a trie node is associated
with a filter substitute object that isn't a character or
string, then convert that to a string using tostringp.
It could be an integer. If so and we feed that to
string_extend, it will extend the string.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
One test case for this is that (append "ABC" "DEF")
returns an "ABCDEF" string whose length reports as 9
instead of the correct 6. This will wreak various havoc.
The bug was introduced in the very first version of
replace_str, in commit d011fda9b6b078f09027eb65d500c8beffc99414
on January 26, 2012.
In the same commit, the string_extend behavior is
introduced of supporting an integer value specifying the
number of characters by which to extend the string.
This feature of string_extend is used in replace_str,
but wrongly.
* lib.c (replace_str): Pass just the size delta
to string_extend; do not add the old length to the
delta such that the total size is wrongly passed.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim, protsym.c: Regenerated.
|
|
|
|
|
|
|
|
|
| |
* filter.c (base64_stream_enc, base64_stream_dec):
Count bytes encoded or decoded (using a fast integral
counter which efficiently overflows to a Lisp value that may
be a bignum).
* txr.1: Doc updated.
|
|
|
|
|
|
|
| |
* buf.c (buf_grow): When size is zero and len is nonzero, the
loop doesn't terminate. Replace silly loop with
straightforward calculation: grow buffer by 25%, capped at
INT_PTR_MAX, or grow to the length, whichever is larger.
|
|
|
|
|
|
|
| |
* parser.y (buflit): Fix neglect to call end_of_buflit
in the empty buffer literal case, which precipitates syntax
errors when an empty buffer literal #b'' is embedded
in other syntax.
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (truncate_stream): If the len argument is missing,
default to the current position, obtained by using the seek
operation.
(stream_init): Fix up registration of truncate-stream for one
optional argument.
* txr.1: Documentation of truncate-stream updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* filter.c (base64_stream_enc): Change return value
behavior. Return in unlimited mode, or number of bytes
encoded.
(get_base64_char): Stop reading when an invalid character is
encountered, push it back and and return 0.
(b64_code): Don't throw for invalid characters. This case
now only occurs if 0 is passed in.
(base64_stream_dec): Drop nchars argument. Read until
get_base64_char returns 0 due to EOF or an invalid character.
(base64_decode): Don't pass third arg to base64_stream_dec.
(filter_init): base64-stream-enc and base64-stream-dec
intrinsics registered.
* filter.h (base64_stream_dec): Declaration updated.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We don't want to be aborting on OOM, but throwing an
exception.
* lib.c (alloc_error_s): New symbol variable.
(oom_realloc): Global variable removed.
(oom): New static function.
(chk_malloc, chk_malloc_gc_more, chk_calloc, chk_realloc):
Call oom instead of removed oom_realloc handler.
(env): Throw alloc-error rather than error by calling oom.
(obj_init): Initialize alloc_error_s.
(init): Drop function pointer argument; do not
initialize removed oom_realloc.
* lib.h (alloc_error_s): Declared.
(oom_realloc): Declaration removed.
(init): Declaration updated.
* txr.1: Type tree diagram includes alloc-error.
|
|
|
|
|
|
|
| |
* lib.c (vec_set_length): Check new length against INT_PTR_MAX
rather than size_t limit. We want to keep the length a fixnum.
If the allocation needs to increase, grow it by 25%, not by
doubling it.
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (string_extend): Restructure internals with these
goals: no loop: calculate needed space in one step; if the
allocation needs to grow, then grow it by 25% or step it
up to exactly the needed size, whichever of the two is
larger. Overflow check against INT_PTR_MAX, since len and alloc
fields of string are not fixnums but integers extracted
with c_num.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The "byacc_fool" rule needed a small update when
in November 2016 it became involved in newly introduced #;
(hash semicolon) syntax for commenting out.
The problem is that when a top-level nested list expression
is followed by #; then a byacc-generated parser throws
a syntax error.
This is because the byacc_fool production only generates
a n_expr, or empty. Thus only those symbols are allowed
which may begin a n_expr. The hash-semicolon token isn't
one of them.
* parser.y (byacc_fool): Add a production rule which generates
a HASH_SEMI. Thus HASH_SEMI is now one of the terminals
that may legally follow any sentential form that matches
a byacc_fool rule after it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In this patch we switch the string literal parser from right
recursion to left recursion, so that it doesn't require a Yacc
stack depth proportional to the number of characters in the
literal. Secondly, we build the string directly in a
syntax-directed way, rather than building a list of characters
and then walking the list to build a string.
This was discovered as a byacc regression, though the
fix is not for the sake of byacc but basic efficiency.
The Sep 29, 2015 commit
111650e235ab2e529fa1529b1c9a23688a11cd1f
"Implementation of static slots for structures."
extended the string literal in the struct.tl test case in such
a way that if the parser is generated by byacc rather than GNU
Bison, the test case fails with a "yacc stack overflow". I
haven't done any regression testing with byacc in over two
years so I didn't notice this.
Quasiliterals could use this treatment also.
Word list literals benefit from this change, but they still
use a Yacc stack depth proportional to the number of words,
since the accumulation of words is right recursive.
* parser.y (lit_char_helper): Static function removed.
(restlitchar): New grammar nonterminal symbol.
(strlit, quasi_item, wordslit): No need to call
lit_char_helper.
(litchars): A litchars is now either a single LITCHAR,
or else a LITCHARS followed by a sequence of more.
This sequence is a separate production rule called
restlitchar, which is purely left recursive. (If
litchars is made directly left recursive without
this helper rule, intractable reduce/reduce and
shift/reduce conflicts arise.)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* unwind.c (UW_CONT_FRAME_BEFORE, UW_CONT_FRAME_AFTER): New
preprocessor symbols.
(revive_cont): The "frame slack" zero-filled padding logic
is replaced by capturing an actual part of the real stack
before the uw_stack unwind frame. On aarch64, there is
content there we must actually capture. Experiment shows
that exactly 128 bytes is enough, and that corresponds to
the frame_slack value.
(capture_cont): Capture UW_CONT_FRAME_BEFORE bytes before
the uw_stack unwind frame location. Also, the "capture_extra"
is replaced by UW_CONT_FRAME_AFTER constant, to harmonize.
* unwind.h (UW_FRAME_ALIGN): New preprocessor symbol.
(union uw_frame): On aarch64, we ask the compiler, via
a GCC-specific attribute syntax, to align the address of
frame objects to a 16 byte boundary. This solves a crash
in the continuation code. Continuation capture is keyed
to unwind frame addresses. When a captured continuation is
revived onto the stack, the delta between its original address
and the revive address must be a multiple of 16. The reason
is that this preserves the stack and frame pointer alignment.
Certain instructions on the aarch64, require the stack pointer
to be 16 byte aligned. There are other ways we could achieve
this, but the easiest is to align the original frames to 16
bytes.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Continuations don't work yet.
* gc.c (STACK_TOP_EXTRA_WORDS): New macro.
(mark): On aarch64, we must include four words above
the stack top. Some live root pointers sometimes
hide there which are not in any of the callee-saved register
that end up in the machine context via jmp_save.
* jmp.S (jmp_save, jmp_restore): Implement for aarch64.
|
|
|
|
|
|
|
|
|
| |
* arith.c (logand, logior, logxor): Allow one operand to be a
character, if the opposite opernad is a fixnum integer.
The result is a character.
(bit): Allow the value being tested to be a character.
* txr.1: Updated.
|
|
|
|
|
|
|
|
|
| |
* ffi.c (put_obj, get_obj, fill_obj): New functions.
(ffi_init): put-obj, get-obj, fill-obj intrinsics registered.
* ffi.h (put_obj, get_obj, fill_obj): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
| |
* buf.c (init_borrowed_buf): New function.
(make_borrowed_buf): Reduced to wrapper around
init_borrowed_buf.
* buf.h (init_borrowed_buf): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* buf.c (struct buf_strm): New struct type.
(buf_strm_mark, int buf_strm_put_byte_callback,
buf_strm_put_string, buf_strm_put_char, buf_strm_put_byte,
buf_strm_get_byte_callback, buf_strm_get_char,
buf_strm_get_byte, buf_strm_unget_char, buf_strm_unget_byte,
buf_strm_seek, buf_strm_truncate, buf_strm_get_prop,
buf_strm_set_prop, buf_strm_get_error,
buf_strm_get_error_str): New static functions.
(buf_strm_ops): New static struct.
(buf_strm): New static function.
(make_buf_stream, get_buf_from_stream): New functions.
(buf_init): Register new intrinsic functiions make-buf-stream
and get-buf-from-stream.
Call fill_stream_ops on new buf_strm_ops to fill
default operations in place of function pointers
that have been left null.
* buf.h (make_buf_stream, get_buf_from_stream): Declared.
* lisplib.c (with_stream_set_entries): Add with-out-buf-stream
and with-in-buf-stream to auto-load symbols for with-stream.tl
module.
* share/txr/stdlib/with-stream.tl (with-out-buf-stream,
with-in-buf-stream): New macros.
* txr.1: New section about buffer streams.
|
|
|
|
|
| |
* buf.c (buf_grow): Use the previously calculated delta value,
rather than re-evaluating the equivalent expression.
|
|
|
|
|
| |
* buf.c (buf_put_uchar): Fix wrong conversion that is causing
this function to reject values in the 128-255 range.
|
|
|
|
|
| |
* stream.h (enum strm_whence): Fix strm_end and strm_start
being duplicate values; strm_end must map to SEEK_END.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The base64_encode and base64_decode functions internally work
with streams. This change factors out those internals into
separate functions (with the intent that these will be
usefully exposed, in another commit).
* filter.c (base64_stream_enc): New function, made out of
the internals of base64_encode.
(base64_encode): Simple wrapper for base64_stream_enc.
(base64_stream_dec): New function, made out of
the internals of base64_decode.
(base64_decode): Simple wrapper for base64_stream_dec.
* filter.h (base64_stream_enc, base64_stream_dec): Declared.
|
|
|
|
|
|
|
|
|
| |
* ffi.c (buf_carray): New function.
(ffi_init): Registered buf-carray intrinsic.
* ffi.c (buf_carray): Declared.
* txr.1: Documented.
|