1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-19 09:18:33 +00:00

263 Commits

Author SHA1 Message Date
Nick Briggs
94a41d2a5b Replace Addr68k related macros with NativeAligned inline functions 2022-09-01 14:15:35 -07:00
Nick Briggs
2c4ccf54c3 Replace Addr68k related macros with NativeAligned inline functions 2022-09-01 14:15:35 -07:00
Nick Briggs
903a7f64fc Replace Addr68k related macros with NativeAligned inline functions 2022-09-01 14:15:35 -07:00
Nick Briggs
a9dcff6fd6 Replace Addr68k related macros with NativeAligned inline functions 2022-09-01 14:15:35 -07:00
Nick Briggs
049568b0f8 Replace Addr68k related macros with NativeAligned inline functions 2022-09-01 14:15:35 -07:00
Nick Briggs
d4226c20f2 Replace Addr68k related macros with NativeAligned inline functions
Addr68k_from_LADDR always produced a 2-byte aligned pointer which
  was frequently cast to a type requiring 4-byte alignment.
  This commit changes Addr68k_from_LADDR uses to one of two new
  inline procedures, NativeAligned2FromLAddr or NativeAligned4FromLAddr,
  which produce a result with the appropriate alignment for the context.
  This permits checking for cases where the Lisp address is not
  appropriately aligned for the usage context, and localizes compiler
  warnings to these two procedures.

  Similarly, the Addr68k_from_StkOffset macros are replaced by
  NativeAligned2FromStackOffset and NativeAligned4FromStackOffset.

  NativeAligned4FromLPage replaces Addr68k_from_LPAGE as page address
  will always be at least 4-byte aligned.

  LAddrFromNative, LPageFromNative, and StackOffsetFromNative complete
  the set, replacing LADDR_from_68k, LPAGE_from_68k, and
  StkOffset_from_68K (note K not k) respectively.
2022-09-01 14:11:54 -07:00
Nick Briggs
889adcaa35 Add NativeAligned4FromStackOffset() and LPageFromNative() before using them 2022-09-01 12:53:24 -07:00
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