| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register neq, neql and nequal
intrinsics.
* lib.h (neq, neql, nequal): New inline functions.
* txr.1: Documented neq, neql and nequal
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
No longer require the leftmost expression in a dwim place to
itself be a place, except when the expression evaluates to
a list, and the list is subject to an element deletion or
a range operation.
* eval.c (eval_init): Register dwim-set and dwim-del with
one additional argument that the C functions now take.
* lib.c (dwim_set, dwim_del): Take a new place_p argument
which informs these functions whether the object they
are operating on came from a syntactic place. The forbidden
situations are diagnosed based on this flag: modification
of the subrange of a list, or deletion of a list ref.
Some error messages reworded.
* lib.h (dwim_set, dwim_del): Declarations updated.
* share/txr/stdlib/place.tl (defplace dwim): Produce a
different update, clobber and delete expansion when
the obj-place form isn't a place. In the non-place case,
do not assign the result of the sys:dwim-set or
sys:dwim-del operation back obj-place. Furthermore,
pass a Boolean flag to sys:dwim-set and sys:dwim-del
indicating which situation is the case: did the object
argument come from a place or non-place.
* txr.1: Documentation updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Change registration of dwim-set to only
one required argument, with the rest variadic.
* lib.c (lambda_set_s): New symbol variable.
(dwim_set): Change to variadic function that takes all
arguments other than the object/sequence being operated on as
struct args *. Rewrite to do a test on the object type first,
handling hashes and structs specially.
(obj_init): Initialize lambda_set_s.
* share/txr/stdlib/place.tl (defplace dwim): Rewritten for
more generic syntax. The only argument required is obj-place;
the other arguments are treated as a variable argument list,
all treated uniformly. This eliminates the special handling
of the default value for hash lookups.
* args.h (args_count): New inline function.
* txr.1: Updated documentation for dwim operator, which neglects
to mention use over objects thanks to the lambda function.
Documented lambda-set.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (looup_fun): Handle (meth ...) syntax.
* share/txr/stdlib/place.tl (sys:get-fb): Function
removed.
(sys:get-fun-getter-setter): New function.
(defplace symbol-function): Rework getter and
setter using new function which works for method
as well as regular function bindings.
* txr.1: Documentation updated in several places.
The mention of symbol-function in the list of place
forms altered so it doesn't insinuate that the argument
must be a symbol. Description of symbol-function
updated. Also under the trace and untrace macros,
a note added that tracing methods is possible.
|
|
|
|
|
|
|
| |
* txr.1: Fix description under fun operator which
says that a macro expander is available via
symbol-function. This is outdated; the symbol-macro
function accesses macro bindings.
|
|
|
|
| |
* txr.1: Only first word of heading is capitalized.
|
|
|
|
| |
* txr.1: Under pprof, *std-output* corrected to *stdout*.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
New variable *trace-output*, and macros trace and untrace.
* lisplib.c (trace_set_entries, trace_instantiate): new static
functions.
(dlt_register): Register new functions to auto-load trace
module.
* share/txr/stdlib/trace.tl: New file.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:awk-state): New slot, streams.
Holds hash table of open streams. New :fini finalizer
which closes all streams.
(sys:awk-state ensure-stream, sys:awk-state close-or-flush):
New methods.
(sys:awk-redir): New macro.
(sys:awk-let): Bind new local macros ->, ->>, <-, !> and !<.
(awk): Call finalizers on awk state to get all streams
to close.
* txr.1: Document new awk macros.
|
|
|
|
|
|
| |
* txr.1: Listing last, butlast, nthlast, butlastn, ref, sub,
hash-userdata, slot, qref, slot access dot notation,
and sock peer. Redundant listing of rest removed.
|
|
|
|
| |
* txr.1: Around half a dozen toplevel -> top-level edits.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The alet macro should always convert bindings to constants
into symbol macros; the all-or-nothing logic should be applied
to any remaining bindings.
* share/txr/stdlib/place.tl (sys:r-s-let-expander): Generalize
this function somewhat more by passing in the fallback binding
symbol to use for bindings that can't be turned into symbol
macros, instead of hard-coding them to let.
(rlset, slet): Specify 'let when calling sys:r-s-let-expander.
(alet): If there are any bindings with constantp init
expressions, then recurse: produce an expansion which
separates constantp from non-constantp using
sys:r-s-let-expander. Pass 'alet as fallback binding symbol;
thus the expansion will recurse back to alet, but without
all the constantp bindings, if there are any.
We then deal with those using the existing all-or-nothing
logic (which simplifies slightly since it doesn't have
to check for constantp any more).
* txr.1: Revised description of alet.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The problem is that when the regular expression
is capable of matching empty strings, tok-str
will extract an empty token immediately following
a non-empty token. For instance (tok-str "a,b" /[^,]*/)
extracts ("a" "" "b") instead of just ("a" "b").
This is a poor behavior and the way to fix it is to
impose a rule that an empty token must not be extracted
immediately at the ending position of a previous token.
Only a non-empty token can be consecutive to a token.
* lib.c (tok_str): Rewrite the logic of the loop,
using the prev_empty flag to suppress empty tokens
which immediately follow non-empty tokens. The
addition of 1 to the position when the token is empty
to skip a character is done at the bottom of the loop
and a new last_end variable keeps track of the end position
of the last extracted token for the purposes of extracting
the keep-between area if keep_sep is true. The old loop
is preserved intact and enabled by compatibility.
* tests/015/split.tl: Multiple empty-regex test cases for
tok-str updated.
* txr.1: Updated tok-str documentation and also added
a note between the conditions under which split-str and
tok-str, invoked with keep-sep true, produce equivalent
output. Added compatibility notes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (optimize_qquote_form): Pass nil to default
new argument of butlast.
(me_whilet, me_iflet_whenlet): Likewise for last.
(eval_init): Add optional argument to registration
of last and butlast intrinsics.
* lib.c (last, butlast): Support optional numeric
argument, like in Common Lisp.
* lib.h (last, butlast): Declarations updated.
* share/txr/stdlib/place.tl (last, butlast): New
place macros.
* txr.1: Updated documentation. The description of
last is now moved into the sequence functions
section.
|
|
|
|
|
|
| |
* share/txr/stdlib/place.tl (defplace sub): New place.
* txr.1: Document sub as accessor.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): register nthlast and butlastn
intrinsicis.
* lib.c (nthlast, butlastn): New function.
* lib.h (nthlast, butlastn): Declared.
* share/txr/stdlib/place.tl (defplace nthlast,
defplace butlastn): New places.
* txr.1: Documented nthlast and butlastn.
|
|
|
|
| |
* txr.1: Fix .code element in the middle of text.
|
|
|
|
|
|
| |
* txr.1: Description of ! hanging indent directive,
ironically, has wrong hanging indentation, due
to stray misplaced .RE.
|
|
|
|
|
|
|
|
| |
* checkman.txr (check-func): Check for excess elements in singular
heading. Add exception for headings that have Operator and macro.
* txr.1: Missing plural in chr-ixdigit and chr-xdigit heading.
Same in hash-begin and hash-next, plus missing desc.
|
|
|
|
|
|
|
| |
* lib.c (epoch_time): New static function.
(time_parse): Default the struct tm to epoch.
* txr.1: Documented.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
| |
* txr.1: Documenting circular notation and the *print-circle*
variable.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The print function now takes an optional boolean
for pretty printing.
The print method is also called with a third argument;
hence structures can customize both standard printing
and pretty printing.
* lib.c (obj_print): Take pretty argument, and pass it down
to obj_print_impl. This makes obj_pprint redundant.
(obj_pprint): Function removed: it was identical to obj_print
except for passing t down to obj_print_impl for the
pretty argument. These two wrappers had started small and
got bigger with identical changes done in parallel.
(pprint): New function.
(tostring, dump): Pass nil for pretty argument of obj_print.
(tostringp): Use pprint instead of obj_pprint.
* lib.h (obj_print): Declaration updated.
(obj_pprint): Declaration removed.
(print, pprint): Declared.
* eval.c (prinl): Pass nil for pretty_p argument of obj_print.
Do the stream defaulting here; obj_print doesn't do it.
(pprinl): Pass t for pretty_p argument of obj_print,
and do stream argument defaulting.
(eval_init): Register print to new print function rather
than directly to obj_print.
Register pprint to new pprint function rather than obj_pprint.
* hash.c (hash_print_op): Call obj_print_impl to print
the :equal-based keyword, rather than obj_print. Pass
down the pretty flag. All the other keywords are treated
this way; this fixes an inconsistency.
* match.c (dump_var): Call pprint instead of obj_pprint.
* stream.c (formatv): Call obj_print, with a calculated
pretty argument instead of switching between obj_pprint
and obj_print.
* struct.c (struct_inst_print): Except when in backward
compatibility mode, call the object's print method in both
pretty and regular printing mode, passing the mode as a third
argument.
* tests/012/oop.tl (defstruct animal): Support third argument
in print method. Make it optional because there are some
explicit calls which don't pass the argument.
* txr.1: Documentation updated for print method and the
print function. Revised text for some of the related
functions. Added compat notes.
|
|
|
|
|
| |
* txr.1: Fixed grammar error and added clarification
that the init-val isn't filtered through key-function.
|
|
|
|
|
| |
* txr.1: describe from and to expressions of
range literals.
|
|
|
|
| |
* txr.1: describe key-value pairs of hash literals.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The semantics of how struct literals come to life is poorly
designed: namely, the slot-value pairs in the struct literal
are used as the plist argument in a call to make-struct.
This is wrong because the implied initializations are then
clobbered by the structure type's :init and :postinit
handlers, resulting in an object with slot values that don't
match what is in the literal. When you add circular syntax
to the mix, things get worse. Slots may be initialized with
(sys:circ-ref ...) expressions corresponding to #<n># syntax.
These expressions then get clobbered by the constructor
actions before the circ_backpatch processes the syntax.
* parser.y (struct): Use make_struct_lit rather than
make_struct to instantiate struct object.
* struct.tl (sys:struct-lit): Expand to a form which calls
sys:make-struct-lit, rather than make-struct.
* struct.c (struct_init): Register new make_struct_lit
function as sys:make-struct-lit intrinsic.
(make_struct_lit): New function.
* struct.h (make_struct_lit): Declared.
* tests/012/struct.tl: struct literal expansion test case
updated.
* txr.1: Updated documentation of struct literals.
Added compat notes.
|
|
|
|
|
|
|
|
| |
* eval.c (env_fbind, env_vbind): Allow env to be
nil, indicating that the binding is to take
place in the global environment.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
| |
* txr.1: If a symbol macro expands to itself indirectly, the
result isn't a loop but runaway recursion.
|
|
|
|
|
| |
* txr.1: Updating awkward wording, beginning with clumsy
two-clause sentence joined by a colon.
|
|
|
|
|
| |
* txr.1: typeset print function name with .code so
it turns to typewriter font and hyperlink.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A static slot indicating the address family simplifies
code which wants to map a socket address to its
family.
* lisplib.c (sock_instantiate): Call sock_load_init
before loading socket.tl rather than after, because socket.tl
now references variables defined inside sock_load_init.
* share/txr/stdlib/socket.tl (sockaddr, sockaddr-in,
sockaddr-in6, sockaddr-un): New static slot, family.
* txr.1: Documented family slots.
|
|
|
|
|
|
| |
* txr.1: the nullify method need not return the object
itself in the non-empty case; it may also return
a sequence.
|
|
|
|
|
|
|
| |
* lib.c (find_max): Restructured to implement separately
for vectors and lists. Support hash tables.
* txr.1: Document find-min and find-max for hashes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The get-hash-userdata function is now deprecated in favor of
hash-userdata, which is an accessor.
* hash.c (hash_init): Register hash-userdata as a synonym
for the same function as get-hash-userdata.
* share/txr/stdlib/place.tl (hash-userdata): New defplace.
* txr.1: Document new accessor, marking get-hash-userdata as a
deprecated synonym. Replace references to get-hash-userdata
with references to hash-userdata.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* hash.c (userdata_k): New keyword symbol variable.
(hash_print_op): Print the userdata together with
the hash flags as :userdata obj.
(hashv): Parse out :userdata obj syntax from
the argument list. This takes care of supporting
it in the read notation and in the hash function.
(hash_init): Initialize userdata_k.
* txr.1: Documenting :userdata in hash
read notation and hash function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (gmtoff_s, zone_s): New symbol variables.
(tm_to_time_struct): Copy tm_gmtoff and tm_zone into
Lisp struct from struct tm, if the platform has these.
(time_fields_to_tm): Zero/null-out the tm_gmtoff
and tm_zone fields of the target structure, if the
platform has them.
(time_init): Intern the gmtoff and zone symbols,
initializing the gmtoff_s and zone_s variables.
Add the gmtoff and zone slots to the time struct.
* txr.1: Documented new slots.
|
|
|
|
| |
* txr.1: necessary -> necessarily
|
|
|
|
|
|
|
| |
* filter.c (regex_from_trie): New static function.
(filter_init): Register regex-from-trie intrinsic.
* txr.1: Documented regex-from-trie.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/struct.tl (meth): Take trailing arguments
and pass them down to method, which now accepts them.
* struct.c (struct_init): Register method intrinsic to the
function method_args instead of the method function.
(method_args_fun): New static function.
(method_args): New function. Behaves like method
function if args is empty, otherwise creates a function
by means of method_args_fun.
* struct.h (method_args_fun): Declared.
* tests/012/oop.tl: New test case.
* tests/012/oop.expected: Updated.
* txr.1: Documented new features in method and
meth, revising the documentation in the process.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/struct.tl (umeth): accept variadic
arguments. Evaluate them using the dwim brackets
and pass to umethod. The (fun umethod) trick is
used to refer to the umethod in the function namespace
even if it is shadowed by a variable.
* struct.c (struct_init): Update registration of umethod to
reflect its new variadic argument signature.
(umethod_args_fun): New static function.
(umethod): Return a function based on umethod_fun,
as before, if there are no variadic args. Otherwise,
use umethod_args_fun which deals with them.
* struct.h (umethod): Declaration updated.
* tests/012/oop.tl: Modest testcase for umeth
with curried argument.
* tests/012/oop.expected: Updated.
* txr.1: Updated documentation of umeth and umethod.
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
|
|
|
|
|
|
|
|
|
| |
* struct.c (replace_struct): If target and source
are the same object, just do nothing and return
target.
* txr.1: Document self-assignment and return
value of replace-struct.
|
|
|
|
|
|
| |
* txr.1: Where do is being introduced, fix a statement
that about op, which should be about do. Plus fix
verb agreement.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
| |
* txr.1: document that ranges are immutable
and expand the surrounding wording a bit.
|
|
|
|
|
| |
* txr.1: describe slot specifier as (name init-form)
rather than (symbol init-form).
|
|
|
|
|
|
| |
* lib.c (length, empty): Handle RNG in switch.
* txr.1: Documented.
|