Install, Readme and Changes files updated. Documentation removed.
[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 |Max -> (2, 1)
44 |Min -> (2, 1)
45 |Prefix -> (2, 1)
46 |Select2 -> (3, 1)
47 |Select3 -> (4, 1);;
48
49 let delay_of_symbol : symbol -> int =
50 fun (s : symbol) ->
51 match s with
52 |Add -> 0
53 |Sub -> 0
54 |Mul -> 0
55 |Div -> 0
56 |Pass -> 0
57 |Stop -> 0
58 |Mem -> 1
59 |Delay -> delay_memory_length
60 |Floor -> 0
61 |Int -> 0
62 |Sin -> 0
63 |Cos -> 0
64 |Atan -> 0
65 |Atan2 -> 0
66 |Sqrt -> 0
67 |Rdtable -> rdtable_memory_length
68 |Mod -> 0
69 |Larger -> 0
70 |Smaller -> 0
71 |Max -> 0
72 |Min -> 0
73 |Vectorize -> vectorize_memory_length
74 |Vconcat -> 0
75 |Vpick -> 0
76 |Serialize -> 0
77 |Prefix -> 1
78 |Select2 -> 0
79 |Select3 -> 0;;
80
81 let string_of_symbol : symbol -> string =
82 fun (s : symbol) ->
83 match s with
84 |Add -> "Add"
85 |Sub -> "Sub"
86 |Mul -> "Mul"
87 |Div -> "Div"
88 |Pass -> "Pass"
89 |Stop -> "Stop"
90 |Mem -> "Mem"
91 |Delay -> "Delay"
92 |Floor -> "Floor"
93 |Int -> "Int"
94 |Sin -> "Sin"
95 |Cos -> "Cos"
96 |Atan -> "Atan"
97 |Atan2 -> "Atan2"
98 |Sqrt -> "Sqrt"
99 |Rdtable -> "Rdtable"
100 |Mod -> "Mod"
101 |Larger -> "Larger"
102 |Smaller -> "Smaller"
103 |Max -> "Max"
104 |Min -> "Min"
105 |Vectorize -> "Vectorize"
106 |Vconcat -> "Vconcat"
107 |Vpick -> "Vpick"
108 |Serialize -> "Serialize"
109 |Prefix -> "Prefix"
110 |Select2 -> "Select2"
111 |Select3 -> "Select3";;
112