1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN">
4 <link rel=
"stylesheet" href=
"style.css" type=
"text/css">
5 <meta content=
"text/html; charset=iso-8859-1" http-equiv=
"Content-Type">
6 <link rel=
"Start" href=
"index.html">
7 <link rel=
"previous" href=
"Lexer.html">
8 <link rel=
"next" href=
"Signal.html">
9 <link rel=
"Up" href=
"index.html">
10 <link title=
"Index of types" rel=Appendix
href=
"index_types.html">
11 <link title=
"Index of exceptions" rel=Appendix
href=
"index_exceptions.html">
12 <link title=
"Index of values" rel=Appendix
href=
"index_values.html">
13 <link title=
"Index of modules" rel=Appendix
href=
"index_modules.html">
14 <link title=
"Types" rel=
"Chapter" href=
"Types.html">
15 <link title=
"Parser" rel=
"Chapter" href=
"Parser.html">
16 <link title=
"Lexer" rel=
"Chapter" href=
"Lexer.html">
17 <link title=
"Value" rel=
"Chapter" href=
"Value.html">
18 <link title=
"Signal" rel=
"Chapter" href=
"Signal.html">
19 <link title=
"Faustexp" rel=
"Chapter" href=
"Faustexp.html">
20 <link title=
"Interpreter" rel=
"Chapter" href=
"Interpreter.html">
21 <link title=
"Preprocess" rel=
"Chapter" href=
"Preprocess.html">
22 <link title=
"Main" rel=
"Chapter" href=
"Main.html"><title>Value
</title>
25 <div class=
"navbar"><a href=
"Lexer.html">Previous
</a>
26 <a href=
"index.html">Up
</a>
27 <a href=
"Signal.html">Next
</a>
29 <center><h1>Module
<a href=
"type_Value.html">Value
</a></h1></center>
31 <pre><span class=
"keyword">module
</span> Value:
<code class=
"code">sig
</code> <a href=
"Value.html">..
</a> <code class=
"code">end
</code></pre>Module: Value
32 Description: basic data type in the vectorial faust interpreter.
<br>
33 <b>Author(s):
</b> WANG Haisheng
34 Created:
31/
05/
2013 Modified:
03/
06/
2013<br>
36 <pre><span id=
"EXCEPTIONConvert_Error"><span class=
"keyword">exception
</span> Convert_Error
</span> <span class=
"keyword">of
</span> <code class=
"type">string
</code></pre>
38 Exception raised in convertions between float/int and type 'Value'.
<br>
40 <pre><span id=
"EXCEPTIONValue_operation"><span class=
"keyword">exception
</span> Value_operation
</span> <span class=
"keyword">of
</span> <code class=
"type">string
</code></pre>
42 Exception raised in type 'Value' operations.
<br>
44 <br><code><span id=
"TYPEvalue_macro"><span class=
"keyword">type
</span> <code class=
"type"></code>value_macro
</span> =
</code><table class=
"typetable">
46 <td align=
"left" valign=
"top" >
47 <code><span class=
"keyword">|
</span></code></td>
48 <td align=
"left" valign=
"top" >
49 <code><span class=
"constructor">Faust_Max_int
</span></code></td>
53 <td align=
"left" valign=
"top" >
54 <code><span class=
"keyword">|
</span></code></td>
55 <td align=
"left" valign=
"top" >
56 <code><span class=
"constructor">Faust_Min_int
</span></code></td>
60 <td align=
"left" valign=
"top" >
61 <code><span class=
"keyword">|
</span></code></td>
62 <td align=
"left" valign=
"top" >
63 <code><span class=
"constructor">Faust_Bits_int
</span></code></td>
68 Macro constants of the file.
<br>
71 <pre><span id=
"VALvalue_macro_to_int"><span class=
"keyword">val
</span> <a href=
"code_VALValue.value_macro_to_int.html">value_macro_to_int
</a></span> :
<code class=
"type"><a href=
"Value.html#TYPEvalue_macro">value_macro
</a> -
> int
</code></pre><div class=
"info">
72 val value_macro_to_value : value_macro -
> int.
<br>
74 <pre><span id=
"VALreturn_N"><span class=
"keyword">val
</span> <a href=
"code_VALValue.return_N.html">return_N
</a></span> :
<code class=
"type">int -
> <a href=
"Types.html#TYPEvalue">Types.value
</a></code></pre><div class=
"info">
75 val return_N : int -
> value, convert from int to value N.
<br>
77 <pre><span id=
"VALreturn_R"><span class=
"keyword">val
</span> <a href=
"code_VALValue.return_R.html">return_R
</a></span> :
<code class=
"type">float -
> <a href=
"Types.html#TYPEvalue">Types.value
</a></code></pre><div class=
"info">
78 val return_R : float -
> value, convert from float to value R.
<br>
80 <pre><span id=
"VALreturn_Vec"><span class=
"keyword">val
</span> <a href=
"code_VALValue.return_Vec.html">return_Vec
</a></span> :
<code class=
"type">int * (int -
> <a href=
"Types.html#TYPEvalue">Types.value
</a>) -
> <a href=
"Types.html#TYPEvalue">Types.value
</a></code></pre><div class=
"info">
81 val return_Vec : int * (int -
> value) -
> value, convert (size, vec) to value Vec.
<br>
83 <pre><span id=
"VALfail"><span class=
"keyword">val
</span> <a href=
"code_VALValue.fail.html">fail
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a></code></pre><div class=
"info">
84 val fail, return value W.
<br>
86 <pre><span id=
"VALtake_off_N"><span class=
"keyword">val
</span> <a href=
"code_VALValue.take_off_N.html">take_off_N
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a> -
> int
</code></pre><div class=
"info">
87 val take_off_N : value -
> int, convert from value N to int.
88 Attention: Zero and W are converted to
0.
<br>
90 <pre><span id=
"VALtake_off_R"><span class=
"keyword">val
</span> <a href=
"code_VALValue.take_off_R.html">take_off_R
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a> -
> float
</code></pre><div class=
"info">
91 val take_off_R : value -
> float, convert from value R to float.
92 Attention: Zero and W are converted to
0.0, int converted to float.
<br>
94 <pre><span id=
"VALconvert_back_R"><span class=
"keyword">val
</span> <a href=
"code_VALValue.convert_back_R.html">convert_back_R
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a> -
> float array
</code></pre><div class=
"info">
95 val convert_back_r : value -
> float array,
96 return a float array of size
1 if v is N|R|Zero|W, a float array of size n if v is Vec.
<br>
98 <pre><span id=
"VALstring_of_value"><span class=
"keyword">val
</span> <a href=
"code_VALValue.string_of_value.html">string_of_value
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a> -
> string
</code></pre><div class=
"info">
99 val string_of_value : value -
> string, converts value to following
100 strings
"N i" |
"R f" |
"Vec" |
"Zero" |
"W".
<br>
102 <pre><span id=
"VALprint_value_list"><span class=
"keyword">val
</span> <a href=
"code_VALValue.print_value_list.html">print_value_list
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a> list -
> unit
</code></pre><div class=
"info">
103 val print_value_list: value list -
> unit, prints to console the value list.
<br>
105 <pre><span id=
"VALfactory_add_memory"><span class=
"keyword">val
</span> <a href=
"code_VALValue.factory_add_memory.html">factory_add_memory
</a></span> :
<code class=
"type">(int -
> 'a) -
> int -
> int -
> 'a
</code></pre><div class=
"info">
106 val factory_add_memory : (int -
> 'b) -
> int -
> (int -
> 'b),
107 <code class=
"code">factory_add_memory f n
</code> adds a memory of size n to fun f.
<br>
109 <pre><span id=
"VALv_memory"><span class=
"keyword">val
</span> <a href=
"code_VALValue.v_memory.html">v_memory
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a></code></pre><div class=
"info">
110 val v_memory : value -
> value, returns value Vec with memory.
<br>
112 <pre><span id=
"VALv_list_memory"><span class=
"keyword">val
</span> <a href=
"code_VALValue.v_list_memory.html">v_list_memory
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a> list -
> <a href=
"Types.html#TYPEvalue">Types.value
</a> list
</code></pre><div class=
"info">
113 val v_list_memory : value list -
> value list, returns value list with memory.
<br>
115 <pre><span id=
"VALmake_vector"><span class=
"keyword">val
</span> <a href=
"code_VALValue.make_vector.html">make_vector
</a></span> :
<code class=
"type">int -
> (int -
> <a href=
"Types.html#TYPEvalue">Types.value
</a>) -
> <a href=
"Types.html#TYPEvalue">Types.value
</a></code></pre><div class=
"info">
116 val make_vector : int -
> (int -
> value) -
> value,
117 <code class=
"code">make_vector size vec
</code>, return a value Vec of (size, vec).
<br>
119 <pre><span id=
"VALnormalize"><span class=
"keyword">val
</span> <a href=
"code_VALValue.normalize.html">normalize
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a></code></pre><div class=
"info">
120 val normalize: value -
> value, normalize value to bounded
<code class=
"code">-
2147483648,
2147483647</code>.
<br>
122 <pre><span id=
"VALv_add"><span class=
"keyword">val
</span> <a href=
"code_VALValue.v_add.html">v_add
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a></code></pre><div class=
"info">
123 val v_add : value -
> value -
> value, value addition, recursive for value.Vec.
<br>
125 <pre><span id=
"VAL(+~)"><span class=
"keyword">val
</span> <a href=
"code_VALValue.(_plus__tilde_).html">(+~)
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a></code></pre><div class=
"info">
126 val (+~) : value -
> value -
> value, operator of v_add.
<br>
128 <pre><span id=
"VALv_neg"><span class=
"keyword">val
</span> <a href=
"code_VALValue.v_neg.html">v_neg
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a></code></pre><div class=
"info">
129 val v_neg : value -
> value, v_neg v = -v.
<br>
131 <pre><span id=
"VALv_sub"><span class=
"keyword">val
</span> <a href=
"code_VALValue.v_sub.html">v_sub
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a></code></pre><div class=
"info">
132 val v_sub : value -
> value -
> value, returns (v1 - v2).
<br>
134 <pre><span id=
"VAL(-~)"><span class=
"keyword">val
</span> <a href=
"code_VALValue.(_minus__tilde_).html">(-~)
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a></code></pre><div class=
"info">
135 val (-~) : value -
> value -
> value, operator of v_sub.
<br>
137 <pre><span id=
"VALv_mul"><span class=
"keyword">val
</span> <a href=
"code_VALValue.v_mul.html">v_mul
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a></code></pre><div class=
"info">
138 val v_mul : value -
> value -
> value, returns (v1 * v2), recursive for value.Vec.
<br>
140 <pre><span id=
"VAL( *~ )"><span class=
"keyword">val
</span> <a href=
"code_VALValue.( _star__tilde_ ).html">( *~ )
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a></code></pre><div class=
"info">
141 val ( *~ ) : value -
> value -
> value, operator of v_mul.
<br>
143 <pre><span id=
"VALv_recip"><span class=
"keyword">val
</span> <a href=
"code_VALValue.v_recip.html">v_recip
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a></code></pre><div class=
"info">
144 val v_recip : value -
> value, v_recip v =
1./.v.
<br>
146 <pre><span id=
"VALv_div"><span class=
"keyword">val
</span> <a href=
"code_VALValue.v_div.html">v_div
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a></code></pre><div class=
"info">
147 val v_div : value -
> value -
> value, value division, returns (v1/.v2).
<br>
149 <pre><span id=
"VAL(/~)"><span class=
"keyword">val
</span> <a href=
"code_VALValue.(_slash__tilde_).html">(/~)
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a></code></pre><div class=
"info">
150 val (/~) : value -
> value -
> value, operator of v_div.
<br>
152 <pre><span id=
"VALv_zero"><span class=
"keyword">val
</span> <a href=
"code_VALValue.v_zero.html">v_zero
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a></code></pre><div class=
"info">
153 val v_zero : value -
> value, Attention: N i -
> N
0 | R f -
> R
0. | Zero -
> Zero | W -
> R
0.,
154 and recursive for value.Vec.
<br>
156 <pre><span id=
"VALv_floor"><span class=
"keyword">val
</span> <a href=
"code_VALValue.v_floor.html">v_floor
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a></code></pre><div class=
"info">
157 val v_floor : value -
> value, returns floor of float, converts int to float, Zero to
0.,
158 error to error, recursive for value.Vec.
<br>
160 <pre><span id=
"VALv_int"><span class=
"keyword">val
</span> <a href=
"code_VALValue.v_int.html">v_int
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a></code></pre><div class=
"info">
161 val v_int : value -
> value, converts value to value.N, error to error, recursive for value.Vec.
<br>
163 <pre><span id=
"VALv_sin"><span class=
"keyword">val
</span> <a href=
"code_VALValue.v_sin.html">v_sin
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a></code></pre><div class=
"info">
164 val v_sin : value -
> value, returns sin(v), recursive for value.Vec.
<br>
166 <pre><span id=
"VALv_cos"><span class=
"keyword">val
</span> <a href=
"code_VALValue.v_cos.html">v_cos
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a></code></pre><div class=
"info">
167 val v_cos : value -
> value, returns cos(v), recursive for value.Vec.
<br>
169 <pre><span id=
"VALv_atan"><span class=
"keyword">val
</span> <a href=
"code_VALValue.v_atan.html">v_atan
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a></code></pre><div class=
"info">
170 val v_atan : value -
> value, returns atan(v), recursive for value.Vec.
<br>
172 <pre><span id=
"VALv_atantwo"><span class=
"keyword">val
</span> <a href=
"code_VALValue.v_atantwo.html">v_atantwo
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a></code></pre><div class=
"info">
173 val v_atantwo : value -
> value, returns atantwo(v), recursive for value.Vec.
<br>
175 <pre><span id=
"VALv_sqrt"><span class=
"keyword">val
</span> <a href=
"code_VALValue.v_sqrt.html">v_sqrt
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a></code></pre><div class=
"info">
176 val v_sqrt : value -
> value, returns sqrt(v), recursive for value.Vec.
<br>
178 <pre><span id=
"VALv_mod"><span class=
"keyword">val
</span> <a href=
"code_VALValue.v_mod.html">v_mod
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a></code></pre><div class=
"info">
179 val v_mod : value -
> value -
> value, returns (v1 % v2), recursive for value.Vec.
<br>
181 <pre><span id=
"VALv_larger_than_zero"><span class=
"keyword">val
</span> <a href=
"code_VALValue.v_larger_than_zero.html">v_larger_than_zero
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a></code></pre><div class=
"info">
182 val v_larger_than_zero : value -
> value, primitive comparison between value and zero,
183 returns value.N
1 if true, value.N
0 if false.
<br>
185 <pre><span id=
"VALv_sup"><span class=
"keyword">val
</span> <a href=
"code_VALValue.v_sup.html">v_sup
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a></code></pre><div class=
"info">
186 val v_sup : value -
> value -
> value, comparison of two values, returns value.N
1 if (v1
> v2),
189 <pre><span id=
"VALv_inf"><span class=
"keyword">val
</span> <a href=
"code_VALValue.v_inf.html">v_inf
</a></span> :
<code class=
"type"><a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a> -
> <a href=
"Types.html#TYPEvalue">Types.value
</a></code></pre><div class=
"info">
190 val v_inf : value -
> value -
> value, comparison of two values, returns value.N
1 if (v1
< v2),