Max 5 API Reference
If you want to use C-like variable expressions that are entered by a user of your object, you can use the "guts" of Max’s expr object in your object. More...
![]() |
Data Structures | |
struct | Ex_ex |
ex_ex. More... | |
struct | t_expr |
Struct for an instance of expr. More... | |
Defines | |
#define | ex_int ex_cont.v_int |
shortcut for accessing members of an Ex_ex struct's ex_cont union. | |
#define | ex_flt ex_cont.v_flt |
shortcut for accessing members of an Ex_ex struct's ex_cont union. | |
#define | ex_op ex_cont.op |
shortcut for accessing members of an Ex_ex struct's ex_cont union. | |
#define | ex_ptr ex_cont.ptr |
shortcut for accessing members of an Ex_ex struct's ex_cont union. | |
Enumerations | |
enum | e_max_expr_types { ET_INT = 0x1, ET_FLT = 0x2, ET_OP = 0x3, ET_STR = 0x4, ET_TBL = 0x5, ET_FUNC = 0x6, ET_SYM = 0x7, ET_VSYM = 0x8, ET_LP = 0x9, ET_LB = 0x10, ET_II = 0x11, ET_FI = 0x12, ET_SI = 0x13 } |
Defines for ex_type. More... | |
Functions | |
void * | expr_new (short argc, t_atom *argv, t_atom *types) |
Create a new expr object. | |
short | expr_eval (t_expr *x, short argc, t_atom *argv, t_atom *result) |
Evaluate an expression in an expr object. |
If you want to use C-like variable expressions that are entered by a user of your object, you can use the "guts" of Max’s expr object in your object.
For example, the if object uses expr routines for evaluating a conditional expression, so it can decide whether to send the message after the words then or else. The following functions provide an interface to expr.
enum e_max_expr_types |
Defines for ex_type.
We treat parenthesis and brackets special to keep a pointer to their match in the content.
Definition at line 59 of file ext_expr.h.
Evaluate an expression in an expr object.
x | The expr object to evaluate. | |
argc | Count of arguments in argv. | |
argv | Array of nine Atoms that will be substituted for variable arguments (such as $i1) in the expression. Unused arguments should be of type A_NOTHING. | |
result | A pre-existing Atom that will hold the type and value of the result of evaluating the expression. |
Create a new expr object.
argc | Count of arguments in argv. | |
argv | Arguments that are used to create the expr. See the example below for details. | |
types | A pre-existing array of nine t_atoms, that will hold the types of any variable arguments created in the expr. The types are returned in the a_type field of each t_atom. If an argument was not present, A_NOTHING is returned. |
After calling expr_new, types would contain the following: