| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
* txr.1: Fix instances of condition-pattern and condition-clauses
to condition-action.
|
|
|
|
|
|
|
| |
* txr.1: *define-struct-prelude* should of course be
define-struct-prelude.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
| |
* txr.1: document return value better for span-str and
compl-span-str. Add examples for all three functions.
|
|
|
|
|
| |
* txr.1: In FFI-related example, a call to abc_function
should just refer to function.
|
|
|
|
| |
* stdlib/quips.tl (%quips%): New one about personality.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When an invalid call expression is constant folded, such
as (call 'abs 1 2), runaway recursion occurs. This is
because due to the wrong number of arguments being passed
to abs, the safe-const-reduce function returns the
expression unmodified. The comp-apply-call method then
passes it to compile, wrongly assuming a reduction had
taken place, and so everything repeats.
* stdlib/compiler.tl (comp-apply-call): Detect when
safe-const-reduce has hit a fixed point by returning
the input form. In that case, we don't call the compiler
top-level entry point, but the comp-fun-form method
directly; the wrong function call will be compiled without
constant folding and throw an error at run-time.
|
|
|
|
|
|
|
|
| |
* stdlib/constfun.tl (%const-foldable-syms%): Removing
the following functions, which cannot be constant folded
because maybe are relied upon to produce fresh objects:
cons, sub-list, conses, ldiff, uniq, tostring, tostringp,
join, join-with.
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (make_string_byte_input_stream,
get_string_from_stream):
Use self in diagnostic, and print bad object
using ~s rather than ~a.
(get_list_from_stream): Likewise, and add missing
nao as well.
(catenated_stream_push): Add self string, use
in diagnostics, print bad object using ~s.
|
|
|
|
|
|
|
|
| |
* arith.c (expt): NUM-FLNUM, FLNUM-NUM and FLNUM-FLNUM cases
ensure that if the expontent is zero, the return value is
1.0. Implementations of pow do this, but ISO C doesn't require it.
* txr.1: Now documented.
|
|
|
|
|
|
| |
* hash.c (hash_double): If the input is equal to 0.0, return
0, so that both negative and positive zero have the same hash
value.
|
|
|
|
|
|
| |
* sysif.c (crypt_wrap): Dynamically allocate struct crypt_data
instead, because it's over 128K wide, resulting in a huge
stack frame size.
|
|
|
|
|
|
|
| |
* struct.c (struct_handle, stype_handle_impl,
struct_handle_for_slot, umethod_fun, umethod_args_fun):
Throw type-error rather than error for the situation
that an argument isn't a struct.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When a global variable v is wrapped with (read-once v),
multiple accesses to the place still generate
multiple accesses of the global through getv or getlx
instructions. The reason is that the alet and slet
macros optimize away a temporary bound to the value of
a variable regardless of whether the variable is lexical.
Let's fix that.
* stdlib/place.tl (slet, alet): Replace the bindable test
with lexical-var-p, in the given environment. A binding
to a variable is only alias-like if the variable is
lexical, otherwise we need a real temporary.
* tests/012/struct.tl (get-current-menv): New macro.
(menv): New global variable. Fix a number of tests which
use expand, whose expansion has changed because the
expressions refer to free variables. We introduce an
environment parameter which binds all the variables, so
that the optimized expansion is produced, as before.
* txr.1: Updated documentation. slet gets examples.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
More often than not, you want the FTW_PHYS flag when
calling the nftw function. Let's make that the default
in TXR's wrapper.
* ftw.c (ftw_wrap): Default to FTW_PHYS when flags
argument not given, rather than zero, subject to
compatibility option.
(ftw_init): Don't check for FTW_PHYS with ifdef, since
we relied on it being present. And anyway, any nftw
implementation must have that.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A struct prelude definition associates one or more
future defstruct (by struct name) with clauses which
are implicitly inserted into the defstruct.
It is purely a macro-time construct, customizing the
expansion behavior of defstruct.
* stdlib/struct.tl (*struct-prelude, *struct-prelude-alists*):
New special variables holding hash tables.
(defstruct): Before processing slot-specs, augment it with
the contents of the prelude definitions associated with
this struct name.
(define-struct-prelude): New macro.
* autoload.c (struct_set_entries): define-struct-prelude
is interned and triggers autoload of struct module.
* tests/012/oop-prelude.tl: New file.
* tests/012/oop-prelude.expected: Likewise.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The validate_salt function was introduced in commit
c3a0ceb2cea1a9d43f2baf5a2e63d0d712c8df19, February 2020.
I cannot reproduce the internal crash in crypt which
it alleges, and I neglected to mention the bad inputs
in the commit or add tests. I'm not able to reproduce
the alleged behavior in spite of trying all sorts of bad
inputs; and looking at the crypt source in glibc, I
don't see any obvious problem.
And so, on this Halowe'en, we exorcise the ghost
that has been haunting the crypt.
* sysif.c (salt_char_p, validate_salt): Static functions
removed.
(crypt_wrap): Don't call validate_salt, and so cwsalt
need not be tested for null.
* tests/018/crypt.tl: New file.
* txr.1: Mention that crypt_r is used if available, which
avoids static storage.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These checks go off on Windows and are likely
not easily fixable. They have to do with how Cygwin
maps permissions. Our security checks depend on
a detailed, bona fide Unix implementation.
* parser.c (report_file_perm_problem,
report_path_perm_problem): Empty bodies when
compiled for Cygwin.
(repl): Initialize the ppriv_s and psafe_s variables
to the tf symbol, the function which takes any
number of arguments, ignoring them, and returning t.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I noticed that when compiling a TXR Lisp program which
refers to self-path using the --compile option, the
compiler complained about self-path being unbound.
* txr.c (self_path_s): New global variable.
(do_compile_opt): Prior to running compile-update-file,
bind self-path to the source path.
(txr_main): Don't define local self_path_s, but initialize
the global one. Replace redundant re-intering of self-path
with a reference to self_path_s.
* txr.1: self-path documentation updated.
|
|
|
|
|
|
| |
* txrtags.tl (process-form): Handle :postfini
in the same way as :fini. In fallback case,
reject clauses headed by a keyword symbol.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stdlib/compiler.tl (comp-catch): Under an optimization level
of at least 1, if no symbols are being caught, or if the
try expression is a safe constant expression, then just
compile the try expression. Furthermore, if there is only one
exception symbol being caught, and a catch clause is for a
subtype of that symbol, we eliminate the run-time
exception-subtype-p test. This will always be true if the catch
macros are being used, because the list of symbols is derived
from the clauses. Lastly, if there is only one exception symbol
being caught, any clause which doesn't match that symbol is
now eliminated as dead code. That shouldn't happen unless
the sys:catch operator is used directly.
|
|
|
|
|
|
|
|
|
| |
* lib.h (or2): Define simply using the ?: operator from
GNU C, eliminating the explicit temporary variable.
(uses_or2): For GNU C, we make this a dummy, harmless
declaration. If memory serves me, one of the few good ways
to do that it without eliciting unused warnings is to
declare an enum.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The measure/allocate/catenate functions which underlie
the cat-str implementation are streamlined, simplifying
the code. At the same time, they handle nested sequences
of string/character items.
* lib.c (struct cat_str): New member, seen_one. This flips
from 0 to 1 after the first item has been seen in the
cat_str_measure pass or cat_str_append pass. Each item
other than the first is preceded by a separator.
(cat_str_measure, cat_str_append): The more_p argument
is dropped. We account for the separator with the help
of the new seen_one flag, which allows us to easily
recurse over items that are sequences.
(cat_str_alloc): Reset the seen_one flag in preparation
for the cat_str_append pass.
(cat_str, vscat, scat2, scat3, join_with): Simplified.
* tests/015/split.tl: New tests.
* txr.1: Redocumented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The :inherit clause allows custom struct clauses to
inject inherited bases.
* stdlib/struct.tl (defstruct): Recognize :inherit clause,
adding symbol arguments to extra list of supers that
get appended to the list coming from defstruct's
seconda rgument.
(define-struct-clause): Disallow :inherit clause name.
* tests/012/oop-dsc.tl: New tests.
* txr.1: Documented.
|
|
|
|
|
|
|
| |
* txr.1: It's a developer surprise that (flow x) returns
nil rather than x; which is due to the documented behavior
of chain, when it has no arguments. Let's add cautionary
notes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure (txr_ver): Bumped version.
* stdlib/ver.tl (lib-version): Bumped.
* txr.1: Bumped version and date. Also mention that separator
commas in integer tokens are new in 283 and have a different
interpretation in older versions.
* txr.vim, tl.vim: Regenerated.
* protsym.c: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The reason is that args_decl_list places struct args
inside a larger struct, where it is followed by another
member. A struct with a flexible array being other than
the last member of another struct is a GNU extension,
which generates warnings on newer GCC versions.
* args.h (struct args): Define arg as array of [1]
rather than [FLEX_ARRAY].
(ARGS_ABS_MIN): Unconditionally define as 1.
(args_decl_list): Subtract 1 from N because we get
one element from struct args. This macro should have
subtracted the FLEX_ARRAY value.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* args.h (args_decl_list): This macro now handles only
constant values of N. It declares an anonyous container
struct type which juxtaposes the struc args header
with exactly N values. This is simply defined as a local
variable without alloca.
(args_decl_constsize): Like args_decl, but requiring a
constant N; implemented via args_decl_list.
(args_decl_list_dyn): New name for the old args_decl_list
which calls alloca. No places in the code depend on this
at all, except the definition of args_decl.
(args_decl): Retargeted to args_decl_list_dyn.
There is some inconsistency in the macro naming in that
args_decl_constsize depends on args_decl_list, and
args_decl depends on arg_decl_list_dyn. This was done
to minimize diffs. Most direct uses of args_decl_list
have a constant size, but a large number of args_decl
uses do not have a constant size.
* eval.c (op_catch): Use args_decl_constsize.
* ffi.c (ffi_struct_in, ffi_struct_get, union_out):
Likewise.
* ftw.c (ftw_callback): Likewise.
* lib.c (funcall, funcall1, funcall2, funcall3,
funcall4, uniq, relate): Likewise.
* socket.c (sockaddr_in_unpack, sockaddr_in6_unpack,
sockaddr_un_unpack):
Likewise.
* stream.c (formatv): Likewise.
* struct.c (struct_from_plist, struct_from_args,
make_struct_lit): Likewise.
* sysif.c (termios_unpack): Likewise.
* time.c (broken_time_struct): Likewise.
|
|
|
|
|
|
|
| |
* lib.c (funcall, funcall1, funcall2, funcall3,
funcall4): Handle FVM case separately, regardless
of the f.variadic flag. If the VM function is
variadic, the call can still use the special cases.
|
|
|
|
|
|
| |
* lib.c (funcall, funcall1, funcall2, funcall3,
funcall4): Handle some situations when the function
is a built-in with optional args.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (funcall, funcall1, funcall2, funcall3, funcall4):
Do not go through the generic_funcall slow path just
because the target function has optional arguments.
It's possible that the call is supplying all of the
required arguments. Let's try it like that and then
if it doesn't work and there are optionals, check again
and go the generic_funcall route. This might not be
an overall improvement by itself, if we end up going
to generic_funcall in more cases than not. However, this
change paves the way for more changes: handling some cases
of optargs in these helpers.
|
|
|
|
|
|
|
|
|
|
|
| |
* stdlib/struct.tl (macroexpand-struct-clause): New function.
* autoload.c (struct_set_entries): Autoload struct module
on macroexpand-struct-clause.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
| |
* stdlib/match.tl (macroexpand-match): New function.
* autoload.c (match_set_entries): Autoload match
module on macroexpand-match.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stdlib/place.tl (sys:pl-expand): Function renamed to
macroexpand-place; env parameter becomes optional.
(macroexpand-1-place): New function.
(place-form-p, call-update-expander, call-clobber-expander,
call-delete-expander): Follow rename.
* autoload.c (place_set_entries): Register symbols
macroexpand-place and macroexpand-1-place for autoload.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stdlib/pmac.tl (macroexpand-params): New function,
implemented using newly exposed sys:expand-param-macro.
* autoload.c (pmac_set_entries): Trigger pmac.tl autload
on macroexpand-params symbol.
* eval.c (eval_init): Register existing expand_param_macro
function as sys:expand-param-macro.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
| |
* txr.1: Fix formatting issue with .IP headings; add more
examples showing (. arg) notation, use of : argument for
requesting defaulting, and demonstration of presence-indicating
variables.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stdlib/struct.tl (:delegate): Handle the two-element
form of the optional parameter, which specifies the
usual initializing expression for the default value.
This is just passed through as-is to the generated
method. Diagnose if the three-element form occurs.
* tests/012/oop.tl: Some new tests.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (standard_k, print_json_format_s):
New symbol variables.
(stream_init): New variables initialized.
* stream.h (enum json_fmt): New enum.
(standard_k, print_json_format_s): Declared.
* lib.c (out_json_rec): Take enum json_fmt param,
and pass it recursively. Printing for vector and
dictionaries reacts to argument value.
(out_json, put_json): Examine value of special
var *print-json-format* and calculate enum json_fmt
value from this. Pass to out_json_rec.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (inc_indent_abs): New function.
(stream_init): inc-init-abs intrinsic registered.
* stream.h (inc_indent_abs): Declared.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The following situation is observed in the listener.
1> (put-json #H(() (a 1)))
{** print: invalid object a in JSON
** during evaluation at expr-1:1 of form (put-json #H(() (a 1)))
1>
1>
An indent established in the aborted JSON print job
has been left in the stream.
* lib.c (put_json): Save the indent value also, not
only the mode. Restore the indent mode and value
on unwinding, not just on a normal exit from out_json_rec,
similiarly to what obj_print does.
|
|
|
|
| |
* stdlib/quips.tl (%quips%): New entry.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Research indicates that this is something useful in
languages that abuse strings for implementing symbols.
We have interned symbols.
* lib.h (struct string): Remove hash member.
* lib.c (string_own, string, string_utf8, mkustring,
string_extend, replace_str, chr_str_set): Remove
all initializations and updates of the removed
hash member.
* hash.c (equal_hash): Do not cache string hash value.
|
|
|
|
| |
* txr.1: Revise text, fixing a grammar error.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This relates to the November 2021 commit
9108e9f8f4434fb29200b08a4b576df47c407c01:
hash: 64 bit string and buffer hashing and seeds.
In the hash constructor, a 32 bit cast was left
behind, needlessly reducing the seed value to 32
bits on 64 bit platforms.
* hash.c (do_make_hash): Don't convert the ucnum
value to u32_t; just store it.
|
|
|
|
|
|
| |
* txr.1: Document that hash-eql and hash-equal
return a value in the range fixnum-min to
fixnum-max.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On platforms which have the malloc_usable_size function,
we don't have to store the allocated size of an object;
malloc provides us the allocated size (which may be larger
than we requested). Here we take advantage of this for
strings. And since we don't have to store the string
allocated size any more, we use that field for something
else: storing the hash code (for seed zero). This can speed
up some hashing operations.
* configure (have_malloc_usable_size): New variable.
Configure test for have_malloc_usable size. We have to
try several header files, too. We set the configure
variable HAVE_MALLOC_USABLE_SIZE, and possibly
HAVE_MALLOC_H or HAVE_MALLOC_NP_H.
* lib.h (struct string): If HAVE_MALLOC_USABLE_SIZE
is true, we define a member called hash insetad of
alloc. Also, we change alloc to cnum.
* lib.c: Include <malloc_np.h> if HAVE_MALLOC_NP_H
is defined.
(string_own, string, string_utf8, mkstring, mkustring,
init_str, string_extend, string_finish, string_set_code,
string_get_code, length_str, replace_str, chr_str_set):
Fix code for both cases. On platforms with malloc_usable_size,
we have the allocated size from malloc, so we don't have to
retrieve it from the object or store it. Any operations which
mutate the string must reset the hash field to zero; zero
means "hash has not been calculated".
* hash.c (equal_hash): Just retrive a string's hash value, if
it is nonzero, otherwise calculate, cache it and return it.
* gc.c (mark_obj): The alloc member of struct string is a
machine integer now; no need to mark it.
|
|
|
|
|
|
|
| |
* txr.1: Syntax markup for file-get-buf, :mass-delegate
and file-open options contains an extra space. This causes
the syntax not to be correctly processed for the HTML
version. nroff-based man page rendering and pdf are fine.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* parser.l (remove_char): New static function.
(DIGSEP, XDIGSEP, NUMSEP, FLOSEP, XNUMSEP, ONUMSEP,
BNUMSEP, ONUM, BNUM): New named lex patterns.
(FLODOT): Use DIGSEP instead of DIG.
(ONUM): Use ODIG instead of [0-7].
(BNUM): Use BDIG instead of [0-1].
(grammar): New rule for producing NUMBER from decimal
token with commas based on BNUMSEP instead of BNUM.
This is a copy and paste so that the BNUM rule doesn't
deal with the comma removal, not to slow it down.
For the octal, binary and hex, we just switch to
BNUMSEP, ONUMSEP and XNUMSEP, so they all go through
one case.
Floating point numbers are also handled with a copy
pasted case using FLOSEP.
* tests/012/syntax.tl: New test cases.
* txr.1: Documented.
* genvim.txr (alpha-noe, digsep, hexsep, octsep, binsep): New
variables.
(txr_pnum, txr_xnum, txr_onum, txr_bnum, txr_num): Integrate
separating commas. Some bugs fixed in txr_num, some simplifications,
better txr_badnum pattern.
* lex.yy.c.shipped: Updated.
|
|
|
|
| |
* tets/012/oop-dsc.tl: New file.
|
|
|
|
|
|
|
|
| |
* stdlib/struct.tl (defstruct): Don't generate a separate finalizer
registration for each :fini or :postfini; roll them into a single
lambda in the correct order. Their object argument turns into a
let block around each piece of code to bind that argument, like
had been done for :init and :postinit.
|
|
|
|
|
|
|
|
| |
* stdlib/struct.tl (defstruct): When an :init, :fini,
:postinit or :postfini has an empty body, do not push
it onto its corresponding list. Then later we don't
have to check for empty items when generating the code;
we know only non-empty items are on the lists.
|