1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-13 15:18:14 +00:00

342 Commits

Author SHA1 Message Date
Nick Briggs
a3f3775c0a Add missing includes and include file if compiling with COLOR defined.
File rawcolordefs.h was completely missing.
Both llcolordefs.h and rawcolordefs.h must be included in subr.c if -DCOLOR
Make newColorizeFont8() local to rawcolor.c
2024-10-22 10:13:00 -07:00
Nick Briggs
0c7b1cccd4
Merge pull request #514 from Interlisp/cleanup-USHORT-bitfields
Remove USHORT and direct "unsigned short" uses in struct bitfields
2024-10-15 19:27:13 -07:00
Nick Briggs
fae5c4956e
Cleanup in the "version array" handling in the {DSK} device (#513)
* Remove useless VersionArray parameter in maintain_version()

The 2nd argument, FileName *varray, is only ever NULL, so
remove it and simplify the code.

* Remove useless and unused VersionArray cache mechanism

* Simplify setting of file times on file close

The futimes(fd, ...) function allows changing the times of a file with
reference to an open file descriptor which allows us to avoid trying to
find a pathname by which utimes(path, ...) would operate on the inode
corresponding to the fd we have just closed.

* Remove unnecessary temporary variable for VersionArray

* In get_version_array() do not mix array and pointer access to VersionArray

* Improve {DSK} device handling of files with many versions

Somewhat dynamically allocate the version array storage, in chunks of
VERSIONARRAYCHUNKLENGTH (currently 200) allowing for up to
VERSIONARRAYMAXLENGTH (currently 2000) entries before reporting an
error. These numbers could be adjusted, or the limit could be removed.

Sorts the version array in descending order of version number to
improve the performance of check_vless_link() which stats every file
in the version array until it finds one linked to the versionless name
(which should be the highest version).  Sorting, and tracking the
number of active entries, also allows for future optimization of other
operations that currently walk through the version array.

* futimens() appears more widely available than futimes() - so use it

* Rework caching of version array for files

While enumerating the entries in a directory is relatively fast,
on some systems (macOS) stat() of a file is slow.
While there is not general agreement on the name in the stat structure
of the timespec field for the modification time, POSIX specifies it
as "st_mtim", and it is possible to #define st_mtim to be the
system-specific name in "version.h" (macOS: st_mtimespec).

* FindHighestVersion can make use of sorted order of filename/version cache

Since the list of filename and versions is maintained in descending order
by version number (see get_version_array) the highest version is trivially
located at index 0 of the filename array.
2024-10-14 14:15:02 -07:00
Nick Briggs
86ba485c3e Replace "unsigned short" use for bit-fields with DLword
Where bit-fields are defined in a structure that represents a Lisp
DLword object the DLword type is now used as the base type instead of
"unsigned short".
2024-10-14 13:17:26 -07:00
Nick Briggs
b88ea87fa8 Remove USHORT definition and replace uses with DLword
USHORT unnecessarily duplicates the DLword type that represents a
single Lisp 16-bit word.
2024-10-14 12:57:02 -07:00
Nick Briggs
aa4df518a1
Release 201 corrections (#510)
* 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
2024-09-01 16:26:30 -07:00
Anarchos
e2e2c7e394
Haiku OS port (#485)
* Haiku OS port
* haiku with X11 backend
* haiku has stpncpy
* Haiku is not Linux.
* X not stable enough on Haiku
* Haiku : settimeofday is a no-op
* Haiku : no need to define settimeofday at all (pointed by nbriggs)

---------

Signed-off-by: Anarchos <sylvain_kerjean@hotmail.com>
2024-04-10 20:14:46 -07:00
Nick Briggs
559ba779b2 Missing definition for taking_mouse_up() 2024-03-19 09:09:36 -07:00
Nick Briggs
68baf6fb30 Use ...FromStackOffset functions where appropriate
Rather than adding/or-ing the STK_OFFSET constant into a stack offset
to convert it to a pointer in general Lisp memory and then converting
from that to a native address... use the functions specifically
present to do those conversions with embedded checks on stack offset
validity.
2024-03-07 10:45:38 -08:00
Nick Briggs
939c23c03b Additional check for bad stack offset calculation
Pointer difference calculations on an inappropriate stack pointer could
result in a negative offset, not just an offset that is too large to fit
in 16 bits.  Complain if either case occurs.
2024-03-07 10:01:19 -08:00
Nick Briggs
55591557b6 Clarify the expected size/packing of bit fields in stack structures
While packing is not guaranteed, and most compilers will combine
adjacent bit fields regardless of the alignment requirements of the
datatype that is being divided, here we can be clearer that we
expect packing into 16-bit fields and we do not require (and must not
have) 32-bit alignment of the collections of bitfields.
2024-03-07 09:30:59 -08:00
Nick Briggs
ad71e1e830 Merge remote-tracking branch 'no-defun-allowed/master' into incorporate-wasm-changes 2023-12-22 19:15:28 -08:00
Nick Briggs
56e7591ada Although an unlikely case, LispNumToCInt() should handle negative SmallP numbers correctly 2023-11-17 13:11:11 -08:00
Nick Briggs
09fae0a3f5 Add file name and line number to debug print output. 2023-11-17 09:41:37 -08:00
Hayley Patton
79a788279b Add Emscripten/WASM support 2023-11-13 15:18:49 +11:00
Nick Briggs
2e893a75ab
Merge pull request #467 from Interlisp/sdl
Bring SDL into master branch
2023-05-31 14:44:04 -07:00
Nick Briggs
3223ef2839 Remove now unnecessary hdw_conf.h and all references in makefile fragments and CMakeLists.txt 2023-05-05 14:02:30 -07:00
Nick Briggs
9cc7d9e13c Remove references to KATANA and replace with MAIKO
No functional difference. Replaces a few leftover references to a prior
project name for the C implementation of the Lisp Virtual Machine with the
current name.
2023-05-05 13:37:25 -07:00
Nick Briggs
44b2412fd6
Merge pull request #465 from Interlisp/warning-reductions-clang15-part2
Warning reductions clang15 part2
2023-05-01 15:35:01 -07:00
Nick Briggs
7c322f41c4
Include for missing definition for MAXNAMLEN on Solaris (#462)
The fix to allow compiling for Alpine Linux caused breakage on Solaris
because MAXNAMLEN is defined in <dirent.h> which was now NOT included.
Pending a conversion to POSIX NAME_MAX, include <dirent.h> in "locfile.h".
2023-03-16 18:30:03 -07:00
Nick Briggs
6b69e0105f int => LispPTR for dtd_nextpage. 2023-03-10 15:24:24 -08:00
Nick Briggs
92df6316dc Use do {} while (0) pattern for FPCLEAR when it is a no-op 2023-03-09 18:48:35 -08:00
Nick Briggs
662fe9550c
Update default X11 window title (#460) 2023-03-07 14:30:05 -08:00
Frank Halasz
00d306d72f
Maiko code changes needed to compile on Alpine Linux with clang. (#456)
* Changes needed to compile maiko on Alpine Linux with clang.  Switching to Alpine on github actions to streamline maiko release builds

* Changes needed to compile maiko on Alpine Linux with clang.

Switching to Alpine on github actions to streamline maiko release builds.

  * ether_nethub.c missing a couple of includes, and incorrectly including
    <sys/poll.h> instead of plain <poll.h>
  * <dirent.h> does not define MAXNAMLEN on Alpine Linux, but "locfile.h"
    compensates for this already, if it is modified to include <limits.h>,
    so use this in "dirdefs.h".

---------

Co-authored-by: Nick Briggs <nicholas.h.briggs@gmail.com>
2023-03-07 12:12:55 -08:00
Nick Briggs
5bd9de5e36 Suppress empty-statement warning for XLOCK/XUNLOCK macro when not doing locking 2023-02-26 12:04:47 -08:00
Nick Briggs
2b5a34ebe9 Correct parameter declarations for N_OP_cons (int => LispPTR) 2023-02-26 12:04:47 -08:00
Bruce Mitchener
97bf4961ba
Remove unused struct lbits / LBITS. (#458) 2023-02-26 11:31:44 -08:00
Peter
0e731ce02d Cache cursors for SDL. 2023-02-19 10:07:28 -08:00
Nick Briggs
64e0419af3 Fix "error: implicit declaration of function" from dspsubrs
Creates an sdldefs.h, declares a few more functions in sdl.c static,
and includes sdldefs.h in dspsubrs.c when necessary.
2023-02-19 10:07:28 -08:00
Peter
e39b650f4d Only bitblt on damage.
Also add an alternative for key handling, which does not work any better...
2023-02-19 10:03:55 -08:00
Nick Briggs
900c9557ab Fix gcscan1, gcscan2 can miss finding 0th entry in gc hashtable #1038
The Lisp implementation distinguishes between 0 and NIL as the result of
    the gcscan1/gcscan2 opcodes, however the C implementation did not, since
    NIL and 0 are indistinguishable.
2023-02-17 17:01:27 -08:00
Nick Briggs
937a003bfb Correct format specification for printing DLword StackOffset (%tx -> %hx) 2023-02-17 17:01:27 -08:00
Nick Briggs
7c270c8b49 Adjust CURRENTFX definition to avoid alignment warning (with cast through (void *)) because the stack is appropriately aligned. 2023-02-17 17:01:27 -08:00
Nick Briggs
2cb51ad326 Silence warnings for incompatible pointer type assignments in stack pointer save/restore defines
CSTKPTR is "LispPTR *" while CurrentStackPTR is "DLword *", cast to "void *" to
  silence the warning, add comment pointing out size difference to explain the
  "- 1" vs "+ 2" adjustments when saving/restoring.
2023-02-17 17:01:27 -08:00
Nick Briggs
98a8d8be49 Add diagnostics for odd-sized stack free blocks and guard blocks, silence alignment upgrade warnings
Creating a free block or guard block on the stack with an odd number of 16-bit words
  will cause the system to break badly.  Always check that and report an error.

  Because the stack pointer is declared as "DLword *" (16-bit) for pointer arithmetic,
  although it is always maintained as a pointer to a 32-bit boundary, the compiler generates
  spurious warnings on casting the stack pointer to structures that require 32-bit alignment.
  Silence those warnings by casting through (void *).
2023-02-17 17:01:27 -08:00
Nick Briggs
4cc267856b Correct types in array header and sequence descriptors to match Lisp datatypes
The "fillpointer" and "totalsize" fields of the array header and the "offst"
   of the sequence descriptor were declared as LispPTR, an unsigned type that
   represents an offset into the Lisp memory, however the Lisp datatype
   declaration indicates that these are FIXP (int32_t) rather than pointers.
2023-02-17 17:01:27 -08:00
Nick Briggs
d5490ed807 Rearrange/resize FINFO and FPROP structures to avoid compiler added padding 2023-02-17 17:01:27 -08:00
Nick Briggs
cdf6024452 Add compile-time constants for SMALLP values 0 and -1 2023-02-17 17:01:27 -08:00
Nick Briggs
96b3bddf12 Resolve warning: arithmetic on a pointer to void is a GNU extension
GCC treats the size of a void as 1 for the purposes of arithmetic on
a pointer to void.  Since this was provoked by an explicit cast to
pointer to void we can replace it with a cast to pointer to char for
the same effect.
2023-02-17 17:01:27 -08:00
Nick Briggs
39b12b20ba Resolve "warning: cast from 'DLword *' to 'LispPTR *' increases required alignment from 2 to 4"
by casting through (void *) since we know that the CurrentStackPTR is maintained with 4-byte
   aligned pointers.
2023-02-17 17:01:27 -08:00
Nick Briggs
6fdb54f2c8 Minor cleanup of some casts. 2023-02-17 17:01:27 -08:00
Nick Briggs
d95b82ac45 Add (LispPTR) cast to VAG2 macro as this would otherwise produce a signed integer 2023-02-17 17:01:27 -08:00
Nick Briggs
96fcc9475a Correct parameter type declaration error for N_OP_ubfloat1
Ensure pointers have appropriate alignment for data being referenced
2023-02-17 17:01:27 -08:00
Nick Briggs
c10d339036 Correct various warning: implicit conversion changes signedness (15)
Correct various warning: implicit conversion loses integer precision (30)

Correct parameter type declaration error for  N_OP_aset1()
Ensure that appropriate types and casts are used in aref_switch()
Remove requirement for declaring "int new" when using aset_switch() macro
2023-02-17 17:01:27 -08:00
Nick Briggs
dc893dda99 Make local procedures map_code_pointers() and remimplicitkeyhash() static and remove from gccodedefs.h 2023-02-17 17:01:27 -08:00
Nick Briggs
6603957a0b Move extern declaration for IOINTERRUPTFLAGS_word to lspglob.h and remove from initsout.c
Initialize MaxTypeNumber_word from address of value cell of \MaxTypeNumber in initsout.c
Correctly extract value of \MaxTypeNumber where used in gcmaptable() (though gcmaptable() itself is unused at this time)
Update GetDTD() macro to return (void *), result will be cast to (struct dtd *) where it is needed.  Alignment should always be sufficiently large.
2023-02-17 17:01:27 -08:00
Nick Briggs
cb441fd8e5 Declare local table generic_X_keymap static and constant, and adjust reference to it. 2023-02-17 17:01:27 -08:00
Nick Briggs
50f88d9f05 Fix typo in comments, upnt => punt 2023-02-17 17:01:27 -08:00
Nick Briggs
b85e7cac80 Use (void *) casts in adr68k.h functions, after ensuring correct pointer alignment, to eliminate spurious alignment warnings. 2023-02-17 17:01:27 -08:00
Nick Briggs
7eb3cd0ceb Address alignment warnings for createcell68k()
createcell68k(typecode) returns a pointer that is aligned for the typecode
argument.  Changing the return type to "void *" puts the onus on the caller
to cast the result to an appropriately aligned object.  All current uses
in the maiko source ask for 4-byte objects (TYPE_FIXP, TYPE_FLOATP).
2023-02-17 17:01:27 -08:00