home *** CD-ROM | disk | FTP | other *** search
/ Encyclopedia of Graphics File Formats Companion / GFF_CD.ISO / formats / ttddd / spec / t3d_doc / igensurf.zoo / src / calcomp.h < prev    next >
C/C++ Source or Header  |  1991-09-28  |  2KB  |  74 lines

  1. /* :ts=8 */
  2. /* Copyright (c) 1986 Regents of the University of California */
  3.  
  4. #ifndef _CALCOMP_H
  5.  
  6. /* SCCSid "@(#)calcomp.h 1.5 4/23/91 LBL" */
  7.  
  8. /*
  9.  *  calcomp.h - header file for expression parser.
  10.  *
  11.  */
  12.                 /* Expression_T types */
  13. #define  ET_Variable    1
  14. #define  ET_Number    2
  15. #define  ET_UMinus    3
  16. #define  ET_Chan    4
  17. #define  ET_Function    5
  18. #define  ET_Argument    6
  19. #define  ET_Timestamp    7
  20. #define  ET_Symbol    8
  21.                 /* also: '+', '-', '*', '/', '^', '=', ':' */
  22.  
  23. typedef struct {
  24.     char      *Function_Name;        /* function name         */
  25.     short     Number_Args;        /* # of required arguments     */
  26.     short      Assignment_Type;    /* assignment type (':' or '=') */
  27.     double      (*Func_Ptr)();        /* pointer to function         */
  28. }  Function_T;                /* a library function         */
  29.  
  30. struct Expression_Tag;    /* Forward declaration */
  31.  
  32. typedef struct Variable_Tag {
  33.     char             *Name;      /* variable name         */
  34.     int             Number_Links;  /* number of references     */
  35.     struct Expression_Tag  *Expression;      /* definition         */
  36.     Function_T         *Function;      /* library definition     */
  37.     struct Variable_Tag    *Next;      /* next in hash list         */
  38. } Variable_T;                  /* A variable definition    */
  39.  
  40. typedef struct Expression_Tag {
  41.     int                 Node_Type;    /* node type         */
  42.     struct Expression_Tag      *Sibling;    /* next child this level*/
  43.     union {
  44.     struct Expression_Tag  *Kid;        /* first child         */
  45.     double          Number;        /* number         */
  46.     char              *Name;        /* symbol name         */
  47.     int              Channel;    /* channel number     */
  48.     long              Timestamp;    /* timestamp         */
  49.     Variable_T         *Variable;    /* link         */
  50.     } Value;                    /* value         */
  51. }  Expression_T;                /* an expression node     */
  52.  
  53. extern double          String_Eval(), Var_Value(), Func_Value();
  54. extern double          Get_Argument(), GetFloat();
  55. extern double          (*Expr_Funcs[])();
  56. extern int          GetInteger();
  57. extern char          *Get_Name(), *Get_Func_Arg_Name();
  58. extern Expression_T      *Expr_Parse(), *Expr_Kid(), *Expr_Lookup(); 
  59. extern Expression_T     *Expr_Pop(), *Expr_First(), *Expr_Next();
  60. extern Expression_T      *Expr_Get();
  61. extern Expression_T      *Get_E1(), *Get_E2(), *Get_E3();
  62. extern Expression_T     *Get_E4(), *Get_E5(), *Const_Reduce();
  63. extern Variable_T      *Var_Insert(), *Var_Lookup(), *Get_Func_Arg();
  64. extern Function_T      *LibFunc_Lookup();
  65. extern long             eclock;
  66. extern int          Next_Char;
  67. extern int          errno;
  68. extern void        Expr_Free(), Init_File(), Init_Str();
  69. extern void        Get_Next_Char(), Syntax_Error();
  70.  
  71. #define  Expr_Value(ep)    (*Expr_Funcs[(ep)->Node_Type])(ep)
  72.  
  73. #endif
  74.