├── .github └── workflows │ ├── linux-build-unit-tests.yml │ ├── macos-build-unit-tests.yml │ ├── webchuck-dev.yml │ └── win-build-unit-tests.yml ├── .gitignore ├── .gitmodules ├── AUTHORS ├── DEVELOPERS ├── INSTALL ├── LICENSE.GPL ├── LICENSE.MIT ├── QUICKSTART ├── README.md ├── THANKS ├── VERSIONS ├── examples ├── README ├── ai │ ├── features │ │ ├── centroid.ck │ │ ├── chroma.ck │ │ ├── features-combined.ck │ │ ├── flux.ck │ │ ├── flux0.ck │ │ ├── kurtosis.ck │ │ ├── mfcc-basic.ck │ │ ├── mfcc-mean.ck │ │ ├── rms.ck │ │ ├── rolloff.ck │ │ ├── rolloff2.ck │ │ ├── sfm.ck │ │ └── zerox.ck │ ├── genre-classify │ │ ├── data │ │ │ └── gtzan-23.txt │ │ ├── feature-extract.ck │ │ ├── genre-classify.ck │ │ └── x-validate.ck │ ├── hmm │ │ ├── hmm-load.ck │ │ └── hmm-train.ck │ ├── knn │ │ ├── knn-search.ck │ │ ├── knn2-classify.ck │ │ └── knn2-search.ck │ ├── mlp │ │ ├── mlp-manual.ck │ │ ├── mlp.ck │ │ ├── model-load.ck │ │ ├── model-save.ck │ │ └── model.txt │ ├── pca │ │ └── pca.ck │ ├── svm │ │ └── svm-basic.ck │ ├── wekinator │ │ ├── currentData.arff │ │ ├── wekinator-basic.ck │ │ ├── wekinator-customize.ck │ │ └── wekinator-import.ck │ └── word2vec │ │ ├── poem-i-feel.ck │ │ ├── poem-randomwalk.ck │ │ ├── poem-spew.ck │ │ ├── poem-ungenerate.ck │ │ ├── word2vec-basic.ck │ │ └── word2vec-prompt.ck ├── analysis │ ├── PitchTrack.ck │ ├── Sigmund.ck │ ├── autocorr.ck │ ├── concat.ck │ ├── dct.ck │ ├── fft.ck │ ├── fft1.ck │ ├── fft2.ck │ ├── fft3.ck │ ├── flip.ck │ ├── ifft.ck │ ├── ifft2.ck │ ├── ifft3.ck │ ├── tracking │ │ ├── Smacking.ck │ │ ├── Tracking.ck │ │ ├── harm.ck │ │ ├── pitch-fifth.ck │ │ ├── pitch-seventh.ck │ │ ├── pitch-third.ck │ │ └── pitch-track.ck │ ├── win.ck │ ├── xcorr.ck │ └── xsynth.ck ├── array │ ├── array_append.ck │ ├── array_argument.ck │ ├── array_assign.ck │ ├── array_associative.ck │ ├── array_capacity.ck │ ├── array_dynamic.ck │ ├── array_erase.ck │ ├── array_erase2.ck │ ├── array_mdim.ck │ ├── array_mmixed.ck │ ├── array_negative.ck │ ├── array_range.ck │ ├── array_resize.ck │ ├── array_reverse.ck │ ├── array_shuffle.ck │ ├── array_sort.ck │ ├── array_storage.ck │ ├── array_sub_assign.ck │ ├── array_ugens.ck │ ├── array_zero.ck │ ├── foreach-1.ck │ ├── foreach-2.ck │ ├── foreach-3.ck │ ├── foreach-4.ck │ ├── foreach-5.ck │ ├── foreach-6.ck │ ├── foreach-auto1.ck │ └── foreach-auto2.ck ├── basic │ ├── adc.ck │ ├── adsr.ck │ ├── alarm.ck │ ├── args.ck │ ├── bar.ck │ ├── blit.ck │ ├── blit2.ck │ ├── blit3.ck │ ├── blit4.ck │ ├── chirp.ck │ ├── chirp2.ck │ ├── comb.ck │ ├── curly++.ck │ ├── curly.ck │ ├── delay.ck │ ├── delay2.ck │ ├── demo0.ck │ ├── demo1.ck │ ├── demo2.ck │ ├── demo3.ck │ ├── doh.ck │ ├── echo.ck │ ├── envelope.ck │ ├── envelope2.ck │ ├── fm.ck │ ├── fm2.ck │ ├── fm3.ck │ ├── foo.ck │ ├── foo2.ck │ ├── func.ck │ ├── i-robot.ck │ ├── imp.ck │ ├── infnan.ck │ ├── larry++.ck │ ├── larry.ck │ ├── lfo.ck │ ├── moe++.ck │ ├── moe.ck │ ├── oscillatronx.ck │ ├── phasor.ck │ ├── pulse.ck │ ├── rec-auto-stereo.ck │ ├── rec-auto.ck │ ├── rec.ck │ ├── ring.ck │ ├── sndbuf.ck │ ├── step.ck │ ├── tick.ck │ ├── tick2.ck │ ├── unchuck.ck │ ├── valueat.ck │ ├── whirl.ck │ ├── whole.ck │ ├── wind.ck │ ├── wind2.ck │ └── zerox.ck ├── book │ └── digital-artists │ │ ├── README.txt │ │ ├── audio │ │ ├── clap_01.wav │ │ ├── click_01.wav │ │ ├── click_02.wav │ │ ├── cowbell_01.wav │ │ ├── hihat_01.wav │ │ ├── hihat_02.wav │ │ ├── hihat_04.wav │ │ ├── kick_01.wav │ │ ├── kick_04.wav │ │ ├── snare_01.wav │ │ ├── snare_02.wav │ │ ├── snare_03.wav │ │ ├── stereo_fx_01.wav │ │ └── stereo_fx_03.wav │ │ ├── chapter1 │ │ ├── Listing1.1.ck │ │ ├── Listing1.10.ck │ │ ├── Listing1.11.ck │ │ ├── Listing1.12.ck │ │ ├── Listing1.13.ck │ │ ├── Listing1.14.ck │ │ ├── Listing1.15.ck │ │ ├── Listing1.16.ck │ │ ├── Listing1.17.ck │ │ ├── Listing1.18.ck │ │ ├── Listing1.19.ck │ │ ├── Listing1.2.ck │ │ ├── Listing1.20.ck │ │ ├── Listing1.3.ck │ │ ├── Listing1.4.ck │ │ ├── Listing1.5.ck │ │ ├── Listing1.6.ck │ │ ├── Listing1.7.ck │ │ ├── Listing1.7Shorthand.ck │ │ ├── Listing1.8.ck │ │ ├── Listing1.9.ck │ │ └── WowExample.ck │ │ ├── chapter10 │ │ ├── Listing10.1.ck │ │ ├── Listing10.2.ck │ │ ├── Listing10.3.ck │ │ ├── Listing10.4.ck │ │ ├── Listing10.4b.ck │ │ ├── Listing10.4c.ck │ │ └── Listing10.5.ck │ │ ├── chapter11 │ │ ├── Listing11.1.ck │ │ ├── Listing11.1Twinkle.ck │ │ ├── Listing11.2.ck │ │ ├── Listing11.3.ck │ │ ├── Listing11.4.ck │ │ └── Listing11.5.ck │ │ ├── chapter2 │ │ ├── Listing2.1.ck │ │ ├── Listing2.2.ck │ │ ├── Listing2.3.ck │ │ ├── Listing2.4.ck │ │ ├── Listing2.5.ck │ │ ├── Listing2.6.ck │ │ ├── Listing2.7.ck │ │ └── Listing2.8.ck │ │ ├── chapter3 │ │ ├── Listing3.1.ck │ │ ├── Listing3.2.ck │ │ ├── Listing3.3.ck │ │ ├── Listing3.4.ck │ │ ├── Listing3.5.ck │ │ ├── Listing3.6.ck │ │ ├── Listing3.7.ck │ │ └── Listing3.8.ck │ │ ├── chapter4 │ │ ├── Listing4.1.ck │ │ ├── Listing4.10.ck │ │ ├── Listing4.11.ck │ │ ├── Listing4.12.ck │ │ ├── Listing4.2.ck │ │ ├── Listing4.3.ck │ │ ├── Listing4.4.ck │ │ ├── Listing4.5.ck │ │ ├── Listing4.6.ck │ │ ├── Listing4.7.ck │ │ ├── Listing4.8.ck │ │ ├── Listing4.9.ck │ │ └── audio │ │ │ ├── clap_01.wav │ │ │ ├── click_01.wav │ │ │ ├── click_02.wav │ │ │ ├── cowbell_01.wav │ │ │ ├── hihat_01.wav │ │ │ ├── hihat_04.wav │ │ │ ├── kick_01.wav │ │ │ ├── snare_01.wav │ │ │ ├── snare_02.wav │ │ │ ├── snare_03.wav │ │ │ ├── stereo_fx_01.wav │ │ │ └── stereo_fx_03.wav │ │ ├── chapter5 │ │ ├── Listing5.1.ck │ │ ├── Listing5.10.ck │ │ ├── Listing5.11.ck │ │ ├── Listing5.12.ck │ │ ├── Listing5.13.ck │ │ ├── Listing5.14.ck │ │ ├── Listing5.15.ck │ │ ├── Listing5.16.ck │ │ ├── Listing5.17.ck │ │ ├── Listing5.18.ck │ │ ├── Listing5.19.ck │ │ ├── Listing5.2.ck │ │ ├── Listing5.20.ck │ │ ├── Listing5.3.ck │ │ ├── Listing5.4.ck │ │ ├── Listing5.5.ck │ │ ├── Listing5.6.ck │ │ ├── Listing5.7.ck │ │ ├── Listing5.8.ck │ │ ├── Listing5.9.ck │ │ └── audio │ │ │ ├── kick_01.wav │ │ │ ├── snare_03.wav │ │ │ └── stereo_fx_01.wav │ │ ├── chapter6 │ │ ├── Listing6.1.ck │ │ ├── Listing6.10.ck │ │ ├── Listing6.11.ck │ │ ├── Listing6.12.ck │ │ ├── Listing6.13.ck │ │ ├── Listing6.14.ck │ │ ├── Listing6.15.ck │ │ ├── Listing6.2.ck │ │ ├── Listing6.3.ck │ │ ├── Listing6.4.ck │ │ ├── Listing6.5.ck │ │ ├── Listing6.6.ck │ │ ├── Listing6.7.ck │ │ ├── Listing6.8.ck │ │ └── Listing6.9.ck │ │ ├── chapter7 │ │ ├── Listing7.1.ck │ │ ├── Listing7.10.ck │ │ ├── Listing7.11.ck │ │ ├── Listing7.12.ck │ │ ├── Listing7.13.ck │ │ ├── Listing7.14.ck │ │ ├── Listing7.15.ck │ │ ├── Listing7.16.ck │ │ ├── Listing7.17.ck │ │ ├── Listing7.18.ck │ │ ├── Listing7.2.ck │ │ ├── Listing7.3.ck │ │ ├── Listing7.4.ck │ │ ├── Listing7.5.ck │ │ ├── Listing7.6.ck │ │ ├── Listing7.7.ck │ │ ├── Listing7.8.ck │ │ ├── Listing7.9.ck │ │ └── TryThis.ck │ │ ├── chapter8 │ │ ├── Listing8.1.ck │ │ ├── Listing8.10.ck │ │ ├── Listing8.2.ck │ │ ├── Listing8.3.ck │ │ ├── Listing8.4.ck │ │ ├── Listing8.5.ck │ │ ├── Listing8.6.ck │ │ ├── Listing8.7.ck │ │ ├── Listing8.8.ck │ │ ├── Listing8.9.ck │ │ ├── audio │ │ │ ├── hihat_01.wav │ │ │ └── kick_01.wav │ │ ├── bass.ck │ │ ├── drums.ck │ │ ├── flute.ck │ │ ├── initialize.ck │ │ ├── piano.ck │ │ └── score.ck │ │ └── chapter9 │ │ ├── BPM.ck │ │ ├── DrumMachine │ │ ├── BPM.ck │ │ ├── Listing9.11.ck │ │ ├── Listing9.12.ck │ │ ├── Listing9.13.ck │ │ ├── Listing9.14.ck │ │ ├── Listing9.15.ck │ │ ├── Listing9.16.ck │ │ ├── Listing9.17.ck │ │ ├── audio │ │ │ ├── clap_01.wav │ │ │ ├── cowbell_01.wav │ │ │ ├── hihat_02.wav │ │ │ ├── kick_04.wav │ │ │ └── snare_01.wav │ │ ├── clap.ck │ │ ├── cowbell.ck │ │ ├── hihat.ck │ │ ├── initialize.ck │ │ ├── kick.ck │ │ ├── score.ck │ │ └── snare.ck │ │ ├── Listing9.1.ck │ │ ├── Listing9.10.ck │ │ ├── Listing9.18.ck │ │ ├── Listing9.19.ck │ │ ├── Listing9.2.ck │ │ ├── Listing9.3.ck │ │ ├── Listing9.4.ck │ │ ├── Listing9.5.ck │ │ ├── Listing9.6.ck │ │ ├── Listing9.7.ck │ │ ├── Listing9.8.ck │ │ ├── Listing9.9.ck │ │ ├── MyScore.ck │ │ ├── SmartMandolin │ │ ├── Listing9.20.ck │ │ ├── Listing9.21.ck │ │ ├── Listing9.22.ck │ │ ├── MandoPlayer.ck │ │ ├── MandoScore.ck │ │ └── initialize.ck │ │ ├── UseBPM.ck │ │ ├── UseBPM2.ck │ │ ├── UseBPM3.ck │ │ └── initialize.ck ├── class │ ├── constructors.ck │ ├── ctors-dtor.ck │ ├── destructor.ck │ ├── dinky.ck │ ├── inline-doc.ck │ ├── static-init.ck │ └── try.ck ├── ctrl │ ├── ctrl_break.ck │ ├── ctrl_break_nested.ck │ ├── ctrl_continue.ck │ ├── ctrl_do_until.ck │ ├── ctrl_do_while.ck │ ├── ctrl_for_loop.ck │ ├── ctrl_foreach.ck │ ├── ctrl_repeat.ck │ ├── ctrl_sequencer.ck │ ├── ctrl_until.ck │ └── ctrl_while.ck ├── data │ ├── hihat-open.wav │ ├── hihat.wav │ ├── kick.wav │ ├── snare-chili.wav │ ├── snare-hop.wav │ └── snare.wav ├── deep │ ├── chant.ck │ ├── dither.ck │ ├── dtmf.ck │ ├── follower.ck │ ├── ks-chord.ck │ ├── plu.ck │ ├── plu2.ck │ ├── plu3.ck │ ├── say-chu.ck │ ├── shepard.ck │ ├── smb.ck │ ├── thx.ck │ └── unclap.ck ├── effects │ ├── ABSaturator.ck │ ├── Bitcrusher.ck │ ├── ExpDelay.ck │ ├── ExpEnv-modes.ck │ ├── ExpEnv.ck │ ├── FoldbackSaturator-index.ck │ ├── FoldbackSaturator-threshold.ck │ ├── GVerb.ck │ ├── KasFilter-demo.ck │ ├── PowerADSR-feedback-beatings.ck │ ├── PowerADSR.ck │ ├── Spectacle.ck │ ├── WinFuncEnv.ck │ ├── autotune.ck │ ├── chorus.ck │ ├── data │ │ └── obama.wav │ ├── pitch-shift.ck │ └── reverb.ck ├── event │ ├── ALSO-SEE │ ├── broadcast.ck │ ├── event-extend.ck │ ├── event-extend2.ck │ ├── event-x-bpm-1.ck │ ├── event-x-bpm-2.ck │ ├── signal.ck │ └── signal4.ck ├── extend │ ├── chugen.ck │ └── chugraph.ck ├── filter │ ├── Elliptic-help.ck │ ├── FIR-convolve-homer.ck │ ├── FIR-greyhole-down-up-decimate.ck │ ├── FIR-sinc-explicit.ck │ ├── KasFilter.ck │ ├── Multicomb.ck │ ├── WPDiodeLadder.ck │ ├── WPKorg35.ck │ ├── bpf.ck │ ├── brf.ck │ ├── dcblocker.ck │ ├── hpf.ck │ ├── lpf.ck │ ├── resonz.ck │ ├── rhpf.ck │ └── rlpf.ck ├── func │ ├── func_doozey.ck │ ├── func_obj_arg.ck │ ├── func_overload.ck │ ├── func_overload_member.ck │ ├── func_overload_multi.ck │ ├── func_recursion.ck │ └── func_void.ck ├── hanoi++.ck ├── hanoi.ck ├── hanoi2.ck ├── hanoi3.ck ├── help.ck ├── hid │ ├── gametra.ck │ ├── joy-fm.ck │ ├── joy-noise.ck │ ├── joy-shake.ck │ ├── joy.ck │ ├── kb.ck │ ├── kbhit │ │ ├── clix.ck │ │ ├── clix2.ck │ │ ├── clix3.ck │ │ ├── kbhit.ck │ │ └── kbhit2.ck │ ├── keyboard-organ.ck │ ├── mouse-abs.ck │ ├── mouse-cursor.ck │ ├── mouse-fm.ck │ ├── mouse.ck │ └── tilt.ck ├── import │ ├── Foo.ck │ ├── import-test-1.ck │ ├── import-test-1e.ck │ ├── import-test-2.ck │ └── import-test-3.ck ├── io │ ├── chout.ck │ ├── jabberwocky.txt │ ├── read-byte.ck │ ├── read-byte.txt │ ├── read-float.ck │ ├── read-float.txt │ ├── read-int.ck │ ├── read-int.txt │ ├── read-line.ck │ ├── read-line.txt │ ├── read-str.ck │ ├── read-str.txt │ ├── read-tokens.ck │ ├── read-wav-raw.ck │ ├── saigon44.wav │ ├── seek.ck │ ├── write-auto.ck │ ├── write-byte.ck │ ├── write.ck │ └── write2.ck ├── machine │ ├── crash.ck │ ├── eval-global.ck │ ├── eval.ck │ ├── intsize.ck │ ├── is-realtime.ck │ ├── machine-help.ck │ ├── machine-shred.ck │ ├── test1.ck │ ├── test2.ck │ └── version.ck ├── math │ ├── int-dist.ck │ ├── map.ck │ ├── math-help.ck │ ├── maybe.ck │ └── randomize.ck ├── midi │ ├── bwv772.mid │ ├── gomidi.ck │ ├── gomidi2.ck │ ├── midifile-play.ck │ ├── midiout.ck │ ├── midiout2.ck │ ├── polyfony.ck │ └── polyfony2.ck ├── multi │ ├── i.ck │ ├── n.ck │ └── we-robot.ck ├── oper │ ├── oper_arith_chuck.ck │ ├── oper_assign.ck │ ├── oper_logic.ck │ ├── oper_post_inc.ck │ ├── oper_pre_inc.ck │ ├── overload_class.ck │ ├── overload_gru.ck │ ├── overload_overview.ck │ ├── overload_pre_post.ck │ └── overload_public.ck ├── osc │ ├── multi-msg │ │ ├── r-multi-msg.ck │ │ └── s-multi-msg.ck │ ├── multicast │ │ ├── r.ck │ │ └── s-multicast.ck │ ├── one2many │ │ ├── r.ck │ │ └── s-sender.ck │ ├── osc-dump.ck │ ├── r.ck │ ├── r2.ck │ ├── s.ck │ ├── utilities │ │ ├── midi2osc-r.ck │ │ └── midi2osc-s.ck │ └── wildcards │ │ ├── r-wildcards.ck │ │ └── s-multi.ck ├── otf_01.ck ├── otf_02.ck ├── otf_03.ck ├── otf_04.ck ├── otf_05.ck ├── otf_06.ck ├── otf_07.ck ├── serial │ ├── arduino │ │ └── ckserial.ino │ ├── byte.ck │ ├── bytes.ck │ ├── ints-ascii.ck │ ├── ints-bin.ck │ ├── lines.ck │ ├── list.ck │ ├── write-bytes.ck │ └── write.ck ├── shred │ ├── ancestor.ck │ ├── dir.ck │ ├── machine.ck │ ├── parent.ck │ ├── powerup.ck │ ├── spork.ck │ ├── spork2-exit.ck │ ├── spork2-remove.ck │ └── spork2.ck ├── spatial │ ├── AmbPan3-CCRMA.ck │ ├── Pan4.ck │ └── Pan8.ck ├── special │ ├── Dyno-compress.ck │ ├── Dyno-duck.ck │ ├── Dyno-limit.ck │ ├── Gen10-test.ck │ ├── Gen17-test.ck │ ├── Gen5-test.ck │ ├── Gen7-test.ck │ ├── Gen9-test.ck │ ├── GenX-CurveTable-test.ck │ ├── GenX-WarpTable-test.ck │ ├── LiSa-load.ck │ ├── LiSa-munger1.ck │ ├── LiSa-munger2.ck │ ├── LiSa-munger3.ck │ ├── LiSa-simplelooping.ck │ ├── LiSa-stereo.ck │ ├── LiSa-track1.ck │ ├── LiSa-track2.ck │ ├── LiSa-track3.ck │ ├── LiSa-track4.ck │ ├── LiSa-track5.ck │ ├── LiSa-trigger.ck │ ├── Mesh2D.ck │ ├── geetar.wav │ ├── readme-GenX.ck │ ├── readme-LiSa1.ck │ ├── readme-LiSa2.ck │ ├── scream-o-matic │ │ ├── data │ │ │ ├── scream-1.wav │ │ │ ├── scream-2.wav │ │ │ ├── scream-3.wav │ │ │ ├── scream-4.wav │ │ │ ├── scream-5.wav │ │ │ └── scream-6-lion.wav │ │ └── scream-o-matic.ck │ └── twilight │ │ ├── twilight-granular-kb-interp.ck │ │ ├── twilight-granular-kb.ck │ │ └── twilight-granular.aiff ├── status.ck ├── stereo │ ├── array.ck │ ├── curly2.ck │ ├── larry2.ck │ ├── moe2.ck │ ├── powerup2.ck │ ├── stereo-noise.ck │ └── ugen-array.ck ├── stk │ ├── band-o-matic.ck │ ├── bandedwg.ck │ ├── bandedwg2.ck │ ├── blowbotl.ck │ ├── blowbotl2.ck │ ├── blowhole.ck │ ├── blowhole2.ck │ ├── bowed.ck │ ├── bowed2.ck │ ├── brass.ck │ ├── brass2.ck │ ├── clarinet.ck │ ├── clarinet2.ck │ ├── flute.ck │ ├── frenchrn-algo2.ck │ ├── hevymetl-algo3.ck │ ├── hevymetl-dance-now.ck │ ├── hevymetl-trumpet-algo3.ck │ ├── honkeytonk-algo1.ck │ ├── jacobass-algo1.ck │ ├── krstlchr-algo7.ck │ ├── mand-o-matic-simple.ck │ ├── mand-o-matic.ck │ ├── mandolin.ck │ ├── modalbar.ck │ ├── modalbar2.ck │ ├── mode-o-matic.ck │ ├── mode-o-test.ck │ ├── modulate.ck │ ├── moog.ck │ ├── moog2.ck │ ├── moogie.ck │ ├── nylon-guitar-algo1.ck │ ├── rhodey-song.ck │ ├── rhodey.ck │ ├── saxofony.ck │ ├── shake-cycle.ck │ ├── shake-o-matic.ck │ ├── sitar.ck │ ├── stif-o-karp.ck │ ├── stifkarp.ck │ ├── subnoise-audio.ck │ ├── subnoise-control.ck │ ├── tubebell-algo5.ck │ ├── voic-o-form.ck │ ├── wurley.ck │ ├── wurley2.ck │ ├── wurley3.ck │ └── wvout-24bit.ck ├── string │ ├── escape.ck │ ├── readline.ck │ ├── replace.ck │ ├── strops.ck │ ├── strops2.ck │ ├── token.ck │ └── tostr.ck ├── time │ ├── time_operations.ck │ └── time_types.ck ├── type │ ├── polymorph.ck │ ├── type_analysis.ck │ ├── type_auto.ck │ ├── type_object.ck │ ├── type_primitives.ck │ ├── type_query.ck │ └── type_type.ck └── vector │ ├── interpolate.ck │ ├── vec2.ck │ ├── vec3.ck │ ├── vec4.ck │ └── vecs-cast.ck └── src ├── core ├── chuck.cpp ├── chuck.h ├── chuck.lex ├── chuck.y ├── chuck_absyn.cpp ├── chuck_absyn.h ├── chuck_carrier.cpp ├── chuck_carrier.h ├── chuck_compile.cpp ├── chuck_compile.h ├── chuck_def.h ├── chuck_dl.cpp ├── chuck_dl.h ├── chuck_emit.cpp ├── chuck_emit.h ├── chuck_errmsg.cpp ├── chuck_errmsg.h ├── chuck_frame.cpp ├── chuck_frame.h ├── chuck_globals.cpp ├── chuck_globals.h ├── chuck_instr.cpp ├── chuck_instr.h ├── chuck_io.cpp ├── chuck_io.h ├── chuck_lang.cpp ├── chuck_lang.h ├── chuck_oo.cpp ├── chuck_oo.h ├── chuck_otf.cpp ├── chuck_otf.h ├── chuck_parse.cpp ├── chuck_parse.h ├── chuck_scan.cpp ├── chuck_scan.h ├── chuck_shell.cpp ├── chuck_shell.h ├── chuck_stats.cpp ├── chuck_stats.h ├── chuck_symbol.cpp ├── chuck_symbol.h ├── chuck_table.cpp ├── chuck_table.h ├── chuck_type.cpp ├── chuck_type.h ├── chuck_ugen.cpp ├── chuck_ugen.h ├── chuck_vm.cpp ├── chuck_vm.h ├── chuck_yacc.c ├── chuck_yacc.h ├── dirent_win32.h ├── hidio_sdl.cpp ├── hidio_sdl.h ├── lo │ ├── address.c │ ├── blob.c │ ├── bundle.c │ ├── config.h │ ├── lo.h │ ├── lo_endian.h │ ├── lo_errors.h │ ├── lo_internal.h │ ├── lo_lowlevel.h │ ├── lo_macros.h │ ├── lo_osc_types.h │ ├── lo_throw.h │ ├── lo_types.h │ ├── lo_types_internal.h │ ├── message.c │ ├── method.c │ ├── pattern_match.c │ ├── send.c │ ├── server.c │ ├── server_thread.c │ └── timetag.c ├── makefile ├── makefile.x │ ├── makefile.alsa │ ├── makefile.jack │ ├── makefile.linux │ ├── makefile.mac │ ├── makefile.pulse │ └── makefile.vanilla ├── midiio_rtmidi.cpp ├── midiio_rtmidi.h ├── rtmidi.cpp ├── rtmidi.h ├── uana_extract.cpp ├── uana_extract.h ├── uana_xform.cpp ├── uana_xform.h ├── ugen_filter.cpp ├── ugen_filter.h ├── ugen_osc.cpp ├── ugen_osc.h ├── ugen_stk.cpp ├── ugen_stk.h ├── ugen_xxx.cpp ├── ugen_xxx.h ├── ulib_ai.cpp ├── ulib_ai.h ├── ulib_doc.cpp ├── ulib_doc.h ├── ulib_machine.cpp ├── ulib_machine.h ├── ulib_math.cpp ├── ulib_math.h ├── ulib_opsc.cpp ├── ulib_opsc.h ├── ulib_std.cpp ├── ulib_std.h ├── util_buffers.cpp ├── util_buffers.h ├── util_console.cpp ├── util_console.h ├── util_hid.cpp ├── util_hid.h ├── util_math.cpp ├── util_math.h ├── util_network.c ├── util_network.h ├── util_opsc.cpp ├── util_opsc.h ├── util_platforms.cpp ├── util_platforms.h ├── util_raw.c ├── util_raw.h ├── util_serial.cpp ├── util_serial.h ├── util_sndfile.c ├── util_sndfile.h ├── util_string.cpp ├── util_string.h ├── util_thread.cpp ├── util_thread.h ├── util_xforms.c └── util_xforms.h ├── host-examples ├── README.txt ├── ck │ ├── test-2-audio.ck │ ├── test-3-globals.ck │ ├── test-4-shreds.ck │ └── test-5-custom.ck ├── example-1-minimal.cpp ├── example-2-audio.cpp ├── example-3-globals.cpp ├── example-4-shreds.cpp ├── example-5-custom-api.cpp └── makefile ├── host-web ├── README.txt ├── chuck.tmlanguage ├── chuck_emscripten.cpp ├── chuck_emscripten.h ├── chucknode-postjs.js └── webchuck │ ├── css │ └── editor.css │ ├── examples │ ├── globals1 │ │ └── index.html │ ├── globals2 │ │ └── index.html │ ├── globals3 │ │ └── index.html │ ├── globals4 │ │ └── index.html │ ├── globals5 │ │ └── index.html │ ├── globals6 │ │ └── index.html │ ├── globals7 │ │ └── index.html │ ├── globals8 │ │ └── index.html │ ├── hid1 │ │ └── index.html │ ├── hid2 │ │ └── index.html │ ├── lisa1 │ │ └── index.html │ ├── mic1 │ │ └── index.html │ ├── midi1 │ │ └── index.html │ ├── pan1 │ │ └── index.html │ ├── sndbuf1 │ │ └── index.html │ ├── sndbuf2 │ │ └── index.html │ ├── sndbuf3 │ │ └── index.html │ └── sndbuf4 │ │ └── index.html │ ├── index.html │ ├── js │ ├── ace-min-noconflict │ │ ├── ace.js │ │ ├── ext-beautify.js │ │ ├── ext-elastic_tabstops_lite.js │ │ ├── ext-emmet.js │ │ ├── ext-error_marker.js │ │ ├── ext-keybinding_menu.js │ │ ├── ext-language_tools.js │ │ ├── ext-linking.js │ │ ├── ext-modelist.js │ │ ├── ext-options.js │ │ ├── ext-prompt.js │ │ ├── ext-rtl.js │ │ ├── ext-searchbox.js │ │ ├── ext-settings_menu.js │ │ ├── ext-spellcheck.js │ │ ├── ext-split.js │ │ ├── ext-static_highlight.js │ │ ├── ext-statusbar.js │ │ ├── ext-textarea.js │ │ ├── ext-themelist.js │ │ ├── ext-whitespace.js │ │ ├── keybinding-emacs.js │ │ ├── keybinding-sublime.js │ │ ├── keybinding-vim.js │ │ ├── mode-c_cpp.js │ │ ├── mode-chuck.js │ │ ├── snippets │ │ │ ├── c_cpp.js │ │ │ └── chuck.js │ │ └── theme-chuck.js │ ├── defer.js │ ├── editor.js │ ├── host.js │ └── webchuck_host.js │ └── wav │ └── aah.wav ├── host ├── RtAudio │ ├── RtAudio.cpp │ ├── RtAudio.h │ └── include │ │ ├── asio.cpp │ │ ├── asio.h │ │ ├── asiodrivers.cpp │ │ ├── asiodrivers.h │ │ ├── asiodrvr.h │ │ ├── asioinfo.txt │ │ ├── asiolist.cpp │ │ ├── asiolist.h │ │ ├── asiosys.h │ │ ├── dsound.h │ │ ├── functiondiscoverykeys_devpkey.h │ │ ├── ginclude.h │ │ ├── iasiodrv.h │ │ ├── iasiothiscallresolver.cpp │ │ ├── iasiothiscallresolver.h │ │ └── soundcard.h ├── chuck_audio.cpp ├── chuck_audio.h ├── chuck_console.cpp ├── chuck_console.h └── chuck_main.cpp ├── makefile ├── scripts ├── ckdoc │ ├── gen-all.ck │ ├── makefile │ ├── test-all.ck │ └── test-class.ck ├── generate-iconset │ ├── README.txt │ └── generate-iconset.py ├── generate-sndfile │ └── generate-sndfile.pl ├── hex2cpp.cpp ├── platform.cpp └── raw2code.cpp ├── test ├── 01-Basic │ ├── 01.ck │ ├── 02.ck │ ├── 03.ck │ ├── 04.ck.disabled │ ├── 05.ck │ ├── 06.ck │ ├── 07.ck │ ├── 08.ck │ ├── 09.ck │ ├── 10.ck │ ├── 100.ck │ ├── 101.ck │ ├── 102.ck │ ├── 103.ck │ ├── 104.ck │ ├── 105.ck │ ├── 106.ck │ ├── 107.ck │ ├── 108.ck │ ├── 109.ck │ ├── 11.ck │ ├── 110.ck │ ├── 111.ck │ ├── 112.ck │ ├── 113.ck │ ├── 113.txt │ ├── 114.ck │ ├── 114.txt │ ├── 115.ck │ ├── 116.ck │ ├── 116.txt │ ├── 117.ck │ ├── 118.ck │ ├── 119.ck │ ├── 119.txt │ ├── 12.ck │ ├── 120.ck │ ├── 120.txt │ ├── 121.ck │ ├── 122.ck │ ├── 122.txt │ ├── 123.ck │ ├── 124.ck │ ├── 125.ck │ ├── 126.ck │ ├── 127.ck │ ├── 128.ck │ ├── 129.ck │ ├── 13.ck │ ├── 130.ck │ ├── 131.ck │ ├── 132.ck │ ├── 132.txt │ ├── 133.ck │ ├── 133.txt │ ├── 134.ck │ ├── 135-array-append.ck │ ├── 135-array-append.txt │ ├── 136-array-erase.ck │ ├── 136-array-erase.txt │ ├── 137-array-erase.ck │ ├── 137-array-erase.txt │ ├── 138-foreach.ck │ ├── 138-foreach.txt │ ├── 139-foreach.ck │ ├── 139-foreach.txt │ ├── 14.ck │ ├── 140-foreach.ck │ ├── 140-foreach.txt │ ├── 141-foreach.ck │ ├── 141-foreach.txt │ ├── 142-foreach.ck │ ├── 142-foreach.txt │ ├── 143-foreach.ck │ ├── 144-foreach.ck │ ├── 144-foreach.txt │ ├── 145-foreach.ck │ ├── 146-foreach-auto.ck │ ├── 146-foreach-auto.txt │ ├── 147-foreach-auto.ck │ ├── 147-foreach-auto.txt │ ├── 148-type-auto.ck │ ├── 148-type-auto.txt │ ├── 149-do-until.ck │ ├── 15.ck │ ├── 150-do-while.ck │ ├── 151-until.ck │ ├── 152-while.ck │ ├── 153-break-nested.ck │ ├── 154-break.ck │ ├── 155-continue.ck │ ├── 156-for-empty.ck │ ├── 157-while-empty.ck │ ├── 158-dowhile-empty.ck │ ├── 159-repeat.ck │ ├── 16.ck │ ├── 160-foreach-class.ck │ ├── 160-foreach-class.txt │ ├── 161-foreach-func.ck │ ├── 162-public-access.ck │ ├── 163-public-access.ck │ ├── 164-depend-class-after.ck │ ├── 165-depend-class-before.ck │ ├── 166-depend-func.ck │ ├── 166-depend-func.txt │ ├── 167-depend-ref.ck │ ├── 168-depend-mutual.ck │ ├── 169-depend-nest1.ck │ ├── 169-depend-nest1.txt │ ├── 17.ck │ ├── 170-depend-nest2.ck │ ├── 171-depend-nest3.ck │ ├── 172-depend-spork.ck.disabled │ ├── 173-complex-polar.ck │ ├── 173-complex-polar.txt │ ├── 174-complex-array.ck │ ├── 174-complex-array.txt │ ├── 175-array-sort.ck │ ├── 175-array-sort.txt │ ├── 176-return-implicit.ck │ ├── 177-getenv2.ck │ ├── 178-decl-b.ck │ ├── 179-ctrl-empty.ck │ ├── 18.ck.disabled │ ├── 180-return-basic.ck │ ├── 181-return-ctrl-paths-1.ck │ ├── 182-return-ctrl-paths-2.ck │ ├── 183-return-ctrl-paths-3.ck │ ├── 184-return-ctrl-paths-4.ck │ ├── 185-range.ck │ ├── 185-range.txt │ ├── 186-array-comma.ck │ ├── 187-return-ctrl-5.ck │ ├── 188-class-var-anywhere1.ck │ ├── 189-class-var-anywhere2.ck │ ├── 19.ck │ ├── 190-class-auto.ck │ ├── 190-class-auto.txt │ ├── 191-a-Foo.ck.disabled │ ├── 191-b-Factory.ck.disabled │ ├── 191-c-User.ck.disabled │ ├── 191-depend-context.ck │ ├── 191-depend-context.txt │ ├── 192-class-ctors.ck │ ├── 192-class-ctors.txt │ ├── 193-machine-add-this.ck.disabled │ ├── 193-machine-add.ck │ ├── 193-machine-add.txt │ ├── 194-value-lookup-order.ck │ ├── 194-value-lookup-order.txt │ ├── 195-value-lookup-order.ck │ ├── 195-value-lookup-order.txt │ ├── 196-array-append-array.ck │ ├── 196-array-append-array.txt │ ├── 197-array-append-array.ck │ ├── 197-array-append-array.txt │ ├── 198-string-replace.ck │ ├── 199-string-replace.ck │ ├── 199-string-replace.txt │ ├── 20.ck │ ├── 200-inner-class.ck │ ├── 200-inner-class.txt │ ├── 201-trail-comment-1.ck │ ├── 202-trail-comment-2.ck │ ├── 203-op-overload-class.ck │ ├── 203-op-overload-class.txt │ ├── 204-op-overload-foo.ck │ ├── 204-op-overload-foo.txt │ ├── 205-op-overload-gru.ck │ ├── 205-op-overload-gru.txt │ ├── 206-op-overload-public.ck │ ├── 206-op-overload-public.txt │ ├── 207-op-overload-pre-post.ck │ ├── 207-op-overload-pre-post.txt │ ├── 208-op-overload-binary-mix.ck │ ├── 209-op-overload-mix.ck │ ├── 209-op-overload-mix.txt │ ├── 21.ck │ ├── 210-mfun-invoke.ck │ ├── 211-mfun-invoke-vars.ck │ ├── 211-mfun-invoke-vars.txt │ ├── 212-use-before-extend.ck │ ├── 213-spork-nested-var.ck │ ├── 213-spork-nested-var.txt │ ├── 214-num-types.ck │ ├── 214-num-types.txt │ ├── 215-chugraph-passthrough.ck │ ├── 216-chugen-passthrough.ck │ ├── 217-vec-fields-access.ck │ ├── 217-vec-fields-access.txt │ ├── 218-vec2.ck │ ├── 218-vec2.txt │ ├── 219-func-call-refs.ck │ ├── 219-func-call-refs.txt │ ├── 22.ck │ ├── 220-dangel-ref-loop.ck │ ├── 221-dangle-ref-loops.ck │ ├── 222-dangle-ref-return.ck │ ├── 223-dangle-ref-func1.ck │ ├── 224-stack-pointer-reg.ck │ ├── 224-stack-pointer-reg.txt │ ├── 225-vecs-cast.ck │ ├── 225-vecs-cast.txt │ ├── 226-vecs-foreach-read.ck │ ├── 226-vecs-foreach-read.txt │ ├── 227-dangle-ref-func2.ck │ ├── 228-dangle-ref-recurse.ck │ ├── 229-dangle-ref-spork.ck │ ├── 23.ck │ ├── 230-dangle-ref-new.ck │ ├── 230-dangle-ref-new.txt │ ├── 231-op-overload-refs.ck │ ├── 232-shred-parent.ck │ ├── 233-shred-parent-recursive.ck │ ├── 234-shred-ancestor.ck │ ├── 235-type-array.ck │ ├── 236-ctors-basic.ck │ ├── 236-ctors-basic.txt │ ├── 237-ctor-arrays.ck │ ├── 237-ctor-arrays.txt │ ├── 238-ctor-order.ck │ ├── 239-ctor-default.ck │ ├── 24.ck │ ├── 240-dtor-basic.ck │ ├── 240-dtor-basic.txt │ ├── 241-ctor-builtin.ck │ ├── 242-ctor-obj.ck │ ├── 242-ctor-obj.txt │ ├── 243-func-closest-match.ck │ ├── 244-depend-member-var.ck │ ├── 245-depend-class-extend.ck │ ├── 246-depend-var-scope.ck │ ├── 247-func-ol-diff-ret.ck │ ├── 248-array-popfront.ck │ ├── 249-dtor-cascade.ck │ ├── 25.ck │ ├── 250-ugen-arrays.ck │ ├── 250-ugen-arrays.txt │ ├── 251-min-max.ck │ ├── 251-min-max.txt │ ├── 252-connected.ck │ ├── 252-connected.txt │ ├── 253-scope-cleanup.ck │ ├── 253-scope-cleanup.txt │ ├── 254-modulo-0-float-assign.ck │ ├── 254-modulo-0-float-assign.txt │ ├── 254-modulo-0-float.ck │ ├── 254-modulo-0-float.txt │ ├── 254-modulo-0-int-assign.ck │ ├── 254-modulo-0-int-assign.txt │ ├── 254-modulo-0-int.ck │ ├── 254-modulo-0-int.txt │ ├── 255-type-of-instance.ck │ ├── 256-type-type.ck │ ├── 256-type-type.txt │ ├── 257-vec3.ck │ ├── 257-vec3.txt │ ├── 258-vec4.ck │ ├── 258-vec4.txt │ ├── 259-strops.ck │ ├── 26.ck │ ├── 260-strops2.ck │ ├── 260-strops2.txt │ ├── 261-null-compare.ck │ ├── 262-vec-literal-func.ck │ ├── 263-vec-literal-stack.ck │ ├── 264-instantiation-integrity.ck │ ├── 265-static-init.ck │ ├── 265-static-init.txt │ ├── 266-static-init-import.ck │ ├── 266-static-init-import.txt │ ├── 267-static-init-more.ck │ ├── 267-static-init-more.txt │ ├── 268-foreach-auto-multidim.ck │ ├── 268-foreach-auto-multidim.txt │ ├── 269-foreach-auto-arraylit.ck │ ├── 269-foreach-auto-arraylit.txt │ ├── 27.ck │ ├── 270-var-func-order.ck │ ├── 271-ctor-call-ctor.ck │ ├── 272-this-call-ctor.ck │ ├── 273-doc-describe.ck │ ├── 273-doc-describe.txt │ ├── 274-type-edge-cases.ck │ ├── 274-type-edge-cases.txt │ ├── 275-func-var-decl.ck │ ├── 275-func-var-decl.txt │ ├── 28.ck │ ├── 29.ck.disabled │ ├── 30.ck.disabled │ ├── 31.ck.disabled │ ├── 32.ck │ ├── 33.ck.disabled │ ├── 34.ck │ ├── 35.ck │ ├── 36.ck │ ├── 37.ck.disabled │ ├── 38.ck.disabled │ ├── 39.ck.disabled │ ├── 40.ck.disabled │ ├── 41.ck │ ├── 42.ck │ ├── 43.ck.disabled │ ├── 44.ck.disabled │ ├── 45.ck.disabled │ ├── 46.ck.disabled │ ├── 47.ck.disabled │ ├── 48.ck.disabled │ ├── 49.ck.disabled │ ├── 50.ck.disabled │ ├── 51.ck.disabled │ ├── 52.ck.disabled │ ├── 53.ck.disabled │ ├── 54.ck.disabled │ ├── 55.ck │ ├── 56.ck.disabled │ ├── 57.ck.disabled │ ├── 58.ck.disabled │ ├── 59.ck.disabled │ ├── 60.ck.disabled │ ├── 61.ck.disabled │ ├── 62.ck.disabled │ ├── 63.ck.disabled │ ├── 64.ck │ ├── 65.ck.disabled │ ├── 66.ck.disabled │ ├── 67.ck.disabled │ ├── 69.ck.disabled │ ├── 70.ck.disabled │ ├── 71.ck.disabled │ ├── 72.ck │ ├── 73.ck.disabled │ ├── 74.ck │ ├── 75.ck │ ├── 76.ck │ ├── 77.ck │ ├── 79-cast-to-child.ck │ ├── 80.ck │ ├── 80.txt │ ├── 81.ck │ ├── 81.txt │ ├── 82.ck │ ├── 82.txt │ ├── 83.ck │ ├── 83.txt │ ├── 84.ck │ ├── 84.txt │ ├── 85.ck │ ├── 85.txt │ ├── 86.ck │ ├── 86.txt │ ├── 87.ck.disabled │ ├── 87.txt │ ├── 88.ck │ ├── 88.txt │ ├── 89.ck │ ├── 89.txt │ ├── 90.ck │ ├── 90.txt │ ├── 91.ck │ ├── 91.txt │ ├── 92.ck │ ├── 93.ck │ ├── 94.ck │ ├── 95.ck │ ├── 95.txt │ ├── 96.ck │ ├── 96.txt │ ├── 97.ck │ ├── 97.txt │ ├── 98.ck │ └── 99.ck ├── 02-UGens │ ├── ADSR-2.ck │ ├── ADSR.ck │ ├── BPF.ck │ ├── BRF.ck │ ├── BandedWG.ck │ ├── BeeThree.ck │ ├── BiQuad.ck │ ├── Blit.ck │ ├── BlitSaw.ck │ ├── BlitSquare.ck │ ├── BlowBotl.ck │ ├── BlowHole.ck │ ├── Bowed.ck │ ├── Brass.ck │ ├── Chorus.ck │ ├── Clarinet.ck │ ├── CurveTable.ck │ ├── Delay.ck │ ├── DelayA.ck │ ├── DelayL.ck │ ├── Dyno.ck │ ├── Echo.ck │ ├── Envelope.ck │ ├── FM.ck.disabled │ ├── FMVoices.ck │ ├── Filter.ck.disabled │ ├── Flute.ck │ ├── FullRect.ck │ ├── Gain.ck │ ├── GenX.ck │ ├── HPF.ck │ ├── HalfRect.ck │ ├── HevyMetl.ck │ ├── Impulse.ck │ ├── JCRev.ck │ ├── LPF.ck │ ├── LiSa-playPos.ck │ ├── LiSa-playPos.txt │ ├── LiSa.ck │ ├── Mandolin.ck │ ├── Mix2.ck │ ├── ModalBar.ck │ ├── Modulate.ck │ ├── Moog.ck │ ├── NRev.ck │ ├── Noise.ck │ ├── OnePole.ck │ ├── OneZero.ck │ ├── PRCRev.ck │ ├── Pan2.ck │ ├── PercFlut.ck │ ├── Phasor.ck │ ├── PitShift.ck │ ├── PoleZero.ck │ ├── PulseOsc.ck │ ├── ResonZ.ck │ ├── Rhodey.ck │ ├── SawOsc.ck │ ├── Saxofony.ck │ ├── Shakers.ck │ ├── SinOsc.ck │ ├── Sitar.ck │ ├── SndBuf.ck │ ├── SqrOsc.ck │ ├── Step.ck │ ├── StifKarp.ck │ ├── StkInstrument.ck.disabled │ ├── SubNoise.ck │ ├── TriOsc.ck │ ├── TubeBell.ck │ ├── TwoPole.ck │ ├── TwoZero.ck │ ├── VoicForm.ck.disabled │ ├── WarpTable.ck │ ├── WaveLoop.ck │ ├── Wurley.ck │ ├── WvIn-2.ck │ ├── WvIn.ck │ ├── WvOut.ck │ ├── ZeroX.ck │ └── generate.py ├── 03-Modules │ ├── 01-file-io.ck │ ├── 02-read-float-data.txt │ ├── 02-read-float.ck │ ├── 02-read-float.txt │ ├── 03-read-int-data.txt │ ├── 03-read-int.ck │ ├── 03-read-int.txt │ ├── 04-read-line-data.txt │ ├── 04-read-line.ck │ ├── 04-read-line.txt │ ├── 05-read-str-data.txt │ ├── 05-read-str.ck │ ├── 05-read-str.txt │ ├── 06-read-tokens.ck │ ├── 06-read-tokens.txt │ ├── 07-seek.ck │ ├── 07-seek.txt │ ├── 08-write-read-op.ck │ ├── 09-write-read.ck │ ├── jabberwocky.txt │ ├── osc01.ck │ ├── osc02.ck │ ├── osc03.ck │ ├── osc04-wildcards.ck │ └── std01.ck ├── 04-Stress │ ├── 147_spork.ck │ ├── 147_spork.txt │ ├── 5200_lines.ck │ ├── 9001_sporks.ck │ ├── 9001_sporks.txt │ ├── func-call-1.ck │ ├── func-call-10-spork-s.ck │ ├── func-call-2-static.ck │ ├── func-call-3-member.ck │ ├── func-call-4-vec.ck │ ├── func-call-5-sinosc.ck │ ├── func-call-6-ctor.ck │ ├── func-call-7-class-m.ck │ ├── func-call-8-class-s.ck │ ├── func-call-9-spork-m.ck │ ├── return-test.ck │ └── static-member-access.ck ├── 05-Global │ ├── 01.ck │ ├── 01b.ck │ ├── 01b.txt │ ├── 02.ck │ ├── 07.ck │ ├── 08.ck │ ├── 09.ck │ ├── 10.ck │ ├── 100.ck │ ├── 101.ck │ ├── 101.txt │ ├── 102a.ck │ ├── 102a.txt │ ├── 102b.ck │ ├── 102b.txt │ ├── 103a.ck │ ├── 103a.txt │ ├── 103b.ck │ ├── 103b.txt │ ├── 104a.ck │ ├── 104a.txt │ ├── 104b.ck │ ├── 105.ck │ ├── 11.ck │ ├── 113.ck │ ├── 14.ck │ ├── 15.ck │ ├── 16.ck │ ├── 17.ck │ ├── 19.ck │ ├── 20.ck │ ├── 25.ck │ ├── 28.ck │ ├── 41.ck │ ├── 42.ck │ ├── 42a.ck │ ├── 55.ck │ ├── 64.ck │ ├── 72.ck │ ├── 74.ck │ ├── 75.ck │ ├── 76.ck │ ├── 77.ck │ ├── 79.ck │ ├── 79b.ck │ ├── 80.ck │ ├── 80.txt │ ├── 81.ck │ ├── 81.txt │ ├── 82.ck │ ├── 82.txt │ ├── 83.ck │ ├── 83.txt │ ├── 84.ck │ ├── 84.txt │ ├── 86.ck │ ├── 86.txt │ ├── 88.ck │ ├── 88.txt │ ├── 89.ck │ ├── 89.txt │ ├── 90.ck │ ├── 90.txt │ ├── 91.ck │ ├── 91.txt │ ├── 95.ck │ ├── 95.txt │ ├── 96.ck │ ├── 96.txt │ ├── 97.ck │ ├── 97.txt │ └── 98.ck ├── 06-Errors │ ├── error-add-assign-decl.ck │ ├── error-add-assign-decl.txt │ ├── error-after-multiline-string-1.ck │ ├── error-after-multiline-string-1.txt │ ├── error-after-multiline-string-2.ck │ ├── error-after-multiline-string-2.txt │ ├── error-array-assign.ck │ ├── error-array-assign.txt │ ├── error-assign-to-class.ck │ ├── error-assign-to-class.txt │ ├── error-auto-auto.ck │ ├── error-auto-auto.txt │ ├── error-auto-decl.ck │ ├── error-auto-decl.txt │ ├── error-auto-global.ck │ ├── error-auto-global.txt │ ├── error-auto-null1.ck │ ├── error-auto-null1.txt │ ├── error-auto-null2.ck │ ├── error-auto-null2.txt │ ├── error-auto-null3.ck │ ├── error-auto-null3.txt │ ├── error-auto-void.ck │ ├── error-auto-void.txt │ ├── error-baseclass-stk1.ck │ ├── error-baseclass-stk1.txt │ ├── error-baseclass-stk2.ck │ ├── error-baseclass-stk2.txt │ ├── error-binary.ck │ ├── error-binary.txt │ ├── error-blit.ck │ ├── error-blit.txt │ ├── error-cast-to-nonchild.ck │ ├── error-cast-to-nonchild.txt │ ├── error-cast.ck │ ├── error-cast.txt │ ├── error-class-auto-m.ck │ ├── error-class-auto-m.txt │ ├── error-class-auto-s.ck │ ├── error-class-auto-s.txt │ ├── error-class-def-order.ck │ ├── error-class-def-order.txt │ ├── error-const-inc-1.ck │ ├── error-const-inc-1.txt │ ├── error-const-inc-2.ck │ ├── error-const-inc-2.txt │ ├── error-const-set-1.ck │ ├── error-const-set-1.txt │ ├── error-const-set-2.ck │ ├── error-const-set-2.txt │ ├── error-ctor-global.ck │ ├── error-ctor-global.txt │ ├── error-ctor-return.ck │ ├── error-ctor-return.txt │ ├── error-ctor-static.ck │ ├── error-ctor-static.txt │ ├── error-depend-class-array.ck │ ├── error-depend-class-array.txt │ ├── error-depend-class-extend.ck │ ├── error-depend-class-extend.txt │ ├── error-depend-class-func.ck │ ├── error-depend-class-func.txt │ ├── error-depend-class-func2.ck │ ├── error-depend-class-func2.txt │ ├── error-depend-class-var.ck │ ├── error-depend-class-var.txt │ ├── error-depend-class.ck │ ├── error-depend-class.txt │ ├── error-depend-func.ck │ ├── error-depend-func.txt │ ├── error-depend-multi.ck │ ├── error-depend-multi.txt │ ├── error-depend-mutual.ck │ ├── error-depend-mutual.txt │ ├── error-depend-nest1.ck │ ├── error-depend-nest1.txt │ ├── error-depend-nest2.ck │ ├── error-depend-nest2.txt │ ├── error-depend-nest3.ck │ ├── error-depend-nest3.txt │ ├── error-depend-new.ck │ ├── error-depend-new.txt │ ├── error-depend-spork.ck │ ├── error-depend-spork.txt │ ├── error-depend-static-func.ck │ ├── error-depend-static-func.txt │ ├── error-depend-var.ck │ ├── error-depend-var.txt │ ├── error-depend-var2.ck │ ├── error-depend-var2.txt │ ├── error-dowhile.ck │ ├── error-dowhile.txt │ ├── error-dtor-access.ck │ ├── error-dtor-access.txt │ ├── error-empty-bracket.ck │ ├── error-empty-bracket.txt │ ├── error-empty-comment.ck │ ├── error-empty-comment.txt │ ├── error-empty-extend.txt │ ├── error-empty-file.ck │ ├── error-empty-file.txt │ ├── error-empty-incomplete.txt │ ├── error-empty-new-prim.txt │ ├── error-empty-spaces.ck │ ├── error-empty-spaces.txt │ ├── error-extend.ck │ ├── error-extend.txt │ ├── error-func-ambiguous.ck │ ├── error-func-ambiguous.txt │ ├── error-incomplete.ck │ ├── error-incomplete.txt │ ├── error-multi-decl-assign1.ck │ ├── error-multi-decl-assign1.txt │ ├── error-multi-decl-assign2.ck │ ├── error-multi-decl-assign2.txt │ ├── error-new-prim.ck │ ├── error-new-prim.txt │ ├── error-no-memb1.ck │ ├── error-no-memb1.txt │ ├── error-no-memb2.ck │ ├── error-no-memb2.txt │ ├── error-no-type.ck │ ├── error-no-type.txt │ ├── error-nspc-no-crash.ck │ ├── error-nspc-no-crash.txt │ ├── error-oneline.ck │ ├── error-oneline.txt │ ├── error-op-overload-child-1.ck │ ├── error-op-overload-child-1.txt │ ├── error-op-overload-child-2.ck │ ├── error-op-overload-child-2.txt │ ├── error-op-overload-kind.ck │ ├── error-op-overload-kind.txt │ ├── error-op-overload-plus.ck │ ├── error-op-overload-plus.txt │ ├── error-op-overload-pre.ck │ ├── error-op-overload-pre.txt │ ├── error-overload-class.ck │ ├── error-overload-class.txt │ ├── error-overload-func.ck │ ├── error-overload-func.txt │ ├── error-public-class-ext-var1.ck │ ├── error-public-class-ext-var1.txt │ ├── error-public-class-ext-var2.ck │ ├── error-public-class-ext-var2.txt │ ├── error-public-class-func.ck │ ├── error-public-class-func.txt │ ├── error-return-if-no-else.ck │ ├── error-return-if-no-else.txt │ ├── error-return-missing-val.ck │ ├── error-return-missing-val.txt │ ├── error-return-multi-semi.ck │ ├── error-return-multi-semi.txt │ ├── error-return-not-all-1.ck │ ├── error-return-not-all-1.txt │ ├── error-return-not-all-2.ck │ ├── error-return-not-all-2.txt │ ├── error-return-not-all-3.ck │ ├── error-return-not-all-3.txt │ ├── error-return-not-all-4.ck │ ├── error-return-not-all-4.txt │ ├── error-return-vec3-missing.ck │ ├── error-return-vec3-missing.txt │ ├── error-return-void-class.ck │ ├── error-return-void-class.txt │ ├── error-return-void.ck │ ├── error-return-void.txt │ ├── error-runtime-cast.ck │ ├── error-runtime-cast.txt │ ├── error-spork-int.ck │ ├── error-spork-int.txt │ ├── error-static-access-member.ck │ ├── error-static-access-member.txt │ ├── error-static-init-local-f.ck │ ├── error-static-init-local-f.txt │ ├── error-static-init-local-v.ck │ ├── error-static-init-local-v.txt │ ├── error-static-init-member-f.ck │ ├── error-static-init-member-f.txt │ ├── error-static-init-member-v.ck │ ├── error-static-init-member-v.txt │ ├── error-static-var-scope-1.ck │ ├── error-static-var-scope-1.txt │ ├── error-static-var-scope-2.ck │ ├── error-static-var-scope-2.txt │ ├── error-static-var-scope-3.ck │ ├── error-static-var-scope-3.txt │ ├── error-static-var-scope-4.ck │ ├── error-static-var-scope-4.txt │ ├── error-string-func-concat-1.ck │ ├── error-string-func-concat-1.txt │ ├── error-string-func-concat-2.ck │ ├── error-string-func-concat-2.txt │ ├── error-string-func-concat-3.ck │ ├── error-string-func-concat-3.txt │ ├── error-syntax-1.ck │ ├── error-syntax-1.txt │ ├── error-tabs.ck │ ├── error-tabs.txt │ ├── error-this.ck │ ├── error-this.txt │ ├── error-ugen-array-link-1.ck │ ├── error-ugen-array-link-1.txt │ ├── error-ugen-array-link-2.ck │ ├── error-ugen-array-link-2.txt │ ├── error-unary.ck │ ├── error-unary.txt │ ├── stack-overflow.ck │ └── stack-overflow.txt ├── 07-Imports │ ├── .deps │ │ ├── 01-A.ck │ │ ├── 02-A.ck │ │ ├── 02-B.ck │ │ ├── 03-A.ck │ │ ├── 03-B.ck │ │ ├── 04-A.ck │ │ ├── 04-B.ck │ │ ├── 04-C.ck │ │ ├── 05-A.ck │ │ ├── 05-B.ck │ │ ├── 05-C.ck │ │ └── Foo.ck │ ├── 01.ck │ ├── 02.ck │ ├── 03.ck │ ├── 03.txt │ ├── 04.ck │ ├── 04.txt │ ├── 05.ck │ ├── 06-error-no-such.ck │ ├── 06-error-no-such.txt │ ├── 07-error-self-import.ck │ ├── 07-error-self-import.txt │ ├── 08-operator.ck │ ├── 09-error-opeartor.ck │ └── 09-error-opeartor.txt ├── README ├── makefile └── test.py ├── visual-studio ├── chuck-vs10.sln ├── chuck-vs10.vcxproj ├── chuck.dsp ├── chuck.dsw ├── chuck.sln ├── chuck.vcxproj └── chuck.vcxproj.filters └── xcode └── chuck.xcodeproj └── project.pbxproj /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/.gitmodules -------------------------------------------------------------------------------- /examples/analysis/ifft.ck: -------------------------------------------------------------------------------- 1 | // our patch 2 | SinOsc g => FFT fft =^ IFFT ifft => dac; 3 | 4 | // set parameters 5 | 1024 => fft.size; 6 | 440 => g.freq; 7 | 8 | // control loop 9 | while( true ) 10 | { 11 | // take fft then ifft 12 | ifft.upchuck(); 13 | 14 | // advance time 15 | fft.size()::samp => now; 16 | } 17 | -------------------------------------------------------------------------------- /examples/array/array_append.ck: -------------------------------------------------------------------------------- 1 | // create zero-length array 2 | int a[0]; 3 | 4 | // print size 5 | <<< "size (before append):", a.size() >>>; 6 | 7 | // append 8 | a << 1 << 2 << 3 << 5 << 8; 9 | 10 | // print size 11 | <<< "size (after append):", a.size() >>>; 12 | 13 | // print contents 14 | for( int i; i < a.size(); i++ ) 15 | { 16 | <<< i, ":", a[i] >>>; 17 | } 18 | -------------------------------------------------------------------------------- /examples/array/array_assign.ck: -------------------------------------------------------------------------------- 1 | // partial array (17.ck) 2 | 3 | // declare int array 2x2 4 | int x[2][2]; 5 | 6 | // assign 7 | 2 => x[1][1]; 8 | 9 | // assign partial array reference to 'y' 10 | x[1] @=> int y[]; 11 | 12 | // test 13 | if( y[1] == 2 ) <<<"success">>>; 14 | -------------------------------------------------------------------------------- /examples/array/array_mmixed.ck: -------------------------------------------------------------------------------- 1 | // based on Robin Haberkorn's example 2 | int a[0][2]; 3 | 4 | // instantiate arrays 5 | new int[2] @=> a["foo"]; 6 | new int[2] @=> a["bar"]; 7 | 8 | // fill them 9 | 23 => a["foo"][0]; 10 | 24 => a["foo"][1]; 11 | 32 => a["bar"][0]; 12 | 42 => a["bar"][1]; 13 | 14 | // test them 15 | if( a["foo"][0] == 23 && a["bar"][1] == 42 ) 16 | <<< "success" >>>; 17 | 18 | -------------------------------------------------------------------------------- /examples/array/array_negative.ck: -------------------------------------------------------------------------------- 1 | // arrays can have negative indices! 2 | // version: need chuck-1.5.0.0 or higher 3 | 4 | // an array 5 | [1,2,3,4] @=> int a[]; 6 | 7 | // same as a(s.size(()-1) 8 | <<< a[-1] >>>; // 4 9 | 10 | // same as a(s.size(()-3) 11 | <<< a[-3] >>>; // 2 12 | -------------------------------------------------------------------------------- /examples/array/array_storage.ck: -------------------------------------------------------------------------------- 1 | // multi-dimensional array 2 | int a[2][2][2]; 3 | // assignment 4 | 4 => a[0][0][1]; 5 | // access 6 | a[0][0][1] => int b; 7 | 8 | // test 9 | if ( b == 4 ) <<<"success">>>; 10 | -------------------------------------------------------------------------------- /examples/array/array_sub_assign.ck: -------------------------------------------------------------------------------- 1 | // multi-dimensional array 2 | // array to array assignment 3 | 4 | int a[2][2][2]; 5 | int b[2][2]; 6 | // assignment 7 | 1 => b[0][1]; 8 | 2 => b[0][0]; 9 | 10 | // assign b to 0th element of a 11 | b @=> a[0]; 12 | 13 | // verify 14 | if ( a[0][0][1] == 1 ) <<<"success">>>; 15 | -------------------------------------------------------------------------------- /examples/basic/adc.ck: -------------------------------------------------------------------------------- 1 | // mic-in to audio out 2 | 3 | // the patch 4 | adc => Gain g => dac; 5 | 6 | // infinite time-loop 7 | while( true ) 8 | { 9 | // advance time 10 | 100::ms => now; 11 | } 12 | -------------------------------------------------------------------------------- /examples/basic/args.ck: -------------------------------------------------------------------------------- 1 | // shows getting command line arguments 2 | // (example run: chuck args:1:2:foo) 3 | 4 | // print number of args 5 | <<< "number of arguments:", me.args() >>>; 6 | 7 | // print each 8 | for( int i; i < me.args(); i++ ) 9 | { 10 | <<< " ", me.arg(i) >>>; 11 | } 12 | -------------------------------------------------------------------------------- /examples/basic/bar.ck: -------------------------------------------------------------------------------- 1 | // point of attack for random otf demo 2 | 3 | SinOsc s => dac; 4 | .2 => s.gain; 5 | 6 | // an array: add stuff 7 | [ 0 ] @=> int hi[]; 8 | 9 | while( true ) 10 | { 11 | // change parameters here 12 | Std.mtof( 45 + Math.random2(0,0) * 12 + 13 | hi[Math.random2(0,hi.size()-1)] ) => s.freq; 14 | 15 | // different rate 16 | 200::ms => now; 17 | } 18 | -------------------------------------------------------------------------------- /examples/basic/delay.ck: -------------------------------------------------------------------------------- 1 | // patch 2 | adc => DelayL delay => dac; 3 | 4 | // set delay parameters 5 | .75::second => delay.max => delay.delay; 6 | 7 | // infinite time loop 8 | while( true ) 1::second => now; 9 | 10 | -------------------------------------------------------------------------------- /examples/basic/demo0.ck: -------------------------------------------------------------------------------- 1 | // demo0.ck 2 | // basic demo showing time and duration 3 | 4 | 5::second + now => time later; 5 | 6 | while( now < later ) 7 | { 8 | <<>>; 9 | 1::second => now; 10 | } 11 | 12 | <<>>; 13 | -------------------------------------------------------------------------------- /examples/basic/demo1.ck: -------------------------------------------------------------------------------- 1 | // demo1.ck 2 | // candidate for most trivial demo 3 | 4 | 0 => int a => int t; 5 | 1 => int b; 6 | 15 => int c; 7 | 8 | while( c > 0 ) 9 | { 10 | a + b => t; 11 | b => a; 12 | << b>>>; 13 | c - 1 => c; 14 | } 15 | -------------------------------------------------------------------------------- /examples/basic/echo.ck: -------------------------------------------------------------------------------- 1 | // feedforward 2 | adc => Gain g => dac; 3 | // feedback 4 | g => Gain feedback => DelayL delay => g; 5 | 6 | // set delay parameters 7 | .75::second => delay.max => delay.delay; 8 | // set feedback 9 | .5 => feedback.gain; 10 | // set effects mix 11 | .75 => delay.gain; 12 | 13 | // infinite time loop 14 | while( true ) 1::second => now; 15 | 16 | -------------------------------------------------------------------------------- /examples/basic/foo.ck: -------------------------------------------------------------------------------- 1 | // hello everyone. 2 | // a chuck is born... 3 | // its first words: 4 | 5 | SinOsc s => JCRev r => dac; 6 | .2 => s.gain; 7 | .1 => r.mix; 8 | 9 | // an array 10 | [ 0, 2, 4, 7, 9, 11 ] @=> int hi[]; 11 | 12 | while( true ) 13 | { 14 | Std.mtof( 45 + Math.random2(0,3) * 12 + 15 | hi[Math.random2(0,hi.size()-1)] ) => s.freq; 16 | 100::ms => now; 17 | } 18 | -------------------------------------------------------------------------------- /examples/basic/lfo.ck: -------------------------------------------------------------------------------- 1 | // low-frequency oscillator 2 | 3 | // sine wave to blackhole (like dac but no sound) 4 | SinOsc lfo => blackhole; 5 | // set period (an alternative to .freq) 6 | 1::second => lfo.period; 7 | 8 | // infinite time loop 9 | while( true ) 10 | { 11 | // print out last value 12 | <<< lfo.last(), "" >>>; 13 | // advance time 14 | 50::ms => now; 15 | } 16 | -------------------------------------------------------------------------------- /examples/basic/step.ck: -------------------------------------------------------------------------------- 1 | // step gen to dac 2 | Step s => dac; 3 | .5 => float v; 4 | 5 | // infinite time-loop 6 | while( 1 ) 7 | { 8 | // advance time 9 | 1::ms => now; 10 | // set value 11 | v => s.next; 12 | -v => v; 13 | } 14 | -------------------------------------------------------------------------------- /examples/basic/tick.ck: -------------------------------------------------------------------------------- 1 | // tick tock 2 | 3 | // infinite time loop 4 | while( true ) 5 | { 6 | // print now in seconds 7 | <<< "tick:", (now / second), "seconds" >>>; 8 | 1::second => now; 9 | } 10 | -------------------------------------------------------------------------------- /examples/basic/tick2.ck: -------------------------------------------------------------------------------- 1 | // tick tock 2 | 3 | // wait until the start of the next second 4 | second - (now % second) => now; 5 | 6 | // infinite time loop 7 | while( true ) 8 | { 9 | // print now in seconds 10 | <<< "tick:", (now / second) $ int, "seconds" >>>; 11 | 1::second => now; 12 | } 13 | -------------------------------------------------------------------------------- /examples/basic/whirl.ck: -------------------------------------------------------------------------------- 1 | // sine to dac 2 | SinOsc s => dac; 3 | // let's turn down gain, for this can be loud and annoying 4 | .15 => s.gain; 5 | 6 | // infinite time loop 7 | 0.0 => float t; 8 | while( true ) 9 | { 10 | // modulate 11 | 30 + ( Math.sin(t) + 1.0 ) * 10000.0 => s.sfreq; 12 | t + .004 => t; 13 | 14 | // advance time 15 | 1::ms => now; 16 | } 17 | -------------------------------------------------------------------------------- /examples/basic/zerox.ck: -------------------------------------------------------------------------------- 1 | // step generator, zero crossing detector, dac 2 | Step s => ZeroX z => dac; 3 | 1.0 => float v; 4 | 5 | // infinite time-loop 6 | while( true ) 7 | { 8 | // set the step value 9 | v => s.next; 10 | // change step value 11 | -v => v; 12 | // advance time 13 | 100::ms => now; 14 | } 15 | -------------------------------------------------------------------------------- /examples/book/digital-artists/audio/clap_01.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/audio/clap_01.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/audio/click_01.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/audio/click_01.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/audio/click_02.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/audio/click_02.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/audio/cowbell_01.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/audio/cowbell_01.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/audio/hihat_01.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/audio/hihat_01.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/audio/hihat_02.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/audio/hihat_02.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/audio/hihat_04.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/audio/hihat_04.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/audio/kick_01.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/audio/kick_01.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/audio/kick_04.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/audio/kick_04.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/audio/snare_01.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/audio/snare_01.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/audio/snare_02.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/audio/snare_02.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/audio/snare_03.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/audio/snare_03.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/audio/stereo_fx_01.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/audio/stereo_fx_01.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/audio/stereo_fx_03.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/audio/stereo_fx_03.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter1/Listing1.1.ck: -------------------------------------------------------------------------------- 1 | // Listing 1.1 Hello Sine! 2 | 3 | SinOsc s => dac; // (1) Connects (ChucKs) a sine wav oscillator to the dac (sound out) 4 | 0.6 => s.gain; // (2) Sets oscillator gain to 0.6 5 | 220 => s.freq; // (3) Sets oscillator frequency to 220 6 | second => now; // (4) Lets it play for one second 7 | -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter1/Listing1.4.ck: -------------------------------------------------------------------------------- 1 | // Listing 1.4 Defining and using an integer variable 2 | 3 | // declare an integer 4 | int myPitch; 5 | 6 | // store a value in it 7 | 220 => myPitch; 8 | 9 | // print it out 10 | <<< myPitch >>>; 11 | -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter1/Listing1.5.ck: -------------------------------------------------------------------------------- 1 | // Listing 1.5 Initializing an integer as it's declared 2 | 3 | // another way to initialize integers 4 | 5 | // store 220 in newly declared myPitch, all at once 6 | 220 => int myPitch; 7 | 8 | <<< myPitch >>>; 9 | -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter1/Listing1.7.ck: -------------------------------------------------------------------------------- 1 | // longhand math with integers 2 | int myPitch; 3 | 220 => myPitch; 4 | 5 | // multiply by 2 6 | 2 * myPitch => myPitch; 7 | 8 | // subtraction 9 | myPitch - 110 => myPitch; 10 | <<< myPitch >>>; 11 | 12 | -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter1/Listing1.7Shorthand.ck: -------------------------------------------------------------------------------- 1 | // shorthand math with integers 2 | 220 => int myPitch; 3 | 4 | // multiply by 2, in-place 5 | 2 *=> myPitch; // "times ChucK" 6 | 7 | // in-place subtraction 8 | 110 -=> myPitch; // "minus ChucK" 9 | 10 | <<< myPitch >>>; 11 | -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter2/Listing2.2.ck: -------------------------------------------------------------------------------- 1 | // Listing 2.2 Random integer generation using the Math library 2 | 3 | // random integer number generation 4 | // simulates the roll of a die 5 | 6 | while (true) 7 | { 8 | <<< "Dice Roll =", Math.random2(1,6) >>>; 9 | second / 2 => now; 10 | } 11 | 12 | -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter3/Listing3.2.ck: -------------------------------------------------------------------------------- 1 | // Listing 3.2 Declare and initialize an array all at once 2 | 3 | [57, 57, 64, 64, 66, 66, 64] @=> int a[]; 4 | 5 | <<< a[0], a[1], a[2], a[3], a[4], a[5], a[6] >>>; 6 | 7 | -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter4/audio/clap_01.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/chapter4/audio/clap_01.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter4/audio/click_01.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/chapter4/audio/click_01.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter4/audio/click_02.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/chapter4/audio/click_02.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter4/audio/cowbell_01.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/chapter4/audio/cowbell_01.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter4/audio/hihat_01.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/chapter4/audio/hihat_01.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter4/audio/hihat_04.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/chapter4/audio/hihat_04.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter4/audio/kick_01.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/chapter4/audio/kick_01.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter4/audio/snare_01.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/chapter4/audio/snare_01.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter4/audio/snare_02.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/chapter4/audio/snare_02.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter4/audio/snare_03.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/chapter4/audio/snare_03.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter4/audio/stereo_fx_01.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/chapter4/audio/stereo_fx_01.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter4/audio/stereo_fx_03.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/chapter4/audio/stereo_fx_03.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter5/audio/kick_01.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/chapter5/audio/kick_01.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter5/audio/snare_03.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/chapter5/audio/snare_03.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter5/audio/stereo_fx_01.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/chapter5/audio/stereo_fx_01.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter6/Listing6.11.ck: -------------------------------------------------------------------------------- 1 | // Listing 6.11 Testing the LPF resonant low pass filter with noise input 2 | 3 | // pass noise through low pass filter 4 | Noise nz => LPF lp => dac; 5 | 6 | // set frequency and Q 7 | 500.0 => lp.freq; 8 | 100.0 => lp.Q; 9 | 0.2 => lp.gain; 10 | second => now; 11 | -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter7/Listing7.12.ck: -------------------------------------------------------------------------------- 1 | // Listing 7.12 Testing all the presets for the Shakers UG 2 | 3 | // Fun with particles, the Shakers instrument 4 | Shakers shak => dac; 5 | 6 | // Run through all the presets in order 7 | for (0 => int i; i < 23; i++) { 8 | i => shak.preset; 9 | 1 => shak.noteOn; 10 | 1.0 :: second => now; 11 | } 12 | -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter8/Listing8.10.ck: -------------------------------------------------------------------------------- 1 | // Listing 8.10 Jazz band: 2 | // save as "initialize.ck" 3 | // Important things will go here soon, 4 | // like Classes, which we learn about in the next chapter 5 | // for now, we just add our score.ck 6 | 7 | me.dir() + "/score.ck" => string scorePath; 8 | 9 | Machine.add(scorePath); // (1) Adds score file for jazz band 10 | -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter8/audio/hihat_01.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/chapter8/audio/hihat_01.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter8/audio/kick_01.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/chapter8/audio/kick_01.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter8/initialize.ck: -------------------------------------------------------------------------------- 1 | // Listing 8.10 Jazz band: 2 | // save as "initialize.ck" 3 | // Important things will go here soon, 4 | // like Classes, which we learn about in the next chapter 5 | // for now, we just add our score.ck 6 | 7 | me.dir() + "/score.ck" => string scorePath; 8 | 9 | Machine.add(scorePath); // (1) Adds score file for jazz band 10 | -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter9/DrumMachine/audio/clap_01.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/chapter9/DrumMachine/audio/clap_01.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter9/DrumMachine/audio/cowbell_01.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/chapter9/DrumMachine/audio/cowbell_01.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter9/DrumMachine/audio/hihat_02.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/chapter9/DrumMachine/audio/hihat_02.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter9/DrumMachine/audio/kick_04.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/chapter9/DrumMachine/audio/kick_04.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter9/DrumMachine/audio/snare_01.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/book/digital-artists/chapter9/DrumMachine/audio/snare_01.wav -------------------------------------------------------------------------------- /examples/book/digital-artists/chapter9/UseBPM2.ck: -------------------------------------------------------------------------------- 1 | // Listing 9.7 Make another BPM, but static variables are shared 2 | 3 | // Lives in another file, UseBPM2.ck 4 | SinOsc s => dac.right; 5 | BPM t2; // Define another BPM named t2 6 | 0.3 => s.gain; 7 | 800 => int freq; 8 | 9 | while (freq > 400) 10 | { 11 | freq => s.freq; 12 | t2.quarterNote => now; 13 | 50 -=> freq; 14 | } 15 | -------------------------------------------------------------------------------- /examples/class/destructor.ck: -------------------------------------------------------------------------------- 1 | // example of class destructor 2 | 3 | // a class 4 | class Foo 5 | { 6 | // class destructor 7 | fun @destruct() 8 | { 9 | <<< "destructor called...", "" >>>; 10 | } 11 | } 12 | 13 | Foo foo; 14 | // when `foo` goes out of scope, the destructor should be called... 15 | -------------------------------------------------------------------------------- /examples/ctrl/ctrl_break.ck: -------------------------------------------------------------------------------- 1 | // break; 2 | 3 | 0 => int j; 4 | 5 | // loop 6 | while ( true ) 7 | { 8 | if ( j >= 5 ) 9 | break; 10 | 11 | 1 +=> j; 12 | } 13 | 14 | // test 15 | if ( j == 5 ) <<<"success">>>; 16 | -------------------------------------------------------------------------------- /examples/ctrl/ctrl_do_until.ck: -------------------------------------------------------------------------------- 1 | // do-until 2 | 3 | 0 => int j; 4 | 0 => int i; 5 | 6 | do { 7 | 1 +=> j; 8 | 1 +=> i; 9 | } until ( i >= 5 ); 10 | 11 | // test 12 | if ( j == 5 ) <<<"success">>>; 13 | -------------------------------------------------------------------------------- /examples/ctrl/ctrl_do_while.ck: -------------------------------------------------------------------------------- 1 | // do-while 2 | 3 | 0 => int j; 4 | 0 => int i; 5 | 6 | do { 7 | 1 +=> j; 8 | 1 +=> i; 9 | } while( i < 5 ); 10 | 11 | // test 12 | if( j == 5 ) <<<"success">>>; 13 | -------------------------------------------------------------------------------- /examples/ctrl/ctrl_until.ck: -------------------------------------------------------------------------------- 1 | // until loop (opposite of while loop) 2 | 3 | 0 => int j; 4 | 0 => int i; 5 | 6 | // loop 7 | until ( i == 5 ) 8 | { 9 | 1 +=> j; 10 | 1 +=> i; 11 | } 12 | 13 | // test 14 | if ( j == 5 ) <<<"success">>>; 15 | -------------------------------------------------------------------------------- /examples/ctrl/ctrl_while.ck: -------------------------------------------------------------------------------- 1 | // while loop (opposite of until loop) 2 | 3 | 0 => int j; 4 | 0 => int i; 5 | 6 | // loop 7 | while( i < 5 ) 8 | { 9 | 1 +=> j; 10 | 1 +=> i; 11 | } 12 | 13 | // test 14 | if ( j == 5 ) <<<"success">>>; 15 | -------------------------------------------------------------------------------- /examples/data/hihat-open.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/data/hihat-open.wav -------------------------------------------------------------------------------- /examples/data/hihat.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/data/hihat.wav -------------------------------------------------------------------------------- /examples/data/kick.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/data/kick.wav -------------------------------------------------------------------------------- /examples/data/snare-chili.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/data/snare-chili.wav -------------------------------------------------------------------------------- /examples/data/snare-hop.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/data/snare-hop.wav -------------------------------------------------------------------------------- /examples/data/snare.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/data/snare.wav -------------------------------------------------------------------------------- /examples/effects/ABSaturator.ck: -------------------------------------------------------------------------------- 1 | 2 | adc => Delay d => ABSaturator sat => dac; 3 | 4 | 20 => sat.drive; 5 | 4 => sat.dcOffset; 6 | 7 | while(true) 8 | { 9 | 1::second => now; 10 | } 11 | -------------------------------------------------------------------------------- /examples/effects/Bitcrusher.ck: -------------------------------------------------------------------------------- 1 | 2 | adc => Delay d => Bitcrusher bc => dac; 3 | 4 | 0.5::second => d.max => d.delay; 5 | 6 | 0.5 => bc.gain; 7 | 5 => bc.bits; 8 | 12 => bc.downsampleFactor; 9 | 10 | <<< "bits:", bc.bits(), "downsampling:", bc.downsampleFactor() >>>; 11 | 12 | while(true) 13 | { 14 | 1::second => now; 15 | } 16 | -------------------------------------------------------------------------------- /examples/effects/FoldbackSaturator-index.ck: -------------------------------------------------------------------------------- 1 | SinOsc s => FoldbackSaturator foldy => dac; 2 | 3 | 0.3 => foldy.threshold; 4 | 5 | 0.001 => float delta; 6 | 7 | while(1::ms => now) 8 | { 9 | if((foldy.index() < 1.0) || (foldy.index() > 4.0)) 10 | { 11 | -1.0 *=> delta; 12 | } 13 | foldy.index(foldy.index() - delta); 14 | } 15 | -------------------------------------------------------------------------------- /examples/effects/FoldbackSaturator-threshold.ck: -------------------------------------------------------------------------------- 1 | SinOsc s => FoldbackSaturator foldy => dac; 2 | 3 | 0.001 => float delta; 4 | 5 | while(10::ms => now) 6 | { 7 | if((foldy.threshold() < 0.03) || (foldy.threshold() > 0.8)) 8 | { 9 | -1.0 *=> delta; 10 | } 11 | foldy.threshold(foldy.threshold() - delta); 12 | } 13 | -------------------------------------------------------------------------------- /examples/effects/data/obama.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/effects/data/obama.wav -------------------------------------------------------------------------------- /examples/event/ALSO-SEE: -------------------------------------------------------------------------------- 1 | See Events in action in other contexts: 2 | 3 | HID input: 4 | ../hid/joy.ck 5 | 6 | MIDI input: 7 | ../midi/gomidi.ck 8 | ../midi/polyfony.ck 9 | ../midi/polyfony2.ck 10 | 11 | Open Sound Control: 12 | ../osc/s.ck (Open Sound Control sender) 13 | ../osc/r.ck (Open Sound Control receiver) 14 | -------------------------------------------------------------------------------- /examples/filter/bpf.ck: -------------------------------------------------------------------------------- 1 | // BPF is a band-pass filter 2 | Noise n => BPF f => dac; 3 | 4 | // set filter Q 5 | 1 => f.Q; 6 | 7 | // infinite time-loop 8 | while( true ) 9 | { 10 | // sweep the cutoff 11 | 100 + Math.fabs(Math.sin(now/second)) * 5000 => f.freq; 12 | // advance time 13 | 5::ms => now; 14 | } 15 | -------------------------------------------------------------------------------- /examples/filter/hpf.ck: -------------------------------------------------------------------------------- 1 | // HPF is a high-pass filter 2 | Noise n => HPF f => dac; 3 | 4 | // set gain 5 | .5 => f.gain; 6 | 7 | // infinite time-loop 8 | while( true ) 9 | { 10 | // sweep the cutoff 11 | Math.sin(now/second) * 110 => Math.fabs => Std.mtof => f.freq; 12 | // advance time 13 | 5::ms => now; 14 | } 15 | -------------------------------------------------------------------------------- /examples/filter/lpf.ck: -------------------------------------------------------------------------------- 1 | // LPF is a low-pass filter 2 | Noise n => LPF lpf => dac; 3 | 4 | // infinite time-loop 5 | while( true ) 6 | { 7 | // sweep the cutoff 8 | Math.sin(now/second) * 110 => Math.fabs => Std.mtof => lpf.freq; 9 | // advance time 10 | 5::ms => now; 11 | } 12 | -------------------------------------------------------------------------------- /examples/filter/rlpf.ck: -------------------------------------------------------------------------------- 1 | // our patch 2 | SqrOsc so => LPF f => dac; 3 | 4 | // set osc frequency 5 | 50 => so.freq; 6 | // set Q 7 | 10 => f.Q; 8 | // set gain 9 | .5 => f.gain; 10 | 11 | // infinite time-loop 12 | while( true ) 13 | { 14 | // sweep the cutoff 15 | 100 + Math.fabs(Math.sin(now/second)) * 5000 => f.freq; 16 | // advance time 17 | 5::ms => now; 18 | } 19 | -------------------------------------------------------------------------------- /examples/func/func_overload.ck: -------------------------------------------------------------------------------- 1 | // 35.ck : overloading functions 2 | 3 | 4 | fun void foo( int a, int b ) 5 | { <<<"success">>>; } 6 | 7 | fun void foo( int a ) 8 | { foo( a, a ); } 9 | 10 | // call 11 | foo( 2 ); 12 | -------------------------------------------------------------------------------- /examples/func/func_recursion.ck: -------------------------------------------------------------------------------- 1 | // recursive function 2 | 3 | fun int factorial( int x ) 4 | { 5 | if ( x <= 1 ) return 1; 6 | else return x * factorial ( x-1 ); 7 | } 8 | 9 | // call 10 | factorial ( 5 ) => int answer; 11 | 12 | // test 13 | if ( answer == 120 ) <<<"success">>>; 14 | 15 | -------------------------------------------------------------------------------- /examples/func/func_void.ck: -------------------------------------------------------------------------------- 1 | // chucking () 2 | 3 | fun void foo() { <<< "hi!" >>>; } 4 | 5 | // call foo 6 | foo(); 7 | 8 | // call foo 9 | () => foo; 10 | -------------------------------------------------------------------------------- /examples/import/import-test-1.ck: -------------------------------------------------------------------------------- 1 | // import 2 | @import "Foo.ck" 3 | 4 | // instantiate class defined in imported file 5 | Foo a(1), b(2); 6 | 7 | // use operator overload defined in imported file 8 | <<< (a + b).num >>>; -------------------------------------------------------------------------------- /examples/import/import-test-1e.ck: -------------------------------------------------------------------------------- 1 | // import statements in code evaluated by Machine.eval inherits 2 | // the host file/code's path (otherwise it defaults to the working 3 | // directory of the chuck host system) 4 | Machine.eval(" 5 | @import \"Foo.ck\" 6 | Foo a(1), b(2); 7 | <<< (a + b).num >>>; 8 | "); 9 | -------------------------------------------------------------------------------- /examples/io/read-byte.txt: -------------------------------------------------------------------------------- 1 | abcde 2 | 12345 3 | -------------------------------------------------------------------------------- /examples/io/read-float.txt: -------------------------------------------------------------------------------- 1 | .1 2.2 3. 2 | 8e-3 9e5 -2.2 3 | -4e-4 4 | 5 | -------------------------------------------------------------------------------- /examples/io/read-int.txt: -------------------------------------------------------------------------------- 1 | 1 2 3 2 | 8 9 -2 3 | -4 4 | -------------------------------------------------------------------------------- /examples/io/read-line.txt: -------------------------------------------------------------------------------- 1 | 1 2 3 2 | a b c 3 | -------------------------------------------------------------------------------- /examples/io/read-str.txt: -------------------------------------------------------------------------------- 1 | foo bar 2 | rakakakakaka 3 | 1 2 three 4 | -------------------------------------------------------------------------------- /examples/io/saigon44.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/io/saigon44.wav -------------------------------------------------------------------------------- /examples/machine/crash.ck: -------------------------------------------------------------------------------- 1 | // ummm this expicitly and deliberately crashes ChucK; use with caution 2 | Machine.crash(); 3 | 4 | // if ChucK didn't crash, then something is *really* wrong 5 | -------------------------------------------------------------------------------- /examples/machine/intsize.ck: -------------------------------------------------------------------------------- 1 | // get the size (in bits) of a chuck int 2 | cherr <= "size of chuck int: " <= Machine.intsize() <= "-bit" <= IO.newline(); 3 | -------------------------------------------------------------------------------- /examples/machine/is-realtime.ck: -------------------------------------------------------------------------------- 1 | <<< "are we running in realtime audio mode?", 2 | Machine.realtime() ? "YES" : "NO " >>>; 3 | 4 | <<< "are we running in silent mode (e.g., --silent)?", 5 | Machine.silent() ? "YES" : "NO " >>>; 6 | 7 | -------------------------------------------------------------------------------- /examples/machine/test1.ck: -------------------------------------------------------------------------------- 1 | // added by machine-help.ck 2 | 3 | // print 4 | <<< "*** hello! I'm TEST 1 ***", "" >>>; 5 | 6 | // print arguments 7 | for( int i; i < me.args(); i++ ) 8 | { 9 | <<< "--- got argument ->", me.arg(i) >>>; 10 | } 11 | 12 | // wait 13 | while( true ) 14 | { 15 | 1::second => now; 16 | } -------------------------------------------------------------------------------- /examples/machine/test2.ck: -------------------------------------------------------------------------------- 1 | // added by machine-help.ck 2 | 3 | // print 4 | <<< "*** hello! I'm TEST 2 ***", "" >>>; 5 | 6 | // print arguments 7 | for( int i; i < me.args(); i++ ) 8 | { 9 | <<< "--- got argument ->", me.arg(i) >>>; 10 | } 11 | 12 | // wait 13 | while( true ) 14 | { 15 | 1::second => now; 16 | } -------------------------------------------------------------------------------- /examples/machine/version.ck: -------------------------------------------------------------------------------- 1 | // ever wonder which chuck language version you are currently using? 2 | cherr <= "chuck version: " <= Machine.version() <= IO.nl(); 3 | -------------------------------------------------------------------------------- /examples/math/math-help.ck: -------------------------------------------------------------------------------- 1 | // name: help-math.ck 2 | // desc: there are many functions in the Math class library 3 | // run this file to print the current Math API 4 | 5 | // print 6 | Math.help(); -------------------------------------------------------------------------------- /examples/math/maybe.ck: -------------------------------------------------------------------------------- 1 | // name: maybe.ck 2 | // desc: can't decide? flip a coin with `maybe`! 3 | // NOTE: `maybe` evaluates to true with 50% probility 4 | // 5 | // author: Ge Wang 6 | // date: 2023, in an age of uncertainty 7 | 8 | // what to eat? feel free to re-run this program 9 | if( maybe ) <<< "get Chinese!", "" >>>; 10 | else <<< " order Mexican!", "" >>>; 11 | -------------------------------------------------------------------------------- /examples/midi/bwv772.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/midi/bwv772.mid -------------------------------------------------------------------------------- /examples/oper/oper_logic.ck: -------------------------------------------------------------------------------- 1 | // chuck logical operators 2 | 3 | <<<"AND">>>; 4 | <<>>; 5 | <<>>; 6 | 7 | <<<"OR">>>; 8 | <<>>; 9 | <<>>; 10 | 11 | <<<"==">>>; 12 | <<< 2 + 2 == 4>>>; 13 | <<< 2 + 2 == 5>>>; 14 | 15 | <<<"!=">>>; 16 | <<< 2 + 2 != 5>>>; 17 | <<< 2 + 2 != 4>>>; 18 | -------------------------------------------------------------------------------- /examples/oper/oper_post_inc.ck: -------------------------------------------------------------------------------- 1 | // post increment operator 2 | 3 | // starting value 4 | 4 => int i; 5 | // assign, then increment i 6 | i++ => int j; 7 | 8 | // print (i should be 1 higher than j) 9 | <<< i >>>; 10 | <<< j >>>; 11 | -------------------------------------------------------------------------------- /examples/oper/oper_pre_inc.ck: -------------------------------------------------------------------------------- 1 | // ++i 2 | 3 | 4 => int i; 4 | ++i => int j; 5 | 6 | <<<"printing i, j">>>; 7 | <<>>; 8 | <<>>; 9 | if ( i == 5 && j == 5 ) <<<"success">>>; 10 | -------------------------------------------------------------------------------- /examples/serial/arduino/ckserial.ino: -------------------------------------------------------------------------------- 1 | char bytes[1024]; 2 | 3 | void setup() 4 | { 5 | // start serial port at 9600 bps and wait for port to open: 6 | Serial.begin(9600); 7 | } 8 | 9 | void loop() 10 | { 11 | int nRead = Serial.readBytesUntil('\n', bytes, 1024); 12 | if(nRead > 0) 13 | Serial.println("bar"); 14 | } 15 | -------------------------------------------------------------------------------- /examples/serial/list.ck: -------------------------------------------------------------------------------- 1 | // serial IO list 2 | SerialIO.list() @=> string list[]; 3 | // print list 4 | for( int i; i < list.size(); i++ ) 5 | { 6 | chout <= i <= ": " <= list[i] <= IO.newline(); 7 | } 8 | -------------------------------------------------------------------------------- /examples/shred/dir.ck: -------------------------------------------------------------------------------- 1 | // me is currnt shred; print directory of current file (if saved) 2 | <<< me.dir() >>>; 3 | // same as above 4 | <<< me.dir( 0 ) >>>; 5 | // one level up 6 | <<< me.dir( 1 ) >>>; 7 | // can also use negative values (same as positive) 8 | <<< me.dir( -2 ) >>>; 9 | // something absurd (should return top level path) 10 | <<< me.dir( 100 ) >>>; 11 | -------------------------------------------------------------------------------- /examples/spatial/Pan4.ck: -------------------------------------------------------------------------------- 1 | 2 | CNoise noise => Pan4 pan => dac; 3 | 4 | "pink" => noise.mode; 5 | 0.1 => noise.gain; 6 | 7 | while(true) 8 | { 9 | pan.pan() + 0.01 => pan.pan; 10 | 10::ms => now; 11 | } 12 | -------------------------------------------------------------------------------- /examples/spatial/Pan8.ck: -------------------------------------------------------------------------------- 1 | 2 | CNoise noise => Pan8 pan => dac; 3 | 4 | "pink" => noise.mode; 5 | 0.1 => noise.gain; 6 | 0 => pan.pan; 7 | 8 | while(true) 9 | { 10 | pan.pan() + 0.01 => pan.pan; 11 | 10::ms => now; 12 | } 13 | -------------------------------------------------------------------------------- /examples/special/geetar.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/special/geetar.wav -------------------------------------------------------------------------------- /examples/special/scream-o-matic/data/scream-1.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/special/scream-o-matic/data/scream-1.wav -------------------------------------------------------------------------------- /examples/special/scream-o-matic/data/scream-2.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/special/scream-o-matic/data/scream-2.wav -------------------------------------------------------------------------------- /examples/special/scream-o-matic/data/scream-3.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/special/scream-o-matic/data/scream-3.wav -------------------------------------------------------------------------------- /examples/special/scream-o-matic/data/scream-4.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/special/scream-o-matic/data/scream-4.wav -------------------------------------------------------------------------------- /examples/special/scream-o-matic/data/scream-5.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/special/scream-o-matic/data/scream-5.wav -------------------------------------------------------------------------------- /examples/special/scream-o-matic/data/scream-6-lion.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/special/scream-o-matic/data/scream-6-lion.wav -------------------------------------------------------------------------------- /examples/special/twilight/twilight-granular.aiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/examples/special/twilight/twilight-granular.aiff -------------------------------------------------------------------------------- /examples/status.ck: -------------------------------------------------------------------------------- 1 | // useful little shred for on-the-fly programming... 2 | 3 | // infinite time loop 4 | while( true ) 5 | { 6 | // print out machine status (same as chuck ^) 7 | Machine.status(); 8 | // every so often 9 | 3::second => now; 10 | } 11 | -------------------------------------------------------------------------------- /examples/string/tostr.ck: -------------------------------------------------------------------------------- 1 | // instantiate object 2 | Event e; 3 | Object o; 4 | 5 | // call 6 | <<< e.toString() + " --- " + o.toString() >>>; 7 | -------------------------------------------------------------------------------- /examples/time/time_types.ck: -------------------------------------------------------------------------------- 1 | // 05.ck : time, now, duration 2 | 3 | // time + duration 4 | now + 5::second => time later; 5 | 6 | // time loop 7 | while( now < later ) 8 | { 9 | // print out the time 10 | <<>>; 11 | // advance time 12 | 1::second => now; 13 | } 14 | 15 | <<<"success">>>; 16 | -------------------------------------------------------------------------------- /examples/type/type_object.ck: -------------------------------------------------------------------------------- 1 | // in contrast to primitive types, we have Objects 2 | // <<< >>> will display a reference address when printed 3 | 4 | // instantiate a base Object 5 | Object obj; 6 | // print 7 | <<>>; 8 | -------------------------------------------------------------------------------- /examples/vector/vecs-cast.ck: -------------------------------------------------------------------------------- 1 | // casting between vec2, vec3, vec4 2 | 3 | // vec2 to vec3 4 | @(1,2) $ vec4 => vec4 v4; <<< v4 >>>; 5 | // vec2 to vec4 6 | @(1,2) $ vec4 => v4; <<< v4 >>>; 7 | // vec3 to vec4 8 | @(1,2,3) $ vec4 => v4; <<< v4 >>>; 9 | 10 | // vec4 to vec3 11 | @(1,2,3,4) $ vec3 => vec3 v3; <<< v3 >>>; 12 | // vec4 to vec2 13 | @(1,2,3,4) $ vec2 => vec2 v2; <<< v2 >>>; 14 | -------------------------------------------------------------------------------- /src/core/makefile.x/makefile.alsa: -------------------------------------------------------------------------------- 1 | # compiler flags 2 | CFLAGS+=-D__LINUX_ALSA__ -fno-strict-aliasing -D__CK_SNDFILE_NATIVE__ 3 | 4 | # linker / library flags 5 | LDFLAGS+=-lasound -lstdc++ -ldl -lm -lsndfile -lpthread 6 | -------------------------------------------------------------------------------- /src/core/makefile.x/makefile.jack: -------------------------------------------------------------------------------- 1 | # compiler flags 2 | CFLAGS+= -D__UNIX_JACK__ -fno-strict-aliasing -D__CK_SNDFILE_NATIVE__ 3 | CFLAGS+= $(shell pkg-config --cflags jack) 4 | 5 | # linker / library flags 6 | LDFLAGS+= -lasound $(shell pkg-config --libs jack) -lstdc++ -ldl -lm -lsndfile -lpthread 7 | -------------------------------------------------------------------------------- /src/core/makefile.x/makefile.pulse: -------------------------------------------------------------------------------- 1 | # compiler flags 2 | CFLAGS+= -D__LINUX_PULSE__ -fno-strict-aliasing -D__CK_SNDFILE_NATIVE__ 3 | 4 | # linker / library flags 5 | LDFLAGS+= -lasound -lstdc++ -ldl -lm -lsndfile -lpthread -lpulse-simple -lpulse 6 | -------------------------------------------------------------------------------- /src/core/makefile.x/makefile.vanilla: -------------------------------------------------------------------------------- 1 | # compile chuck core "vanilla" 2 | # no extra flags, no linking -- just compile object files 3 | 4 | # compiler 5 | CFLAGS+= 6 | 7 | # linker 8 | LDFLAGS+= 9 | -------------------------------------------------------------------------------- /src/host-web/webchuck/js/defer.js: -------------------------------------------------------------------------------- 1 | // src: http://lea.verou.me/2016/12/resolve-promises-externally-with-this-one-weird-trick/ 2 | function defer() 3 | { 4 | var res, rej; 5 | 6 | var promise = new Promise((resolve, reject) => { 7 | res = resolve; 8 | rej = reject; 9 | }); 10 | 11 | promise.resolve = res; 12 | promise.reject = rej; 13 | 14 | return promise; 15 | } 16 | -------------------------------------------------------------------------------- /src/host-web/webchuck/wav/aah.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/src/host-web/webchuck/wav/aah.wav -------------------------------------------------------------------------------- /src/host/RtAudio/include/asioinfo.txt: -------------------------------------------------------------------------------- 1 | The Steinberg ASIO SDK and licensing agreement can be found at: 2 | 3 | - https://www.steinberg.net/developers/ 4 | -------------------------------------------------------------------------------- /src/test/01-Basic/01.ck: -------------------------------------------------------------------------------- 1 | // 01.ck : test assignment 2 | 3 | // assignment 4 | 1 => int x; 5 | 6 | // test 7 | if( x == 1 ) <<<"success">>>; 8 | -------------------------------------------------------------------------------- /src/test/01-Basic/02.ck: -------------------------------------------------------------------------------- 1 | // 02.ck : test float assignment 2 | 3 | // float assignment 4 | 2.2 => float y; 5 | 6 | // test 7 | if( y == 2.2 ) <<<"success">>>; 8 | -------------------------------------------------------------------------------- /src/test/01-Basic/03.ck: -------------------------------------------------------------------------------- 1 | // 03.ck : arithmetic 2 | 3 | // arithmetic 4 | if( 3 + 2 == 5 ) <<<"success">>>; 5 | -------------------------------------------------------------------------------- /src/test/01-Basic/04.ck.disabled: -------------------------------------------------------------------------------- 1 | // 04.ck : infinite loop ( fail-correct ) 2 | 3 | // get ready to stop using your computer 4 | while( true ); 5 | 6 | // it shouldn't get here 7 | <<<"success">>>; 8 | -------------------------------------------------------------------------------- /src/test/01-Basic/05.ck: -------------------------------------------------------------------------------- 1 | // 05.ck : time, now, duration 2 | 3 | // time + duration 4 | now + 1::ms => time later; 5 | 6 | <<<"success">>>; 7 | -------------------------------------------------------------------------------- /src/test/01-Basic/06.ck: -------------------------------------------------------------------------------- 1 | // 06.ck : arithmetic using durations 2 | 3 | 1::ms + 4::samp => dur z; 4 | 5 | <<<"success">>>; 6 | -------------------------------------------------------------------------------- /src/test/01-Basic/07.ck: -------------------------------------------------------------------------------- 1 | // 07.ck : division dur / dur -> float 2 | 3 | 1::ms / 1::samp => float ratio; 4 | 5 | <<<"success">>>; 6 | -------------------------------------------------------------------------------- /src/test/01-Basic/08.ck: -------------------------------------------------------------------------------- 1 | // 08.ck : variable lookup 2 | 3 | // assignment 4 | 1 => int x; 5 | 6 | // increment 7 | x + 1 => x; 8 | 9 | if( x == 2 ) <<<"success">>>; 10 | -------------------------------------------------------------------------------- /src/test/01-Basic/09.ck: -------------------------------------------------------------------------------- 1 | // 09.ck : +=> increment and assign 2 | 3 | // initialize 4 | 1 => int x; 5 | 6 | // increment by 2 7 | 2 +=> x; 8 | 9 | if( x == 3 ) <<<"success">>>; 10 | -------------------------------------------------------------------------------- /src/test/01-Basic/10.ck: -------------------------------------------------------------------------------- 1 | // 10.ck : void function 2 | 3 | // the function 4 | fun void f() 5 | { 6 | 1 + 2 => int x; 7 | } 8 | 9 | // call it 10 | f(); 11 | 12 | <<<"success">>>; 13 | -------------------------------------------------------------------------------- /src/test/01-Basic/100.ck: -------------------------------------------------------------------------------- 1 | // static function test: calling from class name (no instance) 2 | 3 | public class Foo 4 | { 5 | fun static void foo( string s ) 6 | { 7 | if( s == "bar" ) <<< "success">>>; 8 | } 9 | } 10 | 11 | // call here 12 | Foo.foo( "bar" ); 13 | -------------------------------------------------------------------------------- /src/test/01-Basic/101.ck: -------------------------------------------------------------------------------- 1 | // static function test: calling from instance 2 | 3 | public class Foo 4 | { 5 | fun static void foo( string s ) 6 | { 7 | if( s == "bar" ) <<< "success">>>; 8 | } 9 | } 10 | 11 | // instantiate 12 | Foo f; 13 | // call here 14 | f.foo( "bar" ); 15 | -------------------------------------------------------------------------------- /src/test/01-Basic/102.ck: -------------------------------------------------------------------------------- 1 | // static function test: sporking from class 2 | 3 | public class Foo 4 | { 5 | fun static void foo( string s ) 6 | { if( s == "bar") <<< "success" >>>; } 7 | } 8 | 9 | // spork it 10 | spork ~ Foo.foo( "bar" ); 11 | 12 | // give it a chance to run 13 | me.yield(); 14 | -------------------------------------------------------------------------------- /src/test/01-Basic/103.ck: -------------------------------------------------------------------------------- 1 | // static function test: sporking using instance 2 | 3 | public class Foo 4 | { 5 | fun static void foo( string s ) 6 | { if( s == "bar") <<< "success" >>>; } 7 | } 8 | 9 | // instantiate a Foo 10 | Foo f; 11 | // spork it 12 | spork ~ f.foo( "bar" ); 13 | 14 | // give it a chance to run 15 | me.yield(); 16 | -------------------------------------------------------------------------------- /src/test/01-Basic/104.ck: -------------------------------------------------------------------------------- 1 | // static function test: multiple arguments 2 | 3 | public class Foo 4 | { 5 | fun static void foo( string a, int b, float c ) 6 | { 7 | if( a == "bar" && b == 1 && c == 4.0 ) <<< "success" >>>; 8 | } 9 | } 10 | 11 | // spork it 12 | Foo.foo( "bar", 1, 4.0 ); 13 | -------------------------------------------------------------------------------- /src/test/01-Basic/105.ck: -------------------------------------------------------------------------------- 1 | // static function test: multiple arguments from instance 2 | 3 | public class Foo 4 | { 5 | fun static void foo( string a, int b, float c ) 6 | { 7 | if( a == "bar" && b == 1 && c == 4.0 ) <<< "success" >>>; 8 | } 9 | } 10 | 11 | // instantiate 12 | Foo f; 13 | // call it 14 | f.foo( "bar", 1, 4.0 ); 15 | -------------------------------------------------------------------------------- /src/test/01-Basic/106.ck: -------------------------------------------------------------------------------- 1 | // static function test: multiple arguments, sporked 2 | 3 | public class Foo 4 | { 5 | fun static void foo( string a, int b, float c ) 6 | { 7 | if( a == "bar" && b == 1 && c == 4.0 ) <<< "success" >>>; 8 | } 9 | } 10 | 11 | // spork it 12 | spork ~ Foo.foo( "bar", 1, 4.0 ); 13 | 14 | // give it a chance to run 15 | me.yield(); 16 | -------------------------------------------------------------------------------- /src/test/01-Basic/11.ck: -------------------------------------------------------------------------------- 1 | // 11.ck : function with return type 2 | 3 | // function 4 | fun float f() 5 | { 6 | return 1.0; 7 | } 8 | 9 | // call 10 | f() => float x; 11 | 12 | // test 13 | if( x == 1.0 ) <<<"success">>>; 14 | -------------------------------------------------------------------------------- /src/test/01-Basic/113.ck: -------------------------------------------------------------------------------- 1 | // comma-separated declarations; references 2 | Gain @ h, g; 3 | 4 | // print 5 | <<< h, g >>>; 6 | 7 | // 1.4.1.2 (ge) | added fall 2022 8 | -------------------------------------------------------------------------------- /src/test/01-Basic/113.txt: -------------------------------------------------------------------------------- 1 | null null 2 | -------------------------------------------------------------------------------- /src/test/01-Basic/114.ck: -------------------------------------------------------------------------------- 1 | // this is not valid syntax at this time 2 | 5 => int x, y; 3 | 4 | // should output error: 5 | // [114.ck]:line(1): cannot '=>' from/to a multi-variable declaration 6 | -------------------------------------------------------------------------------- /src/test/01-Basic/114.txt: -------------------------------------------------------------------------------- 1 | 114.ck:2:6: error: cannot '=>' from/to a multi-variable declaration 2 | [2] 5 => int x, y; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/01-Basic/115.ck: -------------------------------------------------------------------------------- 1 | // test static array references 2 | class X 3 | { 4 | static int a[]; 5 | static float b[]; 6 | // hah 7 | static float c[], d; 8 | } 9 | 10 | <<< "success" >>>; 11 | -------------------------------------------------------------------------------- /src/test/01-Basic/116.ck: -------------------------------------------------------------------------------- 1 | // test static array references 2 | class X 3 | { 4 | static int a[]; 5 | static float b[]; 6 | // hah 7 | static int c[], d; 8 | } 9 | 10 | new int[5] @=> X.a; 11 | new float[6] @=> X.b; 12 | new int[7] @=> X.c; 13 | 8 => X.d; 14 | 15 | <<< X.a.size(), X.b.size(), X.c.size(), X.d >>>; 16 | -------------------------------------------------------------------------------- /src/test/01-Basic/116.txt: -------------------------------------------------------------------------------- 1 | 5 6 7 8 2 | -------------------------------------------------------------------------------- /src/test/01-Basic/117.ck: -------------------------------------------------------------------------------- 1 | // testing is by default run in --silent mode 2 | if( !Machine.realtime() || Machine.silent() ) 3 | { 4 | // print! 5 | <<< "success" >>>; 6 | } 7 | -------------------------------------------------------------------------------- /src/test/01-Basic/119.txt: -------------------------------------------------------------------------------- 1 | 3 3 0 2 | 0 0 0 0 3 | -------------------------------------------------------------------------------- /src/test/01-Basic/12.ck: -------------------------------------------------------------------------------- 1 | // 12.ck : class definition and instantiation 2 | 3 | // define local class X (use 'public' to define global class) 4 | class X 5 | { 6 | // function foo 7 | public void foo() { } 8 | 9 | // members 10 | int y; 11 | dur z; 12 | } 13 | 14 | // instantiate a X 15 | X x; 16 | 17 | // test 18 | <<<"success">>>; 19 | -------------------------------------------------------------------------------- /src/test/01-Basic/120.txt: -------------------------------------------------------------------------------- 1 | @(1.0000,0.0000,0.0000) :(vec3) 2 | -------------------------------------------------------------------------------- /src/test/01-Basic/121.ck: -------------------------------------------------------------------------------- 1 | // test to make sure that return works in a void function 2 | fun void test() { 3 | return; 4 | } 5 | 6 | test(); 7 | <<< "success" >>>; 8 | -------------------------------------------------------------------------------- /src/test/01-Basic/122.ck: -------------------------------------------------------------------------------- 1 | // negative array index access tests 2 | [1,2,3,4] @=> int a[]; 3 | 4 | // failure cases 5 | if( a[-1] != 4 ) <<< "FAILURE, expecting 4" >>>; 6 | if( a[-4] != 1 ) <<< "FAILURE, expecting 1" >>>; 7 | 8 | // should generate a array out of bounds 9 | a[-5]; 10 | -------------------------------------------------------------------------------- /src/test/01-Basic/122.txt: -------------------------------------------------------------------------------- 1 | [chuck]:(EXCEPTION) ArrayOutofBounds: on line[9] in shred[id=1:01-Basic/122.ck] index[-5] 2 | -------------------------------------------------------------------------------- /src/test/01-Basic/126.ck: -------------------------------------------------------------------------------- 1 | [1,2,3,4,5,6] @=> int a[]; 2 | [1,2,3,4,5,6] @=> int b[]; 3 | 4 | b.reverse(); 5 | 6 | // test b is the reverse of a 7 | for (int i; i < a.size(); i++) { 8 | if (a[i] != b[-i-1]) me.exit(); 9 | } 10 | 11 | <<< "success" >>>; 12 | -------------------------------------------------------------------------------- /src/test/01-Basic/128.ck: -------------------------------------------------------------------------------- 1 | // this checks non-empty arrays of references and full instances 2 | // june 2023 3 | 4 | // 2x2 array of SinOsc refs 5 | SinOsc @ foo[2][2]; 6 | 7 | // 2x2 array of SinOsc instances 8 | SinOsc bar[2][2]; 9 | 10 | // test 11 | if( foo[1][1] == null && bar[1][1] != null ) 12 | <<< "success" >>>; 13 | else 14 | <<< foo[1][1], bar[1][1] >>>; 15 | -------------------------------------------------------------------------------- /src/test/01-Basic/129.ck: -------------------------------------------------------------------------------- 1 | // this tests assignment into arrays 2 | // june 2023 3 | 4 | // error: [1.0, 1.0] @=> float foo[2]; 5 | // this is ok: 6 | [1, 5] @=> int foo[]; 7 | 8 | // error: [ new Object ] @=> Object @ bar[1]; 9 | // this is ok: 10 | [ new Object ] @=> Object @ bar[]; 11 | 12 | if( foo[1] == 5 && bar[0] != null ) <<< "success" >>>; 13 | -------------------------------------------------------------------------------- /src/test/01-Basic/13.ck: -------------------------------------------------------------------------------- 1 | // 13.ck : class inheritance 2 | 3 | // define X 4 | class X 5 | { 6 | public void foo() { } 7 | int y; 8 | dur z; 9 | } 10 | 11 | // define Y 12 | class Y extends X 13 | { 14 | public void foo() { } 15 | } 16 | 17 | // instantiate a X 18 | X x; 19 | 20 | // instantiate a Y 21 | Y y; 22 | 23 | <<<"success">>>; 24 | -------------------------------------------------------------------------------- /src/test/01-Basic/130.ck: -------------------------------------------------------------------------------- 1 | // this tests implicitly treating RHS declaration as a @ reference 2 | // june 2023 3 | 4 | // this basically is seen by chuck as 5 | // 'new SinOsc @=> SinOsc @ foo;' 6 | new SinOsc @=> SinOsc foo; 7 | 8 | // should have no errors 9 | <<< "success" >>>; 10 | -------------------------------------------------------------------------------- /src/test/01-Basic/131.ck: -------------------------------------------------------------------------------- 1 | // print success inside program string to be eval'ed 2 | Machine.eval( "<<< \"success\" >>>;" ); 3 | // give it a chance to run 4 | me.yield(); -------------------------------------------------------------------------------- /src/test/01-Basic/132.txt: -------------------------------------------------------------------------------- 1 | 1 :(int) 2 | "a" :(string) 3 | 2 :(int) 4 | "b" :(string) 5 | 3 :(int) 6 | "c" :(string) 7 | -------------------------------------------------------------------------------- /src/test/01-Basic/133.txt: -------------------------------------------------------------------------------- 1 | 100 (eval) 101 (eval) 2 | 102 (eval) 103 (eval) 3 | 104 (eval) 105 (eval) 4 | -------------------------------------------------------------------------------- /src/test/01-Basic/135-array-append.ck: -------------------------------------------------------------------------------- 1 | // create zero-length array 2 | int a[0]; 3 | 4 | // print size 5 | <<< "size (before append):", a.size() >>>; 6 | 7 | // append 8 | a << 1 << 2 << 3 << 5 << 8; 9 | 10 | // print size 11 | <<< "size (after append):", a.size() >>>; 12 | 13 | // print contents 14 | for( int i; i < a.size(); i++ ) 15 | { 16 | <<< i, ":", a[i] >>>; 17 | } 18 | -------------------------------------------------------------------------------- /src/test/01-Basic/135-array-append.txt: -------------------------------------------------------------------------------- 1 | size (before append): 0 2 | size (after append): 5 3 | 0 : 1 4 | 1 : 2 5 | 2 : 3 6 | 3 : 5 7 | 4 : 8 8 | -------------------------------------------------------------------------------- /src/test/01-Basic/136-array-erase.txt: -------------------------------------------------------------------------------- 1 | size (before append): 0 2 | size (after append): 5 3 | size (after erase and popFront): 3 4 | 0 : 2 5 | 1 : 3 6 | 2 : 5 7 | -------------------------------------------------------------------------------- /src/test/01-Basic/137-array-erase.txt: -------------------------------------------------------------------------------- 1 | size (before append): 0 2 | size (after append): 8 3 | size (after erase and popFront): 5 4 | 0 : 1 5 | 1 : 2 6 | 2 : 6 7 | 3 : 7 8 | 4 : 8 9 | -------------------------------------------------------------------------------- /src/test/01-Basic/138-foreach.txt: -------------------------------------------------------------------------------- 1 | 1.000000 :(float) 2 | 2.500000 :(float) 3 | 3.000000 :(float) 4 | -------------------------------------------------------------------------------- /src/test/01-Basic/139-foreach.txt: -------------------------------------------------------------------------------- 1 | 1 :(int) 2 | 2 :(int) 3 | 3 :(int) 4 | -------------------------------------------------------------------------------- /src/test/01-Basic/140-foreach.txt: -------------------------------------------------------------------------------- 1 | 1 :(int) 2 | 2 :(int) 3 | 3 :(int) 4 | 2 :(int) 5 | 4 :(int) 6 | 6 :(int) 7 | 3 :(int) 8 | 6 :(int) 9 | 9 :(int) 10 | -------------------------------------------------------------------------------- /src/test/01-Basic/141-foreach.txt: -------------------------------------------------------------------------------- 1 | 1 :(int) 2 | 2 :(int) 3 | 3 :(int) 4 | 4 :(int) 5 | -------------------------------------------------------------------------------- /src/test/01-Basic/142-foreach.txt: -------------------------------------------------------------------------------- 1 | 110 :(int) 2 | 220 :(int) 3 | 440 :(int) 4 | 880 :(int) 5 | 1760 :(int) 6 | -------------------------------------------------------------------------------- /src/test/01-Basic/144-foreach.txt: -------------------------------------------------------------------------------- 1 | 1 :(int) 2 | 2 :(int) 3 | 3 :(int) 4 | 1 :(int) 5 | 2 :(int) 6 | -------------------------------------------------------------------------------- /src/test/01-Basic/145-foreach.ck: -------------------------------------------------------------------------------- 1 | // test empty loop body 2 | int a[5]; 3 | for( int b : a ) { } 4 | <<< "success" >>>; 5 | -------------------------------------------------------------------------------- /src/test/01-Basic/146-foreach-auto.txt: -------------------------------------------------------------------------------- 1 | 1 :(int) 2 | 2 :(int) 3 | 3 :(int) 4 | -------------------------------------------------------------------------------- /src/test/01-Basic/147-foreach-auto.txt: -------------------------------------------------------------------------------- 1 | 1 :(int) 2 | 2 :(int) 3 | 3 :(int) 4 | 4 :(int) 5 | -------------------------------------------------------------------------------- /src/test/01-Basic/148-type-auto.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 440 5 | 1 6 | 2 7 | 3 8 | -------------------------------------------------------------------------------- /src/test/01-Basic/149-do-until.ck: -------------------------------------------------------------------------------- 1 | // do-until 2 | 3 | 0 => int j; 4 | 0 => int i; 5 | 6 | do { 7 | 1 +=> j; 8 | 1 +=> i; 9 | } until( i >= 5 ); 10 | 11 | // test 12 | if( j == 5 ) <<<"success">>>; 13 | -------------------------------------------------------------------------------- /src/test/01-Basic/150-do-while.ck: -------------------------------------------------------------------------------- 1 | // do-while 2 | 3 | 0 => int j; 4 | 0 => int i; 5 | 6 | do { 7 | 1 +=> j; 8 | 1 +=> i; 9 | } while( i < 5 ); 10 | 11 | // test 12 | if( j == 5 ) <<<"success">>>; 13 | -------------------------------------------------------------------------------- /src/test/01-Basic/151-until.ck: -------------------------------------------------------------------------------- 1 | // until loop (opposite of while loop) 2 | 3 | 0 => int j; 4 | 0 => int i; 5 | 6 | // loop 7 | until ( i == 5 ) 8 | { 9 | 1 +=> j; 10 | 1 +=> i; 11 | } 12 | 13 | // test 14 | if ( j == 5 ) <<<"success">>>; 15 | -------------------------------------------------------------------------------- /src/test/01-Basic/152-while.ck: -------------------------------------------------------------------------------- 1 | // while loop (opposite of until loop) 2 | 3 | 0 => int j; 4 | 0 => int i; 5 | 6 | // loop 7 | while( i < 5 ) 8 | { 9 | 1 +=> j; 10 | 1 +=> i; 11 | } 12 | 13 | // test 14 | if ( j == 5 ) <<<"success">>>; 15 | -------------------------------------------------------------------------------- /src/test/01-Basic/154-break.ck: -------------------------------------------------------------------------------- 1 | // break; 2 | 3 | 0 => int j; 4 | 5 | // loop 6 | while ( true ) 7 | { 8 | if ( j >= 5 ) 9 | break; 10 | 11 | 1 +=> j; 12 | } 13 | 14 | // test 15 | if ( j == 5 ) <<<"success">>>; 16 | -------------------------------------------------------------------------------- /src/test/01-Basic/156-for-empty.ck: -------------------------------------------------------------------------------- 1 | // empty for init and advance 2 | for( ; true; ) 3 | { 4 | // break out 5 | break; 6 | } 7 | 8 | // done 9 | <<< "success" >>>; 10 | -------------------------------------------------------------------------------- /src/test/01-Basic/157-while-empty.ck: -------------------------------------------------------------------------------- 1 | // empty while body 2 | while( false ) { } 3 | // done 4 | <<< "success" >>>; 5 | -------------------------------------------------------------------------------- /src/test/01-Basic/158-dowhile-empty.ck: -------------------------------------------------------------------------------- 1 | // empty do while body 2 | do{ } while( false ); 3 | // done 4 | <<< "success" >>>; 5 | -------------------------------------------------------------------------------- /src/test/01-Basic/16.ck: -------------------------------------------------------------------------------- 1 | // 16.ck : multi-dimensional array 2 | 3 | // declare int array 2x2x2 4 | int a[2][2][2]; 5 | // assign 6 | 4 => a[0][0][1]; 7 | 8 | // test 9 | if( a[0][0][1] == 4 ) <<<"success">>>; 10 | -------------------------------------------------------------------------------- /src/test/01-Basic/160-foreach-class.txt: -------------------------------------------------------------------------------- 1 | 1 :(int) 2 | 2 :(int) 3 | 3 :(int) 4 | 4 :(int) 5 | 5 :(int) 6 | 6 :(int) 7 | 7 :(int) 8 | 8 :(int) 9 | 9 :(int) 10 | 1 :(int) 11 | 2 :(int) 12 | 3 :(int) 13 | -------------------------------------------------------------------------------- /src/test/01-Basic/161-foreach-func.ck: -------------------------------------------------------------------------------- 1 | fun void foo() 2 | { 3 | [1,2,3] @=> int array[]; 4 | for( int a : array ) 5 | { 6 | if( a == 3 ) return; 7 | } 8 | 9 | // trap 10 | <<< "shouldn't get here" >>>; 11 | } 12 | 13 | foo(); 14 | 15 | // done 16 | <<< "success" >>>; 17 | 18 | -------------------------------------------------------------------------------- /src/test/01-Basic/166-depend-func.txt: -------------------------------------------------------------------------------- 1 | 1 2 3 2 | -------------------------------------------------------------------------------- /src/test/01-Basic/169-depend-nest1.txt: -------------------------------------------------------------------------------- 1 | 1 2 3 2 | -------------------------------------------------------------------------------- /src/test/01-Basic/17.ck: -------------------------------------------------------------------------------- 1 | // 17.ck : partial array 2 | 3 | // declare int array 2x2 4 | int x[2][2]; 5 | 6 | // assign 7 | 2 => x[1][1]; 8 | 9 | // assign partial array reference to 'y' 10 | x[1] @=> int y[]; 11 | 12 | // test 13 | if( y[1] == 2 ) <<<"success">>>; 14 | -------------------------------------------------------------------------------- /src/test/01-Basic/174-complex-array.txt: -------------------------------------------------------------------------------- 1 | 1.000000 2.000000 2 | #(1.0000,2.0000) :(complex) 3 | 2.236068 0.352416 4 | %(2.2361,0.3524*pi) :(polar) 5 | #(8.0000,10.0000) :(complex) 6 | -------------------------------------------------------------------------------- /src/test/01-Basic/175-array-sort.txt: -------------------------------------------------------------------------------- 1 | -2 -1 0 1 2 3 4 5 2 | 5 4 3 2 1 0 -1 -2 3 | -3.14159 1 2 3.14159 4 | #(0,0) #(1,0) #(-1,-1) #(1,1) 5 | %(1,3.14159) %(2,1.5708) %(2,3.14159) 6 | @(0,0,0) @(-1,-1,-1) @(1,2,1) 7 | @(0,0,0,0) @(-1,-1,-1,-1) @(1,3,1,-2) 8 | andrew ge nick 9 | -------------------------------------------------------------------------------- /src/test/01-Basic/176-return-implicit.ck: -------------------------------------------------------------------------------- 1 | // test implicit cast in return type 2 | 3 | fun float foo() 4 | { 5 | // return int in a func that returns float 6 | return 3; 7 | } 8 | 9 | if( foo() == 3 ) 10 | <<< "success" >>>; 11 | -------------------------------------------------------------------------------- /src/test/01-Basic/178-decl-b.ck: -------------------------------------------------------------------------------- 1 | // test decl in a multi-part chuck statement: A => decl B => C 2 | // NOTE decl B is type-checked more than once: as part of `A => decl B` 3 | // and `decl B => C` 4 | 5 | SinOsc osc; 6 | 7 | // A => decl B => C 8 | 440 => float foo => osc.freq; 9 | 10 | // test 11 | if( 440 == foo ) <<< "success" >>>; 12 | -------------------------------------------------------------------------------- /src/test/01-Basic/179-ctrl-empty.ck: -------------------------------------------------------------------------------- 1 | // empty stmt-list 2 | 3 | if( true ) { } 4 | else { } 5 | 6 | while( false ) { } 7 | 8 | until( true ) { } 9 | 10 | for( ; false; ) { } 11 | 12 | for( int x : [1,2,3] ) { } 13 | 14 | // no error 15 | <<< "success" >>>; 16 | 17 | -------------------------------------------------------------------------------- /src/test/01-Basic/18.ck.disabled: -------------------------------------------------------------------------------- 1 | // 18.ck : out of bounds ( fail-correct ) 2 | 3 | // declare int array 4 | int a[2]; 5 | 6 | // use as associative array 7 | 4 => a["foo"]; 8 | 9 | // assignment 10 | 4 => a[1]; 11 | 12 | // this should fail 13 | 5 => a[2]; 14 | 15 | <<<"success">>>; 16 | -------------------------------------------------------------------------------- /src/test/01-Basic/180-return-basic.ck: -------------------------------------------------------------------------------- 1 | fun int foo() 2 | { 3 | return 3; 4 | } 5 | 6 | fun float bar() 7 | { 8 | 5 => float a; 9 | return a; 10 | } 11 | 12 | fun void zaz() 13 | { 14 | 1 => int i; 15 | } 16 | 17 | 18 | if( foo() == 3 && bar() == 5.0 ) <<< "success" >>>; 19 | -------------------------------------------------------------------------------- /src/test/01-Basic/185-range.txt: -------------------------------------------------------------------------------- 1 | [ 0, -1, -2, -3, -4, ] 2 | [ 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, ] 3 | [ -1, 0, 1, 2, 3, 4, ] 4 | [ -2, -3, -4, -5, -6, -7, -8, -9, ] 5 | [ 0, 4, 8, 12, 16, ] 6 | [ 5, 1, -3, -7, -11, -15, -19, ] 7 | [ 5, 1, -3, -7, -11, -15, -19, ] 8 | [ ] 9 | [ ] 10 | [ ] 11 | [ ] 12 | -------------------------------------------------------------------------------- /src/test/01-Basic/186-array-comma.ck: -------------------------------------------------------------------------------- 1 | // an array initializer list (aka array literal) 2 | [1,2,3] @=> int foo[]; 3 | 4 | // also permitted: trailing comma after last element in array literal 5 | [1,2,3,] @=> int bar[]; 6 | 7 | // print 8 | if( foo.size() == 3 && bar.size() == 3 ) 9 | <<< "success" >>>; 10 | -------------------------------------------------------------------------------- /src/test/01-Basic/19.ck: -------------------------------------------------------------------------------- 1 | // 19.ck : function that takes array as argument 2 | 3 | // function foo 4 | fun void foo( float a[] ) 5 | { 6 | // use 'a' associative 7 | 10.0 => a["foo"]; 8 | } 9 | 10 | // declare 11 | float x[10]; 12 | 13 | // call foo 14 | foo( x ); 15 | 16 | // test 17 | if( 10.0 == x["foo"] ) <<<"success">>>; 18 | -------------------------------------------------------------------------------- /src/test/01-Basic/190-class-auto.txt: -------------------------------------------------------------------------------- 1 | 1 :(int) 2 | 2 :(int) 3 | 3 :(int) 4 | 4 :(int) 5 | -------------------------------------------------------------------------------- /src/test/01-Basic/191-a-Foo.ck.disabled: -------------------------------------------------------------------------------- 1 | // Foo base class 2 | public class Foo 3 | { 4 | "1:1" => string ratio; 5 | "Foo" => string name; 6 | } -------------------------------------------------------------------------------- /src/test/01-Basic/191-b-Factory.ck.disabled: -------------------------------------------------------------------------------- 1 | // Foo factory 2 | public class FooFactory 3 | { 4 | fun static FooChild make() 5 | { 6 | FooChild f; 7 | return f; 8 | } 9 | } 10 | 11 | // FooChild, child of Foo 12 | class FooChild extends Foo 13 | { 14 | "FooChild" => name; 15 | } 16 | -------------------------------------------------------------------------------- /src/test/01-Basic/191-c-User.ck.disabled: -------------------------------------------------------------------------------- 1 | // using stuff from other files 2 | public class User 3 | { 4 | FooFactory.make() @=> Foo foo; 5 | } 6 | -------------------------------------------------------------------------------- /src/test/01-Basic/191-depend-context.txt: -------------------------------------------------------------------------------- 1 | [chuck]: (VM) sporking incoming shred: 2 (191-a-Foo.ck.disabled)... 2 | [chuck]: (VM) sporking incoming shred: 3 (191-b-Factory.ck.disabled)... 3 | [chuck]: (VM) sporking incoming shred: 4 (191-c-User.ck.disabled)... 4 | -------------------------------------------------------------------------------- /src/test/01-Basic/192-class-ctors.ck: -------------------------------------------------------------------------------- 1 | // test pre-constructors running with inheritance 2 | 3 | // base 4 | class Foo 5 | { 6 | <<< "I am a Foo" >>>; 7 | } 8 | 9 | // child 10 | class Bar extends Foo 11 | { 12 | <<< "I am a Bar" >>>; 13 | } 14 | 15 | // instantiate Bar should run both Foo's and Bar's pre-constructor 16 | Bar bar; 17 | -------------------------------------------------------------------------------- /src/test/01-Basic/192-class-ctors.txt: -------------------------------------------------------------------------------- 1 | "I am a Foo" :(string) 2 | "I am a Bar" :(string) 3 | -------------------------------------------------------------------------------- /src/test/01-Basic/193-machine-add-this.ck.disabled: -------------------------------------------------------------------------------- 1 | // test argument passing through Machine.add() 2 | if( me.arg(0) == "foo" && me.arg(1) == "1" && me.arg(2) == "2" ) 3 | <<< "success" >>>; 4 | -------------------------------------------------------------------------------- /src/test/01-Basic/193-machine-add.ck: -------------------------------------------------------------------------------- 1 | SinOsc foo => dac; 2 | .25 => foo.gain; 3 | 4 | // test audio clicks when we Machine.add 5 | .5::second => now; 6 | 7 | // test Machine.add, with arguments 8 | Machine.add( me.dir() + "193-machine-add-this.ck.disabled:foo:1:2" ); 9 | 10 | 2::second => now; 11 | -------------------------------------------------------------------------------- /src/test/01-Basic/193-machine-add.txt: -------------------------------------------------------------------------------- 1 | [chuck]: (VM) sporking incoming shred: 2 (193-machine-add-this.ck.disabled)... 2 | "success" :(string) 3 | -------------------------------------------------------------------------------- /src/test/01-Basic/194-value-lookup-order.txt: -------------------------------------------------------------------------------- 1 | b 2000 2 | b 2000 3 | b 8000 4 | b 8000 5 | -------------------------------------------------------------------------------- /src/test/01-Basic/195-value-lookup-order.txt: -------------------------------------------------------------------------------- 1 | a 3000 2 | b 3000 3 | c 3000 4 | -------------------------------------------------------------------------------- /src/test/01-Basic/196-array-append-array.txt: -------------------------------------------------------------------------------- 1 | 1.000000 :(float) 2 | 2.000000 :(float) 3 | 3.000000 :(float) 4 | 5.000000 :(float) 5 | -------------------------------------------------------------------------------- /src/test/01-Basic/197-array-append-array.txt: -------------------------------------------------------------------------------- 1 | 1 :(int) 2 | 2 :(int) 3 | 3 :(int) 4 | 5 :(int) 5 | -------------------------------------------------------------------------------- /src/test/01-Basic/20.ck: -------------------------------------------------------------------------------- 1 | // 20.ck : assignment inside functions 2 | 3 | fun int foo( int x ) 4 | { 5 | x => int a; 6 | return a; 7 | } 8 | 9 | if( foo( 3 ) == 3 ) 10 | <<<"success">>>; 11 | -------------------------------------------------------------------------------- /src/test/01-Basic/200-inner-class.txt: -------------------------------------------------------------------------------- 1 | 1 :(int) 2 | 2 :(int) 3 | in inner class, y = 2 4 | in inner class, y = 3 5 | in inner class, y = 5 6 | -------------------------------------------------------------------------------- /src/test/01-Basic/203-op-overload-class.txt: -------------------------------------------------------------------------------- 1 | 3.000000 :(float) 2 | 3.000000 :(float) 3 | 4.000000 :(float) 4 | 9.000000 :(float) 5 | -------------------------------------------------------------------------------- /src/test/01-Basic/204-op-overload-foo.txt: -------------------------------------------------------------------------------- 1 | 3 :(int) 2 | -------------------------------------------------------------------------------- /src/test/01-Basic/205-op-overload-gru.txt: -------------------------------------------------------------------------------- 1 | 1.000000 2.000000 2 | 1.000000 2.000000 3 | 2.000000 3.000000 4 | -------------------------------------------------------------------------------- /src/test/01-Basic/206-op-overload-public.txt: -------------------------------------------------------------------------------- 1 | 5 0 11 2 | -------------------------------------------------------------------------------- /src/test/01-Basic/207-op-overload-pre-post.txt: -------------------------------------------------------------------------------- 1 | 1 1 2 2 2 3 2 | -------------------------------------------------------------------------------- /src/test/01-Basic/209-op-overload-mix.txt: -------------------------------------------------------------------------------- 1 | 10 0 5 6 2 | -------------------------------------------------------------------------------- /src/test/01-Basic/211-mfun-invoke-vars.txt: -------------------------------------------------------------------------------- 1 | 1 2.000000 3 4 2 | -------------------------------------------------------------------------------- /src/test/01-Basic/213-spork-nested-var.txt: -------------------------------------------------------------------------------- 1 | 6 2.000000 2 | 7 2.000000 3 | 8 2.000000 4 | 9 2.000000 5 | 10 2.000000 6 | 11 2.000000 7 | 12 2.000000 8 | 13 2.000000 9 | 14 2.000000 10 | 15 2.000000 11 | 16 2.000000 12 | -------------------------------------------------------------------------------- /src/test/01-Basic/214-num-types.ck: -------------------------------------------------------------------------------- 1 | // test basic numerical type literals 2 | 3 | // int 4 | <<< 1 >>>; 5 | // float 6 | <<< 2.0 >>>; 7 | // complex 8 | <<< #(3,4) >>>; 9 | // polar 10 | <<< %(1,pi/2) >>>; 11 | // vec2 12 | <<< @(5,6) >>>; 13 | // vec3 14 | <<< @(7,8,9) >>>; 15 | // vec4 16 | <<< @(10,11,12,13) >>>; 17 | -------------------------------------------------------------------------------- /src/test/01-Basic/214-num-types.txt: -------------------------------------------------------------------------------- 1 | 1 :(int) 2 | 2.000000 :(float) 3 | #(3.0000,4.0000) :(complex) 4 | %(1.0000,0.5000*pi) :(polar) 5 | @(5.0000,6.0000) :(vec2) 6 | @(7.0000,8.0000,9.0000) :(vec3) 7 | @(10.0000,11.0000,12.0000,13.0000) :(vec4) 8 | -------------------------------------------------------------------------------- /src/test/01-Basic/217-vec-fields-access.txt: -------------------------------------------------------------------------------- 1 | 5.000000 6.000000 7.000000 100008.000000 2 | -------------------------------------------------------------------------------- /src/test/01-Basic/219-func-call-refs.txt: -------------------------------------------------------------------------------- 1 | 1 :(int) 2 | 2 :(int) 3 | 2 :(int) 4 | 3 :(int) 5 | -------------------------------------------------------------------------------- /src/test/01-Basic/22.ck: -------------------------------------------------------------------------------- 1 | // 22.ck : hmm 2 | 3 | class X 4 | { 5 | int i; 6 | } 7 | 8 | // instantiate a X and assign to i 9 | 10 => (X x).i; 10 | 11 | // test 12 | if( x.i == 10 ) <<<"success">>>; 13 | -------------------------------------------------------------------------------- /src/test/01-Basic/224-stack-pointer-reg.txt: -------------------------------------------------------------------------------- 1 | 1 2 3 @(4.0000,5.0000) #(6.0000,7.0000,8.0000) 2 | "success" :(string) 3 | -------------------------------------------------------------------------------- /src/test/01-Basic/225-vecs-cast.ck: -------------------------------------------------------------------------------- 1 | // casting between vec2, vec3, vec4 2 | 3 | // vec2 to vec3 4 | @(1,2) $ vec4 => vec4 v4; <<< v4 >>>; 5 | // vec2 to vec4 6 | @(1,2) $ vec4 => v4; <<< v4 >>>; 7 | // vec3 to vec4 8 | @(1,2,3) $ vec4 => v4; <<< v4 >>>; 9 | 10 | // vec4 to vec3 11 | @(1,2,3,4) $ vec3 => vec3 v3; <<< v3 >>>; 12 | // vec4 to vec2 13 | @(1,2,3,4) $ vec2 => vec2 v2; <<< v2 >>>; 14 | -------------------------------------------------------------------------------- /src/test/01-Basic/225-vecs-cast.txt: -------------------------------------------------------------------------------- 1 | @(1.0000,2.0000,0.0000,0.0000) :(vec4) 2 | @(1.0000,2.0000,0.0000,0.0000) :(vec4) 3 | @(1.0000,2.0000,3.0000,0.0000) :(vec4) 4 | @(1.0000,2.0000,3.0000) :(vec3) 5 | @(1.0000,2.0000) :(vec2) 6 | -------------------------------------------------------------------------------- /src/test/01-Basic/227-dangle-ref-func2.ck: -------------------------------------------------------------------------------- 1 | class Foo 2 | { 3 | int i; 4 | } 5 | 6 | fun void go( Foo foo ) 7 | { 8 | if( Machine.refcount(foo) != 2 ) <<< "problem found" >>>; 9 | } 10 | 11 | Foo foo; 12 | 13 | go( foo ); 14 | 15 | // test 16 | if( Machine.refcount(foo) == 1 ) <<< "success" >>>; -------------------------------------------------------------------------------- /src/test/01-Basic/23.ck: -------------------------------------------------------------------------------- 1 | // 23.ck : inheritance 2 | 3 | // declare class X 4 | class X 5 | { 6 | int i; 7 | } 8 | 9 | // declare class Y as subclass of X 10 | class Y extends X 11 | { 12 | int j; 13 | } 14 | 15 | // instantiate a Y 16 | Y y; 17 | 18 | // assign to i 19 | 10 => y.i; 20 | 21 | // test 22 | if( y.i == 10 && y.j != 0 ) <<<"test failed">>>; 23 | else <<<"success">>>; 24 | -------------------------------------------------------------------------------- /src/test/01-Basic/230-dangle-ref-new.txt: -------------------------------------------------------------------------------- 1 | 5 2 | 2 3 | -------------------------------------------------------------------------------- /src/test/01-Basic/236-ctors-basic.txt: -------------------------------------------------------------------------------- 1 | constructor 1: 2 2 | constructor 1: 2 3 | constructor 2: 15 4 | constructor 3: 8 9 5 | constructor 4: 10 11 12 6 | 2 2 15 72 1320 7 | -------------------------------------------------------------------------------- /src/test/01-Basic/237-ctor-arrays.txt: -------------------------------------------------------------------------------- 1 | constructor 1: 1 2 | constructor 1: 1 3 | 1 4 | 1 5 | constructor 2: 2 6 | constructor 2: 2 7 | constructor 2: 2 8 | 2 9 | 2 10 | 2 11 | constructor 3: 6 5 12 | constructor 3: 6 5 13 | constructor 3: 6 5 14 | constructor 3: 6 5 15 | 30 16 | 30 17 | 30 18 | 30 19 | -------------------------------------------------------------------------------- /src/test/01-Basic/240-dtor-basic.ck: -------------------------------------------------------------------------------- 1 | // verify destructo is called 2 | 3 | class Foo 4 | { 5 | // destructor 6 | fun @destruct() 7 | { 8 | <<< "destructor called...", "" >>>; 9 | } 10 | } 11 | 12 | // instance 13 | Foo foo; 14 | 15 | // destructor should be called when foo goes out of scope 16 | -------------------------------------------------------------------------------- /src/test/01-Basic/240-dtor-basic.txt: -------------------------------------------------------------------------------- 1 | destructor called... 2 | -------------------------------------------------------------------------------- /src/test/01-Basic/241-ctor-builtin.ck: -------------------------------------------------------------------------------- 1 | // constructors 2 | SinOsc foo(440) => Gain g(.5) => dac; 3 | 4 | // test 5 | if( Math.equal(g.gain(),.5) ) 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/01-Basic/242-ctor-obj.txt: -------------------------------------------------------------------------------- 1 | @construct: 1 2 | ref: 1 3 | ref: 2 num: 1 4 | @construct: 2 5 | ref: 2 num: 2 6 | @destruct: 2 7 | ref: 1 8 | @destruct: 1 9 | -------------------------------------------------------------------------------- /src/test/01-Basic/248-array-popfront.ck: -------------------------------------------------------------------------------- 1 | // verify array pop front with objects 2 | 3 | // class 4 | class Foo 5 | { 6 | int num; 7 | fun @construct(int x) { x => num; } 8 | } 9 | 10 | // array 11 | Foo arr[0]; 12 | // objects 13 | arr << new Foo(1) << new Foo(2); 14 | // pop front 15 | arr.popFront(); 16 | // test 17 | if( arr[0].num == 2 ) <<< "success" >>>; 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/test/01-Basic/25.ck: -------------------------------------------------------------------------------- 1 | // 25.ck : array initialization 2 | 3 | // array literal reference assign 4 | [1,2,3] @=> int x[]; 5 | 6 | // test 7 | if( x[0] != 1 ) 8 | <<<"fail">>>; 9 | else 10 | <<<"success">>>; 11 | -------------------------------------------------------------------------------- /src/test/01-Basic/250-ugen-arrays.txt: -------------------------------------------------------------------------------- 1 | 1) connected: 1 2 | 1) connected: 1 3 | 1) connected: 1 4 | 2) connected: 1 5 | 2) connected: 1 6 | 2) connected: 1 7 | 3) connected: 1 8 | 3) connected: 1 9 | 3) connected: 1 10 | 4) connected: 1 11 | 4) connected: 1 12 | 4) connected: 1 13 | 5) connected: 1 0 0 1 14 | 6) connected: 1 0 0 1 15 | 7) connected: 1 1 1 0 1 1 1 16 | -------------------------------------------------------------------------------- /src/test/01-Basic/251-min-max.txt: -------------------------------------------------------------------------------- 1 | 1 :(int) 2 | 3.000000 :(float) 3 | 5.000000 :(float) 4 | 7.000000 :(float) 5 | 2 :(int) 6 | 4.000000 :(float) 7 | 6.000000 :(float) 8 | 8.000000 :(float) 9 | -------------------------------------------------------------------------------- /src/test/01-Basic/252-connected.ck: -------------------------------------------------------------------------------- 1 | Gain g => dac; 2 | 3 | <<< g.isConnectedTo(dac), g.isConnectedTo(dac.left) >>>; 4 | 5 | Pan2 p => dac; 6 | 7 | <<< p.isConnectedTo(dac), p.left.isConnectedTo(dac.left) >>>; 8 | 9 | -------------------------------------------------------------------------------- /src/test/01-Basic/252-connected.txt: -------------------------------------------------------------------------------- 1 | 1 1 2 | 1 1 3 | -------------------------------------------------------------------------------- /src/test/01-Basic/253-scope-cleanup.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | destructor: -2 4 | 3 5 | destructor: -1 6 | 4 7 | 5 8 | destructor: 0 9 | 6 10 | -------------------------------------------------------------------------------- /src/test/01-Basic/254-modulo-0-float-assign.ck: -------------------------------------------------------------------------------- 1 | 0 => float a; 2 | 1 => float b; 3 | 4 | a %=> b; 5 | -------------------------------------------------------------------------------- /src/test/01-Basic/254-modulo-0-float-assign.txt: -------------------------------------------------------------------------------- 1 | [chuck]:(EXCEPTION) ModuloByZero: on line[4] in shred[id=1:01-Basic/254-modulo-0-float-assign.ck] 2 | -------------------------------------------------------------------------------- /src/test/01-Basic/254-modulo-0-float.ck: -------------------------------------------------------------------------------- 1 | 1.0 % 0.0; 2 | -------------------------------------------------------------------------------- /src/test/01-Basic/254-modulo-0-float.txt: -------------------------------------------------------------------------------- 1 | [chuck]:(EXCEPTION) ModuloByZero: on line[1] in shred[id=1:01-Basic/254-modulo-0-float.ck] 2 | -------------------------------------------------------------------------------- /src/test/01-Basic/254-modulo-0-int-assign.ck: -------------------------------------------------------------------------------- 1 | 0 => int a; 2 | 1 => int b; 3 | 4 | a %=> b; 5 | -------------------------------------------------------------------------------- /src/test/01-Basic/254-modulo-0-int-assign.txt: -------------------------------------------------------------------------------- 1 | [chuck]:(EXCEPTION) ModuloByZero: on line[4] in shred[id=1:01-Basic/254-modulo-0-int-assign.ck] 2 | -------------------------------------------------------------------------------- /src/test/01-Basic/254-modulo-0-int.ck: -------------------------------------------------------------------------------- 1 | 1 % 0; 2 | -------------------------------------------------------------------------------- /src/test/01-Basic/254-modulo-0-int.txt: -------------------------------------------------------------------------------- 1 | [chuck]:(EXCEPTION) ModuloByZero: on line[1] in shred[id=1:01-Basic/254-modulo-0-int.ck] 2 | -------------------------------------------------------------------------------- /src/test/01-Basic/255-type-of-instance.ck: -------------------------------------------------------------------------------- 1 | SinOsc foo @=> UGen @ bar; 2 | 3 | // static typing 4 | if( foo.typeOf().name() != "SinOsc" && bar.typeOf().name() != "UGen" ) 5 | { <<< "error" >>>; me.exit(); } 6 | 7 | // get the instanced type 8 | if( foo.typeOfInstance().name() == "SinOsc" && 9 | bar.typeOfInstance().name() == "SinOsc" ) <<< "success" >>>; 10 | -------------------------------------------------------------------------------- /src/test/01-Basic/258-vec4.txt: -------------------------------------------------------------------------------- 1 | sum: #(6.0000,8.0000,10.0000,12.0000) 2 | diff: #(-4.0000,-4.0000,-4.0000,-4.0000) 3 | cross product: #(-4.0000,8.0000,-4.0000,0.0000) 4 | cross product (function): #(-4.0000,8.0000,-4.0000,0.0000) 5 | dot product: 70.000000 6 | #(1.0000,2.0000,3.0000,4.0000) #(5.0000,6.0000,7.0000,8.0000) #(-4.0000,8.0000,-4.0000,0.0000) 7 | -------------------------------------------------------------------------------- /src/test/01-Basic/261-null-compare.ck: -------------------------------------------------------------------------------- 1 | // verifying == and != for null references 2 | 3 | null @=> Object a; 4 | Object @ b; 5 | 6 | if( (a==b) && !(a!=b) ) <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/01-Basic/265-static-init.txt: -------------------------------------------------------------------------------- 1 | 1 :(int) 2 | 2.000000 :(float) 3 | 3.000000 :(float) 4 | 4.000000 :(float) 5 | @(5.0000,6.0000,7.0000) :(vec3) 6 | 8 :(int) 7 | 9 :(int) 8 | 10 :(int) 9 | 11 :(int) 10 | "12" :(string) 11 | 440.000000 :(float) 12 | -------------------------------------------------------------------------------- /src/test/01-Basic/266-static-init-import.txt: -------------------------------------------------------------------------------- 1 | 1 :(int) 2 | 2.000000 :(float) 3 | 3.000000 :(float) 4 | 4.000000 :(float) 5 | @(5.0000,6.0000,7.0000) :(vec3) 6 | 8 :(int) 7 | 9 :(int) 8 | 10 :(int) 9 | 11 :(int) 10 | "12" :(string) 11 | 440.000000 :(float) 12 | -------------------------------------------------------------------------------- /src/test/01-Basic/267-static-init-more.txt: -------------------------------------------------------------------------------- 1 | 1 1 1 2 2 | -------------------------------------------------------------------------------- /src/test/01-Basic/268-foreach-auto-multidim.txt: -------------------------------------------------------------------------------- 1 | 1 :(int) 2 | 2 :(int) 3 | 3 :(int) 4 | 4 :(int) 5 | 5 :(int) 6 | 6 :(int) 7 | 7 :(int) 8 | 8 :(int) 9 | -------------------------------------------------------------------------------- /src/test/01-Basic/269-foreach-auto-arraylit.ck: -------------------------------------------------------------------------------- 1 | for( auto x : [[1,2],[3,4]] ) 2 | for( auto y : x ) 3 | { <<< y >>>; } 4 | -------------------------------------------------------------------------------- /src/test/01-Basic/269-foreach-auto-arraylit.txt: -------------------------------------------------------------------------------- 1 | 1 :(int) 2 | 2 :(int) 3 | 3 :(int) 4 | 4 :(int) 5 | -------------------------------------------------------------------------------- /src/test/01-Basic/27.ck: -------------------------------------------------------------------------------- 1 | // 27.ck : 26, float 2 | 3 | class X 4 | { 5 | float f; 6 | } 7 | 8 | class Y 9 | { 10 | X x; 11 | fun X foo() { return x; }; 12 | } 13 | 14 | Y y; 15 | 12.2 => y.x.f; 16 | 17 | if( y.foo().f == 12.2 ) <<<"success">>>; 18 | -------------------------------------------------------------------------------- /src/test/01-Basic/273-doc-describe.txt: -------------------------------------------------------------------------------- 1 | "this is a description for the class Foo" :(string) 2 | "beth() is working on a novel about shared memory" :(string) 3 | "kenny() is fun, and expects nothing in return" :(string) 4 | "this is a description for the class Foo" :(string) 5 | "a function in Foo, bar() likes calling his friends" :(string) 6 | -------------------------------------------------------------------------------- /src/test/01-Basic/274-type-edge-cases.txt: -------------------------------------------------------------------------------- 1 | "a representation of a ChucK type." :(string) 2 | "a sine wave oscillator." :(string) 3 | "a sine wave oscillator." :(string) 4 | "" :(string) 5 | -------------------------------------------------------------------------------- /src/test/01-Basic/275-func-var-decl.txt: -------------------------------------------------------------------------------- 1 | 1 2 2 | 1 3 3 | -------------------------------------------------------------------------------- /src/test/01-Basic/28.ck: -------------------------------------------------------------------------------- 1 | // 28.ck : global variable 2 | 3 | 10 => int z; 4 | 5 | class X 6 | { 7 | fun void foo() 8 | { 9 | 20 => z; 10 | } 11 | } 12 | 13 | // instantiate a X 14 | X x; 15 | 16 | // call 17 | x.foo(); 18 | 19 | // test 20 | if( z == 20 ) <<<"success">>>; 21 | -------------------------------------------------------------------------------- /src/test/01-Basic/30.ck.disabled: -------------------------------------------------------------------------------- 1 | // 30.ck : more test 2 | 3 | Object x[10]; 4 | x[9].testID( 3 ); 5 | <<>>; 6 | <<>>; 7 | 8 | if( x[9].m_testID == 3 ) 9 | <<<"success">>>; 10 | -------------------------------------------------------------------------------- /src/test/01-Basic/31.ck.disabled: -------------------------------------------------------------------------------- 1 | // 31.ck : even more test 2 | 3 | Object x[10]; 4 | x[9].testID( 3 ); 5 | <<>>; 6 | <<>>; 7 | 8 | 10 => x[1].our_testID; 9 | <<>>; 10 | <<>>; 11 | -------------------------------------------------------------------------------- /src/test/01-Basic/32.ck: -------------------------------------------------------------------------------- 1 | // 32.ck : calling functions by chucking 2 | 3 | // declare X 4 | class X 5 | { 6 | // member data 7 | float f; 8 | 9 | // function 10 | fun float foo( float a, float b ) 11 | { return a + b; } 12 | } 13 | 14 | // instantiate a X 15 | X x; 16 | 17 | // calling X.foo by chucking 18 | if( (( 1, 2 ) => x.foo) == 3 ) 19 | <<<"success">>>; 20 | -------------------------------------------------------------------------------- /src/test/01-Basic/33.ck.disabled: -------------------------------------------------------------------------------- 1 | // 33.ck : sine 2 | 3 | // sine tones (fail-correct) 4 | SinOsc s => dac; 5 | 6 | [ 0, 2, 4, 7, 9 ] @=> int f[]; 7 | 8 | // time loop 9 | while( true ) 10 | { 11 | // choose freq 12 | Std.mtof( f[Math.random2( 0, 4 )] + 72 ) => s.freq; 13 | // advance time 14 | 100::ms => now; 15 | } 16 | -------------------------------------------------------------------------------- /src/test/01-Basic/35.ck: -------------------------------------------------------------------------------- 1 | // 35.ck : overloading functions 2 | 3 | 4 | fun void foo( int a, int b ) 5 | { <<<"success">>>; } 6 | 7 | fun void foo( int a ) 8 | { foo( a, a ); } 9 | 10 | // call 11 | foo( 2 ); 12 | -------------------------------------------------------------------------------- /src/test/01-Basic/44.ck.disabled: -------------------------------------------------------------------------------- 1 | // 44.ck : crash? 2 | 3 | fun void crash( string crashstr ) 4 | { 5 | <<>>; 6 | "crash!" @=> crashstr; 7 | } 8 | 9 | 10 | "23" @=> string s; 11 | 12 | //string s; 13 | //"1" => s; 14 | 15 | //<<>>; 16 | //<<>>; 17 | 18 | string a; 19 | 20 | s => a; 21 | 22 | crash( a ); 23 | 24 | <<>>; 25 | -------------------------------------------------------------------------------- /src/test/01-Basic/55.ck: -------------------------------------------------------------------------------- 1 | // 55.ck : arrays and functions 2 | 3 | // return new array 4 | fun int[][] foo() 5 | { 6 | return [[1,2],[3,4]]; 7 | } 8 | 9 | // return new array 10 | fun int[] bar() 11 | { 12 | return new int[3]; 13 | } 14 | 15 | // call 16 | bar() @=> int b[]; 17 | 18 | // test 19 | if( foo()[1][1] == 4 && b.size() == 3 ) <<<"success">>>; 20 | -------------------------------------------------------------------------------- /src/test/01-Basic/56.ck.disabled: -------------------------------------------------------------------------------- 1 | 5 => int foo; 2 | 3 | class X 4 | { 5 | // 10 => int foo; 6 | } 7 | 8 | class Y extends X 9 | { 10 | fun void bar() 11 | { 12 | 1 => int foo; 13 | <<< foo >>>; 14 | } 15 | } 16 | 17 | Y y; 18 | y.bar(); 19 | -------------------------------------------------------------------------------- /src/test/01-Basic/57.ck.disabled: -------------------------------------------------------------------------------- 1 | Envelope e => dac; 2 | 3 | 1.0::second => e.duration; 4 | <<< e.time() >>>; 5 | <<< e.duration() >>>; 6 | 7 | now + 2::second => time later; 8 | 9 | //1 => e.keyOn; 10 | e.keyOn(); 11 | while( now < later ) 12 | { 13 | <<< e.value() >>>; 14 | <<< now / second >>>; 15 | 16 | .1::second => now; 17 | } 18 | -------------------------------------------------------------------------------- /src/test/01-Basic/58.ck.disabled: -------------------------------------------------------------------------------- 1 | // instantiate 2 | Skot skot; 3 | 4 | // infinite event loop 5 | while( true ) 6 | { 7 | // prompt and wait 8 | skot.prompt("enter data:") => now; 9 | // get the results 10 | while( skot.more() ) 11 | { 12 | // get and print 13 | <<< skot.getLine() >>>; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/test/01-Basic/60.ck.disabled: -------------------------------------------------------------------------------- 1 | // instantiate a Perry 2 | PRC tokens; 3 | 4 | // set the tokens 5 | tokens.set( "a b c 3.343 2.3" ); 6 | 7 | // loop over tokens 8 | while( tokens.more() ) 9 | { 10 | // print 11 | <<< tokens.next() >>>; 12 | } 13 | -------------------------------------------------------------------------------- /src/test/01-Basic/62.ck.disabled: -------------------------------------------------------------------------------- 1 | Event e @=> Event e2; 2 | 3 | <<< e, e2 >>>; 4 | -------------------------------------------------------------------------------- /src/test/01-Basic/63.ck.disabled: -------------------------------------------------------------------------------- 1 | <<< [1,2,3].cap() >>>; 2 | <<< "a".length() >>>; 3 | -------------------------------------------------------------------------------- /src/test/01-Basic/66.ck.disabled: -------------------------------------------------------------------------------- 1 | 1 => int a; 2 | 3 | <<< a++ + a++ + a >>>; 4 | 5 | public class X 6 | { 7 | int i; 8 | static int j; 9 | } 10 | 11 | X x; 12 | x.i++; 13 | <<< x.i++ + x.i++ + x.i >>>; 14 | <<< X.j++ + X.j++ + X.j >>>; 15 | -------------------------------------------------------------------------------- /src/test/01-Basic/67.ck.disabled: -------------------------------------------------------------------------------- 1 | 1 => int a; 2 | 3 | <<< ++a + ++a + a >>>; 4 | -------------------------------------------------------------------------------- /src/test/01-Basic/69.ck.disabled: -------------------------------------------------------------------------------- 1 | class X 2 | { 3 | int i; 4 | } 5 | 6 | public class Y 7 | { 8 | X x; 9 | } 10 | -------------------------------------------------------------------------------- /src/test/01-Basic/70.ck.disabled: -------------------------------------------------------------------------------- 1 | class X 2 | { 3 | float f; 4 | } 5 | 6 | public class Z 7 | { 8 | X x; 9 | } 10 | -------------------------------------------------------------------------------- /src/test/01-Basic/71.ck.disabled: -------------------------------------------------------------------------------- 1 | Y y; 2 | Z z; 3 | <<< y.x.i, z.x.f >>>; 4 | -------------------------------------------------------------------------------- /src/test/01-Basic/73.ck.disabled: -------------------------------------------------------------------------------- 1 | <<< "fail" >>>; -------------------------------------------------------------------------------- /src/test/01-Basic/74.ck: -------------------------------------------------------------------------------- 1 | // re: https://lists.cs.princeton.edu/pipermail/chuck-users/2015-May/007919.html 2 | { 3 | Noise n[1] => Pan2 p => dac; 4 | p.gain(0.1); 5 | second => now; 6 | } 7 | 8 | <<< "success" >>>; 9 | -------------------------------------------------------------------------------- /src/test/01-Basic/75.ck: -------------------------------------------------------------------------------- 1 | // Tests https://github.com/ccrma/chuck/issues/36 2 | 3 | null @=> string str; 4 | 5 | <<< str >>>; 6 | 7 | <<< "success" >>>; 8 | -------------------------------------------------------------------------------- /src/test/01-Basic/76.ck: -------------------------------------------------------------------------------- 1 | 2 | null @=> string str; 3 | null @=> Object obj; 4 | <<< str, obj, null, 0 >>>; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/01-Basic/80.ck: -------------------------------------------------------------------------------- 1 | [3, 0] @=> int arr[]; 2 | <<< arr[0] >>>; 3 | <<< arr[1] >>>; 4 | // arr out of bounds 5 | <<< arr[2] >>>; -------------------------------------------------------------------------------- /src/test/01-Basic/80.txt: -------------------------------------------------------------------------------- 1 | 3 :(int) 2 | 0 :(int) 3 | [chuck]:(EXCEPTION) ArrayOutofBounds: on line[5] in shred[id=1:01-Basic/80.ck] index[2] 4 | -------------------------------------------------------------------------------- /src/test/01-Basic/81.ck: -------------------------------------------------------------------------------- 1 | int arr[]; 2 | // arr null exception 3 | <<< arr[0] >>>; -------------------------------------------------------------------------------- /src/test/01-Basic/81.txt: -------------------------------------------------------------------------------- 1 | [chuck]:(EXCEPTION) NullPointer: (array access) on line[3] in shred[id=1:01-Basic/81.ck] 2 | -------------------------------------------------------------------------------- /src/test/01-Basic/82.ck: -------------------------------------------------------------------------------- 1 | int arr[]; 2 | // null exception 3 | 3 => arr["foo"]; 4 | -------------------------------------------------------------------------------- /src/test/01-Basic/82.txt: -------------------------------------------------------------------------------- 1 | [chuck]:(EXCEPTION) NullPointer: (map access) on line[3] in shred[id=1:01-Basic/82.ck] 2 | -------------------------------------------------------------------------------- /src/test/01-Basic/83.ck: -------------------------------------------------------------------------------- 1 | [[0, 1],[2, 3, 4]] @=> int arr[][]; 2 | <<< arr[0][0] >>>; 3 | <<< arr[1][1] >>>; 4 | // arr out of bounds 5 | <<< arr[2][0] >>>; 6 | -------------------------------------------------------------------------------- /src/test/01-Basic/83.txt: -------------------------------------------------------------------------------- 1 | 0 :(int) 2 | 3 :(int) 3 | [chuck]:(EXCEPTION) ArrayOutofBounds: on line[5] in shred[id=1:01-Basic/83.ck] index[2] 4 | -------------------------------------------------------------------------------- /src/test/01-Basic/84.ck: -------------------------------------------------------------------------------- 1 | int arr[][]; 2 | // null exception 3 | <<< arr[1][2] >>>; 4 | -------------------------------------------------------------------------------- /src/test/01-Basic/84.txt: -------------------------------------------------------------------------------- 1 | [chuck]:(EXCEPTION) NullPointer: (array access) on line[3] in shred[id=1:01-Basic/84.ck] 2 | [chuck]:(EXCEPTION) ...(array dimension where exception occurred: 1 of 2) 3 | -------------------------------------------------------------------------------- /src/test/01-Basic/85.ck: -------------------------------------------------------------------------------- 1 | TriOsc @ t; 2 | // null pointer exception 3 | t => dac; 4 | -------------------------------------------------------------------------------- /src/test/01-Basic/85.txt: -------------------------------------------------------------------------------- 1 | [chuck]:(EXCEPTION) NullPointer: (UGen link) on line[3] in shred[id=1:01-Basic/85.ck] 2 | -------------------------------------------------------------------------------- /src/test/01-Basic/86.txt: -------------------------------------------------------------------------------- 1 | 1 :(int) 2 | 1 :(int) 3 | 1 :(int) 4 | 1 :(int) 5 | inf -inf 6 | 1 :(int) 7 | -------------------------------------------------------------------------------- /src/test/01-Basic/87.txt: -------------------------------------------------------------------------------- 1 | 1 :(int) 2 | 1 :(int) 3 | 1 :(int) 4 | 1 :(int) 5 | 1 1 1 6 | 1 1 1 1 7 | 1 1 8 | 1 1 9 | 1 0.000000 10 | 11 | [chuck](VM): DivideByZeroException: on line[23] in shred[id=1:01-Basic/87.ck] 12 | -------------------------------------------------------------------------------- /src/test/01-Basic/88.ck: -------------------------------------------------------------------------------- 1 | 1 => int i; 2 | 3 | // integer div-by-zero 4 | 0 5 | /=> i; 6 | -------------------------------------------------------------------------------- /src/test/01-Basic/88.txt: -------------------------------------------------------------------------------- 1 | [chuck]:(EXCEPTION) DivideByZero: on line[4] in shred[id=1:01-Basic/88.ck] 2 | -------------------------------------------------------------------------------- /src/test/01-Basic/89.ck: -------------------------------------------------------------------------------- 1 | string s; 2 | 3 | <<< s.charAt(0) >>>; 4 | -------------------------------------------------------------------------------- /src/test/01-Basic/89.txt: -------------------------------------------------------------------------------- 1 | [chuck]:(EXCEPTION) IndexOutOfBounds: '0' on line[3] in shred[id=1:01-Basic/89.ck] 2 | -------------------------------------------------------------------------------- /src/test/01-Basic/90.ck: -------------------------------------------------------------------------------- 1 | null @=> string s; 2 | 3 | 4 | s.charAt(0); 5 | -------------------------------------------------------------------------------- /src/test/01-Basic/90.txt: -------------------------------------------------------------------------------- 1 | [chuck]:(EXCEPTION) NullPointer: on line[4] in shred[id=1:01-Basic/90.ck] 2 | -------------------------------------------------------------------------------- /src/test/01-Basic/91.ck: -------------------------------------------------------------------------------- 1 | 2 | // test handling of commas in array subscripts 3 | // crashes in v1.3.5.2 and earlier 4 | 5 | int a[1]; 6 | a[1,1] => int b; 7 | -------------------------------------------------------------------------------- /src/test/01-Basic/91.txt: -------------------------------------------------------------------------------- 1 | 91.ck:6:3: error: [..., ...] is invalid subscript syntax. 2 | [6] a[1,1] => int b; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/01-Basic/95.ck: -------------------------------------------------------------------------------- 1 | // comma-separated array declarations 2 | int x[1], y[2]; 3 | // set a value 4 | 3 => y[1]; 5 | // print 6 | <<< y[1] >>>; 7 | 8 | // 1.4.1.2 (ge) | added fall 2022 -------------------------------------------------------------------------------- /src/test/01-Basic/95.txt: -------------------------------------------------------------------------------- 1 | 3 :(int) 2 | -------------------------------------------------------------------------------- /src/test/01-Basic/96.ck: -------------------------------------------------------------------------------- 1 | // comma-separated declarations; mixed 2 | int w, x[10], y[2][2], z; 3 | 4 | // set values 5 | 1 => w; 6 | 2 => x[0]; 7 | 3 => y[1][1]; 8 | 9 | // print 10 | <<< w, x[0], y[1][1] >>>; 11 | 12 | // 1.4.1.2 (ge) | added fall 2022 13 | -------------------------------------------------------------------------------- /src/test/01-Basic/96.txt: -------------------------------------------------------------------------------- 1 | 1 2 3 2 | -------------------------------------------------------------------------------- /src/test/01-Basic/97.ck: -------------------------------------------------------------------------------- 1 | // multi-dimensional comma-separated array literals 2 | [ [1,2,3], [1,2,3] ] @=> int x[][]; 3 | 4 | // print 5 | <<< x[0][0], x[1][1], x[0][2] >>>; 6 | 7 | // 1.4.1.2 (ge) | added fall 2022 8 | -------------------------------------------------------------------------------- /src/test/01-Basic/97.txt: -------------------------------------------------------------------------------- 1 | 1 2 3 2 | -------------------------------------------------------------------------------- /src/test/01-Basic/99.ck: -------------------------------------------------------------------------------- 1 | // this is a test of cleaning up multi-dim local array objects 2 | // floating point version of test #98 (see 98.ck for details) 3 | fun void test() 4 | { 5 | [ [1.0,2.0,3.0], [1.0,2.0,3.0] ] @=> float arr[][]; 6 | } 7 | 8 | test(); 9 | test(); 10 | 11 | // hopefully we get here! 12 | <<< "success" >>>; 13 | 14 | -------------------------------------------------------------------------------- /src/test/02-UGens/ADSR.ck: -------------------------------------------------------------------------------- 1 | ADSR u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/BPF.ck: -------------------------------------------------------------------------------- 1 | BPF u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/BRF.ck: -------------------------------------------------------------------------------- 1 | BRF u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/BandedWG.ck: -------------------------------------------------------------------------------- 1 | BandedWG u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/BeeThree.ck: -------------------------------------------------------------------------------- 1 | BeeThree u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/BiQuad.ck: -------------------------------------------------------------------------------- 1 | BiQuad u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/Blit.ck: -------------------------------------------------------------------------------- 1 | Blit u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/BlitSaw.ck: -------------------------------------------------------------------------------- 1 | BlitSaw u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/BlitSquare.ck: -------------------------------------------------------------------------------- 1 | BlitSquare u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/BlowBotl.ck: -------------------------------------------------------------------------------- 1 | BlowBotl u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/BlowHole.ck: -------------------------------------------------------------------------------- 1 | BlowHole u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/Bowed.ck: -------------------------------------------------------------------------------- 1 | Bowed u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/Brass.ck: -------------------------------------------------------------------------------- 1 | Brass u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/Chorus.ck: -------------------------------------------------------------------------------- 1 | Chorus u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/Clarinet.ck: -------------------------------------------------------------------------------- 1 | Clarinet u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/CurveTable.ck: -------------------------------------------------------------------------------- 1 | CurveTable u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/Delay.ck: -------------------------------------------------------------------------------- 1 | Delay u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/DelayA.ck: -------------------------------------------------------------------------------- 1 | DelayA u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/DelayL.ck: -------------------------------------------------------------------------------- 1 | DelayL u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/Echo.ck: -------------------------------------------------------------------------------- 1 | Echo u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/Envelope.ck: -------------------------------------------------------------------------------- 1 | Envelope u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/FM.ck.disabled: -------------------------------------------------------------------------------- 1 | FM u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/FMVoices.ck: -------------------------------------------------------------------------------- 1 | FMVoices u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/Filter.ck.disabled: -------------------------------------------------------------------------------- 1 | Filter u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/Flute.ck: -------------------------------------------------------------------------------- 1 | Flute u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/FullRect.ck: -------------------------------------------------------------------------------- 1 | FullRect u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/Gain.ck: -------------------------------------------------------------------------------- 1 | Gain u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/GenX.ck: -------------------------------------------------------------------------------- 1 | GenX u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/HPF.ck: -------------------------------------------------------------------------------- 1 | HPF u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/HalfRect.ck: -------------------------------------------------------------------------------- 1 | HalfRect u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/HevyMetl.ck: -------------------------------------------------------------------------------- 1 | HevyMetl u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/Impulse.ck: -------------------------------------------------------------------------------- 1 | Impulse u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/JCRev.ck: -------------------------------------------------------------------------------- 1 | JCRev u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/LPF.ck: -------------------------------------------------------------------------------- 1 | LPF u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/LiSa.ck: -------------------------------------------------------------------------------- 1 | LiSa u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/Mandolin.ck: -------------------------------------------------------------------------------- 1 | Mandolin u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/Mix2.ck: -------------------------------------------------------------------------------- 1 | Mix2 u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/ModalBar.ck: -------------------------------------------------------------------------------- 1 | ModalBar u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/Modulate.ck: -------------------------------------------------------------------------------- 1 | Modulate u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/Moog.ck: -------------------------------------------------------------------------------- 1 | Moog u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/NRev.ck: -------------------------------------------------------------------------------- 1 | NRev u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/Noise.ck: -------------------------------------------------------------------------------- 1 | Noise u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/OnePole.ck: -------------------------------------------------------------------------------- 1 | OnePole u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/OneZero.ck: -------------------------------------------------------------------------------- 1 | OneZero u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/PRCRev.ck: -------------------------------------------------------------------------------- 1 | PRCRev u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/Pan2.ck: -------------------------------------------------------------------------------- 1 | Pan2 u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/PercFlut.ck: -------------------------------------------------------------------------------- 1 | PercFlut u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/Phasor.ck: -------------------------------------------------------------------------------- 1 | Phasor u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/PitShift.ck: -------------------------------------------------------------------------------- 1 | PitShift u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/PoleZero.ck: -------------------------------------------------------------------------------- 1 | PoleZero u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/PulseOsc.ck: -------------------------------------------------------------------------------- 1 | PulseOsc u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/ResonZ.ck: -------------------------------------------------------------------------------- 1 | ResonZ u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/Rhodey.ck: -------------------------------------------------------------------------------- 1 | Rhodey u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/SawOsc.ck: -------------------------------------------------------------------------------- 1 | SawOsc u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/Saxofony.ck: -------------------------------------------------------------------------------- 1 | Saxofony u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/Shakers.ck: -------------------------------------------------------------------------------- 1 | Shakers u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/SinOsc.ck: -------------------------------------------------------------------------------- 1 | 2 | SinOsc u => blackhole; 3 | 1::samp => now; 4 | u =< blackhole; 5 | null @=> u; 6 | 7 | <<< "success" >>>; 8 | -------------------------------------------------------------------------------- /src/test/02-UGens/Sitar.ck: -------------------------------------------------------------------------------- 1 | Sitar u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/SndBuf.ck: -------------------------------------------------------------------------------- 1 | SndBuf u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/SqrOsc.ck: -------------------------------------------------------------------------------- 1 | SqrOsc u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/Step.ck: -------------------------------------------------------------------------------- 1 | Step u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/StifKarp.ck: -------------------------------------------------------------------------------- 1 | StifKarp u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/StkInstrument.ck.disabled: -------------------------------------------------------------------------------- 1 | StkInstrument u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/SubNoise.ck: -------------------------------------------------------------------------------- 1 | SubNoise u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/TriOsc.ck: -------------------------------------------------------------------------------- 1 | TriOsc u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/TubeBell.ck: -------------------------------------------------------------------------------- 1 | TubeBell u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/TwoPole.ck: -------------------------------------------------------------------------------- 1 | TwoPole u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/TwoZero.ck: -------------------------------------------------------------------------------- 1 | TwoZero u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/VoicForm.ck.disabled: -------------------------------------------------------------------------------- 1 | VoicForm u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/WarpTable.ck: -------------------------------------------------------------------------------- 1 | WarpTable u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/WaveLoop.ck: -------------------------------------------------------------------------------- 1 | WaveLoop u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/Wurley.ck: -------------------------------------------------------------------------------- 1 | Wurley u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/WvIn-2.ck: -------------------------------------------------------------------------------- 1 | WvIn wav => blackhole; 2 | wav.path("special:dope"); 3 | 1::second => now; 4 | 5 | <<< "success" >>>; -------------------------------------------------------------------------------- /src/test/02-UGens/WvIn.ck: -------------------------------------------------------------------------------- 1 | WvIn u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/WvOut.ck: -------------------------------------------------------------------------------- 1 | WvOut u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/02-UGens/ZeroX.ck: -------------------------------------------------------------------------------- 1 | ZeroX u => blackhole; 2 | 1::samp => now; 3 | u =< blackhole; 4 | null @=> u; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/03-Modules/02-read-float-data.txt: -------------------------------------------------------------------------------- 1 | .1 2.2 3. 2 | 8e-3 9e5 -2.2 3 | -4e-4 4 | 5 | -------------------------------------------------------------------------------- /src/test/03-Modules/02-read-float.txt: -------------------------------------------------------------------------------- 1 | 0.1 2 | 2.2 3 | 3 4 | 0.008 5 | 900000 6 | -2.2 7 | -0.0004 8 | -------------------------------------------------------------------------------- /src/test/03-Modules/03-read-int-data.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/src/test/03-Modules/03-read-int-data.txt -------------------------------------------------------------------------------- /src/test/03-Modules/03-read-int.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/src/test/03-Modules/03-read-int.txt -------------------------------------------------------------------------------- /src/test/03-Modules/04-read-line-data.txt: -------------------------------------------------------------------------------- 1 | 1 2 3 2 | a b c 3 | -------------------------------------------------------------------------------- /src/test/03-Modules/04-read-line.txt: -------------------------------------------------------------------------------- 1 | 1 2 3 2 | a b c 3 | -------------------------------------------------------------------------------- /src/test/03-Modules/05-read-str-data.txt: -------------------------------------------------------------------------------- 1 | foo bar 2 | rakakakakaka 3 | 1 2 three 4 | -------------------------------------------------------------------------------- /src/test/03-Modules/05-read-str.txt: -------------------------------------------------------------------------------- 1 | foo 2 | bar 3 | rakakakakaka 4 | 1 5 | 2 6 | three 7 | -------------------------------------------------------------------------------- /src/test/04-Stress/func-call-1.ck: -------------------------------------------------------------------------------- 1 | // #2024-func-call-update verification 2 | 3 | // test custom non-class function 4 | fun void foo( int a ) { } 5 | 6 | // call it 7 | foo(1); 8 | // get the function as value only 9 | foo; 10 | 11 | // check for stack overflow 12 | repeat(100000) foo(2); 13 | repeat(100000) foo; 14 | 15 | // if we get here we are ok 16 | <<< "success" >>>; -------------------------------------------------------------------------------- /src/test/04-Stress/func-call-2-static.ck: -------------------------------------------------------------------------------- 1 | // #2024-func-call-update verification 2 | 3 | // test static function 4 | Machine.refcount; 5 | 6 | // check for stack overflow 7 | repeat(1000000) 8 | Machine.refcount; 9 | 10 | // if we get here, ok 11 | <<< "success" >>>; 12 | -------------------------------------------------------------------------------- /src/test/04-Stress/func-call-4-vec.ck: -------------------------------------------------------------------------------- 1 | // #2024-func-call-update verification 2 | 3 | // test special prim-object hybrids 4 | vec2 v; 5 | 6 | // test for stack overflow 7 | repeat(1000000) v.dot; 8 | 9 | // if we get here, ok 10 | <<< "success" >>>; 11 | -------------------------------------------------------------------------------- /src/test/04-Stress/func-call-7-class-m.ck: -------------------------------------------------------------------------------- 1 | // #2024-func-call-update verification 2 | 3 | 0 => int N; 4 | 5 | // test calling member function from within class definition 6 | class Foo 7 | { 8 | fun void foo() { N++; bar(); } 9 | fun void bar() { if( N >= 100000 ) <<< "success" >>>; } 10 | } 11 | 12 | // test for stack overflow 13 | repeat(100000) { Foo foo; foo.foo(); } 14 | -------------------------------------------------------------------------------- /src/test/04-Stress/func-call-8-class-s.ck: -------------------------------------------------------------------------------- 1 | // #2024-func-call-update verification 2 | 3 | 0 => int N; 4 | 5 | // test calling member function from within class definition 6 | class Foo 7 | { 8 | fun static void foo() { N++; bar(); } 9 | fun static void bar() { if( N >= 100000 ) <<< "success" >>>; } 10 | } 11 | 12 | // test for stack overflow 13 | repeat(100000) Foo.foo(); 14 | -------------------------------------------------------------------------------- /src/test/04-Stress/static-member-access.ck: -------------------------------------------------------------------------------- 1 | // test static non-function members 2 | Math.PI; 3 | 4 | // test for stack overflow 5 | repeat(1000000) Math.PI; 6 | 7 | class Foo 8 | { 9 | static int bar; 10 | } 11 | 12 | // test for stack overflow 13 | repeat(1000000) Foo.bar; 14 | 15 | // if we get here, ok 16 | <<< "success" >>>; 17 | -------------------------------------------------------------------------------- /src/test/05-Global/01.ck: -------------------------------------------------------------------------------- 1 | // 01.ck : test assignment 2 | 3 | // assignment 4 | 1 => global int x; 5 | 6 | // test 7 | if( x == 1 ) <<<"success">>>; 8 | -------------------------------------------------------------------------------- /src/test/05-Global/01b.ck: -------------------------------------------------------------------------------- 1 | // 01b.ck : test assignment (deprecated) 2 | 3 | // assignment 4 | 1 => external int x; 5 | 6 | // test 7 | if( x == 1 ) <<<"success">>>; 8 | -------------------------------------------------------------------------------- /src/test/05-Global/01b.txt: -------------------------------------------------------------------------------- 1 | "success" :(string) 2 | -------------------------------------------------------------------------------- /src/test/05-Global/02.ck: -------------------------------------------------------------------------------- 1 | // 02.ck : test float assignment 2 | 3 | // float assignment 4 | 2.2 => global float y; 5 | 6 | // test 7 | if( y == 2.2 ) <<<"success">>>; 8 | -------------------------------------------------------------------------------- /src/test/05-Global/07.ck: -------------------------------------------------------------------------------- 1 | // 07.ck : division dur / dur -> float 2 | 3 | 1::ms / 1::samp => global float ratio; 4 | 5 | <<<"success">>>; 6 | -------------------------------------------------------------------------------- /src/test/05-Global/08.ck: -------------------------------------------------------------------------------- 1 | // 08.ck : variable lookup 2 | 3 | // assignment 4 | 1 => global int x; 5 | 6 | // increment 7 | x + 1 => x; 8 | 9 | if( x == 2 ) <<<"success">>>; 10 | -------------------------------------------------------------------------------- /src/test/05-Global/09.ck: -------------------------------------------------------------------------------- 1 | // 09.ck : +=> increment and assign 2 | 3 | // initialize 4 | 1 => global int x; 5 | 6 | // increment by 2 7 | 2 +=> x; 8 | 9 | if( x == 3 ) <<<"success">>>; 10 | -------------------------------------------------------------------------------- /src/test/05-Global/10.ck: -------------------------------------------------------------------------------- 1 | // 10.ck : void function 2 | 3 | // the function 4 | fun void f() 5 | { 6 | 1 + 2 => global int x; 7 | } 8 | 9 | // call it 10 | f(); 11 | 12 | <<<"success">>>; 13 | -------------------------------------------------------------------------------- /src/test/05-Global/101.ck: -------------------------------------------------------------------------------- 1 | class myEvent extends Event 2 | { 3 | int myInt; 4 | } 5 | 6 | global Event e; 7 | fun void foo() 8 | { 9 | global myEvent e; 10 | } -------------------------------------------------------------------------------- /src/test/05-Global/101.txt: -------------------------------------------------------------------------------- 1 | 101.ck:9:5: error: global Event 'e' has different type 'myEvent' than already existing global Event of the same name 2 | [9] global myEvent e; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/05-Global/102a.ck: -------------------------------------------------------------------------------- 1 | global Foo foo; 2 | 3 | foo.bar(); 4 | 5 | public class Foo 6 | { 7 | int n; 8 | fun void bar() 9 | { 10 | <<< "no i'm foo" >>>; 11 | n++; 12 | } 13 | } 14 | 15 | Machine.add( me.dir() + "102b.ck" ); -------------------------------------------------------------------------------- /src/test/05-Global/102a.txt: -------------------------------------------------------------------------------- 1 | "no i'm foo" :(string) 2 | [chuck]: (VM) sporking incoming shred: 2 (102b.ck)... 3 | "no i'm foo" :(string) 4 | "no i'm foo" :(string) 5 | 3 :(int) 6 | -------------------------------------------------------------------------------- /src/test/05-Global/102b.ck: -------------------------------------------------------------------------------- 1 | global Foo foo; 2 | 3 | foo.bar(); 4 | foo.bar(); 5 | 6 | <<< foo.n >>>; -------------------------------------------------------------------------------- /src/test/05-Global/102b.txt: -------------------------------------------------------------------------------- 1 | 102b.ck:1:8: error: undefined type 'Foo'... 2 | [1] global Foo foo; 3 | ^ 4 | 102b.ck:1:1: error: ...in declaration 5 | [1] global Foo foo; 6 | ^ 7 | -------------------------------------------------------------------------------- /src/test/05-Global/103a.ck: -------------------------------------------------------------------------------- 1 | global MidiMsg foo; 2 | 3 | 64 => foo.data1; 4 | 5 | Machine.add( me.dir() + "103b.ck" ); 6 | -------------------------------------------------------------------------------- /src/test/05-Global/103a.txt: -------------------------------------------------------------------------------- 1 | [chuck]: (VM) sporking incoming shred: 2 (103b.ck)... 2 | 64 :(int) 3 | -------------------------------------------------------------------------------- /src/test/05-Global/103b.ck: -------------------------------------------------------------------------------- 1 | global MidiMsg foo; 2 | 3 | 4 | <<< foo.data1 >>>; 5 | -------------------------------------------------------------------------------- /src/test/05-Global/103b.txt: -------------------------------------------------------------------------------- 1 | 0 :(int) 2 | -------------------------------------------------------------------------------- /src/test/05-Global/104a.ck: -------------------------------------------------------------------------------- 1 | global MidiMsg foo; 2 | 3 | 64 => foo.data1; 4 | 5 | Machine.add( me.dir() + "104b.ck" ); -------------------------------------------------------------------------------- /src/test/05-Global/104a.txt: -------------------------------------------------------------------------------- 1 | 104b.ck:1:1: error: global Object 'foo' has different type 'HidMsg' than already existing global Object of the same name 2 | [1] global HidMsg foo; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/05-Global/104b.ck: -------------------------------------------------------------------------------- 1 | global HidMsg foo; 2 | <<< "success" >>>; 3 | -------------------------------------------------------------------------------- /src/test/05-Global/105.ck: -------------------------------------------------------------------------------- 1 | // 1.5.2.2 2 | // make sure default ctor is called (was crashing on cleanup) 3 | global OscIn aaa; 4 | // try a second one 5 | global OscIn bbb; 6 | // try a non-global 7 | OscIn cc; 8 | 9 | <<< "success" >>>; 10 | -------------------------------------------------------------------------------- /src/test/05-Global/11.ck: -------------------------------------------------------------------------------- 1 | // 11.ck : function with return type 2 | 3 | // function 4 | fun float f() 5 | { 6 | return 1.0; 7 | } 8 | 9 | // call 10 | f() => global float x; 11 | 12 | // test 13 | if( x == 1.0 ) <<<"success">>>; 14 | -------------------------------------------------------------------------------- /src/test/05-Global/113.ck: -------------------------------------------------------------------------------- 1 | // comma-separated declarations; references; global 2 | global Gain h, g; 3 | 4 | // NOTE: null references doesn't seem to be possible for global 5 | // global Gain @ h, g; 6 | 7 | // print 8 | <<< "success" >>>; 9 | 10 | // 1.4.1.2 (ge) | added fall 2022 11 | -------------------------------------------------------------------------------- /src/test/05-Global/16.ck: -------------------------------------------------------------------------------- 1 | // 16.ck : multi-dimensional array 2 | 3 | // declare int array 2x2x2 4 | global int a[2][2][2]; 5 | // assign 6 | 4 => a[0][0][1]; 7 | 8 | // test 9 | if( a[0][0][1] == 4 ) <<<"success">>>; 10 | -------------------------------------------------------------------------------- /src/test/05-Global/17.ck: -------------------------------------------------------------------------------- 1 | // 17.ck : partial array 2 | 3 | // declare int array 2x2 4 | global int x[2][2]; 5 | 6 | // assign 7 | 2 => x[1][1]; 8 | 9 | // assign partial array reference to 'y' 10 | x[1] @=> global int y[]; 11 | 12 | // test 13 | if( y[1] == 2 ) <<<"success">>>; 14 | -------------------------------------------------------------------------------- /src/test/05-Global/19.ck: -------------------------------------------------------------------------------- 1 | // 19.ck : function that takes array as argument 2 | 3 | // function foo 4 | fun void foo( float a[] ) 5 | { 6 | // use 'a' associative 7 | 10.0 => a["foo"]; 8 | } 9 | 10 | // declare 11 | global float x[10]; 12 | 13 | // call foo 14 | foo( x ); 15 | 16 | // test 17 | if( 10.0 == x["foo"] ) <<<"success">>>; 18 | -------------------------------------------------------------------------------- /src/test/05-Global/20.ck: -------------------------------------------------------------------------------- 1 | // 20.ck : assignment inside functions 2 | 3 | fun int foo( int x ) 4 | { 5 | x => global int a; 6 | return a; 7 | } 8 | 9 | if( foo( 3 ) == 3 ) 10 | <<<"success">>>; 11 | -------------------------------------------------------------------------------- /src/test/05-Global/25.ck: -------------------------------------------------------------------------------- 1 | // 25.ck : array initialization 2 | 3 | // array literal reference assign 4 | [1,2,3] @=> global int x[]; 5 | 6 | // test 7 | if( x[0] != 1 ) 8 | <<<"fail">>>; 9 | else 10 | <<<"success">>>; 11 | -------------------------------------------------------------------------------- /src/test/05-Global/28.ck: -------------------------------------------------------------------------------- 1 | // 28.ck : global variable 2 | 3 | 10 => global int z; 4 | 5 | class X 6 | { 7 | fun void foo() 8 | { 9 | 20 => z; 10 | } 11 | } 12 | 13 | // instantiate a X 14 | X x; 15 | 16 | // call 17 | x.foo(); 18 | 19 | // test 20 | if( z == 20 ) <<<"success">>>; 21 | -------------------------------------------------------------------------------- /src/test/05-Global/55.ck: -------------------------------------------------------------------------------- 1 | // 55.ck : arrays and functions 2 | 3 | // return new array 4 | fun int[][] foo() 5 | { 6 | return [[1,2],[3,4]]; 7 | } 8 | 9 | // return new array 10 | fun int[] bar() 11 | { 12 | return new int[3]; 13 | } 14 | 15 | // call 16 | bar() @=> global int b[]; 17 | 18 | // test 19 | if( foo()[1][1] == 4 && b.size() == 3 ) <<<"success">>>; 20 | -------------------------------------------------------------------------------- /src/test/05-Global/74.ck: -------------------------------------------------------------------------------- 1 | // re: https://lists.cs.princeton.edu/pipermail/chuck-users/2015-May/007919.html 2 | { 3 | Noise n[1] => global Pan2 p => dac; 4 | true => p.buffered; 5 | p.gain(0.1); 6 | second => now; 7 | } 8 | 9 | <<< "success" >>>; 10 | -------------------------------------------------------------------------------- /src/test/05-Global/75.ck: -------------------------------------------------------------------------------- 1 | // Tests https://github.com/ccrma/chuck/issues/36 2 | 3 | null @=> global string str; 4 | 5 | <<< str >>>; 6 | 7 | <<< "success" >>>; 8 | -------------------------------------------------------------------------------- /src/test/05-Global/76.ck: -------------------------------------------------------------------------------- 1 | 2 | null @=> global string str; 3 | null @=> Object obj; 4 | <<< str, obj, null, 0 >>>; 5 | 6 | <<< "success" >>>; 7 | -------------------------------------------------------------------------------- /src/test/05-Global/79.ck: -------------------------------------------------------------------------------- 1 | class Crash extends Chugen { 2 | fun float tick(float v) { 3 | return v; 4 | } 5 | } 6 | 7 | global SinOsc s => Crash c => dac; 8 | true => s.buffered; 9 | 440.0 => s.freq; 10 | 1::second => now; 11 | 12 | <<< "success" >>>; 13 | -------------------------------------------------------------------------------- /src/test/05-Global/79b.ck: -------------------------------------------------------------------------------- 1 | class Crash extends Chugen { 2 | fun float tick(float v) { 3 | return v; 4 | } 5 | } 6 | 7 | global SinOsc s => global Crash c => dac; 8 | true => s.buffered; 9 | 440.0 => s.freq; 10 | 1::second => now; 11 | 12 | <<< "success" >>>; 13 | -------------------------------------------------------------------------------- /src/test/05-Global/80.ck: -------------------------------------------------------------------------------- 1 | [3, 0] @=> global int arr[]; 2 | <<< arr[0] >>>; 3 | <<< arr[1] >>>; 4 | // arr out of bounds 5 | <<< arr[2] >>>; -------------------------------------------------------------------------------- /src/test/05-Global/80.txt: -------------------------------------------------------------------------------- 1 | 3 :(int) 2 | 0 :(int) 3 | [chuck]:(EXCEPTION) ArrayOutofBounds: on line[5] in shred[id=1:05-Global/80.ck] index[2] 4 | -------------------------------------------------------------------------------- /src/test/05-Global/81.ck: -------------------------------------------------------------------------------- 1 | global int arr[]; 2 | // arr null exception 3 | <<< arr[0] >>>; -------------------------------------------------------------------------------- /src/test/05-Global/81.txt: -------------------------------------------------------------------------------- 1 | [chuck]:(EXCEPTION) NullPointer: (array access) on line[3] in shred[id=1:05-Global/81.ck] 2 | -------------------------------------------------------------------------------- /src/test/05-Global/82.ck: -------------------------------------------------------------------------------- 1 | global int arr[]; 2 | // null exception 3 | 3 => arr["foo"]; 4 | -------------------------------------------------------------------------------- /src/test/05-Global/82.txt: -------------------------------------------------------------------------------- 1 | [chuck]:(EXCEPTION) NullPointer: (map access) on line[3] in shred[id=1:05-Global/82.ck] 2 | -------------------------------------------------------------------------------- /src/test/05-Global/83.ck: -------------------------------------------------------------------------------- 1 | [[0, 1],[2, 3, 4]] @=> global int arr[][]; 2 | <<< arr[0][0] >>>; 3 | <<< arr[1][1] >>>; 4 | // arr out of bounds 5 | <<< arr[2][0] >>>; 6 | -------------------------------------------------------------------------------- /src/test/05-Global/83.txt: -------------------------------------------------------------------------------- 1 | 0 :(int) 2 | 3 :(int) 3 | [chuck]:(EXCEPTION) ArrayOutofBounds: on line[5] in shred[id=1:05-Global/83.ck] index[2] 4 | -------------------------------------------------------------------------------- /src/test/05-Global/84.ck: -------------------------------------------------------------------------------- 1 | global int arr[][]; 2 | // null exception 3 | <<< arr[0][0] >>>; 4 | -------------------------------------------------------------------------------- /src/test/05-Global/84.txt: -------------------------------------------------------------------------------- 1 | [chuck]:(EXCEPTION) NullPointer: (array access) on line[3] in shred[id=1:05-Global/84.ck] 2 | [chuck]:(EXCEPTION) ...(array dimension where exception occurred: 1 of 2) 3 | -------------------------------------------------------------------------------- /src/test/05-Global/86.txt: -------------------------------------------------------------------------------- 1 | 1 :(int) 2 | 1 :(int) 3 | 1 :(int) 4 | 1 :(int) 5 | inf -inf 6 | 1 :(int) 7 | -------------------------------------------------------------------------------- /src/test/05-Global/88.ck: -------------------------------------------------------------------------------- 1 | 1 => global int i; 2 | 3 | // integer div-by-zero 4 | 0 5 | /=> i; 6 | -------------------------------------------------------------------------------- /src/test/05-Global/88.txt: -------------------------------------------------------------------------------- 1 | [chuck]:(EXCEPTION) DivideByZero: on line[4] in shred[id=1:05-Global/88.ck] 2 | -------------------------------------------------------------------------------- /src/test/05-Global/89.ck: -------------------------------------------------------------------------------- 1 | global string s; 2 | 3 | <<< s.charAt(0) >>>; 4 | -------------------------------------------------------------------------------- /src/test/05-Global/89.txt: -------------------------------------------------------------------------------- 1 | [chuck]:(EXCEPTION) IndexOutOfBounds: '0' on line[3] in shred[id=1:05-Global/89.ck] 2 | -------------------------------------------------------------------------------- /src/test/05-Global/90.ck: -------------------------------------------------------------------------------- 1 | null @=> global string s; 2 | 3 | 4 | s.charAt(0); 5 | -------------------------------------------------------------------------------- /src/test/05-Global/90.txt: -------------------------------------------------------------------------------- 1 | [chuck]:(EXCEPTION) NullPointer: on line[4] in shred[id=1:05-Global/90.ck] 2 | -------------------------------------------------------------------------------- /src/test/05-Global/91.ck: -------------------------------------------------------------------------------- 1 | 2 | // test handling of commas in array subscripts 3 | // crashes in v1.3.5.2 and earlier 4 | 5 | global int a[1]; 6 | a[1,1] => int b; 7 | -------------------------------------------------------------------------------- /src/test/05-Global/91.txt: -------------------------------------------------------------------------------- 1 | 91.ck:6:3: error: [..., ...] is invalid subscript syntax. 2 | [6] a[1,1] => int b; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/05-Global/95.ck: -------------------------------------------------------------------------------- 1 | // 1.4.1.2 (ge) | added 2 | // to test comma-separated array declarations 3 | global int x[1], y[2]; 4 | 3 => y[1]; 5 | <<< y[1] >>>; 6 | -------------------------------------------------------------------------------- /src/test/05-Global/95.txt: -------------------------------------------------------------------------------- 1 | 3 :(int) 2 | -------------------------------------------------------------------------------- /src/test/05-Global/96.ck: -------------------------------------------------------------------------------- 1 | // comma-separated declarations; mixed; global 2 | global int w, x[10], y[2][2], z; 3 | 4 | // set values 5 | 1 => w; 6 | 2 => x[0]; 7 | 3 => y[1][1]; 8 | 9 | // print 10 | <<< w, x[0], y[1][1] >>>; 11 | 12 | // 1.4.1.2 (ge) | added fall 2022 13 | -------------------------------------------------------------------------------- /src/test/05-Global/96.txt: -------------------------------------------------------------------------------- 1 | 1 2 3 2 | -------------------------------------------------------------------------------- /src/test/05-Global/97.ck: -------------------------------------------------------------------------------- 1 | // multi-dimensional comma-separated array literals; global 2 | [ [1,2,3], [1,2,3] ] @=> global int x[][]; 3 | 4 | // print 5 | <<< x[0][0], x[1][1], x[0][2] >>>; 6 | 7 | // 1.4.1.2 (ge) | added fall 2022 8 | -------------------------------------------------------------------------------- /src/test/05-Global/97.txt: -------------------------------------------------------------------------------- 1 | 1 2 3 2 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-add-assign-decl.ck: -------------------------------------------------------------------------------- 1 | "foo" +=> string s; 2 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-add-assign-decl.txt: -------------------------------------------------------------------------------- 1 | error-add-assign-decl.ck:1:7: error: cannot perform '+=>' on a variable declaration... 2 | [1] "foo" +=> string s; 3 | ^ 4 | error-add-assign-decl.ck: ...(hint: use '=>' instead to initialize the variable) 5 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-after-multiline-string-1.ck: -------------------------------------------------------------------------------- 1 | // test error reporting after a multi-line string literal 2 | // (without trailing one-line comment) 3 | " 4 | multi 5 | line 6 | chuck 7 | string 8 | " => string foo; 9 | 10 | [1,2,3] => int bar[]; // syntax error 11 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-after-multiline-string-1.txt: -------------------------------------------------------------------------------- 1 | error-after-multiline-string-1.ck:10:9: error: cannot resolve operator '=>' on types 'int[]' and 'int[]'... 2 | [10] [1,2,3] => int bar[]; // syntax error 3 | ^ 4 | error-after-multiline-string-1.ck:10:9: error: ...(note: use '@=>' for object reference assignment) 5 | [10] [1,2,3] => int bar[]; // syntax error 6 | ^ 7 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-after-multiline-string-2.ck: -------------------------------------------------------------------------------- 1 | // test error reporting after a multi-line string literal 2 | // (without trailing one-line comment) 3 | " 4 | multi 5 | line 6 | chuck 7 | string 8 | " => string foo; 9 | 10 | [1,2,3] => int bar[]; 11 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-after-multiline-string-2.txt: -------------------------------------------------------------------------------- 1 | error-after-multiline-string-2.ck:10:9: error: cannot resolve operator '=>' on types 'int[]' and 'int[]'... 2 | [10] [1,2,3] => int bar[]; 3 | ^ 4 | error-after-multiline-string-2.ck:10:9: error: ...(note: use '@=>' for object reference assignment) 5 | [10] [1,2,3] => int bar[]; 6 | ^ 7 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-array-assign.ck: -------------------------------------------------------------------------------- 1 | [1,2] @=> int a[0]; 2 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-array-assign.txt: -------------------------------------------------------------------------------- 1 | error-array-assign.ck:1:17: error: cannot assign '@=>' to full array declaration... 2 | [1] [1,2] @=> int a[0]; 3 | ^ 4 | error-array-assign.ck: ...(hint: declare as empty array -- e.g., int a[ ]) 5 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-assign-to-class.ck: -------------------------------------------------------------------------------- 1 | // added chuck-1.5.4.4 2 | 3 | // error case: cannot modify; JCRev as a variable here should be marked as const... 4 | null @=> JCRev; 5 | 6 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-assign-to-class.txt: -------------------------------------------------------------------------------- 1 | error-assign-to-class.ck:4:10: error: cannot modify constant variable 'JCRev' 2 | [4] null @=> JCRev; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-auto-auto.ck: -------------------------------------------------------------------------------- 1 | // auto needs more context than itself 2 | auto foo => auto bar; 3 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-auto-auto.txt: -------------------------------------------------------------------------------- 1 | error-auto-auto.ck:2:1: error: cannot use 'auto' type variable declaration here... 2 | [2] auto foo => auto bar; 3 | ^ 4 | error-auto-auto.ck: (hint: 'auto' requires either initialization or specific contexts) 5 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-auto-decl.ck: -------------------------------------------------------------------------------- 1 | // auto needs initialization to infer type 2 | auto x; 3 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-auto-decl.txt: -------------------------------------------------------------------------------- 1 | error-auto-decl.ck:2:1: error: cannot use 'auto' type variable declaration here... 2 | [2] auto x; 3 | ^ 4 | error-auto-decl.ck: (hint: 'auto' requires either initialization or specific contexts) 5 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-auto-global.ck: -------------------------------------------------------------------------------- 1 | 1 => global auto a; 2 | <<< a, "" >>>; 3 | 4 | [1,2,3] @=> global auto b[]; 5 | <<< b[2], "" >>>; 6 | 7 | [ [1,2,3], [4,5,6] ] @=> global auto c[][]; 8 | <<< c[0][2], "" >>>; 9 | 10 | new SinOsc @=> global auto z; 11 | 440 => z.freq; 12 | <<< z.freq()$int, "" >>>; 13 | 14 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-auto-global.txt: -------------------------------------------------------------------------------- 1 | error-auto-global.ck:1:13: error: unsupported type for global keyword: auto 2 | [1] 1 => global auto a; 3 | ^ 4 | error-auto-global.ck: (supported types: int, float, string, Event, UGen, Object) 5 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-auto-null1.ck: -------------------------------------------------------------------------------- 1 | // auto needs more context than null 2 | null @=> auto foo; 3 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-auto-null1.txt: -------------------------------------------------------------------------------- 1 | error-auto-null1.ck:2:10: error: cannot infer 'auto' type from '@null' type 2 | [2] null @=> auto foo; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-auto-null2.ck: -------------------------------------------------------------------------------- 1 | // auto needs more context than null (=> edition) 2 | null => auto foo; 3 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-auto-null2.txt: -------------------------------------------------------------------------------- 1 | error-auto-null2.ck:2:9: error: cannot infer 'auto' type from '@null' type 2 | [2] null => auto foo; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-auto-null3.ck: -------------------------------------------------------------------------------- 1 | // error on null in ARRAY position 2 | for( auto x : null ) { } 3 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-auto-null3.txt: -------------------------------------------------------------------------------- 1 | error-auto-null3.ck:2:15: error: for( X : ARRAY ) expects ARRAY to be an array 2 | [2] for( auto x : null ) { } 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-auto-void.ck: -------------------------------------------------------------------------------- 1 | // auto needs more context than void 2 | void => auto foo; 3 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-auto-void.txt: -------------------------------------------------------------------------------- 1 | error-auto-void.ck:2:9: error: cannot infer 'auto' type from 'void' type 2 | [2] void => auto foo; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-baseclass-stk1.ck: -------------------------------------------------------------------------------- 1 | StkInstrument fm[3]; 2 | fm[0].freq(30); 3 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-baseclass-stk1.txt: -------------------------------------------------------------------------------- 1 | [chuck]:(EXCEPTION) MethodCalledByAbstractClass: 'StkInstrument' is an abstract class 2 | ...(hint: call the method using a non-abstract subclass) shred[id=1:06-Errors/error-baseclass-stk1.ck] 3 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-baseclass-stk2.ck: -------------------------------------------------------------------------------- 1 | FM fm[3]; 2 | fm[0].freq(30); 3 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-baseclass-stk2.txt: -------------------------------------------------------------------------------- 1 | [chuck]:(EXCEPTION) MethodCalledByAbstractClass: 'FM' is an abstract class 2 | ...(hint: call the method using a non-abstract subclass) shred[id=1:06-Errors/error-baseclass-stk2.ck] 3 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-binary.ck: -------------------------------------------------------------------------------- 1 | 1 + dac; 2 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-binary.txt: -------------------------------------------------------------------------------- 1 | error-binary.ck:1:3: error: cannot perform '+' on object references 2 | [1] 1 + dac; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-blit.txt: -------------------------------------------------------------------------------- 1 | error-blit.ck:29:5: error: undefined variable 'x5' 2 | [29] x5::mss => now; 3 | ^ 4 | error-blit.ck:29:9: error: undefined variable 'mss' 5 | [29] x5::mss => now; 6 | ^ 7 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-cast-to-nonchild.ck: -------------------------------------------------------------------------------- 1 | // error case: verify error when casting to a non-subclass 2 | // related:: 01-Basic/211-cast-to-child.ck 3 | 4 | // a class (not subclass of Event) 5 | class Foo { } 6 | 7 | // an Event 8 | Event e; 9 | 10 | // cast to not subclass 11 | e $ Foo @=> Foo @ f; 12 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-cast-to-nonchild.txt: -------------------------------------------------------------------------------- 1 | error-cast-to-nonchild.ck:11:3: error: invalid cast from 'Event' to 'Foo' 2 | [11] e $ Foo @=> Foo @ f; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-cast.ck: -------------------------------------------------------------------------------- 1 | 5 $ SinOsc; 2 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-cast.txt: -------------------------------------------------------------------------------- 1 | error-cast.ck:1:3: error: invalid cast from 'int' to 'SinOsc' 2 | [1] 5 $ SinOsc; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-class-auto-m.txt: -------------------------------------------------------------------------------- 1 | error-class-auto-m.ck:27:10: error: cannot use 'auto' type for top-level class variables... 2 | [27] 7 => auto m_var; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-class-auto-s.txt: -------------------------------------------------------------------------------- 1 | error-class-auto-s.ck:30:17: error: cannot use 'auto' type for top-level class variables... 2 | [30] 8 => static auto m_var; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-class-def-order.txt: -------------------------------------------------------------------------------- 1 | error-class-def-order.ck:7:9: error: cannot extend incomplete type 'X' 2 | [7] class Y extends X 3 | ^ 4 | error-class-def-order.ck:7:9: error: ...(note: the parent's declaration must precede child's) 5 | [7] class Y extends X 6 | ^ 7 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-const-inc-1.ck: -------------------------------------------------------------------------------- 1 | // error case: incrementing a constant 2 | 1 +=> pi; 3 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-const-inc-1.txt: -------------------------------------------------------------------------------- 1 | error-const-inc-1.ck:2:3: error: cannot chuck/assign '+=>' to 'pi'... 2 | [2] 1 +=> pi; 3 | ^ 4 | error-const-inc-1.ck:2:7: error: ...(reason: 'pi' is a constant, and is not assignable) 5 | [2] 1 +=> pi; 6 | ^ 7 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-const-inc-2.ck: -------------------------------------------------------------------------------- 1 | // error case: modifying/assigning constants 2 | 3 | // uhh let's increment Math.PI by 2 (error) 4 | 2 +=> Math.PI; 5 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-const-inc-2.txt: -------------------------------------------------------------------------------- 1 | error-const-inc-2.ck:4:3: error: cannot chuck/assign '+=>' to 'Math.PI'... 2 | [4] 2 +=> Math.PI; 3 | ^ 4 | error-const-inc-2.ck:4:7: error: ...(reason: 'Math.PI' is a constant, and is not assignable) 5 | [4] 2 +=> Math.PI; 6 | ^ 7 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-const-set-1.ck: -------------------------------------------------------------------------------- 1 | // error case: assigning constants 2 | 3 | // okay let's set pi to 1 (error) 4 | 1 => pi; 5 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-const-set-1.txt: -------------------------------------------------------------------------------- 1 | error-const-set-1.ck:4:3: error: cannot chuck/assign => to 'pi'... 2 | [4] 1 => pi; 3 | ^ 4 | error-const-set-1.ck:4:6: error: ...(reason: 'pi' is a constant, and is not assignable) 5 | [4] 1 => pi; 6 | ^ 7 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-const-set-2.ck: -------------------------------------------------------------------------------- 1 | // error case: assigning constants 2 | 3 | // uhh let's set Math.PI to 1 (error) 4 | 1 => Math.PI; 5 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-const-set-2.txt: -------------------------------------------------------------------------------- 1 | error-const-set-2.ck:4:3: error: cannot chuck/assign '=>' to 'Math.PI'... 2 | [4] 1 => Math.PI; 3 | ^ 4 | error-const-set-2.ck:4:6: error: ...(reason: 'Math.PI' is a constant, and is not assignable) 5 | [4] 1 => Math.PI; 6 | ^ 7 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-ctor-global.ck: -------------------------------------------------------------------------------- 1 | // error case: global Object cannot invoke non-default constructors 2 | global Foo foo(6); 3 | 4 | // public class def 5 | public class Foo 6 | { 7 | fun void Foo( int x ) 8 | { 9 | <<< "constructor:", x >>>; 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/06-Errors/error-ctor-global.txt: -------------------------------------------------------------------------------- 1 | error-ctor-global.ck:2:12: error: 'global' variables cannot invoke non-default constructors... 2 | [2] global Foo foo(6); 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-ctor-return.ck: -------------------------------------------------------------------------------- 1 | // error case: constructors cannot return values 2 | 3 | class Foo 4 | { 5 | fun int Foo() { return 1; } 6 | } 7 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-ctor-return.txt: -------------------------------------------------------------------------------- 1 | error-ctor-return.ck:5:5: error: constructor must return void... 2 | [5] fun int Foo() { return 1; } 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-ctor-static.ck: -------------------------------------------------------------------------------- 1 | // error case: constructors cannot be declared as static 2 | 3 | class Foo 4 | { 5 | fun static void Foo() { } 6 | } 7 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-ctor-static.txt: -------------------------------------------------------------------------------- 1 | error-ctor-static.ck:5:5: error: constructor cannot be declared as 'static'... 2 | [5] fun static void Foo() { } 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-depend-class-func2.ck: -------------------------------------------------------------------------------- 1 | // error case: same as error-depend-class-func.ck but this 2 | // specifically calling bar() on the same line... 3 | 4 | public class Foo 5 | { 6 | bar() => vec2 foo; 7 | 8 | fun vec2 bar() 9 | { 10 | return foo; 11 | } 12 | } 13 | 14 | Foo foo; 15 | <<< foo.foo >>>; 16 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-depend-class-var.ck: -------------------------------------------------------------------------------- 1 | // within class definition of Foo, class member 'myVal' is used before declaration 2 | 3 | // class definition 4 | class Foo 5 | { 6 | // no work -- depends on myVal being initialized 7 | <<< myVal >>>; 8 | 9 | // the dependency 10 | 5 => int myVal; 11 | } 12 | 13 | // should have error'ed out by this point 14 | Foo foo; 15 | 16 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-depend-class-var.txt: -------------------------------------------------------------------------------- 1 | error-depend-class-var.ck:7:9: error: class member 'myVal' is used before declaration 2 | [7] <<< myVal >>>; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-depend-static-func.ck: -------------------------------------------------------------------------------- 1 | 2 | public class Foo 3 | { 4 | bar() => static vec2 foo; 5 | 6 | fun static vec2 bar() 7 | { 8 | return foo; 9 | } 10 | } 11 | 12 | <<< Foo.foo >>>; -------------------------------------------------------------------------------- /src/test/06-Errors/error-depend-var2.ck: -------------------------------------------------------------------------------- 1 | // error case using a global-scope var before declaration 2 | 3 | // the use 4 | <<< a >>>; 5 | 6 | // the decl 7 | int a; 8 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-depend-var2.txt: -------------------------------------------------------------------------------- 1 | error-depend-var2.ck:4:5: error: variable 'a' is used before declaration 2 | [4] <<< a >>>; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-dowhile.ck: -------------------------------------------------------------------------------- 1 | do 2 | { 3 | 4 | }while(dac); 5 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-dowhile.txt: -------------------------------------------------------------------------------- 1 | error-dowhile.ck:4:8: error: invalid type 'DAC' in while condition 2 | [4] }while(dac); 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-dtor-access.ck: -------------------------------------------------------------------------------- 1 | // error case: destructors cannot access values outside the class 2 | 3 | int y; 4 | 5 | class Foo 6 | { 7 | 5 => int x; 8 | 9 | fun @destruct() 10 | { 11 | <<< "destructor called...", y >>>; 12 | } 13 | } 14 | 15 | Foo foo; -------------------------------------------------------------------------------- /src/test/06-Errors/error-dtor-access.txt: -------------------------------------------------------------------------------- 1 | error-dtor-access.ck:11:37: error: cannot access local variable 'y' from within @destruct() 2 | [11] <<< "destructor called...", y >>>; 3 | ^ 4 | error-dtor-access.ck: ...in function 'void Foo.@destruct()' 5 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-empty-bracket.ck: -------------------------------------------------------------------------------- 1 | new SinOsc[ ]; 2 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-empty-bracket.txt: -------------------------------------------------------------------------------- 1 | error-empty-bracket.ck:1:13: syntax error 2 | [1] new SinOsc[ ]; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-empty-comment.ck: -------------------------------------------------------------------------------- 1 | /* empty except for this 2 | comment */ 3 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-empty-comment.txt: -------------------------------------------------------------------------------- 1 | error-empty-comment.ck:2:12: syntax error 2 | [2] comment */ 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-empty-extend.txt: -------------------------------------------------------------------------------- 1 | [chuck]: no such file: 'error-empty-extend.ck' 2 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-empty-file.ck: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ccrma/chuck/375949a8750c8972e7097a0980dca05006161eca/src/test/06-Errors/error-empty-file.ck -------------------------------------------------------------------------------- /src/test/06-Errors/error-empty-file.txt: -------------------------------------------------------------------------------- 1 | error-empty-file.ck:1:1: syntax error 2 | (empty file) 3 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-empty-incomplete.txt: -------------------------------------------------------------------------------- 1 | [chuck]: no such file: 'error-empty-incomplete.ck' 2 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-empty-new-prim.txt: -------------------------------------------------------------------------------- 1 | [chuck]: no such file: 'error-empty-new-prim.ck' 2 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-empty-spaces.ck: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-empty-spaces.txt: -------------------------------------------------------------------------------- 1 | error-empty-spaces.ck:3:8: syntax error 2 | [3] 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-extend.ck: -------------------------------------------------------------------------------- 1 | class I extends int 2 | { 3 | } 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-extend.txt: -------------------------------------------------------------------------------- 1 | error-extend.ck:1:17: error: cannot extend primitive type 'int' 2 | [1] class I extends int 3 | ^ 4 | error-extend.ck: ...(primitive types: 'int', 'float', 'time', 'dur', 'vec3', etc.) 5 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-func-ambiguous.txt: -------------------------------------------------------------------------------- 1 | error-func-ambiguous.ck:19:1: error: call to 'foo' is ambiguous... 2 | [19] foo( bar, bar ); 3 | ^ 4 | candidate function: 5 | foo( Object a, UGen b ) { ... } 6 | 7 | candidate function: 8 | foo( UGen a, Object b ) { ... } 9 | 10 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-incomplete.ck: -------------------------------------------------------------------------------- 1 | SinOsc @ 2 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-incomplete.txt: -------------------------------------------------------------------------------- 1 | error-incomplete.ck:1:10: syntax error 2 | [1] SinOsc @ 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-multi-decl-assign1.ck: -------------------------------------------------------------------------------- 1 | 1 => int a, b, c; 2 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-multi-decl-assign1.txt: -------------------------------------------------------------------------------- 1 | error-multi-decl-assign1.ck:1:6: error: cannot '=>' from/to a multi-variable declaration 2 | [1] 1 => int a, b, c; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-multi-decl-assign2.ck: -------------------------------------------------------------------------------- 1 | [5.0] => auto a[], b[]; 2 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-multi-decl-assign2.txt: -------------------------------------------------------------------------------- 1 | error-multi-decl-assign2.ck:1:10: error: cannot '=>' from/to a multi-variable declaration 2 | [1] [5.0] => auto a[], b[]; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-new-prim.ck: -------------------------------------------------------------------------------- 1 | new int; 2 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-new-prim.txt: -------------------------------------------------------------------------------- 1 | error-new-prim.ck:1:5: error: cannot use 'new' on primitive type 'int'... 2 | [1] new int; 3 | ^ 4 | error-new-prim.ck: (primitive types: 'int', 'float', 'time', 'dur', 'vec3', etc.) 5 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-no-memb1.txt: -------------------------------------------------------------------------------- 1 | error-no-memb1.ck:17:17: error: class 'Math' has no member 'random3' 2 | [17] hi[Math.random3(0,hi.size()-1)] ) => s.freq; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-no-memb2.ck: -------------------------------------------------------------------------------- 1 | SinOsc foo => dac; 2 | 3 | foo.test(); 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-no-memb2.txt: -------------------------------------------------------------------------------- 1 | error-no-memb2.ck:3:5: error: class 'SinOsc' has no member 'test' 2 | [3] foo.test(); 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-no-type.ck: -------------------------------------------------------------------------------- 1 | new Foo; 2 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-no-type.txt: -------------------------------------------------------------------------------- 1 | error-no-type.ck:1:5: error: undefined type 'Foo'... 2 | [1] new Foo; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-nspc-no-crash.txt: -------------------------------------------------------------------------------- 1 | error-nspc-no-crash.ck:7:1: error: undefined variable 'x' 2 | [7] x; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-oneline.txt: -------------------------------------------------------------------------------- 1 | error-oneline.ck:1:566: error: 's' has already been defined in the same scope 2 | [1] ...::ms => now; } Blit s => ADSR e => JCRev r => dac; .5 => s.gain; .05... 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-op-overload-child-1.ck: -------------------------------------------------------------------------------- 1 | // test: this should compiler error, since SinOsc is a child of UGen 2 | // and => is already defined for UGen => UGen 3 | fun void @operator =>( SinOsc lhs, SinOsc rhs ) 4 | { 5 | <<< "cannot get here" >>>; 6 | } 7 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-op-overload-child-1.txt: -------------------------------------------------------------------------------- 1 | error-op-overload-child-1.ck:3:20: error: binary operator '=>' already overloaded on types 'SinOsc' and 'SinOsc' (or their parents)... 2 | [3] fun void @operator =>( SinOsc lhs, SinOsc rhs ) 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-op-overload-child-2.ck: -------------------------------------------------------------------------------- 1 | // test: this should compiler error, since SinOsc and NRev are 2 | // children of UGen and => is already defined for UGen => UGen 3 | fun void @operator =>( SinOsc lhs, NRev rhs ) 4 | { 5 | <<< "cannot get here" >>>; 6 | } 7 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-op-overload-child-2.txt: -------------------------------------------------------------------------------- 1 | error-op-overload-child-2.ck:3:20: error: binary operator '=>' already overloaded on types 'SinOsc' and 'NRev' (or their parents)... 2 | [3] fun void @operator =>( SinOsc lhs, NRev rhs ) 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-op-overload-kind.ck: -------------------------------------------------------------------------------- 1 | fun void @operator ~( int a, int b ) 2 | { 3 | } 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-op-overload-kind.txt: -------------------------------------------------------------------------------- 1 | error-op-overload-kind.ck:1:20: error: operator '~' cannot be overloaded as binary operator... 2 | [1] fun void @operator ~( int a, int b ) 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-op-overload-plus.ck: -------------------------------------------------------------------------------- 1 | // error case: should not be able to overload reserved overloading 2 | // e.g., int + int 3 | 4 | // what could possibly go wrong 5 | fun int @operator +( int lhs, int rhs ) 6 | { 7 | // we live in a chaotic world 8 | return lhs - rhs; 9 | } 10 | 11 | // should get here 12 | <<< 1 + 2 >>>; 13 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-op-overload-plus.txt: -------------------------------------------------------------------------------- 1 | error-op-overload-plus.ck:5:19: error: binary operator '+' already overloaded on types 'int' and 'int' (or their parents)... 2 | [5] fun int @operator +( int lhs, int rhs ) 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-op-overload-pre.ck: -------------------------------------------------------------------------------- 1 | // test 2 | fun void @operator ++( int n ) 3 | { 4 | <<< "shouldn't get here..." >>>; 5 | } 6 | 7 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-op-overload-pre.txt: -------------------------------------------------------------------------------- 1 | error-op-overload-pre.ck:2:20: error: unary (prefix) operator '++' already overloaded on type 'int' (or its parent)... 2 | [2] fun void @operator ++( int n ) 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-overload-class.ck: -------------------------------------------------------------------------------- 1 | // related: https://github.com/ccrma/chuck/issues/356 2 | 3 | class Foo 4 | { 5 | fun void bar() 6 | { 7 | } 8 | 9 | fun void bar() 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-overload-class.txt: -------------------------------------------------------------------------------- 1 | error-overload-class.ck:9:5: error: cannot overload function with identical arguments... 2 | [9] fun void bar() 3 | ^ 4 | |- 'void Foo.bar()' already defined elsewhere 5 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-overload-func.ck: -------------------------------------------------------------------------------- 1 | // https://github.com/ccrma/chuck/issues/356 2 | 3 | fun void bar() 4 | { } 5 | 6 | fun void bar() 7 | { } 8 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-overload-func.txt: -------------------------------------------------------------------------------- 1 | error-overload-func.ck:6:1: error: cannot overload function with identical arguments... 2 | [6] fun void bar() 3 | ^ 4 | |- 'void bar()' already defined elsewhere 5 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-public-class-ext-var1.txt: -------------------------------------------------------------------------------- 1 | error-public-class-ext-var1.ck:21:13: error: cannot access local variable 'foo' from within a public class 2 | [21] <<< foo + 5 >>>; 3 | ^ 4 | error-public-class-ext-var1.ck: ...in function 'void X.go()' 5 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-public-class-ext-var2.txt: -------------------------------------------------------------------------------- 1 | error-public-class-ext-var2.ck:12:9: error: cannot access local variable 'foo' from within a public class 2 | [12] <<< foo + 5 >>>; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-public-class-func.txt: -------------------------------------------------------------------------------- 1 | error-public-class-func.ck:15:5: error: cannot call local function 'foo()' from within a public class 2 | [15] foo(); 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-return-if-no-else.ck: -------------------------------------------------------------------------------- 1 | // not all control paths return 2 | // IF without an ELSE clause, for example 3 | 4 | fun float foo( int v ) 5 | { 6 | if( v == 1 ) 7 | { 8 | return 1; 9 | } 10 | else if( v == 2 ) 11 | { 12 | return 2; 13 | } 14 | 15 | // ok if uncommented 16 | // return 3; 17 | } 18 | 19 | <<< foo( 1 ) >>>; 20 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-return-if-no-else.txt: -------------------------------------------------------------------------------- 1 | error-return-if-no-else.ck:4:5: error: not all control paths in 'fun float foo( int v )' return a value 2 | [4] fun float foo( int v ) 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-return-missing-val.ck: -------------------------------------------------------------------------------- 1 | // error case: missing return value 2 | 3 | fun float foo() 4 | { 5 | // missing 6 | return; 7 | } 8 | 9 | <<< foo() >>>; 10 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-return-missing-val.txt: -------------------------------------------------------------------------------- 1 | error-return-missing-val.ck:6:5: error: function 'float foo()' was defined with return type 'float' -- but returning type 'void' 2 | [6] return; 3 | ^ 4 | error-return-missing-val.ck: ...in function 'float foo()' 5 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-return-multi-semi.ck: -------------------------------------------------------------------------------- 1 | // test multiple ;; as last statement 2 | 3 | public class Class 4 | { 5 | fun void foo() 6 | { 7 | samp => now;; 8 | } 9 | } 10 | 11 | fun int bar() 12 | { 13 | while( false ) 14 | { 15 | samp => now;;;;;; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-return-multi-semi.txt: -------------------------------------------------------------------------------- 1 | error-return-multi-semi.ck:11:5: error: not all control paths in 'fun int bar()' return a value 2 | [11] fun int bar() 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-return-not-all-1.ck: -------------------------------------------------------------------------------- 1 | // missing return in non-void function 2 | fun float foo() 3 | { 4 | // return 1; 5 | } 6 | 7 | <<< foo() >>>; 8 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-return-not-all-1.txt: -------------------------------------------------------------------------------- 1 | error-return-not-all-1.ck:2:5: error: not all control paths in 'fun float foo()' return a value 2 | [2] fun float foo() 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-return-not-all-2.ck: -------------------------------------------------------------------------------- 1 | // all control paths return 2 | 3 | fun float foo( int v ) 4 | { 5 | if( v == 1 ) 6 | { 7 | return 1; 8 | } 9 | else if( v == 2 ) 10 | { 11 | } 12 | else 13 | { 14 | return 3; 15 | } 16 | } 17 | 18 | <<< foo( 1 ) >>>; 19 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-return-not-all-2.txt: -------------------------------------------------------------------------------- 1 | error-return-not-all-2.ck:3:5: error: not all control paths in 'fun float foo( int v )' return a value 2 | [3] fun float foo( int v ) 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-return-not-all-3.txt: -------------------------------------------------------------------------------- 1 | error-return-not-all-3.ck:3:5: error: not all control paths in 'fun float foo( int a, int b )' return a value 2 | [3] fun float foo( int a, int b ) 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-return-not-all-4.txt: -------------------------------------------------------------------------------- 1 | error-return-not-all-4.ck:9:16: error: not all control paths in 'fun Foo Foo.make( int c[], int t[] )' return a value 2 | [9] fun static Foo make( int c[], int t[]) 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-return-vec3-missing.ck: -------------------------------------------------------------------------------- 1 | // missing return, vec3 edition 2 | fun vec3 missingReturn() 3 | { 4 | // missing return 5 | } 6 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-return-vec3-missing.txt: -------------------------------------------------------------------------------- 1 | error-return-vec3-missing.ck:2:5: error: not all control paths in 'fun vec3 missingReturn()' return a value 2 | [2] fun vec3 missingReturn() 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-return-void-class.ck: -------------------------------------------------------------------------------- 1 | // error case: return value in void function 2 | 3 | class Foo 4 | { 5 | fun void foo() 6 | { 7 | // returning value from inside a void function 8 | return 5; 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/06-Errors/error-return-void-class.txt: -------------------------------------------------------------------------------- 1 | error-return-void-class.ck:8:9: error: function 'void Foo.foo()' was defined with return type 'void' -- but returning type 'int' 2 | [8] return 5; 3 | ^ 4 | error-return-void-class.ck: ...in function 'void Foo.foo()' 5 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-return-void.ck: -------------------------------------------------------------------------------- 1 | // error case: return value in void function 2 | 3 | fun void foo() 4 | { 5 | // returning value from inside a void function 6 | return 5; 7 | } 8 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-return-void.txt: -------------------------------------------------------------------------------- 1 | error-return-void.ck:6:5: error: function 'void foo()' was defined with return type 'void' -- but returning type 'int' 2 | [6] return 5; 3 | ^ 4 | error-return-void.ck: ...in function 'void foo()' 5 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-runtime-cast.txt: -------------------------------------------------------------------------------- 1 | [chuck]:(EXCEPTION) RuntimeCastIncompatible: in shred[id=1:06-Errors/error-runtime-cast.ck]... 2 | error-runtime-cast.ck:11:6: cannot cast dynamic type 'Gain' to 'SinOsc'... 3 | [11] ugen $ SinOsc @=> SinOsc @ uh; 4 | ^ 5 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-spork-int.ck: -------------------------------------------------------------------------------- 1 | spork ~ 1; 2 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-spork-int.txt: -------------------------------------------------------------------------------- 1 | error-spork-int.ck:1:9: error: only function calls can be sporked 2 | [1] spork ~ 1; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-static-access-member.ck: -------------------------------------------------------------------------------- 1 | class Foo 2 | { 3 | 5 => int x; 4 | } 5 | 6 | class Bar 7 | { 8 | Foo foo; 9 | fun static Foo getFoo() { return foo; } 10 | } 11 | 12 | Bar bar; 13 | 14 | bar.getFoo(); 15 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-static-access-member.txt: -------------------------------------------------------------------------------- 1 | error-static-access-member.ck:9:38: error: non-static member 'foo' used from static function 2 | [9] fun static Foo getFoo() { return foo; } 3 | ^ 4 | error-static-access-member.ck: ...in function 'Foo Bar.getFoo()' 5 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-static-init-local-f.txt: -------------------------------------------------------------------------------- 1 | error-static-init-local-f.ck:12:5: error: cannot call local function 'foo()' to initialize a static variable 2 | [12] foo() => static int THE_NUM; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-static-init-local-v.txt: -------------------------------------------------------------------------------- 1 | error-static-init-local-v.ck:12:5: error: cannot access local variable 'N' to initialize a static variable 2 | [12] N => static int THE_NUM; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-static-init-member-f.ck: -------------------------------------------------------------------------------- 1 | // error test: calling member function in static initialization 2 | // #2024-static-init 3 | 4 | // a class 5 | class Foo 6 | { 7 | // ERROR calling member function to initialize static var 8 | foo() => static int THE_NUM; 9 | 10 | // member function 11 | fun int foo() { return 5; } 12 | } 13 | 14 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-static-init-member-f.txt: -------------------------------------------------------------------------------- 1 | error-static-init-member-f.ck:8:5: error: cannot call non-static function 'Foo.foo()' to initialize a static variable 2 | [8] foo() => static int THE_NUM; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-static-init-member-v.ck: -------------------------------------------------------------------------------- 1 | // error test: using member var in static initialization 2 | // #2024-static-init 3 | 4 | // a class 5 | class Foo 6 | { 7 | // member variable 8 | 1 => int n; 9 | 2 => int m; 10 | 11 | // ERROR using member variable to initialize 12 | n + m => static int THE_NUM; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-static-init-member-v.txt: -------------------------------------------------------------------------------- 1 | error-static-init-member-v.ck:12:5: error: cannot access non-static variable 'Foo.n' to initialize a static variable 2 | [12] n + m => static int THE_NUM; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-static-var-scope-1.ck: -------------------------------------------------------------------------------- 1 | // error case: static variables must be declared at class scope 2 | 3 | class Foo 4 | { 5 | fun static void bar() 6 | { 7 | 5 => static int X; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-static-var-scope-1.txt: -------------------------------------------------------------------------------- 1 | error-static-var-scope-1.ck:7:14: error: static variables must be declared at class scope 2 | [7] 5 => static int X; 3 | ^ 4 | error-static-var-scope-1.ck: ...in function 'void Foo.bar()' 5 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-static-var-scope-2.ck: -------------------------------------------------------------------------------- 1 | // error case: static variables must be declared at class scope 2 | 3 | class Foo 4 | { 5 | fun void bar() 6 | { 7 | 5 => static int X; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-static-var-scope-2.txt: -------------------------------------------------------------------------------- 1 | error-static-var-scope-2.ck:7:14: error: static variables must be declared at class scope 2 | [7] 5 => static int X; 3 | ^ 4 | error-static-var-scope-2.ck: ...in function 'void Foo.bar()' 5 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-static-var-scope-3.ck: -------------------------------------------------------------------------------- 1 | // error case: static variables must be declared at class scope 2 | 3 | class Foo 4 | { 5 | { 6 | 5 => static int X; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-static-var-scope-3.txt: -------------------------------------------------------------------------------- 1 | error-static-var-scope-3.ck:6:14: error: static variables must be declared at class scope 2 | [6] 5 => static int X; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-static-var-scope-4.ck: -------------------------------------------------------------------------------- 1 | // error case: static variables must be declared at class scope 2 | 5 => static int X; 3 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-static-var-scope-4.txt: -------------------------------------------------------------------------------- 1 | error-static-var-scope-4.ck:2:6: error: static variables must be declared at class scope 2 | [2] 5 => static int X; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-string-func-concat-1.txt: -------------------------------------------------------------------------------- 1 | error-string-func-concat-1.ck:17:9: error: cannot perform '+' on string and '[fun]Foo.getFoo()' 2 | [17] <<< " " + f.getFoo >>>; 3 | ^ 4 | error-string-func-concat-1.ck:17:13: error: ...(hint: to call the function, add '()' and any arguments) 5 | [17] <<< " " + f.getFoo >>>; 6 | ^ 7 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-string-func-concat-2.ck: -------------------------------------------------------------------------------- 1 | // error case: check for [function] + string 2 | // https://github.com/ccrma/chuck/issues/162 3 | 4 | class Foo 5 | { 6 | // a function 7 | fun static void bar() 8 | { } 9 | } 10 | 11 | // function in LHS position 12 | Foo.bar + " "; 13 | 14 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-string-func-concat-2.txt: -------------------------------------------------------------------------------- 1 | error-string-func-concat-2.ck:12:9: error: cannot perform '+' on '[fun]Foo.bar()' and string 2 | [12] Foo.bar + " "; 3 | ^ 4 | error-string-func-concat-2.ck:12:5: error: ...(hint: to call the function, add '()' and any arguments) 5 | [12] Foo.bar + " "; 6 | ^ 7 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-string-func-concat-3.ck: -------------------------------------------------------------------------------- 1 | // error case: check for [function] + string; no class def 2 | // https://github.com/ccrma/chuck/issues/162 3 | 4 | // a function 5 | fun void foo() 6 | { } 7 | 8 | // function LHS position 9 | foo + ""; 10 | 11 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-string-func-concat-3.txt: -------------------------------------------------------------------------------- 1 | error-string-func-concat-3.ck:9:5: error: cannot perform '+' on '[fun]foo()' and string 2 | [9] foo + ""; 3 | ^ 4 | error-string-func-concat-3.ck:9:1: error: ...(hint: to call the function, add '()' and any arguments) 5 | [9] foo + ""; 6 | ^ 7 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-syntax-1.ck: -------------------------------------------------------------------------------- 1 | SinOsc @ foo; 2 | 3 | /* multi line 4 | comment 5 | */ it @ is not ! valid => syntax! 6 | 7 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-syntax-1.txt: -------------------------------------------------------------------------------- 1 | error-syntax-1.ck:5:12: syntax error 2 | [5] */ it @ is not ! valid => syntax! 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-tabs.ck: -------------------------------------------------------------------------------- 1 | SinOsc @ foo; 2 | 3 | it @ is not ! valid => syntax! 4 | 5 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-tabs.txt: -------------------------------------------------------------------------------- 1 | error-tabs.ck:3:12: syntax error 2 | [3] it @ is not ! valid => syntax! 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-this.ck: -------------------------------------------------------------------------------- 1 | this => now; 2 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-this.txt: -------------------------------------------------------------------------------- 1 | error-this.ck:1:1: error: keyword 'this' cannot used outside class definition 2 | [1] this => now; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-ugen-array-link-1.ck: -------------------------------------------------------------------------------- 1 | // error case: detect empty array decls in array ugen linking 2 | // https://github.com/ccrma/chuck/issues/39 3 | 4 | // a sinosc 5 | SinOsc foo => dac; 6 | 7 | // make into array (ok); connect to empty array decl (error) 8 | [foo] => SinOsc bars[]; 9 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-ugen-array-link-1.txt: -------------------------------------------------------------------------------- 1 | error-ugen-array-link-1.ck:8:17: error: cannot connect '=>' to empty array '[ ]' declaration... 2 | [8] [foo] => SinOsc bars[]; 3 | ^ 4 | error-ugen-array-link-1.ck: ...(hint: declare 'bars' as an non-empty array) 5 | error-ugen-array-link-1.ck: ...(or if assignment was the intent, use '@=>' instead) 6 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-ugen-array-link-2.ck: -------------------------------------------------------------------------------- 1 | // error case: detect empty array decls in array ugen linking 2 | // https://github.com/ccrma/chuck/issues/39 3 | 4 | // sine osc 5 | SinOsc bar => dac; 6 | 7 | // empty array decl cannot connect to other UGen(s) 8 | SinOsc foos[] => [bar]; 9 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-ugen-array-link-2.txt: -------------------------------------------------------------------------------- 1 | error-ugen-array-link-2.ck:8:8: error: cannot connect '=>' from empty array '[ ]' declaration... 2 | [8] SinOsc foos[] => [bar]; 3 | ^ 4 | error-ugen-array-link-2.ck: ...(hint: declare 'foos' as an non-empty array) 5 | error-ugen-array-link-2.ck: ...(or if assignment was the intent, use '@=>' instead) 6 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-unary.ck: -------------------------------------------------------------------------------- 1 | now++; 2 | -------------------------------------------------------------------------------- /src/test/06-Errors/error-unary.txt: -------------------------------------------------------------------------------- 1 | error-unary.ck:1:1: error: cannot resolve postfix operator '++' on type 'time' 2 | [1] now++; 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/06-Errors/stack-overflow.ck: -------------------------------------------------------------------------------- 1 | // classic 2 | fun void overflow() 3 | { 4 | overflow(); 5 | } 6 | overflow(); 7 | -------------------------------------------------------------------------------- /src/test/06-Errors/stack-overflow.txt: -------------------------------------------------------------------------------- 1 | [chuck]:(EXCEPTION) StackOverflow in shred[id=1:06-Errors/stack-overflow.ck] [pc=3] 2 | ...(possible cause: too many nested/recursive function calls) 3 | -------------------------------------------------------------------------------- /src/test/07-Imports/.deps/01-A.ck: -------------------------------------------------------------------------------- 1 | public class A { 2 | fun string a() { 3 | return "a!"; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /src/test/07-Imports/.deps/02-A.ck: -------------------------------------------------------------------------------- 1 | @import "02-B"; 2 | 3 | public class A { 4 | fun string a() { 5 | B b; 6 | return b.b(); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/test/07-Imports/.deps/02-B.ck: -------------------------------------------------------------------------------- 1 | public class B { 2 | fun string b() { 3 | return "b!"; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /src/test/07-Imports/.deps/03-A.ck: -------------------------------------------------------------------------------- 1 | @import "03-B"; 2 | 3 | public class A { 4 | fun string a() { 5 | B b; 6 | return B.b(); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/test/07-Imports/.deps/03-B.ck: -------------------------------------------------------------------------------- 1 | @import "03-A"; 2 | 3 | public class B { 4 | fun string b() { 5 | A a; 6 | return a.a(); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/test/07-Imports/.deps/04-A.ck: -------------------------------------------------------------------------------- 1 | @import "04-B"; 2 | -------------------------------------------------------------------------------- /src/test/07-Imports/.deps/04-B.ck: -------------------------------------------------------------------------------- 1 | @import "04-C"; 2 | -------------------------------------------------------------------------------- /src/test/07-Imports/.deps/04-C.ck: -------------------------------------------------------------------------------- 1 | @import "04-A"; 2 | -------------------------------------------------------------------------------- /src/test/07-Imports/.deps/05-A.ck: -------------------------------------------------------------------------------- 1 | @import "05-C"; 2 | 3 | public class A { 4 | fun string a() { 5 | C c; 6 | return c.c(); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/test/07-Imports/.deps/05-B.ck: -------------------------------------------------------------------------------- 1 | @import "05-C"; 2 | 3 | public class B { 4 | fun string b() { 5 | C c; 6 | return c.c(); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/test/07-Imports/.deps/05-C.ck: -------------------------------------------------------------------------------- 1 | public class C { 2 | fun string c() { 3 | return "c!"; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /src/test/07-Imports/01.ck: -------------------------------------------------------------------------------- 1 | @import ".deps/01-A"; 2 | 3 | A a; 4 | 5 | if (a.a() == "a!") <<< "success" >>>; -------------------------------------------------------------------------------- /src/test/07-Imports/02.ck: -------------------------------------------------------------------------------- 1 | @import ".deps/02-A"; 2 | 3 | A a; 4 | 5 | if (a.a() == "b!") <<< "success" >>>; -------------------------------------------------------------------------------- /src/test/07-Imports/03.ck: -------------------------------------------------------------------------------- 1 | // A and B or co-dependent. This should not compile 2 | @import ".deps/03-A" 3 | @import ".deps/03-B" 4 | 5 | // shouldn't get here 6 | <<< "aaaaahhhhhh" >>>; 7 | -------------------------------------------------------------------------------- /src/test/07-Imports/03.txt: -------------------------------------------------------------------------------- 1 | [chuck]: @import error -- cycle detected: 2 | [chuck]: |- '03-A.ck' is imported from... 3 | [chuck]: |- '03-B.ck':[line 1], which is imported from... 4 | [chuck]: |- '03-A.ck':[line 1], which is imported from... 5 | [chuck]: |- '03.ck':[line 2] (this is the originating file) 6 | -------------------------------------------------------------------------------- /src/test/07-Imports/04.ck: -------------------------------------------------------------------------------- 1 | @import ".deps/04-A"; 2 | 3 | // Tests a longer cycle (A -> B -> C -> A) 4 | 5 | <<< "aaaaahhhhhh" >>>; -------------------------------------------------------------------------------- /src/test/07-Imports/04.txt: -------------------------------------------------------------------------------- 1 | [chuck]: @import error -- cycle detected: 2 | [chuck]: |- '04-A.ck' is imported from... 3 | [chuck]: |- '04-C.ck':[line 1], which is imported from... 4 | [chuck]: |- '04-B.ck':[line 1], which is imported from... 5 | [chuck]: |- '04-A.ck':[line 1], which is imported from... 6 | [chuck]: |- '04.ck':[line 1] (this is the originating file) 7 | -------------------------------------------------------------------------------- /src/test/07-Imports/05.ck: -------------------------------------------------------------------------------- 1 | // Both A and B depend on C 2 | @import ".deps/05-A"; 3 | @import ".deps/05-B"; 4 | 5 | A a; 6 | B b; 7 | 8 | if (a.a() == "c!" && b.b() == "c!") <<< "success" >>>; -------------------------------------------------------------------------------- /src/test/07-Imports/06-error-no-such.ck: -------------------------------------------------------------------------------- 1 | // test import file that doesn't exist 2 | @import "no-such-file.ck" 3 | -------------------------------------------------------------------------------- /src/test/07-Imports/06-error-no-such.txt: -------------------------------------------------------------------------------- 1 | 06-error-no-such.ck:2:9: error: no such file: 'no-such-file.ck' 2 | [2] @import "no-such-file.ck" 3 | ^ 4 | -------------------------------------------------------------------------------- /src/test/07-Imports/07-error-self-import.ck: -------------------------------------------------------------------------------- 1 | @import "07-error-self-import.ck" 2 | -------------------------------------------------------------------------------- /src/test/07-Imports/07-error-self-import.txt: -------------------------------------------------------------------------------- 1 | [chuck]: @import error -- cycle detected: 2 | [chuck]: |- '07-error-self-import.ck' is imported from... 3 | [chuck]: |- '07-error-self-import.ck':[line 1] (this is the originating file) 4 | -------------------------------------------------------------------------------- /src/test/07-Imports/08-operator.ck: -------------------------------------------------------------------------------- 1 | @import ".deps/Foo.ck" 2 | 3 | Foo a, b; 4 | 1 => a.num; 5 | 2 => b.num; 6 | 7 | if( (a + b).num == 3 ) <<< "success" >>>; 8 | -------------------------------------------------------------------------------- /src/test/07-Imports/09-error-opeartor.ck: -------------------------------------------------------------------------------- 1 | // error case: test using an operator local to Foo.ck 2 | @import ".deps/Foo.ck" 3 | 4 | // make a Foo 5 | Foo a, b; 6 | 7 | // this should throw an error 8 | a =^ b; -------------------------------------------------------------------------------- /src/test/07-Imports/09-error-opeartor.txt: -------------------------------------------------------------------------------- 1 | 09-error-opeartor.ck:8:3: error: cannot resolve operator '=^' on types 'Foo' and 'Foo' 2 | [8] a =^ b; 3 | ^ 4 | --------------------------------------------------------------------------------