home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Developers / MW MPW Binaries 1.1.1a2 / mwcPPC / MWCIncludes / Components.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-31  |  12.9 KB  |  389 lines  |  [TEXT/MMCC]

  1. /*
  2.     File:        Components.h
  3.  
  4.     Copyright:    © 1984-1993 by Apple Computer, Inc., all rights reserved.
  5.  
  6.     WARNING
  7.     This file was auto generated by the interfacer tool. Modifications
  8.     must be made to the master file.
  9.  
  10. */
  11.  
  12. #ifndef __COMPONENTS__
  13. #define __COMPONENTS__
  14.  
  15. #ifndef __TYPES__
  16. #include <Types.h>
  17. /*    #include <ConditionalMacros.h>                                */
  18. /*    #include <MixedMode.h>                                        */
  19. /*        #include <Traps.h>                                        */
  20. #endif
  21.  
  22. #ifndef __MIXEDMODE__
  23. #endif
  24.  
  25. #define kAppleManufacturer 'appl'
  26.  
  27. #define kComponentResourceType 'thng'
  28.  
  29. enum  {
  30.     kAnyComponentType            = 0,
  31.     kAnyComponentSubType        = 0,
  32.     kAnyComponentManufacturer    = 0,
  33.     kAnyComponentFlagsMask        = 0
  34. };
  35.  
  36. enum  {
  37.     cmpWantsRegisterMessage        = 1L << 31
  38. };
  39.  
  40. enum  {
  41.     kComponentOpenSelect        = -1,                            /* ComponentInstance for this open */
  42.     kComponentCloseSelect        = -2,                            /* ComponentInstance for this close */
  43.     kComponentCanDoSelect        = -3,                            /* selector # being queried */
  44.     kComponentVersionSelect        = -4,                            /* no params */
  45.     kComponentRegisterSelect    = -5,                            /* no params */
  46.     kComponentTargetSelect        = -6,                            /* ComponentInstance for top of call chain */
  47.     kComponentUnregisterSelect    = -7                            /* no params */
  48. };
  49.  
  50.  
  51. /* Component Resource Extension flags */
  52.  
  53. enum  {
  54.     componentDoAutoVersion        = (1 << 0),
  55.     componentWantsUnregister    = (1 << 1),
  56.     componentAutoVersionIncludeFlags = (1 << 2),
  57.     componentHasMultiplePlatforms = (1 << 3)
  58. };
  59.  
  60.  
  61. /* Set Default Component flags */
  62.  
  63. enum  {
  64.     defaultComponentIdentical    = 0,
  65.     defaultComponentAnyFlags    = 1,
  66.     defaultComponentAnyManufacturer = 2,
  67.     defaultComponentAnySubType    = 4,
  68.     defaultComponentAnyFlagsAnyManufacturer = (defaultComponentAnyFlags + defaultComponentAnyManufacturer),
  69.     defaultComponentAnyFlagsAnyManufacturerAnySubType = (defaultComponentAnyFlags + defaultComponentAnyManufacturer + defaultComponentAnySubType)
  70. };
  71.  
  72. #if defined(powerc) || defined (__powerc)
  73. #pragma options align=mac68k
  74. #endif
  75. struct ComponentDescription {
  76.     OSType                        componentType;                    /* A unique 4-byte code indentifying the command set */
  77.     OSType                        componentSubType;                /* Particular flavor of this instance */
  78.     OSType                        componentManufacturer;            /* Vendor indentification */
  79.     unsigned long                componentFlags;                    /* 8 each for Component,Type,SubType,Manuf/revision */
  80.     unsigned long                componentFlagsMask;                /* Mask for specifying which flags to consider in search, zero during registration */
  81. };
  82. #if defined(powerc) || defined(__powerc)
  83. #pragma options align=reset
  84. #endif
  85.  
  86. typedef struct ComponentDescription ComponentDescription;
  87.  
  88. #if defined(powerc) || defined (__powerc)
  89. #pragma options align=mac68k
  90. #endif
  91. struct ResourceSpec {
  92.     OSType                        resType;                        /* 4-byte code  */
  93.     short                        resId;
  94. };
  95. #if defined(powerc) || defined(__powerc)
  96. #pragma options align=reset
  97. #endif
  98.  
  99. typedef struct ResourceSpec ResourceSpec;
  100.  
  101. #if defined(powerc) || defined (__powerc)
  102. #pragma options align=mac68k
  103. #endif
  104. struct ComponentResource {
  105.     ComponentDescription        cd;                                /* Registration parameters */
  106.     ResourceSpec                component;                        /* resource where Component code is found */
  107.     ResourceSpec                componentName;                    /* name string resource */
  108.     ResourceSpec                componentInfo;                    /* info string resource */
  109.     ResourceSpec                componentIcon;                    /* icon resource */
  110. };
  111. #if defined(powerc) || defined(__powerc)
  112. #pragma options align=reset
  113. #endif
  114.  
  115. typedef struct ComponentResource ComponentResource;
  116.  
  117. typedef ComponentResource *ComponentResourcePtr, **ComponentResourceHandle;
  118.  
  119. #if defined(powerc) || defined (__powerc)
  120. #pragma options align=mac68k
  121. #endif
  122. struct ComponentPlatformInfo {
  123.     long                        componentFlags;                    /* flags of Component */
  124.     ResourceSpec                component;                        /* resource where Component code is found */
  125.     short                        platformType;                    /* gestaltSysArchitecture result */
  126. };
  127. #if defined(powerc) || defined(__powerc)
  128. #pragma options align=reset
  129. #endif
  130.  
  131. typedef struct ComponentPlatformInfo ComponentPlatformInfo;
  132.  
  133. #if defined(powerc) || defined (__powerc)
  134. #pragma options align=mac68k
  135. #endif
  136. struct ComponentResourceExtension {
  137.     long                        componentVersion;                /* version of Component */
  138.     long                        componentRegisterFlags;            /* flags for registration */
  139.     short                        componentIconFamily;            /* resource id of Icon Family */
  140. };
  141. #if defined(powerc) || defined(__powerc)
  142. #pragma options align=reset
  143. #endif
  144.  
  145. typedef struct ComponentResourceExtension ComponentResourceExtension;
  146.  
  147. #if defined(powerc) || defined (__powerc)
  148. #pragma options align=mac68k
  149. #endif
  150. struct ComponentPlatformInfoArray {
  151.     long                        count;
  152.     ComponentPlatformInfo        platformArray[1];
  153. };
  154. #if defined(powerc) || defined(__powerc)
  155. #pragma options align=reset
  156. #endif
  157.  
  158. typedef struct ComponentPlatformInfoArray ComponentPlatformInfoArray;
  159.  
  160. #if defined(powerc) || defined (__powerc)
  161. #pragma options align=mac68k
  162. #endif
  163. struct ExtComponentResource {
  164.     ComponentDescription        cd;                                /* registration parameters */
  165.     ResourceSpec                component;                        /* resource where Component code is found */
  166.     ResourceSpec                componentName;                    /* name string resource */
  167.     ResourceSpec                componentInfo;                    /* info string resource */
  168.     ResourceSpec                componentIcon;                    /* icon resource */
  169.     long                        componentVersion;                /* version of Component */
  170.     long                        componentRegisterFlags;            /* flags for registration */
  171.     short                        componentIconFamily;            /* resource id of Icon Family */
  172.     long                        count;                            /* elements in platformArray */
  173.     ComponentPlatformInfo        platformArray[1];
  174. };
  175. #if defined(powerc) || defined(__powerc)
  176. #pragma options align=reset
  177. #endif
  178.  
  179. typedef struct ExtComponentResource ExtComponentResource;
  180.  
  181. #if defined(powerc) || defined (__powerc)
  182. #pragma options align=mac68k
  183. #endif
  184. struct ComponentParameters {
  185.     unsigned char                flags;                            /* call modifiers: sync/async, deferred, immed, etc */
  186.     unsigned char                paramSize;                        /* size in bytes of actual parameters passed to this call */
  187.     short                        what;                            /* routine selector, negative for Component management calls */
  188.     long                        params[1];                        /* actual parameters for the indicated routine */
  189. };
  190. #if defined(powerc) || defined(__powerc)
  191. #pragma options align=reset
  192. #endif
  193.  
  194. typedef struct ComponentParameters ComponentParameters;
  195.  
  196. #if defined(powerc) || defined (__powerc)
  197. #pragma options align=mac68k
  198. #endif
  199. struct ComponentRecord {
  200.     long                        data[1];
  201. };
  202. #if defined(powerc) || defined(__powerc)
  203. #pragma options align=reset
  204. #endif
  205.  
  206. typedef struct ComponentRecord ComponentRecord;
  207.  
  208. typedef ComponentRecord *Component;
  209.  
  210. #if defined(powerc) || defined (__powerc)
  211. #pragma options align=mac68k
  212. #endif
  213. struct ComponentInstanceRecord {
  214.     long                        data[1];
  215. };
  216. #if defined(powerc) || defined(__powerc)
  217. #pragma options align=reset
  218. #endif
  219.  
  220. typedef struct ComponentInstanceRecord ComponentInstanceRecord;
  221.  
  222. typedef ComponentInstanceRecord *ComponentInstance;
  223.  
  224. typedef long ComponentResult;
  225.  
  226. typedef pascal ComponentResult (*ComponentRoutineProcPtr)(ComponentParameters *cp, Handle componentStorage);
  227.  
  228. enum {
  229.     uppComponentRoutineProcInfo = kPascalStackBased
  230.          | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
  231.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ComponentParameters*)))
  232.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Handle)))
  233. };
  234.  
  235. #if USESROUTINEDESCRIPTORS
  236. typedef UniversalProcPtr ComponentRoutineUPP;
  237.  
  238. #define CallComponentRoutineProc(userRoutine, cp, componentStorage)        \
  239.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppComponentRoutineProcInfo, (cp), (componentStorage))
  240. #define NewComponentRoutineProc(userRoutine)        \
  241.         (ComponentRoutineUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppComponentRoutineProcInfo, GetCurrentISA())
  242. #else
  243. typedef ComponentRoutineProcPtr ComponentRoutineUPP;
  244.  
  245. #define CallComponentRoutineProc(userRoutine, cp, componentStorage)        \
  246.         (*(userRoutine))((cp), (componentStorage))
  247. #define NewComponentRoutineProc(userRoutine)        \
  248.         (ComponentRoutineUPP)(userRoutine)
  249. #endif
  250.  
  251. typedef ComponentRoutineProcPtr ComponentRoutine;
  252.  
  253.  
  254. /*
  255.     The parameter list for each ComponentFunction is unique. It is 
  256.     therefore up to users to create the appropriate procInfo for their 
  257.     own ComponentFunctions where necessary.
  258. */
  259.  
  260. typedef UniversalProcPtr ComponentFunctionUPP;
  261.  
  262. #if USES68KINLINES
  263. #define ComponentCallNow(callNumber, paramSize)  \
  264.     = {0x2F3C,paramSize,callNumber,0x7000,0xA82A}
  265.  
  266. #else
  267. #define ComponentCallNow(callNumber, paramSize)
  268.  
  269. extern UniversalProcPtr CallComponentUPP;
  270.  
  271. #endif
  272.  
  273. #ifdef __cplusplus
  274. extern "C" {
  275. #endif
  276.  
  277.  
  278. /********************************************************
  279.  * Component Database Add, Delete, and Query Routines
  280.  ********************************************************/
  281.  
  282. extern pascal Component RegisterComponent(ComponentDescription *cd, ComponentRoutineUPP componentEntryPoint, short global, Handle componentName, Handle componentInfo, Handle componentIcon)
  283.  TWOWORDINLINE(0x7001, 0xA82A);
  284. extern pascal Component RegisterComponentResource(ComponentResourceHandle tr, short global)
  285.  TWOWORDINLINE(0x7012, 0xA82A);
  286. extern pascal OSErr UnregisterComponent(Component aComponent)
  287.  TWOWORDINLINE(0x7002, 0xA82A);
  288. extern pascal Component FindNextComponent(Component aComponent, ComponentDescription *looking)
  289.  TWOWORDINLINE(0x7004, 0xA82A);
  290. extern pascal long CountComponents(ComponentDescription *looking)
  291.  TWOWORDINLINE(0x7003, 0xA82A);
  292. extern pascal OSErr GetComponentInfo(Component aComponent, ComponentDescription *cd, Handle componentName, Handle componentInfo, Handle componentIcon)
  293.  TWOWORDINLINE(0x7005, 0xA82A);
  294. extern pascal long GetComponentListModSeed(void)
  295.  TWOWORDINLINE(0x7006, 0xA82A);
  296.  
  297. /********************************************************
  298.  * Component Instance Allocation and dispatch routines
  299.  ********************************************************/
  300.  
  301. extern pascal ComponentInstance OpenComponent(Component aComponent)
  302.  TWOWORDINLINE(0x7007, 0xA82A);
  303. extern pascal OSErr CloseComponent(ComponentInstance aComponentInstance)
  304.  TWOWORDINLINE(0x7008, 0xA82A);
  305. extern pascal OSErr GetComponentInstanceError(ComponentInstance aComponentInstance)
  306.  TWOWORDINLINE(0x700A, 0xA82A);
  307.  
  308. /* Direct calls to the Components */
  309.  
  310. extern pascal long ComponentFunctionImplemented(ComponentInstance ci, short ftnNumber)
  311.  FIVEWORDINLINE(0x2F3C, 0x2, 0xFFFD, 0x7000, 0xA82A);
  312. extern pascal long GetComponentVersion(ComponentInstance ci)
  313.  FIVEWORDINLINE(0x2F3C, 0x0, 0xFFFC, 0x7000, 0xA82A);
  314. extern pascal long ComponentSetTarget(ComponentInstance ci, ComponentInstance target)
  315.  FIVEWORDINLINE(0x2F3C, 0x4, 0xFFFA, 0x7000, 0xA82A);
  316. #ifdef __cplusplus
  317. }
  318. #endif
  319.  
  320. #ifdef __cplusplus
  321. extern "C" {
  322. #endif
  323.  
  324.  
  325. /********************************************************
  326.  * Component Management routines
  327.  ********************************************************/
  328.  
  329. extern pascal void SetComponentInstanceError(ComponentInstance aComponentInstance, OSErr theError)
  330.  TWOWORDINLINE(0x700B, 0xA82A);
  331. extern pascal long GetComponentRefcon(Component aComponent)
  332.  TWOWORDINLINE(0x7010, 0xA82A);
  333. extern pascal void SetComponentRefcon(Component aComponent, long theRefcon)
  334.  TWOWORDINLINE(0x7011, 0xA82A);
  335. extern pascal short OpenComponentResFile(Component aComponent)
  336.  TWOWORDINLINE(0x7015, 0xA82A);
  337. extern pascal OSErr CloseComponentResFile(short refnum)
  338.  TWOWORDINLINE(0x7018, 0xA82A);
  339.  
  340. /********************************************************
  341.  * Component Instance Management routines
  342.  ********************************************************/
  343.  
  344. extern pascal Handle GetComponentInstanceStorage(ComponentInstance aComponentInstance)
  345.  TWOWORDINLINE(0x700C, 0xA82A);
  346. extern pascal void SetComponentInstanceStorage(ComponentInstance aComponentInstance, Handle theStorage)
  347.  TWOWORDINLINE(0x700D, 0xA82A);
  348. extern pascal long GetComponentInstanceA5(ComponentInstance aComponentInstance)
  349.  TWOWORDINLINE(0x700E, 0xA82A);
  350. extern pascal void SetComponentInstanceA5(ComponentInstance aComponentInstance, long theA5)
  351.  TWOWORDINLINE(0x700F, 0xA82A);
  352. extern pascal long CountComponentInstances(Component aComponent)
  353.  TWOWORDINLINE(0x7013, 0xA82A);
  354.  
  355. /* Useful helper routines for convenient method dispatching */
  356.  
  357. extern pascal long CallComponentFunction(ComponentParameters *params, ComponentFunctionUPP func)
  358.  TWOWORDINLINE(0x70FF, 0xA82A);
  359. extern pascal long CallComponentFunctionWithStorage(Handle storage, ComponentParameters *params, ComponentFunctionUPP func)
  360.  TWOWORDINLINE(0x70FF, 0xA82A);
  361. extern pascal long DelegateComponentCall(ComponentParameters *originalParams, ComponentInstance ci)
  362.  TWOWORDINLINE(0x7024, 0xA82A);
  363. #ifdef __cplusplus
  364. }
  365. #endif
  366.  
  367. #ifdef __cplusplus
  368. extern "C" {
  369. #endif
  370.  
  371. extern pascal OSErr SetDefaultComponent(Component aComponent, short flags)
  372.  TWOWORDINLINE(0x701E, 0xA82A);
  373. extern pascal ComponentInstance OpenDefaultComponent(OSType componentType, OSType componentSubType)
  374.  TWOWORDINLINE(0x7021, 0xA82A);
  375. extern pascal Component CaptureComponent(Component capturedComponent, Component capturingComponent)
  376.  TWOWORDINLINE(0x701C, 0xA82A);
  377. extern pascal OSErr UncaptureComponent(Component aComponent)
  378.  TWOWORDINLINE(0x701D, 0xA82A);
  379. extern pascal long RegisterComponentResourceFile(short resRefNum, short global)
  380.  TWOWORDINLINE(0x7014, 0xA82A);
  381. extern pascal OSErr GetComponentIconSuite(Component aComponent, Handle *iconSuite)
  382.  TWOWORDINLINE(0x7029, 0xA82A);
  383. #ifdef __cplusplus
  384. }
  385. #endif
  386.  
  387. #endif
  388.  
  389.