| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/getopts.tl (opthelp): Use a different line
breaking approach for literals: the escaped space is now at
the end of the previous line, rather than at the start of the
next line, which looks nicer. We don't do this for the option
type legend, because that has some instances of leading space
alignment, which requires a leading backslash.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This provides more streamlined option processing.
* lisplib.c (getopts_set_entries): Add auto-load entry for
define-option-struct.
* share/txr/stdlib/getopts.tl (define-option-struct): New
macro.
* txr.1: Documented.
|
|
|
|
|
|
|
|
| |
* txr.1: Document that in the parsed opts object returned by
getopts, an option which has two names (long and short form)
is indexed under both names if it has occurred in the command
line, regardless of whether it has occurred under the short or
long name.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The reason for this rename is that add is a public symbol in
the usr package, thanks to the build macro. This will
interfere with an upcoming feature under which options appear
directly as struct slots, defined by symbols. If a user
defines an --add option using the symbol add, it will clash
with the add method. But add-opt will be sys:add-opt.
* share/txr/stdlib/getopts.tl (opts add): Rename to add-opt.
(sys:opt-processor parse-long, sys:opt-processor
parse-shorts): Follow rename.
|
|
|
|
|
|
|
|
|
| |
* lib.c (intern_fallback_intrinsic): The missing_ok parameter
of get_package must be given a true argument, because
package_in is optional. When it is missing, it is represented
by the colon symbol, and if missing_ok is false, then
get_package treats this colon symbol as the package name ""
(the name of that symbol).
|
|
|
|
|
| |
* lib.c (intern_fallback, intern_fallback_intrinsic): Use
intern-fb name, not intern-fallback.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The methods of sys:opt-processor pass down an argument called
out which is an opts instance that is created in parse-opts.
In this patch, we move that argument into a new slot of the
sys:opt-processor object, named opts. We instantiate the opts
structure in the getopts function instead. The motivation here
is that (meth sys:opt-processor parse-opts) doesn't know which
type of opts object it is working with; its user is now
responsible for instantiating the object and installing it as
the opts slot.
* share/txr/stdlib/getopts.tl (sys:opt-processor): New
slot, opts.
(sys:opt-processor (parse-long, parse-shorts): Drop out
argument; refer to me.opts instead of it.
(sys:opt-processor parse-opts): Don't instantiate opts object
here, and don't pass it to parse-long and parse-shorts which
no longer take that argument. Rather, rely on it already being
installed into the opts slot.
(getopts): Instantiate opts here, and specify it as the opts
slot of the sys:opt-processor object also being instantiated
here.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/getopts.tl (opts): opt-processor slot
removed.
(sys:opt-processor parse-opts): When instantiating opts, do
not initialize the opt-processor slot with a backpointer to
self object. It is not referenced anywhere.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/getopts.tl (opthelp): Use symbol-name to
get the string representation of type keywords instead of
tostringp, so there is no leading colon. In the type legend,
we don't have any colon. For instance --gravity=FLOAT rather
than --gravity=:FLOAT.
|
|
|
|
|
|
| |
share/txr/stdlib/getopts.tl (sys:opt-processor build-hash):
Don't construct (list od.long od.short) twice and iterate
through it twice; make just one and process it in one pass.
|
|
|
|
|
| |
* txr.1: Under deffi-cb, correcting a reference to
nonexistent ff-make-callback to ffi-make-closure.
|
|
|
|
|
|
|
|
|
|
| |
* parser.c (is_balanced_line): When handling the closing
characters, we must look for the state type which matches the
character type, not state[sp]. Of course state[sp] == match,
since we initialized it that way, and so state[sp] != match
is always false. We want match to be derived from the
character ch, not from state[sp]. Also, the polarity in the
match-not-found return case is wrong; we must return 0.
|
|
|
|
|
| |
* lib.c (car, cdr, rplaca, rplacd, make_like): Handle
BUF type.
|
|
|
|
|
|
|
|
|
| |
* buf.c (buf_list): New function.
(buf_init): buf-list intrinsic registered.
* buf.h (buf_list): Declared.
* txr.1: Documented.
|
|
|
|
|
|
| |
* parser.y (hash_semi_or_n_expr, hash_semi_or_i_expr): We need
to handle OREFDOT here so that .?sym can parse as a
top-level expression. Issue reported by vapnik spaknik.
|
|
|
|
|
|
| |
* parser.y (yybadtoken): Add missing cases for UREFDOT,
OREFDOT and UOREFDOT, so these don't fall through to
being reported as a junk character.
|
|
|
|
|
| |
* parser.y (yybadtoken): Merge CONSDOT and LAMBDOT cases since
they have identical code.
|
|
|
|
|
|
|
| |
* txr.1: Update outdated documentation. macro-date is not
required any more in the indicated situations. But it can
still be required sometimes, and has some interesting uses.
More detail added.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
* protsym.c: Likewise.
|
|
|
|
|
| |
* lib.c (identity_star): The args_more function requires
an index which is a cnum, not int.
|
|
|
|
|
| |
* hash.c (hash_reset): Clear the whole structure, not
just a pointer-sized region at its base.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (carray_unum, carray_num, unum_carray, num_carray):
Functions renamed to carray_uint, carray_int, uint_carray,
int_carray.
(ffi_init): Functions registered under new names:
carray-uint, carray-int, uint-carray, int-carray. Compat
values of 227 or less provide the old old names.
* ffi.h (carray_unum, carray_num, unum_carray, num_carray):
Declarations renamed.
* txr.1: Updated to new names; compat note added.
|
|
|
|
|
|
| |
* share/txr/stdlib/op.tl (sys:op-expand): The compatibility
version check should be against 225, not against the not
yet existent 255.
|
|
|
|
|
| |
* ffi.c (carray_num): Use the correct name carray-num rather
than carray-unum in diagnostics.
|
|
|
|
|
| |
* txr.1: The word "times" appeared in place of "types".
Reported by vapnik spaknik.
|
|
|
|
|
|
|
| |
* txr.1: User vapnik spaknik pointed out the poor
documentation for apf, which stated that it takes one argument
which is a list, when in fact it more generally takes
and works with apply-like arguments.
|
|
|
|
|
|
| |
* txr.1: Fix copy and paste errors affecting flo-zero,
struct sockaddr-in6, sockaddr-unix and sock-bind.
Reported by user vapnik spaknik.
|
|
|
|
|
| |
* txr.1: Fix incorrect return value. Reported by user
vapnik spaknik.
|
|
|
|
|
|
| |
* txr.1: Fix wording that refers to first argument as the
second argument. It is the second form element, of course,
but the first argument. Reported by user vapnik spaknik.
|
|
|
|
|
| |
* txr.1: Use .mets instead of .meti on the syntax; this
produces an indentation.
|
|
|
|
|
|
|
|
|
| |
* buf.c (buf_int, buf_uint, int_buf, uint_buf): New static
functions.
(buf_init): buf-int, buf-uint, int-buf and uint-buf intrinsic
functions registered.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The eval function uses a null macro environment for expanding
a form, even when it's given an environment object. This
causes spurious warnings about unbound variables/functions.
For instance:
(let ((env (make-env '((x . 42)) nil nil)))
(eval '(+ x x) env)) ;; warning: unbound variable x
To fix this, we have to create a macro version of the
incoming environment and expand with that.
* eval.c (env_to_menv): Take an evaluation environment chain
and convert it to a (flattened) macro environment.
(expand_eval): Take a macro environment parameter and use
that for expanding the form to be evaluated, rather than nil.
(eval_intrinsic): Calculate a macro environment corresponding
to the given evaluation environment. Use that for the
macroexpand call, and also pass it down to expand_eval
to be used for the full expansion.
|
|
|
|
|
|
|
|
|
| |
* gc.c (sweep): The new logic for removing a deleted
heap's blocks from the free list must correctly maintain
free_tail. Whenever a node is deleted which is the tail node,
the tail pointer must move to the parent's tail field, or to
the free_list pointer. We don't need to do anything afterward
for the free_list == 0 case; that is taken care of.
|
|
|
|
|
|
|
|
|
|
| |
Since sweep can delete heaps now, it's possible that the
bounding box may be tightened. Since we are iterating over all
heaps, we can just recalculate it.
* gc.c (sweep): Recalculate the heap boundaries using local
variables, taking care to exclude any heap that is being
deleted. Then update the globals.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On glibc, our heap allocation requests are considered
large and handled via mmap; when we free a heap, the memory
is returned to the OS via munmap.
* gc.c (sweep): If every object in a heap is freed,
we free the entire heap, taking care to also reset the free
list to the state before those objects were added to it.
The free list may still contain objects from that same heap
that were not just added to it (they were freed in a previous
GC pass), so we must walk the free list to find the remaining
objects and remove them. The Valgrind debugging logic (opening
access and closing while walking the list) was too cumbersome
so it's done in two passes: open access to the whole free
list, process it, close off what is left.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (open_subprocess): new function, formed by adding
fun argument to open_process. Since the program name can be
nil now, in which case argv is not allocated, the code must
be careful not to access argv if it is null.
(open_process): Reduced to trivial wrapper around
open_subprocess.
(stream_init): open-subprocess intrinsic registered.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the mode-string of open-process, I/O redirections can now
be specified that are carried out in the child process.
* stream.c (do_parse_mode): Parse the redirection syntax
indicated by >, which has a short and long form.
The redirections are entered into a small table in the mode
structure.
(open_process): In the child process, perform the redirection
specified in the mode structure's redirection table.
* stream.h (STDIO_MODE_NREDIRS): New preprprocessor symbol.
(struct stdio_mode): New array member, redir.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a regression introduce in the 2019-06-09 commit
4f33b169dc547b7f9af6f2f1c173d36fc4d62fe8 "Adding fcntl
interface." which changed HAVE_FCNTL_H to HAVE_FCNTL
in the configure script, without making the same change
in stream.c.
* stream.c: Replace HAVE_FCNTL_H with the correct
HAVE_FCNTL, so that we're once again actually including
the <fcntl.h> header now, and setting the close-on-exec
flag on the pipe in open-process.
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (sys:env postinit): The
the initialization of me.lev becomes more succinct.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (obj_print_impl): Render the new syntactic conventions
introduced in qref/uref back into the .? syntax. The printers
for qref and uref are united into a single implementation to
reduce code proliferation.
* parser.l (grammar): Produce new tokens OREFDOT and UOREFDOT.
* parser.y (OREFDOT, UREFDOT): New terminal symbols.
(n_expr): Handle .? syntax via the new OREFDOT and UOREFDOT
token via qref_helper and uoref_helper. Logic for the existing
referencing dot is moved into the new qref_helper function.
(n_dot_expr): Handle .? syntax via uoref_helper.
(uoref_helper, qref_helper): New static functions.
* share/txr/stdlib/struct.tl (qref): Handle the new case when
the expression which gives the object is (t expr).
Handle the new case when the first argument after the object
has this form, and is followed by more arguments. Both
these cases emit the right conditional code.
(uref): Handle the leading .? syntax indicated by a leading t
by generating a lambda which checks its argument for nil.
Transformations to qref handle the other cases.
* txr.1: Documentation updated in several places.
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/path-test.tl (path-strictly-private-to-me):
Fix mistake in test whether the file is group
readable/writable. The wrong flag is used for group
readability test, which means that, at that point in the
logic, if the file is merely not group writable, we jump to
the conclusion that the file is strictly private, when in fact
it may be group readable. Reported by user vapnik spaknik.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reported by user vapnik spaknik, who discovered the
path-symlink-p function yielding a false positive
on a regular file. The functions in this group are
bit testing rather than extracting a bitfield and
checking the enumerated value.
* share/txr/stdlib/path-test.tl (sys:path-test-type): New
function.
(path-file-p, path-dir-p, path-symlink-p, path-blkdev-p,
path-chrdev-p, path-sock-p, path-pipe-p): Use
sys:path-test-type rather than sys:path-test-mode.
|
|
|
|
|
|
|
|
|
| |
* hash.c (hash_reset): New function.
(hash_init): hash-reset intrinsic registered.
* hash.h (hash_reset): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (op_dohash): Use hash_iter instead of consing up
heap-allocated hash iterator.
* filter.c (trie_compress, regex_from_trie): Likewise.
* hash.c (hash_equal_op, hash_hash_op, hash_print_op):
Likewise.
* lib.c (package_local_symbols, package_foreign_symbols,
find_max, find_if, rfind_if, populate_obj_hash): Likewise.
* parser.c (circ_backpatch, get_visible_syms): Likewise.
* struct.c (method_name, get_slot_syms): Likewise.
|
|
|
|
|
|
|
|
|
|
| |
* hash.c (struct hash): Declaration removed from here.
(hash_iter_init, us_hash_iter_init, hash_iter_next,
hash_iter_peek): Functions switched to external linkage.
* hash.h (struct hash): Declared here now.
(hash_iter_init, us_hash_iter_init, hash_iter_next,
hash_iter_peek): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Most calls to hash_iter_next are passing a null parameter
for the object; only hash_next uses that parameter.
Let's make hash_iter_next a wrapper which doesn't have
that parameter.
This interface will soon be exposed to other source files, so
it's important to streamline it.
* hash.c (hash_iter_next_impl): New function, exact copy of
hash_iter_next.
(hash_iter_next): Reduced to wrapper for hash_iter_next_impl,
with one less argument.
(hash_next): Call hash_iter_next_impl instead of
hash_iter_next.
(maphash, group_by, group_reduce, hash_uni, hash_diff,
hash_symdiff, hash_isec, hash_subset, hash_update,
hash_revget, hash_invert): Remove null argument from
hash_iter_next calls.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We introduce the function c_time to convert a Lisp integer
to time_t, and num_time to do the reverse conversion.
The FFI type time-t already does this right.
(See registration of time-t in ffi_init_extra_types).
* hash.c (gen_hash_seed): The first value out of time_sec_usec
corresponds to a time_t value. We now convert this to C number
using c_time rather than c_num. Also, while we are touching
this code, the microseconds value can convert directly to
ucnum with c_unum.
* lib.c (time_sec_usec): Use num_time for seconds.
(time_string_local, time_string_utc, time_fields_local,
time_fields_utc, time_struct_local, time_struct_utc): Use c_time.
(make_time_impl, time_parse_utc): Use num_time instead of num.
* signal.h (getitimer_wrap, setitimer_wrap): Convert tv_sec
members of struct timeval using c_time and num_time.
* sysif.c (c_time, num_time): New functions.
(stat_to_struct): Convert st_atime, st_mtime and st_ctime
to Lisp using num_time instead of num.
* sysif.c (c_time, num_time): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Issue: (sys:lisp1-value x) throws a warning even if x is a
predefined library function. This is caused by naively using
expand to attempt to expand it as a symbol macro.
* eval.c (expand_lisp1_value): Use expand_lisp1 instead of
expand, just like expand_forms_lisp1. Because I didn't notice
this problem when adding those two functions, expand_lisp1 is
farther down the file and we need a forward declaration.
(expand_lisp1_setq): Likewise, and eliminate the unbound
variable check which is done by expand_lisp1.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* hash.c (hash_iter_init, us_hash_iter_init, hash_iter_next,
hash_iter_peek): New static functions, made from hash_begin,
hash_next and hash_peek internals.
(hash_begin, hash_next, hash_peek): Turned into wrappers for
hash_iter_init, hash_iter_next, hash_iter_peek.
(maphash, group_by, group_reduce, hash_uni, hash_diff,
hash_symdiff, hash_isec, hash_subset, hash_update,
hash_revget, hash_invert): Use stack-allocated struct
hash_iter instead of heap allocated object from hash_begin.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configure (have_sys_stat): New variable. Set to y when our
test detects <sys/stat.h>. New test added for the presence of
high resolution time stamps in struct stat. If we have these,
we #define HAVE_STAT_NSEC 1 in config.h.
* share/txr/stdlib/path-test.tl (path-newer): Compare
nanosecond parts of the modification time if the seconds are
equal, improving the resolution of the test.
* sysif.c (atime_nsec_s, mtime_nsec_s, ctime_nsec_s): New
symbol variables.
(stat_to_struct): If nanosecond resolution is available, set
the new nanosecond slots from the three tv_nsec fields in
struct stat. Otherwise, set the new slots to zero.
(sysif_init): Initialize the new symbol variables. Add the
three new slots to the stat struct.
* sysif.c (atime_nsec_s, mtime_nsec_s, ctime_nsec_s):
Declared.
* txr.1: Documented new atime-nsec, mtime-nsec and ctime-nsec
slots of stat structure. Added note to path-newer mentioning
high resolution support.
|