EXPR/EXPR.h File Reference

#include "EXPR_API.h"
#include "EX_Error.h"
#include "EXPR_Lock.h"
#include <UT/UT_SmallObject.h>
#include <UT/UT_String.h>

Go to the source code of this file.

Classes

union  EV_TOKENVALUE
class  EV_SYMBOL
struct  EV_TYPEDEF
struct  EV_OPERATOR
class  EV_FUNCTION
struct  EV_ChangeOpReferenceParms
class  EV_EXPRESSION
struct  EV_SYMTABLE
struct  EV_FUNCHELP

Defines

#define EV_OPTIMIZE0   0
#define EV_OPTIMIZE1   1
#define MAX_RECURSION   20
#define EV_NHELPARGS   10
#define OP_PLUS   1
#define OP_MINUS   2
#define OP_TIMES   3
#define OP_DIVIDE   4
#define OP_POWER   5
#define OP_MOD   6
#define OP_NOT   7
#define OP_EQ   8
#define OP_NE   9
#define OP_LT   10
#define OP_LE   11
#define OP_GT   12
#define OP_GE   13
#define OP_LOGAND   14
#define OP_LOGOR   15
#define OP_COMMA   16
#define OP_QUESTION   20
#define OP_COLON   21
#define OP_AND   22
#define OP_OR   23
#define OP_DOT   24
#define OP_TILDE   25
#define OP_AT   26
#define OP_SBRACKET   30
#define OP_BRACE   31
#define OP_EQUATE   32
#define MAX_OPERATOR_TOKEN   32
#define EV_SYMTRANSIENT   0x04000000
#define EV_SYMCONSTANT   0x08000000
#define EV_FLAGS_SET   0x10000000
#define EV_SYMEXPAND   0x20000000
#define EV_EXFUNC_REF   0x40000000
#define EV_FOR_EXFUNC   0x80000000
#define EX_USERFLAGMASK   (0x03ffffff | EV_EXFUNC_REF)
#define EV_TYPEFLOAT   0
#define EV_TYPESTRING   1
#define EV_TYPEUNIXVAR   2
#define EV_TYPEEXPANDVAR   4
#define EV_TYPEVECTOR   5
#define EV_TYPEMATRIX   6
#define EV_TYPE_LOCAL_VAR   10
#define EV_TYPE_UNRESOLVED_VAR   11
#define EV_TYPE_DEFINE   12
#define EV_TYPE_GLOBAL_VAR   20
#define EV_TYPE_CPPSYMBOL   45
#define EV_TYPE_UNRESOLVED_CPPSYMBOL   46

Typedefs

typedef char *(* ev_Expander )(const char *str, int thread)
typedef struct EV_TYPEDEF EV_TYPEDEF
typedef struct EV_OPERATOR EV_OPERATOR
typedef struct EV_FUNCHELP EV_FUNCHELP
typedef void(* EXPRopDependencyCallback )(EV_FUNCTION *me, EV_SYMBOL **args, void *ref_id)
typedef void(* EXPRopChangeRefCallback )(EV_FUNCTION *me, EV_SYMBOL **args, char *new_args[], const char *new_fullpath, const char *old_fullpath, const char *old_cwd, const char *chan_name, const char *old_chan_name)
typedef struct EV_SYMTABLE EV_SYMTABLE

Enumerations

enum  EV_InlineFuncReturnType {
  EV_EXPR_RETURN_NONE, EV_EXPR_RETURN_FLOAT, EV_EXPR_RETURN_STRING, EV_EXPR_RETURN_VECTOR,
  EV_EXPR_RETURN_MATRIX
}

Functions

EXPR_API void ev_InitFloat (void)
EXPR_API void ev_InitString (void)
EXPR_API void ev_InitVariable (void)
EXPR_API void ev_InitVector (void)
EXPR_API void ev_InitMatrix (void)
EXPR_API void ev_InitUserFunc (void)
EXPR_API void ev_AddType (EV_TYPEDEF *type)
EXPR_API void ev_AddVariableType (EV_TYPEDEF *type, int atEnd)
EXPR_API void ev_DeleteVariableType (EV_TYPEDEF *type)
EXPR_API void ev_AddOperator (EV_OPERATOR *op, int level)
EXPR_API void ev_AddFunction (EV_FUNCTION *func)
EXPR_API void ev_DeleteFunction (EV_FUNCTION *func)
EXPR_API void ev_SetOptimization (int level)
EXPR_API int ev_GetNFunctions ()
EXPR_API EV_FUNCTIONev_GetFunction (int i)
EXPR_API EV_TYPEDEFev_GetTypeDef (int key)
EXPR_API int ev_FindFunction (const char *name)
EXPR_API void ev_SetFunctionDependencyCallbacks (const char *func, EXPRopDependencyCallback depend_cb, EXPRopChangeRefCallback changeref_cb)
EXPR_API EV_EXPRESSIONev_AllocExpr (EV_InlineFuncReturnType rettype)
EXPR_API int ev_ChangeExpr (EV_EXPRESSION *expr, const char *source)
EXPR_API void ev_UnresolveVars (EV_EXPRESSION *expr, int thread)
EXPR_API float ev_EvaluateFloat (EV_EXPRESSION *expr, int thread)
EXPR_API void ev_EvaluateString (UT_String &result, EV_EXPRESSION *expr, int thread)
EXPR_API int ev_EvaluateVector (EV_EXPRESSION *expr, ev_Vector &result, int thread)
EXPR_API int ev_EvaluateMatrix (EV_EXPRESSION *expr, ev_Matrix &result, int thread)
EXPR_API void ev_FreeExpr (EV_EXPRESSION *expr)
EXPR_API void ev_UpdateOpDependency (EV_EXPRESSION *expr, void *ref_id, int thread)
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 EV_SYMBOLev_Evaluate (EV_EXPRESSION *expr, EV_InlineFuncReturnType func_ret_type, int thread)
EXPR_API bool ev_SaveCompiledCode (EV_EXPRESSION *expr, ostream &os, int thread)
EXPR_API bool ev_LoadCompiledCode (EV_EXPRESSION *expr, UT_IStream &is, int thread)
EXPR_API EV_SYMBOLev_AllocSymbol (int type, int thread)
EXPR_API void ev_FreeSymbol (EV_SYMBOL *symbol, int thread)
EXPR_API void ev_SetExpander (ev_Expander expander)
EXPR_API void ev_setSafeMode (bool safe_mode)
EXPR_API bool ev_isInSafeMode ()
EXPR_API bool ev_isKeyword (const char *string)
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_GetFunctionData (int thread)


Define Documentation

#define EV_EXFUNC_REF   0x40000000

Definition at line 84 of file EXPR.h.

#define EV_FLAGS_SET   0x10000000

Definition at line 82 of file EXPR.h.

#define EV_FOR_EXFUNC   0x80000000

Definition at line 85 of file EXPR.h.

#define EV_NHELPARGS   10

Definition at line 40 of file EXPR.h.

#define EV_OPTIMIZE0   0

Definition at line 35 of file EXPR.h.

#define EV_OPTIMIZE1   1

Definition at line 36 of file EXPR.h.

#define EV_SYMCONSTANT   0x08000000

Definition at line 81 of file EXPR.h.

#define EV_SYMEXPAND   0x20000000

Definition at line 83 of file EXPR.h.

#define EV_SYMTRANSIENT   0x04000000

Definition at line 80 of file EXPR.h.

#define EV_TYPE_CPPSYMBOL   45

Definition at line 111 of file EXPR.h.

#define EV_TYPE_DEFINE   12

Definition at line 109 of file EXPR.h.

#define EV_TYPE_GLOBAL_VAR   20

Definition at line 110 of file EXPR.h.

#define EV_TYPE_LOCAL_VAR   10

Definition at line 107 of file EXPR.h.

#define EV_TYPE_UNRESOLVED_CPPSYMBOL   46

Definition at line 112 of file EXPR.h.

#define EV_TYPE_UNRESOLVED_VAR   11

Definition at line 108 of file EXPR.h.

#define EV_TYPEEXPANDVAR   4

Definition at line 101 of file EXPR.h.

#define EV_TYPEFLOAT   0

Definition at line 98 of file EXPR.h.

#define EV_TYPEMATRIX   6

Definition at line 103 of file EXPR.h.

#define EV_TYPESTRING   1

Definition at line 99 of file EXPR.h.

#define EV_TYPEUNIXVAR   2

Definition at line 100 of file EXPR.h.

#define EV_TYPEVECTOR   5

Definition at line 102 of file EXPR.h.

#define EX_USERFLAGMASK   (0x03ffffff | EV_EXFUNC_REF)

Definition at line 87 of file EXPR.h.

#define MAX_OPERATOR_TOKEN   32

Definition at line 72 of file EXPR.h.

#define MAX_RECURSION   20

Definition at line 38 of file EXPR.h.

#define OP_AND   22

Definition at line 64 of file EXPR.h.

#define OP_AT   26

Definition at line 68 of file EXPR.h.

#define OP_BRACE   31

Definition at line 70 of file EXPR.h.

#define OP_COLON   21

Definition at line 63 of file EXPR.h.

#define OP_COMMA   16

Definition at line 61 of file EXPR.h.

#define OP_DIVIDE   4

Definition at line 49 of file EXPR.h.

#define OP_DOT   24

Definition at line 66 of file EXPR.h.

#define OP_EQ   8

Definition at line 53 of file EXPR.h.

#define OP_EQUATE   32

Definition at line 71 of file EXPR.h.

#define OP_GE   13

Definition at line 58 of file EXPR.h.

#define OP_GT   12

Definition at line 57 of file EXPR.h.

#define OP_LE   11

Definition at line 56 of file EXPR.h.

#define OP_LOGAND   14

Definition at line 59 of file EXPR.h.

#define OP_LOGOR   15

Definition at line 60 of file EXPR.h.

#define OP_LT   10

Definition at line 55 of file EXPR.h.

#define OP_MINUS   2

Definition at line 47 of file EXPR.h.

#define OP_MOD   6

Definition at line 51 of file EXPR.h.

#define OP_NE   9

Definition at line 54 of file EXPR.h.

#define OP_NOT   7

Definition at line 52 of file EXPR.h.

#define OP_OR   23

Definition at line 65 of file EXPR.h.

#define OP_PLUS   1

Definition at line 46 of file EXPR.h.

#define OP_POWER   5

Definition at line 50 of file EXPR.h.

#define OP_QUESTION   20

Definition at line 62 of file EXPR.h.

#define OP_SBRACKET   30

Definition at line 69 of file EXPR.h.

#define OP_TILDE   25

Definition at line 67 of file EXPR.h.

#define OP_TIMES   3

Definition at line 48 of file EXPR.h.


Typedef Documentation

typedef char*(* ev_Expander)(const char *str, int thread)

Definition at line 42 of file EXPR.h.

typedef struct EV_FUNCHELP EV_FUNCHELP

Definition at line 127 of file EXPR.h.

typedef struct EV_OPERATOR EV_OPERATOR

Definition at line 126 of file EXPR.h.

typedef struct EV_SYMTABLE EV_SYMTABLE

Definition at line 535 of file EXPR.h.

typedef struct EV_TYPEDEF EV_TYPEDEF

Definition at line 125 of file EXPR.h.

typedef void(* EXPRopChangeRefCallback)(EV_FUNCTION *me, EV_SYMBOL **args, char *new_args[], const char *new_fullpath, const char *old_fullpath, const char *old_cwd, const char *chan_name, const char *old_chan_name)

Definition at line 135 of file EXPR.h.

typedef void(* EXPRopDependencyCallback)(EV_FUNCTION *me, EV_SYMBOL **args, void *ref_id)

Definition at line 132 of file EXPR.h.


Enumeration Type Documentation

Enumerator:
EV_EXPR_RETURN_NONE 
EV_EXPR_RETURN_FLOAT 
EV_EXPR_RETURN_STRING 
EV_EXPR_RETURN_VECTOR 
EV_EXPR_RETURN_MATRIX 

Definition at line 279 of file EXPR.h.


Function Documentation

EXPR_API void ev_AddFunction ( EV_FUNCTION func  ) 

EXPR_API void ev_AddOperator ( EV_OPERATOR op,
int  level 
)

EXPR_API void ev_AddType ( EV_TYPEDEF type  ) 

EXPR_API void ev_AddVariableType ( EV_TYPEDEF type,
int  atEnd 
)

EXPR_API EV_EXPRESSION* ev_AllocExpr ( EV_InlineFuncReturnType  rettype  ) 

EXPR_API EV_SYMBOL* ev_AllocSymbol ( int  type,
int  thread 
)

EXPR_API int ev_ChangeExpr ( EV_EXPRESSION expr,
const char *  source 
)

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_DeleteFunction ( EV_FUNCTION func  ) 

EXPR_API void ev_DeleteVariableType ( EV_TYPEDEF type  ) 

EXPR_API EV_SYMBOL* ev_Evaluate ( EV_EXPRESSION expr,
EV_InlineFuncReturnType  func_ret_type,
int  thread 
)

EXPR_API float ev_EvaluateFloat ( EV_EXPRESSION expr,
int  thread 
)

EXPR_API int ev_EvaluateMatrix ( EV_EXPRESSION expr,
ev_Matrix result,
int  thread 
)

EXPR_API void ev_EvaluateString ( UT_String result,
EV_EXPRESSION expr,
int  thread 
)

EXPR_API int ev_EvaluateVector ( EV_EXPRESSION expr,
ev_Vector result,
int  thread 
)

EXPR_API int ev_FindFunction ( const char *  name  ) 

EXPR_API void ev_FreeExpr ( EV_EXPRESSION expr  ) 

EXPR_API void ev_FreeSymbol ( EV_SYMBOL symbol,
int  thread 
)

EXPR_API EV_FUNCTION* ev_GetFunction ( int  i  ) 

EXPR_API void* ev_GetFunctionData ( int  thread  ) 

From within an expression function, use this to retrieve the data created by the alloc function specified in ev_SetFunctionInstanceAllocator().

Parameters:
thread Thread id supplied to the expression function callback

EXPR_API int ev_GetNFunctions (  ) 

EXPR_API EV_TYPEDEF* ev_GetTypeDef ( int  key  ) 

EXPR_API void ev_InitFloat ( void   ) 

EXPR_API void ev_InitMatrix ( void   ) 

EXPR_API void ev_InitString ( void   ) 

EXPR_API void ev_InitUserFunc ( void   ) 

EXPR_API void ev_InitVariable ( void   ) 

EXPR_API void ev_InitVector ( void   ) 

EXPR_API bool ev_isInSafeMode (  ) 

EXPR_API bool ev_isKeyword ( const char *  string  ) 

EXPR_API bool ev_LoadCompiledCode ( EV_EXPRESSION expr,
UT_IStream is,
int  thread 
)

EXPR_API bool ev_SaveCompiledCode ( EV_EXPRESSION expr,
ostream &  os,
int  thread 
)

EXPR_API void ev_SetExpander ( ev_Expander  expander  ) 

EXPR_API void ev_SetFunctionDependencyCallbacks ( const char *  func,
EXPRopDependencyCallback  depend_cb,
EXPRopChangeRefCallback  changeref_cb 
)

Examples:
expr/functions.C.

EXPR_API void ev_SetFunctionInstanceAllocator ( const char *  function,
void *(*)()  alloc,
void(*)(void *)  free 
)

Functions for supplying state data for custom expressions.

This function specifies the constructor/destructor functions for the state data.

Parameters:
function Name of the custom expression function
alloc This allocates and initializes the state data
free This deallocates the state data

EXPR_API void ev_SetOptimization ( int  level  ) 

EXPR_API void ev_setSafeMode ( bool  safe_mode  ) 

EXPR_API void ev_UnresolveVars ( EV_EXPRESSION expr,
int  thread 
)

EXPR_API void ev_UpdateOpDependency ( EV_EXPRESSION expr,
void *  ref_id,
int  thread 
)


Generated on Mon May 21 00:09:38 2012 for HDK by  doxygen 1.5.9