next up previous
Next: REC-F data flow Up: The REC Header and Previous: The REC Header and

REC header

The header file seems excessively long when only a handful of definitions are actually stated, but in keeping with the tradition of using single ASCII characters as symbols, conserving the full list helps browsers and inspectors work uniformly.

Moreover, insertions or deletions to the table are confined to the locations already alloted for them. Such systematics often reduce error and increase programming convenience. In fact, for some of the more common variants, such as floating point numbers, comments in the form of quoted strings, or frequently used operators, including both forms in the table with the unused line neutralized by making it into a comment can reduce confusion and save programming effort.

This header file is also the place to declare all the REC functions which it introduces -- at least the compiling and executing functions -- if not all their satellites. Those can probably be accounted for in the REC implementation file with less overall effort.

/* rectbl.h -- G. Cisneros, 4.91; rev. 2.10.91 */
/* Mandatory declarations */

# include "rec.h"

int r_lpar();        /* compilation of a left parenthesis            */
int r_rpar();        /* compilation of a right parenthesis           */
int r_colon();       /* compilation of a colon                       */
int r_semicol();     /* compilation of a semicolon                   */
int r_code();        /* compilation of a simple operator             */
int r_oper1();       /* compilation of an operator with an ASCII arg */
int r_pred();        /* compilation of a simple predicate            */
int r_pred1();       /* compilation of a predicate with an ASCII arg */
int r_noopc();       /* compilation of no-op                         */
int r_comment();     /* compilation of a (bracket enclosed) comment  */
int r_ubrack();      /* compilation of an unbalanced right bracket   */
int r_lbrace();      /* compilation of a (brace enclosed) program    */
int r_ubrace();      /* compilation of an unbalanced right brace     */

int r_call();        /* execution of predicate @x (call subr. x)     */
int r_quit();        /* execution of operator _ (exit to O.S.)       */
int r_xbrace();      /* execution of brace-enclosed program          */

/* Optional: Counter predicate */

 int r_ctrc();        /* compilation of a counter */
 int r_ctrx();        /* execution of a counter */

/* Optional declarations, needed only in versions using quotes and
   numbers (see cnum.c and cquo.c); r_ld, r_ldch and r_xstr must
   be provided by user */

// int r_dquote(); /* compile doubly quoted string into symbol table        */
// int r_squote(); /* compile singly quoted char into the program array     */
// int r_cmin();   /* compile '-' as simple operator, call r_cnum if followed 
//                     by digit or period */
// int r_cnum();   /* compile a number (WORD, LONG or REAL) into sym. table */

// int r_ld();        /* execution of compiled numbers               */
// int r_ldch();       /* execution of apostrophe (single quote op.) */
// int r_xstr();       /* execution of quoted strings                */

// int r_cdblp(), r_ldblp();

/* Declarations of user-provided execution subroutines. */
/* functions have type void, predicates get type int.   */

void ropla(), ropln(), roplo(), roplp();

void ropua(), ropuc(), ropun(), ropuo(), ropup(), ropur(), ropux();

/* Table of compiling/executing definitions, three items per line */

struct fptbl dtbl[] = {
        r_noopc,      FALSE,    " space (separator)",      /* [blank] */
        r_ctrc,    r_ctrx,    " !n! count to n   ",              /* ! */
//        r_dquote,    r_xstr,    "",                /* " quoted string */
        r_noopc,    FALSE,    "",                  /* " quoted string */
        r_noopc,    FALSE,    " # -  ",                          /* # */
        r_cdblp,    r_ldblp," $xxx.x$ - floating point number ", /* $ */
        r_noopc,    FALSE,    " % -         ",                   /* % */
        r_noopc,    FALSE,    " &           ",                   /* & */
//        r_squote,    r_ldch,    " quoted character",             /* ' */
        r_noopc,    FALSE,    "        ",           /* '  quoted char */
        r_lpar,     FALSE,    " ( - start of expression",        /* ( */
        r_rpar,     FALSE,    " ) - end of expression",          /* ) */
        r_noopc,    FALSE,    " * ",      /* * */
        r_noopc,    FALSE,    " + ",      /* + */
        r_noopc,    FALSE,    " , ",      /* , separator */
//        r_cmin,    FALSE,    " - ",      /* - */
        r_noopc,    FALSE,    " - ",      /* - */
//        r_cnum,    r_ld,    " , ",      /* . f.p. number */
        r_noopc,    FALSE,    " . ",      /* . */
        r_noopc,    FALSE,    " / ",      /* / */
//        r_cnum,    r_ld,    " 0 ",      /* 0 number */
//        r_cnum,    r_ld,    " 1 ",      /* 1 number */
//        r_cnum,    r_ld,    " 2 ",      /* 2 number */
//        r_cnum,    r_ld,    " 3 ",      /* 3 number */
//        r_cnum,    r_ld,    " 4 ",      /* 4 number */
//        r_cnum,    r_ld,    " 5 ",      /* 5 number */
//        r_cnum,    r_ld,    " 6 ",      /* 6 number */
//        r_cnum,    r_ld,    " 7 ",      /* 7 number */
//        r_cnum,    r_ld,    " 8 ",      /* 8 number */
//        r_cnum,    r_ld,    " 9 ",      /* 9 number */
        r_pred,     rprze,    " 0 - switch ",      /* 0 */
        r_pred,     rpron,    " 1 - switch ",      /* 1 */
        r_pred,     rprtw,    " 2 - switch ",      /* 2 */
        r_pred,     rprth,    " 3 - switch ",      /* 3 */
        r_noopc,    FALSE,    " 4 ",      /* 4 number */
        r_noopc,    FALSE,    " 5 ",      /* 5 number */
        r_noopc,    FALSE,    " 6 ",      /* 6 number */
        r_noopc,    FALSE,    " 7 ",      /* 7 number */
        r_noopc,    FALSE,    " 8 ",      /* 8 number */
        r_noopc,    FALSE,    " 9 ",      /* 9 number */
        r_colon,    FALSE,    " : - repeat from opening lparen",/* : iterate */
        r_semicol,  FALSE,    " ; - T exit at rparen", /* ; true termination */
        r_noopc,    FALSE,    " <           ",           /* < */
        r_noopc,    FALSE,    " =           ",           /* = */
        r_noopc,    FALSE,    " >           ",           /* > */
        r_noopc,    FALSE,    " ? -         ",           /* ? */
        r_pred1,    r_call,   " @x - call subroutine x", /* @ */
        r_noopc,    FALSE,    " A -          ",          /* A */
        r_noopc,    FALSE,    " B -          ",          /* B */
        r_code,     ropuc,    " C - draw the polygon ",  /* C */
        r_noopc,    FALSE,    " D -          ",          /* D */
        r_noopc,    FALSE,    " E -          ",          /* E */
        r_noopc,    FALSE,    " F -          ",          /* F */
        r_noopc,    FALSE,    " G            ",          /* G */
        r_noopc,    FALSE,    " H -          ",          /* H */
        r_noopc,    FALSE,    " I -          ",          /* I */
        r_noopc,    FALSE,    " J -          ",          /* J */
        r_noopc,    FALSE,    " K -          ",          /* K */
        r_noopc,    FALSE,    " L -          ",          /* L */
        r_noopc,    FALSE,    " M -          ",                       /* M */
        r_code,     ropun,    " N - reflect in next edge",            /* N */
        r_code,     ropuo,    " O - read top of polygon stack",       /* O */
        r_code,     ropup,    " P - push onto the polygon stack ",    /* P */
        r_noopc,    FALSE,    " Q -        ",                         /* Q */
        r_oper1,    ropur,    " Rn - reflect in edge n",              /* R */
        r_noopc,    FALSE,    " S -        ",                         /* S */
        r_noopc,    FALSE,    " T -        ",                         /* T */
        r_noopc,    FALSE,    " U -        ",                         /* U */
        r_noopc,    FALSE,    " V          ",                         /* V */
        r_noopc,    FALSE,    " W          ",                         /* W */
        r_oper1,    ropux,    " X - Xn puts regular n-gon at origin", /* X */
        r_noopc,    FALSE,    " Y -         ",                        /* Y */
        r_noopc,    FALSE,    " Z -         ",                        /* Z */
        r_comment,  FALSE,    " [ - [begin comment]", /* [ */
        r_noopc,    FALSE,    "        ",             /* \ */
        r_ubrack,   FALSE,    " ] - [end comment] ",  /* ] */
        r_noopc,    FALSE,    " ^ -        ",         /* ^ */
        r_code,     r_quit,   " _ - abandon ship",    /* _ */
        r_noopc,    FALSE,    "             ",        /* ` */
        r_noopc,    FALSE,    " a -         ",        /* a */
        r_noopc,    FALSE,    " b -         ",        /* b */
        r_noopc,    FALSE,    " c -         ",        /* c */
        r_noopc,    FALSE,    " d -         ",        /* d */
        r_noopc,    FALSE,    " e -         ",        /* e */
        r_noopc,    FALSE,    " f -         ",        /* f */
        r_noopc,    FALSE,    " g -         ",        /* g */
        r_noopc,    FALSE,    " h -         ",        /* h */
        r_noopc,    FALSE,    " i -         ",        /* i */
        r_noopc,    FALSE,    " j -         ",        /* j */
        r_noopc,    FALSE,    " k -         ",        /* k */
        r_noopc,    FALSE,    " l -         ",        /* l */
        r_noopc,    FALSE,    " m -         ",        /* m */
        r_code,     ropln,    " n - reflect in last edge  ", /* n */
        r_code,     roplo,    " o - offset the polygon    ", /* o */
        r_code,     roplp,    " p - pop the polygon stack ", /* p */
        r_noopc,    FALSE,    " q -         ",        /* q */
        r_noopc,    FALSE,    " r -         ",        /* r */
        r_noopc,    FALSE,    " s -         ",        /* s */
        r_noopc,    FALSE,    " t -         ",        /* t */
        r_noopc,    FALSE,    " u -         ",        /* u */
        r_noopc,    FALSE,    " v -         ",        /* v */
        r_noopc,    FALSE,    " w -         ",        /* w */
        r_noopc,    FALSE,    " x -         ",        /* x */
        r_noopc,    FALSE,    " y -         ",        /* y */
        r_noopc,    FALSE,    " z -         ",        /* z */
        r_lbrace,   r_xbrace, " { - start of program",/* { */
        r_noopc,    FALSE,    " | -    ",             /* | */
        r_ubrace,   FALSE,    " } - end of program",  /* } */
        r_noopc,    FALSE,    " ~.- "                 /* ~ */
};



Microcomputadoras
2000-09-28