home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************
- *
- * $Source: /unixb/home/unixlib/source/unixlib37/src/clib/sys/h/RCS/syslib,v $
- * $Date: 1996/11/06 22:01:41 $
- * $Revision: 1.5 $
- * $State: Rel $
- * $Author: unixlib $
- *
- * $Log: syslib,v $
- * Revision 1.5 1996/11/06 22:01:41 unixlib
- * Yet more changes by NB, PB and SC.
- *
- * Revision 1.4 1996/10/30 21:58:59 unixlib
- * Massive changes made by Nick Burret and Peter Burwood.
- *
- * Revision 1.3 1996/07/21 22:15:12 unixlib
- * CL_0001 Nick Burret
- * Improve memory handling. Remove C++ library incompatibilities.
- * Improve file stat routines.
- *
- * Revision 1.2 1996/05/06 09:03:13 unixlib
- * Updates to sources made by Nick Burrett, Peter Burwood and Simon Callan.
- * Saved for 3.7a release.
- *
- * Revision 1.1 1996/04/19 21:23:56 simon
- * Initial revision
- *
- ***************************************************************************/
-
- #ifndef __SYS_SYSLIB_H
- #define __SYS_SYSLIB_H
-
- #ifndef __SYS_OS_H
- #include <sys/os.h>
- #endif
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- /* Keep in sync with clib.unixlib.s.asm_dec */
- #define __ALLOCA_FATAL
- #undef __PARANOID
- #define __DYNAMIC_AREA
- #undef __4K_BOUNDARY
-
- extern int __funcall_error(char *, int, unsigned int);
- #ifndef __PARANOID
- #define __funcall(f,p) ((f)p)
- #else
- #define __funcall(f,p) \
- ((((void *)(f) >= __base) && (((unsigned int)(f) & ~3) == (unsigned int)(f)) \
- ? 0 : __funcall_error(__FILE__,__LINE__,(unsigned int)(f))), (f)p)
- #endif
-
- extern void __main(void); /* assembler initialization */
- extern void _main(void); /* C initialization */
-
- extern void __exit(int); /* assembler exit */
- extern void __exit_no_code(void);
-
- #define STAKSIZ 2048
-
- /* __break is initialised to __lomem & __stack to __himem - STAKSIZ;
- * __stack is extended downwards in 512 byte chunks by x$stack_overflow()
- * and __break is extended upwards by brk() and sbrk(). The sl
- * register is kept equal to __stack + 256. Should x$stack_overflow()
- * attempt to extend __stack below __break then SIGEMT is raised.
- * Should brk() or sbrk() be asked to extend __break above __stack
- * then they return with ENOMEM. */
-
- extern char *__cli; /* command line from OS_GetEnv */
-
- extern void __svccli(char *); /* strcpy __cli in SVC mode */
-
- extern void *__base; /* BASE = Image$$RO$$Base */
- extern void *__lomem; /* LOMEM = Image$$RW$$Limit */
- extern void *__himem; /* HIMEM from OS_GetEnv */
- extern void *__rwlimit;
-
- extern void *__break; /* end of data area */
- extern void *__stack; /* bottom of stack */
- extern void *__stack_limit;
- extern int __codeshift;
- extern int __dynamic_num;
- extern void __dynamic_area_exit(void);
-
- /* Zero if we are not executing within a TaskWindow
- Not zero if we are executing within a TaskWindow. */
- extern int __taskwindow;
-
- extern unsigned int __time[2]; /* start time */
-
- #define __OS_ARTHUR 0xA0
- #define __OS_RISCOS_200 0xA1
- #define __OS_RISCOS_201 0xA2
- #define __OS_RISCOS_300 0xA3
- #define __OS_RISCOS_310 0xA4
- #define __OS_RISCOS_350 0xA5
- #define __OS_RISCOS_360 0xA6
- #define __OS_RISCOS_370 0xA7
-
- /* setjmp() and longjmp() modify their behaviour according to __fpflag */
-
- /* FP flag reflecting Floating Point presence or not. */
- extern int __fpflag;
-
- /* Check Floating Point presence and set/clear __fpflag to suit. */
- extern void __fptest(void);
-
- /* Resource limit initialisation */
- extern void __resource_initialise (void);
-
- /* Initialse the signal handlers. */
- extern void __unixlib_signal_initialise (void);
-
- /* Stop the interval timers. */
- extern void __stop_itimers (void);
-
- /* OS_ChangeEnvironment is used to set up exception handlers. These
- * handlers use OS_CallBack to raise signals in the foreground process.
- * RTFM (RiscOS PRM - 'The Program Environment') for more info. */
-
- /* __reset() performs all the functions of exit(), but returns without
- * exiting - note that after a call to __reset() all handlers are
- * in their original state, and *all* stdio & UNIX I/O has been shut down.
- * You should use __exit() to exit after __reset(). */
-
- extern void __reset(void); /* reset handlers, etc. back to orig. state */
-
-
- /* struct handler contains all the information about an
- * OS_ChangeEnvironment handler */
-
- struct handler
- {
- void (*h)(void); /* address of handler (0 = default) */
- unsigned int r; /* r12/0 handler arg. (0 = default) */
- void *b; /* buffer pointer (0 = default) */
- };
-
- /* struct env contains all the info. needed to restore
- * the RiscOS environment prior to a call to OS_Exit */
-
- struct env
- {
- struct handler h[13]; /* handlers 0-12 */
- };
-
- extern struct env __Cenv[1]; /* this C environment */
- extern struct env __Oenv[1]; /* the old (calling) environment */
-
- extern _kernel_oserror *__rdenv(int,struct handler *); /* OS_ChangeEnvironment */
- extern _kernel_oserror *__wrenv(int,struct handler *); /* OS_ChangeEnvironment */
-
- /* vfork() & exec() */
-
- extern void __vret(int); /* return from child - calls __vexit() */
-
- extern int *__vfork(void); /* fork to child context */
- extern int *__vexit(int); /* restore to parent context */
-
- extern void __exret(void); /* return from __exec() - calls __vret() */
-
- extern void (*__exptr)(char *); /* pointer to __exec() routine */
- extern int __exlen; /* length of __exec() routine */
- extern _kernel_oserror *__exerr;
- extern int __exshift; /* __exec() shift */
-
- /* vfork weak link */
-
- extern void (*___vret)(int);
-
- /* stdio weak links */
-
- extern void (*___stdioinit)(void);
- extern void (*___stdioexit)(void);
-
- /* C++ global constructor weak link */
- extern void (*___do_global_ctors)(void);
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif
-