home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / unix / unixlib_1 / !UnixLib37_src_clib_sys_h_os < prev    next >
Encoding:
C/C++ Source or Header  |  1996-11-09  |  4.4 KB  |  151 lines

  1. /****************************************************************************
  2.  *
  3.  * $Source: /unixb/home/unixlib/source/unixlib37/src/clib/sys/h/RCS/os,v $
  4.  * $Date: 1996/10/30 21:58:59 $
  5.  * $Revision: 1.2 $
  6.  * $State: Rel $
  7.  * $Author: unixlib $
  8.  *
  9.  * $Log: os,v $
  10.  * Revision 1.2  1996/10/30 21:58:59  unixlib
  11.  * Massive changes made by Nick Burret and Peter Burwood.
  12.  *
  13.  * Revision 1.1  1996/04/19 21:23:56  simon
  14.  * Initial revision
  15.  *
  16.  ***************************************************************************/
  17.  
  18. #ifndef __SYS_OS_H
  19. #define __SYS_OS_H
  20.  
  21. #ifndef __KERNEL_H
  22. #include <kernel.h>
  23. #endif
  24.  
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28.  
  29. #define os_error _kernel_oserror
  30.  
  31. extern    int        os_console(void);    /* setup console I/O */
  32. extern    int        os_423(void);        /* setup RS423 I/O */
  33.  
  34. extern    int        os_vdu(int);
  35. extern    int        os_get(void);
  36. extern    int        os_inkey(int);        /* returns -1 on timeout */
  37. extern    int        os_keyflush(void);    /* flush keyboard buffer */
  38.  
  39. /* 423 times are in centiseconds */
  40.  
  41. extern    int        os_423vdu(int);
  42. extern    int        os_423get(void);
  43. extern    int        os_423inkey(int);    /* returns -1 on timeout */
  44. extern    int        os_423flush(void);    /* flush RS423 buffer */
  45. extern    int        os_423break(int);
  46.  
  47. extern    _kernel_oserror    *os_swi(int,int * /* 10 reg */ );
  48.  
  49. extern    _kernel_oserror    *os_byte(int,int,int,int * /* 3 reg */ );
  50. extern    _kernel_oserror    *os_word(int,void *);
  51.  
  52. extern    _kernel_oserror    *os_prhex(int);     /* %8x format hex output */
  53. extern    _kernel_oserror    *os_print(char *);
  54. extern    _kernel_oserror    *os_write(char *,int);
  55. extern    _kernel_oserror    *os_nl(void);        /* newline */
  56.  
  57. extern    _kernel_oserror    *os_cli(char *);
  58.  
  59. extern    _kernel_oserror    *os_file(int,char *,int * /* 6 reg */ );
  60.  
  61. /* OS_Find */
  62.  
  63. extern    _kernel_oserror    *os_fopen(int,char *,int * /* 1 reg */ );
  64. extern    _kernel_oserror    *os_fclose(int);
  65.  
  66. /* OS_GBPB */
  67.  
  68. extern    _kernel_oserror    *os_fread(int,void *,int,int * /* 5 reg */ );
  69. extern    _kernel_oserror    *os_fwrite(int,void *,int,int * /* 5 reg */ );
  70.  
  71. extern    _kernel_oserror    *os_args(int,int,int,int * /* 3 reg */ );
  72.  
  73. extern    _kernel_oserror    *os_fsctrl(int,char *,char *,int);
  74.  
  75.  
  76. extern void __seterr(_kernel_oserror *);    /* flag RiscOS error to UNIX */
  77.  
  78. extern void __seterr_(char *);        /* flag error to UNIX */
  79.  
  80.  
  81. /* error flags */
  82.  
  83. #define OS_EHARD(x)    ((x) & 0x80000000)    /* hardware error */
  84. #define OS_EOS(x)    (!((x) & 0x40000000))    /* OS generated */
  85.  
  86. /* error generators */
  87.  
  88. #define OS_EBBC(x) \
  89.     (!(((x) & ~0xff000000)>>8))        /* OS - BBC compatible */
  90. #define OS_EMODULE(x) \
  91.     ((((x) & ~0xff000000)>>5) == 0x08)    /* OS_Module */
  92. #define OS_EVARVAL(x) \
  93.     ((((x) & ~0xff000000)>>5) == 0x09)    /* OS_{Read,Set}VarVal */
  94. #define OS_EREDIR(x) \
  95.     ((((x) & ~0xff000000)>>5) == 0x0a)    /* Redirection Manager */
  96. #define OS_EEVAL(x) \
  97.     ((((x) & ~0xff000000)>>5) == 0x0b)    /* OS_EvaluateExpression */
  98. #define OS_ECLREL(x) \
  99.   ((((x) & ~0xff000000)>>4) >= 0x18 && (((x) & ~0xff000000)>>4) < 0x1b)
  100.                         /* OS_{Claim,Release} */
  101. #define OS_ECHDYN(x) \
  102.     ((((x) & ~0xff000000)>>4) == 0x1b)    /* OS_ChangeDynamicArea */
  103. #define OS_ECHENV(x) \
  104.     ((((x) & ~0xff000000)>>5) == 0x0e)    /* OS_ChangeEnvironment */
  105. #define OS_EOSCLI(x) \
  106.     ((((x) & ~0xff000000)>>4) == 0x1e)    /* OS_CLI / miscellaneous */
  107.  
  108. #define OS_EFONT(x) \
  109.     ((((x) & ~0xff000000)>>7) == 0x04)    /* font manager */
  110. #define OS_EWIMP(x) \
  111.     ((((x) & ~0xff000000)>>6) == 0x0a)    /* wimp */
  112. #define OS_EDATE(x) \
  113.     ((((x) & ~0xff000000)>>6) == 0x0b)    /* date/time conversion */
  114.  
  115. #define OS_EECONET(x) \
  116.     ((((x) & ~0xff000000)>>8) == 0x03)    /* econet */
  117. #define OS_EFSWITCH(x) \
  118.     ((((x) & ~0xff000000)>>8) == 0x04)    /* fileswitch */
  119. #define OS_EPODULE(x) \
  120.   ((((x) & ~0xff000000)>>4) >= 0x50 && (((x) & ~0xff000000)>>4) < 0x5c)
  121.                         /* podule */
  122. #define OS_EPRINT(x) \
  123.     ((((x) & ~0xff000000)>>6) == 0x11)    /* printer driver */
  124. #define OS_EMOS(x) \
  125.     ((((x) & ~0xff000000)>>6) == 0x12)    /* misc. OS errors */
  126. #define OS_EINATION(x) \
  127.   ((((x) & ~0xff000000)>>4) >= 0x64 && (((x) & ~0xff000000)>>4) < 0x70)
  128.                         /* international module */
  129. #define OS_ESPRITE(x) \
  130.     ((((x) & ~0xff000000)>>8) == 0x07)    /* sprites */
  131. #define OS_EDEBUG(x) \
  132.     ((((x) & ~0xff000000)>>8) == 0x08)    /* debugger */
  133.  
  134. #define OS_EFS(x) \
  135.     ((((x) & ~0xff000000)>>16) == 0x1)    /* filing systems */
  136. #define OS_EADFS(x) \
  137.     ((((x) & ~0xff000000)>>8) == 0x108)    /* ADFS specific */
  138.  
  139. #define OS_ESOUND(x) \
  140.     ((((x) & ~0xff000000)>>8) == 0x200)    /* sound */
  141. #define OS_ESCSI(x) \
  142.     ((((x) & ~0xff000000)>>8) == 0x201)    /* SCSI */
  143. #define OS_EVIDEO(x) \
  144.     ((((x) & ~0xff000000)>>8) == 0x202)    /* video */
  145.  
  146. #ifdef __cplusplus
  147.     }
  148. #endif
  149.  
  150. #endif
  151.