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

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