| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
* lisplib.c (copy_file_set_entries): Register autoload for
touch.
* share/txr/stdlib/copy-file.tl (touch): New function.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (w_fopen_mode): Special handling via open and
fdopen is now required if either the m.notrunc or m.nonblock
is present. Since m.nonblock is just an option that can be
used with any open mode, we must handle the mode flags more
fully, to generate more possible combinations of open flags.
(do_parse_mode): Check for 'n', and set nonblock flag.
* stream.h (struct stdio_mode): New member, nonblock.
(stdio_moe_init_blank, stdio_mode_init_r,
stdio_mode_init_rpb): Update initalizers to set nonblock to
zero.
* txr.1: Documented, and also added missing i option to the
mode string syntax grammar summary.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* socket.c (sock_load_init): Register documented but
completely missing intrinsic variables shut-rd, shut-wr,
shut-rdwr.
* lisplib.c (sock_set_entries): Register autoload for shut-rd,
shut-wr, shut-rdwr.
* txr.1: In sock-shutdown description, fix shut-rw typo that
should be shut-wr.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The algorithm for weak processing is not correct. In
hash_mark, we must must simply not mark any of the entries,
keys or values, of a weak table regardless of what type of
weak table it is. If we do that, we cause spurious retention
in situations that the keys and values have some kind of link
together other than through the table. For instance, suppose
keys are weak, but values happen to have references to keys.
If we mark the values, we mark the keys and nothing will
expire from the table.
Such a situation happens in stream_parser_hash, which
associates streams with parsers, and has weak keys. Parsers
have references to streams. So entries in the hash never
expire. Any stream that gets a parser is retained forever.
The weak hashes used for binding in eval.c (top_vb, ...) are
also affected, because the key is some symbol <sym> and the
value is (<sym> . <val>). The key is weak, but the value
references the sym. So these hashes also will not expire the
keys: unreachable variable bindings will stick around.
* hash.c (hash_mark): If a hash table has weak keys,
values, or both, then only mark its vector if the count is
zero. If it has one or more entries, we just add it to the
reachable_weak_hashes list to be processed in do_weak_tables.
|
|
|
|
|
|
|
|
| |
* gc.c (gc_wrap): Takes argument for requesting full garbage
collection.
(gc_late_init): Update registration of gc intrinsic.
* txr.1: Documented.
|
|
|
|
| |
* txr.1: > should be >>.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/path-test.tl (do-path-test): Check also
for the argument being a stream, and pass to statfun.
* txr.1: Documentation updated and improved.
|
|
|
|
|
|
|
|
| |
* txr.1: The read and iread functions have an optional
parameter for overriding the starting line number. It is now
documented. read and lisp-parse got this parameter in 2015,
in TXR 123. iread was introduced with this parameter in
TXR 124.
|
|
|
|
|
| |
* txr.1: Replace "apperas to compiles" typo with better
wording.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When @(throw) generates a non-error exception that is
unhandled, we just want it to continue. In the same situation,
an @(assert) should behave as a failed match; that is, the
failure of the query material that follows the assert, which
activated it, should propagate through the assert.
* match.c (v_throw): Return next_spec_k if uw_rthrow
returns.
(v_assert, h_assert): Return nil if uw_rthrow returns.
* txr.1: Expanded @(throw) and @(assert) documentation with
discussion of unhandled exceptions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch makes a fundamental change in exception behavior.
Going forward, if an exception that is not derived from
error is not handled (no catch intercepts it, and no handler
accepts it) then the throw call simply returns nil to the
caller instead of unwinding and terminating the process.
For error exceptions, the behavior is the same: the
*uhandled-hook* is called, if it exists, and if it doesn't
exist or returns, unwinding and termination with diagnostics
ensues.
The rationale for not treating non-error exceptions fatally
is that this simplifies the use of code that throws exceptions
for non-error situations like progress updates. The code can
be used without the caller having to establish a handler.
* txr.1: Documentation updates and comaptibility notes.
* unwind.c (uw_rthrow): New returning throw function based on
the implementation of uw_throw.
(uw_rthrowv, uw_rthrowvf): New functions.
(uw_throw): Now a wrapper for uw_rthrow. Because uw_throw
still does not return, it calls abort if uw_rthrow
returns. uw_throw is used internally only for error
exceptions.
(uw_throwv, uw_throwfv): Functions removed.
(uw_late_init): Register throw and throwf to the
new functions uw_rthrowv an uw_rthrowfv.
* unwind.h (uw_rthrow, uw_rthrowv, uw_rthrowfv): Declared.
(uw_throwv, uw_throwfv): Declarations removed.
|
|
|
|
|
|
|
|
|
|
|
|
| |
txr-parse provides a way for Lisp code to programmatically
parse the TXR language and obtain the Lisp represenation.
This has hitherto not been available.
* eval.c (eval_init): Register txr-parse intrinsic.
* parser.c (txr_parse): New function.
* parser.h (txr_parse): Declared.
|
|
|
|
|
|
|
|
|
|
| |
* linenoise.c (edit): Handle Ctrl-F in extended mode so that
Ctrl-X Ctrl-F forces the line to be submitted without a
balance check.
* txr.1: Document previously undocumented balance check,
including the flashing exclamation mark. Document Ctrl-X
Ctrl-F.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The recent commit 7c40d5d6ef6832baed4a5ccd0a5d4235ed4f5ee3
states that the documentation has been updated. However,
it contains no changes to txr.1 at all. I swear I made
the changes, but they somehow disappeared. They are not
in my reflog or stash or any file in the filesystem. Gone!
Here, I reproduce those changes, with some additional
improvements and fixes.
* txr.1: Rewrite the description of Ctrl-D. Document the new
effect that major deletion operations all copy into the
clipboard. Fix "It's" typo that should be "Its".
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
* protsym.c: Regenerated.
|
|
|
|
| |
* txr.1: List tnode and tree types in typeof description.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Harmonizes with starts-with and ends-with.
* eval.c (eval_init): Register contains intrinsic.
* lib.c (contains): New function.
* lib.h (contains): Delared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The apf and ipf functions now take arguments in addition to
the function that is being wrapped. If specified, these
arguments are inserted to the left the applied arguments.
* eval.c (do_args_apf, do_args_ipf): New static functions.
(apf, ipf): Use do_args_apf and do_args_ipf, respectively,
for handling the case when arguments are present.
Passing the stored arguments is done with the help of the new
DARG type, instead of consing up a list.
* txr.1: Documented new arguments of apf and ipf.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
An object of args type captures into the heap the "struct
args" argument list that normally appears only on the stack.
Such an object also has space for a car and cdr field,
which can come in handy.
* args.c (dyn_args): New function: hoist a struct args *
into an args heap object.
* args.h (dyn_args): Declared.
* gc.c (finalize, mark_obj): Handle DARGS type code.
* hash.c (equal_hash): Handle DARG via eq equivalence.
* lib.c (args_s): New symbol variable.
(code2type): Map DARG to args symbol.
(equal): Handle DARG type, using eq equivalence for now.
(obj_init): Initialize args_s with interned symbol.
* lib.h (enum type, type_t): New type code, DARG.
(struct dyn_args): New struct.
(union obj): New member, a of type struct dyn_args.
* txr.1: Documented args type under typeof.
|
|
|
|
|
|
|
|
|
|
|
| |
* hash.c (hash_uni): New functional argument map1fun and
map2fun. If present, values from hash1 and hash2,
respectively, are projected through these functions.
(hash_init): hash-uni registration updated.
* hash.h (hash_uni): Declaration updated.
* txr.1: Documented new arguments.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* filter.c (tobase64url_k, frombase64url_k): New keyword
symbols variables.
(base64_stream_enc_impl): New static function, derived from
base64_stream_enc.
(base64_stream_enc): Now a wrapper for base64_stream_enc_impl.
(base64url_stream_enc, base64url_encode): New functions.
(base64_stream_dec_impl): New static function, derived from
base64_stream_dec.
(base64-stream_dec): Now a wrapper for base64_stream_dec_impl.
(get_base64_url_char, b64url_code): New static functions.
(base64url_stream_dec, base64_url_decode,
base64url_decode_buf): New functions.
(filter_init): Intern new keyword symbols, initializing the
corresponding variables, register new :frombase64url
and :tobase64url filters and intrinsic functions
base64url-stream-enc, base64url-stream-dec, base64url-encode,
base64url-decode and base64url-decode-buf.
* filter.h (base64url_stream_enc, base64url_stream_dec,
base64url_encode, base64url_decode, base64url_decode_buf):
Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (propagate-perms): New
function.
(compile-file-conditionally): If the source file is a hash
bang script, then call propagate-perms just before closing
the streams.
* txr.1: Documented the permission propagation.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Inequality comparisons of strings and symbols are broken due
to assuming that cmp_str returns -1 or 1. cmp_str uses the C
library function wscsmp, and is exposed as the Lisp function
cmp-str. That is correctly documented as returning a negative
or positive value. But a few function in lib.c assume
otherwise.
On newer glibc's, at least on x86, it seems that wcscmp
does return 1, 0 or -1 consistently; perhaps the newer
optimized assembly routines are ensuring this. It shows
up on older glibc installations where the C version just
returns the difference between the mismatching characters.
* lib.c (cmp_str): Now returns -1, 0 or 1.
* txr.1: Specify the stronger requirements on the cmp-str
return value, adding a note that older versions conform
to a weaker requirement.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
An option declared as (cumul <type>) indicates that it is of
type <type>, and that multiple occurrences of the option
produce values that are accumulated into a list.
The accumulation is in reverse order: the rightmost
occurrence ends up the first in the list.
* lisplib.c (getopts_set_entries): Add cumul to list of
interned symbols, so that the getopts.tl code isn't mistakenly
working with sys:cumul.
* share/txr/stdlib/getopts.tl (opt-parsed): New slot, cumul.
(opt-desc basic-type p, opt-desc list-type-p, opt-desc
cumul-type-p): New methods.
(opt-desc check): Rework type validity check using the new
methods.
(opt-parsed convert-type): Support 'cumul type by
instantiating an opt-parsed object for the wrapped type,
and stealing its converted argument into the current object,
and setting the cumul flag.
(opts add-opt, option-base add-opt): Support options that have
the cumul flag set by accumulating list values. The code is
different due to different amounts of encapsulation. The opts
structure stores the raw opt-parsed objects, whereas
option-base just takes the decoded values.
(opthelp): Parse through the (cumul ...) type syntax, so
cumulative options are printed in the help text the same way
as if they were non-cumulative.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If a and b are symbols, then it's possible for (equal a b),
(less a b) and (less b a) to all yield false, which makes
no sense. This happens in the case when a and b are distinct
symbols (thus not equal), and have the same name (so the
stringwise comparison finds them to be equal and hence
neither less than the other).
* lib.c (less): Implement more complicated requirements for
comparing symbols. If two distinct symbols have the same name,
then one must be less than the other, and we use other
information to determine this. If at least one of them has a
home package, then we go by comparing packages: package
names are compared as strings, and a missing package is less
than a present package. If both same-named symbols have no
package, then they are compared as pointers.
* txr.1: Documented the properties of less as an
antisymmetric, antireflexive and transitive relation.
Documented the relationship with equal. Documented the
treatment of symbols. Cleaned up some wording.
|
|
|
|
|
| |
* txr.1: Rewriting awkward language in overview of file
compilation.
|
|
|
|
| |
* txr.1: "refers to [a] processing step".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TXR Lisp is henceforth a dialect in which
(cdr (assq key a-list))
works exactly as shown, without substitution of
assql or assoc.
* eval.c (eval_init): Register assq and rassq intrinsics.
* lib.c (assq, rassq): New functions.
* lib.h (assq, rassq): Declared.
* txr.1: Documented.
* tests/012/ashwin.tl: New file.
* tests/012/ashwin.expected: New file.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register meq, meql an mequal intrinsics.
* lib.c (meq, meql, mequal): New functions.
* lib.h (meq, meql, mequal): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
| |
* parser.c (hist_save): New static function.
(repl): Logic for savingn history when terminating has
moved into hist_save. New save command also calls this
function.
* txr.1: Documented.
|
|
|
|
| |
* txr.1: doees -> does.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch addresses the problem of history loss that
occurs when a user juggles multiple TXR sessions that
all clobber the same history file.
* linenoise/linenoise.c (struct lino_state): New member,
loaded_lines, keeping track of how many of the lines in the
history came from loading the history file. Lines between
[0] and [loaded_lines - 1] are loaded lines. New lines
occur between [loaded_lines] and [history_len - 1].
(lino_hist_add): Reset loaded_lines to zero when creating
history for the first time. Not really necessary since the
structure starts zero-filled. When a line of history is
erased, then it must be a loaded line, unless loaded_lines
is zero. Thus, then decrement loaded_lines to account for a
loss of a loaded line, but don't decrement below zero.
(lino_hist_set_max_len): Setting the max length can cause
history to be trimmed, so we must adjust loaded_lines to
account for any loaded lines that get discarded.
(lino_hist_save): Takes a new parameter which indicates
whether to just save the new history by appending it to the
given file, or to overwrite the file with the entire history.
In either case, once we save the history, we assume that all
of our lines are loaded lines and set loaded_lines to
hist_len. In the future, this last step will help implement
incremental saving mid-way through a sesssion.
(lino_hist_load): Error out if there is already a history.
With this loaded_lines logic, it really wouldn't make sense to
read history more than once. After loading, set loaded_lines
to hist_len.
* linenoise/linenoise.h (enum lino_file_mode): New enumeration
lino_append.
(lino_hist_save): Declaration updated.
* parser.c (repl): Implement new history saving protocol.
The history file is read using a temporary instance of
linenoise, which has the effect of trimming it to the required
number of lines. This is written to a temporary file, to which
the newly entered lines are appended, and which is finally
renamed to replace the history file.
(lino_mode_str): Add "a" entry corresponding to lino_append.
(lino_open): Do the fchmod in the lino_append case also.
* txr.1: Documented the new handling of the history file.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Quite surprisingly ISO C lacks a way in fopen to open a file
for writing such that it is not truncated if it already
exists, and not opened in append mode.
(But you will be glad to know that ISO C is adding incredibly
useful features in this area, like Microsoft's fopen_s!)
Let us add modes "m" and "m+" which will be like "w" and "w+",
but without the truncation to zero length (no O_TRUNC
is passed to open).
* stream.c (w_fopen_mode): New static function.
(open_file, open_tail, tail_strategy): Use w_fopen_mode
instead of directly calling w_fopen.
(do_parse_mode): Handle 'm' and set new notrunc flag.
* stream.h (struct stdio_mode): New member, notrunc flag.
(stdio_mode_init_blank, stdio_mode_init_r,
stdio_mode_init_rpb): Initializer macros updated to include
initializer for notrunc flag.
* txr.1: Documented "m" mode.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Like file-put-buf but doesn't overwrite the file.
* lisplib.c (getput_set_entries): New autoload for
file-place-buf.
* share/txr/stdlib/getput.tl (file-put-buf): New
argument for seeking into the file.
(file-place-buf): New function.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* buf.c (buf_grow): Function removed; logic merged into
buf_do_set_len. The bug fixed is that buf_grow was
initializing just the newly allocated bytes to init_val. The
bytes that must actually be initialized are those which lie
between the old and new length, not in the allocated area.
(make_buf): In make_buf, we don't have to initialize the
entire buffer, but only bytes 0 through len - 1. Now
calloc is only used when the initializing value is zero,
and the buffer's allocation size is the same as the length.
When the length is increase to protrude into the allocated
uninitialized area, buf_do_set_len will now properly
initialize that to the value given at that time.
* txr.1: Update make-buf documentation not to say that
all the bytes of the buffer are initialized.
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/getput.tl (sys:get-buf-common): Take two
more arguments for maximum bytes to read and offset.
Read loop simplified with fill-buf-adjust.
(file-get-buf, command-get-buf): Take two new arguments,
pass though to sys:get-buf-common.
* txr.1: Documented.
|
|
|
|
|
| |
* txr.1: It is wrongly documented that file-get-buf and
comman-get-buf use text streams; they use binary streams.
|
|
|
|
|
|
| |
* txr.1: The fill-buf function returns the position
after the last byte that was read, not the position of
that that last byte.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* sysif.c (get_fd): Move this function higher in the file to
avoid forward declarations. The do_fstatt code being moved into
do_stat needs to call it.
(do_stat): Provide stat and fstat functionality in one
function.
(do_fstat): Static function removed.
(fstat_wrap): Call do_stat instead of do_fstat.
* txr.1: Updated.
|
|
|
|
|
|
| |
* txr.1: the Stream Output Limitation section is about the
mechanism to limit output, not about limits of capability;
the word we want is "Limiting".
|
|
|
|
|
| |
* txr.1: Fix reference to a nonexistent stream-fd function;
the correct name is fileno.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The chmod function can now take a string, which uses the same
conventions as the symbolic mode argument of the chmod utility.
* sysif.c (CHM_O, CHM_G, CHM_U): New preprocessor symbols.
(enum chm_state, enum chm_op): New enums.
(chmod_wrap): Allow argument to be a string, and in that case
interpret the chmod symbolic permission language.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (copy_file_set_entries): Add chown-rec and
chmod-rec to list of symbols that trigger auto-load of
copy-file.tl.
* share/txr/stdlib/copy-file.tl (chmod-rec, chown-rec): Neew
functions.
* txr.1: Documented.
|
|
|
|
|
| |
* txr.1: The catch section fails to mention the catch**
operator in the section heading.
|
|
|
|
| |
* txr.1: fix repeated word.
|
|
|
|
|
|
|
|
| |
* txr.1: Fix wrong documentation about defex. It does allow
registration of duplicate relationhips and updates that
do not create cycles. Document a rule that is missing: that
a subtype relationships can't be registered when the opposite
relationship already exists.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On 2009-10-02, prior to TXR 014, I made a change to the c_str
function to allow symbolic arguments, so that c_str(sym) could
be used in the code base instead of c_str(symbol_name(sym)).
This was a bad idea, and is allowing numerous functions that
operate on strings to accept symbols also. That behavior is
not documented and not consistently supported. Ironically, I
completely forgot about this and have been consistently using
symbol_name(sym) anyway. Let us remove this.
Compat support is required because this will break user code
that accidentally depends on this undocumented behavior.
* lib.c (c_str): If the object is type SYM, only return the
symbol_name if compatibility with 231 or older is requested,
otherwise fall through to the error case.
* match.c (dump_var): Fix one case where a symbol is passed
directly to put_string. This fails one of the test cases.
More testing is required to see if any other such cases occur.
* txr.1: New entry in the compatibility notes.
|