home *** CD-ROM | disk | FTP | other *** search
- #ifndef osgbpb_H
- #define osgbpb_H
-
- /* C header file for OSGBPB
- * written by DefMod (Sep 7 1994) on Wed Sep 14 13:18:22 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_GBPB
- #define OS_GBPB 0xC
- #undef XOS_GBPB
- #define XOS_GBPB 0x2000C
- #undef OSGBPB_WriteAt
- #define OSGBPB_WriteAt 0x1
- #undef OSGBPB_Write
- #define OSGBPB_Write 0x2
- #undef OSGBPB_ReadAt
- #define OSGBPB_ReadAt 0x3
- #undef OSGBPB_Read
- #define OSGBPB_Read 0x4
- #undef OSGBPB_ReadDiscName
- #define OSGBPB_ReadDiscName 0x5
- #undef OSGBPB_ReadCSDName
- #define OSGBPB_ReadCSDName 0x6
- #undef OSGBPB_ReadLibName
- #define OSGBPB_ReadLibName 0x7
- #undef OSGBPB_CSDEntries
- #define OSGBPB_CSDEntries 0x8
- #undef OSGBPB_DirEntries
- #define OSGBPB_DirEntries 0x9
- #undef OSGBPB_DirEntriesInfo
- #define OSGBPB_DirEntriesInfo 0xA
- #undef OSGBPB_DirEntriesSystemInfo
- #define OSGBPB_DirEntriesSystemInfo 0xB
- #undef OSGBPB_DirEntriesInfoStamped
- #define OSGBPB_DirEntriesInfoStamped 0xC
- #undef GBPBV
- #define GBPBV 0xC
-
- /************************************
- * Structure and union declarations *
- ************************************/
- typedef struct osgbpb_name osgbpb_name;
- typedef struct osgbpb_disc_name osgbpb_disc_name;
- typedef struct osgbpb_dir_name osgbpb_dir_name;
- typedef struct osgbpb_name_list osgbpb_name_list;
- typedef struct osgbpb_info osgbpb_info;
- typedef struct osgbpb_system_info osgbpb_system_info;
- typedef struct osgbpb_info_stamped osgbpb_info_stamped;
- typedef struct osgbpb_string_list osgbpb_string_list;
- typedef struct osgbpb_info_list osgbpb_info_list;
- typedef struct osgbpb_system_info_list osgbpb_system_info_list;
- typedef struct osgbpb_info_stamped_list osgbpb_info_stamped_list;
-
- /********************
- * Type definitions *
- ********************/
- struct osgbpb_name
- { byte count;
- char c [UNKNOWN];
- };
-
- #define osgbpb_NAME(N) \
- struct \
- { byte count; \
- char c [N]; \
- }
-
- #define osgbpb_SIZEOF_NAME(N) \
- (offsetof (osgbpb_name, c) + \
- (N)*sizeof ((osgbpb_name *) NULL)->c)
-
- struct osgbpb_disc_name
- { osgbpb_name name;
- };
-
- struct osgbpb_dir_name
- { byte reserved;
- osgbpb_name name;
- };
-
- struct osgbpb_name_list
- { osgbpb_name names [UNKNOWN];
- };
-
- struct osgbpb_info
- { bits load_addr;
- bits exec_addr;
- int size;
- bits attr;
- int obj_type;
- char name [UNKNOWN];
- };
-
- #define osgbpb_INFO(N) \
- struct \
- { bits load_addr; \
- bits exec_addr; \
- int size; \
- bits attr; \
- int obj_type; \
- char name [N]; \
- }
-
- #define osgbpb_SIZEOF_INFO(N) \
- (offsetof (osgbpb_info, name) + \
- (N)*sizeof ((osgbpb_info *) NULL)->name)
-
- struct osgbpb_system_info
- { bits load_addr;
- bits exec_addr;
- int size;
- bits attr;
- int obj_type;
- int sin;
- os_date_and_time stamp;
- char name [UNKNOWN];
- };
-
- #define osgbpb_SYSTEM_INFO(N) \
- struct \
- { bits load_addr; \
- bits exec_addr; \
- int size; \
- bits attr; \
- int obj_type; \
- int sin; \
- os_date_and_time stamp; \
- char name [N]; \
- }
-
- #define osgbpb_SIZEOF_SYSTEM_INFO(N) \
- (offsetof (osgbpb_system_info, name) + \
- (N)*sizeof ((osgbpb_system_info *) NULL)->name)
-
- struct osgbpb_info_stamped
- { bits load_addr;
- bits exec_addr;
- int size;
- bits attr;
- int obj_type;
- bits file_type;
- char name [UNKNOWN];
- };
-
- #define osgbpb_INFO_STAMPED(N) \
- struct \
- { bits load_addr; \
- bits exec_addr; \
- int size; \
- bits attr; \
- int obj_type; \
- bits file_type; \
- char name [N]; \
- }
-
- #define osgbpb_SIZEOF_INFO_STAMPED(N) \
- (offsetof (osgbpb_info_stamped, name) + \
- (N)*sizeof ((osgbpb_info_stamped *) NULL)->name)
-
- struct osgbpb_string_list
- { char names [UNKNOWN];
- };
-
- struct osgbpb_info_list
- { osgbpb_info info [UNKNOWN];
- };
-
- struct osgbpb_system_info_list
- { osgbpb_system_info info [UNKNOWN];
- };
-
- struct osgbpb_info_stamped_list
- { osgbpb_info_stamped info [UNKNOWN];
- };
-
- /************************
- * Constant definitions *
- ************************/
- #define osgbpb_PRIVILEGE_OWNER ((byte) 0)
- #define osgbpb_PRIVILEGE_PUBLIC ((byte) 255)
- #define osgbpb_NO_MORE (-1)
-
- /*************************
- * 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: osgbpb_write_at()
- *
- * Description: Writes bytes to an open file at the specified file
- * pointer
- *
- * Input: file - value of R1 on entry
- * data - value of R2 on entry
- * size - value of R3 on entry
- * ptr - value of R4 on entry
- *
- * Output: unwritten - value of R3 on exit (X version only)
- *
- * Returns: R3 (non-X version only)
- *
- * Other notes: Calls SWI 0xC with R0 = 0x1.
- */
-
- extern os_error *xosgbpb_write_at (os_f file,
- byte *data,
- int size,
- int ptr,
- int *unwritten);
- extern int osgbpb_write_at (os_f file,
- byte *data,
- int size,
- int ptr);
-
- /* ------------------------------------------------------------------------
- * Function: osgbpb_write()
- *
- * Description: Writes bytes to an open file
- *
- * Input: file - value of R1 on entry
- * data - value of R2 on entry
- * size - value of R3 on entry
- *
- * Output: unwritten - value of R3 on exit (X version only)
- *
- * Returns: R3 (non-X version only)
- *
- * Other notes: Calls SWI 0xC with R0 = 0x2.
- */
-
- extern os_error *xosgbpb_write (os_f file,
- byte *data,
- int size,
- int *unwritten);
- extern int osgbpb_write (os_f file,
- byte *data,
- int size);
-
- /* ------------------------------------------------------------------------
- * Function: osgbpb_read_at()
- *
- * Description: Reads bytes from an open file at the specified file
- * pointer
- *
- * Input: file - value of R1 on entry
- * buffer - value of R2 on entry
- * size - value of R3 on entry
- * ptr - value of R4 on entry
- *
- * Output: unread - value of R3 on exit (X version only)
- *
- * Returns: R3 (non-X version only)
- *
- * Other notes: Calls SWI 0xC with R0 = 0x3.
- */
-
- extern os_error *xosgbpb_read_at (os_f file,
- byte *buffer,
- int size,
- int ptr,
- int *unread);
- extern int osgbpb_read_at (os_f file,
- byte *buffer,
- int size,
- int ptr);
-
- /* ------------------------------------------------------------------------
- * Function: osgbpb_read()
- *
- * Description: Reads bytes from an open file
- *
- * Input: file - value of R1 on entry
- * buffer - value of R2 on entry
- * size - value of R3 on entry
- *
- * Output: unread - value of R3 on exit (X version only)
- *
- * Returns: R3 (non-X version only)
- *
- * Other notes: Calls SWI 0xC with R0 = 0x4.
- */
-
- extern os_error *xosgbpb_read (os_f file,
- byte *buffer,
- int size,
- int *unread);
- extern int osgbpb_read (os_f file,
- byte *buffer,
- int size);
-
- /* ------------------------------------------------------------------------
- * Function: osgbpb_read_disc_name()
- *
- * Description: Reads the name and boot option of the disc which contains
- * the CSD (prefer OSFSControl_CanonicalisePath and/or
- * OSFSControl_ReadBootOption)
- *
- * Input: disc_name - value of R2 on entry
- *
- * Other notes: Calls SWI 0xC with R0 = 0x5.
- */
-
- extern os_error *xosgbpb_read_disc_name (osgbpb_disc_name *disc_name);
- extern void osgbpb_read_disc_name (osgbpb_disc_name *disc_name);
-
- /* ------------------------------------------------------------------------
- * Function: osgbpb_read_csd_name()
- *
- * Description: Reads the name and privilege status of the CSD (prefer
- * OSFSControl_CanonicalisePath)
- *
- * Input: csd_name - value of R2 on entry
- *
- * Other notes: Calls SWI 0xC with R0 = 0x6.
- */
-
- extern os_error *xosgbpb_read_csd_name (osgbpb_dir_name *csd_name);
- extern void osgbpb_read_csd_name (osgbpb_dir_name *csd_name);
-
- /* ------------------------------------------------------------------------
- * Function: osgbpb_read_lib_name()
- *
- * Description: Reads the name and privilege status of the library
- * (prefer OSFSControl_CanonicalisePath)
- *
- * Input: lib_name - value of R2 on entry
- *
- * Other notes: Calls SWI 0xC with R0 = 0x7.
- */
-
- extern os_error *xosgbpb_read_lib_name (osgbpb_dir_name *lib_name);
- extern void osgbpb_read_lib_name (osgbpb_dir_name *lib_name);
-
- /* ------------------------------------------------------------------------
- * Function: osgbpb_csd_entries()
- *
- * Description: Reads entries from the CSD (prefer OSGBPB_DirEntries)
- *
- * Input: name_list - value of R2 on entry
- * count - value of R3 on entry
- * context - value of R4 on entry
- *
- * Output: unread - value of R3 on exit
- * context_out - value of R4 on exit (X version only)
- *
- * Returns: R4 (non-X version only)
- *
- * Other notes: Calls SWI 0xC with R0 = 0x8.
- */
-
- extern os_error *xosgbpb_csd_entries (osgbpb_name_list *name_list,
- int count,
- int context,
- int *unread,
- int *context_out);
- extern int osgbpb_csd_entries (osgbpb_name_list *name_list,
- int count,
- int context,
- int *unread);
-
- /* ------------------------------------------------------------------------
- * Function: osgbpb_dir_entries()
- *
- * Description: Reads entries from a specified directory
- *
- * Input: dir_name - value of R1 on entry
- * name_list - value of R2 on entry
- * count - value of R3 on entry
- * context - value of R4 on entry
- * size - value of R5 on entry
- * entries - value of R6 on entry
- *
- * Output: read_count - value of R3 on exit
- * context_out - value of R4 on exit (X version only)
- *
- * Returns: R4 (non-X version only)
- *
- * Other notes: Calls SWI 0xC with R0 = 0x9.
- */
-
- extern os_error *xosgbpb_dir_entries (char *dir_name,
- osgbpb_string_list *name_list,
- int count,
- int context,
- int size,
- char *entries,
- int *read_count,
- int *context_out);
- extern int osgbpb_dir_entries (char *dir_name,
- osgbpb_string_list *name_list,
- int count,
- int context,
- int size,
- char *entries,
- int *read_count);
-
- /* ------------------------------------------------------------------------
- * Function: osgbpb_dir_entries_info()
- *
- * Description: Reads entries and file information from a specified
- * directory
- *
- * Input: dir_name - value of R1 on entry
- * info_list - value of R2 on entry
- * count - value of R3 on entry
- * context - value of R4 on entry
- * size - value of R5 on entry
- * entries - value of R6 on entry
- *
- * Output: read_count - value of R3 on exit
- * context_out - value of R4 on exit (X version only)
- *
- * Returns: R4 (non-X version only)
- *
- * Other notes: Calls SWI 0xC with R0 = 0xA.
- */
-
- extern os_error *xosgbpb_dir_entries_info (char *dir_name,
- osgbpb_info_list *info_list,
- int count,
- int context,
- int size,
- char *entries,
- int *read_count,
- int *context_out);
- extern int osgbpb_dir_entries_info (char *dir_name,
- osgbpb_info_list *info_list,
- int count,
- int context,
- int size,
- char *entries,
- int *read_count);
-
- /* ------------------------------------------------------------------------
- * Function: osgbpb_dir_entries_system_info()
- *
- * Description: Reads entries and file information (including SIN) from a
- * specified directory
- *
- * Input: dir_name - value of R1 on entry
- * info_list - value of R2 on entry
- * count - value of R3 on entry
- * context - value of R4 on entry
- * size - value of R5 on entry
- * entries - value of R6 on entry
- *
- * Output: read_count - value of R3 on exit
- * context_out - value of R4 on exit (X version only)
- *
- * Returns: R4 (non-X version only)
- *
- * Other notes: Calls SWI 0xC with R0 = 0xB.
- */
-
- extern os_error *xosgbpb_dir_entries_system_info (char *dir_name,
- osgbpb_system_info_list *info_list,
- int count,
- int context,
- int size,
- char *entries,
- int *read_count,
- int *context_out);
- extern int osgbpb_dir_entries_system_info (char *dir_name,
- osgbpb_system_info_list *info_list,
- int count,
- int context,
- int size,
- char *entries,
- int *read_count);
-
- /* ------------------------------------------------------------------------
- * Function: osgbpb_dir_entries_info_stamped()
- *
- * Description: Reads entries and file information (including file type)
- * from a specified directory
- *
- * Input: dir_name - value of R1 on entry
- * info_list - value of R2 on entry
- * count - value of R3 on entry
- * context - value of R4 on entry
- * size - value of R5 on entry
- * entries - value of R6 on entry
- *
- * Output: read_count - value of R3 on exit
- * context_out - value of R4 on exit (X version only)
- *
- * Returns: R4 (non-X version only)
- *
- * Other notes: Calls SWI 0xC with R0 = 0xC.
- */
-
- extern os_error *xosgbpb_dir_entries_info_stamped (char *dir_name,
- osgbpb_info_stamped_list *info_list,
- int count,
- int context,
- int size,
- char *entries,
- int *read_count,
- int *context_out);
- extern int osgbpb_dir_entries_info_stamped (char *dir_name,
- osgbpb_info_stamped_list *info_list,
- int count,
- int context,
- int size,
- char *entries,
- int *read_count);
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif
-