1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-17 00:22:59 +00:00

256 Commits

Author SHA1 Message Date
Nick Briggs
78f0d3c511 Convert from LADDR_from_68k to LAddrFromNative in inlnSPARC.h 2022-09-01 12:53:24 -07:00
Nick Briggs
ed77b2fb7b Convert to LAddrFromNative, NativeAligned2FromLAddr in return.h 2022-09-01 12:53:23 -07:00
Nick Briggs
7dc889249b Convert from LADDR_from_68k to LAddrFromNative in arith.h 2022-09-01 12:53:23 -07:00
Nick Briggs
ee777103ad Convert from Addr68k_from_LADDR/LADDR_from_68k to NativeAligned4FromLAddr/LAddrFromNative in stack.h 2022-09-01 12:53:23 -07:00
Nick Briggs
cde0be42f0 Replace Addr68k_from_LADDR by NativeAligned[x]FromLAddr() as appropriate in inlineC.h 2022-09-01 12:53:23 -07:00
Nick Briggs
010329f29d Convert to NativeAligned4FromLAddr/LPage in macros defined in cell.h 2022-09-01 12:53:23 -07:00
Nick Briggs
8a0804831e Once and only once for code in GetXXX68k() and GetXXXnew() macros 2022-09-01 12:53:23 -07:00
Nick Briggs
eae42d1a6d Switch from Addr68k_from_LADDR to NativeAligned4FromLAddr in arith.h 2022-09-01 12:53:23 -07:00
Nick Briggs
ed5e504b06 Resolve ~90 cast-align warnings generated by macros in my.h 2022-09-01 12:53:23 -07:00
Nick Briggs
215a22ea9f Introduce functions to convert between lisp addresses and native pointers
Instead of using a single macro that converts from a lisp pointer to
  a native pointer to a 2-byte aligned item then perhaps casting to objects
  that require 4-byte alignment... use separate functions for 2-byte and
  4-byte aligned pointer results.  The clients should be explicit about
  which alignment they require, and the conversion functions can check
  (perhaps in DEBUG mode) that the resulting pointer is on an appropriate
  boundary.

  This commit defines the functions but does not introduce any uses.
2022-09-01 12:53:23 -07:00
Nick Briggs
d35b964393 Cleanup in eqf.c
Correct procedure declarations since N_OP_xxx function args are all LispPTRs
    Replace my.h defn of IsNumber() with Numberp() defn in lsptypes.h
2022-08-15 16:19:38 -07:00
Nick Briggs
58f6f68c7e Correct procedure declarations since N_OP_xxx function args are all LispPTRs 2022-08-15 16:18:37 -07:00
Nick Briggs
873d4927ce Wholesale removal of deprecated register attribute from all source files 2022-08-15 15:04:07 -07:00
Nick Briggs
d509224797 Add explicit cast to byte_swap_word to resolve implicit conversion issue
warning: implicit conversion loses integer precision: 'int' to 'unsigned short'
2022-08-15 14:43:32 -07:00
Nick Briggs
89c01ad00a Fix pointer vs. unboxed fixp in certain fields in onde_array/general_array 2022-08-15 13:32:08 -07:00
Nick Briggs
3075cc93bb Fix types for smallp manipulation in arith.h
Introduce GetPosSmallp for converting an unsigned value to smallp
    Use [unsigned] long as input to Get...Smallp to avoid shortening input
2022-08-15 13:26:53 -07:00
Nick Briggs
4a02a1a24d Rename lisp2c's LispStringLength to LispStringSimpleLength
Avoid confusion with the LispStringLength definition in locfile.h
    This lisp2c function ONLY looks at the fillpointer for the length.
2022-08-14 21:43:48 -07:00
Nick Briggs
813d2aa2b5 Inline GetSmalldata and GetSmallp to improve type diagnostics, code, and readability in arith.h 2022-08-14 16:53:22 -07:00
Nick Briggs
8d804ad5cd Cleanup signedness, remove abuse of comma operator, use C99 local for-loop decls where appropriate 2022-08-14 13:46:27 -07:00
Nick Briggs
ad045ce356 Alarm timer requires an unsigned timeout value in timer.c, timeout.h 2022-08-14 12:50:16 -07:00
Nick Briggs
1c5881fad4 Cleanups in uutils.c
Resolve shadow declarations
    Remove deprecated register attribute
    Simplify for-loop syntax, use C99 style loop var declaration
    Make (not used elsewhere) string functions static
2022-08-14 11:44:27 -07:00
Nick Briggs
89c3041339 bitmaps only referenced internally in xbitmaps.h can be static 2022-08-14 10:34:24 -07:00
Nick Briggs
142b5679cf Use correct type for FIXP (and pointer to it), and reformat for readability in my.h 2022-08-13 19:33:24 -07:00
Nick Briggs
0e7dc75fd9 Use correct type for pointer to FIXP in arith.h 2022-08-13 19:31:05 -07:00
Nick Briggs
5a7cfcbbe7 Correct procedure declarations since N_OP_xxx function args are all LispPTRs 2022-08-13 15:55:11 -07:00
Nick Briggs
9e2b3eb882 Types work out better and better code if not trying to over-optimize memory accesses in arith.h 2022-08-13 15:35:18 -07:00
Nick Briggs
d842b284ac correct prototype declaration for process_io_events 2022-08-13 09:11:58 -07:00
Nick Briggs
d91de66322 Correct -Wformat-pedantic warnings
Many of the warnings were newly visible after the DBPRINT macro
was modified, but the pedantic warnings also caught existing printf
family usage which was not strictly correct.

Mostly replacing 0x%x with %p for pointers, adding (void *) for
those and other pointers, %td for ptrdiff_t, but also changing
some function parameters from UNSIGNED (uintptr_t) to int
where that was the more appropriate type.
2022-08-11 15:38:07 -07:00
Nick Briggs
e72dd332a3 Missing include for kprintdefs.h causes error in tosret.h when compiling with OPTRACE enabled. 2022-08-11 14:22:35 -07:00
Nick Briggs
b94cb8809b Combine three small arithmetic opcode implementation files into one
Combines arith2.c ... arith4.c files and their associated header files
into new arithops.c/arithopsdefs.h files, and adjusts the CMakeLists.txt,
and old-style makefile-tail.  Also updates  makefile-dos,
inlnPS2.h, and inlndos.h to reflect these changes, though these are not
used.
2022-08-10 20:16:59 -07:00
Nick Briggs
601d6e9142 Combine six small array opcode implementation files into one
Combines the array..array6 files and their associated header files
into new arrayops.c/arrayopsdefs.h files, and adjusts the CMakeLists.txt
and old-style makefile-tail to reflect these changes.
2022-08-10 12:54:06 -07:00
Nick Briggs
3d9f090e70
Cleanup of includes and related changes based on include-what-you-use diagnostics (#436)
Remove unused #define PERCENT_OF_SCREEN in MyWindow.h
Move structures for dir.c to dirdefs.h where they are used
Resolve S_CHAR vs S_CHARACTER in favor of S_CHARACTER and cleanup #defines
Fix  = vs == bug in FSDEBUG code in dir.c
Eliminate duplicate/unused constant definitions in gcr.c
Declare static internal function bytecmp in mkatom.c
Update many source and include files to include headers for what they use
2022-08-10 11:07:57 -07:00
Nick Briggs
4bd1f4b49a
Ensure compiler sees debug printf even if won't be executed (#433)
If the debugging printf macros are elided by the preprocessor
rather than being removed by the compiler's optimizer then
the debugging statements may get out-of-date as variables are
modified.  Wrap the non-debug case in "if (0) ..." instead.
2022-08-09 18:11:05 -07:00
Nick Briggs
a15de4df10
quick_stack_check() should return a result indicating status (#432) 2022-07-24 21:49:39 -07:00
Nick Briggs
5fa05ac3d7
Cleanup types in URaid and move declarations to separate include file (#428) 2022-07-20 10:45:37 -07:00
Nick Briggs
9a10f63fe6
some cleanups in the arithmetic operations code (#427)
* arithmetic opcode implementations should return LispPTR rather than int

* all callers of ERROR_EXIT() have return type LispPTR, therefore ERROR_EXIT should too

* N_[I]GETNUMBER, [N_]ARITH_SWITCH need (int) casts for some large constants that would otherwise be unsigned

* Expand use of macro N_ARITH_BODY_1_UNSIGNED and correct types

* Remove unused macros N_ARITH_BODY_1 and N_ARITH_BODY_1_UNSIGNED

* Cast to correct type for storing to TopOfStack, and return type of TIMER_EXIT()
2022-07-20 10:28:21 -07:00
Nick Briggs
77957d421a
fix some compiler warnings (#423)
* Pedantic C compilers want an extern declaration separate from initialization

* Remove duplicate definitions for fns in initdspdefs.h from display.h

* Remove misleading comments on structure member offsets and reorder to minimize padding
2022-07-20 10:18:59 -07:00
Nick Briggs
008ce703e7 Use inttypes.h to provide uintptr_t/intptr_t of machine dependent size for UNSIGNED/INT declarations 2022-01-22 15:16:36 -08:00
Nick Briggs
c7fd28a438 Removed unused (and unimplemented) stackcheck() and stackoverflow() routines
These routines were stubs that did nothing and were not called from anywhere
so lack value in even providing a template or hook for a fuller implementation.
Also note that "stackcheck" conflicts with a predefined symbol in some runtime
libraries.  Should these be implemented in the future they should use a
maiko-specific name.
2021-12-09 14:57:45 -08:00
Nick Briggs
e1efc860c4 Prefer typedef over #define where it can be used for type definitions 2021-12-09 14:48:52 -08:00
Nick Briggs
212a0fa9c6
Add some support for cross-compilation to MC68000 AmigaOS (#412)
Add m68k to recognized CPUs (machinetype)
Add amigaos to recognized operating systems (osversion)
Add ability to override "config.guess" output w/ LDEARCH= to osversion
Add platform.h clauses to recognize AmigaOS 3 using gcc to cross-compile
2021-12-08 12:03:04 -08:00
Nick Briggs
65bbcb7d9d
Remove makepathname() (#410)
makepathname() is only ever called with one of two constant string
arguments, in one case (DOS) such that it only does a strncpy(...),
and the other case (non-DOS) expanding "~" to the current user's home
directory. Additional code duplicates realpath() functionality but is
never used.
2021-11-26 19:53:26 -08:00
Nick Briggs
987cf4c7c6
Correct error for missing byteswap macros in tosfns.h EVAL implementation (#407)
Commit c46fcce307018df6554805050ceb634d72e737c9 fixed a warning for
incompatible pointers to nnewframe() but did not consider that the
order of the DLwords is swapped depending on the endianness of the
system it is running on.  Add the necessary GETBASEWORD() macros to
access the items when constructing the pointer.
2021-11-06 18:36:25 -07:00
Nick Briggs
c46fcce307
Fix "warning: incompatible pointer types" in EVAL implementation (#406)
nnewframe() as called from the EVAL implementation expects to be passed
the address of an array of two DLwords.  Do that, and compose the 32-bit
result correctly rather than passing the address of a (32-bit) LispPTR
and then having to swapx() that result to get the expected value.
2021-11-04 20:18:27 -07:00
Nick Briggs
de5ea2110f
Correct integer type warnings (#405)
* Correct warning: cast to smaller integer type -- X_init/lispbitmap

* Fixes to INTRSAFE, INTRSAFE0 and ensure TIMEOUT, TIMEOUT0 used appropriately

INTRSAFE and INTRSAFE0 must clear errno before executing the library or system
call because not all library calls set errno on success.
Avoid casting pointers or larger integer values down to smaller ints before
comparing to 0 or -1, and use NULL (a pointer) rather than 0.

Fix cases where the result of the library call is a pointer rather than an int
to use TIMEOUT0 instead of TIMEOUT, testing for NULL rather than -1
on timeout (errno == EINTR)

* Remove useless validity check of LASTVMEMFILEPAGE_word pointer

* Convert pointer arithmetic type in drawline from int to ptrdiff_t

* Add NOTE warning about a 32-bit vs 64-bit issue affecting currently unused GET_NATIVE_ADDR_FROM_LISP_PTR
2021-11-04 09:08:55 -07:00
Nick Briggs
c39b751f42
Rework make_atom() to allow removal of parse_number() (#404)
No calls to make_atom() depend on the ability to parse the atom's
pname as a number.  Additionally, the parse_number() implementation
used here was non-functional.

We remove parse_number() and adjust the parameter list of make_atom()
to remove the non_numericp flag.
2021-10-29 09:51:32 -07:00
Nick Briggs
75c668f1cd
The pointers Atomspace, Spospspace, Snegspace, Arrayspace can be removed (#402)
These pointers are neither initialized nor referenced anywhere in the code.
2021-10-10 16:55:33 -07:00
Nick Briggs
533c935e72
Fix various bugprone warnings (#397)
* Fix some warnings in main.c

main.c:678: narrowing conversion from 'unsigned long' to signed type 'int' is implementation-defined
main.c:493: The return value from the call to 'seteuid' is not checked.

* Fix some warnings in array operations

Instead of extracting typenumbers to an 'int', use the unsigned typenumber directly

array3.c:49: narrowing conversion from 'unsigned int' to signed type 'int' is implementation-defined
array4.c:61: narrowing conversion from 'unsigned int' to signed type 'int' is implementation-defined
array5.c:63: narrowing conversion from 'unsigned int' to signed type 'int' is implementation-defined
array6.c:50: narrowing conversion from 'unsigned int' to signed type 'int' is implementation-defined

* Resolve type mismatches for version numbers and propp flag

dir.c:1849: narrowing conversion from 'unsigned int' to signed type 'int'
dir.c:1850: narrowing conversion from 'unsigned int' to signed type 'int'
dir.c:2114: narrowing conversion from 'unsigned long' to signed type 'int'
dir.c:2207: narrowing conversion from 'unsigned int' to signed type 'int'

* Resolve type mismatches for version numbers and strlen result type

dsk.c:1072: narrowing conversion from 'unsigned long' to signed type 'int'
dsk.c:1108: narrowing conversion from 'unsigned long' to signed type 'int'
dsk.c:1549: narrowing conversion from 'unsigned long' to signed type 'int'
dsk.c:1712: narrowing conversion from 'unsigned long' to signed type 'int'
dsk.c:1751: narrowing conversion from 'unsigned long' to signed type 'int'
dsk.c:3426: narrowing conversion from 'unsigned int' to signed type 'int'

* Resolve type mismatches for strlen result type

ufs.c:213: narrowing conversion from 'unsigned long' to signed type 'int'
ufs.c:404: narrowing conversion from 'unsigned long' to signed type 'int'

* Resolve type error

uutils.c:117: 'signed char' to 'int' conversion [bugprone-signed-char-misuse,cert-str34-c]
2021-09-16 17:24:25 -07:00
Nick Briggs
6fedd97d21
add yield subr (#398)
* Add experimental SUBR to call nanosleep() for experiments in reducing CPU load

This adds a SUBR, sb_YIELD, value (octal) 0322 which takes a single number
0..999999999 which is the number of nanoseconds to pass to nanosleep().

The return value is T if the call to nanosleep() was executed or NIL
if it was not (argument out-of-range, or other error in getting the
number from the argument).

To use this experimental SUBR in a sysout you should:

   (SETQ \INITSUBRS (CONS '(YIELD #o322) \INITSUBRS))

then you can define functions that use that SUBR:

   (DEFINEQ (BACKGROUND-YIELD () (SUBRCALL YIELD 833333)))
   (COMPILE 'BACKGROUND-YIELD)
   (SETQ BACKGROUNDFNS (CONS 'BACKGROUND-YIELD BACKGROUNDFNS))

* Update to use subrs.h newly generated from LLSUBRS

The subrs.h include file is generated by WRITECALLSUBRS based on the \INITSUBRS
list.  This update provides for the new YIELD subr in the generated file,
and makes some necessary updates to the C code implementations for some subr
names which have changed.
2021-09-15 10:30:04 -07:00
Nick Briggs
4f79f55c20
Replace uses of atoi() with strtol() or stroul() as appropriate (#394)
As a side-effect of this change, we also resolve a a problem with
signed file version numbers, so that instead of version 2147483647
wrapping to -2147483648 we can go as far as 4294967296 before we
have issues.  Various sprintf() formats get changed from %d to %u.
The DOS version code is left behind as int versions.
2021-09-08 09:58:01 -07:00