30 #define EV_OPTIMIZE0 0
31 #define EV_OPTIMIZE1 1
33 #define MAX_RECURSION 20
35 #define EV_NHELPARGS 10
37 typedef char *(*ev_Expander)(
const char *str,
int thread);
58 #define OP_QUESTION 20
65 #define OP_SBRACKET 30
68 #define MAX_OPERATOR_TOKEN 32
78 #define EV_SYMTRANSIENT 0x04000000
79 #define EV_SYMCONSTANT 0x08000000
80 #define EV_FLAGS_SET 0x10000000
81 #define EV_SYMEXPAND 0x20000000
82 #define EV_EXFUNC_REF 0x40000000
83 #define EV_FOR_EXFUNC 0x80000000
86 #define EX_USERFLAGMASK (0x03ffffff | EV_EXFUNC_REF)
98 #define EV_TYPEFLOAT 0
99 #define EV_TYPESTRING 1
100 #define EV_TYPEUNIXVAR 2
101 #define EV_TYPEEXPANDVAR 4
102 #define EV_TYPEVECTOR 5
103 #define EV_TYPEMATRIX 6
109 #define EV_TYPE_LOCAL_VAR 10
110 #define EV_TYPE_UNRESOLVED_VAR 11
111 #define EV_TYPE_DEFINE 12
112 #define EV_TYPE_GEOATTRIBUTE 13
113 #define EV_TYPE_GLOBAL_VAR 20
114 #define EV_TYPE_CPPSYMBOL 45
115 #define EV_TYPE_UNRESOLVED_CPPSYMBOL 46
144 const char *new_fullpath,
145 const char *old_fullpath,
147 const char *chan_name,
148 const char *old_chan_name);
211 #define EV_START_FN(name) \
212 static void name(EV_FUNCTION *, EV_SYMBOL *result,\
213 EV_SYMBOL **argv, int thread, unsigned &func_flags)
214 #define EV_START_FNNA(name) \
215 static void name(EV_FUNCTION *, EV_SYMBOL *result, \
216 EV_SYMBOL **, int thread, unsigned &func_flags)
217 #define EV_START_FUNC(name) \
218 static void name(EV_FUNCTION *func, EV_SYMBOL *result,\
219 EV_SYMBOL **argv, int thread, unsigned &func_flags)
220 #define EV_END_FN(answer) \
221 result->value.fval = (answer)
222 #define EV_END_FNS(answer) \
223 result->value.sval = (answer)
230 unsigned &func_flags);
236 const char *
name = 0,
239 const int *argTypes = 0,
244 bool is_threadsafe =
false);
247 virtual int64 getMemoryUsage(
bool inclusive)
const;
250 const char *
getName()
const {
return myName; }
259 static void *getInstanceData(
int thread);
260 static void setInstanceAllocator(
const char *
function,
261 void *(*alloc)(),
void (*freer)(
void *));
272 myDependCallback = cb;
276 myChangeOpRefCallback = cb;
296 const int *myArgTypes;
297 void *(*myAllocator)();
298 void (*myFreer)(
void *);
299 unsigned myUserFlags;
330 class in_INSTRUCTION;
334 UT_SMALLOBJECT_CLEANPAGES_DEFAULT,
335 UT_SMALLOBJECT_PAGESIZE_DEFAULT,
336 UT_SMALLOBJECT_THREADSAFE_ON>
346 myFuncRetType = ret_type;
347 myInExprFunc =
false;
348 myNeedResolveVars =
false;
349 myIsPureCompiled =
false;
356 int64 getMemoryUsage(
bool inclusive)
const;
372 {
return evaluate(myFuncRetType, thread); }
376 bool changeExpr(
const char *
source);
377 void unresolveVars(
int thread);
382 void updateOpDependency(
void *ref_id,
int thread);
383 int changeOpReference(
const char *new_fullpath,
384 const char *old_fullpath,
386 const char *chan_name,
387 const char *old_chan_name,
393 bool saveCompiledCode(std::ostream &os,
int thread);
404 *
static_cast<unsigned const volatile *
>(&myFlags);
409 {
return ((
getFlags() & bit) != 0); }
419 void appendFlags(
unsigned int flag)
425 void clearFlagsBeforeEvaluation()
435 {
return ((myFlags & bit) != 0); }
458 {
return (myCompiled != 0); }
461 {
return myIsPureCompiled; }
466 void * getSingleFunctionInstanceData(
472 {
return myInExprFunc; }
474 { myInExprFunc = is_inside; }
479 {
return myFuncRetType; }
481 { myFuncRetType = ret_type; }
488 void freeCompiledExpr(
EV_SYMBOL *&free_list);
490 int compile(
const char *tstring,
int thread,
491 bool ignore_bad_vars);
493 int thread,
bool ignore_bad_vars);
494 bool freeExprSpace();
495 void doUpdateOpDependency(
void *ref_id,
int thread);
496 int doChangeOpReference(
UT_String &new_source,
503 in_INSTRUCTION *myCompiled;
509 bool myNeedResolveVars:1;
512 bool myIsPureCompiled:1;
541 bool full_match_only =
false);
557 const char *
function,
559 void (*free)(
void *));
593 void *ref_id,
int thread);
595 const char *new_fullpath,
596 const char *old_fullpath,
598 const char *chan_name,
599 const char *old_chan_name,
609 std::ostream &os,
int thread);
EXPR_API void ev_UpdateOpDependency(EV_EXPRESSION *expr, void *ref_id, int thread)
const char * old_fullpath
int(* castFrom)(EV_SYMBOL *me, EV_SYMBOL *from)
void setInstanceAllocator(void *(*alloc)(), void(*freer)(void *))
EXPRopChangeRefCallback myChangeOpRefCallback
EXPR_API void ev_DeleteVariableType(EV_TYPEDEF *type)
EXPR_API int ev_ChangeOpReference(EV_EXPRESSION *expr, const char *new_fullpath, const char *old_fullpath, const char *old_cwd, const char *chan_name, const char *old_chan_name, int thread)
EXPR_API void ev_setSafeMode(bool safe_mode)
union used to hold a token's value
void * allocInstanceData()
void freeInstanceData(void *d)
void setChangeOpRefCallback(EXPRopChangeRefCallback cb)
EXPR_API void ev_FreeExpr(EV_EXPRESSION *expr)
void clearFlagsBeforeEvaluationUnsafe()
EXPR_API void ev_InitUserFunc()
const char * getName() const
void(* freeValue)(EV_SYMBOL *)
void(* EXPRopDependencyCallback)(EV_FUNCTION *me, EV_SYMBOL **argv, void *ref_id)
void setEvaluatedUnsafe()
const int * getArgTypes() const
int(* castValue)(EV_SYMBOL *to, EV_SYMBOL *me, int thread)
EXPR_API void ev_InitVariable()
int pos
String pos in expression.
int flag
Flag for operator.
EXPR_API void ev_InitFloat()
unsigned flag
Flag for symbols.
EXPR_API EV_TYPEDEF * ev_GetTypeDef(int key)
EXPR_API EV_SYMBOL * ev_AllocSymbol(int type, int thread)
EXPR_Lock & getLock() const
Return a reference for thread-safe access.
void setFlagsUnsafe(unsigned int flags)
EXPR_API void ev_InitString()
initialize string operations
int leftType
Data for left side of op.
void(* EXPRfuncCallback)(EV_FUNCTION *me, EV_SYMBOL *result, EV_SYMBOL **argv, int thread, unsigned &func_flags)
unsigned int getFlagsUnsafe() const
GLuint const GLchar * name
EXPR_API void ev_FreeSymbol(EV_SYMBOL *symbol, int thread)
EV_EXPRESSION(EV_InlineFuncReturnType ret_type)
const char * new_fullpath
bool hasFlagUnsafe(unsigned int bit) const
int getFlags(int version)
EXPR_API bool ev_SaveCompiledCode(EV_EXPRESSION *expr, std::ostream &os, int thread)
EV_TYPEDEF * type
Interpretation of data.
EXPR_API fpreal ev_EvaluateFloat(EV_EXPRESSION *expr, int thread)
EXPR_API EV_SYMBOL * ev_Evaluate(EV_EXPRESSION *expr, EV_InlineFuncReturnType func_ret_type, int thread)
int rightType
Data for right side of op.
EXPR_API int ev_EvaluateMatrix(EV_EXPRESSION *expr, ev_Matrix &result, int thread)
EXPR_API bool ev_isKeyword(const char *string)
int(* getCastType)(EV_SYMBOL *src)
int token
OP_ token to identify.
EXPR_API void ev_UnresolveVars(EV_EXPRESSION *expr, int thread)
EXPR_API void * ev_GetFunctionData(int thread)
EXPR_API void ev_InitMatrix()
initialize matrix operations
#define SYS_DEPRECATED_REPLACE(__V__, __R__)
EV_SYMBOL * next
Used Internally.
void clearAllFlagsUnsafe()
EV_TOKENVALUE value
Token data.
EXPRfuncCallback myCallback
EXPR_API void EXPRftoa(UT_WorkBuffer &buf, fpreal v)
EXPR_API int ev_GetNFunctions()
EXPR_API void ev_DeleteFunction(EV_FUNCTION *func)
GLint GLint GLsizei GLint GLenum GLenum type
EV_SYMBOL * evaluate(int thread)
EXPR_API EV_FUNCTION * ev_GetFunction(int i)
bool isPureCompiled() const
EXPR_API void ev_SetExpander(ev_Expander expander)
#define EV_TYPEFLOAT
Float type of symbol.
void(* evaluate)(EV_SYMBOL *, EV_SYMBOL *, EV_SYMBOL *)
GLsizei GLsizei GLchar * source
bool isThreadSafe() const
EXPR_API void ev_PrintHelp(std::ostream &os, const char *match, const char *keyword, bool full_match_only=false)
EXPR_API int ev_ChangeExpr(EV_EXPRESSION *expr, const char *source)
#define EV_FLAGS_SET
User flags have been set.
EXPR_API void ev_SetOptimization(int level)
typedef int(WINAPI *PFNWGLRELEASEPBUFFERDCARBPROC)(HPBUFFERARB hPbuffer
EXPR_API bool ev_isInSafeMode()
EXPR_API void ev_AddFunction(EV_FUNCTION *func)
bool isInExprFunc() const
char * argname[EV_NHELPARGS]
int resultType
Resultant type of op.
class representing a symbol operated upon by expressions
EXPR_API void ev_InitVector()
initialize vector operations
GLenum GLuint GLenum GLsizei const GLchar * buf
bool isEvaluatedUnsafe() const
#define EV_SYMCONSTANT
Symbol has a constant value.
#define EV_SYMTRANSIENT
Symbol is result of operation.
struct describing an operator's characteristics
bool hasFlag(unsigned int bit) const
void setIsThreadSafe(bool flag)
EV_InlineFuncReturnType getInlineFuncRetType() const
EXPR_API int ev_EvaluateVector(EV_EXPRESSION *expr, ev_Vector &result, int thread)
EXPR_API void ev_AddVariableType(EV_TYPEDEF *type, int atEnd)
void(* copyValue)(EV_SYMBOL *dest, EV_SYMBOL *src, int thread)
**Note that the tasks the is the thread number *for the or if it s being executed by a non pool thread(this *can happen in cases where the whole pool is occupied and the calling *thread contributes to running the work load).**Thread pool.Have fun
EXPR_API void ev_AddOperator(EV_OPERATOR *op, int level)
EXPR_API EV_EXPRESSION * ev_AllocExpr(EV_InlineFuncReturnType rettype)
EXPR_API bool ev_LoadCompiledCode(EV_EXPRESSION *expr, UT_IStream &is, int thread)
void appendFlagsUnsafe(unsigned int flag)
void setOpDependencyCallback(EXPRopDependencyCallback cb)
char *(* ev_Expander)(const char *str, int thread)
int getResultType() const
bool isForExprFunc() const
EXPR_API void ev_SetFunctionInstanceAllocator(const char *function, void *(*alloc)(), void(*free)(void *))
Functions for supplying state data for custom expressions.
EXPR_API void ev_AddType(EV_TYPEDEF *type)
const char * old_chan_name
const char * getSource() const
EXPRopDependencyCallback myDependCallback
const char * getDSOLocation() const
void(* allocValue)(EV_SYMBOL *)
unsigned getUserFlags() const
EXPR_API void ev_EvaluateString(UT_String &result, EV_EXPRESSION *expr, int thread)
void setInExprFunc(bool is_inside)
EXPR_API int ev_FindFunction(const char *name)
unsigned int getFlags() const
void(* opDepend)(EV_SYMBOL *src, void *ref_id)
unsigned char binary
Binary or unary operator.
void setInlineFuncRetType(EV_InlineFuncReturnType ret_type)
int getArgType(int i) const
EV_OPERATOR * next
Used internally.
void(* EXPRopChangeRefCallback)(EV_FUNCTION *me, EV_SYMBOL **argv, char *new_args[], const char *new_fullpath, const char *old_fullpath, const char *old_cwd, const char *chan_name, const char *old_chan_name)
EXPR_API void ev_SetFunctionDependencyCallbacks(const char *func, EXPRopDependencyCallback depend_cb, EXPRopChangeRefCallback changeref_cb)