31 #define EV_OPTIMIZE0 0
32 #define EV_OPTIMIZE1 1
34 #define MAX_RECURSION 20
36 #define EV_NHELPARGS 10
38 typedef char *(*ev_Expander)(
const char *str,
int thread);
59 #define OP_QUESTION 20
66 #define OP_SBRACKET 30
69 #define MAX_OPERATOR_TOKEN 32
79 #define EV_SYMTRANSIENT 0x04000000
80 #define EV_SYMCONSTANT 0x08000000
81 #define EV_FLAGS_SET 0x10000000
82 #define EV_SYMEXPAND 0x20000000
83 #define EV_EXFUNC_REF 0x40000000
84 #define EV_FOR_EXFUNC 0x80000000
87 #define EX_USERFLAGMASK (0x03ffffff | EV_EXFUNC_REF)
99 #define EV_TYPEFLOAT 0
100 #define EV_TYPESTRING 1
101 #define EV_TYPEUNIXVAR 2
102 #define EV_TYPEEXPANDVAR 4
103 #define EV_TYPEVECTOR 5
104 #define EV_TYPEMATRIX 6
110 #define EV_TYPE_LOCAL_VAR 10
111 #define EV_TYPE_UNRESOLVED_VAR 11
112 #define EV_TYPE_DEFINE 12
113 #define EV_TYPE_GEOATTRIBUTE 13
114 #define EV_TYPE_GLOBAL_VAR 20
115 #define EV_TYPE_CPPSYMBOL 45
116 #define EV_TYPE_UNRESOLVED_CPPSYMBOL 46
145 const char *new_fullpath,
146 const char *old_fullpath,
148 const char *chan_name,
149 const char *old_chan_name);
212 #define EV_START_FN(name) \
213 static void name(EV_FUNCTION *, EV_SYMBOL *result,\
214 EV_SYMBOL **argv, int thread, unsigned &func_flags)
215 #define EV_START_FNNA(name) \
216 static void name(EV_FUNCTION *, EV_SYMBOL *result, \
217 EV_SYMBOL **, int thread, unsigned &func_flags)
218 #define EV_START_FUNC(name) \
219 static void name(EV_FUNCTION *func, EV_SYMBOL *result,\
220 EV_SYMBOL **argv, int thread, unsigned &func_flags)
221 #define EV_END_FN(answer) \
222 result->value.fval = (answer)
223 #define EV_END_FNS(answer) \
224 result->value.sval = (answer)
231 unsigned &func_flags);
238 const char *
name = 0,
241 const int *argTypes = 0,
246 bool is_threadsafe =
false);
251 virtual int64 getMemoryUsage(
bool inclusive)
const;
254 const char *
getName()
const {
return myName; }
263 static void *getInstanceData(
int thread);
264 static void setInstanceAllocator(
const char *
function,
265 void *(*alloc)(),
void (*freer)(
void *));
276 myDependCallback = cb;
280 myChangeOpRefCallback = cb;
300 const int *myArgTypes;
301 void *(*myAllocator)();
302 void (*myFreer)(
void *);
303 unsigned myUserFlags;
334 class in_INSTRUCTION;
338 UT_SMALLOBJECT_CLEANPAGES_DEFAULT,
339 UT_SMALLOBJECT_PAGESIZE_DEFAULT,
340 UT_SMALLOBJECT_THREADSAFE_ON>
350 myFuncRetType = ret_type;
351 myInExprFunc =
false;
352 myNeedResolveVars =
false;
353 myIsPureCompiled =
false;
360 int64 getMemoryUsage(
bool inclusive)
const;
376 {
return evaluate(myFuncRetType, thread); }
380 bool changeExpr(
const char *
source);
381 void unresolveVars(
int thread);
386 void updateOpDependency(
void *ref_id,
int thread);
387 int changeOpReference(
const char *new_fullpath,
388 const char *old_fullpath,
390 const char *chan_name,
391 const char *old_chan_name,
397 bool saveCompiledCode(std::ostream &os,
int thread);
408 *
static_cast<unsigned const volatile *
>(&myFlags);
413 {
return ((
getFlags() & bit) != 0); }
423 void appendFlags(
unsigned int flag)
429 void clearFlagsBeforeEvaluation()
439 {
return ((myFlags & bit) != 0); }
462 {
return (myCompiled != 0); }
465 {
return myIsPureCompiled; }
470 void * getSingleFunctionInstanceData(
476 {
return myInExprFunc; }
478 { myInExprFunc = is_inside; }
483 {
return myFuncRetType; }
485 { myFuncRetType = ret_type; }
492 void freeCompiledExpr(
EV_SYMBOL *&free_list);
494 int compile(
const char *tstring,
int thread,
495 bool ignore_bad_vars);
497 int thread,
bool ignore_bad_vars);
498 bool freeExprSpace();
499 void doUpdateOpDependency(
void *ref_id,
int thread);
500 int doChangeOpReference(
UT_String &new_source,
507 in_INSTRUCTION *myCompiled;
513 bool myNeedResolveVars:1;
516 bool myIsPureCompiled:1;
545 bool full_match_only =
false);
561 const char *
function,
563 void (*free)(
void *));
597 void *ref_id,
int thread);
599 const char *new_fullpath,
600 const char *old_fullpath,
602 const char *chan_name,
603 const char *old_chan_name,
613 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 *))
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
GLenum GLuint GLenum GLsizei const GLchar * buf
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
**But if you need a result
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)
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
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
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)
EXPR_API bool ev_isInSafeMode()
EXPR_API void ev_AddFunction(EV_FUNCTION *func)
bool isInExprFunc() const
GLuint const GLchar * name
struct EV_FUNCHELP EV_FUNCHELP
int resultType
Resultant type of op.
class representing a symbol operated upon by expressions
EXPR_API void ev_InitVector()
initialize vector operations
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)