home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / oslib / h / osfile < prev    next >
Encoding:
Text File  |  1994-09-16  |  36.8 KB  |  1,192 lines

  1. #ifndef osfile_H
  2. #define osfile_H
  3.  
  4. /* C header file for OSFile
  5.  * written by DefMod (Sep  7 1994) on Fri Sep 16 13:26:28 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_File
  27. #define OS_File                                 0x8
  28. #undef  XOS_File
  29. #define XOS_File                                0x20008
  30. #undef  OSFile_SaveStamped
  31. #define OSFile_SaveStamped                      0xA
  32. #undef  OSFile_Write
  33. #define OSFile_Write                            0x1
  34. #undef  OSFile_WriteLoad
  35. #define OSFile_WriteLoad                        0x2
  36. #undef  OSFile_WriteExec
  37. #define OSFile_WriteExec                        0x3
  38. #undef  OSFile_WriteAttr
  39. #define OSFile_WriteAttr                        0x4
  40. #undef  OSFile_Stamp
  41. #define OSFile_Stamp                            0x9
  42. #undef  OSFile_SetType
  43. #define OSFile_SetType                          0x12
  44. #undef  OSFile_Delete
  45. #define OSFile_Delete                           0x6
  46. #undef  OSFile_CreateStamped
  47. #define OSFile_CreateStamped                    0xB
  48. #undef  OSFile_CreateDir
  49. #define OSFile_CreateDir                        0x8
  50. #undef  OSFile_LoadStamped
  51. #define OSFile_LoadStamped                      0xFF
  52. #undef  OSFile_LoadStampedPath
  53. #define OSFile_LoadStampedPath                  0xC
  54. #undef  OSFile_LoadStampedPathVar
  55. #define OSFile_LoadStampedPathVar               0xE
  56. #undef  OSFile_LoadStampedNoPath
  57. #define OSFile_LoadStampedNoPath                0x10
  58. #undef  OSFile_MakeError
  59. #define OSFile_MakeError                        0x13
  60. #undef  OSFile_ReadStamped
  61. #define OSFile_ReadStamped                      0x14
  62. #undef  OSFile_ReadStampedPath
  63. #define OSFile_ReadStampedPath                  0x15
  64. #undef  OSFile_ReadStampedPathVar
  65. #define OSFile_ReadStampedPathVar               0x16
  66. #undef  OSFile_ReadStampedNoPath
  67. #define OSFile_ReadStampedNoPath                0x17
  68. #undef  OSFile_ReadBlockSize
  69. #define OSFile_ReadBlockSize                    0x18
  70. #undef  OSFile_Save
  71. #define OSFile_Save                             0x0
  72. #undef  OSFile_Read
  73. #define OSFile_Read                             0x5
  74. #undef  OSFile_ReadPath
  75. #define OSFile_ReadPath                         0xD
  76. #undef  OSFile_ReadPathVar
  77. #define OSFile_ReadPathVar                      0xF
  78. #undef  OSFile_ReadNoPath
  79. #define OSFile_ReadNoPath                       0x11
  80. #undef  OSFile_Create
  81. #define OSFile_Create                           0x7
  82. #undef  OSFile_Load
  83. #define OSFile_Load                             0xFF
  84. #undef  OSFile_LoadPath
  85. #define OSFile_LoadPath                         0xC
  86. #undef  OSFile_LoadPathVar
  87. #define OSFile_LoadPathVar                      0xE
  88. #undef  OSFile_LoadNoPath
  89. #define OSFile_LoadNoPath                       0x10
  90. #undef  FileV
  91. #define FileV                                   0x8
  92. #undef  UpCallFile_Save
  93. #define UpCallFile_Save                         0x0
  94. #undef  UpCallFile_SetArgs
  95. #define UpCallFile_SetArgs                      0x1
  96. #undef  UpCallFile_SetLoadAddr
  97. #define UpCallFile_SetLoadAddr                  0x2
  98. #undef  UpCallFile_SetExecAddr
  99. #define UpCallFile_SetExecAddr                  0x3
  100. #undef  UpCallFile_SetAttr
  101. #define UpCallFile_SetAttr                      0x4
  102. #undef  UpCallFile_Delete
  103. #define UpCallFile_Delete                       0x6
  104. #undef  UpCallFile_Create
  105. #define UpCallFile_Create                       0x7
  106. #undef  UpCallFile_CreateDir
  107. #define UpCallFile_CreateDir                    0x8
  108.  
  109. /************************
  110.  * Constant definitions *
  111.  ************************/
  112. #define osfile_NOT_FOUND                        0
  113. #define osfile_IS_FILE                          1
  114. #define osfile_IS_DIR                           2
  115. #define osfile_IS_IMAGE                         3
  116. #define osfile_FILE_TYPE                        0xFFF00u
  117. #define osfile_FILE_TYPE_SHIFT                  8
  118. #define osfile_TYPE_DRAW                        0xAFFu
  119. #define osfile_TYPE_BBCROM                      0xBBCu
  120. #define osfile_TYPE_DOS_DISC                    0xFC8u
  121. #define osfile_TYPE_DEVICE                      0xFCCu
  122. #define osfile_TYPE_CACHE                       0xFCFu
  123. #define osfile_TYPE_TASK_EXEC                   0xFD6u
  124. #define osfile_TYPE_TASK_OBEY                   0xFD7u
  125. #define osfile_TYPE_DOS                         0xFE4u
  126. #define osfile_TYPE_DESKTOP                     0xFEAu
  127. #define osfile_TYPE_OBEY                        0xFEBu
  128. #define osfile_TYPE_TEMPLATE                    0xFECu
  129. #define osfile_TYPE_PALETTE                     0xFEDu
  130. #define osfile_TYPE_CONFIG                      0xFF2u
  131. #define osfile_TYPE_PRINTOUT                    0xFF4u
  132. #define osfile_TYPE_POSTSCRIPT                  0xFF5u
  133. #define osfile_TYPE_FONT                        0xFF6u
  134. #define osfile_TYPE_BBC_FONT                    0xFF7u
  135. #define osfile_TYPE_ABSOLUTE                    0xFF8u
  136. #define osfile_TYPE_SPRITE                      0xFF9u
  137. #define osfile_TYPE_MODULE                      0xFFAu
  138. #define osfile_TYPE_BASIC                       0xFFBu
  139. #define osfile_TYPE_UTILITY                     0xFFCu
  140. #define osfile_TYPE_DATA                        0xFFDu
  141. #define osfile_TYPE_COMMAND                     0xFFEu
  142. #define osfile_TYPE_TEXT                        0xFFFu
  143. #define osfile_TYPE_DIR                         0x1000u
  144. #define osfile_TYPE_APPLICATION                 0x2000u
  145. #define osfile_TYPE_UNTYPED                     0xFFFFFFFFu
  146. #define osfile_ATTR_OWNER_READ                  0x1u
  147. #define osfile_ATTR_OWNER_WRITE                 0x2u
  148. #define osfile_ATTR_OWNER_SPECIAL               0x4u
  149. #define osfile_ATTR_OWNER_LOCKED                0x8u
  150. #define osfile_ATTR_WORLD_READ                  0x10u
  151. #define osfile_ATTR_WORLD_WRITE                 0x20u
  152. #define osfile_ATTR_WORLD_SPECIAL               0x40u
  153. #define osfile_ATTR_WORLD_LOCKED                0x80u
  154.  
  155. /*************************
  156.  * Function declarations *
  157.  *************************/
  158.  
  159. #ifdef __cplusplus
  160.    extern "C" {
  161. #endif
  162.  
  163. /*************************************************************
  164.  * NOTE: The following functions provide direct access to    *
  165.  *       the SWI's noted in the function description.        *
  166.  *       Please read the relevant PRM section for more       *
  167.  *       information on their input/output parameters.       *
  168.  *************************************************************/
  169.  
  170. /* ------------------------------------------------------------------------
  171.  * Function:      osfile_save_stamped()
  172.  *
  173.  * Description:   Saves a block of memory as a file
  174.  *
  175.  * Input:         file_name - value of R1 on entry
  176.  *                file_type - value of R2 on entry
  177.  *                data - value of R4 on entry
  178.  *                end - value of R5 on entry
  179.  *
  180.  * Other notes:   Calls SWI 0x8 with R0 = 0xA.
  181.  */
  182.  
  183. extern os_error *xosfile_save_stamped (char *file_name,
  184.       bits file_type,
  185.       byte *data,
  186.       byte *end);
  187. extern void osfile_save_stamped (char *file_name,
  188.       bits file_type,
  189.       byte *data,
  190.       byte *end);
  191.  
  192. /* ------------------------------------------------------------------------
  193.  * Function:      osfile_write()
  194.  *
  195.  * Description:   Writes the load and execution addresses and attributes
  196.  *                for an object
  197.  *
  198.  * Input:         file_name - value of R1 on entry
  199.  *                load_addr - value of R2 on entry
  200.  *                exec_addr - value of R3 on entry
  201.  *                attr - value of R5 on entry
  202.  *
  203.  * Other notes:   Calls SWI 0x8 with R0 = 0x1.
  204.  */
  205.  
  206. extern os_error *xosfile_write (char *file_name,
  207.       bits load_addr,
  208.       bits exec_addr,
  209.       bits attr);
  210. extern void osfile_write (char *file_name,
  211.       bits load_addr,
  212.       bits exec_addr,
  213.       bits attr);
  214.  
  215. /* ------------------------------------------------------------------------
  216.  * Function:      osfile_write_load()
  217.  *
  218.  * Description:   Writes the load address for an object
  219.  *
  220.  * Input:         file_name - value of R1 on entry
  221.  *                load_addr - value of R2 on entry
  222.  *
  223.  * Other notes:   Calls SWI 0x8 with R0 = 0x2.
  224.  */
  225.  
  226. extern os_error *xosfile_write_load (char *file_name,
  227.       bits load_addr);
  228. extern void osfile_write_load (char *file_name,
  229.       bits load_addr);
  230.  
  231. /* ------------------------------------------------------------------------
  232.  * Function:      osfile_write_exec()
  233.  *
  234.  * Description:   Writes the execution address for an object
  235.  *
  236.  * Input:         file_name - value of R1 on entry
  237.  *                exec_addr - value of R3 on entry
  238.  *
  239.  * Other notes:   Calls SWI 0x8 with R0 = 0x3.
  240.  */
  241.  
  242. extern os_error *xosfile_write_exec (char *file_name,
  243.       bits exec_addr);
  244. extern void osfile_write_exec (char *file_name,
  245.       bits exec_addr);
  246.  
  247. /* ------------------------------------------------------------------------
  248.  * Function:      osfile_write_attr()
  249.  *
  250.  * Description:   Writes the attributes for an object
  251.  *
  252.  * Input:         file_name - value of R1 on entry
  253.  *                attr - value of R5 on entry
  254.  *
  255.  * Other notes:   Calls SWI 0x8 with R0 = 0x4.
  256.  */
  257.  
  258. extern os_error *xosfile_write_attr (char *file_name,
  259.       bits attr);
  260. extern void osfile_write_attr (char *file_name,
  261.       bits attr);
  262.  
  263. /* ------------------------------------------------------------------------
  264.  * Function:      osfile_stamp()
  265.  *
  266.  * Description:   Writes the date stamp for an object
  267.  *
  268.  * Input:         file_name - value of R1 on entry
  269.  *
  270.  * Other notes:   Calls SWI 0x8 with R0 = 0x9.
  271.  */
  272.  
  273. extern os_error *xosfile_stamp (char *file_name);
  274. extern void osfile_stamp (char *file_name);
  275.  
  276. /* ------------------------------------------------------------------------
  277.  * Function:      osfile_set_type()
  278.  *
  279.  * Description:   Writes the file type for an object
  280.  *
  281.  * Input:         file_name - value of R1 on entry
  282.  *                file_type - value of R2 on entry
  283.  *
  284.  * Other notes:   Calls SWI 0x8 with R0 = 0x12.
  285.  */
  286.  
  287. extern os_error *xosfile_set_type (char *file_name,
  288.       bits file_type);
  289. extern void osfile_set_type (char *file_name,
  290.       bits file_type);
  291.  
  292. /* ------------------------------------------------------------------------
  293.  * Function:      osfile_delete()
  294.  *
  295.  * Description:   Deletes an object
  296.  *
  297.  * Input:         file_name - value of R1 on entry
  298.  *
  299.  * Output:        obj_type - value of R0 on exit (X version only)
  300.  *                load_addr - value of R2 on exit
  301.  *                exec_addr - value of R3 on exit
  302.  *                size - value of R4 on exit
  303.  *                attr - value of R5 on exit
  304.  *
  305.  * Returns:       R0 (non-X version only)
  306.  *
  307.  * Other notes:   Calls SWI 0x8 with R0 = 0x6.
  308.  */
  309.  
  310. extern os_error *xosfile_delete (char *file_name,
  311.       int *obj_type,
  312.       bits *load_addr,
  313.       bits *exec_addr,
  314.       int *size,
  315.       bits *attr);
  316. extern int osfile_delete (char *file_name,
  317.       bits *load_addr,
  318.       bits *exec_addr,
  319.       int *size,
  320.       bits *attr);
  321.  
  322. /* ------------------------------------------------------------------------
  323.  * Function:      osfile_create_stamped()
  324.  *
  325.  * Description:   Creates an empty file
  326.  *
  327.  * Input:         file_name - value of R1 on entry
  328.  *                file_type - value of R2 on entry
  329.  *                size - value of R5 on entry
  330.  *
  331.  * Other notes:   Calls SWI 0x8 with R0 = 0xB, R4 = 0x0.
  332.  */
  333.  
  334. extern os_error *xosfile_create_stamped (char *file_name,
  335.       bits file_type,
  336.       int size);
  337. extern void osfile_create_stamped (char *file_name,
  338.       bits file_type,
  339.       int size);
  340.  
  341. /* ------------------------------------------------------------------------
  342.  * Function:      osfile_create_dir()
  343.  *
  344.  * Description:   Creates a directory
  345.  *
  346.  * Input:         dir_name - value of R1 on entry
  347.  *                entry_count - value of R4 on entry
  348.  *
  349.  * Other notes:   Calls SWI 0x8 with R0 = 0x8.
  350.  */
  351.  
  352. extern os_error *xosfile_create_dir (char *dir_name,
  353.       int entry_count);
  354. extern void osfile_create_dir (char *dir_name,
  355.       int entry_count);
  356.  
  357. /* ------------------------------------------------------------------------
  358.  * Function:      osfile_load_stamped()
  359.  *
  360.  * Description:   Loads a file using the directory list in File$Path
  361.  *
  362.  * Input:         file_name - value of R1 on entry
  363.  *                addr - value of R2 on entry
  364.  *
  365.  * Output:        obj_type - value of R0 on exit (X version only)
  366.  *                load_addr - value of R2 on exit
  367.  *                exec_addr - value of R3 on exit
  368.  *                size - value of R4 on exit
  369.  *                attr - value of R5 on exit
  370.  *
  371.  * Returns:       R0 (non-X version only)
  372.  *
  373.  * Other notes:   Calls SWI 0x8 with R0 = 0xFF, R3 = 0x0.
  374.  */
  375.  
  376. extern os_error *xosfile_load_stamped (char *file_name,
  377.       byte *addr,
  378.       int *obj_type,
  379.       bits *load_addr,
  380.       bits *exec_addr,
  381.       int *size,
  382.       bits *attr);
  383. extern int osfile_load_stamped (char *file_name,
  384.       byte *addr,
  385.       bits *load_addr,
  386.       bits *exec_addr,
  387.       int *size,
  388.       bits *attr);
  389.  
  390. /* ------------------------------------------------------------------------
  391.  * Function:      osfile_load_stamped_path()
  392.  *
  393.  * Description:   Loads a file using a specified directory list
  394.  *
  395.  * Input:         file_name - value of R1 on entry
  396.  *                addr - value of R2 on entry
  397.  *                path - value of R4 on entry
  398.  *
  399.  * Output:        obj_type - value of R0 on exit (X version only)
  400.  *                load_addr - value of R2 on exit
  401.  *                exec_addr - value of R3 on exit
  402.  *                size - value of R4 on exit
  403.  *                attr - value of R5 on exit
  404.  *
  405.  * Returns:       R0 (non-X version only)
  406.  *
  407.  * Other notes:   Calls SWI 0x8 with R0 = 0xC, R3 = 0x0.
  408.  */
  409.  
  410. extern os_error *xosfile_load_stamped_path (char *file_name,
  411.       byte *addr,
  412.       char *path,
  413.       int *obj_type,
  414.       bits *load_addr,
  415.       bits *exec_addr,
  416.       int *size,
  417.       bits *attr);
  418. extern int osfile_load_stamped_path (char *file_name,
  419.       byte *addr,
  420.       char *path,
  421.       bits *load_addr,
  422.       bits *exec_addr,
  423.       int *size,
  424.       bits *attr);
  425.  
  426. /* ------------------------------------------------------------------------
  427.  * Function:      osfile_load_stamped_path_var()
  428.  *
  429.  * Description:   Loads a file using the directory list in a specified
  430.  *                variable
  431.  *
  432.  * Input:         file_name - value of R1 on entry
  433.  *                addr - value of R2 on entry
  434.  *                var - value of R4 on entry
  435.  *
  436.  * Output:        obj_type - value of R0 on exit (X version only)
  437.  *                load_addr - value of R2 on exit
  438.  *                exec_addr - value of R3 on exit
  439.  *                size - value of R4 on exit
  440.  *                attr - value of R5 on exit
  441.  *
  442.  * Returns:       R0 (non-X version only)
  443.  *
  444.  * Other notes:   Calls SWI 0x8 with R0 = 0xE, R3 = 0x0.
  445.  */
  446.  
  447. extern os_error *xosfile_load_stamped_path_var (char *file_name,
  448.       byte *addr,
  449.       char *var,
  450.       int *obj_type,
  451.       bits *load_addr,
  452.       bits *exec_addr,
  453.       int *size,
  454.       bits *attr);
  455. extern int osfile_load_stamped_path_var (char *file_name,
  456.       byte *addr,
  457.       char *var,
  458.       bits *load_addr,
  459.       bits *exec_addr,
  460.       int *size,
  461.       bits *attr);
  462.  
  463. /* ------------------------------------------------------------------------
  464.  * Function:      osfile_load_stamped_no_path()
  465.  *
  466.  * Description:   Loads a file
  467.  *
  468.  * Input:         file_name - value of R1 on entry
  469.  *                addr - value of R2 on entry
  470.  *
  471.  * Output:        obj_type - value of R0 on exit (X version only)
  472.  *                load_addr - value of R2 on exit
  473.  *                exec_addr - value of R3 on exit
  474.  *                size - value of R4 on exit
  475.  *                attr - value of R5 on exit
  476.  *
  477.  * Returns:       R0 (non-X version only)
  478.  *
  479.  * Other notes:   Calls SWI 0x8 with R0 = 0x10, R3 = 0x0.
  480.  */
  481.  
  482. extern os_error *xosfile_load_stamped_no_path (char *file_name,
  483.       byte *addr,
  484.       int *obj_type,
  485.       bits *load_addr,
  486.       bits *exec_addr,
  487.       int *size,
  488.       bits *attr);
  489. extern int osfile_load_stamped_no_path (char *file_name,
  490.       byte *addr,
  491.       bits *load_addr,
  492.       bits *exec_addr,
  493.       int *size,
  494.       bits *attr);
  495.  
  496. /* ------------------------------------------------------------------------
  497.  * Function:      osfile_make_error()
  498.  *
  499.  * Description:   Generates an error message
  500.  *
  501.  * Input:         file_name - value of R1 on entry
  502.  *                obj_type - value of R2 on entry
  503.  *
  504.  * Other notes:   Calls SWI 0x8 with R0 = 0x13.
  505.  */
  506.  
  507. extern os_error *xosfile_make_error (char *file_name,
  508.       int obj_type);
  509. extern void osfile_make_error (char *file_name,
  510.       int obj_type);
  511.  
  512. /* ------------------------------------------------------------------------
  513.  * Function:      osfile_read_stamped()
  514.  *
  515.  * Description:   Reads catalogue information and file type for an object
  516.  *                using the directory list in File$Path
  517.  *
  518.  * Input:         file_name - value of R1 on entry
  519.  *
  520.  * Output:        obj_type - value of R0 on exit (X version only)
  521.  *                load_addr - value of R2 on exit
  522.  *                exec_addr - value of R3 on exit
  523.  *                size - value of R4 on exit
  524.  *                attr - value of R5 on exit
  525.  *                file_type - value of R6 on exit
  526.  *
  527.  * Returns:       R0 (non-X version only)
  528.  *
  529.  * Other notes:   Calls SWI 0x8 with R0 = 0x14.
  530.  */
  531.  
  532. extern os_error *xosfile_read_stamped (char *file_name,
  533.       int *obj_type,
  534.       bits *load_addr,
  535.       bits *exec_addr,
  536.       int *size,
  537.       bits *attr,
  538.       bits *file_type);
  539. extern int osfile_read_stamped (char *file_name,
  540.       bits *load_addr,
  541.       bits *exec_addr,
  542.       int *size,
  543.       bits *attr,
  544.       bits *file_type);
  545.  
  546. /* ------------------------------------------------------------------------
  547.  * Function:      osfile_read_stamped_path()
  548.  *
  549.  * Description:   Reads catalogue information and file type for an object
  550.  *                using a specified directory list
  551.  *
  552.  * Input:         file_name - value of R1 on entry
  553.  *                path - value of R4 on entry
  554.  *
  555.  * Output:        obj_type - value of R0 on exit (X version only)
  556.  *                load_addr - value of R2 on exit
  557.  *                exec_addr - value of R3 on exit
  558.  *                size - value of R4 on exit
  559.  *                attr - value of R5 on exit
  560.  *                file_type - value of R6 on exit
  561.  *
  562.  * Returns:       R0 (non-X version only)
  563.  *
  564.  * Other notes:   Calls SWI 0x8 with R0 = 0x15.
  565.  */
  566.  
  567. extern os_error *xosfile_read_stamped_path (char *file_name,
  568.       char *path,
  569.       int *obj_type,
  570.       bits *load_addr,
  571.       bits *exec_addr,
  572.       int *size,
  573.       bits *attr,
  574.       bits *file_type);
  575. extern int osfile_read_stamped_path (char *file_name,
  576.       char *path,
  577.       bits *load_addr,
  578.       bits *exec_addr,
  579.       int *size,
  580.       bits *attr,
  581.       bits *file_type);
  582.  
  583. /* ------------------------------------------------------------------------
  584.  * Function:      osfile_read_stamped_path_var()
  585.  *
  586.  * Description:   Reads catalogue information and file type for an object
  587.  *                using the directory list in a specified variable
  588.  *
  589.  * Input:         file_name - value of R1 on entry
  590.  *                var - value of R4 on entry
  591.  *
  592.  * Output:        obj_type - value of R0 on exit (X version only)
  593.  *                load_addr - value of R2 on exit
  594.  *                exec_addr - value of R3 on exit
  595.  *                size - value of R4 on exit
  596.  *                attr - value of R5 on exit
  597.  *                file_type - value of R6 on exit
  598.  *
  599.  * Returns:       R0 (non-X version only)
  600.  *
  601.  * Other notes:   Calls SWI 0x8 with R0 = 0x16.
  602.  */
  603.  
  604. extern os_error *xosfile_read_stamped_path_var (char *file_name,
  605.       char *var,
  606.       int *obj_type,
  607.       bits *load_addr,
  608.       bits *exec_addr,
  609.       int *size,
  610.       bits *attr,
  611.       bits *file_type);
  612. extern int osfile_read_stamped_path_var (char *file_name,
  613.       char *var,
  614.       bits *load_addr,
  615.       bits *exec_addr,
  616.       int *size,
  617.       bits *attr,
  618.       bits *file_type);
  619.  
  620. /* ------------------------------------------------------------------------
  621.  * Function:      osfile_read_stamped_no_path()
  622.  *
  623.  * Description:   Reads catalogue information and file type for an object
  624.  *
  625.  * Input:         file_name - value of R1 on entry
  626.  *
  627.  * Output:        obj_type - value of R0 on exit (X version only)
  628.  *                load_addr - value of R2 on exit
  629.  *                exec_addr - value of R3 on exit
  630.  *                size - value of R4 on exit
  631.  *                attr - value of R5 on exit
  632.  *                file_type - value of R6 on exit
  633.  *
  634.  * Returns:       R0 (non-X version only)
  635.  *
  636.  * Other notes:   Calls SWI 0x8 with R0 = 0x17.
  637.  */
  638.  
  639. extern os_error *xosfile_read_stamped_no_path (char *file_name,
  640.       int *obj_type,
  641.       bits *load_addr,
  642.       bits *exec_addr,
  643.       int *size,
  644.       bits *attr,
  645.       bits *file_type);
  646. extern int osfile_read_stamped_no_path (char *file_name,
  647.       bits *load_addr,
  648.       bits *exec_addr,
  649.       int *size,
  650.       bits *attr,
  651.       bits *file_type);
  652.  
  653. /* ------------------------------------------------------------------------
  654.  * Function:      osfile_read_block_size()
  655.  *
  656.  * Description:   Reads the natural block size of a file
  657.  *
  658.  * Input:         file_name - value of R1 on entry
  659.  *
  660.  * Output:        block_size - value of R2 on exit (X version only)
  661.  *
  662.  * Returns:       R2 (non-X version only)
  663.  *
  664.  * Other notes:   Calls SWI 0x8 with R0 = 0x18.
  665.  */
  666.  
  667. extern os_error *xosfile_read_block_size (char *file_name,
  668.       int *block_size);
  669. extern int osfile_read_block_size (char *file_name);
  670.  
  671. /* ------------------------------------------------------------------------
  672.  * Function:      osfile_save()
  673.  *
  674.  * Description:   Saves a block of memory as an untyped file (prefer
  675.  *                OSFile_SaveStamped)
  676.  *
  677.  * Input:         file_name - value of R1 on entry
  678.  *                load_addr - value of R2 on entry
  679.  *                exec_addr - value of R3 on entry
  680.  *                data - value of R4 on entry
  681.  *                end - value of R5 on entry
  682.  *
  683.  * Other notes:   Calls SWI 0x8 with R0 = 0x0.
  684.  */
  685.  
  686. extern os_error *xosfile_save (char *file_name,
  687.       bits load_addr,
  688.       bits exec_addr,
  689.       byte *data,
  690.       byte *end);
  691. extern void osfile_save (char *file_name,
  692.       bits load_addr,
  693.       bits exec_addr,
  694.       byte *data,
  695.       byte *end);
  696.  
  697. /* ------------------------------------------------------------------------
  698.  * Function:      osfile_read()
  699.  *
  700.  * Description:   Reads catalogue information for an object using the
  701.  *                directory list in File$Path (prefer OSFile_ReadStamped)
  702.  *
  703.  * Input:         file_name - value of R1 on entry
  704.  *
  705.  * Output:        obj_type - value of R0 on exit (X version only)
  706.  *                load_addr - value of R2 on exit
  707.  *                exec_addr - value of R3 on exit
  708.  *                size - value of R4 on exit
  709.  *                attr - value of R5 on exit
  710.  *
  711.  * Returns:       R0 (non-X version only)
  712.  *
  713.  * Other notes:   Calls SWI 0x8 with R0 = 0x5.
  714.  */
  715.  
  716. extern os_error *xosfile_read (char *file_name,
  717.       int *obj_type,
  718.       bits *load_addr,
  719.       bits *exec_addr,
  720.       int *size,
  721.       bits *attr);
  722. extern int osfile_read (char *file_name,
  723.       bits *load_addr,
  724.       bits *exec_addr,
  725.       int *size,
  726.       bits *attr);
  727.  
  728. /* ------------------------------------------------------------------------
  729.  * Function:      osfile_read_path()
  730.  *
  731.  * Description:   Reads catalogue information for an object using a
  732.  *                specified directory list (prefer OSFile_ReadStampedPath)
  733.  *
  734.  * Input:         file_name - value of R1 on entry
  735.  *                path - value of R4 on entry
  736.  *
  737.  * Output:        obj_type - value of R0 on exit (X version only)
  738.  *                load_addr - value of R2 on exit
  739.  *                exec_addr - value of R3 on exit
  740.  *                size - value of R4 on exit
  741.  *                attr - value of R5 on exit
  742.  *
  743.  * Returns:       R0 (non-X version only)
  744.  *
  745.  * Other notes:   Calls SWI 0x8 with R0 = 0xD.
  746.  */
  747.  
  748. extern os_error *xosfile_read_path (char *file_name,
  749.       char *path,
  750.       int *obj_type,
  751.       bits *load_addr,
  752.       bits *exec_addr,
  753.       int *size,
  754.       bits *attr);
  755. extern int osfile_read_path (char *file_name,
  756.       char *path,
  757.       bits *load_addr,
  758.       bits *exec_addr,
  759.       int *size,
  760.       bits *attr);
  761.  
  762. /* ------------------------------------------------------------------------
  763.  * Function:      osfile_read_path_var()
  764.  *
  765.  * Description:   Reads catalogue information for an object using the
  766.  *                directory list in a specified variable (prefer
  767.  *                OSFile_ReadStampedPathVar)
  768.  *
  769.  * Input:         file_name - value of R1 on entry
  770.  *                var - value of R4 on entry
  771.  *
  772.  * Output:        obj_type - value of R0 on exit (X version only)
  773.  *                load_addr - value of R2 on exit
  774.  *                exec_addr - value of R3 on exit
  775.  *                size - value of R4 on exit
  776.  *                attr - value of R5 on exit
  777.  *
  778.  * Returns:       R0 (non-X version only)
  779.  *
  780.  * Other notes:   Calls SWI 0x8 with R0 = 0xF.
  781.  */
  782.  
  783. extern os_error *xosfile_read_path_var (char *file_name,
  784.       char *var,
  785.       int *obj_type,
  786.       bits *load_addr,
  787.       bits *exec_addr,
  788.       int *size,
  789.       bits *attr);
  790. extern int osfile_read_path_var (char *file_name,
  791.       char *var,
  792.       bits *load_addr,
  793.       bits *exec_addr,
  794.       int *size,
  795.       bits *attr);
  796.  
  797. /* ------------------------------------------------------------------------
  798.  * Function:      osfile_read_no_path()
  799.  *
  800.  * Description:   Reads catalogue information for an object (prefer
  801.  *                OSFile_ReadStampedNoPath)
  802.  *
  803.  * Input:         file_name - value of R1 on entry
  804.  *
  805.  * Output:        obj_type - value of R0 on exit (X version only)
  806.  *                load_addr - value of R2 on exit
  807.  *                exec_addr - value of R3 on exit
  808.  *                size - value of R4 on exit
  809.  *                attr - value of R5 on exit
  810.  *
  811.  * Returns:       R0 (non-X version only)
  812.  *
  813.  * Other notes:   Calls SWI 0x8 with R0 = 0x11.
  814.  */
  815.  
  816. extern os_error *xosfile_read_no_path (char *file_name,
  817.       int *obj_type,
  818.       bits *load_addr,
  819.       bits *exec_addr,
  820.       int *size,
  821.       bits *attr);
  822. extern int osfile_read_no_path (char *file_name,
  823.       bits *load_addr,
  824.       bits *exec_addr,
  825.       int *size,
  826.       bits *attr);
  827.  
  828. /* ------------------------------------------------------------------------
  829.  * Function:      osfile_create()
  830.  *
  831.  * Description:   Creates an empty untyped file (prefer
  832.  *                OSFile_CreateStamped)
  833.  *
  834.  * Input:         file_name - value of R1 on entry
  835.  *                load_addr - value of R2 on entry
  836.  *                exec_addr - value of R3 on entry
  837.  *                size - value of R5 on entry
  838.  *
  839.  * Other notes:   Calls SWI 0x8 with R0 = 0x7, R4 = 0x0.
  840.  */
  841.  
  842. extern os_error *xosfile_create (char *file_name,
  843.       bits load_addr,
  844.       bits exec_addr,
  845.       int size);
  846. extern void osfile_create (char *file_name,
  847.       bits load_addr,
  848.       bits exec_addr,
  849.       int size);
  850.  
  851. /* ------------------------------------------------------------------------
  852.  * Function:      osfile_load()
  853.  *
  854.  * Description:   Loads an untyped file using the directory list in
  855.  *                File$Path (prefer OSFile_LoadStamped)
  856.  *
  857.  * Input:         file_name - value of R1 on entry
  858.  *
  859.  * Output:        obj_type - value of R0 on exit (X version only)
  860.  *                load_addr - value of R2 on exit
  861.  *                exec_addr - value of R3 on exit
  862.  *                size - value of R4 on exit
  863.  *                attr - value of R5 on exit
  864.  *
  865.  * Returns:       R0 (non-X version only)
  866.  *
  867.  * Other notes:   Calls SWI 0x8 with R0 = 0xFF, R3 = 0x1.
  868.  */
  869.  
  870. extern os_error *xosfile_load (char *file_name,
  871.       int *obj_type,
  872.       bits *load_addr,
  873.       bits *exec_addr,
  874.       int *size,
  875.       bits *attr);
  876. extern int osfile_load (char *file_name,
  877.       bits *load_addr,
  878.       bits *exec_addr,
  879.       int *size,
  880.       bits *attr);
  881.  
  882. /* ------------------------------------------------------------------------
  883.  * Function:      osfile_load_path()
  884.  *
  885.  * Description:   Loads an untyped file using a specified directory list
  886.  *                (prefer OSFile_LoadStampedPath)
  887.  *
  888.  * Input:         file_name - value of R1 on entry
  889.  *                path - value of R4 on entry
  890.  *
  891.  * Output:        obj_type - value of R0 on exit (X version only)
  892.  *                load_addr - value of R2 on exit
  893.  *                exec_addr - value of R3 on exit
  894.  *                size - value of R4 on exit
  895.  *                attr - value of R5 on exit
  896.  *
  897.  * Returns:       R0 (non-X version only)
  898.  *
  899.  * Other notes:   Calls SWI 0x8 with R0 = 0xC, R3 = 0x1.
  900.  */
  901.  
  902. extern os_error *xosfile_load_path (char *file_name,
  903.       char *path,
  904.       int *obj_type,
  905.       bits *load_addr,
  906.       bits *exec_addr,
  907.       int *size,
  908.       bits *attr);
  909. extern int osfile_load_path (char *file_name,
  910.       char *path,
  911.       bits *load_addr,
  912.       bits *exec_addr,
  913.       int *size,
  914.       bits *attr);
  915.  
  916. /* ------------------------------------------------------------------------
  917.  * Function:      osfile_load_path_var()
  918.  *
  919.  * Description:   Loads an untyped file using the directory list in a
  920.  *                specified variable (prefer OSFile_LoadStampedPathVar)
  921.  *
  922.  * Input:         file_name - value of R1 on entry
  923.  *                var - value of R4 on entry
  924.  *
  925.  * Output:        obj_type - value of R0 on exit (X version only)
  926.  *                load_addr - value of R2 on exit
  927.  *                exec_addr - value of R3 on exit
  928.  *                size - value of R4 on exit
  929.  *                attr - value of R5 on exit
  930.  *
  931.  * Returns:       R0 (non-X version only)
  932.  *
  933.  * Other notes:   Calls SWI 0x8 with R0 = 0xE, R3 = 0x1.
  934.  */
  935.  
  936. extern os_error *xosfile_load_path_var (char *file_name,
  937.       char *var,
  938.       int *obj_type,
  939.       bits *load_addr,
  940.       bits *exec_addr,
  941.       int *size,
  942.       bits *attr);
  943. extern int osfile_load_path_var (char *file_name,
  944.       char *var,
  945.       bits *load_addr,
  946.       bits *exec_addr,
  947.       int *size,
  948.       bits *attr);
  949.  
  950. /* ------------------------------------------------------------------------
  951.  * Function:      osfile_load_no_path()
  952.  *
  953.  * Description:   Loads an untyped file (prefer OSFile_LoadStampedNoPath)
  954.  *
  955.  * Input:         file_name - value of R1 on entry
  956.  *
  957.  * Output:        obj_type - value of R0 on exit (X version only)
  958.  *                load_addr - value of R2 on exit
  959.  *                exec_addr - value of R3 on exit
  960.  *                size - value of R4 on exit
  961.  *                attr - value of R5 on exit
  962.  *
  963.  * Returns:       R0 (non-X version only)
  964.  *
  965.  * Other notes:   Calls SWI 0x8 with R0 = 0x10, R3 = 0x1.
  966.  */
  967.  
  968. extern os_error *xosfile_load_no_path (char *file_name,
  969.       int *obj_type,
  970.       bits *load_addr,
  971.       bits *exec_addr,
  972.       int *size,
  973.       bits *attr);
  974. extern int osfile_load_no_path (char *file_name,
  975.       bits *load_addr,
  976.       bits *exec_addr,
  977.       int *size,
  978.       bits *attr);
  979.  
  980. /* ------------------------------------------------------------------------
  981.  * Function:      upcallfile_save()
  982.  *
  983.  * Description:   Warns your program that a file is being saved
  984.  *
  985.  * Input:         file_name - value of R1 on entry
  986.  *                load_addr - value of R2 on entry
  987.  *                exec_addr - value of R3 on entry
  988.  *                data - value of R4 on entry
  989.  *                end - value of R5 on entry
  990.  *                special - value of R6 on entry
  991.  *                fs_info - value of R8 on entry
  992.  *
  993.  * Other notes:   Calls SWI 0x33 with R0 = 0x3, R9 = 0x0.
  994.  */
  995.  
  996. extern os_error *xupcallfile_save (char *file_name,
  997.       bits load_addr,
  998.       bits exec_addr,
  999.       byte *data,
  1000.       byte *end,
  1001.       char *special,
  1002.       bits fs_info);
  1003. extern void upcallfile_save (char *file_name,
  1004.       bits load_addr,
  1005.       bits exec_addr,
  1006.       byte *data,
  1007.       byte *end,
  1008.       char *special,
  1009.       bits fs_info);
  1010.  
  1011. /* ------------------------------------------------------------------------
  1012.  * Function:      upcallfile_set_args()
  1013.  *
  1014.  * Description:   Warns your program that a file's catalogue information is
  1015.  *                being written
  1016.  *
  1017.  * Input:         file_name - value of R1 on entry
  1018.  *                load_addr - value of R2 on entry
  1019.  *                exec_addr - value of R3 on entry
  1020.  *                attr - value of R5 on entry
  1021.  *                special - value of R6 on entry
  1022.  *                fs_info - value of R8 on entry
  1023.  *
  1024.  * Other notes:   Calls SWI 0x33 with R0 = 0x3, R9 = 0x1.
  1025.  */
  1026.  
  1027. extern os_error *xupcallfile_set_args (char *file_name,
  1028.       bits load_addr,
  1029.       bits exec_addr,
  1030.       bits attr,
  1031.       char *special,
  1032.       bits fs_info);
  1033. extern void upcallfile_set_args (char *file_name,
  1034.       bits load_addr,
  1035.       bits exec_addr,
  1036.       bits attr,
  1037.       char *special,
  1038.       bits fs_info);
  1039.  
  1040. /* ------------------------------------------------------------------------
  1041.  * Function:      upcallfile_set_load_addr()
  1042.  *
  1043.  * Description:   Warns your program that a file's load address is being
  1044.  *                written
  1045.  *
  1046.  * Input:         file_name - value of R1 on entry
  1047.  *                load_addr - value of R2 on entry
  1048.  *                special - value of R6 on entry
  1049.  *                fs_info - value of R8 on entry
  1050.  *
  1051.  * Other notes:   Calls SWI 0x33 with R0 = 0x3, R9 = 0x2.
  1052.  */
  1053.  
  1054. extern os_error *xupcallfile_set_load_addr (char *file_name,
  1055.       bits load_addr,
  1056.       char *special,
  1057.       bits fs_info);
  1058. extern void upcallfile_set_load_addr (char *file_name,
  1059.       bits load_addr,
  1060.       char *special,
  1061.       bits fs_info);
  1062.  
  1063. /* ------------------------------------------------------------------------
  1064.  * Function:      upcallfile_set_exec_addr()
  1065.  *
  1066.  * Description:   Warns your program that a file's execution address is
  1067.  *                being written
  1068.  *
  1069.  * Input:         file_name - value of R1 on entry
  1070.  *                exec_addr - value of R3 on entry
  1071.  *                special - value of R6 on entry
  1072.  *                fs_info - value of R8 on entry
  1073.  *
  1074.  * Other notes:   Calls SWI 0x33 with R0 = 0x3, R9 = 0x3.
  1075.  */
  1076.  
  1077. extern os_error *xupcallfile_set_exec_addr (char *file_name,
  1078.       bits exec_addr,
  1079.       char *special,
  1080.       bits fs_info);
  1081. extern void upcallfile_set_exec_addr (char *file_name,
  1082.       bits exec_addr,
  1083.       char *special,
  1084.       bits fs_info);
  1085.  
  1086. /* ------------------------------------------------------------------------
  1087.  * Function:      upcallfile_set_attr()
  1088.  *
  1089.  * Description:   Warns your program that a file's attributes are being
  1090.  *                written
  1091.  *
  1092.  * Input:         file_name - value of R1 on entry
  1093.  *                attr - value of R5 on entry
  1094.  *                special - value of R6 on entry
  1095.  *                fs_info - value of R8 on entry
  1096.  *
  1097.  * Other notes:   Calls SWI 0x33 with R0 = 0x3, R9 = 0x4.
  1098.  */
  1099.  
  1100. extern os_error *xupcallfile_set_attr (char *file_name,
  1101.       bits attr,
  1102.       char *special,
  1103.       bits fs_info);
  1104. extern void upcallfile_set_attr (char *file_name,
  1105.       bits attr,
  1106.       char *special,
  1107.       bits fs_info);
  1108.  
  1109. /* ------------------------------------------------------------------------
  1110.  * Function:      upcallfile_delete()
  1111.  *
  1112.  * Description:   Warns your program that a file is being deleted
  1113.  *
  1114.  * Input:         file_name - value of R1 on entry
  1115.  *                special - value of R6 on entry
  1116.  *                fs_info - value of R8 on entry
  1117.  *
  1118.  * Other notes:   Calls SWI 0x33 with R0 = 0x3, R9 = 0x6.
  1119.  */
  1120.  
  1121. extern os_error *xupcallfile_delete (char *file_name,
  1122.       char *special,
  1123.       bits fs_info);
  1124. extern void upcallfile_delete (char *file_name,
  1125.       char *special,
  1126.       bits fs_info);
  1127.  
  1128. /* ------------------------------------------------------------------------
  1129.  * Function:      upcallfile_create()
  1130.  *
  1131.  * Description:   Warns your program that a file is being created
  1132.  *
  1133.  * Input:         file_name - value of R1 on entry
  1134.  *                load_addr - value of R2 on entry
  1135.  *                exec_addr - value of R3 on entry
  1136.  *                data - value of R4 on entry
  1137.  *                end - value of R5 on entry
  1138.  *                special - value of R6 on entry
  1139.  *                fs_info - value of R8 on entry
  1140.  *
  1141.  * Other notes:   Calls SWI 0x33 with R0 = 0x3, R9 = 0x7.
  1142.  */
  1143.  
  1144. extern os_error *xupcallfile_create (char *file_name,
  1145.       bits load_addr,
  1146.       bits exec_addr,
  1147.       byte *data,
  1148.       byte *end,
  1149.       char *special,
  1150.       bits fs_info);
  1151. extern void upcallfile_create (char *file_name,
  1152.       bits load_addr,
  1153.       bits exec_addr,
  1154.       byte *data,
  1155.       byte *end,
  1156.       char *special,
  1157.       bits fs_info);
  1158.  
  1159. /* ------------------------------------------------------------------------
  1160.  * Function:      upcallfile_create_dir()
  1161.  *
  1162.  * Description:   Warns your program that a directory is being created
  1163.  *
  1164.  * Input:         file_name - value of R1 on entry
  1165.  *                load_addr - value of R2 on entry
  1166.  *                exec_addr - value of R3 on entry
  1167.  *                entry_count - value of R4 on entry
  1168.  *                special - value of R6 on entry
  1169.  *                fs_info - value of R8 on entry
  1170.  *
  1171.  * Other notes:   Calls SWI 0x33 with R0 = 0x3, R9 = 0x8.
  1172.  */
  1173.  
  1174. extern os_error *xupcallfile_create_dir (char *file_name,
  1175.       bits load_addr,
  1176.       bits exec_addr,
  1177.       int entry_count,
  1178.       char *special,
  1179.       bits fs_info);
  1180. extern void upcallfile_create_dir (char *file_name,
  1181.       bits load_addr,
  1182.       bits exec_addr,
  1183.       int entry_count,
  1184.       char *special,
  1185.       bits fs_info);
  1186.  
  1187. #ifdef __cplusplus
  1188.    }
  1189. #endif
  1190.  
  1191. #endif
  1192.