* Fix compilation for maiko version 201
Version 201 does not have BIGVM, so SWA_FNHEAD requires swapx
which is defined in byteswapdefs.h
* Fix compilation for maiko version 201
Version 201 did not have NEWCDRCODING, so the implementation of
N_OP_rplcons requires definitions from gcdata.h and address.h
* Set up makeright etc. to allow for easier compilation of alternate versions
The makeright script and the makefile-* slices it depends are modified
to allow easily specifying the RELEASE version number of the Maiko emulator
to be built. The default version remains 351, but can be changed with e.g.
RELEASE=201 ./makeright x
The object directories and executables are NOT named with the version.
* Remove unnecessary include of gcdata.h from bbtsub.c
* Users of gcdata.h should include gchtfinddefs.h explicitly if they use gcdata.h macros
* Correct modify_big_reference_count entry parameter type to reflect dependence on GCENTRY size differences between releases
* Add MAIKO_RELEASE to CMake options for building
Rationalize the SDL.h include file references so that they work on all systems
Use the correct macOS Framework options to get include path and library search path
Add makefile fragments for SDL on macOS on Apple Silicon, plus FreeBSD and Linux
on same cpus as X11
Switch to gcc rather than clang as the default compiler for Linux systems
* Rewrite keyboard and async I/O handling to improve performance and reduce dependency on async I/O signals
Replaces the SIGIO handler, which used to process X events in the interrupt context, with
a stub routine that sets a flag to signal processing is required.
Actual event processing is moved to the main dispatch loop where Lisp periodic interrupts
are handled.
Removes the X connection file descriptor from the set of fds contributing to SIGIO events
and moves the processing of X events to where the Lisp periodic interrupt is handled in
the main dispatch loop. This code is already guarded by a check for XPending() so can
be called regardless of whether any file descriptors are known to be ready.
Actual processing of async I/O events and X events are handled by procedures
process_io_events() and process_Xevents() respectively. For the most part these are
a renaming of getsignaldata() and getXsignaldata().
The Lisp periodic timer (VTALRM) was set to operate with a 25000 us period (40 Hz),
but on modern hardware it is possible to run this timer with a period of 10000 us (100 Hz)
Incidentally, a bug was noted (and fixed) in the X event handling code for motion events:
Mouse motion without any keyboard activity should not add an entry to the keyboard event
ring buffer as these events do not represent a key state change.
Since the ring buffer is of limited size, when it is filled new events are ignored
until the buffered events are processed. This resulted in the loss of a key/mouse button
transition (up or down) if the mouse was moved about "too much" between keyboard events.
A few incidental cleanups were also made:
- KBDEventFlg initialization fixed (wrong semantic type)
- Event_Req renamed to IO_Signalled (more appropriate name)
- int_io_open() sets up process (self) to handle SIGIO generated by O_ASYNC operations
- LOCK_X_EVENTS turned off since X library calls can no longer happen in an interrupt context
* Use of O_ASYNC must depend on the symbol being defined (looking at you, Cygwin)
* Add SA_RESTART flag to sigaction for SIGVTALRM periodic interrupt
* LOCK_X_UPDATE is no longer needed and should not be defined by default for Solaris in version.h
* Lock X updates for all systems and lock around X cleanup at exit
All systems which could generate I/O interrupts on the X file descriptor need
to have locking enabled, or there is a high probability that the X library
will deadlock. This requirement may be removed in the future with restructuring
of the way that the interrupt driven I/O is handled.
Ensure that the appropriate XLOCK/XUNLOCK is done around the X window
closing code.
* Also lock X updates when building with CMake.
The default targets differ depending on the display type and whether networking
is configured in or not, so it's more appropriate in the individual fragments
* `LOGINT` is only useful when `MAIKO_HANDLE_CONSOLE_MESSAGES`
is set.
* Only define some variables if `MAIKO_HANDLE_CONSOLE_MESSAGES`
is set. Flag them as static.
* Remove setting `LOGINT` from the build system as it isn't
needed because we aren't handling console messages.
Rather than having to specify or omit -DBYTESWAP in the Makefile
fragment for each system we can detect whether the system requires
byte swapping based on the __BYTE_ORDER__ C preprocessor definition.
Update CMakeLists.txt to account for this as well.
This code has not worked for a long time. Most systems now maintain
the password entries so that a password is not accessible through the
getpwent() interface. The SUBR that calls this interface may be
removed at a future time.
We now can handle these via `inc/maiko/platform.h` and the
constants defined there.
This doesn't change `OS5` for Solaris yet as that's a much wider
set of changes.
The NOFORN flag controls foreign function interface code, which
was written using the dld_* APIs which haven't existed in years.
There was a GNU dld that provided this API, but it was withdrawn
in 2006.
If this code is to be re-enabled, it will have to be changed to
use the `dlopen` family of APIs.
This removes SYSVSIGNALS as we're always and only using POSIX
signals now.
Some platform differences have been papered over. We used to
only ignore SIGPIPE when using BSD signals, but we now ignore
it all the time.
While the SIGFPE code will now compile, it hasn't been updated
to work on modern OSes fully yet as it will need to enable
the correct FP exceptions.
* Remove F_SETSIG call from Linux on X11 display.
Presumably, this was added to be like the `I_SETSIG` call on Solaris.
But it is the only `F_SETSIG` done on Linux and there isn't an
equivalent on the other platforms that we support as it is a GNU
extension.
Also, `F_SETSIG` with an argument of `0`, as here, means to send
the `SIGIO` signal, which is what is done by default.
From the man page:
F_SETSIG (int)
Set the signal sent when input or output becomes possible
to the value given in arg. A value of zero means to send
the default SIGIO signal. Any other value (including SIGIO)
is the signal to send instead, and in this case additional
info is available to the signal handler if installed with
SA_SIGINFO.
By using F_SETSIG with a nonzero value, and setting
SA_SIGINFO for the signal handler (see sigaction(2)),
extra information about I/O events is passed to the
handler in a siginfo_t structure. If the si_code field
indicates the source is SI_SIGIO, the si_fd field gives
the file descriptor associated with the event. Otherwise,
there is no indication which file descriptors are
pending, and you should use the usual mechanisms
(select(2), poll(2), read(2) with O_NONBLOCK set etc.)
to determine which file descriptors are available for I/O.
We aren't setting a non-zero value and we aren't establishing signal
handlers via `sigaction` with `SA_SIGINFO` set, so this shouldn't
be doing anything important for us.
* Stop setting _GNU_SOURCE for GNU libc extensions.
We were previously doing this to get access to the
`F_SETSIG` flag for `fcntl`, but this isn't being
used any longer.
* Always follow NEW_STORAGE code paths.
This removes the code paths for the pre-NEW_STORAGE code.
* Remove NEW_STORAGE from build system.
The code no longer refers to `NEW_STORAGE`, so we can remove
this from the build system.
`timer.c` uses `F_SETSIG` which is a GNU extension. As such, it
needs `_GNU_SOURCE` to be defined, but this was only done for
x86_64, not the other Linux platforms that we have build system
support for.
Closesinterlisp/medley#97.
* Move clang/gcc options into makefile-header.
This puts all of the shared options into a single place so that
we can easily update it.
* Add -fwrapv to the clang/gcc command lines.
This is a step along the way to fixing interlisp/medley#90.
Enabling `-fwrapv` will let overflow checks that rely upon undefined
behavior to work correctly. Without this, with modern versions of
clang and gcc, the overflow checks in the C code are eliminated
by the compiler, resulting in incorrect behavior on the part of
Maiko.
See the linked bug for details and discussion.
Hopefully, this usage of `-fwrapv` will go away once we're using
the correct compiler builtins to detect and handle overflow
correctly.
The FSERROR define is on all the time now. It was not controlling
all of the functionality, with many places setting Lisp_errnno
outside of the code controlled by the define.
On SunOS4, we build `xc.c` by jumping through a lot of hoops to
perform a particular set of operations. We don't do that on other
platforms and this will help clean up the Linux and FreeBSD makefiles.
These directives were already not present in the macOS makefiles.
This is an internal macro to GNU libc and wasn't meant to be
defined like this. Well, it was. It was deprecated and removed
some years ago, so it isn't doing anything at all here now.
Be clear that the code is not clean for pointer aliasing.
modified: bin/makefile-darwin.386-x
modified: bin/makefile-darwin.x86_64-x
modified: bin/makefile-linux.386-x
modified: bin/makefile-linux.armv7l-x
modified: bin/makefile-linux.x86_64-x
modified: bin/makefile-sunos5.386-x
Add makefile for Linux on x86_64 platforms
Remove include <stropts.h> for Linux as modern systems have dropped this
Adjust code to account for fcntl() vs ioctl() for generating signals on X I/O
Adjust includes for time related include files for modern Linux systems
modified: bin/makefile-linux.386-x
new file: bin/makefile-linux.x86_64-x
modified: inc/version.h
modified: src/mkvdate.c
modified: src/timer.c