Bug fixed in preprocessor for new primitives.
authorWANG <wang@wang-OptiPlex-780.(none)>
Thu, 12 Sep 2013 08:20:00 +0000 (10:20 +0200)
committerWANG <wang@wang-OptiPlex-780.(none)>
Thu, 12 Sep 2013 08:20:00 +0000 (10:20 +0200)
New primitives tested in examples/primitives.

examples/primitives/primitives.dsp [new file with mode: 0644]
examples/primitives/primitives.sh [new file with mode: 0644]
interpretor/basic.ml
interpretor/lexer.mll
interpretor/preprocessor/faust-0.9.47mr3/compiler/boxes/ppbox.cpp
interpretor/preprocessor/faust-0.9.47mr3/compiler/extended/log10prim.cpp

diff --git a/examples/primitives/primitives.dsp b/examples/primitives/primitives.dsp
new file mode 100644 (file)
index 0000000..99a3e7a
--- /dev/null
@@ -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 (file)
index 0000000..ad607b1
--- /dev/null
@@ -0,0 +1 @@
+faustine -d primitives.dsp -t 30 --oformat csv
index 1295390..55f0fb5 100644 (file)
@@ -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
 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))
     |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;;
     |Error -> Error;;
 
 let basic_floor = basic_adjust floor;;
index 46ce90d..353712a 100644 (file)
@@ -10,12 +10,11 @@ rule token = parse
 | "-"                                   { IDENT Sub}
 | "*"                                   { IDENT Mul}
 | "/"                                   { IDENT Div}
 | "-"                                   { IDENT Sub}
 | "*"                                   { IDENT Mul}
 | "/"                                   { IDENT Div}
-| "^"                                  { IDENT Power}
 | "_"                                   { IDENT Pass}
 | "!"                                   { IDENT Stop}
 | "&"                                  { IDENT And}
 | "|"                                  { IDENT Or}
 | "_"                                   { IDENT Pass}
 | "!"                                   { IDENT Stop}
 | "&"                                  { IDENT And}
 | "|"                                  { IDENT Or}
-| "xor"                                        { IDENT Xor}
+| "^"                                  { IDENT Xor}
 | "mem"                                 { IDENT Mem}
 | "@"                                   { IDENT Delay}
 | "floor"                               { IDENT Floor}
 | "mem"                                 { IDENT Mem}
 | "@"                                   { IDENT Delay}
 | "floor"                               { IDENT Floor}
@@ -34,9 +33,9 @@ rule token = parse
 | "sqrt"                                { IDENT Sqrt}
 | "log"                                        { IDENT Ln}
 | "logten"                             { IDENT Lg}
 | "sqrt"                                { IDENT Sqrt}
 | "log"                                        { IDENT Ln}
 | "logten"                             { IDENT Lg}
-| "pow"                                        { IDENT Power}
+| "powf"                               { IDENT Power}
 | "abs"                                        { IDENT Abs}
 | "abs"                                        { IDENT Abs}
-| "fmod                              { IDENT Fmod}
+| "fmodf"                              { IDENT Fmod}
 | "%"                                   { IDENT Mod}
 | "remainder"                          { IDENT Remainder}
 | "vectorize"                           { IDENT Vectorize}
 | "%"                                   { IDENT Mod}
 | "remainder"                          { IDENT Remainder}
 | "vectorize"                           { IDENT Vectorize}
index 10e6389..c54701b 100644 (file)
@@ -56,13 +56,13 @@ const char * prim2name(CTree *(*ptr) (CTree *, CTree *))
        if (ptr == sigOR ) return "|";
        if (ptr == sigXOR) return "^";
 
        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 == 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 "!=";
 
        if (ptr == sigEQ) return "==";
        if (ptr == sigNE) return "!=";
 
index f93cc93..e1c32df 100644 (file)
@@ -10,7 +10,7 @@ class Log10Prim : public xtended
 
  public:
  
 
  public:
  
-       Log10Prim() : xtended("log10f") {}
+       Log10Prim() : xtended("logten") {}
        
        virtual unsigned int arity () { return 1; }
        
        
        virtual unsigned int arity () { return 1; }