home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / WHOAMI.ZIP / whoami.ih < prev    next >
Text File  |  1992-07-13  |  6KB  |  226 lines

  1.  
  2. /*
  3.  * This file was generated by the SOM Compiler.
  4.  * FileName: whoami.ih.
  5.  * Generated using:
  6.  *     SOM Precompiler spc: 1.22
  7.  *     SOM Emitter emitih: 1.59
  8.  */
  9.  
  10. #ifndef whoami_ih
  11. #define whoami_ih
  12.  
  13.  
  14. /*
  15.  * Passthru lines: File: "C.ih", "before"
  16.  */
  17. #define INCL_WINWORKPLACE
  18. #include <os2.h>
  19.  
  20. #include "whoami.h"
  21.  
  22. /*
  23.  * Set the scope of methods functions
  24.  */
  25. #ifndef SOM_Scope
  26. #define SOM_Scope static
  27. #endif
  28.  
  29. #ifndef SOM_CurrentClass
  30. #define SOM_CurrentClass WhoamiCClassData.parentMtab
  31. #endif
  32.  
  33. #define Whoami_MaxNoMethods 0
  34.  
  35. /*
  36.  * Instance data
  37.  */
  38. typedef void WhoamiData;
  39.  
  40. /*
  41.  * Trace/Debug macro
  42.  */
  43. #ifndef WhoamiMethodDebug
  44. #define WhoamiMethodDebug(c,m) SOMMethodDebug(c,m)
  45. #endif
  46.  
  47. /*
  48.  * Begin stuff that only goes in the primary file
  49.  */
  50. #ifdef Whoami_Class_Source
  51.  
  52. /*
  53.  * Current class macros for Instance and Meta classes.
  54.  */
  55. #undef SOMMeta
  56. #define SOMMeta M_WhoamiCClassData.parentMtab
  57. #undef SOMInstance
  58. #define SOMInstance WhoamiCClassData.parentMtab
  59.  
  60. #ifndef M_Whoami_Class_Source
  61. #define M_Whoami_Class_Source
  62. #endif    /* M_Whoami_Class_Source */
  63.  
  64. /*
  65.  * Generate the Apply Stubs.
  66.  */
  67.  
  68. /*
  69.  * Overridden method: wpOpen
  70.  */
  71. #pragma linkage(wpOpen, system)
  72. SOM_Scope HWND   SOMLINK wpOpen(Whoami *somSelf,
  73.         HWND hwndCnr,
  74.         ULONG ulView,
  75.         ULONG param);
  76. #ifndef parent_wpOpen
  77. static char *somMN_wpOpen = "wpOpen";
  78. static somId somId_wpOpen = &somMN_wpOpen;
  79. #define parent_wpOpen(somSelf,hwndCnr,ulView,param) \
  80.     ((SOM_ParentResolveE(WPObject, SOM_CurrentClass, wpOpen)) \
  81.      (somSelf,hwndCnr,ulView,param))
  82. #endif
  83. #define WhoamiParent_wpOpen parent_wpOpen
  84.  
  85. /*
  86.  * Overridden method: wpDrop
  87.  */
  88. #pragma linkage(wpDrop, system)
  89. SOM_Scope MRESULT   SOMLINK wpDrop(Whoami *somSelf,
  90.         HWND hwndCnr,
  91.         PDRAGINFO pdrgInfo,
  92.         PDRAGITEM pdrgItem);
  93. #ifndef parent_wpDrop
  94. static char *somMN_wpDrop = "wpDrop";
  95. static somId somId_wpDrop = &somMN_wpDrop;
  96. #define parent_wpDrop(somSelf,hwndCnr,pdrgInfo,pdrgItem) \
  97.     ((SOM_ParentResolveE(WPObject, SOM_CurrentClass, wpDrop)) \
  98.      (somSelf,hwndCnr,pdrgInfo,pdrgItem))
  99. #endif
  100. #define WhoamiParent_wpDrop parent_wpDrop
  101.  
  102. /*
  103.  * Overridden method: wpDraggedOverObject
  104.  */
  105. #pragma linkage(wpDraggedOverObject, system)
  106. SOM_Scope MRESULT   SOMLINK wpDraggedOverObject(Whoami *somSelf,
  107.         WPObject *DraggedOverObject);
  108. #ifndef parent_wpDraggedOverObject
  109. static char *somMN_wpDraggedOverObject = "wpDraggedOverObject";
  110. static somId somId_wpDraggedOverObject = &somMN_wpDraggedOverObject;
  111. #define parent_wpDraggedOverObject(somSelf,DraggedOverObject) \
  112.     ((SOM_ParentResolveE(WPObject, SOM_CurrentClass, wpDraggedOverObject)) \
  113.      (somSelf,DraggedOverObject))
  114. #endif
  115. #define WhoamiParent_wpDraggedOverObject parent_wpDraggedOverObject
  116.  
  117. /*
  118.  * Temporary class data structure used only in class creation
  119.  */
  120. static somClassDataStructure WhoamitempClassData;
  121.  
  122. /*
  123.  * Initialize the class data structure
  124.  */
  125. struct WhoamiClassDataStructure WhoamiClassData = {(SOMAny *) NULL};
  126.  
  127. /*
  128.  * Define the C class data structure
  129.  */
  130. struct WhoamiCClassDataStructure WhoamiCClassData = {(somMethodTab *) NULL};
  131.  
  132. /*
  133.  * Routines to create the class object
  134.  */
  135.  
  136. /*
  137.  * Declare the Override Methods table.
  138.  */
  139. static somOverrideMethod_t WhoamiOM[] = {
  140.     {    &somId_wpOpen,
  141.          (somMethodProc *) wpOpen    },
  142.     {    &somId_wpDrop,
  143.          (somMethodProc *) wpDrop    },
  144.     {    &somId_wpDraggedOverObject,
  145.          (somMethodProc *) wpDraggedOverObject    },
  146. };
  147.  
  148. static void WhoamisomInitializeClass ()
  149. {
  150.     int i;
  151.     somOverrideMethod_t *omp;
  152.  
  153. /*
  154.  * Override methods.
  155.  */
  156.     for (omp = WhoamiOM, i = 0; i < 3; omp++, i++)
  157.         _somOverrideSMethod (WhoamitempClassData.classObject,
  158.             *(omp->methodId), omp->method);
  159.  
  160. }
  161.  
  162. #pragma linkage(WhoamisomCreateClass, system)
  163. static void SOMLINK WhoamisomCreateClass(SOMClass *pClsObj,
  164.                            SOMClass *mClsObj)
  165. {
  166.     WhoamitempClassData.classObject = _somNew (mClsObj);
  167.     _somInitClass (WhoamitempClassData.classObject,
  168.         "Whoami",
  169.         pClsObj,
  170.         0,
  171.         Whoami_MaxNoMethods,
  172.         Whoami_MajorVersion,
  173.         Whoami_MinorVersion);
  174.     WhoamiCClassData.instanceDataToken = 
  175.     _somGetInstanceToken(WhoamitempClassData.classObject);
  176.     WhoamisomInitializeClass();
  177.     WhoamiCClassData.parentMtab =
  178.     _somGetPClsMtab(WhoamitempClassData.classObject);
  179.     _somSetClassData(WhoamitempClassData.classObject, (somClassDataStructure *)&WhoamiClassData);
  180.     _somClassReady(WhoamitempClassData.classObject);
  181.     /* make newly created class object visible */
  182.     WhoamiClassData.classObject = WhoamitempClassData.classObject;
  183. }
  184.  
  185. Whoami * SOMLINK WhoamiNewClass (integer4 scemajorVersion,
  186.         integer4 sceminorVersion)
  187. {
  188.     SOMClass *pClsObj;
  189.     SOMClass *mClsObj;
  190.  
  191.     /* Check the version numbers */
  192.     if (((scemajorVersion != 0) && 
  193.          (scemajorVersion != Whoami_MajorVersion)) ||
  194.         ((sceminorVersion != 0) && 
  195.          (sceminorVersion > Whoami_MinorVersion))) {
  196.     somPrintf("WhoamiNewClass: Error, bad version numbers.\n");
  197.     SOM_Error(SOMERROR_BadVersion);
  198.     }
  199.     /* Don't do anything if class object is already created. */
  200.     if (WhoamiClassData.classObject != (SOMAny *) NULL)
  201.     return(WhoamiClassData.classObject);
  202.  
  203.     /* Make sure the environment is initialized. */
  204.     if (SOMClassMgrObject == (SOMAny *) NULL) somEnvironmentNew();
  205.     if (SOMClassMgrObject == (SOMAny *) NULL)
  206.     SOM_Error(SOMERROR_CouldNotStartup);
  207.  
  208.     /* Get the parent class object. */
  209.     WPAbstractNewClass(1,2);    /* static reference */
  210.     pClsObj = _somFindClass(SOMClassMgrObject,
  211.         SOM_IdFromString("WPAbstract"), 1, 2);
  212.     if (pClsObj == (SOMClass *) NULL)
  213.     SOM_Error(SOMERROR_NoParentClass);
  214.  
  215.     /* Use parent's metaclass */ 
  216.     mClsObj = SOM_GetClass(pClsObj);
  217.  
  218.     somConstructClass(WhoamisomCreateClass, pClsObj, mClsObj,
  219.              &WhoamitempClassData);
  220.     return (WhoamiClassData.classObject);
  221. }
  222.  
  223. #endif                   /* Whoami_Class_Source */
  224.  
  225. #endif       /* whoami_ih */
  226.