[chuck-users] preprocessing chuck (was: Time to SMIRK!)

Michael Heuer heuermh at gmail.com
Wed Oct 8 12:36:53 EDT 2008

Scott Wheeler wrote:
> Stephen Sinclair wrote:
>> Take note, though, that using #include is not the same thing as
>> telling ChucK to pre-load another file!  With #include the code is
>> parsed and loaded into the VM as many times as it appears, so it's not
>> the same thing as sharing public classes within the VM.  In particular
>> if you #include a file with a public class ChucK will refuse to load
>> it twice.  You'll also run into trouble if you try to #include two
>> different files declaring public classes, since you can only have one
>> public class per file.
> My preprocessor works around those things (no double includes,
> specifically), and as mentioned, the one that was really important for me is
> that it takes the error output from the chuck executable and retranslates it
> back to the original source file where the error came from.  I don't find
> the "public" mechanism in ChucK particularly useful.
> I just copied over my ChucK directory to my home page space -- there are a
> bunch of classes there in a couple thousand lines of code, some working some
> not, but it should give an idea of how I use the include mechanism.
> http://developer.kde.org/~wheeler/files/src/ChucK/

Thanks Scott, this is great!

The upchuck script works well for me on linux and OSX but has trouble
with the temp file stuff on Windows under cygwin:

$ ls -R .


$ export CHUCK_DIRS=~/chuck-working/include

$ ./upchuck --silent foo.ck
[chuck.Bc252]: no such file or directory

mktemp seems to do the right thing

$ mktemp -t chuck.XXXXX

$ ls -als /tmp/chuck.ZY844
0 -rw------- 1 xxx xxx 0 Oct  8 11:34 /tmp/chuck.ZY844


More information about the chuck-users mailing list