Components.h
上传用户:xjjlds
上传日期:2015-12-05
资源大小:22823k
文件大小:33k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       Components.h
  3.  
  4.      Contains:   QuickTime Interfaces.
  5.  
  6.      Version:    Technology: QuickTime 6.0
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1990-2001 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:      For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __COMPONENTS__
  18. #define __COMPONENTS__
  19. #ifndef __MACERRORS__
  20. #include "MacErrors.h"
  21. #endif
  22. #ifndef __MACTYPES__
  23. #include "MacTypes.h"
  24. #endif
  25. #ifndef __MIXEDMODE__
  26. #include "MixedMode.h"
  27. #endif
  28. #if PRAGMA_ONCE
  29. #pragma once
  30. #endif
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. #if PRAGMA_IMPORT
  35. #pragma import on
  36. #endif
  37. #if PRAGMA_STRUCT_ALIGN
  38.     #pragma options align=mac68k
  39. #elif PRAGMA_STRUCT_PACKPUSH
  40.     #pragma pack(push, 2)
  41. #elif PRAGMA_STRUCT_PACK
  42.     #pragma pack(2)
  43. #endif
  44. enum {
  45.     kAppleManufacturer          = FOUR_CHAR_CODE('appl'),       /* Apple supplied components */
  46.     kComponentResourceType      = FOUR_CHAR_CODE('thng'),       /* a components resource type */
  47.     kComponentAliasResourceType = FOUR_CHAR_CODE('thga')        /* component alias resource type */
  48. };
  49. enum {
  50.     kAnyComponentType           = 0,
  51.     kAnyComponentSubType        = 0,
  52.     kAnyComponentManufacturer   = 0,
  53.     kAnyComponentFlagsMask      = 0
  54. };
  55. enum {
  56.     cmpIsMissing                = 1L << 29,
  57.     cmpWantsRegisterMessage     = 1L << 31
  58. };
  59. enum {
  60.     kComponentOpenSelect        = -1,                           /* ComponentInstance for this open */
  61.     kComponentCloseSelect       = -2,                           /* ComponentInstance for this close */
  62.     kComponentCanDoSelect       = -3,                           /* selector # being queried */
  63.     kComponentVersionSelect     = -4,                           /* no params */
  64.     kComponentRegisterSelect    = -5,                           /* no params */
  65.     kComponentTargetSelect      = -6,                           /* ComponentInstance for top of call chain */
  66.     kComponentUnregisterSelect  = -7,                           /* no params */
  67.     kComponentGetMPWorkFunctionSelect = -8,                     /* some params */
  68.     kComponentExecuteWiredActionSelect = -9,                    /* QTAtomContainer actionContainer, QTAtom actionAtom, QTCustomActionTargetPtr target, QTEventRecordPtr event */
  69.     kComponentGetPublicResourceSelect = -10                     /* OSType resourceType, short resourceId, Handle *resource */
  70. };
  71. /* Component Resource Extension flags */
  72. enum {
  73.     componentDoAutoVersion      = (1 << 0),
  74.     componentWantsUnregister    = (1 << 1),
  75.     componentAutoVersionIncludeFlags = (1 << 2),
  76.     componentHasMultiplePlatforms = (1 << 3),
  77.     componentLoadResident       = (1 << 4)
  78. };
  79. /* Set Default Component flags */
  80. enum {
  81.     defaultComponentIdentical   = 0,
  82.     defaultComponentAnyFlags    = 1,
  83.     defaultComponentAnyManufacturer = 2,
  84.     defaultComponentAnySubType  = 4,
  85.     defaultComponentAnyFlagsAnyManufacturer = (defaultComponentAnyFlags + defaultComponentAnyManufacturer),
  86.     defaultComponentAnyFlagsAnyManufacturerAnySubType = (defaultComponentAnyFlags + defaultComponentAnyManufacturer + defaultComponentAnySubType)
  87. };
  88. /* RegisterComponentResource flags */
  89. enum {
  90.     registerComponentGlobal     = 1,
  91.     registerComponentNoDuplicates = 2,
  92.     registerComponentAfterExisting = 4,
  93.     registerComponentAliasesOnly = 8
  94. };
  95. struct ComponentDescription {
  96.     OSType                          componentType;              /* A unique 4-byte code indentifying the command set */
  97.     OSType                          componentSubType;           /* Particular flavor of this instance */
  98.     OSType                          componentManufacturer;      /* Vendor indentification */
  99.     unsigned long                   componentFlags;             /* 8 each for Component,Type,SubType,Manuf/revision */
  100.     unsigned long                   componentFlagsMask;         /* Mask for specifying which flags to consider in search, zero during registration */
  101. };
  102. typedef struct ComponentDescription     ComponentDescription;
  103. struct ResourceSpec {
  104.     OSType                          resType;                    /* 4-byte code    */
  105.     short                           resID;                      /*         */
  106. };
  107. typedef struct ResourceSpec             ResourceSpec;
  108. struct ComponentResource {
  109.     ComponentDescription            cd;                         /* Registration parameters */
  110.     ResourceSpec                    component;                  /* resource where Component code is found */
  111.     ResourceSpec                    componentName;              /* name string resource */
  112.     ResourceSpec                    componentInfo;              /* info string resource */
  113.     ResourceSpec                    componentIcon;              /* icon resource */
  114. };
  115. typedef struct ComponentResource        ComponentResource;
  116. typedef ComponentResource *             ComponentResourcePtr;
  117. typedef ComponentResourcePtr *          ComponentResourceHandle;
  118. struct ComponentPlatformInfo {
  119.     long                            componentFlags;             /* flags of Component */
  120.     ResourceSpec                    component;                  /* resource where Component code is found */
  121.     short                           platformType;               /* gestaltSysArchitecture result */
  122. };
  123. typedef struct ComponentPlatformInfo    ComponentPlatformInfo;
  124. struct ComponentResourceExtension {
  125.     long                            componentVersion;           /* version of Component */
  126.     long                            componentRegisterFlags;     /* flags for registration */
  127.     short                           componentIconFamily;        /* resource id of Icon Family */
  128. };
  129. typedef struct ComponentResourceExtension ComponentResourceExtension;
  130. struct ComponentPlatformInfoArray {
  131.     long                            count;
  132.     ComponentPlatformInfo           platformArray[1];
  133. };
  134. typedef struct ComponentPlatformInfoArray ComponentPlatformInfoArray;
  135. struct ExtComponentResource {
  136.     ComponentDescription            cd;                         /* registration parameters */
  137.     ResourceSpec                    component;                  /* resource where Component code is found */
  138.     ResourceSpec                    componentName;              /* name string resource */
  139.     ResourceSpec                    componentInfo;              /* info string resource */
  140.     ResourceSpec                    componentIcon;              /* icon resource */
  141.     long                            componentVersion;           /* version of Component */
  142.     long                            componentRegisterFlags;     /* flags for registration */
  143.     short                           componentIconFamily;        /* resource id of Icon Family */
  144.     long                            count;                      /* elements in platformArray */
  145.     ComponentPlatformInfo           platformArray[1];
  146. };
  147. typedef struct ExtComponentResource     ExtComponentResource;
  148. typedef ExtComponentResource *          ExtComponentResourcePtr;
  149. typedef ExtComponentResourcePtr *       ExtComponentResourceHandle;
  150. struct ComponentAliasResource {
  151.     ComponentResource               cr;                         /* Registration parameters */
  152.     ComponentDescription            aliasCD;                    /* component alias description */
  153. };
  154. typedef struct ComponentAliasResource   ComponentAliasResource;
  155. /*  Structure received by Component:        */
  156. struct ComponentParameters {
  157.     UInt8                           flags;                      /* call modifiers: sync/async, deferred, immed, etc */
  158.     UInt8                           paramSize;                  /* size in bytes of actual parameters passed to this call */
  159.     short                           what;                       /* routine selector, negative for Component management calls */
  160.     long                            params[1];                  /* actual parameters for the indicated routine */
  161. };
  162. typedef struct ComponentParameters      ComponentParameters;
  163. struct ComponentRecord {
  164.     long                            data[1];
  165. };
  166. typedef struct ComponentRecord          ComponentRecord;
  167. typedef ComponentRecord *               Component;
  168. struct ComponentInstanceRecord {
  169.     long                            data[1];
  170. };
  171. typedef struct ComponentInstanceRecord  ComponentInstanceRecord;
  172. typedef ComponentInstanceRecord *       ComponentInstance;
  173. struct RegisteredComponentRecord {
  174.     long                            data[1];
  175. };
  176. typedef struct RegisteredComponentRecord RegisteredComponentRecord;
  177. typedef RegisteredComponentRecord *     RegisteredComponentRecordPtr;
  178. typedef RegisteredComponentRecord *     RegisteredComponentPtr;
  179. struct RegisteredComponentInstanceRecord {
  180.     long                            data[1];
  181. };
  182. typedef struct RegisteredComponentInstanceRecord RegisteredComponentInstanceRecord;
  183. typedef RegisteredComponentInstanceRecord * RegisteredComponentInstanceRecordPtr;
  184. typedef RegisteredComponentInstanceRecord * RegisteredComponentInstancePtr;
  185. typedef long                            ComponentResult;
  186. enum {
  187.     platform68k                 = 1,                            /* platform type (response from gestaltComponentPlatform) */
  188.     platformPowerPC             = 2,                            /* (when gestaltComponentPlatform is not implemented, use */
  189.     platformInterpreted         = 3,                            /* gestaltSysArchitecture) */
  190.     platformWin32               = 4,
  191.     platformPowerPCNativeEntryPoint = 5
  192. };
  193. enum {
  194.     mpWorkFlagDoWork            = (1 << 0),
  195.     mpWorkFlagDoCompletion      = (1 << 1),
  196.     mpWorkFlagCopyWorkBlock     = (1 << 2),
  197.     mpWorkFlagDontBlock         = (1 << 3),
  198.     mpWorkFlagGetProcessorCount = (1 << 4),
  199.     mpWorkFlagGetIsRunning      = (1 << 6)
  200. };
  201. enum {
  202.     cmpAliasNoFlags             = 0,
  203.     cmpAliasOnlyThisFile        = 1
  204. };
  205. struct ComponentMPWorkFunctionHeaderRecord {
  206.     UInt32                          headerSize;
  207.     UInt32                          recordSize;
  208.     UInt32                          workFlags;
  209.     UInt16                          processorCount;
  210.     UInt8                           unused;
  211.     UInt8                           isRunning;
  212. };
  213. typedef struct ComponentMPWorkFunctionHeaderRecord ComponentMPWorkFunctionHeaderRecord;
  214. typedef ComponentMPWorkFunctionHeaderRecord * ComponentMPWorkFunctionHeaderRecordPtr;
  215. typedef CALLBACK_API( ComponentResult , ComponentMPWorkFunctionProcPtr )(void *globalRefCon, ComponentMPWorkFunctionHeaderRecordPtr header);
  216. typedef CALLBACK_API( ComponentResult , ComponentRoutineProcPtr )(ComponentParameters *cp, Handle componentStorage);
  217. typedef CALLBACK_API( OSErr , GetMissingComponentResourceProcPtr )(Component c, OSType resType, short resID, void *refCon, Handle *resource);
  218. typedef STACK_UPP_TYPE(ComponentMPWorkFunctionProcPtr)          ComponentMPWorkFunctionUPP;
  219. typedef STACK_UPP_TYPE(ComponentRoutineProcPtr)                 ComponentRoutineUPP;
  220. typedef STACK_UPP_TYPE(GetMissingComponentResourceProcPtr)      GetMissingComponentResourceUPP;
  221. /*
  222.     The parameter list for each ComponentFunction is unique. It is
  223.     therefore up to users to create the appropriate procInfo for their
  224.     own ComponentFunctions where necessary.
  225. */
  226. typedef UniversalProcPtr                ComponentFunctionUPP;
  227. /*
  228.     For Carbon, we add NewComponentFunctionUPP and DisposeComponentFunctionUPP
  229.     calls that take a procInfo as their second parameter. This allows native
  230.     Component writers to easily write a Carbon compliant component. Note that
  231.     there is no InvokeComponentFunctionUPP, use the CallComponentFunction calls
  232.     with the UPP instead.
  233. */
  234. #if OPAQUE_UPP_TYPES
  235. EXTERN_API( ComponentFunctionUPP )
  236. NewComponentFunctionUPP         (ProcPtr                userRoutine,
  237.                                  ProcInfoType           procInfo);
  238. EXTERN_API( void )
  239. DisposeComponentFunctionUPP     (ComponentFunctionUPP   userUPP);
  240. #else
  241. #define NewComponentFunctionUPP(userRoutine,procInfo)       (ComponentFunctionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), (ProcInfoType)procInfo, GetCurrentArchitecture())
  242. #define DisposeComponentFunctionUPP(userUPP)                DisposeRoutineDescriptor(userUPP)
  243. #endif  /* OPAQUE_UPP_TYPES */
  244. #if TARGET_RT_MAC_CFM
  245. /* 
  246.     CallComponentUPP is a global variable exported from InterfaceLib.
  247.     It is the ProcPtr passed to CallUniversalProc to manually call a component function.
  248. */
  249. extern UniversalProcPtr CallComponentUPP;
  250. #endif
  251. #define ComponentCallNow( callNumber, paramSize ) 
  252.     FIVEWORDINLINE( 0x2F3C,paramSize,callNumber,0x7000,0xA82A )
  253. /********************************************************
  254. *                                                       *
  255. *               APPLICATION LEVEL CALLS                 *
  256. *                                                       *
  257. ********************************************************/
  258. /********************************************************
  259. * Component Database Add, Delete, and Query Routines
  260. ********************************************************/
  261. EXTERN_API( Component )
  262. RegisterComponent               (ComponentDescription * cd,
  263.                                  ComponentRoutineUPP    componentEntryPoint,
  264.                                  short                  global,
  265.                                  Handle                 componentName,
  266.                                  Handle                 componentInfo,
  267.                                  Handle                 componentIcon)                      TWOWORDINLINE(0x7001, 0xA82A);
  268. EXTERN_API( Component )
  269. RegisterComponentResource       (ComponentResourceHandle  cr,
  270.                                  short                  global)                             TWOWORDINLINE(0x7012, 0xA82A);
  271. EXTERN_API( OSErr )
  272. UnregisterComponent             (Component              aComponent)                         TWOWORDINLINE(0x7002, 0xA82A);
  273. EXTERN_API( Component )
  274. FindNextComponent               (Component              aComponent,
  275.                                  ComponentDescription * looking)                            TWOWORDINLINE(0x7004, 0xA82A);
  276. EXTERN_API( long )
  277. CountComponents                 (ComponentDescription * looking)                            TWOWORDINLINE(0x7003, 0xA82A);
  278. EXTERN_API( OSErr )
  279. GetComponentInfo                (Component              aComponent,
  280.                                  ComponentDescription * cd,
  281.                                  Handle                 componentName,
  282.                                  Handle                 componentInfo,
  283.                                  Handle                 componentIcon)                      TWOWORDINLINE(0x7005, 0xA82A);
  284. EXTERN_API( long )
  285. GetComponentListModSeed         (void)                                                      TWOWORDINLINE(0x7006, 0xA82A);
  286. EXTERN_API( long )
  287. GetComponentTypeModSeed         (OSType                 componentType)                      TWOWORDINLINE(0x702C, 0xA82A);
  288. /********************************************************
  289. * Component Instance Allocation and dispatch routines
  290. ********************************************************/
  291. EXTERN_API( OSErr )
  292. OpenAComponent                  (Component              aComponent,
  293.                                  ComponentInstance *    ci)                                 TWOWORDINLINE(0x702D, 0xA82A);
  294. EXTERN_API( ComponentInstance )
  295. OpenComponent                   (Component              aComponent)                         TWOWORDINLINE(0x7007, 0xA82A);
  296. EXTERN_API( OSErr )
  297. CloseComponent                  (ComponentInstance      aComponentInstance)                 TWOWORDINLINE(0x7008, 0xA82A);
  298. EXTERN_API( OSErr )
  299. GetComponentInstanceError       (ComponentInstance      aComponentInstance)                 TWOWORDINLINE(0x700A, 0xA82A);
  300. /********************************************************
  301. * Component aliases
  302. ********************************************************/
  303. EXTERN_API( Component )
  304. ResolveComponentAlias           (Component              aComponent)                         TWOWORDINLINE(0x7020, 0xA82A);
  305. /********************************************************
  306. * Component public resources and public string lists
  307. ********************************************************/
  308. /* Note: GetComponentPublicResource returns a Handle, not a resource.  The caller must dispose it with DisposeHandle. */
  309. EXTERN_API( OSErr )
  310. GetComponentPublicResource      (Component              aComponent,
  311.                                  OSType                 resourceType,
  312.                                  short                  resourceID,
  313.                                  Handle *               theResource)                        TWOWORDINLINE(0x7038, 0xA82A);
  314. EXTERN_API( OSErr )
  315. GetComponentPublicResourceList  (OSType                 resourceType,
  316.                                  short                  resourceID,
  317.                                  long                   flags,
  318.                                  ComponentDescription * cd,
  319.                                  GetMissingComponentResourceUPP  missingProc,
  320.                                  void *                 refCon,
  321.                                  void *                 atomContainerPtr)                   TWOWORDINLINE(0x7039, 0xA82A);
  322. EXTERN_API( OSErr )
  323. GetComponentPublicIndString     (Component              aComponent,
  324.                                  Str255                 theString,
  325.                                  short                  strListID,
  326.                                  short                  index)                              TWOWORDINLINE(0x703A, 0xA82A);
  327. /********************************************************
  328. *                                                       *
  329. *                   CALLS MADE BY COMPONENTS            *
  330. *                                                       *
  331. ********************************************************/
  332. /********************************************************
  333. * Component Management routines
  334. ********************************************************/
  335. EXTERN_API( void )
  336. SetComponentInstanceError       (ComponentInstance      aComponentInstance,
  337.                                  OSErr                  theError)                           TWOWORDINLINE(0x700B, 0xA82A);
  338. EXTERN_API( long )
  339. GetComponentRefcon              (Component              aComponent)                         TWOWORDINLINE(0x7010, 0xA82A);
  340. EXTERN_API( void )
  341. SetComponentRefcon              (Component              aComponent,
  342.                                  long                   theRefcon)                          TWOWORDINLINE(0x7011, 0xA82A);
  343. EXTERN_API( short )
  344. OpenComponentResFile            (Component              aComponent)                         TWOWORDINLINE(0x7015, 0xA82A);
  345. EXTERN_API( OSErr )
  346. OpenAComponentResFile           (Component              aComponent,
  347.                                  short *                resRef)                             TWOWORDINLINE(0x702F, 0xA82A);
  348. EXTERN_API( OSErr )
  349. CloseComponentResFile           (short                  refnum)                             TWOWORDINLINE(0x7018, 0xA82A);
  350. /* Note: GetComponentResource returns a Handle, not a resource.  The caller must dispose it with DisposeHandle. */
  351. EXTERN_API( OSErr )
  352. GetComponentResource            (Component              aComponent,
  353.                                  OSType                 resType,
  354.                                  short                  resID,
  355.                                  Handle *               theResource)                        TWOWORDINLINE(0x7035, 0xA82A);
  356. EXTERN_API( OSErr )
  357. GetComponentIndString           (Component              aComponent,
  358.                                  Str255                 theString,
  359.                                  short                  strListID,
  360.                                  short                  index)                              TWOWORDINLINE(0x7036, 0xA82A);
  361. /********************************************************
  362. * Component Instance Management routines
  363. ********************************************************/
  364. EXTERN_API( Handle )
  365. GetComponentInstanceStorage     (ComponentInstance      aComponentInstance)                 TWOWORDINLINE(0x700C, 0xA82A);
  366. EXTERN_API( void )
  367. SetComponentInstanceStorage     (ComponentInstance      aComponentInstance,
  368.                                  Handle                 theStorage)                         TWOWORDINLINE(0x700D, 0xA82A);
  369. EXTERN_API( long )
  370. GetComponentInstanceA5          (ComponentInstance      aComponentInstance)                 TWOWORDINLINE(0x700E, 0xA82A);
  371. EXTERN_API( void )
  372. SetComponentInstanceA5          (ComponentInstance      aComponentInstance,
  373.                                  long                   theA5)                              TWOWORDINLINE(0x700F, 0xA82A);
  374. EXTERN_API( long )
  375. CountComponentInstances         (Component              aComponent)                         TWOWORDINLINE(0x7013, 0xA82A);
  376. /* useful helper routines for convenient method dispatching */
  377. EXTERN_API( long )
  378. CallComponentFunction           (ComponentParameters *  params,
  379.                                  ComponentFunctionUPP   func)                               TWOWORDINLINE(0x70FF, 0xA82A);
  380. EXTERN_API( long )
  381. CallComponentFunctionWithStorage (Handle                storage,
  382.                                  ComponentParameters *  params,
  383.                                  ComponentFunctionUPP   func)                               TWOWORDINLINE(0x70FF, 0xA82A);
  384. #if TARGET_OS_MAC
  385. EXTERN_API( long )
  386. CallComponentFunctionWithStorageProcInfo (Handle        storage,
  387.                                  ComponentParameters *  params,
  388.                                  ProcPtr                func,
  389.                                  ProcInfoType           funcProcInfo);
  390. #else
  391. #define CallComponentFunctionWithStorageProcInfo(storage, params, func, funcProcInfo ) CallComponentFunctionWithStorage(storage, params, func)
  392. #endif  /* TARGET_OS_MAC */
  393. EXTERN_API( long )
  394. DelegateComponentCall           (ComponentParameters *  originalParams,
  395.                                  ComponentInstance      ci)                                 TWOWORDINLINE(0x7024, 0xA82A);
  396. EXTERN_API( OSErr )
  397. SetDefaultComponent             (Component              aComponent,
  398.                                  short                  flags)                              TWOWORDINLINE(0x701E, 0xA82A);
  399. EXTERN_API( ComponentInstance )
  400. OpenDefaultComponent            (OSType                 componentType,
  401.                                  OSType                 componentSubType)                   TWOWORDINLINE(0x7021, 0xA82A);
  402. EXTERN_API( OSErr )
  403. OpenADefaultComponent           (OSType                 componentType,
  404.                                  OSType                 componentSubType,
  405.                                  ComponentInstance *    ci)                                 TWOWORDINLINE(0x702E, 0xA82A);
  406. EXTERN_API( Component )
  407. CaptureComponent                (Component              capturedComponent,
  408.                                  Component              capturingComponent)                 TWOWORDINLINE(0x701C, 0xA82A);
  409. EXTERN_API( OSErr )
  410. UncaptureComponent              (Component              aComponent)                         TWOWORDINLINE(0x701D, 0xA82A);
  411. EXTERN_API( long )
  412. RegisterComponentResourceFile   (short                  resRefNum,
  413.                                  short                  global)                             TWOWORDINLINE(0x7014, 0xA82A);
  414. EXTERN_API( OSErr )
  415. GetComponentIconSuite           (Component              aComponent,
  416.                                  Handle *               iconSuite)                          TWOWORDINLINE(0x7029, 0xA82A);
  417. /********************************************************
  418. *                                                       *
  419. *           Direct calls to the Components              *
  420. *                                                       *
  421. ********************************************************/
  422. /* Old style names*/
  423. EXTERN_API( long )
  424. ComponentFunctionImplemented    (ComponentInstance      ci,
  425.                                  short                  ftnNumber)                          FIVEWORDINLINE(0x2F3C, 0x0002, 0xFFFD, 0x7000, 0xA82A);
  426. EXTERN_API( long )
  427. GetComponentVersion             (ComponentInstance      ci)                                 FIVEWORDINLINE(0x2F3C, 0x0000, 0xFFFC, 0x7000, 0xA82A);
  428. EXTERN_API( long )
  429. ComponentSetTarget              (ComponentInstance      ci,
  430.                                  ComponentInstance      target)                             FIVEWORDINLINE(0x2F3C, 0x0004, 0xFFFA, 0x7000, 0xA82A);
  431. /* New style names*/
  432. EXTERN_API( ComponentResult )
  433. CallComponentOpen               (ComponentInstance      ci,
  434.                                  ComponentInstance      self)                               FIVEWORDINLINE(0x2F3C, 0x0004, 0xFFFF, 0x7000, 0xA82A);
  435. EXTERN_API( ComponentResult )
  436. CallComponentClose              (ComponentInstance      ci,
  437.                                  ComponentInstance      self)                               FIVEWORDINLINE(0x2F3C, 0x0004, 0xFFFE, 0x7000, 0xA82A);
  438. EXTERN_API( ComponentResult )
  439. CallComponentCanDo              (ComponentInstance      ci,
  440.                                  short                  ftnNumber)                          FIVEWORDINLINE(0x2F3C, 0x0002, 0xFFFD, 0x7000, 0xA82A);
  441. EXTERN_API( ComponentResult )
  442. CallComponentVersion            (ComponentInstance      ci)                                 FIVEWORDINLINE(0x2F3C, 0x0000, 0xFFFC, 0x7000, 0xA82A);
  443. EXTERN_API( ComponentResult )
  444. CallComponentRegister           (ComponentInstance      ci)                                 FIVEWORDINLINE(0x2F3C, 0x0000, 0xFFFB, 0x7000, 0xA82A);
  445. EXTERN_API( ComponentResult )
  446. CallComponentTarget             (ComponentInstance      ci,
  447.                                  ComponentInstance      target)                             FIVEWORDINLINE(0x2F3C, 0x0004, 0xFFFA, 0x7000, 0xA82A);
  448. EXTERN_API( ComponentResult )
  449. CallComponentUnregister         (ComponentInstance      ci)                                 FIVEWORDINLINE(0x2F3C, 0x0000, 0xFFF9, 0x7000, 0xA82A);
  450. EXTERN_API( ComponentResult )
  451. CallComponentGetMPWorkFunction  (ComponentInstance      ci,
  452.                                  ComponentMPWorkFunctionUPP * workFunction,
  453.                                  void **                refCon)                             FIVEWORDINLINE(0x2F3C, 0x0008, 0xFFF8, 0x7000, 0xA82A);
  454. EXTERN_API( ComponentResult )
  455. CallComponentGetPublicResource  (ComponentInstance      ci,
  456.                                  OSType                 resourceType,
  457.                                  short                  resourceID,
  458.                                  Handle *               resource)                           FIVEWORDINLINE(0x2F3C, 0x000A, 0xFFF6, 0x7000, 0xA82A);
  459. #if !TARGET_OS_MAC
  460. /* 
  461.         CallComponent is used by ComponentGlue routines to manually call a component function.
  462.      */
  463. EXTERN_API( ComponentResult )
  464. CallComponent                   (ComponentInstance      ci,
  465.                                  ComponentParameters *  cp);
  466. #endif  /* !TARGET_OS_MAC */
  467. /*
  468.     CallComponentDispatch is a CarbonLib routine that replaces CallComponent inline glue
  469.     to call a component function.
  470.  */
  471. EXTERN_API( ComponentResult )
  472. CallComponentDispatch           (ComponentParameters *  cp);
  473. /* UPP call backs */
  474. #if OPAQUE_UPP_TYPES
  475.     EXTERN_API(ComponentMPWorkFunctionUPP)
  476.     NewComponentMPWorkFunctionUPP    (ComponentMPWorkFunctionProcPtr userRoutine);
  477.     EXTERN_API(ComponentRoutineUPP)
  478.     NewComponentRoutineUPP         (ComponentRoutineProcPtr userRoutine);
  479.     EXTERN_API(GetMissingComponentResourceUPP)
  480.     NewGetMissingComponentResourceUPP    (GetMissingComponentResourceProcPtr userRoutine);
  481.     EXTERN_API(void)
  482.     DisposeComponentMPWorkFunctionUPP    (ComponentMPWorkFunctionUPP userUPP);
  483.     EXTERN_API(void)
  484.     DisposeComponentRoutineUPP     (ComponentRoutineUPP     userUPP);
  485.     EXTERN_API(void)
  486.     DisposeGetMissingComponentResourceUPP    (GetMissingComponentResourceUPP userUPP);
  487.     EXTERN_API(ComponentResult)
  488.     InvokeComponentMPWorkFunctionUPP    (void *             globalRefCon,
  489.                                     ComponentMPWorkFunctionHeaderRecordPtr header,
  490.                                     ComponentMPWorkFunctionUPP userUPP);
  491.     EXTERN_API(ComponentResult)
  492.     InvokeComponentRoutineUPP      (ComponentParameters *   cp,
  493.                                     Handle                  componentStorage,
  494.                                     ComponentRoutineUPP     userUPP);
  495.     EXTERN_API(OSErr)
  496.     InvokeGetMissingComponentResourceUPP    (Component      c,
  497.                                     OSType                  resType,
  498.                                     short                   resID,
  499.                                     void *                  refCon,
  500.                                     Handle *                resource,
  501.                                     GetMissingComponentResourceUPP userUPP);
  502. #else
  503.     enum { uppComponentMPWorkFunctionProcInfo = 0x000003F0 };       /* pascal 4_bytes Func(4_bytes, 4_bytes) */
  504.     enum { uppComponentRoutineProcInfo = 0x000003F0 };              /* pascal 4_bytes Func(4_bytes, 4_bytes) */
  505.     enum { uppGetMissingComponentResourceProcInfo = 0x0000FBE0 };   /* pascal 2_bytes Func(4_bytes, 4_bytes, 2_bytes, 4_bytes, 4_bytes) */
  506.     #define NewComponentMPWorkFunctionUPP(userRoutine)              (ComponentMPWorkFunctionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppComponentMPWorkFunctionProcInfo, GetCurrentArchitecture())
  507.     #define NewComponentRoutineUPP(userRoutine)                     (ComponentRoutineUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppComponentRoutineProcInfo, GetCurrentArchitecture())
  508.     #define NewGetMissingComponentResourceUPP(userRoutine)          (GetMissingComponentResourceUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppGetMissingComponentResourceProcInfo, GetCurrentArchitecture())
  509.     #define DisposeComponentMPWorkFunctionUPP(userUPP)              DisposeRoutineDescriptor(userUPP)
  510.     #define DisposeComponentRoutineUPP(userUPP)                     DisposeRoutineDescriptor(userUPP)
  511.     #define DisposeGetMissingComponentResourceUPP(userUPP)          DisposeRoutineDescriptor(userUPP)
  512.     #define InvokeComponentMPWorkFunctionUPP(globalRefCon, header, userUPP)  (ComponentResult)CALL_TWO_PARAMETER_UPP((userUPP), uppComponentMPWorkFunctionProcInfo, (globalRefCon), (header))
  513.     #define InvokeComponentRoutineUPP(cp, componentStorage, userUPP)  (ComponentResult)CALL_TWO_PARAMETER_UPP((userUPP), uppComponentRoutineProcInfo, (cp), (componentStorage))
  514.     #define InvokeGetMissingComponentResourceUPP(c, resType, resID, refCon, resource, userUPP)  (OSErr)CALL_FIVE_PARAMETER_UPP((userUPP), uppGetMissingComponentResourceProcInfo, (c), (resType), (resID), (refCon), (resource))
  515. #endif
  516. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  517. #define NewComponentMPWorkFunctionProc(userRoutine)             NewComponentMPWorkFunctionUPP(userRoutine)
  518. #define NewComponentRoutineProc(userRoutine)                    NewComponentRoutineUPP(userRoutine)
  519. #define NewGetMissingComponentResourceProc(userRoutine)         NewGetMissingComponentResourceUPP(userRoutine)
  520. #define CallComponentMPWorkFunctionProc(userRoutine, globalRefCon, header) InvokeComponentMPWorkFunctionUPP(globalRefCon, header, userRoutine)
  521. #define CallComponentRoutineProc(userRoutine, cp, componentStorage) InvokeComponentRoutineUPP(cp, componentStorage, userRoutine)
  522. #define CallGetMissingComponentResourceProc(userRoutine, c, resType, resID, refCon, resource) InvokeGetMissingComponentResourceUPP(c, resType, resID, refCon, resource, userRoutine)
  523. /* ProcInfos */
  524. /* MixedMode ProcInfo constants for component calls */
  525. enum {
  526.     uppComponentFunctionImplementedProcInfo    = 0x000002F0,
  527.     uppGetComponentVersionProcInfo             = 0x000000F0,
  528.     uppComponentSetTargetProcInfo              = 0x000003F0,
  529.     uppCallComponentOpenProcInfo               = 0x000003F0,
  530.     uppCallComponentCloseProcInfo              = 0x000003F0,
  531.     uppCallComponentCanDoProcInfo              = 0x000002F0,
  532.     uppCallComponentVersionProcInfo            = 0x000000F0,
  533.     uppCallComponentRegisterProcInfo           = 0x000000F0,
  534.     uppCallComponentTargetProcInfo             = 0x000003F0,
  535.     uppCallComponentUnregisterProcInfo         = 0x000000F0,
  536.     uppCallComponentGetMPWorkFunctionProcInfo  = 0x00000FF0,
  537.     uppCallComponentGetPublicResourceProcInfo  = 0x00003BF0
  538. };
  539. #if PRAGMA_STRUCT_ALIGN
  540.     #pragma options align=reset
  541. #elif PRAGMA_STRUCT_PACKPUSH
  542.     #pragma pack(pop)
  543. #elif PRAGMA_STRUCT_PACK
  544.     #pragma pack()
  545. #endif
  546. #ifdef PRAGMA_IMPORT_OFF
  547. #pragma import off
  548. #elif PRAGMA_IMPORT
  549. #pragma import reset
  550. #endif
  551. #ifdef __cplusplus
  552. }
  553. #endif
  554. #endif /* __COMPONENTS__ */