| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Structs can now have code which executes after an object is
initialized, which is useful for doing work like registering
objects in global lists and whatever, when those actions need
access to the initialized slots of the object.
* share/txr/stdlib/struct.tl (defstruct): Handle :posinit
syntax, by generating lambda as eighth argument of sys:make-struct
call.
* struct.c (struct struct_type): New member, postinitfun.
(struct_init): Adjust registrations of make_struct_type
to account for new parameter. The user visible
make-struct-type is registered as having one optional
argument, for backward compat.
(make_struct_type): New argument, postinitfun. Store this
in the structure. For backward compatibility, the argument
is defaulted.
(struct_type_mark): Mark the new postinitfun member.
(call_postinitfun_chain): New static function.
(make_struct, lazy_struct_init): Call call_postinitfun_chain
after slots are initialized, and after the boa function is
called.
* struct.h (make_struct_type): Declaration updated.
* lib.c (time_init): Pass eighth argument to make_struct type.
* sysif.c (sysif_init): Likewise.
* unwind.c (uw_late_init): Likewise.
* tests/012/struct.tl: Update defstruct expansion test case.
* txr.1: Document new argument of make-struct-type,
and clarify ordering of initfun with regard to
other actions. Likewise, document :postinit, and clarify
ordering of :init actions with regard to other actions.
|
|
|
|
|
|
|
|
|
|
| |
Seems like a good regression test case, combining
structs, macros, lambdas, recursion,
environments and syntactic places.
* tests/012/man-or-boy.tl: New file.
* tests/012/man-or-boy.expected: Likewise.
|
|
|
|
|
|
| |
* tests/012/cont.tl (amb-scope): New macro.
(amb): New function.
New test case using amb.
|
|
|
|
|
|
| |
* tests/012/cont.tl: New file.
* tests/012/cont.expected: New file.
|
|
|
|
|
|
| |
* tests/012/except.tl: New file.
* tests/012/except.expected: New file.
|
|
|
|
|
|
|
| |
* eval.c (me_when): Expand to if if there aren't multiple body forms.
(me_unless): Simplify progn.
* tests/012/struct.tl: Update string representation in struct test case.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/struct.tl (defstruct): Split boa
arguments on colon and generate the lambda
accordingly. The generated function detects which
optional arguments are actually present and only
performs the slot updates for those.
* tests/012/struct.tl: Corrected boa test case.
* txr.1: Documented.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/struct.tl (defstruct): Don't generate lambdas with
empty body; just generate nil, which make-struct-type accepts.
* tests/012/struct.tl: Updated defstruct expansion test.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/struct.tl (sys:bad-slot-syntax): New helper function.
(defstruct): Macro revamped with new slot specifier syntax for
writing static slots as well as methods.
* struct.c (STATIC_SLOT_BASE): New preprocessor symbol.
(struct struct_type): New members, nstslots, stinitfun, stslot.
(make_struct_type_compat): New static function.
(struct_init): Register make-struct-type to make_struct_type_compat
if compatibility is 117 or lower.
Register new intrinsics static-slot, static-slot-set, call-super-method,
call-super-fun, slot-p and static-slot-p.
(call_stinitfun_chain): New static function.
(make_struct_type): Two new arguments for specifying static slots and
an initialization function for them. Logic added for setting
up static slots and handling inheritance.
(struct_type_destroy): New static function.
(struct_type_mark): Mark the new stinitfun member of struct type.
Also iterate over the static slots in the new stslot array and
mark them.
(lookup_slot): Altered to return a loc instead of a raw pointer,
and also to accept the instance object as a member.
Now resolves static slots: it can return a loc which references
a static slot in the structure type, or an instance slot in
the structure.
(lookup_static_slot): New static function.
(slot, slotset): Implementation adjusted due to new lookup_slot interface.
(static_slot, static_slot_set, slot_p, static_slot_p): New functions.
(call_super_method, call_super_fun): New static functions.
(struct_inst_print): This function can no longer assume that the slots
list lines up with the array of slots, since it contains a mixture of
static and instance slots. Earnest slot lookup has to be performed.
(struct_type_ops): Point the destroy function to struct_type_destroy
instead of cobj_destroy_free_op. A structure type now has an array
of static slots to free.
* struct.h (make_struct_type): Declaration updated.
(static_slot, static_slot_set, slot_p, static_slot_p): Declared.
* lib.c (time_init): Update call to make_struct_type with new
arguments.
* sysif.c (sysif_init): Likewise.
* tests/012/struct.tl: Update defstruct macro expansion test.
* txr.1: Documented static slots and new functions.
|
|
|
|
|
|
| |
* tests/012/ifa.tl: New test cases which test the expansion
when the it-form is a place and there are forms before
and after it.
|
|
|
|
|
|
|
|
|
| |
* lib.c (obj_print_impl): Print whether
a function is interpreted or intrinsic, and
include argument information.
* tests/012/struct.tl: Test case relying on
function printed rep updated.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tests/common.tl (vtest): New macro based on test.
Evaluates the expected expression.
(test): Becomes a wrapper for vtest which quotes the expected
expression.
(stest): New macro for string-based comparison of output.
* tests/012/struct.expected: New file.
* tests/012/struct.tl: New file.
|
|
|
|
|
|
|
|
| |
* parser.y (quasi_meta_helper): When obj is a sys:var,
leave it alone; don't add another layer of var. Also,
do the same if it is a sys:expr.
* tests/012/quasi.tl: Added test case.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The problem is that one-argument function calls like @(whatever arg) in
a quasiliteral being turned into sys:var items.
* parser.y (quasi_meta_helper): Remove bogus check on length.
The default case is now var, so the var_s check actually matters.
The integerp check for the argument of a var form didn't do
anything because the entire if statment conditionally selected a
useless goto. Removing it for consistent treatment of var items.
* tests/012/quasi.tl: Some new test cases involving @rest.
These new tests pass whether or not we have that integerp(second(obj))
test in the quasi_meta_helper function. Either way @rest and @@rest
produce the same thing.
|
|
|
|
|
|
| |
* tests/012/quasi.expected: New file.
* tests/012/quasi.tl: New file.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* Makefile (TESTS_OUT): Don't use find to hunt down tests;
but rather wildcard. This way common.tl is not mistakenly
identified as an independent test file.
* tests/012/ifa.tl: Removed test code, placed in new file
which is loaded.
* tests/common.tl: New file.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/ifa.tl (conda): New macro.
* tests/012/ifa.tl: Adding test for conda.
* txr.1: Documenting conda.
|
|
* Makefile (TEST_OUT): Include .tl files.
(tst/%.out): New rule variant, from .tl prerequisite.
* tests/012/ifa.expected: New file.
* tests/012/ifa.tl: New file.
|