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

  1. #ifndef osfind_H
  2. #define osfind_H
  3.  
  4. /* C header file for OSFind
  5.  * written by DefMod (Sep  7 1994) on Wed Sep  7 21:21:05 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_Find
  27. #define OS_Find                                 0xD
  28. #undef  XOS_Find
  29. #define XOS_Find                                0x2000D
  30. #undef  OSFind_Openin
  31. #define OSFind_Openin                           0x40
  32. #undef  OSFind_Openout
  33. #define OSFind_Openout                          0x80
  34. #undef  OSFind_Openup
  35. #define OSFind_Openup                           0xC0
  36. #undef  OSFind_Close
  37. #define OSFind_Close                            0x0
  38. #undef  FindV
  39. #define FindV                                   0xD
  40. #undef  UpCallFind_CreateOpenup
  41. #define UpCallFind_CreateOpenup                 0x101
  42. #undef  UpCallFind_Openup
  43. #define UpCallFind_Openup                       0x102
  44. #undef  UpCallFind_Close
  45. #define UpCallFind_Close                        0x103
  46.  
  47. /************************
  48.  * Constant definitions *
  49.  ************************/
  50. #define osfind_PATH                             0x1u
  51. #define osfind_PATH_VAR                         0x2u
  52. #define osfind_NO_PATH                          0x3u
  53. #define osfind_ERROR_IF_ABSENT                  0x8u
  54. #define osfind_ERROR_IF_DIR                     0x4u
  55.  
  56. /*************************
  57.  * Function declarations *
  58.  *************************/
  59.  
  60. #ifdef __cplusplus
  61.    extern "C" {
  62. #endif
  63.  
  64. /*************************************************************
  65.  * NOTE: The following functions provide direct access to    *
  66.  *       the SWI's noted in the function description.        *
  67.  *       Please read the relevant PRM section for more       *
  68.  *       information on their input/output parameters.       *
  69.  *************************************************************/
  70.  
  71. /* ------------------------------------------------------------------------
  72.  * Function:      osfind_openin()
  73.  *
  74.  * Description:   Opens an existing file with read access only
  75.  *
  76.  * Input:         flags - value of R0 on entry
  77.  *                file_name - value of R1 on entry
  78.  *                path - value of R2 on entry
  79.  *
  80.  * Output:        file - value of R0 on exit (X version only)
  81.  *
  82.  * Returns:       R0 (non-X version only)
  83.  *
  84.  * Other notes:   Calls SWI 0xD with R0 |= 0x40.
  85.  */
  86.  
  87. extern os_error *xosfind_openin (bits flags,
  88.       char *file_name,
  89.       char *path,
  90.       os_f *file);
  91. extern os_f osfind_openin (bits flags,
  92.       char *file_name,
  93.       char *path);
  94.  
  95. /* ------------------------------------------------------------------------
  96.  * Function:      osfind_openout()
  97.  *
  98.  * Description:   Creates a new file with read/write access
  99.  *
  100.  * Input:         flags - value of R0 on entry
  101.  *                file_name - value of R1 on entry
  102.  *                path - value of R2 on entry
  103.  *
  104.  * Output:        file - value of R0 on exit (X version only)
  105.  *
  106.  * Returns:       R0 (non-X version only)
  107.  *
  108.  * Other notes:   Calls SWI 0xD with R0 |= 0x80.
  109.  */
  110.  
  111. extern os_error *xosfind_openout (bits flags,
  112.       char *file_name,
  113.       char *path,
  114.       os_f *file);
  115. extern os_f osfind_openout (bits flags,
  116.       char *file_name,
  117.       char *path);
  118.  
  119. /* ------------------------------------------------------------------------
  120.  * Function:      osfind_openup()
  121.  *
  122.  * Description:   Opens an existing file with read/write access
  123.  *
  124.  * Input:         flags - value of R0 on entry
  125.  *                file_name - value of R1 on entry
  126.  *                path - value of R2 on entry
  127.  *
  128.  * Output:        file - value of R0 on exit (X version only)
  129.  *
  130.  * Returns:       R0 (non-X version only)
  131.  *
  132.  * Other notes:   Calls SWI 0xD with R0 |= 0xC0.
  133.  */
  134.  
  135. extern os_error *xosfind_openup (bits flags,
  136.       char *file_name,
  137.       char *path,
  138.       os_f *file);
  139. extern os_f osfind_openup (bits flags,
  140.       char *file_name,
  141.       char *path);
  142.  
  143. /* ------------------------------------------------------------------------
  144.  * Function:      osfind_close()
  145.  *
  146.  * Description:   Closes a file or files
  147.  *
  148.  * Input:         file - value of R1 on entry
  149.  *
  150.  * Other notes:   Calls SWI 0xD with R0 = 0x0.
  151.  */
  152.  
  153. extern os_error *xosfind_close (os_f file);
  154. extern void osfind_close (os_f file);
  155.  
  156. /* ------------------------------------------------------------------------
  157.  * Function:      upcallfind_create_openup()
  158.  *
  159.  * Description:   Warns your program that a file is being created and
  160.  *                opened for update
  161.  *
  162.  * Input:         file_name - value of R1 on entry
  163.  *                file - value of R2 on entry
  164.  *                special - value of R6 on entry
  165.  *                fs_info - value of R8 on entry
  166.  *
  167.  * Other notes:   Calls SWI 0x33 with R0 = 0x3, R9 = 0x101.
  168.  */
  169.  
  170. extern os_error *xupcallfind_create_openup (char *file_name,
  171.       os_f file,
  172.       char *special,
  173.       bits fs_info);
  174. extern void upcallfind_create_openup (char *file_name,
  175.       os_f file,
  176.       char *special,
  177.       bits fs_info);
  178.  
  179. /* ------------------------------------------------------------------------
  180.  * Function:      upcallfind_openup()
  181.  *
  182.  * Description:   Warns your program that a file is being opened for update
  183.  *
  184.  * Input:         file_name - value of R1 on entry
  185.  *                file - value of R2 on entry
  186.  *                special - value of R6 on entry
  187.  *                fs_info - value of R8 on entry
  188.  *
  189.  * Other notes:   Calls SWI 0x33 with R0 = 0x3, R9 = 0x102.
  190.  */
  191.  
  192. extern os_error *xupcallfind_openup (char *file_name,
  193.       os_f file,
  194.       char *special,
  195.       bits fs_info);
  196. extern void upcallfind_openup (char *file_name,
  197.       os_f file,
  198.       char *special,
  199.       bits fs_info);
  200.  
  201. /* ------------------------------------------------------------------------
  202.  * Function:      upcallfind_close()
  203.  *
  204.  * Description:   Warns your program that a file is being closed
  205.  *
  206.  * Input:         file - value of R1 on entry
  207.  *                fs_info - value of R8 on entry
  208.  *
  209.  * Other notes:   Calls SWI 0x33 with R0 = 0x3, R9 = 0x103.
  210.  */
  211.  
  212. extern os_error *xupcallfind_close (os_f file,
  213.       bits fs_info);
  214. extern void upcallfind_close (os_f file,
  215.       bits fs_info);
  216.  
  217. #ifdef __cplusplus
  218.    }
  219. #endif
  220.  
  221. #endif
  222.