home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / oslib / h / fileswitch < prev    next >
Encoding:
Text File  |  1994-09-07  |  7.6 KB  |  234 lines

  1. #ifndef fileswitch_H
  2. #define fileswitch_H
  3.  
  4. /* C header file for FileSwitch
  5.  * written by DefMod (Sep  7 1994) on Wed Sep  7 21:24:00 1994
  6.  * Copyright © Acorn Computers Ltd, 1994
  7.  */
  8.  
  9. /*************************************************************************
  10.  * This source file was written by Acorn Computers Limited. It is part   *
  11.  * of the OSLib library for writing applications for RISC OS. It may be  *
  12.  * used freely in the creation of programs for RISC OS.                  *
  13.  *************************************************************************/
  14.  
  15. #ifndef types_H
  16.    #include "types.h"
  17. #endif
  18.  
  19. #ifndef os_H
  20.    #include "os.h"
  21. #endif
  22.  
  23. /**********************************
  24.  * SWI names and SWI reason codes *
  25.  **********************************/
  26. #undef  OS_BGet
  27. #define OS_BGet                                 0xA
  28. #undef  XOS_BGet
  29. #define XOS_BGet                                0x2000A
  30. #undef  BGetV
  31. #define BGetV                                   0xA
  32. #undef  OS_BPut
  33. #define OS_BPut                                 0xB
  34. #undef  XOS_BPut
  35. #define XOS_BPut                                0x2000B
  36. #undef  BPutV
  37. #define BPutV                                   0xB
  38. #undef  Service_StartUpFS
  39. #define Service_StartUpFS                       0x12
  40. #undef  Service_FSRedeclare
  41. #define Service_FSRedeclare                     0x40
  42. #undef  Service_CloseFile
  43. #define Service_CloseFile                       0x68
  44.  
  45. /************************
  46.  * Constant definitions *
  47.  ************************/
  48. #define error_FILE_SWITCH_NO_CLAIM              0x400u
  49. #define error_BAD_FS_CONTROL_REASON             0x401u
  50. #define error_BAD_OS_FILE_REASON                0x402u
  51. #define error_BAD_OS_ARGS_REASON                0x403u
  52. #define error_BAD_OSGBPB_REASON                 0x404u
  53. #define error_BAD_MODE_FOR_OS_FIND              0x405u
  54. #define error_NO_ROOM_FOR_TRANSIENT             0x406u
  55. #define error_EXEC_ADDR_NOT_IN_CODE             0x407u
  56. #define error_EXEC_ADDR_TOO_LOW                 0x408u
  57. #define error_UNKNOWN_ACTION_TYPE               0x409u
  58. #define error_TOO_MANY_LEVELS                   0x40Au
  59. #define error_NO_SELECTED_FILING_SYSTEM         0x40Bu
  60. #define error_CANT_REMOVE_FS_BY_NUMBER          0x40Cu
  61. #define error_UNALIGNED_FS_ENTRY                0x40Du
  62. #define error_UNSUPPORTED_FS_ENTRY              0x40Eu
  63. #define error_FS_NOT_SPECIAL                    0x40Fu
  64. #define error_CORE_NOT_READABLE                 0x410u
  65. #define error_CORE_NOT_WRITEABLE                0x411u
  66. #define error_BAD_BUFFER_SIZE_FOR_STREAM        0x412u
  67. #define error_NOT_OPEN_FOR_READING              0x413u
  68. #define error_NOT_ENOUGH_STACK_FOR_FS_ENTRY     0x414u
  69. #define error_NOTHING_TO_COPY                   0x415u
  70. #define error_NOTHING_TO_DELETE                 0x416u
  71. #define error_FILE_SWITCH_CANT_BE_KILLED_WHILST_THREADED 0x417u
  72. #define error_INVALID_ERROR_BLOCK               0x418u
  73. #define error_FS_FILE_TOO_BIG                   0x419u
  74. #define error_CANT_RM_FASTER_FILE_SWITCH        0x41Au
  75. #define error_INCONSISTENT_HANDLE_SET           0x41Bu
  76. #define error_IS_AFILE                          0x41Cu
  77. #define error_BAD_FILE_TYPE                     0x41Du
  78. #define error_LIBRARY_SOMEWHERE_ELSE            0x41Eu
  79. #define error_PATH_IS_SELF_CONTRADICTORY        0x41Fu
  80. #define error_WASNT_DOLLAR_AFTER_DISC           0x420u
  81. #define error_NOT_ENOUGH_MEMORY_FOR_WILDCARD_RESOLUTION 0x421u
  82. #define error_NOT_ENOUGH_STACK_FOR_WILDCARD_RESOLUTION 0x422u
  83. #define error_DIR_WANTED_FILE_FOUND             0x423u
  84. #define error_NOT_FOUND                         0x424u
  85. #define error_MULTIPART_PATH_USED               0x425u
  86. #define error_RECURSIVE_PATH                    0x426u
  87. #define error_MULTI_FS_DOES_NOT_SUPPORT_GBPB11  0x427u
  88. #define error_FILE_SWITCH_DATA_LOST             0x428u
  89. #define error_TOO_MANY_ERROR_LOOKUPS            0x429u
  90. #define error_MESSAGE_FILE_BUSY                 0x42Au
  91. #define error_PARTITION_BUSY                    0x42Bu
  92. #define error_NOT_SUPPORTED                     0xF8u
  93. #define error_FS_WRITE_ONLY                     0xFAu
  94. #define error_FS_READ_ONLY                      0xFCu
  95.  
  96. /*************************
  97.  * Function declarations *
  98.  *************************/
  99.  
  100. #ifdef __cplusplus
  101.    extern "C" {
  102. #endif
  103.  
  104. /*************************************************************
  105.  * NOTE: The following functions provide direct access to    *
  106.  *       the SWI's noted in the function description.        *
  107.  *       Please read the relevant PRM section for more       *
  108.  *       information on their input/output parameters.       *
  109.  *************************************************************/
  110.  
  111. /* ------------------------------------------------------------------------
  112.  * Function:      os_bget()
  113.  *
  114.  * Description:   Reads a byte from an open file
  115.  *
  116.  * Input:         file - value of R1 on entry
  117.  *
  118.  * Output:        c - value of R0 on exit
  119.  *                psr - processor status register on exit (X version only)
  120.  *
  121.  * Returns:       psr (non-X version only)
  122.  *
  123.  * Other notes:   Calls SWI 0xA.
  124.  */
  125.  
  126. extern os_error *xos_bget (os_f file,
  127.       char *c,
  128.       bits *psr);
  129. extern bits os_bget (os_f file,
  130.       char *c);
  131.  
  132. /* ------------------------------------------------------------------------
  133.  * Function:      bgetv()
  134.  *
  135.  * Description:   OS_BGet vector
  136.  *
  137.  * Input:         file - value of R1 on entry
  138.  *
  139.  * Output:        c - value of R0 on exit
  140.  *                psr - processor status register on exit (X version only)
  141.  *
  142.  * Returns:       psr (non-X version only)
  143.  *
  144.  * Other notes:   Calls SWI 0x34 with R9 = 0xA.
  145.  */
  146.  
  147. extern os_error *xbgetv (os_f file,
  148.       char *c,
  149.       bits *psr);
  150. extern bits bgetv (os_f file,
  151.       char *c);
  152.  
  153. /* ------------------------------------------------------------------------
  154.  * Function:      os_bput()
  155.  *
  156.  * Description:   Writes a byte to an open file
  157.  *
  158.  * Input:         c - value of R0 on entry
  159.  *                file - value of R1 on entry
  160.  *
  161.  * Other notes:   Calls SWI 0xB.
  162.  */
  163.  
  164. extern os_error *xos_bput (char c,
  165.       os_f file);
  166. extern void os_bput (char c,
  167.       os_f file);
  168.  
  169. /* ------------------------------------------------------------------------
  170.  * Function:      bputv()
  171.  *
  172.  * Description:   OS_BPut vector
  173.  *
  174.  * Input:         c - value of R0 on entry
  175.  *                file - value of R1 on entry
  176.  *
  177.  * Other notes:   Calls SWI 0x34 with R9 = 0xB.
  178.  */
  179.  
  180. extern os_error *xbputv (char c,
  181.       os_f file);
  182. extern void bputv (char c,
  183.       os_f file);
  184.  
  185. /* ------------------------------------------------------------------------
  186.  * Function:      service_start_up_fs()
  187.  *
  188.  * Description:   Start up filing system (removed with RISC OS 3.5)
  189.  *
  190.  * Input:         fs - value of R2 on entry
  191.  *
  192.  * Other notes:   Calls SWI 0x30 with R1 = 0x12.
  193.  */
  194.  
  195. extern os_error *xservice_start_up_fs (int fs);
  196. extern void service_start_up_fs (int fs);
  197.  
  198. /* ------------------------------------------------------------------------
  199.  * Function:      service_fs_redeclare()
  200.  *
  201.  * Description:   Filing system reinitialise
  202.  *
  203.  * Other notes:   Calls SWI 0x30 with R1 = 0x40.
  204.  */
  205.  
  206. extern os_error *xservice_fs_redeclare (void);
  207. extern void service_fs_redeclare (void);
  208.  
  209. /* ------------------------------------------------------------------------
  210.  * Function:      service_close_file()
  211.  *
  212.  * Description:   Close an object, and any children of that object
  213.  *
  214.  * Input:         file_name - value of R2 on entry
  215.  *                count - value of R3 on entry
  216.  *
  217.  * Output:        count_out - value of R3 on exit
  218.  *
  219.  * Other notes:   Calls SWI 0x30 with R1 = 0x68.
  220.  */
  221.  
  222. extern os_error *xservice_close_file (char *file_name,
  223.       int count,
  224.       int *count_out);
  225. extern void service_close_file (char *file_name,
  226.       int count,
  227.       int *count_out);
  228.  
  229. #ifdef __cplusplus
  230.    }
  231. #endif
  232.  
  233. #endif
  234.