home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / oslib / h / osargs < prev    next >
Encoding:
Text File  |  1994-09-07  |  8.9 KB  |  302 lines

  1. #ifndef osargs_H
  2. #define osargs_H
  3.  
  4. /* C header file for OSArgs
  5.  * written by DefMod (Sep  7 1994) on Wed Sep  7 21:21:34 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_Args
  27. #define OS_Args                                 0x9
  28. #undef  XOS_Args
  29. #define XOS_Args                                0x20009
  30. #undef  OSArgs_ReadPtr
  31. #define OSArgs_ReadPtr                          0x0
  32. #undef  OSArgs_ReadTemporaryFS
  33. #define OSArgs_ReadTemporaryFS                  0x0
  34. #undef  OSArgs_SetPtr
  35. #define OSArgs_SetPtr                           0x1
  36. #undef  OSArgs_ReadExt
  37. #define OSArgs_ReadExt                          0x2
  38. #undef  OSArgs_SetExt
  39. #define OSArgs_SetExt                           0x3
  40. #undef  OSArgs_ReadAllocation
  41. #define OSArgs_ReadAllocation                   0x4
  42. #undef  OSArgs_ReadEOFStatus
  43. #define OSArgs_ReadEOFStatus                    0x5
  44. #undef  OSArgs_SetAllocation
  45. #define OSArgs_SetAllocation                    0x6
  46. #undef  OSArgs_ReadPath
  47. #define OSArgs_ReadPath                         0x7
  48. #undef  OSArgs_ImageStamped
  49. #define OSArgs_ImageStamped                     0x8
  50. #undef  OSArgs_ReadInfo
  51. #define OSArgs_ReadInfo                         0xFE
  52. #undef  OSArgs_Ensure
  53. #define OSArgs_Ensure                           0xFF
  54. #undef  ArgsV
  55. #define ArgsV                                   0x9
  56.  
  57. /************************
  58.  * Constant definitions *
  59.  ************************/
  60. #define osargs_STREAM_INTERACTIVE               0x8u
  61. #define osargs_STREAM_SUPPORTS_GBPB             0x10u
  62. #define osargs_STREAM_DIR                       0x20u
  63. #define osargs_STREAM_READABLE                  0x40u
  64. #define osargs_STREAM_WRITABLE                  0x80u
  65. #define osargs_STREAM_WRITTEN                   0x100u
  66. #define osargs_STREAM_EOF_ERROR_ON_NEXT_READ    0x200u
  67. #define osargs_STREAM_UNBUFFERED                0x400u
  68. #define osargs_STREAM_UNALLOCATED               0x800u
  69. #define osargs_STREAM_CRITICAL                  0x1000u
  70. #define osargs_STREAM_DATA_LOST                 0x2000u
  71. #define osargs_STREAM_IMAGE_FILE_BUSY           0x4000u
  72.  
  73. /*************************
  74.  * Function declarations *
  75.  *************************/
  76.  
  77. #ifdef __cplusplus
  78.    extern "C" {
  79. #endif
  80.  
  81. /*************************************************************
  82.  * NOTE: The following functions provide direct access to    *
  83.  *       the SWI's noted in the function description.        *
  84.  *       Please read the relevant PRM section for more       *
  85.  *       information on their input/output parameters.       *
  86.  *************************************************************/
  87.  
  88. /* ------------------------------------------------------------------------
  89.  * Function:      osargs_read_ptr()
  90.  *
  91.  * Description:   Reads a file's sequential file pointer
  92.  *
  93.  * Input:         file - value of R1 on entry
  94.  *
  95.  * Output:        ptr - value of R2 on exit (X version only)
  96.  *
  97.  * Returns:       R2 (non-X version only)
  98.  *
  99.  * Other notes:   Calls SWI 0x9 with R0 = 0x0.
  100.  */
  101.  
  102. extern os_error *xosargs_read_ptr (os_f file,
  103.       int *ptr);
  104. extern int osargs_read_ptr (os_f file);
  105.  
  106. /* ------------------------------------------------------------------------
  107.  * Function:      osargs_read_temporary_fs()
  108.  *
  109.  * Description:   Reads the temporary filing system number
  110.  *
  111.  * Output:        temp_fs - value of R0 on exit (X version only)
  112.  *
  113.  * Returns:       R0 (non-X version only)
  114.  *
  115.  * Other notes:   Calls SWI 0x9 with R0 = 0x0, R1 = 0x0.
  116.  */
  117.  
  118. extern os_error *xosargs_read_temporary_fs (int *temp_fs);
  119. extern int osargs_read_temporary_fs (void);
  120.  
  121. /* ------------------------------------------------------------------------
  122.  * Function:      osargs_set_ptr()
  123.  *
  124.  * Description:   Writes an open file's sequential file pointer
  125.  *
  126.  * Input:         file - value of R1 on entry
  127.  *                ptr - value of R2 on entry
  128.  *
  129.  * Other notes:   Calls SWI 0x9 with R0 = 0x1.
  130.  */
  131.  
  132. extern os_error *xosargs_set_ptr (os_f file,
  133.       int ptr);
  134. extern void osargs_set_ptr (os_f file,
  135.       int ptr);
  136.  
  137. /* ------------------------------------------------------------------------
  138.  * Function:      osargs_read_ext()
  139.  *
  140.  * Description:   Reads an open file's extent
  141.  *
  142.  * Input:         file - value of R1 on entry
  143.  *
  144.  * Output:        ext - value of R2 on exit (X version only)
  145.  *
  146.  * Returns:       R2 (non-X version only)
  147.  *
  148.  * Other notes:   Calls SWI 0x9 with R0 = 0x2.
  149.  */
  150.  
  151. extern os_error *xosargs_read_ext (os_f file,
  152.       int *ext);
  153. extern int osargs_read_ext (os_f file);
  154.  
  155. /* ------------------------------------------------------------------------
  156.  * Function:      osargs_set_ext()
  157.  *
  158.  * Description:   Writes an open file's extent
  159.  *
  160.  * Input:         file - value of R1 on entry
  161.  *                ext - value of R2 on entry
  162.  *
  163.  * Other notes:   Calls SWI 0x9 with R0 = 0x3.
  164.  */
  165.  
  166. extern os_error *xosargs_set_ext (os_f file,
  167.       int ext);
  168. extern void osargs_set_ext (os_f file,
  169.       int ext);
  170.  
  171. /* ------------------------------------------------------------------------
  172.  * Function:      osargs_read_allocation()
  173.  *
  174.  * Description:   Reads an open file's allocated size
  175.  *
  176.  * Input:         file - value of R1 on entry
  177.  *
  178.  * Output:        allocation - value of R2 on exit (X version only)
  179.  *
  180.  * Returns:       R2 (non-X version only)
  181.  *
  182.  * Other notes:   Calls SWI 0x9 with R0 = 0x4.
  183.  */
  184.  
  185. extern os_error *xosargs_read_allocation (os_f file,
  186.       int *allocation);
  187. extern int osargs_read_allocation (os_f file);
  188.  
  189. /* ------------------------------------------------------------------------
  190.  * Function:      osargs_read_eof_status()
  191.  *
  192.  * Description:   Reads an open file's end-of-file (EOF) status
  193.  *
  194.  * Input:         file - value of R1 on entry
  195.  *
  196.  * Output:        eof_status - value of R2 on exit (X version only)
  197.  *
  198.  * Returns:       R2 (non-X version only)
  199.  *
  200.  * Other notes:   Calls SWI 0x9 with R0 = 0x5.
  201.  */
  202.  
  203. extern os_error *xosargs_read_eof_status (os_f file,
  204.       bool *eof_status);
  205. extern bool osargs_read_eof_status (os_f file);
  206.  
  207. /* ------------------------------------------------------------------------
  208.  * Function:      osargs_set_allocation()
  209.  *
  210.  * Description:   Ensures an open file's size
  211.  *
  212.  * Input:         file - value of R1 on entry
  213.  *                allocation - value of R2 on entry
  214.  *
  215.  * Other notes:   Calls SWI 0x9 with R0 = 0x6.
  216.  */
  217.  
  218. extern os_error *xosargs_set_allocation (os_f file,
  219.       bool allocation);
  220. extern void osargs_set_allocation (os_f file,
  221.       bool allocation);
  222.  
  223. /* ------------------------------------------------------------------------
  224.  * Function:      osargs_read_path()
  225.  *
  226.  * Description:   Converts a file handle to a canonical name
  227.  *
  228.  * Input:         file - value of R1 on entry
  229.  *                buffer - value of R2 on entry
  230.  *                size - value of R5 on entry
  231.  *
  232.  * Output:        spare - value of R5 on exit
  233.  *
  234.  * Other notes:   Calls SWI 0x9 with R0 = 0x7.
  235.  */
  236.  
  237. extern os_error *xosargs_read_path (os_f file,
  238.       char *buffer,
  239.       int size,
  240.       int *spare);
  241. extern void osargs_read_path (os_f file,
  242.       char *buffer,
  243.       int size,
  244.       int *spare);
  245.  
  246. /* ------------------------------------------------------------------------
  247.  * Function:      osargs_image_stamped()
  248.  *
  249.  * Description:   Used by an image filing system to inform of a change to
  250.  *                an image stamp
  251.  *
  252.  * Input:         file - value of R1 on entry
  253.  *                image_stamp - value of R2 on entry
  254.  *
  255.  * Other notes:   Calls SWI 0x9 with R0 = 0x8.
  256.  */
  257.  
  258. extern os_error *xosargs_image_stamped (os_f file,
  259.       int image_stamp);
  260. extern void osargs_image_stamped (os_f file,
  261.       int image_stamp);
  262.  
  263. /* ------------------------------------------------------------------------
  264.  * Function:      osargs_read_info()
  265.  *
  266.  * Description:   Reads information on a file handle
  267.  *
  268.  * Input:         file - value of R1 on entry
  269.  *
  270.  * Output:        stream_status - value of R0 on exit
  271.  *                fs_status - value of R2 on exit
  272.  *
  273.  * Other notes:   Calls SWI 0x9 with R0 = 0xFE.
  274.  */
  275.  
  276. extern os_error *xosargs_read_info (os_f file,
  277.       bits *stream_status,
  278.       bits *fs_status);
  279. extern void osargs_read_info (os_f file,
  280.       bits *stream_status,
  281.       bits *fs_status);
  282.  
  283. /* ------------------------------------------------------------------------
  284.  * Function:      osargs_ensure()
  285.  *
  286.  * Description:   Ensures data has been written to a file, or to all files
  287.  *                on the temporary filing system
  288.  *
  289.  * Input:         file - value of R1 on entry
  290.  *
  291.  * Other notes:   Calls SWI 0x9 with R0 = 0xFF.
  292.  */
  293.  
  294. extern os_error *xosargs_ensure (os_f file);
  295. extern void osargs_ensure (os_f file);
  296.  
  297. #ifdef __cplusplus
  298.    }
  299. #endif
  300.  
  301. #endif
  302.