home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 2 / DATAFILE_PDCD2.iso / utilities2 / unixlib36d / UnixLib36d / clib / sys / h / os < prev    next >
Encoding:
Text File  |  1993-09-01  |  3.8 KB  |  136 lines

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