home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / opus / v5 / opussdk / amigaguide / dopus / modules.h < prev    next >
C/C++ Source or Header  |  1977-12-31  |  13KB  |  290 lines

  1. @DATABASE "dopus/modules.h"
  2. @MASTER   "opussdk:include/dopus/modules.h"
  3. @REMARK   (c) Dr Greg Perry and Jonathan Potter, GPSoftware 1996
  4. @REMARK   This file was initially created by ADtoHT 2.1 on 07-Sep-96 18:20:14
  5. @REMARK   ADtoHT is © 1993-1995 Christian Stieber
  6.  
  7. @NODE MAIN "dopus/modules.h"
  8. @TOC "DopusSDK/MAIN"
  9.  
  10. @{"dopus/modules.h" LINK File}
  11.  
  12.  
  13. @{b}Structures@{ub}
  14.  
  15. @{"addfile_packet" LINK "dopus/modules.h/File" 127}   @{"command_packet" LINK "dopus/modules.h/File" 185}   @{"delfile_packet" LINK "dopus/modules.h/File" 135}
  16. @{"DOpusScreenData" LINK "dopus/modules.h/File" 173}  @{"endentry_packet" LINK "dopus/modules.h/File" 120}  @{"function_entry" LINK "dopus/modules.h/File" 94}
  17. @{"loadfile_packet" LINK "dopus/modules.h/File" 143}  @{"path_node" LINK "dopus/modules.h/File" 103}        @{"replacereq_packet" LINK "dopus/modules.h/File" 155}
  18.  
  19.  
  20. @{b}Typedefs@{ub}
  21.  
  22. @{"ModuleFunction" LINK "dopus/modules.h/File" 16}  @{"ModuleInfo" LINK "dopus/modules.h/File" 41}
  23.  
  24.  
  25. @{b}#defines@{ub}
  26.  
  27. @{"COMMANDF_RESULT" LINK "dopus/modules.h/File" 193}         @{"EXT_FUNC()" LINK "dopus/modules.h/File" 202}
  28. @{"EXTCMD_ADD_FILE" LINK "dopus/modules.h/File" 79}         @{"EXTCMD_CHECK_ABORT" LINK "dopus/modules.h/File" 73}
  29. @{"EXTCMD_DEL_FILE" LINK "dopus/modules.h/File" 88}         @{"EXTCMD_DO_CHANGES" LINK "dopus/modules.h/File" 89}
  30. @{"EXTCMD_END_DEST" LINK "dopus/modules.h/File" 78}         @{"EXTCMD_END_ENTRY" LINK "dopus/modules.h/File" 71}
  31. @{"EXTCMD_END_SOURCE" LINK "dopus/modules.h/File" 77}       @{"EXTCMD_ENTRY_COUNT" LINK "dopus/modules.h/File" 74}
  32. @{"EXTCMD_FREE_SCREENDATA" LINK "dopus/modules.h/File" 86}  @{"EXTCMD_GET_DEST" LINK "dopus/modules.h/File" 76}
  33. @{"EXTCMD_GET_ENTRY" LINK "dopus/modules.h/File" 70}        @{"EXTCMD_GET_HELP" LINK "dopus/modules.h/File" 80}
  34. @{"EXTCMD_GET_PORT" LINK "dopus/modules.h/File" 81}         @{"EXTCMD_GET_SCREEN" LINK "dopus/modules.h/File" 82}
  35. @{"EXTCMD_GET_SCREENDATA" LINK "dopus/modules.h/File" 85}   @{"EXTCMD_GET_SOURCE" LINK "dopus/modules.h/File" 67}
  36. @{"EXTCMD_GET_WINDOW" LINK "dopus/modules.h/File" 75}       @{"EXTCMD_LOAD_FILE" LINK "dopus/modules.h/File" 90}
  37. @{"EXTCMD_NEXT_SOURCE" LINK "dopus/modules.h/File" 68}      @{"EXTCMD_RELOAD_ENTRY" LINK "dopus/modules.h/File" 72}
  38. @{"EXTCMD_REMOVE_ENTRY" LINK "dopus/modules.h/File" 84}     @{"EXTCMD_REPLACE_REQ" LINK "dopus/modules.h/File" 83}
  39. @{"EXTCMD_SEND_COMMAND" LINK "dopus/modules.h/File" 87}     @{"EXTCMD_UNLOCK_SOURCE" LINK "dopus/modules.h/File" 69}
  40. @{"FUNCF_CAN_DO_ICONS" LINK "dopus/modules.h/File" 31}      @{"FUNCF_NEED_DEST" LINK "dopus/modules.h/File" 27}
  41. @{"FUNCF_NEED_DIRS" LINK "dopus/modules.h/File" 29}         @{"FUNCF_NEED_ENTRIES" LINK "dopus/modules.h/File" 30}
  42. @{"FUNCF_NEED_FILES" LINK "dopus/modules.h/File" 28}        @{"FUNCF_NEED_SOURCE" LINK "dopus/modules.h/File" 26}
  43. @{"FUNCF_PRIVATE" LINK "dopus/modules.h/File" 37}           @{"FUNCF_SINGLE_DEST" LINK "dopus/modules.h/File" 33}
  44. @{"FUNCF_SINGLE_SOURCE" LINK "dopus/modules.h/File" 32}     @{"FUNCF_WANT_DEST" LINK "dopus/modules.h/File" 34}
  45. @{"FUNCF_WANT_ENTRIES" LINK "dopus/modules.h/File" 36}      @{"FUNCF_WANT_SOURCE" LINK "dopus/modules.h/File" 35}
  46. @{"FUNCID_STARTUP" LINK "dopus/modules.h/File" 64}          @{"IDCMP_FUNC()" LINK "dopus/modules.h/File" 205}
  47. @{"LFF_ICON" LINK "dopus/modules.h/File" 151}                @{"MODULEF_CALL_STARTUP" LINK "dopus/modules.h/File" 60}
  48. @{"MODULEF_STARTUP_SYNC" LINK "dopus/modules.h/File" 61}    @{"REPLACE_ABORT" LINK "dopus/modules.h/File" 166}
  49. @{"REPLACE_LEAVE" LINK "dopus/modules.h/File" 167}           @{"REPLACE_REPLACE" LINK "dopus/modules.h/File" 168}
  50. @{"REPLACEF_ALL" LINK "dopus/modules.h/File" 169}            @{"TYPE_EXT()" LINK "dopus/modules.h/File" 203}
  51.  
  52. @ENDNODE
  53. @NODE File "dopus/modules.h"
  54. #ifndef _DOPUS_MODULES
  55. #define _DOPUS_MODULES
  56.  
  57. /****************************************************************************
  58.  
  59.  Support file for DOpus modules
  60.  
  61.  ****************************************************************************/
  62.  
  63. #ifndef _DOPUSBASE
  64. #include <@{"dopus/dopusbase.h" LINK "dopus/dopusbase.h/File"}>
  65. #endif
  66.  
  67.  
  68. // Defines a function in a module
  69. typedef struct
  70.         ULONG   id;             // Function ID code
  71.         char    *name;          // Function name
  72.         ULONG   desc;           // Locale string ID for function description
  73.         ULONG   flags;          // Function flags
  74.         char    *template;      // Command template
  75. } ModuleFunction;
  76.  
  77. // Function flags
  78. #define FUNCF_NEED_SOURCE               (1<<0)  // Needs a source directory
  79. #define FUNCF_NEED_DEST                 (1<<1)  // Needs a destination directory
  80. #define FUNCF_NEED_FILES                (1<<2)  // Needs some files to work with
  81. #define FUNCF_NEED_DIRS                 (1<<3)  // Needs some files to work with
  82. #define FUNCF_NEED_ENTRIES      (@{"FUNCF_NEED_FILES" LINK File 28}|@{"FUNCF_NEED_DIRS" LINK File 29})
  83. #define FUNCF_CAN_DO_ICONS              (1<<6)  // Function can do icons
  84. #define FUNCF_SINGLE_SOURCE             (1<<8)  // Only a single source needed
  85. #define FUNCF_SINGLE_DEST               (1<<9)  // Only a single destination needed
  86. #define FUNCF_WANT_DEST                 (1<<11) // Want destinations, don't need them
  87. #define FUNCF_WANT_SOURCE               (1<<12) // Want source, don't need it
  88. #define FUNCF_WANT_ENTRIES              (1<<19) // Want entries
  89. #define FUNCF_PRIVATE                   (1<<26) // Function is private
  90.  
  91.  
  92. // Defines all the functions in a module
  93. typedef struct
  94.         ULONG           ver;            // Module version
  95.         char            *name;          // Module name
  96.         char            *locale_name;   // Catalog name
  97.         ULONG           flags;          // Module flags
  98.         ULONG           function_count; // Number of functions in module
  99.         @{"ModuleFunction" LINK File 16}  function[1];    // Definition of first function
  100. } ModuleInfo;
  101.  
  102.  
  103. /*** If the module has more than one function, the additional @{"ModuleFunction" LINK File 16}
  104.      structures MUST follow the @{"ModuleInfo" LINK File 41} structure in memory. Eg,
  105.  
  106.      @{"ModuleInfo" LINK File 41} module_info={....};
  107.      @{"ModuleFunction" LINK File 16} more_funcs[2]={{...},{...}};                           ***/
  108.  
  109.  
  110. // Flags for @{"ModuleInfo" LINK File 41}
  111. #define MODULEF_CALL_STARTUP            (1<<0)  // Call ModuleEntry() on startup
  112. #define MODULEF_STARTUP_SYNC            (1<<1)  // Run Synchronously on startup
  113.  
  114. // ID passed to Module_Entry() if module is run on startup
  115. #define FUNCID_STARTUP                  0xffffffff
  116.  
  117. // Callback commands
  118. #define EXTCMD_GET_SOURCE       0       // Get current source path
  119. #define EXTCMD_NEXT_SOURCE      1       // Get next source path
  120. #define EXTCMD_UNLOCK_SOURCE    2       // Unlock source paths
  121. #define EXTCMD_GET_ENTRY        3       // Get entry
  122. #define EXTCMD_END_ENTRY        4       // End entry
  123. #define EXTCMD_RELOAD_ENTRY     5       // Reload entry
  124. #define EXTCMD_CHECK_ABORT      9       // Check abort status
  125. #define EXTCMD_ENTRY_COUNT      10      // Get entry count
  126. #define EXTCMD_GET_WINDOW       11      // Get window handle
  127. #define EXTCMD_GET_DEST         12      // Get next destination
  128. #define EXTCMD_END_SOURCE       13      // Cleanup current source path
  129. #define EXTCMD_END_DEST         14      // Cleanup current destination path
  130. #define EXTCMD_ADD_FILE         16      // Add a file to a lister
  131. #define EXTCMD_GET_HELP         17      // Get help on a topic
  132. #define EXTCMD_GET_PORT         18      // Get ARexx port name
  133. #define EXTCMD_GET_SCREEN       19      // Get public screen name
  134. #define EXTCMD_REPLACE_REQ      20      // Show exists/replace? requester
  135. #define EXTCMD_REMOVE_ENTRY     21      // Mark an entry for removal
  136. #define EXTCMD_GET_SCREENDATA   22      // Get DOpus screen data
  137. #define EXTCMD_FREE_SCREENDATA  23      // Free screen data
  138. #define EXTCMD_SEND_COMMAND     30      // Send a command to DOpus
  139. #define EXTCMD_DEL_FILE         31      // Delete a file from a lister
  140. #define EXTCMD_DO_CHANGES       32      // Perform changes
  141. #define EXTCMD_LOAD_FILE        33      // Load files to listers
  142.  
  143.  
  144. // Structures used with callback commands
  145. struct function_entry
  146. {
  147.         ULONG                   pad[2];
  148.         char                    *name;  // File name
  149.         APTR                    entry;  // Entry pointer (don't touch!)
  150.         short                   type;   // Type of file
  151.         short                   flags;  // File flags
  152. };
  153.  
  154. struct path_node
  155. {
  156.         ULONG                   pad[2];
  157.         char                    buffer[512];    // Contains path string
  158.         char                    *path;          // Points to path string
  159.         APTR                    lister;         // Lister pointer
  160.         ULONG                   flags;          // Flags
  161. };
  162.  
  163.  
  164. /****************************************************************************
  165.  
  166.  Packets used to send commands
  167.  
  168.  ****************************************************************************/
  169.  
  170. // @{"EXTCMD_END_ENTRY" LINK File 71}
  171. struct endentry_packet
  172. {
  173.         @{"struct function_entry" LINK File 94}   *entry;         // Entry pointer
  174.         BOOL                    deselect;       // TRUE to deselect entry
  175. };
  176.  
  177. // @{"EXTCMD_ADD_FILE" LINK File 79}
  178. struct addfile_packet
  179. {
  180.         char                    *path;          // Path to add file to
  181.         struct FileInfoBlock    *fib;           // FileInfoBlock to add
  182.         struct ListerWindow     *lister;        // Lister pointer
  183. };
  184.  
  185. // @{"EXTCMD_DEL_FILE" LINK File 88}
  186. struct delfile_packet
  187. {
  188.         char                    *path;          // Path to delete file from
  189.         char                    *name;          // Name of file to delete
  190.         struct ListerWindow     *lister;        // Lister pointer
  191. };
  192.  
  193. // @{"EXTCMD_LOAD_FILE" LINK File 90}
  194. struct loadfile_packet
  195. {
  196.         char                    *path;          // Path of file
  197.         char                    *name;          // File name
  198.         short                   flags;          // Flags field
  199.         short                   reload;         // TRUE to reload existing file
  200. };
  201.  
  202. #define LFF_ICON                (1<<0)
  203.  
  204.  
  205. // @{"EXTCMD_REPLACE_REQ" LINK File 83}
  206. struct replacereq_packet
  207. {
  208.         struct Window           *window;        // Window to open over
  209.         struct Screen           *screen;        // Screen to open on
  210.         @{"IPCData" LINK "dopus/ipc.h/File" 24}                 *ipc;           // Your process IPC pointer
  211.         struct FileInfoBlock    *file1;         // First file
  212.         struct FileInfoBlock    *file2;         // Second file
  213.         short                   flags;          // Flags
  214. };
  215.  
  216. // Result code from @{"EXTCMD_REPLACE_REQ" LINK File 83}
  217. #define REPLACE_ABORT           -1
  218. #define REPLACE_LEAVE           0
  219. #define REPLACE_REPLACE         1
  220. #define REPLACEF_ALL            (1<<1)
  221.  
  222.  
  223. // @{"EXTCMD_GET_SCREENDATA" LINK File 85}
  224. struct DOpusScreenData
  225. {
  226.         struct Screen           *screen;        // Screen pointer
  227.         struct DrawInfo         *draw_info;     // DrawInfo pointer
  228.         unsigned short          depth;          // Screen depth
  229.         unsigned short          pen_alloc;      // Mask of allocated pens
  230.         unsigned short          pen_array[16];  // Pen array
  231.         short                   pen_count;      // Number of pens
  232. };
  233.  
  234.  
  235. // @{"EXTCMD_SEND_COMMAND" LINK File 87}
  236. struct command_packet
  237. {
  238.         char                    *command;       // Command to send
  239.         ULONG                   flags;          // Command flags
  240.         char                    *result;        // Will point to result string
  241.         ULONG                   rc;             // Return code
  242. };
  243.  
  244. #define COMMANDF_RESULT         (1<<0)
  245.  
  246.  
  247. // Prototype for the callback hook
  248. ULONG __asm __saveds function_external_hook(
  249.         register __d0 ULONG command,
  250.         register __a0 APTR handle,
  251.         register __a1 APTR packet);
  252.  
  253. #define EXT_FUNC(name)  unsigned long __asm (*name)(register __d0 ULONG,register __a0 APTR,register __a1 APTR)
  254. #define TYPE_EXT(var)   (unsigned long (*)())var
  255.  
  256. #define IDCMP_FUNC(name)        unsigned long __asm (*name)(register __d0 ULONG,register __a0 struct IntuiMessage *)
  257.  
  258.  
  259.  
  260. /**** Define this if you are using the standard modinit.o code ****/
  261. #ifdef _DOPUS_MODULE_DEF
  262.  
  263. // These library bases are defined and made available automatically
  264. extern struct Library *DOSBase;
  265. extern struct Library *DOpusBase;
  266. extern struct Library *IntuitionBase;
  267. extern struct Library *GfxBase;
  268. extern struct Library *IconBase;
  269. extern struct Library *UtilityBase;
  270. extern struct Library *LayersBase;
  271. extern struct Library *GadToolsBase;
  272. extern struct Library *AslBase;
  273. extern struct Library *DiskfontBase;
  274. extern struct Library *RexxSysBase;
  275. extern struct Library *TimerBase;
  276. extern struct Library *LocaleBase;
  277. extern struct Library *WorkbenchBase;
  278.  
  279. // Global pointer to a module's locale information
  280. extern @{"struct DOpusLocale" LINK "dopus/locale.h/File" 11} *locale;
  281. void init_locale_data(@{"struct DOpusLocale" LINK "dopus/locale.h/File" 11} *);
  282.  
  283. // You MUST define the @{"ModuleInfo" LINK File 41} structure yourself
  284. extern @{"ModuleInfo" LINK File 41} module_info;
  285.  
  286. #endif
  287.  
  288. #endif
  289. @ENDNODE
  290.