Annotation of researchv10no/cmd/pico/pico.h, revision 1.1

1.1     ! root        1: #define NONE   -1
        !             2: #define MANY   128
        !             3: #define        NPROG   32768
        !             4: 
        !             5: #define DEF_CH    3            /* default number of channels    */
        !             6: 
        !             7: #define PICO   1
        !             8: #define DUMP   2
        !             9: #define RUNCODE        3
        !            10: 
        !            11: struct SRC {
        !            12:        int sx, sy, ex, ey;     /* window into image */
        !            13:        int ll, nl;             /* length and nr of scanlines in file */
        !            14:        int ox, oy;             /* wander point, only used in 0 and 1 */
        !            15:        unsigned char incore;   /* 1: mem allocated, 2: pixels read */
        !            16:        unsigned char nchan;    /* #channels allocated in mem    */
        !            17:        unsigned char used;     /* was this picture referenced   */
        !            18:        unsigned char type;     /* PICO or DUMP file format      */
        !            19:        char fname[128];        /* unix file name                */
        !            20:        int fd;                 /* file descriptor               */
        !            21:        int sop;                /* start of picture in file      */
        !            22:        unsigned char *pixred;  /* pixel values as 1-dim arrays  */
        !            23:        unsigned char *pixgrn;
        !            24:        unsigned char *pixblu;
        !            25: };
        !            26: 
        !            27: typedef
        !            28: enum
        !            29: {
        !            30:        OASS,   OCOMMA, ACOMMA, COMP,   OADD,
        !            31:        OMUL,   OXOR,   OOR,    OAND,   OBIC,
        !            32:        OSUB,   OANDAND,        OOROR,  OPOW,
        !            33:        ONOT,   OMINUS, ONEG,   ODIV,
        !            34:        OLT,    OLE,    OEQ,    ONE,
        !            35:        OGE,    OGT,    OLSH,
        !            36: 
        !            37:        CONST,  CONSTB, VAR,    REG,
        !            38:        DEREFB, DEREFS, DEREFL, CONDI,
        !            39: 
        !            40:        OISUB,  OIDIV,
        !            41: 
        !            42:        LABL,   GOTO,
        !            43: 
        !            44:        OCALL, CCALL,   OARG,   ORETURN,
        !            45: 
        !            46:        DIVV,   MODU,
        !            47: } Ntype;
        !            48: 
        !            49: typedef
        !            50: struct Node
        !            51: {
        !            52:        Ntype   type;
        !            53:        struct  Node    *left, *right;
        !            54:        union
        !            55:        {       long            Uarg;
        !            56:                struct Node *   Uother;
        !            57:        } u;
        !            58: } Node;
        !            59: 
        !            60: typedef
        !            61: struct SNode
        !            62: {
        !            63:        Node *n, *x, *y;
        !            64:        char i;
        !            65: } SNode;
        !            66: 
        !            67: struct AR
        !            68: {      int     sz;             /* dimension  */
        !            69:        long    *base;          /* array base */
        !            70: };
        !            71: 
        !            72: struct FU
        !            73: {      char    usednew;        /* did it access new==tmp? */
        !            74:        char    usedold;        /* did it access old? */
        !            75:        char    *fct;           /* compiled function code  */
        !            76:        char    nrparams;       /* number of formal params */
        !            77: };
        !            78: 
        !            79: struct BL
        !            80: {      char    usednew;
        !            81:        int     (*faddr)();
        !            82:        char    nrparams;
        !            83: };
        !            84: 
        !            85: typedef
        !            86: struct Symbol
        !            87: {      char    *name;
        !            88:        short   type;           /* array, function, variable, keyword or name */
        !            89:        int     depth;          /* nesting level of declaration */
        !            90:        union {
        !            91:                struct AR *ar;  /* array    */
        !            92:                struct FU *fu;  /* function */
        !            93:                struct BL *bl;  /* builtin  */
        !            94:                long val;       /* variable */
        !            95:        } u;
        !            96:        struct  Symbol  *next;
        !            97: } Symbol;
        !            98: 
        !            99: #define        arg     u.Uarg
        !           100: #define        other   u.Uother
        !           101: #define NR(n)  new(CONST, Z, Z, n)
        !           102: #define VR(n)  new(VAR,   Z, Z, n)
        !           103: #define RL(A,B)        new(DEREFL, VR(A), B, Z)
        !           104: #define        Z       ((Node *)0)
        !           105: 
        !           106: #define Prompt if (INPUT == stdin)\
        !           107:                {       fprintf(stderr, "%d: ", linenumber);\
        !           108:                        fflush(stderr);\
        !           109:                }
        !           110: #define Old            (&src[CUROLD])
        !           111: #define Scratch                (&src[CURSCRATCH])
        !           112: #define oldred         (src[CUROLD].pixred)
        !           113: #define scratchred     (src[CURSCRATCH].pixred)
        !           114: #define oldgrn         (src[CUROLD].pixgrn)
        !           115: #define scratchgrn     (src[CURSCRATCH].pixgrn)
        !           116: #define oldblu         (src[CUROLD].pixblu)
        !           117: #define scratchblu     (src[CURSCRATCH].pixblu)
        !           118: 
        !           119: #define snore()                {      if (frameb) fbsnore();   \
        !           120:                          else if (metheus) om_open(whichdevice); \
        !           121:                        }
        !           122: #define getscreen(m)   {      if (frameb) fbgetitall(m);   \
        !           123:                          else if (metheus) metgetitall(m); \
        !           124:                          setscratch(Old, Scratch); }
        !           125: #define putscreen(m)   {      if (frameb)  fbputitall(m);  \
        !           126:                          else if (metheus) metputitall(m); }
        !           127: #define upit()         { if (frameb) fbup();   }
        !           128: #define downit()       { if (frameb) fbdown(); }
        !           129: 
        !           130: #define udone          (lastguy == '\n')
        !           131: #define Used           usedold = usednew = 1
        !           132: 
        !           133: #define NLOOP  1       /* execute once */
        !           134: #define BLOOP  2       /* default loop on x, y, and i=ll*y+x */
        !           135: #define SLOOP  3       /* loop on 0<=i<=255 */
        !           136: 
        !           137: #define RESIDENT       { Old->incore = Scratch->incore = 2; }
        !           138: #define ABSENT         { Old->incore = Scratch->incore = 1; }
        !           139: 
        !           140: Node   *new(), *Index(), *sumchans(), *cast(), *weird();
        !           141: Node   *notnew(), *divide(), *modulo(), *splatter();
        !           142: Node   *newloop(), *newhile(), *newuntil();
        !           143: Node   *threechans(), *ncopy(), *par();
        !           144: Node   *mapred(), *mapgrn(), *mapblu(), *mapall();
        !           145: SNode  *nsup(), *super();
        !           146: char   *Emalloc(), *strcpy(), *strncpy(), *mktemp(), *strcat();
        !           147: Symbol *lookup(), *newsym();
        !           148: 
        !           149: #define min(a, b)      ((a<b)?(a):(b))
        !           150: #define max(a, b)      ((a>b)?(a):(b))

unix.superglobalmegacorp.com

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