| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
| |
* tests/012/stslot.expected: New file.
* tests/012/stslot.tl: New file. b/tests/012/stslot.tl
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* struct.c (static_sot_ens_rec): This change is in the case
when a static slot is being ensured in a struct type which
already has that static slot by inheritance. In that
situation, the inheritance is severed and the struct gets its
own non-inherited slot of that name. Then all of the derived
structs are scanned. If any contain the original inherited
slot, it is updated to the new, non-inherited one. The bug
here is that we were copying the home_offs field of the
original inherited slot to the new one! This is wrong; the new
slot is not related to the original inherited one. The new
slot is a home slot and its own offset must be home_offs.
We can calculate that simply as its delta from the static slot
table base.
|
|
|
|
|
|
|
|
|
| |
Fixes from review by Joe Eib.
* configure: switch polarity of main return value, so it
doesn't appear confusing, even though the test program is
never run. Remove stray "set -x" command. Fix wrong use of
nonexistent EXTRA_CFLAGS which should be EXTRA_FLAGS.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This addresses a failure to build with libffi on
Arch Linux, reported by Joe Eib.
* Makefile (opt/ffi.o, dbg/ffi.o): Pull LIBFFI_CFLAGS
into TXR_CFLAGS for just these object files.
* configure (have_pkgconfig, libffi_cflags): New variables.
(gen_config_make): Create new Makefile variable,
LIBFFI_CFLAGS, from libffi_cflags.
New configure test to detect pkg-config.
Libffi test falls back on using pkg-config to test for
existence of the library and to get the cflags and ldflags.
Any needed cflags end up in LIBFFI_CFLAGS and are used
only when compiling ffi.c.
|
|
|
|
|
|
|
|
|
|
|
|
| |
For convenience, we allow a cptr to be converted to foreign
representation even if its tag doesn't match the FFI type
being used for the conversion. This is allowed only in the
case that the cptr is a null pointer, and its tag is nil.
* lib.c (cptr_handle): Defeat the type check if the pointer
is null, and its tag is nil. Thus, the FFI variable cptr-null
will conveniently convert to any cptr type in the ffi_cptr_put
operation and others.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (make_zstruct): New function.
(ffi_init): Register make-zstruct instrinsic.
* ffi.h (make_zstruct): Declared.
* lisplib.c (ffi_set_entries): Add znew to autload list.
* share/txr/stdlib/ffi.tl (znew): New macro.
* txr.1: Documented make-zstruct and znew.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim, protsym.c: Regenerated.
|
|
|
|
|
|
| |
* genvim.txr: do syntax coloring for symbols that are
defined as FFI types or are FFI type operators.
Also, include type operators in the Vim lispwords list.
|
|
|
|
|
|
|
|
|
| |
* genvim.txr: remove code which probes a few symbols with
boundp. The point of this is to stimulate some autoloading,
but it is based on a misunderstanding. The symbols in the
lisplib.c autoload module are all interned. When the usr
package is walked, they all get checked with boundp,
and all all library autoloads are triggered.
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (ffi_type_operator_p, ffi_type_p): New functions.
(ffi_init): Register ffi-type-operator-p and ffi-type-p
intrinsics.
* ffi.h (ffi_type_operator_p, ffi_type_p): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
| |
* txr.1: The table showing fixed-width delimiting examples
doesn't use the right font and doesn't look good in HTML or
PDF. Let's replace it with just a plain verbatim block, and
clarify the leading text also.
|
|
|
|
| |
* txr.1: Document Ctrl-Z and Ctrl-L working in editing help.
|
|
|
|
|
|
| |
* linenoise/linenoise.c (show_help): Handle Ctrl-Z and Ctrl-L
commands, ensuring that the display stays on the same page
when these are processed.
|
|
|
|
|
| |
* txr.1: New section "Editing Help" under "Interactive
Listener" describing Ctrl-X ?
|
|
|
|
|
|
|
|
|
| |
* ffi.c (make_ffi_type_struct): Fix incorrect shift
calculations, which are still being done from the
unit_offs byte rather than the correct offs byte where
the bitfield is actually placed. It is bit_offs which
has the correct bit offset of the bitfield relative
to offs.
|
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (make_union): Two arguments added. These
are optional.
(ffi_init): Update registration of make-union as
three-parameter function, with one required arg.
* ffi.h (make_union): Declaration updated.
* txr.1: Documented.
|
|
|
|
|
| |
* ffi.c (ffi_type_compile): Syntax for union type wrongly
using struct symbol rather than union.
|
|
|
|
|
| |
* txr.1: Split mapcar "zipper" example into two lines to
prevent wrapping and add missing -> between form and output.
|
|
|
|
|
|
| |
* ffi.c (ffi_type_compile): Assign full bool syntax to
cloned type, rather than just the argument syntax denoting the
base type.
|
|
|
|
|
| |
* ffi.c (ffi_make_call_desc): Throw error if argument or
return value is a bitfield.
|
|
|
|
|
| |
* ffi.c (ffi_type_compile): Check for too few or too many
arguments in a compound form.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (prod_common): New static function.
(maprodv, maprendv): New functions.
(eval_init): Registered maprod and maprend intrinsics.
* eval.h (maprodv, maprendv): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (enumed_s): New symbol variable.
(ffi_type_compile): New case for enumed type op.
(ffi_init): Initialize enumed_s.
* ffi.h (enumed_s): Declared.
* txr.1: enumed documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This lays the groundwork for enumerations based off types
other than int. All we need to do is implement the
syntax for this.
* ffi.c (ffi_enum_put, ffi_enum_get, ffi_enum_rput,
ffi_enum_rget): Retrieve the element type descriptor
and recurse into its put, get, rput and rget operation,
respectively, instead of hard-coded calls to the int
operations.
(make_ffi_type_enum): New argument, base_type.
Numerous properties of the enum type are taken from base_type:
the FFI type, the alignment, size, and alloc, free and
clone operations. The base type is installed as eltype.
(ffi_type_lookup): Static function relocated.
(ffi_type_compile): In the enum case, resolve the int type
and pass to make_ffi_type_enum.
|
|
|
|
|
|
| |
* ffi.c (ffi_enum_put, ffi_enum_rput): Fix function name
appearing in quotes in error diagnostic. Fix nonexistent
member being wrongly reported as nil.
|
|
|
|
|
|
|
|
|
|
|
|
| |
We either mishandle return values, or crash due to
a null rput/rget function pointers on aggregate types
and bools.
* ffi.c (ffi_bool_rput, ffi_bool_rget): New static functions.
(make_ffi_type_pointer, make_ffi_type_struct,
make_ffi_type_union, make_ffi_type_array): Fill in rput and rget.
(ffi_type_compile): Fill in rget and rput for bool with new
functions.
|
|
|
|
|
|
|
|
|
| |
* ffi.c (ffi_varray_null_term_in): Rewrite nonsensical
code that refers to the newly created empty output array
as input. We must perform the in semantics on all the
original elements. Then get semantics on any new elements
if the array was extended, and the copy flag is true
(by-ref nuance).
|
|
|
|
|
|
|
|
| |
* lisplib.c (ffi_set_entries): Add deffi-sym to autload list.
* share/txr/stdlib/ffi.tl (deffi-sym): New macro.
* txr.1: Documented.
|
|
|
|
|
|
| |
* txr.1: Provide the correct description of the syntax
allowed for var-expr; i.e. that deffi-var can be put into
a with-dyn-lib form and all that.
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register new intrinsics cptr-cast and
int-cptr.
* lib.c (cptr_cast, int_cptr): New functions.
* lib.h (cptr_cast, int_cptr): Declared.
* txr.1: Documented.
|
|
|
|
|
| |
* txr.1: Fix syntax block under cptr-obj giving
function name as cptr-int.
|
|
|
|
| |
* ffi.c (ffi_varray_alloc): Add tft->null_term to length.
|
|
|
|
|
|
| |
* ffi.c (ffi_varray_null_term_in): Pass zero to replace
rather than 0, which corresponds to nil and is interpreted
as a list by replace.
|
|
|
|
| |
* txr.1: Fix date to 2017-06-25.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim, protsym.c: Regenerated.
|
|
|
|
|
|
| |
* ffi.c (make_ffi_type_union): Create cobj with correct
cobj_ops structure: ffi_type_struct_ops, not
ffi_type_enum_ops.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We can't use the eltype field of the type structure
to store the cptr tag symbol, because that is expected
to be a type object and not a symbol.
* ffi.c (struct txr_ffi_type): New member, tag.
(ffi_cptr_put, ffi_cptr_get, ffi_cptr_alloc): Refer to
tag rather than eltype.
(ffi_type_compile): Handle the compound cptr type
using the same code as the simple one in ffi_init_types: use
make_ffi_type_builtin rather than make_ffi_type_pointer.
Install the tag into the tag field. Also set up the forgotten
alloc and free routines.
(ffi_init_types): For cptr, explicitly initialize the tag
to nil. This is not necessary since the structure is calloced,
and we rely on that for nil all over the place, but here it
serves as a reminder that cptr has a tag.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The recent commit "ffi: elide useless by-value in calls."
neglects to mark a few types with the by_value_in flag.
The string types need it because their in action performs
memory freeing, which must be done regardless of the
by-value or by-pointer semantics.
* ffi.c (ffi_init_types): set by_value_in to 1 for str,
bstr and wstr. In general, if the type needs a release
function, it needs by_value_in to be set.
|
|
|
|
| |
* txr.1: Fix "out operation" that should be "in operation.
|
|
|
|
|
|
|
| |
* txr.1: the actions argument of tcsetattr is
optional and its defaulting is correctly described.
Fix the syntax synopsis which wrongly indicates that
it is required.
|
|
|
|
|
| |
* txr.1: In the Dialect Notes, one of the notes is
confusingly split into two paragraphs.
|
|
|
|
|
| |
* txr.1: A symbol is not "returned" by the reader; drop that
text. Use the terminology that a token is interned.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We can avoid calling in methods in the by-value nuance
(copy == 0) on types known not to have by-value in semantics.
Basic types have no by-value in.
Pointers inherently have by-value in.
An aggregate has by-value in semantics if any of one
of its members does, otherwise not.
* ffi.c (struct txr_ffi_type): New bitfield member,
by_value_in.
(ffi_ptr_in_in, ffi_ptr_in_d_in): Elite in call if target
type's by_value_in flag is clear.
(ffi_struct_in): Short-circuit to a return if doing by-value,
and the FFI struct type has no by-value semantics.
(ffi_array_in_common): Likewise. In this code change, we
just have to replace the test whether the element type has
an in method with a test of its by_value_in flag.
(make_ffi_type_pointer): Set by_value_in flag to 1, since
pointers have by value in semantics. This is true also of
ptr-in, because a structure passed as an in parameter to a
function via ptr-in could itself contain ptr or ptr-out
elements.
(make_ffi_type_struct): Set the type's by_value_in if
any element type's by_value_in is true.
(make_ffi_type_array): Propagate the by_value_in flag from
the element type to the array type.
(ffi_call_wrap): Calculate the in_pass_needed local flag
from the by_value_in flags of the arguments, not from whether
or not they have an in function. Only call the in function
for arguments which have the flag set.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The theme here is that if a struct or array is
being subject to a by-value in operation, there
is nothing to do for that aggregate itself. So
if there is no corresponding Lisp object, we
should not create one. The caller isn't expecting
it and will throw it away. If it is known that no
element of an aggregate supports by-value semantics,
then the operation should short-circuit, and not
perform a useless loop.
* ffi.c (ffi_struct_in): If the strct parameter is nil,
don't unconditionally make a new structure; do so only
when the copy flag is asserted (by reference semantics).
If there is no Lisp struct object and by value semantics is
in effect, there is no point in doing anything; just
short-circuit to a nil return.
(ffi_array_in_common): If doing by value semantics, and
there is no vector object or the structure element type
has no by value in semantics (such as a basic type),
then short circuit to an early return.
(ffi_array_in): Only do the special string decoding when
reference semantics is in effect; there is no point
in extracting strings back from a by-value struct.
If by-value semantics is in effect, we fall through to
the ffi_array_in_common call even for character types;
but since those types have no by-value in semantics,
that function will just short-circuit, which is what we want.
(ffi_varray_in): If there is no vec, bail out with nil,
regardless of whether this is by value or not.
Just return vec if by-value semantics is in effect; don't
try to update it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (union_s): New symbol variable.
(ffi_find_memb, ffi_memb_not_found): New static functions.
(ffi_union_in, ffi_union_put, ffi_union_get): New static
functions.
(make_ffi_type_union): New static function.
(ffi_struct_compile): Handle union syntax using
ffi_struct_compile to compile the member definitions to types,
and make_ffi_type_union to produce the type node.
(struct uni): New struct type.
(uni_struct, uni_struct_checked): New static functions.
(union_destroy_op, union_mark_op): New static functions.
(union_ops): New static struct.
(make_union_common, make_union_tft): New static functions.
(union_get_ptr, make_union, union_members, union_get,
union_put, union_in, union_out): New functions.
(ffi_init): Initialize union_s. Register intrinsics
make-union, union-members, union-get, union-put, union-in,
union-out.
* ffi.h (union_s, union_get_ptr, make_union, union_members,
union_get, union_put, union_in, union_out): Declared.
* txr.1: Documented unions.
|
|
|
|
|
|
|
|
|
|
|
| |
Upcoming work is going to benefit from a pointer for
navigating from the txr_ffi_type structure to the Lisp object
whose implementation is that structure.
* ffi.c (struct txr_ffi_type): New member, self.
(make_ffi_type_builtin, make_ffi_type_pointer,
make_ffi_type_struct, make_ffi_type_array,
make_ffi_type_enum): Initialize self pointer.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Don't bother creating and filling the ffi_type elements[]
array for a structs or array. Let's punch in the size and
alignment fields with the values we calculate ourselves
already, and set up a dummy elements[] array that contains
only a null terminator.
* ffi.c (struct txr_ffi_type): New member, elements:
one element dummy array that holds a null pointer.
(ffi_type_struct_destroy_op): Do not free ft->elements,
since it isn't dynamically allocated any more.
(ffi_struct_clone, ffi_array_clone): Don't copy the elements
array; just set up a dummy elements array in the copied type.
(make_ffi_type_struct, make_ffi_type_array): Eliminate the
dynamic allocation of the elements array. Point ft->elements
to the dummy array. Set up the ft->size and ft->alignment.
|
|
|
|
|
|
|
|
| |
* ffi.c (ffi_float_put): Fix silly range check:
FLT_MIN and FLT_MAX are, of course, both positive.
Also, fix num being used as an argument in the error
diagnostic. It's the address of a C function, not
an object.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (bool_s): New symbol variable.
(ffi_bool_put, ffi_bool_get): New static functions.
(ffi_type_compile): Handle (bool <type>) parametrized type.
(ffi_init_types): Register bool typedef for (bool uchar).
(ffi_init): Initialize bool_s.
* ffi.h (bool_s): Declared.
* txr.1: Documented.
|