From: WANG Date: Tue, 17 Sep 2013 16:11:42 +0000 (+0200) Subject: Add "GUI not supported" primitives to Faustine. X-Git-Url: https://scm.cri.mines-paristech.fr/git/Faustine.git/commitdiff_plain/adf24ec25c76cc5eaa5aa319eaa2df1405312f9e?ds=sidebyside Add "GUI not supported" primitives to Faustine. Tested. --- diff --git a/interpreter/lexer.mll b/interpreter/lexer.mll index 353712a..48b3729 100644 --- a/interpreter/lexer.mll +++ b/interpreter/lexer.mll @@ -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 } diff --git a/interpreter/main.ml b/interpreter/main.ml index 21c2a8e..ff94e29 100644 --- a/interpreter/main.ml +++ b/interpreter/main.ml @@ -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 diff --git a/interpreter/preprocessor/faust-0.9.47mr3/compiler/boxes/ppbox.cpp b/interpreter/preprocessor/faust-0.9.47mr3/compiler/boxes/ppbox.cpp index c54701b..a44dcbf 100644 --- a/interpreter/preprocessor/faust-0.9.47mr3/compiler/boxes/ppbox.cpp +++ b/interpreter/preprocessor/faust-0.9.47mr3/compiler/boxes/ppbox.cpp @@ -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 << "()" ; } diff --git a/interpreter/process.ml b/interpreter/process.ml index ba13961..686adf3 100644 --- a/interpreter/process.ml +++ b/interpreter/process.ml @@ -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 = diff --git a/interpreter/symbol.ml b/interpreter/symbol.ml index 4d58697..f523823 100644 --- a/interpreter/symbol.ml +++ b/interpreter/symbol.ml @@ -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) -> diff --git a/interpreter/types.ml b/interpreter/types.ml index dd82e7c..7024eeb 100644 --- a/interpreter/types.ml +++ b/interpreter/types.ml @@ -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