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

  1.  
  2. /*
  3.  * This file was generated by the SOM Compiler.
  4.  * FileName: .\STUDENT.ih.
  5.  * Generated using:
  6.  *     SOM Precompiler spc: 1.22
  7.  *     SOM Emitter emitih: 1.59
  8.  */
  9.  
  10. #ifndef STUDENT_ih
  11. #define STUDENT_ih
  12.  
  13.  
  14. #include <STUDENT.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 StudentCClassData.parentMtab
  25. #endif
  26.  
  27. #define Student_MaxNoMethods 6
  28.  
  29. /*
  30.  * Instance data
  31.  */
  32. typedef struct {
  33.     char id[16];
  34.     char name[32];
  35.     int GPA;
  36. } StudentData;
  37.  
  38. /*
  39.  * Instance variable access macros
  40.  */
  41. #define _id (somThis->id)
  42. #define _name (somThis->name)
  43. #define _GPA (somThis->GPA)
  44.  
  45. /*
  46.  * Getdata macro
  47.  */
  48. #define StudentGetData(somSelf) \
  49.     ((StudentData *) \
  50.         SOM_DataResolve(somSelf, StudentCClassData.instanceDataToken))
  51.  
  52. /*
  53.  * Trace/Debug macro
  54.  */
  55. #ifndef StudentMethodDebug
  56. #define StudentMethodDebug(c,m) SOMMethodDebug(c,m)
  57. #endif
  58.  
  59. /*
  60.  * Begin stuff that only goes in the primary file
  61.  */
  62. #ifdef Student_Class_Source
  63.  
  64. /*
  65.  * Current class macros for Instance and Meta classes.
  66.  */
  67. #undef SOMMeta
  68. #define SOMMeta M_StudentCClassData.parentMtab
  69. #undef SOMInstance
  70. #define SOMInstance StudentCClassData.parentMtab
  71.  
  72. #ifndef M_Student_Class_Source
  73. #define M_Student_Class_Source
  74. #endif    /* M_Student_Class_Source */
  75.  
  76. /*
  77.  * Generate the Apply Stubs.
  78.  */
  79. #pragma linkage(somAP_setUpStudent, system)
  80. static void   SOMLINK somAP_setUpStudent(Student *somSelf,
  81.         somId __id,
  82.         somId __desc,
  83.         va_list __ap)
  84. {
  85.     char *id = va_arg(__ap, char*);
  86.     char *name = va_arg(__ap, char*);
  87.     __ap; __id; __desc;           /* Referenced to prevent warning msg */
  88.  
  89.     Student_setUpStudent(somSelf,id,name);
  90. }
  91.  
  92. #pragma linkage(somAP_printStudentInfo, system)
  93. static void   SOMLINK somAP_printStudentInfo(Student *somSelf,
  94.         somId __id,
  95.         somId __desc,
  96.         va_list __ap)
  97. {
  98.     __ap; __id; __desc;           /* Referenced to prevent warning msg */
  99.  
  100.     Student_printStudentInfo(somSelf);
  101. }
  102.  
  103. #pragma linkage(somAP_getStudentType, system)
  104. static char *  SOMLINK somAP_getStudentType(Student *somSelf,
  105.         somId __id,
  106.         somId __desc,
  107.         va_list __ap)
  108. {
  109.     __ap; __id; __desc;           /* Referenced to prevent warning msg */
  110.  
  111.     return (Student_getStudentType(somSelf));
  112. }
  113.  
  114. #pragma linkage(somAP_getStudentID, system)
  115. static char *  SOMLINK somAP_getStudentID(Student *somSelf,
  116.         somId __id,
  117.         somId __desc,
  118.         va_list __ap)
  119. {
  120.     __ap; __id; __desc;           /* Referenced to prevent warning msg */
  121.  
  122.     return (Student_getStudentID(somSelf));
  123. }
  124.  
  125. #pragma linkage(somAP_SetStudentGPA, system)
  126. static void   SOMLINK somAP_SetStudentGPA(Student *somSelf,
  127.         somId __id,
  128.         somId __desc,
  129.         va_list __ap)
  130. {
  131.     int GPA = va_arg(__ap, int);
  132.     __ap; __id; __desc;           /* Referenced to prevent warning msg */
  133.  
  134.     Student_SetStudentGPA(somSelf,GPA);
  135. }
  136.  
  137. #pragma linkage(somAP_GetStudentGPA, system)
  138. static int   SOMLINK somAP_GetStudentGPA(Student *somSelf,
  139.         somId __id,
  140.         somId __desc,
  141.         va_list __ap)
  142. {
  143.     __ap; __id; __desc;           /* Referenced to prevent warning msg */
  144.  
  145.     return (Student_GetStudentGPA(somSelf));
  146. }
  147.  
  148.  
  149. /*
  150.  * Overridden method: somInit
  151.  */
  152. #pragma linkage(somInit, system)
  153. SOM_Scope void   SOMLINK somInit(Student *somSelf);
  154. #ifndef parent_somInit
  155. static char *somMN_somInit = "somInit";
  156. static somId somId_somInit = &somMN_somInit;
  157. #define parent_somInit(somSelf) \
  158.     ((SOM_ParentResolveE(SOMObject, SOM_CurrentClass, somInit)) \
  159.      (somSelf))
  160. #endif
  161. #define StudentParent_somInit parent_somInit
  162.  
  163. /*
  164.  * Temporary class data structure used only in class creation
  165.  */
  166. static somClassDataStructure StudenttempClassData;
  167.  
  168. /*
  169.  * Initialize the class data structure
  170.  */
  171. struct StudentClassDataStructure StudentClassData = {(SOMAny *) NULL};
  172.  
  173. /*
  174.  * Define the C class data structure
  175.  */
  176. struct StudentCClassDataStructure StudentCClassData = {(somMethodTab *) NULL};
  177.  
  178. /*
  179.  * New Method: setUpStudent
  180.  */
  181. #pragma linkage(setUpStudent, system)
  182. SOM_Scope void   SOMLINK setUpStudent(Student *somSelf,
  183.         char *id,
  184.         char *name);
  185. static char *somMN_setUpStudent = "setUpStudent";
  186. static somId somId_setUpStudent = &somMN_setUpStudent;
  187. static char *somDS_setUpStudent = somMD_Student_setUpStudent;
  188. static somId somDI_setUpStudent = &somDS_setUpStudent;
  189. #pragma linkage(somRD_setUpStudent, system)
  190. static void   SOMLINK somRD_setUpStudent(Student *somSelf,
  191.         char *id,
  192.         char *name)
  193. {
  194.     va_somDispatchV(somSelf, somId_setUpStudent,
  195.         _somGetMethodDescriptor(SOM_GetClass(somSelf),somId_setUpStudent),id,name);
  196. }
  197.  
  198. /*
  199.  * New Method: printStudentInfo
  200.  */
  201. #pragma linkage(printStudentInfo, system)
  202. SOM_Scope void   SOMLINK printStudentInfo(Student *somSelf);
  203. static char *somMN_printStudentInfo = "printStudentInfo";
  204. static somId somId_printStudentInfo = &somMN_printStudentInfo;
  205. static char *somDS_printStudentInfo = somMD_Student_printStudentInfo;
  206. static somId somDI_printStudentInfo = &somDS_printStudentInfo;
  207. #pragma linkage(somRD_printStudentInfo, system)
  208. static void   SOMLINK somRD_printStudentInfo(Student *somSelf)
  209. {
  210.     va_somDispatchV(somSelf, somId_printStudentInfo,
  211.         _somGetMethodDescriptor(SOM_GetClass(somSelf),somId_printStudentInfo));
  212. }
  213.  
  214. /*
  215.  * New Method: getStudentType
  216.  */
  217. #pragma linkage(getStudentType, system)
  218. SOM_Scope char *  SOMLINK getStudentType(Student *somSelf);
  219. static char *somMN_getStudentType = "getStudentType";
  220. static somId somId_getStudentType = &somMN_getStudentType;
  221. static char *somDS_getStudentType = somMD_Student_getStudentType;
  222. static somId somDI_getStudentType = &somDS_getStudentType;
  223. #pragma linkage(somRD_getStudentType, system)
  224. static char *  SOMLINK somRD_getStudentType(Student *somSelf)
  225. {
  226.     return ((char*) va_somDispatchA(somSelf, somId_getStudentType,
  227.         _somGetMethodDescriptor(SOM_GetClass(somSelf),somId_getStudentType)));
  228. }
  229.  
  230. /*
  231.  * New Method: getStudentID
  232.  */
  233. #pragma linkage(getStudentID, system)
  234. SOM_Scope char *  SOMLINK getStudentID(Student *somSelf);
  235. static char *somMN_getStudentID = "getStudentID";
  236. static somId somId_getStudentID = &somMN_getStudentID;
  237. static char *somDS_getStudentID = somMD_Student_getStudentID;
  238. static somId somDI_getStudentID = &somDS_getStudentID;
  239. #pragma linkage(somRD_getStudentID, system)
  240. static char *  SOMLINK somRD_getStudentID(Student *somSelf)
  241. {
  242.     return ((char*) va_somDispatchA(somSelf, somId_getStudentID,
  243.         _somGetMethodDescriptor(SOM_GetClass(somSelf),somId_getStudentID)));
  244. }
  245.  
  246. /*
  247.  * New Method: SetStudentGPA
  248.  */
  249. #pragma linkage(SetStudentGPA, system)
  250. SOM_Scope void   SOMLINK SetStudentGPA(Student *somSelf,
  251.         int GPA);
  252. static char *somMN_SetStudentGPA = "SetStudentGPA";
  253. static somId somId_SetStudentGPA = &somMN_SetStudentGPA;
  254. static char *somDS_SetStudentGPA = somMD_Student_SetStudentGPA;
  255. static somId somDI_SetStudentGPA = &somDS_SetStudentGPA;
  256. #pragma linkage(somRD_SetStudentGPA, system)
  257. static void   SOMLINK somRD_SetStudentGPA(Student *somSelf,
  258.         int GPA)
  259. {
  260.     va_somDispatchV(somSelf, somId_SetStudentGPA,
  261.         _somGetMethodDescriptor(SOM_GetClass(somSelf),somId_SetStudentGPA),GPA);
  262. }
  263.  
  264. /*
  265.  * New Method: GetStudentGPA
  266.  */
  267. #pragma linkage(GetStudentGPA, system)
  268. SOM_Scope int   SOMLINK GetStudentGPA(Student *somSelf);
  269. static char *somMN_GetStudentGPA = "GetStudentGPA";
  270. static somId somId_GetStudentGPA = &somMN_GetStudentGPA;
  271. static char *somDS_GetStudentGPA = somMD_Student_GetStudentGPA;
  272. static somId somDI_GetStudentGPA = &somDS_GetStudentGPA;
  273. #pragma linkage(somRD_GetStudentGPA, system)
  274. static int   SOMLINK somRD_GetStudentGPA(Student *somSelf)
  275. {
  276.     return ((int) va_somDispatchL(somSelf, somId_GetStudentGPA,
  277.         _somGetMethodDescriptor(SOM_GetClass(somSelf),somId_GetStudentGPA)));
  278. }
  279.  
  280. /*
  281.  * Routines to create the class object
  282.  */
  283.  
  284. /*
  285.  * Declare the Static Methods table.
  286.  */
  287. static somStaticMethod_t StudentSM[] = {
  288.     {    &StudentClassData.setUpStudent,
  289.          &somId_setUpStudent,
  290.          &somDI_setUpStudent,
  291.          (somMethodProc *) setUpStudent,
  292.          (somMethodProc *) somRD_setUpStudent,
  293.          (somMethodProc *) somAP_setUpStudent    },
  294.     {    &StudentClassData.printStudentInfo,
  295.          &somId_printStudentInfo,
  296.          &somDI_printStudentInfo,
  297.          (somMethodProc *) printStudentInfo,
  298.          (somMethodProc *) somRD_printStudentInfo,
  299.          (somMethodProc *) somAP_printStudentInfo    },
  300.     {    &StudentClassData.getStudentType,
  301.          &somId_getStudentType,
  302.          &somDI_getStudentType,
  303.          (somMethodProc *) getStudentType,
  304.          (somMethodProc *) somRD_getStudentType,
  305.          (somMethodProc *) somAP_getStudentType    },
  306.     {    &StudentClassData.getStudentID,
  307.          &somId_getStudentID,
  308.          &somDI_getStudentID,
  309.          (somMethodProc *) getStudentID,
  310.          (somMethodProc *) somRD_getStudentID,
  311.          (somMethodProc *) somAP_getStudentID    },
  312.     {    &StudentClassData.SetStudentGPA,
  313.          &somId_SetStudentGPA,
  314.          &somDI_SetStudentGPA,
  315.          (somMethodProc *) SetStudentGPA,
  316.          (somMethodProc *) somRD_SetStudentGPA,
  317.          (somMethodProc *) somAP_SetStudentGPA    },
  318.     {    &StudentClassData.GetStudentGPA,
  319.          &somId_GetStudentGPA,
  320.          &somDI_GetStudentGPA,
  321.          (somMethodProc *) GetStudentGPA,
  322.          (somMethodProc *) somRD_GetStudentGPA,
  323.          (somMethodProc *) somAP_GetStudentGPA    },
  324. };
  325.  
  326.  
  327. /*
  328.  * Declare the Override Methods table.
  329.  */
  330. static somOverrideMethod_t StudentOM[] = {
  331.     {    &somId_somInit,
  332.          (somMethodProc *) somInit    },
  333. };
  334.  
  335. static void StudentsomInitializeClass ()
  336. {
  337.     int i;
  338.     somStaticMethod_t *smp;
  339.     somOverrideMethod_t *omp;
  340.  
  341. /*
  342.  * Add the Static Methods.
  343.  */
  344.     for (smp = StudentSM, i = 0; i < 6; smp++, i++)
  345.         *(smp->classData) =
  346.             _somAddStaticMethod (StudenttempClassData.classObject,
  347.                 *(smp->methodId), *(smp->methodDescriptor),
  348.                 smp->method, smp->redispatchStub,
  349.                 smp->applyStub);
  350.  
  351.  
  352. /*
  353.  * Override methods.
  354.  */
  355.     for (omp = StudentOM, i = 0; i < 1; omp++, i++)
  356.         _somOverrideSMethod (StudenttempClassData.classObject,
  357.             *(omp->methodId), omp->method);
  358.  
  359. }
  360.  
  361. #pragma linkage(StudentsomCreateClass, system)
  362. static void SOMLINK StudentsomCreateClass(SOMClass *pClsObj,
  363.                            SOMClass *mClsObj)
  364. {
  365.     StudenttempClassData.classObject = _somNew (mClsObj);
  366.     _somInitClass (StudenttempClassData.classObject,
  367.         "Student",
  368.         pClsObj,
  369.         sizeof(StudentData),
  370.         Student_MaxNoMethods,
  371.         Student_MajorVersion,
  372.         Student_MinorVersion);
  373.     StudentCClassData.instanceDataToken = 
  374.     _somGetInstanceToken(StudenttempClassData.classObject);
  375.     StudentsomInitializeClass();
  376.     StudentCClassData.parentMtab =
  377.     _somGetPClsMtab(StudenttempClassData.classObject);
  378.     _somSetClassData(StudenttempClassData.classObject, (somClassDataStructure *)&StudentClassData);
  379.     _somClassReady(StudenttempClassData.classObject);
  380.     /* make newly created class object visible */
  381.     StudentClassData.classObject = StudenttempClassData.classObject;
  382. }
  383.  
  384. Student * SOMLINK StudentNewClass (integer4 scemajorVersion,
  385.         integer4 sceminorVersion)
  386. {
  387.     SOMClass *pClsObj;
  388.     SOMClass *mClsObj;
  389.  
  390.     /* Check the version numbers */
  391.     if (((scemajorVersion != 0) && 
  392.          (scemajorVersion != Student_MajorVersion)) ||
  393.         ((sceminorVersion != 0) && 
  394.          (sceminorVersion > Student_MinorVersion))) {
  395.     somPrintf("StudentNewClass: Error, bad version numbers.\n");
  396.     SOM_Error(SOMERROR_BadVersion);
  397.     }
  398.     /* Don't do anything if class object is already created. */
  399.     if (StudentClassData.classObject != (SOMAny *) NULL)
  400.     return(StudentClassData.classObject);
  401.  
  402.     /* Make sure the environment is initialized. */
  403.     if (SOMClassMgrObject == (SOMAny *) NULL) somEnvironmentNew();
  404.     if (SOMClassMgrObject == (SOMAny *) NULL)
  405.     SOM_Error(SOMERROR_CouldNotStartup);
  406.  
  407.     /* Get the parent class object. */
  408.     SOMObjectNewClass(1,1);    /* static reference */
  409.     pClsObj = _somFindClass(SOMClassMgrObject,
  410.         SOM_IdFromString("SOMObject"), 1, 1);
  411.     if (pClsObj == (SOMClass *) NULL)
  412.     SOM_Error(SOMERROR_NoParentClass);
  413.  
  414.     /* Explicit metaclass, so get it */ 
  415.     M_StudentNewClass(0,0);    /* static reference */
  416.     mClsObj = _somFindClass(SOMClassMgrObject,
  417.         SOM_IdFromString("M_Student"), 0, 0);
  418.     if (mClsObj == (SOMClass *) NULL)
  419.     SOM_Error(SOMERROR_NoMetaClass);
  420.  
  421.     somConstructClass(StudentsomCreateClass, pClsObj, mClsObj,
  422.              &StudenttempClassData);
  423.     return (StudentClassData.classObject);
  424. }
  425.  
  426. #endif                   /* Student_Class_Source */
  427.  
  428. #endif       /* STUDENT_ih */
  429.  
  430. /*
  431.  * This file was generated by the SOM Compiler.
  432.  * FileName: .\STUDENT.ih.
  433.  * Generated using:
  434.  *     SOM Precompiler spc: 1.22
  435.  *     SOM Emitter emitih: 1.59
  436.  */
  437.  
  438. #ifndef STUDENT_mih
  439. #define STUDENT_mih
  440.  
  441.  
  442. /*
  443.  * Set the scope of methods functions
  444.  */
  445. #ifndef SOM_Scope
  446. #define SOM_Scope static
  447. #endif
  448.  
  449. #ifndef SOM_CurrentClass
  450. #define SOM_CurrentClass M_StudentCClassData.parentMtab
  451. #endif
  452.  
  453. #define M_Student_MaxNoMethods 1
  454.  
  455. /*
  456.  * Instance data
  457.  */
  458. typedef struct {
  459.     int count;
  460. } M_StudentData;
  461.  
  462. /*
  463.  * Instance variable access macros
  464.  */
  465. #define _count (somThis->count)
  466.  
  467. /*
  468.  * Getdata macro
  469.  */
  470. #define M_StudentGetData(somSelf) \
  471.     ((M_StudentData *) \
  472.         SOM_DataResolve(somSelf, M_StudentCClassData.instanceDataToken))
  473.  
  474. /*
  475.  * Trace/Debug macro
  476.  */
  477. #ifndef M_StudentMethodDebug
  478. #define M_StudentMethodDebug(c,m) SOMMethodDebug(c,m)
  479. #endif
  480.  
  481. /*
  482.  * Begin stuff that only goes in the primary file
  483.  */
  484. #ifdef M_Student_Class_Source
  485.  
  486. /*
  487.  * Current class macros for Instance and Meta classes.
  488.  */
  489.  
  490. /*
  491.  * Generate the Apply Stubs.
  492.  */
  493. #pragma linkage(somAP_countObjects, system)
  494. static int   SOMLINK somAP_countObjects(M_Student *somSelf,
  495.         somId __id,
  496.         somId __desc,
  497.         va_list __ap)
  498. {
  499.     __ap; __id; __desc;           /* Referenced to prevent warning msg */
  500.  
  501.     return (M_Student_countObjects(somSelf));
  502. }
  503.  
  504.  
  505. /*
  506.  * Overridden method: somInit
  507.  */
  508. #pragma linkage(StudentClass_somInit, system)
  509. SOM_Scope void   SOMLINK StudentClass_somInit(M_Student *somSelf);
  510. #ifndef parent_somInit
  511. static char *somMN_somInit = "somInit";
  512. static somId somId_somInit = &somMN_somInit;
  513. #define parent_somInit(somSelf) \
  514.     ((SOM_ParentResolveE(SOMObject, SOM_CurrentClass, somInit)) \
  515.      (somSelf))
  516. #endif
  517. #define M_StudentParent_somInit parent_somInit
  518.  
  519. /*
  520.  * Overridden method: somNew
  521.  */
  522. #pragma linkage(StudentClass_somNew, system)
  523. SOM_Scope SOMAny *  SOMLINK StudentClass_somNew(M_Student *somSelf);
  524. #ifndef parent_somNew
  525. static char *somMN_somNew = "somNew";
  526. static somId somId_somNew = &somMN_somNew;
  527. #define parent_somNew(somSelf) \
  528.     ((SOM_ParentResolveE(SOMClass, SOM_CurrentClass, somNew)) \
  529.      (somSelf))
  530. #endif
  531. #define M_StudentParent_somNew parent_somNew
  532.  
  533. /*
  534.  * Temporary class data structure used only in class creation
  535.  */
  536. static somClassDataStructure M_StudenttempClassData;
  537.  
  538. /*
  539.  * Initialize the class data structure
  540.  */
  541. struct M_StudentClassDataStructure M_StudentClassData = {(SOMAny *) NULL};
  542.  
  543. /*
  544.  * Define the C class data structure
  545.  */
  546. struct M_StudentCClassDataStructure M_StudentCClassData = {(somMethodTab *) NULL};
  547.  
  548. /*
  549.  * New Method: countObjects
  550.  */
  551. #pragma linkage(StudentClass_countObjects, system)
  552. SOM_Scope int   SOMLINK StudentClass_countObjects(M_Student *somSelf);
  553. static char *somMN_countObjects = "countObjects";
  554. static somId somId_countObjects = &somMN_countObjects;
  555. static char *somDS_countObjects = somMD_M_Student_countObjects;
  556. static somId somDI_countObjects = &somDS_countObjects;
  557. #pragma linkage(somRD_countObjects, system)
  558. static int   SOMLINK somRD_countObjects(M_Student *somSelf)
  559. {
  560.     return ((int) va_somDispatchL(somSelf, somId_countObjects,
  561.         _somGetMethodDescriptor(SOM_GetClass(somSelf),somId_countObjects)));
  562. }
  563.  
  564. /*
  565.  * Routines to create the class object
  566.  */
  567.  
  568. /*
  569.  * Declare the Static Methods table.
  570.  */
  571. static somStaticMethod_t M_StudentSM[] = {
  572.     {    &M_StudentClassData.countObjects,
  573.          &somId_countObjects,
  574.          &somDI_countObjects,
  575.          (somMethodProc *) StudentClass_countObjects,
  576.          (somMethodProc *) somRD_countObjects,
  577.          (somMethodProc *) somAP_countObjects    },
  578. };
  579.  
  580.  
  581. /*
  582.  * Declare the Override Methods table.
  583.  */
  584. static somOverrideMethod_t M_StudentOM[] = {
  585.     {    &somId_somInit,
  586.          (somMethodProc *) StudentClass_somInit    },
  587.     {    &somId_somNew,
  588.          (somMethodProc *) StudentClass_somNew    },
  589. };
  590.  
  591. static void M_StudentsomInitializeClass ()
  592. {
  593.     int i;
  594.     somStaticMethod_t *smp;
  595.     somOverrideMethod_t *omp;
  596.  
  597. /*
  598.  * Add the Static Methods.
  599.  */
  600.     for (smp = M_StudentSM, i = 0; i < 1; smp++, i++)
  601.         *(smp->classData) =
  602.             _somAddStaticMethod (M_StudenttempClassData.classObject,
  603.                 *(smp->methodId), *(smp->methodDescriptor),
  604.                 smp->method, smp->redispatchStub,
  605.                 smp->applyStub);
  606.  
  607.  
  608. /*
  609.  * Override methods.
  610.  */
  611.     for (omp = M_StudentOM, i = 0; i < 2; omp++, i++)
  612.         _somOverrideSMethod (M_StudenttempClassData.classObject,
  613.             *(omp->methodId), omp->method);
  614.  
  615. }
  616.  
  617. #pragma linkage(M_StudentsomCreateClass, system)
  618. static void SOMLINK M_StudentsomCreateClass(SOMClass *pClsObj,
  619.                            SOMClass *mClsObj)
  620. {
  621.     M_StudenttempClassData.classObject = _somNew (mClsObj);
  622.     _somInitClass (M_StudenttempClassData.classObject,
  623.         "M_Student",
  624.         pClsObj,
  625.         sizeof(M_StudentData),
  626.         M_Student_MaxNoMethods,
  627.         M_Student_MajorVersion,
  628.         M_Student_MinorVersion);
  629.     M_StudentCClassData.instanceDataToken = 
  630.     _somGetInstanceToken(M_StudenttempClassData.classObject);
  631.     M_StudentsomInitializeClass();
  632.     M_StudentCClassData.parentMtab =
  633.     _somGetPClsMtab(M_StudenttempClassData.classObject);
  634.     _somSetClassData(M_StudenttempClassData.classObject, (somClassDataStructure *)&M_StudentClassData);
  635.     _somClassReady(M_StudenttempClassData.classObject);
  636.     /* make newly created class object visible */
  637.     M_StudentClassData.classObject = M_StudenttempClassData.classObject;
  638. }
  639.  
  640. M_Student * SOMLINK M_StudentNewClass (integer4 scemajorVersion,
  641.         integer4 sceminorVersion)
  642. {
  643.     SOMClass *pClsObj;
  644.     SOMClass *mClsObj;
  645.  
  646.     /* Check the version numbers */
  647.     if (((scemajorVersion != 0) && 
  648.          (scemajorVersion != M_Student_MajorVersion)) ||
  649.         ((sceminorVersion != 0) && 
  650.          (sceminorVersion > M_Student_MinorVersion))) {
  651.     somPrintf("M_StudentNewClass: Error, bad version numbers.\n");
  652.     SOM_Error(SOMERROR_BadVersion);
  653.     }
  654.     /* Don't do anything if class object is already created. */
  655.     if (M_StudentClassData.classObject != (SOMAny *) NULL)
  656.     return(M_StudentClassData.classObject);
  657.  
  658.     /* Make sure the environment is initialized. */
  659.     if (SOMClassMgrObject == (SOMAny *) NULL) somEnvironmentNew();
  660.     if (SOMClassMgrObject == (SOMAny *) NULL)
  661.     SOM_Error(SOMERROR_CouldNotStartup);
  662.  
  663.     /* Get the parent class object. */
  664.     SOMClassNewClass(1,1);    /* static reference */
  665.     pClsObj = _somFindClass(SOMClassMgrObject,
  666.         SOM_IdFromString("SOMClass"), 1, 1);
  667.     if (pClsObj == (SOMClass *) NULL)
  668.     SOM_Error(SOMERROR_NoParentClass);
  669.  
  670.     /* Use parent's metaclass */ 
  671.     mClsObj = SOM_GetClass(pClsObj);
  672.  
  673.     somConstructClass(M_StudentsomCreateClass, pClsObj, mClsObj,
  674.              &M_StudenttempClassData);
  675.     return (M_StudentClassData.classObject);
  676. }
  677.  
  678. #endif                   /* M_Student_Class_Source */
  679.  
  680. #endif       /* STUDENT_ih */
  681.