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

  1.  
  2. /*
  3.  * This file was generated by the SOM Compiler.
  4.  * FileName: micro.c.
  5.  * Generated using:
  6.  *     SOM Precompiler spc: 1.22
  7.  *     SOM Emitter emitc: 1.24
  8.  */
  9.  
  10. #define Microcomputer_Class_Source
  11. #include "micro.ih"
  12.  
  13. double x, y;
  14.  
  15. SOM_Scope void   SOMLINK Add(Microcomputer *somSelf)
  16. {
  17.  
  18.     MicrocomputerData *somThis = MicrocomputerGetData(somSelf);
  19.     MicrocomputerMethodDebug("Microcomputer","Add");
  20.  
  21.     x = _Pop(somSelf);
  22.     y = _Pop(somSelf);
  23.  
  24.     _Push(somSelf, (y + x));
  25. }
  26.  
  27. SOM_Scope void   SOMLINK Sub(Microcomputer *somSelf)
  28. {
  29.     MicrocomputerData *somThis = MicrocomputerGetData(somSelf);
  30.     MicrocomputerMethodDebug("Microcomputer","Sub");
  31.  
  32.     x = _Pop(somSelf);
  33.     y = _Pop(somSelf);
  34.  
  35.     _Push(somSelf, (y - x));
  36. }
  37.  
  38. SOM_Scope void   SOMLINK Mul(Microcomputer *somSelf)
  39. {
  40.     MicrocomputerData *somThis = MicrocomputerGetData(somSelf);
  41.     MicrocomputerMethodDebug("Microcomputer","Mul");
  42.  
  43.     x = _Pop(somSelf);
  44.     y = _Pop(somSelf);
  45.  
  46.     _Push(somSelf, (y * x));
  47. }
  48.  
  49. SOM_Scope void   SOMLINK Div(Microcomputer *somSelf)
  50. {
  51.     MicrocomputerData *somThis = MicrocomputerGetData(somSelf);
  52.     MicrocomputerMethodDebug("Microcomputer","Div");
  53.  
  54.     x = _Pop(somSelf);
  55.     y = _Pop(somSelf);
  56.  
  57.     _Push(somSelf, (y / x));
  58. }
  59.  
  60. SOM_Scope double   SOMLINK Pop(Microcomputer *somSelf)
  61. {
  62.     MicrocomputerData *somThis = MicrocomputerGetData(somSelf);
  63.     MicrocomputerMethodDebug("Microcomputer","Pop");
  64.  
  65.     return (double) _Stack[--_SP];
  66. }
  67.  
  68. SOM_Scope void   SOMLINK Push(Microcomputer *somSelf,
  69.         double Item)
  70. {
  71.     MicrocomputerData *somThis = MicrocomputerGetData(somSelf);
  72.     MicrocomputerMethodDebug("Microcomputer","Push");
  73.  
  74.     _Stack[_SP++] = Item;
  75. }
  76.  
  77. SOM_Scope void   SOMLINK Input(Microcomputer *somSelf)
  78. {
  79.     double Work;
  80.  
  81.     MicrocomputerData *somThis = MicrocomputerGetData(somSelf);
  82.     MicrocomputerMethodDebug("Microcomputer","Input");
  83.     
  84.      scanf("%lf", &Work);
  85.     _Push(somSelf, Work);
  86. }
  87.  
  88. SOM_Scope void   SOMLINK Output(Microcomputer *somSelf)
  89. {
  90.     MicrocomputerData *somThis = MicrocomputerGetData(somSelf);
  91.     MicrocomputerMethodDebug("Microcomputer","Output");
  92.  
  93.     printf("%lf\n", _Pop(somSelf));
  94. }
  95.  
  96. SOM_Scope void   SOMLINK somInit(Microcomputer *somSelf)
  97. {
  98.     MicrocomputerData *somThis = MicrocomputerGetData(somSelf);
  99.     MicrocomputerMethodDebug("Microcomputer","somInit");
  100.  
  101.     _SP = 0;
  102.     parent_somInit(somSelf);
  103. }
  104.  
  105. SOM_Scope void   SOMLINK somUninit(Microcomputer *somSelf)
  106. {
  107.     MicrocomputerData *somThis = MicrocomputerGetData(somSelf);
  108.     MicrocomputerMethodDebug("Microcomputer","somUninit");
  109.  
  110.     parent_somUninit(somSelf);
  111. }
  112.  
  113. SOM_Scope void   SOMLINK Store(Microcomputer *somSelf,
  114.         int Reg)
  115. {
  116.     double Item;
  117.  
  118.     MicrocomputerData *somThis = MicrocomputerGetData(somSelf);
  119.     MicrocomputerMethodDebug("Microcomputer","Store");
  120.  
  121.     Item = _Pop(somSelf);
  122.     _Registers[Reg] = Item;
  123. }
  124.  
  125. SOM_Scope void   SOMLINK Fetch(Microcomputer *somSelf,
  126.         int Reg)
  127. {
  128.     MicrocomputerData *somThis = MicrocomputerGetData(somSelf);
  129.     MicrocomputerMethodDebug("Microcomputer","Fetch");
  130.   
  131.     _Push(somSelf, _Registers[Reg]);
  132. }
  133.