Bug fixed for unix error "readlink /proc/self/fd/0" on MacOS.
[Faustine.git] / interpreter / 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 to_neststring : string
28 method normalize : unit
29 method add : value_type -> value_type
30 method neg : value_type
31 method sub : value_type -> value_type
32 method mul : value_type -> value_type
33 method recip : value_type
34 method div : value_type -> value_type
35 method power : value_type -> value_type
36 method _and : value_type -> value_type
37 method _or : value_type -> value_type
38 method _xor : value_type -> value_type
39 method zero : value_type
40 method floor : value_type
41 method ceil : value_type
42 method rint : value_type
43 method int : value_type
44 method float : value_type
45 method sin : value_type
46 method asin : value_type
47 method cos : value_type
48 method acos : value_type
49 method tan : value_type
50 method atan : value_type
51 method atan2 : value_type -> value_type
52 method exp : value_type
53 method sqrt : value_type
54 method ln : value_type
55 method lg : value_type
56 method abs : value_type
57 method fmod : value_type -> value_type
58 method _mod : value_type -> value_type
59 method remainder : value_type -> value_type
60 method gt : value_type -> value_type
61 method lt : value_type -> value_type
62 method geq : value_type -> value_type
63 method leq : value_type -> value_type
64 method eq : value_type -> value_type
65 method neq : value_type -> value_type
66 method shl : value_type -> value_type
67 method shr : value_type -> value_type
68 method max : value_type -> value_type
69 method min : value_type -> value_type
70 end;;
71
72
73 type symbol = Add
74 | Sub
75 | Mul
76 | Div
77 | Power
78 | Pass
79 | Stop
80 | And
81 | Or
82 | Xor
83 | Mem
84 | Delay
85 | Floor
86 | Ceil
87 | Rint
88 | Int
89 | Float
90 | Sin
91 | Asin
92 | Cos
93 | Acos
94 | Tan
95 | Atan
96 | Atan2
97 | Exp
98 | Sqrt
99 | Ln
100 | Lg
101 | Abs
102 | Fmod
103 | Mod
104 | Remainder
105 | Vectorize
106 | Vconcat
107 | Vpick
108 | Serialize
109 | Gt
110 | Lt
111 | Geq
112 | Leq
113 | Eq
114 | Neq
115 | Shl
116 | Shr
117 | Max
118 | Min
119 | Prefix
120 | Select2
121 | Select3
122 | Rdtable
123 | Rwtable
124 | Button
125 | Checkbox
126 | Vslider
127 | Hslider
128 | Vgroup
129 | Hgroup
130 | Tgroup
131 | Hbargraph
132 | Vbargraph
133 | Nentry
134 | Attach
135
136 type faust_exp =
137 Const of basic
138 | Ident of symbol
139 | Par of faust_exp * faust_exp
140 | Seq of faust_exp * faust_exp
141 | Rec of faust_exp * faust_exp
142 | Split of faust_exp * faust_exp
143 | Merge of faust_exp * faust_exp
144
145
146 class type rate_type =
147 object
148 method to_int : int
149 method to_float : float
150 method to_string : string
151 method num : int
152 method denom : int
153 method equal : rate_type -> bool
154 method mul : int -> rate_type
155 method div : int -> rate_type
156 end
157
158 class type signal_type =
159 object
160 method frequency : rate_type
161 method at : time -> value_type
162 method add_memory : int -> unit
163 method add : signal_type -> signal_type
164 method neg : signal_type
165 method sub : signal_type -> signal_type
166 method mul : signal_type -> signal_type
167 method div : signal_type -> signal_type
168 method power : signal_type -> signal_type
169 method _and : signal_type -> signal_type
170 method _or : signal_type -> signal_type
171 method _xor : signal_type -> signal_type
172 method delay : signal_type -> signal_type
173 method mem : signal_type
174 method vectorize : signal_type -> signal_type
175 method serialize : signal_type
176 method vconcat : signal_type -> signal_type
177 method vpick : signal_type -> signal_type
178 method floor : signal_type
179 method ceil : signal_type
180 method rint : signal_type
181 method int : signal_type
182 method float : signal_type
183 method sin : signal_type
184 method asin : signal_type
185 method cos : signal_type
186 method acos : signal_type
187 method tan : signal_type
188 method atan : signal_type
189 method atan2 : signal_type -> signal_type
190 method exp : signal_type
191 method sqrt : signal_type
192 method ln : signal_type
193 method lg : signal_type
194 method abs : signal_type
195 method fmod : signal_type -> signal_type
196 method _mod : signal_type -> signal_type
197 method remainder : signal_type -> signal_type
198 method gt : signal_type -> signal_type
199 method lt : signal_type -> signal_type
200 method geq : signal_type -> signal_type
201 method leq : signal_type -> signal_type
202 method eq : signal_type -> signal_type
203 method neq : signal_type -> signal_type
204 method shl : signal_type -> signal_type
205 method shr : signal_type -> signal_type
206 method max : signal_type -> signal_type
207 method min : signal_type -> signal_type
208 method rdtable : signal_type -> signal_type -> signal_type
209 method rwtable : signal_type -> signal_type ->
210 signal_type -> signal_type -> signal_type
211 method select2 : signal_type -> signal_type -> signal_type
212 method select3 : signal_type -> signal_type -> signal_type -> signal_type
213 method prefix : signal_type -> signal_type
214 end;;
215
216 type matrix = float array array;;
217
218 type data = float array array array;;
219
220 type raw_data = value_type array array;;
221
222 class type beam_type =
223 object
224 method get : signal_type array
225 method width : int
226 method sub : int -> int -> beam_type
227 method cut : int -> beam_type * beam_type
228 method append : beam_type -> beam_type
229 method matching : int -> beam_type
230 method at : time -> value_type array
231 method output : int -> data
232 method output_values : int -> raw_data
233 method frequency : rate_type array
234 end;;
235
236
237 class type dimension_type =
238 object
239 method input : int
240 method output : int
241 method par : dimension_type -> dimension_type
242 method seq : dimension_type -> dimension_type
243 method split : dimension_type -> dimension_type
244 method merge : dimension_type -> dimension_type
245 method _rec : dimension_type -> dimension_type
246 end;;
247
248
249 class type process_type =
250 object
251 method exp : faust_exp
252 method dim : dimension_type
253 method delay : int
254 method eval : beam_type -> beam_type
255 end;;
256
257
258 class type io_type =
259 object
260 method set : string -> string -> string -> unit
261 method read : string array -> beam_type
262 method write : rate_type array -> data -> string * string -> string array
263 end;;
264
265
266 type nest =
267 Scalar of float
268 | Vector of nestpar
269 and nestpar = Unary of nest
270 | Binary of nest * nestpar;;