home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / WPSDEM.ZIP / CMBSTDNT / UNDRGRAD.IH < prev    next >
Text File  |  1992-08-21  |  9KB  |  272 lines

  1.  
  2. /*
  3.  * This file was generated by the SOM Compiler.
  4.  * FileName: .\UNDRGRAD.ih.
  5.  * Generated using:
  6.  *     SOM Precompiler spc: 1.22
  7.  *     SOM Emitter emitih: 1.59
  8.  */
  9.  
  10. #ifndef UNDRGRAD_ih
  11. #define UNDRGRAD_ih
  12.  
  13.  
  14. #include "UNDRGRAD.h"
  15.  
  16. /*
  17.  * Set the scope of methods functions
  18.  */
  19. #ifndef SOM_Scope
  20. #define SOM_Scope static
  21. #endif
  22.  
  23. #ifndef SOM_CurrentClass
  24. #define SOM_CurrentClass UnderGraduateStudentCClassData.parentMtab
  25. #endif
  26.  
  27. #define UnderGraduateStudent_MaxNoMethods 1
  28.  
  29. /*
  30.  * Instance data
  31.  */
  32. typedef struct {
  33.     char date[16];
  34. } UnderGraduateStudentData;
  35.  
  36. /*
  37.  * Instance variable access macros
  38.  */
  39. #define _date (somThis->date)
  40.  
  41. /*
  42.  * Getdata macro
  43.  */
  44. #define UnderGraduateStudentGetData(somSelf) \
  45.     ((UnderGraduateStudentData *) \
  46.         SOM_DataResolve(somSelf, UnderGraduateStudentCClassData.instanceDataToken))
  47.  
  48. /*
  49.  * Trace/Debug macro
  50.  */
  51. #ifndef UnderGraduateStudentMethodDebug
  52. #define UnderGraduateStudentMethodDebug(c,m) SOMMethodDebug(c,m)
  53. #endif
  54.  
  55. /*
  56.  * Begin stuff that only goes in the primary file
  57.  */
  58. #ifdef UnderGraduateStudent_Class_Source
  59.  
  60. /*
  61.  * Current class macros for Instance and Meta classes.
  62.  */
  63. #undef SOMMeta
  64. #define SOMMeta M_UnderGraduateStudentCClassData.parentMtab
  65. #undef SOMInstance
  66. #define SOMInstance UnderGraduateStudentCClassData.parentMtab
  67.  
  68. #ifndef M_UnderGraduateStudent_Class_Source
  69. #define M_UnderGraduateStudent_Class_Source
  70. #endif    /* M_UnderGraduateStudent_Class_Source */
  71.  
  72. /*
  73.  * Generate the Apply Stubs.
  74.  */
  75. #pragma linkage(somAP_setUpUnderGraduateStudent, system)
  76. static void   SOMLINK somAP_setUpUnderGraduateStudent(UnderGraduateStudent *somSelf,
  77.         somId __id,
  78.         somId __desc,
  79.         va_list __ap)
  80. {
  81.     char *id = va_arg(__ap, char*);
  82.     char *name = va_arg(__ap, char*);
  83.     char *date = va_arg(__ap, char*);
  84.     __ap; __id; __desc;           /* Referenced to prevent warning msg */
  85.  
  86.     UnderGraduateStudent_setUpUnderGraduateStudent(somSelf,id,name,date);
  87. }
  88.  
  89.  
  90. /*
  91.  * Overridden method: printStudentInfo
  92.  */
  93. #pragma linkage(printStudentInfo, system)
  94. SOM_Scope void   SOMLINK printStudentInfo(UnderGraduateStudent *somSelf);
  95. #ifndef parent_printStudentInfo
  96. static char *somMN_printStudentInfo = "printStudentInfo";
  97. static somId somId_printStudentInfo = &somMN_printStudentInfo;
  98. #define parent_printStudentInfo(somSelf) \
  99.     ((SOM_ParentResolveE(Student, SOM_CurrentClass, printStudentInfo)) \
  100.      (somSelf))
  101. #endif
  102. #define UnderGraduateStudentParent_printStudentInfo parent_printStudentInfo
  103.  
  104. /*
  105.  * Overridden method: getStudentType
  106.  */
  107. #pragma linkage(getStudentType, system)
  108. SOM_Scope char *  SOMLINK getStudentType(UnderGraduateStudent *somSelf);
  109. #ifndef parent_getStudentType
  110. static char *somMN_getStudentType = "getStudentType";
  111. static somId somId_getStudentType = &somMN_getStudentType;
  112. #define parent_getStudentType(somSelf) \
  113.     ((SOM_ParentResolveE(Student, SOM_CurrentClass, getStudentType)) \
  114.      (somSelf))
  115. #endif
  116. #define UnderGraduateStudentParent_getStudentType parent_getStudentType
  117.  
  118. /*
  119.  * Temporary class data structure used only in class creation
  120.  */
  121. static somClassDataStructure UnderGraduateStudenttempClassData;
  122.  
  123. /*
  124.  * Initialize the class data structure
  125.  */
  126. struct UnderGraduateStudentClassDataStructure UnderGraduateStudentClassData = {(SOMAny *) NULL};
  127.  
  128. /*
  129.  * Define the C class data structure
  130.  */
  131. struct UnderGraduateStudentCClassDataStructure UnderGraduateStudentCClassData = {(somMethodTab *) NULL};
  132.  
  133. /*
  134.  * New Method: setUpUnderGraduateStudent
  135.  */
  136. #pragma linkage(setUpUnderGraduateStudent, system)
  137. SOM_Scope void   SOMLINK setUpUnderGraduateStudent(UnderGraduateStudent *somSelf,
  138.         char *id,
  139.         char *name,
  140.         char *date);
  141. static char *somMN_setUpUnderGraduateStudent = "setUpUnderGraduateStudent";
  142. static somId somId_setUpUnderGraduateStudent = &somMN_setUpUnderGraduateStudent;
  143. static char *somDS_setUpUnderGraduateStudent = somMD_UnderGraduateStudent_setUpUnderGraduateStudent;
  144. static somId somDI_setUpUnderGraduateStudent = &somDS_setUpUnderGraduateStudent;
  145. #pragma linkage(somRD_setUpUnderGraduateStudent, system)
  146. static void   SOMLINK somRD_setUpUnderGraduateStudent(UnderGraduateStudent *somSelf,
  147.         char *id,
  148.         char *name,
  149.         char *date)
  150. {
  151.     va_somDispatchV(somSelf, somId_setUpUnderGraduateStudent,
  152.         _somGetMethodDescriptor(SOM_GetClass(somSelf),somId_setUpUnderGraduateStudent),id,name,date);
  153. }
  154.  
  155. /*
  156.  * Routines to create the class object
  157.  */
  158.  
  159. /*
  160.  * Declare the Static Methods table.
  161.  */
  162. static somStaticMethod_t UnderGraduateStudentSM[] = {
  163.     {    &UnderGraduateStudentClassData.setUpUnderGraduateStudent,
  164.          &somId_setUpUnderGraduateStudent,
  165.          &somDI_setUpUnderGraduateStudent,
  166.          (somMethodProc *) setUpUnderGraduateStudent,
  167.          (somMethodProc *) somRD_setUpUnderGraduateStudent,
  168.          (somMethodProc *) somAP_setUpUnderGraduateStudent    },
  169. };
  170.  
  171.  
  172. /*
  173.  * Declare the Override Methods table.
  174.  */
  175. static somOverrideMethod_t UnderGraduateStudentOM[] = {
  176.     {    &somId_printStudentInfo,
  177.          (somMethodProc *) printStudentInfo    },
  178.     {    &somId_getStudentType,
  179.          (somMethodProc *) getStudentType    },
  180. };
  181.  
  182. static void UnderGraduateStudentsomInitializeClass ()
  183. {
  184.     int i;
  185.     somStaticMethod_t *smp;
  186.     somOverrideMethod_t *omp;
  187.  
  188. /*
  189.  * Add the Static Methods.
  190.  */
  191.     for (smp = UnderGraduateStudentSM, i = 0; i < 1; smp++, i++)
  192.         *(smp->classData) =
  193.             _somAddStaticMethod (UnderGraduateStudenttempClassData.classObject,
  194.                 *(smp->methodId), *(smp->methodDescriptor),
  195.                 smp->method, smp->redispatchStub,
  196.                 smp->applyStub);
  197.  
  198.  
  199. /*
  200.  * Override methods.
  201.  */
  202.     for (omp = UnderGraduateStudentOM, i = 0; i < 2; omp++, i++)
  203.         _somOverrideSMethod (UnderGraduateStudenttempClassData.classObject,
  204.             *(omp->methodId), omp->method);
  205.  
  206. }
  207.  
  208. #pragma linkage(UnderGraduateStudentsomCreateClass, system)
  209. static void SOMLINK UnderGraduateStudentsomCreateClass(SOMClass *pClsObj,
  210.                            SOMClass *mClsObj)
  211. {
  212.     UnderGraduateStudenttempClassData.classObject = _somNew (mClsObj);
  213.     _somInitClass (UnderGraduateStudenttempClassData.classObject,
  214.         "UnderGraduateStudent",
  215.         pClsObj,
  216.         sizeof(UnderGraduateStudentData),
  217.         UnderGraduateStudent_MaxNoMethods,
  218.         UnderGraduateStudent_MajorVersion,
  219.         UnderGraduateStudent_MinorVersion);
  220.     UnderGraduateStudentCClassData.instanceDataToken = 
  221.     _somGetInstanceToken(UnderGraduateStudenttempClassData.classObject);
  222.     UnderGraduateStudentsomInitializeClass();
  223.     UnderGraduateStudentCClassData.parentMtab =
  224.     _somGetPClsMtab(UnderGraduateStudenttempClassData.classObject);
  225.     _somSetClassData(UnderGraduateStudenttempClassData.classObject, (somClassDataStructure *)&UnderGraduateStudentClassData);
  226.     _somClassReady(UnderGraduateStudenttempClassData.classObject);
  227.     /* make newly created class object visible */
  228.     UnderGraduateStudentClassData.classObject = UnderGraduateStudenttempClassData.classObject;
  229. }
  230.  
  231. UnderGraduateStudent * SOMLINK UnderGraduateStudentNewClass (integer4 scemajorVersion,
  232.         integer4 sceminorVersion)
  233. {
  234.     SOMClass *pClsObj;
  235.     SOMClass *mClsObj;
  236.  
  237.     /* Check the version numbers */
  238.     if (((scemajorVersion != 0) && 
  239.          (scemajorVersion != UnderGraduateStudent_MajorVersion)) ||
  240.         ((sceminorVersion != 0) && 
  241.          (sceminorVersion > UnderGraduateStudent_MinorVersion))) {
  242.     somPrintf("UnderGraduateStudentNewClass: Error, bad version numbers.\n");
  243.     SOM_Error(SOMERROR_BadVersion);
  244.     }
  245.     /* Don't do anything if class object is already created. */
  246.     if (UnderGraduateStudentClassData.classObject != (SOMAny *) NULL)
  247.     return(UnderGraduateStudentClassData.classObject);
  248.  
  249.     /* Make sure the environment is initialized. */
  250.     if (SOMClassMgrObject == (SOMAny *) NULL) somEnvironmentNew();
  251.     if (SOMClassMgrObject == (SOMAny *) NULL)
  252.     SOM_Error(SOMERROR_CouldNotStartup);
  253.  
  254.     /* Get the parent class object. */
  255.     StudentNewClass(1,1);    /* static reference */
  256.     pClsObj = _somFindClass(SOMClassMgrObject,
  257.         SOM_IdFromString("Student"), 1, 1);
  258.     if (pClsObj == (SOMClass *) NULL)
  259.     SOM_Error(SOMERROR_NoParentClass);
  260.  
  261.     /* Use parent's metaclass */ 
  262.     mClsObj = SOM_GetClass(pClsObj);
  263.  
  264.     somConstructClass(UnderGraduateStudentsomCreateClass, pClsObj, mClsObj,
  265.              &UnderGraduateStudenttempClassData);
  266.     return (UnderGraduateStudentClassData.classObject);
  267. }
  268.  
  269. #endif                   /* UnderGraduateStudent_Class_Source */
  270.  
  271. #endif       /* UNDRGRAD_ih */
  272.