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