Annotation of researchv9/jtools/src/pads/x11/cache.c, revision 1.1.1.1

1.1       root        1: #include "univ.h"
                      2: 
                      3: char **ICache;
                      4: Carte ***CCache;
                      5: Index I_SIZE, C_SIZE;
                      6: 
                      7: void CacheOp(p)
                      8: Protocol p;
                      9: {
                     10:        Index i;
                     11:        register size;
                     12:        register Carte *c;
                     13:        register Index *rcv;
                     14: 
                     15:        i = RcvShort();
                     16:        switch( (int) p ){
                     17:        case P_I_DEFINE:
                     18:                assert(!ICache);
                     19:                I_SIZE = i;
                     20:                ICache = (char **) Alloc(MJR(I_SIZE) * sizeof(char*) );
                     21:                break;
                     22:        case P_C_DEFINE:
                     23:                assert(!CCache);
                     24:                C_SIZE = i;
                     25:                CCache = (Carte***) Alloc(MJR(C_SIZE) * sizeof(Carte*) );
                     26:                break;
                     27:        case P_I_CACHE:
                     28:                if( !ICache[MJR(i)] ) GCAlloc(MNR(I_SIZE), &ICache[MJR(i)]);
                     29:                RcvString( &ICache[MJR(i)][MNR(i)] );
                     30:                break;
                     31:        case P_C_CACHE:
                     32:                size = RcvUChar();
                     33:                if( !CCache[MJR(i)] ) CCache[MJR(i)] =
                     34:                        (Carte**) Alloc(MNR(C_SIZE) * sizeof(Carte*) );
                     35:                assert( !CCache[MJR(i)][MNR(i)] );
                     36:                c = (Carte*) GCAlloc(CARTESIZE(size), &CCache[MJR(i)][MNR(i)]);
                     37:                c->attrib = RcvUChar();
                     38:                for( rcv = c->bin; size-- >= 0; *rcv++ = RcvShort()) {}
                     39:                c->size = RcvUChar();                   /* recursive size */
                     40:                c->width = RcvUChar();                  /* recursive widest */
                     41:                break;
                     42:        default:
                     43:                ProtoErr( "CacheOp(): " );
                     44: 
                     45:        }
                     46: }
                     47: 
                     48: char *IndexToStr(i)
                     49: Index i;
                     50: {
                     51:        assert( !(MJR(i)&CARTE) && ICache[MJR(i)] && MJR(i)<MJR(I_SIZE) );
                     52:        return &ICache[MJR(i)][MNR(i)];
                     53: }
                     54: 
                     55: Carte *IndexToCarte(i)
                     56: Index i;
                     57: {
                     58:        assert( MJR(i)&CARTE );
                     59:        i &= ~(CARTE<<8);
                     60:        assert(MJR(i)<MJR(C_SIZE) && CCache[MJR(i)] && CCache[MJR(i)][MNR(i)]);
                     61:        return CCache[MJR(i)][MNR(i)];
                     62: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.