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

  1. #ifndef osgbpb_H
  2. #define osgbpb_H
  3.  
  4. /* C header file for OSGBPB
  5.  * written by DefMod (Jul 24 1995) on Tue Aug 22 14:42:27 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. #ifndef fileswitch_H
  18. #include "fileswitch.h"
  19. #endif
  20.  
  21. /**********************************
  22.  * SWI names and SWI reason codes *
  23.  **********************************/
  24. #undef  OS_GBPB
  25. #define OS_GBPB                                 0xC
  26. #undef  XOS_GBPB
  27. #define XOS_GBPB                                0x2000C
  28. #undef  OSGBPB_WriteAt
  29. #define OSGBPB_WriteAt                          0x1
  30. #undef  OSGBPB_Write
  31. #define OSGBPB_Write                            0x2
  32. #undef  OSGBPB_ReadAt
  33. #define OSGBPB_ReadAt                           0x3
  34. #undef  OSGBPB_Read
  35. #define OSGBPB_Read                             0x4
  36. #undef  OSGBPB_ReadDiscName
  37. #define OSGBPB_ReadDiscName                     0x5
  38. #undef  OSGBPB_ReadCSDName
  39. #define OSGBPB_ReadCSDName                      0x6
  40. #undef  OSGBPB_ReadLibName
  41. #define OSGBPB_ReadLibName                      0x7
  42. #undef  OSGBPB_CSDEntries
  43. #define OSGBPB_CSDEntries                       0x8
  44. #undef  OSGBPB_DirEntries
  45. #define OSGBPB_DirEntries                       0x9
  46. #undef  OSGBPB_DirEntriesInfo
  47. #define OSGBPB_DirEntriesInfo                   0xA
  48. #undef  OSGBPB_DirEntriesSystemInfo
  49. #define OSGBPB_DirEntriesSystemInfo             0xB
  50. #undef  OSGBPB_DirEntriesInfoStamped
  51. #define OSGBPB_DirEntriesInfoStamped            0xC
  52. #undef  GBPBV
  53. #define GBPBV                                   0xC
  54.  
  55. /************************************
  56.  * Structure and union declarations *
  57.  ************************************/
  58. typedef struct osgbpb_name                      osgbpb_name;
  59. typedef struct osgbpb_disc_name                 osgbpb_disc_name;
  60. typedef struct osgbpb_dir_name                  osgbpb_dir_name;
  61. typedef struct osgbpb_name_list                 osgbpb_name_list;
  62. typedef struct osgbpb_info                      osgbpb_info;
  63. typedef struct osgbpb_system_info               osgbpb_system_info;
  64. typedef struct osgbpb_info_stamped              osgbpb_info_stamped;
  65. typedef struct osgbpb_string_list               osgbpb_string_list;
  66. typedef struct osgbpb_info_list                 osgbpb_info_list;
  67. typedef struct osgbpb_system_info_list          osgbpb_system_info_list;
  68. typedef struct osgbpb_info_stamped_list         osgbpb_info_stamped_list;
  69.  
  70. /********************
  71.  * Type definitions *
  72.  ********************/
  73. struct osgbpb_name
  74.    {  byte count;
  75.       char c [UNKNOWN];
  76.    };
  77.  
  78. #define osgbpb_NAME(N) \
  79.    struct \
  80.       {  byte count; \
  81.          char c [N]; \
  82.       }
  83.  
  84. #define osgbpb_SIZEOF_NAME(N) \
  85.    (offsetof (osgbpb_name, c) + \
  86.          (N)*sizeof ((osgbpb_name *) NULL)->c)
  87.  
  88. struct osgbpb_disc_name
  89.    {  osgbpb_name name;
  90.    };
  91.  
  92. struct osgbpb_dir_name
  93.    {  byte reserved;
  94.       osgbpb_name name;
  95.    };
  96.  
  97. struct osgbpb_name_list
  98.    {  osgbpb_name names [UNKNOWN];
  99.    };
  100.  
  101. struct osgbpb_info
  102.    {  bits load_addr;
  103.       bits exec_addr;
  104.       int size;
  105.       fileswitch_attr attr;
  106.       fileswitch_object_type obj_type;
  107.       char name [UNKNOWN];
  108.    };
  109.  
  110. #define osgbpb_INFO(N) \
  111.    struct \
  112.       {  bits load_addr; \
  113.          bits exec_addr; \
  114.          int size; \
  115.          fileswitch_attr attr; \
  116.          fileswitch_object_type obj_type; \
  117.          char name [N]; \
  118.       }
  119.  
  120. #define osgbpb_SIZEOF_INFO(N) \
  121.    (offsetof (osgbpb_info, name) + \
  122.          (N)*sizeof ((osgbpb_info *) NULL)->name)
  123.  
  124. struct osgbpb_system_info
  125.    {  bits load_addr;
  126.       bits exec_addr;
  127.       int size;
  128.       fileswitch_attr attr;
  129.       fileswitch_object_type obj_type;
  130.       int sin;
  131.       os_date_and_time stamp;
  132.       char name [UNKNOWN];
  133.    };
  134.  
  135. #define osgbpb_SYSTEM_INFO(N) \
  136.    struct \
  137.       {  bits load_addr; \
  138.          bits exec_addr; \
  139.          int size; \
  140.          fileswitch_attr attr; \
  141.          fileswitch_object_type obj_type; \
  142.          int sin; \
  143.          os_date_and_time stamp; \
  144.          char name [N]; \
  145.       }
  146.  
  147. #define osgbpb_SIZEOF_SYSTEM_INFO(N) \
  148.    (offsetof (osgbpb_system_info, name) + \
  149.          (N)*sizeof ((osgbpb_system_info *) NULL)->name)
  150.  
  151. struct osgbpb_info_stamped
  152.    {  bits load_addr;
  153.       bits exec_addr;
  154.       int size;
  155.       fileswitch_attr attr;
  156.       fileswitch_object_type obj_type;
  157.       bits file_type;
  158.       char name [UNKNOWN];
  159.    };
  160.  
  161. #define osgbpb_INFO_STAMPED(N) \
  162.    struct \
  163.       {  bits load_addr; \
  164.          bits exec_addr; \
  165.          int size; \
  166.          fileswitch_attr attr; \
  167.          fileswitch_object_type obj_type; \
  168.          bits file_type; \
  169.          char name [N]; \
  170.       }
  171.  
  172. #define osgbpb_SIZEOF_INFO_STAMPED(N) \
  173.    (offsetof (osgbpb_info_stamped, name) + \
  174.          (N)*sizeof ((osgbpb_info_stamped *) NULL)->name)
  175.  
  176. struct osgbpb_string_list
  177.    {  char names [UNKNOWN];
  178.    };
  179.  
  180. struct osgbpb_info_list
  181.    {  osgbpb_info info [UNKNOWN];
  182.    };
  183.  
  184. struct osgbpb_system_info_list
  185.    {  osgbpb_system_info info [UNKNOWN];
  186.    };
  187.  
  188. struct osgbpb_info_stamped_list
  189.    {  osgbpb_info_stamped info [UNKNOWN];
  190.    };
  191.  
  192. typedef byte osgbpb_privilege;
  193.  
  194. /************************
  195.  * Constant definitions *
  196.  ************************/
  197. #define osgbpb_PRIVILEGE_OWNER                  ((osgbpb_privilege) 0x0u)
  198. #define osgbpb_PRIVILEGE_PUBLIC                 ((osgbpb_privilege) 0xFFu)
  199. #define osgbpb_NO_MORE                          (-1)
  200.  
  201. /*************************
  202.  * Function declarations *
  203.  *************************/
  204.  
  205. #ifdef __cplusplus
  206.    extern "C" {
  207. #endif
  208.  
  209. /* ------------------------------------------------------------------------
  210.  * Function:      osgbpb_write_at()
  211.  *
  212.  * Description:   Writes bytes to an open file at the specified file
  213.  *                pointer
  214.  *
  215.  * Input:         file - value of R1 on entry
  216.  *                data - value of R2 on entry
  217.  *                size - value of R3 on entry
  218.  *                ptr - value of R4 on entry
  219.  *
  220.  * Output:        unwritten - value of R3 on exit (X version only)
  221.  *
  222.  * Returns:       R3 (non-X version only)
  223.  *
  224.  * Other notes:   Calls SWI 0xC with R0 = 0x1.
  225.  */
  226.  
  227. extern os_error *xosgbpb_write_at (os_f file,
  228.       byte const *data,
  229.       int size,
  230.       int ptr,
  231.       int *unwritten);
  232. extern int osgbpb_write_at (os_f file,
  233.       byte const *data,
  234.       int size,
  235.       int ptr);
  236.  
  237. /* ------------------------------------------------------------------------
  238.  * Function:      osgbpb_write()
  239.  *
  240.  * Description:   Writes bytes to an open file
  241.  *
  242.  * Input:         file - value of R1 on entry
  243.  *                data - value of R2 on entry
  244.  *                size - value of R3 on entry
  245.  *
  246.  * Output:        unwritten - value of R3 on exit (X version only)
  247.  *
  248.  * Returns:       R3 (non-X version only)
  249.  *
  250.  * Other notes:   Calls SWI 0xC with R0 = 0x2.
  251.  */
  252.  
  253. extern os_error *xosgbpb_write (os_f file,
  254.       byte const *data,
  255.       int size,
  256.       int *unwritten);
  257. extern int osgbpb_write (os_f file,
  258.       byte const *data,
  259.       int size);
  260.  
  261. /* ------------------------------------------------------------------------
  262.  * Function:      osgbpb_read_at()
  263.  *
  264.  * Description:   Reads bytes from an open file at the specified file
  265.  *                pointer
  266.  *
  267.  * Input:         file - value of R1 on entry
  268.  *                buffer - value of R2 on entry
  269.  *                size - value of R3 on entry
  270.  *                ptr - value of R4 on entry
  271.  *
  272.  * Output:        unread - value of R3 on exit (X version only)
  273.  *
  274.  * Returns:       R3 (non-X version only)
  275.  *
  276.  * Other notes:   Calls SWI 0xC with R0 = 0x3.
  277.  */
  278.  
  279. extern os_error *xosgbpb_read_at (os_f file,
  280.       byte *buffer,
  281.       int size,
  282.       int ptr,
  283.       int *unread);
  284. extern int osgbpb_read_at (os_f file,
  285.       byte *buffer,
  286.       int size,
  287.       int ptr);
  288.  
  289. /* ------------------------------------------------------------------------
  290.  * Function:      osgbpb_read()
  291.  *
  292.  * Description:   Reads bytes from an open file
  293.  *
  294.  * Input:         file - value of R1 on entry
  295.  *                buffer - value of R2 on entry
  296.  *                size - value of R3 on entry
  297.  *
  298.  * Output:        unread - value of R3 on exit (X version only)
  299.  *
  300.  * Returns:       R3 (non-X version only)
  301.  *
  302.  * Other notes:   Calls SWI 0xC with R0 = 0x4.
  303.  */
  304.  
  305. extern os_error *xosgbpb_read (os_f file,
  306.       byte *buffer,
  307.       int size,
  308.       int *unread);
  309. extern int osgbpb_read (os_f file,
  310.       byte *buffer,
  311.       int size);
  312.  
  313. /* ------------------------------------------------------------------------
  314.  * Function:      osgbpb_read_disc_name()
  315.  *
  316.  * Description:   Reads the name and boot option of the disc which contains
  317.  *                the CSD - prefer OSFSControl_CanonicalisePath and/or
  318.  *                OSFSControl_ReadBootOption
  319.  *
  320.  * Input:         disc_name - value of R2 on entry
  321.  *
  322.  * Other notes:   Calls SWI 0xC with R0 = 0x5.
  323.  */
  324.  
  325. extern os_error *xosgbpb_read_disc_name (osgbpb_disc_name *disc_name);
  326. extern void osgbpb_read_disc_name (osgbpb_disc_name *disc_name);
  327.  
  328. /* ------------------------------------------------------------------------
  329.  * Function:      osgbpb_read_csd_name()
  330.  *
  331.  * Description:   Reads the name and privilege status of the C S D - prefer
  332.  *                OSFSControl_CanonicalisePath
  333.  *
  334.  * Input:         csd_name - value of R2 on entry
  335.  *
  336.  * Other notes:   Calls SWI 0xC with R0 = 0x6.
  337.  */
  338.  
  339. extern os_error *xosgbpb_read_csd_name (osgbpb_dir_name *csd_name);
  340. extern void osgbpb_read_csd_name (osgbpb_dir_name *csd_name);
  341.  
  342. /* ------------------------------------------------------------------------
  343.  * Function:      osgbpb_read_lib_name()
  344.  *
  345.  * Description:   Reads the name and privilege status of the library -
  346.  *                prefer OSFSControl_CanonicalisePath
  347.  *
  348.  * Input:         lib_name - value of R2 on entry
  349.  *
  350.  * Other notes:   Calls SWI 0xC with R0 = 0x7.
  351.  */
  352.  
  353. extern os_error *xosgbpb_read_lib_name (osgbpb_dir_name *lib_name);
  354. extern void osgbpb_read_lib_name (osgbpb_dir_name *lib_name);
  355.  
  356. /* ------------------------------------------------------------------------
  357.  * Function:      osgbpb_csd_entries()
  358.  *
  359.  * Description:   Reads entries from the C S D - prefer OSGBPB_DirEntries
  360.  *
  361.  * Input:         name_list - value of R2 on entry
  362.  *                count - value of R3 on entry
  363.  *                context - value of R4 on entry
  364.  *
  365.  * Output:        unread - value of R3 on exit
  366.  *                context_out - value of R4 on exit (X version only)
  367.  *
  368.  * Returns:       R4 (non-X version only)
  369.  *
  370.  * Other notes:   Calls SWI 0xC with R0 = 0x8.
  371.  */
  372.  
  373. extern os_error *xosgbpb_csd_entries (osgbpb_name_list *name_list,
  374.       int count,
  375.       int context,
  376.       int *unread,
  377.       int *context_out);
  378. extern int osgbpb_csd_entries (osgbpb_name_list *name_list,
  379.       int count,
  380.       int context,
  381.       int *unread);
  382.  
  383. /* ------------------------------------------------------------------------
  384.  * Function:      osgbpb_dir_entries()
  385.  *
  386.  * Description:   Reads entries from a specified directory
  387.  *
  388.  * Input:         dir_name - value of R1 on entry
  389.  *                name_list - value of R2 on entry
  390.  *                count - value of R3 on entry
  391.  *                context - value of R4 on entry
  392.  *                size - value of R5 on entry
  393.  *                entries - value of R6 on entry
  394.  *
  395.  * Output:        read_count - value of R3 on exit
  396.  *                context_out - value of R4 on exit (X version only)
  397.  *
  398.  * Returns:       R4 (non-X version only)
  399.  *
  400.  * Other notes:   Calls SWI 0xC with R0 = 0x9.
  401.  */
  402.  
  403. extern os_error *xosgbpb_dir_entries (char const *dir_name,
  404.       osgbpb_string_list *name_list,
  405.       int count,
  406.       int context,
  407.       int size,
  408.       char const *entries,
  409.       int *read_count,
  410.       int *context_out);
  411. extern int osgbpb_dir_entries (char const *dir_name,
  412.       osgbpb_string_list *name_list,
  413.       int count,
  414.       int context,
  415.       int size,
  416.       char const *entries,
  417.       int *read_count);
  418.  
  419. /* ------------------------------------------------------------------------
  420.  * Function:      osgbpb_dir_entries_info()
  421.  *
  422.  * Description:   Reads entries and file information from a specified
  423.  *                directory
  424.  *
  425.  * Input:         dir_name - value of R1 on entry
  426.  *                info_list - value of R2 on entry
  427.  *                count - value of R3 on entry
  428.  *                context - value of R4 on entry
  429.  *                size - value of R5 on entry
  430.  *                entries - value of R6 on entry
  431.  *
  432.  * Output:        read_count - value of R3 on exit
  433.  *                context_out - value of R4 on exit (X version only)
  434.  *
  435.  * Returns:       R4 (non-X version only)
  436.  *
  437.  * Other notes:   Calls SWI 0xC with R0 = 0xA.
  438.  */
  439.  
  440. extern os_error *xosgbpb_dir_entries_info (char const *dir_name,
  441.       osgbpb_info_list *info_list,
  442.       int count,
  443.       int context,
  444.       int size,
  445.       char const *entries,
  446.       int *read_count,
  447.       int *context_out);
  448. extern int osgbpb_dir_entries_info (char const *dir_name,
  449.       osgbpb_info_list *info_list,
  450.       int count,
  451.       int context,
  452.       int size,
  453.       char const *entries,
  454.       int *read_count);
  455.  
  456. /* ------------------------------------------------------------------------
  457.  * Function:      osgbpb_dir_entries_system_info()
  458.  *
  459.  * Description:   Reads entries and file information (including SIN) from a
  460.  *                specified directory
  461.  *
  462.  * Input:         dir_name - value of R1 on entry
  463.  *                info_list - value of R2 on entry
  464.  *                count - value of R3 on entry
  465.  *                context - value of R4 on entry
  466.  *                size - value of R5 on entry
  467.  *                entries - value of R6 on entry
  468.  *
  469.  * Output:        read_count - value of R3 on exit
  470.  *                context_out - value of R4 on exit (X version only)
  471.  *
  472.  * Returns:       R4 (non-X version only)
  473.  *
  474.  * Other notes:   Calls SWI 0xC with R0 = 0xB.
  475.  */
  476.  
  477. extern os_error *xosgbpb_dir_entries_system_info (char const *dir_name,
  478.       osgbpb_system_info_list *info_list,
  479.       int count,
  480.       int context,
  481.       int size,
  482.       char const *entries,
  483.       int *read_count,
  484.       int *context_out);
  485. extern int osgbpb_dir_entries_system_info (char const *dir_name,
  486.       osgbpb_system_info_list *info_list,
  487.       int count,
  488.       int context,
  489.       int size,
  490.       char const *entries,
  491.       int *read_count);
  492.  
  493. /* ------------------------------------------------------------------------
  494.  * Function:      osgbpb_dir_entries_info_stamped()
  495.  *
  496.  * Description:   Reads entries and file information (including file type)
  497.  *                from a specified directory
  498.  *
  499.  * Input:         dir_name - value of R1 on entry
  500.  *                info_list - value of R2 on entry
  501.  *                count - value of R3 on entry
  502.  *                context - value of R4 on entry
  503.  *                size - value of R5 on entry
  504.  *                entries - value of R6 on entry
  505.  *
  506.  * Output:        read_count - value of R3 on exit
  507.  *                context_out - value of R4 on exit (X version only)
  508.  *
  509.  * Returns:       R4 (non-X version only)
  510.  *
  511.  * Other notes:   Calls SWI 0xC with R0 = 0xC.
  512.  */
  513.  
  514. extern os_error *xosgbpb_dir_entries_info_stamped (char const *dir_name,
  515.       osgbpb_info_stamped_list *info_list,
  516.       int count,
  517.       int context,
  518.       int size,
  519.       char const *entries,
  520.       int *read_count,
  521.       int *context_out);
  522. extern int osgbpb_dir_entries_info_stamped (char const *dir_name,
  523.       osgbpb_info_stamped_list *info_list,
  524.       int count,
  525.       int context,
  526.       int size,
  527.       char const *entries,
  528.       int *read_count);
  529.  
  530. #ifdef __cplusplus
  531.    }
  532. #endif
  533.  
  534. #endif
  535.