|
Max API
8.2.0
|
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...
Collaboration diagram for Extending expr:Data Structures | |
| struct | t_ex_ex |
| ex_ex. More... | |
| struct | t_expr |
| Struct for an instance of expr. More... | |
Enumerations | |
| enum | e_max_expr_types { ET_INT , ET_FLT , ET_OP , ET_STR , ET_TBL , ET_FUNC , ET_SYM , ET_VSYM , ET_LP , ET_LB , ET_II , ET_FI , ET_SI } |
| Defines for ex_type. More... | |
Functions | |
| void * | expr_new (long argc, t_atom *argv, t_atom *types) |
| Create a new expr object. More... | |
| short | expr_eval (t_expr *x, long argc, t_atom *argv, t_atom *result) |
| Evaluate an expression in an expr object. More... | |
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.
Evaluate an expression in an expr object.
| x | The expr object to evaluate. |
| argc | Count of arguments in argv. |
| argv | Array of nine t_atom values 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 t_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: