<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>examples/analysis/tracking/Smacking.ck</filename>
    </added>
    <added>
      <filename>examples/analysis/tracking/Tracking.ck</filename>
    </added>
    <added>
      <filename>examples/analysis/tracking/harm.ck</filename>
    </added>
    <added>
      <filename>examples/analysis/tracking/pitch-fifth.ck</filename>
    </added>
    <added>
      <filename>examples/analysis/tracking/pitch-seventh.ck</filename>
    </added>
    <added>
      <filename>examples/analysis/tracking/pitch-third.ck</filename>
    </added>
    <added>
      <filename>examples/analysis/tracking/pitch-track.ck</filename>
    </added>
    <added>
      <filename>examples/io/chout.ck</filename>
    </added>
    <added>
      <filename>examples/io/example.txt</filename>
    </added>
    <added>
      <filename>examples/io/int.txt</filename>
    </added>
    <added>
      <filename>examples/io/out.txt</filename>
    </added>
    <added>
      <filename>examples/io/out2.txt</filename>
    </added>
    <added>
      <filename>examples/io/read-int.ck</filename>
    </added>
    <added>
      <filename>examples/io/read-line.ck</filename>
    </added>
    <added>
      <filename>examples/io/read-str.ck</filename>
    </added>
    <added>
      <filename>examples/io/str.txt</filename>
    </added>
    <added>
      <filename>examples/io/write.ck</filename>
    </added>
    <added>
      <filename>examples/io/write2.ck</filename>
    </added>
    <added>
      <filename>src/dirent_win32.h</filename>
    </added>
    <added>
      <filename>src/makefile.audicle</filename>
    </added>
    <added>
      <filename>src/skini.cpp</filename>
    </added>
    <added>
      <filename>src/skini.h</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -8,5 +8,6 @@ current version of this document:
 chuck home:
 
     http://chuck.cs.princeton.edu/
+    http://chuck.stanford.edu/
 
 ---</diff>
      <filename>DEVELOPER</filename>
    </modified>
    <modified>
      <diff>@@ -6,12 +6,13 @@ version: 1.2.x.x (dracula)
 
 ChucK home:
     http://chuck.cs.princeton.edu/
+    http://chuck.stanford.edu/
 
 Got questions?
     http://chuck.cs.princeton.edu/community.html
 
 email us:
-    gewang@cs.princeton.edu
+    gewang@cs.princeton.edu | ge@ccrma.stanford.edu
 
 online version of this document:
     http://chuck.cs.princeton.edu/doc/build/
@@ -63,18 +64,18 @@ directory name):
 
    %&gt; make
    [chuck build]: please use one of the following configurations:
-       make osx-ppc, make osx-intel, make win32,
+       make osx, make osx-ub, make win32,
        make linux-oss, make linux-alsa, or make linux-jack
 
 Now, type the command corresponding to your platform... 
 
-for example, for MacOS X (PowerPC):
+for example, for MacOS X (Universal Binary: PowerPC + Intel):
 
-   %&gt; make osx-ppc
+   %&gt; make osx-ub
 
-or for MacOS X (Intel):
+or for MacOS X (current):
 
-   %&gt; make osx-intel
+   %&gt; make osx
 
 etc...
 </diff>
      <filename>INSTALL</filename>
    </modified>
    <modified>
      <diff>@@ -31,6 +31,7 @@ authors:
 
 ChucK home page:
     http://chuck.cs.princeton.edu/
+    http://chuck.stanford.edu/
 
 ChucK documentation:
     http://chuck.cs.princeton.edu/doc/
@@ -38,6 +39,9 @@ ChucK documentation:
 Princeton Sound Lab:
     http://soundlab.cs.princeton.edu/
 
+CCRMA:
+    http://ccrma.stanford.edu/
+
 ---
 
 *** QUICK START ***</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -15,6 +15,8 @@ Ken Steiglitz
 Paul Lansky
 Roger Dannenberg
 Max Mathews
+Chris Chafe
+Fernando Lopez-Lezcano
 n++k
 Nick Collins
 Niklas Werner
@@ -26,7 +28,7 @@ Adam Wendt
 Gary Scavone
 Brad Garton
 Graham Coleman
-Kassen
+Kassen Oud
 Kijjaz
 Scott Smallwood
 Mark Daly</diff>
      <filename>THANKS</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,45 @@
 ---
+1.2.1.3
+  - (added) initial/experimental support for file I/O (finally)
+            (thanks to Andrew Schran, Martin Robinson)
+  - (added) new class: IO, FileIO
+            see examples/io/:
+                read-int.ck
+                read-str.ck
+                readline.ck - using readline
+                write.ck - write using &lt;=
+                write2.ck - write using .write()
+  - (added) IO input via =&gt;
+  - (added) IO output via &lt;= (the &quot;back-chuck&quot;)
+            example: fio &lt;= x &lt;= &quot; &quot; &lt;= y &lt;= &quot;\n&quot;;
+  - (added) new syntax for checking if/while/for/until with IO objects
+            e.g., while( fio =&gt; i ) { ... }
+  - (added) StdOut/StdErr objects:
+            &quot;chout&quot; (pronounced &quot;shout&quot;)
+            &quot;cherr&quot; (pronounced &quot;Cher&quot;)
+  - (added) Hid.open() now can accept a device name parameter
+  - (added) analysis/tracking examples are now back
+            (thanks to Kassen for looking into this)
+  - (fixed) calling overloaded functions with most specific match
+            e.g., Specific extends General:
+            fun void foo( General obj ) { }
+            fun void foo( Specific obj ) { }
+            foo( obj $ Specific ); // should call foo( Specific )
+            (thanks to Robert Poor for reporting, to Kassen, David Rush,
+            Michael Heuer, and Andrew C. Smith for follow-up)
+  - (fixed) STK instruments control changes reports range issues as
+            &quot;control value exceeds nominal range&quot;; previously printed
+            hard-coded values that were potentially misleading
+            (thanks to Kassen for reporting)
+  - (fixed) all oscillators now produce audio for negative frequencies
+            (thanks to Luke Dahl)
+  - (fixed) incorrect UGen disconnect (thanks Kassen for reporting)
+  - (fixed) type checker now validates if/while/for/until types
+  - (fixed) linux compilation (for gcc 4.x)
+  - (fixed) complilation on OS X Snow Leopard
+
+
+---
 1.2.1.2
   - (added) dynamic, resizable arrays
                 .size( int ) resizes array; .size() returns current size()
@@ -55,6 +96,7 @@
   - (fixed) unsporked Shred instances now given id == 0 (thanks Kassen)
   - (fixed) typos in ugen_xxx.cpp and chuck-specific rtaudio.cpp (/moudi)
 
+
 ---
 1.2.1.1
   - (fixed) ctrl-c no longer causes crash on shutdown</diff>
      <filename>VERSIONS</filename>
    </modified>
    <modified>
      <diff></diff>
      <filename>doc/ChucK_manual.pdf</filename>
    </modified>
    <modified>
      <diff>@@ -4,3 +4,4 @@ ChucK Documentation + Tutorials:
 
 ChucK home:
     http://chuck.cs.princeton.edu/
+    http://chuck.stanford.edu/</diff>
      <filename>doc/GOTO</filename>
    </modified>
    <modified>
      <filename>examples/event/ALSO_SEE</filename>
    </modified>
    <modified>
      <diff>@@ -4,7 +4,7 @@
 Flute flute =&gt; PoleZero f =&gt; JCRev r =&gt; dac;
 .75 =&gt; r.gain;
 .05 =&gt; r.mix;
-1 =&gt; f.blockZero;
+.99 =&gt; f.blockZero;
 
 // our notes
 [ 61, 63, 65, 66, 68 ] @=&gt; int notes[];</diff>
      <filename>examples/stk/flute.ck</filename>
    </modified>
    <modified>
      <diff>@@ -737,7 +737,7 @@ a_Class_Ext new_class_ext( a_Id_List extend_id, a_Id_List impl_list, int pos )
     return a;
 }
 
-a_Id_List new_id_list( c_str xid, int pos )
+a_Id_List new_id_list( c_constr xid, int pos )
 {
     a_Id_List a = (a_Id_List)checked_malloc( sizeof( struct a_Id_List_ ) );
     a-&gt;xid = insert_symbol( xid );
@@ -747,7 +747,7 @@ a_Id_List new_id_list( c_str xid, int pos )
     return a;
 }
 
-a_Id_List prepend_id_list( c_str xid, a_Id_List list, int pos )
+a_Id_List prepend_id_list( c_constr xid, a_Id_List list, int pos )
 {
     a_Id_List a = new_id_list( xid, pos );
     a-&gt;next = list;</diff>
      <filename>src/chuck_absyn.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -190,8 +190,8 @@ a_Class_Body new_class_body( a_Section section, int pos );
 a_Class_Body prepend_class_body( a_Section section, a_Class_Body body, int pos );
 a_Class_Ext new_class_ext( a_Id_List extend_id, a_Id_List impl_list, int pos );
 a_Class_Def new_iface_def( ae_Keyword class_decl, a_Id_List xid, a_Class_Ext ext, a_Class_Body body, int pos );
-a_Id_List new_id_list( c_str xid, int pos );
-a_Id_List prepend_id_list( c_str xid, a_Id_List list, int pos );
+a_Id_List new_id_list( c_constr xid, int pos );
+a_Id_List prepend_id_list( c_constr xid, a_Id_List list, int pos );
 void clean_exp( a_Exp exp );
 a_Func_Def new_func_def( ae_Keyword func_decl, ae_Keyword static_decl,
                          a_Type_Decl type_decl, c_str name,</diff>
      <filename>src/chuck_absyn.h</filename>
    </modified>
    <modified>
      <diff>@@ -555,8 +555,10 @@ t_CKBOOL load_internal_modules( Chuck_Compiler * compiler )
     if( !load_module( env, opensoundcontrol_query, &quot;opsc&quot;, &quot;global&quot; ) ) goto error;
     // if( !load_module( env, net_query, &quot;net&quot;, &quot;global&quot; ) ) goto error;
 
+#ifndef __DISABLE_MIDI__
     if( !init_class_Midi( env ) ) goto error;
     if( !init_class_MidiRW( env ) ) goto error;
+#endif // __DISABLE_MIDI__
     if( !init_class_HID( env ) ) goto error;
 
     // clear context</diff>
      <filename>src/chuck_compile.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -152,5 +152,21 @@ typedef struct { SAMPLE re ; SAMPLE im ; } t_CKCOMPLEX_SAMPLE;
 #pragma warning (disable : 4068)  // unknown pragma
 #endif
 
+#ifdef __CHIP_MODE__
+#define __DISABLE_MIDI__
+#define __DISABLE_SNDBUF__
+#define __DISABLE_WATCHDOG__
+#define __DISABLE_RAW__
+#define __DISABLE_KBHIT__
+#define __DISABLE_PROMPTER__
+#define __DISABLE_RTAUDIO__
+#define __DISABLE_OTF_SERVER__
+#define __ALTER_HID__
+#define __ALTER_ENTRY_POINT__
+#define __STK_USE_SINGLE_PRECISION__
+#endif
+
+
+
 
 #endif</diff>
      <filename>src/chuck_def.h</filename>
    </modified>
    <modified>
      <diff>@@ -500,6 +500,15 @@ t_CKBOOL emit_engine_emit_if( Chuck_Emitter * emit, a_Stmt_If stmt )
         break;
         
     default:
+        // check for IO
+        if( isa( stmt-&gt;cond-&gt;type, &amp;t_io ) )
+        {
+            // push 0
+            emit-&gt;append( new Chuck_Instr_Reg_Push_Imm( 0 ) );
+            op = new Chuck_Instr_Branch_Eq_int_IO_good( 0 );
+            break;
+        }
+
         EM_error2( stmt-&gt;cond-&gt;linepos,
             &quot;(emit): internal error: unhandled type '%s' in if condition&quot;,
             stmt-&gt;cond-&gt;type-&gt;name.c_str() );
@@ -586,9 +595,18 @@ t_CKBOOL emit_engine_emit_for( Chuck_Emitter * emit, a_Stmt_For stmt )
             break;
         
         default:
+            // check for IO
+            if( isa( stmt-&gt;c2-&gt;stmt_exp-&gt;type, &amp;t_io ) )
+            {
+                // push 0
+                emit-&gt;append( new Chuck_Instr_Reg_Push_Imm( 0 ) );
+                op = new Chuck_Instr_Branch_Eq_int_IO_good( 0 );
+                break;
+            }
+
             EM_error2( stmt-&gt;c2-&gt;stmt_exp-&gt;linepos,
-                 &quot;(emit): internal error: unhandled type '%s' in for conditional&quot;,
-                 stmt-&gt;c2-&gt;stmt_exp-&gt;type-&gt;name.c_str() );
+                &quot;(emit): internal error: unhandled type '%s' in for conditional&quot;,
+                stmt-&gt;c2-&gt;stmt_exp-&gt;type-&gt;name.c_str() );
             return FALSE;
         }
         // append the op
@@ -714,6 +732,15 @@ t_CKBOOL emit_engine_emit_while( Chuck_Emitter * emit, a_Stmt_While stmt )
         break;
         
     default:
+        // check for IO
+        if( isa( stmt-&gt;cond-&gt;type, &amp;t_io ) )
+        {
+            // push 0
+            emit-&gt;append( new Chuck_Instr_Reg_Push_Imm( 0 ) );
+            op = new Chuck_Instr_Branch_Eq_int_IO_good( 0 );
+            break;
+        }
+
         EM_error2( stmt-&gt;cond-&gt;linepos,
             &quot;(emit): internal error: unhandled type '%s' in while conditional&quot;,
             stmt-&gt;cond-&gt;type-&gt;name.c_str() );
@@ -806,9 +833,18 @@ t_CKBOOL emit_engine_emit_do_while( Chuck_Emitter * emit, a_Stmt_While stmt )
         break;
         
     default:
+        // check for IO
+        if( isa( stmt-&gt;cond-&gt;type, &amp;t_io ) )
+        {
+            // push 0
+            emit-&gt;append( new Chuck_Instr_Reg_Push_Imm( 0 ) );
+            op = new Chuck_Instr_Branch_Eq_int_IO_good( 0 );
+            break;
+        }
+
         EM_error2( stmt-&gt;cond-&gt;linepos,
-                   &quot;(emit): internal error: unhandled type '%s' in do/while conditional&quot;,
-                   stmt-&gt;cond-&gt;type-&gt;c_name() );
+            &quot;(emit): internal error: unhandled type '%s' in do/while conditional&quot;,
+            stmt-&gt;cond-&gt;type-&gt;c_name() );
         return FALSE;
     }
     
@@ -886,9 +922,18 @@ t_CKBOOL emit_engine_emit_until( Chuck_Emitter * emit, a_Stmt_Until stmt )
         break;
         
     default:
+        // check for IO
+        if( isa( stmt-&gt;cond-&gt;type, &amp;t_io ) )
+        {
+            // push 0
+            emit-&gt;append( new Chuck_Instr_Reg_Push_Imm( 0 ) );
+            op = new Chuck_Instr_Branch_Neq_int_IO_good( 0 );
+            break;
+        }
+
         EM_error2( stmt-&gt;cond-&gt;linepos,
-             &quot;(emit): internal error: unhandled type '%s' in until conditional&quot;,
-             stmt-&gt;cond-&gt;type-&gt;name.c_str() );
+            &quot;(emit): internal error: unhandled type '%s' in until conditional&quot;,
+            stmt-&gt;cond-&gt;type-&gt;name.c_str() );
         return FALSE;
     }
     
@@ -1992,7 +2037,25 @@ t_CKBOOL emit_engine_emit_op( Chuck_Emitter * emit, ae_Operator op, a_Exp lhs, a
 
         default:
             if( isa( t_left, &amp;t_string ) &amp;&amp; isa( t_right, &amp;t_string ) )
+            {
                 emit-&gt;append( instr = new Chuck_Instr_Op_string( op ) );
+            }
+            else if( isa( t_left, &amp;t_io ) )
+            {
+                // output
+                if( isa( t_right, &amp;t_int ) )
+                {
+                    emit-&gt;append( instr = new Chuck_Instr_IO_out_int );
+                }
+                else if( isa( t_right, &amp;t_float ) )
+                {
+                    emit-&gt;append( instr = new Chuck_Instr_IO_out_float );
+                }
+                else if( isa( t_right, &amp;t_string ) )
+                {
+                    emit-&gt;append( instr = new Chuck_Instr_IO_out_string );
+                }
+            }
             break;
         }
         break;
@@ -2158,8 +2221,31 @@ t_CKBOOL emit_engine_emit_op_chuck( Chuck_Emitter * emit, a_Exp lhs, a_Exp rhs,
 
         return TRUE;
     }
+    
+    // input
+    if( isa( left, &amp;t_io ) )
+    {
+        if( isa( right, &amp;t_int ) )
+        {
+            assert( rhs-&gt;s_meta == ae_meta_var );
+            emit-&gt;append( new Chuck_Instr_IO_in_int );
+	    return TRUE;
+        }
+        else if( isa( right, &amp;t_float ) )
+        {
+            assert( rhs-&gt;s_meta == ae_meta_var );
+            emit-&gt;append( new Chuck_Instr_IO_in_float );
+	    return TRUE;
+        }
+        else if( isa( right, &amp;t_string ) )
+        {
+            assert( rhs-&gt;s_meta == ae_meta_var );
+            emit-&gt;append( new Chuck_Instr_IO_in_string );
+	    return TRUE;
+        }
+    }
 
-    // func call
+// func call
     if( isa( right, &amp;t_function ) )
     {
         assert( binary-&gt;ck_func != NULL );
@@ -2539,6 +2625,14 @@ t_CKBOOL emit_engine_emit_exp_primary( Chuck_Emitter * emit, a_Exp_Primary exp )
         {
             emit-&gt;append( new Chuck_Instr_Bunghole );
         }
+        else if( exp-&gt;var == insert_symbol( &quot;chout&quot; ) )
+        {
+            emit-&gt;append( new Chuck_Instr_Chout );
+        }
+        else if( exp-&gt;var == insert_symbol( &quot;cherr&quot; ) )
+        {
+            emit-&gt;append( new Chuck_Instr_Cherr );
+        }
         else if( emit-&gt;find_dur( S_name(exp-&gt;var), &amp;dur ) )
         {
             emit-&gt;append( new Chuck_Instr_Reg_Push_Imm2( dur ) );</diff>
      <filename>src/chuck_emit.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -41,7 +41,7 @@
 
 
 // current version
-const char CK_VERSION[] = &quot;1.2.1.2 (dracula)&quot;;
+const char CK_VERSION[] = &quot;1.2.1.3 (dracula)&quot;;
 
 // global virtual machine
 Chuck_VM * g_vm = NULL;
@@ -87,12 +87,18 @@ extern &quot;C&quot; void all_detach()
     EM_pushlog();
     // close stk file handles
     stk_detach( 0, NULL );
+#ifndef __DISABLE_MIDI__
     // close midi file handles
     midirw_detach();
+#endif // __DISABLE_MIDI__
+#ifndef __DISABLE_KBHIT__
     // shutdown kb loop
     KBHitManager::shutdown();
+#endif // __DISABLE_KBHIT__
+#ifndef __ALTER_HID__
     // shutdown HID
     HidInManager::cleanup();
+#endif // __ALTER_HID__
     // pop
     EM_poplog();
 }</diff>
      <filename>src/chuck_globals.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -41,6 +41,7 @@
 #include &quot;chuck_bbq.h&quot;
 #include &quot;chuck_dl.h&quot;
 #include &quot;chuck_errmsg.h&quot;
+#include &quot;chuck_globals.h&quot;
 
 #include &quot;util_string.h&quot;
 
@@ -2050,6 +2051,54 @@ void Chuck_Instr_Branch_Neq_double::execute( Chuck_VM * vm, Chuck_VM_Shred * shr
 // name: execute()
 // desc: ...
 //-----------------------------------------------------------------------------
+void Chuck_Instr_Branch_Eq_int_IO_good::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
+{
+    t_CKINT *&amp; sp = (t_CKINT *&amp;)shred-&gt;reg-&gt;sp;
+    Chuck_IO **&amp; ppIO = (Chuck_IO **&amp;)shred-&gt;reg-&gt;sp;
+    t_CKINT result = 0;
+    pop_( sp, 2 );
+
+    if( (*ppIO) != NULL )
+    {
+        // TODO: verify this logic
+        result = (*ppIO)-&gt;good() &amp;&amp; !(*ppIO)-&gt;eof();
+    }
+
+    if( result == val_(sp+1) || !(*ppIO) )
+        shred-&gt;next_pc = m_jmp;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// name: execute()
+// desc: ...
+//-----------------------------------------------------------------------------
+void Chuck_Instr_Branch_Neq_int_IO_good::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
+{
+    t_CKINT *&amp; sp = (t_CKINT *&amp;)shred-&gt;reg-&gt;sp;
+    Chuck_IO **&amp; ppIO = (Chuck_IO **&amp;)shred-&gt;reg-&gt;sp;
+    t_CKINT result = 0;
+    pop_( sp, 2 );
+
+    if( (*ppIO) != NULL )
+    {
+        // TODO: verify this logic
+        t_CKINT result = (*ppIO)-&gt;good() &amp;&amp; !(*ppIO)-&gt;eof();
+    }
+
+    if( result != val_(sp+1) || !(ppIO) )
+        shred-&gt;next_pc = m_jmp;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// name: execute()
+// desc: ...
+//-----------------------------------------------------------------------------
 void Chuck_Instr_Binary_And::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
 {
     t_CKUINT *&amp; sp = (t_CKUINT *&amp;)shred-&gt;reg-&gt;sp;
@@ -2707,6 +2756,8 @@ Chuck_Object * instantiate_and_initialize_object( Chuck_Type * type, Chuck_VM_Sh
 {
     Chuck_Object * object = NULL;
     Chuck_UAna * uana = NULL;
+    // TODO: this is a hack!
+    Chuck_VM * vm_ref = shred ? shred-&gt;vm_ref : g_vm;
 
     // sanity
     assert( type != NULL );
@@ -2720,6 +2771,8 @@ Chuck_Object * instantiate_and_initialize_object( Chuck_Type * type, Chuck_VM_Sh
         else if( isa( type, &amp;t_string ) ) object = new Chuck_String;
         // TODO: is this ok?
         else if( isa( type, &amp;t_shred ) ) object = new Chuck_VM_Shred;
+        // TODO: is this ok?
+        else if( isa( type, &amp;t_fileio ) ) object = new Chuck_IO_File;
         else object = new Chuck_Object;
     }
     else
@@ -2731,10 +2784,12 @@ Chuck_Object * instantiate_and_initialize_object( Chuck_Type * type, Chuck_VM_Sh
         {
             // uana
             object = ugen = uana = new Chuck_UAna;
+            ugen-&gt;alloc_v( vm_ref-&gt;shreduler()-&gt;m_max_block_size );
         }
         else 
         {
             object = ugen = new Chuck_UGen;
+            ugen-&gt;alloc_v( vm_ref-&gt;shreduler()-&gt;m_max_block_size );
         }
 
         if( shred )
@@ -4338,7 +4393,7 @@ void Chuck_Instr_Array_Append::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
 {
     // reg stack pointer
     t_CKUINT *&amp; sp = (t_CKUINT *&amp;)shred-&gt;reg-&gt;sp;
-    t_CKINT i = 0;
+    // t_CKINT i = 0;
     t_CKUINT val = 0;
     t_CKFLOAT fval = 0;
     t_CKCOMPLEX cval;
@@ -4596,7 +4651,7 @@ void Chuck_Instr_Dot_Cmp_First::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
         pop_( sp, 1 );
         // push the addr on
         if( m_emit_addr ) {
-            t_CKFLOAT a = (*(t_CKCOMPLEX **)sp)-&gt;re;
+            // t_CKFLOAT a = (*(t_CKCOMPLEX **)sp)-&gt;re;
             push_( sp, (t_CKUINT)(&amp;((*(t_CKCOMPLEX **)sp)-&gt;re)) );
         } else {
             push_float( sp, (*(t_CKCOMPLEX **)sp)-&gt;re );
@@ -4932,6 +4987,32 @@ void Chuck_Instr_Bunghole::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
 
 
 //-----------------------------------------------------------------------------
+// name: execute()
+// desc: ...
+//-----------------------------------------------------------------------------
+void Chuck_Instr_Chout::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
+{
+    t_CKUINT *&amp; reg_sp = (t_CKUINT *&amp;)shred-&gt;reg-&gt;sp;
+    push_( reg_sp, (t_CKUINT)Chuck_IO_Chout::getInstance() );
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// name: execute()
+// desc: ...
+//-----------------------------------------------------------------------------
+void Chuck_Instr_Cherr::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
+{
+    t_CKUINT *&amp; reg_sp = (t_CKUINT *&amp;)shred-&gt;reg-&gt;sp;
+    push_( reg_sp, (t_CKUINT)Chuck_IO_Cherr::getInstance() );
+}
+
+
+
+
+//-----------------------------------------------------------------------------
 // name: Chuck_Instr_UGen_Link()
 // desc: ...
 //-----------------------------------------------------------------------------
@@ -5127,6 +5208,37 @@ void Chuck_Instr_Init_Loop_Counter::execute( Chuck_VM * vm, Chuck_VM_Shred * shr
 //-----------------------------------------------------------------------------
 void Chuck_Instr_IO_in_int::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
 {
+    t_CKINT *&amp; sp = (t_CKINT *&amp;)shred-&gt;reg-&gt;sp;
+    
+    // pop the value
+    pop_( sp, 2 );
+    
+    // issue: 64-bit
+    // the IO
+    Chuck_IO **&amp; ppIO = (Chuck_IO **&amp;)sp;
+
+    // check it
+    if( *(ppIO) == NULL ) goto null_pointer;
+    
+    // read into the variable
+    **(t_CKINT **)(sp+1) = (*ppIO)-&gt;readInt( Chuck_IO::READ_INT32 );
+    
+    // push the IO
+    push_( sp, (t_CKINT)(*(ppIO)) );
+    
+    return;
+
+null_pointer:
+    // we have a problem
+    fprintf( stderr, 
+        &quot;[chuck](VM): NullPointerException: (IO input int) in shred[id=%d:%s], PC=[%d]\n&quot;,
+        shred-&gt;xid, shred-&gt;name.c_str(), shred-&gt;pc );
+    goto done;
+
+done:
+    // do something!
+    shred-&gt;is_running = FALSE;
+    shred-&gt;is_done = TRUE;
 }
 
 
@@ -5138,6 +5250,37 @@ void Chuck_Instr_IO_in_int::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
 //-----------------------------------------------------------------------------
 void Chuck_Instr_IO_in_float::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
 {
+    t_CKINT *&amp; sp = (t_CKINT *&amp;)shred-&gt;reg-&gt;sp;
+    
+    // issue: 64-bit
+    // pop the value
+    pop_( sp, 3 );
+    
+    // the IO
+    Chuck_IO **&amp; ppIO = (Chuck_IO **&amp;)sp;
+    
+    // check it
+    if( *(ppIO) == NULL ) goto null_pointer;
+    
+    // read into the variable
+    **(t_CKFLOAT **)(sp+1) = (*ppIO)-&gt;readFloat();
+    
+    // push the IO
+    push_( sp, (t_CKINT)(*(ppIO)) );
+    
+    return;
+
+null_pointer:
+    // we have a problem
+    fprintf( stderr, 
+        &quot;[chuck](VM): NullPointerException: (IO input float) in shred[id=%d:%s], PC=[%d]\n&quot;,
+        shred-&gt;xid, shred-&gt;name.c_str(), shred-&gt;pc );
+    goto done;
+
+done:
+    // do something!
+    shred-&gt;is_running = FALSE;
+    shred-&gt;is_done = TRUE;
 }
 
 
@@ -5149,6 +5292,39 @@ void Chuck_Instr_IO_in_float::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
 //-----------------------------------------------------------------------------
 void Chuck_Instr_IO_in_string::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
 {
+    t_CKINT *&amp; sp = (t_CKINT *&amp;)shred-&gt;reg-&gt;sp;
+    
+    // pop the value
+    pop_( sp, 2 );
+    
+    // issue: 64-bit
+    // the IO
+    Chuck_IO ** ppIO = (Chuck_IO **)sp;
+    // the string
+    Chuck_String *** ppStr = (Chuck_String ***)(sp+1);
+    
+    // check it
+    if( *(ppIO) == NULL || **(ppStr) == NULL ) goto null_pointer;
+    
+    // read into the variable
+    (*ppIO)-&gt;readString( (**ppStr)-&gt;str );
+    
+    // push the IO
+    push_( sp, (t_CKINT)(*(ppIO)) );
+    
+    return;
+    
+null_pointer:
+    // we have a problem
+    fprintf( stderr, 
+            &quot;[chuck](VM): NullPointerException: (IO input string) in shred[id=%d:%s], PC=[%d]\n&quot;,
+            shred-&gt;xid, shred-&gt;name.c_str(), shred-&gt;pc );
+    goto done;
+    
+done:
+    // do something!
+    shred-&gt;is_running = FALSE;
+    shred-&gt;is_done = TRUE;
 }
 
 
@@ -5160,6 +5336,37 @@ void Chuck_Instr_IO_in_string::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
 //-----------------------------------------------------------------------------
 void Chuck_Instr_IO_out_int::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
 {
+    t_CKINT *&amp; sp = (t_CKINT *&amp;)shred-&gt;reg-&gt;sp;
+        
+    // pop the value
+    pop_( sp, 2 );
+        
+    // issue: 64-bit
+    // the IO
+    Chuck_IO **&amp; ppIO = (Chuck_IO **&amp;)sp;
+        
+    // check it
+    if( *(ppIO) == NULL ) goto null_pointer;
+        
+    // write the value
+    (*ppIO)-&gt;write( *(sp+1) );
+        
+    // push the IO
+    push_( sp, (t_CKINT)(*(ppIO)) );
+        
+    return;
+
+null_pointer:
+    // we have a problem
+    fprintf( stderr, 
+        &quot;[chuck](VM): NullPointerException: (IO output int) in shred[id=%d:%s], PC=[%d]\n&quot;,
+        shred-&gt;xid, shred-&gt;name.c_str(), shred-&gt;pc );
+    goto done;
+        
+done:
+    // do something!
+    shred-&gt;is_running = FALSE;
+    shred-&gt;is_done = TRUE;
 }
 
 
@@ -5171,6 +5378,37 @@ void Chuck_Instr_IO_out_int::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
 //-----------------------------------------------------------------------------
 void Chuck_Instr_IO_out_float::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
 {
+    t_CKINT *&amp; sp = (t_CKINT *&amp;)shred-&gt;reg-&gt;sp;
+    
+    // pop the value
+    pop_( sp, 3 );
+    
+    // issue: 64-bit
+    // the IO
+    Chuck_IO **&amp; ppIO = (Chuck_IO **&amp;)sp;
+    
+    // check it
+    if( *(ppIO) == NULL ) goto null_pointer;
+    
+    // write the value
+    (*ppIO)-&gt;write( *((t_CKFLOAT *)(sp+1)) );
+    
+    // push the IO
+    push_( sp, (t_CKINT)(*(ppIO)) );
+    
+    return;
+    
+null_pointer:
+    // we have a problem
+    fprintf( stderr, 
+            &quot;[chuck](VM): NullPointerException: (IO output float) in shred[id=%d:%s], PC=[%d]\n&quot;,
+            shred-&gt;xid, shred-&gt;name.c_str(), shred-&gt;pc );
+    goto done;
+    
+done:
+    // do something!
+    shred-&gt;is_running = FALSE;
+    shred-&gt;is_done = TRUE;
 }
 
 
@@ -5182,6 +5420,39 @@ void Chuck_Instr_IO_out_float::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
 //-----------------------------------------------------------------------------
 void Chuck_Instr_IO_out_string::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
 {
+    t_CKINT *&amp; sp = (t_CKINT *&amp;)shred-&gt;reg-&gt;sp;
+    
+    // pop the value
+    pop_( sp, 2 );
+    
+    // issue: 64-bit
+    // the IO
+    Chuck_IO ** ppIO = (Chuck_IO **)sp;
+    // the string
+    Chuck_String ** ppStr = (Chuck_String **)(sp+1);
+    
+    // check it
+    if( *(ppIO) == NULL || *(ppStr) == NULL ) goto null_pointer;
+    
+    // write the variable
+    (*ppIO)-&gt;write( (*ppStr)-&gt;str.c_str() );
+    
+    // push the IO
+    push_( sp, (t_CKINT)(*(ppIO)) );
+    
+    return;
+    
+null_pointer:
+    // we have a problem
+    fprintf( stderr, 
+            &quot;[chuck](VM): NullPointerException: (IO output string) in shred[id=%d:%s], PC=[%d]\n&quot;,
+            shred-&gt;xid, shred-&gt;name.c_str(), shred-&gt;pc );
+    goto done;
+    
+done:
+    // do something!
+    shred-&gt;is_running = FALSE;
+    shred-&gt;is_done = TRUE;
 }
 
 </diff>
      <filename>src/chuck_instr.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -1093,6 +1093,34 @@ public:
 
 
 //-----------------------------------------------------------------------------
+// name: struct Chuck_Instr_Branch_Eq_int_IO_good
+// desc: ...
+//-----------------------------------------------------------------------------
+struct Chuck_Instr_Branch_Eq_int_IO_good : public Chuck_Instr_Branch_Op
+{
+public:
+    Chuck_Instr_Branch_Eq_int_IO_good( t_CKUINT jmp ) { this-&gt;set( jmp ); }
+    virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
+};
+
+
+
+
+//-----------------------------------------------------------------------------
+// name: struct Chuck_Instr_Branch_Neq_int_IO_good
+// desc: ...
+//-----------------------------------------------------------------------------
+struct Chuck_Instr_Branch_Neq_int_IO_good : public Chuck_Instr_Branch_Op
+{
+public:
+    Chuck_Instr_Branch_Neq_int_IO_good( t_CKUINT jmp ) { this-&gt;set( jmp ); }
+    virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
+};
+
+
+
+
+//-----------------------------------------------------------------------------
 // name: struct Chuck_Instr_Lt_int
 // desc: ...
 //-----------------------------------------------------------------------------
@@ -2743,6 +2771,32 @@ public:
 
 
 //-----------------------------------------------------------------------------
+// name: struct Chuck_Instr_Chout
+// desc: ...
+//-----------------------------------------------------------------------------
+struct Chuck_Instr_Chout : public Chuck_Instr
+{
+public:
+    virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
+};
+
+
+
+
+//-----------------------------------------------------------------------------
+// name: struct Chuck_Instr_Cherr
+// desc: ...
+//-----------------------------------------------------------------------------
+struct Chuck_Instr_Cherr : public Chuck_Instr
+{
+public:
+    virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
+};
+
+
+
+
+//-----------------------------------------------------------------------------
 // name: struct Chuck_Instr_UGen_Link
 // desc: ...
 //-----------------------------------------------------------------------------</diff>
      <filename>src/chuck_instr.h</filename>
    </modified>
    <modified>
      <diff>@@ -28,6 +28,8 @@
 //
 // authors: Ge Wang (gewang@cs.princeton.edu)
 //          Perry R. Cook (prc@cs.princeton.edu)
+//          Spencer Salazar (ssalazar@cs.princeton.edu)
+//          Andrew Schran (aschran@princeton.edu)
 //    date: spring 2005
 //-----------------------------------------------------------------------------
 #include &quot;chuck_lang.h&quot;
@@ -36,10 +38,14 @@
 #include &quot;chuck_vm.h&quot;
 #include &quot;chuck_errmsg.h&quot;
 #include &quot;chuck_ugen.h&quot;
-#include &quot;midiio_rtmidi.h&quot;
+#include &quot;chuck_globals.h&quot;
 #include &quot;hidio_sdl.h&quot;
 #include &quot;util_string.h&quot;
 
+#ifndef __DISABLE_MIDI__
+#include &quot;midiio_rtmidi.h&quot;
+#endif
+
 #include &lt;iostream&gt;
 #include &lt;iomanip&gt;
 #include &lt;sstream&gt;
@@ -50,6 +56,11 @@ CK_DLL_TICK(__ugen_tick) { *out = in; return TRUE; }
 // object string offset
 static t_CKUINT Object_offset_string = 0;
 
+// global
+static Chuck_String * g_newline = new Chuck_String();
+
+
+
 
 //-----------------------------------------------------------------------------
 // name: init_class_object()
@@ -455,7 +466,6 @@ error:
 
 
 
-static t_CKUINT io_offset_args = 0;
 //-----------------------------------------------------------------------------
 // name: init_class_io()
 // desc: ...
@@ -464,98 +474,116 @@ t_CKBOOL init_class_io( Chuck_Env * env, Chuck_Type * type )
 {
     // init as base class
     Chuck_DL_Func * func = NULL;
-
+    
     // log
     EM_log( CK_LOG_SEVERE, &quot;class 'io'&quot; );
-
+    
     // init as base class
     // TODO: ctor/dtor?
     // TODO: replace dummy with pure function
     if( !type_engine_import_class_begin( env, type, env-&gt;global(), NULL, NULL ) )
         return FALSE;
     
-    // add more()
-    func = make_new_mfun( &quot;int&quot;, &quot;more&quot;, io_dummy );
-    if( !type_engine_import_mfun( env, func ) ) goto error;
-
-    // add eof()
-    func = make_new_mfun( &quot;int&quot;, &quot;eof&quot;, io_dummy );
-    if( !type_engine_import_mfun( env, func ) ) goto error;
-
     // add good()
     func = make_new_mfun( &quot;int&quot;, &quot;good&quot;, io_dummy );
     if( !type_engine_import_mfun( env, func ) ) goto error;
-    
-    // add good2read()
-    func = make_new_mfun( &quot;int&quot;, &quot;good2read&quot;, io_dummy );
-    if( !type_engine_import_mfun( env, func ) ) goto error;
-
-    // add good2write()
-    func = make_new_mfun( &quot;int&quot;, &quot;good2write&quot;, io_dummy );
-    if( !type_engine_import_mfun( env, func ) ) goto error;
 
     // add close()
     func = make_new_mfun( &quot;void&quot;, &quot;close&quot;, io_dummy );
     if( !type_engine_import_mfun( env, func ) ) goto error;
 
-    // add readInt
-    func = make_new_mfun( &quot;int&quot;, &quot;readInt&quot;, io_dummy );
+    // add flush()
+    func = make_new_mfun( &quot;void&quot;, &quot;flush&quot;, io_dummy );
     if( !type_engine_import_mfun( env, func ) ) goto error;
-
-    // add readFloat
-    func = make_new_mfun( &quot;float&quot;, &quot;readFloat&quot;, io_dummy );
+    
+    // add mode(int)
+    func = make_new_mfun( &quot;int&quot;, &quot;mode&quot;, io_dummy );
+    func-&gt;add_arg( &quot;int&quot;, &quot;flag&quot; );
     if( !type_engine_import_mfun( env, func ) ) goto error;
-
-    // add readString
-    func = make_new_mfun( &quot;string&quot;, &quot;readString&quot;, io_dummy );
+    
+    // add mode()
+    func = make_new_mfun( &quot;int&quot;, &quot;mode&quot;, io_dummy );
     if( !type_engine_import_mfun( env, func ) ) goto error;
-
-    // add readLine
+    
+	// TODO: add this later?
+    // add read()
+    // func = make_new_mfun( &quot;string&quot;, &quot;read&quot;, io_dummy );
+    // func-&gt;add_arg( &quot;int&quot;, &quot;length&quot; );
+    // if( !type_engine_import_mfun( env, func ) ) goto error;
+    
+    // add readLine()
     func = make_new_mfun( &quot;string&quot;, &quot;readLine&quot;, io_dummy );
     if( !type_engine_import_mfun( env, func ) ) goto error;
-
-    // add writeInt
-    func = make_new_mfun( &quot;void&quot;, &quot;writeInt&quot;, io_dummy );
-    func-&gt;add_arg( &quot;int&quot;, &quot;val&quot; );
+    
+    // add readInt()
+    func = make_new_mfun( &quot;int&quot;, &quot;readInt&quot;, io_dummy );
+    func-&gt;add_arg( &quot;int&quot;, &quot;flags&quot; );
     if( !type_engine_import_mfun( env, func ) ) goto error;
-
-    // add writeFloat
-    func = make_new_mfun( &quot;void&quot;, &quot;writeFloat&quot;, io_dummy );
-    func-&gt;add_arg( &quot;float&quot;, &quot;val&quot; );
+    
+    // add readFloat()
+    // func = make_new_mfun( &quot;float&quot;, &quot;readFloat&quot;, io_dummy );
+    // if( !type_engine_import_mfun( env, func ) ) goto error;
+    
+    // add eof()
+    func = make_new_mfun( &quot;int&quot;, &quot;eof&quot;, io_dummy );
     if( !type_engine_import_mfun( env, func ) ) goto error;
 
-    // add writeString
-    func = make_new_mfun( &quot;void&quot;, &quot;writeString&quot;, io_dummy );
+    // add more()
+    func = make_new_mfun( &quot;int&quot;, &quot;more&quot;, io_dummy );
+    if( !type_engine_import_mfun( env, func ) ) goto error;    
+    
+    // add write(string)
+    func = make_new_mfun( &quot;void&quot;, &quot;write&quot;, io_dummy );
     func-&gt;add_arg( &quot;string&quot;, &quot;val&quot; );
     if( !type_engine_import_mfun( env, func ) ) goto error;
-
-    // add writeLine
-    func = make_new_mfun( &quot;string&quot;, &quot;writeLine&quot;, io_dummy );
-    func-&gt;add_arg( &quot;string&quot;, &quot;line&quot; );
+    
+    // add write(int)
+    func = make_new_mfun( &quot;void&quot;, &quot;write&quot;, io_dummy );
+    func-&gt;add_arg( &quot;int&quot;, &quot;val&quot; );
     if( !type_engine_import_mfun( env, func ) ) goto error;
-
-    // add READ
-    if( !type_engine_import_svar( env, &quot;int&quot;, &quot;READ&quot;, TRUE, (t_CKUINT)&amp;Chuck_IO::READ ) ) goto error;
-
-    // add WRITE
-    if( !type_engine_import_svar( env, &quot;int&quot;, &quot;WRITE&quot;, TRUE, (t_CKUINT)&amp;Chuck_IO::WRITE ) ) goto error;
-
-    // add APPEND
-    if( !type_engine_import_svar( env, &quot;int&quot;, &quot;APPEND&quot;, TRUE, (t_CKUINT)&amp;Chuck_IO::APPEND ) ) goto error;
-
-    // add TRUNCATE
-    if( !type_engine_import_svar( env, &quot;int&quot;, &quot;TRUNCATE&quot;, TRUE, (t_CKUINT)&amp;Chuck_IO::TRUNCATE) ) goto error;
-
-    // add BINARY
-    if( !type_engine_import_svar( env, &quot;int&quot;, &quot;BINARY&quot;, TRUE, (t_CKUINT)&amp;Chuck_IO::BINARY ) ) goto error;
-
+    
+    // add write(float)
+    func = make_new_mfun( &quot;void&quot;, &quot;write&quot;, io_dummy );
+    func-&gt;add_arg( &quot;float&quot;, &quot;val&quot; );
+    if( !type_engine_import_mfun( env, func ) ) goto error;
+    
+    // add newline
+    func = make_new_sfun( &quot;string&quot;, &quot;newline&quot;, io_newline );
+    if( !type_engine_import_sfun( env, func ) ) goto error;
+    func = make_new_sfun( &quot;string&quot;, &quot;nl&quot;, io_newline );
+    if( !type_engine_import_sfun( env, func ) ) goto error;
+    func = make_new_sfun( &quot;string&quot;, &quot;newlineEx2VistaHWNDVisualFoxProA&quot;, io_newline );
+    if( !type_engine_import_sfun( env, func ) ) goto error;
+    initialize_object( g_newline, &amp;t_string );
+    g_newline-&gt;str = &quot;\n&quot;;
+    
+    // add READ_INT32
+    if( !type_engine_import_svar( env, &quot;int&quot;, &quot;READ_INT32&quot;,
+                                 TRUE, (t_CKUINT)&amp;Chuck_IO::READ_INT32 ) ) goto error;
+    
+    // add READ_INT16
+    if( !type_engine_import_svar( env, &quot;int&quot;, &quot;READ_INT16&quot;,
+                                 TRUE, (t_CKUINT)&amp;Chuck_IO::READ_INT16 ) ) goto error;
+    
+    // add READ_INT8
+    if( !type_engine_import_svar( env, &quot;int&quot;, &quot;READ_INT8&quot;,
+                                 TRUE, (t_CKUINT)&amp;Chuck_IO::READ_INT8 ) ) goto error;
+    
+    // add MODE_SYNC
+    if( !type_engine_import_svar( env, &quot;int&quot;, &quot;MODE_SYNC&quot;,
+                                 TRUE, (t_CKUINT)&amp;Chuck_IO::MODE_SYNC ) ) goto error;
+    
+    // add MODE_ASYNC
+    if( !type_engine_import_svar( env, &quot;int&quot;, &quot;MODE_ASYNC&quot;,
+                                 TRUE, (t_CKUINT)&amp;Chuck_IO::MODE_ASYNC ) ) goto error;
+    
     // end the class import
     type_engine_import_class_end( env );
-
+    
     return TRUE;
-
+    
 error:
-
+    
     // end the class import
     type_engine_import_class_end( env );
     
@@ -573,83 +601,145 @@ t_CKBOOL init_class_fileio( Chuck_Env * env, Chuck_Type * type )
 {
     // init as base class
     Chuck_DL_Func * func = NULL;
-
+    
     // log
     EM_log( CK_LOG_SEVERE, &quot;class 'fileio'&quot; );
-
+    
     // init as base class
     // TODO: ctor/dtor?
     // TODO: replace dummy with pure function
     if( !type_engine_import_class_begin( env, type, env-&gt;global(), fileio_ctor, fileio_dtor ) )
         return FALSE;
     
-    // add more()
-    func = make_new_mfun( &quot;int&quot;, &quot;more&quot;, fileio_more );
+    // add open(string)
+    func = make_new_mfun( &quot;int&quot;, &quot;open&quot;, fileio_open );
+    func-&gt;add_arg( &quot;string&quot;, &quot;path&quot; );
     if( !type_engine_import_mfun( env, func ) ) goto error;
-
-    // add eof()
-    func = make_new_mfun( &quot;int&quot;, &quot;eof&quot;, fileio_eof );
+    
+    // add open(string, flags)
+    func = make_new_mfun( &quot;int&quot;, &quot;open&quot;, fileio_openflags );
+    func-&gt;add_arg( &quot;string&quot;, &quot;path&quot; );
+    func-&gt;add_arg( &quot;int&quot;, &quot;flags&quot; );
     if( !type_engine_import_mfun( env, func ) ) goto error;
-
+    
     // add good()
     func = make_new_mfun( &quot;int&quot;, &quot;good&quot;, fileio_good );
     if( !type_engine_import_mfun( env, func ) ) goto error;
     
-    // add good2read()
-    func = make_new_mfun( &quot;int&quot;, &quot;good2read&quot;, fileio_good2read );
-    if( !type_engine_import_mfun( env, func ) ) goto error;
-
-    // add good2write()
-    func = make_new_mfun( &quot;int&quot;, &quot;good2write&quot;, fileio_good2write );
-    if( !type_engine_import_mfun( env, func ) ) goto error;
-
     // add close()
     func = make_new_mfun( &quot;void&quot;, &quot;close&quot;, fileio_close );
     if( !type_engine_import_mfun( env, func ) ) goto error;
-
-    // add readInt
-    func = make_new_mfun( &quot;int&quot;, &quot;readInt&quot;, fileio_readint );
+    
+    // add flush()
+    func = make_new_mfun( &quot;void&quot;, &quot;flush&quot;, fileio_flush );
     if( !type_engine_import_mfun( env, func ) ) goto error;
-
-    // add readFloat
-    func = make_new_mfun( &quot;float&quot;, &quot;readFloat&quot;, fileio_readfloat );
+    
+    // add mode()
+    func = make_new_mfun( &quot;int&quot;, &quot;mode&quot;, fileio_getmode );
     if( !type_engine_import_mfun( env, func ) ) goto error;
-
-    // add readString
-    func = make_new_mfun( &quot;string&quot;, &quot;readString&quot;, fileio_readstring );
+    
+    // add mode(int)
+    func = make_new_mfun( &quot;int&quot;, &quot;mode&quot;, fileio_setmode );
+    func-&gt;add_arg( &quot;int&quot;, &quot;flag&quot; );
     if( !type_engine_import_mfun( env, func ) ) goto error;
-
-    // add readLine
+    
+    // add size()
+    func = make_new_mfun( &quot;int&quot;, &quot;size&quot;, fileio_size );
+    if( !type_engine_import_mfun( env, func ) ) goto error;
+    
+    // add seek(int)
+    func = make_new_mfun( &quot;void&quot;, &quot;seek&quot;, fileio_seek );
+    func-&gt;add_arg( &quot;int&quot;, &quot;pos&quot; );
+    if( !type_engine_import_mfun( env, func ) ) goto error;
+    
+    // add tell()
+    func = make_new_mfun( &quot;int&quot;, &quot;tell&quot;, fileio_tell );
+    if( !type_engine_import_mfun( env, func ) ) goto error;
+    
+    // add isDir()
+    func = make_new_mfun( &quot;int&quot;, &quot;isDir&quot;, fileio_isdir );
+    if( !type_engine_import_mfun( env, func ) ) goto error;
+    
+    // add dirList()
+    func = make_new_mfun( &quot;string[]&quot;, &quot;dirList&quot;, fileio_dirlist );
+    if( !type_engine_import_mfun( env, func ) ) goto error;
+    
+    // add read()
+    // func = make_new_mfun( &quot;string&quot;, &quot;read&quot;, fileio_read );
+    // func-&gt;add_arg( &quot;int&quot;, &quot;length&quot; );
+    // if( !type_engine_import_mfun( env, func ) ) goto error;
+    
+    // add readLine()
     func = make_new_mfun( &quot;string&quot;, &quot;readLine&quot;, fileio_readline );
     if( !type_engine_import_mfun( env, func ) ) goto error;
-
-    // add writeInt
-    func = make_new_mfun( &quot;void&quot;, &quot;writeInt&quot;, fileio_writeint );
-    func-&gt;add_arg( &quot;int&quot;, &quot;val&quot; );
+    
+    // add readInt()
+    // func = make_new_mfun( &quot;int&quot;, &quot;readInt&quot;, fileio_readint );
+    // if( !type_engine_import_mfun( env, func ) ) goto error;
+    
+    // add readInt(int)
+    func = make_new_mfun( &quot;int&quot;, &quot;readInt&quot;, fileio_readintflags );
+    func-&gt;add_arg( &quot;int&quot;, &quot;flags&quot; );
     if( !type_engine_import_mfun( env, func ) ) goto error;
-
-    // add writeFloat
-    func = make_new_mfun( &quot;void&quot;, &quot;writeFloat&quot;, fileio_writefloat );
-    func-&gt;add_arg( &quot;float&quot;, &quot;val&quot; );
+    
+    // add readFloat()
+    // func = make_new_mfun( &quot;float&quot;, &quot;readFloat&quot;, fileio_readfloat );
+    // if( !type_engine_import_mfun( env, func ) ) goto error;
+    
+    // add eof()
+    func = make_new_mfun( &quot;int&quot;, &quot;eof&quot;, fileio_eof );
+    if( !type_engine_import_mfun( env, func ) ) goto error;
+    
+    // add more()
+    func = make_new_mfun( &quot;int&quot;, &quot;more&quot;, fileio_more );
     if( !type_engine_import_mfun( env, func ) ) goto error;
 
-    // add writeString
-    func = make_new_mfun( &quot;void&quot;, &quot;writeString&quot;, fileio_writestring );
+    // add write(string)
+    func = make_new_mfun( &quot;void&quot;, &quot;write&quot;, fileio_writestring );
     func-&gt;add_arg( &quot;string&quot;, &quot;val&quot; );
     if( !type_engine_import_mfun( env, func ) ) goto error;
-
-    // add writeLine
-    func = make_new_mfun( &quot;string&quot;, &quot;writeLine&quot;, fileio_writeline );
-    func-&gt;add_arg( &quot;string&quot;, &quot;line&quot; );
+    
+    // add write(int)
+    func = make_new_mfun( &quot;void&quot;, &quot;write&quot;, fileio_writeint );
+    func-&gt;add_arg( &quot;int&quot;, &quot;val&quot; );
     if( !type_engine_import_mfun( env, func ) ) goto error;
-
+    
+    // add write(float)
+    func = make_new_mfun( &quot;void&quot;, &quot;write&quot;, fileio_writefloat );
+    func-&gt;add_arg( &quot;float&quot;, &quot;val&quot; );
+    if( !type_engine_import_mfun( env, func ) ) goto error;
+    
+    // add FLAG_READ_WRITE
+    if( !type_engine_import_svar( env, &quot;int&quot;, &quot;READ_WRITE&quot;,
+                                  TRUE, (t_CKUINT)&amp;Chuck_IO_File::FLAG_READ_WRITE ) ) goto error;
+    
+    // add FLAG_READONLY
+    if( !type_engine_import_svar( env, &quot;int&quot;, &quot;READ&quot;,
+                                  TRUE, (t_CKUINT)&amp;Chuck_IO_File::FLAG_READONLY ) ) goto error;
+    
+    // add FLAG_WRITEONLY
+    if( !type_engine_import_svar( env, &quot;int&quot;, &quot;WRITE&quot;,
+                                  TRUE, (t_CKUINT)&amp;Chuck_IO_File::FLAG_WRITEONLY ) ) goto error;
+    
+    // add FLAG_APPEND
+    if( !type_engine_import_svar( env, &quot;int&quot;, &quot;APPEND&quot;,
+                                  TRUE, (t_CKUINT)&amp;Chuck_IO_File::FLAG_APPEND ) ) goto error;
+    
+    // add TYPE_ASCII
+    if( !type_engine_import_svar( env, &quot;int&quot;, &quot;ASCII&quot;,
+                                  TRUE, (t_CKUINT)&amp;Chuck_IO_File::TYPE_ASCII ) ) goto error;
+    
+    // add TYPE_BINARY
+    if( !type_engine_import_svar( env, &quot;int&quot;, &quot;BINARY&quot;,
+                                  TRUE, (t_CKUINT)&amp;Chuck_IO_File::TYPE_BINARY ) ) goto error;
+    
     // end the class import
     type_engine_import_class_end( env );
     
     return TRUE;
-
+    
 error:
-
+    
     // end the class import
     type_engine_import_class_end( env );
     
@@ -801,6 +891,7 @@ error:
 
 
 
+#ifndef __DISABLE_MIDI__
 
 // static
 static t_CKUINT MidiIn_offset_data = 0;
@@ -936,6 +1027,8 @@ error:
     return FALSE;
 }
 
+#endif // __DISABLE_MIDI__
+
 
 
 
@@ -1130,6 +1223,11 @@ t_CKBOOL init_class_HID( Chuck_Env * env )
     func-&gt;add_arg( &quot;int&quot;, &quot;num&quot; );
     if( !type_engine_import_mfun( env, func ) ) goto error;
     
+    // add open()
+    func = make_new_mfun( &quot;int&quot;, &quot;open&quot;, HidIn_open_named );
+    func-&gt;add_arg( &quot;string&quot;, &quot;name&quot; );
+    if( !type_engine_import_mfun( env, func ) ) goto error;
+    
     // add openJoystick()
     func = make_new_mfun( &quot;int&quot;, &quot;openJoystick&quot;, HidIn_open_joystick );
     func-&gt;add_arg( &quot;int&quot;, &quot;num&quot; );
@@ -1358,6 +1456,8 @@ error:
 
 
 
+#ifndef __DISABLE_MIDI__
+
 // static
 static t_CKUINT MidiRW_offset_data = 0;
 static t_CKUINT MidiMsgOut_offset_data = 0;
@@ -1471,6 +1571,12 @@ error:
 }
 
 
+
+#endif // __DISABLE_MIDI__
+
+
+
+
 // Object ctor
 CK_DLL_CTOR( object_ctor )
 {
@@ -1995,6 +2101,11 @@ CK_DLL_MFUN( io_dummy )
     RETURN-&gt;v_int = 0;
 }
 
+CK_DLL_SFUN( io_newline )
+{
+    RETURN-&gt;v_string = g_newline;
+}
+
 
 //-----------------------------------------------------------------------------
 // FileIO API
@@ -2006,49 +2117,271 @@ CK_DLL_DTOR( fileio_dtor )
 { }
 
 CK_DLL_MFUN( fileio_open )
-{ }
+{
+    std::string filename = GET_NEXT_STRING(ARGS)-&gt;str;    
+    Chuck_IO_File * f = (Chuck_IO_File *)SELF;
+    t_CKINT default_flags =
+        Chuck_IO_File::FLAG_READ_WRITE | Chuck_IO_File::TYPE_ASCII;
 
-CK_DLL_MFUN( fileio_more )
-{ }
+    RETURN-&gt;v_int = f-&gt;open(filename, default_flags);
+}
 
-CK_DLL_MFUN( fileio_eof )
-{ }
+CK_DLL_MFUN( fileio_openflags )
+{
+    Chuck_IO_File * f = (Chuck_IO_File *)SELF;
+    std::string filename = GET_NEXT_STRING(ARGS)-&gt;str;
+    t_CKINT flags = GET_NEXT_INT(ARGS);
 
-CK_DLL_MFUN( fileio_good2read )
-{ }
+    RETURN-&gt;v_int = f-&gt;open(filename, flags);
+}
 
-CK_DLL_MFUN( fileio_good2write )
-{ }
+CK_DLL_MFUN( fileio_close )
+{
+    Chuck_IO_File * f = (Chuck_IO_File *)SELF;
+    f-&gt;close();
+}
 
 CK_DLL_MFUN( fileio_good )
-{ }
+{
+    Chuck_IO_File * f = (Chuck_IO_File *)SELF;
+    RETURN-&gt;v_int = f-&gt;good();
+}
 
-CK_DLL_MFUN( fileio_close )
-{ }
+CK_DLL_MFUN( fileio_flush )
+{
+    Chuck_IO_File * f = (Chuck_IO_File *)SELF;
+    f-&gt;flush();
+}
+
+CK_DLL_MFUN( fileio_getmode )
+{
+    Chuck_IO_File * f = (Chuck_IO_File *)SELF;
+    RETURN-&gt;v_int = f-&gt;mode();
+}
+
+CK_DLL_MFUN( fileio_setmode )
+{
+    t_CKINT flag = GET_NEXT_INT(ARGS);
+    
+    Chuck_IO_File * f = (Chuck_IO_File *)SELF;
+    f-&gt;mode( flag );
+    RETURN-&gt;v_int = 0;
+}
+
+CK_DLL_MFUN( fileio_size )
+{
+    Chuck_IO_File * f = (Chuck_IO_File *)SELF;
+    RETURN-&gt;v_int = f-&gt;size();
+}
+
+CK_DLL_MFUN( fileio_seek )
+{
+    t_CKINT pos = GET_NEXT_INT(ARGS);
+    
+    Chuck_IO_File * f = (Chuck_IO_File *)SELF;
+    f-&gt;seek(pos);
+}
+
+CK_DLL_MFUN( fileio_tell )
+{
+    Chuck_IO_File * f = (Chuck_IO_File *)SELF;
+    RETURN-&gt;v_int = f-&gt;tell();
+}
+
+CK_DLL_MFUN( fileio_isdir )
+{
+    Chuck_IO_File * f = (Chuck_IO_File *)SELF;
+    RETURN-&gt;v_int = f-&gt;isDir();
+}
+
+CK_DLL_MFUN( fileio_dirlist )
+{
+    Chuck_IO_File * f = (Chuck_IO_File *)SELF;
+    Chuck_Array4 * a = f-&gt;dirList();
+    RETURN-&gt;v_object = a;
+}
+
+/*
+CK_DLL_MFUN( fileio_read )
+{
+    t_CKINT len = GET_NEXT_INT(ARGS);
+    Chuck_IO_File * f = (Chuck_IO_File *)SELF;
+    
+    Chuck_String * s = f-&gt;read( len );
+    RETURN-&gt;v_object = s;
+}
+*/
+
+CK_DLL_MFUN( fileio_readline )
+{
+    Chuck_IO_File * f = (Chuck_IO_File *)SELF;
+    Chuck_String * ret = f-&gt;readLine();
+    RETURN-&gt;v_object = ret;
+}
 
 CK_DLL_MFUN( fileio_readint )
-{ }
+{
+    Chuck_IO_File * f = (Chuck_IO_File *)SELF;
+    t_CKINT defaultflags = Chuck_IO::READ_INT32;
+    
+    /* (ATODO: doesn't look like asynchronous reading will work)
+     if (f-&gt;mode() == Chuck_IO::MODE_ASYNC)
+     {
+     // set up arguments
+     Chuck_IO::async_args *args = new Chuck_IO::async_args;
+     args-&gt;RETURN = (void *)RETURN;
+     args-&gt;fileio_obj = f;
+     args-&gt;intArg = defaultflags;
+     // set shred to wait for I/O completion
+     f-&gt;m_asyncEvent-&gt;wait( SHRED, g_vm );
+     // start thread
+     bool ret = f-&gt;m_thread-&gt;start( f-&gt;readInt_thread, (void *)args );
+     if (!ret) {
+     cerr &lt;&lt; &quot;m_thread-&gt;start failed; recreating m_thread&quot; &lt;&lt; endl;
+     delete f-&gt;m_thread;
+     f-&gt;m_thread = new XThread;
+     ret = f-&gt;m_thread-&gt;start( f-&gt;readInt_thread, (void *)args );
+     if (!ret) {
+     EM_error3( &quot;(FileIO): failed to start thread for asynchronous mode I/O&quot; );
+     }
+     }
+     } else {*/
+    t_CKINT ret = f-&gt;readInt( defaultflags );
+    RETURN-&gt;v_int = ret;
+    //}
+    // ATODO: Debug
+    //sleep(1);
+    //cerr &lt;&lt; &quot;fileio_readint exiting&quot; &lt;&lt; endl;
+}
+
+CK_DLL_MFUN( fileio_readintflags )
+{    
+    t_CKINT flags = GET_NEXT_INT(ARGS);
+    
+    Chuck_IO_File * f = (Chuck_IO_File *)SELF;
+    t_CKINT ret = f-&gt;readInt( flags );
+    
+    RETURN-&gt;v_int = ret;
+}
 
 CK_DLL_MFUN( fileio_readfloat )
-{ }
+{
+    Chuck_IO_File * f = (Chuck_IO_File *)SELF;
+    t_CKFLOAT ret = f-&gt;readFloat();
+    RETURN-&gt;v_float = ret;
+}
 
-CK_DLL_MFUN( fileio_readstring )
-{ }
+CK_DLL_MFUN( fileio_eof )
+{
+    Chuck_IO_File * f = (Chuck_IO_File *)SELF;
+    t_CKBOOL ret = f-&gt;eof();
+    RETURN-&gt;v_int = ret;
+}
 
-CK_DLL_MFUN( fileio_readline )
-{ }
+CK_DLL_MFUN( fileio_more )
+{
+    Chuck_IO_File * f = (Chuck_IO_File *)SELF;
+    t_CKBOOL ret = !f-&gt;eof();
+    RETURN-&gt;v_int = ret;
+}
+
+CK_DLL_MFUN( fileio_writestring )
+{
+    std::string val = GET_NEXT_STRING(ARGS)-&gt;str;
+    
+    Chuck_IO_File * f = (Chuck_IO_File *)SELF;
+    if (f-&gt;mode() == Chuck_IO::MODE_ASYNC)
+    {
+        // set up arguments
+        Chuck_IO::async_args *args = new Chuck_IO::async_args;
+        args-&gt;RETURN = (void *)RETURN;
+        args-&gt;fileio_obj = f;
+        args-&gt;stringArg = std::string(val);
+        // set shred to wait for I/O completion
+        // TODO: make sure using g_vm is OK
+        f-&gt;m_asyncEvent-&gt;wait( SHRED, g_vm );
+        // start thread
+        bool ret = f-&gt;m_thread-&gt;start( f-&gt;writeStr_thread, (void *)args );
+        if (!ret) {
+            // for some reason, the XThread object needs to be
+            // deleted and reconstructed every time after call #375
+            delete f-&gt;m_thread;
+            f-&gt;m_thread = new XThread;
+            ret = f-&gt;m_thread-&gt;start( f-&gt;writeStr_thread, (void *)args );
+            if (!ret) {
+                EM_error3( &quot;(FileIO): failed to start thread for asynchronous mode I/O&quot; );
+            }
+        }
+    } else {
+        f-&gt;write(val);
+    }
+}
 
 CK_DLL_MFUN( fileio_writeint )
-{ }
+{
+    t_CKINT val = GET_NEXT_INT(ARGS);
+    
+    Chuck_IO_File * f = (Chuck_IO_File *)SELF;
+    if (f-&gt;mode() == Chuck_IO::MODE_ASYNC)
+    {
+        // set up arguments
+        Chuck_IO::async_args *args = new Chuck_IO::async_args;
+        args-&gt;RETURN = (void *)RETURN;
+        args-&gt;fileio_obj = f;
+        args-&gt;intArg = val;
+        // set shred to wait for I/O completion
+        // TODO: make sure using g_vm is OK
+        f-&gt;m_asyncEvent-&gt;wait( SHRED, g_vm );
+        // start thread
+        bool ret = f-&gt;m_thread-&gt;start( f-&gt;writeInt_thread, (void *)args );
+        if (!ret) {
+            // for some reason, the XThread object needs to be
+            // deleted and reconstructed every time after call #375
+            delete f-&gt;m_thread;
+            f-&gt;m_thread = new XThread;
+            ret = f-&gt;m_thread-&gt;start( f-&gt;writeInt_thread, (void *)args );
+            if (!ret) {
+                EM_error3( &quot;(FileIO): failed to start thread for asynchronous mode I/O&quot; );
+            }
+        }
+    } else {
+        f-&gt;write(val);
+    }
+}
 
 CK_DLL_MFUN( fileio_writefloat )
-{ }
+{
+    t_CKFLOAT val = GET_NEXT_FLOAT(ARGS);
+    
+    Chuck_IO_File * f = (Chuck_IO_File *)SELF;
+    if (f-&gt;mode() == Chuck_IO::MODE_ASYNC)
+    {
+        // set up arguments
+        Chuck_IO::async_args *args = new Chuck_IO::async_args;
+        args-&gt;RETURN = (void *)RETURN;
+        args-&gt;fileio_obj = f;
+        args-&gt;floatArg = val;
+        // set shred to wait for I/O completion
+        // TODO: make sure using g_vm is OK
+        f-&gt;m_asyncEvent-&gt;wait( SHRED, g_vm );
+        // start thread
+        bool ret = f-&gt;m_thread-&gt;start( f-&gt;writeFloat_thread, (void *)args );
+        if (!ret) {
+            // for some reason, the XThread object needs to be
+            // deleted and reconstructed every time after call #375
+            delete f-&gt;m_thread;
+            f-&gt;m_thread = new XThread;
+            ret = f-&gt;m_thread-&gt;start( f-&gt;writeFloat_thread, (void *)args );
+            if (!ret) {
+                EM_error3( &quot;(FileIO): failed to start thread for asynchronous mode I/O&quot; );
+            }
+        }
+    } else {
+        f-&gt;write(val);
+    }
+}
 
-CK_DLL_MFUN( fileio_writestring )
-{ }
 
-CK_DLL_MFUN( fileio_writeline )
-{ }
 
 
 //-----------------------------------------------------------------------------
@@ -2311,6 +2644,8 @@ CK_DLL_MFUN( array_pop_back )
 }
 
 
+#ifndef __DISABLE_MIDI__
+
 //-----------------------------------------------------------------------------
 // MidiIn API
 //-----------------------------------------------------------------------------
@@ -2448,6 +2783,7 @@ CK_DLL_MFUN( MidiOut_send )
     RETURN-&gt;v_int = mout-&gt;send( &amp;the_msg );
 }
 
+#endif // __DISABLE_MIDI__
 
 
 //-----------------------------------------------------------------------------
@@ -2513,6 +2849,13 @@ CK_DLL_MFUN( HidIn_open )
     RETURN-&gt;v_int = min-&gt;open( type, num );
 }
 
+CK_DLL_MFUN( HidIn_open_named )
+{
+    HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);
+    Chuck_String * name = GET_NEXT_STRING(ARGS);
+    RETURN-&gt;v_int = min-&gt;open( name-&gt;str );
+}
+
 CK_DLL_MFUN( HidIn_open_joystick )
 {
     HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);
@@ -2835,6 +3178,7 @@ CK_DLL_MFUN( HidOut_send )
 }
 
 
+#ifndef __DISABLE_MIDI__
 
 //-----------------------------------------------------------------------------
 // MidiRW API
@@ -2969,3 +3313,4 @@ CK_DLL_MFUN( MidiMsgIn_read )
     OBJ_MEMBER_TIME(fake_msg, MidiMsg_offset_when) = time;
 }
 
+#endif // __DISABLE_MIDI__</diff>
      <filename>src/chuck_lang.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -29,6 +29,7 @@
 // authors: Ge Wang (gewang@cs.princeton.edu)
 //          Perry R. Cook (prc@cs.princeton.edu)
 //          Ananya Misra (amisra@cs.princeton.edu)
+//          Andrew Schran (aschran@princeton.edu)
 //    date: spring 2005
 //-----------------------------------------------------------------------------
 #ifndef __CHUCK_LANG_H__
@@ -196,6 +197,7 @@ CK_DLL_MFUN( event_can_wait );
 // io API
 //-----------------------------------------------------------------------------
 CK_DLL_MFUN( io_dummy );
+CK_DLL_SFUN( io_newline );
 CK_DLL_SFUN( io_openfile );
 
 
@@ -205,20 +207,27 @@ CK_DLL_SFUN( io_openfile );
 CK_DLL_CTOR( fileio_ctor );
 CK_DLL_DTOR( fileio_dtor );
 CK_DLL_MFUN( fileio_open );
-CK_DLL_MFUN( fileio_more );
-CK_DLL_MFUN( fileio_eof );
-CK_DLL_MFUN( fileio_good2read );
-CK_DLL_MFUN( fileio_good2write );
+CK_DLL_MFUN( fileio_openflags );
 CK_DLL_MFUN( fileio_good );
 CK_DLL_MFUN( fileio_close );
+CK_DLL_MFUN( fileio_flush );
+CK_DLL_MFUN( fileio_getmode );
+CK_DLL_MFUN( fileio_setmode );
+CK_DLL_MFUN( fileio_size );
+CK_DLL_MFUN( fileio_seek );
+CK_DLL_MFUN( fileio_tell );
+CK_DLL_MFUN( fileio_isdir );
+CK_DLL_MFUN( fileio_dirlist );
+CK_DLL_MFUN( fileio_read );
+CK_DLL_MFUN( fileio_readline );
 CK_DLL_MFUN( fileio_readint );
+CK_DLL_MFUN( fileio_readintflags );
 CK_DLL_MFUN( fileio_readfloat );
-CK_DLL_MFUN( fileio_readstring );
-CK_DLL_MFUN( fileio_readline );
+CK_DLL_MFUN( fileio_eof );
+CK_DLL_MFUN( fileio_more );
+CK_DLL_MFUN( fileio_writestring );
 CK_DLL_MFUN( fileio_writeint );
 CK_DLL_MFUN( fileio_writefloat );
-CK_DLL_MFUN( fileio_writestring );
-CK_DLL_MFUN( fileio_writeline );
 
 
 //-----------------------------------------------------------------------------
@@ -334,6 +343,7 @@ CK_DLL_MFUN( HidMsg_is_wheel_motion );
 CK_DLL_CTOR( HidIn_ctor );
 CK_DLL_DTOR( HidIn_dtor );
 CK_DLL_MFUN( HidIn_open );
+CK_DLL_MFUN( HidIn_open_named );
 CK_DLL_MFUN( HidIn_open_joystick );
 CK_DLL_MFUN( HidIn_open_mouse );
 CK_DLL_MFUN( HidIn_open_keyboard );</diff>
      <filename>src/chuck_lang.h</filename>
    </modified>
    <modified>
      <diff>@@ -264,7 +264,11 @@ static void usage()
 // name: main()
 // desc: entry point
 //-----------------------------------------------------------------------------
-int main( int argc, const char ** argv )
+#ifndef __ALTER_ENTRY_POINT__
+  int main( int argc, const char ** argv )
+#else
+  extern &quot;C&quot; int chuck_main( int argc, const char ** argv )
+#endif
 {
     Chuck_Compiler * compiler = NULL;
     Chuck_VM * vm = NULL;
@@ -290,13 +294,16 @@ int main( int argc, const char ** argv )
     t_CKBOOL load_hid = FALSE;
     t_CKBOOL enable_server = TRUE;
     t_CKBOOL do_watchdog = TRUE;
+    t_CKINT  adaptive_size = 0;
     t_CKINT  log_level = CK_LOG_CORE;
     t_CKINT  deprecate_level = 1; // warn
 
     string   filename = &quot;&quot;;
     vector&lt;string&gt; args;
 
-#if defined(__MACOSX_CORE__)
+#if defined(__DISABLE_WATCHDOG__)
+    do_watchdog = FALSE;
+#elif defined(__MACOSX_CORE__)
     do_watchdog = TRUE;
 #elif defined(__PLATFORM_WIN32__) &amp;&amp; !defined(__WINDOWS_PTHREAD__)
     do_watchdog = TRUE;
@@ -398,6 +405,8 @@ int main( int argc, const char ** argv )
                 log_level = argv[i][9] ? atoi( argv[i]+9 ) : CK_LOG_INFO;
             else if( !strncmp(argv[i], &quot;-v&quot;, 2) )
                 log_level = argv[i][2] ? atoi( argv[i]+2 ) : CK_LOG_INFO;
+            else if( !strncmp(argv[i], &quot;--adaptive&quot;, 10) )
+                adaptive_size = argv[i][10] ? atoi( argv[i]+10 ) : -1;
             else if( !strncmp(argv[i], &quot;--deprecate&quot;, 11) )
             {
                 // get the rest
@@ -463,13 +472,15 @@ int main( int argc, const char ** argv )
     {
         Digitalio::probe();
 
+#ifndef __DISABLE_MIDI__
         EM_error2b( 0, &quot;&quot; );
         probeMidiIn();
         EM_error2b( 0, &quot;&quot; );
         probeMidiOut();
         EM_error2b( 0, &quot;&quot; );
-        
-        //HidInManager::probeHidIn();
+#endif  // __DISABLE_MIDI__
+
+        // HidInManager::probeHidIn();
         
         // exit
         exit( 0 );
@@ -486,6 +497,8 @@ int main( int argc, const char ** argv )
     Chuck_VM::our_priority = g_priority;
     // set watchdog
     g_do_watchdog = do_watchdog;
+    // set adaptive size
+    if( adaptive_size &lt; 0 ) adaptive_size = buffer_size;
 
     if ( !files &amp;&amp; vm_halt &amp;&amp; !enable_shell )
     {
@@ -519,7 +532,8 @@ int main( int argc, const char ** argv )
     // allocate the vm - needs the type system
     vm = g_vm = new Chuck_VM;
     if( !vm-&gt;initialize( enable_audio, vm_halt, srate, buffer_size,
-                         num_buffers, dac, adc, dac_chans, adc_chans, block ) )
+                         num_buffers, dac, adc, dac_chans, adc_chans,
+                         block, adaptive_size ) )
     {
         fprintf( stderr, &quot;[chuck]: %s\n&quot;, vm-&gt;last_error() );
         exit( 1 );
@@ -545,8 +559,10 @@ int main( int argc, const char ** argv )
         exit( 1 );
     }
 
+#ifndef __ALTER_HID__
     // pre-load hid
     if( load_hid ) HidInManager::init();
+#endif // __ALTER_HID__
 
     // catch SIGINT
     signal( SIGINT, signal_int );
@@ -656,6 +672,7 @@ int main( int argc, const char ** argv )
     // server
     if( enable_server )
     {
+#ifndef __DISABLE_OTF_SERVER__
         // log
         EM_log( CK_LOG_SYSTEM, &quot;starting listener on port: %d...&quot;, g_port );
 
@@ -675,6 +692,7 @@ int main( int argc, const char ** argv )
             g_tid_otf = CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE)otf_cb, NULL, 0, 0 );
     #endif
         }
+#endif // __DISABLE_OTF_SERVER__
     }
     else
     {</diff>
      <filename>src/chuck_main.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -29,6 +29,7 @@
 // author: Ge Wang (gewang@cs.princeton.edu)
 //         Perry R. Cook (prc@cs.princeton.edu)
 //         Ananya Misra (amisra@cs.princeton.edu)
+//         Andrew Schran (aschran@princeton.edu) - fileIO implementation
 // date: Autumn 2004
 //-----------------------------------------------------------------------------
 #include &quot;chuck_oo.h&quot;
@@ -36,21 +37,34 @@
 #include &quot;chuck_vm.h&quot;
 #include &quot;chuck_instr.h&quot;
 #include &quot;chuck_errmsg.h&quot;
+#include &quot;chuck_dl.h&quot;
 
+#include &lt;iostream&gt;
 #include &lt;sstream&gt;
 #include &lt;iomanip&gt;
 #include &lt;typeinfo&gt;
 using namespace std;
 
+#if defined(__PLATFORM_WIN32__)
+  #include &quot;dirent_win32.h&quot;
+#endif
+
 
 // initialize
 t_CKBOOL Chuck_VM_Object::our_locks_in_effect = TRUE;
-const t_CKINT Chuck_IO::READ = 0x1;
-const t_CKINT Chuck_IO::WRITE = 0x2;
-const t_CKINT Chuck_IO::APPEND = 0x4;
-const t_CKINT Chuck_IO::TRUNCATE = 0x8;
-const t_CKINT Chuck_IO::ASCII = 0x10;
-const t_CKINT Chuck_IO::BINARY = 0x20;
+const t_CKINT Chuck_IO::READ_INT32 = 0x1;
+const t_CKINT Chuck_IO::READ_INT16 = 0x2;
+const t_CKINT Chuck_IO::READ_INT8 = 0x4;
+const t_CKINT Chuck_IO::MODE_SYNC = 0;
+const t_CKINT Chuck_IO::MODE_ASYNC = 1;
+const t_CKINT Chuck_IO_File::FLAG_READ_WRITE = 0x8;
+const t_CKINT Chuck_IO_File::FLAG_READONLY = 0x10;
+const t_CKINT Chuck_IO_File::FLAG_WRITEONLY = 0x20;
+const t_CKINT Chuck_IO_File::FLAG_APPEND = 0x40;
+const t_CKINT Chuck_IO_File::TYPE_ASCII = 0x80;
+const t_CKINT Chuck_IO_File::TYPE_BINARY = 0x100;
+Chuck_IO_Chout * Chuck_IO_Chout::our_chout = NULL;
+Chuck_IO_Cherr * Chuck_IO_Cherr::our_cherr = NULL;
 
 
 
@@ -1421,8 +1435,8 @@ void Chuck_Event::wait( Chuck_VM_Shred * shred, Chuck_VM * vm )
 
 
 //-----------------------------------------------------------------------------
-// name:
-// desc:
+// name: Chuck_IO Constructor
+// desc: Empty because you cannot construct a Chuck_IO object
 //-----------------------------------------------------------------------------
 Chuck_IO::Chuck_IO()
 { }
@@ -1431,8 +1445,8 @@ Chuck_IO::Chuck_IO()
 
 
 //-----------------------------------------------------------------------------
-// name:
-// desc:
+// name: Chuck_IO Destructor
+// desc: Empty becuase you cannot destruct a Chuck_IO object
 //-----------------------------------------------------------------------------
 Chuck_IO::~Chuck_IO()
 { }
@@ -1441,47 +1455,198 @@ Chuck_IO::~Chuck_IO()
 
 
 //-----------------------------------------------------------------------------
-// name:
-// desc:
+// name: Chuck_IO_File()
+// desc: constructor
 //-----------------------------------------------------------------------------
-Chuck_IO_File * Chuck_IO::openFile( const string &amp; path, t_CKINT flags )
+Chuck_IO_File::Chuck_IO_File()
 {
-    return NULL;
+    // zero things out
+    m_flags = 0;
+    m_iomode = MODE_SYNC;
+    m_path = &quot;&quot;;
+    m_dir = NULL;
+    m_dir_start = 0;
+    m_asyncEvent = new Chuck_Event;
+    initialize_object( m_asyncEvent, &amp;t_event );
+    m_thread = new XThread;
 }
 
 
 
 
 //-----------------------------------------------------------------------------
-// name:
-// desc:
+// name: ~Chuck_IO_File()
+// desc: destructor
 //-----------------------------------------------------------------------------
-string Chuck_IO::currentDir()
+Chuck_IO_File::~Chuck_IO_File()
 {
-    return &quot;&quot;;
+    // clean up
+    this-&gt;close();
+    delete m_asyncEvent;
+    delete m_thread;
 }
 
 
 
 
 //-----------------------------------------------------------------------------
-// name:
-// desc:
+// name: open
+// desc: open file from disk
 //-----------------------------------------------------------------------------
-string Chuck_IO::changeDir( const string &amp; to )
+t_CKBOOL Chuck_IO_File::open( const string &amp; path, t_CKINT flags )
 {
-    return &quot;&quot;;
-}
-
-
-
+    // log
+    EM_log( CK_LOG_INFO, &quot;FileIO: opening file from disk...&quot; );
+    EM_log( CK_LOG_INFO, &quot;FileIO: path: %s&quot;, path.c_str() );
+    EM_pushlog();
+    
+    // if no flag specified, make it READ by default
+    if( !(flags &amp; FLAG_READ_WRITE) &amp;&amp;
+        !(flags &amp; FLAG_READONLY) &amp;&amp;
+        !(flags &amp; FLAG_WRITEONLY) &amp;&amp;
+        !(flags &amp; FLAG_APPEND) )
+    {
+        flags |= FLAG_READONLY;
+    }
 
-//-----------------------------------------------------------------------------
-// name:
-// desc:
-//-----------------------------------------------------------------------------
-t_CKBOOL Chuck_IO::isFile( const string &amp; path )
-{
+    // if both read and write, enable read and write
+    if( flags &amp; FLAG_READONLY &amp;&amp; flags &amp; FLAG_WRITEONLY )
+    {
+        flags ^= FLAG_READONLY;
+        flags ^= FLAG_WRITEONLY;
+        flags |= FLAG_READ_WRITE;
+    }
+    
+    // check flags for errors
+    if ((flags &amp; TYPE_ASCII) &amp;&amp;
+        (flags &amp; TYPE_BINARY)) {
+        EM_error3( &quot;[chuck](via FileIO): cannot open file in both ASCII and binary mode&quot; );
+        goto error;
+    }
+    
+    if ((flags &amp; FLAG_READ_WRITE) &amp;&amp;
+        (flags &amp; FLAG_READONLY)) {
+        EM_error3( &quot;[chuck](via FileIO): conflicting flags: READ_WRITE and READ&quot; );
+        goto error;
+    }
+    
+    if ((flags &amp; FLAG_READ_WRITE) &amp;&amp;
+        (flags &amp; FLAG_WRITEONLY)) {
+        EM_error3( &quot;[chuck](via FileIO): conflicting flags: READ_WRITE and WRITE&quot; );
+        goto error;
+    }
+    
+    if ((flags &amp; FLAG_READ_WRITE) &amp;&amp;
+        (flags &amp; FLAG_APPEND)) {
+        EM_error3( &quot;[chuck](via FileIO): conflicting flags: READ_WRITE and APPEND&quot; );
+        goto error;
+    }
+    
+    if ((flags &amp; FLAG_WRITEONLY) &amp;&amp;
+        (flags &amp; FLAG_READONLY)) {
+        EM_error3( &quot;[chuck](via FileIO): conflicting flags: WRITE and READ&quot; );
+        goto error;
+    }
+    
+    if ((flags &amp; FLAG_APPEND) &amp;&amp;
+        (flags &amp; FLAG_READONLY)) {
+        EM_error3( &quot;[chuck](via FileIO): conflicting flags: APPEND and FLAG_READ&quot; );
+        goto error;
+    }
+    
+    // set open flags
+    ios_base::openmode mode;
+    
+    if (flags &amp; FLAG_READ_WRITE)
+        mode = ios_base::in | ios_base::out;
+    else if (flags &amp; FLAG_READONLY)
+        mode = ios_base::in;
+    else if (flags &amp; FLAG_APPEND)
+        mode = ios_base::out | ios_base::app;
+    else if (flags &amp; FLAG_WRITEONLY)
+        mode = ios_base::out | ios_base::trunc;
+    
+    if (flags &amp; TYPE_BINARY)
+        mode |= ios_base::binary;
+    
+    // close first
+    if (m_io.is_open())
+        this-&gt;close();
+    
+    // try to open as a dir first
+    if (m_dir = opendir( path.c_str() ) ) {
+        EM_poplog();
+        return TRUE;
+    }
+    
+    // not a dir, create file if it does not exist unless flag is
+    // readonly
+    if ( !(flags &amp; FLAG_READONLY) )
+    {
+        m_io.open( path.c_str(), ios_base::in );
+        if ( m_io.fail() )
+        {
+            m_io.clear();
+            m_io.open( path.c_str(), ios_base::out | ios_base::trunc );
+            m_io.close();
+        }
+        else
+            m_io.close();
+    }
+    
+    //open file
+    m_io.open( path.c_str(), mode );
+    
+    // seek to beginning if necessary
+    if (flags &amp; FLAG_READ_WRITE)
+    {
+        m_io.seekp(0);
+        m_io.seekg(0);
+    }
+    
+    /* ATODO: Ge's code
+     // windows sucks for being creative in the wrong places
+     #ifdef __PLATFORM_WIN32__
+     // if( flags ^ Chuck_IO::TRUNCATE &amp;&amp; flags | Chuck_IO::READ ) nMode |= ios::nocreate;
+     m_io.open( path.c_str(), nMode );
+     #else
+     m_io.open( path.c_str(), (_Ios_Openmode)nMode );
+     #endif
+     */
+    
+    // check for error
+    if( !(m_io.is_open()) )
+    {
+        // EM_error3( &quot;[chuck](via FileIO): cannot open file: '%s'&quot;, path.c_str() );
+        goto error;
+    }
+    
+    // set path
+    m_path = path;
+    // set flags
+    m_flags = flags;
+    if (!(flags &amp; TYPE_BINARY))
+        m_flags |= Chuck_IO_File::TYPE_ASCII; // ASCII is default
+    // set mode
+    m_iomode = MODE_SYNC;
+    
+    // pop
+    EM_poplog();
+    
+    return TRUE;
+    
+error:
+    
+    // pop
+    EM_poplog();
+    
+    // reset
+    m_path = &quot;&quot;;
+    m_flags = 0;
+    m_iomode = MODE_SYNC;
+    m_io.clear();
+    m_io.close();
+    
     return FALSE;
 }
 
@@ -1489,302 +1654,363 @@ t_CKBOOL Chuck_IO::isFile( const string &amp; path )
 
 
 //-----------------------------------------------------------------------------
-// name:
-// desc:
+// name: close
+// desc: close file
 //-----------------------------------------------------------------------------
-t_CKBOOL Chuck_IO::isDir( const string &amp; path )
+void Chuck_IO_File::close()
 {
-    return FALSE;
+    // log
+    EM_log( CK_LOG_INFO, &quot;FileIO: closing file '%s'...&quot;, m_path.c_str() );
+    // close it
+    m_io.close();
+    m_flags = 0;
+    m_path = &quot;&quot;;
+    m_iomode = Chuck_IO::MODE_SYNC;
+    if ( m_dir ) {
+        closedir( m_dir );
+        m_dir = NULL;
+        m_dir_start = 0;
+    }
 }
 
 
 
 
 //-----------------------------------------------------------------------------
-// name:
-// desc:
+// name: good()
+// desc: ...
 //-----------------------------------------------------------------------------
-t_CKINT Chuck_IO::getSize( const string &amp; path )
+t_CKBOOL Chuck_IO_File::good()
 {
-    return 0;
+    return m_dir || m_io.is_open();
+    // return (!m_dir) &amp;&amp; (!m_io.is_open());
 }
 
 
 
 
 //-----------------------------------------------------------------------------
-// name:
-// desc:
+// name: flush()
+// desc: ...
 //-----------------------------------------------------------------------------
-string Chuck_IO::baseName( const string &amp; path )
+void Chuck_IO_File::flush()
 {
-    return &quot;&quot;;
+    // sanity
+    if ( m_dir )
+    {
+        EM_error3( &quot;[chuck](via FileIO): cannot flush on directory&quot; );
+        return;
+    }
+    m_io.flush();
 }
 
 
 
 
 //-----------------------------------------------------------------------------
-// name:
-// desc:
+// name: mode()
+// desc: ...
 //-----------------------------------------------------------------------------
-void Chuck_IO::getContent( vector&lt;string&gt; &amp; content )
+t_CKINT Chuck_IO_File::mode()
 {
-    content.clear();
+    // sanity
+    if ( m_dir )
+    {
+        EM_error3( &quot;[chuck](via FileIO): cannot get mode on directory&quot; );
+        return -1;
+    }
+    return m_iomode;
 }
 
 
-    
+
 
 //-----------------------------------------------------------------------------
-// name: Chuck_IO_File()
-// desc: constructor
+// name: mode( t_CKINT flag )
+// desc: ...
 //-----------------------------------------------------------------------------
-Chuck_IO_File::Chuck_IO_File()
-{
-    // zero things out
-    m_ready_flags = 0;
-    m_flags = 0;
+void Chuck_IO_File::mode( t_CKINT flag )
+{    
+    // sanity
+    if ( m_dir )
+    {
+        EM_error3( &quot;[chuck](via FileIO): cannot set mode on directory&quot; );
+        return;
+    }
+    if ( (flag != Chuck_IO::MODE_ASYNC) &amp;&amp; (flag != Chuck_IO::MODE_SYNC) )
+    {
+        EM_error3( &quot;[chuck](via FileIO): invalid mode flag&quot; );
+        return;
+    }
+    
+    m_iomode = flag;
 }
 
 
 
 
 //-----------------------------------------------------------------------------
-// name: ~Chuck_IO_File()
-// desc: destructor
+// name: size()
+// desc: Returns the size of the file in bytes, or -1 if no file is opened or
+//       if a directory is opened.
 //-----------------------------------------------------------------------------
-Chuck_IO_File::~Chuck_IO_File()
+t_CKINT Chuck_IO_File::size()
 {
-    // check it
-    this-&gt;close();
+    if (!(m_io.is_open())) return -1;
+    if ( m_dir )
+    {
+        EM_error3( &quot;[chuck](via FileIO): cannot get size on a directory&quot; );
+        return -1;
+    }
+    
+    // no easy way to find file size in C++
+    // have to seek to end, report position
+    FILE * stream = fopen( m_path.c_str(), &quot;r&quot; );
+    fseek( stream, 0L, SEEK_END );
+    int endPos = ftell( stream );
+    fclose( stream );
+    return endPos;
 }
 
 
 
 
 //-----------------------------------------------------------------------------
-// name: open
-// desc: open file from disk
+// name: seek( t_CKINT pos )
+// desc: Seeks to the specified byte offset in the file.
 //-----------------------------------------------------------------------------
-t_CKBOOL Chuck_IO_File::open( const string &amp; path, t_CKINT flags )
+void Chuck_IO_File::seek( t_CKINT pos )
 {
-    // close first
-    this-&gt;close();
-
-    // log
-    EM_log( CK_LOG_INFO, &quot;(IO): opening file from disk...&quot; );
-    EM_pushlog();
-    EM_log( CK_LOG_INFO, &quot;(IO): path: %s&quot;, path.c_str() );
-    EM_log( CK_LOG_INFO, &quot;(IO): READ: %s WRITE: %s APPEND: %s PLUS: %s&quot;,
-        flags &amp; Chuck_IO::READ ? &quot;Y&quot; : &quot;N&quot;, flags &amp; Chuck_IO::WRITE ? &quot;Y&quot; : &quot;N&quot;,
-        flags &amp; Chuck_IO::APPEND ? &quot;Y&quot; : &quot;N&quot;, flags &amp; Chuck_IO::TRUNCATE ? &quot;Y&quot; : &quot;N&quot;,
-        flags &amp; Chuck_IO::BINARY ? &quot;Y&quot; : &quot;N&quot; );
-
-    // open modes
-    int nMode = 0;
-
-    // construct mode string
-    stringstream sout;
-    if( flags &amp; Chuck_IO::READ )
-    {
-        // write it
-        sout &lt;&lt; &quot;r&quot;;
-        // set ready
-        m_ready_flags |= Chuck_IO::READ;
-        // set mode
-        nMode |= ios::in;
-    }
-    if( flags &amp; Chuck_IO::WRITE )
-    {
-        // write it
-        sout &lt;&lt; &quot;w&quot;;
-        // set ready
-        m_ready_flags |= Chuck_IO::WRITE;
-        // set mode
-        nMode |= ios::out;
-    }
-    if( flags &amp; Chuck_IO::APPEND )
-    {
-        // write it
-        sout &lt;&lt; &quot;a&quot;;
-        // set ready
-        m_ready_flags |= Chuck_IO::WRITE | Chuck_IO::APPEND;
-        // set mode
-        nMode |= ios::out | ios::ate;
-    }
-    if( flags &amp; Chuck_IO::TRUNCATE )
+    if ( !(m_io.is_open()) )
     {
-        // read + write
-        if( flags ^ Chuck_IO::WRITE || flags &amp; Chuck_IO::APPEND )
-        {
-            // error
-            EM_error3( &quot;(FileIO): malformed open flag (TRUNCATE)...&quot; );
-            EM_error3( &quot;    note: must be used with WRITE, and without APPEND&quot; );
-            goto error;
-        };
-
-        // write it
-        sout &lt;&lt; &quot;w&quot;;
-        // set ready
-        m_ready_flags |= Chuck_IO::TRUNCATE;
-        // set mode
-        nMode |= ios::trunc;
-    }
-    if( flags &amp; Chuck_IO::BINARY )
-    {
-        // add it
-        m_ready_flags |= Chuck_IO::BINARY;
+        EM_error3( &quot;[chuck](via FileIO): cannot seek: no file is open&quot; );
+        return;
     }
-
-    // sanity check
-    if( sout.str().length() == 0 )
+    if ( m_dir )
     {
-        // error
-        EM_error3( &quot;(FileIO): malformed open flag (no operation specified)...&quot; );
-        goto error;
+        EM_error3( &quot;[chuck](via FileIO): cannot seek on a directory&quot; );
+        return;
     }
-
-    // log
-    EM_log( CK_LOG_INFO, &quot;(IO): flag: '%s'&quot;, sout.str().c_str() );
-
-    // windows sucks for being creative in the wrong places
-#ifdef __PLATFORM_WIN32__
-    // if( flags ^ Chuck_IO::TRUNCATE &amp;&amp; flags | Chuck_IO::READ ) nMode |= ios::nocreate;
-    m_io.open( path.c_str(), nMode );
-#else
-    m_io.open( path.c_str(), (_Ios_Openmode)nMode );
-#endif
-
-    // check for error
-    if( !m_io.good() )
-    {
-        EM_error3( &quot;(FileIO): cannot open file: '%s'&quot;, path.c_str() );
-        goto error;
-    }
-
-    // for write
-    if( good2write() )
-    {
-        // set precision
-        setprecision( 6 );
-    }
-
-    // set path
-    m_path = path;
-    // set flags
-    m_flags = flags;
-
-    // pop
-    EM_poplog();
-
-    return TRUE;
-
-error:
-
-    // pop
-    EM_poplog();
-
-    // reset
-    m_ready_flags = 0;
-    // reset
-    m_path = &quot;&quot;;
-
-    return FALSE;
+    m_io.seekg( pos );
+    m_io.seekp( pos );
 }
 
 
 
 
 //-----------------------------------------------------------------------------
-// name: close
-// desc: close file
+// name: tell()
+// desc: Returns the byte offset into the file, or -1 if no file is opened.
 //-----------------------------------------------------------------------------
-t_CKBOOL Chuck_IO_File::close()
+t_CKINT Chuck_IO_File::tell()
 {
-    // check
-    if( !m_io.good() )
-        return FALSE;
-
-    // log
-    EM_log( CK_LOG_INFO, &quot;(IO): closing file '%s'...&quot;, m_path.c_str() );
-    // close it
-    m_io.close();
-    m_flags = 0;
-    m_ready_flags = 0;
-    m_path = &quot;&quot;;
-
-    return TRUE;
+    if (!(m_io.is_open()))
+        return -1;
+    if ( m_dir )
+    {
+        EM_error3( &quot;[chuck](via FileIO): cannot tell on directory&quot; );
+        return -1;
+    }
+    
+    return m_io.tellg();
 }
 
 
 
 
 //-----------------------------------------------------------------------------
-// name: more()
-// desc: is there more to read?
+// name: isDir()
+// desc: ...
 //-----------------------------------------------------------------------------
-t_CKBOOL Chuck_IO_File::more()
+t_CKINT Chuck_IO_File::isDir()
 {
-    return !eof();
+    return m_dir != NULL;
 }
 
 
 
 
 //-----------------------------------------------------------------------------
-// name: eof()
-// desc: end of file?
+// name: dirList()
+// desc: ...
 //-----------------------------------------------------------------------------
-t_CKBOOL Chuck_IO_File::eof()
+Chuck_Array4 * Chuck_IO_File::dirList()
 {
     // sanity
-    if( !m_io.good() ) return TRUE;
-    return !m_io;
+    if ( !m_dir )
+    {
+        EM_error3( &quot;[chuck](via FileIO): cannot get list: no directory open&quot; );
+        Chuck_Array4 *ret = new Chuck_Array4( TRUE, 0 );
+        initialize_object( ret, &amp;t_array );
+        return ret;
+    }
+    
+    // fill vector with entry names
+    rewinddir( m_dir );
+    std::vector&lt;Chuck_String *&gt; entrylist;
+    struct dirent *ent;
+    while ( ent = readdir( m_dir ) )
+    {
+        Chuck_String *s = (Chuck_String *)instantiate_and_initialize_object( &amp;t_string, NULL );
+        s-&gt;str = std::string( ent-&gt;d_name );
+        if ( s-&gt;str != &quot;..&quot; &amp;&amp; s-&gt;str != &quot;.&quot; )
+            // don't include .. and . in the list
+            entrylist.push_back( s );
+    }
+    
+    // make array
+    Chuck_Array4 *array = new Chuck_Array4( true, entrylist.size() );
+    initialize_object( array, &amp;t_array );
+    for ( int i = 0; i &lt; entrylist.size(); i++ )
+        array-&gt;set( i, (t_CKUINT) entrylist[i] );
+    return array;
 }
 
 
 
 
 //-----------------------------------------------------------------------------
-// name: good2read()
-// desc: ready to read?
+// name: read( t_CKINT length )
+// desc: ...
 //-----------------------------------------------------------------------------
-t_CKBOOL Chuck_IO_File::good2read()
+/*Chuck_String * Chuck_IO_File::read( t_CKINT length )
 {
-    return ( m_io.good() &amp;&amp; m_flags &amp; Chuck_IO::READ );
-}
+    // sanity
+    if (!(m_io.is_open())) {
+        EM_error3( &quot;[chuck](via FileIO): cannot read: no file open&quot; );
+        return new Chuck_String( &quot;&quot; );
+    }
+    
+    if (m_io.fail()) {
+        EM_error3( &quot;[chuck](via FileIO): cannot read: I/O stream failed&quot; );
+        return new Chuck_String( &quot;&quot; );
+    }
+    
+    if ( m_dir )
+    {
+        EM_error3( &quot;[chuck](via FileIO): cannot read on a directory&quot; );
+        return new Chuck_String( &quot;&quot; );
+    }
+    
+    char buf[length+1];
+    m_io.read( buf, length );
+    buf[m_io.gcount()] = '\0';
+    string s( buf );
+    return new Chuck_String( s );
+}*/
 
 
 
 
 //-----------------------------------------------------------------------------
-// name: good2write()
-// desc: ready for write?
+// name: readLine()
+// desc: read line
 //-----------------------------------------------------------------------------
-t_CKBOOL Chuck_IO_File::good2write()
+Chuck_String * Chuck_IO_File::readLine()
 {
-    return ( m_io.good() &amp;&amp; m_flags &amp; Chuck_IO::READ );
+    // sanity
+    if (!(m_io.is_open())) {
+        EM_error3( &quot;[chuck](via FileIO): cannot readLine: no file open&quot; );
+        return new Chuck_String( &quot;&quot; );
+    }
+    
+    if (m_io.fail()) {
+        EM_error3( &quot;[chuck](via FileIO): cannot readLine: I/O stream failed&quot; );
+        return new Chuck_String( &quot;&quot; );
+    }
+    
+    if ( m_dir )
+    {
+        EM_error3( &quot;[chuck](via FileIO): cannot readLine on directory&quot; );
+        return new Chuck_String( &quot;&quot; );
+    }
+    
+    string s;
+    getline( m_io, s );
+    return new Chuck_String( s );
 }
 
 
 
 
 //-----------------------------------------------------------------------------
-// name: readInt()
-// desc: read next as (ascii) integer
+// name: readInt( t_CKINT flags )
+// desc: ...
 //-----------------------------------------------------------------------------
-t_CKINT Chuck_IO_File::readInt()
+t_CKINT Chuck_IO_File::readInt( t_CKINT flags )
 {
     // sanity
-    if( !good2read() ) return 0;
-
-    // read int
-    t_CKINT val = 0;
-    // TODO: check for EOF?
-    m_io &gt;&gt; val;
-
-    return val;
+    if (!(m_io.is_open())) {
+        EM_error3( &quot;[chuck](via FileIO): cannot readInt: no file open&quot; );
+        return 0;
+    }
+    
+    if (m_io.eof()) {
+        EM_error3( &quot;[chuck](via FileIO): cannot readInt: EOF reached&quot; );
+        return 0;
+    }
+    
+    if ( m_dir )
+    {
+        EM_error3( &quot;[chuck](via FileIO): cannot read on directory&quot; );
+        return 0;
+    }
+    
+    if (m_io.fail()) {
+        EM_error3( &quot;[chuck](via FileIO): cannot readInt: I/O stream failed&quot; );
+        return 0;
+    }
+    
+    if (m_flags &amp; TYPE_ASCII) {
+        // ASCII
+        t_CKINT val = 0;
+        m_io &gt;&gt; val;
+        // if (m_io.fail())
+        //     EM_error3( &quot;[chuck](via FileIO): cannot readInt: I/O stream failed&quot; );
+        return val;
+        
+    } else if (m_flags &amp; TYPE_BINARY) {
+        // binary
+        if (flags &amp; Chuck_IO::READ_INT32) {
+            // 32-bit
+            t_CKINT i;
+            m_io.read( (char *)&amp;i, 4 );
+            if (m_io.gcount() != 4)
+                EM_error3( &quot;[chuck](via FileIO): cannot readInt: not enough bytes left&quot; );
+            else if (m_io.fail())
+                EM_error3( &quot;[chuck](via FileIO): cannot readInt: I/O stream failed&quot; );
+            return i;
+        } else if (flags &amp; Chuck_IO::READ_INT16) {
+            // 16-bit
+            // int16_t i;
+            // issue: 64-bit
+            short i;
+            m_io.read( (char *)&amp;i, 2 );
+            if (m_io.gcount() != 2)
+                EM_error3( &quot;[chuck](via FileIO): cannot readInt: not enough bytes left&quot; );
+            else if (m_io.fail())
+                EM_error3( &quot;[chuck](via FileIO): cannot readInt: I/O stream failed&quot; );
+            return (t_CKINT) i;
+        } else if (flags &amp; Chuck_IO::READ_INT8) {
+            // 8-bit
+            // int8_t i;
+            // issue: 64-bit
+            char i;
+            m_io.read( (char *)&amp;i, 1 );
+            if (m_io.gcount() != 1)
+                EM_error3( &quot;[chuck](via FileIO): cannot readInt: not enough bytes left&quot; );
+            else if (m_io.fail())
+                EM_error3( &quot;[chuck](via FileIO): cannot readInt: I/O stream failed&quot; );
+            return (t_CKINT) i;
+        } else {
+            EM_error3( &quot;[chuck](via FileIO): readInt error: invalid int size flag&quot; );
+            return 0;
+        }
+        
+    } else {
+        EM_error3( &quot;[chuck](via FileIO): readInt error: invalid ASCII/binary flag&quot; );
+        return 0;
+    }
 }
 
 
@@ -1797,14 +2023,49 @@ t_CKINT Chuck_IO_File::readInt()
 t_CKFLOAT Chuck_IO_File::readFloat()
 {
     // sanity
-    if( !good2read() ) return 0;
-
-    // read float
-    t_CKFLOAT val = 0;
-    // TODO: check for EOF?
-    m_io &gt;&gt; val;
-
-    return 0;
+    if (!(m_io.is_open())) {
+        EM_error3( &quot;[chuck](via FileIO): cannot readFloat: no file open&quot; );
+        return 0;
+    }
+    
+    if (m_io.eof()) {
+        EM_error3( &quot;[chuck](via FileIO): cannot readFloat: EOF reached&quot; );
+        return 0;
+    }
+    
+    if (m_io.fail()) {
+        EM_error3( &quot;[chuck](via FileIO): cannot readFloat: I/O stream failed&quot; );
+        return 0;
+    }
+    
+    if ( m_dir )
+    {
+        EM_error3( &quot;[chuck](via FileIO): cannot read a directory&quot; );
+        return 0;
+    }
+    
+    if (m_flags &amp; TYPE_ASCII) {
+        // ASCII
+        t_CKFLOAT val = 0;
+        m_io &gt;&gt; val;
+        // if (m_io.fail())
+        //     EM_error3( &quot;[chuck](via FileIO): cannot readFloat: I/O stream failed&quot; );
+        return val;
+        
+    } else if (m_flags &amp; TYPE_BINARY) {
+        // binary
+        t_CKFLOAT i;
+        m_io.read( (char *)&amp;i, sizeof(t_CKFLOAT) );
+        if (m_io.gcount() != sizeof(t_CKFLOAT) )
+            EM_error3( &quot;[chuck](via FileIO): cannot readFloat: not enough bytes left&quot; );
+        else if (m_io.fail())
+            EM_error3( &quot;[chuck](via FileIO): cannot readInt: I/O stream failed&quot; );
+        return i;
+        
+    } else {
+        EM_error3( &quot;[chuck](via FileIO): readFloat error: invalid ASCII/binary flag&quot; );
+        return 0;
+    }
 }
 
 
@@ -1812,182 +2073,378 @@ t_CKFLOAT Chuck_IO_File::readFloat()
 
 //-----------------------------------------------------------------------------
 // name: readString()
-// desc: read next as string
+// desc: ...
 //-----------------------------------------------------------------------------
-string Chuck_IO_File::readString()
+t_CKBOOL Chuck_IO_File::readString( std::string &amp; str )
 {
+    // set
+    str = &quot;&quot;;
+
     // sanity
-    if( !good2read() ) return 0;
+    if (!(m_io.is_open())) {
+        EM_error3( &quot;[chuck](via FileIO): cannot readString: no file open&quot; );
+        return FALSE;
+    }
+    
+    if (m_io.eof()) {
+        EM_error3( &quot;[chuck](via FileIO): cannot readString: EOF reached&quot; );
+        return FALSE;
+    }
+    
+    if ( m_dir )
+    {
+        EM_error3( &quot;[chuck](via FileIO): cannot read on directory&quot; );
+        return FALSE;
+    }
+    
+    if (m_io.fail()) {
+        EM_error3( &quot;[chuck](via FileIO): cannot readString: I/O stream failed&quot; );
+        return FALSE;
+    }
+    
+    if (m_flags &amp; TYPE_ASCII) {
+        // ASCII
+        m_io &gt;&gt; str;
+        return TRUE;
+    } else if (m_flags &amp; TYPE_BINARY) {
+        EM_error3( &quot;[chuck](via FileIO): readString not supported for binary mode&quot; );
+        return FALSE;
+    } else {
+        EM_error3( &quot;[chuck](via FileIO): readInt error: invalid ASCII/binary flag&quot; );
+        return FALSE;
+    }
+}
 
-    // read string
-    string val;
-    // TODO: check for EOF?
-    m_io &gt;&gt; val;
 
-    return val;
-}
 
 
+/* (ATODO: doesn't look like asynchronous reads will work)
+ 
+ THREAD_RETURN ( THREAD_TYPE Chuck_IO_File::read_thread ) ( void *data )
+ {
+ // (ATODO: test this)
+ cerr &lt;&lt; &quot;In thread&quot; &lt;&lt; endl;
+ async_args *args = (async_args *)data;
+ Chuck_String *ret = (Chuck_String *)(args-&gt;RETURN);
+ ret = args-&gt;fileio_obj-&gt;read( args-&gt;intArg );
+ cerr &lt;&lt; &quot;Called FileIO.read(int)&quot; &lt;&lt; endl;
+ args-&gt;fileio_obj-&gt;m_asyncEvent-&gt;broadcast(); // wake up
+ cerr &lt;&lt; &quot;Broadcasted on event&quot; &lt;&lt; endl;
+ cerr &lt;&lt; &quot;Sleeping&quot; &lt;&lt; endl;
+ sleep(5);
+ cerr &lt;&lt; &quot;Woke up&quot; &lt;&lt; endl;
+ delete args;
+ cerr &lt;&lt; &quot;Deleted args&quot; &lt;&lt; endl;
+ 
+ return (THREAD_RETURN)0;
+ }
+ 
+ THREAD_RETURN ( THREAD_TYPE Chuck_IO_File::readLine_thread ) ( void *data )
+ {
+ // not yet implemented
+ return NULL;
+ }
+ 
+ THREAD_RETURN ( THREAD_TYPE Chuck_IO_File::readInt_thread ) ( void *data )
+ {
+ // (ATODO: test this)
+ async_args *args = (async_args *)data;
+ Chuck_DL_Return *ret = (Chuck_DL_Return *)(args-&gt;RETURN);
+ ret-&gt;v_int = args-&gt;fileio_obj-&gt;readInt( args-&gt;intArg );
+ cerr &lt;&lt; &quot;Called readInt, set ret-&gt;v_int to &quot; &lt;&lt; ret-&gt;v_int &lt;&lt; endl;
+ args-&gt;fileio_obj-&gt;m_asyncEvent-&gt;broadcast(); // wake up
+ cerr &lt;&lt; &quot;Called broadcast&quot; &lt;&lt; endl;
+ delete args;
+ 
+ return (THREAD_RETURN)0;
+ }
+ 
+ THREAD_RETURN ( THREAD_TYPE Chuck_IO_File::readFloat_thread ) ( void *data )
+ {
+ // not yet implemented
+ return NULL;
+ }
+ */
 
-    
 //-----------------------------------------------------------------------------
-// name: readLine()
-// desc: read line
+// name: eof()
+// desc: end of file?
 //-----------------------------------------------------------------------------
-string Chuck_IO_File::readLine()
+t_CKBOOL Chuck_IO_File::eof()
 {
-    // sanity
-    if( !good2read() ) return 0;
-
-    // read string
-    string val;
-    // TODO: check for EOF?
-    std::getline( m_io, val );
+    if( !m_io.is_open() )
+    {
+        // EM_error3( &quot;[chuck](via FileIO): cannot check eof: no file open&quot; );
+        return TRUE;
+    }
+    if( m_dir )
+    {
+        EM_error3( &quot;[chuck](via FileIO): cannot check eof on directory&quot; );
+        return TRUE;
+    }
 
-    return val;
+    return m_io.eof() || m_io.fail();
 }
 
 
 
 
 //-----------------------------------------------------------------------------
-// name: writeInt()
-// desc: write (ascii) integer
+// name: write( const std::string &amp; val )
+// desc: ...
 //-----------------------------------------------------------------------------
-t_CKBOOL Chuck_IO_File::writeInt( t_CKINT val )
+void Chuck_IO_File::write( const std::string &amp; val )
 {
     // sanity
-    if( !good2write() ) return FALSE;
-
-    // write it
-    m_io &lt;&lt; val;
-
-    return m_io.good();
+    if (!(m_io.is_open())) {
+        EM_error3( &quot;[chuck](via FileIO): cannot write: no file open&quot; );
+        return;
+    }
+    
+    if (m_io.fail()) {
+        EM_error3( &quot;[chuck](via FileIO): cannot write: I/O stream failed&quot; );
+        return;
+    }
+    
+    if ( m_dir )
+    {
+        EM_error3( &quot;[chuck](via FileIO): cannot write to a directory&quot; );
+        return;
+    }
+    
+    m_io.write( val.c_str(), val.size() );
+    
+    if (m_io.fail()) { // check both before and after write if stream is ok
+        EM_error3( &quot;[chuck](via FileIO): cannot write: I/O stream failed&quot; );
+    }
 }
 
 
 
 
 //-----------------------------------------------------------------------------
-// name: writeFloat()
-// desc: write (ascii) floating point value
+// name: write( t_CKINT val )
+// desc: ...
 //-----------------------------------------------------------------------------
-t_CKBOOL Chuck_IO_File::writeFloat( t_CKFLOAT val )
+void Chuck_IO_File::write( t_CKINT val )
 {
     // sanity
-    if( !good2write() ) return 0;
-
-    // write it
-    m_io &lt;&lt; val;
-
-    return m_io.good();
+    if (!(m_io.is_open())) {
+        EM_error3( &quot;[chuck](via FileIO): cannot write: no file open&quot; );
+        return;
+    }
+    
+    if (m_io.fail()) {
+        EM_error3( &quot;[chuck](via FileIO): cannot write: I/O stream failed&quot; );
+        return;
+    }
+    
+    if ( m_dir )
+    {
+        EM_error3( &quot;[chuck](via FileIO): cannot write on directory&quot; );
+        return;
+    }
+    
+    if (m_flags &amp; TYPE_ASCII) {
+        m_io &lt;&lt; val;
+    } else if (m_flags &amp; TYPE_BINARY) {
+        m_io.write( (char *)&amp;val, sizeof(t_CKINT) );
+    } else {
+        EM_error3( &quot;[chuck](via FileIO): write error: invalid ASCII/binary flag&quot; );
+    }
+    
+    if (m_io.fail()) { // check both before and after write if stream is ok
+        EM_error3( &quot;[chuck](via FileIO): cannot write: I/O stream failed&quot; );
+    }
 }
 
 
 
 
 //-----------------------------------------------------------------------------
-// name: writeString()
-// desc: write string
+// name: write( t_CKFLOAT val )
+// desc: ...
 //-----------------------------------------------------------------------------
-t_CKBOOL Chuck_IO_File::writeString( const string &amp; val )
+void Chuck_IO_File::write( t_CKFLOAT val )
 {
     // sanity
-    if( !good2read() ) return 0;
-
-    // write it
-    m_io &lt;&lt; val;
-
-    return m_io.good();
+    if (!(m_io.is_open())) {
+        EM_error3( &quot;[chuck](via FileIO): cannot write: no file open&quot; );
+        return;
+    }
+    
+    if (m_io.fail()) {
+        EM_error3( &quot;[chuck](via FileIO): cannot write: I/O stream failed&quot; );
+        return;
+    }
+    
+    if ( m_dir )
+    {
+        EM_error3( &quot;[chuck](via FileIO): cannot write to a directory&quot; );
+        return;
+    }
+    
+    if (m_flags &amp; TYPE_ASCII) {
+        m_io &lt;&lt; val;
+    } else if (m_flags &amp; TYPE_BINARY) {
+        m_io.write( (char *)&amp;val, sizeof(t_CKFLOAT) );
+    } else {
+        EM_error3( &quot;[chuck](via FileIO): write error: invalid ASCII/binary flag&quot; );
+    }
+    
+    if (m_io.fail()) { // check both before and after write if stream is ok
+        EM_error3( &quot;[chuck](via FileIO): cannot write: I/O stream failed&quot; );
+    }
 }
 
 
 
-    
-//-----------------------------------------------------------------------------
-// name: writeLine()
-// desc: write line
-//-----------------------------------------------------------------------------
-t_CKBOOL Chuck_IO_File::writeLine( const string &amp; val )
+
+// static helper functions for writing asynchronously
+THREAD_RETURN ( THREAD_TYPE Chuck_IO_File::writeStr_thread ) ( void *data )
 {
-    // sanity
-    if( !good2read() ) return 0;
+    async_args *args = (async_args *)data;
+    args-&gt;fileio_obj-&gt;write ( args-&gt;stringArg );
+    Chuck_Event *e = args-&gt;fileio_obj-&gt;m_asyncEvent;
+    delete args;
+    e-&gt;broadcast(); // wake up
+    
+    return (THREAD_RETURN)0;
+}
 
-    // write it
-    m_io &lt;&lt; val &lt;&lt; endl;
+THREAD_RETURN ( THREAD_TYPE Chuck_IO_File::writeInt_thread ) ( void *data )
+{
+    async_args *args = (async_args *)data;
+    args-&gt;fileio_obj-&gt;write ( args-&gt;intArg );
+    args-&gt;fileio_obj-&gt;m_asyncEvent-&gt;broadcast(); // wake up
+    delete args;
     
-    return m_io.good();
+    return (THREAD_RETURN)0;
 }
 
+THREAD_RETURN ( THREAD_TYPE Chuck_IO_File::writeFloat_thread ) ( void *data )
+{
+    async_args *args = (async_args *)data;
+    args-&gt;fileio_obj-&gt;write ( args-&gt;floatArg );
+    args-&gt;fileio_obj-&gt;m_asyncEvent-&gt;broadcast(); // wake up
+    delete args;
+    
+    return (THREAD_RETURN)0;
+}
 
 
 
 
-//-----------------------------------------------------------------------------
-// name: read32i()
-// desc: read next 32 bits, return as int
-//-----------------------------------------------------------------------------
-t_CKINT Chuck_IO_File::read32i()
+Chuck_IO_Chout::Chuck_IO_Chout() { }
+Chuck_IO_Chout::~Chuck_IO_Chout() { }
+Chuck_IO_Chout * Chuck_IO_Chout::getInstance()
 {
-    return 0;
+    if( !our_chout )
+    {
+        our_chout = new Chuck_IO_Chout;
+        our_chout-&gt;add_ref();
+        our_chout-&gt;lock();
+        // TODO: reference count
+    }
+
+    return our_chout;
 }
 
+t_CKBOOL Chuck_IO_Chout::good()
+{ return cout.good(); }
 
+void Chuck_IO_Chout::close()
+{ /* uh can't do it */ }
 
+void Chuck_IO_Chout::flush()
+{ cout.flush(); }
 
-//-----------------------------------------------------------------------------
-// name: read24i()
-// desc: read next 24 bits, return as int
-//-----------------------------------------------------------------------------
-t_CKINT Chuck_IO_File::read24i()
-{
-    return 0;
-}
+t_CKINT Chuck_IO_Chout::mode()
+{ return 0; }
+
+void Chuck_IO_Chout::mode( t_CKINT flag )
+{ }
 
+Chuck_String * Chuck_IO_Chout::readLine()
+{ return NULL; }
 
+t_CKINT Chuck_IO_Chout::readInt( t_CKINT flags )
+{ return 0; }
 
+t_CKFLOAT Chuck_IO_Chout::readFloat()
+{ return 0.0f; }
 
-//-----------------------------------------------------------------------------
-// name: read16i()
-// desc: read next 16 bits, return as int
-//-----------------------------------------------------------------------------
-t_CKINT Chuck_IO_File::read16i()
+t_CKBOOL Chuck_IO_Chout::readString( std::string &amp; str )
 {
-    return 0;
+    str = &quot;&quot;;
+    return FALSE;
 }
 
+t_CKBOOL Chuck_IO_Chout::eof()
+{ return TRUE; }
 
+void Chuck_IO_Chout::write( const std::string &amp; val )
+{ cout &lt;&lt; val; }
 
+void Chuck_IO_Chout::write( t_CKINT val )
+{ cout &lt;&lt; val; }
 
-//-----------------------------------------------------------------------------
-// name: read8i()
-// desc: return next 8 bits, return as int
-//-----------------------------------------------------------------------------
-t_CKINT Chuck_IO_File::read8i()
+void Chuck_IO_Chout::write( t_CKFLOAT val )
+{ cout &lt;&lt; val; }
+
+
+Chuck_IO_Cherr::Chuck_IO_Cherr() { }
+Chuck_IO_Cherr::~Chuck_IO_Cherr() { }
+Chuck_IO_Cherr * Chuck_IO_Cherr::getInstance()
 {
-    return 0;
+    if( !our_cherr )
+    {
+        our_cherr = new Chuck_IO_Cherr;
+        our_cherr-&gt;add_ref();
+        our_cherr-&gt;lock();
+        // TODO: reference count
+    }
+    return our_cherr;
 }
 
+t_CKBOOL Chuck_IO_Cherr::good()
+{ return cerr.good(); }
 
+void Chuck_IO_Cherr::close()
+{ /* uh can't do it */ }
 
+void Chuck_IO_Cherr::flush()
+{ cerr.flush(); }
 
-//-----------------------------------------------------------------------------
-// name: read32f()
-// desc: return next 32-bits as (binary) single float
-//-----------------------------------------------------------------------------
-t_CKSINGLE Chuck_IO_File::read32f()
-{
-    return 0;
-}
+t_CKINT Chuck_IO_Cherr::mode()
+{ return 0; }
+
+void Chuck_IO_Cherr::mode( t_CKINT flag )
+{ }
 
+Chuck_String * Chuck_IO_Cherr::readLine()
+{ return NULL; }
 
+t_CKINT Chuck_IO_Cherr::readInt( t_CKINT flags )
+{ return 0; }
 
+t_CKFLOAT Chuck_IO_Cherr::readFloat()
+{ return 0.0f; }
 
-//-----------------------------------------------------------------------------
-// name: read64f()
-// desc: return next 64-bits as (binary) double float
-//-----------------------------------------------------------------------------
-t_CKDOUBLE Chuck_IO_File::read64f()
+t_CKBOOL Chuck_IO_Cherr::readString( std::string &amp; str )
 {
-    return 0;
+    str = &quot;&quot;;
+    return FALSE;
 }
+
+t_CKBOOL Chuck_IO_Cherr::eof()
+{ return TRUE; }
+
+void Chuck_IO_Cherr::write( const std::string &amp; val )
+{ cerr &lt;&lt; val; }
+
+void Chuck_IO_Cherr::write( t_CKINT val )
+{ cerr &lt;&lt; val; }
+
+void Chuck_IO_Cherr::write( t_CKFLOAT val )
+{ cerr &lt;&lt; val; }</diff>
      <filename>src/chuck_oo.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -28,7 +28,7 @@
 //
 // author: Ge Wang (gewang@cs.princeton.edu)
 //         Perry R. Cook (prc@cs.princeton.edu)
-// date: Autumn 2002
+// date: Autumn 2005
 //-----------------------------------------------------------------------------
 #ifndef __CHUCK_OO_H__
 #define __CHUCK_OO_H__
@@ -40,6 +40,11 @@
 #include &lt;queue&gt;
 #include &lt;fstream&gt;
 
+#ifndef __PLATFORM_WIN32__
+  #include &lt;dirent.h&gt;
+#else
+  struct DIR;
+#endif
 
 // forward reference
 struct Chuck_Type;
@@ -359,66 +364,50 @@ public:
 struct Chuck_IO : Chuck_Object
 {
 public:
+    Chuck_IO();
     virtual ~Chuck_IO();
-
+    
 public:
-    // query
-    virtual t_CKBOOL more() = 0;
-    virtual t_CKBOOL eof() = 0;
-    virtual t_CKBOOL good2read() = 0;
-    virtual t_CKBOOL good2write() = 0;
-
-    // ascii
-    virtual t_CKINT readInt() = 0;
+    // meta
+    virtual t_CKBOOL good() = 0;
+    virtual void close() = 0;
+    virtual void flush() = 0;
+    virtual t_CKINT mode() = 0;
+    virtual void mode( t_CKINT flag ) = 0;
+    
+    // reading
+    virtual Chuck_String * readLine() = 0;
+    virtual t_CKINT readInt( t_CKINT flags ) = 0;
     virtual t_CKFLOAT readFloat() = 0;
-    virtual std::string readString() = 0;
-    virtual std::string readLine() = 0;
-    virtual t_CKINT writeInt() = 0;
-    virtual t_CKFLOAT writeFloat() = 0;
-    virtual std::string writeString() = 0;
-    virtual std::string writeLine() = 0;
+    virtual t_CKBOOL readString( std::string &amp; str ) = 0;
+    virtual t_CKBOOL eof() = 0;
     
-    // binary
-    virtual t_CKINT read32i() = 0;
-    virtual t_CKINT read24i() = 0;
-    virtual t_CKINT read16i() = 0;
-    virtual t_CKINT read8i() = 0;
-    virtual t_CKSINGLE read32f() = 0;
-    virtual t_CKDOUBLE read64f() = 0;
-
-    // done
-    virtual t_CKBOOL close() = 0;
-
-// constants
-public:
-    static const t_CKINT READ;
-    static const t_CKINT WRITE;
-    static const t_CKINT APPEND;
-    static const t_CKINT TRUNCATE;
-    static const t_CKINT ASCII;
-    static const t_CKINT BINARY;
-
-// static utilities
-public:
-    static Chuck_IO_File * openFile( const std::string &amp; path, t_CKINT flags );
-
-    // more stuff
-    static t_CKBOOL isFile( const std::string &amp; path );
-    static t_CKBOOL isDir( const std::string &amp; path );
-    static t_CKINT getSize( const std::string &amp; path );
-    static std::string currentDir();
-    static std::string changeDir( const std::string &amp; to );
-    static void getContent( std::vector&lt;std::string&gt; &amp; content );
-    static std::string baseName( const std::string &amp; path );
-
-// can't instantiate one of these
-protected:
-    Chuck_IO();
+    // writing
+    virtual void write( const std::string &amp; val ) = 0;
+    virtual void write( t_CKINT val ) = 0;
+    virtual void write( t_CKFLOAT val ) = 0;
+    
+    // constants
+public:
+    static const t_CKINT READ_INT32;
+    static const t_CKINT READ_INT16;
+    static const t_CKINT READ_INT8;
+    
+    // asynchronous I/O members
+    static const t_CKINT MODE_SYNC;
+    static const t_CKINT MODE_ASYNC;
+    Chuck_Event *m_asyncEvent;
+    XThread *m_thread;
+    struct async_args {
+        Chuck_IO_File *fileio_obj;
+        void *RETURN; // actually a Chuck_DL_Return
+        t_CKINT intArg;
+        t_CKFLOAT floatArg;
+        std::string stringArg;
+    };
 };
 
 
-
-
 //-----------------------------------------------------------------------------
 // name: Chuck_IO_File
 // desc: Chuck File IO class
@@ -428,43 +417,71 @@ struct Chuck_IO_File : Chuck_IO
 public:
     Chuck_IO_File();
     virtual ~Chuck_IO_File();
-
+    
 public:
-    // open
-    t_CKBOOL open( const std::string &amp; path, t_CKINT flags );
-    t_CKBOOL close();
-
-    // query
-    virtual t_CKBOOL more();
-    virtual t_CKBOOL eof();
-    virtual t_CKBOOL good2read();
-    virtual t_CKBOOL good2write();
-
-    // ascii
-    virtual t_CKINT readInt();
+    // meta
+    virtual t_CKBOOL open( const std::string &amp; path, t_CKINT flags );
+    virtual t_CKBOOL good();
+    virtual void close();
+    virtual void flush();
+    virtual t_CKINT mode();
+    virtual void mode( t_CKINT flag );
+    virtual t_CKINT size();
+    
+    // seeking
+    virtual void seek( t_CKINT pos );
+    virtual t_CKINT tell();
+    
+    // directories
+    virtual t_CKINT isDir();
+    virtual Chuck_Array4 * dirList();
+    
+    // reading
+    // virtual Chuck_String * read( t_CKINT length );
+    virtual Chuck_String * readLine();
+    virtual t_CKINT readInt( t_CKINT flags );
     virtual t_CKFLOAT readFloat();
-    virtual std::string readString();
-    virtual std::string readLine();
-    virtual t_CKBOOL writeInt( t_CKINT val );
-    virtual t_CKBOOL writeFloat( t_CKFLOAT val );
-    virtual t_CKBOOL writeString( const std::string &amp; val );
-    virtual t_CKBOOL writeLine( const std::string &amp; val );
+    virtual t_CKBOOL readString( std::string &amp; str );
+    virtual t_CKBOOL eof();
+    
+    // reading -- async
+    /* TODO: doesn't look like asynchronous reads will work
+     static THREAD_RETURN ( THREAD_TYPE read_thread ) ( void *data );
+     static THREAD_RETURN ( THREAD_TYPE readLine_thread ) ( void *data );
+     static THREAD_RETURN ( THREAD_TYPE readInt_thread ) ( void *data );
+     static THREAD_RETURN ( THREAD_TYPE readFloat_thread ) ( void *data );
+     */
+    
+    // writing
+    virtual void write( const std::string &amp; val );
+    virtual void write( t_CKINT val );
+    virtual void write( t_CKFLOAT val );
+    
+    // writing -- async
+    static THREAD_RETURN ( THREAD_TYPE writeStr_thread ) ( void *data );
+    static THREAD_RETURN ( THREAD_TYPE writeInt_thread ) ( void *data );
+    static THREAD_RETURN ( THREAD_TYPE writeFloat_thread ) ( void *data );
+    
+public:
+    // constants
+    static const t_CKINT FLAG_READ_WRITE;
+    static const t_CKINT FLAG_READONLY;
+    static const t_CKINT FLAG_WRITEONLY;
+    static const t_CKINT FLAG_APPEND;
+    static const t_CKINT TYPE_ASCII;
+    static const t_CKINT TYPE_BINARY;
     
-    // binary
-    virtual t_CKINT read32i();
-    virtual t_CKINT read24i();
-    virtual t_CKINT read16i();
-    virtual t_CKINT read8i();
-    virtual t_CKSINGLE read32f();
-    virtual t_CKDOUBLE read64f();
-
 protected:
-    // open floags
+    // open flags
     t_CKINT m_flags;
-    // ready flags
-    t_CKINT m_ready_flags;
-    // in file
+    // I/O mode
+    t_CKINT m_iomode;
+    // file stream
     std::fstream m_io;
+    // directory pointer
+    DIR * m_dir;
+    // directory location
+    long m_dir_start;
     // path
     std::string m_path;
 };
@@ -472,4 +489,77 @@ protected:
 
 
 
+//-----------------------------------------------------------------------------
+// name: Chuck_IO_Chout
+// desc: Chuck console IO out
+//-----------------------------------------------------------------------------
+struct Chuck_IO_Chout : Chuck_IO
+{
+public:
+    Chuck_IO_Chout();
+    virtual ~Chuck_IO_Chout();
+
+    static Chuck_IO_Chout * our_chout;
+    static Chuck_IO_Chout * getInstance();
+    
+public:
+    // meta
+    virtual t_CKBOOL good();
+    virtual void close();
+    virtual void flush();
+    virtual t_CKINT mode();
+    virtual void mode( t_CKINT flag );
+    
+    // reading
+    virtual Chuck_String * readLine();
+    virtual t_CKINT readInt( t_CKINT flags );
+    virtual t_CKFLOAT readFloat();
+    virtual t_CKBOOL readString( std::string &amp; str );
+    virtual t_CKBOOL eof();
+
+    // writing
+    virtual void write( const std::string &amp; val );
+    virtual void write( t_CKINT val );
+    virtual void write( t_CKFLOAT val );
+};
+
+
+
+
+//-----------------------------------------------------------------------------
+// name: Chuck_IO_Cherr
+// desc: Chuck console IO err
+//-----------------------------------------------------------------------------
+struct Chuck_IO_Cherr : Chuck_IO
+{
+public:
+    Chuck_IO_Cherr();
+    virtual ~Chuck_IO_Cherr();
+    
+    static Chuck_IO_Cherr * our_cherr;
+    static Chuck_IO_Cherr * getInstance();
+    
+public:
+    // meta
+    virtual t_CKBOOL good();
+    virtual void close();
+    virtual void flush();
+    virtual t_CKINT mode();
+    virtual void mode( t_CKINT flag );
+    
+    // reading
+    virtual Chuck_String * readLine();
+    virtual t_CKINT readInt( t_CKINT flags );
+    virtual t_CKFLOAT readFloat();
+    virtual t_CKBOOL readString( std::string &amp; str );
+    virtual t_CKBOOL eof();
+    
+    // writing
+    virtual void write( const std::string &amp; val );
+    virtual void write( t_CKINT val );
+    virtual void write( t_CKFLOAT val );
+};
+
+
+
 #endif</diff>
      <filename>src/chuck_oo.h</filename>
    </modified>
    <modified>
      <diff>@@ -67,6 +67,8 @@ Chuck_Type t_uanablob( te_uanablob, &quot;UAnaBlob&quot;, &amp;t_object, sizeof(void *) );
 Chuck_Type t_shred( te_shred, &quot;Shred&quot;, &amp;t_object, sizeof(void *) );
 Chuck_Type t_io( te_io, &quot;IO&quot;, &amp;t_object, sizeof(void *) );
 Chuck_Type t_fileio( te_fileio, &quot;FileIO&quot;, &amp;t_io, sizeof(void *) );
+Chuck_Type t_chout( te_chout, &quot;StdOut&quot;, &amp;t_io, sizeof(void *) );
+Chuck_Type t_cherr( te_cherr, &quot;StdErr&quot;, &amp;t_io, sizeof(void *) );
 Chuck_Type t_thread( te_thread, &quot;Thread&quot;, &amp;t_object, sizeof(void *) );
 Chuck_Type t_class( te_class, &quot;Class&quot;, &amp;t_object, sizeof(void *) );
 
@@ -225,6 +227,8 @@ Chuck_Env * type_engine_init( Chuck_VM * vm )
     env-&gt;global()-&gt;type.add( t_event.name, &amp;t_event );        t_event.lock();
     env-&gt;global()-&gt;type.add( t_io.name, &amp;t_io );              t_io.lock();
     env-&gt;global()-&gt;type.add( t_fileio.name, &amp;t_fileio );      t_fileio.lock();
+    env-&gt;global()-&gt;type.add( t_chout.name, &amp;t_chout );        t_chout.lock();
+    env-&gt;global()-&gt;type.add( t_cherr.name, &amp;t_cherr );        t_cherr.lock();
 
     // dur value
     t_CKDUR samp = 1.0;
@@ -249,6 +253,7 @@ Chuck_Env * type_engine_init( Chuck_VM * vm )
     init_class_shred( env, &amp;t_shred );
     init_class_event( env, &amp;t_event );
     init_class_io( env, &amp;t_io );
+    init_class_fileio( env, &amp;t_fileio );
 
     EM_log( CK_LOG_SEVERE, &quot;class 'class'&quot; );
     t_class.info = new Chuck_Namespace;
@@ -276,6 +281,8 @@ Chuck_Env * type_engine_init( Chuck_VM * vm )
     env-&gt;global()-&gt;value.add( &quot;maybe&quot;, new Chuck_Value( &amp;t_int, &quot;maybe&quot;, new t_CKFLOAT(.5), FALSE ) );
     env-&gt;global()-&gt;value.add( &quot;pi&quot;, new Chuck_Value( &amp;t_float, &quot;pi&quot;, new t_CKFLOAT(ONE_PI), TRUE ) );
     env-&gt;global()-&gt;value.add( &quot;global&quot;, new Chuck_Value( &amp;t_class, &quot;global&quot;, env-&gt;global(), TRUE ) );
+    env-&gt;global()-&gt;value.add( &quot;chout&quot;, new Chuck_Value( &amp;t_io, &quot;chout&quot;, Chuck_IO_Chout::getInstance(), TRUE ) );
+    env-&gt;global()-&gt;value.add( &quot;cherr&quot;, new Chuck_Value( &amp;t_io, &quot;cherr&quot;, Chuck_IO_Cherr::getInstance(), TRUE ) );
 
     // TODO: can't use the following now is local to shred
     // env-&gt;global()-&gt;value.add( &quot;now&quot;, new Chuck_Value( &amp;t_time, &quot;now&quot;, &amp;(vm-&gt;shreduler()-&gt;now_system), TRUE ) );
@@ -339,6 +346,8 @@ Chuck_Env * type_engine_init( Chuck_VM * vm )
     env-&gt;key_values[&quot;dac&quot;] = TRUE;
     env-&gt;key_values[&quot;blackhole&quot;] = TRUE;
     env-&gt;key_values[&quot;global&quot;] = TRUE;
+    env-&gt;key_values[&quot;chout&quot;] = TRUE;
+    env-&gt;key_values[&quot;cherr&quot;] = TRUE;
     env-&gt;key_values[&quot;null&quot;] = TRUE;
     env-&gt;key_values[&quot;NULL&quot;] = TRUE;
 
@@ -356,6 +365,9 @@ Chuck_Env * type_engine_init( Chuck_VM * vm )
     // env-&gt;key_types[&quot;machine&quot;] = TRUE;
     // env-&gt;key_types[&quot;language&quot;] = TRUE;
     // env-&gt;key_types[&quot;compiler&quot;] = TRUE;
+    
+    // ge and spencer reserve this one
+    env-&gt;key_values[&quot;newlineEx2VistaHWNDVisualFoxProA&quot;] = TRUE;
 
     // commit the global namespace
     env-&gt;global()-&gt;commit();
@@ -392,6 +404,7 @@ void type_engine_shutdown( Chuck_Env * env )
     SAFE_RELEASE( t_class.info );
     SAFE_RELEASE( t_thread.info );
     SAFE_RELEASE( t_io.info );
+    SAFE_RELEASE( t_fileio.info );
 }
 
 
@@ -804,7 +817,24 @@ t_CKBOOL type_engine_check_if( Chuck_Env * env, a_Stmt_If stmt )
     if( !type_engine_check_exp( env, stmt-&gt;cond ) )
         return FALSE;
         
-    // TODO: ensure that conditional has valid type
+    // ensure that conditional has valid type
+    switch( stmt-&gt;cond-&gt;type-&gt;xid )
+    {
+    case te_int:
+    case te_float:
+    case te_dur:
+    case te_time:
+        break;
+        
+    default:
+        // check for IO
+        if( isa( stmt-&gt;cond-&gt;type, &amp;t_io ) ) break;
+
+        // error
+        EM_error2( stmt-&gt;cond-&gt;linepos,
+            &quot;invalid type '%s' in if condition&quot;, stmt-&gt;cond-&gt;type-&gt;name.c_str() );
+        return FALSE;
+    }
 
     // check if
     if( !type_engine_check_stmt( env, stmt-&gt;if_body ) )
@@ -835,7 +865,24 @@ t_CKBOOL type_engine_check_for( Chuck_Env * env, a_Stmt_For stmt )
     if( !type_engine_check_stmt( env, stmt-&gt;c2 ) )
         return FALSE;
 
-    // TODO: same as if - check conditional type valid
+    // ensure that conditional has valid type
+    switch( stmt-&gt;c2-&gt;stmt_exp-&gt;type-&gt;xid )
+    {
+    case te_int:
+    case te_float:
+    case te_dur:
+    case te_time:
+        break;
+        
+    default:
+        // check for IO
+        if( isa( stmt-&gt;c2-&gt;stmt_exp-&gt;type, &amp;t_io ) ) break;
+
+        // error
+        EM_error2( stmt-&gt;c2-&gt;stmt_exp-&gt;linepos,
+            &quot;invalid type '%s' in for condition&quot;, stmt-&gt;c2-&gt;stmt_exp-&gt;type-&gt;name.c_str() );
+        return FALSE;
+    }
 
     // check the post
     if( stmt-&gt;c3 &amp;&amp; !type_engine_check_exp( env, stmt-&gt;c3 ) )
@@ -869,7 +916,24 @@ t_CKBOOL type_engine_check_while( Chuck_Env * env, a_Stmt_While stmt )
     if( !type_engine_check_exp( env, stmt-&gt;cond ) )
         return FALSE;
         
-    // TODO: same as if - ensure the type in conditional is valid
+    // ensure that conditional has valid type
+    switch( stmt-&gt;cond-&gt;type-&gt;xid )
+    {
+    case te_int:
+    case te_float:
+    case te_dur:
+    case te_time:
+        break;
+        
+    default:
+        // check for IO
+        if( isa( stmt-&gt;cond-&gt;type, &amp;t_io ) ) break;
+
+        // error
+        EM_error2( stmt-&gt;cond-&gt;linepos,
+            &quot;invalid type '%s' in while condition&quot;, stmt-&gt;cond-&gt;type-&gt;name.c_str() );
+        return FALSE;
+    }
 
     // for break and continue statement
     env-&gt;breaks.push_back( stmt-&gt;self );
@@ -898,7 +962,24 @@ t_CKBOOL type_engine_check_until( Chuck_Env * env, a_Stmt_Until stmt )
     if( !type_engine_check_exp( env, stmt-&gt;cond ) )
         return FALSE;
         
-    // TODO: same as if - ensure the type in conditional is valid
+    // ensure that conditional has valid type
+    switch( stmt-&gt;cond-&gt;type-&gt;xid )
+    {
+    case te_int:
+    case te_float:
+    case te_dur:
+    case te_time:
+        break;
+        
+    default:
+        // check for IO
+        if( isa( stmt-&gt;cond-&gt;type, &amp;t_io ) ) break;
+
+        // error
+        EM_error2( stmt-&gt;cond-&gt;linepos,
+            &quot;invalid type '%s' in until condition&quot;, stmt-&gt;cond-&gt;type-&gt;name.c_str() );
+        return FALSE;
+    }
 
     // for break and continue statement
     env-&gt;breaks.push_back( stmt-&gt;self );
@@ -1252,6 +1333,7 @@ t_CKTYPE type_engine_check_op( Chuck_Env * env, ae_Operator op, a_Exp lhs, a_Exp
     }
 
     // file I/O
+    /*
     if( op == ae_op_arrow_left || op == ae_op_arrow_right )
     {
         // check left
@@ -1272,7 +1354,8 @@ t_CKTYPE type_engine_check_op( Chuck_Env * env, ae_Operator op, a_Exp lhs, a_Exp
                 return left;
         }
     }
-
+    */
+    
     // implicit cast
     if( *left != *right )
     {
@@ -1549,6 +1632,19 @@ t_CKTYPE type_engine_check_op( Chuck_Env * env, ae_Operator op, a_Exp lhs, a_Exp
     case ae_op_lt:
     case ae_op_gt:
     case ae_op_le:
+        // file output
+        if( isa( left, &amp;t_io ) )
+        {
+            if( isa( right, &amp;t_int ) ) return left;
+            else if( isa( right, &amp;t_float ) ) return left;
+            else if( isa( right, &amp;t_string ) ) return left;
+            else // error
+            {
+                EM_error2( lhs-&gt;linepos, &quot;on suitable IO action for '%s' &lt;= '%s'...&quot;,
+                    left-&gt;c_name(), right-&gt;c_name() );
+                return NULL;
+            }
+        }
     case ae_op_ge:
     case ae_op_neq:
         LR( te_int, te_int ) return &amp;t_int;
@@ -1680,6 +1776,28 @@ t_CKTYPE type_engine_check_op_chuck( Chuck_Env * env, a_Exp lhs, a_Exp rhs,
         return right;
     }
     
+    // input ( IO =&gt; int ), (IO =&gt; float)
+    if( isa( left, &amp;t_io ) )
+    {
+        // right hand side
+        if( rhs-&gt;s_meta != ae_meta_var )
+        {
+            // error
+            EM_error2( rhs-&gt;linepos,
+                &quot;cannot perform I/O assignment via '=&gt;' to non-mutable value&quot; );
+            return NULL;
+        }
+
+        // check right
+        if( isa( right, &amp;t_int ) || isa( right, &amp;t_float ) ||
+            isa( right, &amp;t_string ) )
+        {
+            // emit ref
+            rhs-&gt;emit_var = TRUE;
+            return left;
+        }
+    }
+
     // object.toString
 
     // implicit cast
@@ -2839,15 +2957,17 @@ string type_engine_print_exp_dot_member( Chuck_Env * env, a_Exp_Dot_Member membe
 
 
 //-----------------------------------------------------------------------------
-// name: find_func_match()
+// name: find_func_match_actual()
 // desc: ...
 //-----------------------------------------------------------------------------
-Chuck_Func * find_func_match( Chuck_Func * up, a_Exp args, t_CKBOOL implicit )
+Chuck_Func * find_func_match_actual( Chuck_Func * up, a_Exp args, 
+                                     t_CKBOOL implicit, t_CKBOOL specific )
 {
     a_Exp e;
     a_Arg_List e1;
     t_CKUINT count;
     Chuck_Func * func;
+    t_CKBOOL match = FALSE;
 
     // see if args is nil
     if( args &amp;&amp; args-&gt;type == &amp;t_void )
@@ -2870,8 +2990,11 @@ Chuck_Func * find_func_match( Chuck_Func * up, a_Exp args, t_CKBOOL implicit )
                 // check for extra arguments
                 if( e1 == NULL ) goto moveon;
 
+                // get match
+                match = specific ? e-&gt;type == e1-&gt;type : isa( e-&gt;type, e1-&gt;type );
+
                 // no match
-                if( !isa( e-&gt;type, e1-&gt;type ) )
+                if( !match )
                 {
                     // TODO: fix this for overload implicit cast (multiple matches)
                     if( implicit &amp;&amp; *e-&gt;type == t_int &amp;&amp; *e1-&gt;type == t_float )
@@ -2908,6 +3031,36 @@ moveon:
 
 
 //-----------------------------------------------------------------------------
+// name: find_func_match()
+// desc: ...
+//-----------------------------------------------------------------------------
+Chuck_Func * find_func_match( Chuck_Func * up, a_Exp args )
+{
+    Chuck_Func * func = NULL;
+
+    // try to find specific
+    func = find_func_match_actual( up, args, FALSE, TRUE );
+    if( func ) return func;
+
+    // try to find specific with implicit
+    func = find_func_match_actual( up, args, TRUE, TRUE );
+    if( func ) return func;
+
+    // try to find non-specific
+    func = find_func_match_actual( up, args, FALSE, FALSE );
+    if( func ) return func;
+
+    // try to find non-specific with implicit
+    func = find_func_match_actual( up, args, TRUE, FALSE );
+    if( func ) return func;
+
+    return NULL;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
 // name: type_engine_check_exp_func_call()
 // desc: ...
 //-----------------------------------------------------------------------------
@@ -2943,9 +3096,7 @@ t_CKTYPE type_engine_check_exp_func_call( Chuck_Env * env, a_Exp exp_func, a_Exp
     }
 
     // look for a match
-    func = find_func_match( up, args, FALSE );
-    // look for a match (with implicit cast)
-    if( !func ) func = find_func_match( up, args, TRUE );
+    func = find_func_match( up, args );
 
     // no func
     if( !func )
@@ -4606,7 +4757,7 @@ Chuck_Type * type_engine_import_ugen_begin( Chuck_Env * env, const char * name,
 
     // construct class
     if( !(type = type_engine_import_class_begin( env, name, parent, where, pre_ctor, dtor ) ) )
-        return FALSE;
+        return NULL;
 
     // make sure parent is ugen
     assert( type-&gt;parent != NULL );
@@ -4616,7 +4767,7 @@ Chuck_Type * type_engine_import_ugen_begin( Chuck_Env * env, const char * name,
         EM_error2( 0,
             &quot;imported class '%s' does not have a ugen as parent&quot;,
             type-&gt;c_name() );
-        return FALSE;
+        return NULL;
     }
 
     // do the ugen part
@@ -4656,7 +4807,7 @@ Chuck_Type * type_engine_import_uana_begin( Chuck_Env * env, const char * name,
     // construct class
     if( !(type = type_engine_import_ugen_begin( env, name, parent, where, pre_ctor, dtor,
                                                 tick, pmsg, num_ins, num_outs ) ) )
-        return FALSE;
+        return NULL;
 
     // make sure parent is ugen
     assert( type-&gt;parent != NULL );
@@ -4666,7 +4817,7 @@ Chuck_Type * type_engine_import_uana_begin( Chuck_Env * env, const char * name,
         EM_error2( 0,
             &quot;imported class '%s' does not have a uana as parent&quot;,
             type-&gt;c_name() );
-        return FALSE;
+        return NULL;
     }
 
     // do the info</diff>
      <filename>src/chuck_type.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -52,7 +52,7 @@ typedef enum {
     te_complex, te_polar, te_string, te_thread, te_shred, te_class,
     te_function, te_object, te_user, te_array, te_null, te_ugen, te_uana, 
     te_event, te_void, te_stdout, te_stderr, te_adc, te_dac, te_bunghole, 
-    te_uanablob, te_io, te_fileio, te_multi
+    te_uanablob, te_io, te_fileio, te_chout, te_cherr, te_multi
 } te_Type;
 
 
@@ -809,6 +809,8 @@ extern Chuck_Type t_class;
 extern Chuck_Type t_event;
 extern Chuck_Type t_io;
 extern Chuck_Type t_fileio;
+extern Chuck_Type t_chout;
+extern Chuck_Type t_cherr;
 extern Chuck_Type t_ugen;
 extern Chuck_Type t_uana;
 extern Chuck_Type t_uanablob;</diff>
      <filename>src/chuck_type.h</filename>
    </modified>
    <modified>
      <diff>@@ -200,6 +200,9 @@ void Chuck_UGen::init()
     m_pan = 1.0f;
     m_next = 0.0f;
     m_use_next = FALSE;
+    
+    m_sum_v = NULL;
+    m_current_v = NULL;
 
     shred = NULL;
     owner = NULL;
@@ -230,6 +233,10 @@ void Chuck_UGen::done()
     fa_done( m_dest_list, m_dest_cap );
     fa_done( m_src_uana_list, m_src_uana_cap );
     fa_done( m_dest_uana_list, m_dest_uana_cap );
+    
+    // reclaim
+    SAFE_DELETE_ARRAY( m_sum_v );
+    SAFE_DELETE_ARRAY( m_current_v );
 
     // TODO: m_multi_chan, break ref count loop
 }
@@ -238,6 +245,31 @@ void Chuck_UGen::done()
 
 
 //-----------------------------------------------------------------------------
+// name: alloc_v()
+// desc: ...
+//-----------------------------------------------------------------------------
+t_CKBOOL Chuck_UGen::alloc_v( t_CKUINT size )
+{
+    // reclaim
+    SAFE_DELETE_ARRAY( m_sum_v );
+    SAFE_DELETE_ARRAY( m_current_v );
+
+    // go
+    if( size &gt; 0 )
+    {
+        m_sum_v = new SAMPLE[size];
+        m_current_v = new SAMPLE[size];
+
+        return ( m_sum_v != NULL &amp;&amp; m_current_v != NULL );
+    }
+    
+    return TRUE;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
 // name: alloc_multi_chan()
 // desc: ...
 //-----------------------------------------------------------------------------
@@ -417,7 +449,8 @@ t_CKBOOL Chuck_UGen::remove( Chuck_UGen * src )
                 for( t_CKUINT k = j+1; k &lt; m_num_uana_src; k++ )
                     m_src_uana_list[k-1] = m_src_uana_list[k];
                 
-                m_src_uana_list[--m_num_uana_src] = NULL;                
+                m_src_uana_list[--m_num_uana_src] = NULL;
+                --j;
             }
 
         // remove
@@ -431,6 +464,7 @@ t_CKBOOL Chuck_UGen::remove( Chuck_UGen * src )
                 m_src_list[--m_num_src] = NULL;
                 src-&gt;remove_by( this );
                 src-&gt;release();
+                --i;
             }
         
     }
@@ -486,6 +520,7 @@ void Chuck_UGen::remove_by( Chuck_UGen * dest )
             
             // null last element
             m_dest_uana_list[--m_num_uana_dest] = NULL;
+            j--;
         }
 
     // remove
@@ -500,6 +535,7 @@ void Chuck_UGen::remove_by( Chuck_UGen * dest )
             dest-&gt;release();
             // null the last element
             m_dest_list[--m_num_dest] = NULL;
+            i--;
         }
 }
 
@@ -692,6 +728,121 @@ t_CKBOOL Chuck_UGen::system_tick( t_CKTIME now )
 
 
 //-----------------------------------------------------------------------------
+// name: tick_v()
+// dsec: ...
+//-----------------------------------------------------------------------------
+t_CKBOOL Chuck_UGen::system_tick_v( t_CKTIME now, t_CKUINT numFrames )
+{
+    if( m_time &gt;= now )
+        return m_valid;
+    
+    t_CKUINT i, j; Chuck_UGen * ugen; SAMPLE factor;
+    
+    // inc time
+    m_time = now;
+
+    if( m_num_src )
+    {
+        ugen = m_src_list[0];
+        if( ugen-&gt;m_time &lt; now ) ugen-&gt;system_tick_v( now, numFrames );
+        memcpy( m_sum_v, ugen-&gt;m_current_v, numFrames * sizeof(SAMPLE) );
+        
+        // tick the src list
+        for( i = 1; i &lt; m_num_src; i++ )
+        {
+            ugen = m_src_list[i];
+            if( ugen-&gt;m_time &lt; now ) ugen-&gt;system_tick_v( now, numFrames );
+            if( ugen-&gt;m_valid )
+            {
+                if( m_op &lt;= 1 )
+                    for( j = 0; j &lt; numFrames; j++ )
+                        m_sum_v[j] += ugen-&gt;m_current_v[j];
+                else // special ops
+                {
+                    switch( m_op )
+                    {
+                        case 2: for( j = 0; j &lt; numFrames; j++ )
+                            m_sum_v[j] -= ugen-&gt;m_current_v[j]; break;
+                        case 3: for( j = 0; j &lt; numFrames; j++ )
+                            m_sum_v[j] *= ugen-&gt;m_current_v[j]; break;
+                        case 4: for( j = 0; j &lt; numFrames; j++ )
+                            m_sum_v[j] /= ugen-&gt;m_current_v[j]; break;
+                        default: for( j = 0; j &lt; numFrames; j++ )
+                            m_sum_v[j] += ugen-&gt;m_current_v[j]; break;
+                    }
+                }
+            }
+        }
+    }
+    else
+    {
+        memset( m_sum_v, 0, numFrames * sizeof(SAMPLE) );
+    }
+
+    // tick multiple channels
+    if( m_multi_chan_size )
+    {
+        // initialize
+        factor = 1.0f / m_multi_chan_size;
+        // iterate
+        for( i = 0; i &lt; m_multi_chan_size; i++ )
+        {
+            ugen = m_multi_chan[i];
+            if( ugen-&gt;m_time &lt; now ) ugen-&gt;system_tick_v( now, numFrames );
+            for( j = 0; j &lt; numFrames; j++ )
+                m_sum_v[j] += ugen-&gt;m_current_v[j] * factor;
+        }
+    }
+    
+    // if owner
+    if( owner != NULL &amp;&amp; owner-&gt;m_time &lt; now )
+        owner-&gt;system_tick_v( now, numFrames );
+    
+    if( m_op &gt; 0 )  // UGEN_OP_TICK
+    {
+        // tick the ugen
+        if( tick ) 
+            for( j = 0; j &lt; numFrames; j++ )
+                m_valid = tick( this, m_sum_v[j], &amp;(m_current_v[j]), NULL );
+        if( !m_valid )
+            for( j = 0; j &lt; numFrames; j++ )
+                m_current_v[j] = 0.0f;
+        else
+            for( j = 0; j &lt; numFrames; j++ )
+            {
+                // apply gain and pan
+                m_current_v[j] *= m_gain * m_pan;
+                // dedenormal
+                CK_DDN( m_current_v[j] );
+            }
+        // save as last
+        m_last = m_current_v[numFrames-1];
+        return m_valid;
+    }
+    else if( m_op &lt; 0 ) // UGEN_OP_PASS
+    {
+        for( j = 0; j &lt; numFrames; j++ )
+        {
+            // pass through
+            m_current_v[j] = m_sum_v[j];
+        }
+        m_last = m_current_v[numFrames-1];
+        return TRUE;
+    }
+    else // UGEN_OP_STOP
+    {
+        memset( m_current_v, 0, numFrames * sizeof(SAMPLE) );
+        // m_current = 0.0f;
+    }
+    
+    m_last = m_current_v[numFrames-1];
+    return TRUE;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
 // name: Chuck_UAna()
 // desc: constructor
 //-----------------------------------------------------------------------------</diff>
      <filename>src/chuck_ugen.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -72,6 +72,8 @@ public: // src
     t_CKBOOL is_connected_from( Chuck_UGen * src );
     t_CKUINT disconnect( t_CKBOOL recursive );
     t_CKUINT system_tick( t_CKTIME now );
+    t_CKUINT system_tick_v( t_CKTIME now, t_CKUINT numFrames );
+    t_CKBOOL alloc_v( t_CKUINT size );
 
 protected:
     t_CKVOID add_by( Chuck_UGen * dest, t_CKBOOL isUpChuck );
@@ -117,6 +119,10 @@ public: // data
     SAMPLE m_gain;
     SAMPLE m_pan;
     t_CKINT m_op;
+    
+    // block processing
+    SAMPLE * m_sum_v;
+    SAMPLE * m_current_v;
 
     // the shred on which the ugen is created
     Chuck_VM_Shred * shred;</diff>
      <filename>src/chuck_ugen.h</filename>
    </modified>
    <modified>
      <diff>@@ -152,6 +152,8 @@ Chuck_VM::~Chuck_VM()
 }
 
 
+
+
 // dac tick
 //UGEN_TICK __dac_tick( Chuck_Object * SELF, SAMPLE in, SAMPLE * out ) 
 //{ *out = in; return TRUE; }
@@ -243,7 +245,7 @@ t_CKBOOL Chuck_VM::set_priority( t_CKINT priority, Chuck_VM * vm )
 t_CKBOOL Chuck_VM::initialize( t_CKBOOL enable_audio, t_CKBOOL halt, t_CKUINT srate,
                                t_CKUINT buffer_size, t_CKUINT num_buffers,
                                t_CKUINT dac, t_CKUINT adc, t_CKUINT dac_chan,
-                               t_CKUINT adc_chan, t_CKBOOL block )
+                               t_CKUINT adc_chan, t_CKBOOL block, t_CKUINT adaptive )
 {
     if( m_init )
     {
@@ -275,6 +277,7 @@ t_CKBOOL Chuck_VM::initialize( t_CKBOOL enable_audio, t_CKBOOL halt, t_CKUINT sr
     m_shreduler = new Chuck_VM_Shreduler;
     m_shreduler-&gt;bbq = m_bbq;
     m_shreduler-&gt;rt_audio = enable_audio;
+    m_shreduler-&gt;set_adaptive( adaptive &gt; 0 ? adaptive : 0 );
 
     // log
     EM_log( CK_LOG_SYSTEM, &quot;allocating messaging buffers...&quot; );
@@ -298,6 +301,7 @@ t_CKBOOL Chuck_VM::initialize( t_CKBOOL enable_audio, t_CKBOOL halt, t_CKUINT sr
     {
         EM_log( CK_LOG_SYSTEM, &quot;num buffers: %ld&quot;, num_buffers );
         EM_log( CK_LOG_SYSTEM, &quot;devices adc: %ld dac: %d (default 0)&quot;, adc, dac );
+        EM_log( CK_LOG_SYSTEM, &quot;adaptive block processing: %ld&quot;, adaptive &gt; 1 ? adaptive : 0 ); 
     }
     EM_log( CK_LOG_SYSTEM, &quot;channels in: %ld out: %ld&quot;, adc_chan, dac_chan );
     m_num_adc_channels = adc_chan;
@@ -383,6 +387,7 @@ t_CKBOOL Chuck_VM::initialize_synthesis( )
     m_bunghole-&gt;lock();
     initialize_object( m_bunghole, &amp;t_ugen );
     m_bunghole-&gt;tick = NULL;
+    m_bunghole-&gt;alloc_v( m_shreduler-&gt;m_max_block_size );
     m_shreduler-&gt;m_dac = m_dac;
     m_shreduler-&gt;m_adc = m_adc;
     m_shreduler-&gt;m_bunghole = m_bunghole;
@@ -700,10 +705,12 @@ t_CKBOOL Chuck_VM::run( t_CKINT num_samps )
         if( !m_audio_started ) start_audio();
 
         // advance the shreduler
-        m_shreduler-&gt;advance();
-
-        // count
-        if( num_samps &gt; 0 ) num_samps--;
+        if( !m_shreduler-&gt;m_adaptive )
+        {
+            m_shreduler-&gt;advance();
+            if( num_samps &gt; 0 ) num_samps--;
+        }
+        else m_shreduler-&gt;advance_v( num_samps );
     }
 
     return FALSE;
@@ -1612,6 +1619,8 @@ Chuck_VM_Shreduler::Chuck_VM_Shreduler()
     m_bunghole = NULL;
     m_num_dac_channels = 0;
     m_num_adc_channels = 0;
+    
+    set_adaptive( 0 );
 }
 
 
@@ -1654,6 +1663,20 @@ t_CKBOOL Chuck_VM_Shreduler::shutdown()
 
 
 //-----------------------------------------------------------------------------
+// name: set_adaptive()
+// desc: ...
+//-----------------------------------------------------------------------------
+void Chuck_VM_Shreduler::set_adaptive( t_CKUINT max_block_size )
+{
+    m_max_block_size = max_block_size &gt; 1 ? max_block_size : 0;
+    m_adaptive = m_max_block_size &gt; 1;
+    m_samps_until_next = -1;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
 // name: add_blocked()
 // desc: add shred to the shreduler's blocked list
 //-----------------------------------------------------------------------------
@@ -1765,11 +1788,98 @@ t_CKBOOL Chuck_VM_Shreduler::shredule( Chuck_VM_Shred * shred,
         }
     }
 
+    t_CKTIME diff = shred_list-&gt;wake_time - this-&gt;now_system;
+    if( diff &lt; 0 ) diff = 0;
+    // if( diff &lt; m_samps_until_next )
+    m_samps_until_next = diff;
+    
     return TRUE;
 }
 
 
 
+
+//-----------------------------------------------------------------------------
+// name: advance_v()
+// desc: ...
+//-----------------------------------------------------------------------------
+void Chuck_VM_Shreduler::advance_v( t_CKINT &amp; numLeft )
+{
+    t_CKINT i, j, numFrames;
+    SAMPLE frame[128], gain[128], sum;
+    BBQ * audio = this-&gt;bbq;
+    
+    // compute number of frames to compute; update
+    numFrames = ck_min( m_max_block_size, numLeft );
+    if( this-&gt;m_samps_until_next &gt;= 0 )
+    {
+        numFrames = (t_CKINT)(ck_min( numFrames, this-&gt;m_samps_until_next ));
+        if( numFrames == 0 ) numFrames = 1;
+        this-&gt;m_samps_until_next -= numFrames;
+    }
+    numLeft -= numFrames;
+
+    // advance system 'now'
+    this-&gt;now_system += numFrames;
+
+    // tick in
+    if( rt_audio )
+    {
+        for( j = 0; j &lt; m_num_adc_channels; j++ )
+        {
+            // update channel
+            m_adc-&gt;m_multi_chan[j]-&gt;m_time = this-&gt;now_system;
+            // cache gain
+            gain[j] = m_adc-&gt;m_multi_chan[j]-&gt;m_gain;
+        }
+        
+        // adaptive block
+        for( i = 0; i &lt; numFrames; i++ )
+        {
+            // get input
+            audio-&gt;digi_in()-&gt;tick_in( frame, m_num_adc_channels );
+            // clear
+            sum = 0.0f;
+            // loop over channels
+            for( j = 0; j &lt; m_num_adc_channels; j++ )
+            {
+                m_adc-&gt;m_multi_chan[j]-&gt;m_current_v[i] = frame[j] * gain[j] * m_adc-&gt;m_gain;
+                sum += m_adc-&gt;m_multi_chan[j]-&gt;m_current_v[i];
+            }
+            m_adc-&gt;m_current_v[i] = sum / m_num_adc_channels;
+        }
+        
+        for( j = 0; j &lt; m_num_adc_channels; j++ )
+        {
+            // update last
+            m_adc-&gt;m_multi_chan[j]-&gt;m_last = m_adc-&gt;m_multi_chan[j]-&gt;m_current_v[numFrames-1];
+        }
+        // update last
+        m_adc-&gt;m_last = m_adc-&gt;m_current_v[numFrames-1];
+        // update time
+        m_adc-&gt;m_time = this-&gt;now_system;
+    }
+
+    // dac
+    m_dac-&gt;system_tick_v( this-&gt;now_system, numFrames );
+
+    // suck samples
+    m_bunghole-&gt;system_tick_v( this-&gt;now_system, numFrames );
+
+    // adaptive block
+    for( i = 0; i &lt; numFrames; i++ )
+    {
+        for( j = 0; j &lt; m_num_dac_channels; j++ )
+            frame[j] = m_dac-&gt;m_multi_chan[j]-&gt;m_current_v[i];
+        
+        // tick
+        audio-&gt;digi_out()-&gt;tick_out( frame, m_num_dac_channels );
+    }
+}
+
+
+
+
 //-----------------------------------------------------------------------------
 // name: advance2()
 // desc: ...
@@ -1837,6 +1947,7 @@ void Chuck_VM_Shreduler::advance( )
         for( i = 0; i &lt; m_num_adc_channels; i++ )
         {
             m_adc-&gt;m_multi_chan[i]-&gt;m_current = frame[i] * m_adc-&gt;m_multi_chan[i]-&gt;m_gain * m_adc-&gt;m_gain;
+            m_adc-&gt;m_multi_chan[i]-&gt;m_last = m_adc-&gt;m_multi_chan[i]-&gt;m_current;
             m_adc-&gt;m_multi_chan[i]-&gt;m_time = this-&gt;now_system;
             sum += m_adc-&gt;m_multi_chan[i]-&gt;m_current;
         }
@@ -1847,7 +1958,7 @@ void Chuck_VM_Shreduler::advance( )
     // dac
     m_dac-&gt;system_tick( this-&gt;now_system );
     for( i = 0; i &lt; m_num_dac_channels; i++ )
-        frame[i] = m_dac-&gt;m_multi_chan[i]-&gt;m_current * .5f;
+        frame[i] = m_dac-&gt;m_multi_chan[i]-&gt;m_current; // * .5f;
 
     // suck samples
     m_bunghole-&gt;system_tick( this-&gt;now_system );
@@ -1858,6 +1969,7 @@ void Chuck_VM_Shreduler::advance( )
 
 
 
+
 //-----------------------------------------------------------------------------
 // name: get()
 // desc: ...
@@ -1868,7 +1980,10 @@ Chuck_VM_Shred * Chuck_VM_Shreduler::get( )
 
     // list empty
     if( !shred )
+    {
+        m_samps_until_next = -1;
         return NULL;
+    }
 
     // TODO: should this be &lt;=?
     if( shred-&gt;wake_time &lt;= ( this-&gt;now_system + .5 ) )
@@ -1881,7 +1996,11 @@ Chuck_VM_Shred * Chuck_VM_Shreduler::get( )
         shred-&gt;prev = NULL;
         
         if( shred_list )
+        {
             shred_list-&gt;prev = NULL;
+            m_samps_until_next = shred_list-&gt;wake_time - this-&gt;now_system;
+            if( m_samps_until_next &lt; 0 ) m_samps_until_next = 0;
+        }
 
         return shred;
     }</diff>
      <filename>src/chuck_vm.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -291,6 +291,8 @@ public: // shreduling
     Chuck_VM_Shred * get( );
     void advance( );
     void advance2( );
+    void advance_v( t_CKINT &amp; num_left );
+    void set_adaptive( t_CKUINT max_block_size );
 
 public: // high-level shred interface
     t_CKBOOL remove( Chuck_VM_Shred * shred );
@@ -329,6 +331,11 @@ public:
     
     // status cache
     Chuck_VM_Status m_status;
+    
+    // max block size for adaptive block processing
+    t_CKUINT m_max_block_size;
+    t_CKBOOL m_adaptive;
+    t_CKDUR m_samps_until_next;
 };
 
 
@@ -353,7 +360,7 @@ public: // init
                          t_CKUINT buffer_size = 512, t_CKUINT num_buffers = 4,
                          t_CKUINT dac = 0, t_CKUINT adc = 0,
                          t_CKUINT dac_chan = 2, t_CKUINT adc_chan = 2,
-                         t_CKBOOL block = TRUE );
+                         t_CKBOOL block = TRUE, t_CKUINT adaptive = 0 );
     t_CKBOOL initialize_synthesis( );
     t_CKBOOL shutdown();
 </diff>
      <filename>src/chuck_vm.h</filename>
    </modified>
    <modified>
      <diff>@@ -3186,7 +3186,7 @@ yyreturn:
 /* A lexical scanner generated by flex */
 
 /* Scanner skeleton version:
- * $Header: /cvs/chuck/src/chuck_win32.c,v 1.92 2008/07/16 09:50:20 gw-chuck_int Exp $
+ * $Header: /cvs/chuck_dev/v2/chuck_win32.c,v 1.53 2007/08/17 04:23:12 gw-chuck Exp $
  */
 
 #define FLEX_SCANNER</diff>
      <filename>src/chuck_win32.c</filename>
    </modified>
    <modified>
      <diff>@@ -408,6 +408,10 @@ SOURCE=.\digiio_rtaudio.h
 # End Source File
 # Begin Source File
 
+SOURCE=.\dirent.h
+# End Source File
+# Begin Source File
+
 SOURCE=.\hidio_sdl.h
 # End Source File
 # Begin Source File</diff>
      <filename>src/chuck_win32.dsp</filename>
    </modified>
    <modified>
      <diff>@@ -33,8 +33,15 @@
 #include &quot;chuck_vm.h&quot;
 #include &quot;chuck_errmsg.h&quot;
 #include &quot;chuck_globals.h&quot;
+#ifndef __DISABLE_RTAUDIO__
 #include &quot;rtaudio.h&quot;
+#endif // __DISABLE_RTAUDIO__
+#if defined(__CHIP_MODE__)
+#include &quot;../small.h&quot;&gt;
+#endif // __CHIP_MODE__
+#ifndef __DISABLE_MIDI__
 #include &quot;rtmidi.h&quot;
+#endif // __DISABLE_MIDI__
 // #include &lt;signal.h&gt;
 #if (defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__)) &amp;&amp; !defined(__WINDOWS_PTHREAD__)
 #include &lt;windows.h&gt;
@@ -84,6 +91,7 @@ DWORD__ Digitalio::m_xrun = 0;
 
 
 
+#ifndef __DISABLE_RTAUDIO__
 //-----------------------------------------------------------------------------
 // name: print()
 // desc: ...
@@ -121,6 +129,7 @@ void print( const RtAudioDeviceInfo &amp; info )
         }
     }
 }
+#endif // __DISABLE_RTAUDIO__
 
 
 
@@ -131,6 +140,7 @@ void print( const RtAudioDeviceInfo &amp; info )
 //-----------------------------------------------------------------------------
 void Digitalio::probe()
 {
+#ifndef __DISABLE_RTAUDIO__
     RtAudio * rta = NULL;
     RtAudioDeviceInfo info;
     
@@ -166,6 +176,7 @@ void Digitalio::probe()
     }
 
     delete rta;
+#endif // __DISABLE_RTAUDIO__
 
     return;
 }
@@ -407,6 +418,7 @@ BOOL__ Digitalio::initialize( DWORD__ num_dac_channels,
     // if rt_audio is false, then set block to FALSE to avoid deadlock
     if( !rt_audio ) m_block = FALSE;
 
+#ifndef __DISABLE_RTAUDIO__    
     // if real-time audio
     if( rt_audio )
     {
@@ -492,6 +504,15 @@ BOOL__ Digitalio::initialize( DWORD__ num_dac_channels,
         // pop indent
         EM_poplog();
     }
+#endif // __DISABLE_RTAUDIO__
+
+#if defined(__CHIP_MODE__)
+    if( !SMALL::init( sampling_rate, buffer_size, 2 ) )
+    {
+        EM_error2( 0, &quot;%s&quot;, &quot;(chuck)error: unable to initialize SMALL...&quot; );
+        return m_init = FALSE;
+    }
+#endif // __CHIP_MODE__
 
     if( m_use_cb )
     {
@@ -675,17 +696,38 @@ int Digitalio::cb2( char * buffer, int buffer_size, void * user_data )
 
 
 
+#ifdef __SMALL_MODE__
+//-----------------------------------------------------------------------------
+// name: small_cb()
+// desc: ...
+//-----------------------------------------------------------------------------
+void small_cb( Float32 * buffer, UInt32 numFrames, void * userData )
+{
+    Digitalio::cb2( (char *)buffer, numFrames, userData );
+}
+#endif // __SMALL_MODE__
+
+
+
+
 //-----------------------------------------------------------------------------
 // name: start()
 // desc: ...
 //-----------------------------------------------------------------------------
 BOOL__ Digitalio::start( )
 {
+#ifndef __DISABLE_RTAUDIO__
     try{ if( !m_start )
               m_rtaudio-&gt;startStream();
          m_start = TRUE;
     } catch( RtError err ){ return FALSE; }
-    
+#endif // __DISABLE_RTAUDIO__
+
+#if defined(__CHIP_MODE__)
+    if( !m_start )
+        m_start = SMALL::start( small_cb, g_vm );
+#endif // __CHIP_MODE__
+
     return m_start;
 }
 
@@ -698,10 +740,18 @@ BOOL__ Digitalio::start( )
 //-----------------------------------------------------------------------------
 BOOL__ Digitalio::stop( )
 {
+#ifndef __DISABLE_RTAUDIO__
     try{ if( m_start )
              m_rtaudio-&gt;stopStream();
          m_start = FALSE;
     } catch( RtError err ){ return FALSE; }
+#endif // __DISABLE_RTAUDIO__
+
+#if defined(__CHIP_MODE__)
+    if( m_start )
+        SMALL::stop();
+    m_start = FALSE;
+#endif
 
     return !m_start;
 }
@@ -715,6 +765,7 @@ BOOL__ Digitalio::stop( )
 //-----------------------------------------------------------------------------
 BOOL__ Digitalio::tick( )
 {
+#ifndef __DISABLE_RTAUDIO__
     try
     {
         if( ++m_tick_count &gt;= m_start )
@@ -727,6 +778,9 @@ BOOL__ Digitalio::tick( )
         
         return TRUE;
     } catch( RtError err ){ return FALSE; }
+#endif // __DISABLE_RTAUDIO__
+    
+    return FALSE;
 }
 
 
@@ -739,14 +793,18 @@ BOOL__ Digitalio::tick( )
 void Digitalio::shutdown()
 {
     if( !m_init ) return;
+
+#ifndef __DISABLE_RTAUDIO__
     if( m_start )
     {
         if( m_use_cb ) m_rtaudio-&gt;cancelStreamCallback();
         m_rtaudio-&gt;stopStream();
     }
-    
+
     m_rtaudio-&gt;closeStream();
     SAFE_DELETE( m_rtaudio );
+#endif // __DISABLE_RTAUDIO__
+
     m_init = FALSE;
     m_start = FALSE;
     
@@ -788,9 +846,15 @@ DigitalOut::~DigitalOut()
 //-----------------------------------------------------------------------------
 BOOL__ DigitalOut::initialize( )
 {
+#ifndef __DISABLE_RTAUDIO__
     // set pointer to beginning of local buffer
     m_data_ptr_out = Digitalio::m_use_cb ? Digitalio::m_buffer_out
         : (SAMPLE *)Digitalio::audio()-&gt;getStreamBuffer();
+#else
+    // set pointer
+    assert( Digitalio::m_use_cb );
+    m_data_ptr_out = Digitalio::m_buffer_out;
+#endif // __DISABLE_RTAUDIO__
     // calculate the end of the buffer
     m_data_max_out = m_data_ptr_out + 
         Digitalio::buffer_size() * Digitalio::num_channels_out();
@@ -972,9 +1036,15 @@ BOOL__ DigitalIn::initialize( )
 {
     m_data = new SAMPLE[Digitalio::buffer_size() * Digitalio::num_channels_in()];
     memset( m_data, 0, Digitalio::buffer_size() * Digitalio::num_channels_in() * sizeof(SAMPLE) );
+#ifndef __DISABLE_RTAUDIO__
     // set the buffer to the beginning of the local buffer
     m_data_ptr_in = Digitalio::m_use_cb ? m_data
         : (SAMPLE *)Digitalio::audio()-&gt;getStreamBuffer();
+#else
+    // set the buffer pointer
+    assert( Digitalio::m_use_cb );
+    m_data_ptr_in = m_data;
+#endif // __DISABLE_RTAUDIO__
     // calculate past buffer
     m_data_max_in = m_data_ptr_in + 
         Digitalio::buffer_size() * Digitalio::num_channels_in();</diff>
      <filename>src/digiio_rtaudio.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -429,7 +429,7 @@ t_CKBOOL HidIn::open( t_CKINT device_type, t_CKINT device_num )
     // close if already opened
     if( m_valid )
         this-&gt;close();
-
+    
     // open
     return m_valid = HidInManager::open( this, device_type, device_num );
 }
@@ -437,6 +437,23 @@ t_CKBOOL HidIn::open( t_CKINT device_type, t_CKINT device_num )
 
 
 
+//-----------------------------------------------------------------------------
+// name: open()
+// desc: open
+//-----------------------------------------------------------------------------
+t_CKBOOL HidIn::open( std::string &amp; name, t_CKUINT device_type )
+{
+    // close if already opened
+    if( m_valid )
+        this-&gt;close();
+    
+    // open
+    return m_valid = HidInManager::open( this, device_type, name );
+}
+
+
+
+
 void HidInManager::init()
 {
     if( has_init == FALSE )
@@ -661,6 +678,76 @@ t_CKBOOL HidInManager::open( HidIn * hin, t_CKINT device_type, t_CKINT device_nu
     return TRUE;
 }
 
+
+
+t_CKBOOL HidInManager::open( HidIn * hin, t_CKINT device_type, std::string &amp; device_name )
+{
+    // init?
+    if( has_init == FALSE )
+    {
+        init();
+    }
+    
+    t_CKINT device_type_start = 1;
+    t_CKINT device_type_finish = CK_HID_DEV_COUNT;
+    
+    if(device_type != CK_HID_DEV_COUNT)
+    {
+        // check type
+        if( device_type &lt; 1 || device_type &gt;= CK_HID_DEV_COUNT )
+        {
+            // log
+            EM_log( CK_LOG_WARNING, &quot;HidInManager: open() failed -&gt; invalid type '%d'...&quot;, 
+                    device_type );
+            return FALSE;
+        }
+        
+        device_type_start = device_type;
+        device_type_finish = device_type + 1;
+    }
+    
+    for(t_CKINT i = device_type_start; i &lt; device_type_finish; i++)
+    {
+        t_CKINT max_devices = default_drivers[i].count();
+        
+        for(t_CKINT j = 0; j &lt; max_devices; j++)
+        {
+            const char * _name = NULL;
+            
+            if( !default_drivers[i].name )
+                _name = default_drivers[i].driver_name;
+            else
+            {
+                _name = default_drivers[i].name( ( int ) j );
+            }
+            
+            if(!_name)
+            {
+                continue;
+            }
+            
+            std::string name = _name;
+            
+//            PhyHidDevIn * phyHid = devices[j];
+//            if(!phyHid)
+//                continue;
+//            
+//            std::string name = phyHid-&gt;name();
+            
+            if(name == device_name)
+            {
+                return open( hin, i, j );
+            }
+        }
+    }
+    
+    EM_log( CK_LOG_WARNING, &quot;HidInManager: open() failed -&gt; no device named '%s'...&quot;, 
+            device_name.c_str() );
+    
+    return FALSE;
+}
+
+
 //-----------------------------------------------------------------------------
 // name: close()
 // desc: close</diff>
      <filename>src/hidio_sdl.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -93,6 +93,7 @@ public:
 
 public:
     t_CKBOOL open( t_CKINT device_type, t_CKINT device_num );
+    t_CKBOOL open( std::string &amp; name, t_CKUINT device_type = CK_HID_DEV_COUNT );
     t_CKBOOL close();
     t_CKBOOL read( t_CKINT type, t_CKINT num, HidMsg * msg );
     t_CKBOOL send( const HidMsg * msg );
@@ -127,6 +128,7 @@ public:
     static void init_default_drivers();
     static void cleanup();
     static t_CKBOOL open( HidIn * hin, t_CKINT device_type, t_CKINT device_num );
+    static t_CKBOOL open( HidIn * hin, t_CKINT device_type, std::string &amp; device_name );
     static t_CKBOOL close( HidIn * hin );
     
     static void probeHidIn();</diff>
      <filename>src/hidio_sdl.h</filename>
    </modified>
    <modified>
      <diff>@@ -3,7 +3,7 @@ CXX?=g++
 LEX=flex
 YACC=bison
 INCLUDES=
-CFLAGS?= -O3
+CFLAGS?= -O3 -fno-strict-aliasing
 FLAGS= -D__LINUX_ALSA__ -c $(CFLAGS)
 LIBS=-lasound -lstdc++ -ldl -lm -lfluidsynth
 SF_OBJ=util_sndfile.o</diff>
      <filename>src/makefile.alsa</filename>
    </modified>
    <modified>
      <diff>@@ -4,7 +4,7 @@ CXX?=g++
 LEX=flex
 YACC=bison
 INCLUDES=
-CFLAGS?= -O3
+CFLAGS?= -O3 -fno-strict-aliasing
 FLAGS= -D__LINUX_JACK__ -c $(CFLAGS)
 LIBS=-lasound -ljack -lstdc++ -ldl -lm
 SF_OBJ=util_sndfile.o</diff>
      <filename>src/makefile.jack</filename>
    </modified>
    <modified>
      <diff>@@ -4,7 +4,7 @@ CXX?=g++
 LEX=flex
 YACC=bison
 INCLUDES=
-CFLAGS?= -O3
+CFLAGS?= -O3 -fno-strict-aliasing
 FLAGS= -D__LINUX_OSS__ -c $(CFLAGS)
 LIBS=-lpthread -lstdc++ -ldl -lm
 SF_OBJ=util_sndfile.o</diff>
      <filename>src/makefile.oss</filename>
    </modified>
    <modified>
      <diff>@@ -1,12 +1,11 @@
-
 CXX=gcc
 CXX_LINK=g++
 LEX=flex
 YACC=bison
 INCLUDES=
-FLAGS=-D__MACOSX_CORE__ -c
+FLAGS=-D__MACOSX_CORE__ -c -m32
 LIBS=-framework CoreAudio -framework CoreMIDI -framework CoreFoundation \
-	-framework IOKit -framework Carbon -lstdc++ -lm -lfluidsynth
+	-framework IOKit -framework Carbon -lstdc++ -lm -m32 -lfluidsynth
 SF_OBJ=util_sndfile.o
 
 ifneq ($(CHUCK_STAT),)</diff>
      <filename>src/makefile.osx</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,11 @@
+ifeq ($(shell gcc --version | head -1 | awk -F&quot; &quot; '{ printf $3 }' | grep '4\.[1-9]'),)
 CXX=gcc
 CXX_LINK=g++
+else
+# force GCC 4.0 if gcc 4.2 is present (for OS X 10.4 compatibility)
+CXX=gcc-4.0
+CXX_LINK=g++-4.0
+endif
 LEX=flex
 YACC=bison
 INCLUDES=</diff>
      <filename>src/makefile.osx-ub</filename>
    </modified>
    <modified>
      <diff>@@ -32,6 +32,9 @@
 // date: summer 2005
 //-----------------------------------------------------------------------------
 #include &quot;midiio_rtmidi.h&quot;
+
+#ifndef __DISABLE_MIDI__
+
 #include &quot;chuck_errmsg.h&quot;
 #include &lt;vector&gt;
 #include &lt;map&gt;
@@ -792,3 +795,36 @@ t_CKBOOL MidiMsgIn::read( MidiMsg * msg, t_CKTIME * time )
     
     return m &amp;&amp; t;
 }
+
+#else // __DISABLE_MIDI__
+
+MidiOut::MidiOut()
+{
+    
+}
+
+MidiOut::~MidiOut()
+{
+}
+
+t_CKBOOL MidiOut::open( t_CKUINT device_num )
+{
+    return TRUE;
+}
+
+MidiIn::MidiIn()
+{
+    
+}
+
+MidiIn::~MidiIn()
+{
+    
+}
+
+t_CKBOOL MidiIn::open( t_CKUINT device_num )
+{
+    return FALSE;
+}
+
+#endif // __DISABLE_MIDI__</diff>
      <filename>src/midiio_rtmidi.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -35,7 +35,9 @@
 #define __MIDI_IO_H__
 
 #include &quot;chuck_def.h&quot;
+#ifndef __DISABLE_MIDI__
 #include &quot;rtmidi.h&quot;
+#endif
 #include &quot;util_buffers.h&quot;
 
 
@@ -68,6 +70,13 @@ union MidiMsg
 
 
 
+// forward reference
+class RtMidiOut;
+class RtMidiIn;
+
+
+
+
 //-----------------------------------------------------------------------------
 // name: class MidiOut
 // desc: midi out</diff>
      <filename>src/midiio_rtmidi.h</filename>
    </modified>
    <modified>
      <diff>@@ -384,7 +384,7 @@ CK_DLL_TICK( sinosc_tick )
             d-&gt;num = d-&gt;freq / d-&gt;srate;
             // bound it
             if( d-&gt;num &gt;= 1.0 ) d-&gt;num -= floor( d-&gt;num );
-            else if( d-&gt;num &lt;= 1.0 ) d-&gt;num += floor( d-&gt;num );
+            else if( d-&gt;num &lt;= -1.0 ) d-&gt;num += floor( d-&gt;num );
         }
         // sync phase to input
         else if( d-&gt;sync == 1 )
@@ -402,7 +402,7 @@ CK_DLL_TICK( sinosc_tick )
             d-&gt;num = freq / d-&gt;srate;
             // bound it
             if( d-&gt;num &gt;= 1.0 ) d-&gt;num -= floor( d-&gt;num );
-            else if( d-&gt;num &lt;= 1.0 ) d-&gt;num += floor( d-&gt;num );
+            else if( d-&gt;num &lt;= -1.0 ) d-&gt;num += floor( d-&gt;num );
         }
         // sync phase to now
         // else if( d-&gt;sync == 3 )
@@ -421,6 +421,7 @@ CK_DLL_TICK( sinosc_tick )
         d-&gt;phase += d-&gt;num;
         // keep the phase between 0 and 1
         if( d-&gt;phase &gt; 1.0 ) d-&gt;phase -= 1.0;
+        else if( d-&gt;phase &lt; 0.0 ) d-&gt;phase += 1.0;
     }
 
     return TRUE;
@@ -452,7 +453,7 @@ CK_DLL_TICK( triosc_tick )
             d-&gt;num = d-&gt;freq / d-&gt;srate;
             // bound it
             if( d-&gt;num &gt;= 1.0 ) d-&gt;num -= floor( d-&gt;num );
-            else if( d-&gt;num &lt;= 1.0 ) d-&gt;num += floor( d-&gt;num );
+            else if( d-&gt;num &lt;= -1.0 ) d-&gt;num += floor( d-&gt;num );
         }
         // sync phase to input
         else if( d-&gt;sync == 1 )
@@ -470,7 +471,7 @@ CK_DLL_TICK( triosc_tick )
             d-&gt;num = freq / d-&gt;srate;
             // bound it
             if( d-&gt;num &gt;= 1.0 ) d-&gt;num -= floor( d-&gt;num );
-            else if( d-&gt;num &lt;= 1.0 ) d-&gt;num += floor( d-&gt;num );
+            else if( d-&gt;num &lt;= -1.0 ) d-&gt;num += floor( d-&gt;num );
         }
         // sync to now
         // if( d-&gt;sync == 3 )
@@ -491,6 +492,7 @@ CK_DLL_TICK( triosc_tick )
         d-&gt;phase += d-&gt;num;
         // keep the phase between 0 and 1
         if( d-&gt;phase &gt; 1.0 ) d-&gt;phase -= 1.0;
+        else if( d-&gt;phase &lt; 0.0 ) d-&gt;phase += 1.0;
     }
 
     return TRUE;
@@ -523,7 +525,7 @@ CK_DLL_TICK( pulseosc_tick )
             d-&gt;num = d-&gt;freq / d-&gt;srate;
             // bound it
             if( d-&gt;num &gt;= 1.0 ) d-&gt;num -= floor( d-&gt;num );
-            else if( d-&gt;num &lt;= 1.0 ) d-&gt;num += floor( d-&gt;num );
+            else if( d-&gt;num &lt;= -1.0 ) d-&gt;num += floor( d-&gt;num );
         }
         // sync phase to input
         else if( d-&gt;sync == 1 )
@@ -541,7 +543,7 @@ CK_DLL_TICK( pulseosc_tick )
             d-&gt;num = freq / d-&gt;srate;
             // bound it
             if( d-&gt;num &gt;= 1.0 ) d-&gt;num -= floor( d-&gt;num );
-            else if( d-&gt;num &lt;= 1.0 ) d-&gt;num += floor( d-&gt;num );
+            else if( d-&gt;num &lt;= -1.0 ) d-&gt;num += floor( d-&gt;num );
         }
         // sync to now
         // if( d-&gt;sync == 3 )
@@ -560,6 +562,7 @@ CK_DLL_TICK( pulseosc_tick )
         d-&gt;phase += d-&gt;num;
         // keep the phase between 0 and 1
         if( d-&gt;phase &gt; 1.0 ) d-&gt;phase -= 1.0;
+		else if( d-&gt;phase &lt; 0.0 ) d-&gt;phase += 1.0;
     }
 
     return TRUE;</diff>
      <filename>src/ugen_osc.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -4296,7 +4296,7 @@ void BandedWG :: controlChange(int number, MY_FLOAT value)
   }
   else if ( norm &gt; 1.0 ) {
     norm = 1.0;
-    std::cerr &lt;&lt; &quot;[chuck](via STK): BandedWG: Control value greater than 128.0!&quot; &lt;&lt; std::endl;
+    std::cerr &lt;&lt; &quot;[chuck](via STK): BandedWG: Control value exceeds nominal range!&quot; &lt;&lt; std::endl;
   }
 
   if (number == __SK_BowPressure_) { // 2
@@ -5096,7 +5096,7 @@ void BlowBotl :: controlChange(int number, MY_FLOAT value)
   }
   else if ( norm &gt; 1.0 ) {
     norm = 1.0;
-    std::cerr &lt;&lt; &quot;[chuck](via STK): BlowBotl: Control value greater than 128.0!&quot; &lt;&lt; std::endl;
+    std::cerr &lt;&lt; &quot;[chuck](via STK): BlowBotl: Control value exceeds nominal range!&quot; &lt;&lt; std::endl;
   }
 
   if( number == __SK_NoiseLevel_ ) { // 4
@@ -5379,7 +5379,7 @@ void BlowHole :: controlChange(int number, MY_FLOAT value)
   }
   else if ( norm &gt; 1.0 ) {
     norm = 1.0;
-    std::cerr &lt;&lt; &quot;[chuck](via STK): BlowHole: Control value greater than 128.0!&quot; &lt;&lt; std::endl;
+    std::cerr &lt;&lt; &quot;[chuck](via STK): BlowHole: Control value exceeds nominal range!&quot; &lt;&lt; std::endl;
   }
 
   if (number == __SK_ReedStiffness_) { // 2 
@@ -5650,7 +5650,7 @@ void Bowed :: controlChange(int number, MY_FLOAT value)
   }
   else if ( norm &gt; 1.0 ) {
     norm = 1.0;
-    std::cerr &lt;&lt; &quot;[chuck](via STK): Bowed: Control value greater than 128.0!&quot; &lt;&lt; std::endl;
+    std::cerr &lt;&lt; &quot;[chuck](via STK): Bowed: Control value exceeds nominal range!&quot; &lt;&lt; std::endl;
   }
 
   if (number == __SK_BowPressure_) { // 2
@@ -5853,7 +5853,7 @@ void Brass :: controlChange(int number, MY_FLOAT value)
   }
   else if ( norm &gt; 1.0 ) {
     norm = 1.0;
-    std::cerr &lt;&lt; &quot;[chuck](via STK): Brass: Control value greater than 128.0!&quot; &lt;&lt; std::endl;
+    std::cerr &lt;&lt; &quot;[chuck](via STK): Brass: Control value exceeds nominal range!&quot; &lt;&lt; std::endl;
   }
 
   if (number == __SK_LipTension_) { // 2
@@ -6168,7 +6168,7 @@ void Clarinet :: controlChange(int number, MY_FLOAT value)
   }
   else if ( norm &gt; 1.0 ) {
     norm = 1.0;
-    std::cerr &lt;&lt; &quot;[chuck](via STK): Clarinet: Control value greater than 128.0!&quot; &lt;&lt; std::endl;
+    std::cerr &lt;&lt; &quot;[chuck](via STK): Clarinet: Control value exceeds nominal range!&quot; &lt;&lt; std::endl;
   }
 
   if (number == __SK_ReedStiffness_) { // 2
@@ -7238,7 +7238,7 @@ void FM :: controlChange(int number, MY_FLOAT value)
   }
   else if ( norm &gt; 1.0 ) {
     norm = 1.0;
-    std::cerr &lt;&lt; &quot;[chuck](via STK): FM: Control value greater than 128.0!&quot; &lt;&lt; std::endl;
+    std::cerr &lt;&lt; &quot;[chuck](via STK): FM: Control value exceeds nominal range!&quot; &lt;&lt; std::endl;
   }
 
   if (number == __SK_Breath_) // 2
@@ -7420,7 +7420,7 @@ void FMVoices :: controlChange(int number, MY_FLOAT value)
   }
   else if ( norm &gt; 1.0 ) {
     norm = 1.0;
-    std::cerr &lt;&lt; &quot;[chuck](via STK): FMVoices: Control value greater than 128.0!&quot; &lt;&lt; std::endl;
+    std::cerr &lt;&lt; &quot;[chuck](via STK): FMVoices: Control value exceeds nominal range!&quot; &lt;&lt; std::endl;
   }
 
 
@@ -7901,7 +7901,7 @@ void Flute :: controlChange(int number, MY_FLOAT value)
   }
   else if ( norm &gt; 1.0 ) {
     norm = 1.0;
-    std::cerr &lt;&lt; &quot;[chuck](via STK): Flute: Control value greater than 128.0!&quot; &lt;&lt; std::endl;
+    std::cerr &lt;&lt; &quot;[chuck](via STK): Flute: Control value exceeds nominal range!&quot; &lt;&lt; std::endl;
   }
 
   if (number == __SK_JetDelay_) // 2
@@ -8576,7 +8576,7 @@ void Mandolin :: controlChange(int number, MY_FLOAT value)
   }
   else if ( norm &gt; 1.0 ) {
     norm = 1.0;
-    std::cerr &lt;&lt; &quot;[chuck](via STK): Mandolin: Control value greater than 128.0!&quot; &lt;&lt; std::endl;
+    std::cerr &lt;&lt; &quot;[chuck](via STK): Mandolin: Control value exceeds nominal range!&quot; &lt;&lt; std::endl;
   }
 
   if (number == __SK_BodySize_) // 2
@@ -8964,7 +8964,7 @@ void Mesh2D :: controlChange(int number, MY_FLOAT value)
   }
   else if ( norm &gt; 1.0 ) {
     norm = 1.0;
-    std::cerr &lt;&lt; &quot;[chuck](via STK): Mesh2D: Control value greater than 128.0!&quot; &lt;&lt; std::endl;
+    std::cerr &lt;&lt; &quot;[chuck](via STK): Mesh2D: Control value exceeds nominal range!&quot; &lt;&lt; std::endl;
   }
 
   if (number == 2) // 2
@@ -9386,7 +9386,7 @@ void ModalBar :: controlChange(int number, MY_FLOAT value)
   }
   else if ( norm &gt; 1.0 ) {
     norm = 1.0;
-    std::cerr &lt;&lt; &quot;[chuck](via STK): ModalBar: Control value greater than 128.0!&quot; &lt;&lt; std::endl;
+    std::cerr &lt;&lt; &quot;[chuck](via STK): ModalBar: Control value exceeds nominal range!&quot; &lt;&lt; std::endl;
   }
 
   if (number == __SK_StickHardness_) // 2
@@ -9633,7 +9633,7 @@ void Moog :: controlChange(int number, MY_FLOAT value)
   }
   else if ( norm &gt; 1.0 ) {
     norm = 1.0;
-    std::cerr &lt;&lt; &quot;[chuck](via STK): Moog: Control value greater than 128.0!&quot; &lt;&lt; std::endl;
+    std::cerr &lt;&lt; &quot;[chuck](via STK): Moog: Control value exceeds nominal range!&quot; &lt;&lt; std::endl;
   }
 
   if (number == __SK_FilterQ_) // 2
@@ -11178,7 +11178,7 @@ void Resonate :: controlChange(int number, MY_FLOAT value)
   }
   else if ( norm &gt; 1.0 ) {
     norm = 1.0;
-    std::cerr &lt;&lt; &quot;[chuck](via STK): Resonate: Control value greater than 128.0!&quot; &lt;&lt; std::endl;
+    std::cerr &lt;&lt; &quot;[chuck](via STK): Resonate: Control value exceeds nominal range!&quot; &lt;&lt; std::endl;
   }
 
   if (number == 2) // 2
@@ -11969,7 +11969,7 @@ void Saxofony :: controlChange(int number, MY_FLOAT value)
   }
   else if ( norm &gt; 1.0 ) {
     norm = 1.0;
-    std::cerr &lt;&lt; &quot;[chuck](via STK): Saxofony: Control value greater than 128.0!&quot; &lt;&lt; std::endl;
+    std::cerr &lt;&lt; &quot;[chuck](via STK): Saxofony: Control value exceeds nominal range!&quot; &lt;&lt; std::endl;
   }
 
   if (number == __SK_ReedStiffness_) { // 2
@@ -12924,7 +12924,7 @@ void Shakers :: controlChange(int number, MY_FLOAT value)
   }
   else if ( norm &gt; 1.0 ) {
     norm = 1.0;
-    std::cerr &lt;&lt; &quot;[chuck](via STK): Shakers: Control value greater than 128.0!&quot; &lt;&lt; std::endl;
+    std::cerr &lt;&lt; &quot;[chuck](via STK): Shakers: Control value exceeds nominal range!&quot; &lt;&lt; std::endl;
   }
 
   MY_FLOAT temp;
@@ -13257,7 +13257,7 @@ void Simple :: controlChange(int number, MY_FLOAT value)
   }
   else if ( norm &gt; 1.0 ) {
     norm = 1.0;
-    std::cerr &lt;&lt; &quot;[chuck](via STK): Clarinet: Control value greater than 128.0!&quot; &lt;&lt; std::endl;
+    std::cerr &lt;&lt; &quot;[chuck](via STK): Clarinet: Control value exceeds nominal range!&quot; &lt;&lt; std::endl;
   }
 
   if (number == __SK_Breath_) // 2
@@ -13842,7 +13842,7 @@ void StifKarp :: controlChange(int number, MY_FLOAT value)
   }
   else if ( norm &gt; 1.0 ) {
     norm = 1.0;
-    std::cerr &lt;&lt; &quot;[chuck](via STK): StifKarp: Control value greater than 128.0!&quot; &lt;&lt; std::endl;
+    std::cerr &lt;&lt; &quot;[chuck](via STK): StifKarp: Control value exceeds nominal range!&quot; &lt;&lt; std::endl;
   }
 
   if (number == __SK_PickPosition_) // 4
@@ -14744,7 +14744,7 @@ void VoicForm :: controlChange(int number, MY_FLOAT value)
     }
     else if ( norm &gt; 1.0 ) {
         norm = 1.0;
-        std::cerr &lt;&lt; &quot;[chuck](via STK): VoicForm: Control value greater than 128.0!&quot; &lt;&lt; std::endl;
+        std::cerr &lt;&lt; &quot;[chuck](via STK): VoicForm: Control value exceeds nominal range!&quot; &lt;&lt; std::endl;
     }
 
     if (number == __SK_Breath_) { // 2
@@ -15448,7 +15448,7 @@ void Whistle :: controlChange(int number, MY_FLOAT value)
   }
   else if ( norm &gt; 1.0 ) {
     norm = 1.0;
-    std::cerr &lt;&lt; &quot;[chuck](via STK): Whistle: Control value greater than 128.0!&quot; &lt;&lt; std::endl;
+    std::cerr &lt;&lt; &quot;[chuck](via STK): Whistle: Control value exceeds nominal range!&quot; &lt;&lt; std::endl;
   }
 
   if (number == __SK_NoiseLevel_) // 4</diff>
      <filename>src/ugen_stk.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -45,7 +45,7 @@ t_CKBOOL  stk_detach( t_CKUINT type, void * data );
 
 
 // this determines STK float type and de-denormal method
-#if 1
+#ifndef __STK_USE_SINGLE_PRECISION__
 #define MY_FLOAT double
 #define CK_STK_DDN CK_DDN_DOUBLE
 #else</diff>
      <filename>src/ugen_stk.h</filename>
    </modified>
    <modified>
      <diff>@@ -510,6 +510,8 @@ DLL_QUERY xxx_query( Chuck_DL_Query * QUERY )
     
     //! \section sound files
     
+#ifndef __DISABLE_SNDBUF__
+    
     // add sndbuf
     //! sound buffer ( now interpolating ) 
     //! reads from a variety of file formats
@@ -661,6 +663,9 @@ DLL_QUERY xxx_query( Chuck_DL_Query * QUERY )
     // end import
     if( !type_engine_import_class_end( env ) )
         return FALSE;
+    
+#endif // __DISABLE_SNDBUF__
+
 
     //---------------------------------------------------------------------
     // init as base class: Dyno
@@ -1865,6 +1870,9 @@ CK_DLL_CGET( delayp_cget_max )
     RETURN-&gt;v_dur = d-&gt;bufsize;
 }
 
+
+#ifndef __DISABLE_SNDBUF__
+
 //-----------------------------------------------------------------------------
 // name: sndbuf
 // desc: ...
@@ -2878,6 +2886,8 @@ CK_DLL_CGET( sndbuf_cget_valueAt )
     RETURN-&gt;v_float = ( i &gt; d-&gt;num_frames || i &lt; 0 ) ? 0 : d-&gt;buffer[i];
 }
 
+#endif // __DISABLE_SNDBUF__
+
 
 class Dyno_Data
 {</diff>
      <filename>src/ugen_xxx.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -47,6 +47,7 @@ static t_CKFLOAT g_floatMin = DBL_MIN;
 static t_CKFLOAT g_inf = 0.0;
 static t_CKINT g_intMax = LONG_MAX;
 static t_CKCOMPLEX g_i = { 0.0, 1.0 };
+static t_CKFLOAT fzero() { return 0.0; }
 
 
 // query
@@ -299,9 +300,8 @@ DLL_QUERY libmath_query( Chuck_DL_Query * QUERY )
     assert( sizeof(t_CKINT) == sizeof(long) );
     QUERY-&gt;add_svar( QUERY, &quot;int&quot;, &quot;INT_MAX&quot;, TRUE, &amp;g_intMax );
 
-    // infinity
-    double zero = 0.0;
-    g_inf = 1.0 / zero;
+    // infinity, using function to avoid potential &quot;smart&quot; compiler warning
+    g_inf = 1.0 / fzero();
     QUERY-&gt;add_svar( QUERY, &quot;float&quot;, &quot;INFINITY&quot;, TRUE, &amp;g_inf );
 
     // i</diff>
      <filename>src/ulib_math.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -65,6 +65,7 @@ int setenv( const char *n, const char *v, int i )
 using namespace std;
 
 
+#ifndef __DISABLE_KBHIT__
 // KBHit
 CK_DLL_CTOR( KBHit_ctor );
 CK_DLL_DTOR( KBHit_dtor );
@@ -77,7 +78,9 @@ CK_DLL_MFUN( KBHit_getchar );
 CK_DLL_MFUN( KBHit_can_wait );
 
 static t_CKUINT KBHit_offset_data = 0;
+#endif // __DISABLE_KBHIT__
 
+#ifndef __DISABLE_PROMPTER__
 // Skot functions
 CK_DLL_CTOR( Skot_ctor );
 CK_DLL_DTOR( Skot_dtor );
@@ -88,6 +91,7 @@ CK_DLL_MFUN( Skot_getLine );
 CK_DLL_MFUN( Skot_can_wait );
 
 static t_CKUINT Skot_offset_data = 0;
+#endif // __DISABLE_PROMPTER__
 
 // StrTok functions
 CK_DLL_CTOR( StrTok_ctor );
@@ -253,6 +257,7 @@ DLL_QUERY libstd_query( Chuck_DL_Query * QUERY )
 
     Chuck_DL_Func * func = NULL;
     
+#ifndef __DISABLE_KBHIT__
     // KBHit
     // begin class (KBHit)
     if( !type_engine_import_class_begin( env, &quot;KBHit&quot;, &quot;Event&quot;,
@@ -297,11 +302,13 @@ DLL_QUERY libstd_query( Chuck_DL_Query * QUERY )
 
     // start it
     KBHitManager::init();
+#endif // __DISABLE_KBHIT__
 
 
     // register deprecate
     type_engine_register_deprecate( env, &quot;Skot&quot;, &quot;ConsoleInput&quot; );
 
+#ifndef __DISABLE_PROMPTER__
     // begin class (Skot)
     if( !type_engine_import_class_begin( env, &quot;ConsoleInput&quot;, &quot;Event&quot;,
                                          env-&gt;global(), Skot_ctor,
@@ -335,6 +342,7 @@ DLL_QUERY libstd_query( Chuck_DL_Query * QUERY )
 
     // end class
     type_engine_import_class_end( env );
+#endif // __DISABLE_PROMPTER__
 
 
     // register deprecate
@@ -725,6 +733,7 @@ CK_DLL_SFUN( dbtorms_impl )
 
 
 
+#ifndef __DISABLE_KBHIT__
 // static
 CBufferAdvance * KBHitManager::the_buf = NULL;
 t_CKINT KBHitManager::the_onoff = 0;
@@ -786,6 +795,7 @@ t_CKBOOL KBHitManager::init()
     the_thread = new XThread;
     the_thread-&gt;start( kb_loop, NULL );
 
+
     return TRUE;
 }
 
@@ -1000,10 +1010,12 @@ CK_DLL_MFUN( KBHit_can_wait )
     KBHit * kb = (KBHit *)(OBJ_MEMBER_INT(SELF, KBHit_offset_data));
     RETURN-&gt;v_int = kb-&gt;empty();
 }
+#endif // __DISABLE_KBHIT__
 
 
 
 
+#ifndef __DISABLE_PROMPTER__
 class LineEvent : public Chuck_Event
 {
 public:
@@ -1198,6 +1210,7 @@ CK_DLL_MFUN( Skot_can_wait )
     LineEvent * le = (LineEvent *)OBJ_MEMBER_INT(SELF, Skot_offset_data);
     RETURN-&gt;v_int = le-&gt;can_wait();
 }
+#endif // __DISABLE_PROMPTER__
 
 
 // StrTok</diff>
      <filename>src/ulib_std.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -1,25 +1,25 @@
 /*----------------------------------------------------------------------------
-ChucK Concurrent, On-the-fly Audio Programming Language
-Compiler and Virtual Machine
-
-Copyright (c) 2004 Ge Wang and Perry R. Cook.  All rights reserved.
-http://chuck.cs.princeton.edu/
-http://soundlab.cs.princeton.edu/
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-U.S.A.
+    ChucK Concurrent, On-the-fly Audio Programming Language
+      Compiler and Virtual Machine
+
+    Copyright (c) 2004 Ge Wang and Perry R. Cook.  All rights reserved.
+      http://chuck.cs.princeton.edu/
+      http://soundlab.cs.princeton.edu/
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+    U.S.A.
 -----------------------------------------------------------------------------*/
 
 //-----------------------------------------------------------------------------
@@ -71,7 +71,7 @@ const t_CKUINT CK_HID_TABLET_MOTION = 15;
 const t_CKUINT CK_HID_TABLET_ROTATION = 16;
 const t_CKUINT CK_HID_MSG_COUNT = 17;
 
-#ifdef __PLATFORM_MACOSX__
+#if defined(__PLATFORM_MACOSX__) &amp;&amp; !defined(__CHIP_MODE__)
 #pragma mark OS X General HID support
 
 /* TODO: ***********************************************************************
@@ -7403,3 +7403,289 @@ const char * TiltSensor_name( int ts ){ return NULL; }
 
 
 #endif
+
+
+#ifdef __CHIP_MODE__
+
+// #include &quot;util_iphone.h&quot;
+
+extern int get_tilt_sensor_x();
+extern int get_tilt_sensor_y();
+extern int get_tilt_sensor_z();
+
+extern void start_hid_multi_touch();
+extern void stop_hid_multi_touch();
+
+void Hid_init(){}
+void Hid_poll(){}
+void Hid_quit(){}
+
+void Mouse_init(){}
+void Mouse_poll(){}
+void Mouse_quit(){}
+void Mouse_probe(){}
+
+int Mouse_count()
+{
+    return 1;
+}
+
+int Mouse_count_elements( int js, int type )
+{
+    return -1;
+}
+
+int Mouse_open( int m )
+{
+    if(m &gt;= 0 &amp;&amp; m &lt; 1)
+    {
+        start_hid_multi_touch();
+        return 0;
+    }
+    else
+        return -1;
+}
+
+int Mouse_open( const char * name )
+{
+    return -1;
+}
+
+int Mouse_close( int m )
+{
+    if(m &gt;= 0 &amp;&amp; m &lt; 1)
+    {
+        stop_hid_multi_touch();
+        return 0;
+    }
+    else
+        return -1;
+}
+
+int Mouse_send( int m, const HidMsg * msg )
+{
+    return -1;
+}
+
+const char * Mouse_name( int m )
+{
+    if(m == 0)
+        return &quot;iPhone Multitouch&quot;;
+    else
+        return NULL;
+}
+
+int Mouse_buttons( int m )
+{
+    if(m == 0)
+        return 2;
+    else
+        return -1;
+}
+
+int Mouse_start_cursor_track()
+{
+    return -1;
+}
+
+int Mouse_stop_cursor_track()
+{
+    return -1;
+}
+
+void TiltSensor_init(){}
+void TiltSensor_quit(){}
+void TiltSensor_probe(){}
+
+int TiltSensor_count()
+{
+    return 1;
+}
+
+int TiltSensor_open( int ts )
+{
+    if(ts == 0)
+        return 0;
+    return -1;
+}
+
+int TiltSensor_close( int ts )
+{
+    if(ts == 0)
+        return 0;
+    return -1;
+}
+
+int TiltSensor_read( int ts, int type, int num, HidMsg * msg )
+{
+    if( type != CK_HID_ACCELEROMETER )
+        return -1;
+    
+    msg-&gt;idata[0] = get_tilt_sensor_x();
+    msg-&gt;idata[1] = get_tilt_sensor_y();
+    msg-&gt;idata[2] = get_tilt_sensor_z();
+    
+    return 0;
+}
+
+const char * TiltSensor_name( int ts )
+{
+    if(ts == 0)
+        return &quot;iPhone Accelerometer&quot;;
+    else
+        return NULL;
+}
+
+// ge: SMS multi-thread poll rate
+t_CKINT TiltSensor_setPollRate( t_CKINT usec )
+{
+    return -1;
+}
+
+t_CKINT TiltSensor_getPollRate( )
+{
+    return -1;
+}
+
+void Joystick_init(){}
+
+void Joystick_poll(){}
+
+void Joystick_quit(){}
+
+void Joystick_probe(){}
+
+int Joystick_count()
+{
+    return 0;
+}
+
+int Joystick_count_elements( int js, int type )
+{
+    return -1;
+}
+
+int Joystick_open( int js )
+{
+    return -1;
+}
+
+int Joystick_open_async( int js )
+{
+    return -1;
+}
+
+int Joystick_open( const char * name )
+{
+    return -1;
+}
+
+int Joystick_close( int js )
+{
+    return -1;
+}
+
+int Joystick_send( int js, const HidMsg * msg )
+{
+    return -1;
+}
+
+
+const char * Joystick_name( int js )
+{
+    return NULL;
+}
+
+int Joystick_axes( int js )
+{
+    return -1;
+}
+
+int Joystick_buttons( int js )
+{
+    return -1;
+}
+
+int Joystick_hats( int js )
+{
+    return -1;
+}
+
+void Keyboard_init(){}
+void Keyboard_poll(){}
+void Keyboard_quit(){}
+void Keyboard_probe(){}
+
+int Keyboard_count()
+{
+    return 0;
+}
+
+int Keyboard_count_elements( int js, int type )
+{
+    return -1;
+}
+
+int Keyboard_open( int kb )
+{
+    return -1;
+}
+
+int Keyboard_open( const char * name )
+{
+    return -1;
+}
+
+int Keyboard_close( int kb )
+{
+    return -1;
+}
+
+int Keyboard_send( int kb, const HidMsg * msg )
+{
+    return -1;
+}
+
+const char * Keyboard_name( int kb )
+{
+    return NULL;
+}
+
+void WiiRemote_init(){}
+void WiiRemote_poll(){}
+void WiiRemote_quit(){}
+void WiiRemote_probe(){}
+
+int WiiRemote_count()
+{
+    return 0;
+}
+
+int WiiRemote_open( int wr )
+{
+    return -1;
+}
+
+int WiiRemote_open( const char * name )
+{
+    return -1;
+}
+
+int WiiRemote_close( int wr )
+{
+    return -1;
+}
+
+int WiiRemote_send( int wr, const HidMsg * msg )
+{
+    return -1;
+}
+
+const char * WiiRemote_name( int wr )
+{
+    return NULL;
+}
+
+
+#endif // __CHIP_MODE__
+</diff>
      <filename>src/util_hid.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -32,6 +32,7 @@
 //------------------------------------------------------------------------------
 #include &quot;util_raw.h&quot;
 
+#ifndef __DISABLE_RAW__
 
 // data for ahh.raw...
 SAMPLE ahh_data[] = {
@@ -4724,3 +4725,60 @@ SAMPLE glot_pop_data[] = {
     0.0f,
     0
 }; t_CKUINT glot_pop_size = 521;
+
+
+#else  // __DISABLE_RAW__
+
+// begin the abuse of memory
+SAMPLE ahh_data[] = { 0.0f };
+SAMPLE britestk_data[] = { 0.0f }; 
+SAMPLE dope_data[] = { 0.0f };
+SAMPLE eee_data[] = { 0.0f };
+SAMPLE fwavblnk_data[] = { 0.0f };
+SAMPLE halfwave_data[] = { 0.0f };
+SAMPLE impuls10_data[] = { 0.0f };
+SAMPLE impuls20_data[] = { 0.0f };
+SAMPLE impuls40_data[] = { 0.0f };
+SAMPLE mand1_data[] = { 0.0f };
+SAMPLE mandpluk_data[] = { 0.0f };
+SAMPLE marmstk1_data[] = { 0.0f };
+SAMPLE ooo_data[] = { 0.0f };
+SAMPLE peksblnk_data[] = { 0.0f };
+SAMPLE ppksblnk_data[] = { 0.0f };
+SAMPLE silence_data[] = { 0.0f };
+SAMPLE sineblnk_data[] = { 0.0f };
+SAMPLE sinewave_data[] = { 0.0f };
+SAMPLE snglpeak_data[] = { 0.0f };
+SAMPLE twopeaks_data[] = { 0.0f };
+SAMPLE glot_ahh_data[] = { 0.0f };
+SAMPLE glot_eee_data[] = { 0.0f };
+SAMPLE glot_ooo_data[] = { 0.0f };
+SAMPLE glot_pop_data[] = { 0.0f };
+
+t_CKUINT ahh_size = 1;
+t_CKUINT britestk_size = 1;
+t_CKUINT dope_size = 1;
+t_CKUINT eee_size = 1;
+t_CKUINT fwavblnk_size = 1;
+t_CKUINT halfwave_size = 1;
+t_CKUINT impuls10_size = 1;
+t_CKUINT impuls20_size = 1;
+t_CKUINT impuls40_size = 1;
+t_CKUINT mand1_size = 1;
+t_CKUINT mandpluk_size = 1;
+t_CKUINT marmstk1_size = 1;
+t_CKUINT ooo_size = 1;
+t_CKUINT peksblnk_size = 1;
+t_CKUINT ppksblnk_size = 1;
+t_CKUINT silence_size = 1;
+t_CKUINT sineblnk_size = 1;
+t_CKUINT sinewave_size = 1;
+t_CKUINT snglpeak_size = 1;
+t_CKUINT twopeaks_size = 1;
+t_CKUINT glot_ahh_size = 1;
+t_CKUINT glot_eee_size = 1;
+t_CKUINT glot_ooo_size = 1;
+t_CKUINT glot_pop_size = 1;
+
+
+#endif</diff>
      <filename>src/util_raw.c</filename>
    </modified>
    <modified>
      <diff>@@ -31,6 +31,7 @@
 // date: Summer 2005
 //-----------------------------------------------------------------------------
 #include &quot;util_string.h&quot;
+#include &lt;stdio.h&gt;
 using namespace std;
 
 </diff>
      <filename>src/util_string.cpp</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>src/chuck_win32.opt</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>8d8e527b2cdab65dc214e19de7cb32bd8a4e1e13</id>
    </parent>
    <parent>
      <id>92a3236407995d9f922e05c3157c70f4adc5eeec</id>
    </parent>
  </parents>
  <author>
    <name>Tom Lieber</name>
    <email>tom@alltom.com</email>
  </author>
  <url>http://github.com/alltom/chuck/commit/d1e92a33d2792b449babce4c0ffeea2f3d29d68d</url>
  <id>d1e92a33d2792b449babce4c0ffeea2f3d29d68d</id>
  <committed-date>2009-10-05T10:50:48-07:00</committed-date>
  <authored-date>2009-10-05T10:50:48-07:00</authored-date>
  <message>merged 1.2.1.3</message>
  <tree>aa2a02d3d592fe39e074981d29cd3aa9ec3de5fd</tree>
  <committer>
    <name>Tom Lieber</name>
    <email>tom@alltom.com</email>
  </committer>
</commit>
