| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
CPTR shares representation and a lot of implementation with
COBJ. The COBJ class symbol is the CPTR type tag. There is no
hierarchy among CPTR tags. The nil tag is used for a modicum
of type looseness, so that we don't straitjacket ourselves
too much into this tag-based typing scheme.
All existing cptr objects are becoming CPTR, and all
get a nil tag, except for dlopen library handles, and
dlsym symbols, which are tagged as dlhandle and dlsym.
The FFI framework will support tag-declared cptr's. This will
help with safety. For instance, suppose an API has half a
dozen different kinds of opaque handles. If they are all just
cptr on the TXR Lisp side, it's easy to mix them up, passing
the wrong one to the wrong C function.
* lib.h (enum type): New enum member, CPTR.
(cptr_print_op, cptr_typed, cptrp, cptr_type, cptr_handle):
Declared.
(cptr_addr_of): Parameters added.
* lib.c (code2type): Map CPTR type code to cptr_s.
(equal): Handle CPTR objects. They are only equal to other
CPTR objects which have the same operations, and
are equal under the equal function of those operations.
(cptr_print_op): New function.
(cptr_ops): Use cptr_print_op rather than cobj_print_op.
(cptr_typed): New function.
(cptr): Use cptr_typed to make a cptr with tag nil,
rather than using cobj.
(cptrp, cptr_handle, cptr_type): New functions.
(cptr_get): Go through cptr_handle rather than cobj_handle.
(cptr_addr_of, cptr_zap, cptr_free): Use call to cptr_handle
rather than cobj_handle for the type checking side effect.
New parameters for type and parent function name.
(obj_print_impl): Handle CPTR with same case as COBJ.
* gc.c (finalize, mark_obj): Handle CPTR cases using
common code with COBJ.
* hash.c (equal_hash): Handle CPTR just like COBJ.
* eval.c (eval_init): Register cptrp and cptr-type intrinsic
functions.
* ffi.c (ffi_cptr_put, ffi_cptr_get, ffi_cptr_alloc): Use the
potentially type-safe cptr_handle, instead of cptr_get.
However, for an untagged cptr, there is no type safety because
tft->mtypes is nil. The argument can be any kind of cptr.
* sysif.c (dlhandle_s, dlsym_s): New symbol variables.
(cptr_dl_ops): Use cptr_print_op.
(dlopen_wrap, dlclose_wrap): Use typed cptr with
dlhandle as the type.
(dlsym_wrap, dlsym_checked, dlvsym_wrap, dlvsym_checked):
Recognize only a cptr of type dlhandle for the library.
Construct a typed cptr of type dlsym.
(sysif_init): Initialize dlhandle_s and dlsym_s.
Register dlsym function using dlsym_s.
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (less_tab_init): The type_prec table initialization
will become incorrect if new type enums are added other than
at the end. Let's switch to assignments. Anything not
mentioned is zero.
* lib.h: Add more advice to comment about extending type_t:
consider all places where MAX_TYPE is used.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since cptr objects are equal if their handles are equal, they
must have a hashing function over the handle rather than over
their own address.
* lib.c (cobj_handle_hash_op): New function.
(cptr_ops): Use cobj_handle_hash_op instead of
cobj_eq_hash_op.
* lib.h (cobj_handle_hash_op): Declared.
* sysif.c (cptr_dl_ops): Use cobj_handle_hash_op instead of
cobj_eq_hash_op.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Renaming cobj_hash_op to cobj_eq_hash_op. This function is
only appropriate to use with COBJ objects which use
eq as their equal funtion. I've spotted one instance of an
inappropriate use which have to be addressed by a different
commit: the equal function is other than eq, but cobj_hash_op
is used for the equal hash.
* lib.h (cobj_hash_op): Declaration renamed to
cobj_eq_hash_op.
* hash.c (cobj_hash_op): Renamed to cobj_eq_hash_op.
(hash_iter_ops): Refer to renamed cobj_hash_eq_op.
* ffi.c (ffi_type_builtin_ops, ffi_type_struct_ops,
ffi_type_ptr_ops, ffi-closure_ops, ffi_call_desc_ops):
Likewise.
* lib.c (cptr_ops): Likewise.
* parser.c (parser_ops): Likewise.
* rand.c (random_state_ops): Likewise.
* regex.c (char_set_ops, regex_obj_ops): Likewise.
* socket.c (dgram_strm_ops): Likewise.
* stream.c (null_ops, stdio_ops, tail_ops, pipe_ops, dir_ops,
string_in_ops, byte_in_ops, strlist_in_ops, string_out_ops,
strlist_out_ops, cat_stream_ops, record_adapter_ops):
Likewise.
* struct.c (struct_type_ops): Likewise.
* sysif.c (cptr_dl_ops): Likewise.
* syslog.c (syslog_strm_ops): Likewise.
* unwind.c (cont_ops): Likewise.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register cptr-int, ctpr-obj, cptr-zap
and cptr-free functions and cptr-null variable.
* lib.c (cptr_int, cptr_obj, cptr_zap, cptr_free): New
functions.
* lib.c (cptr_int, cptr_obj, cptr_zap, cptr_free): Declared.
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (struct txr_ffi_type): New bitfield flag, bchar_conv.
(ffi_array_in, ffi_array_get): Handle bchar_conv.
(ffi_type_compile): Set bchar_conv flag for array of bchar.
* lib.c (string_8bit_size): New function.
* lib.h (string_8bit_size): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The bstr type is like str, but doesn't perform UTF-8
conversion. The C data is assumed to be null terminated byte
strings representing code points U+0000 through U+00FF.
* ffi.c (bstr_s, bstr_d_s): New symbol variables.
(ffi_bstr_put, ffi_bstr_get, ffi_bstr_d_get): New static
functions.
(ffi_init_types): Register bstr and bstr-d types.
(ffi_init): Initialize bstr_s and bstr_d_s.
* ffi.h (bstr_s, bstr_d_s): Declared.
* lib.c (chk_strdup_8bit, string_8bit): New function.
* lib.h (chk_strdup_8bit, string_8bit): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (ffi_ptr_alloc): New static function.
(ffi_type_compile): Give the cptr type alloc and free
functions: alloc just retrives the address of the pointer
inside the cptr object (pointer to pointer); free is a noop.
(cptr_make): New static function.
(ffi_init): Register cptr_make as cptr intrinsic. Register
cptr-null intrinsic variable denoting a ready-made null
pointer.
* lib.c (cptr_addr_of): New function.
* lib.h (cptr_addr_of): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configure: New test for dlopen.
* lib.c (cptr_equal_op): Function renamed to
cobj_equal_handle_op, to reflect what it's really
doing; it is not specifically to cptr objects.
Also changed from static to extern.
(cptr_ops): Follow rename.
* lib.h (cobj_equal_handle_op): Declared.
* sysif.c (cptr_dl_destroy_op): New static function.
(dlopen_wrap, dlclose_wrap, dlsym_wrap, dlvsym_wrap): New
static functions.
(sysif_init): Register new intrinsic functions dlopen,
dlclose, dlsym, dlvsym. New variables rtld-lazy, rtld-now,
rtld-global, rtld-local, rtld-nodelete, rtld-noload,
rtld-deepbind.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Unsigned version of cnum becomes less verbose.
* arith.c (c_uint_ptr_num): Renamed to c_unum.
* arith.h (c_uint_ptr_num): Declaration removed.
(c_unum): Declared.
* itypes.c (c_u32, c_u64, c_uint): Follow rename.
* lib.h (ucnum): New typedef.
* rand.c (make_random_state): Follow rename.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Work in progress.
* gc.c (finalize): Add cast to switch expression so gcc
flags when we are missing one of the enumerations.
Handle new BUF enum to free dynamic buffers.
(mark_obj): Mark len and size fields of buf, in case
they aren't just nil or integers.
* hash.c (hash_buf): New static function.
(equal_hash): Route BUF type to hash_buf.
* lib.c (buf_s): New symbol variable.
(code2type): Handle BUF.
(equal): Handle BUF using memcmp on the data.
(obj_init): Intern buf symbol and initialize buf_s.
* lib.h (type_t): New enum member BUF.
(struct buf): New type.
(union obj): New member b, of struct buf type.
(buf_s): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register intrinsic functions
time-parse-local and time-parse-utc.
* lib.c (strptime_wrap): New static function.
(time_parse): Now implemented as by call to strptime_wrap.
(time_parse_local, time_parse_utc): New functions.
These get the time_t time from struct tm without
constructing the intermediate Lisp structure.
* lib.h (time_parse_local, time_parse_utc): Declared.
* txr.1: Documented new functions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When completing .prefix[TAB], .(prefix[TAB] or .[prefix[TAB],
restrict identifiers to the appropriate namespace. The former
will report only symbols from the relevant package which are
struct slots; the latter further restricts it to those which
are static slots defined as functions.
* lib.c (symbol_visible): Static function becomes extern.
* lib.h (symbol_visible): Declared.
* parser.c (find_matching_syms): par parameter is renamed
kind and can hold additional values 'S' (slots) and 'M'
(methods). New get_slot_syms function is used to fetch the
slots, as necessary, instead of the visible syms, if the
kind is 'S' or 'M'. The same loop as before (with the minor
change of recognizing 'S' and 'M' also) performs the prefix
matching.
(provide_completions): Recognize . .( and .[ prefix,
calculating the kind argument of find_matching_syms in
a new way.
* struct.c (get_slot_syms): New function.
* struct.h (get_slot_syms): Declared.
* txr.1: Add some notes about this under the description of
completion. The full rules are not given though; let the
user discover.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register *package-alist* variable,
taking on the contents of the packages variable.
* lib.c (package_alist_s): New symbol variable.
(make_package, packagep, find_package, package_alist); Work
with dynamic package alist variable via cur_package_alist_loc
macro.
(get_current_package_alist_loc): New function.
* lib.h (cur_package_alist_loc): New macro.
(packages, package_alist_s, get_current_package_alist_loc):
Declared.
* txr.1: Documented *package-alist* along with notes about
sandboxing. Documented that the package-alist function is
now obsolescent.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.h (default_bool_arg): Inline function renamed to
default_null_arg.
* eval.c (if_fun, pad, ginterate, giterate, range_star, range,
constantp, macroexpand_1, macro_form_p, expand_with_free_refs,
do_expand, eval_intrinsic, func_get_name, make_env_intrinsic):
Follow rename.
* arith.c (lognot): Likewise.
* gc.c (gc_finalize): Likewise.
* glob.c (glob_wrap): Likewise.
* hash.c (group_reduce, gethash_n): Likewise.
* lib.c (print, multi_sort, lazy_str, vector, iff, tok_str,
split_str_keep, search_str, remove_if, val): Likewise.
* match.c (match_fun): Likewise.
* parser.c (lisp_parse_impl, regex_parse): Likewise.
* rand.c (make_random_state): Likewise.
* regex.c (read_until_match, search_regex, regex_compile):
Likewise.
* socket.c (sock_accept, sock_connect): Likewise.
* stream.c (open_files_star, open_files, run, open_process,
open_tail, get_string, record_adapter): Likewise.
* struct.c (static_slot_ensure, static_slot_ens_rec,
clear_struct, make_struct_type): Likewise.
* sysif.c (exec_wrap, errno_wrap, cobj_ops_init): Likewise.
* unwind.c (uw_capture_cont, uw_find_frames_impl): Likewise.
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register starts-with and ends-with
intrinsics.
* lib.c (starts_with, ends_with): New functions.
* lib.c (starts_with, ends_with): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register rmismatch intrinsic.
* lib.c (rmismatch): New function.
* lib.h (rmismatch): Declared.
* txr.1: Documented
|
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (trunc_rem): Move function to below round function.
Make second argument optional, defaulting to one.
(floor_rem, ceil_rem, round_rem): New functions.
* eval.c (eval_init): Registration of trunc-rem altered for
optional argument. New registrations for floor-rem, ceil-rem,
round=rem.
* txr.1: Documented for new functions folded with trunc-rem.
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (round1): New static function.
(roundiv): New function.
* configure: New test for C99 round function.
* eval.c (eval_init): Register round intrinsic.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Also, with one argument, these functions handle
ranges.
* arith.c (floordiv, ceildiv): New functions.
(floorf, ceili): Handle ranges.
* eval.c (eval_init): Register floor and ceil
to new functions.
* lib.h (floordiv, ceildiv): Declared.
* txr.1: Documentation updated.
|
|
|
|
|
|
| |
* lib.c (vec): New function.
* lib.h (vec): Declared.
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register rassoc and rassql intrinsics.
* lib.c (rassoc, rassql): New functions.
* lib.h (rassoc, rassql): Declared.
* txr.1: Documented rassoc and rassql, with small fixes
to assql and assoc.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Deferrable warnings now get their own subtype, defr-warning.
The tag is a regular argument: no funny dotted argument list.
* eval.c (eval_defr_warn): Throw new style deferrable warning.
(me_op, no_warn_expand): Catch defr-warning rather than
warning. Use uw_muffle_warning to suppress it.
(gather_free_refs): Parse new representation of deferrable
warning.
(expand_with_free_refs): Catch defr-warning rather than
warning.
* lib.c (defr_warning_s): New symbol variable defined.
(obj_init): Initialize defr_warning_s.
* lib.h (defr_warning_s): Declared.
* share/txr/stdlib/error.tl (compile-defr-warning): Throw
new-style deferrable warning.
* unwind.c (uw_muffle_deferrable_warning): Function removed.
(uw_throw): Bugfix: handle warnings by checking by subtype
rather than exactly for the warning type. Distinguish
deferrable warnings by subtype rather than argument list
shape.
(uw_defer_warning): Take the new style args and reconstruct
the (msg . tag) representation for a deferred warning, so
the other functions don't have to change.
(uw_late_init): Register defr-warning as exception subtype
of warning.
* unwind.h (uw_muffle_deferrable_warning): Decl removed.
* txr.1: Adjusted all documentation touching on the subject
of the representation of deferrable warnings.
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (rem_impl): New static function.
(remove_if): Rewritten similarly to rem_impl.
(remq, remql, remqual, keepq, keepql, keepqual): Reduced to
wrappers around rem_impl.
(keep_if): Wrapper around remove_if with test negated.
* lib.c (remq, remql, remqual, remove_if, keepq, keepql,
keepqual, keep_if): Argument names adjusted.
|
|
|
|
|
|
|
| |
* lib.c (proper_plist_to_alist): Renamed to plist_to_alist.
* lib.h (proper_plist_to_alist): Declaration replaced.
(plist_to_alist): Declared.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register memp intrinsic.
* lib.c (memp): New function.
* lib.h (memp): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* LICENSE, LICENSE-CYG, METALICENSE, 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, signal.c, signal.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, 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/getopts.tl, share/txr/stdlib/getput.tl,
share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl,
share/txr/stdlib/package.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/tagbody.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:
Add 2017 to all copyright headers and strings.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register mismatch intrinsic.
* lib.c (mismatch): New function.
* lib.c (mismatch): Declared.
* txr.1: Documented mismatch.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This improves compatibility with other Lisp dialects
in a small way.
* eval.c (eval_init): Register endp intrinsic.
* lib.c (endp): New function.
* lib.h (endp): Declared.
* txr.1: Documented endp.
|
|
|
|
|
|
|
| |
* lib.c (do_curry_1234_1): New static function.
(curry_1234_1): New function
* lib.h: (curry_1234_1): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_exception): New static function.
(eval_error): Reduced to wrapper around eval_exception.
(eval_warn): New function.
(me_op): Bind the rest symbol in a shadowing env to suppress
watnings about unbound rest.
(do_expand): Throw a warning when a bindable symbol is
traversed that has no binding.
(expand): Don't install atoms as last_form_expanded.
* lib.c (warning_s, restart_s, continue_s): New symbol
variables.
(obj_init): Initialize new symbol variables.
* lib.h (warning_s, restart_s, continue_s): Declared.
* lisplib.c (except_set_entries): New entries for
ignwarn and macro-time-ignwarn.
* parser.c (repl_warning): New static function.
(repl): Use repl_warning function as a handler for
warning exceptions: to print their message and then
continue by throwing a continue exception.
* parser.y (warning_continue): New static function.
(parse_once): Use warning_continue to ignore warnings.
In other words, we suppress warnings from Lisp that is
mixed into TXR pattern language code, because this
produces too many false positives.
* share/txr/stdlib/except.tl (ignwarn, macro-time-ignwarn):
New macros.
* share/txr/stdlib/place.tl (call-update-expander,
call-clobber-expander, call-delete-expander): Ignore warnings
around calls to sys:expand, because of some gensym-related
false positives (we expand code into which we inserted some
gensyms, without having inserted the constructs which
bind them.
* tests/011/macros-2.txr: Suppress unbound variable
warnings from a test case.
* tests/012/ifa.tl: Bind unbound x y variables in one
test case.
* tests/012/struct.tl: Suppress unbound variable
warnings in some test cases.
* uwind.c (uw_throw): If a warning is unhandled, then
print its message with a "warning" prefix and then
throw a continue exception.
(uw_register_subtype): Eliminate the check for sub
already being a subtype of sup. This allows us to
officially register new types against t.
(uw_late_init): Register continue exception type as a
subtype of the restart type.
Formally register warning type.
* txr.1: Documented ignwarn.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (find_symbol): New function.
(symbol_present): Search the fallback list also to
determine whether the symbol is visible.
* lib.h (find_symbol): Declared.
* parser.y (sym_helper): Implement a new behavior for
qualified symbols. Interning new symbols is only allowed
for packages that have an empty fallback list.
* parser.c (get_visible_syms): New static function.
(find_matching_syms): Use get_visible_syms to get
the list of eligible symbols. This way the fallback list
of the package is included if it is the current package.
* share/txr/stdlib/package.tl (defpackage): Do not insert
a default (:use usr) if there is no :usr clause. Since
defpackage is very new, no need for backward compatibility;
the amount of code depending on this is likely zero.
* txr.1: Documented fallback list feature.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register package-fallback-list and
set-package-fallback-list intrinsics.
* lib.c (package_fallback_list, set_package_fallback_list,
intern_fallback): New functions
* lib.h (package_fallback_list, set_package_fallback_list,
intern_fallback): Declared.
* parser.y (sym_helper): Slightly restructure function
so that the symbol interning is done separately in
the various cases. In the unqualified symbol case,
use intern_fallback to search the fallback list
of the current package.
* share/txr/stdlib/package.tl (defpackage): Implement
:fallback clause.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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*).
|
|
|
|
|
|
|
|
|
| |
* 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 (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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (unbound_s): New symbol variable.
(lookup_var): If a dynamic binding has the special sys:unbound
symbol as its value, then return nil, so the behavior
is as if there is no binding.
(makunbound): If the symbol exists in a dynamic environment,
then replace its value with sys:unbound, making it look
unbound.
(eval_init): Initialize unbound_s.
* lib.h (us_car, us_cdr): New inline functions.
* txr.1: New dialect notes under boundp.
Updated the makunbound documentation. Separated
makunbound documentation from fmakunbound and
mmakunbound. Added compatibility notes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Although we are garbage-collected, being able to clean up on
shutdown is nevertheless useful for uncovering leaks. Leaks
can occur, for instance, due to neglect to free out-of-heap
satellite data from objects that are reclaimed by gc.
This feature is long overdue.
* arith.c, arith.h (arith_free_all): New function.
* gc.c, gc.h (gc_free_all): New function.
* lib.c (init): Remove program name parameter and
redundant initialization of progname globl variable.
* lib.h (progname): Superfluous declaration removed.
This is already declared in txr.h.
(init): Declaration updated.
* regex.c (char_set_destroy): Do not check the static
allocation flag here; just destroy the object.
Do check for a null pointer, though.
(char_set_cobj_destroy): This cobj destructor now
checks the static flag of the char set object and
avoids freeing it. Thus our char set singletons are
left alone by gc, but our global freeing function
takes care of them.
(wide_cs): New static variable moved out of
wide_display_char_p to static scope.
(regex_free_all): New function.
* regex.h (regex_free_all): Declared.
* txr.c (progname): const qualifier and initializer removed.
(main): Ensure progname is always dynamically allocated, even
in the argv[0] == 0 case. Do not pass progname to init;
it doesn't take that argument any more.
(free_all): New static function.
(txr_main): Implement --free-all option.
* txr.h (progname): Declaration updated.
|