| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
| |
* lib.c (get_current_package): If *package* contains
nonsense, then reset it to a sane value and throw
an exception.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register new intrinsics:
package-local-symbols, package-foreign-symbols, use-sym,
unuse-sym, use-package, unuse-package, unintern.
* gc.c (mark_obj): Mark new hidhash member of
struct package.
* lib.c (make_package): Initialize new hidhash
member of struct package.
(lookup_package): New static function.
(find_package): Allow string or symbol argument.
(get_package): New static function.
(delete_package, package_symbols): Use get_package for
flexible package argument; delete_package removes
symbols from other packages via unuse_package.
(package_local_symbols, package_foreign_symbols): New
functions.
(use_sym, unuse_sym): New functions.
(resolve_package_designators): New static function.
(use_package, unuse_package): New functions.
(symbol_present): New static function.
(intern): Revised with get_package for flexible
package argument.
(unintern): New function.
(rehome_sym): Use get_package. Semantics revised.
(obj_print_impl): Use symbol_present function to
determine whether object is visible in *package* and
can be printed without a prefix, rather than naive
home package test.
* lib.h (struct package): New member, hidhash.
(package_local_symbols, package_foreign_symbols, use_sym,
unuse_sym, use_package, unuse_package, unintern): Declared.
* txr.1: Documentation updated. Extended section introducing
the design of packages, and argument conventions. New
functions described. Existing function descriptions revised,
particularly rehome-sym. Missing description of
delete-package added.
|
|
|
|
|
| |
* lib.c (make_sym, make_package, intern): Check
that the name argument is a string.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (load): Rebind *package* in the local dynamic
environment already established for the sake of *load-path*.
By doing this we cause *package* to be restored to its
prior value, which allows the loaded file to alter it.
Common Lisp works this way.
(eval_init): Register *package* variable, with the
user package as its default value.
* lib.c (package_s): New symbol variable.
(intern, rehome_sym): Default the package argument to the
current package, not to user_package.
(get_user_package, get_system_package, get_keyword_package):
Functions removed.
(get_current_package): New function.
(obj_print_impl): Revise symbol printing. Keyword and
uninterned symbols are printed with : and #: prefixes.
The remainder are printed with a package prefix if their
home package isn't the current package.
* lib.h (keyword_package, user_package, system_package): These
macros are just straight aliases for the global
variables, not going through the lookup mechanism,
which was pointless.
(cur_package): New macro.
(package_s): Declared.
(get_current_package): Declared.
* lisplib.c (lisplib_try_load): Establish a local
dynamic environment, and bind the *package* variable
to the user package which the library modules expect.
* parser.c (find_matching_syms, provide_completions):
Treat unqualified symbols in the current package
rather than user package.
* parser.y (sym_helper): Intern unqualified symbols
in the current package, not user package.
* txr.1: Document that the variables user-package,
system-package and keyword-package should not be modified.
Document the *package* special variable, and that intern and
rehome-sym default their package argument to its value. (Here
we get rid of wrong references to the undocumented variable
*user-package*).
|
|
|
|
|
|
|
|
| |
* lib.c (obj_print): Check that print_circle_s has
been interned before trying to look it up as a variable.
Otherwise the auto-load code will be triggered, and try to use
a hash table that doesn't exist yet. This can happen when
this code is called during early initialization.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Two issues addressed here, both occurring when *print-circle*
is enabled and an object has struct components which have a
custom print method that re-enters the object printer.
One issue is that the children of these components which occur
just once print with spurious labels: like #3=, when no
matching #3# occurs. The other bug is a wrong "unexpected
duplicate object" exception caused by mismanagement of the
child object's label hash table and its merging with the parent.
* stream.h (struct stream_ctx): New member, obj_hash_prev.
Makes the parent hash table known to populate_obj_hash,
if there is a table, otherwise nil.
* lib.c (populate_obj_hash): If there is a parent table, check
each object in it. If it occurs, then bail. I.e. don't add
objects to the child table which occur in the parent. This
fixes both issues. Also, we do the unexpected duplicate object
check right here now: if we traverse an object that already
printed without a label (because it is not known to be
duplicate), that means that a custom print method is
inappropriately introducing new references to existing
objects, contrary to the rules. (obj_hash_merge): The logic
here is now simplified. All entries in the child table are
simply moved to the parent. If anything already exists, that
is an unexpected stuation indicating an internal problem,
turned into a variant of the unexpected duplicate object
message.
* tests/012/circ.tl: New file, giving tests for the bugs.
* tests/012/circ.expected: New file.
|
|
|
|
|
|
|
|
|
| |
* lib.c (circle_print_eligible): New inline function.
(obj_print_impl): Do not bother with hash lookup for
interned objects that don't participate in circle
notation.
(populate_obj_hash): Replace open-coded test with
call to circle_print_eligible.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
lib.c (tok_where) Implement new loop which suppresses
empty tokens immediately matching after non-empty
tokens. Old loop available under compatibility.
No documentation update needed since tok-where
is already documented as working like tok-str.
|
|
|
|
| |
* lib.c (tok_where): Just compare match_end == match_start.
|
|
|
|
|
|
| |
* lib.c (tok_where): Check that the regex match
succeeded before destructuring the result with
range_bind.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
* lib.c (obj_print): Only set up and tear down the
continuation-blocking unwind frame when doing circle
printing.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We have a bug in that when an exception occurs in a context
called from obj_print, the guard for stopping continuation
captures across obj_print also unintentially blocks the
unwinding. Let's make the unwinding blockage optional
* unwind.c (uw_unwind_to_exit_point): If a UW_GUARD is
encountered, do not abort if the uw_ok flag is set;
keep unwinding.
(uw_push_guard): New uw_ok argument, initializes the
uw_ok member of a guard frame.
* unwind.h (struct uw_guard): New struct type.
(union uw_frame): New member gu of type struct uw_guard.
(uw_push_guard): Declaration updated.
* ftw.c (ftw_callback): Pass zero as new uw_push_guard
argument: no unwinding across the POSIX library function ftw.
* glob.c (errfunc_thunk): Likewise, no unwinding across
the library function glob.
* lib.c (obj_print): Pass 1 as new uw_push_guard argument:
continuations can't be captured, but unwinding is okay.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
| |
* lib.c (epoch_time): New static function.
(time_parse): Default the struct tm to epoch.
* txr.1: Documented.
|
|
|
|
|
| |
* lib.c (obj_print): Applying a continuation guard
around the body of the function. This seems prudent.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Continuing on the theme of the previous patch, we now properly
detect the situation when the recursive call is re-introducing
duplicate references to objects that have already been sent to
the stream without at #<num>= label. It's too late to print
those objects, so we throw an exception.
* lib.c (obj_print_impl): When we print an object that doesn't
have duplicates (its hash entry has a nil value), we replace
that value with the : symbol to indicate that the object has
already been printed. (obj_hash_merge): New function,
factoring out the hash merging logic from obj_print,
introduced in parent commit. Here, we detect the case that the
recursive print call has submitted to us an object which was
already printed without a label: because it is associated with
the : symbol in the parent hash. This situation is a
show-stopper so we throw. We cannot attempt to print the
object in any manner because we can get into runaway
recursion.
(obj_print): Hash merging logic replaced with call to new
static function.
|
|
|
|
|
|
|
|
|
| |
* lib.c (obj_print): When invoked recursively in
circular printing mode, collect the nodes of the
new object into a separate hash table. Then
merge these entries into to the previous hash
table. If the newly visited object visits objects
we have already seen, suppress those entries.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
* lib.c (obj_print): The ret variable doesn't have to be
volatile qualified, because it is never modified after
setting an exception handler, and then accessed in the
cleanup. On the other hand, the ctx variable is
manipulated this way and must be volatile.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (obj_print_impl): On entry, ctx being non-null
indicates that cycle and substructure detecting is enabled via
*print-circle* for this print job. In this case, check
whether this is the first request to print a
multiply-referenced object, in which case we print the #<n>=
label definition, or whether it is a second or additional
reference, in which case we render the object as #<n>#.
Special handling must also be introduced into the loop which
prints list elements. At any point in a list, the rest of the
list could be shared substructure or a cyclic link that must
be rendered with the appropriate notation.
(populate_obj_hash): New static function. Enters all objects
in the substructure that are eligible for the circle notation
into the hash that is stored in the print context. Any object
that appears two or more times is associated with a t value.
(obj_print, obj_pprint): Unless circle printing is already in
effect, check *print-circle* and turn it on if necessary and
prepare the context, associating it with the stream. Either
way, if circle printing is enabled, call populate_obj_hash to
walk the object and add its components to the hash.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is some infrastructure which will support *print-circle*.
* lib.h (struct strm_ctx): Forward declared.
(struct cobj_ops): Add context parameter to print function
pointer.
(cobj_print_op, obj_print_impl): Add context parameter to
declarations.
* hash.c (hash_print_op): Take context argument and
pass it down in obj_print_impl calls.
* lib.c (cobj_print_op, out_quasi_str): Likewise
(obj_print_impl): Likewise, and also pass to
COBJ print method.
(obj_print, obj_pprint): Pass null pointer
as context argument to obj_print_impl.
* regex.c (regex_print): Take context parameter and ignore it.
* socket.c (dgram_print): Likewise.
* stream.h (struct strm_ctx): New struct type.
(struct strm_base): New ctx member, pointer to struct
strm_ctx.
(stream_print_op): Add context parameter to declaration.
(get_set_ctx, get_ctx): Declared.
* stream.c (strm_base_init): Add null pointer to initializer.
(strm_base_cleanup): Add assertion against context pointer
being non-null: that indicates that some stream operation
installed a context pointer and neglected to restore it to
null before returning, which is bad because context will be
stack allocated.
(stream_print_op, stdio_stream_print, cat_stream_print): Take
context parameter and ignore it.
(get_set_ctx, get_ctx): New functions.
* struct.c (struct_type_print): Take context parameter and
ignore it.
(struct_inst_print): Take context parameter and pass
down to obj_print_impl.
|
|
|
|
|
| |
* lib.c (reduce_left): init value pulled from
list itself must be passed through the key function.
|
|
|
|
|
|
|
|
|
|
| |
Ranges continue to be immutable; but a
backdoor is needed for upcoming support for
circular notation.
* lib.c (set_from, set_to): New functions.
* lib.h (set_from, set_to): Declared.
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (length_proper_list): New static function.
(length): Use length_proper_list for objects.
(sub): Call nullify on COBJ object before passing
to sub_list.
* tests/012/aseq.tl, tests/012/aseq.expected:
New files.
|
|
|
|
|
| |
* lib.c (where): Implement faster ref-based access for vectors
and strings. Support abstract sequence structs.
|
|
|
|
|
|
| |
* lib.c (in, sub, ref, search, rsearch, sel): These
functions now accept struct objects that have the
nullify, car and cdr methods.
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
| |
* lib.c (length, empty): Handle RNG in switch.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Makefile, args.c, args.h, arith.c, arith.h, cadr.c, cadr.h, combi.c,
combi.h, configure, debug.c, debug.h, eval.c, eval.h, filter.c,
filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c, glob.h, hash.c, hash.h,
jmp.S, lib.c, lib.h, lisplib.c, lisplib.h, match.c, match.h, parser.c,
parser.h, parser.l, parser.y, rand.c, rand.h, regex.c, regex.h,
share/txr/stdlib/awk.tl, share/txr/stdlib/build.tl,
share/txr/stdlib/cadr.tl, share/txr/stdlib/conv.tl,
share/txr/stdlib/except.tl, share/txr/stdlib/hash.tl,
share/txr/stdlib/ifa.tl, share/txr/stdlib/path-test.tl,
share/txr/stdlib/place.tl, share/txr/stdlib/socket.tl,
share/txr/stdlib/struct.tl, share/txr/stdlib/termios.tl,
share/txr/stdlib/txr-case.tl, share/txr/stdlib/type.tl,
share/txr/stdlib/with-resources.tl, share/txr/stdlib/with-stream.tl,
share/txr/stdlib/yield.tl, signal.c, signal.h, socket.c, socket.h,
stream.c, stream.h, struct.c, struct.h, sysif.c, sysif.h, syslog.c,
syslog.h, termios.c, termios.h, txr.1, txr.c, txr.h, unwind.c,
unwind.h, utf8.c, utf8.h: Revert to verbatim 2-Clause BSD.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We have a problem not handling negative list indices
which index beyond the beginning of the list.
Such accesses are just storing and retrieving the
first element!
* lib.c (listref): If a negative index is still negative
after the length of the list is added to it, then
return nil. Do not return car(list)!
(listref_l): Similary, do not return car_l(list) if
the index is less than zero, so that an error
occurs for an out-of-range negative index.
* txr.1: Update the documentation for ref
to describe these indexing constraints, and also
to include hashes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The sys:regex internal symbol was historically used when
derivative-based regexes had a S-exp representation headed
by that symbol. It had to be a private symbol.
Now the regex symbol is only used as the COBJ class type
for regexes; it makes no sense for it to be in the sys
package. We want user code to be able to refer to this
type using a public symbol.
* lib.c (obj_init): Intern the regex symbol stored
in regex_s in user_package.
* txr.1: Include regex in the type graph in the
Object Type section, and in the type list under
the typeof function.
|
|
|
|
|
|
|
|
| |
* lib.c (generic_funcall): Add case for regexes.
Handle arguments in such a way that the string is always
rightmost, with a view to convenient partial application.
* txr.1: Documented in multiple places.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (tok_str): Only continue the loop if
the new position isn't past the end of the string.
This fixes the problem of recognizing an empty
token past the last character in the string.
Also, advance new_pos by one if there is a zero
length match. Then don't advance pos by one later
in that case. This fixes the bug that we collect
empty separator pieces *and* empty tokens,
and also prevents empty matches before the first
character of the string. Logic in tok_str is now very similar
to that in split_str_keep.
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (split_str_keep): In the regex case, changing
to an infinite loop. The do/while is no longer needed because
the if statement includes a test of the position having
reached the end of the string. This is done before it is
incremented by len, so we avoid wrongly keeping a separator.
* txr.1: Clarified that an empty regex match
behaves like an sep which is an empty string,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register split-str to split_str_keep,
with optional argument.
* lib.c (split_str_keep): New function, formed from
split_str, with third argument.
(split_str): Reduced to wrapper around split_str_keep.
Thus we don't have to update umpteen existing calls
with an extra nil parameter.
* lib.h (split_str_keep): Declared.
* txr.1: Documented new optional argument of split-str.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (weave_while): Pass third arg to remq as nil.
(eval_init): Update registrations of remq, remql and
remqual.
* lib.c (remq, remql, remqual): Implement key function
argument.
* lib.h (remq, remql, remqual): Declarations updated.
* sysif.c (at_exit_call): Pass third arg to remq as nil.
* debug.c (debug): Pass third argument to remqual as nil.
* txr.1: Documentation updated.
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register keepq, keepql and keepqual
intrinsic functions.
* lib.c (keepq, keepql, keepqual): New functions.
* lib.h (keepq, keepql, keepqual): Declared.
|
|
|
|
|
|
|
|
| |
* lib.c (remq, remql, remqual, remove_if, keep_if): Bug:
functions don't work correctly for strings. Anyway,
the ldiff-based algorithm is ugly on vectors and strings.
Patching things upp by converting input to list with
tolist.
|
|
|
|
|
|
|
|
|
| |
* lib.c (trim_str): Trim only newlines and blanks,
not carriage returns, vertical tabs and form feeds.
This is subject to the compatibility option
* txr.1: Doc updated and compatibility note
added.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (time_parse_s): New symbol variable.
(tm_to_time_struct): New static function,
based on code moved out of broken_time_struct.
(broken_time_struct): Bulk of code replaced with call to
tm_to_time_struct.
(time_struct_to_tm): New parameter, strict. Indicates
whether nils in time struct are converted to zeros,
or whether they trigger errors.
(time_string_meth): Specify strict conversion
of argument time struct to to struct tm when
calling time_struct_to_tm.
(time_parse_meth): New static function.
(time_init): Initialize time_parse_s symbol variable;
add time-parse static slot to time struct;
initialize slot with new method.
* txr.1: Document time-parse method.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (time_string_s): New symbol variable.
(time_fields_to_tm, time_struct_to_tm): New static functions.
(make_time_impl): Replace bunch of code with call to
time_fields_to_tm.
(time_string_meth): New static function.
(time_init): Initialize time_string_s. Add time-string
static slot to time struct. Register time-string
method.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configure: Test for strptime.
* eval.c (eval_init): register time-parse intrinsic.
* lib.c (time_parse): New function.
* lib.h (time_parse): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
| |
* lib.c (out_quasi_str): New static function.
(obj_print_impl): Handle sys:quasi and sys:quasilist
forms, reproducing a syntax similar to their read
notation.
|
|
|
|
|
| |
* lib.c (split_str): Fourth argument of search_regex is
Lisp boolean, so nil should be used to specify false.
|
|
|
|
|
|
|
| |
* lib.c (vector, copy_vec, sub_vec, cat_vec): Set the type
field of the object sooner. Do not malloc between obtaining
the object, and initializing it, because that could throw,
leaving an uninitialized object in the heap space.
|