| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/place.tl (sys:pl-expand): At each expansion
round, repeatedly expand the form as a place macro until that
can no longer be done and only then try macroexpand-1,
instead of just trying one place macro expansion.
* txr.1: Updated and revised description of expansion under
define-place-macro.
|
|
|
|
|
| |
* arith.c (int_flo): Don't subtract one from INT_PTR_MIN any
more, since it is now the most negative integer already.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (length_list, length_proper_list): Fix off-by-one bug
when calculating lengths of lists that overflow the cnum type.
Note that we will never see regular lists which hit this
situation, because there are more values in the range [0,
INT_PTR_MAX] then there are possible pointers in the system,
However, lazy lists can be that long or longer, because as we
calculate the length of a lazy list, the part we have already
traversed can be garbage-collected under the right
circumstances.
|
|
|
|
|
|
|
| |
* sysif.c (close_wrap): New static function.
(sysif_init): close intrinsic registered.
* txr.1: Documented.
|
|
|
|
| |
* txr.1: add missing "or" to make "bitwise or".
|
|
|
|
| |
* txr.1: Misplaced comma nudged left.
|
|
|
|
| |
* txr: use .verb block instead of .mono block.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/path-test.tl (path-private-to-me,
path-strictly-private-to-me): These functions were neglecting
to trust the root user, as documented. If the file is owned
by root, we treat it as if it were owned by the caller.
Furthermore, if we have to process the group membership, we
allow the group to contain the superuser's name.
* txr.1: Documentation improved, and the treatment of
groups documented.
|
|
|
|
|
|
|
|
|
| |
* mpi.c (mp_set_int, mp_set_intptr, mp_set_double_intptr):
When the signed input is negative, do not simply calculate its
inverse with unary minus, because it could be the most
negative value that has no additive inverse. Instead, convert
to unsigned first, then apply the unary minus to the unsigned
type, which calculates the two's complement.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This bug causes a problem particularly in FFI. THe conversion
of an integer to the FFI int type begins by conversion via
c_num to the cnum type, which is at least as wide as int.
Alas, the INT_MIN value (e.g. #x-80000000 on 32 bits) will
not convert!
Fixing this has a ripple effect. We alter the INT_PTR_MIN
constant to include this value. This causes the derived
NUM_MIN to also include the extra negative value, extending
the fixnum range by one value. Everything seems to be okay.
* configure: Decrease value of INT_PTR_MIN and
DOUBLE_INTPTR_MIN constants by one to include the most
negative two's complement value.
* ffi.c (make_ffi_type_enum): We must not subtract 1 from
INT_PTR_MIN here any more.
* mpi.c (mp_in_range): If the bignum is negative, then extend
the range check by one value, so that we don't reject the
most negative two's complement value.
|
|
|
|
| |
* lib.h (maxint, minint): Remove unused macros.
|
|
|
|
| |
* win/fassoc.nsh: Patch applied.
|
|
|
|
|
|
|
|
|
| |
Add registration of .txr, .tl and .tlo suffixe.
* inst.nsi: Include fassoc.nsh file. Associate .txr, .tl and
.tlo with txr-win.exe
* win/fassoc.nsh: New file.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/place.tl (sys:placelet-1): Adding
comment explaining why the explicit expansion and temporary
proxy place are necessary, even though in most cases
it can work fine without them.
|
|
|
|
|
| |
* share/txr/stdlib/asm.tl (%oc-list%): Unused global symbol
macro removed.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
* protsym.c: Likewise.
|
|
|
|
| |
* txr.1: .PP added.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (open-compile-streams): The
input file is now determined in a manner similar to the load
function. If the path is relative and there is a *load-path*
binding, then it is now considered relative to *load-path*.
It is considered suffixed only if ending in .tl or
.txr. If unsuffixed, then it is first tried with the .tl
suffix.
(usr:compile-file): Bind *load-path* to the actual path used
for loading the file, rather than the input path.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (load): Bind *load-path* to the real path that was
used to open the file, not to the tentative path to which
the .tl suffix was added, subject to compatibility option.
* txr.1: Documentation for load revised for better wording and
to document the above change. Fixed *load-path* being wrongly
called a macro, and also load being called a macro.
Compat note added.
|
|
|
|
|
|
|
|
|
|
|
| |
* struct.c (derived_s): New symbol variable.
(struct_init): Initialize derived_s symbol.
(make_struct_type): Check for derived method in parent, and
invoke.
* struct.h (derived_s): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (struct_set_entries): Add autoload entries for
new* and lnew* symbols.
* share/txr/stdlib/struct.tl (sys:new-type, sys:new-expander):
New functions.
(new, lnew): Macros now implemented using sys:new-expander.
(new*, lnew*): New macros.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
| |
* struct.c (struct_init): Register struct-type-name intrinsic.
(struct_type_name): New function.
* struct.h (struct_type_name): Declared.
* txr.1: Documented.
|
|
|
|
| |
* struct.h (static_slot_s): Dangling declaration removed.
|
|
|
|
|
|
| |
* share/txr/stdlib/debugger.tl (print-backtrace): Use the new
window-mapdo instead of window-map, to avoid consing a list
that is throw away.
|
|
|
|
|
|
| |
* eval.c (me_interp_macro): Combine initialization and
assignment into one. There was previously code between the two
that got removed when the old debugger was scrubbed.
|
|
|
|
|
|
| |
* eval.c (do_eval_args): Since function call expressions all
undergo the dot-to-apply transform, there is no need
look for a form in the dot position.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Refactorings to apply released TXR 192 broke it, causing apply
to fail to treat non-list sequences as individual arguments,
as documented. This affects dotted application as well.
;; wrong
(list . "abc") -> "abc"
;; correct
(list . "abc") -> (#\a #\b #\c)
With some misgivings, I'm not making the behavior subject
to the -C compat option.
* eval.c (applyv): Two things are wrong here: we moved the
last fixed argument into args->list without turning it into a
one-element list. Secondly, we didn't pass this list through
apply_intrinsic_frob_args. We can combine both actions into
just calling tolist, which is what apply_intrinsic_frob_args
will do with the car of a one-element list.
|
|
|
|
|
|
|
|
|
|
|
| |
* hash.c, lib.c, parser.y, unwind.c: Remove useless
declarations that were believed to be C99 inline
instantiations. This was mistakenly added at the time the
Solaris issue was discovered that _XOPEN_SOURCE values of 600
or greater require compiling in C99 mode.
We use "static inline" under C99 for inline functions;
instantiation is not applicable at all to inline functions
that don't have external linkage.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In this patch we change the strategy for resolving unsuffixed
paths in load and @(load). In load, an unsuffixed name is
tried with a .tlo suffix, then .tl and only if those don't
resolve to a file it is tried as-is. The previous order is
as-is, .tlo, .tl. Similarly in @(load), but unsuffixed paths
are tried as .txr, then .tlo, then .tl.
The motivation for this is to avoid probing the filesystem
multiple times the optimized case that we care about: loading
.tlo files from Lisp.
* parser.c (open_txr_file): Rearrange the probing strategy.
Also recognize .txr_profile as a suffix, treating it like .tl.
This is so that we don't probe for .txr_profile.tlo and
.txr_profile.tl before finding the profile.
(load_rcfile): Take advantage of the new path-not-found
exception. We avoid wastefully checking with path-exists-p
to avoid calling open_txr_file. We just let open_txr_file
throw an exception if the file doesn't exist, and then
distinguish the non-existence case in the handler.
* txr.1: Updated @(load) and load documentation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Several new more specific exception types are derived from
file-error and used. Error handlers can distinguish unexpected
non-existence, unexpected existence and permission errors
from each other and other errors.
* lib.c (path_not_found_s, path_exists_s, path_permission_s):
New symbol variables.
(obj_init): New variables initialized.
* lib.h (path_not_found_s, path_exists_s, path_permission_s):
Declared.
* parser.c (open_txr_file): Use new errno_to_file_error
function to convert errno to exception symbol.
* socket.c (open_sockfd): Likewise.
* stream.c (open_directory, open_file, open_fileno,
open_command, open_process, run, remove_path, rename_path):
Likewise, and process-error is used in open_process and run
instead of file-error for problems related to creating the
process.
* sysif.c (errno_to_file_error): New function.
(mkdir_wrap, ensure_dir, chdir_wrap, getcwd_wrap, mknod_wrap,
chmod_wrap, symlink_wrap, link_wrap, readlink_wrap, stat_impl,
umask_wrap, ): Use
errno_to_file_error to convert errno to exception symbol.
(exec_wrap): Use process-error instead of file-error.
* sysif.c (errno_to_file_error): Declared.
* unwind.c (uw_init): Register path-not-found, path-exists and
path-permission as subtypes of file-error.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When the build is being done in the source directory, allow
the configure script to be executed via path names other than
just ./configure, such as an absolute path.
Some distros use this.
* configure (build_in_srcdir): New variable.
(inode): New function.
Rather than checking whether "$source_dir" is ".", we test
whether they are the same inode. If they are the same, we now
also set the build_in_srcdir variable in addition to
generating the usual warning.
(gen_config_make): Propagate the build_in_srcdir into
config.make.
* Makefile: use the build_in_srcdir variable from config.make
to determine whether we are building in the source directory,
rather than relying on top_srcdir being blank.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch adds special unwind frames for backtracing
expansions. With this, we can get rid of the global variable
last_form_expanded, since to get the last form expanded, we
just search for the most enclosing expand frame.
* eval.c (last_form_expanded): Global variable removed.
(error_trace): Use uw_last_form_expanded() instead of
last_form_expanded.
(expand_eval): No need to save and restore
last_form_expanded any more.
(expand_lisp_setq, expand_setqf, expand_lisp1, do_expand): Use
uw_last_form_expanded().
(expand, do_macroexpand_1): Push and pop expand frame.
This fixes a bug: do_macroexpand_1 was not recording
last_form_expanded. Evaluation of top-level forms uses
explicit macroexpansion, therefore top-level evaluation was
neglecting to set last_form_expanded.
This explains weird behavior I saw in the listener from
time to time, when errors would report against the expansion
of the wrong form.
(eval_init): Remove reference to last_form_expanded variable.
* eval.h (last_form_expanded): Declaration removed.
* share/txr/stdlib/debug.tl (expand-frame print-trace,
expand-frame loc): New methods.
(print-backtrace): Include uw-expand frames in the backtrace.
* unwind.c (expand_frame_type): New static variable.
(uw_find_frames_by_mask): Handle UW_EXPAND.
(uw_last_form_expanded, uw_push_expand): New functions.
(uw_late_init): Register expand-frame struct type.
* unwind.h (enum uw_frtype): New enum member, UW_EXPAND.
(uw_last_form_expanded, uw_push_expand): Declared.
|
|
|
|
|
| |
* share/txr/stdlib/debug.tl (fcall-frame print-trace): Don't
invoke .(loc) method on nx-fr, if it is nil.
|
|
|
|
|
|
| |
* unwind.c (uw_late_init): Move uw-block, uw-captured-block,
uw-menv, uw-catch, uw-handle, uw-cont-copy, uw-guard, uw-fcall
and uw-eval into the system package.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (load): When we read and discard a hash bang line,
we must set the parser line number to two.
* parser.c (parser_set_lineno): New function.
* parser.h (parser_set_lineno): Declared.
* txr.c (check_hash_bang): New argument, occurs.
(txr_main): Track whether hash bang has occurred in a new
local variable hb_occurs. Then, before parsing, if hash bang
has occurred, set the line number to two.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This refactoring is needed for fixing the off-by-one
line number bug when the hash bang line is processed.
* eval.c (load): Don't define parser locally; ensure there is
one in the stream and use it.
* match.c (v_load): Likewise.
* parser.c (get_parser_impl): Renamed to parser_get_impl and
changed from internal to external linkage.
(ensure_parser): Changed to external linkage.
(lisp_parser_impl, read_file_common): Follow rename of
get_parser_impl.
* parser.h (parse_once): Declaration updated.
(parser_get_impl, ensure_parser): Declared.
* parser.y (parse_once): Take self parameter; drop parser
parameter. Ensure a parser to the stream, rather than
declaring one locally. Don't clean up the parser when
done, just let the stream clean it up.
* txr.c (parse_once_noerr): Parser argument is dropped and
not passed to parse_once. Program name is passed as self
argument to parse_once.
(txr_main): When parsing the TXR pattern query, don't define a
parser locally; ensure there is one in the stream and use it,
like in load and v_load.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (enum wmap_op): New enum type.
(window_map_list): Use enum wmap_op for last argument instead
of Boolean flag. If the argument is WMAP_MAPDO, do not
accumulate.
(window_map_vec, window_map, window_mapped): Adjust to new
enum argument.
(window_mapdo): New function.
* lib.h (window_mapdo): Declared.
* eval.c (eval_init): window-mapdo intrinsic registered.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We introduce evaluation tracking frames. The backtrace
function can use these to deduce the line from which
a function is called (if called from interpreted code).
Eventually we will have analogous virtual machine
frames to do this for compiled code.
* eval.c (do_eval): If backtraces are enabled, then push
and pop an eval frame, which holds the two key pieces: the
form and environment.
* share/txr/stdlib/debug.tl ((fcall-frame loc), (fcall-frame
print-trace), (eval-frame loc), (eval-frame print-trace)):
New methods.
(print-backtrace): Loop reduced to just dispatching
frame-specific print-trace methods. It gives the previous and
next frame to each method.
The (fcall-frame print-trace) method prints function frames,
using the previous form to deduce the location from which
the function is called. The (eval-frame print-trace) method
mostly suppresses the printing of eval frames. We print
an eval frame if it is the parent of an internal function
frame, and if it is the topmost frame (to identify the
toplevel form at the root of the backtrace).
* unwind.c (form_s): New symbol variable.
(eval_frame_type): New static variable.
(uw_find_frames_by_mask): Handle UW_EVAL case, producing
eval-frame struct.
(uw_push_eval): New function.
(uw_late_init): Allocate eval-frame struct type, storing it in
eval_frame_type, and gc-protect that new variable.
Register uw-eval variable evaluating to a one bit mask
with the UW_EVAL-th bit set.
* unwind.h (enum uw_frtype): New enum constant UW_EVAL.
(struct uw_eval): New struct type.
(union uw_frame): New member, el.
(uw_push_eval): Declared.
|
|
|
|
|
|
|
|
|
|
| |
* struct.c (allocate_struct): Changed from internal to
external linkage.
* struct.h (allocate_struct): Declared.
* unwind.c (uw_get_frames, uw_find_frames_by_mask): Use
allocate_struct instead of make_struct.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The interpreted defun should tag the function form that is
obtainable with func-get-form with source location info.
* eval.c (op_defun): In all cases, propagate source loc info
from the form to the function form that is bound to
the function name.
(op_defmacro): Propagate the source location info in the
same manner: not from the body (which could be empty) but from
the form.
|
|
|
|
|
| |
* txr.1: Document --backtrace and also that it is implied
by --debug.
|
|
|
|
|
|
|
|
| |
* struct.c (struct_init): allocate-struct intrinsic
registered.
(allocate_struct): New static function.
* txr.1: Documented.
|
|
|
|
|
|
| |
* share/txr/stdlib/debug.tl (print-backtrace): Force
indentation and formatting off, and set maximum length and
depth to condense the backtrace output.
|
|
|
|
|
|
| |
* lib.c (sub_str): Optimization: if the range spans
the entire string, just return it; don't allocate
a copy.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* hash.c (hash_print_op): Implement max length.
* lib.c (lazy_str_put, out_lazy_str): Take struct strm_base *
parameter and implement max length.
(out_quasi_str_sym): Don't use obj_print_impl for symbol's
name string; just put_string. The use of obj_print_impl causes
symbols appearing as variables in quasiliterals to be
truncated when max length is imposed.
(out_quasi_str): Implement max length.
(obj_print_impl): Implement max length and depth. Note that
there is now always a non-null ctx pointer.
(obj_print): Always set up context pointer for obj_print_impl.
Context now has pointer to low-level stream structure, where
we can access max_length and max_depth. It also carries the
recursion depth.
* lib.h (lazy_str_put): Declaration updated.
* stream.c (strm_base_init): Add initializers for max_length
and max_depth.
(put_string): Pass stream structure to lazy_str_put.
(set_max_length, set_max_depth): New functions.
(stream_init): set-max-length and set-max-depth intrinsics
registered.
* stream.h (struct strm_ctx): New members depth and strm.
(struct strm_base): New members max_length and max_depth.
(set_max_length, set_max_depth): Declared.
* txr.1: Documented.
|
|
|
|
|
|
| |
* txr.1: example of with-resources should use .verb not .mono.
This must be because it previously used .cblk without
indentation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The fourth indent mode indent-foff (force off) is introduced.
* buf.c (buf_print): Turn on data mode indentation if
the current mode is not indent-foff, rather than when it
is indent-off.
* lib.c (obj_print_impl): The unconditional set_indent_mode
calls are replaced with test_neq_set_indent_mode so we only
set the mode if it is not forced off.
* stream.c (formatv): For the ! directive, turn on data
mode identation is not indent-foff, rather than when it is
indent-off.
(put_string, put_char, width_check): Recognize ident-foff as
indentation off.
(test_neq_set_indent_mode): New function.
(stream_init): Register test-neq-set-indent-mode function
and indent-foff variable.
* stream.h (indent_mode): New enum constant, indent_foff.
(test_neq_set_indent_mode): Declared.
* struct.c (struct_inst_print): Turn on data mode indentation
if the current mode is not indent-foff, rather than when it is
indent-off.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* debug.c (debug_state): Switch to unsigned, since this is now
a bitmask.
(sys_print_backtrace_s): New symbol variable.
(dbg_clear, dbg_set, dbg_restore): New static functions.
(debug_init): Initialize sys_print_backtrace_s. Register
dbg-clear, dbg-set, dbg-restore intrinsics. Register
dbg-enable, dbg-step, dbg-backtrace and dbg-all bitmask
variables, Lisp equivalents of DBG_ENABLE, DBG_SETP,
DBG_BACKTRACE and DBG_ALL.
(debug_dump_backtrace): New function.
* debug.h (opt_debugger): Declaration removed.
(debug_state): Declaration updated.
(DBG_ENABLE, DBG_STEP, DBG_BACKTRACE, DBG_ALL): New
preprocessor symbols.
(debug_set_state): Inline function removed.
(debug_clear, debug_set, debug_restore): New inline functions.
(dbg_backtrace, dbg_fcall_begin, dbg_fcall_end): New macros.
(debug_dump_backtrace): Declared.
* eval.c (error_trace): Invoke debug_dump_backtrace if support
is compiled in and backtraces are enabled.
* lib.c (do_generic_funcall): New function, copy of
generic_funcall.
(generic_funcall): Now a wrapper for do_generic_funcall which
registers fcall frames if backtrace support is enabled.
(funcall, funcall1, funcall2, funcall3, funcall4): Route to
slow generic_funcall path if backtraces are enabled.
* lisplib.c (debugger_instantiate, debugger_set_entries):
New static functions.
(lisplib_init): Autload support for debug module via above
new functions.
(lisplib_try_load): Save and restore debugger state in new
way using debug_set and debug_restore, with specific mask
values.
* parser.y (parse_once): Disable debugging in new way.
* share/txr/stdlib/debug.tl New file.
* sighal.h (EJ_DBG_MEMB, EJ_DBG_SAVE, EJ_DBG_REST): New
macros for saving/restoring debug state.
(EJ_OPT_MEMB, EJ_OPT_SAVE, EJ_OPT_REST): Reference the above
macros to include debug state in extended jump context.
* txr.c (help): Document --backtrace and that that -d
implies --backtrace.
(txr_main): Enable debugger using debug_set.
Provide new --backtrace option to enable backtraces only.
* unwind.c (args_s): New symbol variable.
(fcall_frame_type): New static variable.
(unwind_to_exit_point): Save pointer to original frame stack
and restore it when calling error_trace. This is so that
error_trace can walk the stack to collect a backtrace.
(uw_find_frames_by_mask, uw_push_fcall): New functions.
(uw_late_init): Initialize args_s and fcall_frame_type.
gc-protect fcall_frame_type. Register uw-* variables
corresponding to the UW_* frame types.
* unwind.h (uw_frtype_t): New enum constant UW_FCALL.
(struct uw_fcall): New frame structure.
(union uw_frame): New member fc.
(uw_push_fcall, uw_find_frames_by_mask): Declared.
|
|
|
|
|
|
| |
* txr.c (read_compiled_file_noerr): New static function.
(txr_main): Use read_compied_file indirectly through
read_compiled_file_noerr wrapper.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Errors encountered when parsing or evaluating a source file
should be handled using a handler rather than a catch, so that
the unwind stack is available to the error reporting function.
This anticipates being able to dump a backtrace.
* txr.c (parse_once_noerr, read_eval_stream_noerr): Adjust
to reduced argument count in ignerr_func_body macro.
* unwind.c (uw_trace_error): New function.
* unwind.h (uw_trace_error): Declared.
(ignerr_func_body): Revised to establish a handler in addition
to the catch. The catch now doesn't do anything other than
provide an intercepting exit point; the error_trace call is
moved into the handler, and so it executes in a context where
unwinding hasn't happened yet.
|