| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c: include <assert.h> that was previously coming
via "mpi.h".
* mpi/mpi.c: Includes of <stdio.h>, <ctype.h> and <assert.h>
moved here.
* mpi/mpi.h: Remove include of <stdio.h>, <ctype.h> and
<assert.h>. Keeping <limits.h> for now; needed for CHAR_BIT.
* mpi/mplogic.c: Needs <assert.h>
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* filter.c (tobase64_k, frombase64_k): New keyword symbol variables.
(col_check, get_base64_char, b64_code): New static functions.
(base64_decode, base64_encode): New functions.
(filter_init): Initialize new keyword symbol variables, and register
base64-encode and base64-decode intrinsic functions.
* filter.h (base64_encode, base64_decode): Declared.
* txr.1: Documented base64-encode, base64-decode,
as well as :tobase64 and :frombase64.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is responsible for behaviors like Ctrl-C being
subsequently ignored after the first time a read is
interrupted that way.
* signal.c (sig_reload_cache): Eliminate the return
statement which was making the memcpy expression
unreachable! No warning from gcc. Also, since
nobody checks the return value of this function and
it doesn't provide one, let's make it void.
There is no reason the sigprocmask would fail since
the arguments are correct, but let's check its
return value anyway.
|
|
|
|
|
|
| |
* genvim.txr: Add missing single, first, last and other output
repeat modifiers. Removing rep, since it's scraped from the
table registration in match.c.
|
|
|
|
| |
* txr.1: "variables substitutions".
|
|
|
|
| |
* txr.1: "They encodes" fixed.
|
|
|
|
|
|
|
|
|
|
| |
This happened on 2015-07-29, before TXR 111,
"Deriving streams from the same base" commit.
* stream.c (string_in_get_char): Must retrieve the character
at the previous position, not the incremented one. Otherwise
we lose the first character, and of course we blow up with an
out of range access when we hit the end of the string.
|
|
|
|
|
|
|
| |
* lib.c (vec_list): Don't require input to be specifically a
list, just any sequence that can be marched with cdr until
nil. This commit also fixes the problem that the error message
was still referring to the function as vector-list.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (UINT_PTR_MAX_MP): New static variable.
(biggnum_from_uintptr): New function.
(in_uint_ptr_range): New static function.
(c_uint_ptr_num): New function.
(arith_init): Initialize UINT_PTR_MAX_MP.
* arith.h (bignum_from_uintptr, c_uint_ptr_num): Declared.
* eval.c (eval_init): Register random-state-get-vec.
* mpi/mpi.c (mp_set_uintptr, mp_get_uintptr): New functions.
(mp_set_intptr, mp_get_intptr): Expressed in terms of
mp_set_uintptr and mp_get_uintptr.
* mpi/mpi.h (mp_set_uintptr, mp_get_uintptr): Declared.
* rand.c (make_random_state): Handle vector seed.
(random_state_get_vec): New function.
* rand.h (random_state_get_vec): Declared.
* txr.1: Documented new feature in make-random-state
and new random-state-get-vec function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This mistake causes wasteful behavior for power-of-two
moduli in the random function, in both the bignum and
fixnum cases. For instance, the modulus 16 is taken
to be 17 bits wide. But we really want the width 16:
the number of bits needed for values in the range [0, 16).
The result isn't wrong, but the loop generates 17-bit
random numbers, and then throws away those which equal
or exceed the modulus, which is wasteful.
* mpi/mpi.c (mp_is_pow_two): New function.
* mpi/mpi.h (mp_is_pow_two): Declared.
* rand.c (random): In bignum case, after counting
bits in the modulus, subtract 1 if the modulus is a power
of two. In the fixnum case, subtract 1 from the modulus
and then count the bits in the reduced value.
* tests/013/maze.expected: regenerate due to different
prng behavior.
|
|
|
|
|
|
|
|
|
|
| |
* rand.c (random): In fixnum case, allow only m >= 1.
The code is restructured so that this check is done
before we do some arithmetic with derived values,
where the behavior can become undefined.
* txr.1: Document the restriction on modulus range
for rand and random.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register split*.
* lib.c (split_star_func): New static function.
(partition_split_common): Take pointer-to-function argument
instead of boolean. Hoist this C function into the lazy cons.
(partition): Pass pointer to partition_func ito
partition_split_common, intsead of a flag requesting the use
of partition_func.
(split): Pass apointer to split_func into
partition_split_common.
(split_star): New function.
* lib.h (split_star): Declared.
* txr.1: Documented split*.
|
|
|
|
|
|
|
| |
* txr.1: examples were calling split as if it were
variadic, accepting multiple indices as separate
arguments. This is not the case; a sequence of indices
must be passed as one argument.
|
|
|
|
|
| |
* lib.c (partition_star): Eliminate strange behaviors
when a negative index is given as an argument.
|
|
|
|
|
|
|
| |
lib.c (partition_star): In the special case that the indices
argument is given as the integer zero, the function wrongly
returned just the remaining piece of the sequence after zero,
rather than a list containing this piece.
|
|
|
|
|
|
| |
* lib.c (partition_star): The same issues that were addressed
in TXR 126 in 2015-11-29 commits and 2015-11-24 commits
must also be addressed here.
|
|
|
|
|
| |
* sysif.c (make_hash): Fix incorrect treatment of env values
which contain equal signs, due to careless use of split_str.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* match.c (mandatory_k): New keyword variable.
(h_coll, v_gather, v_collect): Implement :mandatory logic.
(syms_init): Initialize mandatory_k.
* parser.l (grammar): The UNTIL and LAST tokens must be
matched similarly to collect, without consuming the
closing parenthesis, allowing a list of items to be parsed
between the symbol and the closure, in the NESTED state.
* parser.y (gather_clause, collect_clause, elem,
repeat_parts_opt, rep_parts_opt): Adjust to new until/last
syntax. In the matching productions, the abstract syntax
changes to incorporate the options. In the output productions,
we throw an error if options are present.
* txr.1: Documented :mandatory for collect, coll and gather.
|
|
|
|
|
|
|
|
| |
* match.c (v_gather): Use getplist_f to distinguish the :vars
nil case just like v_collect does. A :vars nil gather could be
useful; it says none of the variables are strictly required.
In any case, it is not correct to treat :vars nil as if :vars
weren't there.
|
|
|
|
|
| |
* lib.c (obj_print_impl): Handle NUM and BGNUM separately from
FLNUM, thorugh a hard-coded "~s" format.
|
|
|
|
|
|
| |
* lib.c (minusv): Avoid reduce_left overhead in
common two-argument case, and just call binary
minus function directly.
|
|
|
|
|
| |
* lib.c (nary_op): Avoid the overhead of reduce_left in the
two-argument case and just call the binary function.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register / function to divv instead of divi.
* lib.c (divv): New function.
* lib.h (divv): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
| |
* eval.c (do_expand): Add missing rlcp in the construction
of the return value of the clause which expands a dohash.
Let's make it a rlcp_tree. Test case: (dohash (a b c) d e)
with c unbound.
|
|
|
|
|
|
| |
* eval.c (eval_init): Register "use" as alias for identity.
* txr.1: Documented use function.
|
|
|
|
|
|
|
|
| |
* parser.c (read_eval_read_last): New argument: counter.
Incorporate counter into name of stream.
(repl): Pass prev_counter into read_eval_read_last
so the paste inherits the line number of the :read
command.
|
|
|
|
|
|
|
|
|
|
| |
* configure: Check for availability of crypt,
and what library must be used.
* sysif.c (crypt_wrap): New static function.
(sysif_init): Register crypt intrinsic.
* txr.1: Documented crypt.
|
|
|
|
|
| |
* configure: the do-we-need-to-set-stack-size test
shouldn't overwrite conf_ldflags, but add to it.
|
|
|
|
|
| |
* Makefile (EXTRA_LDFLAGS): New variable, interpolated
into LDFLAGS.
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
|
|
|
|
|
|
|
|
| |
* lib.c (out_str_char): If semi-flag is true, we must
issue a semicolon not only when the next character is
a hex digit, but also when it is a semicolon, so that
"\x1F;;" isn't rendered as "\x1F;" where the semicolon
character has disappeared.
|
|
|
|
|
| |
* regex.c (print_rec): Handle '[' and ']' in backslash-adding
switch.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (out_str_char): Static function becomes extern.
* lib.h (out_str_char): Declared.
* regex.c (puts_clear_flag, putc_clear_flag): New static
functions.
(print_class_char): Take semicolon flag argument.
Use out_str_char to render characters not escaped locally.
Clear the semicolon flag.
(paren_print_rec): Take semicolon flag argument, and pass it
down. Clear it when printing parentheses.
(print_rec): Take semicolon flag argument, and pass
down to lower level functions. Use putc_clear_flag and
puts_clear_flag instead of put_string and put_char.
Use out_str_char for char object not esaped locally.
(regex_print): define semi_flag and pass it down
to print_rec.
|
|
|
|
|
|
| |
* lib.c (out_str_char): Don't print all characters
above space as themselves. Treat 7F and U+DCxx
as control chars to be printed using hex escape.
|
|
|
|
| |
* regex.c (print_class_char): Add missing character cases.
|
|
|
|
|
|
| |
* lib.c (chk_strdup, chk_strdup_utf8, chk_copy_obj):
No need to assert !async_sig_enabled since the lower
level chk_malloc or chk_malloc does it.
|
|
|
|
|
| |
* lib.c (cat_str): Unnecessarily scoped len variable
moves to inner scope.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Avoids consing up list of strings.
* lib.c (vscat): New static function.
(scat): New function.
(lazy_str): Use scat instead of cat_str.
* lib.h (scat): Declared.
* eval.c (format_field): Use scat instead of cat_str.
* parser.c (open_txr_file, read_eval_stream): Likewise.
|
|
|
|
|
|
| |
* lib.c (copy_lazy_str): Eliminate pointless initialization of ls.list
and to nil. Make ls.prefix initialization the last step since
it's the only operation which conses.
|
|
|
|
|
|
|
| |
* eval.c (set_origin): Add form != origin
to the condition for recording the ancestry.
(expand_macro): Use set_origin function instead
of direct call to sethash.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is also a bugfix. Padding up the index to be at least
1024 characters longer than the existing prefix was dumb
and wrong; it changes the semantics of code which restores the
list from the lazy string, like the @(freeform) directive.
How much of the string is forced is visible to the caller!
* lib.c (lazy_str_force, lazy_str_force_upto): Don't
collect pieces from the lazy list and then catenate them
in one pass. Instead, use the existing function string_extend,
which grows the string exponentially.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* gc.c (finalize): Must free the dynamic structure attached
to the LSTR type now.
(mark_obj): Must mark interior of LSTR type's props structure.
* lib.c (lazy_sub_str, copy_lazy_str): Copy props structure.
(lazy_str): Allocate and initialize props structure.
(lazy_str_force, lazy_str_put, lazy_str_force_upto,
lazy_str_get_trailing_list, out_lazy_str): Follow
representation change.
* lib.h (struct lazy_string_props): New struct type.
(strut lazy_string): Member opts replaced with props
pointer to struct lazy_string_props.
|
|
|
|
|
|
| |
* lib.c (chk_copy_obj): New function.
* lib.h (chk_copy_obj): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some glibc nincompoops have suddenly decided, in their
infinite wisdom, that a wise move is to deprecate the
_BSD_SOURCE feature selection macro with annoying preprocessor
warnings insisting that _DEFAULT_SOURCE be used instead,
even though the functions convered by _BSD_SOURCE
still exist.
* configure: Let's test for _DEFAULT_SOURCE ahead of
_BSD_SOURCE.
|
|
|
|
|
|
| |
* signal.c (sig_mask): Pass address of real_oldset
to VALGRIND_MAKE_MEM_DEFINED, rather than a copy
of the object itself.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
| |
txr.1: Improperly closed .cblk around example.
|