99a3877300eded2f13a063b0c5eaebd531b923aa
[Faustine.git] / interpretor / types.ml
1
2 type index = int;;
3
4 type time = int;;
5
6 type basic = N of int
7 | R of float
8 | Vec of vector
9 | Zero
10 | Error
11 and vector = < size : int; nth : (index -> basic) >;;
12
13 class type vector_type =
14 object
15 method size : int
16 method nth : index -> basic
17 end;;
18
19 class type value_type =
20 object
21 method get : basic
22 method to_int : int
23 method to_float : float
24 method to_float_array : float array
25 method of_float_array : float array -> value_type
26 method to_string : string
27 method normalize : unit
28 method add : value_type -> value_type
29 method neg : value_type
30 method sub : value_type -> value_type
31 method mul : value_type -> value_type
32 method recip : value_type
33 method div : value_type -> value_type
34 method power : value_type -> value_type
35 method _and : value_type -> value_type
36 method _or : value_type -> value_type
37 method _xor : value_type -> value_type
38 method zero : value_type
39 method floor : value_type
40 method ceil : value_type
41 method rint : value_type
42 method int : value_type
43 method float : value_type
44 method sin : value_type
45 method asin : value_type
46 method cos : value_type
47 method acos : value_type
48 method tan : value_type
49 method atan : value_type
50 method atan2 : value_type -> value_type
51 method exp : value_type
52 method sqrt : value_type
53 method ln : value_type
54 method lg : value_type
55 method abs : value_type
56 method fmod : value_type -> value_type
57 method _mod : value_type -> value_type
58 method remainder : value_type -> value_type
59 method gt : value_type -> value_type
60 method lt : value_type -> value_type
61 method geq : value_type -> value_type
62 method leq : value_type -> value_type
63 method eq : value_type -> value_type
64 method neq : value_type -> value_type
65 method max : value_type -> value_type
66 method min : value_type -> value_type
67 end;;
68
69
70 type symbol = Add
71 | Sub
72 | Mul
73 | Div
74 | Power
75 | Pass
76 | Stop
77 | And
78 | Or
79 | Xor
80 | Mem
81 | Delay
82 | Floor
83 | Ceil
84 | Rint
85 | Int
86 | Float
87 | Sin
88 | Asin
89 | Cos
90 | Acos
91 | Tan
92 | Atan
93 | Atan2
94 | Exp
95 | Sqrt
96 | Ln
97 | Lg
98 | Abs
99 | Fmod
100 | Mod
101 | Remainder
102 | Vectorize
103 | Vconcat
104 | Vpick
105 | Serialize
106 | Gt
107 | Lt
108 | Geq
109 | Leq
110 | Eq
111 | Neq
112 | Max
113 | Min
114 | Prefix
115 | Select2
116 | Select3
117 | Rdtable
118 | Rwtable
119
120 type faust_exp =
121 Const of basic
122 | Ident of symbol
123 | Par of faust_exp * faust_exp
124 | Seq of faust_exp * faust_exp
125 | Rec of faust_exp * faust_exp
126 | Split of faust_exp * faust_exp
127 | Merge of faust_exp * faust_exp
128
129
130 class type rate_type =
131 object
132 method to_int : int
133 method to_float : float
134 method to_string : string
135 method num : int
136 method denom : int
137 method equal : rate_type -> bool
138 method mul : int -> rate_type
139 method div : int -> rate_type
140 end
141
142 class type signal_type =
143 object
144 method frequency : rate_type
145 method at : time -> value_type
146 method add_memory : int -> unit
147 method add : signal_type -> signal_type
148 method neg : signal_type
149 method sub : signal_type -> signal_type
150 method mul : signal_type -> signal_type
151 method div : signal_type -> signal_type
152 method power : signal_type -> signal_type
153 method _and : signal_type -> signal_type
154 method _or : signal_type -> signal_type
155 method _xor : signal_type -> signal_type
156 method delay : signal_type -> signal_type
157 method mem : signal_type
158 method vectorize : signal_type -> signal_type
159 method serialize : signal_type
160 method vconcat : signal_type -> signal_type
161 method vpick : signal_type -> signal_type
162 method floor : signal_type
163 method ceil : signal_type
164 method rint : signal_type
165 method int : signal_type
166 method float : signal_type
167 method sin : signal_type
168 method asin : signal_type
169 method cos : signal_type
170 method acos : signal_type
171 method tan : signal_type
172 method atan : signal_type
173 method atan2 : signal_type -> signal_type
174 method exp : signal_type
175 method sqrt : signal_type
176 method ln : signal_type
177 method lg : signal_type
178 method abs : signal_type
179 method fmod : signal_type -> signal_type
180 method _mod : signal_type -> signal_type
181 method remainder : signal_type -> signal_type
182 method gt : signal_type -> signal_type
183 method lt : signal_type -> signal_type
184 method geq : signal_type -> signal_type
185 method leq : signal_type -> signal_type
186 method eq : signal_type -> signal_type
187 method neq : signal_type -> signal_type
188 method max : signal_type -> signal_type
189 method min : signal_type -> signal_type
190 method rdtable : signal_type -> signal_type -> signal_type
191 method rwtable : signal_type -> signal_type ->
192 signal_type -> signal_type -> signal_type
193 method select2 : signal_type -> signal_type -> signal_type
194 method select3 : signal_type -> signal_type -> signal_type -> signal_type
195 method prefix : signal_type -> signal_type
196 end;;
197
198 type matrix = float array array;;
199
200 type data = float array array array;;
201
202 class type beam_type =
203 object
204 method get : signal_type array
205 method width : int
206 method sub : int -> int -> beam_type
207 method cut : int -> beam_type * beam_type
208 method append : beam_type -> beam_type
209 method matching : int -> beam_type
210 method at : time -> value_type array
211 method output : int -> data
212 method frequency : rate_type array
213 end;;
214
215
216 class type dimension_type =
217 object
218 method input : int
219 method output : int
220 method par : dimension_type -> dimension_type
221 method seq : dimension_type -> dimension_type
222 method split : dimension_type -> dimension_type
223 method merge : dimension_type -> dimension_type
224 method _rec : dimension_type -> dimension_type
225 end;;
226
227
228 class type process_type =
229 object
230 method exp : faust_exp
231 method dim : dimension_type
232 method delay : int
233 method eval : beam_type -> beam_type
234 end;;
235
236
237 class type io_type =
238 object
239 method set : string -> string -> unit
240 method read : string array -> beam_type
241 method write : rate_type array -> data -> string array
242 end;;