1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-03-16 06:47:22 +00:00

Compare commits

..

49 Commits

Author SHA1 Message Date
Nick Briggs
987cf4c7c6 Correct error for missing byteswap macros in tosfns.h EVAL implementation (#407)
Commit c46fcce307 fixed a warning for
incompatible pointers to nnewframe() but did not consider that the
order of the DLwords is swapped depending on the endianness of the
system it is running on.  Add the necessary GETBASEWORD() macros to
access the items when constructing the pointer.
2021-11-06 18:36:25 -07:00
Nick Briggs
c46fcce307 Fix "warning: incompatible pointer types" in EVAL implementation (#406)
nnewframe() as called from the EVAL implementation expects to be passed
the address of an array of two DLwords.  Do that, and compose the 32-bit
result correctly rather than passing the address of a (32-bit) LispPTR
and then having to swapx() that result to get the expected value.
2021-11-04 20:18:27 -07:00
Nick Briggs
de5ea2110f Correct integer type warnings (#405)
* Correct warning: cast to smaller integer type -- X_init/lispbitmap

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

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

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

* Remove useless validity check of LASTVMEMFILEPAGE_word pointer

* Convert pointer arithmetic type in drawline from int to ptrdiff_t

* Add NOTE warning about a 32-bit vs 64-bit issue affecting currently unused GET_NATIVE_ADDR_FROM_LISP_PTR
2021-11-04 09:08:55 -07:00
Nick Briggs
6c241f1eaa Make opcode_table (names of opcodes) visible as useful debug aid. 2021-10-29 10:02:47 -07:00
Nick Briggs
19688bc314 Drop setuid privilege correctly. (#401) 2021-10-29 09:52:51 -07:00
Nick Briggs
c39b751f42 Rework make_atom() to allow removal of parse_number() (#404)
No calls to make_atom() depend on the ability to parse the atom's
pname as a number.  Additionally, the parse_number() implementation
used here was non-functional.

We remove parse_number() and adjust the parameter list of make_atom()
to remove the non_numericp flag.
2021-10-29 09:51:32 -07:00
Nick Briggs
75c668f1cd The pointers Atomspace, Spospspace, Snegspace, Arrayspace can be removed (#402)
These pointers are neither initialized nor referenced anywhere in the code.
2021-10-10 16:55:33 -07:00
Nick Briggs
a25368714f Use SHELL rather than /bin/csh when forking shells. Issue Interlisp/medley#384 (#400)
As long as $(SHELL) names an executable that appears in /etc/shells (as determined
by the getusershell() function) use that.  It used to always use /bin/csh, but some
modern distros do not ship with csh installed.  Using the user's preferred shell
seems like a better choice, while allowing the choice from /etc/shells gives some
additional flexibility.
2021-10-08 17:58:29 -07:00
Nick Briggs
3cdbccd0c7 Implement -noscroll option to ldex to disable X window scroll bars (#399)
Adds a -noscroll option, parsed as an X option, also accessible via
resource ldex*noscroll, which avoids adding the bottom and side scroll
bars and the bit-gravity control buttons to the main Lisp display window.

Unless the geometry given for the X window in which the Lisp screen is
displayed is at least as big as the Lisp screen part of the Lisp screen
(bottom, right) will not be visible.

On macOS with XQuartz, maximizing the X window will bring it to
the size of the Lisp screen (or the size of the display, whichever is smaller)
2021-09-30 10:44:37 -07:00
Nick Briggs
4d2bf13347 Add description for ethernet related flags to compile-flags 2021-09-25 15:01:21 -07:00
Nick Briggs
f7e40d1ed5 Use symbolic constants for COLOR related subrs rather than numbers
cases for subrs UNCOLORIZE-BITMAP, COLORIZE-BITMAP, COLOR-8BPPDRAWLINE (which
are not compiled into current code) can have the numbers replaced by the
symbolic constants that are now defined in subrs.h
2021-09-19 14:19:42 -07:00
Nick Briggs
9bb5a4298c Use symbolic constant for subr CAUSE-INTERRUPT switch/case rather than number (0222) 2021-09-19 14:12:47 -07:00
Nick Briggs
533c935e72 Fix various bugprone warnings (#397)
* Fix some warnings in main.c

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

* Fix some warnings in array operations

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

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

* Resolve type mismatches for version numbers and propp flag

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

* Resolve type mismatches for version numbers and strlen result type

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

* Resolve type mismatches for strlen result type

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

* Resolve type error

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

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

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

To use this experimental SUBR in a sysout you should:

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

then you can define functions that use that SUBR:

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

* Update to use subrs.h newly generated from LLSUBRS

The subrs.h include file is generated by WRITECALLSUBRS based on the \INITSUBRS
list.  This update provides for the new YIELD subr in the generated file,
and makes some necessary updates to the C code implementations for some subr
names which have changed.
2021-09-15 10:30:04 -07:00
Nick Briggs
a70b18d444 Avoid use of sscanf() for parsing simple integer values (#396)
There is no reason to use sscanf() rather than strtol()/strtoul()
for parsing simple integer values from a string.
Resolves a number of cert-str34-c warnings from clang-tidy.
2021-09-12 14:24:05 -07:00
Larry Masinter
c7adb3c4ba Add scripts to aid in constructing github releases of the maiko artifacts (#395)
Until these are superceded by github actions, if the github CLI tool "gh"
is installed, a github release of the maiko code can be created by running
   ./start-release
from the maiko/bin directory, and then running
   ./release-one
for each combination of OS/architecture that should be included in the
release.

The scripts assume that the maiko code is checked out in a directory
named "maiko" (and may produce unexpected results if run from somewhere else)

Co-authored-by: Nick Briggs <nicholas.h.briggs@gmail.com>
2021-09-10 13:33:54 -07:00
Nick Briggs
b1545e4ccc fix 'signed char' to 'int' conversion [cert-str34-c]
Fortunately here we don't need to convert to unsigned char then int,
we can do the only comparisons we need staying in the char domain.
2021-09-09 18:01:02 -07:00
Nick Briggs
4f79f55c20 Replace uses of atoi() with strtol() or stroul() as appropriate (#394)
As a side-effect of this change, we also resolve a a problem with
signed file version numbers, so that instead of version 2147483647
wrapping to -2147483648 we can go as far as 4294967296 before we
have issues.  Various sprintf() formats get changed from %d to %u.
The DOS version code is left behind as int versions.
2021-09-08 09:58:01 -07:00
Nick Briggs
85c4ebf0ac Merge branch 'master' of github.com:Interlisp/maiko 2021-09-03 16:47:02 -07:00
Nick Briggs
7284e19b32 Suppress clang-tidy warnings for uses of bzero()
The only uses of bzero() in the maiko sources come about because it is used in the macOS
definition of the FD_ZERO() macro in sys/select.h.  Suppress the warning by including
   -clang-analyzer-security.insecureAPI.bzero
in the clang-tidy list of checks.  This may well have been replaced by a memset()
call in more up-to-date macOS releases.
2021-09-03 16:39:29 -07:00
Nick Briggs
0de1b1438b Left shift is undefined if left argument is negative (#454) (#393) 2021-09-03 12:46:21 -07:00
Nick Briggs
740f012254 Eliminate URaid access to uninitialized pointer when saving post-crash VM image
Old code attempted to save the display region through an uninitialized pointer
which occurs nowhere else in the system.  Removed the save.
2021-09-02 15:14:32 -07:00
Nick Briggs
377a6f3f47 Rewrite keyboard and async I/O handling to improve performance and reduce dependency on async I/O signals (#392)
* Rewrite keyboard and async I/O handling to improve performance and reduce dependency on async I/O signals

Replaces the SIGIO handler, which used to process X events in the interrupt context, with
a stub routine that sets a flag to signal processing is required.
Actual event processing is moved to the main dispatch loop where Lisp periodic interrupts
are handled.

Removes the X connection file descriptor from the set of fds contributing to SIGIO events
and moves the processing of X events to where the Lisp periodic interrupt is handled in
the main dispatch loop.  This code is already guarded by a check for XPending() so can
be called regardless of whether any file descriptors are known to be ready.

Actual processing of async I/O events and X events are handled by procedures
process_io_events() and process_Xevents() respectively.  For the most part these are
a renaming of getsignaldata() and getXsignaldata().

The Lisp periodic timer (VTALRM) was set to operate with a 25000 us period (40 Hz),
but on modern hardware it is possible to run this timer with a period of 10000 us (100 Hz)

Incidentally, a bug was noted (and fixed) in the X event handling code for motion events:
Mouse motion without any keyboard activity should not add an entry to the keyboard event
ring buffer as these events do not represent a key state change.
Since the ring buffer is of limited size, when it is filled new events are ignored
until the buffered events are processed.  This resulted in the loss of a key/mouse button
transition (up or down) if the mouse was moved about "too much" between keyboard events.

A few incidental cleanups were also made:
  - KBDEventFlg initialization fixed (wrong semantic type)
  - Event_Req renamed to IO_Signalled (more appropriate name)
  - int_io_open() sets up process (self) to handle SIGIO generated by O_ASYNC operations
  - LOCK_X_EVENTS turned off since X library calls can no longer happen in an interrupt context

* Use of O_ASYNC must depend on the symbol being defined (looking at you, Cygwin)

* Add SA_RESTART flag to sigaction for SIGVTALRM periodic interrupt

* LOCK_X_UPDATE is no longer needed and should not be defined by default for Solaris in version.h
2021-09-02 12:42:51 -07:00
Nick Briggs
c07618f55c Do not attempt to use ether_fd as valid fd if it is -1. Closes medley #450 2021-09-02 10:35:10 -07:00
Nick Briggs
dbbb59b30b Add clang-tidy to CMakeLists.txt -- run it at compile time if it is found at cmake configuration time 2021-08-29 13:39:07 -07:00
Nick Briggs
e957e331c4 Lock X updates for all systems and lock around X cleanup at exit (#391)
* Lock X updates for all systems and lock around X cleanup at exit

All systems which could generate I/O interrupts on the X file descriptor need
to have locking enabled, or there is a high probability that the X library
will deadlock. This requirement may be removed in the future with restructuring
of the way that the interrupt driven I/O is handled.

Ensure that the appropriate XLOCK/XUNLOCK is done around the X window
closing code.

* Also lock X updates when building with CMake.
2021-08-26 16:29:10 -07:00
Nick Briggs
934a86fbb5 Remove Create_N_Set_Cell() which is unused since native code is not supported. 2021-08-24 12:05:17 -07:00
Nick Briggs
28ea238807 Check for flags in argv[1..n] not argv[0..n] 2021-08-23 21:15:23 -07:00
Nick Briggs
81c36341ef Fully initialize XImage ScreenBitmap with XInitImage() before using it. 2021-08-22 18:23:41 -07:00
Nick Briggs
6cad51735f Fix errors preventing the use of -DDTDDEBUG for mkcell.c (#389) 2021-08-11 11:37:15 -07:00
Nick Briggs
c33386ef44 Remove code for unsupported Sun display configurations (#388)
* Remove code for unsupported Sun display configurations

Initial cleanup removing all code that was #ifdef'd for SUNDISPLAY.
Other SunWindows dependent code may also be removeable

* prropstyle will never be defined with no SunWindows support and therefore no pixrect code

* Remove code that is ifndef NOPIXRECT, since pixrects are part of the obsolete Sun windows code.

There are still traces of pixrect dependent code that could be removed.
2021-08-10 16:31:59 -07:00
Nick Briggs
588e804a2f Merge branch 'master' of github.com:Interlisp/maiko 2021-08-09 13:15:04 -07:00
Nick Briggs
c56cbb2a91 Add missing include of <time.h> to initsout.c 2021-08-09 12:30:34 -07:00
Tim Hawes
ef31b3fe0b Additional Makefiles for FreeBSD amd64, Raspberry Pi (#387)
* Add makefiles for FreeBSD amd64 and aarch64

* Add appropriate comments in new makefiles

* Add makefile-init files for the new FreeBSD archs
2021-08-08 14:59:15 -07:00
Nick Briggs
ea8d31f590 Set up git workflow to build a maiko docker image with multi-architecture support
On pushes to master: builds images for x86_64, Apple M1, and ARMv7
architectures based on Ubuntu Focal release.  This builds only the
regular lde/ldex and does NOT build the ldeinit, so these are not
suitable for doing a loadup from scratch.

Commit based on https://github.com/stumbo/maiko/tree/gitHubBuild
2021-07-31 11:34:27 -07:00
Nick Briggs
093fb9a3d5 Merge branch 'master' of github.com:Interlisp/maiko 2021-07-30 18:30:05 -07:00
Nick Briggs
b53620852a Clean up makefile fragments for FreeBSD on 386
* Add LOCK_X_UPDATES
* Increase optimization level to -O2 and adjust -g option
* Add makefile-init-freebsd.386 in order to do loadups
2021-07-30 17:46:35 -07:00
Nick Briggs
13163c6772 Add build directory to .gitignore so typical cmake build doesn't generate git changes 2021-07-30 17:25:00 -07:00
Nick Briggs
9e179e66f2 Call getXsignaldata() with XLocked set
getXsignaldata() can call additional Xlib procedures which could generate an I/O
interrupt.  To avoid deadlocks in Xlib, ensure that XLocked is set when
getXsignaldata() is called.
2021-07-08 15:18:41 -07:00
Nick Briggs
084d69c6e8 Comment out build-pi in workflows because the RPi system is not online at this time. 2021-07-06 20:21:03 -07:00
Nick Briggs
40e18e6da0 Remove unnecessary XLOCK/XUNLOCK around calls to bitblt_to_screen/clipping_Xbitblt in getXsignaldata() 2021-07-06 20:15:35 -07:00
Nick Briggs
9ed46e6b69 Integer variables referenced from a signal handler (XLocked, XNeedSignal) should be type sig_atomic_t 2021-07-05 14:19:23 -07:00
Nick Briggs
934b15b63b Correct declaration mismatch for Event_Req between xc.c and other (correct) sites 2021-07-05 14:10:38 -07:00
Nick Briggs
2de44247b5 Include byteswapdefs.h for swapx() and byte_swap_code_block() 2021-07-05 14:03:02 -07:00
Nick Briggs
ef6a6554ac Remove SIGPOLL usage (#385)
* Remove unnecessary calls to XLOCK/XUNLOCK

The X methods called by flush_display_region() and flush_display_lineregion() handle the
locking/unlocking, therefore it is unnecessary to invoke the locking here.

* Remove explict signals when doing XUNLOCK()

Call getXsignaldata() directly if a signal happened while X code
was locked, instead of generating a signal and then handling it.

Some macros and functions needed to pass the DspInterface instead of
extracting the X display and window and passing those so that the
correct structure was available for the XUNLOCK() call.
2021-06-27 19:02:02 -07:00
Nick Briggs
1c47bf5df0 Fix the FastRetCALL macro to use do {} while (0) style (#384) 2021-06-17 13:21:00 -07:00
Nick Briggs
f42671022f Remove outdated hand-optimized assembler support for gcc on 386 (#379) 2021-05-29 17:32:32 -07:00
Nick Briggs
2122f095e8 Simplify OPFN/OPFNX macros by removing hand expansion of 1, 2, N bindings (#383)
The OPFN and OPFNX macros had been coded with a hand expansion of a loop
pushing values on the stack to separately handle the cases of 1, 2, and
more values.  This actually lead to larger, likely slower, and certainly
less obvious code.
2021-05-18 16:35:21 -07:00
Abe Jellinek
91fe7d51f9 Correct Medley GitHub link in README (#380) 2021-04-14 09:38:11 -07:00
120 changed files with 7668 additions and 2821 deletions

View File

@@ -21,14 +21,17 @@ jobs:
working-directory: bin
run: ./makeright x
build-pi:
runs-on: [self-hosted, linux, ARM]
if: ${{ github.repository == 'Interlisp/maiko' }}
steps:
- uses: actions/checkout@v2
- name: Build
working-directory: bin
run: ./makeright x
#
# Commented out because the RPi is not online at this time (6 July 2021)
#
# build-pi:
# runs-on: [self-hosted, linux, ARM]
# if: ${{ github.repository == 'Interlisp/maiko' }}
# steps:
# - uses: actions/checkout@v2
# - name: Build
# working-directory: bin
# run: ./makeright x
build-cmake:
runs-on: ${{ matrix.os }}

84
.github/workflows/buildDocker.yml vendored Normal file
View File

@@ -0,0 +1,84 @@
# based on https://blog.oddbit.com/post/2020-09-25-building-multi-architecture-im/
---
# Interlisp workflow to build a Docker Image that supports multiple architectures
name: 'Build Maiko Docker image'
# Run this workflow on push to master
# Other branches can be added it needed.
on:
push:
branches:
- master
# Jobs that are run as part of this workflow.
jobs:
# Job to build the docker image
# see: https://github.com/docker/build-push-action
docker:
runs-on: ubuntu-latest
steps:
# Checkout the branch
- name: Checkout
uses: actions/checkout@v2
# Setup some environment variables
- name: Prepare
id: prep
run: |
# Name of the Docker Image.
DOCKER_IMAGE=interlisp/${GITHUB_REPOSITORY#*/}
VERSION=latest
SHORTREF=${GITHUB_SHA::8}
## Do we want to use tags and or versions
# If this is git tag, use the tag name as a docker tag
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
fi
TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:${SHORTREF}"
# If the VERSION looks like a version number, assume that
# this is the most recent version of the image and also
# tag it 'latest'.
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
fi
# Set output parameters.
echo ::set-output name=tags::${TAGS}
echo ::set-output name=docker_image::${DOCKER_IMAGE}
echo ::set-output name=build_time::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
# Setup the Docker Machine Emulation environment.
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all
# Setup the Docker Buildx funtion
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
# Login into DockerHub - required to store the created image
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Start the Docker Build using the Dockerfile in the repository we
# checked out.
- name: Build
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
build-args: BUILD_DATE=${{ steps.prep.outputs.build_time }}
context: .
file: ./Dockerfile
# Platforms - Sepecify the platforms to include in the build
# linux/amd64 -- Standard x86_64
# linux/arm64 -- Apple M1
# linux/arm/v7 -- Raspberry pi
platforms: linux/amd64,linux/arm64,linux/arm/v7
# Push the result to DockerHub
push: true
# tags to assign to the Docker image
tags: ${{ steps.prep.outputs.tags }}

1
.gitignore vendored
View File

@@ -5,6 +5,7 @@
\#*#
.DS_Store
# build directories
build/**
*.386-x/**
*.386/**
*.ppc-x/**

View File

@@ -16,6 +16,19 @@ IF(CMAKE_C_COMPILER_ID MATCHES "SunPro")
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
ENDIF()
find_program(
CLANG_TIDY_EXE
NAMES "clang-tidy" "clang-tidy12" "clang-tidy11" "clang-tidy10"
DOC "Path to clang-tidy executable"
)
IF (CLANG_TIDY_EXE)
# There are many many warnings for strcpy instances to deal with,
# but suppress it for now so that other issues are more obvious
#
SET(CMAKE_C_CLANG_TIDY ${CLANG_TIDY_EXE} -checks=-*,cert-*,clang-analyzer-security.*,-clang-analyzer-security.insecureAPI.strcpy,-clang-analyzer-security.insecureAPI.bzero -header-filter=.*)
ENDIF()
INCLUDE(CheckLibraryExists)
CHECK_LIBRARY_EXISTS(m fmod "" NEED_LIB_M)
IF(NEED_LIB_M)
@@ -79,9 +92,13 @@ SET(BAD_SRCS
src/chatter.c
src/codeconv.c
src/codetbl.c
src/doscomm.c
src/doskbd.c
src/dosmouse.c
src/ejlisp.c
src/imagefile2.c
src/imagefile.c
src/kbdif.c
src/lpdual.c
src/lpkit.c
src/lplexyy.c
@@ -98,6 +115,8 @@ SET(BAD_SRCS
src/rawrs232c.c
src/rs232c.c
src/truecolor.c
src/vesainit.c
src/vgainit.c
)
SET(MAIKO_SRCS
@@ -169,6 +188,7 @@ SET(MAIKO_SRCS
src/miscn.c
src/mkatom.c
src/mkcell.c
src/mouseif.c
src/mvs.c
src/osmsg.c
src/perrno.c
@@ -273,10 +293,12 @@ SET(MAIKO_HDRS
inc/initsoutdefs.h
inc/inlineC.h
inc/inln68k.h
inc/inlndos.h
inc/inlnPS2.h
inc/inlnSPARC.h
inc/intcalldefs.h
inc/iopage.h
inc/kbdif.h
inc/kbdsubrsdefs.h
inc/keyboard.h
inc/keyeventdefs.h
@@ -288,6 +310,7 @@ SET(MAIKO_HDRS
inc/lisp2cdefs.h
inc/lispemul.h
inc/lispmap.h
inc/lispver1.h
inc/lispver2.h
inc/llcolordefs.h
inc/lldsp.h

18
Dockerfile Normal file
View File

@@ -0,0 +1,18 @@
FROM ubuntu:focal
ARG BUILD_DATE
LABEL name="Maiko"
LABEL description="Virtual machine for Interlisp Medley"
LABEL url="https://github.com/Interlisp/maiko"
LABEL build-time=$BUILD_DATE
ARG TARGETPLATFORM
RUN apt-get update && apt-get install -y make clang libx11-dev gcc x11vnc xvfb
COPY --chown=nonroot:nonroot . /app/maiko
RUN rm -rf /app/maiko/linux*
WORKDIR /app/maiko/bin
RUN ./makeright x
RUN rm -rf /app/maiko/inc /app/maiko/include /app/maiko/src

View File

@@ -6,7 +6,7 @@ connecting with Lisp for access to display (via X11) and disk etc.
For an overview, see [Medley Interlisp Introduction](https://github.com/Interlisp/medley/wiki/Medley-Interlisp-Introduction).
See [the Medley repository](https://github.org/Interlisp/medley) for
See [the Medley repository](https://github.com/Interlisp/medley) for
* [Issues](https://github.com/Interlisp/medley/issues) (note that maiko issues are there too)
* [Discussions](https://github.com/Interlisp/medley/discussions) (Q&A, announcements, etc)
* [Medley's README](https://github.com/Interlisp/medley/blob/master/README.md)

View File

@@ -124,9 +124,19 @@ BIGATOMS True if this emulator will support 3-byte symbols, instead of
NEWBITBLT True if we want to use assembler BITBLT code, rather than
have code created inline by macro calls.
USE_DLPI True if the ethernet API is via the SysV Data Link Provider
Interface. Solaris uses DLPI.
USE_NIT True if the ethernet API is via the Network Interface Tap.
SunOS uses NIT.
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.
bitbltsub.c:#ifdef GETBASE
testdisplay.c:#ifdef NOTUSED
uraid.c:#ifdef ETHERINT
bitblt.c:#ifndef COLOR
bitbltsub.c:#ifndef prropstyle
lispmap.h:#ifdef MEDLEY

View File

@@ -19,7 +19,7 @@ XFLAGS = -I/opt/X11/include -DXWINDOW
OPTFLAGS = -O2 -g
DEBUGFLAGS = # -DDEBUG -DOPTRACE
DFLAGS = $(DEBUGFLAGS) $(XFLAGS) \
-DRELEASE=351 -DSTACKCHECK -DFSBCHECK -DPCTRACE
-DRELEASE=351 # -DSTACKCHECK -DFSBCHECK -DPCTRACE
LDFLAGS = -L/opt/X11/lib -lX11 -lm
LDELDFLAGS = -L/opt/X11/lib -lX11 -lm

614
bin/makefile-dos Normal file
View File

@@ -0,0 +1,614 @@
AFLAGS = /T
ARCHFILES = dosmouse.obj doskbd.obj vesafns.obj vesainit.obj vgainit.obj kbdif.obj
ADMINFILES = makefile mkvdate.c
LPFILES = lpmain.obj lpread.obj lpsolve.obj lpwrite.obj lpdual.obj lptran.obj
CFLAGS = -DDOS -DKBINT -DNOPIXRECT \
-DNOVERSION -DLPSOLVE -g
LDFLAGS = -g graphics.lib binmode.lib mouse.lib
RM = del
SRCFILES = conspage.c gcoflow.c shift.c dbgtool.c gcr.c gcrcell.c llstk.c gcscan.c loopsops.c storage.c allocmds.c dir.c gvar2.c lowlev1.c subr.c arith2.c lowlev2.c subr0374.c arith3.c doscomm.c hardrtn.c lsthandl.c sxhash.c arith4.c draw.c main.c testtool.c array.c dsk.c inet.c misc7.c timer.c array2.c dspif.c initdsp.c miscn.c typeof.c array3.c initkbd.c ubf1.c array4.c dspsubrs.c initsout.c mkatom.c ubf2.c array5.c eqf.c intcall.c mkcell.c ubf3.c array6.c ether.c mkvdate.c ufn.c atom.c findkey.c kbdsubrs.c mouseif.c ufs.c bbtsub.c foreign.c keyevent.c unixcomm.c bin.c fp.c binds.c asmbbt.c fvar.c mvs.c unwind.c bitblt.c gc.c uraid.c blt.c gc2.c kprint.c osmsg.c usrsubr.c byteswap.c gcarray.c perrno.c ldeboot.c ldeether.c uutils.c carcdr.c gccode.c rawcolor.c vars3.c gcfinal.c ldsout.c return.c vmemsave.c chardev.c gchtfind.c lineblt8.c rpc.c xc.c common.c gcmain3.c lisp2c.c rplcons.c z2.c xmkicon.c xbbt.c xinit.c xscroll.c xcursor.c xlspwin.c xrdopt.c xwinman.c dosmouse.c vesafns.asm vesainit.c vgainit.c kbdif.c dspsparc.il copyright launch.asm lpread.c lpsolve.c lpmain.c lpwrite.c lpdual.c lptran.c
OFILES = conspage.obj gcoflow.obj shift.obj dbgtool.obj gcr.obj gcrcell.obj llstk.obj gcscan.obj loopsops.obj storage.obj allocmds.obj dir.obj gvar2.obj lowlev1.obj subr.obj arith2.obj lowlev2.obj subr0374.obj arith3.obj doscomm.obj hardrtn.obj lsthandl.obj sxhash.obj arith4.obj draw.obj main.obj testtool.obj array.obj dsk.obj inet.obj misc7.obj timer.obj array2.obj dspif.obj initdsp.obj miscn.obj typeof.obj array3.obj initkbd.obj ubf1.obj array4.obj dspsubrs.obj initsout.obj mkatom.obj ubf2.obj array5.obj eqf.obj intcall.obj mkcell.obj ubf3.obj array6.obj ether.obj ufn.obj atom.obj findkey.obj kbdsubrs.obj mouseif.obj ufs.obj bbtsub.obj foreign.obj keyevent.obj unixcomm.obj bin.obj fp.obj binds.obj fvar.obj mvs.obj unwind.obj bitblt.obj gc.obj uraid.obj blt.obj gc2.obj kprint.obj osmsg.obj usrsubr.obj byteswap.obj gcarray.obj perrno.obj uutils.obj carcdr.obj asmbbt.obj gccode.obj vars3.obj gcfinal.obj ldsout.obj return.obj vmemsave.obj chardev.obj gchtfind.obj lineblt8.obj rpc.obj xc.obj common.obj gcmain3.obj lisp2c.obj rplcons.obj z2.obj vdate.obj $(COLORFILES) $(ARCHFILES) $(LPFILES)
HFILES = address.h adr68k.h arith.h cell.h dbprint.h display.h dspif.h ifpage.h iopage.h lispemul.h lispmap.h lsptypes.h miscstat.h lspglob.h array.h bb.h bitblt.h debug.h devconf.h dspdata.h ether.h fast_dsp.h gcdata.h hdw_conf.h initatms.h inlinec.h keyboard.h lispver1.h lispver2.h lldsp.h locfile.h medleyfp.h mouseif.h my.h opcodes.h osmsg.h pilotbbt.h print.h return.h stack.h stream.h subrs.h timeout.h tos1defs.h tosfns.h tosret.h vmemsave.h xdefs.h xbitmaps.h xkeymap.h
bigvm:
CFLAGS = $(CFLAGS)
make -f foot emul.exe
emul.exe : $(OFILES)
@ echo $** > linkopts
@ echo $(CFLAGS) > copts
$(RM) vdate.c
$(CC) @copts @linkopts $(LDFLAGS) /e$@
del linkopts
del copts
@ echo "Executable is now named '$@'"
main.o : lispemul.h address.h lsptypes.h adr68k.h stack.h lspglob.h lispmap.h ifpage.h iopage.h return.h debug.h
.SUFFIXES .exe .lib .c .obj .c .asm .s .c
medley.exe: launch.obj
TLINK launch,medley
launch.obj: launch.asm
# xc.obj: xc.s
# tasm /ml xc.s
#
#xc.s: xc.c
# rsh sparky (cd /users/nilsson/curr ; gcc-make $* )
vdate.obj : mkvdate.exe
mkvdate > vdate.c
$(CC) vdate.c -c $@
mkvdate.exe : ../src/mkvdate.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/mkvdate.c
del copts
xc.obj : ../src/xc.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/xc.c -I ../inc -c $@
del copts
lpmain.obj : ../src/lpmain.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/lpmain.c -I ../inc -c $@
del copts
lpsolve.obj : ../src/lpsolve.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/lpsolve.c -I ../inc -c $@
del copts
lpread.obj : ../src/lpread.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/lpread.c -I ../inc -c $@
del copts
lptran.obj : ../src/lptran.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/lptran.c -I ../inc -c $@
del copts
lpdual.obj : ../src/lpdual.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/lpdual.c -I ../inc -c $@
del copts
lpwrite.obj : ../src/lpwrite.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/lpwrite.c -I ../inc -c $@
del copts
conspage.obj : ../src/conspage.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/conspage.c -I ../inc -c $@
del copts
dosmouse.obj : ../src/dosmouse.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/dosmouse.c -I ../inc -c $@
del copts
doskbd.obj : ../src/doskbd.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/doskbd.c -I ../inc -c $@
del copts
vesafns.obj : ../src/vesafns.asm
tasm /ml ..\src\vesafns.asm
vesainit.obj : ../src/vesainit.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/vesainit.c -I ../inc -c $@
del copts
vgainit.obj : ../src/vgainit.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/vgainit.c -I ../inc -c $@
del copts
kbdif.obj : ../src/kbdif.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/kbdif.c -I ../inc -c $@
del copts
gcoflow.obj : ../src/gcoflow.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/gcoflow.c -I ../inc -c $@
del copts
shift.obj : ../src/shift.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/shift.c -I ../inc -c $@
del copts
dbgtool.obj : ../src/dbgtool.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/dbgtool.c -I ../inc -c $@
del copts
gcr.obj : ../src/gcr.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/gcr.c -I ../inc -c $@
del copts
gcrcell.obj : ../src/gcrcell.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/gcrcell.c -I ../inc -c $@
del copts
llstk.obj : ../src/llstk.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/llstk.c -I ../inc -c $@
del copts
gcscan.obj : ../src/gcscan.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/gcscan.c -I ../inc -c $@
del copts
loopsops.obj : ../src/loopsops.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/loopsops.c -I ../inc -c $@
del copts
storage.obj : ../src/storage.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/storage.c -I ../inc -c $@
del copts
allocmds.obj : ../src/allocmds.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/allocmds.c -I ../inc -c $@
del copts
dir.obj : ../src/dir.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/dir.c -I ../inc -c $@
del copts
gvar2.obj : ../src/gvar2.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/gvar2.c -I ../inc -c $@
del copts
lowlev1.obj : ../src/lowlev1.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/lowlev1.c -I ../inc -c $@
del copts
subr.obj : ../src/subr.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/subr.c -I ../inc -c $@
del copts
arith2.obj : ../src/arith2.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/arith2.c -I ../inc -c $@
del copts
lowlev2.obj : ../src/lowlev2.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/lowlev2.c -I ../inc -c $@
del copts
subr0374.obj : ../src/subr0374.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/subr0374.c -I ../inc -c $@
del copts
arith3.obj : ../src/arith3.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/arith3.c -I ../inc -c $@
del copts
doscomm.obj : ../src/doscomm.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/doscomm.c -I ../inc -c $@
del copts
hardrtn.obj : ../src/hardrtn.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/hardrtn.c -I ../inc -c $@
del copts
lsthandl.obj : ../src/lsthandl.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/lsthandl.c -I ../inc -c $@ -Le
del copts
sxhash.obj : ../src/sxhash.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/sxhash.c -I ../inc -c $@
del copts
arith4.obj : ../src/arith4.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/arith4.c -I ../inc -c $@
del copts
draw.obj : ../src/draw.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/draw.c -I ../inc -c $@
del copts
main.obj : ../src/main.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/main.c -I ../inc -c $@
del copts
testtool.obj : ../src/testtool.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/testtool.c -I ../inc -c $@
del copts
array.obj : ../src/array.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/array.c -I ../inc -c $@
del copts
dsk.obj : ../src/dsk.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/dsk.c -I ../inc -c $@
del copts
inet.obj : ../src/inet.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/inet.c -I ../inc -c $@
del copts
misc7.obj : ../src/misc7.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/misc7.c -I ../inc -c $@
del copts
timer.obj : ../src/timer.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/timer.c -I ../inc -c $@
del copts
array2.obj : ../src/array2.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/array2.c -I ../inc -c $@
del copts
dspif.obj : ../src/dspif.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/dspif.c -I ../inc -c $@
del copts
initdsp.obj : ../src/initdsp.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/initdsp.c -I ../inc -c $@
del copts
miscn.obj : ../src/miscn.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/miscn.c -I ../inc -c $@
del copts
typeof.obj : ../src/typeof.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/typeof.c -I ../inc -c $@
del copts
array3.obj : ../src/array3.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/array3.c -I ../inc -c $@
del copts
initkbd.obj : ../src/initkbd.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/initkbd.c -I ../inc -c $@
del copts
ubf1.obj : ../src/ubf1.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/ubf1.c -I ../inc -c $@
del copts
array4.obj : ../src/array4.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/array4.c -I ../inc -c $@
del copts
dspsubrs.obj : ../src/dspsubrs.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/dspsubrs.c -I ../inc -c $@
del copts
initsout.obj : ../src/initsout.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/initsout.c -I ../inc -c $@
del copts
mkatom.obj : ../src/mkatom.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/mkatom.c -I ../inc -c $@
del copts
ubf2.obj : ../src/ubf2.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/ubf2.c -I ../inc -c $@
del copts
array5.obj : ../src/array5.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/array5.c -I ../inc -c $@
del copts
eqf.obj : ../src/eqf.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/eqf.c -I ../inc -c $@
del copts
intcall.obj : ../src/intcall.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/intcall.c -I ../inc -c $@
del copts
mkcell.obj : ../src/mkcell.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/mkcell.c -I ../inc -c $@
del copts
ubf3.obj : ../src/ubf3.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/ubf3.c -I ../inc -c $@
del copts
array6.obj : ../src/array6.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/array6.c -I ../inc -c $@
del copts
ether.obj : ../src/ether.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/ether.c -I ../inc -c $@
del copts
ufn.obj : ../src/ufn.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/ufn.c -I ../inc -c $@
del copts
atom.obj : ../src/atom.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/atom.c -I ../inc -c $@
del copts
findkey.obj : ../src/findkey.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/findkey.c -I ../inc -c $@
del copts
kbdsubrs.obj : ../src/kbdsubrs.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/kbdsubrs.c -I ../inc -c $@
del copts
mouseif.obj : ../src/mouseif.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/mouseif.c -I ../inc -c $@
del copts
ufs.obj : ../src/ufs.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/ufs.c -I ../inc -c $@
del copts
bbtsub.obj : ../src/bbtsub.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/bbtsub.c -I ../inc -c $@
del copts
foreign.obj : ../src/foreign.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/foreign.c -I ../inc -c $@
del copts
keyevent.obj : ../src/keyevent.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/keyevent.c -I ../inc -c $@
del copts
unixcomm.obj : ../src/unixcomm.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/unixcomm.c -I ../inc -c $@
del copts
bin.obj : ../src/bin.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/bin.c -I ../inc -c $@
del copts
fp.obj : ../src/fp.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/fp.c -I ../inc -c $@
del copts
binds.obj : ../src/binds.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/binds.c -I ../inc -c $@
del copts
fvar.obj : ../src/fvar.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/fvar.c -I ../inc -c $@
del copts
mvs.obj : ../src/mvs.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/mvs.c -I ../inc -c $@
del copts
unwind.obj : ../src/unwind.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/unwind.c -I ../inc -c $@
del copts
bitblt.obj : ../src/bitblt.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/bitblt.c -I ../inc -c $@
del copts
gc.obj : ../src/gc.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/gc.c -I ../inc -c $@
del copts
uraid.obj : ../src/uraid.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/uraid.c -I ../inc -c $@
del copts
blt.obj : ../src/blt.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/blt.c -I ../inc -c $@
del copts
gc2.obj : ../src/gc2.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/gc2.c -I ../inc -c $@
del copts
kprint.obj : ../src/kprint.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/kprint.c -I ../inc -c $@
del copts
osmsg.obj : ../src/osmsg.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/osmsg.c -I ../inc -c $@
del copts
usrsubr.obj : ../src/usrsubr.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/usrsubr.c -I ../inc -c $@
del copts
byteswap.obj : ../src/byteswap.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/byteswap.c -I ../inc -c $@
del copts
gcarray.obj : ../src/gcarray.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/gcarray.c -I ../inc -c $@
del copts
perrno.obj : ../src/perrno.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/perrno.c -I ../inc -c $@
del copts
uutils.obj : ../src/uutils.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/uutils.c -I ../inc -c $@
del copts
carcdr.obj : ../src/carcdr.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/carcdr.c -I ../inc -c $@
del copts
asmbbt.obj : ../src/asmbbt.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/asmbbt.c -I ../inc -c $@
del copts
gccode.obj : ../src/gccode.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/gccode.c -I ../inc -c $@
del copts
vars3.obj : ../src/vars3.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/vars3.c -I ../inc -c $@
del copts
gcfinal.obj : ../src/gcfinal.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/gcfinal.c -I ../inc -c $@
del copts
ldsout.obj : ../src/ldsout.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/ldsout.c -I ../inc -c $@
del copts
return.obj : ../src/return.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/return.c -I ../inc -c $@
del copts
vmemsave.obj : ../src/vmemsave.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/vmemsave.c -I ../inc -c $@
del copts
chardev.obj : ../src/chardev.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/chardev.c -I ../inc -c $@
del copts
gchtfind.obj : ../src/gchtfind.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/gchtfind.c -I ../inc -c $@
del copts
lineblt8.obj : ../src/lineblt8.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/lineblt8.c -I ../inc -c $@
del copts
rpc.obj : ../src/rpc.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/rpc.c -I ../inc -c $@
del copts
common.obj : ../src/common.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/common.c -I ../inc -c $@
del copts
gcmain3.obj : ../src/gcmain3.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/gcmain3.c -I ../inc -c $@
del copts
lisp2c.obj : ../src/lisp2c.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/lisp2c.c -I ../inc -c $@
del copts
rplcons.obj : ../src/rplcons.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/rplcons.c -I ../inc -c $@
del copts
z2.obj : ../src/z2.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/z2.c -I ../inc -c $@
del copts

View File

@@ -16,7 +16,7 @@ XFILES = $(OBJECTDIR)xmkicon.o \
XFLAGS = -I/usr/local/include -DXWINDOW
# OPTFLAGS is normally -O2.
OPTFLAGS = -O1 -gdwarf-2
OPTFLAGS = -O2 -g
DFLAGS = $(XFLAGS) -DRELEASE=351
LDFLAGS = -L/usr/local/lib -lX11 -lc -lm

View File

@@ -0,0 +1,27 @@
# Options for FreeBSD, ARMv7 and X-Windows
CC = clang -m64 $(CLANG_CFLAGS)
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 = -I/usr/local/include -DXWINDOW
# OPTFLAGS is normally -O2.
OPTFLAGS = -O2 -g
DFLAGS = $(XFLAGS) -DRELEASE=351
LDFLAGS = -L/usr/local/lib -lX11 -lc -lm
LDELDFLAGS = -L/usr/local/lib -lX11 -lc -lm
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldex

View File

@@ -0,0 +1,27 @@
# Options for FreeBSD, Intel x86_64 and X-Windows
CC = clang -m64 $(CLANG_CFLAGS)
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 = -I/usr/local/include -DXWINDOW
# OPTFLAGS is normally -O2.
OPTFLAGS = -O2 -g
DFLAGS = $(XFLAGS) -DRELEASE=351
LDFLAGS = -L/usr/local/lib -lX11 -lc -lm
LDELDFLAGS = -L/usr/local/lib -lX11 -lc -lm
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldex

View File

@@ -0,0 +1,27 @@
# Options for FreeBSD, Intel 386/486 and X Windows
CC = clang -m32 $(CLANG_CFLAGS)
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 = -I/usr/local/include -DXWINDOW
# OPTFLAGS is normally -O0 for init
OPTFLAGS = -O0 -g
DFLAGS = $(XFLAGS) -DRELEASE=351 -DNOVERSION -DINIT
LDFLAGS = -L/usr/local/lib -lX11 -lc -lm
LDELDFLAGS = -L/usr/local/lib -lX11 -lc -lm
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/ldeinit

View File

@@ -0,0 +1,27 @@
# Options for FreeBSD, ARMv7 and X-Windows
CC = clang -m64 $(CLANG_CFLAGS)
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 = -I/usr/local/include -DXWINDOW
# OPTFLAGS is normally -O0 for init
OPTFLAGS = -O0 -g
DFLAGS = $(XFLAGS) -DRELEASE=351 -DNOVERSION -DINIT
LDFLAGS = -L/usr/local/lib -lX11 -lc -lm
LDELDFLAGS = -L/usr/local/lib -lX11 -lc -lm
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/ldeinit

View File

@@ -0,0 +1,27 @@
# Options for FreeBSD, Intel x86_64 and X-Windows
CC = clang -m64 $(CLANG_CFLAGS)
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 = -I/usr/local/include -DXWINDOW
# OPTFLAGS is normally -O0 for init
OPTFLAGS = -O0 -g
DFLAGS = $(XFLAGS) -DRELEASE=351 -DNOVERSION -DINIT
LDFLAGS = -L/usr/local/lib -lX11 -lc -lm
LDELDFLAGS = -L/usr/local/lib -lX11 -lc -lm
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/ldeinit

View File

@@ -41,7 +41,7 @@ OPTFLAGS = -g3 -O0
DEBUGFLAGS = # -DSTACKCHECK -DFNSTKCHECK
MACHINEFLAGS = -DOS5 -DUSE_DLPI -DLOCK_X_UPDATES
MACHINEFLAGS = -DOS5 -DUSE_DLPI
# The LDEINIT wants to have NOVERSION set, so we don't hang up on
# any change-over in versions.

View File

@@ -36,7 +36,6 @@ DEBUGFLAGS = # -DSTACKCHECK -DFNSTKCHECK
DFLAGS = $(XFLAGS) \
$(DEBUGFLAGS) \
-DOS5 \
-DLOCK_X_UPDATES \
-DRELEASE=351
LDFLAGS = -L/usr/X11/lib -lX11 -lc -lm -lsocket -lnsl

View File

@@ -36,7 +36,6 @@ DEBUGFLAGS = # -DSTACKCHECK -DFNSTKCHECK
DFLAGS = $(XFLAGS) \
$(DEBUGFLAGS) \
-DOS5 -DUSE_DLPI \
-DLOCK_X_UPDATES \
-I$(OPENWINHOME)/include \
-DRELEASE=210

View File

@@ -40,7 +40,7 @@ OPTFLAGS = -O2 -g3
DEBUGFLAGS = # -DSTACKCHECK -DFNSTKCHECK
MACHINEFLAGS = -DOS5 -DUSE_DLPI -DLOCK_X_UPDATES
MACHINEFLAGS = -DOS5 -DUSE_DLPI
DFLAGS = $(XFLAGS) \
$(DEBUGFLAGS) \

View File

@@ -36,7 +36,6 @@ DEBUGFLAGS = # -DSTACKCHECK -DFNSTKCHECK
DFLAGS = $(XFLAGS) \
$(DEBUGFLAGS) \
-DOS5 \
-DLOCK_X_UPDATES \
-DUSE_DLPI \
-DRELEASE=351

View File

@@ -485,6 +485,14 @@ $(OBJECTDIR)dspif.o: $(SRCDIR)dspif.c $(REQUIRED-INCS) \
$(INCDIR)devif.h $(INCDIR)dspifdefs.h $(INCDIR)xinitdefs.h
$(CC) $(RFLAGS) $(SRCDIR)dspif.c -o $(OBJECTDIR)dspif.o
$(OBJECTDIR)kbdif.o: $(SRCDIR)kbdif.c $(REQUIRED-INCS) $(INCDIR)lispemul.h \
$(INCDIR)dbprint.h $(INCDIR)devif.h
$(CC) $(RFLAGS) $(SRCDIR)kbdif.c -o $(OBJECTDIR)kbdif.o
$(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.o: $(SRCDIR)ether.c $(REQUIRED-INCS) \
$(INCDIR)commondefs.h $(INCDIR)lispemul.h \
$(INCDIR)lispmap.h $(INCDIR)emlglob.h $(INCDIR)lsptypes.h $(INCDIR)lspglob.h \

44
bin/release-one Executable file
View File

@@ -0,0 +1,44 @@
#!/bin/sh
# Make and release maiko for one os / arch
# Hopefully to be replaced by GitHub Action
if [ ! -x ../../maiko/bin/machinetype ] ; then
echo ERROR: Must be run from maiko/bin
exit 1
fi
tag=$1
if [ -z "$tag" ] ; then
tag=maiko-`date +%y%m%d`
fi
export PATH=.:"$PATH"
osarch=`osversion`.`machinetype`
./makeright x
./makeright init
cd ../..
mkdir -p maiko/build
echo making $tag-$osarch.tgz
tar cfz maiko/build/$tag-$osarch.tgz \
maiko/bin/osversion \
maiko/bin/machinetype \
maiko/bin/config.guess \
maiko/bin/config.sub \
maiko/$osarch/lde*
if ! command -v gh >/dev/null ; then
echo
echo The GitHub Command Line Interface, gh
echo does not seem to be installed.
echo Please upload maiko/build/$tag-$osarch.tgz
echo to https://github.com/Interlisp/maiko/releases $tag
exit 0
fi
echo uploading
cd maiko
gh release upload --clobber $tag build/$tag-$osarch.tgz

36
bin/start-release Executable file
View File

@@ -0,0 +1,36 @@
#!/bin/sh
# This script is just a placeholder until we get GitHub
# Actions to do releases
# Start Maiko release from maiko/bin
# startrelease [tag]
# tag defaults to maiko-YYMMDD
tag=$1
if [ -z "$tag" ] ; then
tag=maiko-`date +%y%m%d`
fi
if ! command -v gh >/dev/null ; then
echo "It seems like 'gh', the GitHub Command Line Interface is"
echo "not installed. You can start a release using the"
echo "web interface at"
echo "https://github.com/Interlisp/maiko/releases/new"
echo "Make up a tag (or use $tag)"
echo "and run './release-one tag' (or manually upload if"
echo "no 'gh' is installed) on every os/machine you want"
echo "this release to work for"
exit 0
fi
# Now for the only thing this script is actually doing
gh release create $tag -p -t $tag -n "See release notes in medley repo"
echo "Now run "
echo ./release-one $tag
echo "in maiko/bin on every os/machine you want this release"
echo "to work for. When done, edit the release in your"
echo "browser and uncheck the prerelease box "

View File

@@ -77,7 +77,7 @@ typedef struct
, White_Pixel ); \
XLOCK; \
XFlush( display ); \
XUNLOCK; \
XUNLOCK( display ); \
(child_win)->parent = parent_win; \
if( (child_win)->after_create ) \
((child_win)->after_create)(parent_win,child_win);\
@@ -96,7 +96,7 @@ typedef struct
, (window)->width \
, (window)->height ); \
XFlush( display ); \
XUNLOCK; \
XUNLOCK( display ); \
if( (window)->after_resize ) \
((window)->after_resize)( window ); \
} \
@@ -106,7 +106,7 @@ typedef struct
XLOCK; \
XDefineCursor( display, (window)->win, *(mycursor) ); \
XFlush( display ); \
XUNLOCK; \
XUNLOCK( display ); \
(window)->cursor = mycursor; \
}

View File

@@ -1,36 +1,19 @@
#ifndef BBTSUBDEFS_H
#define BBTSUBDEFS_H 1
/***** Don't use PixRect code on 386i for now *****/
/***** -or on any machine that doesn't support it (HP, e.g.) *****/
/********************************************************/
/* */
/* prropstyle is DEFINED when we want to use */
/* pixrect versions of the operations in this */
/* file, and UNDEFINED, when we want to use */
/* Don Charnley's bitblt code to do them. */
/* Don Charnley's bitblt code */
/* */
/********************************************************/
#include "lispemul.h" /* for LispPTR, DLword */
#if defined(SUNDISPLAY) && \
!defined(NOPIXRECT) && \
!defined(NEWBITBLT)
#define prropstyle 1
#endif
void bitbltsub(LispPTR *argv);
LispPTR n_new_cursorin(DLword *baseaddr, int dx, int dy, int w, int h);
LispPTR bitblt_bitmap(LispPTR *args);
LispPTR bitshade_bitmap(LispPTR *args);
#ifndef prropstyle
void bltchar(LispPTR *args);
void newbltchar(LispPTR *args);
#else
LispPTR bltchar(LispPTR *args);
LispPTR newbltchar(LispPTR *args);
#endif
void ccfuncall(unsigned int atom_index, int argnum, int bytenum);
void tedit_bltchar(LispPTR *args);

View File

@@ -49,13 +49,11 @@ extern int DisplayRasterWidth;
#define MOUSEYH ((int)*EmMouseY68K + YDELTA)
#if defined(SUNDISPLAY) && defined(OLD_CURSOR)
extern struct winlock DisplayLockArea;
#define HideCursor \
ioctl( LispWindowFd, WINLOCKSCREEN, &DisplayLockArea)
#ifdef DOS
#define HideCursor { (currentdsp->mouse_invisible)(currentdsp, IOPage68K); }
#define ShowCursor { (currentdsp->mouse_visible)(IOPage68K->dlmousex, \
IOPage68K->dlmousey); }
#define ShowCursor \
ioctl( LispWindowFd, WINUNLOCKSCREEN, &DisplayLockArea)
#else
extern DLword *EmCursorX68K,*EmCursorY68K;
#define HideCursor { taking_mouse_down();}
@@ -77,7 +75,14 @@ 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--;
#else
#define LOCKSCREEN ScreenLocked = T;
#define UNLOCKSCREEN ScreenLocked = NIL;
#endif /* DOS */
#endif /* BITBLT_H */

View File

@@ -154,6 +154,19 @@ typedef struct
{
DevRec device;
PFV device_event; /* Event handler for the keyboard. */
#ifdef DOS
u_char KeyMap[0x80]; /* The key translation table. Use the keycode you
get from the keyboard as an index. The value
gives the lispkeycode.*/
unsigned char lastbyte; /* Last byte that we got from the keyboard. */
unsigned int keyeventsize; /* The sizeof() one kbd event */
unsigned int maxkeyevent; /* Offset to the end of the ringbuffer. */
int eurokbd; /* Keep tabs of the euro-ness of the kbd */
PFV prev_handler; /* The previous keyboard handler.
Keep this around
to restore when we exit Medley */
int URaid; /* Put this in a better place later.. /jarl */
#endif /* DOS */
} KbdInterfaceRec, *KbdInterface;
@@ -208,7 +221,20 @@ typedef struct
unsigned long oldstate; /* Keep the old state around */
unsigned long graphicsmode; /* Magic cookie used to set the state. */
unsigned long numberofbanks;
#if XWINDOW
#ifdef DOS
unsigned long BytesPerLine;
unsigned long DisplayStartAddr;
unsigned long DisplaySegSize;
unsigned long DisplaySegMagnitude;
unsigned long LinesPerBank;
unsigned short LastLineLen[32]; /* length of last line fragment per bank */
unsigned short LinesInBank[32]; /* True # of full lines in this bank */
/* # of lines we can do with the full-line dumpline */
/* for sure. */
unsigned short LinesBeforeBank[32]; /* Scan lines before start of this bank. */
void (* SwitchBank)(); /* Method to switch the bank (see vesa standard) */
#elif XWINDOW
char *identifier;
int BitGravity;
Display *display_id;
@@ -238,11 +264,12 @@ typedef struct
#ifdef XWINDOW
#define DefineCursor(display, window, mycursor) { \
XLOCK;\
XDefineCursor( display, window, *(mycursor) );\
XUNLOCK;\
}
#define DefineCursor(dsp, window, mycursor) \
do { \
XLOCK; \
XDefineCursor((dsp)->display_id, window, *(mycursor) ); \
XUNLOCK(dsp); \
} while (0)
#endif /* XWINDOW */
#define OUTER_SB_WIDTH(dsp) ((dsp)->ScrollBarWidth + 2*((dsp)->InternalBorderWidth))

View File

@@ -1,6 +1,9 @@
#ifndef DIRDEFS_H
#define DIRDEFS_H 1
#include "lispemul.h" /* for LispPTR */
#ifdef DOS
int make_old_version(char *old, char *file);
#endif
#ifdef FSDEBUG
void print_finfo(FINFO *fp);
#endif

View File

@@ -44,6 +44,10 @@ extern DLword *DISP_MAX_Address;
#define DISPLAYBUFFER
#endif /* XWINDOW */
#ifdef DOS
#define DISPLAYBUFFER
#endif /* DOS */
#ifdef DISPLAYBUFFER
/************************************************************************/
/* */

View File

@@ -1,7 +1,11 @@
#ifndef DSKDEFS_H
#define DSKDEFS_H 1
#include "lispemul.h" /* for LispPTR */
#ifdef DOS
void separate_host(char *lfname, char *host, char *drive);
#else
void separate_host(char *lfname, char *host);
#endif
LispPTR COM_openfile(register LispPTR *args);
LispPTR COM_closefile(register LispPTR *args);
LispPTR DSK_getfilename(register LispPTR *args);

703
inc/inlndos.h Executable file
View File

@@ -0,0 +1,703 @@
/* $Id: inlndos.h,v 1.2 1999/01/03 02:06:05 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1991, 1992 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/************************************************************************/
/************************************************************************/
/* */
/* I N L I N E P S 2 . H */
/* */
/* INLINE definitions for 386 machines, compiled with gcc. */
/* */
/* This file consists of 3 sections: */
/* */
/* inline static functions for use anywhere in Medley */
/* (e.g., the byte-swapping functions) */
/* */
/* #defines and static inline functions for the dispatch */
/* loop (e.g., IDIFFERENCE), relying on the register */
/* conventions that hold in that part of the code */
/* */
/* #defines and static inline functions for other */
/* specific files (e.g., the arithmetic functions, */
/* free-variable lookup, etc.), relying on the register */
/* conventions in the respective files. */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* R E G I S T E R C O N V E N T I O N S */
/* */
/* The following register conventions hold in the dispatch loop, */
/* and are set up by register ... asm("...") decls in xc.c: */
/* */
/* esi pccache - the current PC */
/* edi cspcache - the current lisp stack ptr. */
/* ebx tscache - the top-of-stack item. */
/* */
/* */
/* Register conventions within arithmetic functions in the files */
/* arith2.c - arith4.c, etc.: */
/* */
/* esi first argument to the function */
/* edi second argument to the function */
/* */
/************************************************************************/
/************************************************************************/
/* */
/* G E N E R A L - P U R P O S E I N L I N E F U N C T I O N S */
/* */
/* These functions don't rely on register conventions. */
/* */
/************************************************************************/
/************************************************************************/
/* */
/* */
/* */
/* */
/* */
/************************************************************************/
/* undefine these macros so we use the 386i inline code */
#undef Get_BYTE_PCMAC0
#undef Get_BYTE_PCMAC1
#undef Get_BYTE_PCMAC2
#undef Get_BYTE_PCMAC3
#define Get_BYTE_PCMAC0 Get_BYTE_PCMAC0fn(pccache)
#define Get_BYTE_PCMAC1 Get_BYTE_PCMAC1fn(pccache)
#define Get_BYTE_PCMAC2 Get_BYTE_PCMAC2fn(pccache)
#define Get_BYTE_PCMAC3 Get_BYTE_PCMAC3fn(pccache)
extern inline unsigned int Get_BYTE_PCMAC0fn (pccache)
unsigned int pccache;
{
register unsigned int word;
asm("lea %0,-1[%1] \n\
xor %0,3 \n\
movzx %0,BYTE PTR [%0] \n\
" : "=r" (word) : "r" (pccache) );
return(word);
}
extern inline unsigned int Get_BYTE_PCMAC1fn (pccache)
unsigned int pccache;
{
register unsigned int word;
asm("lea %0,[%1] \n\
xor %0,3 \n\
movzx %0,BYTE PTR [%0] \n\
" : "=r" (word) : "r" (pccache) );
return(word);
}
extern inline unsigned int Get_BYTE_PCMAC2fn (pccache)
unsigned int pccache;
{
register unsigned int word;
asm("lea %0,1[%1] \n\
xor %0,3 \n\
movzx %0,BYTE PTR [%0] \n\
" : "=r" (word) : "r" (pccache) );
return(word);
}
extern inline unsigned int Get_BYTE_PCMAC3fn (pccache)
unsigned int pccache;
{
register unsigned int word;
asm("lea %0,2[%1] \n\
xor %0,3 \n\
movzx %0,BYTE PTR [%0] \n\
" : "=r" (word) : "r" (pccache) );
return(word);
}
#undef Get_DLword_PCMAC0
#undef Get_DLword_PCMAC1
#undef Get_DLword_PCMAC2
#undef Get_DLword_PCMAC3
#define Get_DLword_PCMAC0 Get_DLword_PCMAC0fn(pccache)
#define Get_DLword_PCMAC1 Get_DLword_PCMAC1fn(pccache)
#define Get_DLword_PCMAC2 Get_DLword_PCMAC2fn(pccache)
#define Get_DLword_PCMAC3 Get_DLword_PCMAC3fn(pccache)
extern inline unsigned int Get_DLword_PCMAC0fn(pccache)
unsigned int pccache;
{
register unsigned int word asm("ax");
asm("mov edx,%1 \n\
xor dl,3 \n\
movzx eax, byte ptr [edx] \n\
lea edx,-1[%1] \n\
xor dl,3 \n\
mov ah, byte ptr [edx] \n\
" : "=r" (word) : "r" (pccache) : "dx" );
return(word);
}
extern inline unsigned int Get_DLword_PCMAC1fn(pccache)
unsigned int pccache;
{
register unsigned int word asm("ax");
asm("lea edx,1[%1] \n\
xor dl,3 \n\
movzx eax, byte ptr [edx] \n\
lea edx,[%1] \n\
xor dl,3 \n\
mov ah, byte ptr [edx] \n\
" : "=r" (word) : "r" (pccache) : "dx" );
return(word);
}
extern inline unsigned int Get_DLword_PCMAC2fn(pccache)
unsigned int pccache;
{
register unsigned int word asm("ax");
asm("lea edx,2[%1] \n\
xor dl,3 \n\
movzx eax, byte ptr [edx] \n\
lea edx,1[%1] \n\
xor dl,3 \n\
mov ah, byte ptr [edx] \n\
" : "=r" (word) : "r" (pccache) : "dx" );
return(word);
}
extern inline unsigned int Get_DLword_PCMAC3fn(pccache)
unsigned int pccache;
{
register unsigned int word asm("ax");
asm("lea edx,3[%1] \n\
xor dl,3 \n\
movzx eax, byte ptr [edx] \n\
lea edx,2[%1] \n\
xor dl,3 \n\
mov ah, byte ptr [edx] \n\
" : "=r" (word) : "r" (pccache) : "dx" );
return(word);
}
#undef Get_Pointer_PCMAC0
#undef Get_Pointer_PCMAC1
#undef Get_Pointer_PCMAC2
#define Get_Pointer_PCMAC0 Get_Pointer_PCMAC0fn(pccache)
#define Get_Pointer_PCMAC1 Get_Pointer_PCMAC1fn(pccache)
#define Get_Pointer_PCMAC2 Get_Pointer_PCMAC2fn(pccache)
extern inline const unsigned int Get_Pointer_PCMAC0fn(pccache)
unsigned int pccache;
{
register unsigned int word asm("ax");
asm("lea edx,-1[%1] \n\
xor dl,3 \n\
movzx eax,byte ptr [edx] \n\
shl eax,16 \n\
lea edx,1[%1] \n\
xor dl,3 \n\
mov al,[edx] \n\
lea edx,[%1] \n\
xor dl,3 \n\
mov ah,[edx] \n\
" : "=r" (word) : "r" (pccache) : "dx" );
return(word);
}
extern inline const unsigned int Get_Pointer_PCMAC1fn(pccache)
unsigned int pccache;
{
register unsigned int word asm("ax");
asm("lea edx,[%1] \n\
xor dl,3 \n\
movzx eax,byte ptr [edx] \n\
shl eax,16 \n\
lea edx,2[%1] \n\
xor dl,3 \n\
mov al,[edx] \n\
lea edx,1[%1] \n\
xor dl,3 \n\
mov ah,[edx] \n\
" : "=r" (word) : "r" (pccache) : "dx" );
return(word);
}
extern inline const unsigned int Get_Pointer_PCMAC2fn(pccache)
unsigned int pccache;
{
register unsigned int word asm("ax");
asm("lea edx,1[%1] \n\
xor dl,3 \n\
movzx eax,byte ptr [edx] \n\
shl eax,16 \n\
lea edx,3[%1] \n\
xor dl,3 \n\
mov al,[edx] \n\
lea edx,2[%1] \n\
xor dl,3 \n\
mov ah,[edx] \n\
" : "=r" (word) : "r" (pccache) : "dx" );
return(word);
}
#undef DIFFERENCE
#undef IDIFFERENCE
#define DIFFERENCE { \
fast_op_difference(POP_TOS_1); \
fast1_dispatcher(); \
diff_err: \
asm volatile("diff_err:"); \
asm volatile("add bl,7"); \
asm volatile("ror ebx,15"); \
N_OP_POPPED_CALL_2(N_OP_difference, GET_POPPED); \
}
extern inline void fast_op_difference(LispPTR value)
{
asm volatile("\
mov eax,%0 \n\
rol ebx,15 \n\
sub bl,7 \n\
jne diff_err \n\
rol eax,17 \n\
sub al,7 \n\
jne diff_err \n\
sub eax,ebx \n\
jo diff_err \n\
ror eax,15 \n\
or eax,917504 \n\
mov ebx,eax \
" : : "g" (value) : "ax" );
}
#define IDIFFERENCE { \
fast_op_idifference(POP_TOS_1); \
fast1_dispatcher(); \
idiff_err: \
asm volatile("idiff_err:"); \
asm volatile("add bl,7"); \
asm volatile("ror ebx,15"); \
N_OP_POPPED_CALL_2(N_OP_idifference, GET_POPPED); \
}
extern inline void fast_op_idifference(LispPTR value)
{
asm volatile("\
mov eax,%0 \n\
rol ebx,15 \n\
sub bl,7 \n\
jne idiff_err \n\
rol eax,17 \n\
sub al,7 \n\
jne idiff_err \n\
sub eax,ebx \n\
jo idiff_err \n\
ror eax,15 \n\
or eax,917504 \n\
mov ebx,eax \
" : : "g" (value) : "ax" );
}
#undef IDIFFERENCE_N
#define IDIFFERENCE_N(n) { \
fast_op_idifferencen(n); \
fast2_dispatcher(); \
idiffn_err: \
asm("idiffn_err2:"); \
asm volatile("add ebx,eax ; undo the sub"); \
asm("idiffn_err:"); \
asm volatile("add bl,7"); \
asm volatile("ror ebx,15"); \
N_OP_CALL_1d(N_OP_idifferencen, n); \
}
extern inline void fast_op_idifferencen(LispPTR value)
{
asm volatile("\
mov eax,%0 \n\
rol eax,15 \n\
rol ebx,15 \n\
sub bl,7 \n\
jne idiffn_err \n\
sub ebx,eax \n\
jo idiffn_err2 \n\
ror ebx,15 \n\
or ebx,917504 \n\
" : : "g" (value) : "ax" );
}
#undef PLUS2
#undef IPLUS2
#define PLUS2 { \
fast_op_plus(POP_TOS_1); \
fast1_dispatcher(); \
plus_err: \
asm volatile("plus_err:"); \
asm volatile("add bl,7"); \
asm volatile("ror ebx,15"); \
N_OP_POPPED_CALL_2(N_OP_plus2, GET_POPPED); \
}
extern inline void fast_op_plus(LispPTR value)
{
asm volatile("\
mov eax,%0 \n\
rol ebx,15 \n\
sub bl,7 \n\
jne plus_err \n\
rol eax,15 \n\
sub al,7 \n\
jne plus_err \n\
add eax,ebx \n\
jo plus_err \n\
ror eax,15 \n\
or eax,917504 \n\
mov ebx,eax \n\
" : : "g" (value) : "ax" );
}
#define IPLUS2 { \
fast_op_iplus(POP_TOS_1); \
fast1_dispatcher(); \
iplus_err: \
asm volatile("iplus_err:"); \
asm volatile("add bl,7"); \
asm volatile("ror ebx,15"); \
N_OP_POPPED_CALL_2(N_OP_iplus2, GET_POPPED); \
}
extern inline void fast_op_iplus(LispPTR value)
{
asm volatile("\
mov eax,%0 \n\
rol ebx,15 \n\
sub bl,7 \n\
jne iplus_err \n\
rol eax,15 \n\
sub al,7 \n\
jne iplus_err \n\
add eax,ebx \n\
jo iplus_err \n\
ror eax,15 \n\
or eax,917504 \n\
mov ebx,eax \n\
" : : "g" (value) : "ax" );
}
#undef IPLUS_N
#define IPLUS_N(n) { \
fast_op_iplusn(n); \
fast2_dispatcher(); \
iplusn_err: \
asm("iplusn_err:"); \
asm volatile("add bl,7"); \
asm volatile("ror ebx,15"); \
N_OP_CALL_1d(N_OP_iplusn, n); \
}
extern inline void fast_op_iplusn(LispPTR value)
{
asm volatile("\
mov eax,%0 \n\
rol eax,15 \n\
rol ebx,15 \n\
sub bl,7 \n\
jne iplusn_err \n\
add eax,ebx \n\
jo iplusn_err \n\
ror eax,15 \n\
or eax,917504 \n\
mov ebx,eax \n\
" : : "g" (value) : "ax" );
}
#undef GREATERP
#define GREATERP { \
fast_op_greaterp(POP_TOS_1); \
fast1_dispatcher(); \
greaterp_err: \
asm("greaterp_err:"); \
N_OP_POPPED_CALL_2(N_OP_greaterp, GET_POPPED); \
}
extern inline void fast_op_greaterp(LispPTR value)
{
asm volatile("\
mov eax,%0 \n\
mov edx,ebx \n\
rol edx,15 \n\
sub dl,7 \n\
jne greaterp_err \n\
rol eax,15 \n\
sub al,7 \n\
jne greaterp_err \n\
xor ebx,ebx \n\
cmp eax,edx \n\
jle greater_no \n\
mov ebx,76 \n\
greater_no: " : : "g" (value) );
}
#undef IGREATERP
#define IGREATERP { \
fast_op_igreaterp(POP_TOS_1); \
fast1_dispatcher(); \
igreaterp_err: \
asm("igreaterp_err: "); \
N_OP_POPPED_CALL_2(N_OP_igreaterp, GET_POPPED); \
}
extern inline void fast_op_igreaterp(LispPTR value)
{
asm volatile("\
mov eax,%0 \n\
mov edx,ebx \n\
rol edx,15 \n\
sub dl,7 \n\
jne igreaterp_err \n\
rol eax,15 \n\
sub al,7 \n\
jne igreaterp_err \n\
xor ebx,ebx \n\
cmp eax,edx \n\
jle igreater_no \n\
mov ebx,76 \n\
igreater_no: " : : "g" (value) );
}
#undef LRSH8
#define LRSH8 { \
asm volatile("\
mov eax,ebx \n\
rol eax,16 \n\
cmp ax,0eh \n\
jne lrsh8_err \n\
shr bx,8 \n\
" : : : "ax" ); \
fast1_dispatcher(); \
lrsh8_err: \
asm("lrsh8_err: "); \
N_OP_CALL_1(N_OP_lrsh8); \
}
#undef LRSH1
#define LRSH1 { \
asm volatile("\
mov eax,ebx \n\
rol eax,16 \n\
cmp ax,0eh \n\
jne lrsh1_err \n\
shr bx,1 \n\
" : : : "ax" ); \
fast1_dispatcher(); \
lrsh1_err: \
asm("lrsh1_err: "); \
N_OP_CALL_1(N_OP_lrsh1); \
}
#undef LLSH8
#define LLSH8 { \
asm volatile("\
mov eax,ebx \n\
rol eax,16 \n\
cmp ax,0eh \n\
jne llsh8_err \n\
or bh,bh \n\
jne llsh8_err \n\
shl bx,8 \n\
" : : : "ax" ); \
fast1_dispatcher(); \
llsh8_err: \
asm("llsh8_err: "); \
N_OP_CALL_1(N_OP_llsh8); \
}
#undef LLSH1
#define LLSH1 { \
asm volatile("\
mov eax,ebx \n\
rol eax,16 \n\
cmp ax,0eh \n\
jne llsh1_err \n\
test bh,80h \n\
jne llsh1_err \n\
shl bx,1 \n\
" : : : "ax" ); \
fast1_dispatcher(); \
llsh1_err: \
asm("llsh1_err: "); \
N_OP_CALL_1(N_OP_llsh1); \
}
#undef LOGOR
#define LOGOR { \
fast_op_logor(POP_TOS_1); \
fast1_dispatcher(); \
logor_err: \
asm("logor_err:"); \
asm volatile("ror ebx,15"); \
N_OP_POPPED_CALL_2(N_OP_logor, GET_POPPED); \
}
extern inline void fast_op_logor(LispPTR value)
{
asm volatile("\
mov eax,%0 \n\
rol ebx,15 \n\
cmp bl,7 \n\
jne logor_err \n\
rol eax,15 \n\
cmp al,7 \n\
jne logor_err \n\
or ebx,eax \n\
ror ebx,15 \n\
" : : "g" (value) : "ax" );
}
#undef LOGAND
#define LOGAND { \
fast_op_logand(POP_TOS_1); \
fast1_dispatcher(); \
logand_err: \
asm("logand_err: "); \
asm volatile("ror ebx,15"); \
N_OP_POPPED_CALL_2(N_OP_logand, GET_POPPED); \
}
extern inline void fast_op_logand(LispPTR value)
{
asm volatile("\
mov eax,%0 \n\
rol ebx,15 \n\
cmp bl,7 \n\
jne logand_err \n\
rol eax,15 \n\
cmp al,7 \n\
jne logand_err \n\
and ebx,eax \n\
ror ebx,15 \n\
" : : "g" (value) : "ax" );
}
#undef LOGXOR
#define LOGXOR { \
fast_op_logxor(POP_TOS_1); \
fast1_dispatcher(); \
logxor_err: \
asm("logxor_err:"); \
asm volatile("ror ebx,15"); \
N_OP_POPPED_CALL_2(N_OP_logxor, GET_POPPED); \
}
extern inline void fast_op_logxor(LispPTR value)
{
asm volatile("\
mov eax,%0 \n\
rol ebx,15 \n\
cmp bl,7 \n\
jne logxor_err \n\
rol eax,15 \n\
sub al,7 \n\
jne logxor_err \n\
xor ebx,eax \n\
ror ebx,15 \n\
" : : "g" (value) : "ax" );
}
#undef N_OP_ADDBASE
#define N_OP_ADDBASE { \
fast_op_addbase(POP_TOS_1); \
fast1_dispatcher(); \
addbase_err: \
asm("addbase_err: "); \
asm volatile("ror ebx,15"); \
N_OP_POPPED_CALL_2(N_OP_addbase, GET_POPPED); \
}
extern inline void fast_op_addbase(LispPTR value)
{
asm volatile("\
mov eax,%0 \n\
rol ebx,15 \n\
cmp bl,7 \n\
jne addbase_err \n\
sar ebx,15 \n\
and eax,0ffffffh \n\
add ebx,eax \n\
" : : "g" (value) : "ax" );
}
#undef N_OP_LOLOC
#define N_OP_LOLOC { \
asm volatile(" \
and %0,0ffffh \n\
or %0,0e0000h" : "=r" (tscache) : "0" (tscache)); \
nextop1; }
#undef N_OP_HILOC
#define N_OP_HILOC { \
asm volatile(" \
shr %0,16 \n\
and %0,0ffffh \n\
or %0,0e0000h" : "=r" (tscache) : "0" (tscache)); \
nextop1; }
#undef N_OP_VAG2
#define N_OP_VAG2 \
{ \
asm(" sub edi,4"); \
asm(" mov eax,[edi]"); \
asm(" rol ebx,16"); \
asm(" mov bx,ax"); \
asm(" ror ebx,16"); \
nextop1; }

34
inc/kbdif.h Normal file
View File

@@ -0,0 +1,34 @@
#ifndef KBDIF_H
#define KBDIF_H 1
/* $Id: kbdif.h,v 1.2 1999/01/03 02:06:06 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1990, 1990, 1991, 1992, 1993, 1994, 1995 Venue. */
/* All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/************************************************************************/
#include <sys/types.h> /* for u_char */
/* The Keyboard structure. */
typedef struct {
u_char KeyMap[0x80];
#ifdef DOS
u_char lastbyte;
void (*prev_handler)();
#endif /* DOS */
void (* sync_device)(); /* Make reality and emulator coincide with each other */
void (* enter_device)();
void (* exit_device)();
void (* device_event)();
void (* before_raid)();
void (* after_raid)();
int lispkeycode;
#ifdef DOS
int device_active;
int device_locked;
#endif /* DOS */
} KbdInterfaceRec, *KbdInterface;
#endif /* KBDIF_H */

View File

@@ -1,7 +1,7 @@
#ifndef KEYEVENTDEFS_H
#define KEYEVENTDEFS_H 1
#include <sys/types.h>
void getsignaldata(int sig);
void process_io_events();
void kb_trans(u_short keycode, u_short upflg);
void taking_mouse_down(void);
void copy_cursor(int newx, int newy);

View File

@@ -13,23 +13,24 @@
/************************************************************************/
#ifdef LOCK_X_UPDATES
#define XLOCK { XLocked++; /* printf("L"); fflush(stdout);*/}
#define XUNLOCK \
{ XLocked--;/* printf("U"); fflush(stdout);*/ \
if (XNeedSignal) \
#define XLOCK do { XLocked++; } while (0)
#define XUNLOCK(dsp) \
do { \
if (XLocked == 1 && XNeedSignal) \
{ \
XNeedSignal = 0; \
kill(getpid(), SIGPOLL); \
}; \
}
getXsignaldata(dsp); \
}; \
XLocked--; \
} while (0)
#else
#define XLOCK
#define XUNLOCK
#endif /* LOCK_X_UPDATES */
extern int XLocked;
extern int XNeedSignal;
/* this is !0 if we're locked; it should be 0 or larger always */
#include <signal.h>
extern volatile sig_atomic_t XLocked;
extern volatile sig_atomic_t XNeedSignal;
#endif

47
inc/lispver1.h Normal file
View File

@@ -0,0 +1,47 @@
#ifndef LISPVER1_H
#define LISPVER1_H 1
/* $Id: lispver1.h,v 1.2 1999/01/03 02:06:08 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/* DOS version of LispVersionToUnixVersion */
#define LispVersionToUnixVersion(pathname, ver) \
{ \
\
register char *cp; \
register char *vp; \
char ver_buf[VERSIONLEN]; \
\
cp = pathname; \
vp = NULL; \
while (*cp) \
{ \
switch (*cp) \
{ \
\
case ';': \
*cp = 0; \
cp++; \
vp = cp; \
break; \
\
case '\'': \
if (*(cp + 1) != 0) cp += 2; \
else cp++; \
break; \
\
default: \
cp++; \
break; \
} \
} \
\
if (vp) \
{ \
NumericStringP(vp, YES, NO); \
NO: *vp = 0; \
YES: \
if ((*vp)) ver = strtol(vp, (char **)NULL, 10); \
else ver = -1; \
} \
else ver = -1; \
}
#endif /* LISPVER1_H */

View File

@@ -8,7 +8,7 @@
\
register char *lv_cp; \
register char *lv_vp; \
register int lv_ver; \
register unsigned lv_ver; \
char lv_ver_buf[VERSIONLEN]; \
\
lv_cp = pathname; \
@@ -48,12 +48,12 @@
/* \
* Convert the remaining field to digit. \
*/ \
lv_ver = atoi(lv_vp + 1); \
if (lv_ver == 0) { \
lv_ver = strtoul(lv_vp + 1, (char **)NULL, 10); \
if (lv_ver == 0) { \
/* versionless */ \
*lv_vp = 0; \
} else { \
sprintf(lv_ver_buf, ".~%d~", lv_ver); \
sprintf(lv_ver_buf, ".~%u~", lv_ver); \
*lv_vp = 0; \
strcat(pathname, lv_ver_buf); \
} \
@@ -61,7 +61,7 @@
\
NO: \
strcpy(lv_ver_buf, lv_vp + 1); \
strcat(lv_ver_buf, "~"); \
strcat(lv_ver_buf, "~"); \
*lv_vp++ = '.'; \
*lv_vp++ = '~'; \
*lv_vp = 0; \

View File

@@ -312,8 +312,16 @@ extern DLword *Lisp_world; /* To access LispSysout area */
* They might be lost in the course of the conversion.
*
*/
#ifdef DOS
/* DOS version of LispVersionToUnixVersion */
/* * * * * This is done this way because DOS can't handle the non-DOS version -- */
/* * * * * it gave "Too many characters in a character constant" errors! */
#include "lispver1.h"
#else /* DOS */
/* NON-DOS version of the macro LispVersionToUnixVersion */
#include "lispver2.h"
#endif /* DOS */
/*
@@ -377,9 +385,9 @@ extern DLword *Lisp_world; /* To access LispSysout area */
*(start - 1) = ';'; \
*start = '\0'; \
*end = '\0'; \
/* call ato i to eliminate leading 0s. */ \
ver_no = atoi(start + 1); \
sprintf(ver_buf, "%d", ver_no); \
/* call strtoul() to eliminate leading 0s. */ \
ver_no = strtoul(start + 1, (char **)NULL, 10); \
sprintf(ver_buf, "%u", ver_no); \
strcat(pathname, ver_buf); \
goto CONT; \
\
@@ -486,16 +494,20 @@ extern DLword *Lisp_world; /* To access LispSysout area */
#define MAXVERSION 999999999
#define LASTVERSIONARRAY (-1)
#define LASTVERSIONARRAY ((unsigned) -1)
#define VERSIONARRAYLENGTH 200
#define NoFileP(varray) \
(((varray)->version_no == LASTVERSIONARRAY)? 1 : 0)
#define OnlyVersionlessP(varray) \
#ifdef DOS
#define OnlyVersionlessP(varray) 0
#else
#define OnlyVersionlessP(varray) \
(((varray)->version_no == 0 && ((varray) + 1)->version_no == LASTVERSIONARRAY) ? \
1 : 0)
#endif /* DOS */
/* An argument of AddDotNoExtension must be LispVersion convention */
/* Like "foo/fee.fee;3" or "/foo/foo;3" */
@@ -610,6 +622,13 @@ extern int errno;
/* DRIVESEP = OS-specific drive separator character. */
/* (only used with DOS as of 3/93) */
/********************************************************/
#ifdef DOS
#define DIRSEP '\\'
#define DIRSEPSTR "\\"
#define DRIVESEP ':'
#define UNIXDIRSEP '/'
#define MAXNAMLEN _MAX_PATH
#else
#define DIRSEPSTR "/"
#define DIRSEP '/'
#define UNIXDIRSEP '/'
@@ -617,5 +636,6 @@ extern int errno;
#if !defined(MAXNAMLEN)
#define MAXNAMLEN NAME_MAX
#endif
#endif
#endif /* LOCFILE_H */

View File

@@ -31,7 +31,6 @@
#include "lispemul.h" /* for LispPTR, DLword */
#include "miscstat.h" /* for MISCSTAT */
extern DLword *Atomspace; /* ATOMSPACE */
extern DLword *Stackspace; /* STACKSPACE*/
extern DLword *Plistspace; /* PLISTSPACE */
extern DLword *DTDspace; /* DTDSPACE */
@@ -41,8 +40,6 @@
extern DLword *AtomSpace; /* New atoms, initial set */
extern DLword *Defspace; /* DEFSPACE */
extern DLword *Valspace; /* VALSPACE */
extern DLword *Spospspace; /* POSITIVE Smallp */
extern DLword *Snegspace; /* NEGATIVE Smallp */
/* For Virtual Mem Management */
#ifdef BIGVM
@@ -82,7 +79,6 @@ extern DLword *UFNTable ;
/* FLEX STORAGES */
extern DLword *Arrayspace; /* Start of ARRAYSPACE */
extern DLword *MDS_space_bottom; /* Start of MDS (pre -2) */
extern DLword *PnCharspace ; /* Space for PN char codes (Thin only) */

View File

@@ -39,6 +39,11 @@ extern volatile sig_atomic_t FP_error;
#define FPCLEAR FP_error = 0;
#define FPTEST(result) FP_error
#elif defined(DOS)
#include <i32.h>
#define FPCLEAR
#define FPTEST(result) (_getrealerror() & ( I87_ZERO_DIVIDE | I87_OVERFLOW | I87_UNDERFLOW))
#else
#include <math.h>
#define FPCLEAR

View File

@@ -5,6 +5,5 @@ DLword compute_hash(const char *char_base, DLword offset, DLword length);
DLword compute_lisp_hash(const char *char_base, DLword offset, DLword length, DLword fatp);
LispPTR compare_chars(register const char *char1, register const char *char2, register DLword length);
LispPTR compare_lisp_chars(register const char *char1, register const char *char2, register DLword length, DLword fat1, DLword fat2);
LispPTR make_atom(const char *char_base, DLword offset, DLword length, short int non_numericp);
LispPTR parse_number(const char *char_base, short int length);
LispPTR make_atom(const char *char_base, DLword offset, DLword length);
#endif

View File

@@ -3,5 +3,4 @@
#include "lispemul.h" /* for LispPTR, DLword */
LispPTR N_OP_createcell(register LispPTR tos);
DLword *createcell68k(unsigned int type);
LispPTR Create_n_Set_Cell(unsigned int type, LispPTR value);
#endif

View File

@@ -71,7 +71,7 @@
}
static inline LispPTR
aref_switch(int type, LispPTR tos, LispPTR baseL, int index)
aref_switch(unsigned type, LispPTR tos, LispPTR baseL, int index)
{
LispPTR result;
DLword *wordp;

View File

@@ -35,7 +35,7 @@
/* FAST case return use */
#ifndef RESWAPPEDCODESTREAM
#define FastRetCALL \
{ \
do { \
/* Get IVar from Returnee's IVAR offset slot(BF) */ \
IVar = Addr68k_from_LADDR(STK_OFFSET | GETWORD((DLword *)CURRENTFX -1)); \
/* Get FuncObj from Returnee's FNHEAD slot in FX */ \
@@ -43,10 +43,10 @@
Addr68k_from_LADDR(FX_FNHEADER); \
/* Get PC from Returnee's pc slot in FX */ \
PC = (ByteCode *)FuncObj + CURRENTFX->pc ; \
}
} while (0)
#else
#define FastRetCALL \
{ \
do { \
/* Get IVar from Returnee's IVAR offset slot(BF) */ \
IVar = Addr68k_from_LADDR(STK_OFFSET | GETWORD((DLword *)CURRENTFX -1)); \
/* Get FuncObj from Returnee's FNHEAD slot in FX */ \
@@ -59,7 +59,7 @@
byte_swap_code_block(FuncObj); \
FuncObj->byteswapped = 1; \
} \
}
} while (0)
#endif /* RESWAPPEDCODESTREAM */

View File

@@ -1,194 +1,150 @@
#ifndef SUBRS_H
#define SUBRS_H 1
/* $Id: subrs.h,v 1.2 1999/01/03 02:06:24 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/* This file written from LLSUBRS on 13-Sep-2021 15:19:22 */
/* Do not edit this file! Instead, edit the list \initsubrs */
/* on the lisp file LLSUBRS and then call WRITECALLSUBRS to */
/* generate a new version. */
#define sb_BACKGROUNDSUBR 06
#define sb_CHECKBCPLPASSWORD 07
#define sb_DISKPARTITION 010
#define sb_DSPBOUT 011
#define sb_DSPRATE 012
#define sb_GATHERSTATS 013
#define sb_GETPACKETBUFFER 014
#define sb_LISPFINISH 015
#define sb_MOREVMEMFILE 016
#define sb_RAID 017
#define sb_READRAWPBI 020
#define sb_WRITERAWPBI 021
#define sb_SETSCREENCOLOR 022
#define sb_SHOWDISPLAY 023
#define sb_PUPLEVEL1STATE 024
#define sb_WRITESTATS 025
#define sb_CONTEXTSWITCH 026
#define sb_COPYSYS0SUBR 027
#define sb_WRITEMAP 030
#define sb_UFS_GETFILENAME 042
#define sb_UFS_DELETEFILE 043
#define sb_UFS_RENAMEFILE 044
#define sb_COM_READPAGES 045
#define sb_COM_WRITEPAGES 046
#define sb_COM_TRUNCATEFILE 047
#define sb_UFS_DIRECTORYNAMEP 051
#define sb_COM_GETFREEBLOCK 055
#define sb_SETUNIXTIME 060
#define sb_GETUNIXTIME 061
#define sb_COPYTIMESTATS 062
#define sb_UNIX_USERNAME 063
#define sb_UNIX_FULLNAME 064
#define sb_UNIX_GETENV 065
#define sb_UNIX_GETPARM 066
#define sb_CHECK_SUM 067
#define sb_ETHER_SUSPEND 070
#define sb_ETHER_RESUME 071
#define sb_ETHER_AVAILABLE 072
#define sb_ETHER_RESET 073
#define sb_ETHER_GET 074
#define sb_ETHER_SEND 075
#define sb_ETHER_SETFILTER 076
#define sb_ETHER_CHECK 077
#define sb_DSPCURSOR 0100
#define sb_SETMOUSEXY 0101
#define sb_DSP_VIDEOCOLOR 0102
#define sb_DSP_SCREENWIDTH 0103
#define sb_DSP_SCREENHEIGHT 0104
#define sb_BITBLTSUB 0105
#define sb_BLTCHAR 0106
#define sb_TEDIT_BLTCHAR 0107
#define sb_BITBLT_BITMAP 0110
#define sb_BLTSHADE_BITMAP 0111
#define sb_RS232C_CMD 0112
#define sb_RS232C_READ_INIT 0113
#define sb_RS232C_WRITE 0114
#define sb_KEYBOARDBEEP 0120
#define sb_KEYBOARDMAP 0121
#define sb_KEYBOARDSTATE 0122
#define sb_VMEMSAVE 0131
#define sb_LISP_FINISH 0132
#define sb_NEWPAGE 0133
#define sb_DORECLAIM 0134
#define sb_DUMMY_135Q 0135
#define sb_NATIVE_MEMORY_REFERENCE 0136
#define sb_OLD_COMPILE_LOAD_NATIVE 0137 /* obsolete */
#define sb_DISABLEGC 0140
#define sb_COM_SETFILEINFO 0147
#define sb_COM_OPENFILE 0150
#define sb_COM_CLOSEFILE 0151
#define sb_DSK_GETFILENAME 0152
#define sb_DSK_DELETEFILE 0153
#define sb_DSK_RENAMEFILE 0154
#define sb_COM_NEXT_FILE 0156
#define sb_COM_FINISH_FINFO 0157
#define sb_COM_GEN_FILES 0160
#define sb_DSK_DIRECTORYNAMEP 0161
#define sb_COM_GETFILEINFO 0162
#define sb_COM_CHANGEDIR 0164
#define sb_UNIX_HANDLECOMM 0165
#define sb_OCR_COMM 0166
#define sb_RPC_CALL 0167
#define sb_MESSAGE_READP 0170
#define sb_MESSAGE_READ 0171
#define sb_MONITOR_CONTROL 0200
#define sb_GET_NATIVE_ADDR_FROM_LISP_PTR 0203
#define sb_GET_LISP_PTR_FROM_NATIVE_ADDR 0204
#define sb_LOAD_NATIVE_FILE 0205 /* obsolete */
#define sb_SUSPEND_LISP 0206
#define sb_NEW_BLTCHAR 0207
#define sb_COLOR_INIT 0210
#define sb_COLOR_SCREENMODE 0211
#define sb_COLOR_MAP 0212
#define sb_COLOR_BASE 0213
#define sb_C_SlowBltChar 0214
#define sb_TCP_OP 0220
#define sb_WITH_SYMBOL 0221
/* For linear-programming interface */
#define sb_LP_SETUP 0230
#define sb_LP_RUN 0231
/* For Native Windows */
#define sb_MNW_OP 0244
#define sb_QUERY_WINDOWS 0245
#define sb_FILL_IN 0246
/* DLD codes */
#define sb_CALL_C_FN 0247
#define sb_DLD_LINK 0250
#define sb_DLD_UNLINK_BY_FILE 0251
#define sb_DLD_UNLINK_BY_SYMBOL 0252
#define sb_DLD_GET_SYMBOL 0253
#define sb_DLD_GET_FUNC 0254
#define sb_DLD_FUNCTION_EXECUTABLE_P 0255
#define sb_DLD_LIST_UNDEFINED_SYM 0256
#define sb_MALLOC 0257
#define sb_FREE 0260
#define sb_PUT_C_BASEBYTE 0261
#define sb_GET_C_BASEBYTE 0262
#define sb_SMASHING_APPLY 0263
#ifdef TRUECOLOR
#define sb_PICTURE_OP 0250
#define sb_TRUE_COLOR_OP 0251
#ifdef VIDEO
#define sb_VIDEO_OP 0252
#endif /* VIDEO */
#endif /* TRUECOLOR */
#define sb_CHAR_OPENFILE 0310
#define sb_CHAR_BIN 0311
#define sb_CHAR_BOUT 0312
#define sb_CHAR_IOCTL 0313
#define sb_CHAR_CLOSEFILE 0314
#define sb_CHAR_EOFP 0315
#define sb_CHAR_READP 0316
#define sb_CHAR_BINS 0317
#define sb_CHAR_BOUTS 0320
#define sb_CHAR_FILLBUFFER 0321
/* on the lisp file LLSUBRS and then call WRITECALLSUBRS to */
/* generate a new version. */
#define sb_BACKGROUNDSUBR 06
#define sb_CHECKBCPLPASSWORD 07
#define sb_DISKPARTITION 010
#define sb_DSPBOUT 011
#define sb_DSPRATE 012
#define sb_GATHERSTATS 013
#define sb_GETPACKETBUFFER 014
#define sb_LISPFINISH 015
#define sb_MOREVMEMFILE 016
#define sb_RAID 017
#define sb_READRAWPBI 020
#define sb_WRITERAWPBI 021
#define sb_SETSCREENCOLOR 022
#define sb_SHOWDISPLAY 023
#define sb_PUPLEVEL1STATE 024
#define sb_WRITESTATS 025
#define sb_CONTEXTSWITCH 026
#define sb_COPYSYS0SUBR 027
#define sb_WRITEMAP 030
#define sb_UFS_GETFILENAME 042
#define sb_UFS_DELETEFILE 043
#define sb_UFS_RENAMEFILE 044
#define sb_COM_READPAGES 045
#define sb_COM_WRITEPAGES 046
#define sb_COM_TRUNCATEFILE 047
#define sb_UFS_DIRECTORYNAMEP 051
#define sb_COM_GETFREEBLOCK 055
#define sb_SETUNIXTIME 060
#define sb_GETUNIXTIME 061
#define sb_COPYTIMESTATS 062
#define sb_UNIX_USERNAME 063
#define sb_UNIX_FULLNAME 064
#define sb_UNIX_GETENV 065
#define sb_UNIX_GETPARM 066
#define sb_CHECK_SUM 067
#define sb_ETHER_SUSPEND 070
#define sb_ETHER_RESUME 071
#define sb_ETHER_AVAILABLE 072
#define sb_ETHER_RESET 073
#define sb_ETHER_GET 074
#define sb_ETHER_SEND 075
#define sb_ETHER_SETFILTER 076
#define sb_ETHER_CHECK 077
#define sb_DSPCURSOR 0100
#define sb_SETMOUSEXY 0101
#define sb_DSP_VIDEOCOLOR 0102
#define sb_DSP_SCREENWIDTH 0103
#define sb_DSP_SCREENHEIGHT 0104
#define sb_BITBLTSUB 0105
#define sb_BLTCHAR 0106
#define sb_TEDIT_BLTCHAR 0107
#define sb_BITBLT_BITMAP 0110
#define sb_BLTSHADE_BITMAP 0111
#define sb_RS232C_CMD 0112
#define sb_RS232C_READ_INIT 0113
#define sb_RS232C_WRITE 0114
#define sb_KEYBOARDBEEP 0120
#define sb_KEYBOARDMAP 0121
#define sb_KEYBOARDSTATE 0122
#define sb_VMEMSAVE 0131
#define sb_LISP_FINISH 0132
#define sb_NEWPAGE 0133
#define sb_DORECLAIM 0134
#define sb_DUMMY_135Q 0135
#define sb_NATIVE_MEMORY_REFERENCE 0136
#define sb_OLD_COMPILE_LOAD_NATIVE 0137
#define sb_DISABLEGC 0140
#define sb_COM_SETFILEINFO 0147
#define sb_COM_OPENFILE 0150
#define sb_COM_CLOSEFILE 0151
#define sb_DSK_GETFILENAME 0152
#define sb_DSK_DELETEFILE 0153
#define sb_DSK_RENAMEFILE 0154
#define sb_COM_NEXT_FILE 0156
#define sb_COM_FINISH_FINFO 0157
#define sb_COM_GEN_FILES 0160
#define sb_DSK_DIRECTORYNAMEP 0161
#define sb_COM_GETFILEINFO 0162
#define sb_COM_CHANGEDIR 0164
#define sb_UNIX_HANDLECOMM 0165
#define sb_RPC_CALL 0167
#define sb_MESSAGE_READP 0170
#define sb_MESSAGE_READ 0171
#define sb_MONITOR_CONTROL 0200
#define sb_GET_NATIVE_ADDR_FROM_LISP_PTR 0203
#define sb_GET_LISP_PTR_FROM_NATIVE_ADDR 0204
#define sb_LOAD_NATIVE_FILE 0205
#define sb_SUSPEND_LISP 0206
#define sb_NEW_BLTCHAR 0207
#define sb_COLOR_INIT 0210
#define sb_COLOR_SCREENMODE 0211
#define sb_COLOR_MAP 0212
#define sb_COLOR_BASE 0213
#define sb_C_SlowBltChar 0214
#define sb_UNCOLORIZE_BITMAP 0215
#define sb_COLORIZE_BITMAP 0216
#define sb_COLOR_8BPPDRAWLINE 0217
#define sb_TCP_OP 0220
#define sb_WITH_SYMBOL 0221
#define sb_CAUSE_INTERRUPT 0222
#define sb_OPEN_SOCKET 0240
#define sb_CLOSE_SOCKET 0241
#define sb_READ_SOCKET 0242
#define sb_WRITE_SOCKET 0243
#define sb_CALL_C_FUNCTION 0247
#define sb_DLD_LINK 0250
#define sb_DLD_UNLINK_BY_FILE 0251
#define sb_DLD_UNLINK_BY_SYMBOL 0252
#define sb_DLD_GET_SYMBOL 0253
#define sb_DLD_GET_FUNC 0254
#define sb_DLD_FUNCTION_EXECUTABLE_P 0255
#define sb_DLD_LIST_UNDEFINED_SYMBOLS 0256
#define sb_C_MALLOC 0257
#define sb_C_FREE 0260
#define sb_C_PUTBASEBYTE 0261
#define sb_C_GETBASEBYTE 0262
#define sb_CHAR_OPENFILE 0310
#define sb_CHAR_BIN 0311
#define sb_CHAR_BOUT 0312
#define sb_CHAR_IOCTL 0313
#define sb_CHAR_CLOSEFILE 0314
#define sb_CHAR_EOFP 0315
#define sb_CHAR_READP 0316
#define sb_CHAR_BINS 0317
#define sb_CHAR_BOUTS 0320
#define sb_CHAR_FILLBUFFER 0321
#define sb_YIELD 0322
/* MISCN opcodes */
#define miscn_USER_SUBR 00
#define miscn_VALUES 01
#define miscn_SXHASH 02
#define miscn_EQLHASHBITSFN 03
#define miscn_STRINGHASHBITS 04
#define miscn_STRING_EQUAL_HASHBITS 05
#define miscn_VALUES_LIST 06
#define miscn_LCFetchMethod 07
#define miscn_LCFetchMethodOrHelp 010
#define miscn_LCFindVarIndex 011
#define miscn_LCGetIVValue 012
#define miscn_LCPutIVValue 013
/* for accessing RAW RS232C port */
#define miscn_RAW_RS232C_OPEN 050
#define miscn_RAW_RS232C_CLOSE 051
#define miscn_RAW_RS232C_SETPARAM 052
#define miscn_RAW_RS232C_GETPARAM 053
#define miscn_RAW_RS232C_READ 054
#define miscn_RAW_RS232C_WRITE 055
#define miscn_RAW_RS232C_SETINT 056
/* for CHATTER */
#define miscn_CHATTER 040
/* for EJLISP */
#define miscn_EJLISP 060
#define miscn_USER_SUBR 00
#define miscn_VALUES 01
#define miscn_SXHASH 02
#define miscn_EQLHASHBITSFN 03
#define miscn_STRINGHASHBITS 04
#define miscn_STRING_EQUAL_HASHBITS 05
#define miscn_VALUES_LIST 06
#define miscn_LCFetchMethod 07
#define miscn_LCFetchMethodOrHelp 010
#define miscn_LCFindVarIndex 011
#define miscn_LCGetIVValue 012
#define miscn_LCPutIVValue 013
/* Assigned USER SUBR numbers */
#define user_subr_DUMMY 012
#define user_subr_SAMPLE_USER_SUBR 00
#define user_subr_DUMMY 012
#define user_subr_SAMPLE_USER_SUBR 00
#endif

View File

@@ -33,6 +33,7 @@ LispPTR *MakeAtom68k(char *string);
void GETTOPVAL(char *string);
void all_stack_dump(DLword start, DLword end, DLword silent);
void dtd_chain(DLword type);
void check_dtd_chain(DLword type);
void Trace_FNCall(int numargs, int atomindex, int arg1, LispPTR *tos);
void Trace_APPLY(int atomindex);
#endif

View File

@@ -61,8 +61,8 @@ extern int TIMEOUT_TIME;
/************************************************************************/
#define INTRSAFE(exp) \
do {} while ((int)(exp) == -1 && errno == EINTR)
do {errno = 0; } while ((exp) == -1 && errno == EINTR)
#define INTRSAFE0(exp) \
do {} while ((int)(exp) == 0 && errno == EINTR)
do {errno = 0; } while ((exp) == NULL && errno == EINTR)
#endif /* TIMEOUT_H */

View File

@@ -223,22 +223,10 @@
CSTKPTRL = (LispPTR *)(((DLword *)CSTKPTR) + FRAMESIZE); \
PVARL = (DLword *)CSTKPTR; \
{ \
register int result; \
result = LOCFNCELL->pv; \
if (result >= 0) { \
register LispPTR unboundval; \
unboundval = (LispPTR)0xffffffff; \
for (int pv = LOCFNCELL->pv; pv >= 0; pv--) { \
const LispPTR unboundval = 0xffffffff; \
HARD_PUSH(unboundval); \
HARD_PUSH(unboundval); \
if (result > 0) { \
HARD_PUSH(unboundval); \
HARD_PUSH(unboundval); \
result -= 1; \
for (; --result >= 0;) { \
HARD_PUSH(unboundval); \
HARD_PUSH(unboundval); \
} \
} \
} \
} \
CSTKPTRL += 1; \
@@ -291,22 +279,10 @@
CSTKPTRL = (LispPTR *)(((DLword *)CSTKPTR) + FRAMESIZE); \
PVARL = (DLword *)CSTKPTR; \
{ \
register int result; \
result = LOCFNCELL->pv; \
if (result >= 0) { \
register LispPTR unboundval; \
unboundval = (LispPTR)0xffffffff; \
for (int pv = LOCFNCELL->pv; pv >= 0; pv--) { \
const LispPTR unboundval = 0xffffffff; \
HARD_PUSH(unboundval); \
HARD_PUSH(unboundval); \
if (result > 0) { \
HARD_PUSH(unboundval); \
HARD_PUSH(unboundval); \
result -= 1; \
for (; --result >= 0;) { \
HARD_PUSH(unboundval); \
HARD_PUSH(unboundval); \
} \
} \
} \
} \
CSTKPTRL += 1; \
@@ -537,7 +513,8 @@
#ifndef BIGATOMS
#define EVAL \
do { \
LispPTR scratch, work, lookuped; \
LispPTR work, lookuped; \
DLword scratch[2]; \
switch (TOPOFSTACK & SEGMASK) { \
case S_POSITIVE: \
case S_NEGATIVE: \
@@ -545,8 +522,8 @@
case ATOM_OFFSET: \
if ((TOPOFSTACK == NIL_PTR) || (TOPOFSTACK == ATOM_T)) \
goto Hack_Label; \
nnewframe(CURRENTFX, &scratch, TOPOFSTACK & 0xffff); \
work = POINTERMASK & swapx(scratch); \
nnewframe(CURRENTFX, scratch, TOPOFSTACK & 0xffff); \
work = POINTERMASK & ((GETBASEWORD(scratch,1) << 16) | GETBASEWORD(scratch,0)); \
lookuped = *((LispPTR *)(Addr68k_from_LADDR(work))); \
if (lookuped == NOBIND_PTR) \
goto op_ufn; \
@@ -576,7 +553,8 @@
#else
#define EVAL \
do { \
LispPTR scratch, work, lookuped; \
LispPTR work, lookuped; \
DLword scratch[2]; \
switch (TOPOFSTACK & SEGMASK) { \
case S_POSITIVE: \
case S_NEGATIVE: \
@@ -584,8 +562,8 @@
case ATOM_OFFSET: \
if ((TOPOFSTACK == NIL_PTR) || (TOPOFSTACK == ATOM_T)) \
goto Hack_Label; \
nnewframe(CURRENTFX, &scratch, TOPOFSTACK & 0xffff); \
work = POINTERMASK & swapx(scratch); \
nnewframe(CURRENTFX, scratch, TOPOFSTACK & 0xffff); \
work = POINTERMASK & ((GETBASEWORD(scratch,1) << 16) | GETBASEWORD(scratch,0)); \
lookuped = *((LispPTR *)(Addr68k_from_LADDR(work))); \
if (lookuped == NOBIND_PTR) \
goto op_ufn; \
@@ -608,8 +586,8 @@
fn_apply = 0; \
goto op_fn_common; \
case TYPE_NEWATOM: \
nnewframe(CURRENTFX, &scratch, TOPOFSTACK); \
work = POINTERMASK & swapx(scratch); \
nnewframe(CURRENTFX, scratch, TOPOFSTACK); \
work = POINTERMASK & ((GETBASEWORD(scratch,1) << 16) | GETBASEWORD(scratch,0)); \
lookuped = *((LispPTR *)(Addr68k_from_LADDR(work))); \
if (lookuped == NOBIND_PTR) \
goto op_ufn; \

View File

@@ -5,7 +5,11 @@ LispPTR UFS_getfilename(LispPTR *args);
LispPTR UFS_deletefile(LispPTR *args);
LispPTR UFS_renamefile(LispPTR *args);
LispPTR UFS_directorynamep(LispPTR *args);
#ifdef DOS
int unixpathname(char *src, char *dst, int versionp, int genp, char *drive, int *extlenptr, char *rawname);
#else
int unixpathname(char *src, char *dst, int versionp, int genp);
#endif
int lisppathname(char *fullname, char *lispname, int dirp, int versionp);
int quote_fname(char *file);
int quote_fname_ufs(char *file);

View File

@@ -223,7 +223,6 @@ error Must specify RELEASE to build Medley.
#ifdef OS5
/* Solaris, sort of SYSV-ish, but not really */
#define MAIKO_ENABLE_ETHERNET
#define LOCK_X_UPDATES 1
#endif /* OS5 */
@@ -233,7 +232,15 @@ error Must specify RELEASE to build Medley.
/* */
/********************************************************/
#ifdef DOS
typedef unsigned char u_char;
typedef unsigned long u_int;
typedef unsigned short u_short;
#undef UNALIGNED_FETCH_OK
#define USHORT unsigned
#else
#define USHORT unsigned short
#endif /* DOS */
/****************************************************************/
/* End of architecture-specific flag settings */

View File

@@ -6,6 +6,6 @@
#include "devif.h" /* for DspInterface */
void Init_XCursor(void);
void Set_XCursor(int x, int y);
void init_Xcursor(Display *display, Window window);
void init_Xcursor(DspInterface dsp);
void set_Xcursor(DspInterface dsp, const uint8_t *bitmap, int hotspot_x, int hotspot_y, Cursor *return_cursor, int from_lisp);
#endif

View File

@@ -32,22 +32,25 @@
#include <unistd.h>
#include <signal.h>
extern int XLocked;
extern int XNeedSignal;
/* this is !0 if we're locked; it should be 0 or larger always */
#include "xwinmandefs.h"
#define XLOCK do { XLocked++; /* printf("L"); fflush(stdout);*/} while (0)
#define XUNLOCK \
do { XLocked--;/* printf("U"); fflush(stdout);*/ \
if (XNeedSignal) \
/* this is !0 if we're locked; it should be 0 or larger always */
extern volatile sig_atomic_t XLocked;
extern volatile sig_atomic_t XNeedSignal;
#define XLOCK do { XLocked++; } while (0)
#define XUNLOCK(dsp) \
do { \
if (XLocked == 1 && XNeedSignal) \
{ \
XNeedSignal = 0; \
kill(getpid(), SIGPOLL); \
getXsignaldata(dsp); \
}; \
XLocked--; \
} while (0)
#else
#define XLOCK
#define XUNLOCK
#define XUNLOCK(dsp)
#endif /* LOCK_X_UPDATES */
#endif /* XDEFS_H */

View File

@@ -6,5 +6,5 @@ void lisp_Xexit(DspInterface dsp);
void Xevent_before_raid(DspInterface dsp);
void Xevent_after_raid(DspInterface dsp);
void Open_Display(DspInterface dsp);
DspInterface X_init(DspInterface dsp, char *lispbitmap, int width_hint, int height_hint, int depth_hint);
DspInterface X_init(DspInterface dsp, LispPTR lispbitmap, int width_hint, int height_hint, int depth_hint);
#endif

View File

@@ -8,5 +8,5 @@ void Set_BitGravity(XButtonEvent *event, DspInterface dsp, Window window, int gr
void enable_Xkeyboard(DspInterface dsp);
void disable_Xkeyboard(DspInterface dsp);
void beep_Xkeyboard(DspInterface dsp);
void getXsignaldata(DspInterface dsp);
void process_Xevents(DspInterface dsp);
#endif

View File

@@ -33,7 +33,7 @@
/*** N_OP_aref1 -- op 266 (array index) ***/
LispPTR N_OP_aref1(register LispPTR arrayarg, register LispPTR inx) {
register LispPTR baseL;
register int type, index;
register int index;
register OneDArray *arrayblk;
/* verify array */
@@ -45,12 +45,9 @@ LispPTR N_OP_aref1(register LispPTR arrayarg, register LispPTR inx) {
if (index >= arrayblk->totalsize) ERROR_EXIT(inx);
index += arrayblk->offset;
/* setup typenumber */
type = 0xFF & arrayblk->typenumber;
/* setup base */
baseL = arrayblk->base;
/* disp on type */
return (aref_switch(type, inx, baseL, index));
return (aref_switch(arrayblk->typenumber, inx, baseL, index));
} /* end N_OP_aref1() */

View File

@@ -42,7 +42,6 @@
/************************************************************************/
LispPTR N_OP_aset1(register LispPTR data, LispPTR arrayarg, register int inx) {
register int type;
register OneDArray *arrayblk;
register LispPTR base;
register int new;
@@ -57,14 +56,11 @@ LispPTR N_OP_aset1(register LispPTR data, LispPTR arrayarg, register int inx) {
if (index >= arrayblk->totalsize) ERROR_EXIT(inx);
index += arrayblk->offset;
/* setup typenumber */
type = 0xFF & arrayblk->typenumber;
/* setup base */
base = arrayblk->base;
/* disp on type */
aset_switch(type, inx);
aset_switch(arrayblk->typenumber, inx);
doufn:
ERROR_EXIT(inx);

View File

@@ -41,7 +41,6 @@
LispPTR N_OP_aref2(LispPTR arrayarg, LispPTR inx0, LispPTR inx1) {
#define REG
LispPTR baseL;
int type;
int arindex, temp;
LispArray *arrayblk;
int j;
@@ -59,9 +58,6 @@ LispPTR N_OP_aref2(LispPTR arrayarg, LispPTR inx0, LispPTR inx1) {
arindex *= j;
arindex += temp;
/* setup typenumber */
type = 0xFF & arrayblk->typenumber;
/* disp on type */
return (aref_switch(type, inx1, baseL, arindex));
return (aref_switch(arrayblk->typenumber, inx1, baseL, arindex));
} /* end N_OP_aref2() */

View File

@@ -26,7 +26,6 @@
/*** N_OP_aset2 -- op 357 (new-value array index0 index1) ***/
LispPTR N_OP_aset2(register LispPTR data, LispPTR arrayarg, LispPTR inx0, LispPTR inx1) {
register int type;
register LispArray *arrayblk;
register LispPTR base;
register int new;
@@ -46,11 +45,8 @@ LispPTR N_OP_aset2(register LispPTR data, LispPTR arrayarg, LispPTR inx0, LispPT
index *= j;
index += temp;
/* setup typenumber */
type = 0xFF & arrayblk->typenumber;
/* disp on type */
aset_switch(type, inx1);
aset_switch(arrayblk->typenumber, inx1);
doufn:
ERROR_EXIT(inx1);

View File

@@ -28,19 +28,15 @@
#include <stdlib.h>
#ifdef XWINDOW
#ifndef DOS
#include <sys/ioctl.h>
#endif /* DOS */
#include <sys/types.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "xdefs.h"
#endif /* XWINDOW */
#ifdef SUNDISPLAY
#ifndef NOPIXRECT
#include <sunwindow/window_hs.h>
#include <sunwindow/win_ioctl.h>
#endif /* NOPIXRECT */
#endif /* SUNDISPLAY */
#include "lispemul.h"
#include "lspglob.h"
@@ -85,10 +81,8 @@ extern int kbd_for_makeinit;
};
#endif
#if !defined(SUNDISPLAY)
#include "devif.h"
extern DspInterface currentdsp;
#endif /* SUNDISPLAY */
#ifdef COLOR
extern int MonoOrColor;
@@ -99,7 +93,7 @@ extern int MonoOrColor;
/* take care of cursor movement & hiding */
/* (during bitblts to screen) ourselves. */
/*******************************************/
#if defined(SUNDISPLAY)
#if defined(SUNDISPLAY) || defined(DOS)
#define REALCURSOR
#else
#undef REALCURSOR
@@ -451,7 +445,11 @@ void bitbltsub(LispPTR *argv) {
}
do_it_now:
#ifdef DOS
currentdsp->device.locked++;
#else
ScreenLocked = T;
#endif /* DOS */
#ifdef REALCURSOR
displayflg |= n_new_cursorin(dstbase, dx, dty, w, h);
@@ -478,16 +476,26 @@ do_it_now:
#endif
#ifdef XWINDOW
XLOCK;
if (in_display_segment(dstbase)) flush_display_region(dx, dty, w, h);
XUNLOCK;
#endif /* XWINDOW */
#ifdef DOS
/* Copy the changed section of display bank to the frame buffer */
if (in_display_segment(dstbase)) {
/* DBPRINT(("bltsub: x %d, y %d, w %d, h %d.\n",dx, dty, w,h)); */
flush_display_region(dx, dty, w, h);
}
#endif /* DOS */
#ifdef REALCURSOR
if (displayflg) ShowCursor;
#endif /* REALCURSOR */
#ifdef DOS
currentdsp->device.locked--;
#else
ScreenLocked = NIL;
#endif /* DOS */
} /* end of bitbltsub */
@@ -823,11 +831,17 @@ do_it_now:
#endif
#ifdef XWINDOW
XLOCK;
if (in_display_segment(dstbase)) flush_display_region(dlx, dty, width, height);
XUNLOCK;
#endif /* XWINDOW */
#ifdef DOS
/* Copy the changed section of display bank to the frame buffer */
if (in_display_segment(dstbase)) {
/* DBPRINT(("bltsub: x %d, y %d, w %d, h %d.\n",dx, dty, w,h)); */
flush_display_region(dlx, dty, width, height);
}
#endif /* DOS */
#ifdef REALCURSOR
if (displayflg) ShowCursor;
#endif /* REALCURSOR */
@@ -1064,11 +1078,17 @@ do_it_now:
#endif
#ifdef XWINDOW
XLOCK;
if (in_display_segment(dstbase)) flush_display_region(left, dty, width, height);
XUNLOCK;
#endif /* XWINDOW */
#ifdef DOS
/* Copy the changed section of display bank to the frame buffer */
if (in_display_segment(dstbase)) {
/* DBPRINT(("bltsub: x %d, y %d, w %d, h %d.\n",dx, dty, w,h)); */
flush_display_region(left, dty, width, height);
}
#endif /* DOS */
#ifdef REALCURSOR
if (displayflg) ShowCursor;
#endif /* REALCURSOR */
@@ -1110,7 +1130,6 @@ bad_arg:
/* */
/* */
/************************************************************************/
#ifndef prropstyle
/********************************************************/
/* Non-PIXRECT version of the code */
/********************************************************/
@@ -1188,11 +1207,13 @@ void bltchar(LispPTR *args)
#endif
#ifdef XWINDOW
XLOCK;
if (in_display_segment(dstbase)) flush_display_lineregion(dx, dstbase, w, h);
XUNLOCK;
#endif /* XWINDOW */
#ifdef DOS
if (in_display_segment(dstbase)) flush_display_lineregion(dx, dstbase, w, h);
#endif /* DOS */
#ifdef REALCURSOR
if (displayflg) ShowCursor;
#endif /* REALCURSOR */
@@ -1200,96 +1221,6 @@ void bltchar(LispPTR *args)
UNLOCKSCREEN;
}
#else
/* prropstyle */
LispPTR bltchar(LispPTR *args)
/* args[0] : PILOTBBT
* args[1] : DISPLAYDATA
* args[2] : CHAR8CODE
* args[3] : CURX
* args[4] : LEFT
* args[5] : RIGHT
*/
{
register PILOTBBT *pbt;
register DISPLAYDATA *dspdata;
int x, y, destbpl, srcebpl, srcebit, distance;
int base;
register int displayflg;
unsigned int pix_op;
DLword *dstbase;
pbt = (PILOTBBT *)Addr68k_from_LADDR(((BLTC *)args)->pilotbbt);
dspdata = (DISPLAYDATA *)Addr68k_from_LADDR(((BLTC *)args)->displaydata);
(mpr_d(SrcePixRect))->md_image =
(short *)Addr68k_from_LADDR(VAG2(pbt->pbtsourcehi, pbt->pbtsourcelo));
dstbase = (mpr_d(DestPixRect))->md_image =
(short *)Addr68k_from_LADDR(VAG2(pbt->pbtdesthi, pbt->pbtdestlo));
SrcePixRect->pr_width = srcebpl = abs(pbt->pbtsourcebpl);
DestPixRect->pr_width = destbpl = abs(pbt->pbtdestbpl);
SrcePixRect->pr_height = DestPixRect->pr_height = pbt->pbtheight;
mpr_mdlinebytes(DestPixRect) = (destbpl + 7) >> 3;
mpr_mdlinebytes(SrcePixRect) = (srcebpl + 7) >> 3;
base = GETWORD(Addr68k_from_LADDR(dspdata->ddoffsetscache + ((BLTC *)args)->char8code));
srcebit = base + ((BLTC *)args)->left - ((BLTC *)args)->curx;
#ifdef REALCURSOR
/* if displayflg != 0 then source or destination is DisplayBitMap
* Now we consider about only destination
*/
displayflg = old_cursorin(pbt->pbtdesthi, pbt->pbtdestlo, ((BLTC *)args)->left, (((BLTC *)args)->right - ((BLTC *)args)->left),
pbt->pbtheight, y, pbt->pbtbackward);
#endif /* REALCURSOR */
/**** for DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG *****/
/* displayflg = T; */
/**** for DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG *****/
pix_op = PixOperation(pbt->pbtsourcetype, pbt->pbtoperation);
LOCKSCREEN;
#ifdef REALCURSOR
if (displayflg) HideCursor;
#endif /* REALCURSOR */
if (pr_rop(DestPixRect, ((BLTC *)args)->left, 0, (((BLTC *)args)->right - ((BLTC *)args)->left), pbt->pbtheight, pix_op,
SrcePixRect, srcebit, 0) != 0)
error("pilotbitblt: pr_rop failed\n");
#ifdef DISPLAYBUFFER
#ifdef COLOR
if (MonoOrColor == MONO_SCREEN)
#endif /* COLOR */
if (in_display_segment(dstbase)) {
/* DBPRINT(("bltchar pix: x %x, y %d, w %d, h %d.\n", ((BLTC *)args)->left, dstbase,
* (((BLTC *)args)->right - ((BLTC *)args)->left),pbt->pbtheight));
*/
flush_display_lineregion(((BLTC *)args)->left, dstbase, (((BLTC *)args)->right - ((BLTC *)args)->left), pbt->pbtheight);
}
#endif
#ifdef XWINDOW
XLOCK;
if (in_display_segment(dstbase))
flush_display_lineregion(((BLTC *)args)->left, dstbase, (((BLTC *)args)->right - ((BLTC *)args)->left), pbt->pbtheight);
XUNLOCK;
#endif /* XWINDOW */
#ifdef REALCURSOR
if (displayflg) ShowCursor;
#endif /* REALCURSOR */
ScreenLocked = NIL;
}
#endif
/************************************************************************/
/* */
@@ -1376,7 +1307,6 @@ LispPTR BLTCHAR_index; /* Atom # for \PUNTBLTCHAR punt fn */
LispPTR TEDIT_BLTCHAR_index; /* if NIL ,TEDIT is not yet loaded */
#ifndef prropstyle
/************************************************************************/
/* */
@@ -1493,6 +1423,9 @@ void newbltchar(LispPTR *args) {
#ifdef XWINDOW
if (in_display_segment(dstbase)) flush_display_lineregion(dx, dstbase, w, h);
#endif /* XWINDOW */
#ifdef DOS
if (in_display_segment(dstbase)) flush_display_lineregion(dx, dstbase, w, h);
#endif /* DOS */
#ifdef REALCURSOR
if (displayflg) ShowCursor;
@@ -1502,145 +1435,6 @@ void newbltchar(LispPTR *args) {
} /* end of newbltchar */
#else /* prropstyle */
/************************************************************************/
/* */
/* n e w b l t c h a r */
/* (PIXRECT version) */
/* */
/************************************************************************/
LispPTR newbltchar(LispPTR *args) {
register DISPLAYDATA *displaydata68k;
register int right, left, curx;
register PILOTBBT *pbt;
register int lmargin, rmargin, xoff;
int displayflg; /* T if cursor needs to be taken down */
displaydata68k = (DISPLAYDATA *)Addr68k_from_LADDR(((BLTARG *)args)->displaydata);
if ((displaydata68k->ddcharset & 0xFFFF) != ((BLTARG *)args)->charset) {
/* Currently, this has BUG, so I can't call it */
/*if(changecharset_display(displaydata68k,((BLTARG *)args)->charset) ==-1)*/
{ PUNT_TO_BLTCHAR; }
}
if (displaydata68k->ddslowprintingcase) { PUNT_TO_BLTCHAR; /** \SLOWBLTCHAR--return;**/ }
FGetNum(displaydata68k->ddxposition, curx);
FGetNum(displaydata68k->ddrightmargin, rmargin);
FGetNum(displaydata68k->ddleftmargin, lmargin);
FGetNum(displaydata68k->ddxoffset, xoff);
right =
curx +
GETWORD((DLword *)Addr68k_from_LADDR(displaydata68k->ddcharimagewidths + ((BLTARG *)args)->char8code));
if ((right > rmargin) && (curx > lmargin)) PUNT_TO_BLTCHAR;
if (((BLTARG *)args)->displaystream != *TOPWDS68k) PUNT_TO_BLTCHAR;
{
register int newpos;
newpos = curx +
GETWORD((DLword *)Addr68k_from_LADDR(displaydata68k->ddwidthscache + ((BLTARG *)args)->char8code));
if ((0 <= newpos) && (newpos < 65536))
(displaydata68k->ddxposition) = (LispPTR)(S_POSITIVE | newpos);
else if (-65537 < newpos)
(displaydata68k->ddxposition) = (LispPTR)(S_NEGATIVE | (0xffff & newpos));
else {
PUNT_TO_BLTCHAR;
}
}
curx += xoff;
right += xoff;
if (right > (int)(displaydata68k->ddclippingright)) right = displaydata68k->ddclippingright;
if (curx > (int)(displaydata68k->ddclippingleft))
left = curx;
else
left = displaydata68k->ddclippingleft;
if (left < right) {
pbt = (PILOTBBT *)Addr68k_from_LADDR(displaydata68k->ddpilotbbt);
if (pbt->pbtheight != 0) {
/****** OLD bltchar *****/
register int destbpl, srcebpl, sourcebit;
DLword *dstbase;
int base, y;
(mpr_d(SrcePixRect))->md_image =
(short *)Addr68k_from_LADDR(VAG2(pbt->pbtsourcehi, pbt->pbtsourcelo));
dstbase = (mpr_d(DestPixRect))->md_image =
(short *)Addr68k_from_LADDR(VAG2(pbt->pbtdesthi, pbt->pbtdestlo));
SrcePixRect->pr_width = srcebpl = abs(pbt->pbtsourcebpl);
DestPixRect->pr_width = destbpl = abs(pbt->pbtdestbpl);
SrcePixRect->pr_height = DestPixRect->pr_height = pbt->pbtheight;
mpr_mdlinebytes(DestPixRect) = (destbpl + 7) >> 3;
mpr_mdlinebytes(SrcePixRect) = (srcebpl + 7) >> 3;
base = GETBASE(Addr68k_from_LADDR(displaydata68k->ddoffsetscache), ((BLTARG *)args)->char8code);
sourcebit = base + left - curx;
LOCKSCREEN;
#ifdef SUNDISPLAY
if (displayflg = old_cursorin(pbt->pbtdesthi, pbt->pbtdestlo, left, (right - left),
pbt->pbtheight, y, pbt->pbtbackward)) {
HideCursor;
if (pr_rop(DestPixRect, left, 0, (right - left), pbt->pbtheight,
PixOperation(pbt->pbtsourcetype, pbt->pbtoperation), SrcePixRect, sourcebit,
0) != 0)
error("pilotbitblt: pr_rop failed\n");
/* Save SHOWCURSOR 'til after paint to screen */
#ifndef DISPLAYBUFFER
ShowCursor;
#endif
} /* display case */
else {
if (pr_rop(DestPixRect, left, 0, (right - left), pbt->pbtheight,
PixOperation(pbt->pbtsourcetype, pbt->pbtoperation), SrcePixRect, sourcebit,
0) != 0)
error("pilotbitblt: pr_rop failed\n");
} /* else */
#ifdef DISPLAYBUFFER
#ifdef COLOR
if (MonoOrColor == MONO_SCREEN)
#endif /* COLOR */
if (in_display_segment(dstbase)) {
/* DBPRINT(("newbltchar: x %d, y 0x%x, w %d, h %d.\n", left, dstbase,
* (right - left), pbt->pbtheight)); */
flush_display_lineregion(left, dstbase, (right - left), pbt->pbtheight);
if (displayflg) ShowCursor; /* because hide is done earlier */
}
#endif
#endif /* SUNDISPLAY */
#ifdef XWINDOW
if (pr_rop(DestPixRect, left, 0, (right - left), pbt->pbtheight,
PixOperation(pbt->pbtsourcetype, pbt->pbtoperation), SrcePixRect, sourcebit,
0) != 0)
error("pilotbitblt: pr_rop failed\n");
if (in_display_segment(dstbase))
flush_display_lineregion(left, dstbase, (right - left), pbt->pbtheight);
#endif /* XWINDOW */
ScreenLocked = NIL;
/****** OLD bltchar *****/
}
}
} /* newbltchar */
#endif
/******************************************************************/
#ifndef BYTESWAP
@@ -1938,7 +1732,6 @@ void ccfuncall(register unsigned int atom_index, register int argnum, register i
/* */
/****************************************************************/
#ifndef prropstyle
/***************************/
/* Non-PIXRECT version */
/***************************/
@@ -1996,67 +1789,6 @@ void tedit_bltchar(LispPTR *args)
#undef backwardflg
} /* end tedit_bltchar */
#else
/* pr_op style */
/**********************/
/* PIXRECT version */
/**********************/
void tedit_bltchar(LispPTR *args)
{
register DISPLAYDATA *displaydata68k;
register int left, right;
register PILOTBBT *pbt;
register int imagewidth, newx;
register displayflg;
displaydata68k = (DISPLAYDATA *)Addr68k_from_LADDR(((TBLTARG *)args)->displaydata);
if (displaydata68k->ddcharset != ((TBLTARG *)args)->charset) {
/**if(changecharset_display(displaydata68k, ((TBLTARG *)args)->charset)== -1)**/
{ PUNT_TO_TEDIT_BLTCHAR; }
}
imagewidth = *((DLword *)Addr68k_from_LADDR(displaydata68k->ddcharimagewidths + ((TBLTARG *)args)->char8code));
newx = ((TBLTARG *)args)->current_x + imagewidth;
left = IMAX(0, ((TBLTARG *)args)->current_x);
right = IMIN(newx, ((TBLTARG *)args)->clipright);
LOCKSCREEN;
if (left < right) {
pbt = (PILOTBBT *)Addr68k_from_LADDR(displaydata68k->ddpilotbbt);
if (pbt->pbtheight) {
(mpr_d(SrcePixRect))->md_image =
(short *)Addr68k_from_LADDR(VAG2(pbt->pbtsourcehi, pbt->pbtsourcelo));
(mpr_d(DestPixRect))->md_image =
(short *)Addr68k_from_LADDR(VAG2(pbt->pbtdesthi, pbt->pbtdestlo));
{
register int srcebpl, destbpl;
SrcePixRect->pr_width = srcebpl = abs(pbt->pbtsourcebpl);
DestPixRect->pr_width = destbpl = abs(pbt->pbtdestbpl);
SrcePixRect->pr_height = DestPixRect->pr_height = pbt->pbtheight;
mpr_mdlinebytes(DestPixRect) = (destbpl + 7) >> 3;
mpr_mdlinebytes(SrcePixRect) = (srcebpl + 7) >> 3;
}
pbt->pbtwidth = IMIN(imagewidth, (right - left));
pbt->pbtsourcebit =
GETBASE(Addr68k_from_LADDR(displaydata68k->ddoffsetscache), ((TBLTARG *)args)->char8code);
if (pr_rop(DestPixRect, left, 0, pbt->pbtwidth, pbt->pbtheight,
PixOperation(pbt->pbtsourcetype, pbt->pbtoperation), SrcePixRect,
pbt->pbtsourcebit, 0) != 0)
error("pilotbitblt: pr_rop failed\n");
} /* if pbt->pbtheight */
} /* if left<right */
UNLOCKSCREEN;
} /* end tedit_bltchar */
#endif
#if defined(REALCURSOR) || defined(SUNDISPLAY)
#ifndef COLOR

View File

@@ -33,7 +33,7 @@ LispPTR *N_OP_bind(register LispPTR *stack_pointer, register LispPTR tos, int by
register int n1; /* # slots to bind to NIL (0, 0) */
register int n2; /* # slots to bind to value in stack */
register LispPTR *ppvar; /* pointer to argued slot in Pvar area */
register int i; /* temporary for control */
register unsigned i; /* temporary for control */
#ifdef TRACE
printPC();

View File

@@ -12,16 +12,6 @@
#include <stdio.h>
#ifdef SUNDISPLAY
#include <sunwindow/window_hs.h>
#include <sunwindow/win_ioctl.h>
#include <suntool/sunview.h>
#include <sunwindow/cms_mono.h>
#include <suntool/canvas.h>
#include <sys/ioctl.h>
#include <signal.h>
#endif
#ifdef XWINDOW
#define DISPLAYBUFFER
@@ -46,6 +36,13 @@
extern int kbd_for_makeinit;
#endif
#ifdef DOS
#include "devif.h"
#include "iopage.h"
extern DspInterface currentdsp;
extern IOPAGE *IOPage68K;
#endif
extern int LispWindowFd;
extern int ScreenLocked;
@@ -66,7 +63,7 @@ LispPTR N_OP_pilotbitblt(LispPTR pilot_bt_tbl,int tos)
{
PILOTBBT *pbt;
DLword *srcbase, *dstbase;
#if defined(SUNDISPLAY)
#if defined(SUNDISPLAY) || defined(DOS)
int displayflg;
#endif
int sx, dx, w, h, srcbpl, dstbpl, backwardflg;
@@ -98,9 +95,13 @@ LispPTR N_OP_pilotbitblt(LispPTR pilot_bt_tbl,int tos)
sx = pbt->pbtsourcebit;
backwardflg = pbt->pbtbackward;
/* if displayflg != 0 then source or destination is DisplayBitMap */
#ifdef DOS
currentdsp->device.locked++;
#else
ScreenLocked = T;
#endif /* DOS */
#if SUNDISPLAY
#if SUNDISPLAY || DOS
displayflg = cursorin(pbt->pbtdesthi, (pbt->pbtdestlo + (dx >> 4)), w, h, backwardflg) ||
cursorin(pbt->pbtsourcehi, (pbt->pbtsourcelo + (sx >> 4)), w, h, backwardflg);
#endif /* SUNDISPLAY */
@@ -116,28 +117,27 @@ LispPTR N_OP_pilotbitblt(LispPTR pilot_bt_tbl,int tos)
num_gray = ((TEXTUREBBT *)pbt)->pbtgrayheightlessone + 1;
curr_gray_line = ((TEXTUREBBT *)pbt)->pbtgrayoffset;
#ifdef SUNDISPLAY
if (displayflg) HideCursor;
#endif /* SUNDISPLAY */
#if DOS
if (displayflg) (currentdsp->mouse_invisible)(currentdsp, IOPage68K);
;
#endif /* SUNDISPLAY / DOS */
new_bitblt_code
#ifdef SUNDISPLAY
#ifdef DISPLAYBUFFER
#ifdef COLOR
if (MonoOrColor == MONO_SCREEN)
#endif /* COLOR */
if (in_display_segment(dstbase)) flush_display_lineregion(dx, dstbase, w, h);
#endif
if (displayflg) ShowCursor;
#endif /* SUNDISPLAY */
#if DOS
flush_display_lineregion(dx, dstbase, w, h);
if (displayflg) (currentdsp->mouse_visible)(IOPage68K->dlmousex, IOPage68K->dlmousey);
#endif /* SUNDISPLAY / DOS */
#ifdef XWINDOW
flush_display_lineregion(dx, dstbase, w, h);
#endif /* XWINDOW */
#ifdef DOS
currentdsp->device.locked--;
#else
ScreenLocked = NIL;
#endif /* DOS */
return (pilot_bt_tbl);

View File

@@ -25,6 +25,7 @@
#include <string.h>
#include <unistd.h>
#ifndef DOS
#include <dirent.h>
#include <stdio.h>
#include <sys/types.h>
@@ -33,6 +34,7 @@
#include <sys/param.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#endif /* DOS */
#include "lispemul.h"
#include "lispmap.h"
@@ -73,6 +75,7 @@ LispPTR CHAR_openfile(LispPTR *args)
/* args[1] access */
/* args[2] errno */
{
#ifndef DOS
register int fd; /* return value of open system call. */
register int flags; /* open system call's argument */
/* struct stat statbuf; */
@@ -103,6 +106,7 @@ LispPTR CHAR_openfile(LispPTR *args)
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
return (GetSmallp(fd));
#endif /* DOS */
}
/************************************************************************/
@@ -123,6 +127,7 @@ LispPTR CHAR_closefile(LispPTR *args)
/* args[0] fd */
/* args[1] errno */
{
#ifndef DOS
register int fd; /* file descriptor */
register int rval;
Lisp_errno = (int *)(Addr68k_from_LADDR(args[1]));
@@ -143,6 +148,7 @@ LispPTR CHAR_closefile(LispPTR *args)
return (NIL);
}
return (ATOM_T);
#endif /* DOS */
}
/************************************************************************/
@@ -165,6 +171,7 @@ LispPTR CHAR_closefile(LispPTR *args)
LispPTR CHAR_ioctl(LispPTR *args)
{
#ifndef DOS
int fd, request;
void *data;
register int rval;
@@ -180,6 +187,7 @@ LispPTR CHAR_ioctl(LispPTR *args)
return (NIL);
}
return (ATOM_T);
#endif /* DOS */
}
/************************************************************************/
@@ -195,6 +203,7 @@ LispPTR CHAR_ioctl(LispPTR *args)
LispPTR CHAR_bin(int fd, LispPTR errn)
{
#ifndef DOS
register int rval;
unsigned char ch[4];
Lisp_errno = (int *)(Addr68k_from_LADDR(errn));
@@ -211,6 +220,7 @@ LispPTR CHAR_bin(int fd, LispPTR errn)
return (NIL);
}
return (GetSmallp(ch[0]));
#endif /* DOS */
}
/************************************************************************/
@@ -225,6 +235,7 @@ LispPTR CHAR_bin(int fd, LispPTR errn)
LispPTR CHAR_bout(int fd, LispPTR ch, LispPTR errn)
{
#ifndef DOS
register int rval;
char buf[4];
Lisp_errno = (int *)(Addr68k_from_LADDR(errn));
@@ -243,6 +254,7 @@ LispPTR CHAR_bout(int fd, LispPTR ch, LispPTR errn)
return (NIL);
}
return (ATOM_T);
#endif /* DOS */
}
/************************************************************************/
@@ -268,6 +280,7 @@ LispPTR CHAR_bout(int fd, LispPTR ch, LispPTR errn)
LispPTR CHAR_bins(LispPTR *args)
{
#ifndef DOS
register int fd, rval;
char *buffer;
int nbytes;
@@ -292,6 +305,7 @@ LispPTR CHAR_bins(LispPTR *args)
#endif /* BYTESWAP */
return (GetSmallp(rval));
#endif /* DOS */
}
/************************************************************************/
@@ -317,6 +331,7 @@ LispPTR CHAR_bins(LispPTR *args)
LispPTR CHAR_bouts(LispPTR *args)
{
#ifndef DOS
register int fd, rval;
char *buffer;
int nbytes;
@@ -344,4 +359,5 @@ LispPTR CHAR_bouts(LispPTR *args)
return (NIL);
}
return (GetSmallp(rval));
#endif /* DOS */
}

View File

@@ -91,6 +91,7 @@ int error(const char *cp) {
fflush(stdout); fflush(stderr);
URaid_currentFX = URMAXFXNUM + 1;
memset(URaid_FXarray, 0, URMAXFXNUM * 4);
#ifndef DOS
{
int stat = fcntl(fileno(stdin), F_GETFL, 0);
if (stat != O_RDONLY && stat != O_RDWR)
@@ -99,6 +100,7 @@ int error(const char *cp) {
exit(0);
}
}
#endif /* DOS */
uraidloop:
if (setjmp(BT_jumpbuf) == 1) goto uraidloop;
if (setjmp(SD_jumpbuf) == 1) goto uraidloop;

View File

@@ -67,6 +67,18 @@ extern int URaid_ArrMAXIndex;
int BT_lines;
int BT_temp;
jmp_buf BT_jumpbuf;
#ifdef DOS
#define BTMAXLINE 24
/* DOS has a 25-line screen, and getchar discards ESC for some reason */
#define BT_morep \
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 \
if (++BT_lines > BTMAXLINE) { \
@@ -76,6 +88,7 @@ jmp_buf BT_jumpbuf;
BT_lines = 0; \
if (BT_temp == 27) longjmp(BT_jumpbuf, 1); \
}
#endif /* DOS */
/***************************************************************/
/*

560
src/dir.c
View File

@@ -18,9 +18,16 @@
#include <sys/types.h>
#include <unistd.h>
#ifndef DOS
#include <dirent.h>
#include <pwd.h>
#include <sys/param.h>
#else /* DOS, now */
#include <dos.h>
#define MAXPATHLEN _MAX_PATH
#define MAXNAMLEN _MAX_PATH
#define alarm(x) 1
#endif /* DOS */
#include "lispemul.h"
#include "lispmap.h"
@@ -139,6 +146,12 @@ static int match_pattern(char *tp, char *pp)
register char *tsp, *psp;
register int inastr;
#ifdef DOS
/* % is not allowed in DOS names for Medley. */
if (strchr(tp, '%')) return 0;
#endif /* DOS */
for (tsp = tp, psp = pp, inastr = 0;; tp++, pp++) {
switch (*pp) {
case '\0': return ((*tp == '\0') ? 1 : 0);
@@ -178,6 +191,29 @@ static int match_pattern(char *tp, char *pp)
}
}
#ifdef DOS
int make_old_version(char *old, char *file)
{
int len = (int)strlen(file) - 1;
if (file[len] == DIRCHAR) return 0;
/* look up old versions of files for version # 0's */
strcpy(old, file);
if (old[len] == '.')
strcat(old, "%");
else if ((len > 0) && old[len - 1] == '.')
strcat(old, "%");
else if ((len > 1) && old[len - 2] == '.')
strcat(old, "%");
else if ((len > 2) && old[len - 3] == '.')
old[len] = '%';
else
strcat(old, ".%");
return 1;
}
#endif /* DOS */
/************************************************************************/
/******** E N D O F P A T T E R N - M A T C H I N G C O D E *******/
/************************************************************************/
@@ -293,7 +329,7 @@ void print_finfo(FINFO *fp)
if (fp != (FINFO *)NULL) {
do {
printf("%s -> ", fp->lname);
printf("%d\n", fp->version);
printf("%u\n", fp->version);
fp = fp->next;
} while (fp != (FINFO *)NULL && fp != sp);
@@ -411,6 +447,167 @@ static int get_finfo_id() {
* of FINFO structures.
*/
#ifdef DOS
static int enum_dsk_prop(char *dir, char *name, char *ver, FINFO **finfo_buf)
{
register struct direct *dp;
register FINFO *prevp;
register FINFO *nextp;
int n, len, rval, res, isslash = 0, drive = 0;
struct find_t dirp;
register struct passwd *pwd;
struct stat sbuf;
char namebuf[MAXPATHLEN];
char fver[VERSIONLEN];
char old[MAXNAMLEN];
/* The null directory has to be special cased */
/* because adjacent \'s in the pathname don't match anything */
if (dir[1] == DRIVESEP) drive = dir[0];
if (strcmp(dir, "\\") == 0)
isslash = 1;
else if (drive && (strcmp(dir + 2, "\\") == 0))
isslash = 1;
if (!isslash)
strcpy(namebuf, dir); /* Only add the dir if it's real */
else if (drive) {
namebuf[0] = drive;
namebuf[1] = DRIVESEP;
namebuf[2] = '\0';
} else
*namebuf = '\0';
strcat(namebuf, DIRSEPSTR);
strcat(namebuf, name);
TIMEOUT(res = _dos_findfirst(namebuf, _A_NORMAL | _A_SUBDIR, &dirp));
if (res < 0) {
*Lisp_errno = errno;
return (-1);
}
for (nextp = prevp = (FINFO *)NULL, n = 0; res == 0;
S_TOUT(res = _dos_findnext(&dirp)), prevp = nextp) {
if (strcmp(dirp.name, ".") == 0 || strcmp(dirp.name, "..") == 0) continue;
MatchP(dirp.name, name, ver, match, unmatch);
unmatch:
continue;
match:
AllocFinfo(nextp);
if (nextp == (FINFO *)NULL) {
FreeFinfo(prevp);
*Lisp_errno = errno;
return (-1);
}
nextp->next = prevp;
if (isslash) {
if (drive)
sprintf(namebuf, "%c:\\%s", drive, dirp.name);
else
sprintf(namebuf, "\\%s", dirp.name);
} else
sprintf(namebuf, "%s\\%s", dir, dirp.name);
TIMEOUT(rval = stat(namebuf, &sbuf));
if (rval == -1 && errno != ENOENT) {
/*
* ENOENT error might be caused by missing symbolic
* link. We should ignore such error here.
*/
FreeFinfo(nextp);
*Lisp_errno = errno;
return (-1);
}
strcpy(namebuf, dirp.name);
if (sbuf.st_mode & S_IFDIR) {
nextp->dirp = 1;
quote_dname(namebuf);
strcpy(nextp->lname, namebuf);
len = strlen(namebuf);
*(nextp->lname + len) = DIRCHAR;
*(nextp->lname + len + 1) = '\0';
nextp->lname_len = len + 1;
} else {
/* All other types than directory. */
nextp->dirp = 0;
strcat(namebuf, ".~1~");
quote_fname(namebuf);
len = strlen(namebuf);
strcpy(nextp->lname, namebuf);
*(nextp->lname + len) = '\0';
nextp->lname_len = len;
}
strcpy(namebuf, dirp.name);
len = strlen(namebuf);
DOWNCASE(namebuf);
strcpy(nextp->no_ver_name, namebuf);
nextp->version = 1;
nextp->ino = sbuf.st_ino;
nextp->prop->length = (unsigned)sbuf.st_size;
nextp->prop->wdate = (unsigned)ToLispTime(sbuf.st_mtime);
nextp->prop->rdate = (unsigned)ToLispTime(sbuf.st_atime);
nextp->prop->protect = (unsigned)sbuf.st_mode;
/* TIMEOUT(pwd = getpwuid(sbuf.st_uid));
if (pwd == (struct passwd *)NULL) {
nextp->prop->au_len = 0;
} else {
len = strlen(pwd->pw_name);
strcpy(nextp->prop->author, pwd->pw_name);
*(nextp->prop->author + len) = '\0';
nextp->prop->au_len = len;
} */
n++;
}
/***********************/
/* Now go looking for version-0 entries */
/***********************/
for (nextp = prevp; nextp; nextp = nextp->next) {
FINFO *newp;
if (!make_old_version(old, nextp->no_ver_name)) continue;
if (isslash) {
if (drive)
sprintf(namebuf, "%c:\\%s", drive, old);
else
sprintf(namebuf, "\\%s", old);
} else
sprintf(namebuf, "%s\\%s", dir, old);
TIMEOUT(rval = stat(namebuf, &sbuf));
if (rval == -1) continue;
AllocFinfo(newp);
newp->next = prevp;
/* All other types than directory. */
newp->dirp = 0;
sprintf(namebuf, "%s.~00~", nextp->no_ver_name);
quote_fname(namebuf);
len = strlen(namebuf);
strcpy(newp->lname, namebuf);
*(newp->lname + len) = '\0';
newp->lname_len = len;
strcpy(newp->no_ver_name, old);
newp->version = 0;
newp->ino = sbuf.st_ino;
newp->prop->length = (unsigned)sbuf.st_size;
newp->prop->wdate = (unsigned)ToLispTime(sbuf.st_mtime);
newp->prop->rdate = (unsigned)ToLispTime(sbuf.st_atime);
newp->prop->protect = (unsigned)sbuf.st_mode;
n++;
prevp = newp;
}
if (n > 0) *finfo_buf = prevp;
return (n);
}
#else /* DOS */
static int enum_dsk_prop(char *dir, char *name, char *ver, FINFO **finfo_buf)
{
register struct dirent *dp;
@@ -488,13 +685,13 @@ static int enum_dsk_prop(char *dir, char *name, char *ver, FINFO **finfo_buf)
if (*fver == '\0')
nextp->version = 0;
else
nextp->version = atoi(fver);
nextp->version = strtoul(fver, (char **)NULL, 10);
nextp->ino = sbuf.st_ino;
nextp->prop->length = (unsigned)sbuf.st_size;
nextp->prop->wdate = (unsigned)ToLispTime(sbuf.st_mtime);
nextp->prop->rdate = (unsigned)ToLispTime(sbuf.st_atime);
nextp->prop->protect = (unsigned)sbuf.st_mode;
TIMEOUT(pwd = getpwuid(sbuf.st_uid));
TIMEOUT0(pwd = getpwuid(sbuf.st_uid));
if (pwd == (struct passwd *)NULL) {
nextp->prop->au_len = 0;
} else {
@@ -509,6 +706,7 @@ static int enum_dsk_prop(char *dir, char *name, char *ver, FINFO **finfo_buf)
if (n > 0) *finfo_buf = prevp;
return (n);
}
#endif /* DOS */
/*
* Name: enum_dsk
@@ -529,6 +727,150 @@ static int enum_dsk_prop(char *dir, char *name, char *ver, FINFO **finfo_buf)
*
* Similar to enum_dsk_prop, but file properties are not stored.
*/
#ifdef DOS
static int enum_dsk(char *dir, char *name, char *ver, FINFO **finfo_buf)
{
register struct direct *dp;
register FINFO *prevp;
register FINFO *nextp;
int n, len, rval, isslash = 0, drive = 0;
struct find_t dirp;
struct stat sbuf;
char namebuf[MAXPATHLEN];
char fver[VERSIONLEN];
char old[MAXPATHLEN];
/* The null directory has to be special cased */
/* because adjacent \'s in the pathname don't match anything */
if (dir[1] == DRIVESEP) drive = dir[0];
if (strcmp(dir, "\\") == 0)
isslash = 1;
else if (drive && (strcmp(dir + 2, "\\") == 0))
isslash = 1;
if (!isslash)
strcpy(namebuf, dir); /* Only add the dir if it's real */
else if (drive) {
namebuf[0] = drive;
namebuf[1] = DRIVESEP;
namebuf[2] = '\0';
} else
*namebuf = '\0';
strcat(namebuf, DIRSEPSTR);
strcat(namebuf, name);
TIMEOUT(rval = _dos_findfirst(namebuf, _A_NORMAL | _A_SUBDIR, &dirp));
if (rval != 0) {
*Lisp_errno = errno;
return (-1);
}
for (nextp = prevp = (FINFO *)NULL, n = 0; rval == 0;
S_TOUT(rval = _dos_findnext(&dirp)), prevp = nextp) {
if (strcmp(dirp.name, ".") == 0 || strcmp(dirp.name, "..") == 0) continue;
MatchP(dirp.name, name, ver, match, unmatch);
unmatch:
continue;
match:
AllocFinfo(nextp);
if (nextp == (FINFO *)NULL) {
FreeFinfo(prevp);
*Lisp_errno = errno;
return (-1);
}
nextp->next = prevp;
if (isslash) {
if (drive)
sprintf(namebuf, "%c:\\%s", drive, dirp.name);
else
sprintf(namebuf, "\\%s", dirp.name);
} else
sprintf(namebuf, "%s\\%s", dir, dirp.name);
TIMEOUT(rval = stat(namebuf, &sbuf));
if (rval == -1 && errno != ENOENT) {
/*
* ENOENT error might be caused by missing symbolic
* link. We should ignore such error here.
*/
FreeFinfo(nextp);
*Lisp_errno = errno;
return (-1);
}
strcpy(namebuf, dirp.name); /* moved from below 2/26/93 */
if (sbuf.st_mode & S_IFDIR) {
nextp->dirp = 1;
quote_dname(namebuf);
strcpy(nextp->lname, namebuf);
len = strlen(namebuf);
*(nextp->lname + len) = DIRCHAR;
*(nextp->lname + len + 1) = '\0';
nextp->lname_len = len + 1;
} else {
/* All other types than directory. */
nextp->dirp = 0;
strcat(namebuf, ".~1~");
quote_fname(namebuf);
len = strlen(namebuf);
strcpy(nextp->lname, namebuf);
*(nextp->lname + len) = '\0';
nextp->lname_len = len;
}
strcpy(namebuf, dirp.name); /* to get real versionless name */
len = strlen(namebuf);
DOWNCASE(namebuf);
strcpy(nextp->no_ver_name, namebuf);
nextp->version = 1;
nextp->ino = sbuf.st_ino;
n++;
}
/***********************/
/* Now go looking for version-0 entries */
/***********************/
for (nextp = prevp; nextp; nextp = nextp->next) {
FINFO *newp;
if (!make_old_version(old, nextp->no_ver_name)) continue;
if (isslash) {
if (drive)
sprintf(namebuf, "%c:\\%s", drive, old);
else
sprintf(namebuf, "\\%s", old);
} else
sprintf(namebuf, "%s\\%s", dir, old);
TIMEOUT(rval = stat(namebuf, &sbuf));
if (rval == -1) continue;
AllocFinfo(newp);
newp->next = prevp;
/* All other types than directory. */
newp->dirp = 0;
sprintf(namebuf, "%s.~00~", nextp->no_ver_name);
quote_fname(namebuf);
len = strlen(namebuf);
strcpy(newp->lname, namebuf);
*(newp->lname + len) = '\0';
newp->lname_len = len;
strcpy(newp->no_ver_name, old);
newp->version = 0;
newp->ino = sbuf.st_ino;
n++;
prevp = newp;
}
if (n > 0) *finfo_buf = prevp;
return (n);
}
#else /* DOS */
static int enum_dsk(char *dir, char *name, char *ver, FINFO **finfo_buf)
{
@@ -606,7 +948,7 @@ static int enum_dsk(char *dir, char *name, char *ver, FINFO **finfo_buf)
if (*fver == '\0')
nextp->version = 0;
else
nextp->version = atoi(fver);
nextp->version = strtoul(fver, (char **)NULL, 10);
nextp->ino = sbuf.st_ino;
n++;
}
@@ -614,6 +956,7 @@ static int enum_dsk(char *dir, char *name, char *ver, FINFO **finfo_buf)
if (n > 0) *finfo_buf = prevp;
return (n);
}
#endif /* DOS */
/*
* Name: enum_ufs_prop
@@ -637,6 +980,93 @@ static int enum_dsk(char *dir, char *name, char *ver, FINFO **finfo_buf)
* File properties Lisp will need later are also stored in the result linked list
* of FINFO structures.
*/
#ifdef DOS
static int enum_ufs_prop(char *dir, char *name, char *ver, FINFO **finfo_buf)
{
register struct direct *dp;
register FINFO *prevp;
register FINFO *nextp;
int n, len, rval;
struct find_t dirp;
/* register struct passwd *pwd; -- From author support */
struct stat sbuf;
char namebuf[MAXPATHLEN];
TIMEOUT(rval = _dos_findfirst(dir, _A_SUBDIR, &dirp));
if (rval != 0) {
*Lisp_errno = errno;
return (-1);
}
for (nextp = prevp = (FINFO *)NULL, n = 0; rval == 0;
S_TOUT(rval = _dos_findnext(&dirp)), prevp = nextp) {
if (strcmp(dirp.name, ".") == 0 || strcmp(dirp.name, "..") == 0) continue;
MatchP_Case(dirp.name, name, ver, match, unmatch);
unmatch:
continue;
match:
AllocFinfo(nextp);
if (nextp == (FINFO *)NULL) {
FreeFinfo(prevp);
*Lisp_errno = errno;
return (-1);
}
nextp->next = prevp;
sprintf(namebuf, "%s\\%s", dir, dirp.name);
TIMEOUT(rval = stat(namebuf, &sbuf));
if (rval == -1 && errno != ENOENT) {
/*
* ENOENT error might be caused by missing symbolic
* link. We should ignore such error here.
*/
FreeFinfo(nextp);
*Lisp_errno = errno;
return (-1);
}
strcpy(namebuf, dirp.name);
if (sbuf.st_mode & S_IFDIR) {
nextp->dirp = 1;
quote_dname(namebuf);
strcpy(nextp->lname, namebuf);
len = strlen(namebuf);
*(nextp->lname + len) = DIRCHAR;
*(nextp->lname + len + 1) = '\0';
nextp->lname_len = len + 1;
} else {
/* All other types than directory. */
nextp->dirp = 0;
quote_fname_ufs(namebuf);
len = strlen(namebuf);
strcpy(nextp->lname, namebuf);
*(nextp->lname + len) = '\0';
nextp->lname_len = len;
}
strcpy(namebuf, dirp.name);
len = strlen(namebuf);
nextp->ino = sbuf.st_ino;
nextp->prop->length = (unsigned)sbuf.st_size;
nextp->prop->wdate = (unsigned)ToLispTime(sbuf.st_mtime);
nextp->prop->rdate = (unsigned)ToLispTime(sbuf.st_atime);
nextp->prop->protect = (unsigned)sbuf.st_mode;
/*
TIMEOUT(pwd = getpwuid(sbuf.st_uid));
if (pwd == (struct passwd *)NULL) {
nextp->prop->au_len = 0;
} else {
len = strlen(pwd->pw_name);
strcpy(nextp->prop->author, pwd->pw_name);
*(nextp->prop->author + len) = '\0';
nextp->prop->au_len = len;
}
*/
n++;
}
if (n > 0) *finfo_buf = prevp;
return (n);
}
#else /* DOS */
static int enum_ufs_prop(char *dir, char *name, char *ver, FINFO **finfo_buf)
{
register struct dirent *dp;
@@ -650,7 +1080,7 @@ static int enum_ufs_prop(char *dir, char *name, char *ver, FINFO **finfo_buf)
char namebuf[MAXPATHLEN];
errno = 0;
TIMEOUT(dirp = opendir(dir));
TIMEOUT0(dirp = opendir(dir));
if (dirp == NULL) {
*Lisp_errno = errno;
return (-1);
@@ -729,6 +1159,7 @@ static int enum_ufs_prop(char *dir, char *name, char *ver, FINFO **finfo_buf)
if (n > 0) *finfo_buf = prevp;
return (n);
}
#endif /* DOS */
/*
* Name: enum_ufs
@@ -749,6 +1180,77 @@ static int enum_ufs_prop(char *dir, char *name, char *ver, FINFO **finfo_buf)
*
* Similar to enum_ufs_prop, but file properties are not stored.
*/
#ifdef DOS
static int enum_ufs(char *dir, char *name, char *ver, FINFO **finfo_buf)
{
register struct direct *dp;
register FINFO *prevp;
register FINFO *nextp;
int n, len, rval;
struct find_t dirp;
struct stat sbuf;
char namebuf[MAXPATHLEN];
TIMEOUT(rval = _dos_findfirst(dir, _A_SUBDIR, &dirp));
if (rval != 0) {
*Lisp_errno = errno;
return (-1);
}
for (nextp = prevp = (FINFO *)NULL, n = 0; rval == 0;
S_TOUT(rval = _dos_findnext(&dirp)), prevp = nextp) {
if (strcmp(dirp.name, ".") == 0 || strcmp(dirp.name, "..") == 0) continue;
MatchP_Case(dirp.name, name, ver, match, unmatch);
unmatch:
continue;
match:
AllocFinfo(nextp);
if (nextp == (FINFO *)NULL) {
FreeFinfo(prevp);
*Lisp_errno = errno;
return (-1);
}
nextp->next = prevp;
sprintf(namebuf, "%s\\%s", dir, dirp.name);
TIMEOUT(rval = stat(namebuf, &sbuf));
if (rval == -1 && errno != ENOENT) {
/*
* ENOENT error might be caused by missing symbolic
* link. We should ignore such error here.
*/
FreeFinfo(nextp);
*Lisp_errno = errno;
return (-1);
}
strcpy(namebuf, dirp.name);
if (sbuf.st_mode & S_IFDIR) {
nextp->dirp = 1;
quote_dname(namebuf);
strcpy(nextp->lname, namebuf);
len = strlen(namebuf);
*(nextp->lname + len) = DIRCHAR;
*(nextp->lname + len + 1) = '\0';
nextp->lname_len = len + 1;
} else {
/* All other types than directory. */
nextp->dirp = 0;
quote_fname_ufs(namebuf);
len = strlen(namebuf);
strcpy(nextp->lname, namebuf);
*(nextp->lname + len) = '\0';
nextp->lname_len = len;
}
strcpy(namebuf, dirp.name);
len = strlen(namebuf);
nextp->ino = sbuf.st_ino;
n++;
}
if (n > 0) *finfo_buf = prevp;
return (n);
}
#else /* DOS */
static int enum_ufs(char *dir, char *name, char *ver, FINFO **finfo_buf)
{
register struct dirent *dp;
@@ -761,7 +1263,7 @@ static int enum_ufs(char *dir, char *name, char *ver, FINFO **finfo_buf)
char namebuf[MAXPATHLEN];
errno = 0;
TIMEOUT(dirp = opendir(dir));
TIMEOUT0(dirp = opendir(dir));
if (dirp == NULL) {
*Lisp_errno = errno;
return (-1);
@@ -825,6 +1327,7 @@ static int enum_ufs(char *dir, char *name, char *ver, FINFO **finfo_buf)
if (n > 0) *finfo_buf = prevp;
return (n);
}
#endif /* DOS*/
/*
* Name: trim_finfo
@@ -846,6 +1349,7 @@ static int enum_ufs(char *dir, char *name, char *ver, FINFO **finfo_buf)
static int trim_finfo(FINFO **fp)
{
#ifndef DOS
register FINFO *tp, *sp, *mp, *cp, *pp;
register int num, pnum;
int linkp;
@@ -895,7 +1399,7 @@ static int trim_finfo(FINFO **fp)
* Versionless is not linked to any versioned
* file.
*/
sprintf(ver, ";%d", mp->version + 1);
sprintf(ver, ";%u", mp->version + 1);
strcat(sp->lname, ver);
sp->lname_len = strlen(sp->lname);
pnum = ++num;
@@ -944,6 +1448,16 @@ static int trim_finfo(FINFO **fp)
}
} while (sp != (FINFO *)NULL);
#else /* DOS version */
int num = 0;
FINFO *tp;
tp = *fp;
while (tp) {
num++;
tp = tp->next;
}
#endif /* DOS */
return (num);
}
@@ -1013,7 +1527,7 @@ static int trim_finfo_highest(FINFO **fp, int highestp)
* Versionless is not linked to any versioned
* file.
*/
sprintf(ver, ";%d", mp->version + 1);
sprintf(ver, ";%u", mp->version + 1);
strcat(sp->lname, ver);
sp->lname_len = strlen(sp->lname);
/*
@@ -1088,7 +1602,7 @@ static int trim_finfo_highest(FINFO **fp, int highestp)
* Name: trim_finfo_version
*
* Argument: FINFO **fp Linked list of the numerated FINFO structures.
* int rver Requested version number.
* unsigned rver Requested version number.
*
* Value: Returns the total number of files still remaining in **fp.
*
@@ -1100,7 +1614,7 @@ static int trim_finfo_highest(FINFO **fp, int highestp)
* are got rid of.
*/
static int trim_finfo_version(FINFO **fp, int rver)
static int trim_finfo_version(FINFO **fp, unsigned rver)
{
register FINFO *tp, *sp, *mp, *cp, *pp, *vp;
register int num, pnum;
@@ -1195,7 +1709,7 @@ static int trim_finfo_version(FINFO **fp, int rver)
* file.
*/
if (mp->version + 1 == rver) {
sprintf(ver, ";%d", rver);
sprintf(ver, ";%u", rver);
strcat(sp->lname, ver);
sp->lname_len = strlen(sp->lname);
/*
@@ -1326,13 +1840,16 @@ static FINFO **prepare_sort_buf(register FINFO *fp, register int n)
static int dsk_filecmp(FINFO **fp1, FINFO **fp2)
{
register int res, v1, v2;
register int res;
unsigned v1, v2;
if ((res = strcmp((*fp1)->no_ver_name, (*fp2)->no_ver_name)) != 0) return (res);
if ((*fp1)->version == (*fp2)->version) return (0);
#ifndef DOS
if ((v1 = (*fp1)->version) == 0) return (-1);
if ((v2 = (*fp2)->version) == 0) return (1);
#endif /* DOS */
return ((v1 < v2) ? 1 : -1);
}
@@ -1513,7 +2030,11 @@ LispPTR COM_gen_files(register LispPTR *args)
{
char fbuf[MAXPATHLEN + 5], dir[MAXPATHLEN], pattern[MAXPATHLEN];
char host[MAXNAMLEN], name[MAXNAMLEN], ver[VERSIONLEN];
int dskp, count, highestp, propp, fid, version;
#ifdef DOS
char drive[1];
#endif
int dskp, count, highestp, fid;
unsigned propp, version;
register char *cp;
FINFO *fp;
int dsk_filecmp(), unix_filecmp();
@@ -1534,7 +2055,11 @@ LispPTR COM_gen_files(register LispPTR *args)
if (count > MAXPATHLEN + 5) FileNameTooLong((GetSmallp(-1)));
LispStringToCString(args[0], fbuf, MAXPATHLEN);
#ifdef DOS
separate_host(fbuf, host, drive);
#else
separate_host(fbuf, host);
#endif /* DOS */
UPCASE(host);
if (strcmp(host, "DSK") == 0)
@@ -1568,7 +2093,11 @@ LispPTR COM_gen_files(register LispPTR *args)
* to do some trick here.
*/
#ifdef DOS
if (!unixpathname(fbuf, pattern, 1, 1, drive, 0, 0)) {
#else
if (!unixpathname(fbuf, pattern, 1, 1)) {
#endif /* DOS */
/* Yes, always dskp is on */
return (GetSmallp(-1));
}
@@ -1584,7 +2113,7 @@ LispPTR COM_gen_files(register LispPTR *args)
if (*ver != '\0') {
highestp = 0;
version = atoi(ver);
version = strtoul(ver, (char **)NULL, 10);
if (version > 0) strcpy(ver, "*");
} else {
version = 0;
@@ -1666,7 +2195,8 @@ LispPTR COM_next_file(register LispPTR *args)
register char *base;
register DFINFO *dfp;
register UFSGFS *gfsp;
int finfoid, propp;
int finfoid;
unsigned propp;
ERRSETJMP(-1);
Lisp_errno = &Dummy_errno;

14
src/doscomm.c Normal file
View File

@@ -0,0 +1,14 @@
/* $Id: doscomm.c,v 1.3 1999/05/31 23:35:27 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved
*/
/************************************************************************/
/* */
/* (C) Copyright 1989, 1990, 1990, 1991, 1992, 1993, 1994, 1995 Venue. */
/* All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/************************************************************************/
#include "version.h"
DOS_handlecomm(int args) {}

314
src/doskbd.c Normal file
View File

@@ -0,0 +1,314 @@
/* $Id: doskbd.c,v 1.2 1999/01/03 02:06:55 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved
*/
/************************************************************************/
/* */
/* D O S K E Y B O A R D H A N D L E R */
/* */
/* */
/************************************************************************/
/************************************************************************/
/* */
/* (C) Copyright 1989, 1990, 1990, 1991, 1992, 1993, 1994, 1995 Venue. */
/* All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/************************************************************************/
#include "version.h"
#include <dos.h> /* defines REGS & other structs */
#include <i32.h> /* "#pragma interrupt" & '_chain_intr'*/
#include <stk.h>
#include <conio.h>
#include "lispemul.h"
#include "keyboard.h"
#include "keysym.h"
#include "devif.h"
int nokbdflag = FALSE;
extern int eurokbd;
extern KbdInterface currentkbd;
extern MouseInterface currentmouse;
extern IOPAGE *IOPage68K;
extern IFPAGE *InterfacePage;
extern int KBDEventFlg;
extern keybuffer *CTopKeyevent;
extern LispPTR *LASTUSERACTION68k;
extern LispPTR *KEYBUFFERING68k;
/************************************************/
/* Keyboard-Interface Registers, Status Codes */
/************************************************/
#define KBD_COMMAND_PORT 0x64 /* I/O port commands go out on */
#define KBD_ENABLE 0xAE
#define KBD_DISABLE 0xAD
#define KBD_RESET 0xF6
#define PORT_8042 0x60 /* Port scan codes come in on */
#define KBD_SCAN_CODE_PORT 0x60
#define KBD_resend 0xFE /* KBD asked for resend */
#define KBD_ack 0xFA /* KBD ack's our command */
#define KBD_echo_response 0xEE /* KBD responds to echo req */
#define KBD_failure 0xFD /* Failure code */
#define KBD_prefix 0xE0 /* Prefix for extended chars */
#define KBD_pause_prefix 0xE1 /* Pause prefix?? */
#define KBD_overflow 0x00 /* Overflow of some kind */
#define KBD_overrun 0xFF /* KBD buffer overrun */
#define KBD_STATUS_PORT 0x64 /* Port KBD status comes in on */
#define KBD_INP_FULL 0x02 /* input buffer full */
#define INTA00 0x20 /* The 8259 port, to reset irq */
#define ENDOFINTERRUPT 0x20
#define PRTSC_KEY 0x37 /* Keyboard codes for extended chars */
#define HOME_KEY 0x47
#define UPARROW_KEY 0x48
#define PGUP_KEY 0x49
#define LEFTARROW_KEY 0x4b
#define RIGHTARROW_KEY 0x4d
#define END_KEY 0x4f
#define DOWNARROW_KEY 0x50
#define PGDOWN_KEY 0x51
#define INS_KEY 0x52
#define DEL_KEY 0x53
/******************************************************/
/* Tell the Interrupt-dispatch IC we're done, and */
/* Tell the keyboard itself that we're ready again. */
/* */
/* (This process is critical to the proper function */
/* of the handler, so let's do it once, correctly.) */
/******************************************************/
#define ENABLE_KBD \
{ \
outp(INTA00, ENDOFINTERRUPT); \
outp(KBD_COMMAND_PORT, KBD_ENABLE); /* Turn kbd on again. */ \
}
/************************************************************************/
/* */
/* K B D _ E V E N T */
/* */
/* Keyboard interrupt handler routine */
/************************************************************************/
extern DLword *DisplayRegion68k;
#pragma interrupt(Kbd_event)
void Kbd_event() {
_XSTACK *ebp; /* Real-mode handler stack frame */
DLword w, r;
KBEVENT *kbevent;
unsigned char keycode, tmpkey;
ebp = (_XSTACK *)_get_stk_frame(); /* Get stack frame address */
ebp->opts |= _STK_NOINT; /* Bypass real-mode handler */
/*************************************************/
/* First, get the scan code from the keyboard. */
/* Handle exceptional conditions & errors, and */
/* the extended-character prefix, 0xE0 */
/* generated for, e.g., the INSERT key. */
/*************************************************/
_disable(); /* prevent further interrupts from killing us */
outp(KBD_COMMAND_PORT, KBD_DISABLE); /* Turn the kbd off. */
do { tmpkey = inp(KBD_STATUS_PORT); } while (tmpkey & KBD_INP_FULL);
/* Finite state machine that either returns or goes to label handle: */
switch (tmpkey = inp(KBD_SCAN_CODE_PORT)) {
case KBD_overflow: /* Ignore these. */
case KBD_pause_prefix:
case KBD_echo_response:
case KBD_ack:
case KBD_failure:
case KBD_resend:
case KBD_overrun:
ENABLE_KBD;
return;
break;
case KBD_prefix: /* It's a prefix, so really use next char. */
/* Remember that we saw the prefix: */
currentkbd->lastbyte = tmpkey;
ENABLE_KBD;
return;
break;
default:
tmpkey = inp(KBD_SCAN_CODE_PORT);
if (currentkbd->lastbyte == KBD_prefix)
switch (tmpkey) /* deal with prefixed characters */
{
case 0x2A: /* by ignoring some (what are they??) */
case 0xAA:
case 0xB6:
case 0x36:
ENABLE_KBD;
return;
break;
default: /* and passing the rest thru as-is */
currentkbd->lastbyte = tmpkey; /* Set the state. */
goto handle;
break;
}
else {
currentkbd->lastbyte = tmpkey; /* Set the state. */
goto handle;
}
}
return; /* Don't have anything to handle yet, so just return */
/*****************************************************/
/* Second, translate the scan code into a LISP key */
/* transition, add it to the ring buffer, and set */
/* the interrupt-request flags so lisp sees it. */
/*****************************************************/
handle:
/* The upflag is the eight bit in the char ie. upflag = currentkbd->lastbyte >> 7 */
/* The event is the lower seven bits of the byte */
keycode = currentkbd->KeyMap[currentkbd->lastbyte & 0x7f];
if (keycode != 0xff) {
if (keycode < 64) {
PUTBASEBIT68K(&(IOPage68K->dlkbdad0), keycode, (currentkbd->lastbyte >> 7) & 1);
} else if (keycode >= 80) {
PUTBASEBIT68K(&(IOPage68K->dlkbdad0), keycode - 16, (currentkbd->lastbyte >> 7) & 1);
} else {
PUTBASEBIT68K(&(IOPage68K->dlutilin), (keycode & 0xf), (currentkbd->lastbyte >> 7) & 1);
PUTBASEBIT68K(&(InterfacePage->fakemousebits), (keycode & 0xf),
(currentkbd->lastbyte >> 7) & 1);
}
}
/* In DOS we can't enter uraid inside an exception handler. */
/* Uraid may touch a swapped out address and that dumps Medley */
if (((IOPage68K->dlkbdad2 & 2113) == 0) || /* Ctrl-shift-NEXT */
((IOPage68K->dlkbdad2 & 2114) == 0)) { /* Ctrl-shift-DEL */
currentkbd->URaid = TRUE; /* Tell the dispatch loop about it. */
return;
}
r = CTopKeyevent->ring.vectorindex.read;
w = CTopKeyevent->ring.vectorindex.write;
if (r != w) {
kbevent = (KBEVENT *)((DLword *)CTopKeyevent + w);
/* Copy the Hardware bits. */
kbevent->W0 = IOPage68K->dlkbdad0;
kbevent->W1 = IOPage68K->dlkbdad1;
kbevent->W2 = IOPage68K->dlkbdad2;
kbevent->W3 = IOPage68K->dlkbdad3;
kbevent->W4 = IOPage68K->dlkbdad4;
kbevent->W5 = IOPage68K->dlkbdad5;
kbevent->WU = IOPage68K->dlutilin;
/* If queue was empty, update the read pointer */
if (r == 0) CTopKeyevent->ring.vectorindex.read = w;
/* Update the write pointer */
if (w >= currentkbd->maxkeyevent)
CTopKeyevent->ring.vectorindex.write = MINKEYEVENT;
else
CTopKeyevent->ring.vectorindex.write += currentkbd->keyeventsize;
}
if (*KEYBUFFERING68k == NIL) *KEYBUFFERING68k = ATOM_T;
KBDEventFlg++;
Irq_Stk_End = 0;
Irq_Stk_Check = 0;
ENABLE_KBD;
return;
}
extern u_char DOSLispKeyMap_101[];
/************************************************************************/
/* */
/* E X I T D O S K B D */
/* */
/* Turn off the DOS keyboard handler, and reinstall the */
/* normal DOS handler. */
/************************************************************************/
void ExitDosKbd(KbdInterface kbd)
{
if (kbd->device.active == TRUE) {
kbd->device.active = FALSE;
_dpmi_unlockregion((void *)&currentkbd, sizeof(currentkbd));
_dpmi_unlockregion((void *)kbd, sizeof(*kbd));
_dpmi_unlockregion((void *)&InterfacePage, sizeof(InterfacePage));
_dpmi_unlockregion((void *)InterfacePage, sizeof(IFPAGE));
_dpmi_unlockregion((void *)&IOPage68K, sizeof(IOPage68K));
_dpmi_unlockregion((void *)IOPage68K, sizeof(IOPAGE));
_dpmi_unlockregion((void *)&CTopKeyevent, sizeof(CTopKeyevent));
_dpmi_unlockregion((void *)CTopKeyevent, sizeof(*CTopKeyevent));
_dpmi_unlockregion((void *)&MachineState, sizeof(MachineState));
_dpmi_unlockregion((void *)&KEYBUFFERING68k, sizeof(KEYBUFFERING68k));
_dpmi_unlockregion((void *)&ExitDosKbd, 4096);
_dpmi_unlockregion((void *)&Kbd_event, 4096);
_dos_setvect(0x09, kbd->prev_handler); /* unhook our handlr, install previous*/
}
}
/************************************************************************/
/* */
/* E N T E R D O S K B D */
/* */
/* Turn on the DOS keyboard device. */
/* */
/************************************************************************/
void EnterDosKbd(KbdInterface kbd)
{
int i;
if (kbd->device.active == FALSE) {
kbd->device.active = TRUE;
for (i = 0; i < 0x80; i++) kbd->KeyMap[i] = DOSLispKeyMap_101[i];
if (eurokbd)
kbd->keyeventsize = EUROKEYEVENTSIZE;
else
kbd->keyeventsize = NOEUROKEYEVENTSIZE;
kbd->eurokbd = eurokbd;
/* Offset of the end of the ring buffer */
kbd->maxkeyevent = (MINKEYEVENT + (NUMBEROFKEYEVENTS * kbd->keyeventsize));
_dpmi_lockregion((void *)&currentkbd, sizeof(currentkbd));
_dpmi_lockregion((void *)kbd, sizeof(*kbd));
_dpmi_lockregion((void *)&InterfacePage, sizeof(InterfacePage));
_dpmi_lockregion((void *)InterfacePage, sizeof(IFPAGE));
_dpmi_lockregion((void *)&IOPage68K, sizeof(IOPage68K));
_dpmi_lockregion((void *)IOPage68K, sizeof(IOPAGE));
_dpmi_lockregion((void *)&MachineState, sizeof(MachineState));
_dpmi_lockregion((void *)&CTopKeyevent, sizeof(CTopKeyevent));
_dpmi_lockregion((void *)CTopKeyevent, sizeof(*CTopKeyevent));
_dpmi_lockregion((void *)&KEYBUFFERING68k, sizeof(KEYBUFFERING68k));
_dpmi_lockregion((void *)&ExitDosKbd, 4096);
_dpmi_lockregion((void *)&Kbd_event, 4096);
/* Don't hook in our handler if the user flagged he wants to run */
/* without a kbd. */
if (!nokbdflag) {
kbd->prev_handler = _dos_getvect(0x09); /* get addr of current 09 hndlr */
_dos_setvect(0x09, kbd->device_event); /* hook our int handler to interrupt */
}
}
}

624
src/dosmouse.c Normal file
View File

@@ -0,0 +1,624 @@
/* $Id: dosmouse.c,v 1.2 1999/01/03 02:06:56 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved
*/
/************************************************************************/
/* */
/* (C) Copyright 1989, 1990, 1990, 1991, 1992, 1993, 1994, 1995 Venue. */
/* All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/************************************************************************/
#include "version.h"
#include <i32.h> /* Defines "#pragma interrupt" */
#include <stk.h> /* _XSTACK struct definition */
#include <dos.h> /* Defines REGS & other structs */
#include "lispemul.h"
#include "display.h"
#include "bb.h"
#include "dbprint.h"
#include "devif.h"
#include "keyboard.h"
#include "ifpage.h"
extern int eurokbd;
extern IOPAGE *IOPage68K;
extern MISCSTATS *MiscStats;
extern IFPAGE *InterfacePage;
extern int KBDEventFlg;
extern DspInterface currentdsp;
extern MouseInterface currentmouse;
extern KbdInterface currentkbd;
extern keybuffer *CTopKeyevent;
extern DLword *DisplayRegion68k;
extern DLword *Lisp_world;
extern LispPTR *KEYBOARDEVENTQUEUE68k;
extern LispPTR *KEYBUFFERING68k;
extern LispPTR *LASTUSERACTION68k;
#define MOUSE_MV 0x01 /* Mouse movement occurred */
#define LB_PRESS 0x02 /* Left button pressed */
#define LB_OFF 0x04 /* Left button released */
#define RB_PRESS 0x08 /* Right button pressed */
#define RB_OFF 0x10 /* Right button released */
#define CB_PRESS 0x20 /* Center button released */
#define CB_OFF 0x40 /* Center button pressed */
#pragma interrupt(TwoButtonHandler)
#pragma interrupt(ThreeButtonHandler)
#pragma interrupt(ButtonTimer)
void ButtonTimer();
void MouseButtonSignal();
void EnterDosMouse(MouseInterface mouse, DspInterface dsp)
{
union REGS regs;
probemouse();
_dpmi_lockregion((void *)&MouseButtonSignal, 4096);
/* Set up the ringbuffer */
if (eurokbd)
mouse->keyeventsize = EUROKEYEVENTSIZE;
else
mouse->keyeventsize = NOEUROKEYEVENTSIZE;
mouse->eurokbd = eurokbd;
/* Offset of the end of the ring buffer */
mouse->maxkeyevent = (MINKEYEVENT + (NUMBEROFKEYEVENTS * mouse->keyeventsize));
/* Lock myself */
_dpmi_lockregion((void *)mouse, sizeof(*mouse));
_dpmi_lockregion((void *)&currentmouse, sizeof(currentmouse));
/* Lock the handler routines */
_dpmi_lockregion((void *)mouse->Handler, 4096);
if (mouse->Button.TwoButtonP) { _dpmi_lockregion((void *)&ButtonTimer, 4096); }
/* Lock the structures used, both pointers to 'em & the whole structure. */
_dpmi_lockregion((void *)&IOPage68K, sizeof(IOPage68K));
_dpmi_lockregion((void *)IOPage68K, sizeof(IOPAGE));
_dpmi_lockregion((void *)&InterfacePage, sizeof(InterfacePage));
_dpmi_lockregion((void *)InterfacePage, sizeof(IFPAGE));
_dpmi_lockregion((void *)&MiscStats, sizeof(MiscStats));
_dpmi_lockregion((void *)MiscStats, sizeof(MISCSTATS));
/* Lock the flags */
_dpmi_lockregion((void *)&KBDEventFlg, sizeof(KBDEventFlg));
_dpmi_lockregion((void *)&MachineState, sizeof(MachineState));
/* Lock the pointers into the sysout */
_dpmi_lockregion((void *)&KEYBUFFERING68k, sizeof(KEYBUFFERING68k));
/* Lock the regions of the sysout that the pointers points to */
/* KEYBUFFERINF68k points to the value cell for a symbol */
_dpmi_lockregion((void *)KEYBUFFERING68k, sizeof(LispPTR));
/* CTopKeyevent points to the ring-buffer of keyboard events */
_dpmi_lockregion((void *)&CTopKeyevent, sizeof(CTopKeyevent));
_dpmi_lockregion((void *)CTopKeyevent, sizeof(*CTopKeyevent));
/* Now Lock the lastuseraction machine. */
/* _dpmi_lockregion(mouse->timestamp, sizeof(LispPTR)); */ /* Lisp_world itself */
regs.w.eax = 0x0001; /* Function 1 = turn on mouse cursor */
int86(0x33, &regs, &regs);
regs.w.eax = 0x0002; /* Function 2 = hide mouse cursor */
int86(0x33, &regs, &regs);
regs.w.eax = 0x0C; /* Function 0C = set user-defined mouse handler */
regs.w.ecx = LB_PRESS | LB_OFF | CB_PRESS | CB_OFF | RB_PRESS | RB_OFF | MOUSE_MV;
regs.w.edx = FP_OFF(*(mouse->Handler)); /* Address of our mouse handler routine */
int86(0x33, &regs, &regs); /* Install our handler to process events */
if (regs.w.eax == 'MERR')
VESA_errorexit("Unable to install mouse handler - not enough low memory.\n", -1);
regs.x.ax = 0x7; /* Set mouse horizontal range */
regs.x.cx = 0x0;
regs.x.dx = (short)(dsp->Display.width - 1);
int86(0x33, &regs, &regs);
regs.x.ax = 0x8; /* Set mouse vertical range */
regs.x.cx = 0x0;
regs.x.dx = (short)(dsp->Display.height - 1);
int86(0x33, &regs, &regs);
/* See if turning this off fixes the "mouse granularity" problem */
/* Nope. It didn't. */
regs.x.ax = 0xf; /* Set mickey per pixel range */
regs.x.cx = 0x8;
regs.x.dx = 0x8;
int86(0x33, &regs, &regs);
mouse->Button.NextHandler = _dos_getvect(0x1c);
_dos_setvect(0x1c, ButtonTimer);
mouse->device.active = TRUE;
}
void ExitDosMouse(MouseInterface mouse)
{
if (mouse->device.active) {
/* Unlock myself */
_dpmi_unlockregion((void *)mouse, sizeof(*mouse));
_dpmi_unlockregion((void *)&currentmouse, sizeof(currentmouse));
/* Unlock the handler routines */
_dpmi_unlockregion((void *)mouse->Handler, 4096);
_dpmi_unlockregion((void *)&ButtonTimer, 4096);
_dpmi_unlockregion((void *)&MouseButtonSignal, 4096);
/* Unlock the structures used. */
_dpmi_unlockregion((void *)&IOPage68K, sizeof(IOPage68K));
_dpmi_unlockregion((void *)&InterfacePage, sizeof(InterfacePage));
_dpmi_unlockregion((void *)&MiscStats, sizeof(MiscStats));
/* Unlock the flags */
_dpmi_unlockregion((void *)&KBDEventFlg, sizeof(KBDEventFlg));
_dpmi_unlockregion((void *)&MachineState, sizeof(MachineState));
/* Unlock the pointers into the sysout */
_dpmi_unlockregion((void *)&KEYBUFFERING68k, sizeof(KEYBUFFERING68k));
/* _dpmi_unlockregion((void *)&KEYBOARDEVENTQUEUE68k, sizeof(KEYBOARDEVENTQUEUE68k)); */
/* Unlock the regions of the sysout that the pointers points to */
_dpmi_unlockregion((void *)KEYBUFFERING68k, sizeof(LispPTR));
_dpmi_unlockregion((void *)&CTopKeyevent, sizeof(CTopKeyevent));
_dpmi_unlockregion((void *)CTopKeyevent, sizeof(*CTopKeyevent));
/* _dpmi_unlockregion(mouse->timestamp, sizeof(LispPTR)); */
_dos_setvect(0x1c, mouse->Button.NextHandler);
mouse->device.active = FALSE;
}
}
void DosMouseAfterRaid(MouseInterface mouse, DspInterface dsp)
{
union REGS regs;
/* Screen mode changed. We have to reinit the ranges. */
regs.x.ax = 0x7; /* Set mouse horizontal range */
regs.x.cx = 0x0;
regs.x.dx = (short)(dsp->Display.width - 1);
int86(0x33, &regs, &regs);
regs.x.ax = 0x8; /* Set mouse vertical range */
regs.x.cx = 0x0;
regs.x.dx = (short)(dsp->Display.height - 1);
int86(0x33, &regs, &regs);
mouse->device.active = TRUE;
}
void DosMouseBeforeRaid(MouseInterface mouse, DspInterface dsp)
{ mouse->device.active = FALSE; }
/***************************************************************/
/* d o s _ c u r s o r _ i n v i s s i b l e */
/* Since we only blit the cursor to the VESA/VGA displaybuffer */
/* and not to the emulator displaybuffer we can make the cursor*/
/* invisible just by updating the area under the cursor! */
/***************************************************************/
void dos_cursor_invisible(DspInterface dsp, IOPAGE *iop)
{ (dsp->bitblt_to_screen)(dsp, DisplayRegion68k, iop->dlcursorx, iop->dlcursory, 16, 16); }
/***************************************************************/
/* d o s _ c u r s o r _ v i s s i b l e */
/* blit the mouse to the display ... */
/* The cursor should be blitted according to the following: */
/* ((backgroundbm AND maskbm) OR ((NOT mask) OR cursorbm)) */
/* ie. bltAND the mask to the background then bltOR the rest */
/* */
/* Hah!! this crappy machine doesn't have a mask!! /jarl */
/* ie. use the inverted bitmap as a mask!!!! */
/* */
/* More to the point. The mask is the image inverted. (sigh..) */
/* */
/***************************************************************/
set_DOSmouseposition(DspInterface dsp, int x, int y)
{
union REGS regs;
dsp->device.locked++;
currentmouse->device.active++;
#ifdef NEVER
/* int 33h, case 0004, cx=col, dx = row */
regs.w.eax = 4; /* Function 4 = move cursor */
regs.w.ecx = x;
regs.w.edx = y;
int86(0x33, &regs, &regs);
#endif /* NEVER */
/* Actually move the cursor image */
IOPage68K->dlmousex = x;
IOPage68K->dlmousey = y;
/* *(currentmouse->timestamp) = MiscStats->secondstmp; */
(currentdsp->mouse_invisible)(currentdsp, IOPage68K);
currentmouse->Cursor.New.x = IOPage68K->dlcursorx = x;
currentmouse->Cursor.New.y = IOPage68K->dlcursory = y;
(currentdsp->mouse_visible)(x, y);
dsp->device.locked--;
currentmouse->device.active--;
}
void docopy(int newx, int newy)
{
register DLword *srcbase, *dstbase;
static int sx, dx, w = 16, h = 16, srcbpl, dstbpl, backwardflg = 0;
static int src_comp = 0, op = 0, gray = 0, num_gray = 0, curr_gray_line = 0;
srcbase = IOPage68K->dlcursorbitmap;
dstbase = DisplayRegion68k + (newy * currentdsp->Display.width / 16);
sx = 0;
dx = newx;
w = currentmouse->Cursor.Last.width;
h = currentmouse->Cursor.Last.height;
srcbpl = 16;
dstbpl = currentdsp->Display.width;
op = 2; /* OR-in */
#ifdef NEWBITBLT
bitblt(srcbase, dstbase, sx, dx, w, h, srcbpl, dstbpl, backwardflg, src_comp, 2, 0, 0, 0);
#else
new_bitblt_code;
#endif /* NEWBITBLT */
}
dostaking_mouse_up(int newx, int newy)
{
/* save hidden bitmap */
register DLword *srcbase, *dstbase;
static int sx, dx, w = 16, h = 16, srcbpl, dstbpl, backwardflg = 0;
static int src_comp = 0, op = 0, gray = 0, num_gray = 0, curr_gray_line = 0;
/* newx and newy are hotspot coordinates. */
/* newx -= currentmouse->Cursor.Hotspot.x; */
/* newy -= ( 15 - currentmouse->Cursor.Hotspot.y); */
/* save image */
srcbase = DisplayRegion68k + (newy * currentdsp->Display.width / 16);
dstbase = currentmouse->Cursor.Savebitmap;
sx = newx;
dx = 0;
if (currentdsp->Display.width < (newx + 16)) {
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;
op = 0; /* replace */
#ifdef NEWBITBLT
bitblt(srcbase, dstbase, sx, dx, w, h, srcbpl, dstbpl, backwardflg, src_comp, 0, gray, num_gray,
curr_gray_line);
#else
new_bitblt_code;
#endif /* NEWBITBLT */
/* Copy Cursor Image */
docopy(newx, newy);
currentmouse->Cursor.Last.x = newx;
currentmouse->Cursor.Last.y = newy;
(currentdsp->bitblt_to_screen)(currentdsp, DisplayRegion68k, currentmouse->Cursor.Last.x,
currentmouse->Cursor.Last.y, w, h);
}
dostaking_mouse_down(DspInterface dsp, IOPAGE *iop)
{
register DLword *srcbase, *dstbase;
static int sx, dx, w, h, srcbpl, dstbpl, backwardflg = 0;
static int src_comp = 0, op = 0, gray = 0, num_gray = 0, curr_gray_line = 0;
/* restore saved image */
srcbase = currentmouse->Cursor.Savebitmap;
dstbase =
DisplayRegion68k + ((currentmouse->Cursor.Last.y) * (dsp->Display.width / 16)); /* old y */
sx = 0;
dx = currentmouse->Cursor.Last.x; /* old x */
w = currentmouse->Cursor.Last.width;
h = currentmouse->Cursor.Last.height;
srcbpl = 16;
dstbpl = dsp->Display.width;
op = 0;
#ifdef NEWBITBLT
bitblt(srcbase, dstbase, sx, dx, w, h, srcbpl, dstbpl, backwardflg, src_comp, 0, 0, 0, 0);
#else
new_bitblt_code;
#endif /* NEWBITBLT */
(dsp->bitblt_to_screen)(dsp, DisplayRegion68k, currentmouse->Cursor.Last.x,
currentmouse->Cursor.Last.y, w, h);
}
/************************************************************************/
/* */
/* M o u s e B u t t o n S i g n a l */
/* */
/* Tell LISP about a mouse event by putting an entry on the ring buf- */
/* fer of mouse/kbd events, with the new mouse-button state in it. */
/* */
/* */
/************************************************************************/
void MouseButtonSignal(MouseInterface mouse)
{
DLword w, r;
KBEVENT *kbevent;
/* In the mouse device TRUE means button pressed */
/* In the IOPage 0 means button pressed */
/* Hence the ! in the lines below. */
PUTBASEBIT68K(&(IOPage68K->dlutilin), MOUSE_LEFT, !mouse->Button.Left);
PUTBASEBIT68K(&(IOPage68K->dlutilin), MOUSE_MIDDLE, !mouse->Button.Middle);
PUTBASEBIT68K(&(IOPage68K->dlutilin), MOUSE_RIGHT, !mouse->Button.Right);
r = CTopKeyevent->ring.vectorindex.read;
w = CTopKeyevent->ring.vectorindex.write;
if (r != w) {
kbevent = (KBEVENT *)((DLword *)CTopKeyevent + w);
/* Copy the Hardware bits. */
kbevent->W0 = IOPage68K->dlkbdad0;
kbevent->W1 = IOPage68K->dlkbdad1;
kbevent->W2 = IOPage68K->dlkbdad2;
kbevent->W3 = IOPage68K->dlkbdad3;
kbevent->W4 = IOPage68K->dlkbdad4;
kbevent->W5 = IOPage68K->dlkbdad5;
kbevent->WU = IOPage68K->dlutilin;
/* If queue was empty, update the read pointer */
if (r == 0) CTopKeyevent->ring.vectorindex.read = w;
/* Update the write pointer */
if (w >= mouse->maxkeyevent)
CTopKeyevent->ring.vectorindex.write = MINKEYEVENT;
else
CTopKeyevent->ring.vectorindex.write += mouse->keyeventsize;
}
if (*KEYBUFFERING68k == NIL) *KEYBUFFERING68k = ATOM_T;
KBDEventFlg++; /* Signal the emulator to tell Lisp */
Irq_Stk_Check = 0;
Irq_Stk_End = 0;
}
/***************************************************************/
/* B u t t o n T i m e r */
/* This function is used with the mouse chording machinery. */
/* This function is the timer interrupt handler. When a button */
/* event happens we will wait to report it until the next */
/* timeout happens. We will thus obtain the ``rubbery feeling''*/
/* that proponents of chording so desire. */
/***************************************************************/
void ButtonTimer() {
if (currentmouse->Button.RunTimer)
if (currentmouse->Button.tick-- <= 0) {
currentmouse->Button.RunTimer = FALSE; /* Turn the timer off. */
currentmouse->Button.Left |= currentmouse->Button.StateLeft;
currentmouse->Button.Right |= currentmouse->Button.StateRight;
/* Mouse chording code. If at the end of the timeout
the left and right buttons are down we signal middle
button and bring the others up. */
/* Are L & R down? */
if (currentmouse->Button.StateLeft && currentmouse->Button.StateRight) {
currentmouse->Button.Left = FALSE;
currentmouse->Button.Right = FALSE;
currentmouse->Button.Middle = TRUE;
}
currentmouse->Button.StateLeft = FALSE;
currentmouse->Button.StateRight = FALSE;
/* Did L & R go up after a simulated M */
/* if((currentmouse->Button.Middle &&
!(currentmouse->Button.StateLeft ||
currentmouse->Button.StateRight)))
{
currentmouse->Button.Left = FALSE;
currentmouse->Button.Right = FALSE;
currentmouse->Button.Middle = FALSE;
}
*/
MouseButtonSignal(currentmouse);
}
_chain_intr(currentmouse->Button.NextHandler);
}
/***************************************************************/
/* T w o B u t t o n H a n d l e r */
/* This function is the interrupt handler for the mouse. */
/* This function sets the state of the mouse structure and */
/* signals the dispatch loop to take care of the matter. This */
/* awkward solution is due to the severe braindamage in DOS. */
/***************************************************************/
void TwoButtonHandler(void) {
_XSTACK *stk_ptr;
/* First save the stack frame. */
stk_ptr = (_XSTACK *)_get_stk_frame(); /* Get ptr to V86 _XSTACK frame */
stk_ptr->opts |= _STK_NOINT; /* Bypass real-mode handler */
if (!currentmouse->device.active) return;
if (stk_ptr->eax & LB_PRESS)
if (currentmouse->Button.RunTimer) /* Prior right-down seen... */
{
currentmouse->Button.RunTimer = FALSE;
currentmouse->Button.FakeMiddle = TRUE;
currentmouse->Button.Middle = TRUE;
currentmouse->Button.StateLeft = TRUE;
MouseButtonSignal(currentmouse);
} else if (currentmouse->Button.Right) {
currentmouse->Button.Left = TRUE;
currentmouse->Button.StateLeft = TRUE;
MouseButtonSignal(currentmouse);
} else /* No other button down... */
{
currentmouse->Button.StateLeft = TRUE;
currentmouse->Button.tick = currentmouse->Button.StartTime;
currentmouse->Button.RunTimer = TRUE;
}
if (stk_ptr->eax & LB_OFF) /* Left button released, and */
if (currentmouse->Button.RunTimer) /* Timer had been running */
{
currentmouse->Button.RunTimer = FALSE;
currentmouse->Button.Left = TRUE;
MouseButtonSignal(currentmouse);
currentmouse->Button.StateLeft = FALSE;
/* currentmouse->Button.Left = FALSE;
MouseButtonSignal(currentmouse); */
} else /* timer wasn't running */
{
currentmouse->Button.StateLeft = FALSE;
currentmouse->Button.Left = FALSE;
currentmouse->Button.FakeMiddle = FALSE;
currentmouse->Button.Middle = currentmouse->Button.StateMiddle;
MouseButtonSignal(currentmouse);
}
if ((stk_ptr->eax & CB_PRESS) || (stk_ptr->eax & CB_OFF)) {
currentmouse->Button.Middle =
((stk_ptr->eax & CB_PRESS) && TRUE) || currentmouse->Button.FakeMiddle;
currentmouse->Button.StateMiddle = (stk_ptr->eax & CB_PRESS) && TRUE;
currentmouse->Button.RunTimer = FALSE;
MouseButtonSignal(currentmouse);
}
if (stk_ptr->eax & RB_PRESS) /* Right button pressed, and */
if (currentmouse->Button.RunTimer) /* Timer was running... */
{
currentmouse->Button.RunTimer = FALSE;
currentmouse->Button.FakeMiddle = TRUE;
currentmouse->Button.Middle = TRUE;
currentmouse->Button.StateRight = TRUE;
MouseButtonSignal(currentmouse);
} else if (currentmouse->Button.Left) {
currentmouse->Button.Right = TRUE;
currentmouse->Button.StateRight = TRUE;
MouseButtonSignal(currentmouse);
} else {
currentmouse->Button.StateRight = TRUE;
currentmouse->Button.tick = currentmouse->Button.StartTime;
currentmouse->Button.RunTimer = TRUE;
}
if (stk_ptr->eax & RB_OFF) /* Right button released */
if (currentmouse->Button.RunTimer) /* Timer had been running */
{
currentmouse->Button.RunTimer = FALSE;
currentmouse->Button.Right = TRUE;
MouseButtonSignal(currentmouse);
currentmouse->Button.StateRight = FALSE;
/* currentmouse->Button.Right = FALSE;
MouseButtonSignal(currentmouse); */
} else {
currentmouse->Button.StateRight = FALSE;
currentmouse->Button.Right = FALSE;
currentmouse->Button.FakeMiddle = FALSE;
currentmouse->Button.Middle = currentmouse->Button.StateMiddle;
MouseButtonSignal(currentmouse);
}
/* The dude moved the mouse. Set the chordstate NOW. */
/* And turn the timer off. */
if ((stk_ptr->eax & MOUSE_MV) && (!currentdsp->device.locked)) {
currentmouse->Button.RunTimer = FALSE;
/* Are L & R down? */
/* if(currentmouse->Button.StateLeft && currentmouse->Button.StateRight)
{
currentmouse->Button.Left = FALSE;
currentmouse->Button.Right = FALSE;
currentmouse->Button.Middle = TRUE;
}
*/
/* currentmouse->Cursor.New.x = (DLword)stk_ptr->ecx & 0xFFFF;
currentmouse->Cursor.New.y = (DLword)stk_ptr->edx & 0xFFFF; */
currentmouse->Cursor.Moved = TRUE;
if (currentmouse->Button.StateLeft && currentmouse->Button.StateRight) {
currentmouse->Button.Left = FALSE;
currentmouse->Button.Right = FALSE;
currentmouse->Button.Middle = TRUE;
} else {
currentmouse->Button.Left |= currentmouse->Button.StateLeft;
currentmouse->Button.Right |= currentmouse->Button.StateRight;
}
currentmouse->Button.StateLeft = currentmouse->Button.StateRight = FALSE;
MouseButtonSignal(currentmouse);
}
}
/***************************************************************/
/* T h r e e B u t t o n H a n d l e r */
/* This function is the interrupt handler for the mouse. */
/* This function sets the state of the mouse structure and */
/* signals the dispatch loop to take care of the matter. This */
/* awkward solution is due to the severe braindamage in DOS. */
/***************************************************************/
void ThreeButtonHandler()
{
_XSTACK *stk_ptr;
unsigned long mouse_flags;
/* First save the stack frame. */
stk_ptr = (_XSTACK *)_get_stk_frame(); /* Get ptr to V86 _XSTACK frame */
stk_ptr->opts |= _STK_NOINT; /* Bypass real-mode handler */
if (currentmouse->device.active) {
mouse_flags = stk_ptr->eax; /* Save event flags from mouse driver */
/* Decode the transition bits. */
if (mouse_flags & LB_PRESS) currentmouse->Button.Left = TRUE;
if (mouse_flags & LB_OFF) currentmouse->Button.Left = FALSE;
if (mouse_flags & CB_PRESS) currentmouse->Button.Middle = TRUE;
if (mouse_flags & CB_OFF) currentmouse->Button.Middle = FALSE;
if (mouse_flags & RB_PRESS) currentmouse->Button.Right = TRUE;
if (mouse_flags & RB_OFF) currentmouse->Button.Right = FALSE;
if ((!currentdsp->device.locked) && (mouse_flags & MOUSE_MV)) {
currentmouse->Cursor.Moved = TRUE;
Irq_Stk_Check = 0;
Irq_Stk_End = 0;
}
if (mouse_flags & (LB_PRESS | LB_OFF | CB_PRESS | CB_OFF | RB_PRESS | RB_OFF))
MouseButtonSignal(currentmouse);
}
}

View File

@@ -17,15 +17,10 @@
#include "version.h"
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef SUNDISPLAY
#include <sys/ioctl.h>
#include <sunwindow/window_hs.h>
#include <sunwindow/win_ioctl.h>
#endif
#include "lispemul.h"
#include "lspglob.h"
#include "lispmap.h"
@@ -133,17 +128,6 @@ int N_OP_drawline(LispPTR ptr, int curbit, int xsize, int width, int ysize, int
if (MonoOrColor == MONO_SCREEN)
#endif /* COLOR */
#ifdef SUNDISPLAY
#ifndef DISPLAYBUFFER
HideCursor; /** Figure out how to be smart later **/
#else /* DISPLAYBUFFER */
#ifndef OLD_CURSOR
HideCursor;
#endif /* OLD_CURSOR */
#endif /* DISPLAYBUFFER */
#endif /* SUNDISPLAY */
delta &= 0xFFFF;
op &= 3;
@@ -277,17 +261,6 @@ int N_OP_drawline(LispPTR ptr, int curbit, int xsize, int width, int ysize, int
if (MonoOrColor == MONO_SCREEN)
#endif /* COLOR */
#ifdef SUNDISPLAY
#ifndef DISPLAYBUFFER
ShowCursor; /** figure how to be smart later **/
#else
#ifndef OLD_CURSOR
ShowCursor;
#endif /* OLD_CURSOR */
#endif /* DISPLAYBUFFER */
#endif /* SUNDISPLAY */
#ifdef DISPLAYBUFFER
#ifdef COLOR
@@ -295,24 +268,21 @@ int N_OP_drawline(LispPTR ptr, int curbit, int xsize, int width, int ysize, int
#endif /* COLOR */
{
DLword *start_addr, *temp_s, *temp_e;
DLword *start_addr;
start_addr = (DLword *)Addr68k_from_LADDR(ptr);
if (((int)(temp_s = (DLword *)(start_addr - DisplayRegion68k)) >= 0) &&
(start_addr < DisplayRegion68k_end_addr) &&
((int)(temp_e = (DLword *)(dataptr - DisplayRegion68k)) >= 0) &&
((DLword *)dataptr < DisplayRegion68k_end_addr)) {
if (in_display_segment(start_addr) && in_display_segment(dataptr)) {
int start_x, start_y, end_x, end_y, w, h;
#if defined(SUNDISPLAY) && defined(OLD_CURSOR)
int displayflg;
#endif
ptrdiff_t temp_s, temp_e;
start_y = (int)temp_s / DisplayRasterWidth;
start_x = ((int)temp_s % DisplayRasterWidth) * BITSPER_DLWORD;
temp_s = start_addr - DisplayRegion68k;
temp_e = dataptr - DisplayRegion68k;
end_y = (int)temp_e / DisplayRasterWidth;
end_x = ((int)temp_e % DisplayRasterWidth) * BITSPER_DLWORD + (BITSPER_DLWORD - 1);
start_y = temp_s / DisplayRasterWidth;
start_x = (temp_s % DisplayRasterWidth) * BITSPER_DLWORD;
end_y = temp_e / DisplayRasterWidth;
end_x = (temp_e % DisplayRasterWidth) * BITSPER_DLWORD + (BITSPER_DLWORD - 1);
w = abs(start_x - end_x) + 1;
h = abs(start_y - end_y) + 1;
@@ -320,22 +290,8 @@ int N_OP_drawline(LispPTR ptr, int curbit, int xsize, int width, int ysize, int
if (start_x > end_x) start_x = end_x;
if (start_y > end_y) start_y = end_y;
#if defined(SUNDISPLAY) && !defined(BYTESWAP)
#ifdef OLD_CURSOR
if ((displayflg = n_new_cursorin_CG6(start_x, start_y, w, h))) HideCursor;
#endif /* OLD_CURSOR */
pr_rop(ColorDisplayPixrect, start_x, start_y, w, h, PIX_SRC, DisplayRegionPixrect, start_x,
start_y);
#ifdef OLD_CURSOR
if (displayflg) ShowCursor;
#endif /* OLD_CURSOR */
#endif /* SUNDISPLAY */
#if defined(XWINDOW) || defined(BYTESWAP)
flush_display_region(start_x, start_y, w, h);
#endif /* XWINDOW */
}
}

673
src/dsk.c

File diff suppressed because it is too large Load Diff

View File

@@ -27,22 +27,55 @@ DspInterface currentdsp = &curdsp;
#ifdef XWINDOW
extern int LispDisplayRequestedWidth;
extern int LispDisplayRequestedHeight;
extern DspInterface X_init(DspInterface dsp, char *lispbitmap, int width_hint, int height_hint,
int depth_hint);
#endif /* XWINDOW */
#ifdef DOS
extern int dosdisplaymode;
#endif /* DOS */
void make_dsp_instance(DspInterface dsp, char *lispbitmap, int width_hint, int height_hint,
int depth_hint) {
#if XWINDOW
#ifdef DOS
TPRINT(("Enter make_dsp_instance, dosdisplaymode is: %d\n", dosdisplaymode));
if (depth_hint == 0) depth_hint = 1;
switch (dosdisplaymode) {
case 1: VGA_init(dsp, 0, 0, 0, depth_hint); break;
case 0x102:
case 0x104: VESA_init(dsp, 0, 0, 0, depth_hint); break;
default:
if (VESA_p()) {
VESA_init(dsp, 0, 0, 0, depth_hint);
} else if (VGA_p()) {
VGA_init(dsp, 0, 0, 0, depth_hint);
} else { /* Can't set *ANY* video mode! */
(void)fprintf(stderr, "No portable graphics mode supported by this host.\n");
(void)fprintf(stderr, "\n-Expected VESA or VGA.\n");
exit(1);
}
break;
}
#elif XWINDOW
/* lispbitmap is 0 when we call X_init the first time. */
if (X_init(dsp, 0, LispDisplayRequestedWidth, LispDisplayRequestedHeight, depth_hint) == NULL) {
fprintf(stderr, "Can't open display.");
exit(-1);
}
#endif /* XWINDOW */
#endif /* DOS | XWINDOW */
} /* Now we know the maximum capabilities of the hardware. */
#ifdef DOS
VESA_p() {
/* Magic. Do a vesa call to determine the current mode. */
return (VESA_call(3, 0));
}
VGA_p() { return (TRUE); }
#endif /* DOS */
/*********************************************************************/
/* */
/* G e n e r i c R e t u r n T */
@@ -71,7 +104,16 @@ void describedsp(DspInterface dsp) {
printf("colors= %lu\n", dsp->colors);
printf("graphicsmode= %lu\n", dsp->graphicsmode);
printf("numberofbanks= %lu\n", dsp->numberofbanks);
#ifdef DOS
printf("BytesPerLine= %d\n", dsp->BytesPerLine);
printf("DisplayStartAddr= %d\n", dsp->DisplayStartAddr);
#endif /* DOS */
printf("bitblt_to_screen= %p\n", dsp->bitblt_to_screen);
printf("cleardisplay= %p\n", dsp->cleardisplay);
#ifdef DOS
printf("mouse_visible= %d\n", dsp->mouse_visible);
printf("mouse_invisible= %d\n", dsp->mouse_invisible);
printf("\n");
#endif /* DOS */
fflush(stdout);
}

View File

@@ -12,9 +12,6 @@
#include "version.h"
#include <stdio.h>
#ifdef SUNDISPLAY
#include <sunwindow/window_hs.h>
#endif
#include "lispemul.h"
#include "lsptypes.h"
@@ -68,9 +65,7 @@ void DSP_showdisplay(LispPTR *args)
LispPTR DSP_VideoColor(LispPTR *args) /* args[0] : black flag */
{
int invert;
#ifdef SUNDISPLAY
return NIL;
#elif defined(XWINDOW)
#if defined(XWINDOW)
invert = args[0] & 0xFFFF;
lisp_Xvideocolor(invert);
if (invert)
@@ -99,50 +94,7 @@ void DSP_Cursor(LispPTR *args, int argnum)
extern int ScreenLocked;
extern DLword *EmCursorX68K, *EmCursorY68K;
extern int LastCursorX, LastCursorY;
#if defined(SUNDISPLAY) && !defined(OLD_CURSOR)
static int Init = T;
#endif
#ifdef SUNDISPLAY
if (argnum == 2) {
CurrentCursor.cur_xhot = args[0] & 0xffff;
CurrentCursor.cur_yhot = args[1] & 0xffff;
};
#ifdef OLD_CURSOR
win_setcursor(LispWindowFd, &CurrentCursor);
#else
#ifndef INIT
ScreenLocked = T;
if (!Init) {
taking_mouse_down();
taking_mouse_up(*EmCursorX68K, *EmCursorY68K);
} else {
Init = NIL;
cursor_hidden_bitmap(0, 0);
taking_mouse_up(0, 0);
*EmCursorX68K = LastCursorX = 0;
*EmCursorY68K = LastCursorY = 0;
}
ScreenLocked = NIL;
#else
/* Init specific lde only */
ScreenLocked = T;
if (!Init) {
taking_mouse_down();
taking_mouse_up(0, 0);
} else {
Init = NIL;
cursor_hidden_bitmap(0, 0);
taking_mouse_up(0, 0);
}
ScreenLocked = NIL;
#endif /* INIT */
#endif
#endif /* SUNDISPLAY */
#ifdef XWINDOW
/* For X-Windows, set the cursor to the given location. */
@@ -161,32 +113,6 @@ void DSP_Cursor(LispPTR *args, int argnum)
*/
void DSP_SetMousePos(register LispPTR *args)
{
#ifdef SUNDISPLAY
#ifdef OLD_CURSOR
register int x, y;
x = GetSmalldata(args[0]);
y = GetSmalldata(args[1]); /* debug */
win_setmouseposition(LispWindowFd, GetSmalldata(args[0]), GetSmalldata(args[1]));
#else
extern int ScreenLocked;
extern DLword *EmCursorX68K, *EmCursorY68K, *EmMouseX68K, *EmMouseY68K;
register int x, y;
ScreenLocked = T;
x = GetSmalldata(args[0]);
y = GetSmalldata(args[1]);
/* for Suntool's invisible cursor */
win_setmouseposition(LispWindowFd, x, y);
/* for REAL cursor image */
taking_mouse_down();
taking_mouse_up(x, y);
#ifndef INIT
*EmMouseX68K = x;
*EmMouseY68K = y;
#endif
ScreenLocked = NIL;
#endif
#endif /* SUNDISPLAY */
#ifdef XWINDOW
if (Mouse_Included)
@@ -251,25 +177,6 @@ void flip_cursor() {
#endif
#ifdef SUNDISPLAY
#ifdef OLD_CURSOR
win_setcursor(LispWindowFd, &CurrentCursor);
#else
ScreenLocked = T;
taking_mouse_down();
#ifndef INIT
taking_mouse_up(*EmCursorX68K, *EmCursorY68K);
#else
if (!for_makeinit)
taking_mouse_up(*EmCursorX68K, *EmCursorY68K);
else
taking_mouse_up(0, 0);
#endif /* INIT */
ScreenLocked = NIL;
#endif
#endif /* SUNDISPLAY */
#ifdef XWINDOW
/* JDS 011213: 15- cur y, as function does same! */

View File

@@ -21,6 +21,7 @@
#include <string.h>
#include <unistd.h>
#include <ctype.h>
#ifndef DOS
#include <sys/file.h>
#include <signal.h>
#include <errno.h>
@@ -58,6 +59,7 @@
#include <sys/mbuf.h>
#endif
#include <nlist.h>
#endif /* DOS */
#endif /* MAIKO_ENABLE_ETHERNET */
#include "commondefs.h"
@@ -740,7 +742,7 @@ static int check_filter(u_char *buffer)
static void init_uid() {
int rid;
rid = getuid();
seteuid(rid);
setuid(rid);
}
#endif /* MAIKO_ENABLE_ETHERNET */
@@ -828,7 +830,7 @@ void init_ether() {
/* JDS 991228 remove perror("Can't open network; XNS unavailable.\n"); */
ether_fd = -1;
}
seteuid(getuid());
setuid(getuid());
}
#elif defined(USE_NIT)
#ifndef OS4
@@ -950,7 +952,7 @@ void init_ether() {
perror("Can't open network; XNS unavailable.\n");
ether_fd = -1;
}
seteuid(getuid());
setuid(getuid());
}
#endif /* OS4 */

View File

@@ -24,9 +24,6 @@
#include "commondefs.h"
#include "gchtfinddefs.h"
#ifdef GCC386
#include "inlnPS2.h"
#endif
#define MaskShift(x) (((x) << 16) & SEGMASK)

View File

@@ -34,9 +34,6 @@
#include "gc2defs.h"
#include "gcscandefs.h"
#ifdef GCC386
#include "inlnPS2.h"
#endif /* GCC386 */
/**********************************************************************/
/*

View File

@@ -52,9 +52,6 @@
#include "gcrcelldefs.h"
#include "gcscandefs.h"
#ifdef GCC386
#include "inlnPS2.h"
#endif
#define WORDSPERCELL 2
#define MAXHTCNT 63
@@ -99,203 +96,6 @@
#define STKREFBIT 0x200
#endif /* BIGVM */
#ifdef GCC386
/* byte-swapped, 386 assembler version */
LispPTR gcmapscan() {
volatile DLword probe;
volatile DLword *entry;
volatile DLword offset;
volatile LispPTR ptr;
asm volatile(
" \n\
movl $32768,%%edi / probe = HTSIZE. \n\
.align 4 \n\
nextentry: / nextentry: \n\
decl %%edi \n\
js returNIL \n\
leal 0(,%%edi,2),%%esi \n\
addl HTmain,%%esi /htlptr = (struct htlinkptr *)(HTmain+probe); \n\
.align 4 \n\
scanloop: \n\
movl %%esi,%%edx \n\
xorb $2,%%dl \n\
movzwl (%%edx),%%eax / contents = ((struct htlinkptr *)WORDPTR(htlptr))->contents \n\
testl %%eax,%%eax / if (contents && \n\
je scanbot \n\
testb $1,%%al \n\
jne scanok \n\
testb $254,%%ah \n\
jne scanbot \n\
scanok: \n\
jmp scandone \n\
.align 4 \n\
scanbot: \n\
addl $-2,%%esi / end of while loop. \n\
decl %%edi \n\
jns scanloop \n\
jmp returNIL \n\
\n\
\n\
scandone: \n\
movl %%edx,%0 / entry = (DLword *) HTmain + probe. \n\
retry: / retry: \n\
movl %0,%%ecx \n\
movzwl (%%ecx),%%eax \n\
testb $1,%%al / if HENTRY->collision, \n\
je nocollision \n\
xorl %%esi,%%esi / prev = 0 \n\
andl $65534,%%eax \n\
linkloop: // linkloop: \n\
leal 0(,%%eax,2),%%ecx \n\
addl HTcoll,%%ecx \n\
movw 2(%%ecx),%%ax / offset = ((struct htcoll *)link)->free_ptr; \n\
testb $254,%%ah / if StkCountIsZero(offset) \n\
jne stknz \n\
sall $15,%%eax / , (probe << 1)); \n\
andl $16711680,%%eax \n\
leal 0(,%%edi,2),%%edx \n\
orl %%eax,%%edx \n\
movl %%edx,%2 / to ptr. \n\
testl %%esi,%%esi / DelLink. if (prev != 0) \n\
je prevZ \n\
leal 2(%%esi),%%edx / GETWORD((DLword *)prev + 1) = GETWORD((DLword *)link + 1) \n\
xorb $2,%%dl \n\
leal 2(%%ecx),%%eax \n\
xorb $2,%%al \n\
movw (%%eax),%%ax \n\
jmp freelink \n\
.align 4 \n\
prevZ: \n\
movl %0,%%edx / else GETWORD((DLword *)entry) = GETWORD((DLword *)link + 1) \n\
leal 2(%%ecx),%%eax \n\
xorb $2,%%al \n\
movw (%%eax),%%ax \n\
orb $1,%%al \n\
freelink: / FreeLink \n\
movw %%ax,(%%edx) \n\
movl %%ecx,%%eax \n\
xorb $2,%%al \n\
movw $0,(%%eax) \n\
leal 2(%%ecx),%%eax \n\
xorb $2,%%al \n\
movl HTcoll,%%edx / GETWORD(link+1) = GETWORD(HTcoll); \n\
xorb $2,%%dl \n\
movw (%%edx),%%dx \n\
movw %%dx,(%%eax) \n\
movl HTcoll,%%edx / GETWORD(HTcoll) = (link - HTcoll); \n\
xorb $2,%%dl \n\
movl %%ecx,%%eax \n\
subl HTcoll,%%eax \n\
sarl $1,%%eax \n\
movw %%ax,(%%edx) \n\
movl %0,%%esi / link = (DLword *)HTcoll + GetLinkptr(GETWORD((DLword *)entry \n\
movw (%%esi),%%ax \n\
andl $65534,%%eax \n\
addl %%eax,%%eax \n\
movl %%eax,%%ecx \n\
addl HTcoll,%%ecx \n\
leal 2(%%ecx),%%edx / if (GETWORD((DLword *)link + 1) == 0) { \n\
xorb $2,%%dl \n\
cmpw $0,(%%edx) \n\
jne sgclp1 \n\
movl %%ecx,%%eax / GETWORD((DLword *)entry) = GETWORD((DLword *)link) \n\
xorb $2,%%al \n\
movw (%%eax),%%bx \n\
movw %%bx,(%%esi) \n\
movw $0,(%%eax) / FreeLink: GETWORD(link) = 0 \n\
movl HTcoll,%%eax / GETWORD(link+1) = GETWORD(HTcoll) \n\
xorb $2,%%al \n\
movw (%%eax),%%bx \n\
movw %%bx,(%%edx) \n\
movl %%ecx,%%ebx \n\
subl HTcoll,%%ebx \n\
sarl $1,%%ebx \n\
movw %%bx,(%%eax) \n\
.align 4 \n\
sgclp1: / start of gcloop 1 - do setup \n\
movl GcDisabled_word,%%ecx \n\
movl MDStypetbl,%%ebx \n\
gclp1: / GcreclaimLp: \n\
pushl %2 \n\
call gcreccell \n\
addl $4,%%esp \n\
movl %%eax,%2 \n\
testl %%eax,%%eax \n\
je eogclp1 \n\
shrl $9,%%eax \n\
leal 0(%%ebx,%%eax,2),%%eax \n\
xorb $2,%%al \n\
cmpw $0,(%%eax) \n\
jl gclp1 \n\
cmpl $76,(%%ecx) \n\
je gclp1 \n\
pushl $0 \n\
pushl %2 \n\
call rec_htfind \n\
addl $8,%%esp \n\
jmp gclp1 \n\
.align 4 \n\
.align 4 \n\
eogclp1: \n\
movl %0,%%eax / if (HTLPTR->contents == 0) \n\
cmpw $0,(%%eax) \n\
je nextentry / goto nextentry; \n\
jmp retry / else goto retry; \n\
.align 4 \n\
.align 4 \n\
\n\
stknz: \n\
movw (%%ecx),%%ax / if ((offset = ((struct htcoll *)link)->next_free)) \n\
testw %%ax,%%ax \n\
je nextentry \n\
movl %%ecx,%%esi \n\
andl $65535,%%eax \n\
jmp linkloop \n\
.align 4 \n\
.align 4 \n\
nocollision: \n\
testw $65024,(%%ecx) / if (StkCntIsZero(HTLPTR->contents)) { \n\
jne nextentry \n\
movw (%%ecx),%%dx /ptr = VAG2(HENTRY->segnum, (probe << 1)); \n\
sall $15,%%edx \n\
andl $16711680,%%edx \n\
leal (,%%edi,2),%%eax \n\
orl %%eax,%%edx \n\
movl %%edx,%2 \n\
movw $0,(%%ecx) / HTLPTR->contents = 0 \n\
.align 4 \n\
movl GcDisabled_word,%%ecx \n\
movl MDStypetbl,%%ebx \n\
gclp2: / GcreclaimLp \n\
pushl %2 \n\
call gcreccell \n\
addl $4,%%esp \n\
movl %%eax,%2 \n\
testl %%eax,%%eax \n\
je nextentry \n\
shrl $9,%%eax \n\
leal 0(%%ebx,%%eax,2),%%eax \n\
xorb $2,%%al \n\
cmpw $0,(%%eax) \n\
jl gclp2 \n\
cmpl $76,(%%ecx) \n\
je gclp2 \n\
pushl $0 \n\
pushl %2 \n\
call rec_htfind \n\
addl $8,%%esp \n\
jmp gclp2 \n\
.align 4 \n\
returNIL: \n\
"
: "=g"(entry), "=g"(offset), "=g"(ptr)
:
: "ax", "dx", "cx", "bx", "si", "di");
return NIL;
}
#else
LispPTR gcmapscan(void) {
register GCENTRY probe;
@@ -342,7 +142,6 @@ nextentry:
}
return (NIL);
}
#endif /* GCC386 */
LispPTR gcmapunscan(void) {
register GCENTRY probe;

View File

@@ -14,6 +14,7 @@
#include <stdio.h>
#include <string.h> /* for mem... fns */
#ifndef DOS
#include <errno.h>
#include <netdb.h>
#include <netinet/in.h>
@@ -25,6 +26,7 @@
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#endif /* DOS */
#if (defined(OS5) || defined(__CYGWIN__)) && !defined(O_ASYNC)
/* Cygwin and Solaris don't define O_ASYNC, yet still define FASYNC. */
@@ -47,9 +49,6 @@
#include "commondefs.h"
#include "mkcelldefs.h"
#ifdef GCC386
#include "inlnPS2.h"
#endif
#define TCPhostlookup 0
#define TCPservicelookup 1
@@ -76,6 +75,7 @@ fd_set LispIOFds;
LispPTR subr_TCP_ops(int op, LispPTR nameConn, LispPTR proto, LispPTR length, LispPTR bufaddr, LispPTR maxlen)
{
#ifndef DOS
int sock, len, buflen, res;
unsigned ures;
char namestring[100];
@@ -332,4 +332,5 @@ LispPTR subr_TCP_ops(int op, LispPTR nameConn, LispPTR proto, LispPTR length, Li
default: return (NIL); break;
}
#endif /* DOS */
}

View File

@@ -18,20 +18,6 @@
#include <stdio.h>
#include <unistd.h>
#ifdef SUNDISPLAY
#ifndef NOPIXRECT
#include <sunwindow/window_hs.h>
#include <sunwindow/cms.h>
#include <sunwindow/win_ioctl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <pixrect/pixrect_hs.h>
#include <sun/fbio.h>
#include <sys/ioctl.h>
#include <sys/file.h>
#include <pixrect/pr_planegroups.h>
#endif /* NOPIXRECT */
#endif /* SUNDISPLAY */
#ifdef OS4
#include <vfork.h>
@@ -60,12 +46,15 @@
#include "xcursordefs.h"
#endif
#if defined(XWINDOW)
#ifdef DOS
#define getpagesize() 512
#endif /* DOS */
#if defined(XWINDOW) || defined(DOS)
#include "devif.h"
DLword *DisplayRegion68k_end_addr;
extern DspInterface currentdsp;
int DisplayWidth8;
#endif /* XWINDOW */
#endif /* DOS */
/* from /usr/include/sun/fbio.h some machines don't have following def. */
#ifndef FBTYPE_SUNROP_COLOR
@@ -73,21 +62,6 @@ int DisplayWidth8;
#define FBTYPE_SUNFAST_COLOR 12
#endif
#ifdef SUNDISPLAY
struct screen LispScreen;
#ifndef NOPIXRECT
struct pixrect *CursorBitMap, *InvisibleCursorBitMap;
struct pixrect *SrcePixRect, *DestPixRect;
#ifdef DISPLAYBUFFER
int black = 0, white = -1;
struct pixrect *ColorDisplayPixrect, *DisplayRegionPixrect;
#define COPY_PIXRECT_TO_COLOR (PIX_SRC /*| PIX_DONTCLIP */)
#ifdef DEBUG
int oldred[2], oldgreen[2], oldblue[2];
#endif /* DEBUG */
#endif /* DISPLAYBUFFER */
#endif /* NOPIXRECT */
#endif /* SUNDISPLAY */
int LispWindowFd = -1;
int FrameBufferFd = -1;
@@ -104,10 +78,6 @@ DLword *DisplayRegion68k_end_addr;
/* some functions use this variable when undef DISPLAYBUFFER */
DLword *DISP_MAX_Address;
#ifdef SUNDISPLAY
struct cursor CurrentCursor, InvisibleCursor;
struct winlock DisplayLockArea;
#endif /* SUNDISPLAY */
extern DLword *EmCursorBitMap68K;
extern IFPAGE *InterfacePage;
@@ -124,13 +94,6 @@ DLword *DisplayRegion68k_end_addr;
extern int *Xdisplay; /* DAANGER -jarl nilsson 27-apr-92 */
#endif /* XWINDOW */
#ifdef SUNDISPLAY
/* For SunOS4.1 Window Security Feature. */
int Win_security_p;
#include <sys/wait.h>
#define SV_ACQUIRE "/bin/sunview1/sv_acquire"
#define SV_RELEASE "/bin/sunview1/sv_release"
#endif /* SUNDISPLAY */
/************************************************************************/
/* */
@@ -141,30 +104,6 @@ int Win_security_p;
/************************************************************************/
void init_cursor() {
#ifdef SUNDISPLAY
#ifndef NOPIXRECT
CursorBitMap = mem_create(CURSORWIDTH, CURSORHEIGHT, 1);
mpr_mdlinebytes(CursorBitMap) = CURSORWIDTH >> 3; /* 2(byte) */
#endif /* NOPIXRECT */
CurrentCursor.cur_xhot = 0;
CurrentCursor.cur_yhot = 0;
CurrentCursor.cur_shape = CursorBitMap;
CurrentCursor.cur_function = PIX_SRC | PIX_DST;
/* Invisible Cursor */
#ifndef NOPIXRECT
InvisibleCursorBitMap = mem_create(0, 0, 1);
#endif /* NOPIXRECT */
InvisibleCursor.cur_xhot = 0;
InvisibleCursor.cur_yhot = 0;
InvisibleCursor.cur_shape = InvisibleCursorBitMap;
InvisibleCursor.cur_function = /*PIX_SRC |*/ PIX_DST;
win_setcursor(LispWindowFd, &InvisibleCursor);
win_setmouseposition(LispWindowFd, 0, 0);
#endif /* SUNDISPLAY */
}
/************************************************************************/
@@ -175,18 +114,6 @@ void init_cursor() {
/* */
/************************************************************************/
void set_cursor() {
#ifdef SUNDISPLAY
#ifdef OLD_CURSOR
(mpr_d(CursorBitMap))->md_image = (short *)(IOPage->dlcursorbitmap);
/* BitmapBase of CurrentCursor
* is set to IOPage->dlcursorbitmap
*/
if (win_setcursor(LispWindowFd, &CurrentCursor) == -1) perror("SET Cursor");
if (win_setmouseposition(LispWindowFd, 0, 0) == -1) perror("SET Mouse POS");
#else
if (win_setcursor(LispWindowFd, &InvisibleCursor) == -1) perror("SET Cursor:");
#endif
#endif /* SUNDISPLAY */
#ifdef XWINDOW
Init_XCursor();
@@ -205,23 +132,12 @@ void set_cursor() {
#ifndef COLOR
void clear_display() {
#ifdef SUNDISPLAY
#ifndef DISPLAYBUFFER
register short *word;
register int w, h;
word = (short *)DisplayRegion68k;
for (h = displayheight; (h--);) {
for (w = DisplayRasterWidth; (w--);) { *word++ = 0; }
}
#else
pr_rop(ColorDisplayPixrect, 0, 0, displaywidth, displayheight, PIX_CLR, ColorDisplayPixrect, 0,
0);
/* Original images are still kept in SYSOUT(DisplayRegion) */
/* clear_CG6; */
#endif /* DISPLAYBUFFER */
#endif /* SUNDISPLAY */
#ifdef DOS
TPRINT(("Enter Clear_display\n"));
(currentdsp->cleardisplay)(currentdsp);
TPRINT(("Exit Clear_display\n"));
#endif /* DOS */
}
#else /* COLOR */
@@ -253,84 +169,13 @@ void clear_display() {
void init_display2(DLword *display_addr, int display_max)
{
#ifdef SUNDISPLAY
#ifndef DISPLAYBUFFER
int mmapstat;
#endif
int fbgattr_result;
struct fbtype my_screen;
char groups[PIXPG_OVERLAY + 1];
struct fbgattr FBattr;
struct pixrect *ColorFb;
#endif /* SUNDISPLAY */
#ifdef SUNDISPLAY
/* For SunOS4.1 Window Security Feature. */
union wait status;
/* Window Security is available? */
if (!access(SV_ACQUIRE, F_OK))
Win_security_p = 1;
else
Win_security_p = 0;
if (Win_security_p) {
switch (vfork()) {
case -1: /* Error */ (void)fprintf(stderr, "init_display: Fork failed.\n"); exit(1);
case 0: /* Child */
(void)execl(SV_ACQUIRE, "sv_acquire", "0", "256", "250", 0);
/* should not return */
(void)fprintf(stderr, "init_display: exec for sv_acquire failed\n");
exit(1);
default: /* Parent */
/* do nothing */
break;
}
(void)wait(&status); /* child dies after changing 6 */
if (status.w_retcode != 0) {
(void)fprintf(stderr, "init_display: failed to set ownership of win devices\n");
exit(1);
}
}
#endif /* SUNDISPLAY */
#ifdef SUNDISPLAY
if ((LispWindowFd = win_screennew(&LispScreen)) == -1) {
perror("init_display: can't create LispWindow\n");
exit(-1);
} else {
#ifdef KBINT
/* int_io_open(LispWindowFd); JDS 4/27/94 move to initkbd, to try preventing the
* move-mouse-never-get-kbd bug */
#endif
fcntl(LispWindowFd, F_SETFL, fcntl(LispWindowFd, F_GETFL, 0) | O_NONBLOCK);
}
#endif /* SUNDISPLAY */
DisplayRegion68k = (DLword *)display_addr;
#ifdef SUNDISPLAY
if ((FrameBufferFd = open(LispScreen.scr_fbname, 2)) == -1) {
perror("init_display: can't open FrameBuffer\n");
exit(-1);
}
/* initialize Display parameters */
if (ioctl(FrameBufferFd, FBIOGTYPE, &my_screen) == -1) {
perror("init_display: can't find screen parameters\n");
exit(-1);
}
displaywidth = my_screen.fb_width;
displayheight = my_screen.fb_height;
#endif /* SUNDISPLAY */
#if defined(XWINDOW)
#if (defined(XWINDOW) || defined(DOS))
(currentdsp->device.enter)(currentdsp);
displaywidth = currentdsp->Display.width;
displayheight = currentdsp->Display.height;
@@ -343,146 +188,7 @@ void init_display2(DLword *display_addr, int display_max)
DBPRINT(("FBIOGTYPE w x h = %d x %d\n", displaywidth, displayheight));
DBPRINT(("FBIOGTYPE w x h = %d x %d\n", displaywidth, displayheight));
#ifdef SUNDISPLAY
DBPRINT((" (real) type = %d\n", my_screen.fb_type));
DBPRINT((" (real) bpp = %d\n", my_screen.fb_depth));
#endif /* SUNDISPLAY */
#ifdef SUNDISPLAY
/** now attempt to use the FBIOGATTR call for more information **/
fbgattr_result = ioctl(FrameBufferFd, FBIOGATTR, &FBattr);
if (fbgattr_result >= 0) {
DBPRINT(("FBIOGATTR realtype = %d\n", FBattr.real_type));
DBPRINT((" (real) size = %d x %d\n", FBattr.fbtype.fb_width, FBattr.fbtype.fb_height));
DBPRINT((" (real) type = %d\n", FBattr.fbtype.fb_type));
DBPRINT((" (real) bpp = %d\n", FBattr.fbtype.fb_depth));
DBPRINT((" emuls= %d %d %d %d\n", FBattr.emu_types[0], FBattr.emu_types[1],
FBattr.emu_types[2], FBattr.emu_types[3]));
} else { /* fill in defaults */
FBattr.real_type = my_screen.fb_type;
}
DBPRINT(("init_display: FBIOGATTR_result = %d\n", fbgattr_result));
/* probe for DISPLAY type */
/**********************************************************************
* FB-TYPE REAL-TYPE
* BW2 2 x
* CG2 3 3
* CG3 8 6
* CG4 2 8
* CG6 8 12
* CG8 6 7
* CG9(GP1) 4 4 ;gpconfig -f -b
* CG9(GP1) 2 13 ;gpconfig gpone0 -f -b cgtwo0
* ;We assume This config for GXP model
***********************************************************************/
/* Medley supports real (or emulated) BW2, so check for that first */
#ifndef DISPLAYBUFFER
if ((my_screen.fb_type == FBTYPE_SUN2BW) /* real or emulated bwtwo */
|| (my_screen.fb_type == FBTYPE_SUN3COLOR)) /* Sun 3 color? */
switch (FBattr.real_type) {
case FBTYPE_SUN2BW: DisplayType = SUN2BW; break;
case FBTYPE_MEMCOLOR: /* memory 24-bit (CG8) */
{
DisplayType = SUNMEMCOLOR;
ColorFb = pr_open("/dev/fb");
pr_available_plane_groups(ColorFb, sizeof(groups), groups);
if (groups[PIXPG_OVERLAY] && groups[PIXPG_OVERLAY_ENABLE]) {
pr_set_plane_group(ColorFb, PIXPG_OVERLAY_ENABLE);
pr_rop(ColorFb, 0, 0, ColorFb->pr_width, ColorFb->pr_height, PIX_SET, 0, 0, 0);
pr_set_plane_group(ColorFb, PIXPG_OVERLAY);
}
} break;
case FBTYPE_SUN4COLOR: /* cg4 */
case FBTYPE_SUNROP_COLOR: /* cg9(GXP) */
{ /* need to clear overlay plane */
DisplayType = SUN4COLOR;
ColorFb = pr_open("/dev/fb");
pr_available_plane_groups(ColorFb, sizeof(groups), groups);
if (groups[PIXPG_OVERLAY] && groups[PIXPG_OVERLAY_ENABLE]) {
pr_set_plane_group(ColorFb, PIXPG_OVERLAY_ENABLE);
pr_rop(ColorFb, 0, 0, ColorFb->pr_width, ColorFb->pr_height, PIX_SET, 0, 0, 0);
pr_set_plane_group(ColorFb, PIXPG_OVERLAY);
}
break;
}
default:
printf("initdisplay: Unsupported FBreal_type %d\n", FBattr.real_type);
DisplayType = (my_screen.fb_type) << 3;
/* should be able to proceed, since its an emulated bwtwo */
}
else { /* not currently a SUN2BW, perhaps can emulate it? */
if (fbgattr_result >= 0) { /* got gattrs, can try sattr */
#ifdef DEBUG
error("fb bwtwo emulation not implemented, q to proceed\n");
#endif /* DEBUG */
} else {
error("Not cgfour or bwtwo, q to attempt to proceed");
}
printf("initdisplay: Unsupported FBreal_type %d\n", FBattr.real_type);
DisplayType = (my_screen.fb_type) << 3;
/* try to muddle on */
}
#else /* DISPLAYBUFFER is defined, then: */
DisplayRegion68k_end_addr = DisplayRegion68k + DisplayRasterWidth * displayheight;
if (my_screen.fb_type == FBTYPE_SUN2BW) /* real or emulated bwtwo */
switch (FBattr.real_type) {
case FBTYPE_SUN4COLOR: { /* need to clear overlay plane */
DisplayType = SUN4COLOR;
ColorFb = pr_open("/dev/fb");
pr_available_plane_groups(ColorFb, sizeof(groups), groups);
if (groups[PIXPG_OVERLAY] && groups[PIXPG_OVERLAY_ENABLE]) {
pr_set_plane_group(ColorFb, PIXPG_OVERLAY_ENABLE);
pr_rop(ColorFb, 0, 0, ColorFb->pr_width, ColorFb->pr_height, PIX_CLR, 0, 0, 0);
pr_set_plane_group(ColorFb, PIXPG_8BIT_COLOR);
}
ColorDisplayPixrect = ColorFb;
break;
}
default: ColorDisplayPixrect = pr_open("/dev/fb"); break;
}
else if (my_screen.fb_type == FBTYPE_SUN4COLOR) { /* cg3 or cg6 */
switch (FBattr.real_type) {
case FBTYPE_SUN3COLOR: /* cg3 */
/* DisplayType = SUN3COLOR; */
DisplayType = (FBattr.real_type) << 3;
break;
case FBTYPE_SUNFAST_COLOR: /* cg6 */
/* DisplayType = SUNFASTCOLOR; */
DisplayType = (FBattr.real_type) << 3;
break;
default: /* unknown display */ DisplayType = (FBattr.real_type) << 3; break;
} /* end switch */
ColorDisplayPixrect = pr_open("/dev/fb");
} /* end else if() */
else
ColorDisplayPixrect = pr_open("/dev/fb");
DisplayRegionPixrect = mem_point(displaywidth, displayheight, 1, display_addr);
#ifdef DEBUG
pr_getcolormap(ColorDisplayPixrect, 0, 2, oldred, oldgreen, oldblue);
#endif /* DEBUG */
DBPRINT(("Color map for color pixrect:\n 0: R: %d, G: %d, B: %d\n 1: R: %d, G: %d, B: %d\n",
oldred[0], oldgreen[0], oldblue[0], oldred[1], oldgreen[1], oldblue[1]));
DBPRINT(("Color depth = %d.\n", ColorDisplayPixrect->pr_depth));
pr_putcolormap(ColorDisplayPixrect, 1, 1, &black, &black, &black);
pr_putcolormap(ColorDisplayPixrect, 0, 1, &white, &white, &white);
pr_putcolormap(ColorDisplayPixrect, 255, 1, &black, &black, &black);
pr_putcolormap(ColorDisplayPixrect, (1 << ColorDisplayPixrect->pr_depth) - 1, 1, &black, &black,
&black);
#endif
DisplayLockArea.wl_rect.r_width = displaywidth;
DisplayLockArea.wl_rect.r_height = displayheight;
#endif /* SUNDISPLAY */
#ifdef XWINDOW
DisplayType = SUN2BW;
@@ -496,35 +202,15 @@ void init_display2(DLword *display_addr, int display_max)
DBPRINT((" length : 0x%x\n", DisplayByteSize));
DBPRINT((" pg size: 0x%x\n", getpagesize()));
#ifdef SUNDISPLAY
#ifndef DISPLAYBUFFER
mmapstat = (int)mmap(DisplayRegion68k, DisplayByteSize, PROT_READ | PROT_WRITE,
#ifdef OS4
MAP_FIXED |
#endif
MAP_SHARED,
FrameBufferFd, 0);
DBPRINT(("after mmap: 0x%x\n", mmapstat));
if (mmapstat == -1) {
perror("init_display: ERROR at mmap system call\n");
exit(0);
}
#endif /* ifndef DISPLAYBUFFER */
DBPRINT(("after mem_point\n"));
#endif /* SUNDISPLAY */
#ifdef DOS
(currentdsp->cleardisplay)(currentdsp);
#else /* DOS */
clear_display();
#endif /* DOS */
DBPRINT(("after clear_display()\n"));
#if defined(SUNDISPLAY) && !defined(NOPIXRECT)
/* initialize pixrect used in pilotbitblt */
SrcePixRect = mem_point(0, 0, 1, NULL);
DestPixRect = mem_point(0, 0, 1, NULL);
#endif
DBPRINT(("exiting init_display\n"));
}
@@ -537,52 +223,19 @@ void init_display2(DLword *display_addr, int display_max)
/* */
/************************************************************************/
void display_before_exit() {
#ifdef SUNDISPLAY
union wait status;
#endif /* SUNDISPLAY */
#ifdef TRUECOLOR
truecolor_before_exit();
#endif /* TRUECOLOR */
clear_display();
#ifdef SUNDISPLAY
/* win_remove( LispWindowFd ); */
win_screendestroy(LispWindowFd);
#ifdef KBINT
int_io_close(LispWindowFd);
#endif
close(LispWindowFd);
if (Win_security_p) {
switch (vfork()) {
case -1: /* Error */ (void)fprintf(stderr, "display_before_exit: Fork failed.\n"); exit(1);
case 0: /* Child */
(void)execl(SV_RELEASE, "sv_release", 0);
/* should not return */
(void)fprintf(stderr, "display_before_exit: exec for sv_release failed\n");
exit(1);
default: /* Parent */
/* do nothing */
break;
}
(void)wait(&status);
if (status.w_retcode != 0) {
(void)fprintf(stderr, "display_before_raid: failed to set ownership of win devices\n");
exit(1);
}
}
#endif /* SUNDISPLAY */
#if defined(XWINDOW)
#if defined(XWINDOW) || defined(DOS)
(currentdsp->device.exit)(currentdsp);
#endif /* XWINDOW */
#endif /* DOS */
}
#if defined(DISPLAYBUFFER)
#if defined(DISPLAYBUFFER) || defined(DOS)
/************************************************************************/
/* */
/* i n _ d i s p l a y _ s e g m e n t */
@@ -613,18 +266,17 @@ in_display_segment(baseaddr)
/************************************************************************/
void flush_display_buffer() {
#ifdef SUNDISPLAY
#ifdef DISPLAYBUFFER
pr_rop(ColorDisplayPixrect, 0, 0, displaywidth, displayheight, COPY_PIXRECT_TO_COLOR,
DisplayRegionPixrect, 0, 0);
#endif /* DISPLAYBUFFER */
#endif /* SUNDISPLAY */
#ifdef XWINDOW
(currentdsp->bitblt_to_screen)(currentdsp, DisplayRegion68k, currentdsp->Visible.x,
currentdsp->Visible.y, currentdsp->Visible.width,
currentdsp->Visible.height);
#endif /* XWINDOW */
#elif DOS
TPRINT(("Enter flush_display_buffer\n"));
(currentdsp->bitblt_to_screen)(currentdsp, DisplayRegion68k, 0, 0, currentdsp->Display.width,
currentdsp->Display.height);
TPRINT(("Exit flush_display_buffer\n"));
#endif /* DOS */
}
/************************************************************************/
@@ -645,19 +297,12 @@ void flush_display_buffer() {
void flush_display_region(int x, int y, int w, int h)
{
#ifdef SUNDISPLAY
#ifdef DISPLAYBUFFER
pr_rop(ColorDisplayPixrect, x, y, w, h, COPY_PIXRECT_TO_COLOR, DisplayRegionPixrect, x, y);
#endif /* DISPLAYBUFFER */
#endif /* SUNDISPLAY */
#if defined(XWINDOW)
#if (defined(XWINDOW) || defined(DOS))
TPRINT(("Enter flush_display_region x=%d, y=%d, w=%d, h=%d\n", x, y, w, h));
(currentdsp->bitblt_to_screen)(currentdsp, DisplayRegion68k, x, y, w, h);
TPRINT(("Exit flush_display_region\n"));
#endif /* XWINDOW */
#endif /* DOS */
}
#ifdef BYTESWAP
void byte_swapped_displayregion(int x, int y, int w, int h)
@@ -695,19 +340,12 @@ void flush_display_lineregion(UNSIGNED x, DLword *ybase, UNSIGNED w, UNSIGNED h)
{
int y;
y = ((DLword *)ybase - DisplayRegion68k) / DLWORD_PERLINE;
#ifdef SUNDISPLAY
#ifdef DISPLAYBUFFER
pr_rop(ColorDisplayPixrect, x, y, w, h, COPY_PIXRECT_TO_COLOR, DisplayRegionPixrect, x, y);
#endif /* DISPLAYBUFFER */
#endif /* SUNDISPLAY */
#if defined(XWINDOW)
#if (defined(XWINDOW) || defined(DOS))
TPRINT(("Enter flush_display_lineregion x=%d, y=%d, w=%d, h=%d\n", x, y, w, h));
(currentdsp->bitblt_to_screen)(currentdsp, DisplayRegion68k, x, y, w, h);
TPRINT(("Exit flush_display_lineregion\n"));
#endif /* XWINDOW */
#endif /* DOS */
}
/************************************************************************/
@@ -734,11 +372,9 @@ void flush_display_ptrregion(DLword *ybase, UNSIGNED bitoffset, UNSIGNED w, UNSI
y = baseoffset / DLWORD_PERLINE;
x = bitoffset + (BITSPERWORD * (baseoffset - (DLWORD_PERLINE * y)));
#if (defined(SUNDISPLAY) && defined(DISPLAYBUFFER))
pr_rop(ColorDisplayPixrect, x, y, w, h, COPY_PIXRECT_TO_COLOR, DisplayRegionPixrect, x, y);
#elif defined(XWINDOW)
#if (defined(XWINDOW) || defined(DOS))
TPRINT(("Enter flush_display_ptrregion\n x=%d, y=%d, w=%d, h=%d\n", x, y, w, h));
(currentdsp->bitblt_to_screen)(currentdsp, DisplayRegion68k, x, y, w, h);
TPRINT(("Exit flush_display_ptrregion\n"));
#endif /* SUNDISPLAY & DISPLAYBUFFER, XWINDOW */
#endif /* DOS */
}

View File

@@ -17,18 +17,20 @@
#include <string.h>
#include <sys/types.h>
#ifndef DOS
#include <sys/file.h>
#include <sys/select.h>
#endif /* DOS */
#ifdef DOS
#include <i32.h> /* "#pragma interrupt" & '_chain_intr'*/
#include <dos.h> /* defines REGS & other structs */
#include <stdio.h> /* define NULL */
#include <conio.h>
#include <time.h>
#include <stk.h>
#endif /* DOS */
#ifdef SUNDISPLAY
#include <sundev/kbd.h>
#include <sundev/kbio.h>
#include <sunwindow/window_hs.h>
#include <sunwindow/cms.h>
#include <sys/ioctl.h>
#include <sunwindow/win_ioctl.h>
#include <pixrect/pixrect_hs.h>
#endif /* SUNDISPLAY */
#ifdef XWINDOW
#include <X11/Xlib.h>
@@ -59,9 +61,12 @@
extern DspInterface currentdsp;
#endif /* XWINDOW */
#ifdef SUNDISPLAY
extern struct screen LispScreen;
#endif /* SUNDISPLAY */
#ifdef DOS
#include "devif.h"
extern MouseInterface currentmouse;
extern KbdInterface currentkbd;
extern DspInterface currentdsp;
#endif /* DOS */
extern int LispWindowFd;
int LispKbdFd = -1;
@@ -71,9 +76,6 @@ int DebugKBD = NIL;
FILE *KBlog;
extern fd_set LispReadFds;
#ifdef SUNDISPLAY
struct inputmask LispEventMask;
#endif /* SUNDISPLAY */
IOPAGE *IOPage68K;
@@ -197,57 +199,38 @@ u_char DOSLispKeyMap_101[0x80] = {
void init_keyboard(int flg) /* if 0 init else re-init */
{
#ifdef SUNDISPLAY
int keytrans;
#endif
set_kbd_iopointers();
#ifdef SUNDISPLAY
if ((LispKbdFd = open(LispScreen.scr_kbdname, O_RDWR)) == -1) {
fprintf(stderr, "can't open %s\n", LispScreen.scr_kbdname);
exit(-1);
}
#endif /* SUNDISPLAY */
if (flg == 0) { keyboardtype(LispKbdFd); }
#ifdef SUNDISPLAY
keytrans = TR_UNTRANS_EVENT; /* keyboard does not encode key */
if (ioctl(LispKbdFd, KIOCTRANS, &keytrans) == -1) {
fprintf(stderr, "Error at ioctl errno =%d\n", errno);
exit(-1);
}
close(LispKbdFd);
#ifdef KBINT
int_io_open(LispWindowFd); /* from init_dsp, try to prevent mouse-move-no-kbd bug */
#endif /* KBINT */
seteventmask(&LispEventMask);
#elif XWINDOW
#if XWINDOW
init_Xevent(currentdsp);
#endif /* SUNDISPLAY, XWINDOW */
#elif DOS
if (flg == 0) { /* Install the handlers ONLY when we */
/* init the kbd the init the kbd the */
/* first time. */
/* turn on kbd */
make_kbd_instance(currentkbd);
(currentkbd->device.enter)(currentkbd);
/* turn on mouse */
make_mouse_instance(currentmouse);
(currentmouse->device.enter)(currentmouse, currentdsp);
}
#endif /* XWINDOW DOS */
}
/* ----------------------------------------------------------------*/
void device_before_exit() {
#ifdef SUNDISPLAY
int keytrans;
if ((LispKbdFd = open(LispScreen.scr_kbdname, O_RDWR)) == -1) {
fprintf(stderr, "can't open %s\n", LispScreen.scr_kbdname);
exit(-1);
}
keytrans = TR_EVENT; /* keyboard encodes key */
if (ioctl(LispKbdFd, KIOCTRANS, &keytrans) == -1) {
fprintf(stderr, "Error at ioctl errno =%d\n", errno);
exit(-1);
}
close(LispKbdFd);
#endif /* SUNDISPLAY */
#if DOS
(currentmouse->device.exit)(currentmouse, currentdsp);
(currentkbd->device.exit)(currentkbd);
#endif /* SUNDISPLAY DOS*/
display_before_exit();
}
@@ -282,24 +265,6 @@ void set_kbd_iopointers() {
/* ----------------------------------------------------------------*/
#ifdef SUNDISPLAY
void seteventmask(struct inputmask *eventmask)
{
input_imnull(eventmask);
eventmask->im_flags |= IM_ASCII | IM_NEGASCII | IM_NEGEVENT;
win_setinputcodebit(eventmask, MS_LEFT);
win_setinputcodebit(eventmask, MS_MIDDLE);
win_setinputcodebit(eventmask, MS_RIGHT);
win_setinputcodebit(eventmask, LOC_MOVE);
win_unsetinputcodebit(eventmask, LOC_STILL);
win_unsetinputcodebit(eventmask, LOC_MOVEWHILEBUTDOWN);
win_unsetinputcodebit(eventmask, LOC_WINENTER);
win_unsetinputcodebit(eventmask, LOC_WINEXIT);
win_setinputmask(LispWindowFd, eventmask, eventmask, WIN_NULLLINK);
}
#endif /* SUNDISPLAY */
#define MIN_KEYTYPE 3
#define KB_AS3000J (7 + MIN_KEYTYPE)
@@ -307,7 +272,7 @@ void seteventmask(struct inputmask *eventmask)
#define KB_DEC3100 (9 + MIN_KEYTYPE) /* TODO: Can we remove this? */
#define KB_HP9000 (10 + MIN_KEYTYPE) /* TODO: Can we remove this? */
#define KB_X (11 + MIN_KEYTYPE)
#define KB_DOS (12 + MIN_KEYTYPE) /* TODO: Can we remove this? */
#define KB_DOS (12 + MIN_KEYTYPE)
/* KB_SUN4 not defined in older OS versions */
#ifndef KB_SUN4
@@ -378,7 +343,7 @@ static u_char *make_X_keymap() {
XDisplayKeycodes(currentdsp->display_id, &minkey, &maxkey);
codecount = maxkey + 1 - minkey;
mapping = XGetKeyboardMapping(currentdsp->display_id, minkey, codecount, &symspercode);
XUNLOCK;
XUNLOCK(currentdsp);
for (; *key_sym_pairs != -1;) {
int reusable = *key_sym_pairs++, code = *key_sym_pairs++, sym = *key_sym_pairs++, xcode;
@@ -465,11 +430,8 @@ void keyboardtype(int fd)
if ((key = getenv("LDEKBDTYPE")) == 0) {
#ifdef XWINDOW
type = KB_X;
#elif SUNDISPLAY
if (ioctl(fd, KIOCTYPE, &type) != 0) {
error("keyboardtype:IOCTL(KIOCTYPE) fails (cont. w. type-3");
type = KB_SUN3;
} /* otherwise, type is set */
#elif DOS
type = KB_DOS;
#endif /* XWINDOW */
} /* if end */
else {
@@ -522,6 +484,12 @@ void keyboardtype(int fd)
break;
#endif /* XWINDOW */
#ifdef DOS
case KB_DOS:
SUNLispKeyMap = DOSLispKeyMap_101;
InterfacePage->devconfig |= KB_SUN3 - MIN_KEYTYPE; /* 10 */
break;
#endif /* DOS */
default: {
char errmsg[200];
sprintf(errmsg, "Unsupported keyboard type: %d", type);

View File

@@ -20,9 +20,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#ifndef DOS
#include <pwd.h>
#endif
#include "hdw_conf.h"
#include "lispemul.h"
@@ -136,17 +139,19 @@ void init_ifpage(int sysout_size) {
#ifdef BIGVM
/* For BIGVM system, save the value in \LASTVMEMFILEPAGE for lisp's use */
if ((LispPTR)LASTVMEMFILEPAGE_word != 0xFFFFFFFF)
*LASTVMEMFILEPAGE_word = InterfacePage->dllastvmempage;
*LASTVMEMFILEPAGE_word = InterfacePage->dllastvmempage;
#endif /* BIGVM */
/* unfortunately, Lisp only looks at a 16 bit serial number */
#ifndef DOS
InterfacePage->serialnumber = 0xffff & gethostid();
#endif /* DOS */
/* get user name and stuff into vmem; this is the VMEM buffer;
This is a BCPL string -- it starts with a length count. C strings
are null terminated instead */
InterfacePage->usernameaddr = 0;
#ifndef DOS
{
struct passwd *pwd;
char *s;
@@ -170,6 +175,7 @@ are null terminated instead */
}
}
#endif /* DOS */
/* Days from Oct-13-87 12:00 It's Takeshi's birthday. */
/* MDate may be set by vdate.c, generated by mkvdate.c. */

39
src/kbdif.c Normal file
View File

@@ -0,0 +1,39 @@
/* $Id: kbdif.c,v 1.3 1999/05/31 23:35:35 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989, 1990, 1990, 1991, 1992, 1993, 1994, 1995 Venue. */
/* All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/************************************************************************/
#include "version.h"
/* * K Y E B O A R D I N T E R F A C E * */
#include "lispemul.h"
#include "dbprint.h"
#include "devif.h"
KbdInterfaceRec curkbd;
KbdInterface currentkbd = &curkbd;
#ifdef DOS
extern void Kbd_event();
extern void EnterDosKbd();
extern void ExitDosKbd();
extern unsigned long GenericReturnT();
#endif /* DOS */
void make_kbd_instance(KbdInterface kbd) {
#ifdef DOS
kbd->device_event = &Kbd_event; /* */
kbd->device.enter = &EnterDosKbd;
kbd->device.exit = &ExitDosKbd;
kbd->device.before_raid = &ExitDosKbd;
kbd->device.after_raid = &EnterDosKbd;
kbd->device.active = FALSE;
#elif XWINDOW
#endif /* DOS or XWINDOW */
}

View File

@@ -12,16 +12,16 @@
#include <errno.h>
#include <stdio.h>
#ifdef DOS
#include <time.h>
#include <conio.h>
#else
#include <sys/time.h>
#include <sys/types.h>
#include <sys/file.h>
#include <sys/select.h>
#endif /* DOS */
#ifdef SUNDISPLAY
#include <sundev/kbd.h>
#include <sundev/kbio.h>
#include <sunwindow/window_hs.h>
#endif /* SUNDISPLAY */
#include "lispemul.h"
@@ -32,11 +32,16 @@
#include "xwinmandefs.h"
#endif
#if XWINDOW
#ifdef DOS
#define PORT_A 0x60
#include "devif.h"
extern KbdInterface currentkbd;
extern DspInterface currentdsp;
#endif /* XWINDOW */
#elif XWINDOW
#include "devif.h"
extern KbdInterface currentkbd;
extern DspInterface currentdsp;
#endif /* DOS */
/****************************************************
*
@@ -45,9 +50,6 @@ extern DspInterface currentdsp;
*
****************************************************/
#ifdef SUNDISPLAY
extern struct screen LispScreen;
#endif /* SUNDISPLAY */
#ifdef XWINDOW
#include <X11/Xlib.h>
@@ -62,17 +64,17 @@ void KB_enable(LispPTR *args) /* args[0] : ON/OFF flag
*/
{
if (args[0] == ATOM_T) {
#ifdef SUNDISPLAY
FD_SET(LispWindowFd, &LispReadFds);
#elif XWINDOW
#if XWINDOW
enable_Xkeyboard(currentdsp);
#endif /* SUNDISPLAY, XWINDOW */
#elif DOS
(currentkbd->device.enter)(currentkbd);
#endif /* DOS */
} else if (args[0] == NIL) {
#ifdef SUNDISPLAY
FD_CLR(LispWindowFd, &LispReadFds);
#elif XWINDOW
#if XWINDOW
disable_Xkeyboard(currentdsp);
#endif /* SUNDISPLAY, XWINDOW */
#elif DOS
(currentkbd->device.exit)(currentkbd);
#endif /* DOS */
} else {
error("KB_enable: illegal arg \n");
printf("KB_enable: arg = %d\n", args[0]);
@@ -92,36 +94,34 @@ struct timeval belltime ={
*/
extern int LispKbdFd;
#ifdef DOS
int bell_status_word;
#endif /* DOS */
void KB_beep(LispPTR *args) /* args[0] : ON/OFF flag
* T -- ON
* NIL -- OFF
* args[1] : frequency
*/
{
#ifdef SUNDISPLAY
int keycommand;
/* belltime.tv_usec = args[1] & 0xffff;
win_bell(LispWindowFd, belltime, 0);
*/
if ((LispKbdFd = open(LispScreen.scr_kbdname, O_RDWR)) == -1)
fprintf(stderr, "can't open %s, errno=%d\n", LispScreen.scr_kbdname, errno);
if (args[0] == ATOM_T) {
keycommand = KBD_CMD_BELL; /* Turn on the bell */
if (ioctl(LispKbdFd, KIOCCMD, &keycommand) == -1)
fprintf(stderr, "Error at ioctl errno =%d\n", errno);
} else {
keycommand = KBD_CMD_NOBELL; /* Turn off the bell */
if (ioctl(LispKbdFd, KIOCCMD, &keycommand) == -1)
fprintf(stderr, "Error at ioctl errno =%d\n", errno);
}
close(LispKbdFd);
#elif XWINDOW
#if XWINDOW
if (args[0] == ATOM_T) beep_Xkeyboard(currentdsp);
#endif /* SUNDISPLAY, XWINDOW */
#elif DOS
if (args[0] == ATOM_T) {
bell_status_word = inp(0x61);
outp(0x61, bell_status_word | 0x3); /* Turn on the speaker */
/* Prepare timer by sending 10111100 to port 43. */
outp(0x43, 0xb6);
/* Divide input frequency by timer ticks per second and
* write (byte by byte) to timer. */
outp(0x42, (char)(1193180L / (LispIntToCInt(args[1]))));
outp(0x42, (char)(1193180L / (LispIntToCInt(args[1])) >> 8));
} else {
outp(0x61, bell_status_word & ~0x3); /* Turn off the speaker (with */
/* bits 0 and 1). */
}
#endif /* SUNDISPLAY, XWINDOW, DOS */
}
/****************************************************
@@ -152,4 +152,9 @@ void KB_setmp(LispPTR *args) /* args[0] : MPCODE */
void KB_setled(LispPTR *args)
{
#ifdef DOS
outp(PORT_A, (unsigned char)0xED);
outp(PORT_A,
(unsigned char)(((args[0] != NIL) << 2) | ((args[1] != NIL) << 1) | (args[2] != NIL)));
#endif /* DOS */
}

View File

@@ -20,17 +20,25 @@
#include <signal.h>
#include <sys/types.h>
#include <string.h>
#ifndef DOS
#include <sys/file.h>
#include <sys/ioctl.h>
#include <sys/select.h>
#include <sys/time.h>
#if SUNDISPLAY
#include <sunwindow/window_hs.h>
#include <sunwindow/win_ioctl.h>
#include <suntool/window.h>
#include <ctype.h>
#include <sundev/kbio.h>
#endif /* SUNDISPLAY */
#else
#include <time.h>
#endif /* DOS */
#ifdef DOS
#include <i32.h> /* Defines "#pragma interrupt" */
#include <dos.h> /* Defines REGS & other structs */
#include <stk.h> /* _XSTACK struct definition */
#pragma interrupt(Mouse_hndlr)
void Mouse_hndlr(void); /* Fields mouse events from driver */
/* (during servicing of mouse interrupt) */
#endif /* DOS */
#include "lispemul.h"
#include "lspglob.h"
@@ -57,11 +65,11 @@
#endif /* MAIKO_ENABLE_ETHERNET */
#include "dbprint.h"
#if defined(XWINDOW)
#if (defined(DOS) || defined(XWINDOW))
#include "devif.h"
extern DspInterface currentdsp;
extern IOPAGE *IOPage68K;
#endif /* XWINDOW */
#endif /* DOS */
/* for contextsw */
#define AS_OPCODE 1
@@ -107,10 +115,11 @@ extern DLword *EmMouseX68K, *EmMouseY68K, *EmKbdAd068K, *EmRealUtilin68K, *EmUti
extern DLword *EmKbdAd168K, *EmKbdAd268K, *EmKbdAd368K, *EmKbdAd468K, *EmKbdAd568K;
extern u_char *SUNLispKeyMap;
extern int LispWindowFd;
extern int RS232C_Fd, RS232C_remain_data, XLocked;
extern int RS232C_Fd, RS232C_remain_data;
extern fd_set LispIOFds;
fd_set LispReadFds;
int XNeedSignal = 0; /* T if an X interrupt happened while XLOCK asserted */
extern volatile sig_atomic_t XLocked;
extern volatile sig_atomic_t XNeedSignal;
extern int LogFileFd;
@@ -120,11 +129,9 @@ extern int ether_fd;
extern DLword *DisplayRegion68k;
#ifndef DOS
static struct timeval SelectTimeout = {0, 0};
#ifdef XWINDOW
extern volatile sig_atomic_t Event_Req;
#endif /* XWINDOW */
#endif /* DOS */
extern MISCSTATS *MiscStats;
LispPTR *LASTUSERACTION68k;
@@ -162,25 +169,6 @@ typedef struct {
/* EmXXXX68K are already swapped, no need for GETWORD */
#ifdef SUNDISPLAY
#ifdef OLD_CURSOR
#define TrackCursor(cx, cy) \
{ \
*CLastUserActionCell68k = MiscStats->secondstmp; \
*EmCursorX68K = cx; \
*EmCursorY68K = cy; \
}
#else
#define TrackCursor(cx, cy) \
{ \
*CLastUserActionCell68k = MiscStats->secondstmp; \
taking_mouse_down(); \
taking_mouse_up(cx, cy); \
*EmCursorX68K = cx; \
*EmCursorY68K = cy; \
}
#endif /* OLD_CURSOR */
#endif /* SUNDISPLAY */
/* commented out is some code that would also clobber
Irq_Stk_Check & Irq_Stk_End to force
@@ -195,7 +183,7 @@ LispPTR *MOUSECHORDTICKS68k;
/**NEW GLOBAL***-> will be moved***/
LispPTR *KEYBOARDEVENTQUEUE68k;
LispPTR *KEYBUFFERING68k;
int KBDEventFlg = NIL;
int KBDEventFlg = 0;
DLword *CTopKeyevent;
LispPTR DOBUFFEREDTRANSITION_index;
@@ -221,20 +209,12 @@ DLword ColorCursor_savebitmap[CURSORWIDTH / COLORPIXELS_IN_DLWORD * CURSORHEIGHT
/************************************************************************/
/* */
/* G E T S I G N A L D A T A */
/* */
/* Handler for the SIGIO interrupt, which happens */
/* 1. When a key transition happens */
/* 2. On mouse moves */
/* 3. When TCP input becomes available. */
/* 4. When a NIT ethernet packet becomes available. */
/* 5. When a console/log/stderr msg needs to be printed. */
/* */
/* */
/* */
/* */
/* */
/* p r o c e s s _ i o _ e v e n t s */
/* */
/* Periodically, or After a SIGIO interrupt which happens */
/* 1. When TCP input becomes available. */
/* 2. When a NIT ethernet packet becomes available. */
/* 3. When a console/log/stderr msg needs to be printed. */
/* */
/* */
/* Statics: LispReadFds A 32-bit vector with a 1 for each */
@@ -264,64 +244,16 @@ DLword ColorCursor_savebitmap[CURSORWIDTH / COLORPIXELS_IN_DLWORD * CURSORHEIGHT
/* */
/************************************************************************/
void getsignaldata(int sig)
void process_io_events()
{
#ifdef SUNDISPLAY
struct inputevent event;
#endif /* SUNDISPLAY */
fd_set rfds, efds;
#ifndef DOS
fd_set rfds;
u_int iflags;
int i;
#ifdef XWINDOW
#if defined(sun)
if (Event_Req) {
if (!XLocked++)
getXsignaldata(currentdsp);
else
XNeedSignal = 1;
Event_Req = FALSE;
XLocked--;
}
#endif
#endif /* XWINDOW */
/* #ifndef KBINT */
/* FD_COPY would be preferred but uses deprecated bcopy() on macOS. Why? */
memcpy(&rfds, &LispReadFds, sizeof(rfds));
memcpy(&efds, &LispReadFds, sizeof(efds));
/* label and ifs not needed if only keyboard on SIGIO */
getmore:
if (select(32, &rfds, NULL, &efds, &SelectTimeout) >= 0)
{
/* need to print out fd sets...
DBPRINT(("SIGIO: fd mask(r/e) = 0x%x/0x%x.\n", rfds, efds));
*/
#ifdef SUNDISPLAY
if (LispWindowFd >= 0 && FD_ISSET(LispWindowFd, &rfds)) {
/* #endif */
while (input_readevent(LispWindowFd, &event) >= 0) {
/*if(!kb_event( &event )) {goto getmore;};*/
if ((KBDEventFlg += kb_event(&event)) > 0) {
/* immediately request for IRQ check */
Irq_Stk_End = Irq_Stk_Check = 0;
}
}
/* #ifndef KBINT */
}
#endif /* SUNDISPLAY */
#ifdef XWINDOW
if (FD_ISSET(ConnectionNumber(currentdsp->display_id), &rfds)) {
if (!XLocked)
getXsignaldata(currentdsp);
else
XNeedSignal = 1;
}
#endif /* XWINDOW */
if (select(32, &rfds, NULL, NULL, &SelectTimeout) > 0) {
#ifdef MAIKO_ENABLE_ETHERNET
if (ether_fd >= 0 && FD_ISSET(ether_fd, &rfds)) { /* Raw ethernet (NIT) I/O happened, so handle it. */
@@ -360,134 +292,9 @@ getmore:
}
}
/* #endif */
} /* end getsignaldata */
#endif /* DOS */
} /* end process_io_events */
#ifdef SUNDISPLAY
/************************************************************************/
/* */
/* k b _ e v e n t */
/* */
/* Given an event from the kbd code, return 1 if a key transition */
/* occurred, 0 if one didn't occur. */
/* */
/************************************************************************/
extern int for_makeinit;
int kb_event(struct inputevent *event);
{
register u_int upflg;
int kn;
DLword w, r;
KBEVENT *kbevent;
#ifdef INIT
/* generate some code to check if we are running as an INIT. Don't
needlessly generate this code, and don't return if we aren't
running with the -INIT flag turned on. --was 2/7/89 */
if (for_makeinit) { return (0); };
#endif
upflg = event_is_up(event);
#ifdef SHOWKEYSTROKES
printf("Key # %d, upflg %d.\n", (unsigned short)event->ie_code, upflg);
#endif
switch (((unsigned short)event->ie_code)) {
case LOC_MOVE:
#ifndef OLD_CURSOR
if (!ScreenLocked)
#endif
{
ScreenLocked = T;
MouseMove(event->ie_locx, event->ie_locy);
TrackCursor(event->ie_locx, event->ie_locy);
ScreenLocked = NIL;
}
return (0);
case MS_LEFT: /*mouse_button( MOUSE_LEFT, upflg );*/
PUTBASEBIT68K(EmRealUtilin68K, MOUSE_LEFT, upflg);
break;
case MS_MIDDLE: /*mouse_button( MOUSE_MIDDLE, upflg );*/
PUTBASEBIT68K(EmRealUtilin68K, MOUSE_MIDDLE, upflg);
break;
case MS_RIGHT: /*mouse_button( MOUSE_RIGHT, upflg );*/
PUTBASEBIT68K(EmRealUtilin68K, MOUSE_RIGHT, upflg);
break;
default: /* keystroke */
if ((kn = SUNLispKeyMap[((unsigned short)event->ie_code)]) < 255)
kb_trans(kn, upflg);
else
printf("kb_event: unknown key number=%d\n", event->ie_code);
break;
};
{
do_ring:
/* Emxxx do not use GETWORD */
if (((*EmKbdAd268K) & 2113) == 0) { /*Ctrl-shift-NEXT*/
error("****** EMERGENCY Interrupt ******");
(*EmKbdAd268K) = KB_ALLUP; /*reset*/
((RING *)CTopKeyevent)->read = 0; /* reset queue */
((RING *)CTopKeyevent)->write = MINKEYEVENT;
/*return(0);*/
} else if (((*EmKbdAd268K) & 2114) == 0) { /* Ctrl-Shift-DEL */
(*EmKbdAd268K) = KB_ALLUP; /*reset*/
URaid_req = T;
((RING *)CTopKeyevent)->read = 0; /* reset queue */
((RING *)CTopKeyevent)->write = MINKEYEVENT;
/*return(0);*/
}
#ifdef OS4_TYPE4BUG
else if (((*EmKbdAd268K) & 2120) == 0) { /* Ctrl-Shift-Return */
error("****** EMERGENCY Interrupt ******");
(*EmKbdAd268K) = KB_ALLUP; /*reset*/
((RING *)CTopKeyevent)->read = 0; /* reset queue */
((RING *)CTopKeyevent)->write = MINKEYEVENT;
/*return(0);*/
}
#endif
r = RING_READ(CTopKeyevent);
w = RING_WRITE(CTopKeyevent);
if (r == w) goto KBnext; /* event queue FULL */
kbevent = (KBEVENT *)(CTopKeyevent + w);
/* RCLK(kbevent->time); */
kbevent->W0 = (*EmKbdAd068K); /* Emxxxx do not use GETWORD */
kbevent->W1 = (*EmKbdAd168K);
kbevent->W2 = (*EmKbdAd268K);
kbevent->W3 = (*EmKbdAd368K);
kbevent->W4 = (*EmKbdAd468K);
kbevent->W5 = (*EmKbdAd568K);
kbevent->WU = (*EmRealUtilin68K);
if (r == 0) /* Queue was empty */
((RING *)CTopKeyevent)->read = w;
if (w >= MAXKEYEVENT)
((RING *)CTopKeyevent)->write = MINKEYEVENT;
else
((RING *)CTopKeyevent)->write = w + KEYEVENTSIZE;
KBnext:
if (*KEYBUFFERING68k == NIL) *KEYBUFFERING68k = ATOM_T;
} /* if *EmRealUtilin68K end */
return (1);
}
#endif /* SUNDISPLAY */
/************************************************************************/
/* */
@@ -562,6 +369,9 @@ void taking_mouse_down() {
static int sx, dx, w, h, srcbpl, dstbpl, backwardflg = 0;
static int src_comp = 0, op = 0, gray = 0, num_gray = 0, curr_gray_line = 0;
#ifdef DOS
(currentdsp->mouse_invisible)(currentdsp, IOPage68K);
#else
if (!DisplayInitialized) return;
/* restore saved image */
@@ -578,6 +388,7 @@ void taking_mouse_down() {
#ifdef DISPLAYBUFFER
flush_display_region(dx, (LastCursorY), w, h);
#endif /* DISPLAYBUFFER */
#endif /* DOS */
}
#else
@@ -711,6 +522,9 @@ void copy_cursor(int newx, int newy)
/* I'll make it MACRO */
void taking_mouse_up(int newx, int newy)
{
#ifdef DOS
(currentdsp->mouse_visible)(newx, newy);
#else
if (!DisplayInitialized) return;
/* save hidden bitmap */
cursor_hidden_bitmap(newx, newy);
@@ -720,6 +534,7 @@ void taking_mouse_up(int newx, int newy)
#endif
LastCursorX = newx;
LastCursorY = newy;
#endif
}
/* store bitmap image inside rect. which specified by x,y */

358
src/launch.asm Normal file
View File

@@ -0,0 +1,358 @@
;; # @(#) launch.asm Version 1.1 (12/29/94). Copyright Venue #
;************************************************************************
;* *
;* l a u n c h . a s m *
;* *
;* This is the launcher for Medley on DOS. It: *
;* *
;* * Looks for and validates any -m memsize argument on the *
;* command line. Only values in the range 8 - 32 are allowed. *
;* *
;* * Loads the real Medley emulator, emul.exe, from the same *
;* directory that the launcher came from. *
;* *
;* * Sets the Intel DOS Extender's profile to the requested *
;* memory size + 3Mb (to allow for the emulator, internal *
;* data areas, etc.) *
;* *
;* * Set the termination address in the child process's PSP, *
;* so control returns to the launcher when Medley terminates. *
;* *
;* * Jumps to the emulator's start address. *
;* *
;* * Upon return, just terminates cleanly. *
;* *
;* [We could perhaps do some diagnosis here of error returns?] *
;* *
;* *
;* *
;************************************************************************
;************************************************************************/
;* */
;* (C) Copyright 1993, 1994 Venue. All Rights Reserved. */
;* Manufactured in the United States of America. */
;* */
;************************************************************************/
.model small
.386p
.stack 100h
.data
align 8
;********************************************************
;* Parameter block for INT 214B, that loads medley.exe *
;********************************************************
envseg DW 0 ; environment (0 = copy mine)
cmdip DW ? ; command-line-tail pointer
cmdcs DW ?
fcb1 DD ? ; dummy first FCB to fill in
fcb2 DD ? ; " 2nd FCB, not here in DOS 4.01???
stk DD ? ; SS:SP for emul.exe, filled in by loader
csip DD ? ; start addr for emul.exe, filled in by loader
retad DD FAR PTR myret ; cs:ip return address, to put in
; child PSP, so we get control back.
;* Error messages, misc strings, and work areas*
align 8
memval dd 0
errstg DB 'ERROR: Couldn''t free excess storage.',13,10,'$'
noload db 'ERROR: Loading emulator failed: $'
loaded db 'LOAD SUCCESSFUL.',13,10,'$'
nominfo db 'ERROR: -m must be followed by a number 8 - 64.',13,10,'$'
badexe db 'ERROR: emul.exe is corrupted.',13,10,'$'
emulpath DB 'emul.exe',0 ; name of the real emulator.
mflag db '-m' ; to search for -m/-M in cmd line
mmflag db '-M'
profile db 'PRO' ; to find the DOS extender profile
cmdline db 128 dup (?) ; hold the cmd line tail for real emulator
;* Error-message table for failures loading emul.exe
align 2
errtbl dw OFFSET ng0msg ; 0 = unknown failure
dw OFFSET ng1msg ; 1 = "invalid function"
dw OFFSET ng2msg ; 2 = file not found
dw OFFSET ng3msg ; 3 = path not found
dw OFFSET ng4msg ; 4 = too many open files
dw OFFSET ng5msg ; 5 = access denied
dw OFFSET ng0msg ; 6 = not possible error
dw OFFSET ng0msg ; 7 = not possible error
dw OFFSET ng8msg ; 8 = insufficient storage
dw OFFSET ng0msg ; 9 = not possible
dw OFFSET ngamsg ; A = bad environment
dw OFFSET ngbmsg ; B = bad format (corrupt .exe?)a
ng0msg db 'Unknown problem',13,10,'$'
ng1msg db 'Invalid Function',13,10
db 'Make sure you are running DOS 4.0 or later.',13,10,'$'
ng2msg db 'File not found.',13,10
db 'CD to proper directory, or set PATH.',13,10,'$'
ng3msg db 'Path not found.',13,10
db 'CD to proper directory, or set PATH.',13,10,'$'
ng4msg db 'Too many files open.',13,10
db 'Shut down some TSRs that have file open?',13,10,'$'
ng5msg db 'Access denied.',13,10
db 'Make sure of your access rights to emul.exe?',13,10,'$'
ng8msg db 'Not enough memory.',13,10
db 'Shut down some TSR applications?',13,10,'$'
ngamsg db 'Environment corrupt.',13,10
db 'Check using SET; You may need to re-boot.',13,10,'$'
ngbmsg db 'EXE file corrupted.',13,10,'$'
db 'You may need to restore from backup or re-install.',13,10,'$'
.code
;************************************************************************
;* *
;* M A C R O S *
;* *
;* prints Given a string ptr in DX, print it to the display. *
;* *
;* kill Exit cleanly, using INT 21/4C *
;* *
;************************************************************************
prints macro text
mov dx, OFFSET text
mov ah,9
int 21h
endm
kill macro
mov ah,4ch
int 21h
endm
;************************************************************************
;* *
;* M A I N E N T R Y *
;* *
;* *
;* *
;* *
;* *
;************************************************************************
PUBLIC main
main PROC NEAR
mov ax,ds ; Save memory-block start for freeing
mov es,ax ; excess memory in a bit.
mov ax,@data ; DS points to start of data segment
mov ds,ax
mov cmdcs, ax ; Copy the command line for the emulator
mov cmdip, OFFSET cmdline
mov di, OFFSET cmdline
mov cx,128
mov bx,es
mov dx,ds
mov es,dx
mov ds,bx
mov si,80h
rep
movsb
mov es,bx ; Free the excess memory that DOS gives
mov ds,dx ; us (we need it for the emulator)
mov ax,4a00h
mov bx,090h ; We only need 900h bytes for this program
int 21h
jnc freeok
prints errstg ; Couldn't free spare space; punt.
kill
;************************************************
;* Search the command line for -m or -M *
;************************************************
freeok:
mov di,81h ; start of command line tail
mov si, OFFSET mflag
mov cx, 2
mov bx,81h
add bl,es:[80h]
m1lp: call strcmp
je fndm
add di, 1
cmp di, bx
jl m1lp
mov di,81h ; start of command line tail
mov si, OFFSET mmflag
m2lp: call strcmp
je fndm
add di, 1
cmp di, bx
jl m2lp
mov memval,02400000h ; memory value not set--use 35MB total.
jmp doload
fndm: add di,2 ; Found "-m". Now look for a number
cmp di,bx ; (Make sure it's not end of line)
jnl nogoodm
ok1:
mov edx, 0 ; Holds the memory-requirement value
mov ax,0 ; holds characters as we read
;************************************************
;* Skip over spaces/tabs before any number *
;************************************************
skiplp:
mov al, es:[di]
inc di
cmp al, 20h ; spaces
je skiplp
cmp al, 09h ; tabs
je skiplp
cmp di,bx ; make sure we're still in the string
jle cnvst ; Yup, we've got the first char, so enter
; the conversion loop part-way down.
nogoodm:
prints nominfo ; no arg to -m, or it's bad; Punt.
kill
;********************************************************
; Convert the numeric argument to -m; result in edx. *
;********************************************************
cnvlp: mov al,es:[di]
add di, 1
cnvst: cmp al, 30h
jl endcnv
cmp al, 39h
jg endcnv
sub al, 30h
imul dx, 10
add dx, ax
jmp cnvlp
endcnv:
cmp edx,0 ; if still 0, no valid chars!
je nogoodm
cmp edx, 8 ; must be in the range [8, 32]
jl nogoodm
cmp edx,64
jg nogoodm
add edx, 3 ; add 3mb for data areas, etc, and
sal edx, 20 ; convert to megabytes
mov memval, edx ; save memory requested
;************************************************
;* Load the real emulator .EXE file, emul.exe *
;************************************************
doload: mov dx, OFFSET emulpath
mov ax, seg envseg
mov es, ax
mov bx, OFFSET envseg
mov ax,4b01h ; load-don't-start
int 21h
jnc loadok
add ax,ax
mov si,ax
prints noload
mov bx,OFFSET errtbl
mov dx,ds:[bx+si]
mov ah,9
int 21h
kill
loadok: ; Load succeeded.
mov ah,51h ; get PSP address for child
int 21h
mov es, bx ; get segment for DI addressing
; mov cx,128 ; copy the command line tail
; mov di,80h ; (which appears to be flaky in DOS 4)
; mov si, offset cmdline
; rep
; movsb
mov eax,retad
mov dword ptr es:[+0ah], eax ; set up return address.
cmp memval, 0 ; If no -m value given, just
je dorun ; go start the emulator.
mov di,0 ; Search for the Intel Extender's PROFILE
mov si, OFFSET profile ; (see extender.h)
mov cx, 3 ; (length is 3 bytes)
srchlp: call strcmp
je gotprof ; found the profile; fix it.
add di, 1
cmp di, 2048
jle srchlp
prints badexe ; No extender profile, so the emulator
kill ; EXE must be corrupt. Punt.
gotprof:
mov eax,memval ; Fill in the memory requirement.
mov es:[di+1bch], eax
;********************************************************
;* *
;* Set up the stack seg/pointer & start medley. *
;* *
;********************************************************
dorun: lss sp,stk ; load stack SS & SP regs
mov ax, es ; copy PSP ptr to ax & ds, since some
mov bx, ds ; code expects it in both places.
mov fs,bx ; Also, copy DS to FS, so we still have
mov ds,ax ; a base for the indirect jump . . .
jmp fs:[csip] ; to start-of-medley.
myret: kill ; we get back here, so quit gracefully.
main endp
;************************************************************************/
;* */
;* s t r c m p */
;* */
;* Compare [ds]di and es:[si] for (CX) characters. If the */
;* strings are equal, the Zero flag is set when this returns. */
;* */
;* All registers are preserved. */
;* */
;************************************************************************/
strcmp proc near
cld
push di
push si
push cx
repe
cmpsb
pop cx
pop si
pop di
ret
strcmp endp
END

View File

@@ -105,7 +105,7 @@ int main(int argc, char *argv[])
/* JRB - call fork_Unix here, while we're REALLY small, unless -NF is
specified, of course... */
for (i = 0; i < argc; i++)
for (i = 1; i < argc; i++)
if (!strcmp(argv[i], "-NF")) break;
if (i == argc) /* -NF not in arguments */
fork_Unix();
@@ -181,7 +181,7 @@ int main(int argc, char *argv[])
/* JRB - call fork_Unix here, while we're REALLY small, unless -NF is
specified, of course... */
for (i = 0; i < argc; i++)
for (i = 1; i < argc; i++)
if (!strcmp(argv[i], "-NF")) break;
if (i == argc) /* -NF not in arguments */
fork_Unix();

View File

@@ -214,7 +214,7 @@ int main(int argc, char *argv[]) {
ether_fd = -1;
/* exit(); */
}
seteuid(getuid());
setuid(getuid());
}
/* OK, right here do other stuff like scan args */

View File

@@ -30,9 +30,6 @@
#include "byteswapdefs.h"
#include "initdspdefs.h"
#ifdef GCC386
#include "inlnPS2.h"
#endif /* GCC386 */
#define IFPAGE_ADDRESS 512
#define DEFAULT_MAX_SYSOUTSIZE 64 /* in Mbyte */
@@ -50,10 +47,10 @@ int Storage_expanded; /* T or NIL */
/* Load the sysout file into memory. */
/* */
/************************************************************************/
#if defined(XWINDOW)
#if defined(DOS) || defined(XWINDOW)
#include "devif.h"
extern DspInterface currentdsp;
#endif /* XWINDOW */
#endif /* DOS || XWINDOW */
/* sys_size is sysout size in megabytes */
int sysout_loader(const char *sysout_file_name, int sys_size) {
@@ -153,10 +150,16 @@ int sysout_loader(const char *sysout_file_name, int sys_size) {
"\nsysout loader: Error, secondary space in use. You can't specify size.\nProcess "
"size = %d\nSys size = %d\n",
ifpage.process_size, sys_size);
#ifdef DOS
/* Note that we have an initialized display by now. */
/* Hence we have to observe the display protocol. */
VESA_errorexit(tmp);
#else
fprintf(stderr, "sysout_loader: You can't specify the process size.\n");
fprintf(stderr, "Because, secondary space is already used.\n");
fprintf(stderr, "(size is %d, you specified %d.)\n", ifpage.process_size, sys_size);
exit(-1);
#endif /* DOS */
}
/*Can use this sys_size as the process size */
/* The sys_size should be same as the previous one */
@@ -273,6 +276,28 @@ int sysout_loader(const char *sysout_file_name, int sys_size) {
/* read sysout file to lispworld */
for (i = 0; i < (sysout_size / 2); i++) {
#ifdef DOS
/* Dial that floats from left to right on the top line of the */
/* displaty. Dial shows % of sysout loaded by digits and */
/* position. */
int columns;
switch (currentdsp->graphicsmode) {
case 0x104:
columns = 120; /* 131 - 10 */
break;
case 0x102:
columns = 69; /* 79 - 10 */
break;
default:
columns = 69; /* 79 - 10 */
break;
}
_settextposition((short)0, (short)0);
if ((i & 0xf) == 0) {
for (int j = 0; j < (columns * i) / (sysout_size >> 1); j++) putchar(' ');
printf("-=(%2d%%)=-\n", (100 * i) / (sysout_size >> 1));
}
#endif /* DOS */
if (GETPAGEOK(fptovp, i) != 0177777) {
if (lseek(sysout, i * BYTESPER_PAGE, SEEK_SET) == -1) {
perror("sysout_loader: can't seek sysout file");
@@ -299,11 +324,11 @@ int sysout_loader(const char *sysout_file_name, int sys_size) {
free(fptovp);
DBPRINT(("sysout file is read completely.\n"));
#if defined(DISPLAYBUFFER) || defined(XWINDOW)
#if (defined(DISPLAYBUFFER) || defined(XWINDOW) || defined(DOS))
TPRINT(("Flushing display buffer...\n"));
flush_display_buffer();
TPRINT(("After Flushing display buffer\n"));
#endif /* DISPLAYBUFFER || XWINDOW */
#endif /* DISPLAYBUFFER || XWINDOW || DOS */
close(sysout);
return (sys_size);

View File

@@ -12,15 +12,6 @@
#include <stdio.h>
#if defined(COLOR) && !defined(NOPIXRECT)
#include <sunwindow/window_hs.h>
#include <sunwindow/cms.h>
#include <sunwindow/win_ioctl.h>
#include <pixrect/pixrect_hs.h>
#include <sun/fbio.h>
#include <pixrect/pr_planegroups.h>
#include <sys/mman.h>
#endif /* COLOR && !NOPIXRECT */
#include <sys/ioctl.h>
#include <sys/types.h>

View File

@@ -482,9 +482,6 @@ extern struct cursor CurrentCursor;
void flip_cursorbar(int n)
{
GETWORD(EmCursorBitMap68K + n) = ~(GETWORD(EmCursorBitMap68K + n));
#ifdef SUNDISPLAY
win_setcursor(LispWindowFd, &CurrentCursor);
#endif /* SUNDISPLAY */
#ifdef XWINDOW
/* JDS 011213 When using current_hot_y, remember fn does 15-it! */

View File

@@ -16,8 +16,15 @@
#include "lispemul.h"
#ifdef DOS
#include "devif.h"
#endif /* DOS */
extern int KBDEventFlg;
extern int *KEYBUFFERING68k;
#ifdef DOS
extern MouseInterface currentmouse;
#endif /* DOS */
/* Globals used by solver */
short JustInverted;
@@ -935,6 +942,10 @@ int milpsolve(sstate *st, REAL *upbo, REAL *lowbo, short *sbasis, short *slower,
return (TIMEOUT); /* Time out every 100 LP solves */
else if ((KBDEventFlg > 0) && *KEYBUFFERING68k == ATOM_T)
return (TIMEOUT); /* Time out on key/mouse clicks */
#ifdef DOS
else if (currentmouse->Cursor.Moved)
return (TIMEOUT); /* Time out if mouse moves in DOS */
#endif /* DOS */
if (Break_bb) return (BREAK_BB);
Level++;

View File

@@ -25,9 +25,15 @@
#include <sys/types.h>
#include <time.h>
#ifndef DOS
#include <pwd.h>
#include <sys/param.h>
#include <unistd.h>
#else /* DOS */
#include <i32.h>
#define MAXPATHLEN 128
#define R_OK 04
#endif /* DOS */
#ifdef MAIKO_ENABLE_ETHERNET
#if defined(USE_NIT)
@@ -69,7 +75,6 @@
DLword *Lisp_world; /* lispworld */
/********** 68k address for Lisp Space **********/
DLword *Atomspace;
DLword *Stackspace;
DLword *Plistspace;
DLword *DTDspace;
@@ -79,8 +84,6 @@ DLword *Pnamespace;
DLword *AtomSpace;
DLword *Defspace;
DLword *Valspace;
DLword *Spospspace;
DLword *Snegspace;
/********** For Virtual Memory Management **********/
#ifdef BIGVM
@@ -118,7 +121,6 @@ DLword *HTcoll;
DLword *DisplayRegion;
int DisplayInitialized = NIL;
DLword *Arrayspace;
DLword *MDS_space_bottom;
DLword *PnCharspace;
struct dtd *ListpDTD;
@@ -204,7 +206,8 @@ int UnixPipeIn;
int UnixPipeOut;
int UnixPID;
int please_fork = 1;
/* disable X11 scroll bars if requested */
int noscroll = 0;
/*** STACK handle staff(Takeshi) **/
LispPTR *STACKOVERFLOW_word;
LispPTR *GuardStackAddr_word;
@@ -242,15 +245,38 @@ int sysout_size = 0; /* ditto */
int flushing = FALSE; /* see dbprint.h if set, all debug/trace printing will call fflush(stdout) after each printf */
#if defined(XWINDOW)
#if defined(DOS) || defined(XWINDOW)
#include "devif.h"
extern DspInterface currentdsp;
#endif /* XWINDOW */
#endif /* DOS || XWINDOW */
extern time_t MDate;
extern int nokbdflag;
extern int nomouseflag;
#if XWINDOW
#ifdef DOS
extern void dispatch();
int dosdisplaymode = 0;
int twobuttonflag = FALSE;
int eurokbd = TRUE; /* Assume eurokbd by default. */
const char *helpstring =
"\n\
medley [sysout-name] [<options>] ...\n\
Where <options> are:\n\
sysout-name The filename of your sysout.(see manual.)\n\
-m <size> Virtual memory size in Mega Bytes(from 8 to 32)\n\
-vga Use standard VGA 640x480 screen resolution\n\
-vesa102 Use VESA 800x600 screen resolution\n\
-vesa104 Use VESA 1024x768 screen resolution\n\
-2button Force two button mouse handling\n\
-3button Force three button mouse handling\n\
-noeurokbd Force old style kbd handling (for 2.0 and earlier sysouts)\n\
-eurokbd Force new style kbd handling (for 2.01 and later sysouts)\n\
-nokbd Turn the kbd handling off (for debugging only)\n\
-nomouse Turn the mouse handling off (for debugging only)\n\
-info Print general info about the system\n\
-help Print this message\n";
#elif XWINDOW
const char *helpstring =
"\n\
either setenv LDESRCESYSOUT or do:\n\
@@ -261,14 +287,14 @@ const char *helpstring =
-bw <pixels> The Medley screen borderwidth\n\
-g[eometry] <geom>] The Medley screen geometry\n\
-sc[reen] <w>x<h>] The Medley screen geometry\n";
#else /* not XWINDOW */
#else /* not DOS, not XWINDOW */
const char *helpstring =
"\n\
either setenv LDESRCESYSOUT or do:\n\
lde[ether] [sysout-name] [<options>]\n\
-info Print general info about the system\n\
-help Print this message\n";
#endif /* XWINDOW */
#endif /* DOS */
/************************************************************************/
/* */
@@ -283,6 +309,7 @@ int main(int argc, char *argv[])
char *envname;
extern int TIMER_INTERVAL;
extern fd_set LispReadFds;
int tmpint;
#ifdef MAIKO_ENABLE_FOREIGN_FUNCTION_INTERFACE
if (dld_find_executable(argv[0]) == 0) {
perror("Name of executable not found.");
@@ -331,7 +358,11 @@ int main(int argc, char *argv[])
strncpy(sysout_name, envname, MAXPATHLEN);
} else if ((envname = getenv("LDESOURCESYSOUT")) != NULL)
strncpy(sysout_name, envname, MAXPATHLEN);
#ifdef DOS
else if (!makepathname("lisp.vm", sysout_name)
#else
else if (!makepathname("~/lisp.virtualmem", sysout_name)
#endif /* DOS */
|| access(sysout_name, R_OK)) {
fprintf(stderr, "Couldn't find a sysout to run;\n");
fprintf(stderr, "%s", helpstring);
@@ -344,18 +375,32 @@ int main(int argc, char *argv[])
/* -t and -m are undocumented and somewhat dangerous... */
if (!strcmp(argv[i], "-t")) { /**** timer interval ****/
if (argc > ++i)
TIMER_INTERVAL = atoi(argv[i]);
else {
if (argc > ++i) {
errno = 0;
tmpint = strtol(argv[i], (char **)NULL, 10);
if (errno == 0 && tmpint > 0) {
TIMER_INTERVAL = tmpint;
} else {
fprintf(stderr, "Bad value for -t (integer > 0)\n");
exit(1);
}
} else {
fprintf(stderr, "Missing argument after -t\n");
exit(1);
}
}
else if (!strcmp(argv[i], "-m")) { /**** sysout size ****/
if (argc > ++i)
sysout_size = atoi(argv[i]);
else {
if (argc > ++i) {
errno = 0;
tmpint = strtol(argv[i], (char **)NULL, 10);
if (errno == 0 && tmpint > 0) {
sysout_size = tmpint;
} else {
fprintf(stderr, "Bad value for -m (integer > 0)\n");
exit(1);
}
} else {
fprintf(stderr, "Missing argument after -m\n");
exit(1);
}
@@ -368,6 +413,28 @@ int main(int argc, char *argv[])
else if (!strcmp(argv[i], "-INIT")) { /*** init sysout, no packaged */
for_makeinit = 1;
}
#ifdef DOS
else if ((strcmp(argv[i], "-vga") == 0) || (strcmp(argv[i], "-VGA") == 0)) {
dosdisplaymode = 1;
} else if ((strcmp(argv[i], "-vesa102") == 0) || (strcmp(argv[i], "-VESA102") == 0)) {
dosdisplaymode = 0x102;
} else if ((strcmp(argv[i], "-vesa104") == 0) || (strcmp(argv[i], "-VESA104") == 0)) {
dosdisplaymode = 0x104;
} else if ((strcmp(argv[i], "-2button") == 0) || (strcmp(argv[i], "-2BUTTON") == 0)) {
twobuttonflag = TRUE;
} else if ((strcmp(argv[i], "-3button") == 0) || (strcmp(argv[i], "-3BUTTON") == 0)) {
twobuttonflag = FALSE;
} else if ((strcmp(argv[i], "-noeurokbd") == 0) || (strcmp(argv[i], "-NOEUROKBD") == 0)) {
eurokbd = FALSE;
} else if ((strcmp(argv[i], "-eurokbd") == 0) || (strcmp(argv[i], "-EUROKBD") == 0)) {
eurokbd = TRUE;
} else if ((strcmp(argv[i], "-nokbd") == 0) || (strcmp(argv[i], "-NOKBD") == 0)) {
nokbdflag = TRUE;
} else if ((strcmp(argv[i], "-nomouse") == 0) || (strcmp(argv[i], "-NOMOUSE") == 0)) {
nomouseflag = TRUE;
}
#endif /* DOS */
/* Can only do this under SUNOs, for now */
else if (!strcmp(argv[i], "-E")) { /**** ethernet info ****/
@@ -398,9 +465,16 @@ int main(int argc, char *argv[])
}
/* diagnostic flag for big vmem write() calls */
else if (!strcmp(argv[i], "-xpages")) {
if (argc > ++i)
maxpages = atoi(argv[i]);
else {
if (argc > ++i) {
errno = 0;
tmpint = strtol(argv[i], (char **)NULL, 10);
if (errno == 0 && tmpint > 0) {
maxpages = tmpint;
} else {
fprintf(stderr, "Bad value for -xpages (integer > 0)\n");
exit(1);
}
} else {
fprintf(stderr, "Missing argument after -xpages\n");
exit(1);
}
@@ -408,10 +482,17 @@ int main(int argc, char *argv[])
}
/* Sanity checks. */
#ifdef DOS
probemouse(); /* See if the mouse is connected. */
#else
if (getuid() != geteuid()) {
fprintf(stderr, "Effective user is not real user. Setting euid to uid.\n");
seteuid(getuid());
fprintf(stderr, "Effective user is not real user. Resetting uid\n");
if (setuid(getuid()) == -1) {
fprintf(stderr, "Unable to reset user id to real user id\n");
exit(1);
}
}
#endif /* DOS */
FD_ZERO(&LispReadFds);
@@ -419,6 +500,9 @@ int main(int argc, char *argv[])
init_ether(); /* modified by kiuchi Nov. 4 */
#endif /* MAIKO_ENABLE_ETHERNET */
#ifdef DOS
init_host_filesystem();
#else
/* Fork Unix was called in kickstarter; if we forked, look up the */
/* pipe handles to the subprocess and set them up. */
@@ -426,10 +510,11 @@ int main(int argc, char *argv[])
{ /* in case we're re-starting a savevm w/open ptys */
if (please_fork) fprintf(stderr, "Failed to find UNIXCOMM file handles; no processes\n");
}
#endif /* DOS */
#if defined(XWINDOW)
#if defined(DOS) || defined(XWINDOW)
make_dsp_instance(currentdsp, 0, 0, 0, 1); /* All defaults the first time */
#endif /* XWINDOW */
#endif /* DOS || XWINDOW */
/* Load sysout to VM space and returns real sysout_size(not 0) */
sysout_size = sysout_loader(sysout_name, sysout_size);
@@ -454,9 +539,6 @@ int main(int argc, char *argv[])
/* Get OS message to ~/lisp.log and print the message to prompt window */
if (!for_makeinit) {
#ifdef SUNDISPLAY
mess_init();
#endif /* SUNDISPLAY */
init_keyboard(0); /* can't turn on the keyboard yet or you will die
in makeinit. Pilotbitblt will turn it on if
@@ -464,6 +546,13 @@ int main(int argc, char *argv[])
JDS -- 1/18/90 also BITBLTSUB does it now. */
}
#ifdef DOS
_setrealmode(0x3f); /* Don't interrupt on FP overflows */
_getrealerror();
tzset();
#endif
#ifdef OS5
tzset();
#endif /* OS5 */
@@ -519,6 +608,9 @@ void start_lisp() {
/* entering the bytecode dispatch loop; interrupts get */
/* unblocked here */
int_init();
#ifdef DOS
_dpmi_lockregion((void *)&dispatch, 32768);
#endif /* DOS */
dispatch();
}
@@ -532,7 +624,6 @@ void start_lisp() {
int makepathname(char *src, char *dst)
{
register int len;
register char *base, *cp;
register struct passwd *pwd;
char name[MAXPATHLEN];
@@ -565,27 +656,37 @@ int makepathname(char *src, char *dst)
ERRSETJMP(0);
if (*(base + 1) == '/') {
/* path is "~/foo" */
TIMEOUT(pwd = getpwuid(getuid()));
#ifdef DOS
pwd = 0;
#else
TIMEOUT0(pwd = getpwuid(getuid()));
#endif /* DOS */
if (pwd == NULL) {
*Lisp_errno = errno;
return (0);
}
#ifndef DOS
sprintf(dst, "%s%s", pwd->pw_dir, base + 1);
#endif
return (1);
} else {
/* path is "~foo/" */
if ((cp = (char *)strchr(base + 1, '/')) == 0)
return (0);
else {
len = (UNSIGNED)cp - (UNSIGNED)base - 1;
size_t len = cp - base - 1;
strncpy(name, base + 1, len);
name[len] = '\0';
TIMEOUT(pwd = getpwnam(name));
#ifndef DOS
TIMEOUT0(pwd = getpwnam(name));
#endif /* DOS */
if (pwd == NULL) {
*Lisp_errno = errno;
return (0);
}
#ifndef DOS
sprintf(dst, "%s%s", pwd->pw_dir, cp);
#endif /* DOS */
return (1);
}
}

View File

@@ -12,7 +12,9 @@
/* misc7.c
*/
#include <stdio.h>
#ifndef DOS
#include <sys/ioctl.h>
#endif /* DOS */
#include "lispemul.h"
#include "lspglob.h"
#include "adr68k.h"
@@ -30,15 +32,6 @@
#include "bbtsubdefs.h"
#include "initdspdefs.h"
#ifdef SUNDISPLAY
#include <sunwindow/window_hs.h>
#include <sunwindow/win_ioctl.h>
#include <suntool/sunview.h>
#include <signal.h>
#include <sunwindow/cms_mono.h>
#include <suntool/canvas.h>
#endif
/*************************************************/
/* Possible operation fields for FBITMAPBIT */
@@ -76,9 +69,6 @@ LispPTR N_OP_misc7(LispPTR arg1, LispPTR arg2, LispPTR arg3, LispPTR arg4, LispP
DBPRINT(("MISC7 args OK.\n"));
displayflg = n_new_cursorin(base, x, (heightminus1 - y), 1, 1);
#ifdef SUNDISPLAY
if (displayflg) HideCursor;
#endif /* SUNDISPLAY */
/* Bitmaps use a positive integer coordinate system with the lower left
corner pixel at coordinate (0, 0). Storage is allocated in 16-bit words
@@ -98,15 +88,6 @@ LispPTR N_OP_misc7(LispPTR arg1, LispPTR arg2, LispPTR arg3, LispPTR arg4, LispP
default: GETWORDBASEWORD(base, offset) = bmdata | bmmask;
};
#ifdef SUNDISPLAY
#ifdef DISPLAYBUFFER
if (in_display_segment(base)) {
/* NB: base + offset doesn't need WORDPTR() wrapper */
flush_display_ptrregion(base + offset, 0, 16, 1);
}
#endif
if (displayflg) ShowCursor;
#endif /* SUNDISPLAY */
#ifdef XWINDOW
if (in_display_segment(base)) {

View File

@@ -27,7 +27,6 @@
compute_hash
create_symbol
compare_chars
parse_number
*/
/**********************************************************************/
@@ -248,10 +247,11 @@ LispPTR compare_lisp_chars(register const char *char1, register const char *char
/*
Func name : make_atom
If the atom already existed then return
else create new atom . Returns the Atom's index.
Look up the atom index of an existing atom, or return 0xFFFFFFFF
This function does not handle FAT pname's.
This function is a subset of \MKATOM (in LLBASIC), but only handles
thin text atom names (no numbers, no 2-byte pnames).
It MUST return the same atom index number as \MKATOM
Date : January 29, 1987
Edited by : Takeshi Shimizu
@@ -264,10 +264,8 @@ LispPTR compare_lisp_chars(register const char *char1, register const char *char
*/
/**********************************************************************/
LispPTR make_atom(const char *char_base, DLword offset, DLword length, short int non_numericp)
/* if it is NIL then these chars are treated as NUMBER */
LispPTR make_atom(const char *char_base, DLword offset, DLword length)
{
extern DLword *Spospspace;
extern DLword *AtomHT;
extern DLword *Pnamespace;
extern DLword *AtomSpace;
@@ -282,41 +280,34 @@ LispPTR make_atom(const char *char_base, DLword offset, DLword length, short int
unsigned short first_char;
#ifdef TRACE2
printf("TRACE: make_atom( %s , offset= %d, len= %d, non_numericp = %d)\n", char_base, offset,
length, non_numericp);
printf("TRACE: make_atom( %s , offset= %d, len= %d)\n", char_base, offset, length);
#endif
first_char = (*(char_base + offset)) & 0xff;
if (length != 0) {
if (length == 1) /* one char. atoms */
{
if (first_char > 57) /* greater than '9 */
return ((LispPTR)(ATOMoffset + (first_char - 10)));
else if (first_char > 47) /* between '0 to '9 */
return ((LispPTR)(S_POSITIVE + (first_char - 48)));
/* fixed S_... mar-27-87 take */
else /* other one char. atoms */
return ((LispPTR)(ATOMoffset + first_char));
} /* if(length==1.. end */
else if ((non_numericp == NIL) && (first_char <= '9'))
/* more than 10 arithmetic aon + - mixed atom process */
{
if ((hash_entry = parse_number(char_base + offset, length)) != 0)
return ((LispPTR)hash_entry); /* if NIL that means THE ATOM is +- mixed litatom */
/* 15 may 87 take */
}
hash = compute_hash(char_base, offset, length);
} /* if(lengt.. end */
else {
switch (length) {
case 0:
/* the zero-length atom has hashcode 0 */
hash = 0;
first_char = 255;
break;
case 1:
/* One-character atoms live in well known places, no need to hash */
if (first_char > '9')
return ((LispPTR)(ATOMoffset + (first_char - 10)));
if (first_char >= '0' ) /* 0..9 */
return ((LispPTR)(S_POSITIVE + (first_char - '0')));
/* other one character atoms */
return ((LispPTR)(ATOMoffset + first_char));
default:
hash = compute_hash(char_base, offset, length);
break;
}
/* This point corresponds with LP in Lisp source */
/* following for loop never exits until it finds new hash entry or same atom */
/* following for loop does not exit until it finds new hash entry or same atom */
for (reprobe = Atom_reprobe(hash, first_char); (hash_entry = GETWORD(AtomHT + hash)) != 0;
hash = ((hash + reprobe) & 0xffff)) {
atom_index = hash_entry - 1;
@@ -327,7 +318,7 @@ LispPTR make_atom(const char *char_base, DLword offset, DLword length, short int
if ((length == GETBYTE(pname_base)) &&
(compare_chars(++pname_base, char_base + offset, length) == T)) {
DBPRINT(("FOUND the atom. \n"));
return (atom_index); /* find already existed atom */
return (atom_index); /* found existing atom */
}
DBPRINT(("HASH doesn't hit. reprobe!\n"));
@@ -338,65 +329,3 @@ LispPTR make_atom(const char *char_base, DLword offset, DLword length, short int
return (0xffffffff);
/** Don't create newatom now **/
} /* make_atom end */
/*********************************************************************/
/*
Func name : parse_number
Desc : It can treat -65534 to 65535 integer
Returns SMALLP PTR
Date : 1,May 1987 Take
15 May 87 take
*/
/*********************************************************************/
/* Assume this func. should be called with C string in "char_base" */
LispPTR parse_number(const char *char_base, short int length) {
register LispPTR sign_mask;
register LispPTR val;
register int radix;
register int *cell68k;
#ifdef TRACE2
printf("TRACE: parse_number()\n");
#endif
/* Check for Radix 8(Q) postfixed ?? */
if ((*(char_base + (length - 1))) == 'Q') {
radix = 8;
length--;
} else
radix = 10;
/* Check for Sign */
sign_mask = S_POSITIVE;
if ((*(char_base) == '+') || (*(char_base) == '-')) {
sign_mask = ((*char_base++) == '+') ? S_POSITIVE : S_NEGATIVE;
length--;
}
for (val = 0; length > 0; length--) {
if ((((*char_base)) < '0') || ('9' < ((*char_base)))) return (NIL);
val = radix * val + (*char_base++) - '0';
}
if (val > 0xffffffff) error("parse_number : Overflow ...exceeded range of FIXP");
if ((sign_mask == S_POSITIVE) && (val > 0xffff)) {
cell68k = (int *)createcell68k(TYPE_FIXP);
*cell68k = val;
return (LADDR_from_68k(cell68k));
} else if ((sign_mask == S_NEGATIVE) && (val > 0xffff)) {
cell68k = (int *)createcell68k(TYPE_FIXP);
*cell68k = ~val + 1;
return (LADDR_from_68k(cell68k));
}
else if (sign_mask == S_NEGATIVE)
return (sign_mask | (~((DLword)val) + 1));
else {
return (sign_mask | val);
}
}
/* end parse_number */

View File

@@ -41,6 +41,9 @@
#include "allocmdsdefs.h"
#include "commondefs.h"
#include "gchtfinddefs.h"
#ifdef DTDDEBUG
#include "testtooldefs.h"
#endif
static LispPTR oldoldfree;
static LispPTR oldfree;
@@ -155,45 +158,3 @@ retry:
}
} /* createcell68k end */
/**********************************************************/
/* Create a Cell of Specified Type & Set to given Value */
/* Works with 32 bit typed values only. */
/* (Initially used only by native code) */
/**********************************************************/
LispPTR Create_n_Set_Cell(unsigned int type, LispPTR value) {
register struct dtd *dtd68k;
register DLword *ptr, *lastptr;
register LispPTR newcell;
dtd68k = (struct dtd *)GetDTD(type);
if (dtd68k->dtd_size == 0) error("createcell : Attempt to create a cell not declared yet");
retry:
if ((newcell = (dtd68k->dtd_free & POINTERMASK)) != NIL) {
ptr = Addr68k_from_LADDR(newcell);
/* replace dtd_free with newcell's top DLword (it may keep next chain)*/
dtd68k->dtd_free = (*((LispPTR *)ptr)) & POINTERMASK;
dtd68k->dtd_oldcnt++;
if (dtd68k->dtd_free & 0x8000000) error("bad entry on free chain.");
/* clear 0 */
for (lastptr = ptr + dtd68k->dtd_size; ptr != lastptr; ptr++) { GETWORD(ptr) = 0; }
/* IncAllocCnt(1); */
GCLOOKUP(newcell, DELREF);
(*((LispPTR *)Addr68k_from_LADDR(newcell))) = value;
return (newcell);
} else {
dtd68k->dtd_free = initmdspage(alloc_mdspage(dtd68k->dtd_typeentry), dtd68k->dtd_size, NIL);
if (dtd68k->dtd_free & 0x8000000) error("bad entry on free chain.");
goto retry;
}
} /* createcell68k end */

View File

@@ -33,8 +33,18 @@
#include <stdio.h>
#include <time.h>
#ifndef DOS
#include <sys/time.h>
#endif /* DOS */
#ifdef DOS
int main(void) {
long dtime;
time(&dtime);
printf("long MDate= %ld;\n", dtime);
return (0);
}
#else
/* Version for every other Unix */
int main(void) {
struct timeval time;
@@ -50,3 +60,4 @@ int main(void) {
return (0);
}
#endif /* DOS */

121
src/mouseif.c Normal file
View File

@@ -0,0 +1,121 @@
/* $Id: mouseif.c,v 1.2 1999/01/03 02:07:26 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved
*/
/************************************************************************/
/* */
/* (C) Copyright 1989, 1990, 1990, 1991, 1992, 1993, 1994, 1995 Venue. */
/* All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/************************************************************************/
/* * * * D O S M O U S E I N T E R F A C E * * * */
#include "version.h"
#include "lispemul.h"
#include "dbprint.h"
#include "devif.h"
MouseInterfaceRec curmouse;
MouseInterface currentmouse = &curmouse;
#ifdef DOS
#include <dos.h>
int nomouseflag = FALSE;
extern DLword *Lisp_world;
extern LispPTR *LASTUSERACTION68k;
extern int twobuttonflag;
extern void EnterDosMouse();
extern void ExitDosMouse();
extern void DosMouseAfterRaid();
extern void DosMouseBeforeRaid();
extern unsigned long GenericReturnT();
extern void ThreeButtonHandler();
extern void TwoButtonHandler();
#endif /* DOS */
#ifdef DOS
/*****************************************************************/
/* p r o b e m o u s e */
/* */
/* Probe for mouse and return the number of buttons available. */
/*****************************************************************/
int probemouse() {
union REGS regs;
char c;
/***************************************************************************
* Reset mouse driver, exit if no mouse driver present
***************************************************************************/
/* int 33h, case 0000, ax = drive installed, bx = # of buttons. */
if (nomouseflag) {
return (666); /* return something, why not 666? */
} else {
regs.w.eax = 0; /* Func 0 = Reset mouse, ret. button info */
int86(0x33, &regs, &regs);
if (regs.x.ax == 0x0000) VESA_errorexit("No mouse driver found.", -1);
return (regs.x.bx);
}
}
#endif
void make_mouse_instance(MouseInterface mouse)
{
#ifdef DOS
int NumberOfButtons;
if (nomouseflag) {
mouse->device.enter = &GenericReturnT;
mouse->device.exit = &GenericReturnT;
mouse->device.before_raid = &GenericReturnT;
mouse->device.after_raid = &GenericReturnT;
mouse->device.active = FALSE;
NumberOfButtons = 3;
} else {
mouse->device.enter = &EnterDosMouse;
mouse->device.exit = &ExitDosMouse;
mouse->device.before_raid = &DosMouseBeforeRaid;
mouse->device.after_raid = &DosMouseAfterRaid;
mouse->device.active = FALSE;
NumberOfButtons = probemouse();
}
mouse->Button.StartTime = 2;
mouse->Cursor.Last.width = 16;
mouse->Cursor.Last.height = 16;
if (nomouseflag == FALSE) {
if (twobuttonflag) { /* We force two button handling. */
mouse->Handler = &TwoButtonHandler;
mouse->Button.TwoButtonP = TRUE;
} else /* Determine how many buttons we have. */
switch (NumberOfButtons) {
case 0x0000: /* Other than 2 buttons, assume three */
mouse->Button.TwoButtonP = FALSE;
mouse->Handler = &ThreeButtonHandler;
break;
case 0x0002: /* Two buttons. */
mouse->Button.TwoButtonP = TRUE;
mouse->Handler = &TwoButtonHandler;
break;
case 0x0003: /* Three buttons. */
mouse->Button.TwoButtonP = FALSE;
mouse->Handler = &ThreeButtonHandler;
break;
case 0xffff: /* Two buttons. */
mouse->Button.TwoButtonP = TRUE;
mouse->Handler = &TwoButtonHandler;
break;
default: /* Strange case, assume three. */
mouse->Button.TwoButtonP = FALSE;
mouse->Handler = &ThreeButtonHandler;
break;
}
}
/* mouse->timestamp = ((*LASTUSERACTION68k& 0xffffff) + Lisp_world); */
#elif XWINDOW
#endif /* DOS or XWINDOW */
}

View File

@@ -28,14 +28,12 @@
#include "lsptypes.h"
#include "opcodes.h"
#include "cell.h"
#include "byteswapdefs.h"
#include "mvsdefs.h"
#include "car-cdrdefs.h"
#include "conspagedefs.h"
#ifdef GCC386
#include "inlnPS2.h"
#endif /* GCC386 */
/* to optionally swap the fnhead field of a frame */
#ifdef BIGVM

View File

@@ -168,7 +168,8 @@ void contextsw(register DLword fxnum, register DLword bytenum, register DLword f
CHECKFX;
if (EndSTKP < CurrentStackPTR) error("contextsw:Illegal ESP");
#endif
FastRetCALL return;
FastRetCALL;
return;
}
} /* end contextsw */

View File

@@ -18,6 +18,7 @@
/* */
/************************************************************************/
#ifndef DOS
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
@@ -29,6 +30,7 @@
#include <netdb.h>
#include <errno.h>
#include <string.h> /* for memset/memcpy */
#endif /* DOS */
#include "lispemul.h"
#include "lispmap.h"
#include "lsptypes.h"
@@ -46,6 +48,7 @@
LispPTR rpc(LispPTR *args)
{
#ifndef DOS
/* Arguments are:
args[0]:Destination Address; hostname or internet address are both supported.
args[1]:Remote port for this program.
@@ -191,4 +194,5 @@ getbuf:
*/
handle_error:
return (NIL_PTR);
#endif /* DOS */
}

View File

@@ -253,7 +253,7 @@ rs232c_read() {
}
} else {
/*
* SIGIO handler getsignaldata and the successive
* SIGIO handler, process_io_events, and the successive
* rs232c_read has been called before Lisp prepares
* the next buffer. Turn on RS232C_remain_data to
* specify to read the remaining data after.

View File

@@ -99,7 +99,9 @@ int main(int argc, char **argv) {
printf("setsysout version sysout-name\n");
return (-1);
}
if ((version = atoi(argv[1])) == 0) {
errno = 0;
version = (int)strtol(argv[1], (char **)NULL, 10);
if (errno || version <= 0) {
printf("version must be an integer > 0.\n");
return (-1);
}

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