1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-03-16 23:07:24 +00:00

Compare commits

..

1 Commits

Author SHA1 Message Date
Nick Briggs
bc390c511f Scratch branch for (trying to) build old release 2.01 2022-09-08 12:44:19 -07:00
114 changed files with 589 additions and 1569 deletions

View File

@@ -11,7 +11,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-11, macos-12, ubuntu-22.04, ubuntu-20.04]
os: [macos-11, ubuntu-22.04, ubuntu-18.04]
steps:
- uses: actions/checkout@v2
- name: Install X11 dependencies on MacOS
@@ -37,7 +37,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-11, macos-12, ubuntu-22.04, ubuntu-20.04]
os: [macos-11, ubuntu-22.04, ubuntu-20.04, ubuntu-18.04]
env:
BUILD_TYPE: Release
steps:

View File

@@ -72,30 +72,10 @@ IF(MAIKO_DISPLAY_X11)
)
ENDIF()
# according to: https://cmake.org/pipermail/cmake/2016-October/064342.html
# the following 2 lines should produce a dropdown-box in the cmake-gui
# but this will happen only after running the command line version of cmake,
# possibly after "clearing the cache" (i.e. starting with a fresh build directory)
SET(MAIKO_NETWORK_TYPE NONE CACHE STRING "Type of networking to use: one of: NONE, SUN_DLPI, SUN_NIT, NETHUB")
SET_PROPERTY(CACHE MAIKO_NETWORK_TYPE PROPERTY STRINGS NONE SUN_DLPI SUN_NIT NETHUB)
# configure networking implementation to use
IF(MAIKO_NETWORK_TYPE STREQUAL "NETHUB")
LIST(APPEND MAIKO_DEFINITIONS "-DMAIKO_ENABLE_NETHUB")
MESSAGE("-- Configured for NETHUB network support")
ELSEIF(MAIKO_NETWORK_TYPE STREQUAL "SUN_DLPI")
LIST(APPEND MAIKO_DEFINITIONS "-DMAIKO_ENABLE_ETHERNET -DUSE_DLPI")
MESSAGE("-- Configured for (SunOS) DLPI networking")
ELSEIF(MAIKO_NETWORK_TYPE STREQUAL "SUN_NIT")
LIST(APPEND MAIKO_DEFINITIONS "-DMAIKO_ENABLE_ETHERNET -DUSE_NIT")
MESSAGE("-- Configured for (SunOS) NIT networking")
ELSEIF(NOT MAIKO_NETWORK_TYPE STREQUAL "NONE")
MESSAGE(WARNING "Invalid option given for MAIKO_NETWORK_TYPE, must be one of:\nNONE, SUN_DLPI, SUN_NIT, NETHUB")
ENDIF()
IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
LIST(APPEND MAIKO_DEFINITIONS
"-DOS5"
"-DUSE_DLPI"
)
ENDIF()
@@ -162,9 +142,7 @@ SET(MAIKO_SRCS
src/dspif.c
src/dspsubrs.c
src/eqf.c
src/ether_common.c
src/ether_sunos.c
src/ether_nethub.c
src/ether.c
src/findkey.c
src/foreign.c
src/fp.c

18
bin/compile-flags Normal file → Executable file
View File

@@ -134,24 +134,6 @@ PKTFILTER True if the ethernet packets are to be filtered before being
passed to the Lisp ethernet handler. Available on Sun systems
for both the NIT and DLPI cases.
MAIKO_ENABLE_NETHUB enables the support for Dodo Nethub networking for Dodo
XNS services, see documentation: using-dodo-networking-with-maiko.md
(implicitely disables USE_DLPI and USE_NIT)
MAIKO_EMULATE_TIMER_INTERRUPTS enables emulation of recurring timer interrupts for
platforms where SIGVTALRM/ITIMER_VIRTUAL or SIGALRM/ITIMER_REAL
do not work as expected (like cygwin)
timer is emulated by signaling an interrupt after a number of
executed instructions, by default 20.000 instructions, this can be
overriden by defining MAIKO_TIMER_ASYNC_EMULATION_INSNS_COUNTDOWN
with the number of instructions between 2 interrupts
additionally this adds the command line arguments -intr-emu-insns
for overriding the compiled in instruction interval
(not working if OPDISP (fast opcode dispatch) is used)
MAIKO_EMULATE_ASYNC_INTERRUPTS same as MAIKO_EMULATE_TIMER_INTERRUPTS, but also
signals an I/O interrupt after each instruction interval
bitbltsub.c:#ifdef GETBASE
testdisplay.c:#ifdef NOTUSED

0
bin/config.guess vendored Normal file → Executable file
View File

0
bin/copyright Normal file → Executable file
View File

0
bin/dbxinit.txt Normal file → Executable file
View File

0
bin/environment-variables Normal file → Executable file
View File

0
bin/machinetype Normal file → Executable file
View File

View File

@@ -1,7 +1,7 @@
# Options for cygwin
# Options for Linux, Intel x86_64 and X-Window
CC = gcc -m64 $(GCC_CFLAGS) -DMAIKO_ENABLE_NETHUB
# CC = clang -m64 $(CLANG_CFLAGS) -DMAIKO_ENABLE_NETHUB
#CC = gcc -m64 $(GCC_CFLAGS)
CC = clang -m64 $(CLANG_CFLAGS)
XFILES = $(OBJECTDIR)xmkicon.o \
$(OBJECTDIR)xbbt.o \
@@ -17,8 +17,7 @@ XFILES = $(OBJECTDIR)xmkicon.o \
XFLAGS = -DXWINDOW
# OPTFLAGS is normally -O2.
OPTFLAGS = -O0 -g
OPTFLAGS = -O2 -g3
DFLAGS = $(XFLAGS) -DRELEASE=351
LDFLAGS = -L/usr/X11/lib -lX11 -lc -lm

View File

@@ -18,7 +18,7 @@ XFLAGS = -I/opt/X11/include -DXWINDOW
# OPTFLAGS is normally -O2.
OPTFLAGS = -O1 -g
DEBUGFLAGS = # -DDEBUG -DOPTRACE
DFLAGS = $(DEBUGFLAGS) $(XFLAGS) -DRELEASE=351
DFLAGS = $(DEBUGFLAGS) $(XFLAGS) -DRELEASE=201 # was 351
LDFLAGS = -L/opt/X11/lib -lX11 -lm
LDELDFLAGS = -L/opt/X11/lib -lX11 -lm

0
bin/makefile-header Normal file → Executable file
View File

View File

@@ -1,28 +0,0 @@
# Options for cygwin
CC = gcc -m64 $(GCC_CFLAGS) -DMAIKO_ENABLE_NETHUB
# CC = clang -m64 $(CLANG_CFLAGS) -DMAIKO_ENABLE_NETHUB
XFILES = $(OBJECTDIR)xmkicon.o \
$(OBJECTDIR)xbbt.o \
$(OBJECTDIR)dspif.o \
$(OBJECTDIR)xinit.o \
$(OBJECTDIR)xscroll.o \
$(OBJECTDIR)xcursor.o \
$(OBJECTDIR)xlspwin.o \
$(OBJECTDIR)xrdopt.o \
$(OBJECTDIR)xwinman.o
XFLAGS = -DXWINDOW
# OPTFLAGS is normally -O2.
OPTFLAGS = -O0 -g
DEBUGFLAGFLAGS =
DFLAGS = $(DEBUGFLAGS) $(XFLAGS) -DRELEASE=351 -DNOVERSION -DINIT
LDFLAGS = -L/usr/X11/lib -lX11 -lc -lm
LDELDFLAGS = -L/usr/X11/lib -lX11 -lc -lm
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/ldeinit

View File

@@ -18,7 +18,7 @@ XFLAGS = -I/opt/X11/include -DXWINDOW
# OPTFLAGS is normally -O2.
OPTFLAGS = -O0 -g
DEBUGFLAGS = # -DDEBUG -DOPTRACE
DFLAGS = $(DEBUGFLAGS) $(XFLAGS) -DRELEASE=351 -DNOVERSION -DINIT
DFLAGS = $(DEBUGFLAGS) $(XFLAGS) -DRELEASE=201 -DNOVERSION -DINIT
LDFLAGS = -L/opt/X11/lib -lX11 -lm
LDELDFLAGS = -L/opt/X11/lib -lX11 -lm

View File

@@ -1,7 +1,7 @@
# Options for Linux, Intel x86_64 and X-Window
#CC = gcc -m64 $(GCC_CFLAGS)
CC = clang -m64 $(CLANG_CFLAGS) -DMAIKO_ENABLE_NETHUB
CC = clang -m64 $(CLANG_CFLAGS)
XFILES = $(OBJECTDIR)xmkicon.o \
$(OBJECTDIR)xbbt.o \

View File

@@ -115,9 +115,7 @@ DEVICES = $(OBJECTDIR)dspsubrs.o \
$(OBJECTDIR)dir.o \
$(OBJECTDIR)keyevent.o \
$(OBJECTDIR)kbdsubrs.o \
$(OBJECTDIR)ether_common.o \
$(OBJECTDIR)ether_sunos.o \
$(OBJECTDIR)ether_nethub.o \
$(OBJECTDIR)ether.o \
$(OBJECTDIR)tty.o \
$(OBJECTDIR)initkbd.o
@@ -474,26 +472,12 @@ $(OBJECTDIR)mouseif.o: $(SRCDIR)mouseif.c $(REQUIRED-INCS) $(INCDIR)lispemul.h \
$(INCDIR)dbprint.h $(INCDIR)devif.h
$(CC) $(RFLAGS) $(SRCDIR)mouseif.c -o $(OBJECTDIR)mouseif.o
$(OBJECTDIR)ether_common.o: $(SRCDIR)ether_common.c $(REQUIRED-INCS) \
$(OBJECTDIR)ether.o: $(SRCDIR)ether.c $(REQUIRED-INCS) \
$(INCDIR)commondefs.h $(INCDIR)lispemul.h \
$(INCDIR)lispmap.h $(INCDIR)emlglob.h $(INCDIR)lsptypes.h $(INCDIR)lspglob.h \
$(INCDIR)ifpage.h $(INCDIR)iopage.h $(INCDIR)miscstat.h $(INCDIR)adr68k.h \
$(INCDIR)ether.h $(INCDIR)dbprint.h $(INCDIR)etherdefs.h
$(CC) $(RFLAGS) $(SRCDIR)ether_common.c -o $(OBJECTDIR)ether_common.o
$(OBJECTDIR)ether_sunos.o: $(SRCDIR)ether_sunos.c $(REQUIRED-INCS) \
$(INCDIR)commondefs.h $(INCDIR)lispemul.h \
$(INCDIR)lispmap.h $(INCDIR)emlglob.h $(INCDIR)lsptypes.h $(INCDIR)lspglob.h \
$(INCDIR)ifpage.h $(INCDIR)iopage.h $(INCDIR)miscstat.h $(INCDIR)adr68k.h \
$(INCDIR)ether.h $(INCDIR)dbprint.h $(INCDIR)etherdefs.h
$(CC) $(RFLAGS) $(SRCDIR)ether_sunos.c -o $(OBJECTDIR)ether_sunos.o
$(OBJECTDIR)ether_nethub.o: $(SRCDIR)ether_nethub.c $(REQUIRED-INCS) \
$(INCDIR)commondefs.h $(INCDIR)lispemul.h \
$(INCDIR)lispmap.h $(INCDIR)emlglob.h $(INCDIR)lsptypes.h $(INCDIR)lspglob.h \
$(INCDIR)ifpage.h $(INCDIR)iopage.h $(INCDIR)miscstat.h $(INCDIR)adr68k.h \
$(INCDIR)ether.h $(INCDIR)dbprint.h $(INCDIR)etherdefs.h
$(CC) $(RFLAGS) $(SRCDIR)ether_nethub.c -o $(OBJECTDIR)ether_nethub.o
$(CC) $(RFLAGS) $(SRCDIR)ether.c -o $(OBJECTDIR)ether.o
$(OBJECTDIR)findkey.o: $(SRCDIR)findkey.c $(REQUIRED-INCS) \
$(INCDIR)lispemul.h $(INCDIR)lispmap.h \

0
bin/makeinitlde Normal file → Executable file
View File

0
bin/makeright Normal file → Executable file
View File

0
bin/mkvdate Normal file → Executable file
View File

0
bin/osversion Normal file → Executable file
View File

0
bin/release-one Normal file → Executable file
View File

0
bin/start-release Normal file → Executable file
View File

0
bin/u2dnames.sed Normal file → Executable file
View File

0
bin/unix2dos.sed Normal file → Executable file
View File

View File

@@ -1,86 +0,0 @@
# Using Dodo-networking with Maiko
The [Dodo XNS services](https://github.com/devhawala/dodo) provide an emulation for a usable
subset of the Xerox 8000 Network Services from the 1980-ies. Dodo uses its own virtual
network infrastructure - the Dodo *Nethub* - for avoiding the problems involved with
implementing the transmission of XNS protocol packets over (real or virtual) network
adapters of the diverse contemporary operating systems.
The Dodo Nethub provides a simple virtual network, a kind of *XNS-over-TCP/IP*,
where clients and servers connect with TCP/IP to the central Nethub program, which relays all
packets ingoing from one connection to the other connections.
The following sections describe the support for Dodo-networking added to
Maiko. The Dodo Nethub support was implemented and tested with Linux on the x86_64
architecture. However as only standard system calls for TCP/IP were used, adapting to other
platforms if necessary should be possible.
This extension allows Medley 3.51 running in a Maiko VM to use the XNS services
*Clearinghouse*, *Filing* and *Printing* provided by Dodo (using the *Mail* service may
also be possible, but this was not verified so far)
## Building Maiko with Dodo-networking support
As long as Dodo-networking support is not merged into the `master`-branch
of the primary Maiko repository, this networking option is only available in this
clone of the original Maiko repository in the branch `dodo-nethub-support`.
(however: this branch should already be checked out if this file is present)
The Dodo-networking support is enabled by defining `MAIKO_ENABLE_NETHUB`
when compiling Maiko. This can be done in the Makefile for the relevant platform
(file `bin/makefile-`*platform*) for example in the line where the compiler-command
variable is defined.
This is already done in the Makefile for the *Linux-x86_64-X* platform (file
`bin/makefile-linux.x86_64-x`), where the compiler-command defined as follows:
```
CC = clang -m64 $(CLANG_CFLAGS) -DMAIKO_ENABLE_NETHUB
```
After a complete (re-)build, this Maiko VM optionally allows to connect to a Dodo Nethub
and through this to use Dodo XNS services.
## Running Maiko with Dodo-networking
With Dodo-networking support compiled in, Maiko (i.e. the program `ldex`) accepts the
following additional commandline options:
- `-nh-host` *dodo-host*
the name or IP-address of the host where the Dodo Nethub program runs; no connection to
Dodo services will be opened if this option is not specified
Default: (*none*)
- `-nh-port` *port-number*
the port which the Dodo Nethub is listening to at *dodo-host*
Default: `3333`
- `-nh-mac` *machine-id*
the machine-id (aka. MAC-address) that this Maiko VM instance will use in the Dodo network;
the machine-id must be given as 48 bit hexadecimal value with a dash as byte-separator, i.e.
in the format *XX-XX-XX-XX-XX-XX* (with *XX* the hexcode for a single byte)
Default: `CA-FF-EE-12-34-56`
- `-nh-loglevel` *log-level*
the detail level of logging to `stdout`, one of:
`0`: log only main events (connect, disconnect or the like)
`1`: log network events each with a single line
`2`: detailled log of network events
Default: `0`
So by default Maiko will not connect to a Dodo nethub and behave like a "standard" version
without networking support.
To use Dodo XNS services, the option `-nh-host` must be given to specify the location
of the Dodo nethub. In the simplest (and probably most usual) case where Dodo is run on the
same machine as Maiko/Medley, the value for option `-nh-host` will be *localhost*, so
adding the option `-nh-host localhost` when starting the Medley Lisp system will allow
to use the XNS services of a Dodo system running locally.
Specifying the *machine-id* is optional unless more than one Maiko/Medley instances are to use
Dodo XNS services concurrently: in this case, each Maiko VM *must* use a *unique* machine-id,
so at most one Maiko VM may omit the `-nh-mac` option.
However, each machine-id used by the Maiko VMs should have an entry in the `machine.cfg`
file of the Dodo installation, cloning or copying the low-level SPP-configuration of the
`maiko-Lisp-One` example entry in the `machine.cfg` of the Dodo `dist.zip`
distribution.

View File

@@ -86,4 +86,26 @@ static inline LispPTR LPageFromNative(void *NAddr)
}
return (((DLword *)NAddr) - Lisp_world) >> 8;
}
/* translate 68k ptr to Lisp DLword address */
#define LADDR_from_68k(ptr68k) ((LispPTR)(((UNSIGNED)(ptr68k) - (UNSIGNED)Lisp_world) >>1))
/* translate 68k ptr to Lisp Page number */
#define LPAGE_from_68k(ptr68k) (LADDR_from_68k(ptr68k) >> 8)
/* Translate Lisp_address to 68K address */
/* Lisp_addr: word offset */
#define Addr68k_from_LADDR(Lisp_addr) (Lisp_world + (Lisp_addr))
/* translate LispPage to 68k address */
#define Addr68k_from_LPAGE(Lisp_page) (Addr68k_from_LADDR(((Lisp_page) << 8) ))
/* Stack Offset Macros */
#define StkOffset_from_68K(ptr68k)\
((LispPTR)(((UNSIGNED)(ptr68k) - (UNSIGNED)Stackspace) >>1))
#define Addr68k_from_StkOffset(stkoffset)\
(Stackspace + (stkoffset))
#endif /* ADR68K_H */

View File

@@ -738,7 +738,7 @@ int srcRshift;
/************************************************************************/
#define new_bitblt_code \
do { \
{ \
variables \
some_init \
while (num_lines_remaining-- > 0) \
@@ -778,7 +778,7 @@ next_line: \
continue; \
} \
} /* end line loop */ \
} while (0)
}
@@ -791,7 +791,7 @@ next_line: \
/************************************************************************/
#define new_gray_bitblt_code \
do { \
{ \
variables \
some_init \
while (num_lines_remaining-- > 0) \
@@ -803,7 +803,7 @@ do_fpt: \
next_line: \
do_gray_advance \
} /* end line loop */ \
} while (0)
}
@@ -816,7 +816,7 @@ next_line: \
/************************************************************************/
#define new_char_bitblt_code \
do { \
{ \
variables \
some_init \
while (num_lines_remaining-- > 0) \
@@ -828,7 +828,7 @@ do_fpt: \
next_line: \
F_do_advance \
} /* end line loop */ \
} while (0)
}

View File

@@ -76,13 +76,13 @@ extern DLword *EmCursorX68K,*EmCursorY68K;
/* Macro for locking and unlocking screen to prevent multiple updates */
#ifdef DOS
#define LOCKSCREEN currentdsp->device.locked++
#define UNLOCKSCREEN currentdsp->device.locked--
#define LOCKSCREEN currentdsp->device.locked++;
#define UNLOCKSCREEN currentdsp->device.locked--;
#else
#define LOCKSCREEN ScreenLocked = T
#define UNLOCKSCREEN ScreenLocked = NIL
#define LOCKSCREEN ScreenLocked = T;
#define UNLOCKSCREEN ScreenLocked = NIL;
#endif /* DOS */
#endif /* BITBLT_H */

View File

@@ -10,6 +10,16 @@ static inline unsigned int swapx(unsigned int word) {
return (((word >> 16) & 0xffff) | ((word & 0xffff) << 16));
}
/****************************************************************/
/* */
/* Byte-swap a single 2-byte word */
/* */
/****************************************************************/
static inline unsigned short byte_swap_word(unsigned short word) {
return ((word >> 8) | (unsigned short)((word & 0xff) << 8));
}
void byte_swap_page(unsigned short *page, int wordcount);
void word_swap_page(unsigned short *page, int longwordcount);
void bit_reverse_region(unsigned short *top, int width, int height, int rasterwidth);
#ifdef RESWAPPEDCODESTREAM

View File

@@ -416,11 +416,11 @@ struct cadr_cell {
/* When cadr() function is called, type check should be done. */
#define S_N_CHECKANDCADR(sour, dest, tos) \
do { \
{ \
LispPTR parm = sour; \
if (GetTypeNumber(parm) != TYPE_LISTP) { \
ERROR_EXIT(tos); \
} else \
(dest) = cadr(parm); \
} while (0)
}
#endif

0
inc/copyright Normal file → Executable file
View File

0
inc/cr Normal file → Executable file
View File

0
inc/display.h Normal file → Executable file
View File

View File

@@ -14,10 +14,4 @@ LispPTR check_ether(void);
void init_ifpage_ether(void);
void init_ether(void);
LispPTR check_sum(LispPTR *args);
void setNethubHost(char* host);
void setNethubPort(int port);
void setNethubMac(int m0, int m1, int m2, int m3, int m4, int m5);
void setNethubLogLevel(int ll);
void connectToHub();
#endif

View File

@@ -48,23 +48,23 @@
/* IncAllocCnt is called only when *Reclaim_cnt_word != NIL */
#define IncAllocCnt(n) do { \
#define IncAllocCnt(n) {\
if ((*Reclaim_cnt_word -= (n)) <= S_POSITIVE) { \
/* time for GC */ \
Irq_Stk_Check = Irq_Stk_End = 0; \
*Reclaim_cnt_word = S_POSITIVE; \
} \
} while (0)
/* time for GC */\
Irq_Stk_Check = Irq_Stk_End = 0;\
*Reclaim_cnt_word = S_POSITIVE;\
};\
}
/* DecAllocCnt only called when *Reclaim_cnt_word != NIL */
#define DecAllocCnt(n) do { *Reclaim_cnt_word += (n); } while (0)
#define DecAllocCnt(n) { *Reclaim_cnt_word += (n); }
#define FreeLink(link) do { \
#define FreeLink(link) { \
GETGC(link) = 0; \
GETGC((link)+1) = GETGC(HTcoll); \
GETGC(HTcoll) = ((link) - HTcoll); \
} while (0)
}
/* Given the contents of an HTMAIN or HTCOLL entry,
@@ -72,7 +72,7 @@
#define GetLinkptr(entry) ((entry) & 0x0fffffffe)
#define DelLink(link, prev, entry) do { \
#define DelLink(link, prev, entry) { \
if ((prev) != (GCENTRY *)0) \
{ \
GETGC((GCENTRY *)(prev) + 1) = GETGC((GCENTRY *)(link) + 1); \
@@ -88,41 +88,41 @@
GETGC((GCENTRY *)(entry)) = GETGC((GCENTRY *)(link)); \
FreeLink((GCENTRY *)(link)); \
} \
} while (0)
}
#define RefCntP(ptr) (!(GetTypeEntry((ptr)) & TT_NOREF) && \
(*GcDisabled_word != ATOM_T))
#define GCLOOKUP(ptr, case) do { \
#define GCLOOKUP(ptr, case) { \
if (RefCntP(ptr)) { \
if (*Reclaim_cnt_word != NIL) \
htfind(ptr, case); \
else \
rec_htfind(ptr, case); \
} \
} while (0)
}
#define GCLOOKUPV(ptr, case, val) do { \
#define GCLOOKUPV(ptr, case, val) { \
if (RefCntP(ptr)) { \
if (*Reclaim_cnt_word != NIL) \
(val) = htfind((ptr), (case)); \
else \
(val) = rec_htfind((ptr), (case)); \
} else (val) = NIL; \
} while (0)
}
#define REC_GCLOOKUP(ptr, case) do { if (RefCntP(ptr)) rec_htfind(ptr, case); } while (0)
#define REC_GCLOOKUPV(ptr, case, val) do { \
#define REC_GCLOOKUP(ptr, case) { if (RefCntP(ptr)) rec_htfind(ptr, case); }
#define REC_GCLOOKUPV(ptr, case, val) { \
if (RefCntP(ptr)) \
(val) = rec_htfind((ptr), (case)); \
else \
(val) = NIL; \
} while (0)
}
#define FRPLPTR(old , new) do { \
#define FRPLPTR(old , new) { \
GCLOOKUP(new, ADDREF); \
GCLOOKUP(old, DELREF); \
(old) = (new) ; } while (0)
(old) = (new) ; }
#ifndef BYTESWAP

0
inc/ifpage.h Normal file → Executable file
View File

0
inc/inln68k.h Normal file → Executable file
View File

0
inc/iopage.h Normal file → Executable file
View File

0
inc/keysym.h Normal file → Executable file
View File

0
inc/ldeXdefs.h Normal file → Executable file
View File

0
inc/lispmap.h Normal file → Executable file
View File

View File

@@ -4,7 +4,7 @@
/* DOS version of LispVersionToUnixVersion */
#define LispVersionToUnixVersion(pathname, ver) \
do { \
{ \
\
char *cp; \
char *vp; \
@@ -43,5 +43,5 @@
else ver = -1; \
} \
else ver = -1; \
} while (0)
}
#endif /* LISPVER1_H */

View File

@@ -4,7 +4,7 @@
/* non-DOS version of LispVersionToUnixVersion */
#define LispVersionToUnixVersion(pathname) do { \
#define LispVersionToUnixVersion(pathname){ \
\
char *lv_cp; \
char *lv_vp; \
@@ -70,5 +70,5 @@
lv_vp--; /* Just for label */ \
} \
} \
} while (0)
}
#endif /* LISPVER2_H */

View File

@@ -45,24 +45,24 @@ extern DLword *Lisp_world; /* To access LispSysout area */
/* For getfileinfo. For WDATE&RDATE */
/* 29969152 == (timer.c)LISP_UNIX_TIME_DIFF */
#define StrNCpyFromCToLisp(lispbuf, cbuf ,len) do { \
#define StrNCpyFromCToLisp(lispbuf, cbuf ,len) { \
char *lf_sptr = (cbuf); \
char *lf_dptr = (lispbuf); \
for(size_t lf_i=0;lf_i<(len);lf_i++)\
GETBYTE(lf_dptr++) = *lf_sptr++; \
} while (0)
}
#define StrNCpyFromLispToC(cbuf , lispbuf, len) do { \
#define StrNCpyFromLispToC(cbuf , lispbuf, len) { \
char *lf_sptr = (lispbuf); \
char *lf_dptr = (cbuf); \
for(size_t lf_i=0;lf_i<(len);lf_i++)\
*lf_dptr++ = GETBYTE(lf_sptr++); \
} while (0)
}
#define FGetNum(ptr, place) do { \
#define FGetNum(ptr, place) { \
if(((ptr) & SEGMASK)== S_POSITIVE) {(place) = ((ptr) & 0xffff);}\
else if(((ptr) & SEGMASK)== S_NEGATIVE) {(place) = (int)((ptr)| 0xffff0000);}\
else {return(NIL);}} while (0)
else {return(NIL);}}
/************************************************************************/
@@ -81,7 +81,7 @@ extern DLword *Lisp_world; /* To access LispSysout area */
/************************************************************************/
#ifndef BYTESWAP
#define LispStringToCString(Lisp, C, MaxLen) \
do { \
{ \
OneDArray *lf_arrayp; \
char *lf_base, *lf_dp; \
short *lf_sbase; \
@@ -108,10 +108,10 @@ extern DLword *Lisp_world; /* To access LispSysout area */
default: \
error("LispStringToCString: Not a character array.\n"); \
} \
} while (0)
}
#else /* BYTESWAP == T CHANGED-BY-TAKE */
#define LispStringToCString(Lisp, C, MaxLen) \
do { \
{ \
OneDArray *lf_arrayp; \
char *lf_base, *lf_dp; \
short *lf_sbase; \
@@ -138,7 +138,7 @@ extern DLword *Lisp_world; /* To access LispSysout area */
default: \
error("LispStringToCString: Not a character array.\n"); \
} \
} while (0)
}
#endif /* BYTESWAP */
@@ -154,7 +154,7 @@ extern DLword *Lisp_world; /* To access LispSysout area */
/* */
/************************************************************************/
#define LispStringLength(LispString, Length, FatP) \
do { \
{ \
OneDArray *lf_arrayp; \
lf_arrayp = (OneDArray *)(NativeAligned4FromLAddr(LispString)); \
switch(lf_arrayp->typenumber) \
@@ -171,7 +171,7 @@ extern DLword *Lisp_world; /* To access LispSysout area */
default: \
error("LispStringLength: Not a character array.\n"); \
} \
} while (0)
}
@@ -184,11 +184,11 @@ extern DLword *Lisp_world; /* To access LispSysout area */
/* */
/************************************************************************/
#define STRING_BASE(lstringp, cstringp) \
do { \
{ \
LispPTR *lf_naddress; \
lf_naddress = (LispPTR *)(NativeAligned4FromLAddr(lstringp)); \
(cstringp) = (char *)(NativeAligned2FromLAddr(((OneDArray *)lf_naddress)->base)); \
} while (0)
}
#ifndef min
#define min(a, b) (((a) <= (b))?(a):(b))
@@ -200,23 +200,23 @@ do { \
#define UPLOWDIFF 0x20
#define DOWNCASE(name) do { \
#define DOWNCASE(name){ \
\
char *lf_cp; \
\
for(lf_cp = (name); *lf_cp!='\0'; ++lf_cp) \
if((*lf_cp >= 'A') && (*lf_cp <= 'Z')) *lf_cp += UPLOWDIFF; \
} while (0)
}
#define UPCASE(name) do { \
#define UPCASE(name){ \
\
char *lf_cp; \
\
for(lf_cp = (name); *lf_cp!='\0'; ++lf_cp) \
if((*lf_cp >= 'a') && (*lf_cp <= 'z')) *lf_cp -= UPLOWDIFF; \
} while (0)
}
#define DIR_OR_FILE_P(name, type) do { \
#define DIR_OR_FILE_P(name, type){ \
int lf_result; \
struct stat lf_statbuf; \
\
@@ -244,9 +244,9 @@ do { \
break; \
} \
} \
} while (0)
}
#define DIRP(path, dir, buf) do { \
#define DIRP(path, dir, buf){ \
int lf_rval; \
struct stat lf_statbuf; \
strcpy(buf, path); \
@@ -262,9 +262,9 @@ do { \
*Lisp_errno = 60; \
return(0); \
} \
} while (0)
}
#define FILEP(path, file, buf) do { \
#define FILEP(path, file, buf){ \
int lf_rval; \
strcpy(buf, path); \
strcat(buf, file); \
@@ -273,7 +273,7 @@ do { \
strcat(path, file); \
return(1); \
} \
} while (0)
}
#define STREQ(name1, name2)( \
(*(name1) == *(name2)) && (strcmp(name1, name2) == 0) \
@@ -281,7 +281,7 @@ do { \
#define SPECIALFILEMARK (-1)
#define NumericStringP(str, truetag, falsetag) do { \
#define NumericStringP(str, truetag, falsetag) { \
char *lfn_cp; \
\
/* NOLINTNEXTLINE(bugprone-macro-parentheses) */ \
@@ -291,7 +291,7 @@ do { \
if(*lfn_cp < '0' || '9' < *lfn_cp) \
goto falsetag; /* NOLINT(bugprone-macro-parentheses) */ \
goto truetag; /* NOLINT(bugprone-macro-parentheses) */ \
} while (0)
}
/*
* Name: LispVersionToUnixVersion
@@ -353,7 +353,7 @@ do { \
* dealt with as version 1.
*/
#define UnixVersionToLispVersion(pathname, vlessp) do { \
#define UnixVersionToLispVersion(pathname, vlessp){ \
\
char *start; \
char *end; \
@@ -408,7 +408,7 @@ do { \
/* Dealt with as version 1 unless vlessp. */ \
if (!(vlessp)) strcat(pathname, ";1"); \
} \
} while (0)
}
/*
* Name: ConcDirAndName
@@ -428,7 +428,7 @@ do { \
*
*/
#define ConcDirAndName(dir, name, fname) do { \
#define ConcDirAndName(dir, name, fname){ \
\
char *lf_cp1, *lf_cp2; \
\
@@ -464,7 +464,7 @@ do { \
strcat(fname, "/"); \
strcat(fname, name); \
} \
} while (0)
}
/*
* Name: ConcNameAndVersion
@@ -483,7 +483,7 @@ do { \
*
*/
#define ConcNameAndVersion(name, ver, rname) do { \
#define ConcNameAndVersion(name, ver, rname){ \
if (*(ver) != '\0') { \
strcpy(rname, name); \
strcat(rname, ".~"); \
@@ -492,7 +492,7 @@ do { \
} else { \
strcpy(rname, name); \
} \
} while (0)
}
#define VERSIONLEN 16
@@ -517,7 +517,7 @@ do { \
/* Like "foo/fee.fee;3" or "/foo/foo;3" */
/* AddDotNoExtension must be put after UnixVersionToLispVersion */
#define AddDotNoExtension(file) do { \
#define AddDotNoExtension(file){ \
char *lf_cp; \
char *lf_cp1; \
if( (strrchr(file,'.')== 0) && ((lf_cp=strrchr(file,';'))!=0) ){ \
@@ -527,41 +527,41 @@ do { \
*lf_cp1 = *(lf_cp1-1); \
*lf_cp = '.'; \
} \
} while (0)
}
/* An argument of RemoveDotNoExtension must be LispVersion convention */
/* Like "foo/fee.fee;3" or "/foo/foo.;3" */
/* RemoveDotNoExtension must be put before LispVersionToUnixVersion */
#define RemoveDotNoExtension(file) do { \
#define RemoveDotNoExtension(file){ \
char *lf_cp; \
if( ((lf_cp=strrchr(file, ';'))!=0) && (*(lf_cp-1)=='.') ){ \
for(;*lf_cp!='\0';++lf_cp) \
*(lf_cp-1) = *lf_cp; \
*(lf_cp-1) = '\0'; \
} \
} while (0)
}
extern int errno;
#define ChangeToVersionless(pathname) do { \
#define ChangeToVersionless(pathname){ \
char *lf_cp; \
if( (lf_cp=strrchr(pathname, ';')) != 0) \
*lf_cp = '\0'; \
} while (0)
}
#define UNLINK(x) do { \
#define UNLINK(x){ \
TIMEOUT(lf_rval=unlink(x)); \
if(lf_rval == -1){ \
err_mess("unlink", errno); \
*Lisp_errno = errno; \
return(0); \
} \
} while (0)
}
#define LINK(x,y) do { \
#define LINK(x,y){ \
TIMEOUT(lf_rval=link(x, y)); \
if(lf_rval == -1){ \
if(errno == 2) \
@@ -572,9 +572,9 @@ extern int errno;
return(0); \
} \
} \
} while (0)
}
#define RENAME(x,y) do { \
#define RENAME(x,y){ \
TIMEOUT(lf_rval=rename(x, y)); \
if(lf_rval == -1){ \
switch(errno){ \
@@ -589,26 +589,26 @@ extern int errno;
return(0); \
} \
} \
} while (0)
}
#define STAT(x,y) do { \
#define STAT(x,y){ \
TIMEOUT(lf_rval=stat(x, y)); \
if(lf_rval != 0){ \
err_mess("stat", errno); \
*Lisp_errno = errno; \
return(-1); \
} \
} while (0)
}
/*
* For file name length check
*/
#define FNAMETOOLONG 200
#define FileNameTooLong(val) do { \
#define FileNameTooLong(val) { \
*Lisp_errno = FNAMETOOLONG; \
return((val)); \
} while (0)
}

0
inc/lpkit.h Normal file → Executable file
View File

0
inc/lspglob.h Normal file → Executable file
View File

View File

@@ -17,8 +17,6 @@
# define MAIKO_OS_CYGWIN 1
# define MAIKO_OS_NAME "Cygwin"
# define MAIKO_OS_UNIX_LIKE 1
# define MAIKO_EMULATE_TIMER_INTERRUPTS 1
# define MAIKO_EMULATE_ASYNC_INTERRUPTS 1
# define MAIKO_OS_DETECTED 1
#endif

View File

@@ -34,7 +34,7 @@
/* from SMALLP or FIXP, if necessary. */
/* */
/************************************************************************/
#define N_MakeFloat(arg, dest, tos) do { \
#define N_MakeFloat(arg, dest, tos){ \
switch (SEGMASK & (LispPTR)(arg)) { \
case S_POSITIVE: \
(dest) = (float)(0xFFFF & (LispPTR)(arg)); \
@@ -53,11 +53,11 @@
default: ERROR_EXIT(tos); \
} \
} \
} while (0)
}
#define N_GetPos(arg, dest, tos) do { \
#define N_GetPos(arg, dest, tos){ \
if (((arg) & SEGMASK) == S_POSITIVE) \
(dest) = (arg) & 0xFFFF; \
else { \
@@ -65,7 +65,7 @@
if (((dest) = *((int *)NativeAligned4FromLAddr(arg))) & 0x80000000) \
ERROR_EXIT(tos); \
} \
} while (0)
}
static inline LispPTR
aref_switch(unsigned type, LispPTR tos, LispPTR baseL, int index)
@@ -117,7 +117,7 @@ aref_switch(unsigned type, LispPTR tos, LispPTR baseL, int index)
}
#define aset_switch(type, tos) \
do { \
{ \
switch (type) { \
case 38: /* pointer : 32 bits */ \
GCLOOKUP(*(((int *)NativeAligned4FromLAddr(base)) + index), DELREF); \
@@ -178,5 +178,5 @@ do { \
default: /* Illegal or Unimplemented */ \
ERROR_EXIT(tos); \
}/* end switch typenumber */ \
} while (0)
}
#endif /* MY_H */

View File

@@ -18,9 +18,9 @@
#include "osmsgdefs.h" // for flush_pty
#define OSMESSAGE_PRINT(print_exp) \
do { \
{ \
flush_pty(); \
print_exp; \
} while (0)
}
#endif /* OSMSG_H */

View File

@@ -65,22 +65,21 @@
/** in CONTEXTSW , for exchanging context **/
#define Midpunt(fxnum) \
do { DLword midpunt; \
{ DLword midpunt; \
midpunt = LOLOC(LAddrFromNative(CURRENTFX)); \
PVar=(DLword *) \
NativeAligned2FromStackOffset( \
Addr68k_from_StkOffset( \
(GETWORD(((DLword *)InterfacePage) + (fxnum)))) \
+ FRAMESIZE; \
GETWORD(((DLword *)InterfacePage) + (fxnum)) = midpunt ; \
} while (0)
}
#define CHECKFX \
do { if (((UNSIGNED)PVar -(UNSIGNED)CURRENTFX) != 20) \
if (((UNSIGNED)PVar -(UNSIGNED)CURRENTFX) != 20) \
{ printf("Invalid FX(0x%x) and PV(0x%x) \n", \
LAddrFromNative(CURRENTFX),LAddrFromNative(PVar)); \
} \
} while (0)
}
@@ -88,17 +87,17 @@
that it is called by CONTEXTSW in original LISP code **/
#define BEFORE_CONTEXTSW \
do { CurrentStackPTR += 2; \
CURRENTFX->nextblock=StackOffsetFromNative(CurrentStackPTR); \
{ CurrentStackPTR += 2; \
CURRENTFX->nextblock=StkOffset_from_68K(CurrentStackPTR); \
GETWORD(CurrentStackPTR)=STK_FSB_WORD; \
GETWORD(CurrentStackPTR+1)= (((UNSIGNED)EndSTKP-(UNSIGNED)(CurrentStackPTR))>>1); \
if (GETWORD(CurrentStackPTR+1) == 0) error("0-long free block."); \
} while (0)
}
#define AFTER_CONTEXTSW \
do { DLword *ac_ptr68k,*ac_freeptr; \
ac_ptr68k = (DLword*)NativeAligned2FromStackOffset(CURRENTFX->nextblock); \
{ DLword *ac_ptr68k,*ac_freeptr; \
ac_ptr68k = (DLword*)Addr68k_from_StkOffset(CURRENTFX->nextblock); \
if(GETWORD(ac_ptr68k) != STK_FSB_WORD) error("pre_moveframe: MP9316"); \
CHECK_FX(CURRENTFX); \
ac_freeptr=ac_ptr68k; \
@@ -110,5 +109,5 @@
CHECK_FX(CURRENTFX); \
S_CHECK( EndSTKP > CurrentStackPTR, \
"End of stack isn't beyond current stk pointer."); \
} while (0)
}
#endif /* RETURN_H */

0
inc/rs232c.h Normal file → Executable file
View File

View File

@@ -305,51 +305,51 @@ typedef struct stackp {
#define SLOWP(fx) (((FXBLOCK *)(fx))->slowp)
#define FASTP(fx) (!SLOWP(fx))
#define SET_FASTP_NIL(fx68k) \
do { \
{ \
if (FASTP(fx68k)) { \
((FX *)(fx68k))->blink = StackOffsetFromNative(DUMMYBF(fx68k)); \
((FX *)(fx68k))->blink = StkOffset_from_68K(DUMMYBF(fx68k)); \
((FX *)(fx68k))->clink = ((FX *)(fx68k))->alink; \
SLOWP(fx68k) = T; \
} \
} while (0)
}
#define GETALINK(fx) ((((fx)->alink) & 0xfffe) - FRAMESIZE)
#define SETALINK(fx, val) \
do { \
{ \
if (FASTP(fx)) { \
((FX *)(fx))->blink = LAddrFromNative(DUMMYBF(fx)); \
((FX *)(fx))->clink = ((FX *)(fx))->alink; \
} \
((FX *)(fx))->alink = (val) + FRAMESIZE + 1; \
} while (0)
}
#define GETBLINK(fx) (SLOWP(fx) ? ((FX *)(fx))->blink : LOLOC(LAddrFromNative(DUMMYBF(fx))))
#define SETBLINK(fx, val) \
do { \
{ \
((FX *)(fx))->blink = (val); \
if (FASTP(fx)) { \
((FX *)(fx))->clink = ((FX *)(fx))->alink; \
SLOWP(fx) = 1; \
} \
} while (0)
}
#define GETCLINK(fx) \
(SLOWP(fx) ? (((FX *)(fx))->clink - FRAMESIZE) : (((FX *)(fx))->alink - FRAMESIZE))
#define SETCLINK(fx, val) \
do { \
{ \
((FX *)(fx))->clink = (val) + FRAMESIZE; \
if (FASTP((fx))) { \
((FX *)(fx))->blink = LAddrFromNative(DUMMYBF(fx)); \
SLOWP(fx) = 1; \
} \
} while (0)
}
#define SETACLINK(fx, val) \
do { \
{ \
if (FASTP(fx)) { ((FX *)(fx))->blink = LAddrFromNative(DUMMYBF(fx)); } \
((FX *)(fx))->clink = (val) + FRAMESIZE; \
((FX *)(fx))->alink = ((FX *)(fx))->clink + 1; \
} while (0)
}
#ifdef BIGVM
#define SWAP_FNHEAD
@@ -364,16 +364,16 @@ typedef struct stackp {
POINTERMASK))
#define MAKEFREEBLOCK(ptr68k, size) \
do { \
{ \
if ((size) <= 0) error("creating 0 long FSP"); \
*((LispPTR *)(ptr68k)) = (STK_FSB_WORD << 16) | ((DLword)(size)); \
} while (0)
}
#define SETUPGUARDBLOCK(ptr68k, size) \
do { \
{ \
if ((size) <= 0) error("creating 0 long Guard block"); \
(*((LispPTR *)(ptr68k)) = (STK_GUARD_WORD << 16) | ((DLword)(size))); \
} while (0)
}
/************************************************************************/
/* */
@@ -389,47 +389,47 @@ typedef struct stackp {
#include "testtooldefs.h"
#define S_CHECK(condition, msg) \
do { \
{ \
if (!(condition)) { \
printf("\n\nStack check failed: %s.\n\n", (msg)); \
error("S_Check.."); \
} \
} while (0)
}
#define S_WARN(condition, msg, scanptr) \
do { \
{ \
if (!(condition)) { printf("\n\nStack check failed at %p: %s.\n\n", (scanptr), (msg)); } \
} while (0)
}
#define CHECK_BF(bf68k) check_BF(bf68k)
#define CHECK_FX(fx68k) check_FX(fx68k)
#define PreMoveFrameCheck(fx68k) \
do { \
{ \
LispPTR *tos_on_stack; \
if (check_stack_rooms(fx68k) > 1000) { \
warn("moveframe:there is more than 100 words SPACE for FX"); \
printf("# When calling "); \
tos_on_stack = (LispPTR *)NativeAligned4FromStackOffset((fx68k)->nextblock - 2); \
tos_on_stack = (LispPTR *)Addr68k_from_StkOffset((fx68k)->nextblock - 2); \
print_atomname(*tos_on_stack); \
printf("\n"); \
stack_check(0); \
} \
} while (0)
}
#else /* STACKCHECK */
#define S_CHECK(condition, msg) \
do {} while (0)
{}
#define S_WARN(condition, msg, scanptr) \
do {} while (0)
{}
#define PreMoveFrameCheck(fx68k) \
do {} while (0)
{}
#define CHECK_BF(bf68k) \
do {} while (0)
{}
#define CHECK_FX(fx68k) \
do {} while (0)
{}
#endif /* STACKCHECK */

0
inc/subrs.h Normal file → Executable file
View File

View File

@@ -19,37 +19,37 @@ extern jmp_buf jmpbuf;
extern unsigned int TIMEOUT_TIME;
#define SETJMP(x) \
do { \
{ \
if(setjmp(jmpbuf) != 0) return(x); \
} while (0)
}
#define TIMEOUT(exp) \
do { \
{ \
alarm(TIMEOUT_TIME); \
INTRSAFE(exp); \
alarm(0); \
} while (0)
}
#define TIMEOUT0(exp) \
do { \
{ \
alarm(TIMEOUT_TIME); \
INTRSAFE0(exp); \
alarm(0); \
} while (0)
}
#define S_TOUT(exp) \
alarm(TIMEOUT_TIME), \
(exp), \
alarm(0)
alarm(TIMEOUT_TIME),\
(exp), \
alarm(0)
#define ERRSETJMP(rval) \
do { \
{ \
if(setjmp(jmpbuf) != 0) \
{ \
*Lisp_errno = 100; \
return(rval); \
} \
} while (0)
}
/************************************************************************/

View File

@@ -202,8 +202,9 @@
BCE_CURRENTFX->pc = ((UNSIGNED)PCMAC - (UNSIGNED)FuncObj) + FN_OPCODE_SIZE; \
FN_STACK_CHECK; \
{ \
IVARL = (DLword *)(CSTKPTR - (argcount) + 1); \
BCE_CURRENTFX->nextblock = NEXTBLOCK = StackOffsetFromNative(IVARL); \
UNSIGNED newivar; \
newivar = (UNSIGNED)(IVARL = (DLword *)(CSTKPTR - (argcount) + 1)); \
BCE_CURRENTFX->nextblock = NEXTBLOCK = StkOffset_from_68K(newivar); \
} \
HARD_PUSH(TOPOFSTACK); /* save TOS */ \
if (LOCFNCELL->na >= 0) { \
@@ -217,7 +218,7 @@
} /* if end */ \
/* Set up BF */ \
HARD_PUSH(BF_MARK32 | NEXTBLOCK); \
*((LispPTR *)CSTKPTR) = (FX_MARK << 16) | (StackOffsetFromNative(PVAR)); \
*((LispPTR *)CSTKPTR) = (FX_MARK << 16) | (StkOffset_from_68K(PVAR)); \
((struct frameex2 *)CSTKPTR)->fnheader = SWAP_FNHEAD(defcell_word); \
CSTKPTRL = (LispPTR *)(((DLword *)CSTKPTR) + FRAMESIZE); \
PVARL = (DLword *)CSTKPTR; \
@@ -257,8 +258,9 @@
BCE_CURRENTFX->pc = ((UNSIGNED)PCMAC - (UNSIGNED)FuncObj) + FNX_OPCODE_SIZE; \
FN_STACK_CHECK; \
{ \
IVARL = (DLword *)(CSTKPTR - num_args + 1); \
BCE_CURRENTFX->nextblock = NEXTBLOCK = StackOffsetFromNative(IVARL); \
UNSIGNED newivar; \
newivar = (UNSIGNED)(IVARL = (DLword *)(CSTKPTR - num_args + 1)); \
BCE_CURRENTFX->nextblock = NEXTBLOCK = StkOffset_from_68K(newivar); \
} \
HARD_PUSH(TOPOFSTACK); /* save TOS */ \
if (LOCFNCELL->na >= 0) { \
@@ -272,7 +274,7 @@
} /* if end */ \
/* Set up BF */ \
HARD_PUSH(BF_MARK32 | NEXTBLOCK); \
*((LispPTR *)CSTKPTR) = (FX_MARK << 16) | (StackOffsetFromNative(PVAR)); \
*((LispPTR *)CSTKPTR) = (FX_MARK << 16) | (StkOffset_from_68K(PVAR)); \
((struct frameex2 *)CSTKPTR)->fnheader = SWAP_FNHEAD(defcell->defpointer); \
CSTKPTRL = (LispPTR *)(((DLword *)CSTKPTR) + FRAMESIZE); \
PVARL = (DLword *)CSTKPTR; \
@@ -370,8 +372,9 @@
FN_STACK_CHECK; \
APPLY_POP_PUSH_TEST; \
{ \
IVARL = (DLword *)(CSTKPTR + (1 - fn_num_args - needpush)); \
BCE_CURRENTFX->nextblock = NEXTBLOCK = StackOffsetFromNative(IVARL); \
UNSIGNED newivar; \
newivar = (UNSIGNED)(IVARL = (DLword *)(CSTKPTR + (1 - fn_num_args - needpush))); \
BCE_CURRENTFX->nextblock = NEXTBLOCK = StkOffset_from_68K(newivar); \
} \
HARD_PUSH(TOPOFSTACK); /* save TOS */ \
if (LOCFNCELL->na >= 0) { \
@@ -386,7 +389,7 @@
/* Set up BF */ \
HARD_PUSH(BF_MARK32 | NEXTBLOCK); \
} /* NEXTBLOCK BLOCK */ \
*((LispPTR *)CSTKPTR) = (FX_MARK << 16) | (StackOffsetFromNative(PVAR)); \
*((LispPTR *)CSTKPTR) = (FX_MARK << 16) | (StkOffset_from_68K(PVAR)); \
((struct frameex2 *)CSTKPTR)->fnheader = SWAP_FNHEAD(defcell->defpointer); \
CSTKPTRL = (LispPTR *)(((DLword *)CSTKPTR) + FRAMESIZE); \
PVARL = (DLword *)CSTKPTR; \
@@ -438,8 +441,9 @@
FN_STACK_CHECK; \
CSTKPTRL -= 2; \
{ \
IVARL = (DLword *)(CSTKPTR - num_args); \
BCE_CURRENTFX->nextblock = NEXTBLOCK = StackOffsetFromNative(IVARL);\
UNSIGNED newivar; \
newivar = (UNSIGNED)(IVARL = (DLword *)(CSTKPTR - num_args)); \
BCE_CURRENTFX->nextblock = NEXTBLOCK = StkOffset_from_68K(newivar); \
} \
if (LOCFNCELL->na >= 0) { \
int RESTARGS; \
@@ -452,7 +456,7 @@
} /* if end */ \
/* Set up BF */ \
HARD_PUSH(BF_MARK32 | NEXTBLOCK); \
*((LispPTR *)CSTKPTR) = (FX_MARK << 16) | (StackOffsetFromNative(PVAR)); \
*((LispPTR *)CSTKPTR) = (FX_MARK << 16) | (StkOffset_from_68K(PVAR)); \
((struct frameex2 *)CSTKPTR)->fnheader = SWAP_FNHEAD(Fn_DefCell); \
CSTKPTRL = (LispPTR *)(((DLword *)CSTKPTR) + FRAMESIZE); \
PVARL = (DLword *)CSTKPTR; \

View File

@@ -218,6 +218,17 @@ typedef intptr_t INT;
/********************************************************/
/* */
/********************************************************/
#ifdef OS5
/* Solaris, sort of SYSV-ish, but not really */
#define MAIKO_ENABLE_ETHERNET
#endif /* OS5 */
/********************************************************/
/* */
/********************************************************/

0
inc/xdefs.h Normal file → Executable file
View File

0
src/bbt68k.s Normal file → Executable file
View File

0
src/bbtSPARC.s Normal file → Executable file
View File

View File

@@ -75,12 +75,10 @@ extern IOPAGE *IOPage68K;
extern int kbd_for_makeinit;
#define init_kbd_startup \
do { \
if (!kbd_for_makeinit) { \
if (!kbd_for_makeinit) { \
init_keyboard(0); \
kbd_for_makeinit = 1; \
} \
} while (0)
};
#endif
#include "devif.h"
@@ -581,7 +579,7 @@ LispPTR n_new_cursorin(DLword *baseaddr, int dx, int dy, int w, int h) {
#define BITBLTBITMAP_argnum 14
#define PUNT_TO_BITBLTBITMAP \
do { \
{ \
if (BITBLTBITMAP_index == 0xffffffff) { \
BITBLTBITMAP_index = get_package_atom("\\PUNT.BITBLT.BITMAP", 19, "INTERLISP", 9, NIL); \
if (BITBLTBITMAP_index == 0xffffffff) { \
@@ -592,7 +590,7 @@ LispPTR n_new_cursorin(DLword *baseaddr, int dx, int dy, int w, int h) {
CurrentStackPTR += (BITBLTBITMAP_argnum - 1) * DLWORDSPER_CELL; \
ccfuncall(BITBLTBITMAP_index, BITBLTBITMAP_argnum, 3); \
return (ATOM_T); \
} while (0)
}
LispPTR BITBLTBITMAP_index;
/************************************************************************/
@@ -858,7 +856,7 @@ bad_arg:
#define BLTSHADEBITMAP_argnum 8
#define PUNT_TO_BLTSHADEBITMAP \
do { \
{ \
if (BLTSHADEBITMAP_index == 0xffffffff) { \
BLTSHADEBITMAP_index = get_package_atom("\\PUNT.BLTSHADE.BITMAP", 21, "INTERLISP", 9, NIL); \
if (BLTSHADEBITMAP_index == 0xffffffff) { \
@@ -869,7 +867,7 @@ bad_arg:
CurrentStackPTR += (BLTSHADEBITMAP_argnum - 1) * DLWORDSPER_CELL; \
ccfuncall(BLTSHADEBITMAP_index, BLTSHADEBITMAP_argnum, 3); \
return (ATOM_T); \
} while (0)
}
LispPTR BLTSHADEBITMAP_index;
@@ -1197,7 +1195,7 @@ void bltchar(LispPTR *args)
bitblt(srcbase, dstbase, sx, dx, w, h, srcbpl, dstbpl, backwardflg, src_comp, op, gray, num_gray,
curr_gray_line);
#else
new_char_bitblt_code;
new_char_bitblt_code
#endif
#ifdef DISPLAYBUFFER
@@ -1240,7 +1238,7 @@ void bltchar(LispPTR *args)
#define BLTCHAR_argnum 3
#ifndef INIT
#define PUNT_TO_BLTCHAR \
do { \
{ \
if ((BLTCHAR_index == 0)) { \
BLTCHAR_index = get_package_atom("\\MAIKO.PUNTBLTCHAR", 18, "INTERLISP", 9, NIL); \
if (BLTCHAR_index == 0xffffffff) { \
@@ -1251,10 +1249,10 @@ void bltchar(LispPTR *args)
CurrentStackPTR += (BLTCHAR_argnum - 1) * DLWORDSPER_CELL; \
ccfuncall(BLTCHAR_index, BLTCHAR_argnum, 3); \
return; \
} while (0)
}
#else
#define PUNT_TO_BLTCHAR \
do { /* Version that is silent instead of erroring for init */ \
{ /* Version that is silent instead of erroring for init */ \
if ((BLTCHAR_index == 0)) { \
BLTCHAR_index = get_package_atom("\\MAIKO.PUNTBLTCHAR", 18, "INTERLISP", 9, NIL); \
if (BLTCHAR_index == 0xffffffff) { \
@@ -1265,12 +1263,12 @@ void bltchar(LispPTR *args)
CurrentStackPTR += (BLTCHAR_argnum - 1) * DLWORDSPER_CELL; \
ccfuncall(BLTCHAR_index, BLTCHAR_argnum, 3); \
return; \
} while (0)
}
#endif /* INIT */
#define TEDIT_BLTCHAR_argnum 6
#define PUNT_TO_TEDIT_BLTCHAR \
do { \
{ \
if (TEDIT_BLTCHAR_index == 0xffffffff) { \
TEDIT_BLTCHAR_index = get_package_atom("\\TEDIT.BLTCHAR", 14, "INTERLISP", 9, NIL); \
if (TEDIT_BLTCHAR_index == 0xffffffff) { \
@@ -1281,10 +1279,10 @@ void bltchar(LispPTR *args)
CurrentStackPTR += (TEDIT_BLTCHAR_argnum - 1) * DLWORDSPER_CELL; \
ccfuncall(TEDIT_BLTCHAR_index, TEDIT_BLTCHAR_argnum, 3); \
return; \
} while (0)
}
#define FGetNum(ptr, place) \
do { \
{ \
if (((ptr)&SEGMASK) == S_POSITIVE) { \
(place) = ((ptr)&0xffff); \
} else if (((ptr)&SEGMASK) == S_NEGATIVE) { \
@@ -1292,9 +1290,9 @@ void bltchar(LispPTR *args)
} else { \
PUNT_TO_BLTCHAR; \
} \
} while (0)
}
#define FGetNum2(ptr, place) \
do { \
{ \
if (((ptr)&SEGMASK) == S_POSITIVE) { \
(place) = ((ptr)&0xffff); \
} else if (((ptr)&SEGMASK) == S_NEGATIVE) { \
@@ -1302,7 +1300,7 @@ void bltchar(LispPTR *args)
} else { \
return (-1); \
} \
} while (0)
}
LispPTR *TOPWDS68k; /* Top of window stack's DS */
LispPTR BLTCHAR_index; /* Atom # for \PUNTBLTCHAR punt fn */
@@ -1408,7 +1406,7 @@ void newbltchar(LispPTR *args) {
bitblt(srcbase, dstbase, sx, dx, w, h, srcbpl, dstbpl, backwardflg, src_comp, op, gray, num_gray,
curr_gray_line);
#else
new_char_bitblt_code;
new_char_bitblt_code
#endif
#ifdef DISPLAYBUFFER

View File

@@ -82,7 +82,7 @@ LispPTR N_OP_pilotbitblt(LispPTR pilot_bt_tbl, LispPTR tos)
if (!kbd_for_makeinit) {
init_keyboard(0);
kbd_for_makeinit = 1;
}
};
#endif
@@ -122,7 +122,7 @@ LispPTR N_OP_pilotbitblt(LispPTR pilot_bt_tbl, LispPTR tos)
;
#endif /* SUNDISPLAY / DOS */
new_bitblt_code;
new_bitblt_code
#if DOS
flush_display_lineregion(dx, dstbase, w, h);

0
src/box Normal file → Executable file
View File

View File

@@ -19,18 +19,33 @@
/* */
/***************************************************************************/
#include <arpa/inet.h>
#include "byteswapdefs.h"
#include "lsptypes.h"
/****************************************************************/
/* */
/* Byte-swap a region wordcount words long */
/* This does NOT swap words in a long-word! */
/* */
/****************************************************************/
void byte_swap_page(unsigned short *page, int wordcount) {
int i;
for (i = 0; i < wordcount; i++) { *(page + i) = byte_swap_word(*(page + i)); }
}
/****************************************************************/
/* */
/* Byte- & word-swap a region wordcount long-words long */
/* */
/****************************************************************/
void word_swap_page(unsigned short *page, int longwordcount) {
unsigned int *longpage = (unsigned int *)page;
for (int i = 0; i < longwordcount; i++) { *(longpage + i) = ntohl(*(longpage + i)); }
int i;
unsigned int *longpage;
longpage = (unsigned int *)page;
for (i = 0; i < (longwordcount + longwordcount); i++) {
*(page + i) = byte_swap_word(*(page + i));
}
for (i = 0; i < longwordcount; i++) { *(longpage + i) = swapx(*(longpage + i)); }
}
/****************************************************************/

0
src/cr Normal file → Executable file
View File

View File

@@ -65,27 +65,23 @@ jmp_buf BT_jumpbuf;
#define BTMAXLINE 24
/* DOS has a 25-line screen, and getchar discards ESC for some reason */
#define BT_morep \
do { \
if ((BT_temp != '!') && (++BT_lines > BTMAXLINE)) { \
printf("Press Return(Esc & Ret to quit, ! don't stop):"); \
BT_temp = getch(); \
fflush(stdin); \
BT_lines = 0; \
if (BT_temp == 27) longjmp(BT_jumpbuf, 1); \
} \
} while (0)
if ((BT_temp != '!') && (++BT_lines > BTMAXLINE)) { \
printf("Press Return(Esc & Ret to quit, ! don't stop):"); \
BT_temp = getch(); \
fflush(stdin); \
BT_lines = 0; \
if (BT_temp == 27) longjmp(BT_jumpbuf, 1); \
}
#else /* DOS */
#define BTMAXLINE 30
#define BT_morep \
do { \
if (++BT_lines > BTMAXLINE) { \
printf("Press Return(to quit Esc and Ret):"); \
BT_temp = getchar(); \
fflush(stdin); \
BT_lines = 0; \
if (BT_temp == 27) longjmp(BT_jumpbuf, 1); \
} \
} while (0)
if (++BT_lines > BTMAXLINE) { \
printf("Press Return(to quit Esc and Ret):"); \
BT_temp = getchar(); \
fflush(stdin); \
BT_lines = 0; \
if (BT_temp == 27) longjmp(BT_jumpbuf, 1); \
}
#endif /* DOS */
/***************************************************************/

View File

@@ -69,7 +69,7 @@ extern int Dummy_errno;
*/
#define SetupMatch(tname, pname, text, pext, tver) \
do { \
{ \
char *pp; \
\
separate_version(tname, tver, 0); \
@@ -87,10 +87,10 @@ extern int Dummy_errno;
*pp = '\0'; \
strcpy(pext, pp + 1); \
} \
} while (0)
}
#define MatchP(target, name, ver, matchtag, unmatchtag) \
do { \
{ \
char tname[MAXNAMLEN], text[MAXNAMLEN], tver[VERSIONLEN]; \
char pname[MAXNAMLEN], pext[MAXNAMLEN]; \
\
@@ -105,10 +105,10 @@ extern int Dummy_errno;
goto matchtag; /* NOLINT(bugprone-macro-parentheses) */ \
else \
goto unmatchtag; /* NOLINT(bugprone-macro-parentheses) */ \
} while (0)
}
#define MatchP_Case(target, name, ver, matchtag, unmatchtag) \
do { \
{ \
char tname[MAXNAMLEN], text[MAXNAMLEN], tver[VERSIONLEN]; \
char pname[MAXNAMLEN], pext[MAXNAMLEN]; \
\
@@ -121,7 +121,7 @@ extern int Dummy_errno;
goto matchtag; /* NOLINT(bugprone-macro-parentheses) */ \
else \
goto unmatchtag; /* NOLINT(bugprone-macro-parentheses) */ \
} while (0)
}
/*
* Name: match_pattern
@@ -232,7 +232,7 @@ int MAXFINFO;
#define FINFOARRAYRSIZE 16
#define AllocFinfo(fp) \
do { \
{ \
if (FreeFinfoList != (FINFO *)NULL) { \
(fp) = FreeFinfoList; \
FreeFinfoList = (fp)->next; \
@@ -242,15 +242,15 @@ int MAXFINFO;
free(fp); \
(fp) = (FINFO *)NULL; \
} \
} while (0)
}
#define FreeFinfo(fp) \
do { \
{ \
FINFO *lastp; \
for (lastp = fp; lastp->next != (FINFO *)NULL; lastp = lastp->next) {} \
lastp->next = FreeFinfoList; \
FreeFinfoList = fp; \
} while (0)
}
/*

View File

@@ -85,10 +85,10 @@ extern LispPTR *KEYBUFFERING68k;
/* of the handler, so let's do it once, correctly.) */
/******************************************************/
#define ENABLE_KBD \
do { \
{ \
outp(INTA00, ENDOFINTERRUPT); \
outp(KBD_COMMAND_PORT, KBD_ENABLE); /* Turn kbd on again. */ \
} while (0)
}
/************************************************************************/
/* */

View File

@@ -302,13 +302,13 @@ dostaking_mouse_up(int newx, int newy)
currentmouse->Cursor.Last.width = w = currentdsp->Display.width - newx;
} else {
currentmouse->Cursor.Last.width = w = 16;
}
};
if (currentdsp->Display.height < (newy + 16)) {
currentmouse->Cursor.Last.height = h = currentdsp->Display.height - newy;
} else {
currentmouse->Cursor.Last.height = h = 16;
}
};
srcbpl = currentdsp->Display.width;
dstbpl = 16;

View File

@@ -2811,7 +2811,7 @@ static int make_directory(char *dir)
*/
#ifdef DOS
#define FindHighestVersion(varray, mentry, max_no) \
do { \
{ \
FileName *centry; \
for (centry = varray, max_no = -1; centry->version_no != LASTVERSIONARRAY; centry++) { \
if (centry->version_no > max_no) { \
@@ -2819,10 +2819,10 @@ static int make_directory(char *dir)
mentry = centry; \
} \
} \
} while (0)
}
#else
#define FindHighestVersion(varray, mentry, max_no) \
do { \
{ \
FileName *centry; \
for (centry = (varray), (max_no) = 0; centry->version_no != LASTVERSIONARRAY; centry++) { \
if (centry->version_no > (max_no)) { \
@@ -2830,7 +2830,7 @@ static int make_directory(char *dir)
(mentry) = centry; \
} \
} \
} while (0)
}
#endif /* DOS */
/*
@@ -2859,7 +2859,7 @@ static int make_directory(char *dir)
*/
#ifdef DOS
#define FindLowestVersion(varray, mentry, min_no) \
do { \
{ \
FileName *centry; \
for (centry = varray, min_no = MAXVERSION; centry->version_no != LASTVERSIONARRAY; centry++) { \
if (centry->version_no < min_no) { \
@@ -2867,10 +2867,10 @@ static int make_directory(char *dir)
mentry = centry; \
} \
} \
} while (0)
}
#else
#define FindLowestVersion(varray, mentry, min_no) \
do { \
{ \
FileName *centry; \
for (centry = (varray), (min_no) = MAXVERSION; centry->version_no != LASTVERSIONARRAY; centry++) { \
if (centry->version_no < (min_no) && centry->version_no != 0) { \
@@ -2878,7 +2878,7 @@ static int make_directory(char *dir)
(mentry) = centry; \
} \
} \
} while (0)
}
#endif /* DOS */
/*
@@ -2906,7 +2906,7 @@ static int make_directory(char *dir)
*/
#define FindSpecifiedVersion(varray, sentry, ver_no) \
do { \
{ \
FileName *centry; \
\
(sentry) = (FileName *)NULL; \
@@ -2915,7 +2915,7 @@ static int make_directory(char *dir)
(sentry) = centry; \
break; \
} \
} while (0)
}
/************************************************************************/
/* */

0
src/dsp386.il Normal file → Executable file
View File

0
src/dspSPARC.il Normal file → Executable file
View File

View File

@@ -165,12 +165,12 @@ void flip_cursor() {
except those who want to try building loadups. */
if (!for_makeinit) {
for (cnt = CURSORHEIGHT; (cnt--);) { GETWORD(word++) ^= 0xFFFF; }
}
for (cnt = CURSORHEIGHT; (cnt--);) { GETWORD(word++) ^= 0xFFFF; };
};
#else
for (cnt = CURSORHEIGHT; (cnt--);) { GETWORD(word++) ^= 0xFFFF; }
for (cnt = CURSORHEIGHT; (cnt--);) { GETWORD(word++) ^= 0xFFFF; };
#endif

View File

@@ -37,7 +37,7 @@
#define CHAR_SIZE CHAR_MAXLEN *(sizeof(char) / sizeof(int))
#define LStringToCString(Lisp, C, MaxLen, Len) \
do { \
{ \
OneDArray *arrayp; \
char *base; \
short *sbase; \
@@ -64,10 +64,10 @@
\
default: error("LStringToCString can not handle\n"); \
} \
} while (0)
}
#define CStringToLString(C, Lisp, Len) \
do { \
{ \
OneDArray *arrayp; \
char *base; \
short *sbase; \
@@ -93,18 +93,18 @@
\
default: error("CStringToLString can not handle\n"); \
} \
} while (0)
}
#define IntToFixp(C, Lisp) \
do { \
{ \
int *base; \
\
base = (int *)NativeAligned4FromLAddr((unsigned int)Lisp); \
*base = C; \
} while (0)
}
#define ZeroFix(C) \
do { \
{ \
int k, j; \
\
if (C[0] == 0 && C[1] != 0) { \
@@ -113,15 +113,15 @@
} \
C[j] = 0; \
} \
} while (0)
}
#define EJLISP_SETJMP(x) \
do { \
{ \
if (setjmp(jmpbuf) != 0) { \
ejlisp_buf = NULL; \
return (x); \
} \
} while (0)
}
typedef struct first_array {
unsigned int orig : 1;

View File

@@ -64,14 +64,12 @@ BIGNUM (integer that can't be represented bigger than 32 bits)
*/
#define IF_IMMEDIATE(arg, doit, doitsmall) \
do { \
switch (SEGMASK & (arg)) { \
case ATOM_OFFSET: doit; /* NOLINT(bugprone-macro-parentheses) */ \
case S_CHARACTER: doit; /* NOLINT(bugprone-macro-parentheses) */ \
case S_POSITIVE: doitsmall; /* NOLINT(bugprone-macro-parentheses) */ \
case S_NEGATIVE: doitsmall; /* NOLINT(bugprone-macro-parentheses) */ \
} \
} while (0)
switch (SEGMASK & (arg)) { \
case ATOM_OFFSET: doit; /* NOLINT(bugprone-macro-parentheses) */ \
case S_CHARACTER: doit; /* NOLINT(bugprone-macro-parentheses) */ \
case S_POSITIVE: doitsmall; /* NOLINT(bugprone-macro-parentheses) */ \
case S_NEGATIVE: doitsmall; /* NOLINT(bugprone-macro-parentheses) */ \
}
/************************************************************************/
/* */

View File

@@ -7,8 +7,6 @@
/* */
/************************************************************************/
#if defined(MAIKO_ENABLE_ETHERNET) && !defined(MAIKO_ENABLE_NETHUB)
#include "version.h"
#if defined(USE_DLPI)
@@ -81,17 +79,17 @@
#define NIOCSETF PFIOCSETF
#endif
extern int ether_fd; /* file descriptor for ether socket */
static int ether_intf_type = 0;
extern u_char ether_host[6]; /* 48 bit address of this node */
extern u_char broadcast[6];
extern int ether_bsize; /* if nonzero then a receive is pending */
extern u_char *ether_buf; /* address of receive buffer */
static u_char nit_buf[3000]; /* the current chunk read from NIT (one packet) */
int ether_fd = -1; /* file descriptor for ether socket */
int ether_intf_type = 0;
u_char ether_host[6] = {0, 0, 0, 0, 0, 0}; /* 48 bit address of this node */
u_char broadcast[6] = {255, 255, 255, 255, 255, 255};
int ether_bsize = 0; /* if nonzero then a receive is pending */
u_char *ether_buf; /* address of receive buffer */
u_char nit_buf[3000]; /* the current chunk read from NIT (one packet) */
extern LispPTR *PENDINGINTERRUPT68k;
extern fd_set LispReadFds;
extern fd_set LispReadFds;
extern int ETHEREventCount;
int ETHEREventCount = 0;
#define PacketTypeIP 0x0800
#define PacketTypeARP 0x0806
@@ -122,6 +120,7 @@ extern int ETHEREventCount;
ments of the stack and replaces them with its result. When
both an action and operator are specified in the same short-
word, the action is performed followed by the operation.
The binary operator can also be from the set { ENF_COR,
ENF_CAND, ENF_CNOR, ENF_CNAND }. These are "short-circuit"
operators, in that they terminate the execution of the
@@ -133,6 +132,7 @@ extern int ETHEREventCount;
false; ENF_CNOR returns false if the result is true. Unlike
the other binary operators, these four do not leave a result
on the stack, even if they continue.
The short-circuit operators should be used when possible, to
reduce the amount of time spent evaluating filters. When
they are used, you should also arrange the order of the
@@ -140,6 +140,7 @@ extern int ETHEREventCount;
possible; for example, checking the IP destination field of
a UDP packet is more likely to indicate failure than the
packet type field.
The special action ENF_NOPUSH and the special operator
ENF_NOP can be used to only perform the binary operation or
to only push a value on the stack. Since both are (con-
@@ -147,6 +148,7 @@ extern int ETHEREventCount;
actually specifies the action followed by ENF_NOP, and indi-
cating only an operation actually specifies ENF_NOPUSH fol-
lowed by the operation.
After executing the filter command list, a non-zero value
(true) left on top of the stack (or an empty stack) causes
the incoming packet to be accepted and a zero value (false)
@@ -725,13 +727,13 @@ static int check_filter(u_char *buffer)
case PacketTypeIP: return (0);
case PacketTypeARP: return (0);
default: return (1);
}
};
/* my address */
if (ether_addr_equal(buffer, ether_host)) switch (((short *)buffer)[6]) {
case PacketTypeIP: return (0);
case PacketTypeARP: return (0);
default: return (1);
}
};
return (0);
}
@@ -744,7 +746,23 @@ static void init_uid() {
rid = getuid();
setuid(rid);
}
#endif /* MAIKO_ENABLE_ETHERNET */
/************************************************************************/
/* i n i t _ i f p a g e _ e t h e r */
/* */
/* sets Lisp's idea of \my.nsaddress. Clears it if ether not */
/* enabled */
/* */
/************************************************************************/
void init_ifpage_ether() {
InterfacePage->nshost0 = (DLword)((ether_host[0] << 8) + ether_host[1]);
InterfacePage->nshost1 = (DLword)((ether_host[2] << 8) + ether_host[3]);
InterfacePage->nshost2 = (DLword)((ether_host[4] << 8) + ether_host[5]);
}
#ifdef MAIKO_ENABLE_ETHERNET
/* this needs to be a global so the name can be set by main() in Ctest */
/* But MAIKO_ENABLE_ETHERNET doesn't support NIT, so dyke it out for MAIKO_ENABLE_ETHERNET */
#if defined(USE_NIT)
@@ -1067,4 +1085,49 @@ void init_ether() {
#endif /* MAIKO_ENABLE_ETHERNET */
}
#endif /* defined(MAIKO_ENABLE_ETHERNET) */
#define MASKWORD1 0xffff
/************************************************************************/
/* */
/* c h e c k _ s u m */
/* */
/* Implements the CHECKSUM opcode; compute the checksum for an */
/* ethernet packet. */
/* */
/* args[0] LispPTR base; */
/* args[1] LispPTR nwords; */
/* args[2] LispPTR initsum; */
/* */
/* */
/************************************************************************/
LispPTR check_sum(LispPTR *args)
{
LispPTR checksum;
DLword *address;
int nwords;
address = (DLword *)NativeAligned2FromLAddr(*args++);
nwords = *args++;
if (*args != NIL)
checksum = (*args) & MASKWORD1;
else
checksum = 0;
for (; nwords > (S_POSITIVE); address++, nwords--) {
checksum = checksum + GETWORD(address);
if (checksum > 0xffff) checksum = (checksum & 0xffff) + 1; /* add carry */
if (checksum > 0x7fff) /* ROTATE LEFT 1 */
checksum = ((checksum & 0x7fff) << 1) | 1;
else
checksum = checksum << 1;
}
if (checksum == MASKWORD1)
return (S_POSITIVE); /* ret 0 */
else
return (S_POSITIVE | checksum);
} /*check_sum */

View File

@@ -1,204 +0,0 @@
/* $Id: ether.c,v 1.4 2001/12/24 01:09:02 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-1996 inclusive Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/************************************************************************/
#include "version.h"
#include <unistd.h>
#include <sys/types.h>
#include "lsptypes.h"
#include "lspglob.h"
#include "adr68k.h"
/*
* global variables exported to ether_*.c and possibly others
*/
int ether_fd = -1; /* file descriptor for ether socket */
u_char ether_host[6] = {0, 0, 0, 0, 0, 0}; /* 48 bit address of this node */
u_char broadcast[6] = {255, 255, 255, 255, 255, 255};
int ether_bsize = 0; /* if nonzero then a receive is pending */
u_char *ether_buf = NULL; /* address of receive buffer */
int ETHEREventCount = 0;
/*
* public procedures
*/
/************************************************************************/
/* i n i t _ i f p a g e _ e t h e r */
/* */
/* sets Lisp's idea of \my.nsaddress. Clears it if ether not */
/* enabled */
/* */
/************************************************************************/
void init_ifpage_ether() {
InterfacePage->nshost0 = (DLword)((ether_host[0] << 8) + ether_host[1]);
InterfacePage->nshost1 = (DLword)((ether_host[2] << 8) + ether_host[3]);
InterfacePage->nshost2 = (DLword)((ether_host[4] << 8) + ether_host[5]);
}
#define MASKWORD1 0xffff
/************************************************************************/
/* */
/* c h e c k _ s u m */
/* */
/* Implements the CHECKSUM opcode; compute the checksum for an */
/* ethernet packet. */
/* */
/* args[0] LispPTR base; */
/* args[1] LispPTR nwords; */
/* args[2] LispPTR initsum; */
/* */
/* */
/************************************************************************/
LispPTR check_sum(LispPTR *args)
{
LispPTR checksum;
DLword *address;
int nwords;
address = (DLword *)NativeAligned2FromLAddr(*args++);
nwords = *args++;
if (*args != NIL)
checksum = (*args) & MASKWORD1;
else
checksum = 0;
for (; nwords > (S_POSITIVE); address++, nwords--) {
checksum = checksum + GETWORD(address);
if (checksum > 0xffff) checksum = (checksum & 0xffff) + 1; /* add carry */
if (checksum > 0x7fff) /* ROTATE LEFT 1 */
checksum = ((checksum & 0x7fff) << 1) | 1;
else
checksum = checksum << 1;
}
if (checksum == MASKWORD1)
return (S_POSITIVE); /* ret 0 */
else
return (S_POSITIVE | checksum);
} /*check_sum */
/*
* dummy implementation of SUBRs if none of the networking options is compiled in
*/
#if !defined(MAIKO_ENABLE_ETHERNET) && !defined(MAIKO_ENABLE_NETHUB)
/************************************************************************/
/* */
/* e t h e r _ s u s p e n d */
/* */
/* Suspend receiving packets. */
/* 175/70/0 */
/* */
/************************************************************************/
LispPTR ether_suspend(LispPTR args[])
{
return (ATOM_T);
}
/************************************************************************/
/* */
/* e t h e r _ r e s u m e */
/* */
/* resume nit socket to receive all types of packets 175/71/0 */
/* */
/************************************************************************/
LispPTR ether_resume(LispPTR args[])
{
return (ATOM_T);
}
/************************************************************************/
/* */
/* e t h e r _ c t r l r */
/* */
/* return T if ether controller is available 175/72/0 */
/* */
/************************************************************************/
LispPTR ether_ctrlr(LispPTR args[])
{
return (NIL);
}
/**********************************************************************
* ether_reset(args) 175/73/0
* reset ether controller and disable receipt of packets
**********************************************************************/
LispPTR ether_reset(LispPTR args[])
{
return (NIL);
}
/************************************************************************/
/* */
/* e t h e r _ g e t (175/74/2) */
/* */
/* Set up the Ethernet driver to receive a packet. The driver */
/* first tries to read any pending packet from the net, and if */
/* there is one, ether_get returns T. If there is no pending */
/* packet, the failing read sets us up to get an interrupt when */
/* a packet DOES arrive, and ether_get returns NIL. */
/* */
/* args[0] Length of the buffer we're passed */
/* args[1] LISP address of a packet buffer */
/* */
/* sets ether_buf to the buffer address, for check_ether's use */
/* sets ether_bsize to the buffer size. ether_bsize>0 means */
/* it's OK to read packets from the network on interrupt. */
/* */
/************************************************************************/
LispPTR ether_get(LispPTR args[])
{
return (NIL);
}
/**********************************************************************
* ether_send(args) 175/75/2 max_words,buffer_addr
* send a packet
**********************************************************************/
LispPTR ether_send(LispPTR args[])
{
return (NIL);
}
/**********************************************************************
* ether_setfilter(args) 175/76/1 filterbits
* check whether a packet has come. if does, notify iocb
**********************************************************************/
LispPTR ether_setfilter(LispPTR args[])
{
return (NIL);
}
/**********************************************************************
* check_ether() 175/77/0
* checks an incoming packet
**********************************************************************/
LispPTR check_ether()
{
return (NIL);
}
#endif

View File

@@ -1,577 +0,0 @@
/*******************************************************************************/
/* */
/* Support for Dodo Nethub networking (see: https://github.com/devhawala/dodo) */
/* */
/* Copyright (c) 2022, Dr. Hans-Walter Latz. All rights reserved. */
/* Released to the Public Domain. */
/* */
/*******************************************************************************/
#if defined(MAIKO_ENABLE_NETHUB) && !defined(MAIKO_ENABLE_ETHERNET)
#include "version.h"
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <sys/poll.h>
#include <signal.h>
#include <fcntl.h>
#include <errno.h>
#include <netdb.h>
#include <netinet/in.h>
#include "commondefs.h"
#include "lispemul.h"
#include "lispmap.h"
#include "emlglob.h"
#include "lsptypes.h"
#include "lspglob.h"
#include "adr68k.h"
#include "ether.h"
#include "dbprint.h"
#include "etherdefs.h"
#include "ifpage.h"
#include "iopage.h"
#include "byteswapdefs.h"
#include "dbprint.h"
#include "timerdefs.h"
#include "lisp2cdefs.h"
/*
** --- ether implementation common data -------------------------------------------
*/
extern int ether_fd; /* file descriptor for ether socket */
extern u_char ether_host[6]; /* 48 bit address of this node */
extern u_char broadcast[6];
extern int ether_bsize; /* if nonzero then a receive is pending */
extern u_char *ether_buf; /* address of receive buffer */
extern LispPTR *PENDINGINTERRUPT68k;
extern fd_set LispReadFds;
/*
** --- nethub configuration data --------------------------------------------------
*/
static char* nethubHost = NULL;
static int nethubPort = 3333;
static int mac0 = 0xCA;
static int mac1 = 0xFF;
static int mac2 = 0xEE;
static int mac3 = 0x12;
static int mac4 = 0x34;
static int mac5 = 0x56;
void setNethubHost(char* host) {
if (host && *host) {
nethubHost = host;
DBPRINT(("nh :: host now: '%s'\n", nethubHost));
}
}
void setNethubPort(int port) {
if (port > 0 && port <= 65535) {
nethubPort = port;
DBPRINT(("nh :: port now: %d\n", nethubPort));
}
}
void setNethubMac(int m0, int m1, int m2, int m3, int m4, int m5) {
if ( m0 >= 0 && m0 <= 255
&& m1 >= 0 && m1 <= 255
&& m2 >= 0 && m2 <= 255
&& m3 >= 0 && m3 <= 255
&& m4 >= 0 && m4 <= 255
&& m5 >= 0 && m5 <= 255) {
mac0 = m0;
mac1 = m1;
mac2 = m2;
mac3 = m3;
mac4 = m4;
mac5 = m5;
DBPRINT(("nh :: mac now: %02X-%02X-%02X-%02X-%02X-%02X\n", mac0, mac1, mac2, mac3, mac4, mac5));
}
}
/*
** --- very simple logging --------------------------------------------------------
*/
static int loglevel = 0;
static int logcnt = 0;
void setNethubLogLevel(int ll) {
loglevel = ll;
DBPRINT(("nh :: loglevel now: %d\n", loglevel));
}
#define log_info(line) { if (loglevel == 1) \
{ printf("nh-info[%d]: ", logcnt++); printf line; }}
#define log_debug(line) { if (loglevel >= 2) \
{ printf("nh-debug[%d]: ", logcnt++); printf line; }}
#define log_all(line) { if (loglevel < 1) \
{ printf("nh[%d]: ", logcnt++); printf line; }}
/*
** --- utilities ------------------------------------------------------------------
*/
#define LONG_PTR_MASK ((long)(~((long)3)))
static void dblwordsSwap(u_char* basePtr, int forBytes) {
u_char* dblwordPtr = (u_char*)((long)basePtr & LONG_PTR_MASK);
int neededBytes = forBytes + (basePtr - dblwordPtr);
int dblwordCount = (neededBytes + 3) / 4;
word_swap_page((unsigned short*)dblwordPtr, dblwordCount);
}
/*
** --- connect, disconnect and transmit packets -----------------------------------
*/
void connectToHub() {
if (nethubHost == NULL) {
return;
}
if (ether_fd > -1) {
return;
}
log_debug(("connectToHub() - begin\n"));
ether_host[0] = mac0;
ether_host[1] = mac1;
ether_host[2] = mac2;
ether_host[3] = mac3;
ether_host[4] = mac4;
ether_host[5] = mac5;
log_debug((" resolving nethub hostname\n"));
struct hostent *host = gethostbyname(nethubHost);
if (host == NULL || host->h_addr_list == NULL) {
log_debug(("connectToHub(): hostname '%s' cannot be resolved\n", nethubHost));
log_info(("connectToHub(): hostname '%s' cannot be resolved\n", nethubHost));
log_all(("connectToHub(): hostname '%s' cannot be resolved\n", nethubHost));
return;
}
log_debug((" connecting to nethub\n"));
struct sockaddr_in hubaddr;
hubaddr.sin_family = AF_INET;
hubaddr.sin_addr.s_addr = *(in_addr_t *)host->h_addr_list[0];
hubaddr.sin_port = htons(nethubPort);
ether_fd = socket(AF_INET, SOCK_STREAM, 0);
if (ether_fd < 0) {
log_info(("connectToHub(): FAILED to create AF_INET/SOCK_STREAM socket\n"));
return;
}
if (connect(ether_fd, (struct sockaddr*)&hubaddr, sizeof(hubaddr)) < 0) {
perror("connectToHub() - connect failed");
close(ether_fd);
ether_fd = -1;
log_info(("connectToHub(): FAILED to connect to nethub\n"));
return;
}
log_debug((" connected to nethub, ether_fd = %d\n", ether_fd));
FD_SET(ether_fd, &LispReadFds);
log_debug((" added ether_fd to LispReadFds\n"));
log_debug(("connectToHub() - end\n\n"));
log_info(("connectToHub() - connected to nethub\n"));
log_all(("connectToHub() - connected to nethub\n"));
}
static void disconnectFromHub() {
if (ether_fd > -1) {
close(ether_fd);
ether_fd = -1;
log_debug(("disconnectFromHub() - disconnected from nethub\n"));
log_info(("disconnectFromHub() - disconnected from nethub\n"));
log_all(("disconnectFromHub() - disconnected from nethub\n"));
}
}
/* Input:
* ether_fd: fd to read Nethub format packets from
* ether_bsize: size of ether_buf storage
* Output:
* ether_buf: buffer to copy XIP packet into
* ether_bsize: set to 0 if packet returned
* Returns:
* -1: failed/not connected
* 0: no packet available
* >0: number of bytes received and placed in ether_buf
*/
static int recvPacket() {
int rcvLen;
unsigned short bLen;
if (ether_fd < 0) {
log_debug((" recvPacket() :: not connected to hub !!!\n"));
return -1;
}
if (ether_bsize < 1) {
log_debug((" recvPacket() :: no receive buffer present -> return 0\n"));
return 0;
}
/* start by reading the (network byte order) short value indicating the size of the
* XIP packet being received
*/
rcvLen = recv(ether_fd, &bLen, sizeof(bLen), MSG_DONTWAIT);
if (rcvLen < 0 && errno != EAGAIN && errno != EWOULDBLOCK) {
perror("recvPacket() :: recv(ether_fd, &bLen, sizeof(bLen), MSG_DONTWAIT)");
disconnectFromHub();
return -1;
}
if (rcvLen <= 0) {
log_debug((" recvPacket() :: no network packet available -> return 0\n"));
return 0;
}
bLen = ntohs(bLen);
log_debug((" recvPacket() :: received %d bytes, logical packet length = %d bytes\n", rcvLen, bLen));
if (bLen & 0x0001) {
log_debug(("recvPacket() ERROR :: odd byte length of logical packet -> disconnecting from nethub\n"));
log_info(("recvPacket() ERROR :: odd byte length of logical packet -> disconnecting from nethub\n"));
log_all(("recvPacket() ERROR :: odd byte length of logical packet -> disconnecting from nethub\n"));
disconnectFromHub();
return -1;
}
if (bLen > ether_bsize) {
log_debug((" recvPacket() ERROR :: logical packet larger than buffer -> disconnecting from nethub\n"));
log_info(("recvPacket() ERROR :: logical packet larger than buffer -> disconnecting from nethub\n"));
log_all(("recvPacket() ERROR :: logical packet larger than buffer -> disconnecting from nethub\n"));
disconnectFromHub();
return -1;
}
/* continue reading the XIP packet of the just determined size
*/
rcvLen = recv(ether_fd, ether_buf, bLen, MSG_DONTWAIT);
if (rcvLen < 0 && errno != EAGAIN && errno != EWOULDBLOCK) {
perror("recvPacket() :: recv(ether_fd, ether_buf, bLen, MSG_DONTWAIT)");
disconnectFromHub();
return -1;
}
if (rcvLen <= 0) {
log_debug((" recvPacket() :: no network packet available -> return 0\n"));
return 0;
}
if (bLen != rcvLen) {
log_debug((" recvPacket() WARNING :: packet size mismatch -> discard packet -> return 0\n"));
log_info(("recvPacket() WARNING :: packet size mismatch -> discard packet -> return 0\n"));
log_all(("recvPacket() WARNING :: packet size mismatch -> discard packet -> return 0\n"));
return 0;
}
if (bLen < 14) {
/* not even enough bytes for the ethernet header */
/* -> discard packet */
log_debug((" recvPacket() WARNING :: packet too small -> discard packet -> return 0\n"));
log_info(("recvPacket() WARNING :: packet too small -> discard packet -> return 0\n"));
log_all(("recvPacket() WARNING :: packet too small -> discard packet -> return 0\n"));
return 0;
}
if ( memcmp(ether_buf, ether_host, 6) != 0
&& memcmp(ether_buf, broadcast, 6) != 0) {
log_debug((" recvPacket() :: packet is not for us and not a broadcast, ignoring packet\n"));
return 0;
}
#if defined(BYTESWAP)
log_debug((" recvPacket() :: byte-swapping %d bytes at %p\n", bLen, (void *)ether_buf));
dblwordsSwap(ether_buf, bLen);
IOPage->dlethernet[2] = bLen;
#else
log_debug((" recvPacket() :: %d bytes at %p\n", bLen, (void *)ether_buf));
IOPage->dlethernet[3] = bLen;
#endif
ether_bsize = 0;
return bLen;
}
/* -1: failed/not connected; >= 0: packet bytes sent */
static int sendPacket(u_char *source, int sourceLen) {
struct msghdr msg = {0};
struct iovec iov[2];
uint16_t nhlength;
if (ether_fd < 0) {
log_debug((" sendPacket() :: not connected to hub !!!\n"));
return -1;
}
if (sourceLen < 14) {
log_debug((" sendPacket() :: invalid packet length: %d !!!\n", sourceLen));
return -1;
}
if (sourceLen & 0x0001) {
log_debug((" sendPacket() :: packet length not even (mutiple of 2) !!!\n"));
return -1;
}
nhlength = htons(sourceLen);
iov[0].iov_base = &nhlength;
iov[0].iov_len = 2;
iov[1].iov_base = source;
iov[1].iov_len = sourceLen;
msg.msg_iov = iov;
msg.msg_iovlen = 2;
int result = sendmsg(ether_fd, &msg, 0);
return result;
}
/*
** --- SUBR implementations -------------------------------------------------------
*/
/************************************************************************/
/* */
/* e t h e r _ s u s p e n d */
/* */
/* Suspend receiving packets. */
/* 175/70/0 */
/* */
/************************************************************************/
LispPTR ether_suspend(LispPTR args[])
{
if (nethubHost == NULL) {
return (ATOM_T);
}
log_debug(("ether_suspend() -- ignored!\n\n"));
log_info(("ether_suspend()\n"));
return (ATOM_T);
}
/************************************************************************/
/* */
/* e t h e r _ r e s u m e */
/* */
/* resume nit socket to receive all types of packets 175/71/0 */
/* */
/************************************************************************/
LispPTR ether_resume(LispPTR args[])
{
if (nethubHost == NULL) {
return (ATOM_T);
}
log_debug(("ether_resume() - begin\n"));
int_io_open(ether_fd);
log_debug(("ether_resume() - end\n\n"));
log_info(("ether_resume()\n"));
return (ATOM_T);
}
/************************************************************************/
/* */
/* e t h e r _ c t r l r */
/* */
/* return T if ether controller is available 175/72/0 */
/* */
/************************************************************************/
LispPTR ether_ctrlr(LispPTR args[])
{
if (nethubHost == NULL) {
return (NIL);
}
log_debug(("ether_ctrlr() - begin\n"));
connectToHub();
if (ether_fd < 0) {
log_debug(("ether_ctrlr() - end -> NIL\n\n"));
log_info(("ether_ctrlr() -> NIL\n"));
return (NIL);
} else {
int_io_open(ether_fd);
log_debug(("ether_ctrlr() - end -> ATOM_T\n\n"));
log_info(("ether_ctrlr() -> ATOM_T\n"));
return (ATOM_T);
}
}
/**********************************************************************
* ether_reset(args) 175/73/0
* reset ether controller and disable receipt of packets
**********************************************************************/
LispPTR ether_reset(LispPTR args[])
{
if (nethubHost == NULL) {
return (NIL);
}
log_debug(("ether_reset() - begin\n"));
if (ether_fd < 0) {
log_debug(("ether_reset() - end -> NIL\n\n"));
log_info(("ether_reset() -> NIL\n"));
return (NIL);
}
ether_bsize = 0; /* deactivate receiver */
log_debug(("ether_reset() - end -> ATOM_T\n\n"));
log_info(("ether_reset() -> ATOM_T\n"));
return (ATOM_T);
}
/************************************************************************/
/* */
/* e t h e r _ g e t (175/74/2) */
/* */
/* Set up the Ethernet driver to receive a packet. The driver */
/* first tries to read any pending packet from the net, and if */
/* there is one, ether_get returns T. If there is no pending */
/* packet, the failing read sets us up to get an interrupt when */
/* a packet DOES arrive, and ether_get returns NIL. */
/* */
/* args[0] Length of the buffer we're passed */
/* args[1] LISP address of a packet buffer */
/* */
/* sets ether_buf to the buffer address, for check_ether's use */
/* sets ether_bsize to the buffer size. ether_bsize>0 means */
/* it's OK to read packets from the network on interrupt. */
/* */
/************************************************************************/
LispPTR ether_get(LispPTR args[])
{
int receivedBytes;
u_char *target;
int maxByteCount;
if (nethubHost == NULL) {
return (NIL);
}
log_debug(("ether_get() - begin\n"));
target = (u_char *)NativeAligned2FromLAddr(args[1]);
maxByteCount = 2 * LispIntToCInt(args[0]); /* words to bytes */
log_debug((" target = %p maxBytecount: %d bytes\n", (void *)target, maxByteCount));
ether_buf = target;
ether_bsize = maxByteCount;
receivedBytes = recvPacket();
log_debug(("ether_get() :: receivedBytes: %d bytes\n", receivedBytes));
if (receivedBytes <= 0) {
log_debug(("ether_get() - end -> NIL\n\n"));
return (NIL);
}
log_debug(("ether_get() - end -> ATOM_T\n\n"));
log_info(("ether_get(): received packet, len = %d bytes\n", receivedBytes));
return (ATOM_T);
}
/**********************************************************************
* ether_send(args) 175/75/2 max_words,buffer_addr
* send a packet
**********************************************************************/
LispPTR ether_send(LispPTR args[])
{
if (nethubHost == NULL) {
return (NIL);
}
log_debug(("ether_send() - begin\n"));
u_char *source = (u_char *)NativeAligned2FromLAddr(args[1]);
int byteCount = 2 * LispIntToCInt(args[0]); /* words to bytes */
log_debug((" source = %p , bytecount: %d bytes\n", (void *)source, byteCount));
#if defined(BYTESWAP)
dblwordsSwap(source, byteCount);
int bytesSent = sendPacket(source, byteCount);
dblwordsSwap(source, byteCount);
#else
int bytesSent = sendPacket(source, byteCount);
#endif
if (bytesSent < 0) {
log_debug(("ether_send() - failed (bytesSent: %d bytes) -> NIL\n\n", bytesSent));
log_info(("ether_send(): FAILED to send packet, len = %d\n", byteCount));
return (NIL);
}
log_debug(("ether_send() - end -> ATOM_T\n\n"));
log_info(("ether_send(): sent packet, len = %d\n", bytesSent));
return (ATOM_T);
}
/**********************************************************************
* ether_setfilter(args) 175/76/1 filterbits
* check whether a packet has come. if does, notify iocb
**********************************************************************/
LispPTR ether_setfilter(LispPTR args[])
{
log_debug(("ether_setfilter() - ????\n\n"));
return (NIL);
}
/**********************************************************************
* check_ether() 175/77/0
* checks an incoming packet
**********************************************************************/
LispPTR check_ether()
{
int receivedBytes;
struct pollfd pfds[1];
if (ether_fd < 0) {
return (NIL);
}
log_debug(("check_ether() - begin\n"));
pfds[0].fd = ether_fd;
pfds[0].events = POLLIN;
pfds[0].revents = 0;
poll(pfds, 1, 0);
if (!(pfds[0].revents & POLLIN)) {
log_debug(("check_ether() - poll end -> NIL\n\n"));
return (NIL);
}
receivedBytes = recvPacket();
if (receivedBytes <= 0) {
log_debug(("check_ether() - data end -> NIL\n\n"));
return (NIL);
}
((INTSTAT *)NativeAligned4FromLAddr(*INTERRUPTSTATE_word))->ETHERInterrupt = 1;
Irq_Stk_Check = Irq_Stk_End = 0; /* ??? */
*PENDINGINTERRUPT68k = (ATOM_T);
log_debug(("check_ether() :: raised LISP interrupt\n"));
log_debug(("check_ether() :: INTERRUPTSTATE_word = 0x%08X\n",
*((int*)NativeAligned4FromLAddr(*INTERRUPTSTATE_word))));
log_info(("check_ether(): received packet, len = %d bytes\n", receivedBytes));
log_debug(("check_ether() - end -> ATOM_T\n\n"));
return (ATOM_T);
}
#endif /* MAIKO_ENABLE_NETHUB */

View File

@@ -43,7 +43,7 @@
/***********************************************************/
#define LStringToCString(Lisp, C, MaxLen, Len) \
do { \
{ \
OneDArray *arrayp; \
char *base; \
short *sbase; \
@@ -70,7 +70,7 @@
\
default: error("LStringToCString can not handle\n"); \
} \
} while (0)
}
/************************************************************************/
/* */
@@ -134,7 +134,7 @@ LispPTR call_c_fn(LispPTR *args) {
*errorflag = 0;
/* Initialize the argvector */
for (i = 0; i < Max_Arg; i++) { intarg[i] = 0; }
for (i = 0; i < Max_Arg; i++) { intarg[i] = 0; };
/* Test the function addr. If it is 0 we can not execute. */
if (fnaddr == 0) {
@@ -329,7 +329,7 @@ LispPTR call_c_fn(LispPTR *args) {
intarg[24], intarg[25], intarg[26], intarg[27], intarg[28], intarg[29],
intarg[30], intarg[31]);
return (CIntToLispInt(tmp));
} break;
}; break;
case TYPE_CHARACTERP: {
int tmp;
tmp = ((PFC)fnaddr)(intarg[0], intarg[1], intarg[2], intarg[3], intarg[4], intarg[5],
@@ -339,7 +339,7 @@ LispPTR call_c_fn(LispPTR *args) {
intarg[24], intarg[25], intarg[26], intarg[27], intarg[28], intarg[29],
intarg[30], intarg[31]);
return (S_CHARACTER | tmp);
} break;
}; break;
case TYPE_FLOATP:
fresult = ((PFF)fnaddr)(intarg[0], intarg[1], intarg[2], intarg[3], intarg[4], intarg[5],
intarg[6], intarg[7], intarg[8], intarg[9], intarg[10], intarg[11],
@@ -416,7 +416,7 @@ LispPTR smashing_c_fn(LispPTR *args) {
valueplace = (int *)NativeAligned4FromLAddr(args[1]);
/* Initialize the argvector */
for (i = 0; i < Max_Arg; i++) { intarg[i] = 0; }
for (i = 0; i < Max_Arg; i++) { intarg[i] = 0; };
/* Test the function addr. If it is 0 we can not execute. */
if (fnaddr == 0) {
@@ -597,7 +597,7 @@ LispPTR smashing_c_fn(LispPTR *args) {
intarg[30], intarg[31]);
*valueplace = tmp;
return (NIL);
} break;
}; break;
case TYPE_CHARACTERP:
return (S_CHARACTER |
(((PFC)fnaddr)(intarg[0], intarg[1], intarg[2], intarg[3], intarg[4], intarg[5],
@@ -867,7 +867,7 @@ int put_c_basebyte(LispPTR *args) {
GETBYTE((char *)(addr + (offset >> 3))) &= (~(1 << (0x7 & offset)));
} else {
GETBYTE((char *)(addr + (offset >> 3))) |= (1 << (0x7 & offset));
}
};
break;
case 1: /* byte */ GETBYTE((char *)(addr + offset)) = 0xFF & newval; break;
case 2: /* word */
@@ -917,7 +917,7 @@ int get_c_basebyte(LispPTR *args) {
return (ATOM_T);
} else {
return (NIL);
}
};
break;
case 1: /* byte */ return ((0xFF & (GETBYTE((char *)(addr + offset)))) | S_POSITIVE); break;
case 2: /* word */

View File

@@ -492,6 +492,7 @@ LispPTR native_newframe(int slot)
ppvar = (DLword *)newpfra2 - 1;
/* ppvar points to IVAR field in Basic frame */
return (*((LispPTR *)achain) = STK_HI_RET(GETWORD(ppvar) + fvaroffset));
;
default: error("Stack corrupted: bad value in name table");
} /* end switch */
} /* end if */

View File

@@ -128,7 +128,7 @@ LispPTR aref1(LispPTR array, int index) {
break;
case 38: retval = (*(((LispPTR *)NativeAligned4FromLAddr(base)) + index)); break;
default: error("Not Implemented in gc's aref1 (other types)");
}
};
return (retval);
}

View File

@@ -151,8 +151,8 @@ LispPTR map_code_pointers(LispPTR codeblock, short int casep) {
{
REC_GCLOOKUP(reclaimed, casep);
}
}
}
};
};
if ((len = oplength[opnum]) >
LONGEST_OPCODE) { /* len > biggest possible marks an unknown opcode */
char errtext[200];
@@ -164,7 +164,7 @@ LispPTR map_code_pointers(LispPTR codeblock, short int casep) {
oplength[opnum] = len = (((UFN *)UFNTable) + (opnum))->byte_num;
}
codeptr += len + 1;
}
};
}
/************************************************************************/
@@ -190,20 +190,20 @@ LispPTR remimplicitkeyhash(LispPTR item, LispPTR ik_hash_table) {
value = Getikvalue(base, index);
if (value != *Deleted_Implicit_Hash_Slot_word) {
if (value != NIL) {
if (item == getikkey(value)) { goto found; }
if (item == getikkey(value)) { goto found; };
} else
return (NIL);
}
};
reprobe = Reprobefn(bits, limits);
lp:
index = Fn16bits(index, reprobe) & limits;
value = Getikvalue(base, index);
if (value != *Deleted_Implicit_Hash_Slot_word) {
if (value != NIL) {
if (item == getikkey(value)) { goto found; }
if (item == getikkey(value)) { goto found; };
} else
return (NIL);
}
};
goto lp;
found:
/*
@@ -235,7 +235,7 @@ LispPTR reclaimcodeblock(LispPTR codebase) {
if ((*Closure_Cache_Enabled_word != NIL) &&
(remimplicitkeyhash(codebase, *Closure_Cache_word) != NIL)) {
return (T);
}
};
fnbase = (struct fnhead *)NativeAligned4FromLAddr(codebase);
REC_GCLOOKUP((POINTERMASK & fnbase->framename), DELREF);
if (fnbase->startpc != 0) map_code_pointers(codebase, DELREF);
@@ -260,7 +260,7 @@ int code_block_size(long unsigned int codeblock68k) {
while (T) {
switch (opnum = Get_BYTE(codeptr)) {
case ENDOFX: /* -X- */ return (codeptr - initcodeptr);
}
};
if ((len = oplength[opnum]) >
LONGEST_OPCODE) { /* len > biggest possible marks an unknown opcode */
char errtext[200];
@@ -272,5 +272,5 @@ int code_block_size(long unsigned int codeblock68k) {
oplength[opnum] = len = (((UFN *)UFNTable) + (opnum))->byte_num;
}
codeptr += len + 1;
}
};
}

View File

@@ -123,7 +123,7 @@ int integerlength(unsigned int n) {
n = (n >> 1);
} while (n != 1);
return (cnt);
}
};
}
/************* The above procedure is common !! **************************/
@@ -146,7 +146,7 @@ LispPTR findptrsbuffer(LispPTR ptr) {
return (LAddrFromNative(bptr));
else
bptr = (struct buf *)NativeAligned4FromLAddr(bptr->sysnext);
}
};
return (NIL);
}
@@ -229,8 +229,8 @@ LispPTR checkarrayblock(LispPTR base, LispPTR free, LispPTR onfreelist) {
rbase = (struct arrayblock *)NativeAligned4FromLAddr(*rover & POINTERMASK);
} while (((*rover = rbase->fwd) & POINTERMASK) != (*tmprover & POINTERMASK));
return (NIL);
}
}
};
};
return (NIL);
}
@@ -299,11 +299,11 @@ LispPTR linkblock(LispPTR base) {
tmpbase = (struct arrayblock *)NativeAligned4FromLAddr(fbbase->bkwd);
tmpbase->fwd = base;
fbbase->bkwd = base;
}
};
*freeblock = base;
checkarrayblock(base, T, T);
}
}
};
};
return (base);
}
@@ -357,10 +357,10 @@ LispPTR arrayblockmerger(LispPTR base, LispPTR nbase) {
narlens = minblocksize;
arlens += shaveback;
secondbite += shaveback;
}
};
linkblock(makefreearrayblock(nbase + 2 * secondbite, narlens));
narlens = 0;
}
};
return (linkblock(makefreearrayblock(base, arlens + narlens)));
}
@@ -457,7 +457,7 @@ LispPTR reclaimarrayblock(LispPTR ptr) {
((ARRAYBLOCKPASSWORD != base->password) || (base->inuse == NIL))) {
error("Bad array block reclaimed--continue with 'q' but save state ASAP. \n");
return (T);
}
};
#endif /* ARRAYCHECK */
switch (base->gctype) {
@@ -472,12 +472,12 @@ LispPTR reclaimarrayblock(LispPTR ptr) {
tmpptr += 2;
} while (tmpptr != btrailer);
break;
}
};
case CODEBLOCK_GCT:
reclaim_p = ((reclaimcodeblock(ptr) == NIL) ? T : NIL);
/* default: No Action */
}
};
if (reclaim_p == T)
mergeforward(mergebackward(makefreearrayblock(ptr - ARRAYBLOCKHEADERWORDS, base->arlen)));
return (T);

View File

@@ -32,21 +32,21 @@
/* GetLink gets a new entry from the GC collision table */
#define GetLink(var) \
do { \
{ \
GCENTRY linkoff; \
linkoff = GETGC(HTcoll); \
if (linkoff == 0) { \
if ((linkoff = GETGC((GCENTRY *)HTcoll + 1)) >= HTCOLLMAX) { \
disablegc1(NIL); \
return (NIL); \
} \
}; \
GETGC((GCENTRY *)HTcoll + 1) = linkoff + 2; \
(var) = (GCENTRY *)(HTcoll + linkoff); \
} else { \
GETGC(HTcoll) = GETGC((GCENTRY *)(HTcoll + linkoff + 1)); \
(var) = (GCENTRY *)(HTcoll + linkoff); \
} \
} while (0)
}
#ifdef BIGVM
#define HTCNTSHIFT 17 /* amount to shift to get hash table count */
@@ -81,7 +81,7 @@
* Thus STKREF case is not needed.
*/
#define NewEntry(entry, hiptr, casep, ptr) \
do { \
{ \
switch (casep) { \
case ADDREF: \
GETGC(entry) = (hiptr) | (2 << HTCNTSHIFT); /* set count = 2 */ \
@@ -94,14 +94,14 @@
default: error("GC error: new entry touches stack bit"); \
return NIL; /* NOT REACHED */ \
} \
} while (0)
}
/*
* RecNewEntry is called in the course of the reclamation.
* Does not maintain the allocation count.
*/
#define RecNewEntry(entry, hiptr, casep, ptr) \
do { \
{ \
switch (casep) { \
case ADDREF: \
GETGC(entry) = (hiptr) | (2 << HTCNTSHIFT); /* set count = 2 */ \
@@ -115,7 +115,7 @@
default: error("GC error: new entry when turning off stack bit"); \
return NIL; /* NOT REACHED */ \
} \
} while (0)
}
/* ModEntry is a macro to modify an old gc hash table entry.
entry is a pointer to the entry
@@ -131,7 +131,7 @@
* Thus STKREF and UNSTKREF cases are not needed.
*/
#define ModEntry(entry, contents, ptr, casep, remove) \
do { \
{ \
if (((contents) & HTCNTMASK) == HTCNTMASK) { /* overflow; return non-zero */ \
modify_big_reference_count(entry, casep, ptr); \
return NIL; \
@@ -161,14 +161,14 @@
} \
GETGC(entry) = contents; \
return NIL; \
} while (0)
}
/*
* RecModEntry is called in the course of the reclamation.
* Does not maintain the allocation count.
*/
#define RecModEntry(entry, contents, ptr, casep, remove) \
do { \
{ \
if (((contents) & HTCNTMASK) == HTCNTMASK) { /* overflow; return non-zero */ \
modify_big_reference_count(entry, casep, ptr); \
return NIL; \
@@ -200,7 +200,7 @@
if (((contents) & HTCNTSTKMASK) == (1 << HTCNTSHIFT)) goto remove; \
GETGC(entry) = contents; \
return NIL; \
} while (0)
}
/************************************************************************/
/* */
@@ -231,7 +231,7 @@ void enter_big_reference_count(LispPTR ptr) {
return;
} else
++oventry;
}
};
if (tmp == NIL) {
if (Evenp(LAddrFromNative(oventry + 1), DLWORDSPER_PAGE)) {

View File

@@ -219,7 +219,7 @@ LispPTR gcscanstack(void) {
#endif /* BIGVM */
Stkref(fn_head);
fnheader = (struct fnhead *)NativeAligned4FromLAddr(fn_head);
}
};
{
int pcou;
LispPTR *pvars;
@@ -230,8 +230,8 @@ LispPTR gcscanstack(void) {
if
Boundp(BIND_BITS(value)) Stkref(value);
++pvars;
} /* for */
} /* int pcou */
}; /* for */
}; /* int pcou */
{
UNSIGNED qtemp;
@@ -264,7 +264,7 @@ LispPTR gcscanstack(void) {
(((struct fnhead *)qtemp)->ntsize) * 2);
} else
Stkref(nametable);
} /* frameex->validnametable */
}; /* frameex->validnametable */
obasicframe = basicframe;
basicframe =
@@ -286,7 +286,7 @@ LispPTR gcscanstack(void) {
if
Boundp(BIND_BITS(value)) Stkref(value);
basicframe++;
} /* while */
}; /* while */
if (ntend != 0) {
obasicframe = basicframe;
@@ -303,7 +303,7 @@ LispPTR gcscanstack(void) {
qtemp = next;
ntend = 0;
goto scantemps;
}
};
obasicframe = basicframe;
basicframe = (Bframe *)next;
@@ -317,10 +317,10 @@ LispPTR gcscanstack(void) {
error(debugStr);
}
} /* LOCAL regs qtemp next */
} /* local regs fnheader frameex */
}; /* LOCAL regs qtemp next */
}; /* local regs fnheader frameex */
break;
}
};
case STK_GUARD: /* stack's tail ? */ {
if ((UNSIGNED)basicframe >= (UNSIGNED)scanend68K)
return (NIL);
@@ -336,9 +336,9 @@ LispPTR gcscanstack(void) {
(void *)basicframe, (void *)obasicframe);
error(debugStr);
}
}
};
break;
}
};
case STK_FSB: {
obasicframe = basicframe;
basicframe = (Bframe *)((DLword *)basicframe + basicframe->ivar);
@@ -353,25 +353,25 @@ LispPTR gcscanstack(void) {
}
break;
}
};
default: /* must be basic frame !! */
{
LispPTR bf_word;
while (STK_BF != BF_FLAGS(bf_word = *((LispPTR *)basicframe))) {
Stkref(PTR_BITS(bf_word));
basicframe++;
}
};
basicframe++;
}
};
/* **** NOTE THIS CODE DOES NOT COMPILE CORRECTLY ON THE SUN 4
{LispPTR bf_word;
while(STK_BF != BF_FLAGS(
bf_word = *((LispPTR *)basicframe++)))
{ Stkref(PTR_BITS(bf_word));
}
}
};
};
**** */
} /* switch */
} /* while(1) */
}; /* switch */
}; /* while(1) */
}

View File

@@ -37,16 +37,14 @@
#include "lsptypes.h" // for dtd, GetDTD, TYPE_LISTP
#define Increment_Allocation_Count(n) \
do { \
if (*Reclaim_cnt_word != NIL) { \
if (*Reclaim_cnt_word > (n)) \
(*Reclaim_cnt_word) -= (n); \
else { \
*Reclaim_cnt_word = NIL; \
doreclaim(); \
} \
} \
} while (0)
if (*Reclaim_cnt_word != NIL) { \
if (*Reclaim_cnt_word > (n)) \
(*Reclaim_cnt_word) -= (n); \
else { \
*Reclaim_cnt_word = NIL; \
doreclaim(); \
} \
}
DLword gc_handleoverflow(DLword arg) {
struct htoverflow *cell;
@@ -60,14 +58,14 @@ DLword gc_handleoverflow(DLword arg) {
cell->ptr = 0;
cell->pcase = 0;
++cell; /* (\ADDBASE CELL WORDSPERCELL) */
}
};
ptr = (struct dtd *)GetDTD(TYPE_LISTP);
/* same as "extern struct dtd *ListpDTD" */
if ((cellcnt = ptr->dtd_cnt0) > 1024) {
Increment_Allocation_Count(cellcnt);
ptr->dtd_oldcnt += cellcnt;
ptr->dtd_cnt0 = 0;
}
};
return (arg);
}
@@ -84,7 +82,7 @@ DLword gcmaptable(DLword arg) {
cell->ptr = 0;
cell->pcase = 0;
++cell; /* (\ADDBASE CELL WORDSPERCELL) */
}
};
for (typnum = 1; typnum <= *MaxTypeNumber_word; ++typnum)
/* applied alltype */
{
@@ -93,7 +91,7 @@ DLword gcmaptable(DLword arg) {
ptr->dtd_oldcnt += cellcnt;
ptr->dtd_cnt0 = 0;
Increment_Allocation_Count(cellcnt);
}
}
};
};
return (arg);
}

View File

@@ -149,6 +149,6 @@ void disablegc1(int noerror) {
if ((noerror == NIL) && (*GcDisabled_word == NIL)) {
gcinterruptstate->gcdisabled = T;
*PENDINGINTERRUPT_word = ATOM_T;
}
};
*GcDisabled_word = ATOM_T;
}

View File

@@ -87,18 +87,16 @@
#define TODO_LIMIT 1000
#define ADD_TO_DO(ptr, offset) \
do { \
if (do_count < TODO_LIMIT) { \
if ((ptr) & 0xF0000000) error("illegal ptr in addtodo"); \
to_do[do_count] = (ptr); \
to_do_offset[do_count] = offset; \
todo_uses++; \
/*REC_GCLOOKUP((ptr), ADDREF);*/ \
do_count++; \
} else { /* error("GC missing some to-do's"); */ \
todo_misses++; \
} \
} while (0)
if (do_count < TODO_LIMIT) { \
if ((ptr) & 0xF0000000) error("illegal ptr in addtodo"); \
to_do[do_count] = (ptr); \
to_do_offset[do_count] = offset; \
todo_uses++; \
/*REC_GCLOOKUP((ptr), ADDREF);*/ \
do_count++; \
} else { /* error("GC missing some to-do's"); */ \
todo_misses++; \
}
unsigned todo_uses = 0;
unsigned todo_misses = 0;
@@ -158,7 +156,7 @@ lp:
ptr = (ConsCell *)NativeAligned4FromLAddr(tmpcell);
tmpptr = tmpcell;
code = ptr->cdr_code;
}
};
if (index != -1) /* car part */
index = -1;
else {
@@ -168,7 +166,7 @@ lp:
ptr->cdr_code = code;
donext = tmpptr;
goto doval;
}
};
}
REC_GCLOOKUPV(cdr(tmpptr), DELREF, val);
if (code <= CDR_MAXINDIRECT) {
@@ -178,10 +176,10 @@ lp:
tmpcell = POINTER_PAGEBASE(tmpptr) + ((code - CDR_INDIRECT) << 1);
#endif /* NEWCDRCODING */
freelistcell(tmpcell);
}
};
freelistcell(tmpptr);
goto doval;
}
};
case TYPE_ARRAYBLOCK:
if ((index == -1) && reclaimarrayblock(tmpptr))
goto trynext;
@@ -210,7 +208,7 @@ lp:
else
break;
default:;
}
};
normal:
typdtd = (struct dtd *)GetDTD(typ);
ptrfield = typdtd->dtd_ptrs;
@@ -219,7 +217,7 @@ normal:
ptrfield = cdr(ptrfield);
while ((car(ptrfield) & 0x0ffff) != index) ptrfield = cdr(ptrfield);
index = -1;
}
};
while (ptrfield != NIL) {
carfield = car(ptrfield);
ptrfield = cdr(ptrfield);
@@ -235,7 +233,7 @@ normal:
goto doval;
} else
goto addtofreelist;
}
};
#else
if (val != NIL) {
if (ptrfield != NIL) {
@@ -251,9 +249,9 @@ normal:
}
} else
goto addtofreelist;
}
};
#endif /* NEWCDRCODING */
}
};
addtofreelist:
field = (LispPTR *)NativeAligned4FromLAddr(tmpptr);
*field = typdtd->dtd_free;
@@ -275,7 +273,7 @@ doval:
/* GCLOOKUP(0x8000, ADDREF,tmpptr); */
val = NIL;
goto lp;
}
};
/***************************************************************/
/* */
@@ -291,7 +289,7 @@ trynext:
donext = (LispPTR)ptr->car_field;
index = ptr->cdr_code;
goto lp;
}
};
#ifdef NEWCDRCODING
if (do_count) /* If there are other cells to collect */
{
@@ -356,5 +354,5 @@ void freelistcell(LispPTR cell) {
if ((++pbase->count > 32) && (pbase->next_page == CONSPAGE_LAST)) {
pbase->next_page = ListpDTD->dtd_nextpage;
ListpDTD->dtd_nextpage = POINTER_PAGE(cell);
}
};
}

View File

@@ -36,12 +36,12 @@
#include "stack.h" // for FX, frameex1, Bframe, CHECK_FX, StackWord
#define MAKE_FXCOPY(fx68k) \
do { \
{ \
BEFORE_CONTEXTSW; \
if (((fx68k) = (FX *)make_FXcopy(fx68k)) == 0) { return (1); /* Whole space exhausted */ } \
AFTER_CONTEXTSW; \
CHECK_FX(fx68k); \
} while (0)
}
static FX *make_FXcopy(FX *fx68k) {
int size;
int nametbl_on_stk = NIL;

View File

@@ -46,7 +46,7 @@
#include "mkcelldefs.h" // for N_OP_createcell
#include "testtooldefs.h" // for MakeAtom68k, MAKEATOM
#if defined(MAIKO_ENABLE_ETHERNET) || defined(MAIKO_ENABLE_NETHUB)
#ifdef MAIKO_ENABLE_ETHERNET
#include "etherdefs.h"
#endif
@@ -117,9 +117,9 @@ void init_ifpage(int sysout_size) {
Initialize IFPAGE
*/
InterfacePage->machinetype = KATANA; /* 3 is katana */
#if defined(MAIKO_ENABLE_ETHERNET) || defined(MAIKO_ENABLE_NETHUB)
#ifdef MAIKO_ENABLE_ETHERNET
init_ifpage_ether(); /* store ethernet ID in IF page */
#endif /* MAIKO_ENABLE_ETHERNET or MAIKO_ENABLE_NETHUB */
#endif /* MAIKO_ENABLE_ETHERNET */
/*InterfacePage->dl24bitaddressable = (sysout_size == 32? 0xffff : 0);*/
InterfacePage->dl24bitaddressable = (sysout_size == 8 ? 0 : 0xffff);
new_lastvmem = (sysout_size * PAGES_IN_MBYTE) - 1;
@@ -457,7 +457,7 @@ void init_for_bltchar(void) {
if (!for_makeinit) {
BLTCHAR_index = get_package_atom("\\MAIKO.PUNTBLTCHAR", 18, IL, 9, NIL);
TEDIT_BLTCHAR_index = get_package_atom("\\TEDIT.BLTCHAR", 14, IL, 9, NIL);
}
};
TOPWDS68k = MakeAtom68k("\\TOPWDS");
#ifdef COLOR

View File

@@ -61,9 +61,9 @@ void Mouse_hndlr(void); /* Fields mouse events from driver */
#include "osmsgdefs.h"
#include "xwinmandefs.h"
#if defined(MAIKO_ENABLE_ETHERNET) || defined(MAIKO_ENABLE_NETHUB)
#ifdef MAIKO_ENABLE_ETHERNET
#include "etherdefs.h"
#endif /* MAIKO_ENABLE_ETHERNET or MAIKO_ENABLE_NETHUB */
#endif /* MAIKO_ENABLE_ETHERNET */
#include "dbprint.h"
#if (defined(DOS) || defined(XWINDOW))
@@ -78,28 +78,28 @@ extern IOPAGE *IOPage68K;
/* EmMouseX68K are already swapped, no need for GETWORD */
#define MouseMove(x, y) \
do { \
{ \
*((DLword *)EmMouseX68K) = x; \
*((DLword *)EmMouseY68K) = y; \
} while (0)
}
#ifdef NEVER
#ifndef BYTESWAP
#define PUTBASEBIT68K(base68k, offset, bitvalue) \
do { \
{ \
if (bitvalue) \
*((DLword *)(base68k) + (((u_short)(offset)) >> 4)) |= \
1 << (15 - ((u_short)(offset)) % BITSPER_DLWORD); \
else \
*((DLword *)(base68k) + (((u_short)(offset)) >> 4)) &= \
~(1 << (15 - ((u_short)(offset)) % BITSPER_DLWORD)); \
} while (0)
}
#else
/* convert to real 68 k address, then do arithmetic, and convert
back to i386 address pointer */
#define PUTBASEBIT68K(base68k, offset, bitvalue) \
do { \
{ \
int real68kbase; \
real68kbase = 2 ^ ((int)(base68k)); \
if (bitvalue) \
@@ -108,7 +108,7 @@ extern IOPAGE *IOPage68K;
else \
GETWORD((DLword *)(real68kbase) + (((u_short)(offset)) >> 4)) &= \
~(1 << (15 - ((u_short)(offset)) % BITSPER_DLWORD)); \
} while (0)
}
#endif
#endif /* NEVER */
@@ -124,9 +124,9 @@ extern volatile sig_atomic_t XNeedSignal;
extern int LogFileFd;
#if defined(MAIKO_ENABLE_ETHERNET) || defined(MAIKO_ENABLE_NETHUB)
#ifdef MAIKO_ENABLE_ETHERNET
extern int ether_fd;
#endif /* MAIKO_ENABLE_ETHERNET or MAIKO_ENABLE_NETHUB */
#endif /* MAIKO_ENABLE_ETHERNET */
extern DLword *DisplayRegion68k;
@@ -263,10 +263,6 @@ void process_io_events()
}
#endif /* MAIKO_ENABLE_ETHERNET */
#ifdef MAIKO_ENABLE_NETHUB
check_ether();
#endif /* MAIKO_ENABLE_NETHUB */
#ifdef RS232
if (RS232C_Fd >= 0 && (FD_ISSET(RS232C_Fd, &rfds) || (RS232C_remain_data && rs232c_lisp_is_ready())))
rs232c_read();
@@ -340,22 +336,22 @@ typedef struct {
} CURSOR;
#define CursorClippingX(posx, width) \
do { \
{ \
if (displaywidth < ((posx) + HARD_CURSORWIDTH)) { \
LastCursorClippingX = (width) = displaywidth - (posx); \
} else { \
LastCursorClippingX = (width) = HARD_CURSORWIDTH; \
} \
} while (0)
}
#define CursorClippingY(posy, height) \
do { \
{ \
if (displayheight < ((posy) + HARD_CURSORHEIGHT)) { \
LastCursorClippingY = (height) = displayheight - (posy); \
} else { \
LastCursorClippingY = (height) = HARD_CURSORHEIGHT; \
} \
} while (0)
}
extern int displaywidth, displayheight;
extern int DisplayInitialized;
@@ -452,7 +448,7 @@ void copy_cursor(int newx, int newy)
dx = newx;
w = LastCursorClippingX;
h = LastCursorClippingY;
;
srcbpl = HARD_CURSORWIDTH;
dstbpl = displaywidth;
op = 2; /* OR-in */

View File

@@ -174,7 +174,7 @@ int main(int argc, char *argv[])
} else {
perror("lde: This Display Model does not supported\n");
exit(-1);
} /* endif( my_screen... */
}; /* endif( my_screen... */
close(FrameBufferFd);

View File

@@ -302,7 +302,7 @@ int sysout_loader(const char *sysout_file_name, int sys_size) {
perror("sysout_loader: can't seek sysout file");
free(fptovp);
exit(-1);
}
};
lispworld_offset = GETFPTOVP(fptovp, i) * BYTESPER_PAGE;
if (read(sysout, lispworld_scratch + lispworld_offset, BYTESPER_PAGE) == -1) {
printf("sysout_loader: can't read sysout file at %d\n", i);
@@ -314,11 +314,11 @@ int sysout_loader(const char *sysout_file_name, int sys_size) {
}
free(fptovp);
exit(-1);
}
};
#ifdef BYTESWAP
word_swap_page((DLword *)(lispworld_scratch + lispworld_offset), 128);
#endif
}
};
}
free(fptovp);
DBPRINT(("sysout file is read completely.\n"));

View File

@@ -56,7 +56,7 @@ unsigned int BMask_tbl[] = {0xf, 7, 3, 1};
therefore, width indicates the rest bits in source bitmap */
#define LineBLT8(srcWptr, offset, width, dstLptr, op1, op2) \
do { \
{ \
DLword *srcw; \
u_int temp1; \
for (srcw = (srcWptr) + (offset) / BITSPERDLWORD; ((width)-BITSPERNIBBLE) >= 0; \
@@ -116,7 +116,7 @@ unsigned int BMask_tbl[] = {0xf, 7, 3, 1};
break; \
default:; /* error */ \
} /* switch end */ \
} while (0) /* MACRO END */
} /* MACRO END */
/************************************************************************/
/* */

View File

@@ -178,7 +178,7 @@ LispPTR cgfour_change_screen_mode(LispPTR which_screen)
break;
}
default: { error("cgfour_change_screen_mode:Unknown mode:"); }
}
};
#ifndef DISPLAYBUFFER
pr_close(ColorFb);

View File

@@ -335,7 +335,7 @@ SCAN:
while (STKWORD(scanptr68k)->flags != STK_BF) {
S_WARN(STKWORD(scanptr68k)->flags == STK_NOTFLG, "NOTFLG not on", (void *)scanptr68k);
scanptr68k = (StackWord *)(((DLword *)scanptr68k) + DLWORDSPER_CELL);
}
};
#ifdef STACKCHECK
if (((Bframe *)scanptr68k)->residual) {
@@ -605,7 +605,7 @@ void stack_check(StackWord *start68k) {
WARN("StackCheck:!=STK_NOTFLG", printf("content:0x%x\n", GETWORD((DLword *)scanptr68k)));
}
scanptr68k = (StackWord *)((DLword *)scanptr68k + DLWORDSPER_CELL);
} /* while end */
} /* while end */;
CHECK_BF((Bframe *)scanptr68k);
if (((Bframe *)scanptr68k)->residual) {
if ((DLword *)scanptr68k != top_ivar)
@@ -774,7 +774,7 @@ void walk_stack(StackWord *start68k) {
GETWORD((DLword *)scanptr68k));
}
scanptr68k = (StackWord *)((DLword *)scanptr68k + DLWORDSPER_CELL);
} /* while end */
} /* while end */;
/* CHECK_BF(scanptr68k); */
{
Bframe *bf = (Bframe *)scanptr68k;
@@ -900,7 +900,7 @@ int quick_stack_check(void) {
return(1);
}
scanptr68k = (StackWord *)((DLword *)scanptr68k + DLWORDSPER_CELL);
} /* while end */
} /* while end */;
CHECK_BF((Bframe *)scanptr68k);
if (((Bframe *)scanptr68k)->residual) {
if ((DLword *)scanptr68k != top_ivar)

View File

@@ -65,21 +65,21 @@ static const char il_string[] = "INTERLISP";
#define CLASSP(obj) (LC_TYPEP((obj), atom_class))
#define INSTANCE_OR_PUNT(obj, fn, argnum) \
do { \
{ \
if (!LC_TYPEP((obj), atom_instance)) RETCALL(fn, argnum); \
} while (0)
}
#define INSTANCE_CLASS_OR_PUNT(obj, fn, argnum) \
do { \
{ \
LispPTR tmp = DTD_FROM_LADDR(obj); \
if (tmp != atom_instance && tmp != atom_class) RETCALL(fn, argnum); \
} while (0)
}
#define LC_INIT \
if (atom_instance == 0) LCinit()
#define GET_IV_INDEX(objptr, iv, dest, otherwise) \
do { \
{ \
struct LCIVCacheEntry *ce; \
LispPTR iNames = (objptr)->iNames; \
\
@@ -105,7 +105,7 @@ static const char il_string[] = "INTERLISP";
} \
} \
} \
} while (0)
}
struct LCClass { /* class datatype */
LispPTR metaClass, ivNames, ivDescrs, classUnitRec, localIVs, cvNames, cvDescrs, className,
@@ -206,7 +206,7 @@ LispPTR LCFetchMethodOrHelp(LispPTR object, LispPTR selector) {
ce->selector = selector;
return (ce->method_fn = ((LispPTR *)NativeAligned4FromLAddr(classptr->methods))[i - 1]);
}
}
};
next_class:
if ((cur_class = car(supers)) == NIL_PTR) break;
@@ -255,7 +255,7 @@ LispPTR LCFetchMethod(LispPTR class, LispPTR selector) {
ce->selector = selector;
return (ce->method_fn = ((LispPTR *)NativeAligned4FromLAddr(classptr->methods))[i - 1]);
}
}
};
next_class:
if ((cur_class = car(supers)) == NIL_PTR) break;

View File

@@ -50,7 +50,7 @@ LispPTR N_OP_putbitsnfd(LispPTR base, LispPTR data, int word_offset,
if (beta > 0xFF) { error("bad beta argument to PUTBITS"); }
#endif
if ((SEGMASK & data) != S_POSITIVE) { ERROR_EXIT(data); }
if ((SEGMASK & data) != S_POSITIVE) { ERROR_EXIT(data); };
pword = NativeAligned2FromLAddr(base + word_offset);
field_size = 0xF & beta;

View File

@@ -73,19 +73,19 @@ LispPTR fmemb(LispPTR item, LispPTR list) {
/**********************************************************************/
#define SAVE_ERROR_EXIT2(topcstk, tos) \
do { \
{ \
Scratch_CSTK = topcstk; \
ERROR_EXIT(tos); \
} while (0)
}
#define S_N_CHECKANDCADR2(sour, dest, tos, tcstk) \
do { \
{ \
LispPTR parm = sour; \
if (GetTypeNumber(parm) != TYPE_LISTP) { \
SAVE_ERROR_EXIT2(tcstk, tos); \
} else \
(dest) = cadr(parm); \
} while (0)
}
LispPTR N_OP_listget(LispPTR plist, LispPTR tos) {
struct cadr_cell cadrobj;

View File

@@ -285,22 +285,6 @@ const char *helpstring =
-help Print this message\n";
#endif /* DOS */
#if defined(MAIKO_ENABLE_NETHUB)
const char *nethubHelpstring =
"\
-nh-host dodo-host Hostname for Dodo Nethub (no networking if missing)\n\
-nh-port port-number Port for Dodo Nethub (optional, default: 3333)\n\
-nh-mac XX-XX-XX-XX-XX-XX Machine-ID for Maiko-VM (optional, default: CA-FF-EE-12-34-56) \n\
-nh-loglevel level Loglevel for Dodo networking (0..2, optional, default: 0)\n\
";
#else
const char *nethubHelpstring = "";
#endif
#if defined(MAIKO_EMULATE_TIMER_INTERRUPTS) || defined(MAIKO_EMULATE_ASYNC_INTERRUPTS)
extern int insnsCountdownForTimerAsyncEmulation;
#endif
/************************************************************************/
/* */
/* M A I N E N T R Y P O I N T */
@@ -320,7 +304,7 @@ int main(int argc, char *argv[])
perror("Name of executable not found.");
} else if (dld_init(dld_find_executable(argv[0])) != 0) {
dld_perror("Can't init DLD.");
}
};
#endif /* MAIKO_ENABLE_FOREIGN_FUNCTION_INTERFACE */
#ifdef XWINDOW
@@ -349,7 +333,7 @@ int main(int argc, char *argv[])
}
if (argv[i] && ((strcmp(argv[i], "-help") == 0) || (strcmp(argv[i], "-HELP") == 0))) {
fprintf(stderr, "%s%s", helpstring, nethubHelpstring);
fprintf(stderr, "%s", helpstring);
exit(0);
}
@@ -372,7 +356,7 @@ int main(int argc, char *argv[])
}
if (access(sysout_name, R_OK)) {
perror("Couldn't find a sysout to run");
fprintf(stderr, "%s%s", helpstring, nethubHelpstring);
fprintf(stderr, "%s", helpstring);
exit(1);
}
/* OK, sysout name is now in sysout_name, and i is moved past a supplied name */
@@ -470,80 +454,6 @@ int main(int argc, char *argv[])
#endif /* MAIKO_ENABLE_ETHERNET */
}
#ifdef MAIKO_ENABLE_NETHUB
else if (!strcmp(argv[i], "-nh-host")) {
if (argc > ++i) {
setNethubHost(argv[i]);
} else {
fprintf(stderr, "Missing argument after -nh-host\n");
exit(1);
}
}
else if (!strcmp(argv[i], "-nh-port")) {
if (argc > ++i) {
errno = 0;
tmpint = strtol(argv[i], (char **)NULL, 10);
if (errno == 0 && tmpint > 0) {
setNethubPort(tmpint);
} else {
fprintf(stderr, "Bad value for -nh-port\n");
exit(1);
}
} else {
fprintf(stderr, "Missing argument after -nh-port\n");
exit(1);
}
}
else if (!strcmp(argv[i], "-nh-mac")) {
if (argc > ++i) {
int b0, b1, b2, b3, b4, b5;
if (sscanf(argv[i], "%x-%x-%x-%x-%x-%x", &b0, &b1, &b2, &b3, &b4, &b5) == 6) {
setNethubMac(b0, b1, b2, b3, b4, b5);
} else {
fprintf(stderr, "Invalid argument for -nh-mac\n");
exit(1);
}
} else {
fprintf(stderr, "Missing argument after -nh-mac\n");
exit(1);
}
}
else if (!strcmp(argv[i], "-nh-loglevel")) {
if (argc > ++i) {
errno = 0;
tmpint = strtol(argv[i], (char **)NULL, 10);
if (errno == 0 && tmpint >= 0) {
setNethubLogLevel(tmpint);
} else {
fprintf(stderr, "Bad value for -nh-loglevel\n");
exit(1);
}
} else {
fprintf(stderr, "Missing argument after -nh-loglevel\n");
exit(1);
}
}
#endif /* MAIKO_ENABLE_NETHUB */
#if defined(MAIKO_EMULATE_TIMER_INTERRUPTS) || defined(MAIKO_EMULATE_ASYNC_INTERRUPTS)
else if (!strcmp(argv[i], "-intr-emu-insns")) {
if (argc > ++i) {
errno = 0;
tmpint = strtol(argv[i], (char **)NULL, 10);
if (errno == 0 && tmpint > 1000) {
insnsCountdownForTimerAsyncEmulation = tmpint;
} else {
fprintf(stderr, "Bad value for -intr-emu-insns (integer > 1000)\n");
exit(1);
}
} else {
fprintf(stderr, "Missing argument after -intr-emu-insns\n");
exit(1);
}
}
#endif
/* diagnostic flag for big vmem write() calls */
else if (!strcmp(argv[i], "-xpages")) {
if (argc > ++i) {
@@ -581,10 +491,6 @@ int main(int argc, char *argv[])
init_ether(); /* modified by kiuchi Nov. 4 */
#endif /* MAIKO_ENABLE_ETHERNET */
#ifdef MAIKO_ENABLE_NETHUB
connectToHub();
#endif
#ifdef DOS
init_host_filesystem();
#else

View File

@@ -77,7 +77,7 @@ LispPTR N_OP_misc7(LispPTR arg1, LispPTR arg2, LispPTR arg3, LispPTR arg4, LispP
case OP_ERASE: GETWORDBASEWORD(base, offset) = bmdata & ~bmmask; break;
case OP_READ: break;
default: GETWORDBASEWORD(base, offset) = bmdata | bmmask;
}
};
#ifdef XWINDOW

Some files were not shown because too many files have changed in this diff Show More