next up previous
Next: REC-R 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 */

void ropla(), roplc(), ropld(), rople(), roplf(), roplg(), roplh();
void ropli(), roplj(), roplk(), ropll();
void roplm(), ropln(), roplo();
void roplp(), roplq(), roplr(), ropls(), roplu(), roplv();

void ropua(), ropuc(), ropud(), ropue();
void ropuf(), ropug(), ropuh();
void ropui(), ropuj(), ropuk(), ropul();
void ropum(), ropun(), ropuo();
void ropup(), ropur(), ropus(), roput();
void ropuv();

int  rpruf(), rpruq();

void ropca(), ropqm();

int  rprns(), rprps();
int  rprze(), rpron(), rprtw(), rprth();

/* Table of compiling/executing function definitions,
   a pair for each printing ASCII character */

struct fptbl dtbl[] = {
  r_noopc,   FALSE,  " space (separator)",                                  /* [blank] */
  r_ctrc,  r_ctrx,   " ! - count to n, as in (!n![repeat]:[finish];)",            /* ! */
  r_noopc,   FALSE,  "",                                            /* " quoted string */
  r_pred,    rprns,  " # - rand pred, prob 1/2, as in (#[heads];[tails];)  ",     /* # */
  r_cdblp,   r_ldblp," $ - floating point number, sits until changed, e.g. $2.5$",/* $ */
  r_pred,    rprps,   " % - rand pred, prob 1/10, as in (%[common];[rare];)",     /* % */
  r_noopc,   FALSE,   " & -",                                                     /* & */
  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_noopc,   FALSE,   " - - ",                                                    /* - */
  r_noopc,   FALSE,   " . - ",                                        /* . f.p. number */
  r_noopc,   FALSE,   " / - ",                                                    /* / */
  r_pred,    rprze,    " 0 - ",                                            /* 0 number */
  r_pred,    rpron,    " 1 - ",                                            /* 1 number */
  r_pred,    rprtw,    " 2 - ",                                            /* 2 number */
  r_pred,    rprth,    " 3 - ",                                            /* 3 number */
  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 ",               /* : iteration */
  r_semicol, FALSE,   " ; - exit at terminating rparen with value T  ", /* ; true exit */
  r_noopc,   FALSE,   " < - ",                                                    /* < */
  r_noopc,   FALSE,   " = - ",                                                    /* = */
  r_noopc,   FALSE,   " > - ",                                                    /* > */
  r_code,    ropqm,   " ? - print register values ",                              /* ? */
  r_pred1,   r_call,  " @ - call a subroutine, e.g. @x calls x ", /* @ subroutine call */
  r_code,    ropua,   " A - make the point offset equal to zero ",                /* A */
  r_pred,    rprub,   " B - does the top of the stack lie between -1.0 and 1.0?", /* B */
  r_oper1,   ropuc,   " C - set color with Cx, x = r,g,b,c,m,y,k,w ",             /* C */
  r_code,    ropud,   " D - set the Runge-Kutta step size, as in $0.1$ D",        /* D */
  r_code,    ropue,   " E - set the Energy, as in $1.5$ E, or in s E ",           /* E */
  r_pred,    rpruf,   " F - relative signs in coeff. (F[forbidden];[not];) ",     /* F */
  r_code,    ropug,   " G - move to first graph point ",                          /* G */
  r_code,    ropuh,   " H - record first point in a hidden line sequence ",       /* H */
  r_code,    ropui,   " I - push [0][0] element of coefficient matrix ",          /* I */
  r_code,    ropuj,   " J - push [0][1] element of coefficient matrix ",          /* J */
  r_code,    ropuk,   " K - push [1][0] element of coefficient matrix ",          /* K */
  r_code,    ropul,   " L - push [1][1] element of coefficient matrix ",          /* L */
  r_code,    ropum,   " M - set mass for Dirac Equations, e.g. $1.0$M ",          /* M */
  r_code,    ropun,   " N - ",                                                    /* N */
  r_code,    ropuo,   " O - set origin, incr of ind var: $-7.5$ n $0.1$ n O, say",/* O */
  r_code,    ropup,   " P - pop the stack ",                                      /* P */
  r_pred,    rpruq,   " Q - quit for large coordinates",                          /* Q */
  r_code,    ropur,   " R - advance by one 6th order Runge-Kutta step",           /* R */
  r_code,    ropus,   " S - initialize step variable, as in $-7.5$ n $0.1$ n S ", /* S */
  r_code,    roput,   " T - push half the trace of the period matrix",            /* T */
  r_code,    ropuu,   " U - Offsets the y-origin, as in $-1.5$ U",                /* U */
  r_oper1,   ropuv,   " V - Vn choose potential n [e.g. V5=harmonic oscillator]", /* V */
  r_code,    ropuw,   " W - define the weight coefficient, as in $1.0$ W ",       /* W */
  r_noopc,   FALSE,   " X - ",                                                    /* X */
  r_noopc,   FALSE,   " Y - ",                                                    /* Y */
  r_noopc,   FALSE,   " Z - ",                                                    /* Z */
  r_comment, FALSE,   " ] - begin comment, as in [comment] ",                     /* [ */
  r_noopc,   FALSE,   " \\ - ",                                                   /* \ */
  r_ubrack,  FALSE,   " ] - end comment   ",                                      /* ] */
  r_code,    ropca,   " ^ - ",                                                    /* ^ */
  r_code,    r_quit,   " _- ",                                         /* _ panic exit */
  r_noopc,   FALSE,   " ` - ",                                                    /* ` */
  r_code,    ropla,   " a - add an ever increasing offset to point coordinates",  /* a */
  r_pred,    rprlb,   " b - is the top of the stack positive?",                   /* b */
  r_code,    roplc,   " c - clip the number on top of the stack",                 /* c */
  r_code,    ropld,   " d - rescale the step size, as in $1.125$ d ",             /* d */
  r_code,    rople,   " e - modify the energy, as in $-0.01$ e ",                 /* e */
  r_code,    roplf,   " f - ",                                                    /* f */
  r_code,    roplg,   " g - graph additional points",                             /* g */
  r_code,    roplh,   " h - Graph what is visible over (& under) the horizons ",  /* h */
  r_code,    ropli,   " i - push [0][0] element of solution matrix",              /* i */
  r_code,    roplj,   " j - push [0][1] element of solution matrix",              /* j */
  r_code,    roplk,   " k - push [1][0] element of solution matrix",              /* k */
  r_code,    ropll,   " l - push [1][1] element of solution matrix",              /* l */
  r_code,    roplm,   " m - modify the mass, as in $-0.01$ m ",                   /* m */
  r_code,    ropln,   " n - push the numerical datum [$1.0$ n, for example]",     /* n */
  r_code,    roplo,   " o - set Runge-Kutta variable's origin: $0.0$ o, say ",    /* o */
  r_code,    roplp,   " p - push the top of the stack ",                          /* p */
  r_code,    roplq,   " q - ",                                                /* q */
  r_code,    roplr,   " r - advance by one 4th order Runge-Kutta step",       /* r */
  r_code,    ropls,   " s - push, then increment, the step variable ",        /* s */
  r_code,    roplt,   " t - push half the trace of the solution matrix",      /* t */
  r_code,    roplu,   " u - set solution matrix equal to unit matrix",        /* u */
  r_code,    roplv,   " v - push the independent variable",                   /* v */
  r_code,    roplw,   " w - increment the weight, as in $0.1$ w",             /* w */
  r_noopc,   FALSE,   " x - ",                                                /* x */
  r_noopc,   FALSE,   " y - ",                                                /* y */
  r_noopc,   FALSE,   " z - ",                                                /* z */
  r_lbrace,  r_xbrace," { - start program, e.g. {(...) a (...) b ... (...)}", /* { */
  r_noopc,   FALSE,   " | - ",                                                /* | */
  r_ubrace,  FALSE,   " } - end of program ",                                 /* } */
  r_noopc,   FALSE,   " ~ - "                                                 /* ~ */
};



Microcomputadoras
2001-01-10