1. ecl_peek_char had outdated comment presumbly from before we've introduced
stream dispatch tables - that comment has been removed.
2. fix erroneous specializations
- of STREAM-UNREAD-CHAR
By mistake we had two methods specialized to ANSI-STREAM, while one were
clearly meant to specialize to T (in order to call BUG-OR-ERROR).
- of winsock winsock_stream_output_ops
stream peek char was set to ecl_generic_peek_char instead of
ecl_not_input_read_char
3. change struct ecl_file_ops definition
a) ecl_file_ops structure change order of some operations to always feature READ
before WRITE (for consistency)
b) we are more precise in dispatch function declaration and specify the return
type to be ecl_character where applicable
The function operates on base_string while if it was supplied with an extended
string then ecl_base_char array became ecl_character, and that lead to bad
copies. To fix it we ensure that the passes string is first coerced to cstring.
This commit splits one garguntulum file into numerous orthogonal stream types:
- strm_os -- c99/posix/windows streams
- strm_clos -- gray streams
- strm_string -- string streams
- strm_composite -- composite streams (echo, broadcast, synonym ...)
- strm_common -- common errors, byte manipulation routines etc
- strm_sequence -- si_write_sequence and si_read_sequence (fast I/O)
- strm_eformat -- external format processing routines (unicode etc)
After this split file.d contains only open/close. This will be the place to
dispatch to a virtual filesystem.
At least in two from four cases continuing from the error lead to an error:
- for concatenated stream we've tried to dispatch on CAR that was NIL (segfault)
- for string stream we've decremented the position below 0
Also change these functions to defined macros ecl_unread_* that expand to
FEerror (in internal.h). This is in anticipation of splitting file.d.
Atomics are needed by stacks.
Replace ecl_atomic_push -> ecl_atomic_psh that takes as an argument a
preallocated cons. ecl_atomic_push is replaced with a macro.
We've hit qutie fast 3/4 of the limit, so this pull request limits pipelines to
be run only when we commit to the branch develop and on merge requests.
On OpenBSD, FILE is opaque (starting from upcoming OpenBSD 7.8).
FILE_CNT() macro is implementable using `size_t __freadahead(FILE *stream)` function (provided for gnulib compat).
With recent versions of the android NDK, there is no need to create a
separate toolchain anymore. Moreover, the LDFLAGS and CPPFLAGS are
obsolete. Also, we can't call the C compiler with a `-Dandroid`
argument as we used to since that conflicts with uses of the `android`
identifier within the header files of the android C standard library.
Therefore, we change from `thehost=android` to `thehost=ANDROID` in
uppercase. Finally, make the test script run more reliably by starting
an adb server before we change TMPDIR.
This is needed to allow for cross compiling from a compiler with a
different set of configure options (e.g. compiling for a target which
doesn't support complex floats from a host which does).
Previously, there were a lot of places that turned on or off C macros
which finally determined whether some particular entry was found
in *features* or not. Now, we do this all in the configure script.
This is necessary for cross compilation from a non-compatible host
which may have different features.
We were trying to check if the output of the program is empty but we
were passing `:output nil` to ext:run-program. Thus, the stream from
which we trying to read was nil which is the stream designator for the
standard input. The empty read succeeded only by chance if the
standard input had no available characters to read.
After this commit
(setf (logical-pathname-translations "x")
(list ("X:a;*;b;*;*.*" "/hello/*/hi/*/what/*.*")))
(translate-logical-pathname #p"x:a;bonjour;b;barev;greetings.me")
will return a correct result
#P"/hello/bonjour/hi/barev/what/greetings.me"
Related to #784.
The function find_list_wilds incorrectly collected results from calling
find_wilds, and the latter returned incorrect results when the component fully
matched. It seems that this was a single function that was later split with
errors.
This change saves us from a segfault when we try to match multiple wild
components. Previously find_list_wilds for
(setf (logical-pathname-translations "x")
`(("X:a;*;b;*;*.*" "/hello/*/hi/*/what/*.*")))
;; ((#P"X:A;*;B;*;*.*" #P"/hello/*/hi/*/what/*.*"))
(translate-logical-pathname #p"x:a;bonjour;b;barev;greetings.me")
returned #1=((BONJUR) #1# BAREV).
Moreover fix an issue where we've compared incorrect character in find_wilds to
determine the end of the glob (we've compared the source character with #\*
instead of the character after).
Fixes#784.
On x86_64, gcc 12.2.0 from debian 12 miscompiles the code we had
previously. It generates code that copies symbol.macfun and
symbol.sfdef using an aligned move SSE instruction which requires 16
byte alignment of its operand. This alignment is not present in
general, leading to a segfault for instance when calling (copy-symbol
t t). By reordering the assignments, we avoid triggering the bug.
these functions are not used by us yet, so these issues were not noticed. Most
notably we did not assign the vector type and did not release the object.
We don't eagerly dereference bytecodes.data->vector.self in case when data is
assigned ECL_NIL. IN that case the *data vector is NULL. That saves us from the
necessity to allocate a vector when we don't use the data segment at all.
Previously we did not perform necessary checks for whether we should update the
frame size and stack pointer or whether we should resize the stack. This commit
fixes these functions and adds a missing function to API ecl_stack_frame_pop.
This is to avoid a situation where the form evaluated by CMP-EVAL treats the
compiler environment as its own local environment. That caused recently a
regression, because we count indexes in FIFO order for sake of dlat closures
Before local closures:
v first from top (correct)
[compiler-env-record form-record]
After local closures
v first from bottom (incorrect)
[compiler-env-record form-record]
After this commit:
v first from bottom after the boundary
[compiler-env-record | form-record]
This way we don't need to separately keep track for whether the function
boundary was crossed for the env, and we don't need to /think hard/ when
captured vector should be allocated.
Moreover the test for whether the parent crosses the function boundary is
precise now, and we save memory when we don't need to allocat a vector.
Commit f36f53a933 accidently(?) reversed the test
by adding the else clause without switghing != to ==.
SYMBOL-MACROLET does not change top-levelness of its children (unlike other
bindings), so we should set lexical_level=1 when we encounter /other/ binding
than SYMBOL-MACRO.
Moreover we add :DECLARE to the mix. The macro LOCALLY does not change
top-levelness either.