Update of /cvsroot/pure-data/pd/extra/expr~ In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10939/pd/extra/expr~
Modified Files: fts_to_pd.h makefile vexp.c vexp.h vexp_fun.c vexp_if.c Log Message: 0.38 test 9 (mostly bug fixes)
Index: vexp.c =================================================================== RCS file: /cvsroot/pure-data/pd/extra/expr~/vexp.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** vexp.c 6 Sep 2004 20:20:27 -0000 1.4 --- vexp.c 6 Nov 2004 16:07:22 -0000 1.5 *************** *** 29,42 ****
/* ! * Feb 2002 - added access to variables ! * multiple expression support ! * new short hand forms for fexpr~ ! * now $y or $y1 = $y1[-1] and $y2 = $y2[-1] ! * --sdy * * July 2002 ! * fixed bugs introduced in last changes in store and ET_EQ [...3834 lines suppressed...] ! post("%s", "||"); ! break; ! case OP_COMMA: ! post("%c", ','); ! break; ! case OP_SEMI: ! post("%c", ';'); ! break; ! default: ! post("expr: ex_print: bad op 0x%lx\n", eptr->ex_op); ! } ! break; ! default: ! post("expr: ex_print: bad type 0x%lx\n", eptr->ex_type); ! } ! eptr++; ! } ! post("\n"); }
Index: vexp_fun.c =================================================================== RCS file: /cvsroot/pure-data/pd/extra/expr~/vexp_fun.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** vexp_fun.c 23 Sep 2003 00:18:13 -0000 1.3 --- vexp_fun.c 6 Nov 2004 16:07:23 -0000 1.4 *************** *** 28,61 **** * * Nov. 2001 --sdy ! * conversion for expr~ * * Jan, 2002 --sdy ! * added fmod() * * May 2002 ! * added floor and ceil for expr -- Orm Finnendahl * [...2171 lines suppressed...] ! return (xx); } FUNC_DEF_UNARY(ex_imodf, imodf, (double), 1); *************** *** 1229,1235 **** fracmodf(double x) { ! double xx;
! return(modf(x, &xx)); } FUNC_DEF_UNARY(ex_modf, fracmodf, (double), 1); --- 1229,1235 ---- fracmodf(double x) { ! double xx;
! return(modf(x, &xx)); } FUNC_DEF_UNARY(ex_modf, fracmodf, (double), 1);
Index: fts_to_pd.h =================================================================== RCS file: /cvsroot/pure-data/pd/extra/expr~/fts_to_pd.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** fts_to_pd.h 8 Aug 2002 16:42:32 -0000 1.2 --- fts_to_pd.h 6 Nov 2004 16:07:22 -0000 1.3 *************** *** 15,26 ****
#ifdef MSP ! #define t_atom Atom ! #define t_symbol Symbol ! #define pd_new(x) newobject(x); ! #define pd_free(x) freeobject(x); ! #define t_outlet void ! #define t_binbuf void ! typedef t_class *t_pd; ! typedef float t_floatarg;
#include <stdlib.h> --- 15,26 ----
#ifdef MSP ! #define t_atom Atom ! #define t_symbol Symbol ! #define pd_new(x) newobject(x); ! #define pd_free(x) freeobject(x); ! #define t_outlet void ! #define t_binbuf void ! typedef t_class *t_pd; ! typedef float t_floatarg;
#include <stdlib.h>
Index: vexp_if.c =================================================================== RCS file: /cvsroot/pure-data/pd/extra/expr~/vexp_if.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** vexp_if.c 6 Sep 2004 20:20:27 -0000 1.4 --- vexp_if.c 6 Nov 2004 16:07:23 -0000 1.5 *************** *** 31,36 **** * Feb 2002 - added access to variables * multiple expression support ! * new short hand forms for fexpr~ ! * now $y or $y1 = $y1[-1] and $y2 = $y2[-1] * --sdy */ --- 31,36 ---- * Feb 2002 - added access to variables * multiple expression support ! * new short hand forms for fexpr~ [...2162 lines suppressed...] ! optr->ex_int = 0; ! }
! fts_integer_vector_set_element(tw, argv->ex_int < 0 ? 0 : argv->ex_int % fts_integer_vector_get_size(tw), argv[1].ex_int); ! *optr = argv[1]; #endif } *************** *** 1210,1214 **** vsprintf(error_string, fmt, ap); */ post(fmt, ap); ! va_end(ap); /* SDY fprintf(stderr, "error: %s\n", error_string); --- 1210,1214 ---- vsprintf(error_string, fmt, ap); */ post(fmt, ap); ! va_end(ap); /* SDY fprintf(stderr, "error: %s\n", error_string);
Index: makefile =================================================================== RCS file: /cvsroot/pure-data/pd/extra/expr~/makefile,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** makefile 6 Sep 2004 20:20:27 -0000 1.6 --- makefile 6 Nov 2004 16:07:22 -0000 1.7 *************** *** 82,86 **** LINUXCFLAGS = -DPD -O2 -funroll-loops -fomit-frame-pointer -fPIC \ -Wall -W -Wshadow -Wstrict-prototypes \ ! -Wno-unused -Wno-parentheses -Wno-switch $(CFLAGS)
LINUXINCLUDE = -I../../src --- 82,86 ---- LINUXCFLAGS = -DPD -O2 -funroll-loops -fomit-frame-pointer -fPIC \ -Wall -W -Wshadow -Wstrict-prototypes \ ! -Wno-unused -Wno-parentheses -Wno-switch
LINUXINCLUDE = -I../../src
Index: vexp.h =================================================================== RCS file: /cvsroot/pure-data/pd/extra/expr~/vexp.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** vexp.h 23 Sep 2003 00:18:13 -0000 1.3 --- vexp.h 6 Nov 2004 16:07:23 -0000 1.4 *************** *** 44,50 ****
#ifdef MSP ! #define t_atom Atom ! #define t_symbol Symbol ! #define pd_new(x) newobject(x); #define t_outlet void #endif --- 44,50 ----
#ifdef MSP ! #define t_atom Atom ! #define t_symbol Symbol ! #define pd_new(x) newobject(x); #define t_outlet void #endif *************** *** 56,61 **** */
! #define MAX_VARS 9 ! #define MINODES 10 /* was 200 */
/* terminal defines */ --- 56,61 ---- */
! #define MAX_VARS 9 ! #define MINODES 10 /* was 200 */
/* terminal defines */ *************** *** 68,221 **** */
! #define OP_SEMI ((long)(1<<16|1)) /* ; */ ! #define OP_COMMA ((long)(2<<16|2)) /* , */ ! #define OP_LOR ((long)(3<<16|3)) /* || */ ! #define OP_LAND ((long)(4<<16|4)) /* && */ ! #define OP_OR ((long)(5<<16|5)) /* | */ ! #define OP_XOR ((long)(6<<16|6)) /* ^ */ ! #define OP_AND ((long)(7<<16|7)) /* & */ ! #define OP_NE ((long)(8<<16|8)) /* != */ ! #define OP_EQ ((long)(8<<16|9)) /* == */ ! #define OP_GE ((long)(9<<16|10)) /* >= */ ! #define OP_GT ((long)(9<<16|11)) /* > */ ! #define OP_LE ((long)(9<<16|12)) /* <= */ ! #define OP_LT ((long)(9<<16|13)) /* < */ ! #define OP_SR ((long)(10<<16|14)) /* >> */ ! #define OP_SL ((long)(10<<16|15)) /* << */ ! #define OP_SUB ((long)(11<<16|16)) /* - */ ! #define OP_ADD ((long)(11<<16|17)) /* + */ ! #define OP_MOD ((long)(12<<16|18)) /* % */ ! #define OP_DIV ((long)(12<<16|19)) /* / */ ! #define OP_MUL ((long)(12<<16|20)) /* * */ ! #define OP_UMINUS ((long)(13<<16|21)) /* - unary minus */ ! #define OP_NEG ((long)(13<<16|22)) /* ~ one complement */ ! #define OP_NOT ((long)(13<<16|23)) /* ! */ ! #define OP_RB ((long)(14<<16|24)) /* ] */ ! #define OP_LB ((long)(14<<16|25)) /* [ */ ! #define OP_RP ((long)(14<<16|26)) /* ) */ ! #define OP_LP ((long)(14<<16|27)) /* ( */ ! #define OP_STORE ((long)(15<<16|28)) /* = */ ! #define HI_PRE ((long)(100<<16)) /* infinite precedence */ ! #define PRE_MASK ((long)0xffff0000) /* precedence level mask */
struct ex_ex;
! #define name_ok(c) (((c)=='_') || ((c)>='a' && (c)<='z') || \ ! ((c)>='A' && (c)<='Z') || ((c) >= '0' && (c) <= '9')) ! #define unary_op(x) ((x) == OP_NOT || (x) == OP_NEG || (x) == OP_UMINUS)
struct ex_ex { ! union { ! long v_int; ! float v_flt; ! t_float *v_vec; /* this is an for allocated vector */ ! long op; ! char *ptr; ! } ex_cont; /* content */ ! #define ex_int ex_cont.v_int ! #define ex_flt ex_cont.v_flt ! #define ex_vec ex_cont.v_vec ! #define ex_op ex_cont.op ! #define ex_ptr ex_cont.ptr ! long ex_type; /* type of the node */ }; ! #define exNULL ((struct ex_ex *)0)
/* defines for ex_type */ ! #define ET_INT 1 /* an int */ ! #define ET_FLT 2 /* a float */ ! #define ET_OP 3 /* operator */ ! #define ET_STR 4 /* string */ ! #define ET_TBL 5 /* a table, the content is a pointer */ ! #define ET_FUNC 6 /* a function */ ! #define ET_SYM 7 /* symbol ("string") */ ! #define ET_VSYM 8 /* variable symbol ("$s?") */ ! /* we treat parenthesis and brackets */ ! /* special to keep a pointer to their */ ! /* match in the content */ ! #define ET_LP 9 /* left parenthesis */ ! #define ET_LB 10 /* left bracket */ ! #define ET_II 11 /* and integer inlet */ ! #define ET_FI 12 /* float inlet */ ! #define ET_SI 13 /* string inlet */ ! #define ET_VI 14 /* signal inlet */ ! #define ET_VEC 15 /* allocated signal vector */ ! /* special types for fexpr~ */ ! #define ET_YO 16 /* vector output for fexpr~ */ ! #define ET_YOM1 17 /* shorthand for $y?[-1] */ ! #define ET_XI 18 /* vector input for fexpr~ */ ! #define ET_XI0 20 /* shorthand for $x?[0] */ ! #define ET_VAR 21 /* variable */
/* defines for ex_flags */ ! #define EF_TYPE_MASK 0x07 /* first three bits define the type of expr */ ! #define EF_EXPR 0x01 /* expr - control in and out */ ! #define EF_EXPR_TILDE 0x02 /* expr~ signal and control in, signal out */ ! #define EF_FEXPR_TILDE 0x04 /* fexpr~ filter expression */
! #define EF_STOP 0x08 /* is it stopped used for expr~ and fexpr~ */ ! #define EF_VERBOSE 0x10 /* verbose mode */
! #define IS_EXPR(x) ((((x)->exp_flags&EF_TYPE_MASK)|EF_EXPR) == EF_EXPR) ! #define IS_EXPR_TILDE(x) \ ((((x)->exp_flags&EF_TYPE_MASK)|EF_EXPR_TILDE)==EF_EXPR_TILDE) ! #define IS_FEXPR_TILDE(x) \ ((((x)->exp_flags&EF_TYPE_MASK)|EF_FEXPR_TILDE)==EF_FEXPR_TILDE)
! #define SET_EXPR(x) (x)->exp_flags |= EF_EXPR; \ ! (x)->exp_flags &= ~EF_EXPR_TILDE; \ ! (x)->exp_flags &= ~EF_FEXPR_TILDE;
! #define SET_EXPR_TILDE(x) (x)->exp_flags &= ~EF_EXPR; \ ! (x)->exp_flags |= EF_EXPR_TILDE; \ ! (x)->exp_flags &= ~EF_FEXPR_TILDE;
! #define SET_FEXPR_TILDE(x) (x)->exp_flags &= ~EF_EXPR; \ ! (x)->exp_flags &= ~EF_EXPR_TILDE; \ ! (x)->exp_flags |= EF_FEXPR_TILDE;
/* * defines for expr_error */ ! #define EE_DZ 0x01 /* divide by zero error */ ! #define EE_BI_OUTPUT 0x02 /* Bad output index */ ! #define EE_BI_INPUT 0x04 /* Bad input index */ ! #define EE_NOTABLE 0x08 /* NO TABLE */ ! #define EE_NOVAR 0x10 /* NO VARIABLE */
typedef struct expr { #ifdef PD ! t_object exp_ob; #else /* MSP */ ! t_pxobject exp_ob; #endif ! int exp_flags; /* are we expr~, fexpr~, or expr */ ! int exp_error; /* reported errors */ ! int exp_nexpr; /* number of expressions */ ! char *exp_string; /* the full expression string */ ! char *exp_str; /* current parsing position */ ! t_outlet *exp_outlet[MAX_VARS]; #ifdef PD ! struct _exprproxy *exp_proxy; #else /* MAX */ ! void *exp_proxy[MAX_VARS]; ! long exp_proxy_id; #endif ! struct ex_ex *exp_stack[MAX_VARS]; ! struct ex_ex exp_var[MAX_VARS]; ! struct ex_ex exp_res[MAX_VARS]; /* the evluation result */ ! t_float *exp_p_var[MAX_VARS]; ! t_float *exp_p_res[MAX_VARS]; /* the previous evaluation result */ ! t_float *exp_tmpres[MAX_VARS]; /* temporty result for fexpr~ */ ! int exp_vsize; /* the size of the signal vector */ ! int exp_nivec; /* # of vector inlets */ ! float exp_f; /* control value to be transformed to signal */ } t_expr;
typedef struct ex_funcs { ! char *f_name; /* function name */ ! void (*f_func)(t_expr *, long, struct ex_ex *, struct ex_ex *); ! /* the real function performing the function (void, no return!!!) */ ! long f_argc; /* number of arguments */ } t_ex_func;
--- 68,221 ---- */
! #define OP_SEMI ((long)(1<<16|1)) /* ; */ ! #define OP_COMMA ((long)(2<<16|2)) /* , */ ! #define OP_LOR ((long)(3<<16|3)) /* || */ ! #define OP_LAND ((long)(4<<16|4)) /* && */ ! #define OP_OR ((long)(5<<16|5)) /* | */ ! #define OP_XOR ((long)(6<<16|6)) /* ^ */ ! #define OP_AND ((long)(7<<16|7)) /* & */ ! #define OP_NE ((long)(8<<16|8)) /* != */ ! #define OP_EQ ((long)(8<<16|9)) /* == */ ! #define OP_GE ((long)(9<<16|10)) /* >= */ ! #define OP_GT ((long)(9<<16|11)) /* > */ ! #define OP_LE ((long)(9<<16|12)) /* <= */ ! #define OP_LT ((long)(9<<16|13)) /* < */ ! #define OP_SR ((long)(10<<16|14)) /* >> */ ! #define OP_SL ((long)(10<<16|15)) /* << */ ! #define OP_SUB ((long)(11<<16|16)) /* - */ ! #define OP_ADD ((long)(11<<16|17)) /* + */ ! #define OP_MOD ((long)(12<<16|18)) /* % */ ! #define OP_DIV ((long)(12<<16|19)) /* / */ ! #define OP_MUL ((long)(12<<16|20)) /* * */ ! #define OP_UMINUS ((long)(13<<16|21)) /* - unary minus */ ! #define OP_NEG ((long)(13<<16|22)) /* ~ one complement */ ! #define OP_NOT ((long)(13<<16|23)) /* ! */ ! #define OP_RB ((long)(14<<16|24)) /* ] */ ! #define OP_LB ((long)(14<<16|25)) /* [ */ ! #define OP_RP ((long)(14<<16|26)) /* ) */ ! #define OP_LP ((long)(14<<16|27)) /* ( */ ! #define OP_STORE ((long)(15<<16|28)) /* = */ ! #define HI_PRE ((long)(100<<16)) /* infinite precedence */ ! #define PRE_MASK ((long)0xffff0000) /* precedence level mask */
struct ex_ex;
! #define name_ok(c) (((c)=='_') || ((c)>='a' && (c)<='z') || \ ! ((c)>='A' && (c)<='Z') || ((c) >= '0' && (c) <= '9')) ! #define unary_op(x) ((x) == OP_NOT || (x) == OP_NEG || (x) == OP_UMINUS)
struct ex_ex { ! union { ! long v_int; ! float v_flt; ! t_float *v_vec; /* this is an for allocated vector */ ! long op; ! char *ptr; ! } ex_cont; /* content */ ! #define ex_int ex_cont.v_int ! #define ex_flt ex_cont.v_flt ! #define ex_vec ex_cont.v_vec ! #define ex_op ex_cont.op ! #define ex_ptr ex_cont.ptr ! long ex_type; /* type of the node */ }; ! #define exNULL ((struct ex_ex *)0)
/* defines for ex_type */ ! #define ET_INT 1 /* an int */ ! #define ET_FLT 2 /* a float */ ! #define ET_OP 3 /* operator */ ! #define ET_STR 4 /* string */ ! #define ET_TBL 5 /* a table, the content is a pointer */ ! #define ET_FUNC 6 /* a function */ ! #define ET_SYM 7 /* symbol ("string") */ ! #define ET_VSYM 8 /* variable symbol ("$s?") */ ! /* we treat parenthesis and brackets */ ! /* special to keep a pointer to their */ ! /* match in the content */ ! #define ET_LP 9 /* left parenthesis */ ! #define ET_LB 10 /* left bracket */ ! #define ET_II 11 /* and integer inlet */ ! #define ET_FI 12 /* float inlet */ ! #define ET_SI 13 /* string inlet */ ! #define ET_VI 14 /* signal inlet */ ! #define ET_VEC 15 /* allocated signal vector */ ! /* special types for fexpr~ */ ! #define ET_YO 16 /* vector output for fexpr~ */ ! #define ET_YOM1 17 /* shorthand for $y?[-1] */ ! #define ET_XI 18 /* vector input for fexpr~ */ ! #define ET_XI0 20 /* shorthand for $x?[0] */ ! #define ET_VAR 21 /* variable */
/* defines for ex_flags */ ! #define EF_TYPE_MASK 0x07 /* first three bits define the type of expr */ ! #define EF_EXPR 0x01 /* expr - control in and out */ ! #define EF_EXPR_TILDE 0x02 /* expr~ signal and control in, signal out */ ! #define EF_FEXPR_TILDE 0x04 /* fexpr~ filter expression */
! #define EF_STOP 0x08 /* is it stopped used for expr~ and fexpr~ */ ! #define EF_VERBOSE 0x10 /* verbose mode */
! #define IS_EXPR(x) ((((x)->exp_flags&EF_TYPE_MASK)|EF_EXPR) == EF_EXPR) ! #define IS_EXPR_TILDE(x) \ ((((x)->exp_flags&EF_TYPE_MASK)|EF_EXPR_TILDE)==EF_EXPR_TILDE) ! #define IS_FEXPR_TILDE(x) \ ((((x)->exp_flags&EF_TYPE_MASK)|EF_FEXPR_TILDE)==EF_FEXPR_TILDE)
! #define SET_EXPR(x) (x)->exp_flags |= EF_EXPR; \ ! (x)->exp_flags &= ~EF_EXPR_TILDE; \ ! (x)->exp_flags &= ~EF_FEXPR_TILDE;
! #define SET_EXPR_TILDE(x) (x)->exp_flags &= ~EF_EXPR; \ ! (x)->exp_flags |= EF_EXPR_TILDE; \ ! (x)->exp_flags &= ~EF_FEXPR_TILDE;
! #define SET_FEXPR_TILDE(x) (x)->exp_flags &= ~EF_EXPR; \ ! (x)->exp_flags &= ~EF_EXPR_TILDE; \ ! (x)->exp_flags |= EF_FEXPR_TILDE;
/* * defines for expr_error */ ! #define EE_DZ 0x01 /* divide by zero error */ ! #define EE_BI_OUTPUT 0x02 /* Bad output index */ ! #define EE_BI_INPUT 0x04 /* Bad input index */ ! #define EE_NOTABLE 0x08 /* NO TABLE */ ! #define EE_NOVAR 0x10 /* NO VARIABLE */
typedef struct expr { #ifdef PD ! t_object exp_ob; #else /* MSP */ ! t_pxobject exp_ob; #endif ! int exp_flags; /* are we expr~, fexpr~, or expr */ ! int exp_error; /* reported errors */ ! int exp_nexpr; /* number of expressions */ ! char *exp_string; /* the full expression string */ ! char *exp_str; /* current parsing position */ ! t_outlet *exp_outlet[MAX_VARS]; #ifdef PD ! struct _exprproxy *exp_proxy; #else /* MAX */ ! void *exp_proxy[MAX_VARS]; ! long exp_proxy_id; #endif ! struct ex_ex *exp_stack[MAX_VARS]; ! struct ex_ex exp_var[MAX_VARS]; ! struct ex_ex exp_res[MAX_VARS]; /* the evluation result */ ! t_float *exp_p_var[MAX_VARS]; ! t_float *exp_p_res[MAX_VARS]; /* the previous evaluation result */ ! t_float *exp_tmpres[MAX_VARS]; /* temporty result for fexpr~ */ ! int exp_vsize; /* the size of the signal vector */ ! int exp_nivec; /* # of vector inlets */ ! float exp_f; /* control value to be transformed to signal */ } t_expr;
typedef struct ex_funcs { ! char *f_name; /* function name */ ! void (*f_func)(t_expr *, long, struct ex_ex *, struct ex_ex *); ! /* the real function performing the function (void, no return!!!) */ ! long f_argc; /* number of arguments */ } t_ex_func;
*************** *** 228,237 **** void ex_mkvector(t_float *fp, t_float x, int size); extern void ex_size(t_expr *expr, long int argc, struct ex_ex *argv, ! struct ex_ex *optr); ! extern void ex_sum(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr); ! extern void ex_Sum(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr); ! extern void ex_avg(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr); ! extern void ex_Avg(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr); ! extern void ex_store(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
int value_getonly(t_symbol *s, t_float *f); --- 228,237 ---- void ex_mkvector(t_float *fp, t_float x, int size); extern void ex_size(t_expr *expr, long int argc, struct ex_ex *argv, ! struct ex_ex *optr); ! extern void ex_sum(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr); ! extern void ex_Sum(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr); ! extern void ex_avg(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr); ! extern void ex_Avg(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr); ! extern void ex_store(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
int value_getonly(t_symbol *s, t_float *f);