*** empty log message ***
[chuck-blob.git] / v1 / chuck_type.h
blob9b03eb3cffe9acae11b7563f64da82f76fdcaa2b
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 // file: chuck_type.h
27 // desc: ...
29 // author: Ge Wang (gewang@cs.princeton.edu)
30 // Perry R. Cook (prc@cs.princeton.edu)
31 // date: Autumn 2002
32 //-----------------------------------------------------------------------------
33 #ifndef __CHUCK_TYPE_H__
34 #define __CHUCK_TYPE_H__
36 #include "chuck_absyn.h"
41 //-----------------------------------------------------------------------------
42 // type engine enum
43 //-----------------------------------------------------------------------------
44 typedef enum {
45 // general types
46 te_int, te_uint, te_single, te_float, te_double, te_string, te_thread,
47 te_shred, te_time, te_dur, te_array, te_function, te_ugen, te_pattern,
48 te_transport, te_host, te_class, te_unit, te_object, te_null, te_code,
49 te_tuple, te_midiin, te_midiout, te_adc, te_dac, te_bunghole,
51 // system types (internal - cannot instantiate)
52 te_void, __te_system_out__, __te_system_err__, __te_system_time__,
53 __te_system_namespace__, __te_system_class__, __te_system_user__
54 } te_Type;
59 //-----------------------------------------------------------------------------
60 // type engine struct
61 //-----------------------------------------------------------------------------
63 // type struct
64 struct t_Type_
66 // type id
67 te_Type type;
68 // type name
69 c_str name;
70 // class info
71 t_Type parent;
72 // size
73 unsigned int size;
74 // array depth
75 unsigned int array_depth;
76 // dynamic
77 unsigned int dyn;
83 //-----------------------------------------------------------------------------
84 // type engine api
85 //-----------------------------------------------------------------------------
86 typedef struct t_Env_ * t_Env;
87 typedef struct t_Namespace_Info_ * t_Namespace_Info;
88 typedef struct t_Namespace_Value_ * t_Namespace_Value;
89 typedef struct t_Class_Info_ * t_Class_Info;
91 // advanced reference
92 struct Chuck_DLL;
93 struct Chuck_UGen_Info;
94 class Chuck_VM;
96 // api
97 t_Env type_engine_init( Chuck_VM * vm );
98 t_CKBOOL type_engine_shutdown( t_Env env );
99 void type_engine_begin( t_Env env );
100 void type_engine_end( t_Env env );
101 t_CKBOOL type_engine_check_prog( t_Env env, a_Program prog );
102 t_Type type_engine_check_exp( t_Env env, a_Exp exp );
103 t_CKBOOL type_engine_check_stmt( t_Env env, a_Stmt stmt );
104 t_CKBOOL type_engine_add_dll( t_Env env, Chuck_DLL * dll, const char * nspc );
105 t_Namespace_Info type_engine_get_namespace( t_Env env, const char * nspc );
107 t_Type lookup_type( t_Env env, S_Symbol type_name, t_CKBOOL climb = TRUE );
108 t_Type lookup_value( t_Env env, S_Symbol type_name, t_CKBOOL climb = TRUE );
109 a_Func_Def lookup_func( t_Env env, S_Symbol func_name, t_CKBOOL climb = TRUE );
110 Chuck_UGen_Info * lookup_ugen( t_Env env, S_Symbol ugen_name, t_CKBOOL climb = TRUE );
111 t_Env lookup_namespace( t_Env env, S_Symbol nspc_name, t_CKBOOL climb = TRUE );
112 void * lookup_addr( t_Env env, S_Symbol value_name, t_CKBOOL climb = TRUE );
113 t_CKBOOL isa( t_Type a, t_Type b );
118 #endif