| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
* lisp.c (compiler_set_entries): Add with-compilation-unit to
autoload symbols for compile module.
* share/txr/stdlib/compiler.tl (usr:with-compilation-unit):
New macro.
(usr:compile-file): Use with-compilation-unit macro to
dump warnings if a file is processed alone.
* txr.1: Documented.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (usr:compile-file): Bind
*rec-source-loc* to t, otherwise the read function doesn't
record source loc info and we don't get warnings reported
against line numbers in the processed source files.
|
|
|
|
|
|
| |
* txr.1: Documented force-break and the altered return value of
width-check. The existence of a stream's force flag is
mentioned under width check.
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (compiler comp-and-or): Handle
the trivial zero and one argument cases separately. In
particular, the one-argument case results in better code
because it eliminates a temporary register. We don't have
to test for the zero-arg case any more in the general case,
so it is simplified in a few cases.
|
|
|
|
| |
* txr.1: Adding description of disassemble function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
References to rslot must be usr:rslot because there is a
sys:rslot. Some difference in loading order causes this not to
be a problem when runing compiled "make tests", but if the
.tlo files are removed, the awk test case fails.
* share/txr/stdlib/awk.tl (sys:awk-mac-let): Replace
rslot with usr:rslot.
* share/txr/stdlib/struct.tl (rslot): Replace rslot
symbol token with usr:rslot in definitions of rslot macro and
rslot place macro.
|
|
|
|
|
| |
* txr.1: ldiff documentation moved under Sequence Manipulation
and rewritten. Compatibility note added.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The problem is that completion on pub:sym[Tab] is
completing on the fallback list, because pub is the
current package. If we type pub:l[Tab], we might complete
to pub:list. But that's because usr:list was found
in the fallbacklist; pub:list isn't that symbol, and its
use will shadow usr:list.
This is against the documentatiion too, which describes
it the way it should work: simply that the fallback
list of the current package is used under completion when no
package qualifier prefix is present.
* parser.c (get_visible_syms): Rename second parameter to
reflect its actual meaning, rather than an original intended
use.
(find_matching_syms): Only allow get_visible_syms to traverse
package fallback lists if qualify is false. Thus even if we
are completing against the current package, if that package is
being explicitly indicated with a prefix, then only the
package local symbols are included.
|
|
|
|
|
|
| |
* txr.1: Fixed syntax synopsis under struct-type using
structp. Improved some wording here. Fixed static-slot-home's
syntax synopsis wrongly referring to static-slot-ensure.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (compiler comp-prog1): The
output of the frag should be fireg, not oreg. We need to
move into fireg before re-frag.code is executed, because
the data source in fi-frag may be clobbered by re-frag.
|
|
|
|
|
| |
* txr.1: Add descriptions of compile-file, compile-only and
eval-only.
|
|
|
|
|
| |
* txr.1: Description of load includes treatment of .tlo files.
New major section on Lisp compilation.
|
|
|
|
|
|
|
|
| |
* eval.c (do_expand): Do not convert (op arg ... . dot)
to (sys:apply (fun op) (sys:l1-value arg) ... dot) if op is
a special operator; this is only valid for functions.
This issue has been uncovered by new diagnosis of undefined
functions in the fun operator.
|
|
|
|
|
|
|
| |
* eval.c (dotted_form_error): New static function.
(expand_forms, expand_forms_ss, expand_forms_lisp1): Call
dotted_form_error instead of repeated open coded uw_throwf
calls.
|
|
|
|
|
|
| |
* configure (lndir): Strip trailing slash from todir argument
to prevent double slashes. Remove the destination in case
it is a symlink to a directory.
|
|
|
|
|
|
| |
* share/txr/stdlib/trace.tl (sys:trace, sys:untrace): Now that
library code is being read in the sys package, catch refers
to the sys:catch special form; we want the usr:catch macro here.
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/trace.tl (sys:trace-canonicalize-name):
Don't call static-slot-home on something that might not be a
struct type symbol. Otherwise the trace module will throw
whenever some lookup is performed for a non-existent
method. That means that when trace is loaded, it is impossible
to define a method with defun.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The compiler internally allocates registers that are never
inserted into code (but correctly recycled). Thus the treg
bump counter overestimates the actual number of registers that
a VM requires; but that's how we use it! That causes wasted
stack space.
What we can do to get a tightly clamped register count
is simply to let the assembler report the highest-numbered
treg operand that it finds in the code.
(In the future we will need something better to optimize the
register allocation. Why: because closures have their own VM
instance with its own registers. If an overall VM uses
registers t00 through t09, but a certain closure uses
only t02 through t06, that closure's frame only needs to
allocate seven registers.)
* share/txr/stdlib/asm.tl (assembler): New slot, max-treg.
(assembler parse-args): Whenever a register operand is parsed,
if it is a t register, update max-treg.
* share/txr/stdlib/compiler.tl (usr:compile-toplevel): When
creating the vm-desc, determine the nreg parameter from the
assembler's max-treg value, rather than from the compiler's
treg allocation bump counter.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (me_case): Correct the condition. We want to generate
for all the case comparison types. The only situation we want
to avoid is when the keys do not use eq equality, but caseq
is used. The reason is that the underlying hash table is
eql-based, not eq-based: it's not the right kind of hash
table for caseql/caseql*. We can only use it if two keys
might be eql that are not eq.
|
|
|
|
|
|
|
| |
* eval.c (compares_with_eq): New static function.
(me_case): Instead of check_fun, call compares_with_eq
directly. For the case when we map over check fun,
allocate the function just once, outside the loop.
|
|
|
|
|
|
| |
* lisplib.c (compiler_set_entries): Add compile to autoloads.
* share/txr/stdlib/compiler.tl (usr:compile): New function.
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/asm.tl (disassemble): Drop usr: prefix
since symbol is interned already in usr package.
Handle vm functions by obtaining their vm desc and entry
point. Disassemble whole desc, then indicate entry point.
The fallback case tries the object as a potential function
name and recurses, so (disassemble '(meth struct slot))
and (disassemble 'name) will work.
|
|
|
|
|
|
|
| |
* vm.c (vm_closure_struct): New static function.
(vm_closure_desc, vm_closure_entry): New functions.
(vm_init): sys:vm-closure-desc and sys:vm-closure-entry
intrinsics registered.
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): vm-fun-p intrinsic registered.
* lib.c (vm_fun_p): New function.
* lib.h (vm_fun_p): Declared.
|
|
|
|
|
|
|
|
| |
* Makefile (%.tlo, %.tlo2): Drop dependency on $(TXR).
Of course, the dependency is strictly correct, but most
changes to TXR are irrelevant. Moreover, not all relevant
dependencies are in place anyway; if we change compile.tl,
only the compile.tlo is recompiled.
|
|
|
|
|
|
|
| |
* lib.c (generic_funall): Handle vm-desc objects via
vm_execute_toplevel.
* vm.h (vm_desc_s, vm_closure_s): Declared.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/asm.tl (disassemble-c-d): Rename to
disassemble-cdf. These letters stand for code, data vector,
function vector. The name had been was chosen before the VM
had function vectors.
(usr:disassemble): Follow rename.
|
|
|
|
|
| |
* vm.c (vm_insn_opcode): Conversion between integer types
requires convert rather than coerce.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (public_package): New variable.
(obj_init): Protect public_package from gc. Initialize
it with a package called "pub" which has the user
package in its fallback list.
* lib.h (public_package): Declared.
* eval.c (eval_init): Initialize package_s to public_package
rather than user_package, except in compat <= 190 mode.
* txr.c (txr_main): Bind *package* to public_package
rather than user_package, except in compat <= 190 mode.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Another part of the preparation for an upcoming change.
All library code is now read in the sys package, so any
symbols that are interned (local variables and whatnot)
are in sys and will not be exposed to user code.
We have to overcome some annoyances to achieve this:
- We have to stay away from the symbols exp or var,
because they are now sys:exp and sys:var with their
special meaning.
- Instances in which a symbol of the same name exists
in both sys and usr present a problem; the plain
symbol now is the usr one. For instance rplaca
will refer to sys:rplaca, so a small amount of
code has to explicitly use usr:rplaca.
* Makefile (COMPILE_TL): Change to the sys package before
compiling library code.
* lisplib.c (lisplib_try_load): Bind *package* to the system
package.
* share/txr/stdlib/asm.tl, share/txr/stdlib/compiler.tl:
Remove in-package macro invocation; we don't need this since
all files are loaded or compiled in the sys package.
* share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl,
share/txr/stdlib/conv.tl, share/txr/stdlib/doloop.tl,
share/txr/stdlib/error.tl, share/txr/stdlib/error.tl,
share/txr/stdlib/except.tl, share/txr/stdlib/ffi.tl,
share/txr/stdlib/getopts.tl, share/txr/stdlib/getput.tl,
share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl,
share/txr/stdlib/keyparams.tl, share/txr/stdlib/op.tl,
share/txr/stdlib/package.tl, share/txr/stdlib/path-test.tl,
share/txr/stdlib/place.tl, share/txr/stdlib/pmac.tl,
share/txr/stdlib/socket.tl, share/txr/stdlib/stream-wrap.tl,
share/txr/stdlib/struct.tl, share/txr/stdlib/tagbody.tl,
share/txr/stdlib/termios.tl, share/txr/stdlib/trace.tl
share/txr/stdlib/txr-case.tl, share/txr/stdlib/type.tl,
share/txr/stdlib/ver.tl, share/txr/stdlib/with-resources.tl,
share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl:
Deal with the various usr versus sys symbol issues.
|
|
|
|
|
|
|
|
|
|
|
|
| |
If user code interns these symbols before the autoload takes
place, things will misbehave. For instance if user code
interns a symbol called "rng" in its own package, not usr,
and then awk is loaded, then using (rng ...) in that awk macro
won't work.
* lisplib.c (ifa_set_entries): Add the it symbol.
(awk_set_entries): Add numerous symbols to the intern list:
all of the awk special variables and awk functions/macros.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/struct.tl (defstruct, sys:check-slot,
defmeth): Use slot rather than sys:slot as indicator in
tentative defs.
* struct.c (static_slot_s): Variable removed.
(struct_init): slot_s initialized with symbol in user package,
rather than system package. Initialization of static_slot_s
removed. Existing slot function now registered using slot_s.
(static_slot_type_reg): Remove reference to static_slot_s.
This was a dud all along; nothing publishes deferred warnings
against this symbol.
* protsym.c (protected_sym): Remove static_slot_s.
|
|
|
|
|
|
|
| |
* lisplib.c (place_set_entries): add missing pinc and pdec.
Fix misspelled define-accessor.
(sock_set_entries): Add missing iinaddr-any, inaddr-loopback,
in6addr-any and in6addr-loopback.
|
|
|
|
|
|
|
| |
* lisplib.c (termios_instantiate, awk_instantiate,
build_instantiate): Remove sock_load_init calls which make no
sense in these functions. This is the result of flurried copy
and pasting.
|
|
|
|
| |
* trace.tl: File was introduced in 2016, so 2016-2018.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The identifiers user_package, system_package and
keyword_package are preprocessor symbols that expand to other
preprocessor symbols for no good reason. Time to get rid of
this.
* lib.c (system_package_var, keyword_package_var,
user_package_var): Variables renamed to system_package,
keyword_package and user_package.
(symbol_package, keywordp, obj_init): Fix variable
references to follow rename.
* lib.h (keyword_package, user_package, system_package):
Macros removed.
(system_package_var, keyword_package_var,
user_package_var): Variables renamed.
* eval.c (eval_init): Fix variable references to
follow rename.
* parser.y (sym_helper): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Makefile (STDLIB_SRCS, STDLIB_TLOS, STDLIB_TLOS2): New
variables.
(COMPILE_TL): New recipe macro.
(%.tlo, %.tlo2): New pattern rules.
(all): Depend on new stage1 and stage2 targets.
(stage1, stage2): New phony targets.
(clean): Add clean-tlo dependency.
(clean-tlo): New phony target.
(install): Install .tlo files also.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configure (lndir): New function; imitation of same-named
utility from the X11 distribution. Using lndir, instead of
creating, in the build directory, symlinks for the tests and
shared directories pointing back to the source tree,
we mirror the directory structure of these directories and
populate it with individual file symlinks. Motivation:
this will allow us to build .tlo object files in these
directories side by side with .tl files, without touching
the source tree.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is an issue with the printer in that it produces
output whereby objects continue on the same line after
a multi-line object, e.g:
(foo (foobly bar
xyzzy quux) (oops same
line))
rather than:
(foo (foobly bar
xyzzy quux)
(oops same line))
There is a simple fix for this: set a flag to force
a line break on the next width-check operation whenever
an object has been broken into multiple lines.
width-check can return a Boolean indication whether
it generated a line break, and so aggregate object
printing routines can tell whether their object
has been broken into lines, and set the flag.
* stream.h (struct strm_base): New member, force_break.
(force_break): Declared.
* stream.c (strm_base_init): Extent initializer to cover
force_break flag.
(put_string, put_char): Clear the force_break flag whenever
we hit column zero.
(width_check): If indent mode is on, and force_break is
true, generate a break. Clear force_break.
(force_break): New function.
(stream_init): Register force-break intrinsic.
* buf.c (buf_print): Set the force break flag if the buffer
was broken into multiple lines.
* hash.c (hash_print_op): Set the force break flag if the
hash was broken into multiple lines.
* lib.c (obj_print_impl): Same logic for lists.
* struct.c (struct_inst_print): Same logic for structs.
* tests/009/json.expected, tests/011/macros-2.expected,
tests/012/struct.tl, tests/017/glob-zarray.expected:
Update expected textual output to reflect new formatting.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* parser.c (read_file_common): The entire compiled
representation is now one big list. We must walk the list to
visit the individual compiled top-level forms.
* share/txr/stdlib/compiler.tl (compile-file): Collect all the
compiled top-level forms into one list, and emit it as one
object. This way, gensym references among the items will
resolve; for instance tests/012/man-or-boy.tl now compiles.
That file defines a function named by a gensym, and a macro
which expands to calls to that function. These end up in
separate top-level forms and have to resolve.
Because we are emitting everything as one big object, we
cannot rely on (in-package ...) forms influencing the reading
of the symbols. So we create a dummy package and switch to
that during the writing, which forces all symbols to be fully
qualified.
|
|
|
|
|
|
|
|
|
|
| |
* parser.c (read_file_common): Treat first form in file as a
version number of the form (major minor), where major nad
minor are non-negative integers. If the major number is
greater than zero, reject the file as incompatible.
* share/txr/stdlib/compiler.tl (usr:compile-file): Emit version
number (0 0) as the first item in a compiled file.
|
|
|
|
|
|
|
|
|
|
|
| |
append is too generic, and produces nil sometimes. Let's use a
custom run-time support function sys:fmt-join.
* eval.c (fmt_join): New function.
(eval_init): Intern sys:fmt-join.
* share/txr/stdlib/compiler.tl (expand-quasi): Generate a
sys:fmt-join call to combine the pieces rather than append.
|
|
|
|
|
|
|
| |
* parser.c (read_file_common): Remove the check whether the
data vector is a list (due to have been converted to
sys:vector-lit by the presence of unquotes). This doesn't
happen any more, thanks to the previous parser commit.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The parser generates a sys:hash-lit, sys:struct-lit or
sys:vector-lit whenever a hash, struct or vector literal
contains unquotes. This allows the quasiquote expander
to treat these objects as ordinary list structure when
interpolating inside them, and then recognize these symbols
and construct the implied real objects.
The issue is that these literals are generated even if the
unquotes occur outside of a backquote. For instance if a
vector literal like #(,a) occurs out of the blue,
not in any backquote, this is still a
(sys:vector-lit (sys:unquote a)) and not an actual vector.
The issue is compounded because this substitution takes
place even if there is no actual comma or splice notation.
Even the following is a sys:vector-lit: #((sys:unquote x)).
In any case, it causes problems for compiled files, because
such material can occur in the data vector of a compiled
toplevel form.
In this patch we modify the parser to keep track of the
quasiquote/unquote level. The special literals are generated
only when the object occurs inside a quasiquote.
* parser.h (struct parser): New member, quasi_level.
* parser.c (parser_common_init): Initialize the parser's new
quasi_level member.
* parser.y (vector, hash, struct): To decide whether to
generate the special literal, don't just check whether
unquotes occur in the list. Check that we are in a quasiquote,
indicated by the quasiquoting level being positive.
(i_expr, n_expr): Use a mid-rule actions on the quasiquote,
unquote and splice rules to bump the quasiquoting level in one
direction before recognizing the object, and then bump in the
opposite direction when reducing the rule.
(parse): Initialize quasi_level.
|
|
|
|
|
|
|
|
| |
The compiler barfed on hash.tl, reporting an if form with too
many arguments in the with-hash-iter macro, indicating that
it's basically broken.
* share/txr/stdlib/hash.tl (with-hash-iter): Repair the macro.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (expand-quasi-args): When the
element of the quasiquote is a compound form, we can't just
return it. Firstly, because we are appending, we must wrap
each returned item in a list. Secondly, we must wrap the form
in code which formats it into a string consistently.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These top-level macro-time forms are preventing code from
being compiled.
* share/txr/stdlib/ifa.tl: Remove macro-time around
sys:if-to-cond function.
* share/txr/stdlib/package.tl: Remove macro-time around
sys:name-str.
* share/txr/stdlib/struct.tl: Remove macro-time around
sys:bad-slot-syntax and sys:prune-missing-inits.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The sys:bind-mac-error function is a run-time support function
for the compiler-generated code for destructuring. But the
compiler.tl source file is a bad place for it. It means that
compiled modules which need sys:bind-mac-error auto-load the
entire compiler. That easily creates an irresolveable cycle,
because the compiler is on top of the foodchain.
No, sys:bind-mac-error belongs in error.tl; the light-weight
module of low-dependency run-time support routines for error
reporting.
* lisplib.c (error_set_entries): Add sys:bind-mac-error symbol
here.
(compiler_set_entries): Remove it from here.
* share/txr/stdlib/compiler.tl (sys:bind-mac-error): Function
removed.
* share/txr/stdlib/error.tl (sys:bind-mac-error): Function
moved here.
|
|
|
|
|
|
|
|
|
|
| |
Compiled code references sys:define-method directly without
going through the struct macrology that would otherwise
trigger the autoload of the struct stuff. The symbol needs
to be added to the set of triggers.
* lisplib.c (struct_set_entries): Add sys:define-method
symbol.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We would like to load the compiled versions of the library
files, if they exist, in preference to the source versions.
So we want to issue loads without the .tl suffix; let the
load function sort it out.
* gencadr.c (cadr_register): Drop .tl suffix.
* lisplib.c (place_instantiate, ver_instantiate,
ifa_instantiate, txr_case_instantiate,
with_resources_instantiate, path_test_instantiate,
struct_instantiate, with_stream_instantiate, hash_instantiate,
except_instantiate, type_instantiate, yield_instantiate,
termios_instantiate, awk_instantiate, build_instantiate,
trace_instantiate, getopts_instantiate, package_instantiate,
getput_instantiate, tagbody_instantiate, pmac_instantiate,
error_instantiate, keyparams_instantiate, ffi_instantiate,
doloop_instantiate, stream_wrap_instantiate, asm_instantiate,
compiler_instantiate, op_instantiate): Likewise.
* cadr.c: Regenerated.
|