home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / programming / oslib / oslib_1 / OSLib / Computer / h / fileswitch < prev    next >
Encoding:
Text File  |  1995-08-22  |  14.0 KB  |  357 lines

  1. #ifndef fileswitch_H
  2. #define fileswitch_H
  3.  
  4. /* C header file for FileSwitch
  5.  * written by DefMod (Jul 24 1995) on Tue Aug 22 14:42:56 1995
  6.  * Jonathan Coxhead, Acorn Computers Ltd
  7.  */
  8.  
  9. #ifndef types_H
  10. #include "types.h"
  11. #endif
  12.  
  13. #ifndef os_H
  14. #include "os.h"
  15. #endif
  16.  
  17. /**********************************
  18.  * SWI names and SWI reason codes *
  19.  **********************************/
  20. #undef  OS_BGet
  21. #define OS_BGet                                 0xA
  22. #undef  XOS_BGet
  23. #define XOS_BGet                                0x2000A
  24. #undef  BGetV
  25. #define BGetV                                   0xA
  26. #undef  OS_BPut
  27. #define OS_BPut                                 0xB
  28. #undef  XOS_BPut
  29. #define XOS_BPut                                0x2000B
  30. #undef  BPutV
  31. #define BPutV                                   0xB
  32. #undef  Service_StartUpFS
  33. #define Service_StartUpFS                       0x12
  34. #undef  Service_FSRedeclare
  35. #define Service_FSRedeclare                     0x40
  36. #undef  Service_CloseFile
  37. #define Service_CloseFile                       0x68
  38.  
  39. /************************************
  40.  * Structure and union declarations *
  41.  ************************************/
  42. typedef union  fileswitch_info_words            fileswitch_info_words;
  43.  
  44. /********************
  45.  * Type definitions *
  46.  ********************/
  47. typedef byte fileswitch_fs_no;
  48.  
  49. typedef bits fileswitch_fs_info;
  50.  
  51. typedef bits fileswitch_fs_extra_info;
  52.  
  53. typedef int fileswitch_object_type;
  54.  
  55. typedef bits fileswitch_attr;
  56.  
  57. union fileswitch_info_words
  58.    {  os_date_and_time date_and_time;
  59.       struct
  60.       {  bits exec_addr;
  61.          bits load_addr;
  62.       }
  63.       addrs;
  64.    };
  65.  
  66. /************************
  67.  * Constant definitions *
  68.  ************************/
  69. #define error_FILE_SWITCH_NO_CLAIM              0x400u
  70.       /*Unable to claim FileSwitch workspace*/
  71. #define error_BAD_FS_CONTROL_REASON             0x401u
  72.       /*Bad FSControl call*/
  73. #define error_BAD_OS_FILE_REASON                0x402u
  74.       /*Bad OSFile call*/
  75. #define error_BAD_OS_ARGS_REASON                0x403u
  76.       /*Bad OSArgs call*/
  77. #define error_BAD_OSGBPB_REASON                 0x404u
  78.       /*Bad OSGBPB call*/
  79. #define error_BAD_MODE_FOR_OS_FIND              0x405u
  80.       /*Bad mode for OSFind*/
  81. #define error_NO_ROOM_FOR_TRANSIENT             0x406u
  82.       /*No room to run transient*/
  83. #define error_EXEC_ADDR_NOT_IN_CODE             0x407u
  84.       /*Execution address not within code*/
  85. #define error_EXEC_ADDR_TOO_LOW                 0x408u
  86.       /*Code runs too low*/
  87. #define error_UNKNOWN_ACTION_TYPE               0x409u
  88.       /*No run action for this file type*/
  89. #define error_TOO_MANY_LEVELS                   0x40Au
  90.       /*Too many levels*/
  91. #define error_NO_SELECTED_FILING_SYSTEM         0x40Bu
  92.       /*No selected filing system*/
  93. #define error_CANT_REMOVE_FS_BY_NUMBER          0x40Cu
  94.       /*Can't remove filing system by number*/
  95. #define error_UNALIGNED_FS_ENTRY                0x40Du
  96.       /*Unaligned filing system entry point*/
  97. #define error_UNSUPPORTED_FS_ENTRY              0x40Eu
  98.       /*Filing system does not support this operation*/
  99. #define error_FS_NOT_SPECIAL                    0x40Fu
  100.       /*Filing system does not support special fields*/
  101. #define error_CORE_NOT_READABLE                 0x410u
  102.       /*No readable memory at this address*/
  103. #define error_CORE_NOT_WRITEABLE                0x411u
  104.       /*No writable memory at this address*/
  105. #define error_BAD_BUFFER_SIZE_FOR_STREAM        0x412u
  106.       /*Bad buffer size*/
  107. #define error_NOT_OPEN_FOR_READING              0x413u
  108.       /*Not open for reading*/
  109. #define error_NOT_ENOUGH_STACK_FOR_FS_ENTRY     0x414u
  110.       /*Not enough stack to call filing system*/
  111. #define error_NOTHING_TO_COPY                   0x415u
  112.       /*Nothing to copy*/
  113. #define error_NOTHING_TO_DELETE                 0x416u
  114.       /*Nothing to delete*/
  115. #define error_FILE_SWITCH_CANT_BE_KILLED_WHILST_THREADED 0x417u
  116.       /*FileSwitch can not be killed whilst it is threaded*/
  117. #define error_INVALID_ERROR_BLOCK               0x418u
  118.       /*Invalid error block*/
  119. #define error_FS_FILE_TOO_BIG                   0x419u
  120.       /*File too big , Clashed with ROMFS FileTooBig*/
  121. #define error_CANT_RM_FASTER_FILE_SWITCH        0x41Au
  122.       /*Can't RMFaster FileSwitch*/
  123. #define error_INCONSISTENT_HANDLE_SET           0x41Bu
  124.       /*Inconsistent handle set*/
  125. #define error_IS_AFILE                          0x41Cu
  126.       /*Object is a file*/
  127. #define error_BAD_FILE_TYPE                     0x41Du
  128.       /*Bad file type*/
  129. #define error_LIBRARY_SOMEWHERE_ELSE            0x41Eu
  130.       /*The library is somewhere else*/
  131. #define error_PATH_IS_SELF_CONTRADICTORY        0x41Fu
  132.       /*Path is self contradictory*/
  133. #define error_WASNT_DOLLAR_AFTER_DISC           0x420u
  134.       /*Disc was specified, but absolute wasn't $*/
  135. #define error_NOT_ENOUGH_MEMORY_FOR_WILDCARD_RESOLUTION 0x421u
  136.       /*Not enough memory for wildcard resolution*/
  137. #define error_NOT_ENOUGH_STACK_FOR_WILDCARD_RESOLUTION 0x422u
  138.       /*Not enough stack for wildcard resolution*/
  139. #define error_DIR_WANTED_FILE_FOUND             0x423u
  140.       /*Directory wanted, but file found*/
  141. #define error_NOT_FOUND                         0x424u
  142.       /*Not found, &0100D6*/
  143. #define error_MULTIPART_PATH_USED               0x425u
  144.       /*Path variable had multiple entries and was used for a write operation*/
  145. #define error_RECURSIVE_PATH                    0x426u
  146.       /*One of the path variables used refers to itself*/
  147. #define error_MULTI_FS_DOES_NOT_SUPPORT_GBPB11  0x427u
  148.       /*The OS_GBPB 11 call is not supported by image filing systems*/
  149. #define error_FILE_SWITCH_DATA_LOST             0x428u
  150.       /*Data lost, &4AC , Consistent with ADFS*/
  151. #define error_TOO_MANY_ERROR_LOOKUPS            0x429u
  152.       /*Too many error lookups happening at once - recursion assumed*/
  153. #define error_MESSAGE_FILE_BUSY                 0x42Au
  154.       /*FileSwitch message file busy*/
  155. #define error_PARTITION_BUSY                    0x42Bu
  156.       /*Partition not ready*/
  157. #define fileswitch_FS_NUMBER_NONE               ((fileswitch_fs_no) 0x0u)
  158. #define fileswitch_FS_NUMBER_ROMFS              ((fileswitch_fs_no) 0x3u)
  159. #define fileswitch_FS_NUMBER_NETFS              ((fileswitch_fs_no) 0x5u)
  160. #define fileswitch_FS_NUMBER_ADFS               ((fileswitch_fs_no) 0x8u)
  161. #define fileswitch_FS_NUMBER_NETPRINT           ((fileswitch_fs_no) 0xCu)
  162. #define fileswitch_FS_NUMBER_NULL               ((fileswitch_fs_no) 0xDu)
  163. #define fileswitch_FS_NUMBER_PRINTER            ((fileswitch_fs_no) 0xEu)
  164. #define fileswitch_FS_NUMBER_SERIAL             ((fileswitch_fs_no) 0xFu)
  165. #define fileswitch_FS_NUMBER_VDU                ((fileswitch_fs_no) 0x11u)
  166. #define fileswitch_FS_NUMBER_RAWVDU             ((fileswitch_fs_no) 0x12u)
  167. #define fileswitch_FS_NUMBER_KBD                ((fileswitch_fs_no) 0x13u)
  168. #define fileswitch_FS_NUMBER_RAWKBD             ((fileswitch_fs_no) 0x14u)
  169. #define fileswitch_FS_NUMBER_DESKFS             ((fileswitch_fs_no) 0x15u)
  170. #define fileswitch_FS_NUMBER_RAMFS              ((fileswitch_fs_no) 0x17u)
  171. #define fileswitch_FS_NUMBER_RISCIXFS           ((fileswitch_fs_no) 0x18u)
  172. #define fileswitch_FS_NUMBER_STREAMER           ((fileswitch_fs_no) 0x19u)
  173. #define fileswitch_FS_NUMBER_SCSIFS             ((fileswitch_fs_no) 0x1Au)
  174. #define fileswitch_FS_NUMBER_DIGITISER          ((fileswitch_fs_no) 0x1Bu)
  175. #define fileswitch_FS_NUMBER_SCANNER            ((fileswitch_fs_no) 0x1Cu)
  176. #define fileswitch_FS_NUMBER_MULTIFS            ((fileswitch_fs_no) 0x1Du)
  177. #define fileswitch_FS_NUMBER_NFS                ((fileswitch_fs_no) 0x21u)
  178. #define fileswitch_FS_NUMBER_CDFS               ((fileswitch_fs_no) 0x25u)
  179. #define fileswitch_FS_NUMBER_DOSFS              ((fileswitch_fs_no) 0x2Bu)
  180. #define fileswitch_FS_NUMBER_RESOURCEFS         ((fileswitch_fs_no) 0x2Eu)
  181. #define fileswitch_FS_NUMBER_PIPEFS             ((fileswitch_fs_no) 0x2Fu)
  182. #define fileswitch_FS_NUMBER_DEVICEFS           ((fileswitch_fs_no) 0x35u)
  183. #define fileswitch_FS_NUMBER_PARALLEL           ((fileswitch_fs_no) 0x36u)
  184. #define fileswitch_FS_NUMBER_PCCARDFS           ((fileswitch_fs_no) 0x59u)
  185. #define fileswitch_FS_NUMBER_SHAREFS            ((fileswitch_fs_no) 0x63u)
  186. #define fileswitch_FS_NUMBER                    ((fileswitch_fs_info) 0xFFu)
  187. #define fileswitch_FS_OPEN_FILE_LIMIT           ((fileswitch_fs_info) 0xFF00u)
  188. #define fileswitch_FS_READ_ONLY                 ((fileswitch_fs_info) 0x10000u)
  189. #define fileswitch_HAS_EXTRA_FLAGS              ((fileswitch_fs_info) 0x20000u)
  190. #define fileswitch_NO_FILE_ENTRIES              ((fileswitch_fs_info) 0x40000u)
  191. #define fileswitch_NO_SAVE_ENTRY                ((fileswitch_fs_info) 0x80000u)
  192. #define fileswitch_NO_LOAD_ENTRY                ((fileswitch_fs_info) 0x100000u)
  193. #define fileswitch_IMPLICIT_DIRECTORIES         ((fileswitch_fs_info) 0x200000u)
  194. #define fileswitch_NEEDS_URD_AND_LIB            ((fileswitch_fs_info) 0x400000u)
  195. #define fileswitch_SUPPORTS_IMAGE               ((fileswitch_fs_info) 0x800000u)
  196. #define fileswitch_RESERVED                     ((fileswitch_fs_info) 0x1000000u)
  197. #define fileswitch_SUPPORTS_FILE_INFO           ((fileswitch_fs_info) 0x2000000u)
  198. #define fileswitch_SUPPORTS_STAMP_NAMED         ((fileswitch_fs_info) 0x4000000u)
  199. #define fileswitch_NEEDS_FLUSH                  ((fileswitch_fs_info) 0x8000000u)
  200. #define fileswitch_NEEDS_CREATE                 ((fileswitch_fs_info) 0x10000000u)
  201. #define fileswitch_SUPPORTS_EMPTY_NAMES         ((fileswitch_fs_info) 0x20000000u)
  202. #define fileswitch_INTERACTIVE                  ((fileswitch_fs_info) 0x40000000u)
  203. #define fileswitch_SUPPORTS_SPECIAL             ((fileswitch_fs_info) 0x80000000u)
  204. #define fileswitch_SUPPORTS_DIR_CHANGE          ((fileswitch_fs_extra_info) 0x1u)
  205. #define fileswitch_NEEDS_CAT                    ((fileswitch_fs_extra_info) 0x2u)
  206. #define fileswitch_NEEDS_EX                     ((fileswitch_fs_extra_info) 0x4u)
  207. #define fileswitch_NOT_FOUND                    ((fileswitch_object_type) 0x0u)
  208. #define fileswitch_IS_FILE                      ((fileswitch_object_type) 0x1u)
  209. #define fileswitch_IS_DIR                       ((fileswitch_object_type) 0x2u)
  210. #define fileswitch_IS_IMAGE                     ((fileswitch_object_type) 0x3u)
  211. #define fileswitch_ATTR_OWNER_READ              ((fileswitch_attr) 0x1u)
  212. #define fileswitch_ATTR_OWNER_WRITE             ((fileswitch_attr) 0x2u)
  213. #define fileswitch_ATTR_OWNER_SPECIAL           ((fileswitch_attr) 0x4u)
  214. #define fileswitch_ATTR_OWNER_LOCKED            ((fileswitch_attr) 0x8u)
  215. #define fileswitch_ATTR_WORLD_READ              ((fileswitch_attr) 0x10u)
  216. #define fileswitch_ATTR_WORLD_WRITE             ((fileswitch_attr) 0x20u)
  217. #define fileswitch_ATTR_WORLD_SPECIAL           ((fileswitch_attr) 0x40u)
  218. #define fileswitch_ATTR_WORLD_LOCKED            ((fileswitch_attr) 0x80u)
  219. #define error_NOT_SUPPORTED                     0xF8u
  220.       /*Bad operation on ...:*/
  221. #define error_FS_WRITE_ONLY                     0xFAu
  222.       /*...: is a write only filing system*/
  223. #define error_FS_READ_ONLY                      0xFCu
  224.       /*...: is a read only filing system*/
  225.  
  226. /*************************
  227.  * Function declarations *
  228.  *************************/
  229.  
  230. #ifdef __cplusplus
  231.    extern "C" {
  232. #endif
  233.  
  234. /* ------------------------------------------------------------------------
  235.  * Function:      os_bget()
  236.  *
  237.  * Description:   Reads a byte from an open file
  238.  *
  239.  * Input:         file - value of R1 on entry
  240.  *
  241.  * Output:        c - value of R0 on exit
  242.  *                psr - processor status register on exit (X version only)
  243.  *
  244.  * Returns:       psr (non-X version only)
  245.  *
  246.  * Other notes:   Calls SWI 0xA.
  247.  */
  248.  
  249. extern os_error *xos_bget (os_f file,
  250.       char *c,
  251.       bits *psr);
  252. extern bits os_bget (os_f file,
  253.       char *c);
  254.  
  255. /* ------------------------------------------------------------------------
  256.  * Function:      bgetv()
  257.  *
  258.  * Description:   OS_BGet vector
  259.  *
  260.  * Input:         file - value of R1 on entry
  261.  *
  262.  * Output:        c - value of R0 on exit
  263.  *                psr - processor status register on exit (X version only)
  264.  *
  265.  * Returns:       psr (non-X version only)
  266.  *
  267.  * Other notes:   Calls SWI 0x34 with R9 = 0xA.
  268.  */
  269.  
  270. extern os_error *xbgetv (os_f file,
  271.       char *c,
  272.       bits *psr);
  273. extern bits bgetv (os_f file,
  274.       char *c);
  275.  
  276. /* ------------------------------------------------------------------------
  277.  * Function:      os_bput()
  278.  *
  279.  * Description:   Writes a byte to an open file
  280.  *
  281.  * Input:         c - value of R0 on entry
  282.  *                file - value of R1 on entry
  283.  *
  284.  * Other notes:   Calls SWI 0xB.
  285.  */
  286.  
  287. extern os_error *xos_bput (char c,
  288.       os_f file);
  289. __swi (0xB) void os_bput (char c,
  290.       os_f file);
  291.  
  292. /* ------------------------------------------------------------------------
  293.  * Function:      bputv()
  294.  *
  295.  * Description:   OS_BPut vector
  296.  *
  297.  * Input:         c - value of R0 on entry
  298.  *                file - value of R1 on entry
  299.  *
  300.  * Other notes:   Calls SWI 0x34 with R9 = 0xB.
  301.  */
  302.  
  303. extern os_error *xbputv (char c,
  304.       os_f file);
  305. extern void bputv (char c,
  306.       os_f file);
  307.  
  308. /* ------------------------------------------------------------------------
  309.  * Function:      service_start_up_fs()
  310.  *
  311.  * Description:   Start up filing system - not RISC OS 3.5+
  312.  *
  313.  * Input:         fs_no - value of R2 on entry
  314.  *
  315.  * Other notes:   Calls SWI 0x30 with R1 = 0x12.
  316.  */
  317.  
  318. extern os_error *xservice_start_up_fs (fileswitch_fs_no fs_no);
  319. extern void service_start_up_fs (fileswitch_fs_no fs_no);
  320.  
  321. /* ------------------------------------------------------------------------
  322.  * Function:      service_fs_redeclare()
  323.  *
  324.  * Description:   Filing system reinitialise
  325.  *
  326.  * Other notes:   Calls SWI 0x30 with R1 = 0x40.
  327.  */
  328.  
  329. extern os_error *xservice_fs_redeclare (void);
  330. extern void service_fs_redeclare (void);
  331.  
  332. /* ------------------------------------------------------------------------
  333.  * Function:      service_close_file()
  334.  *
  335.  * Description:   Close an object, and any children of that object
  336.  *
  337.  * Input:         file_name - value of R2 on entry
  338.  *                count - value of R3 on entry
  339.  *
  340.  * Output:        count_out - value of R3 on exit
  341.  *
  342.  * Other notes:   Calls SWI 0x30 with R1 = 0x68.
  343.  */
  344.  
  345. extern os_error *xservice_close_file (char const *file_name,
  346.       int count,
  347.       int *count_out);
  348. extern void service_close_file (char const *file_name,
  349.       int count,
  350.       int *count_out);
  351.  
  352. #ifdef __cplusplus
  353.    }
  354. #endif
  355.  
  356. #endif
  357.