mirror of
https://github.com/Interlisp/maiko.git
synced 2026-01-11 23:43:19 +00:00
Modifies Lisp exit subr to permit passing an exit status code (#524)
These changes add (LOGOUT <number>) to the traditional (LOGOUT) and (LOGOUT T) calls. If an integer <number> is provided it will be used as the exit status code, while NIL and T result in an EXIT_SUCCESS. If the argument passed is none of NIL, T, or a number, the exit status code will be a generic EXIT_FAILURE (typically 1). (LOGOUT) and (LOGOUT T) virtual memory behavior is unaffected. When a <number> is passed Lisp will exit without saving the virtual memory state, as is the case for (LOGOUT T), although this behavior is determined by Lisp rather than the Maiko emulator.
This commit is contained in:
parent
f23a43f1a0
commit
31bb14b9d7
@ -6,5 +6,5 @@ LispPTR unix_username(LispPTR *args);
|
||||
LispPTR unix_getparm(LispPTR *args);
|
||||
LispPTR unix_getenv(LispPTR *args);
|
||||
LispPTR unix_fullname(LispPTR *args);
|
||||
LispPTR suspend_lisp(LispPTR *args);
|
||||
LispPTR suspend_lisp(void);
|
||||
#endif
|
||||
|
||||
@ -4,5 +4,5 @@
|
||||
int lispstringP(LispPTR Lisp);
|
||||
LispPTR vmem_save(char *sysout_file_name);
|
||||
LispPTR vmem_save0(LispPTR *args);
|
||||
void lisp_finish(void);
|
||||
void lisp_finish(int exit_status);
|
||||
#endif
|
||||
|
||||
20
src/subr.c
20
src/subr.c
@ -29,6 +29,7 @@
|
||||
/***********************************************************/
|
||||
|
||||
#include <stdio.h> // for printf, sprintf, NULL
|
||||
#include <stdlib.h> // for EXIT_FAILURE, EXIT_SUCCESS
|
||||
#include <time.h> // for nanosleep, timespec
|
||||
#include "adr68k.h" // for NativeAligned2FromLAddr, NativeAligned4FromLAddr
|
||||
#include "arith.h" // for N_GETNUMBER, ARITH_SWITCH
|
||||
@ -412,16 +413,17 @@ void OP_subrcall(int subr_no, int argnum) {
|
||||
break;
|
||||
|
||||
case sb_LISPFINISH:
|
||||
case sb_LISP_FINISH:
|
||||
case sb_LISP_FINISH: {
|
||||
int status;
|
||||
POP_SUBR_ARGS;
|
||||
if ((argnum > 0) && (args[0] == S_POSITIVE))
|
||||
/* 8/03/88 This branch impossible to take, subr has no args */
|
||||
{
|
||||
TopOfStack = suspend_lisp(args);
|
||||
} else
|
||||
lisp_finish();
|
||||
if (argnum == 0 || args[0] == NIL || args[0] == ATOM_T)
|
||||
lisp_finish(EXIT_SUCCESS);
|
||||
N_GETNUMBER(args[0], status, exit_fail);
|
||||
lisp_finish(status);
|
||||
exit_fail:
|
||||
lisp_finish(EXIT_FAILURE);
|
||||
break;
|
||||
|
||||
}
|
||||
case sb_NEWPAGE:
|
||||
POP_SUBR_ARGS;
|
||||
TopOfStack = newpage(args[0]);
|
||||
@ -589,7 +591,7 @@ void OP_subrcall(int subr_no, int argnum) {
|
||||
case sb_SUSPEND_LISP:
|
||||
POP_SUBR_ARGS;
|
||||
/* Suspend Maiko */
|
||||
TopOfStack = suspend_lisp(args);
|
||||
TopOfStack = suspend_lisp();
|
||||
break;
|
||||
|
||||
case sb_MONITOR_CONTROL:
|
||||
|
||||
@ -292,7 +292,7 @@ LispPTR unix_fullname(LispPTR *args) {
|
||||
extern DLword *EmMouseX68K, *EmMouseY68K, *EmKbdAd068K, *EmRealUtilin68K, *EmUtilin68K;
|
||||
extern DLword *EmKbdAd168K, *EmKbdAd268K, *EmKbdAd368K, *EmKbdAd468K, *EmKbdAd568K;
|
||||
|
||||
LispPTR suspend_lisp(LispPTR *args) {
|
||||
LispPTR suspend_lisp(void) {
|
||||
#ifndef DOS
|
||||
extern DLword *CTopKeyevent;
|
||||
extern LispPTR *KEYBUFFERING68k;
|
||||
|
||||
@ -518,7 +518,7 @@ LispPTR vmem_save(char *sysout_file_name)
|
||||
|
||||
/* Make sure that we kill off any Unix subprocesses before we go away */
|
||||
|
||||
void lisp_finish(void) {
|
||||
void lisp_finish(int exit_status) {
|
||||
char d[4];
|
||||
|
||||
DBPRINT(("finish lisp_finish\n"));
|
||||
@ -536,5 +536,5 @@ void lisp_finish(void) {
|
||||
#ifdef DOS
|
||||
exit_host_filesystem();
|
||||
#endif /* DOS */
|
||||
exit(0);
|
||||
exit(exit_status);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user