Merge branch 'master' of https://scm.cri.ensmp.fr/git/Faustine
[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 zero : value_type
35 method floor : value_type
36 method int : value_type
37 method sin : value_type
38 method cos : value_type
39 method atan : value_type
40 method sqrt : value_type
41 method atan2 : value_type -> value_type
42 method _mod : value_type -> value_type
43 method larger : value_type -> value_type
44 method smaller : value_type -> value_type
45 method max : value_type -> value_type
46 method min : value_type -> value_type
47 end;;
48
49
50 type symbol = Add
51 | Sub
52 | Mul
53 | Div
54 | Pass
55 | Stop
56 | Mem
57 | Delay
58 | Floor
59 | Int
60 | Sin
61 | Cos
62 | Atan
63 | Atan2
64 | Sqrt
65 | Rdtable
66 | Mod
67 | Vectorize
68 | Vconcat
69 | Vpick
70 | Serialize
71 | Larger
72 | Smaller
73 | Max
74 | Min
75 | Prefix
76 | Select2
77 | Select3
78
79
80 type faust_exp =
81 Const of basic
82 | Ident of symbol
83 | Par of faust_exp * faust_exp
84 | Seq of faust_exp * faust_exp
85 | Rec of faust_exp * faust_exp
86 | Split of faust_exp * faust_exp
87 | Merge of faust_exp * faust_exp
88
89
90 class type rate_type =
91 object
92 method to_int : int
93 method to_float : float
94 method equal : rate_type -> bool
95 method mul : int -> rate_type
96 method div : int -> rate_type
97 end
98
99 class type signal_type =
100 object
101 method frequency : rate_type
102 method at : time -> value_type
103 method add_memory : int -> unit
104 method add : signal_type -> signal_type
105 method neg : signal_type
106 method sub : signal_type -> signal_type
107 method mul : signal_type -> signal_type
108 method div : signal_type -> signal_type
109 method delay : signal_type -> signal_type
110 method mem : signal_type
111 method vectorize : signal_type -> signal_type
112 method serialize : signal_type
113 method vconcat : signal_type -> signal_type
114 method vpick : signal_type -> signal_type
115 method floor : signal_type
116 method int : signal_type
117 method sin : signal_type
118 method cos : signal_type
119 method atan : signal_type
120 method atan2 : signal_type -> signal_type
121 method sqrt : signal_type
122 method _mod : signal_type -> signal_type
123 method larger : signal_type -> signal_type
124 method smaller : signal_type -> signal_type
125 method max : signal_type -> signal_type
126 method min : signal_type -> signal_type
127 method rdtable : signal_type -> signal_type -> signal_type
128 method select2 : signal_type -> signal_type -> signal_type
129 method select3 : signal_type -> signal_type -> signal_type -> signal_type
130 method prefix : signal_type -> signal_type
131 end;;
132
133
134 class type beam_type =
135 object
136 method get : signal_type array
137 method width : int
138 method sub : int -> int -> beam_type
139 method cut : int -> beam_type * beam_type
140 method append : beam_type -> beam_type
141 method matching : int -> beam_type
142 method at : time -> value_type array
143 method output : int -> float array array array
144 method frequency : int array
145 end;;
146
147
148 class type dimension_type =
149 object
150 method input : int
151 method output : int
152 method par : dimension_type -> dimension_type
153 method seq : dimension_type -> dimension_type
154 method split : dimension_type -> dimension_type
155 method merge : dimension_type -> dimension_type
156 method _rec : dimension_type -> dimension_type
157 end;;
158
159
160 class type process_type =
161 object
162 method exp : faust_exp
163 method dim : dimension_type
164 method delay : int
165 method eval : beam_type -> beam_type
166 end;;
167
168
169 class type io_type =
170 object
171 method set : string -> string -> unit
172 method read : string array -> beam_type
173 method write : int array -> float array array array -> string array
174 end;;