MRFausti -> Faustine in Makefile.in.
[Faustine.git] / interpretor / symbol.ml
1 (**
2 Module: Symbol
3 Description: Symbols' information in faust.
4 @author WANG Haisheng
5 Created: 05/08/2013 Modified: 05/08/2013
6 *)
7
8 open Types;;
9
10 exception Symbol_error of string;;
11
12 (* MACRO *)
13 let delay_memory_length = 100000;;
14 let rdtable_memory_length = 100000;;
15 let vectorize_memory_length = 1000;;
16
17 let dimension_of_symbol : symbol -> int * int =
18 fun (s : symbol) ->
19 match s with
20 |Add -> (2, 1)
21 |Sub -> (2, 1)
22 |Mul -> (2, 1)
23 |Div -> (2, 1)
24 |Pass -> (1, 1)
25 |Stop -> (1, 0)
26 |Mem -> (1, 1)
27 |Delay -> (2, 1)
28 |Floor -> (1, 1)
29 |Int -> (1, 1)
30 |Sin -> (1, 1)
31 |Cos -> (1, 1)
32 |Atan -> (1, 1)
33 |Atan2 -> (2, 1)
34 |Sqrt -> (1, 1)
35 |Rdtable -> (3, 1)
36 |Mod -> (2, 1)
37 |Vectorize -> (2, 1)
38 |Vconcat -> (2, 1)
39 |Vpick -> (2, 1)
40 |Serialize -> (1, 1)
41 |Larger -> (2, 1)
42 |Smaller -> (2, 1)
43 |Prefix -> (2, 1)
44 |Select2 -> (3, 1)
45 |Select3 -> (4, 1);;
46
47 let delay_of_symbol : symbol -> int =
48 fun (s : symbol) ->
49 match s with
50 |Add -> 0
51 |Sub -> 0
52 |Mul -> 0
53 |Div -> 0
54 |Pass -> 0
55 |Stop -> 0
56 |Mem -> 1
57 |Delay -> delay_memory_length
58 |Floor -> 0
59 |Int -> 0
60 |Sin -> 0
61 |Cos -> 0
62 |Atan -> 0
63 |Atan2 -> 0
64 |Sqrt -> 0
65 |Rdtable -> rdtable_memory_length
66 |Mod -> 0
67 |Larger -> 0
68 |Smaller -> 0
69 |Vectorize -> vectorize_memory_length
70 |Vconcat -> 0
71 |Vpick -> 0
72 |Serialize -> 0
73 |Prefix -> 1
74 |Select2 -> 0
75 |Select3 -> 0;;
76
77 let string_of_symbol : symbol -> string =
78 fun (s : symbol) ->
79 match s with
80 |Add -> "Add"
81 |Sub -> "Sub"
82 |Mul -> "Mul"
83 |Div -> "Div"
84 |Pass -> "Pass"
85 |Stop -> "Stop"
86 |Mem -> "Mem"
87 |Delay -> "Delay"
88 |Floor -> "Floor"
89 |Int -> "Int"
90 |Sin -> "Sin"
91 |Cos -> "Cos"
92 |Atan -> "Atan"
93 |Atan2 -> "Atan2"
94 |Sqrt -> "Sqrt"
95 |Rdtable -> "Rdtable"
96 |Mod -> "Mod"
97 |Larger -> "Larger"
98 |Smaller -> "Smaller"
99 |Vectorize -> "Vectorize"
100 |Vconcat -> "Vconcat"
101 |Vpick -> "Vpick"
102 |Serialize -> "Serialize"
103 |Prefix -> "Prefix"
104 |Select2 -> "Select2"
105 |Select3 -> "Select3";;
106