* Added more system checks.
* Now builds on Win32. git-svn-id: svn://svn.zoy.org/elk/trunk@130 55e467fa-43c5-0310-a8a2-de718669efc6
This commit is contained in:
parent
dcf74a9c38
commit
7a028b1c77
17
configure.ac
17
configure.ac
|
@ -52,7 +52,7 @@ AC_CHECK_FUNCS(random)
|
||||||
|
|
||||||
# Does the system have the index library function? If not, strchr
|
# Does the system have the index library function? If not, strchr
|
||||||
# will be used.
|
# will be used.
|
||||||
dnl FIXME
|
AC_CHECK_FUNCS(index)
|
||||||
|
|
||||||
# Does the system have the bcopy, bzero, and bcmp library functions?
|
# Does the system have the bcopy, bzero, and bcmp library functions?
|
||||||
# If not, memcpy/memset/memcmp will be used.
|
# If not, memcpy/memset/memcmp will be used.
|
||||||
|
@ -105,10 +105,8 @@ AC_EGREP_HEADER(_SC_PAGESIZE, unistd.h, [
|
||||||
# signals (has sigblock and related functions); set reliable_signals=posix
|
# signals (has sigblock and related functions); set reliable_signals=posix
|
||||||
# for POSIX-style signals (sigprocmask, sigsets); otherwise old V7/SysV
|
# for POSIX-style signals (sigprocmask, sigsets); otherwise old V7/SysV
|
||||||
# signal semantics are assumed.
|
# signal semantics are assumed.
|
||||||
if false; then
|
AC_CHECK_HEADERS(signal.h)
|
||||||
AC_DEFINE(BSD_SIGNALS, 1, [FIXME HARD])
|
AC_CHECK_FUNCS(sigprocmask sigblock)
|
||||||
fi
|
|
||||||
AC_DEFINE(POSIX_SIGNALS, 1, [FIXME HARD])
|
|
||||||
|
|
||||||
# To support dynamic loading of object files and "dump", the system's
|
# To support dynamic loading of object files and "dump", the system's
|
||||||
# a.out format has to be known. Choose one of the following:
|
# a.out format has to be known. Choose one of the following:
|
||||||
|
@ -293,9 +291,8 @@ AC_CHECK_HEADERS(termio.h termios.h)
|
||||||
# The interpreter uses the getrlimit function to determine the maximum
|
# The interpreter uses the getrlimit function to determine the maximum
|
||||||
# stack size of the running program. If this function is not supported,
|
# stack size of the running program. If this function is not supported,
|
||||||
# set max_stack_size to a (fixed) maximum stack size (in bytes).
|
# set max_stack_size to a (fixed) maximum stack size (in bytes).
|
||||||
if false; then
|
AC_CHECK_FUNCS(getrlimit)
|
||||||
AC_DEFINE(MAX_STACK_SIZE, 1, [FIXME HARD])
|
AC_DEFINE(DEFAULT_MAX_STACK_SIZE, 1024*1024, [Define default max stack size])
|
||||||
fi
|
|
||||||
|
|
||||||
# Is the mprotect system call supported? The generational garbage collector
|
# Is the mprotect system call supported? The generational garbage collector
|
||||||
# requires mprotect to implement incremental GC. $mprotect is ignored if
|
# requires mprotect to implement incremental GC. $mprotect is ignored if
|
||||||
|
@ -339,7 +336,7 @@ fi
|
||||||
# function actually extend the stack? If in doubt, extract alloca.o
|
# function actually extend the stack? If in doubt, extract alloca.o
|
||||||
# from the C library and check if it contains the symbols malloc and free.
|
# from the C library and check if it contains the symbols malloc and free.
|
||||||
# If this is the case, forget it.
|
# If this is the case, forget it.
|
||||||
AC_DEFINE(USE_ALLOCA, 1, [FIXME HARD])
|
AC_CHECK_FUNCS(alloca)
|
||||||
|
|
||||||
# Must <alloca.h> be included to use alloca? Is "#pragma alloca" required?
|
# Must <alloca.h> be included to use alloca? Is "#pragma alloca" required?
|
||||||
AC_CHECK_HEADERS(alloca.h)
|
AC_CHECK_HEADERS(alloca.h)
|
||||||
|
@ -391,6 +388,8 @@ AC_DEFINE(OBJ_DIR, "/usr/lib/elk", [FIXME HARD])
|
||||||
#define FIND_AOUT defined(USE_LD) || defined(CAN_DUMP) || defined(INIT_OBJECTS)
|
#define FIND_AOUT defined(USE_LD) || defined(CAN_DUMP) || defined(INIT_OBJECTS)
|
||||||
AC_DEFINE(FIND_AOUT, 1, [FIXME HARD])
|
AC_DEFINE(FIND_AOUT, 1, [FIXME HARD])
|
||||||
|
|
||||||
|
AC_CHECK_HEADERS(pwd.h sys/resource.h)
|
||||||
|
|
||||||
dnl
|
dnl
|
||||||
dnl Check for available compiler features
|
dnl Check for available compiler features
|
||||||
dnl
|
dnl
|
||||||
|
|
|
@ -28,22 +28,24 @@
|
||||||
* THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
* THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_SIGNAL_H
|
||||||
|
# include <signal.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
extern int Intr_Was_Ignored;
|
extern int Intr_Was_Ignored;
|
||||||
extern unsigned long Intr_Level;
|
extern unsigned long Intr_Level;
|
||||||
|
|
||||||
#ifdef POSIX_SIGNALS
|
#if defined(HAVE_SIGPROCMASK)
|
||||||
extern sigset_t Sigset_Old, Sigset_Block;
|
extern sigset_t Sigset_Old, Sigset_Block;
|
||||||
#else
|
#elif defined(HAVE_SIGBLOCK)
|
||||||
#ifdef BSD_SIGNALS
|
|
||||||
extern int Sigmask_Old, Sigmask_Block;
|
extern int Sigmask_Old, Sigmask_Block;
|
||||||
#else
|
#else
|
||||||
C_LINKAGE_BEGIN
|
C_LINKAGE_BEGIN
|
||||||
extern void Intr_Handler P_((int));
|
extern void Intr_Handler P_((int));
|
||||||
C_LINKAGE_END
|
C_LINKAGE_END
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef BSD_SIGNALS
|
#if defined(HAVE_SIGPROCMASK) || ! defined(HAVE_SIGBLOCK)
|
||||||
# ifndef sigmask
|
# ifndef sigmask
|
||||||
# define sigmask(n) (1 << ((n)-1))
|
# define sigmask(n) (1 << ((n)-1))
|
||||||
# endif
|
# endif
|
||||||
|
@ -57,15 +59,14 @@ extern unsigned long Intr_Level;
|
||||||
if (Intr_Level > 0 && --Intr_Level == 0) Force_Enable_Interrupts;\
|
if (Intr_Level > 0 && --Intr_Level == 0) Force_Enable_Interrupts;\
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BSD_SIGNALS
|
#ifdef HAVE_SIGPROCMASK
|
||||||
#define Force_Disable_Interrupts (void)sigblock (Sigmask_Block)
|
|
||||||
#define Force_Enable_Interrupts (void)sigsetmask (Sigmask_Old)
|
|
||||||
#else
|
|
||||||
#ifdef POSIX_SIGNALS
|
|
||||||
#define Force_Disable_Interrupts (void)sigprocmask (SIG_BLOCK, &Sigset_Block,\
|
#define Force_Disable_Interrupts (void)sigprocmask (SIG_BLOCK, &Sigset_Block,\
|
||||||
(sigset_t *)0)
|
(sigset_t *)0)
|
||||||
#define Force_Enable_Interrupts (void)sigprocmask (SIG_SETMASK, &Sigset_Old,\
|
#define Force_Enable_Interrupts (void)sigprocmask (SIG_SETMASK, &Sigset_Old,\
|
||||||
(sigset_t *)0)
|
(sigset_t *)0)
|
||||||
|
#elif defined(HAVE_SIGBLOCK)
|
||||||
|
#define Force_Disable_Interrupts (void)sigblock (Sigmask_Block)
|
||||||
|
#define Force_Enable_Interrupts (void)sigsetmask (Sigmask_Old)
|
||||||
#else
|
#else
|
||||||
#define Force_Disable_Interrupts {\
|
#define Force_Disable_Interrupts {\
|
||||||
if (!Intr_Was_Ignored) (void)signal (SIGINT, SIG_IGN);\
|
if (!Intr_Was_Ignored) (void)signal (SIGINT, SIG_IGN);\
|
||||||
|
@ -74,4 +75,4 @@ extern unsigned long Intr_Level;
|
||||||
if (!Intr_Was_Ignored) (void)signal (SIGINT, Intr_Handler);\
|
if (!Intr_Was_Ignored) (void)signal (SIGINT, Intr_Handler);\
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
|
@ -149,7 +149,7 @@ extern SYMTAB *Open_File_And_Snarf_Symbols P_((char *));
|
||||||
|
|
||||||
/* stkmem.c
|
/* stkmem.c
|
||||||
*/
|
*/
|
||||||
#ifndef USE_ALLOCA
|
#ifndef HAVE_ALLOCA
|
||||||
extern Object Save_GC_Nodes P_((void));
|
extern Object Save_GC_Nodes P_((void));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
* THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
* THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,6 @@
|
||||||
#ifndef SCHEME_H
|
#ifndef SCHEME_H
|
||||||
#define SCHEME_H
|
#define SCHEME_H
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
#include "site.h"
|
#include "site.h"
|
||||||
#include "funcproto.h"
|
#include "funcproto.h"
|
||||||
#include "param.h"
|
#include "param.h"
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
* THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
* THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef USE_ALLOCA
|
#ifdef HAVE_ALLOCA
|
||||||
|
|
||||||
#ifdef HAVE_ALLOCA_H
|
#ifdef HAVE_ALLOCA_H
|
||||||
# include <alloca.h>
|
# include <alloca.h>
|
||||||
|
@ -59,7 +59,7 @@ C_LINKAGE_END
|
||||||
(ret) = (type)alloca((size)))
|
(ret) = (type)alloca((size)))
|
||||||
#define Alloca_End
|
#define Alloca_End
|
||||||
|
|
||||||
#else /* USE_ALLOCA */
|
#else /* HAVE_ALLOCA */
|
||||||
|
|
||||||
extern MEM_NODE *Mem_List;
|
extern MEM_NODE *Mem_List;
|
||||||
extern char *Mem_Alloc P_((unsigned));
|
extern char *Mem_Alloc P_((unsigned));
|
||||||
|
|
|
@ -201,11 +201,7 @@ static Object P_Pause() {
|
||||||
Fatal_Error("pause() returned unexpectedly");
|
Fatal_Error("pause() returned unexpectedly");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(POSIX_SIGNALS) || defined(BSD_SIGNALS)
|
#if defined(HAVE_SIGPROCMASK) || defined(HAVE_SIGBLOCK)
|
||||||
# define RELIABLE_SIGNALS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RELIABLE_SIGNALS
|
|
||||||
|
|
||||||
static Object Handlers;
|
static Object Handlers;
|
||||||
|
|
||||||
|
@ -217,7 +213,7 @@ static Object P_Alarm(Object s) {
|
||||||
void General_Handler(int sig) {
|
void General_Handler(int sig) {
|
||||||
Object fun, args;
|
Object fun, args;
|
||||||
|
|
||||||
#ifndef BSD_SIGNALS
|
#if defined(HAVE_SIGPROCMASK)
|
||||||
(void)signal(sig, General_Handler);
|
(void)signal(sig, General_Handler);
|
||||||
#endif
|
#endif
|
||||||
Set_Error_Tag("signal-handler");
|
Set_Error_Tag("signal-handler");
|
||||||
|
@ -248,7 +244,7 @@ static Object Action_To_Sym(void (*act)()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Add_To_Mask(int sig) {
|
void Add_To_Mask(int sig) {
|
||||||
#ifdef POSIX_SIGNALS
|
#ifdef HAVE_SIGPROCMASK
|
||||||
sigaddset(&Sigset_Block, sig);
|
sigaddset(&Sigset_Block, sig);
|
||||||
#else
|
#else
|
||||||
Sigmask_Block |= sigmask(sig);
|
Sigmask_Block |= sigmask(sig);
|
||||||
|
@ -258,7 +254,7 @@ void Add_To_Mask(int sig) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Remove_From_Mask(int sig) {
|
void Remove_From_Mask(int sig) {
|
||||||
#ifdef POSIX_SIGNALS
|
#ifdef HAVE_SIGPROCMASK
|
||||||
sigdelset(&Sigset_Block, sig);
|
sigdelset(&Sigset_Block, sig);
|
||||||
#else
|
#else
|
||||||
Sigmask_Block &= ~sigmask(sig);
|
Sigmask_Block &= ~sigmask(sig);
|
||||||
|
@ -319,7 +315,7 @@ static Object P_Signal(int argc, Object *argv) {
|
||||||
Raise_System_Error("~E");
|
Raise_System_Error("~E");
|
||||||
return Truep(old) ? old : Action_To_Sym(disp);
|
return Truep(old) ? old : Action_To_Sym(disp);
|
||||||
}
|
}
|
||||||
#endif /* RELIABLE_SIGNALS */
|
#endif /* defined(HAVE_SIGPROCMASK) || defined(HAVE_SIGBLOCK) */
|
||||||
|
|
||||||
void elk_init_unix_signal() {
|
void elk_init_unix_signal() {
|
||||||
Define_Symbol(&Sym_Exit, "exit");
|
Define_Symbol(&Sym_Exit, "exit");
|
||||||
|
@ -328,7 +324,7 @@ void elk_init_unix_signal() {
|
||||||
Def_Prim(P_Kill, "unix-kill", 2, 2, EVAL);
|
Def_Prim(P_Kill, "unix-kill", 2, 2, EVAL);
|
||||||
Def_Prim(P_List_Signals, "unix-list-signals", 0, 0, EVAL);
|
Def_Prim(P_List_Signals, "unix-list-signals", 0, 0, EVAL);
|
||||||
Def_Prim(P_Pause, "unix-pause", 0, 0, EVAL);
|
Def_Prim(P_Pause, "unix-pause", 0, 0, EVAL);
|
||||||
#ifdef RELIABLE_SIGNALS
|
#if defined(HAVE_SIGPROCMASK) || defined(HAVE_SIGBLOCK)
|
||||||
Def_Prim(P_Alarm, "unix-alarm", 1, 1, EVAL);
|
Def_Prim(P_Alarm, "unix-alarm", 1, 1, EVAL);
|
||||||
Handlers = Make_Vector(NSIG, False);
|
Handlers = Make_Vector(NSIG, False);
|
||||||
Global_GC_Link(Handlers);
|
Global_GC_Link(Handlers);
|
||||||
|
|
12
src/cont.c
12
src/cont.c
|
@ -98,7 +98,7 @@ convex_longjmp (char *p, int i) {
|
||||||
WIND *First_Wind, *Last_Wind;
|
WIND *First_Wind, *Last_Wind;
|
||||||
|
|
||||||
static Object Cont_Value;
|
static Object Cont_Value;
|
||||||
#ifndef USE_ALLOCA
|
#ifndef HAVE_ALLOCA
|
||||||
static Object Cont_GCsave;
|
static Object Cont_GCsave;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ void Jump_Cont (struct S_Control *cp, Object val) {
|
||||||
longjmp (p->j, 1);
|
longjmp (p->j, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef USE_ALLOCA
|
#ifndef HAVE_ALLOCA
|
||||||
Object Terminate_Cont (Object cont) {
|
Object Terminate_Cont (Object cont) {
|
||||||
Free_Mem_Nodes (CONTROL(cont)->memlist);
|
Free_Mem_Nodes (CONTROL(cont)->memlist);
|
||||||
return Void;
|
return Void;
|
||||||
|
@ -190,7 +190,7 @@ Object Internal_Call_CC (int from_dump, Object proc) {
|
||||||
|
|
||||||
control = gcsave = Null;
|
control = gcsave = Null;
|
||||||
GC_Link3 (proc, control, gcsave);
|
GC_Link3 (proc, control, gcsave);
|
||||||
#ifndef USE_ALLOCA
|
#ifndef HAVE_ALLOCA
|
||||||
gcsave = Save_GC_Nodes ();
|
gcsave = Save_GC_Nodes ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -220,12 +220,12 @@ Object Internal_Call_CC (int from_dump, Object proc) {
|
||||||
to = cp->stack;
|
to = cp->stack;
|
||||||
memcpy (to, p, cp->size);
|
memcpy (to, p, cp->size);
|
||||||
cp->delta = to - p;
|
cp->delta = to - p;
|
||||||
#ifndef USE_ALLOCA
|
#ifndef HAVE_ALLOCA
|
||||||
Register_Object (control, (GENERIC)0, Terminate_Cont, 0);
|
Register_Object (control, (GENERIC)0, Terminate_Cont, 0);
|
||||||
Save_Mem_Nodes (control);
|
Save_Mem_Nodes (control);
|
||||||
#endif
|
#endif
|
||||||
if (setjmp (CONTROL(control)->j) != 0) {
|
if (setjmp (CONTROL(control)->j) != 0) {
|
||||||
#ifndef USE_ALLOCA
|
#ifndef HAVE_ALLOCA
|
||||||
Restore_GC_Nodes (Cont_GCsave);
|
Restore_GC_Nodes (Cont_GCsave);
|
||||||
#endif
|
#endif
|
||||||
if (Intr_Level == 0) {
|
if (Intr_Level == 0) {
|
||||||
|
@ -289,7 +289,7 @@ void Funcall_Control_Point (Object control, Object argl, int eval) {
|
||||||
cp = CONTROL(control);
|
cp = CONTROL(control);
|
||||||
Switch_Environment (cp->env);
|
Switch_Environment (cp->env);
|
||||||
GC_List = cp->gclist;
|
GC_List = cp->gclist;
|
||||||
#ifndef USE_ALLOCA
|
#ifndef HAVE_ALLOCA
|
||||||
Restore_Mem_Nodes (control);
|
Restore_Mem_Nodes (control);
|
||||||
Cont_GCsave = CONTROL(control)->gcsave;
|
Cont_GCsave = CONTROL(control)->gcsave;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -39,13 +39,11 @@ extern void Reset () elk_attribute(__noreturn__);
|
||||||
int Intr_Was_Ignored;
|
int Intr_Was_Ignored;
|
||||||
unsigned long int Intr_Level;
|
unsigned long int Intr_Level;
|
||||||
|
|
||||||
#ifdef POSIX_SIGNALS
|
#if defined(HAVE_SIGPROCMASK)
|
||||||
sigset_t Sigset_Old, Sigset_Block;
|
sigset_t Sigset_Old, Sigset_Block;
|
||||||
#else
|
#elif defined(HAVE_SIGBLOCK)
|
||||||
#ifdef BSD_SIGNALS
|
|
||||||
int Sigmask_Old, Sigmask_Block;
|
int Sigmask_Old, Sigmask_Block;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
static Object V_Interrupt_Handler;
|
static Object V_Interrupt_Handler;
|
||||||
|
|
||||||
|
@ -59,25 +57,27 @@ void Signal_Exit (int sig) {
|
||||||
|
|
||||||
void Init_Exception () {
|
void Init_Exception () {
|
||||||
Define_Variable (&V_Interrupt_Handler, "interrupt-handler", Null);
|
Define_Variable (&V_Interrupt_Handler, "interrupt-handler", Null);
|
||||||
#ifdef POSIX_SIGNALS
|
#if defined(HAVE_SIGPROCMASK)
|
||||||
sigemptyset (&Sigset_Block);
|
sigemptyset (&Sigset_Block);
|
||||||
sigaddset (&Sigset_Block, SIGINT);
|
sigaddset (&Sigset_Block, SIGINT);
|
||||||
(void)sigprocmask (0, (sigset_t *)0, &Sigset_Old);
|
(void)sigprocmask (0, (sigset_t *)0, &Sigset_Old);
|
||||||
#else
|
#elif defined(HAVE_SIGBLOCK)
|
||||||
#ifdef BSD_SIGNALS
|
|
||||||
Sigmask_Block = sigmask (SIGINT);
|
Sigmask_Block = sigmask (SIGINT);
|
||||||
Sigmask_Old = sigblock (0);
|
Sigmask_Old = sigblock (0);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#ifdef SIGHUP
|
||||||
(void)signal (SIGHUP, Signal_Exit);
|
(void)signal (SIGHUP, Signal_Exit);
|
||||||
|
#endif
|
||||||
|
#ifdef SIGPIPE
|
||||||
(void)signal (SIGPIPE, Signal_Exit);
|
(void)signal (SIGPIPE, Signal_Exit);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
void Intr_Handler (int sig) {
|
void Intr_Handler (int sig) {
|
||||||
Object fun;
|
Object fun;
|
||||||
|
|
||||||
#ifndef BSD_SIGNALS
|
#if defined(HAVE_SIGPROCMASK) || ! defined(HAVE_SIGBLOCK)
|
||||||
(void)signal (SIGINT, Intr_Handler);
|
(void)signal (SIGINT, Intr_Handler);
|
||||||
#endif
|
#endif
|
||||||
Set_Error_Tag ("interrupt-handler");
|
Set_Error_Tag ("interrupt-handler");
|
||||||
|
|
|
@ -1183,7 +1183,7 @@ static void ScanPage (Object *currentp, Object *nextcp) {
|
||||||
case T_Control_Point:
|
case T_Control_Point:
|
||||||
(CONTROL(obj)->delta) += CONTROL(obj)->reloc;
|
(CONTROL(obj)->delta) += CONTROL(obj)->reloc;
|
||||||
|
|
||||||
#ifdef USE_ALLOCA
|
#ifdef HAVE_ALLOCA
|
||||||
Visit_GC_List (CONTROL(obj)->gclist, CONTROL(obj)->delta);
|
Visit_GC_List (CONTROL(obj)->gclist, CONTROL(obj)->delta);
|
||||||
#else
|
#else
|
||||||
Visit (&CONTROL(obj)->gcsave);
|
Visit (&CONTROL(obj)->gcsave);
|
||||||
|
|
|
@ -243,7 +243,7 @@ again:
|
||||||
case T_Control_Point:
|
case T_Control_Point:
|
||||||
Recursive_Visit (&CONTROL(*p)->memsave);
|
Recursive_Visit (&CONTROL(*p)->memsave);
|
||||||
CONTROL(*p)->delta += reloc;
|
CONTROL(*p)->delta += reloc;
|
||||||
#ifdef USE_ALLOCA
|
#ifdef HAVE_ALLOCA
|
||||||
Visit_GC_List (CONTROL(*p)->gclist, CONTROL(*p)->delta);
|
Visit_GC_List (CONTROL(*p)->gclist, CONTROL(*p)->delta);
|
||||||
#else
|
#else
|
||||||
Recursive_Visit (&CONTROL(*p)->gcsave);
|
Recursive_Visit (&CONTROL(*p)->gcsave);
|
||||||
|
|
16
src/io.c
16
src/io.c
|
@ -32,7 +32,9 @@
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <pwd.h>
|
#ifdef HAVE_PWD_H
|
||||||
|
# include <pwd.h>
|
||||||
|
#endif
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
@ -147,13 +149,16 @@ Object Get_File_Name (Object name) {
|
||||||
|
|
||||||
char *Internal_Tilde_Expand (register char *s, register char **dirp) {
|
char *Internal_Tilde_Expand (register char *s, register char **dirp) {
|
||||||
register char *p;
|
register char *p;
|
||||||
|
#ifdef HAVE_PWD_H
|
||||||
struct passwd *pw, *getpwnam();
|
struct passwd *pw, *getpwnam();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (*s++ != '~')
|
if (*s++ != '~')
|
||||||
return 0;
|
return 0;
|
||||||
for (p = s; *p && *p != '/'; p++)
|
for (p = s; *p && *p != '/'; p++)
|
||||||
;
|
;
|
||||||
if (*p == '/') *p++ = 0;
|
if (*p == '/') *p++ = 0;
|
||||||
|
#ifdef HAVE_PWD_H
|
||||||
if (*s == '\0') {
|
if (*s == '\0') {
|
||||||
if ((*dirp = getenv ("HOME")) == 0)
|
if ((*dirp = getenv ("HOME")) == 0)
|
||||||
*dirp = "";
|
*dirp = "";
|
||||||
|
@ -162,6 +167,9 @@ char *Internal_Tilde_Expand (register char *s, register char **dirp) {
|
||||||
Primitive_Error ("unknown user: ~a", Make_String (s, strlen (s)));
|
Primitive_Error ("unknown user: ~a", Make_String (s, strlen (s)));
|
||||||
*dirp = pw->pw_dir;
|
*dirp = pw->pw_dir;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
*dirp = "";
|
||||||
|
#endif
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,7 +183,8 @@ Object General_File_Operation (Object s, register int op) {
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case 0: {
|
case 0: {
|
||||||
char *p, *dir;
|
char *p, *dir;
|
||||||
if ((p = Internal_Tilde_Expand (r, &dir)) == 0) {
|
p = Internal_Tilde_Expand (r, &dir);
|
||||||
|
if (p == 0) {
|
||||||
Alloca_End;
|
Alloca_End;
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
@ -224,7 +233,8 @@ Object Open_File (char *name, int flags, int err) {
|
||||||
struct stat st;
|
struct stat st;
|
||||||
Alloca_Begin;
|
Alloca_Begin;
|
||||||
|
|
||||||
if ((p = Internal_Tilde_Expand (name, &dir))) {
|
p = Internal_Tilde_Expand (name, &dir);
|
||||||
|
if (p) {
|
||||||
Alloca (name, char*, strlen (dir) + 1 + strlen (p) + 1);
|
Alloca (name, char*, strlen (dir) + 1 + strlen (p) + 1);
|
||||||
sprintf (name, "%s/%s", dir, p);
|
sprintf (name, "%s/%s", dir, p);
|
||||||
}
|
}
|
||||||
|
|
24
src/libelk.c
24
src/libelk.c
|
@ -38,17 +38,19 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#ifndef MAX_STACK_SIZE
|
#ifdef HAVE_GETRLIMIT
|
||||||
# include <sys/time.h>
|
# include <sys/time.h>
|
||||||
# include <sys/resource.h>
|
# ifdef HAVE_SYS_RESOURCES_H
|
||||||
|
# include <sys/resource.h>
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FIND_AOUT
|
#ifdef FIND_AOUT
|
||||||
# ifdef HAVE_UNISTD_H
|
# ifdef HAVE_UNISTD_H
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# else
|
# else
|
||||||
# include <sys/file.h>
|
# include <sys/file.h>
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
|
@ -383,9 +385,7 @@ void Init_Everything () {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Get_Stack_Limit () {
|
void Get_Stack_Limit () {
|
||||||
#ifdef MAX_STACK_SIZE
|
#ifdef HAVE_GETRLIMIT
|
||||||
Max_Stack = MAX_STACK_SIZE;
|
|
||||||
#else
|
|
||||||
struct rlimit rl;
|
struct rlimit rl;
|
||||||
|
|
||||||
if (getrlimit (RLIMIT_STACK, &rl) == -1) {
|
if (getrlimit (RLIMIT_STACK, &rl) == -1) {
|
||||||
|
@ -393,6 +393,8 @@ void Get_Stack_Limit () {
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
Max_Stack = rl.rlim_cur;
|
Max_Stack = rl.rlim_cur;
|
||||||
|
#else
|
||||||
|
Max_Stack = DEFAULT_MAX_STACK_SIZE;
|
||||||
#endif
|
#endif
|
||||||
Max_Stack -= STACK_MARGIN;
|
Max_Stack -= STACK_MARGIN;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
|
|
||||||
#ifdef USE_ALLOCA
|
#ifdef HAVE_ALLOCA
|
||||||
# define MAX_ARGS_ON_STACK 4
|
# define MAX_ARGS_ON_STACK 4
|
||||||
#else
|
#else
|
||||||
# define MAX_ARGS_ON_STACK 8
|
# define MAX_ARGS_ON_STACK 8
|
||||||
|
|
|
@ -52,7 +52,6 @@
|
||||||
|
|
||||||
extern void Flush_Output (Object);
|
extern void Flush_Output (Object);
|
||||||
|
|
||||||
extern char *index();
|
|
||||||
extern double atof();
|
extern double atof();
|
||||||
|
|
||||||
int Skip_Comment (Object);
|
int Skip_Comment (Object);
|
||||||
|
@ -659,7 +658,11 @@ Object Parse_Number (Object port, char const *buf, int radix) {
|
||||||
return Null;
|
return Null;
|
||||||
if (p[1] == '+' || p[1] == '-')
|
if (p[1] == '+' || p[1] == '-')
|
||||||
p++;
|
p++;
|
||||||
|
#ifdef HAVE_INDEX
|
||||||
} else if (radix == 16 && !index ("0123456789abcdefABCDEF", c)) {
|
} else if (radix == 16 && !index ("0123456789abcdefABCDEF", c)) {
|
||||||
|
#else
|
||||||
|
} else if (radix == 16 && !strchr ("0123456789abcdefABCDEF", c)) {
|
||||||
|
#endif
|
||||||
return Null;
|
return Null;
|
||||||
} else if (radix < 16 && (c < '0' || c > '0' + radix-1)) {
|
} else if (radix < 16 && (c < '0' || c > '0' + radix-1)) {
|
||||||
return Null;
|
return Null;
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
|
|
||||||
#ifndef USE_ALLOCA
|
#ifndef HAVE_ALLOCA
|
||||||
|
|
||||||
extern char *malloc();
|
extern char *malloc();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue