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

315 Commits

Author SHA1 Message Date
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
Nick Briggs
9bfeaeb8b4 Resolve warning because URaid_comm string as a target of a sscanf() must have space for a terminating NUL 2023-02-17 17:01:27 -08:00
Nick Briggs
a536faa736 Reduce missing-variable-declarations, move some atom index extern definitions to lspglob.h. 2023-02-17 17:01:27 -08:00
Nick Briggs
4834f6f2b1 Eliminate various warnings from vmemsave.c/vmemsavedefs.h
* sort_fptovp() and twowords() can be static and are sometimes (depending on flags)
   not needed at all
 * roundup() macro is unused and can be removed
 * maxpages can be unsigned (affects main.c)
 * variables used for return values of system calls should be correctly declared
 * pointers into Lisp_world should be DLword* rather than char*, and
   computations must take that into account.
 * ENOSPC and EDQUOT errors on write should return NOFILESPACE instead of FILECANNOTWRITE error.
2023-02-17 17:01:27 -08:00
Nick Briggs
766de557bb Cleanup warnings from byte swapping routines 2023-02-17 17:01:27 -08:00
Nick Briggs
d98df4f8d3 Remove extra MState macro and replace MState(&MachineState)->x with a direct MachineState.x field access. 2023-02-17 17:01:27 -08:00
Nick Briggs
a17460cd6b Remove unused atom_to_str() function and the warning it generates 2023-02-17 17:01:27 -08:00
Nick Briggs
55939e0bc9 Resolve warning: variable '...' may be uninitialized when used here in new_bitblt_code
Note that one might analyze the order of the variables in the bitblt inner loops and
adjust so that items accessed together are in the same cache-line.
2023-02-17 17:01:27 -08:00
Nick Briggs
960baf9b96 fix signedness issue in N_OP_bind(unused), matching correction made in inlineC.h BIND in 26e67a51 2023-02-17 17:01:27 -08:00
Nick Briggs
1c6277d313 Clean up usage of the native address of the I/O page and its struct typedef
The global variable holding the native address of the I/O page is spelled "IOPage"
The global variable "IOPage" is declared extern by "lspglob.h"
The structure pointed to by IOPage is named IOPAGE and is defined in "iopage.h"
If there is no direct reference to the IOPAGE struct do not include "iopage.h"
2023-02-17 17:01:27 -08:00
Nick Briggs
602fff2c2f Reformatting, remove whitespace before semi-colon 2023-02-17 17:01:27 -08:00
Nick Briggs
43809d070b Fix a few sign-conversion and shorten-64-to-32 warnings while converting some values from int to unsigned 2023-02-17 17:01:27 -08:00
Nick Briggs
e1c4263dd8 Remove extraneous extern references for Lisp_world that are covered by lspglob.h 2023-02-17 17:01:27 -08:00
Nick Briggs
871bf5459c Fix a couple of sign-conversion warnings (int to LispPTR) in adr68k.h 2023-02-17 17:01:27 -08:00
Nick Briggs
aa29914b2b rs232c.h does not directly reference Lisp_world and both rs232 implementations include lspglob.h for it 2023-02-17 17:01:27 -08:00
Nick Briggs
2b7228f37e Remove typedefs for function pointers and their uses. Methods which are defined but never used get (void) args until they are implemented. 2023-02-17 17:01:27 -08:00
Nick Briggs
4853f0e3f5 Fix missing prototype adding ttydefs.h, declare tty_baudtosymbol() as static. 2023-02-17 17:01:27 -08:00
Nick Briggs
80c9c796c5 Address "warning: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x"
* Update struct DevRec methods to take a "void *" parameter
   since they get called with different xxxInterface records
   depending on whether they are a keyboard, mouse, or display.
   Introduce GenericReturnVoid method implementation for use
   where needed with DevRec methods. (see mouseif.c)

 * Cast functions implementing DevRec methods as appropriate to match
   the method signature.

 * Update struct DspInterfaceRec methods cleardisplay,
   bitblt_to_screen, mouse_invisible, and mouse_visible to declare
   the parameters they require and all return unsigned long results
   (though it's not clear that this is actually the correct type).
   Requires updating dosmouse.c method implementations.

 * Update GenericReturnT and GenericPanic method implementations
   to have the signature required by the method slots they
   are used in.

 * Correct DOS-only section with incorrect arguments to device.exit
   call for the mouse.

 * Use include "dspifdefs.h" for prototypes for GenericReturnXXX method
   implementations.
2023-02-17 17:01:27 -08:00
Nick Briggs
d5acdf7ea4 Static analysis suggests savedS might be used uninitialized (pathlength > 150). It is or-ed into a result, so initialize to 0 2023-02-17 17:01:27 -08:00
Nick Briggs
a3ba41fba2 fix warning: a function declaration without a prototype is deprecated in all versions of C
make savestr() static and remove it from dlpidefs.h since it is not used outside of dlpi.c
2023-02-17 17:01:27 -08:00
Nick Briggs
6838c701cc fix warning: a function declaration without a prototype is deprecated in all versions of C 2023-02-17 17:01:27 -08:00
Nick Briggs
81d459be16 Substitute include <errno.h> for extern int errno. 2023-02-17 17:01:27 -08:00
Nick Briggs
36a7422ebc Correct malformed connectToHub prototype and definition 2023-02-17 17:01:27 -08:00
Nick Briggs
aa177fa40a Make typedefs for struct xxxRec/xxx clearer. 2023-02-17 17:01:27 -08:00
Nick Briggs
60e13a774d Net reduction of about 150 warnings when compiling with clang 15.0.6
devif.h, mnxdefs.h:
Update MRegion to reflect that width/height are unsigned.
Update ...EventMask fields in XWINDOW section of DspInterfaceRec to match parameter
   type used in XSelectInput() to which they are passed.
Add padding to explicitly align colors field (short among longs)

xbitmaps.h:
Reorder fields in LISP_CURSOR struct to avoid requiring padding for alignment
   constraints, and adjust initialization to match.
Declare cursors static const.
Move Lisp_Icon from xbitmaps.h to xmkicon.c

xinit.c, xinitdefs.h
Replace bound() (xwinmandefs.h) with static inline unsigned ubound() in xinit.c
Change signature of X_init() to use unsigned values for width, height, depth.
Add casts where necessary to avoid implicit signedness conversions.
Add extern declarations for all globals defined in xinit.c

xwinman.c, xwinmandefs.h
Remove bound() from xwinmandefs.h and use static inline unsigned ubound() in xwinman.c
Change signature of lisp_Xconfigure() to use unsigned width and height parameters.
Make GravSize unsigned to match its usage context.
Add casts where necessary to avoid implicit signedness conversions.
Add missing break to correct switch case fall-through warning.

dspif.c
Change LispDisplayRequestedWidth/Height to unsigned to reflect context of use.

xlspwin.c
Eliminate declaration for unused XEvent report.
Move global variable gcv, used only locally, to local variable in the procedures where needed.
Change various variables used in width/height calculation to unsigned to match usage context.
Add casts where necessary to avoid implicit signedness conversions.

xmkicon.c
Move Lisp_Icon from xbitmaps.h to xmkicon.c.
Move global XImage IconImage to local in function where it is required.
Add cast where necessary to avoid implicit signedness conversions.

xrdopt.c
Remove incorrect casts for signedness causing implicit sign conversion warnings.
Add extern declarations for all globals defined in xrdopt.c

xscroll.c
Replace bound() (xwinmandefs.h) with static inline signed sbound() in xscroll.c

initdsp.c, initdspdefs.h
Change signedness of various display variables from int to unsigned.
Change signature of init_display2() to unsigned display_max.
Add extern declarations for some globals defined in initdsp.c

xbbt.c
Add explicit casts for type warnings from MRegion width/height change.
Add explicit casts for type warnings in arguments to XPutImage().
2023-02-17 17:01:27 -08:00
Nick Briggs
6e38d50829
Improve implementation of word_swap_page() and remove unused code (#447)
word_swap_page() should only touch each 32-bit word once to change
  the byte order from ABCD to DCBA rather than twice doing a transform
  of the entire region from ABCD to BADC and then again to DCBA

  The compiler provided ntohl() usually gets favorable optimizations
  applied, so use it for the byte reordering.

  With word_swap_page() rewritten, byte_swap_word() is superfluous.
2022-10-30 15:49:32 -07:00
devhawala
82577ce951
Dodo Nethub support (#445)
* added support for XNS networking via Dodo-Nethub

* NetHub connection now optional (only if -nh-host is given); released NetHub-related changes to 'ether.c' to the public domain

* Added file using-dodo-networking-with-maiko.md

Documentation for building and using the Dodo-networking addition to Maiko

* Added support for running Maiko unter cygwin/x86_64-x

* Migrate Addr68k/NativeAlignment{2,4} in Nethub code, move timer/async defines to platform.h

* added missing include <netinet/in.h> for FreeBSD

* updated 'compile-flags' with added flags

* splitted ether.c in 3 (_common, _sunos, _nethub)

* reworks/modifications for nbriggs' pull-request review comments

* addintional additions for nbriggs' pull-request review comments

* get the Lisp packet lengths with 'LispInt2CInt'

* renamed variables in dblwordsSwap to indicate it's about double-words

* fixed wrong preprocessor directive unnoticed by clang

* added networking choice option to cmake build, fix to printf warning

- for cmake specify the networking to use with -DMAIKO_NETWORK_TYPE=<type>
- with <type> one of: NONE, SUN_DLPI, SUN_NIT, NETHUB
- e.g.: cmake .. -DMAIKO_NETWORK_TYPE=NETHUB

* integrated improvement to sendPacket() proposed by nbriggs

* integrated fix for SIGBUS on 32-bit big-endian, provided by nbriggs

* MAIKO_ENABLE_ETHERNET should not be unconditionally set on Solaris systems

* Receiving an ethernet packet is an ether interrupt but not an i/o interrupt.

Co-authored-by: dev hawala <devhawala@x.y>
Co-authored-by: Nick Briggs <nicholas.h.briggs@gmail.com>
2022-10-11 14:21:55 -07:00
Nick Briggs
cdffa541ef
Remove extra semicolons, convert #define x() {...} to do {...} while (0) style (#444)
* Remove extra semicolons, convert #define x() {...} to do {...} while (0) style

* Fix missing brace in INIT-specific definition of init_kbd_startup
2022-10-05 09:07:17 -07:00