home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / 1989 / 11 / review / m2ccli2.txt < prev    next >
Encoding:
Text File  |  1989-07-14  |  2.7 KB  |  101 lines

  1.      1    typedef unsigned int size_t;
  2.      2    extern void * memcpy(void *, const void *, size_t);
  3.      3    extern char * strncpy(char *, const char *, size_t);
  4.      4    
  5.      5    typedef enum {FALSE, TRUE} BOOLEAN;
  6.      6    typedef unsigned BITSET;
  7.      7    typedef void (*PROC)(void);
  8.      8    typedef unsigned *ADDRESS;
  9.      9    typedef unsigned char BYTE;
  10.     10    typedef unsigned WORD;
  11.     11    
  12.     12    extern int m2c_iabs(int);
  13.     13    extern long m2c_liabs(long);
  14.     14    extern double m2c_fabs(double);
  15.     15    extern unsigned char m2c_cap(unsigned char);
  16.     16    extern BOOLEAN m2c_in(unsigned, BITSET);
  17.     17    extern void NEWPROCESS(PROC, ADDRESS, unsigned, ADDRESS *);
  18.     18    extern void TRANSFER(ADDRESS *, ADDRESS *);
  19.     19    extern void HALT(void);
  20.     20    extern void ENABLE(void);
  21.     21    extern void DISABLE(void);
  22.     22    
  23.     23    typedef struct ASTORE__0
  24.     24      {
  25.     25        unsigned KEY;
  26.     26        ADDRESS DATA;
  27.     27        } ASTORE_ASSOC;
  28.     28    BOOLEAN ASTORE_PUT(unsigned, ADDRESS);
  29.     29    ADDRESS ASTORE_GET(unsigned);
  30.     30    typedef unsigned ASTORE_ARANGE;
  31.     31    typedef unsigned ASTORE_EXTRANGE;
  32.     32    static ASTORE_EXTRANGE ASTORE_LAST;
  33.     33    static ASTORE_ASSOC ASTORE_STORE[99];
  34.     34    static ASTORE_EXTRANGE ASTORE_IND(unsigned);
  35.     35    
  36.     36    static ASTORE_EXTRANGE ASTORE_IND(K)
  37.     37    unsigned K;
  38.     38    {
  39.     39      ASTORE_ARANGE I;
  40.     40      if (1 <= ASTORE_LAST)
  41.     41      {
  42.     42        for (I = 1; I <= ASTORE_LAST; I += 1)
  43.     43        {
  44.     44          if (ASTORE_STORE[I - 1].KEY == K)
  45.     45            return I;
  46.     46          if (I >= 99)
  47.     47            break;
  48.     48        }
  49.     49      }
  50.     50      return 0;
  51.     51    }
  52.     52    
  53.     53    
  54.     54    BOOLEAN ASTORE_PUT(K, D)
  55.     55    unsigned K;
  56.     56    ADDRESS D;
  57.     57    {
  58.     58      ASTORE_ARANGE I;
  59.     59      I = ASTORE_IND(K);
  60.     60      if (I == 0)
  61.     61        if (ASTORE_LAST < 99)
  62.     62        {
  63.     63          ASTORE_LAST = ASTORE_LAST + 1;
  64.     64          I = ASTORE_LAST;
  65.     65        }
  66.     66        else
  67.     67          return FALSE;
  68.     68      {
  69.     69        ASTORE_ASSOC *_0;
  70.     70        _0 = (ASTORE_ASSOC *)&ASTORE_STORE[I - 1];
  71.     71        (*_0).KEY = K;
  72.     72        (*_0).DATA = D;
  73.     73      }
  74.     74      return TRUE;
  75.     75    }
  76.     76    
  77.     77    
  78.     78    ADDRESS ASTORE_GET(K)
  79.     79    unsigned K;
  80.     80    {
  81.     81      ASTORE_ARANGE I;
  82.     82      I = ASTORE_IND(K);
  83.     83      if (I == 0)
  84.     84        return (ADDRESS)0;
  85.     85      else
  86.     86        return ASTORE_STORE[I - 1].DATA;
  87.     87    }
  88.     88    
  89.     89    
  90.     90    void ASTORE_7C576C970CF0(void)
  91.     91    {
  92.     92      static unsigned char _init = 0;
  93.     93      if (!_init)
  94.     94      {
  95.     95        _init = 1;
  96.     96        ASTORE_LAST = 0;
  97.     97      }
  98.     98      
  99.     99    }
  100.    100    
  101.