| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
| |
* arith.c (divides): New function.
(arith_init): Intrinsic registered.
* arith.h (divides): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register the same function under
length and len.
* txr.1: Documented.
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register spl and tok intrinsics.
* lib.c (spl, tok): New functions.
* txr.1: Documented.
|
|
|
|
| |
* eval.c (eval_init): Fix incorrect registration of tok-str.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We are allowing calls like (* "a") and (+ "a")
without diagnosing that the argument isn't of a valid
type. Note that (max "a") is fine beacause min and
max use the less function; they are not strictly numeric.
* lib.c (nary_op): Beef up function with additional argument
for type checking the unary case.
(unary_num, unary_arith, unary_int): New static functions.
(plusv, mulv, logandv, logiorv): Use new nary_op interface.
(gtv, ltv, gev, lev, numeqv, numneq): Check the
first number.
* lib.c (nary_op): Declaration updated.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): prod and sum intrinsics registered.
* lib.c (sum, prod): New functions.
* lib.h (sum, prod): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (digcommon): New static function.
(digpow, digits): New functions.
(arith_init): New digpow and digits intrinsic functions
registered.
* arith.h (digpow, digits): Declared.
* txr.1: New functions documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* parser.y (expand_meta): Fix incorrect conversion
of (sys:var x) when x is a non-bindable term
to (sys:expr . x). Should be (sys:expr x). This doesn't have
that much of an impact, I don't think. It prevent certain
degenerate forms from working like @(bind x @"str"). The bad
thing is that this particular one has a silent problem: @"str"
wrongly evaluates to #\s. Neverheless, this doesn't seem worth
the addition of a compat flag test; the odds of someone
depending on @"str" producing #\s in some pattern language
code see vanishingly low.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is an inconsistency in @(bind) in that
given @(bind x y) where x is a variable, both
directions are tried for a string tree match.
x could be tree of strings and y a string atom,
or vice versa. But if x is just an atom, or
a Lisp evaluation, then only one direction is
tried. @(bind @(list "a" "b") "a") succeeds,
but @(bind "a" @(list "a" "b")) fails.
* match.c (dest_bind): Test both directions
in the scalar and Lisp evaluated cases of the
left hand side. Subject to compatibility,
just in case.
* txr.1: Compat note added.
|
|
|
|
|
| |
* txr.1: Fix description of aret, which wrongly refers
to the ret macro.
|
|
|
|
|
| |
* txr.1: Under the qref and uref operators, mention what
these stand for and how the terminology is derived.
|
|
|
|
|
| |
* txr.1: Adding note that a symbol cannot be a global
symbol macro and global variable at the same time.
|
|
|
|
|
| |
* txr.1: equivalence between .(qref ...) and (uref ...) now
typeset properly in monospaced font.
|
|
|
|
|
|
| |
* txr.1: Remove clumsy "firstly, secondly, thirdly" because
we need a "fourthly" which is too much. Intro now mentions
that Lisp evaluation is also possible via the listener.
|
|
|
|
|
| |
* txr.1: Note under #b binary number syntax that #b is also
used for buffer literals, and vice versa.
|
|
|
|
|
|
| |
* eval.c (pad): Incoming sequence must be nullified, otherwise
empty vectors and strings produce a spurious nil.
This affects the weave function, which uses pad.
|
|
|
|
|
| |
* genvim.txr (iskeyword): add ^ character.
Now r^ and others are colorized properly.
|
|
|
|
|
|
|
|
|
|
| |
This eliminates one incompatibility between doloop
and ANSI CL do.
* share/txr/stdlib/doloop.tl (sys:expand-doloop): Wrap body in
tagbody form.
* txr.1: Documentation updated.
|
|
|
|
|
| |
* txr.1: Note added that a tagbody label may be any
symbol whatsoever.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/tagbody.tl (tagbody): Reduce unnecessary
use of DWIM brackets to parentheses in calculation of bblocks.
Remove entry-lbl local variable, propagating its initform
to its one and only use site.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/tagbody.tl (tagbody): Use progn for the
trivial case, and in the ordinary case, the sys:for-op
special form directly rather than the for loop maro.
sys:for-op doesn't introduce a block; the for macro is
doing that.
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/tagbody.tl (tagbody): If the body contains
no labels, then emit a simple block. Note that we should just
be emitting a progn here; however, there is a bug in tagbody
in that there is an anonymous block. This is not documented,
and a consequence of the looping construct used. So for now we
preserve that behavior in the reduced case.
|
|
|
|
|
| |
* parser.c (is_balanced_line): Handle #b'...' syntax with some
new states and transitions.
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (doloop_set_entries, doloop_instantiate): New
functions.
(lisplib_init): Register autoload for doloop macros.
* share/txr/stdlib/doloop.tl: New file.
* txr.1: Documented.
|
|
|
|
| |
* txr.1: Superfluous article a deleted, and sentence reworded.
|
|
|
|
|
|
|
|
|
|
|
| |
* genvim.txr (txr_pnum): New match; matches a superset of
the #x, #o and #b literals with the inclusion of trailing
alphanumeric junk. Highlighted as Error.
(txr_xnum, txr_onum, txr_bnum): New match categories, formed
by renaming the previous #x, #o and #b matches. These are
contained in txr_pnum, highlighted as Number.
(txr_bracevar, txr_directive, txr_list, txr_bracket,
txr_mlist, txr_mbracket): Include txr_pnum.
|
|
|
|
| |
* txr.1: Fix incorrect #H prefix which should of course be #S.
|
|
|
|
| |
* txr.1: anything code -> any code.
|
|
|
|
|
|
|
| |
* genvim.txr (txr_error): New match in this category for #
followed by something other than H, S or R. Some characters
other than these are valid after #, but are covered by
explicit matches that occur later.
|