| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
| |
* socket.c: Add missing #include <netinet/in.h>.
* tests/017/glob-carray.tl, tests/017/glob-zarray.tl:
Use same definition for struct glob as Cygwin.
Both are of BSD origin.
* tests/017/realpath.tl: Do not test on Android.
* tests/common.tl (os-symbol): Detect Android and return :android.
(libc): Handle :android.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The undimensioned (array <type>) and (zarray <type>) types are
not doing UTF-8 conversion when <type> is char or zchar,
or doing what they are supposed to with the FFI character
types, which is inconsistent from their dimensioned
counterparts.
* ffi.c (ffi_varray_dynsize): if the element type is marked
for character conversion, then do the size calculation for
char and zchar by measuring the UTF-8 coded size.
(ffi_varray_alloc): Call ffi_varray_dynsize to get the size,
to benefit from the char handling. Thus when FFI allocates
buffers for a variable length array, it will allocate correct
size required for the UTF-8 encoded string.
(ffi_varray_put, ffi_varray_in): Here we must call
ffi_varray_dynsize and divide by the element type to get the
proper numer of elements. Then we must check for character
conversion and handle the cases.
(ffi_varray_null_term_in): Check for character conversion
cases and route those through ffi_varray_in, which handles
null-terminated strings.
* tests/017/ffi-misc.tl: New file.
* tests/017/ffi-misc.expected: New file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Among several issues, the main one is that these
test cases use the str-d FFI type for strings.
This type means that TXR will take ownership of the
memory; it creates the Lisp strings for the Lisp array,
and then assuming that it has owership of the C strings,
it will free them. On musl, this causes an instant crash,
probably because the strings might not be individually
coming from malloc. The only documented interface for
freing glob resources is globfree; programs cannot assume
that the strings can be freed.
* tests/017/glob-carray.expected: Updated.
* tests/017/glob-carray.tl (glob-t): Add missing flags member
of type int. Change the array element string type from str-d
to str.
* tests/017/glob-zarray.tl: Likewise, and also add a comment
to explain why we are not calling globfree in this test case.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tests/001/query-5.txr: New file.
* tests/001/query-5.expected: New file.
* Makefile (tst/tests/001/query-5.ok): Pass -B to txr for this
new test.
* tests/017/glob-carray.expected: Updated, because the glob
test globs over the contents of tests/001 directory.
* tests/017/glob-zarray.expected: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
* tests/017/glob-carray.tl (glob-t): Restructure
to case statement. Add padding to struct based on
looking at the glibc definition. Add FFI definition
based on Cygwin header.
* tests/017/glob-zarray.tl (glob-t): Likewise.
|
|
|
|
|
|
|
|
|
| |
* tests/017/glob-carray.tl (glob-t): Initialize reserve
member to 0. Since it doesn't exist on Darwin, it will
stay nil, and change the the test output. A Darwin variant
of the corresponding FFI type is provided.
* tests/017/glob-zarray.tl (glob-t): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The realpath function is called using FFI. One approach
passes a null pointer, so that the function dynamically
allocates. The return value is str-d, causing FFI to take
ownership of the pointer, freeing it. The other approach
is to pass a pointer to a large null-terminated character
array, marked for ownership transfer to the function. FFI
allocates it and puts the argument into it, which is just
a dummy empty string. The function fills that buffer and
returns it. The return is captured as a str-d, so FFI takes
ownership back, and frees the buffer.
* tests/017/realpath.tl: New function.
* tests/017/realpath.expected: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
One approach captures the paths as a carray of
strings, and explicitly frees it with globfree.
The other approach uses a zarray, taking advantage
of null termination. globfree is elided because TXR FFI
does the freeing; the types used declare to it that it
is taking ownership of a dynamically allocated vector of
dynamically allocated strings, and so it performs the
equivalent of globfree.
* tests/017/glob-carray.expected: New file.
* tests/017/glob-carray.tl: Likewise.
* tests/017/glob-zarray.expected: Likewise.
* tests/017/glob-zarray.tl: Likewise.
|
|
* tests/017/qsort.expected: New file.
* tests/017/qsort.tl: New file.
* tests/common.tl (libc): New function.
* Makefile (tst/tests/017/%): Clear TXR_DBG_OPTS so the GC
stress test isn't applied to tests in this directory.
|