00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00030
00031
00032
00033
00034 #ifndef ASC_EXPRS_H
00035 #define ASC_EXPRS_H
00036
00041 extern struct Expr *CreateVarExpr(struct Name *n);
00046 extern struct Expr *CreateDiffExpr(struct Name *n);
00052 extern void InitVarExpr(struct Expr *e, CONST struct Name *n);
00065 extern struct Expr *CreateOpExpr(enum Expr_enum t);
00070 extern struct Expr *CreateSatisfiedExpr(struct Name *n,
00071 double tol,
00072 CONST dim_type *dims);
00077 extern struct Expr *CreateFuncExpr(CONST struct Func *f);
00082 extern struct Expr *CreateIntExpr(long i);
00087 extern struct Expr *CreateRealExpr(double r, CONST dim_type *dims);
00092 extern struct Expr *CreateTrueExpr(void);
00097 extern struct Expr *CreateFalseExpr(void);
00102 extern struct Expr *CreateAnyExpr(void);
00107 extern struct Expr *CreateSetExpr(struct Set *set);
00112 extern struct Expr *CreateSymbolExpr(symchar *sym);
00117 extern struct Expr *CreateQStringExpr(CONST char *qstring);
00124 extern struct Expr *CreateBuiltin(enum Expr_enum t, struct Set *set);
00129 extern void LinkExprs(struct Expr *cur, struct Expr *next);
00134 extern unsigned long ExprListLength(CONST struct Expr *e);
00140 #ifdef NDEBUG
00141 #define NextExpr(e) ((e)->next)
00142 #else
00143 #define NextExpr(e) NextExprF(e)
00144 #endif
00145
00151 extern struct Expr *NextExprF(CONST struct Expr *e);
00158 #ifdef NDEBUG
00159 #define ExprType(e) ((e)->t)
00160 #else
00161 #define ExprType(e) ExprTypeF(e)
00162 #endif
00163
00169 extern enum Expr_enum ExprTypeF(CONST struct Expr *e);
00176 #ifdef NDEBUG
00177 #define ExprName(e) ((e)->v.nptr)
00178 #else
00179 #define ExprName(e) ExprNameF(e)
00180 #endif
00181
00187 extern CONST struct Name *ExprNameF(CONST struct Expr *e);
00194 #ifdef NDEBUG
00195 #define ExprFunc(e) ((e)->v.fptr)
00196 #else
00197 #define ExprFunc(e) ExprFuncF(e)
00198 #endif
00199
00205 extern CONST struct Func *ExprFuncF(CONST struct Expr *e);
00212 #ifdef NDEBUG
00213 #define ExprIValue(e) ((e)->v.ivalue)
00214 #else
00215 #define ExprIValue(e) ExprIValueF(e)
00216 #endif
00217
00223 extern long ExprIValueF(CONST struct Expr *e);
00230 #ifdef NDEBUG
00231 #define ExprRValue(e) ((e)->v.r.rvalue)
00232 #else
00233 #define ExprRValue(e) ExprRValueF(e)
00234 #endif
00235
00241 extern double ExprRValueF(CONST struct Expr *e);
00248 #ifdef NDEBUG
00249 #define ExprRDimensions(e) ((e)->v.r.dimensions)
00250 #else
00251 #define ExprRDimensions(e) ExprRDimensionsF(e)
00252 #endif
00253
00259 extern CONST dim_type *ExprRDimensionsF(CONST struct Expr *e);
00266 #ifdef NDEBUG
00267 #define SatisfiedExprName(e) ((e)->v.se.sen)
00268 #else
00269 #define SatisfiedExprName(e) SatisfiedExprNameF(e)
00270 #endif
00271
00277 extern CONST struct Name *SatisfiedExprNameF(CONST struct Expr *e);
00284 #ifdef NDEBUG
00285 #define SatisfiedExprRValue(e) ((e)->v.se.ser.rvalue)
00286 #else
00287 #define SatisfiedExprRValue(e) SatisfiedExprRValueF(e)
00288 #endif
00289
00295 extern double SatisfiedExprRValueF(CONST struct Expr *e);
00302 #ifdef NDEBUG
00303 #define SatisfiedExprRDimensions(e) ((e)->v.se.ser.dimensions)
00304 #else
00305 #define SatisfiedExprRDimensions(e) SatisfiedExprRDimensionsF(e)
00306 #endif
00307
00313 extern CONST dim_type *SatisfiedExprRDimensionsF(CONST struct Expr *e);
00320 #ifdef NDEBUG
00321 #define ExprBValue(e) ((e)->v.bvalue)
00322 #else
00323 #define ExprBValue(e) ExprBValueF(e)
00324 #endif
00325
00332 extern int ExprBValueF(CONST struct Expr *e);
00339 #ifdef NDEBUG
00340 #define ExprSValue(e) ((e)->v.s)
00341 #else
00342 #define ExprSValue(e) ExprSValueF(e)
00343 #endif
00344
00350 extern struct Set *ExprSValueF(CONST struct Expr *e);
00357 #ifdef NDEBUG
00358 #define ExprSymValue(e) ((e)->v.sym_ptr)
00359 #else
00360 #define ExprSymValue(e) ExprSymValueF(e)
00361 #endif
00362
00368 extern symchar *ExprSymValueF(CONST struct Expr *e);
00375 #ifdef NDEBUG
00376 #define ExprQStrValue(e) ((e)->v.sym_ptr)
00377 #else
00378 #define ExprQStrValue(e) ExprQStrValueF(e)
00379 #endif
00380
00388 extern CONST char *ExprQStrValueF(CONST struct Expr *e);
00397 #ifdef NDEBUG
00398 #define ExprBuiltinSet(e) ((e)->v.s)
00399 #else
00400 #define ExprBuiltinSet(e) ExprBuiltinSetF(e)
00401 #endif
00402
00409 extern CONST struct Set *ExprBuiltinSetF(CONST struct Expr *e);
00417 extern struct Expr *CopyExprList(CONST struct Expr *e);
00422 extern void DestroyExprList(struct Expr *e);
00428 extern struct Expr *JoinExprLists(struct Expr *e1, struct Expr *e2);
00434 extern int ExprsEqual(CONST struct Expr *e1, CONST struct Expr *e2);
00439 extern int CompareExprs(CONST struct Expr *e1, CONST struct Expr *e2);
00450 extern void exprs_init_pool(void);
00455 extern void exprs_destroy_pool(void);
00460 extern void exprs_report_pool(void);
00465
00466
00467 #endif
00468