home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / oslib / h / resourcefs < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-14  |  5.4 KB  |  183 lines

  1. #ifndef resourcefs_H
  2. #define resourcefs_H
  3.  
  4. /* C header file for ResourceFS
  5.  * written by DefMod (Sep  7 1994) on Wed Sep 14 13:18:01 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  ResourceFS_RegisterFiles
  27. #define ResourceFS_RegisterFiles                0x41B40
  28. #undef  XResourceFS_RegisterFiles
  29. #define XResourceFS_RegisterFiles               0x61B40
  30. #undef  ResourceFS_DeregisterFiles
  31. #define ResourceFS_DeregisterFiles              0x41B41
  32. #undef  XResourceFS_DeregisterFiles
  33. #define XResourceFS_DeregisterFiles             0x61B41
  34. #undef  Service_ResourceFSStarted
  35. #define Service_ResourceFSStarted               0x59
  36. #undef  Service_ResourceFSDying
  37. #define Service_ResourceFSDying                 0x5A
  38. #undef  Service_ResourceFSStarting
  39. #define Service_ResourceFSStarting              0x60
  40.  
  41. /************************************
  42.  * Structure and union declarations *
  43.  ************************************/
  44. typedef struct resourcefs_file_header           resourcefs_file_header;
  45. typedef struct resourcefs_file_data             resourcefs_file_data;
  46. typedef struct resourcefs_file                  resourcefs_file;
  47. typedef struct resourcefs_file_list             resourcefs_file_list;
  48.  
  49. /********************
  50.  * Type definitions *
  51.  ********************/
  52. struct resourcefs_file_header
  53.    {  int data_size;
  54.       bits load_addr;
  55.       bits exec_addr;
  56.       int size;
  57.       bits attr;
  58.       char name [UNKNOWN];
  59.    };
  60.  
  61. #define resourcefs_FILE_HEADER(N) \
  62.    struct \
  63.       {  int data_size; \
  64.          bits load_addr; \
  65.          bits exec_addr; \
  66.          int size; \
  67.          bits attr; \
  68.          char name [N]; \
  69.       }
  70.  
  71. #define resourcefs_SIZEOF_FILE_HEADER(N) \
  72.    (offsetof (resourcefs_file_header, name) + \
  73.          (N)*sizeof ((resourcefs_file_header *) NULL)->name)
  74.  
  75. struct resourcefs_file_data
  76.    {  int size;
  77.       byte data [UNKNOWN];
  78.    };
  79.  
  80. #define resourcefs_FILE_DATA(N) \
  81.    struct \
  82.       {  int size; \
  83.          byte data [N]; \
  84.       }
  85.  
  86. #define resourcefs_SIZEOF_FILE_DATA(N) \
  87.    (offsetof (resourcefs_file_data, data) + \
  88.          (N)*sizeof ((resourcefs_file_data *) NULL)->data)
  89.  
  90. struct resourcefs_file
  91.    {  resourcefs_file_header header;
  92.       resourcefs_file_data data;
  93.    };
  94.  
  95. struct resourcefs_file_list
  96.    {  resourcefs_file file [UNKNOWN];
  97.    };
  98.  
  99. /*************************
  100.  * Function declarations *
  101.  *************************/
  102.  
  103. #ifdef __cplusplus
  104.    extern "C" {
  105. #endif
  106.  
  107. /*************************************************************
  108.  * NOTE: The following functions provide direct access to    *
  109.  *       the SWI's noted in the function description.        *
  110.  *       Please read the relevant PRM section for more       *
  111.  *       information on their input/output parameters.       *
  112.  *************************************************************/
  113.  
  114. /* ------------------------------------------------------------------------
  115.  * Function:      resourcefs_register_files()
  116.  *
  117.  * Description:   Add file(s) to the ResourceFS structure
  118.  *
  119.  * Input:         file_list - value of R0 on entry
  120.  *
  121.  * Other notes:   Calls SWI 0x41B40.
  122.  */
  123.  
  124. extern os_error *xresourcefs_register_files (resourcefs_file_list *file_list);
  125. extern void resourcefs_register_files (resourcefs_file_list *file_list);
  126.  
  127. /* ------------------------------------------------------------------------
  128.  * Function:      resourcefs_deregister_files()
  129.  *
  130.  * Description:   Remove file(s) from the ResourceFS structure
  131.  *
  132.  * Input:         file_list - value of R0 on entry
  133.  *
  134.  * Other notes:   Calls SWI 0x41B41.
  135.  */
  136.  
  137. extern os_error *xresourcefs_deregister_files (resourcefs_file_list *file_list);
  138. extern void resourcefs_deregister_files (resourcefs_file_list *file_list);
  139.  
  140. /* ------------------------------------------------------------------------
  141.  * Function:      service_resource_fs_started()
  142.  *
  143.  * Description:   The file structure inside ResourceFS has changed
  144.  *
  145.  * Other notes:   Calls SWI 0x30 with R1 = 0x59.
  146.  */
  147.  
  148. extern os_error *xservice_resource_fs_started (void);
  149. extern void service_resource_fs_started (void);
  150.  
  151. /* ------------------------------------------------------------------------
  152.  * Function:      service_resource_fs_dying()
  153.  *
  154.  * Description:   ResourceFS is killed
  155.  *
  156.  * Other notes:   Calls SWI 0x30 with R1 = 0x5A.
  157.  */
  158.  
  159. extern os_error *xservice_resource_fs_dying (void);
  160. extern void service_resource_fs_dying (void);
  161.  
  162. /* ------------------------------------------------------------------------
  163.  * Function:      service_resource_fs_starting()
  164.  *
  165.  * Description:   ResourceFS module is reloaded or reinitialised
  166.  *
  167.  * Input:         register_files - value of R2 on entry
  168.  *                workspace - value of R3 on entry
  169.  *
  170.  * Other notes:   Calls SWI 0x30 with R1 = 0x60.
  171.  */
  172.  
  173. extern os_error *xservice_resource_fs_starting (void *register_files,
  174.       void *workspace);
  175. extern void service_resource_fs_starting (void *register_files,
  176.       void *workspace);
  177.  
  178. #ifdef __cplusplus
  179.    }
  180. #endif
  181.  
  182. #endif
  183.