home *** CD-ROM | disk | FTP | other *** search
- /* sys/os.h (c) Copyright 1990 H.Rogers */
-
- #ifndef __SYS_OS_H
- #define __SYS_OS_H
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- typedef struct
- {
- unsigned int err;
- char mess[252];
- } os_error;
-
- extern int os_console(void); /* setup console I/O */
- extern int os_423(void); /* setup RS423 I/O */
-
- extern int os_vdu(int);
- extern int os_get(void);
- extern int os_inkey(int); /* returns -1 on timeout */
- extern int os_keyflush(void); /* flush keyboard buffer */
-
- /* 423 times are in centiseconds */
-
- extern int os_423vdu(int);
- extern int os_423get(void);
- extern int os_423inkey(int); /* returns -1 on timeout */
- extern int os_423flush(void); /* flush RS423 buffer */
- extern int os_423break(int);
-
- extern os_error *os_swi(int,int * /* 10 reg */ );
-
- extern os_error *os_byte(int,int,int,int * /* 3 reg */ );
- extern os_error *os_word(int,void *);
-
- extern os_error *os_prhex(int); /* %8x format hex output */
- extern os_error *os_print(char *);
- extern os_error *os_write(char *,int);
- extern os_error *os_nl(void); /* newline */
-
- extern os_error *os_cli(char *);
-
- extern os_error *os_file(int,char *,int * /* 6 reg */ );
-
- /* OS_Find */
-
- extern os_error *os_fopen(int,char *,int * /* 1 reg */ );
- extern os_error *os_fclose(int);
-
- /* OS_GBPB */
-
- extern os_error *os_fread(int,void *,int,int * /* 5 reg */ );
- extern os_error *os_fwrite(int,void *,int,int * /* 5 reg */ );
-
- extern os_error *os_args(int,int,int,int * /* 3 reg */ );
-
- extern os_error *os_fsctrl(int,char *,char *,int);
-
-
- extern void __seterr(os_error *); /* flag RiscOS error to UNIX */
-
- extern void __seterr_(char *); /* flag error to UNIX */
-
-
- /* error flags */
-
- #define OS_EHARD(x) ((x) & 0x80000000) /* hardware error */
- #define OS_EOS(x) (!((x) & 0x40000000)) /* OS generated */
-
- /* error generators */
-
- #define OS_EBBC(x) \
- (!(((x) & ~0xff000000)>>8)) /* OS - BBC compatible */
- #define OS_EMODULE(x) \
- ((((x) & ~0xff000000)>>5) == 0x08) /* OS_Module */
- #define OS_EVARVAL(x) \
- ((((x) & ~0xff000000)>>5) == 0x09) /* OS_{Read,Set}VarVal */
- #define OS_EREDIR(x) \
- ((((x) & ~0xff000000)>>5) == 0x0a) /* Redirection Manager */
- #define OS_EEVAL(x) \
- ((((x) & ~0xff000000)>>5) == 0x0b) /* OS_EvaluateExpression */
- #define OS_ECLREL(x) \
- ((((x) & ~0xff000000)>>4) >= 0x18 && (((x) & ~0xff000000)>>4) < 0x1b)
- /* OS_{Claim,Release} */
- #define OS_ECHDYN(x) \
- ((((x) & ~0xff000000)>>4) == 0x1b) /* OS_ChangeDynamicArea */
- #define OS_ECHENV(x) \
- ((((x) & ~0xff000000)>>5) == 0x0e) /* OS_ChangeEnvironment */
- #define OS_EOSCLI(x) \
- ((((x) & ~0xff000000)>>4) == 0x1e) /* OS_CLI / miscellaneous */
-
- #define OS_EFONT(x) \
- ((((x) & ~0xff000000)>>7) == 0x04) /* font manager */
- #define OS_EWIMP(x) \
- ((((x) & ~0xff000000)>>6) == 0x0a) /* wimp */
- #define OS_EDATE(x) \
- ((((x) & ~0xff000000)>>6) == 0x0b) /* date/time conversion */
-
- #define OS_EECONET(x) \
- ((((x) & ~0xff000000)>>8) == 0x03) /* econet */
- #define OS_EFSWITCH(x) \
- ((((x) & ~0xff000000)>>8) == 0x04) /* fileswitch */
- #define OS_EPODULE(x) \
- ((((x) & ~0xff000000)>>4) >= 0x50 && (((x) & ~0xff000000)>>4) < 0x5c)
- /* podule */
- #define OS_EPRINT(x) \
- ((((x) & ~0xff000000)>>6) == 0x11) /* printer driver */
- #define OS_EMOS(x) \
- ((((x) & ~0xff000000)>>6) == 0x12) /* misc. OS errors */
- #define OS_EINATION(x) \
- ((((x) & ~0xff000000)>>4) >= 0x64 && (((x) & ~0xff000000)>>4) < 0x70)
- /* international module */
- #define OS_ESPRITE(x) \
- ((((x) & ~0xff000000)>>8) == 0x07) /* sprites */
- #define OS_EDEBUG(x) \
- ((((x) & ~0xff000000)>>8) == 0x08) /* debugger */
-
- #define OS_EFS(x) \
- ((((x) & ~0xff000000)>>16) == 0x1) /* filing systems */
- #define OS_EADFS(x) \
- ((((x) & ~0xff000000)>>8) == 0x108) /* ADFS specific */
-
- #define OS_ESOUND(x) \
- ((((x) & ~0xff000000)>>8) == 0x200) /* sound */
- #define OS_ESCSI(x) \
- ((((x) & ~0xff000000)>>8) == 0x201) /* SCSI */
- #define OS_EVIDEO(x) \
- ((((x) & ~0xff000000)>>8) == 0x202) /* video */
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif
-