home *** CD-ROM | disk | FTP | other *** search
/ APDL Public Domain 1 / APDL_PD1A.iso / program / language / icon / Source / Iconx / C / Idata < prev    next >
Encoding:
Text File  |  1990-07-19  |  8.0 KB  |  371 lines

  1. /*
  2.  * Various interpreter data tables.
  3.  */
  4.  
  5. #include "../h/config.h"
  6. #include "../h/rt.h"
  7. #include "rproto.h"
  8.  
  9. struct b_proc Bnoproc;
  10.  
  11. /*
  12.  * External declarations for function blocks.
  13.  */
  14.  
  15. char *fncnames[] = {
  16.  
  17. #define FncDef(p,n) Lit(p),
  18. #define FncDefV(p) Lit(p),
  19. #include "../h/fdefs.h"
  20. #undef FncDef
  21. #undef FncDefV
  22.    0
  23.    };
  24.  
  25. int fnsize = (sizeof(fncnames) / sizeof(char*)) - 1;
  26.  
  27. #define FncDef(p,n) extern struct b_proc Cat(B,p);
  28. #define FncDefV(p) extern struct b_proc Cat(B,p);
  29. #include "../h/fdefs.h"
  30. #undef FncDef
  31. #undef FncDefV
  32.  
  33. #define OpDef(p,n,s) extern struct b_proc Cat(B,p);
  34. #include "../h/odefs.h"
  35. #undef OpDef
  36.  
  37. extern struct b_proc Bbscan;
  38. extern struct b_proc Bcreate;
  39. extern struct b_proc Bescan;
  40. extern struct b_proc Bfield;
  41. extern struct b_proc Blimit;
  42. extern struct b_proc Bllist;
  43.  
  44. /*
  45.  * Array of addresses of function blocks.
  46.  */
  47. struct b_proc *functab[] = {
  48. #define FncDef(p,n) Cat(&B,p),
  49. #define FncDefV(p) Cat(&B,p),
  50. #include "../h/fdefs.h"
  51. #undef FncDef
  52. #undef FncDefV
  53.    0
  54.    };
  55.  
  56. int ftsize = (sizeof(functab) / sizeof(struct b_proc *)) - 1;
  57.  
  58.  
  59.  
  60. #ifdef TraceBack
  61.  
  62. struct b_proc *opblks[] = {
  63.     NULL,
  64. #define OpDef(p,n,s) Cat(&B,p),
  65. #include "../h/odefs.h"
  66. #undef OpDef
  67.    &Bbscan,
  68.    NULL,
  69.    NULL,
  70.    NULL,
  71.    NULL,
  72.    NULL,
  73.    &Bcreate,
  74.    NULL,
  75.    NULL,
  76.    NULL,
  77.    NULL,
  78.    &Bescan,
  79.    NULL,
  80.    &Bfield,
  81.    NULL,
  82.    NULL,
  83.    NULL,
  84.    NULL,
  85.    NULL,
  86.    &Blimit,
  87.    &Bllist,
  88.    NULL,
  89.    NULL,
  90.    NULL
  91.    };
  92. #endif                    /* TraceBack */
  93.  
  94. #ifdef StrInvoke
  95. /*
  96.  * Array of names and corresponding functions.
  97.  */
  98.  
  99. struct pstrnm pntab[] = {
  100.  
  101. #ifndef BoundFunctions
  102. #define FncDef(p,n) Lit(p), Cat(&B,p),
  103. #define FncDefV(p) Lit(p), Cat(&B,p),
  104. #include "../h/fdefs.h"
  105. #undef FncDef
  106. #undef FncDefV
  107. #endif                    /* BoundFunctions */
  108.  
  109. #define OpDef(p,n,s) s, Cat(&B,p),
  110. #include "../h/odefs.h"
  111. #undef OpDef
  112.     0,         0
  113.     };
  114. #endif                    /* StrInvoke */
  115.  
  116. /*
  117.  * Structures for built-in values.  Parts of some of these structures are
  118.  *  initialized later. Since some C compilers cannot handle any partial
  119.  *  initializations, all parts are initialized later if any have to be.
  120.  */
  121.  
  122. /*
  123.  * Built-in csets
  124.  */
  125.  
  126. /*
  127.  * &ascii; 128 bits on, second 128 bits off.
  128.  */
  129. struct b_cset  k_ascii = {
  130.  
  131. #if EBCDIC == 1 /* Conflict: "a" is in &ascii, but ord("a") >= 128 */
  132.    T_Cset,
  133.    128,
  134.    cset_display(0xf8af, 0xf34f, 0xe0e0, 0xb084,
  135.                 0xf801, 0xfc01, 0xf803, 0xfe00,
  136.                 0x03fe, 0x03fe, 0x23fe, 0x2000,
  137.                 0x03ff, 0x03ff, 0x03fd, 0x03ff)
  138.    };
  139. #else                    /* EBCDIC == 1 */
  140.    T_Cset,
  141.    128,
  142.    cset_display(~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0,
  143.                  0,  0,  0,  0,  0,  0,  0,  0)
  144.    };
  145. #endif                    /* EBCDIC == 1 */
  146.  
  147. /*
  148.  * &cset; all 256 bits on.
  149.  */
  150. struct b_cset  k_cset = {
  151.    T_Cset,
  152.    256,
  153.    cset_display(~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0,
  154.         ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0)
  155.    };
  156.  
  157. /*
  158.  * &digits; bits corrosponding to 0-9 are on.
  159.  */
  160. struct b_cset  k_digits = {
  161.    T_Cset,
  162.    10,
  163.  
  164. #if EBCDIC != 1
  165.    cset_display(0,  0,    0,  0x3ff, 0,  0, 0,  0,
  166.         0,  0,    0,  0,     0,  0,     0,  0)
  167. #else                    /* EBCDIC != 1*/
  168.    cset_display(0,  0,    0,  0,    0,  0,    0,  0,
  169.         0,  0,    0,  0,  0,  0,  0,  0x3ff)
  170. #endif                    /* EBCDIC != 1 */
  171.  
  172.    };
  173.  
  174. /*
  175.  * Cset for &lcase; bits corresponding to lowercase letters are on.
  176.  */
  177. struct b_cset  k_lcase = {
  178.    T_Cset,
  179.    26,
  180.  
  181. #if EBCDIC != 1
  182.    cset_display(0,  0,    0,  0,    0,  0,    ~01,  03777,
  183.         0,  0,    0,  0,    0,  0,    0,  0)
  184. #else                    /* EBCDIC != 1 */
  185.    cset_display(0,  0,    0,  0,    0,  0,    0,  0,
  186.         0x3fe,    0x3fe,    0x3fc,    0,  0,    0,  0,    0)
  187. #endif                    /* EBCDIC != 1 */
  188.  
  189.    };
  190.  
  191. /*
  192.  * &ucase; bits corresponding to uppercase characters are on.
  193.  */
  194. struct b_cset  k_ucase = {
  195.    T_Cset,
  196.    26,
  197.  
  198. #if EBCDIC != 1
  199.    cset_display(0,  0,    0,  0,    ~01,  03777, 0, 0,
  200.         0,  0,    0,  0,    0,  0,    0,  0)
  201. #else                    /* EBCDIC != 1 */
  202.    cset_display(0,  0,    0,  0,    0,  0,    0,  0,
  203.         0,  0,    0,  0,    0x3fe,    0x3fe,    0x3fc,    0)
  204. #endif                    /* EBCDIC != 1 */
  205.  
  206.    };
  207.  
  208. /*
  209.  * &letters; bits corresponding to letters are on.
  210.  */
  211. struct b_cset  k_letters = {
  212.    T_Cset,
  213.    52,
  214.  
  215. #if EBCDIC != 1
  216.    cset_display(0,  0,    0,  0,    ~01,  03777, ~01, 03777,
  217.         0,  0,    0,  0,    0,  0,    0,  0)
  218. #else                    /* EBCDIC != 1 */
  219.    cset_display(0,  0,    0,  0,    0,  0,    0,  0,
  220.         0x3fe,  0x3fe,    0x3fc,  0, 0x3fe, 0x3fe, 0x3fc,    0)
  221. #endif                    /* EBCDIC != 1 */
  222.  
  223.    };
  224.  
  225. /*
  226.  * Built-in files.
  227.  */
  228.  
  229. struct b_file  k_errout = {T_File, NULL, Fs_Write};    /* &errout */
  230. struct b_file  k_input = {T_File, NULL, Fs_Read};    /* &input */
  231. struct b_file  k_output = {T_File, NULL, Fs_Write};    /* &outout */
  232.  
  233. /*
  234.  * Keyword trapped variables.
  235.  */
  236.  
  237.  
  238. struct b_tvkywd tvky_err = {T_Tvkywd, putint, {D_Integer}};    /* &error */
  239. struct b_tvkywd tvky_pos = {T_Tvkywd, putpos, {D_Integer}};    /* &pos */
  240. struct b_tvkywd tvky_ran = {T_Tvkywd, putint, {D_Integer}};    /* &random */
  241. struct b_tvkywd tvky_sub = {T_Tvkywd, putsub};             /* &subject */
  242. struct b_tvkywd tvky_trc = {T_Tvkywd, putint, {D_Integer}};    /* &trace */
  243.  
  244. /*
  245.  * Various constant descriptors.
  246.  */
  247.  
  248. struct descrip blank;             /* one-character blank string */
  249. struct descrip emptystr;         /* zero-length empty string */
  250. struct descrip errout = {D_File};    /* &errout */
  251. struct descrip input = {D_File};    /* &input */
  252. struct descrip lcase;            /* string of lowercase letters */
  253. struct descrip letr;            /* "r" */
  254. struct descrip nulldesc = {D_Null};    /* null value */
  255. struct descrip onedesc = {D_Integer};    /* integer 1 */
  256. struct descrip ucase;            /* string of uppercase letters */
  257. struct descrip zerodesc = {D_Integer};    /* integer 0 */
  258.  
  259. /*
  260.  * The tended descriptors.
  261.  */
  262.  
  263. struct descrip tended[6];
  264.  
  265. /*
  266.  * Run-time error numbers and text.
  267.  */
  268. struct errtab errtab[] = {
  269.    101, "integer expected",
  270.    102, "numeric expected",
  271.    103, "string expected",
  272.    104, "cset expected",
  273.    105, "file expected",
  274.    106, "procedure or integer expected",
  275.    107, "record expected",
  276.    108, "list expected",
  277.    109, "string or file expected",
  278.    110, "string or list expected",
  279.    111, "variable expected",
  280.    112, "invalid type to size operation",
  281.    113, "invalid type to random operation",
  282.    114, "invalid type to subscript operation",
  283.    115, "list, set, or table expected",
  284.    116, "invalid type to element generator",
  285.    117, "missing main procedure",
  286.    118, "co-expression expected",
  287.    119, "set expected",
  288.    120, "cset or set expected",
  289.    121, "function not supported",
  290.    122, "set or table expected",
  291.    123, "invalid type",
  292.    124, "table expected",
  293.  
  294.    201, "division by zero",
  295.    202, "remaindering by zero",
  296.    203, "integer overflow",
  297.    204, "real overflow, underflow, or division by zero",
  298.    205, "value out of range",
  299.    206, "negative first argument to real exponentiation",
  300.    207, "invalid field name",
  301.    208, "second and third arguments to map of unequal length",
  302.    209, "invalid second argument to open",
  303.    210, "non-ascending arguments to detab/entab",
  304.    211, "by value equal to zero",
  305.    212, "attempt to read file not open for reading",
  306.    213, "attempt to write file not open for writing",
  307.    214, "input/output error",
  308.    215, "attempt to refresh &main",
  309.    216, "external function not found",
  310.  
  311.  
  312.    301, "evaluation stack overflow",
  313.    302, "system stack overflow",
  314.    303, "inadequate space for evaluation stack",
  315.  
  316. #ifdef FixedRegions
  317.    304, "inadequate space in qualifier list",
  318. #endif                    /* FixedRegions */
  319.  
  320.    305, "inadequate space for static allocation",
  321.    306, "inadequate space in string region",
  322.    307, "inadequate space in block region",
  323.    308, "system stack overflow in co-expression",
  324.  
  325. #if VMS
  326.    351, "insufficient MAXMEM limit",
  327. #endif                    /* VMS */
  328.  
  329. #ifndef Coexpr
  330.    401, "co-expressions not implemented",
  331. #endif                    /* Coexpr */
  332.  
  333.    500, "program malfunction",        /* for use by runerr() */
  334.  
  335. /*
  336.  * End of operating-system specific code.
  337.  */
  338.  
  339.    0,    ""
  340.    };
  341.  
  342. /*
  343.  * Note:  the following material is here to avoid a bug in the Cray C compiler.
  344.  */
  345.  
  346. /*
  347.  * When an opcode n has a subroutine call associated with it, the
  348.  *  nth word here is the routine to call.
  349.  */
  350.  
  351. int (*optab[])() = {
  352.     err,
  353. #define OpDef(p,n,s) Cat(O,p),
  354. #include "../h/odefs.h"
  355. #undef OpDef
  356.    Obscan,
  357.    err,
  358.    err,
  359.    err,
  360.    err,
  361.    err,
  362.    Ocreate,
  363.    err,
  364.    err,
  365.    err,
  366.    err,
  367.    Oescan,
  368.    err,
  369.    Ofield
  370.    };
  371.