Annotation of researchv10dc/cmd/icon/pi/pil/iscope.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  *     ISCOPE
                      3:  *
                      4:  *     Inspect Icon internals.
                      5:  *
                      6:  *     Ralph E. Griswold
                      7:  *
                      8:  *     Last modified  6/8/86
                      9:  *
                     10:  */
                     11: 
                     12: #include "../h/rt.h"
                     13: 
                     14: /*
                     15:  * Vword(x) - return second word of descriptor as integer
                     16:  */
                     17: 
                     18: FncDcl(Vword,1)
                     19:    {
                     20:    Arg0.dword = D_Integer;
                     21:    Arg0.vword.integr = Arg1.vword.integr;
                     22:    Return;
                     23:    }
                     24: 
                     25: 
                     26: /*
                     27:  * Dword(x) - return first word of descriptor as integer.
                     28:  */
                     29: 
                     30: FncDcl(Dword,1)
                     31:    {
                     32:    Arg0.dword = D_Integer;
                     33:    Arg0.vword.integr = Arg1.dword;
                     34:    Return;
                     35:    }
                     36: 
                     37: /*
                     38:  * Descr(x,y) - construct descriptor from integer values of x and y
                     39:  */
                     40: 
                     41: FncDcl(Descr,2)
                     42:    {
                     43:    defshort(&Arg1, 0);
                     44:    defshort(&Arg2, 0);
                     45:    Arg0.dword = Arg1.vword.integr;
                     46:    Arg0.vword.integr = Arg2.vword.integr;
                     47:    Return;
                     48:    }
                     49: 
                     50: /*
                     51:  * Indir(x) - return integer to where x points.
                     52:  */
                     53: 
                     54: FncDcl(Indir,1)
                     55:    {
                     56:    Arg0.dword = D_Integer;
                     57:    Arg0.vword.integr = *((int *) Arg1.vword.integr);
                     58:    Return;
                     59:    }
                     60: 
                     61: /*
                     62:  * Symbol(x) - get address of Icon symbol.
                     63:  */
                     64: 
                     65: FncDcl(Symbol,1)
                     66:    {
                     67:    extern globals, eglobals, gnames;
                     68:    char sbuf[MaxCvtLen];
                     69:    if (cvstr(&Arg1, sbuf) == NULL)
                     70:       runerr(103, &Arg1);
                     71:    qtos(&Arg1, sbuf);
                     72:    ((Arg0).dword) = D_Integer;
                     73:    if (strcmp(sbuf, "globals") == 0)
                     74:       IntVal(Arg0) = (int) &globals;
                     75:    else if (strcmp(sbuf, "eglobals") == 0)
                     76:       IntVal(Arg0) = (int) &eglobals;
                     77:    else if (strcmp(sbuf, "gnames") == 0)
                     78:       IntVal(Arg0) = (int) &gnames;
                     79:    else if (strcmp(sbuf, "strbase") == 0)
                     80:       IntVal(Arg0) = (int) strbase;
                     81:    else if (strcmp(sbuf, "strfree") == 0)
                     82:       IntVal(Arg0) = (int) strfree;
                     83:    else if (strcmp(sbuf, "blkbase") == 0)
                     84:       IntVal(Arg0) = (int) blkbase;
                     85:    else if (strcmp(sbuf, "blkfree") == 0)
                     86:       IntVal(Arg0) = (int) blkfree;
                     87:    else runerr(205, &Arg1);
                     88:    Return;
                     89:    }
                     90: /*
                     91:  * Ivar(x) - get value of interpreter state variable
                     92:  */
                     93: 
                     94: FncDcl(Ivar,1)
                     95:    {
                     96:    char sbuf[MaxCvtLen];
                     97:    if (cvstr(&Arg1, sbuf) == NULL)
                     98:       runerr(103, &Arg1);
                     99:    qtos(&Arg1, sbuf);
                    100:    ((Arg0).dword) = D_Integer;
                    101:    if (strcmp(sbuf, "sp") == 0)
                    102:       IntVal(Arg0) = (int)sp;
                    103:    else if (strcmp(sbuf, "efp") == 0)
                    104:       IntVal(Arg0) = (int)efp;
                    105:    else if (strcmp(sbuf, "gfp") == 0)
                    106:       IntVal(Arg0) = (int)gfp;
                    107:    else if (strcmp(sbuf, "argp") == 0)
                    108:       IntVal(Arg0) = (int)argp;
                    109:    else if (strcmp(sbuf, "pfp") == 0)
                    110:       IntVal(Arg0) = (int)pfp;
                    111:    else if (strcmp(sbuf, "ilevel") == 0)
                    112:       IntVal(Arg0) = (int)ilevel;
                    113:    else runerr(205, &Arg1);
                    114:    Return;
                    115:    }

unix.superglobalmegacorp.com

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