]> CRI, Mines Paris - PSL - Faustine.git/commitdiff
Add "GUI not supported" primitives to Faustine.
authorWANG <wang@wang-OptiPlex-780.(none)>
Tue, 17 Sep 2013 16:11:42 +0000 (18:11 +0200)
committerWANG <wang@wang-OptiPlex-780.(none)>
Tue, 17 Sep 2013 16:11:42 +0000 (18:11 +0200)
Tested.

interpreter/lexer.mll
interpreter/main.ml
interpreter/preprocessor/faust-0.9.47mr3/compiler/boxes/ppbox.cpp
interpreter/process.ml
interpreter/symbol.ml
interpreter/types.ml

index 353712aa7d26a0a486e3a0e6fd1ce77907d5df6b..48b37298682ba1b919b25e5d38e0be2a886738cc 100644 (file)
@@ -57,6 +57,17 @@ rule token = parse
 | "selectthree"                         { IDENT Select3}  
 | "rdtable"                             { IDENT Rdtable}
 | "rwtable"                            { IDENT Rwtable}
+| "button"                             { IDENT Button}
+| "checkbox"                           { IDENT Checkbox}
+| "vslider"                            { IDENT Vslider}
+| "hslider"                            { IDENT Hslider}
+| "vgroup"                             { IDENT Vgroup}
+| "hgroup"                             { IDENT Hgroup}
+| "tgroup"                             { IDENT Tgroup}
+| "hbargraph"                          { IDENT Hbargraph}
+| "vbargraph"                          { IDENT Vbargraph}
+| "nentry"                             { IDENT Nentry}
+| "attach"                             { IDENT Attach}
 
 | ['0'-'9']+ as a                      { CONST a }
 | '.'                                   { POINT }
index 21c2a8e9fa30f62d4c4e6feb879865645f29cb36..ff94e29f433832cb297b407ca802a3b42bc49547 100644 (file)
@@ -83,14 +83,14 @@ let main () =
        let () = print_endline(" Done. (duration: " ^ (string_of_float (toc2 -. tic2)) ^ "s.)") in
 
 
-       let () = print_string("    Faustine -> Evaluating...") in
+       let () = print_string("    Faustine -> Constructing signals...") in
        let tic3 = Sys.time () in
        let output = proc#eval input in
        let toc3 = Sys.time () in
        let () = print_endline(" Done. (duration: " ^ (string_of_float (toc3 -. tic3)) ^ "s.)") in
 
 
-       let () = print_string("    Faustine -> Calculating...") in
+       let () = print_string("    Faustine -> Evaluating...") in
        let tic4 = Sys.time () in
        let data = output#output !time_max in
        let rates = output#frequency in
index c54701b27030fc73be6053d0165694c74750aa5c..a44dcbf88d4109105f9520ee686ccff3444f8569 100644 (file)
@@ -185,6 +185,7 @@ ostream& boxpp::print (ostream& fout) const
        else if (isBoxISum(box, t1, t2, t3))    fout << "sum(" << boxpp(t1) << ", " << boxpp(t2) << ") {" << boxpp(t3) << "}";
        else if (isBoxIProd(box, t1, t2, t3))   fout << "prod(" << boxpp(t1) << ", " << boxpp(t2) << ") {" << boxpp(t3) << "}";
 
+/* 
        // user interface
        else if (isBoxButton(box, label))       fout << "button(" << tree2str(label) << ')';
        else if (isBoxCheckbox(box, label))     fout << "checkbox(" << tree2str(label) << ')';
@@ -233,6 +234,37 @@ ostream& boxpp::print (ostream& fout) const
                         << boxpp(max) << ", "
                         << boxpp(step)<< ')';
        }
+*/
+
+       // user interface   -----------   Edited by Haisheng WANG for Faustine, 16/09/2013.
+       else if (isBoxButton(box, label))       fout << "button";
+       else if (isBoxCheckbox(box, label))     fout << "checkbox";
+       else if (isBoxVSlider(box, label, cur, min, max, step))         {
+               fout << "vslider";
+       }
+       else if (isBoxHSlider(box, label, cur, min, max, step))         {
+               fout << "hslider";
+       }
+       else if (isBoxVGroup(box, label, t1)) {
+               fout << "vgroup";
+       }
+       else if (isBoxHGroup(box, label, t1)) {
+               fout << "hgroup";
+       }
+       else if (isBoxTGroup(box, label, t1)) {
+               fout << "tgroup";
+       }
+       else if (isBoxHBargraph(box, label, min, max))  {
+               fout << "hbargraph";
+       }
+       else if (isBoxVBargraph(box, label, min, max))  {
+               fout << "vbargraph";
+       }
+       else if (isBoxNumEntry(box, label, cur, min, max, step))        {
+               fout << "nentry";
+       }
+       // end user interface
+
        else if (isNil(box)) {
                fout << "()" ;
        }
index ba139614a3fb1152d4968beeb6ed13e21e000128..686adf3c1ff4420dd820e904f0f72103b95bd57a 100644 (file)
@@ -223,6 +223,10 @@ class proc_ident : faust_exp -> process_type =
          | Rwtable -> self#beam_of_ident n 
                ((input#get.(0))#rwtable input#get.(1) 
                   input#get.(2) input#get.(3) input#get.(4))
+         | other -> 
+             let err_message = "GUI not supported: " 
+               ^ (string_of_symbol other) ^ "." in
+             raise (Process_error err_message)
       end;;
 
 class virtual process_binary =
index 4d586971e1ec37b9f85de53c32a4744520e34d01..f5238236c12d224e6fb41abdfb1e48e9be5a3216 100644 (file)
@@ -68,7 +68,18 @@ let dictionary_of_symbol : symbol -> (int * int) * int * string =
     |Select2    ->  ((3, 1), 0, "Select2")
     |Select3     ->  ((4, 1), 0, "Select3")
     |Rdtable    ->  ((3, 1), rdtable_memory_length, "Rdtalbe")
-    |Rwtable    ->  ((5, 1), rwtable_memory_length, "Rwtable");;
+    |Rwtable    ->  ((5, 1), rwtable_memory_length, "Rwtable")
+    |Button      ->  ((0, 1), 0, "Button")
+    |Checkbox    ->  ((0, 1), 0, "Checkbox")
+    |Vslider     ->  ((0, 1), 0, "Vslider")
+    |Hslider     ->  ((0, 1), 0, "Hslider")
+    |Vgroup      ->  ((0, 1), 0, "Vgroup")
+    |Hgroup      ->  ((0, 1), 0, "Hgroup")
+    |Tgroup      ->  ((0, 1), 0, "Tgroup")
+    |Hbargraph   ->  ((0, 1), 0, "Hbargraph")
+    |Vbargraph   ->  ((0, 1), 0, "Vbargraph")
+    |Nentry      ->  ((0, 1), 0, "Nentry")
+    |Attach      ->  ((2, 1), 0, "Attach") ;;
 
 let dimension_of_symbol : symbol -> int * int =
   fun (s : symbol) ->
index dd82e7c86f8a711107018e2e0f05f4086a3fcd44..7024eeb9d13a05364e9a68632c039037e02b5e2b 100644 (file)
@@ -120,6 +120,17 @@ type symbol = Add
            | Select3
            | Rdtable
            | Rwtable
+           | Button
+           | Checkbox
+           | Vslider
+           | Hslider
+           | Vgroup
+           | Hgroup
+           | Tgroup
+           | Hbargraph
+           | Vbargraph
+           | Nentry
+           | Attach
 
 type faust_exp =
          Const of basic