*** empty log message ***
[chuck-blob.git] / v2 / chuck_lang.h
blob3a8fbd22e838a79d9e7d5b88233b76a651c487e6
1 /*----------------------------------------------------------------------------
2 ChucK Concurrent, On-the-fly Audio Programming Language
3 Compiler and Virtual Machine
5 Copyright (c) 2004 Ge Wang and Perry R. Cook. All rights reserved.
6 http://chuck.cs.princeton.edu/
7 http://soundlab.cs.princeton.edu/
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 U.S.A.
23 -----------------------------------------------------------------------------*/
25 //-----------------------------------------------------------------------------
26 // name: chuck_lang.h
27 // desc: chuck class library base
29 // authors: Ge Wang (gewang@cs.princeton.edu)
30 // Perry R. Cook (prc@cs.princeton.edu)
31 // Ananya Misra (amisra@cs.princeton.edu)
32 // date: spring 2005
33 //-----------------------------------------------------------------------------
34 #ifndef __CHUCK_LANG_H__
35 #define __CHUCK_LANG_H__
37 #include "chuck_def.h"
38 #include "chuck_oo.h"
39 #include "chuck_dl.h"
40 #include <queue>
43 // forward reference
44 struct Chuck_UAna;
46 // query
47 DLL_QUERY lang_query( Chuck_DL_Query * QUERY );
49 // base class initialization
50 t_CKBOOL init_class_object( Chuck_Env * env, Chuck_Type * type );
51 t_CKBOOL init_class_ugen( Chuck_Env * env, Chuck_Type * type );
52 t_CKBOOL init_class_uana( Chuck_Env * env, Chuck_Type * type );
53 t_CKBOOL init_class_blob( Chuck_Env * env, Chuck_Type * type );
54 t_CKBOOL init_class_event( Chuck_Env * env, Chuck_Type * type );
55 t_CKBOOL init_class_shred( Chuck_Env * env, Chuck_Type * type );
56 t_CKBOOL init_class_io( Chuck_Env * env, Chuck_Type * type );
57 t_CKBOOL init_class_fileio( Chuck_Env * env, Chuck_Type * type );
58 t_CKBOOL init_class_string( Chuck_Env * env, Chuck_Type * type );
59 t_CKBOOL init_class_array( Chuck_Env * env, Chuck_Type * type );
60 t_CKBOOL init_class_Midi( Chuck_Env * env );
61 t_CKBOOL init_class_MidiRW( Chuck_Env * env );
62 t_CKBOOL init_class_HID( Chuck_Env * env );
67 //-----------------------------------------------------------------------------
68 // object API
69 //-----------------------------------------------------------------------------
70 CK_DLL_CTOR( object_ctor );
71 CK_DLL_DTOR( object_dtor );
72 CK_DLL_MFUN( object_equals );
73 CK_DLL_MFUN( object_getType );
74 CK_DLL_MFUN( object_hashCode );
75 CK_DLL_MFUN( object_toString );
78 //-----------------------------------------------------------------------------
79 // ugen API
80 //-----------------------------------------------------------------------------
81 CK_DLL_CTOR( ugen_ctor );
82 CK_DLL_DTOR( ugen_dtor );
83 CK_DLL_MFUN( ugen_op );
84 CK_DLL_MFUN( ugen_cget_op );
85 CK_DLL_MFUN( ugen_last );
86 CK_DLL_MFUN( ugen_cget_last );
87 CK_DLL_MFUN( ugen_next );
88 CK_DLL_MFUN( ugen_cget_next );
89 CK_DLL_MFUN( ugen_gain );
90 CK_DLL_MFUN( ugen_cget_gain );
91 CK_DLL_MFUN( ugen_numChannels );
92 CK_DLL_MFUN( ugen_cget_numChannels );
93 CK_DLL_MFUN( ugen_chan );
94 CK_DLL_MFUN( ugen_connected );
97 //-----------------------------------------------------------------------------
98 // uana API
99 //-----------------------------------------------------------------------------
100 CK_DLL_CTOR( uana_ctor );
101 CK_DLL_DTOR( uana_dtor );
102 CK_DLL_MFUN( uana_upchuck );
103 CK_DLL_MFUN( uana_blob );
104 CK_DLL_MFUN( uana_fvals );
105 CK_DLL_MFUN( uana_cvals );
106 CK_DLL_MFUN( uana_fval );
107 CK_DLL_MFUN( uana_cval );
110 //-----------------------------------------------------------------------------
111 // uanablob API
112 //-----------------------------------------------------------------------------
113 CK_DLL_CTOR( uanablob_ctor );
114 CK_DLL_DTOR( uanablob_dtor );
115 CK_DLL_MFUN( uanablob_fvals );
116 CK_DLL_MFUN( uanablob_cvals );
117 CK_DLL_MFUN( uanablob_fval );
118 CK_DLL_MFUN( uanablob_cval );
119 CK_DLL_MFUN( uanablob_when );
122 //-----------------------------------------------------------------------------
123 // name: Chuck_UAnaBlobProxy
124 // desc: proxy for interfacing with UAnaBlob, which is a Chuck class
125 //-----------------------------------------------------------------------------
126 struct Chuck_UAnaBlobProxy
128 public:
129 Chuck_UAnaBlobProxy( Chuck_Object * blob );
130 virtual ~Chuck_UAnaBlobProxy();
132 public:
133 t_CKTIME & when();
134 Chuck_Array8 & fvals();
135 Chuck_Array16 & cvals();
137 public:
138 Chuck_Object * realblob() { return m_blob; }
140 protected:
141 Chuck_Object * m_blob;
144 // get proxy
145 Chuck_UAnaBlobProxy * getBlobProxy( const Chuck_UAna * uana );
148 //-----------------------------------------------------------------------------
149 // shred API
150 //-----------------------------------------------------------------------------
151 CK_DLL_CTOR( shred_ctor );
152 CK_DLL_DTOR( shred_dtor );
153 CK_DLL_MFUN( shred_exit );
154 CK_DLL_MFUN( shred_clone );
155 CK_DLL_MFUN( shred_id );
156 CK_DLL_MFUN( shred_yield );
157 CK_DLL_MFUN( shred_running );
158 CK_DLL_MFUN( shred_done );
159 CK_DLL_MFUN( shred_numArgs );
160 CK_DLL_MFUN( shred_getArg );
163 //-----------------------------------------------------------------------------
164 // array API
165 //-----------------------------------------------------------------------------
166 CK_DLL_CTOR( array_ctor );
167 CK_DLL_DTOR( array_dtor );
168 CK_DLL_MFUN( array_set_capacity );
169 CK_DLL_MFUN( array_get_capacity );
170 CK_DLL_MFUN( array_get_capacity_hack );
171 CK_DLL_MFUN( array_set_size );
172 CK_DLL_MFUN( array_get_size );
173 CK_DLL_MFUN( array_push_back );
174 CK_DLL_MFUN( array_pop_back );
175 CK_DLL_MFUN( array_push_front );
176 CK_DLL_MFUN( array_pop_front );
177 CK_DLL_MFUN( array_find );
178 CK_DLL_MFUN( array_erase );
179 CK_DLL_MFUN( array_clear );
180 CK_DLL_MFUN( array_reset );
183 //-----------------------------------------------------------------------------
184 // event API
185 //-----------------------------------------------------------------------------
186 CK_DLL_CTOR( event_ctor );
187 CK_DLL_DTOR( event_dtor );
188 CK_DLL_MFUN( event_signal );
189 CK_DLL_MFUN( event_broadcast );
190 CK_DLL_MFUN( event_wait );
191 CK_DLL_MFUN( event_can_wait );
194 //-----------------------------------------------------------------------------
195 // io API
196 //-----------------------------------------------------------------------------
197 CK_DLL_MFUN( io_dummy );
198 CK_DLL_SFUN( io_openfile );
201 //-----------------------------------------------------------------------------
202 // fileio API
203 //-----------------------------------------------------------------------------
204 CK_DLL_CTOR( fileio_ctor );
205 CK_DLL_DTOR( fileio_dtor );
206 CK_DLL_MFUN( fileio_open );
207 CK_DLL_MFUN( fileio_more );
208 CK_DLL_MFUN( fileio_eof );
209 CK_DLL_MFUN( fileio_good2read );
210 CK_DLL_MFUN( fileio_good2write );
211 CK_DLL_MFUN( fileio_good );
212 CK_DLL_MFUN( fileio_close );
213 CK_DLL_MFUN( fileio_readint );
214 CK_DLL_MFUN( fileio_readfloat );
215 CK_DLL_MFUN( fileio_readstring );
216 CK_DLL_MFUN( fileio_readline );
217 CK_DLL_MFUN( fileio_writeint );
218 CK_DLL_MFUN( fileio_writefloat );
219 CK_DLL_MFUN( fileio_writestring );
220 CK_DLL_MFUN( fileio_writeline );
223 //-----------------------------------------------------------------------------
224 // string API
225 //-----------------------------------------------------------------------------
226 CK_DLL_CTOR( string_ctor );
227 CK_DLL_DTOR( string_dtor );
228 CK_DLL_MFUN( string_length );
229 CK_DLL_MFUN( string_upper );
230 CK_DLL_MFUN( string_lower );
231 CK_DLL_MFUN( string_ltrim );
232 CK_DLL_MFUN( string_rtrim );
233 CK_DLL_MFUN( string_trim );
234 CK_DLL_MFUN( string_toString );
235 CK_DLL_MFUN( string_set_at );
236 CK_DLL_MFUN( string_get_at );
239 //-----------------------------------------------------------------------------
240 // name: Data_Exception
241 // desc: data for base Chuck Exception class
242 //-----------------------------------------------------------------------------
243 struct Data_Exception
245 public:
246 Data_Exception();
247 ~Data_Exception();
249 public:
251 //-----------------------------------------------------------------------------
252 // exception API
253 //-----------------------------------------------------------------------------
256 //-----------------------------------------------------------------------------
257 // MidiMsg API
258 //-----------------------------------------------------------------------------
259 CK_DLL_CTOR( MidiMsg_ctor );
262 //-----------------------------------------------------------------------------
263 // MidiRW API
264 //-----------------------------------------------------------------------------
265 CK_DLL_CTOR( MidiRW_ctor );
266 CK_DLL_DTOR( MidiRW_dtor );
267 CK_DLL_MFUN( MidiRW_open );
268 CK_DLL_MFUN( MidiRW_close );
269 CK_DLL_MFUN( MidiRW_read );
270 CK_DLL_MFUN( MidiRW_write );
273 //-----------------------------------------------------------------------------
274 // MidiMsgOut API
275 //-----------------------------------------------------------------------------
276 CK_DLL_CTOR( MidiMsgOut_ctor );
277 CK_DLL_DTOR( MidiMsgOut_dtor );
278 CK_DLL_MFUN( MidiMsgOut_open );
279 CK_DLL_MFUN( MidiMsgOut_close );
280 CK_DLL_MFUN( MidiMsgOut_write );
283 //-----------------------------------------------------------------------------
284 // MidiMsgIn API
285 //-----------------------------------------------------------------------------
286 CK_DLL_CTOR( MidiMsgIn_ctor );
287 CK_DLL_DTOR( MidiMsgIn_dtor );
288 CK_DLL_MFUN( MidiMsgIn_open );
289 CK_DLL_MFUN( MidiMsgIn_close );
290 CK_DLL_MFUN( MidiMsgIn_read );
293 //-----------------------------------------------------------------------------
294 // MidiIn API
295 //-----------------------------------------------------------------------------
296 CK_DLL_CTOR( MidiIn_ctor );
297 CK_DLL_DTOR( MidiIn_dtor );
298 CK_DLL_MFUN( MidiIn_open );
299 CK_DLL_MFUN( MidiIn_good );
300 CK_DLL_MFUN( MidiIn_num );
301 CK_DLL_MFUN( MidiIn_name );
302 CK_DLL_MFUN( MidiIn_printerr );
303 CK_DLL_MFUN( MidiIn_recv );
304 CK_DLL_MFUN( MidiIn_can_wait );
307 //-----------------------------------------------------------------------------
308 // MidiOut API
309 //-----------------------------------------------------------------------------
310 CK_DLL_CTOR( MidiOut_ctor );
311 CK_DLL_DTOR( MidiOut_dtor );
312 CK_DLL_MFUN( MidiOut_open );
313 CK_DLL_MFUN( MidiOut_good );
314 CK_DLL_MFUN( MidiOut_num );
315 CK_DLL_MFUN( MidiOut_name );
316 CK_DLL_MFUN( MidiOut_printerr );
317 CK_DLL_MFUN( MidiOut_send );
320 //-----------------------------------------------------------------------------
321 // HidMsg API
322 //-----------------------------------------------------------------------------
323 CK_DLL_MFUN( HidMsg_is_axis_motion );
324 CK_DLL_MFUN( HidMsg_is_button_down );
325 CK_DLL_MFUN( HidMsg_is_button_up );
326 CK_DLL_MFUN( HidMsg_is_mouse_motion );
327 CK_DLL_MFUN( HidMsg_is_hat_motion );
328 CK_DLL_MFUN( HidMsg_is_wheel_motion );
330 //-----------------------------------------------------------------------------
331 // HidIn API
332 //-----------------------------------------------------------------------------
333 CK_DLL_CTOR( HidIn_ctor );
334 CK_DLL_DTOR( HidIn_dtor );
335 CK_DLL_MFUN( HidIn_open );
336 CK_DLL_MFUN( HidIn_open_joystick );
337 CK_DLL_MFUN( HidIn_open_mouse );
338 CK_DLL_MFUN( HidIn_open_keyboard );
339 CK_DLL_MFUN( HidIn_open_tiltsensor );
340 CK_DLL_MFUN( HidIn_good );
341 CK_DLL_MFUN( HidIn_num );
342 CK_DLL_MFUN( HidIn_name );
343 CK_DLL_MFUN( HidIn_printerr );
344 CK_DLL_MFUN( HidIn_recv );
345 CK_DLL_MFUN( HidIn_read );
346 CK_DLL_MFUN( HidIn_send );
347 CK_DLL_MFUN( HidIn_can_wait );
348 CK_DLL_SFUN( HidIn_read_tilt_sensor );
349 CK_DLL_SFUN( HidIn_start_cursor_track );
350 CK_DLL_SFUN( HidIn_stop_cursor_track );
353 //-----------------------------------------------------------------------------
354 // HidOut API
355 //-----------------------------------------------------------------------------
356 CK_DLL_CTOR( HidOut_ctor );
357 CK_DLL_DTOR( HidOut_dtor );
358 CK_DLL_MFUN( HidOut_open );
359 CK_DLL_MFUN( HidOut_good );
360 CK_DLL_MFUN( HidOut_num );
361 CK_DLL_MFUN( HidOut_name );
362 CK_DLL_MFUN( HidOut_printerr );
363 CK_DLL_MFUN( HidOut_send );
368 #endif