home *** CD-ROM | disk | FTP | other *** search
- #ifndef fileswitch_H
- #define fileswitch_H
-
- /* C header file for FileSwitch
- * written by DefMod (Sep 7 1994) on Wed Sep 7 21:24:00 1994
- * Copyright © Acorn Computers Ltd, 1994
- */
-
- /*************************************************************************
- * This source file was written by Acorn Computers Limited. It is part *
- * of the OSLib library for writing applications for RISC OS. It may be *
- * used freely in the creation of programs for RISC OS. *
- *************************************************************************/
-
- #ifndef types_H
- #include "types.h"
- #endif
-
- #ifndef os_H
- #include "os.h"
- #endif
-
- /**********************************
- * SWI names and SWI reason codes *
- **********************************/
- #undef OS_BGet
- #define OS_BGet 0xA
- #undef XOS_BGet
- #define XOS_BGet 0x2000A
- #undef BGetV
- #define BGetV 0xA
- #undef OS_BPut
- #define OS_BPut 0xB
- #undef XOS_BPut
- #define XOS_BPut 0x2000B
- #undef BPutV
- #define BPutV 0xB
- #undef Service_StartUpFS
- #define Service_StartUpFS 0x12
- #undef Service_FSRedeclare
- #define Service_FSRedeclare 0x40
- #undef Service_CloseFile
- #define Service_CloseFile 0x68
-
- /************************
- * Constant definitions *
- ************************/
- #define error_FILE_SWITCH_NO_CLAIM 0x400u
- #define error_BAD_FS_CONTROL_REASON 0x401u
- #define error_BAD_OS_FILE_REASON 0x402u
- #define error_BAD_OS_ARGS_REASON 0x403u
- #define error_BAD_OSGBPB_REASON 0x404u
- #define error_BAD_MODE_FOR_OS_FIND 0x405u
- #define error_NO_ROOM_FOR_TRANSIENT 0x406u
- #define error_EXEC_ADDR_NOT_IN_CODE 0x407u
- #define error_EXEC_ADDR_TOO_LOW 0x408u
- #define error_UNKNOWN_ACTION_TYPE 0x409u
- #define error_TOO_MANY_LEVELS 0x40Au
- #define error_NO_SELECTED_FILING_SYSTEM 0x40Bu
- #define error_CANT_REMOVE_FS_BY_NUMBER 0x40Cu
- #define error_UNALIGNED_FS_ENTRY 0x40Du
- #define error_UNSUPPORTED_FS_ENTRY 0x40Eu
- #define error_FS_NOT_SPECIAL 0x40Fu
- #define error_CORE_NOT_READABLE 0x410u
- #define error_CORE_NOT_WRITEABLE 0x411u
- #define error_BAD_BUFFER_SIZE_FOR_STREAM 0x412u
- #define error_NOT_OPEN_FOR_READING 0x413u
- #define error_NOT_ENOUGH_STACK_FOR_FS_ENTRY 0x414u
- #define error_NOTHING_TO_COPY 0x415u
- #define error_NOTHING_TO_DELETE 0x416u
- #define error_FILE_SWITCH_CANT_BE_KILLED_WHILST_THREADED 0x417u
- #define error_INVALID_ERROR_BLOCK 0x418u
- #define error_FS_FILE_TOO_BIG 0x419u
- #define error_CANT_RM_FASTER_FILE_SWITCH 0x41Au
- #define error_INCONSISTENT_HANDLE_SET 0x41Bu
- #define error_IS_AFILE 0x41Cu
- #define error_BAD_FILE_TYPE 0x41Du
- #define error_LIBRARY_SOMEWHERE_ELSE 0x41Eu
- #define error_PATH_IS_SELF_CONTRADICTORY 0x41Fu
- #define error_WASNT_DOLLAR_AFTER_DISC 0x420u
- #define error_NOT_ENOUGH_MEMORY_FOR_WILDCARD_RESOLUTION 0x421u
- #define error_NOT_ENOUGH_STACK_FOR_WILDCARD_RESOLUTION 0x422u
- #define error_DIR_WANTED_FILE_FOUND 0x423u
- #define error_NOT_FOUND 0x424u
- #define error_MULTIPART_PATH_USED 0x425u
- #define error_RECURSIVE_PATH 0x426u
- #define error_MULTI_FS_DOES_NOT_SUPPORT_GBPB11 0x427u
- #define error_FILE_SWITCH_DATA_LOST 0x428u
- #define error_TOO_MANY_ERROR_LOOKUPS 0x429u
- #define error_MESSAGE_FILE_BUSY 0x42Au
- #define error_PARTITION_BUSY 0x42Bu
- #define error_NOT_SUPPORTED 0xF8u
- #define error_FS_WRITE_ONLY 0xFAu
- #define error_FS_READ_ONLY 0xFCu
-
- /*************************
- * Function declarations *
- *************************/
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- /*************************************************************
- * NOTE: The following functions provide direct access to *
- * the SWI's noted in the function description. *
- * Please read the relevant PRM section for more *
- * information on their input/output parameters. *
- *************************************************************/
-
- /* ------------------------------------------------------------------------
- * Function: os_bget()
- *
- * Description: Reads a byte from an open file
- *
- * Input: file - value of R1 on entry
- *
- * Output: c - value of R0 on exit
- * psr - processor status register on exit (X version only)
- *
- * Returns: psr (non-X version only)
- *
- * Other notes: Calls SWI 0xA.
- */
-
- extern os_error *xos_bget (os_f file,
- char *c,
- bits *psr);
- extern bits os_bget (os_f file,
- char *c);
-
- /* ------------------------------------------------------------------------
- * Function: bgetv()
- *
- * Description: OS_BGet vector
- *
- * Input: file - value of R1 on entry
- *
- * Output: c - value of R0 on exit
- * psr - processor status register on exit (X version only)
- *
- * Returns: psr (non-X version only)
- *
- * Other notes: Calls SWI 0x34 with R9 = 0xA.
- */
-
- extern os_error *xbgetv (os_f file,
- char *c,
- bits *psr);
- extern bits bgetv (os_f file,
- char *c);
-
- /* ------------------------------------------------------------------------
- * Function: os_bput()
- *
- * Description: Writes a byte to an open file
- *
- * Input: c - value of R0 on entry
- * file - value of R1 on entry
- *
- * Other notes: Calls SWI 0xB.
- */
-
- extern os_error *xos_bput (char c,
- os_f file);
- extern void os_bput (char c,
- os_f file);
-
- /* ------------------------------------------------------------------------
- * Function: bputv()
- *
- * Description: OS_BPut vector
- *
- * Input: c - value of R0 on entry
- * file - value of R1 on entry
- *
- * Other notes: Calls SWI 0x34 with R9 = 0xB.
- */
-
- extern os_error *xbputv (char c,
- os_f file);
- extern void bputv (char c,
- os_f file);
-
- /* ------------------------------------------------------------------------
- * Function: service_start_up_fs()
- *
- * Description: Start up filing system (removed with RISC OS 3.5)
- *
- * Input: fs - value of R2 on entry
- *
- * Other notes: Calls SWI 0x30 with R1 = 0x12.
- */
-
- extern os_error *xservice_start_up_fs (int fs);
- extern void service_start_up_fs (int fs);
-
- /* ------------------------------------------------------------------------
- * Function: service_fs_redeclare()
- *
- * Description: Filing system reinitialise
- *
- * Other notes: Calls SWI 0x30 with R1 = 0x40.
- */
-
- extern os_error *xservice_fs_redeclare (void);
- extern void service_fs_redeclare (void);
-
- /* ------------------------------------------------------------------------
- * Function: service_close_file()
- *
- * Description: Close an object, and any children of that object
- *
- * Input: file_name - value of R2 on entry
- * count - value of R3 on entry
- *
- * Output: count_out - value of R3 on exit
- *
- * Other notes: Calls SWI 0x30 with R1 = 0x68.
- */
-
- extern os_error *xservice_close_file (char *file_name,
- int count,
- int *count_out);
- extern void service_close_file (char *file_name,
- int count,
- int *count_out);
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif
-