home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / WPSDEM.ZIP / WHOAMI / WHOAMI.IH < prev    next >
Text File  |  1992-04-30  |  5KB  |  190 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: wpDrop
  70.  */
  71. #pragma linkage(wpDrop, system)
  72. SOM_Scope MRESULT   SOMLINK wpDrop(Whoami *somSelf,
  73.         HWND hwndCnr,
  74.         PDRAGINFO pdrgInfo,
  75.         PDRAGITEM pdrgItem);
  76. #ifndef parent_wpDrop
  77. static char *somMN_wpDrop = "wpDrop";
  78. static somId somId_wpDrop = &somMN_wpDrop;
  79. #define parent_wpDrop(somSelf,hwndCnr,pdrgInfo,pdrgItem) \
  80.     ((SOM_ParentResolveE(WPObject, SOM_CurrentClass, wpDrop)) \
  81.      (somSelf,hwndCnr,pdrgInfo,pdrgItem))
  82. #endif
  83. #define WhoamiParent_wpDrop parent_wpDrop
  84.  
  85. /*
  86.  * Temporary class data structure used only in class creation
  87.  */
  88. static somClassDataStructure WhoamitempClassData;
  89.  
  90. /*
  91.  * Initialize the class data structure
  92.  */
  93. struct WhoamiClassDataStructure WhoamiClassData = {(SOMAny *) NULL};
  94.  
  95. /*
  96.  * Define the C class data structure
  97.  */
  98. struct WhoamiCClassDataStructure WhoamiCClassData = {(somMethodTab *) NULL};
  99.  
  100. /*
  101.  * Routines to create the class object
  102.  */
  103.  
  104. /*
  105.  * Declare the Override Methods table.
  106.  */
  107. static somOverrideMethod_t WhoamiOM[] = {
  108.     {    &somId_wpDrop,
  109.          (somMethodProc *) wpDrop    },
  110. };
  111.  
  112. static void WhoamisomInitializeClass ()
  113. {
  114.     int i;
  115.     somOverrideMethod_t *omp;
  116.  
  117. /*
  118.  * Override methods.
  119.  */
  120.     for (omp = WhoamiOM, i = 0; i < 1; omp++, i++)
  121.         _somOverrideSMethod (WhoamitempClassData.classObject,
  122.             *(omp->methodId), omp->method);
  123.  
  124. }
  125.  
  126. #pragma linkage(WhoamisomCreateClass, system)
  127. static void SOMLINK WhoamisomCreateClass(SOMClass *pClsObj,
  128.                            SOMClass *mClsObj)
  129. {
  130.     WhoamitempClassData.classObject = _somNew (mClsObj);
  131.     _somInitClass (WhoamitempClassData.classObject,
  132.         "Whoami",
  133.         pClsObj,
  134.         0,
  135.         Whoami_MaxNoMethods,
  136.         Whoami_MajorVersion,
  137.         Whoami_MinorVersion);
  138.     WhoamiCClassData.instanceDataToken = 
  139.     _somGetInstanceToken(WhoamitempClassData.classObject);
  140.     WhoamisomInitializeClass();
  141.     WhoamiCClassData.parentMtab =
  142.     _somGetPClsMtab(WhoamitempClassData.classObject);
  143.     _somSetClassData(WhoamitempClassData.classObject, (somClassDataStructure *)&WhoamiClassData);
  144.     _somClassReady(WhoamitempClassData.classObject);
  145.     /* make newly created class object visible */
  146.     WhoamiClassData.classObject = WhoamitempClassData.classObject;
  147. }
  148.  
  149. Whoami * SOMLINK WhoamiNewClass (integer4 scemajorVersion,
  150.         integer4 sceminorVersion)
  151. {
  152.     SOMClass *pClsObj;
  153.     SOMClass *mClsObj;
  154.  
  155.     /* Check the version numbers */
  156.     if (((scemajorVersion != 0) && 
  157.          (scemajorVersion != Whoami_MajorVersion)) ||
  158.         ((sceminorVersion != 0) && 
  159.          (sceminorVersion > Whoami_MinorVersion))) {
  160.     somPrintf("WhoamiNewClass: Error, bad version numbers.\n");
  161.     SOM_Error(SOMERROR_BadVersion);
  162.     }
  163.     /* Don't do anything if class object is already created. */
  164.     if (WhoamiClassData.classObject != (SOMAny *) NULL)
  165.     return(WhoamiClassData.classObject);
  166.  
  167.     /* Make sure the environment is initialized. */
  168.     if (SOMClassMgrObject == (SOMAny *) NULL) somEnvironmentNew();
  169.     if (SOMClassMgrObject == (SOMAny *) NULL)
  170.     SOM_Error(SOMERROR_CouldNotStartup);
  171.  
  172.     /* Get the parent class object. */
  173.     WPAbstractNewClass(1,2);    /* static reference */
  174.     pClsObj = _somFindClass(SOMClassMgrObject,
  175.         SOM_IdFromString("WPAbstract"), 1, 2);
  176.     if (pClsObj == (SOMClass *) NULL)
  177.     SOM_Error(SOMERROR_NoParentClass);
  178.  
  179.     /* Use parent's metaclass */ 
  180.     mClsObj = SOM_GetClass(pClsObj);
  181.  
  182.     somConstructClass(WhoamisomCreateClass, pClsObj, mClsObj,
  183.              &WhoamitempClassData);
  184.     return (WhoamiClassData.classObject);
  185. }
  186.  
  187. #endif                   /* Whoami_Class_Source */
  188.  
  189. #endif       /* whoami_ih */
  190.