home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / oper_sys / fp / ifp_unix.lzh / ifp / interp / node.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-05-23  |  3.9 KB  |  112 lines

  1.  
  2. /****** node.h ********************************************************/
  3. /**                                                                  **/
  4. /**                    University of Illinois                        **/
  5. /**                                                                  **/
  6. /**                Department of Computer Science                    **/
  7. /**                                                                  **/
  8. /**   Tool: IFP                         Version: 0.5                 **/
  9. /**                                                                  **/
  10. /**   Author:  Arch D. Robison          Date:   May 1, 1985          **/
  11. /**                                                                  **/
  12. /**   Revised by: Arch D. Robison       Date:   May 5, 1987          **/
  13. /**                                                                  **/
  14. /**   Principal Investigators: Prof. R. H. Campbell                  **/
  15. /**                            Prof. W. J. Kubitz                    **/
  16. /**                                                                  **/
  17. /**                                                                  **/
  18. /**------------------------------------------------------------------**/
  19. /**   (C) Copyright 1987  University of Illinois Board of Trustees   **/
  20. /**                       All Rights Reserved.                       **/
  21. /**********************************************************************/
  22.  
  23. #ifndef INCLUDE_NODE_H
  24. #define INCLUDE_NODE_H 1
  25.  
  26. /*
  27.  * Define FETCH as 1 to define "fetch" (^k) functional form, 0 otherwise.
  28.  * Define XDEF  as 1 to define "xdef"  ({...} f) functional form, 0 otherwise.
  29.  */
  30. #define FETCH 0
  31. #define XDEF 1
  32.  
  33. extern ListPtr MakePath ();
  34.  
  35. extern NodePtr PrimDef (), FindNode (), MakeNode ();
  36. extern void LinkPath (), GroupDef ();
  37.  
  38.  
  39. #define ObIsDefNode(X) ((X)->Tag==NODE && (X)->Node->NodeType==DEF)
  40. extern NodePtr CopyNPtr ();
  41. extern NodePtr MakeChild ();
  42. extern NodePtr RootNode, SysNode, ArithNode, LogicNode;
  43. extern void DelNPtr (), FormPath ();
  44. void InitNode ();
  45.  
  46.  
  47. /*
  48.  * OpDef
  49.  *
  50.  * The OpDef structure is used for node initialization tables.
  51.  * 
  52.  * The OPDEF macro is for writing static initilizations of OpDef tables.
  53.  * The release version may look strange, since OPDEF does not use its
  54.  * last parameter, which is for OOFP only.
  55.  *
  56.  * Fields 
  57.  *      OpName = name of function
  58.  *    OpParam = internal id # for function.  Many functions have the same 
  59.  *          code, and are distinguished by passing the OpParam to the 
  60.  *          code.  For an example, see function Dyadic in F_arith.c
  61.  *     OpPtr = pointer to function code, these functions should be void,
  62.  *        but the compiler complains about void functions in static
  63.  *         initializations.
  64.  */
  65. typedef struct {       
  66.    char *OpName;
  67.    char OpParam;
  68.    int (*OpPtr) ();     
  69. } OpDef;                
  70.  
  71. #define OPDEF(a,b,c,d) {a,b,c}        /* Throws d away */
  72.  
  73. #define OpCount(OpTable) (sizeof(OpTable)/sizeof(OpTable[0])) 
  74.  
  75. extern NodePtr FormNode[];
  76.  
  77. /*
  78.  * Subscripts for FormNode
  79.  *
  80.  * These must correspond to the entries in the FormOpTable in forms.c
  81.  * Also, the InFirst[] array in "infun.c" must be updated if entries are added.
  82.  */
  83. #define NODE_C          0
  84. #define NODE_Comp       1
  85. #define NODE_Cons       2
  86. #define NODE_Each       3
  87. #define NODE_Fetch    4
  88. #define NODE_Filter     (4 + FETCH)
  89. #define NODE_If         (5 + FETCH)
  90. #define NODE_RInsert    (6 + FETCH)
  91. #define NODE_Out        (7 + FETCH)
  92. #define NODE_Sel        (8 + FETCH)
  93. #define NODE_While      (9 + FETCH)
  94. #define NODE_XDef    (9 + FETCH + XDEF)
  95. #define NODE_Enc    (9 + FETCH + XDEF + OOFP) 
  96. #define FORM_TABLE_SIZE (1 + NODE_Enc)
  97.  
  98.  
  99. typedef struct {
  100.    NodePtr FormNode;            /* Node pointer for form */
  101.    char *FormInPrefix;
  102.    OpDef FormOp;
  103.    char *FormComment;        /* Comment for `expected' error message */
  104. } FormEntry;
  105.  
  106. extern FormEntry FormTable[FORM_TABLE_SIZE];
  107.  
  108. #endif
  109.  
  110. /****************************** end of node.h ******************************/
  111.  
  112.