mirror of
https://github.com/Interlisp/maiko.git
synced 2026-03-15 14:27:19 +00:00
Compare commits
46 Commits
maiko-2311
...
fgh_emscri
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eac4cdc3d3 | ||
|
|
eacdd98f48 | ||
|
|
fb579a2ab5 | ||
|
|
258f70a82b | ||
|
|
895f765105 | ||
|
|
9f02ce0590 | ||
|
|
ce20accae3 | ||
|
|
ce7deadad3 | ||
|
|
0b0c82ce18 | ||
|
|
3ae25f81f8 | ||
|
|
52a3512379 | ||
|
|
df6dd883a6 | ||
|
|
3d341e3bbd | ||
|
|
ebe4babbe1 | ||
|
|
587ce1983a | ||
|
|
b841a44427 | ||
|
|
efd200dbf7 | ||
|
|
640f69877f | ||
|
|
400f3b7835 | ||
|
|
e657b2e1dc | ||
|
|
75c815f585 | ||
|
|
696ac9a675 | ||
|
|
8c54c0fbe0 | ||
|
|
586a3206c2 | ||
|
|
e93e3c895e | ||
|
|
29fdf4c40b | ||
|
|
7bb2393637 | ||
|
|
7c1d2081c8 | ||
|
|
acffcb74aa | ||
|
|
ad71e1e830 | ||
|
|
4b0032e1b6 | ||
|
|
b21fbcbcb1 | ||
|
|
0cc8e4d71c | ||
|
|
bee6a2f33e | ||
|
|
f208fd3302 | ||
|
|
e82b47a9e7 | ||
|
|
b666b1b2de | ||
|
|
d933ba88b7 | ||
|
|
56e7591ada | ||
|
|
28d7d5ec00 | ||
|
|
1e0264416f | ||
|
|
15966ccf34 | ||
|
|
09fae0a3f5 | ||
|
|
2caa2269a9 | ||
|
|
7b2cf44c7c | ||
|
|
79a788279b |
111
.github/workflows/buildRelease.yml
vendored
111
.github/workflows/buildRelease.yml
vendored
@@ -107,7 +107,7 @@ jobs:
|
||||
echo "linux=true" >> $GITHUB_OUTPUT;
|
||||
echo "macos=true" >> $GITHUB_OUTPUT;
|
||||
echo "windows=true" >> $GITHUB_OUTPUT;
|
||||
|
||||
|
||||
|
||||
######################################################################################
|
||||
|
||||
@@ -123,7 +123,7 @@ jobs:
|
||||
steps:
|
||||
# Checkout the actions for this repo owner
|
||||
- name: Checkout Actions
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ github.repository_owner }}/.github
|
||||
path: ./Actions_${{ github.sha }}
|
||||
@@ -157,7 +157,7 @@ jobs:
|
||||
steps:
|
||||
# Checkout the actions for this repo owner
|
||||
- name: Checkout Actions
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ github.repository_owner }}/.github
|
||||
path: ./Actions_${{ github.sha }}
|
||||
@@ -165,7 +165,7 @@ jobs:
|
||||
|
||||
# Checkout the branch
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Setup release tag
|
||||
- name: Setup Release Tag
|
||||
@@ -185,14 +185,14 @@ jobs:
|
||||
|
||||
# Setup the Docker Machine Emulation environment.
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
uses: docker/setup-qemu-action@v3
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||
|
||||
# Setup the Docker Buildx funtion
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
# Do the Docker Build using the Dockerfile in the repository we
|
||||
# checked out. Save the results in a directory under /tmp to be used
|
||||
@@ -204,7 +204,7 @@ jobs:
|
||||
# Dockerfile, NOT HERE IN THE WORKFLOW.
|
||||
#
|
||||
- name: Build Docker Image and Save It Locally
|
||||
uses: docker/build-push-action@v4
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
builder: ${{ steps.buildx.outputs.name }}
|
||||
build-args: |
|
||||
@@ -272,11 +272,11 @@ jobs:
|
||||
|
||||
# Checkout the branch
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Checkout the actions for this repo owner
|
||||
- name: Checkout Actions
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ github.repository_owner }}/.github
|
||||
path: ./Actions_${{ github.sha }}
|
||||
@@ -324,7 +324,7 @@ jobs:
|
||||
export LDEARCH=aarch64-apple-darwin
|
||||
./makeright init
|
||||
mkdir -p ../darwin.universal
|
||||
exe=ldeinit
|
||||
exe=ldeinit
|
||||
lipo -create \
|
||||
-arch arm64 ../darwin.aarch64/${exe} \
|
||||
-arch x86_64 ../darwin.x86_64/${exe} \
|
||||
@@ -346,7 +346,7 @@ jobs:
|
||||
lipo ${exe} -output ../darwin.x86_64/${exe} -extract x86_64
|
||||
lipo ${exe} -output ../darwin.aarch64/${exe} -extract arm64
|
||||
cp -p ${exe} ../darwin.universal/${exe}
|
||||
done
|
||||
done
|
||||
|
||||
# Create release tar for github.
|
||||
- name: Make release tar(s)
|
||||
@@ -369,7 +369,7 @@ jobs:
|
||||
# Push Release
|
||||
- name: Push the release
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
with:
|
||||
allowUpdates: true
|
||||
artifacts:
|
||||
/tmp/release_tars/${{ steps.tag.outputs.release_tag }}-darwin.x86_64.tgz,
|
||||
@@ -383,7 +383,7 @@ jobs:
|
||||
|
||||
# Windows: build for Windows-Cygwin via Docker build and use results to
|
||||
# create and push release assets to github
|
||||
|
||||
|
||||
windows:
|
||||
|
||||
needs: [inputs, sentry]
|
||||
@@ -418,7 +418,7 @@ jobs:
|
||||
# Retrieve SDL2 and install in cygwin
|
||||
- name: Install SDL2
|
||||
id: sdl2
|
||||
env:
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
gh release download 2.26.5 --repo interlisp/cygwin-sdl --pattern *.tgz --output .\cygwin\sdl2.tar.gz
|
||||
@@ -426,13 +426,13 @@ jobs:
|
||||
|
||||
# Checkout the branch
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: cygwin\maiko
|
||||
|
||||
# Checkout the actions for this repo owner
|
||||
- name: Checkout Actions
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ github.repository_owner }}/.github
|
||||
path: ./Actions_${{ github.sha }}
|
||||
@@ -473,6 +473,81 @@ jobs:
|
||||
|
||||
|
||||
|
||||
######################################################################################
|
||||
|
||||
# Emscripten: build and push Maiko compiled for Emscripten (to run Maiko in browser)
|
||||
|
||||
emscripten:
|
||||
|
||||
needs: [inputs, sentry]
|
||||
if: |
|
||||
needs.inputs.outputs.linux == 'true'
|
||||
&& (
|
||||
needs.sentry.outputs.release_not_built == 'true'
|
||||
|| needs.inputs.outputs.force == 'true'
|
||||
)
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
||||
# Checkout the actions for this repo owner
|
||||
- name: Checkout Actions
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ github.repository_owner }}/.github
|
||||
path: ./Actions_${{ github.sha }}
|
||||
- run: mv ./Actions_${{ github.sha }}/actions ../actions && rm -rf ./Actions_${{ github.sha }}
|
||||
|
||||
# Install SDL2
|
||||
- name: Install SDL2
|
||||
run: |
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
sudo -E apt-get update
|
||||
sudo -E apt-get install -y libsdl2-dev libsdl2-2.0-0
|
||||
|
||||
# Install Emscripten SDK
|
||||
- name: Install Empscripten
|
||||
working-directory: ../
|
||||
run: |
|
||||
git clone https://github.com/emscripten-core/emsdk.git
|
||||
cd emsdk
|
||||
./emsdk install latest
|
||||
./emsdk activate latest
|
||||
CWD="$(pwd)"
|
||||
echo "${CWD}" >> ${GITHUB_PATH}
|
||||
echo "${CWD}/upstream/emscripten" >> ${GITHUB_PATH}
|
||||
echo "${CWD}/upstream/emscripten/tools" >> ${GITHUB_PATH}
|
||||
echo "${CWD}/node/$(ls -d node/*64bit | tail -1)/bin" >> ${GITHUB_PATH}
|
||||
|
||||
# Checkout the maiko branch
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Setup release tag
|
||||
- name: Setup Release Tag
|
||||
id: tag
|
||||
uses: ./../actions/release-tag-action
|
||||
|
||||
# Compile maiko using Emscripten (no load build)
|
||||
- name: Compile Maiko using Emscripten
|
||||
working-directory: ./bin
|
||||
run: |
|
||||
./makeright wasm
|
||||
cd ../emscripten.wasm
|
||||
tar -c -z -f ../${{ steps.tag.outputs.release_tag }}-emscripten.tgz *
|
||||
|
||||
# Push Release to github
|
||||
- name: Push the release
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
allowUpdates: true
|
||||
artifacts: ${{ steps.tag.outputs.release_tag }}-emscripten.tgz
|
||||
tag: ${{ steps.tag.outputs.release_tag }}
|
||||
draft: ${{ needs.inputs.outputs.draft }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
|
||||
######################################################################################
|
||||
|
||||
# Use set-sentry-action to determine set the sentry that says this release has
|
||||
@@ -485,12 +560,12 @@ jobs:
|
||||
outputs:
|
||||
build_successful: ${{ steps.output.outputs.build_successful }}
|
||||
|
||||
needs: [inputs, sentry, linux, macos, windows]
|
||||
needs: [inputs, sentry, linux, macos, windows, emscripten]
|
||||
|
||||
steps:
|
||||
# Checkout the actions for this repo owner
|
||||
- name: Checkout Actions
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ github.repository_owner }}/.github
|
||||
path: ./Actions_${{ github.sha }}
|
||||
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -19,6 +19,10 @@ cmake-build-*/**
|
||||
*.x86_64-x/**
|
||||
*.x86_64-sdl/**
|
||||
*.x86_64/**
|
||||
*.wasm/**
|
||||
*.wasm-wasm/**
|
||||
*.wasm_nl/**
|
||||
*.wasm_nl-wasm_nl/**
|
||||
*.armv7l-x/**
|
||||
*.armv7l/**
|
||||
*.aarch64-x/**
|
||||
|
||||
20
bin/makefile-emscripten.wasm-wasm
Normal file
20
bin/makefile-emscripten.wasm-wasm
Normal file
@@ -0,0 +1,20 @@
|
||||
# Options for Emscripten, WASM and SDL
|
||||
|
||||
CC = emcc $(CLANG_CFLAGS)
|
||||
|
||||
XFILES = $(OBJECTDIR)sdl.o
|
||||
|
||||
XFLAGS = -DSDL -sUSE_SDL=2
|
||||
|
||||
# OPTFLAGS is normally -O2.
|
||||
OPTFLAGS = -O2
|
||||
DFLAGS = $(XFLAGS) -DRELEASE=351 -DMAIKO_ENABLE_NETHUB
|
||||
|
||||
LD = emcc
|
||||
LDFLAGS = -lidbfs.js -sUSE_SDL=2 -sASYNCIFY -sALLOW_MEMORY_GROWTH -sEXIT_RUNTIME=1 -sFORCE_FILESYSTEM -sLZ4
|
||||
|
||||
LDELDFLAGS =
|
||||
|
||||
OBJECTDIR = ../$(RELEASENAME)/
|
||||
|
||||
default : ../$(OSARCHNAME)/ldesdl.js
|
||||
@@ -20,7 +20,7 @@
|
||||
# Nov 20 2001 JDS: Convert to use BASH, not CSH, for open-source...
|
||||
#
|
||||
# usage: makeright [display-option] [other-option]
|
||||
#
|
||||
#
|
||||
# example: makeright single ; make lde for mmaped displayFB
|
||||
# makeright multi ; make lde for cg3,cg6
|
||||
# makeright x ; make lde for X-windows
|
||||
@@ -74,6 +74,11 @@ case "$display" in
|
||||
sdl) releasename=${osversion}.${architecture}-${display}
|
||||
ldename=ldesdl
|
||||
;;
|
||||
wasm) osversion=emscripten
|
||||
architecture=wasm
|
||||
releasename=${osversion}.${architecture}-${display}
|
||||
ldename=ldesdl.js
|
||||
;;
|
||||
*) echo "display-option: $display is not supported."
|
||||
exit
|
||||
;;
|
||||
|
||||
@@ -40,7 +40,7 @@ extern int flushing;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#define DBPRINT(X) do {printf X ; if (flushing) fflush(stdout); } while(0)
|
||||
#define DBPRINT(X) do { printf("%s:%d ", __FILE__, __LINE__); printf X ; if (flushing) fflush(stdout); } while(0)
|
||||
#define DEBUGGER(X) X
|
||||
#else
|
||||
#define DBPRINT(X) if (0) do {printf X ; } while(0)
|
||||
@@ -51,7 +51,7 @@ extern int flushing;
|
||||
/* For trace print statements */
|
||||
|
||||
#ifdef TRACE
|
||||
#define TPRINT(X) do { printf X; if (flushing) fflush(stdout); } while (0)
|
||||
#define TPRINT(X) do { printf("%s:%d ", __FILE__, __LINE__); printf X; if (flushing) fflush(stdout); } while (0)
|
||||
#define TRACER(X) X
|
||||
#else /* TRACE */
|
||||
|
||||
@@ -64,7 +64,7 @@ extern int flushing;
|
||||
/* For tracing individual opcode executions */
|
||||
|
||||
#ifdef OPTRACE
|
||||
#define OPTPRINT(X) do { printf X; if (flushing) fflush(stdout); } while (0)
|
||||
#define OPTPRINT(X) do { printf("%s:%d ", __FILE__, __LINE__); printf X; if (flushing) fflush(stdout); } while (0)
|
||||
#define OPTRACER(X) X
|
||||
#else
|
||||
#define OPTPRINT(X) if (0) do { printf X; } while (0)
|
||||
@@ -75,7 +75,7 @@ extern int flushing;
|
||||
/* For tracing function calls */
|
||||
|
||||
#ifdef FNTRACE
|
||||
#define FNTPRINT(X) do { printf X; if (flushing) fflush(stdout); } while (0)
|
||||
#define FNTPRINT(X) do { printf("%s:%d ", __FILE__, __LINE__); printf X; if (flushing) fflush(stdout); } while (0)
|
||||
#define FNTRACER(X) X
|
||||
#else
|
||||
#define FNTPRINT(X) if (0) do { printf X; } while (0)
|
||||
@@ -86,7 +86,7 @@ extern int flushing;
|
||||
/* For function-call & return stack checking */
|
||||
|
||||
#ifdef FNSTKCHECK
|
||||
#define FNCHKPRINT(X) do { printf X ; if (flushing) fflush(stdout); } while (0)
|
||||
#define FNCHKPRINT(X) do { printf("%s:%d ", __FILE__, __LINE__); printf X ; if (flushing) fflush(stdout); } while (0)
|
||||
#define FNCHECKER(X) X
|
||||
#else
|
||||
#define FNCHKPRINT(X) if (0) do { printf X; } while (0)
|
||||
|
||||
@@ -194,8 +194,9 @@ do { \
|
||||
#endif /* min */
|
||||
|
||||
#define LispNumToCInt(Lisp) \
|
||||
( (((Lisp) & SEGMASK) == S_POSITIVE) ? \
|
||||
((Lisp) & 0xFFFF) : (*((int *)(NativeAligned4FromLAddr(Lisp)))) )
|
||||
( (((Lisp) & SEGMASK) == S_POSITIVE) ? ((Lisp) & 0xFFFF) : \
|
||||
(((Lisp) & SEGMASK) == S_NEGATIVE) ? ((Lisp) | 0xFFFF0000) : \
|
||||
(*((int *)(NativeAligned4FromLAddr(Lisp)))) )
|
||||
|
||||
#define UPLOWDIFF 0x20
|
||||
|
||||
|
||||
@@ -83,6 +83,19 @@
|
||||
# define MAIKO_OS_DETECTED 1
|
||||
#endif
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
# define MAIKO_OS_LINUX 1
|
||||
# define MAIKO_OS_EMSCRIPTEN 1
|
||||
# define MAIKO_OS_NAME "Emscripten"
|
||||
# define MAIKO_EMULATE_TIMER_INTERRUPTS 1
|
||||
# define MAIKO_EMULATE_ASYNC_INTERRUPTS 1
|
||||
# define MAIKO_OS_UNIX_LIKE 1
|
||||
# define MAIKO_OS_DETECTED
|
||||
# define MAIKO_ARCH_NAME "WebAssembly"
|
||||
# define MAIKO_ARCH_WORD_BITS 32
|
||||
# define MAIKO_ARCH_DETECTED 1
|
||||
#endif
|
||||
|
||||
/* __x86_64__: GNU C, __x86_64: Sun Studio, _M_AMD64: Visual Studio */
|
||||
#if defined(__x86_64__) || defined(__x86_64) || defined(_M_AMD64)
|
||||
# define MAIKO_ARCH_X86_64 1
|
||||
|
||||
@@ -1799,7 +1799,7 @@ void tedit_bltchar(LispPTR *args)
|
||||
|
||||
} /* end tedit_bltchar */
|
||||
|
||||
#if defined(REALCURSOR) || defined(SUNDISPLAY)
|
||||
#if defined(REALCURSOR)
|
||||
#ifndef COLOR
|
||||
/* Lisp addr hi-word, lo-word, ... */
|
||||
static int old_cursorin(DLword addrhi, DLword addrlo, int x, int w, int h, int y, int backward)
|
||||
@@ -1866,4 +1866,4 @@ static int old_cursorin(DLword addrhi, DLword addrlo, int x, int w, int h, int y
|
||||
} /* COLOR case end */
|
||||
}
|
||||
#endif /* COLOR */
|
||||
#endif /* defined(REALCURSOR) || defined(SUNDISPLAY) */
|
||||
#endif /* defined(REALCURSOR) */
|
||||
|
||||
@@ -375,8 +375,6 @@ static u_char *make_X_keymap(void) {
|
||||
table[xcode - 7] = code;
|
||||
}
|
||||
|
||||
XFree(mapping); /* No locking required? */
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("\n\n\tXGetKeyboardMapping table\n\n");
|
||||
for (i = 0; i < codecount * symspercode; i += symspercode) {
|
||||
@@ -394,6 +392,8 @@ static u_char *make_X_keymap(void) {
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
XFree(mapping); /* No locking required? */
|
||||
|
||||
return (table);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include "ifpage.h" // for IFPAGE, MACHINETYPE_MAIKO
|
||||
#include "initsoutdefs.h" // for build_lisp_map, fixp_value, init_for_bitblt
|
||||
#include "iopage.h" // for IOPAGE
|
||||
#include "lispemul.h" // for LispPTR, DLword, NIL, BYTESPER_DLWORD
|
||||
#include "lispemul.h" // for LispPTR, DLword, NIL, BYTESPER_DLWORD, POINTERMASK
|
||||
#include "lispmap.h" // for ATMHT_OFFSET, ATOMS_OFFSET, DEFS_OFFSET
|
||||
#include "lspglob.h" // for InterfacePage, IOPage, AtomHT, Closure_Cac...
|
||||
#include "lsptypes.h" // for GetDTD, TYPE_FIXP, TYPE_LISTP
|
||||
@@ -405,7 +405,9 @@ void init_for_keyhandle(void) {
|
||||
MOUSECHORDTICKS68k = MakeAtom68k("\\MOUSECHORDTICKS");
|
||||
LASTUSERACTION68k = MakeAtom68k("\\LASTUSERACTION");
|
||||
|
||||
CLastUserActionCell68k = (LispPTR *)NativeAligned4FromLAddr(*LASTUSERACTION68k & 0xffffff);
|
||||
#ifndef INIT
|
||||
CLastUserActionCell68k = (LispPTR *)NativeAligned4FromLAddr(*LASTUSERACTION68k & POINTERMASK);
|
||||
#endif
|
||||
|
||||
DOBUFFEREDTRANSITION_index = MAKEATOM("\\DOBUFFEREDTRANSITIONS");
|
||||
INTERRUPTFRAME_index = MAKEATOM("\\INTERRUPTFRAME");
|
||||
|
||||
24
src/lde.html
Normal file
24
src/lde.html
Normal file
@@ -0,0 +1,24 @@
|
||||
<!doctype html>
|
||||
<!-- Based on https://github.com/timhutton/sdl-canvas-wasm/blob/main/index.html -->
|
||||
<!-- html to set up WebAssembly module for Medley running in a browser -->
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<div style="text-align: center;">
|
||||
<canvas id="canvas" oncontextmenu="event.preventDefault()"></canvas>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var width = 32*Math.trunc(Math.min(Math.max(window.innerWidth, 512), 1664)/32);
|
||||
var height = Math.min(Math.max(window.innerHeight, 512), 1260);
|
||||
var Module = {
|
||||
preRun: [ function() {ENV.MEDLEYDIR = "{DSK}<medley>";} ],
|
||||
arguments: ["medley/loadups/full.sysout","-sc", width+"x"+height, "-nh-host", "127.0.0.1"],
|
||||
canvas: (function() { return document.getElementById('canvas'); })()
|
||||
};
|
||||
</script>
|
||||
<script src="ldesdl.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
15
src/timer.c
15
src/timer.c
@@ -118,6 +118,19 @@ void update_miscstats(void) {
|
||||
MiscStats->diskiotime = 0; /* ?? not available ?? */
|
||||
MiscStats->diskops = 0;
|
||||
MiscStats->secondstmp = MiscStats->secondsclock = (time(0) + UNIX_ALTO_TIME_DIFF);
|
||||
#elif defined(MAIKO_OS_EMSCRIPTEN)
|
||||
/* Emscripten does not provide getrusage() functionality */
|
||||
struct timeval timev;
|
||||
|
||||
MiscStats->totaltime = gettime(0) - MiscStats->starttime;
|
||||
MiscStats->swapwaittime = 0;
|
||||
MiscStats->pagefaults = 0;
|
||||
MiscStats->swapwrites = 0;
|
||||
MiscStats->diskiotime = 0;
|
||||
MiscStats->diskops = 0;
|
||||
|
||||
gettimeofday(&timev, NULL);
|
||||
MiscStats->secondstmp = MiscStats->secondsclock = (timev.tv_sec + UNIX_ALTO_TIME_DIFF);
|
||||
#else
|
||||
struct timeval timev;
|
||||
struct rusage ru;
|
||||
@@ -288,6 +301,8 @@ void subr_settime(LispPTR args[])
|
||||
dosday.year = uxtime.tm_year;
|
||||
dosday.dayofweek = uxtime.tm_wday;
|
||||
_dos_setdate(&dosday);
|
||||
#elif defined(MAIKO_OS_EMSCRIPTEN)
|
||||
(void)args[0];
|
||||
#else
|
||||
struct timeval timev;
|
||||
timev.tv_sec = *((int *)NativeAligned4FromLAddr(args[0])) - UNIX_ALTO_TIME_DIFF;
|
||||
|
||||
@@ -518,6 +518,7 @@ LispPTR Unix_handlecomm(LispPTR *args) {
|
||||
DBPRINT(("Terminating process in slot %d.\n", slot));
|
||||
if (!valid_slot(slot)) return (ATOM_T);
|
||||
/* in all cases we need to close() the file descriptor */
|
||||
if (slot == 0) DBPRINT(("ZERO SLOT\n"));
|
||||
close(slot);
|
||||
switch (UJ[slot].type) {
|
||||
case UJSHELL:
|
||||
@@ -699,7 +700,7 @@ LispPTR Unix_handlecomm(LispPTR *args) {
|
||||
if (!valid_slot(slot)) return (NIL); /* No fd open; punt the read */
|
||||
|
||||
bufp = (NativeAligned2FromLAddr(args[2])); /* User buffer */
|
||||
DBPRINT(("Read buffer slot %d, type is %d\n", slot, UJ[slot].type));
|
||||
DBPRINT(("Read buffer slot %d, type is %d buffer LAddr 0x%x (native %p)\n", slot, UJ[slot].type, args[2], bufp));
|
||||
|
||||
switch (UJ[slot].type) {
|
||||
case UJSHELL:
|
||||
|
||||
@@ -98,7 +98,7 @@ static int ForkUnixShell(int slot, char *PtySlave, char *termtype, char *shellar
|
||||
if (SlaveFD == -1) {
|
||||
perror("Slave Open");
|
||||
perror(PtySlave);
|
||||
exit(0);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#ifdef OS5
|
||||
@@ -132,7 +132,7 @@ static int ForkUnixShell(int slot, char *PtySlave, char *termtype, char *shellar
|
||||
for (userShell = getusershell(); userShell != NULL && strcmp(shell, userShell) != 0; userShell = getusershell());
|
||||
if (userShell == NULL) {
|
||||
perror("$(SHELL) not found in /etc/shells");
|
||||
exit(0);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* argvec entries initialized to NULL */
|
||||
@@ -146,7 +146,7 @@ static int ForkUnixShell(int slot, char *PtySlave, char *termtype, char *shellar
|
||||
|
||||
/* Should never get here */
|
||||
perror("execv");
|
||||
exit(0);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* fork_Unix is the secondary process spawned right after LISP is
|
||||
@@ -264,12 +264,14 @@ int fork_Unix(void) {
|
||||
while (1) {
|
||||
ssize_t len;
|
||||
len = SAFEREAD(LispPipeIn, IOBuf, 6);
|
||||
if (len == 0)
|
||||
exit(0);
|
||||
if (len < 0) {
|
||||
perror("Error reading packet by slave");
|
||||
exit(0);
|
||||
exit(1);
|
||||
} else if (len != 6) {
|
||||
DBPRINT(("Input packet wrong length: %zd", len));
|
||||
exit(0);
|
||||
exit(1);
|
||||
}
|
||||
slot = IOBuf[3];
|
||||
IOBuf[3] = 1; /* Start by signalling success in return-code */
|
||||
@@ -345,7 +347,7 @@ int fork_Unix(void) {
|
||||
sock = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
if (sock < 0) {
|
||||
perror("slave socket");
|
||||
exit(0);
|
||||
exit(1);
|
||||
}
|
||||
sprintf(PipeName, "/tmp/LPU%ld-%d", StartTime, slot);
|
||||
memset(&addr, 0, sizeof(struct sockaddr_un));
|
||||
@@ -357,7 +359,7 @@ int fork_Unix(void) {
|
||||
perror("slave connect");
|
||||
printf("Name = %s.\n", PipeName);
|
||||
fflush(stdout);
|
||||
exit(0);
|
||||
exit(1);
|
||||
} else {
|
||||
DBPRINT(("Slave connected on %s.\n", PipeName));
|
||||
}
|
||||
|
||||
@@ -354,7 +354,7 @@ LispPTR vmem_save(char *sysout_file_name)
|
||||
TIMEOUT(sysout = open(sysout_file_name, O_WRONLY, 0666));
|
||||
if (sysout == -1) {
|
||||
/* No file error skip return. */
|
||||
if (errno != 2) return (FILECANNOTOPEN); /* No such file error.*/
|
||||
if (errno != ENOENT) return (FILECANNOTOPEN); /* No such file error.*/
|
||||
} else
|
||||
TIMEOUT(rval = close(sysout));
|
||||
|
||||
@@ -481,7 +481,7 @@ LispPTR vmem_save(char *sysout_file_name)
|
||||
TIMEOUT(rval = unlink(sysout_file_name));
|
||||
if (rval == -1) {
|
||||
/* No file error skip return. */
|
||||
if (errno != 2) /* No such file error.*/
|
||||
if (errno != ENOENT) /* No such file error.*/
|
||||
return (FILECANNOTOPEN);
|
||||
}
|
||||
|
||||
|
||||
6
src/xc.c
6
src/xc.c
@@ -20,6 +20,9 @@
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#ifdef MAIKO_OS_EMSCRIPTEN
|
||||
#include <emscripten.h>
|
||||
#endif
|
||||
#include <signal.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
@@ -286,6 +289,9 @@ nextopcode:
|
||||
Irq_Stk_End = 0;
|
||||
#if defined(MAIKO_EMULATE_ASYNC_INTERRUPTS)
|
||||
IO_Signalled = TRUE;
|
||||
#endif
|
||||
#ifdef MAIKO_OS_EMSCRIPTEN
|
||||
emscripten_sleep(1);
|
||||
#endif
|
||||
pseudoTimerAsyncCountdown = insnsCountdownForTimerAsyncEmulation;
|
||||
}
|
||||
|
||||
26
src/xinit.c
26
src/xinit.c
@@ -16,6 +16,7 @@
|
||||
#include <signal.h> // for sig_atomic_t
|
||||
#include <stdbool.h> // for false, bool, true
|
||||
#include <stdio.h> // for NULL
|
||||
#include <stdlib.h> // for exit
|
||||
#include "adr68k.h" // for NativeAligned4FromLAddr
|
||||
#include "dbprint.h" // for TPRINT
|
||||
#include "devif.h" // for (anonymous), MRegion, DspInterface, OUTER_S...
|
||||
@@ -200,6 +201,27 @@ void Open_Display(DspInterface dsp)
|
||||
init_Xevent(dsp); /* Turn on the event reporting */
|
||||
} /* end OpenDisplay */
|
||||
|
||||
int X_FatalErrorHandler(Display *display)
|
||||
{
|
||||
/* when the fatal error handler gets called it can do cleanup
|
||||
* and either exit, or return. If it returns, the
|
||||
* FatalErrorExitHandler will be called
|
||||
*/
|
||||
/* If we could do a SAVEVM in the interrupt context we would mark it
|
||||
* as needed here. Returning will cause the FatalErrorExitHandler
|
||||
* hook to be called.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
void X_FatalErrorExitHandler(Display *display, void *userdata)
|
||||
{
|
||||
/* If we were invoking a SAVEVM/LOGOUT in the interrupt context we
|
||||
* would not exit here, as the Lisp VM needs to continue to run
|
||||
*/
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*********************************************************************/
|
||||
/* */
|
||||
/* X _ i n i t */
|
||||
@@ -236,6 +258,10 @@ DspInterface X_init(DspInterface dsp, LispPTR lispbitmap, unsigned width_hint, u
|
||||
/* Try to open the X display. If this isn't possible, we just */
|
||||
/* return FALSE. */
|
||||
if ((dsp->display_id = XOpenDisplay(dsp->identifier)) == NULL) return (NULL);
|
||||
|
||||
XSetIOErrorHandler(X_FatalErrorHandler);
|
||||
XSetIOErrorExitHandler(dsp->display_id, X_FatalErrorExitHandler, NULL);
|
||||
|
||||
/* Load the dsp structure */
|
||||
|
||||
Xscreen = ScreenOfDisplay(dsp->display_id, DefaultScreen(dsp->display_id));
|
||||
|
||||
Reference in New Issue
Block a user