From: WANG Date: Thu, 12 Sep 2013 08:20:00 +0000 (+0200) Subject: Bug fixed in preprocessor for new primitives. X-Git-Url: https://scm.cri.ensmp.fr/git/Faustine.git/commitdiff_plain/992d59159547267e1491fcd1c5123765b4c452b8?ds=sidebyside;hp=--cc Bug fixed in preprocessor for new primitives. New primitives tested in examples/primitives. --- 992d59159547267e1491fcd1c5123765b4c452b8 diff --git a/examples/primitives/primitives.dsp b/examples/primitives/primitives.dsp new file mode 100644 index 0000000..99a3e7a --- /dev/null +++ b/examples/primitives/primitives.dsp @@ -0,0 +1,3 @@ +import ("fft.lib"); + +process = 3.3 : vectorize(5) <: float, floor, ceil, rint, (_, (2 : vectorize(5)) <: ^, pow), (int : _, (2 : vectorize(5)) : - : _, (0 : vectorize(5)) <: &, |, xor), (_, (3 : vectorize(5)) <: >=, <=, ==, !=, >, <), (_, (3.3 : vectorize(5)) <: >=, <=, ==, !=, >, <), (_, (3 : vectorize(5)) : - <: acos, asin, tan, exp, log, log10, abs), (_, (2 : vectorize(5) : float) <: fmod, remainder) : nconcat(30) : serialize; diff --git a/examples/primitives/primitives.sh b/examples/primitives/primitives.sh new file mode 100644 index 0000000..ad607b1 --- /dev/null +++ b/examples/primitives/primitives.sh @@ -0,0 +1 @@ +faustine -d primitives.dsp -t 30 --oformat csv diff --git a/interpretor/basic.ml b/interpretor/basic.ml index 1295390..55f0fb5 100644 --- a/interpretor/basic.ml +++ b/interpretor/basic.ml @@ -369,11 +369,11 @@ let basic_xor = basic_logic xor;; let rec basic_adjust : (float -> float) -> basic -> basic = fun oper -> fun b -> match b with - |N i -> R (float_of_int i) - |R f -> R (floor f) + |N i -> R (oper (float_of_int i)) + |R f -> R (oper f) |Vec vec -> Vec (new vector vec#size (fun_unary (basic_adjust oper) vec#nth)) - |Zero -> R 0. + |Zero -> R (oper 0.) |Error -> Error;; let basic_floor = basic_adjust floor;; diff --git a/interpretor/lexer.mll b/interpretor/lexer.mll index 46ce90d..353712a 100644 --- a/interpretor/lexer.mll +++ b/interpretor/lexer.mll @@ -10,12 +10,11 @@ rule token = parse | "-" { IDENT Sub} | "*" { IDENT Mul} | "/" { IDENT Div} -| "^" { IDENT Power} | "_" { IDENT Pass} | "!" { IDENT Stop} | "&" { IDENT And} | "|" { IDENT Or} -| "xor" { IDENT Xor} +| "^" { IDENT Xor} | "mem" { IDENT Mem} | "@" { IDENT Delay} | "floor" { IDENT Floor} @@ -34,9 +33,9 @@ rule token = parse | "sqrt" { IDENT Sqrt} | "log" { IDENT Ln} | "logten" { IDENT Lg} -| "pow" { IDENT Power} +| "powf" { IDENT Power} | "abs" { IDENT Abs} -| "fmod" { IDENT Fmod} +| "fmodf" { IDENT Fmod} | "%" { IDENT Mod} | "remainder" { IDENT Remainder} | "vectorize" { IDENT Vectorize} diff --git a/interpretor/preprocessor/faust-0.9.47mr3/compiler/boxes/ppbox.cpp b/interpretor/preprocessor/faust-0.9.47mr3/compiler/boxes/ppbox.cpp index 10e6389..c54701b 100644 --- a/interpretor/preprocessor/faust-0.9.47mr3/compiler/boxes/ppbox.cpp +++ b/interpretor/preprocessor/faust-0.9.47mr3/compiler/boxes/ppbox.cpp @@ -56,13 +56,13 @@ const char * prim2name(CTree *(*ptr) (CTree *, CTree *)) if (ptr == sigOR ) return "|"; if (ptr == sigXOR) return "^"; - if (ptr == sigLeftShift ) return "<<"; - if (ptr == sigRightShift) return ">>"; + if (ptr == sigLeftShift ) return "<< "; + if (ptr == sigRightShift) return " >>"; if (ptr == sigLT) return "< "; if (ptr == sigLE) return "<="; if (ptr == sigGT) return " >"; - if (ptr == sigGE) return ">="; + if (ptr == sigGE) return " >="; if (ptr == sigEQ) return "=="; if (ptr == sigNE) return "!="; diff --git a/interpretor/preprocessor/faust-0.9.47mr3/compiler/extended/log10prim.cpp b/interpretor/preprocessor/faust-0.9.47mr3/compiler/extended/log10prim.cpp index f93cc93..e1c32df 100644 --- a/interpretor/preprocessor/faust-0.9.47mr3/compiler/extended/log10prim.cpp +++ b/interpretor/preprocessor/faust-0.9.47mr3/compiler/extended/log10prim.cpp @@ -10,7 +10,7 @@ class Log10Prim : public xtended public: - Log10Prim() : xtended("log10f") {} + Log10Prim() : xtended("logten") {} virtual unsigned int arity () { return 1; }