home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / WPSDEM.ZIP / COMPUTER / MICRO.IH < prev    next >
Text File  |  1992-08-06  |  16KB  |  578 lines

  1.  
  2. /*
  3.  * This file was generated by the SOM Compiler.
  4.  * FileName: micro.ih.
  5.  * Generated using:
  6.  *     SOM Precompiler spc: 1.22
  7.  *     SOM Emitter emitih: 1.59
  8.  */
  9.  
  10. #ifndef micro_ih
  11. #define micro_ih
  12.  
  13.  
  14. /*
  15.  * Passthru lines: File: "C.ih", "before"
  16.  */
  17. #include <stdio.h>
  18.  
  19. #include "micro.h"
  20.  
  21. /*
  22.  * Set the scope of methods functions
  23.  */
  24. #ifndef SOM_Scope
  25. #define SOM_Scope static
  26. #endif
  27.  
  28. #ifndef SOM_CurrentClass
  29. #define SOM_CurrentClass MicrocomputerCClassData.parentMtab
  30. #endif
  31.  
  32. #define Microcomputer_MaxNoMethods 10
  33.  
  34. /*
  35.  * Instance data
  36.  */
  37. typedef struct {
  38.     double Registers[26];
  39.     double Stack[20];
  40.     int SP;
  41. } MicrocomputerData;
  42.  
  43. /*
  44.  * Instance variable access macros
  45.  */
  46. #define _Registers (somThis->Registers)
  47. #define _Stack (somThis->Stack)
  48. #define _SP (somThis->SP)
  49.  
  50. /*
  51.  * Getdata macro
  52.  */
  53. #define MicrocomputerGetData(somSelf) \
  54.     ((MicrocomputerData *) \
  55.         SOM_DataResolve(somSelf, MicrocomputerCClassData.instanceDataToken))
  56.  
  57. /*
  58.  * Trace/Debug macro
  59.  */
  60. #ifndef MicrocomputerMethodDebug
  61. #define MicrocomputerMethodDebug(c,m) SOMMethodDebug(c,m)
  62. #endif
  63.  
  64. /*
  65.  * Begin stuff that only goes in the primary file
  66.  */
  67. #ifdef Microcomputer_Class_Source
  68.  
  69. /*
  70.  * Current class macros for Instance and Meta classes.
  71.  */
  72. #undef SOMMeta
  73. #define SOMMeta M_MicrocomputerCClassData.parentMtab
  74. #undef SOMInstance
  75. #define SOMInstance MicrocomputerCClassData.parentMtab
  76.  
  77. #ifndef M_Microcomputer_Class_Source
  78. #define M_Microcomputer_Class_Source
  79. #endif    /* M_Microcomputer_Class_Source */
  80.  
  81. /*
  82.  * Generate the Apply Stubs.
  83.  */
  84. #pragma linkage(somAP_Add, system)
  85. static void   SOMLINK somAP_Add(Microcomputer *somSelf,
  86.         somId __id,
  87.         somId __desc,
  88.         va_list __ap)
  89. {
  90.     __ap; __id; __desc;           /* Referenced to prevent warning msg */
  91.  
  92.     Microcomputer_Add(somSelf);
  93. }
  94.  
  95. #pragma linkage(somAP_Sub, system)
  96. static void   SOMLINK somAP_Sub(Microcomputer *somSelf,
  97.         somId __id,
  98.         somId __desc,
  99.         va_list __ap)
  100. {
  101.     __ap; __id; __desc;           /* Referenced to prevent warning msg */
  102.  
  103.     Microcomputer_Sub(somSelf);
  104. }
  105.  
  106. #pragma linkage(somAP_Mul, system)
  107. static void   SOMLINK somAP_Mul(Microcomputer *somSelf,
  108.         somId __id,
  109.         somId __desc,
  110.         va_list __ap)
  111. {
  112.     __ap; __id; __desc;           /* Referenced to prevent warning msg */
  113.  
  114.     Microcomputer_Mul(somSelf);
  115. }
  116.  
  117. #pragma linkage(somAP_Div, system)
  118. static void   SOMLINK somAP_Div(Microcomputer *somSelf,
  119.         somId __id,
  120.         somId __desc,
  121.         va_list __ap)
  122. {
  123.     __ap; __id; __desc;           /* Referenced to prevent warning msg */
  124.  
  125.     Microcomputer_Div(somSelf);
  126. }
  127.  
  128. #pragma linkage(somAP_Pop, system)
  129. static double   SOMLINK somAP_Pop(Microcomputer *somSelf,
  130.         somId __id,
  131.         somId __desc,
  132.         va_list __ap)
  133. {
  134.     __ap; __id; __desc;           /* Referenced to prevent warning msg */
  135.  
  136.     return (Microcomputer_Pop(somSelf));
  137. }
  138.  
  139. #pragma linkage(somAP_Push, system)
  140. static void   SOMLINK somAP_Push(Microcomputer *somSelf,
  141.         somId __id,
  142.         somId __desc,
  143.         va_list __ap)
  144. {
  145.     double Item = va_arg(__ap, double);
  146.     __ap; __id; __desc;           /* Referenced to prevent warning msg */
  147.  
  148.     Microcomputer_Push(somSelf,Item);
  149. }
  150.  
  151. #pragma linkage(somAP_Store, system)
  152. static void   SOMLINK somAP_Store(Microcomputer *somSelf,
  153.         somId __id,
  154.         somId __desc,
  155.         va_list __ap)
  156. {
  157.     int Reg = va_arg(__ap, int);
  158.     __ap; __id; __desc;           /* Referenced to prevent warning msg */
  159.  
  160.     Microcomputer_Store(somSelf,Reg);
  161. }
  162.  
  163. #pragma linkage(somAP_Fetch, system)
  164. static void   SOMLINK somAP_Fetch(Microcomputer *somSelf,
  165.         somId __id,
  166.         somId __desc,
  167.         va_list __ap)
  168. {
  169.     int Reg = va_arg(__ap, int);
  170.     __ap; __id; __desc;           /* Referenced to prevent warning msg */
  171.  
  172.     Microcomputer_Fetch(somSelf,Reg);
  173. }
  174.  
  175. #pragma linkage(somAP_Input, system)
  176. static void   SOMLINK somAP_Input(Microcomputer *somSelf,
  177.         somId __id,
  178.         somId __desc,
  179.         va_list __ap)
  180. {
  181.     __ap; __id; __desc;           /* Referenced to prevent warning msg */
  182.  
  183.     Microcomputer_Input(somSelf);
  184. }
  185.  
  186. #pragma linkage(somAP_Output, system)
  187. static void   SOMLINK somAP_Output(Microcomputer *somSelf,
  188.         somId __id,
  189.         somId __desc,
  190.         va_list __ap)
  191. {
  192.     __ap; __id; __desc;           /* Referenced to prevent warning msg */
  193.  
  194.     Microcomputer_Output(somSelf);
  195. }
  196.  
  197.  
  198. /*
  199.  * Overridden method: somInit
  200.  */
  201. #pragma linkage(somInit, system)
  202. SOM_Scope void   SOMLINK somInit(Microcomputer *somSelf);
  203. #ifndef parent_somInit
  204. static char *somMN_somInit = "somInit";
  205. static somId somId_somInit = &somMN_somInit;
  206. #define parent_somInit(somSelf) \
  207.     ((SOM_ParentResolveE(SOMObject, SOM_CurrentClass, somInit)) \
  208.      (somSelf))
  209. #endif
  210. #define MicrocomputerParent_somInit parent_somInit
  211.  
  212. /*
  213.  * Overridden method: somUninit
  214.  */
  215. #pragma linkage(somUninit, system)
  216. SOM_Scope void   SOMLINK somUninit(Microcomputer *somSelf);
  217. #ifndef parent_somUninit
  218. static char *somMN_somUninit = "somUninit";
  219. static somId somId_somUninit = &somMN_somUninit;
  220. #define parent_somUninit(somSelf) \
  221.     ((SOM_ParentResolveE(SOMObject, SOM_CurrentClass, somUninit)) \
  222.      (somSelf))
  223. #endif
  224. #define MicrocomputerParent_somUninit parent_somUninit
  225.  
  226. /*
  227.  * Temporary class data structure used only in class creation
  228.  */
  229. static somClassDataStructure MicrocomputertempClassData;
  230.  
  231. /*
  232.  * Initialize the class data structure
  233.  */
  234. struct MicrocomputerClassDataStructure MicrocomputerClassData = {(SOMAny *) NULL};
  235.  
  236. /*
  237.  * Define the C class data structure
  238.  */
  239. struct MicrocomputerCClassDataStructure MicrocomputerCClassData = {(somMethodTab *) NULL};
  240.  
  241. /*
  242.  * New Method: Add
  243.  */
  244. #pragma linkage(Add, system)
  245. SOM_Scope void   SOMLINK Add(Microcomputer *somSelf);
  246. static char *somMN_Add = "Add";
  247. static somId somId_Add = &somMN_Add;
  248. static char *somDS_Add = somMD_Microcomputer_Add;
  249. static somId somDI_Add = &somDS_Add;
  250. #pragma linkage(somRD_Add, system)
  251. static void   SOMLINK somRD_Add(Microcomputer *somSelf)
  252. {
  253.     va_somDispatchV(somSelf, somId_Add,
  254.         _somGetMethodDescriptor(SOM_GetClass(somSelf),somId_Add));
  255. }
  256.  
  257. /*
  258.  * New Method: Sub
  259.  */
  260. #pragma linkage(Sub, system)
  261. SOM_Scope void   SOMLINK Sub(Microcomputer *somSelf);
  262. static char *somMN_Sub = "Sub";
  263. static somId somId_Sub = &somMN_Sub;
  264. static char *somDS_Sub = somMD_Microcomputer_Sub;
  265. static somId somDI_Sub = &somDS_Sub;
  266. #pragma linkage(somRD_Sub, system)
  267. static void   SOMLINK somRD_Sub(Microcomputer *somSelf)
  268. {
  269.     va_somDispatchV(somSelf, somId_Sub,
  270.         _somGetMethodDescriptor(SOM_GetClass(somSelf),somId_Sub));
  271. }
  272.  
  273. /*
  274.  * New Method: Mul
  275.  */
  276. #pragma linkage(Mul, system)
  277. SOM_Scope void   SOMLINK Mul(Microcomputer *somSelf);
  278. static char *somMN_Mul = "Mul";
  279. static somId somId_Mul = &somMN_Mul;
  280. static char *somDS_Mul = somMD_Microcomputer_Mul;
  281. static somId somDI_Mul = &somDS_Mul;
  282. #pragma linkage(somRD_Mul, system)
  283. static void   SOMLINK somRD_Mul(Microcomputer *somSelf)
  284. {
  285.     va_somDispatchV(somSelf, somId_Mul,
  286.         _somGetMethodDescriptor(SOM_GetClass(somSelf),somId_Mul));
  287. }
  288.  
  289. /*
  290.  * New Method: Div
  291.  */
  292. #pragma linkage(Div, system)
  293. SOM_Scope void   SOMLINK Div(Microcomputer *somSelf);
  294. static char *somMN_Div = "Div";
  295. static somId somId_Div = &somMN_Div;
  296. static char *somDS_Div = somMD_Microcomputer_Div;
  297. static somId somDI_Div = &somDS_Div;
  298. #pragma linkage(somRD_Div, system)
  299. static void   SOMLINK somRD_Div(Microcomputer *somSelf)
  300. {
  301.     va_somDispatchV(somSelf, somId_Div,
  302.         _somGetMethodDescriptor(SOM_GetClass(somSelf),somId_Div));
  303. }
  304.  
  305. /*
  306.  * New Method: Pop
  307.  */
  308. #pragma linkage(Pop, system)
  309. SOM_Scope double   SOMLINK Pop(Microcomputer *somSelf);
  310. static char *somMN_Pop = "Pop";
  311. static somId somId_Pop = &somMN_Pop;
  312. static char *somDS_Pop = somMD_Microcomputer_Pop;
  313. static somId somDI_Pop = &somDS_Pop;
  314. #pragma linkage(somRD_Pop, system)
  315. static double   SOMLINK somRD_Pop(Microcomputer *somSelf)
  316. {
  317.     return ((double) va_somDispatchD(somSelf, somId_Pop,
  318.         _somGetMethodDescriptor(SOM_GetClass(somSelf),somId_Pop)));
  319. }
  320.  
  321. /*
  322.  * New Method: Push
  323.  */
  324. #pragma linkage(Push, system)
  325. SOM_Scope void   SOMLINK Push(Microcomputer *somSelf,
  326.         double Item);
  327. static char *somMN_Push = "Push";
  328. static somId somId_Push = &somMN_Push;
  329. static char *somDS_Push = somMD_Microcomputer_Push;
  330. static somId somDI_Push = &somDS_Push;
  331. #pragma linkage(somRD_Push, system)
  332. static void   SOMLINK somRD_Push(Microcomputer *somSelf,
  333.         double Item)
  334. {
  335.     va_somDispatchV(somSelf, somId_Push,
  336.         _somGetMethodDescriptor(SOM_GetClass(somSelf),somId_Push),Item);
  337. }
  338.  
  339. /*
  340.  * New Method: Store
  341.  */
  342. #pragma linkage(Store, system)
  343. SOM_Scope void   SOMLINK Store(Microcomputer *somSelf,
  344.         int Reg);
  345. static char *somMN_Store = "Store";
  346. static somId somId_Store = &somMN_Store;
  347. static char *somDS_Store = somMD_Microcomputer_Store;
  348. static somId somDI_Store = &somDS_Store;
  349. #pragma linkage(somRD_Store, system)
  350. static void   SOMLINK somRD_Store(Microcomputer *somSelf,
  351.         int Reg)
  352. {
  353.     va_somDispatchV(somSelf, somId_Store,
  354.         _somGetMethodDescriptor(SOM_GetClass(somSelf),somId_Store),Reg);
  355. }
  356.  
  357. /*
  358.  * New Method: Fetch
  359.  */
  360. #pragma linkage(Fetch, system)
  361. SOM_Scope void   SOMLINK Fetch(Microcomputer *somSelf,
  362.         int Reg);
  363. static char *somMN_Fetch = "Fetch";
  364. static somId somId_Fetch = &somMN_Fetch;
  365. static char *somDS_Fetch = somMD_Microcomputer_Fetch;
  366. static somId somDI_Fetch = &somDS_Fetch;
  367. #pragma linkage(somRD_Fetch, system)
  368. static void   SOMLINK somRD_Fetch(Microcomputer *somSelf,
  369.         int Reg)
  370. {
  371.     va_somDispatchV(somSelf, somId_Fetch,
  372.         _somGetMethodDescriptor(SOM_GetClass(somSelf),somId_Fetch),Reg);
  373. }
  374.  
  375. /*
  376.  * New Method: Input
  377.  */
  378. #pragma linkage(Input, system)
  379. SOM_Scope void   SOMLINK Input(Microcomputer *somSelf);
  380. static char *somMN_Input = "Input";
  381. static somId somId_Input = &somMN_Input;
  382. static char *somDS_Input = somMD_Microcomputer_Input;
  383. static somId somDI_Input = &somDS_Input;
  384. #pragma linkage(somRD_Input, system)
  385. static void   SOMLINK somRD_Input(Microcomputer *somSelf)
  386. {
  387.     va_somDispatchV(somSelf, somId_Input,
  388.         _somGetMethodDescriptor(SOM_GetClass(somSelf),somId_Input));
  389. }
  390.  
  391. /*
  392.  * New Method: Output
  393.  */
  394. #pragma linkage(Output, system)
  395. SOM_Scope void   SOMLINK Output(Microcomputer *somSelf);
  396. static char *somMN_Output = "Output";
  397. static somId somId_Output = &somMN_Output;
  398. static char *somDS_Output = somMD_Microcomputer_Output;
  399. static somId somDI_Output = &somDS_Output;
  400. #pragma linkage(somRD_Output, system)
  401. static void   SOMLINK somRD_Output(Microcomputer *somSelf)
  402. {
  403.     va_somDispatchV(somSelf, somId_Output,
  404.         _somGetMethodDescriptor(SOM_GetClass(somSelf),somId_Output));
  405. }
  406.  
  407. /*
  408.  * Routines to create the class object
  409.  */
  410.  
  411. /*
  412.  * Declare the Static Methods table.
  413.  */
  414. static somStaticMethod_t MicrocomputerSM[] = {
  415.     {    &MicrocomputerClassData.Add,
  416.          &somId_Add,
  417.          &somDI_Add,
  418.          (somMethodProc *) Add,
  419.          (somMethodProc *) somRD_Add,
  420.          (somMethodProc *) somAP_Add    },
  421.     {    &MicrocomputerClassData.Sub,
  422.          &somId_Sub,
  423.          &somDI_Sub,
  424.          (somMethodProc *) Sub,
  425.          (somMethodProc *) somRD_Sub,
  426.          (somMethodProc *) somAP_Sub    },
  427.     {    &MicrocomputerClassData.Mul,
  428.          &somId_Mul,
  429.          &somDI_Mul,
  430.          (somMethodProc *) Mul,
  431.          (somMethodProc *) somRD_Mul,
  432.          (somMethodProc *) somAP_Mul    },
  433.     {    &MicrocomputerClassData.Div,
  434.          &somId_Div,
  435.          &somDI_Div,
  436.          (somMethodProc *) Div,
  437.          (somMethodProc *) somRD_Div,
  438.          (somMethodProc *) somAP_Div    },
  439.     {    &MicrocomputerClassData.Pop,
  440.          &somId_Pop,
  441.          &somDI_Pop,
  442.          (somMethodProc *) Pop,
  443.          (somMethodProc *) somRD_Pop,
  444.          (somMethodProc *) somAP_Pop    },
  445.     {    &MicrocomputerClassData.Push,
  446.          &somId_Push,
  447.          &somDI_Push,
  448.          (somMethodProc *) Push,
  449.          (somMethodProc *) somRD_Push,
  450.          (somMethodProc *) somAP_Push    },
  451.     {    &MicrocomputerClassData.Store,
  452.          &somId_Store,
  453.          &somDI_Store,
  454.          (somMethodProc *) Store,
  455.          (somMethodProc *) somRD_Store,
  456.          (somMethodProc *) somAP_Store    },
  457.     {    &MicrocomputerClassData.Fetch,
  458.          &somId_Fetch,
  459.          &somDI_Fetch,
  460.          (somMethodProc *) Fetch,
  461.          (somMethodProc *) somRD_Fetch,
  462.          (somMethodProc *) somAP_Fetch    },
  463.     {    &MicrocomputerClassData.Input,
  464.          &somId_Input,
  465.          &somDI_Input,
  466.          (somMethodProc *) Input,
  467.          (somMethodProc *) somRD_Input,
  468.          (somMethodProc *) somAP_Input    },
  469.     {    &MicrocomputerClassData.Output,
  470.          &somId_Output,
  471.          &somDI_Output,
  472.          (somMethodProc *) Output,
  473.          (somMethodProc *) somRD_Output,
  474.          (somMethodProc *) somAP_Output    },
  475. };
  476.  
  477.  
  478. /*
  479.  * Declare the Override Methods table.
  480.  */
  481. static somOverrideMethod_t MicrocomputerOM[] = {
  482.     {    &somId_somInit,
  483.          (somMethodProc *) somInit    },
  484.     {    &somId_somUninit,
  485.          (somMethodProc *) somUninit    },
  486. };
  487.  
  488. static void MicrocomputersomInitializeClass ()
  489. {
  490.     int i;
  491.     somStaticMethod_t *smp;
  492.     somOverrideMethod_t *omp;
  493.  
  494. /*
  495.  * Add the Static Methods.
  496.  */
  497.     for (smp = MicrocomputerSM, i = 0; i < 10; smp++, i++)
  498.         *(smp->classData) =
  499.             _somAddStaticMethod (MicrocomputertempClassData.classObject,
  500.                 *(smp->methodId), *(smp->methodDescriptor),
  501.                 smp->method, smp->redispatchStub,
  502.                 smp->applyStub);
  503.  
  504.  
  505. /*
  506.  * Override methods.
  507.  */
  508.     for (omp = MicrocomputerOM, i = 0; i < 2; omp++, i++)
  509.         _somOverrideSMethod (MicrocomputertempClassData.classObject,
  510.             *(omp->methodId), omp->method);
  511.  
  512. }
  513.  
  514. #pragma linkage(MicrocomputersomCreateClass, system)
  515. static void SOMLINK MicrocomputersomCreateClass(SOMClass *pClsObj,
  516.                            SOMClass *mClsObj)
  517. {
  518.     MicrocomputertempClassData.classObject = _somNew (mClsObj);
  519.     _somInitClass (MicrocomputertempClassData.classObject,
  520.         "Microcomputer",
  521.         pClsObj,
  522.         sizeof(MicrocomputerData),
  523.         Microcomputer_MaxNoMethods,
  524.         Microcomputer_MajorVersion,
  525.         Microcomputer_MinorVersion);
  526.     MicrocomputerCClassData.instanceDataToken = 
  527.     _somGetInstanceToken(MicrocomputertempClassData.classObject);
  528.     MicrocomputersomInitializeClass();
  529.     MicrocomputerCClassData.parentMtab =
  530.     _somGetPClsMtab(MicrocomputertempClassData.classObject);
  531.     _somSetClassData(MicrocomputertempClassData.classObject, (somClassDataStructure *)&MicrocomputerClassData);
  532.     _somClassReady(MicrocomputertempClassData.classObject);
  533.     /* make newly created class object visible */
  534.     MicrocomputerClassData.classObject = MicrocomputertempClassData.classObject;
  535. }
  536.  
  537. Microcomputer * SOMLINK MicrocomputerNewClass (integer4 scemajorVersion,
  538.         integer4 sceminorVersion)
  539. {
  540.     SOMClass *pClsObj;
  541.     SOMClass *mClsObj;
  542.  
  543.     /* Check the version numbers */
  544.     if (((scemajorVersion != 0) && 
  545.          (scemajorVersion != Microcomputer_MajorVersion)) ||
  546.         ((sceminorVersion != 0) && 
  547.          (sceminorVersion > Microcomputer_MinorVersion))) {
  548.     somPrintf("MicrocomputerNewClass: Error, bad version numbers.\n");
  549.     SOM_Error(SOMERROR_BadVersion);
  550.     }
  551.     /* Don't do anything if class object is already created. */
  552.     if (MicrocomputerClassData.classObject != (SOMAny *) NULL)
  553.     return(MicrocomputerClassData.classObject);
  554.  
  555.     /* Make sure the environment is initialized. */
  556.     if (SOMClassMgrObject == (SOMAny *) NULL) somEnvironmentNew();
  557.     if (SOMClassMgrObject == (SOMAny *) NULL)
  558.     SOM_Error(SOMERROR_CouldNotStartup);
  559.  
  560.     /* Get the parent class object. */
  561.     SOMObjectNewClass(1,1);    /* static reference */
  562.     pClsObj = _somFindClass(SOMClassMgrObject,
  563.         SOM_IdFromString("SOMObject"), 1, 1);
  564.     if (pClsObj == (SOMClass *) NULL)
  565.     SOM_Error(SOMERROR_NoParentClass);
  566.  
  567.     /* Use parent's metaclass */ 
  568.     mClsObj = SOM_GetClass(pClsObj);
  569.  
  570.     somConstructClass(MicrocomputersomCreateClass, pClsObj, mClsObj,
  571.              &MicrocomputertempClassData);
  572.     return (MicrocomputerClassData.classObject);
  573. }
  574.  
  575. #endif                   /* Microcomputer_Class_Source */
  576.  
  577. #endif       /* micro_ih */
  578.