History

Merge remote-tracking branch 'origin/main' into qt6-main

Spencer Salazars committed 3 years ago

Commit 2fbfa982 parents 0506c4a d0ee61c263 files · +29036 −10344Browse files

Unified · Split

263 files
  1. .github/workflows/linux-build-unit-tests.yml +1 −1
  2. .github/workflows/macos-build-unit-tests.yml +1 −6
  3. examples/ai/features/centroid.ck +42 −0
  4. examples/ai/features/chroma.ck +62 −0
  5. examples/ai/features/features-combined.ck +59 −0
  6. examples/ai/features/flux.ck +0 −0
  7. examples/ai/features/flux0.ck +0 −0
  8. examples/ai/features/kurtosis.ck +36 −0
  9. examples/ai/features/mfcc-basic.ck +48 −0
  10. examples/ai/features/mfcc-mean.ck +91 −0
  11. examples/ai/features/rms.ck +0 −0
  12. examples/ai/features/rolloff.ck +0 −0
  13. examples/ai/features/rolloff2.ck +0 −0
  14. examples/ai/features/sfm.ck +47 −0
  15. examples/ai/features/zerox.ck +0 −0
  16. examples/ai/genre-classify/data/gtzan-23.txt +1000 −0
  17. examples/ai/genre-classify/feature-extract.ck +212 −0
  18. examples/ai/genre-classify/genre-classify.ck +338 −0
  19. examples/ai/genre-classify/x-validate.ck +323 −0
  20. examples/ai/hmm/hmm-load.ck +37 −0
  21. examples/ai/hmm/hmm-train.ck +31 −0
  22. examples/ai/knn/knn-search.ck +38 −0
  23. examples/ai/knn/knn2-classify.ck +64 −0
  24. examples/ai/knn/knn2-search.ck +68 −0
  25. examples/ai/mlp/mlp-manual.ck +164 −0
  26. examples/ai/mlp/mlp.ck +62 −0
  27. examples/ai/mlp/model-load.ck +34 −0
  28. examples/ai/mlp/model-save.ck +54 −0
  29. examples/ai/mlp/model.txt +15 −0
  30. examples/ai/pca/pca.ck +41 −0
  31. examples/ai/svm/svm-basic.ck +34 −0
  32. examples/ai/wekinator/currentData.arff +19 −0
  33. examples/ai/wekinator/wekinator-basic.ck +121 −0
  34. examples/ai/wekinator/wekinator-customize.ck +232 −0
  35. examples/ai/wekinator/wekinator-import.ck +48 −0
  36. examples/ai/word2vec/poem-i-feel.ck +195 −0
  37. examples/ai/word2vec/poem-randomwalk.ck +122 −0
  38. examples/ai/word2vec/poem-spew.ck +109 −0
  39. examples/ai/word2vec/poem-ungenerate.ck +284 −0
  40. examples/ai/word2vec/word2vec-basic.ck +211 −0
  41. examples/ai/word2vec/word2vec-prompt.ck +468 −0
  42. examples/analysis/features/centroid.ck +0 −23
  43. examples/array/array_associative.ck +26 −0
  44. examples/array/array_negative.ck +11 −0
  45. examples/array/array_zero.ck +14 −0
  46. examples/basic/rec-auto-stereo.ck +1 −1
  47. examples/basic/rec-auto.ck +2 −1
  48. examples/basic/rec.ck +2 −1
  49. examples/deep/ks-chord.ck +149 −0
  50. examples/deep/say-chu.ck +1 −1
  51. examples/event/event-extend.ck +4 −1
  52. examples/event/event-x-bpm-1.ck +144 −0
  53. examples/event/event-x-bpm-2.ck +139 −0
  54. examples/hid/kbhit/kb.ck +0 −0
  55. examples/hid/kbhit/kb2.ck +0 −0
  56. examples/io/chout.ck +3 −0
  57. examples/io/jabberwocky.txt +37 −0
  58. examples/io/read-byte.ck +36 −0
  59. examples/io/read-byte.txt +2 −0
  60. examples/io/read-float.ck +33 −0
  61. examples/io/read-float.txt +4 −0
  62. examples/io/read-int.ck +6 −1
  63. examples/io/read-int.txt +0 −1
  64. examples/io/read-line.ck +6 −1
  65. examples/io/read-line.txt +0 −0
  66. examples/io/read-str.ck +1 −1
  67. examples/io/read-str.txt +0 −0
  68. examples/io/read-tokens.ck +66 −0
  69. examples/io/seek.ck +40 −0
  70. examples/io/write-byte.ck +35 −0
  71. examples/io/write.ck +8 −3
  72. examples/io/write2.ck +8 −3
  73. examples/machine/crash.ck +4 −0
  74. examples/machine/eval.ck +22 −0
  75. examples/machine/intsize.ck +2 −0
  76. examples/machine/is-realtime.ck +6 −0
  77. examples/machine/machine-shred.ck +24 −0
  78. examples/math/map.ck +28 −0
  79. examples/math/math-help.ck +6 −0
  80. examples/osc/multi-msg/r-multi-msg.ck +1 −2
  81. examples/osc/multicast/r.ck +23 −13
  82. examples/osc/one2many/r.ck +22 −12
  83. examples/osc/one2many/s-sender.ck +10 −4
  84. examples/osc/osc-dump.ck +20 −11
  85. examples/osc/r.ck +22 −12
  86. examples/shred/machine.ck +0 −1
  87. examples/special/LiSa-munger3.ck +1 −1
  88. examples/type/polymorph.ck +71 −0
  89. examples/type/type_object.ck +4 −4
  90. examples/type/type_primitives.ck +4 −2
  91. examples/type/type_query.ck +75 −0
  92. examples/type/type_type.ck +116 −0
  93. notes/VERSIONS +639 −6
  94. src/core/chuck.cpp +145 −89
  95. src/core/chuck.h +15 −17
  96. src/core/chuck.y +1 −1
  97. src/core/chuck_absyn.cpp +49 −49
  98. src/core/chuck_absyn.h +15 −14
  99. src/core/chuck_carrier.cpp +4 −4
  100. src/core/chuck_carrier.h +8 −8
  101. src/core/chuck_compile.cpp +107 −103
  102. src/core/chuck_compile.h +12 −7
  103. src/core/chuck_def.h +17 −7
  104. src/core/chuck_dl.cpp +231 −92
  105. src/core/chuck_dl.h +61 −55
  106. src/core/chuck_emit.cpp +357 −250
  107. src/core/chuck_emit.h +7 −5
  108. src/core/chuck_errmsg.cpp +55 −53
  109. src/core/chuck_errmsg.h +7 −7
  110. src/core/chuck_frame.cpp +9 −4
  111. src/core/chuck_frame.h +1 −1
  112. src/core/chuck_globals.cpp +206 −206
  113. src/core/chuck_globals.h +21 −21
  114. src/core/chuck_instr.cpp +594 −302
  115. src/core/chuck_instr.h +162 −92
  116. src/core/chuck_io.cpp +664 −640
  117. src/core/chuck_io.h +29 −29
  118. src/core/chuck_lang.cpp +749 −151
  119. src/core/chuck_lang.h +36 −2
  120. src/core/chuck_oo.cpp +219 −62
  121. src/core/chuck_oo.h +66 −43
  122. src/core/chuck_otf.cpp +29 −28
  123. src/core/chuck_otf.h +1 −1
  124. src/core/chuck_parse.cpp +468 −12
  125. src/core/chuck_parse.h +7 −5
  126. src/core/chuck_scan.cpp +209 −125
  127. src/core/chuck_scan.h +2 −2
  128. src/core/chuck_shell.cpp +252 −252
  129. src/core/chuck_shell.h +80 −80
  130. src/core/chuck_stats.cpp +10 −10
  131. src/core/chuck_stats.h +10 −10
  132. src/core/chuck_symbol.cpp +9 −9
  133. src/core/chuck_symbol.h +1 −1
  134. src/core/chuck_table.cpp +6 −6
  135. src/core/chuck_table.h +2 −2
  136. src/core/chuck_type.cpp +586 −344
  137. src/core/chuck_type.h +121 −56
  138. src/core/chuck_ugen.cpp +78 −78
  139. src/core/chuck_ugen.h +6 −6
  140. src/core/chuck_utils.cpp +3 −3
  141. src/core/chuck_utils.h +1 −1
  142. src/core/chuck_vm.cpp +70 −70
  143. src/core/chuck_vm.h +18 −18
  144. src/core/chuck_win32.h +2 −2
  145. src/core/dirent_win32.h +37 −37
  146. src/core/hidio_sdl.cpp +100 −100
  147. src/core/hidio_sdl.h +4 −4
  148. src/core/lo/config.h +200 −200
  149. src/core/lo/lo.h +16 −16
  150. src/core/lo/lo_endian.h +32 −32
  151. src/core/lo/lo_lowlevel.h +14 −14
  152. src/core/lo/lo_macros.h +3 −3
  153. src/core/lo/lo_osc_types.h +48 −48
  154. src/core/lo/lo_types.h +2 −2
  155. src/core/lo/lo_types_internal.h +52 −52
  156. src/core/makefile +15 −10
  157. src/core/makefile.x/makefile.alsa +8 −2
  158. src/core/makefile.x/makefile.jack +8 −2
  159. src/core/makefile.x/makefile.mac +5 −5
  160. src/core/makefile.x/makefile.pulse +8 −2
  161. src/core/midiio_rtmidi.cpp +123 −123
  162. src/core/midiio_rtmidi.h +15 −15
  163. src/core/regex/config.h +185 −185
  164. src/core/regex/regex.h +4 −4
  165. src/core/regex/tre-ast.h +14 −14
  166. src/core/regex/tre-config.h +52 −52
  167. src/core/regex/tre-internal.h +31 −31
  168. src/core/regex/tre-match-utils.h +149 −149
  169. src/core/regex/tre-mem.h +4 −4
  170. src/core/regex/tre-parse.h +1 −1
  171. src/core/regex/tre-stack.h +20 −20
  172. src/core/regex/tre.h +54 −54
  173. src/core/regex/xmalloc.h +14 −14
  174. src/core/rtmidi.cpp +12 −12
  175. src/core/rtmidi.h +10 −10
  176. src/core/uana_extract.cpp +1435 −180
  177. src/core/uana_xform.cpp +218 −212
  178. src/core/ugen_filter.cpp +239 −163
  179. src/core/ugen_osc.cpp +101 −101
  180. src/core/ugen_osc.h +2 −2
  181. src/core/ugen_stk.cpp +901 −854
  182. src/core/ugen_stk.h +139 −141
  183. src/core/ugen_xxx.cpp +595 −553
  184. src/core/ulib_ai.cpp +6921 −0
  185. src/core/ulib_ai.h +370 −0
  186. src/core/ulib_machine.cpp +236 −31
  187. src/core/ulib_machine.h +6 −10
  188. src/core/ulib_math.cpp +389 −51
  189. src/core/ulib_math.h +11 −6
  190. src/core/ulib_opsc.cpp +292 −286
  191. src/core/ulib_regex.cpp +76 −77
  192. src/core/ulib_regex.h +4 −4
  193. src/core/ulib_std.cpp +101 −99
  194. src/core/util_buffers.cpp +26 −26
  195. src/core/util_buffers.h +52 −52
  196. src/core/util_console.cpp +32 −52
  197. src/core/util_hid.cpp +1310 −1313
  198. src/core/util_hid.h +4 −2
  199. src/core/util_math.c +15 −1
  200. src/core/util_math.h +18 −4
  201. src/core/util_network.c +1 −1
  202. src/core/util_opsc.cpp +254 −275
  203. src/core/util_opsc.h +51 −51
  204. src/core/util_platforms.cpp +5 −5
  205. src/core/util_platforms.h +4 −4
  206. src/core/util_serial.cpp +15 −17
  207. src/core/util_serial.h +3 −1
  208. src/core/util_sndfile.c +154 −147
  209. src/core/util_sndfile.h +103 −97
  210. src/core/util_string.cpp +39 −41
  211. src/core/util_string.h +1 −1
  212. src/core/util_thread.cpp +39 −39
  213. src/core/util_thread.h +18 −18
  214. src/core/util_xforms.c +2 −2
  215. src/host/chuck_audio.cpp +91 −73
  216. src/host/chuck_audio.h +4 −5
  217. src/host/chuck_main.cpp +24 −5
  218. src/host_web/README.txt +58 −0
  219. src/host_web/chuck_emscripten.cpp +9 −6
  220. src/host_web/chuck_emscripten.h +0 −0
  221. src/makefile +23 −19
  222. src/test/01-Basic/113.ck +7 −0
  223. src/test/01-Basic/113.txt +1 −0
  224. src/test/01-Basic/114.ck +5 −0
  225. src/test/01-Basic/114.txt +1 −0
  226. src/test/01-Basic/115.ck +10 −0
  227. src/test/01-Basic/116.ck +15 −0
  228. src/test/01-Basic/116.txt +1 −0
  229. src/test/01-Basic/117.ck +6 −0
  230. src/test/01-Basic/118.ck +29 −0
  231. src/test/01-Basic/119.ck +12 −0
  232. src/test/01-Basic/120.ck +20 −0
  233. src/test/01-Basic/120.txt +1 −0
  234. src/test/01-Basic/121.ck +7 −0
  235. src/test/01-Basic/122.ck +9 −0
  236. src/test/01-Basic/122.txt +1 −0
  237. src/test/01-Basic/123.ck +17 −0
  238. src/test/01-Basic/124.ck +50 −0
  239. src/test/01-Basic/94.ck +75 −0
  240. src/test/01-Basic/95.ck +8 −0
  241. src/test/01-Basic/95.txt +1 −0
  242. src/test/01-Basic/96.ck +12 −0
  243. src/test/01-Basic/96.txt +1 −0
  244. src/test/01-Basic/97.ck +7 −0
  245. src/test/01-Basic/97.txt +1 −0
  246. src/test/01-Basic/98.ck +45 −0
  247. src/test/01-Basic/99.ck +13 −0
  248. src/test/05-Global/01b.txt +1 −1
  249. src/test/05-Global/102a.txt +3 −3
  250. src/test/05-Global/113.ck +10 −0
  251. src/test/05-Global/95.ck +5 −0
  252. src/test/05-Global/95.txt +1 −0
  253. src/test/05-Global/96.ck +12 −0
  254. src/test/05-Global/96.txt +1 −0
  255. src/test/05-Global/97.ck +7 −0
  256. src/test/05-Global/97.txt +1 −0
  257. src/test/README +19 −6
  258. src/test/test.py +8 −4
  259. src/visual-studio/chuck-vs10.vcxproj +532 −530
  260. src/visual-studio/chuck.dsp +17 −0
  261. src/visual-studio/chuck.vcxproj +7 −5
  262. src/visual-studio/chuck.vcxproj.filters +7 −1
  263. src/xcode/chuck.xcodeproj/project.pbxproj +12 −2
.github/workflows/linux-build-unit-tests.yml+1−1
@@ -18,7 +18,7 @@ jobs: · 17 unmodified lines
18 run: sudo apt update && sudo apt install --fix-missing -y libsndfile1-dev libpulse-dev libasound2-dev18 run: sudo apt update && sudo apt install --fix-missing -y libsndfile1-dev libpulse-dev libasound2-dev
19 19
20 - name: Compile - Linux20 - name: Compile - Linux
21 run: cd src/ && make linux-pulse21 run: cd src/ && make -j linux-pulse
22 22
23 - name: Unit Tests - Linux23 - name: Unit Tests - Linux
24 run: cd src/ && export PATH=$PATH:$(pwd) && cd test/ && python test.py24 run: cd src/ && export PATH=$PATH:$(pwd) && cd test/ && python test.py
.github/workflows/macos-build-unit-tests.yml+1−6
@@ -14,13 +14,8 @@ jobs: · 13 unmodified lines
14 steps:14 steps:
15 - uses: actions/checkout@v215 - uses: actions/checkout@v2
16 16
17 - name: Install dependencies
18 run: |
19 python -m pip install --upgrade pip
20 pip install pathlib
21
22 - name: Compile - macOS17 - name: Compile - macOS
23 run: cd src/ && make mac18 run: cd src/ && make -j mac
24 19
25 - name: Unit Tests - macOS20 - name: Unit Tests - macOS
26 run: cd src/ && export PATH=$PATH:$(pwd) && cd test/ && python test.py21 run: cd src/ && export PATH=$PATH:$(pwd) && cd test/ && python test.py
examples/ai/features/centroid.ck+42−0
@@ -0,0 +1,42 @@
1//---------------------------------------------------------------------
2// name: centroid.ck
3// desc: fantastic audio features and where to extract them:
4// extracting spectral centroid; also demonstrates using
5// unit analyzers (UAna), connecting them using the
6// upchuck operator (=^), and getting results
7//
8// author: Ge Wang (https://ccrma.stanford.edu/~ge/)
9// date: Spring 2023
10//---------------------------------------------------------------------
11
12// synthesis / analysis network
13SinOsc foo => FFT fft =^ Centroid centroid => blackhole;
14// set sine frequency
15440 => foo.freq;
16
17// set FFT size
181024 => fft.size;
19// set window type and size
20Windowing.hann(fft.size()) => fft.window;
21// our hop size (how often to perform analysis)
22fft.size()::samp => dur HOP;
23// compute srate
24second / samp => float srate;
25
26// let one FFT-size of time pass (to buffer)
27fft.size()::samp => now;
28// control loop
29while( true )
30{
31 //----------------------------------------------------------------
32 // upchuck() computes our centroid, automatically computing upstream
33 // dependencies connected to it using =^ (e.g., FFT)
34 //----------------------------------------------------------------
35 centroid.upchuck();
36
37 // get and print the output
38 <<< "centroid (hz):", centroid.fval(0) * srate / 2 >>>;
39
40 // advance time
41 HOP => now;
42}
examples/ai/features/chroma.ck+62−0
@@ -0,0 +1,62 @@
1//---------------------------------------------------------------------
2// name: chroma.ck
3// desc: chroma unit anlyzer, used for feature extraction of pitch data
4// e.g., a set of frequencies
5//
6// uncomment for Chroma API:
7// Chroma.help();
8//
9// author: Yikai Li
10// Ge Wang (https://ccrma.stanford.edu/~ge/)
11// date: Winter 2023
12//---------------------------------------------------------------------
13
14// synthesis / analysis network
15SinOsc s => FFT fft =^ Chroma chroma => blackhole;
16
17// set FFT size
182048 => fft.size;
19// set window type and size
20Windowing.hann(fft.size()) => fft.window;
21// our hop size (how often to perform analysis)
22fft.size()::samp => dur HOP;
23
24// pitch names
25["C4", "C#", "D4", "D#", "E4", "F4", "F#", "G4", "G#", "A4", "A#", "B4"] @=> string note_names[];
26// test frequencies
27[262, 277, 294, 311, 330, 349, 370, 392, 415, 440, 466, 494] @=> int freqs[];
28
29// print header
30cherr <= "freq ";
31for (0 => int i; i < 12; i++) {
32 cherr <= note_names[i] + " ";
33}
34cherr <= IO.newline();
35
36// let one FFT-size of time pass (to buffer)
37fft.size()::samp => now;
38
39// extract chroma features
40for( 0 => int i; i < freqs.size(); i++ )
41{
42 // set frequency for test
43 freqs[i] => s.freq;
44
45 //----------------------------------------------------------------
46 // upchuck() computes our Chroma, automatically computing upstream
47 // dependencies connected to it using =^ (e.g., FFT)
48 //----------------------------------------------------------------
49 chroma.upchuck();
50
51 // print features
52 cherr <= freqs[i] <= ": ";
53 for( 0 => int j; j < chroma.fvals().size(); j++ )
54 {
55 Math.round(chroma.fval(j) * 100) => float tmp;
56 cherr <= (tmp < 10 ? " ":"") <= tmp <= " ";
57 }
58 cherr <= IO.newline();
59
60 // advance time
61 HOP => now;
62}
examples/ai/features/features-combined.ck+59−0
@@ -0,0 +1,59 @@
1//---------------------------------------------------------------------
2// name: features-combined.ck
3// desc: extracting multiple features; collect into one vector
4// e.g., Centroid, Flux, RMS, MFCC
5//
6// author: Ge Wang (https://ccrma.stanford.edu/~ge/)
7// date: Spring 2023
8//---------------------------------------------------------------------
9
10// audio input into a FFT
11adc => FFT fft;
12// a thing for collecting multiple features into one vector
13FeatureCollector combo => blackhole;
14// add spectral feature: Centroid
15fft =^ Centroid centroid =^ combo;
16// add spectral feature: Flux
17fft =^ Flux flux =^ combo;
18// add spectral feature: RMS
19fft =^ RMS rms =^ combo;
20// add spectral feature: MFCC
21fft =^ MFCC mfcc =^ combo;
22
23// set number of coefficients in MFCC (how many we get out)
24// 13 is a commonly used value; using less here for printing
2513 => mfcc.numCoeffs;
26// set number of mel filters in MFCC
2710 => mfcc.numFilters;
28
29// set FFT size
302048 => fft.size;
31// set window type and size
32Windowing.hann(fft.size()) => fft.window;
33// our hop size (how often to perform analysis)
34fft.size()::samp => dur HOP;
35
36// let one FFT-size of time pass (to buffer)
37fft.size()::samp => now;
38// control loop
39while( true )
40{
41 //-----------------------------------------------------------------
42 // a single upchuck() will trigger analysis on everything
43 // connected upstream from combo via the upchuck operator (=^)
44 // the total number of output dimensions is the sum of
45 // dimensions of all the connected unit analyzers
46 //-----------------------------------------------------------------
47 combo.upchuck();
48
49 // print
50 cherr <= "features (" <= combo.fvals().size() <= " total dims): ";
51 // print the MFCC results
52 for( int i; i < combo.fvals().size(); i++ )
53 { cherr <= combo.fval(i) <= " "; }
54 // endline
55 cherr <= IO.newline();
56
57 // advance time
58 HOP => now;
59}
examples/ai/features/flux.ckrenamed from examples/analysis/features/flux.ck+0−0

File renamed without changes.

examples/ai/features/flux0.ckrenamed from examples/analysis/features/flux0.ck+0−0

File renamed without changes.

examples/ai/features/kurtosis.ck+36−0
@@ -0,0 +1,36 @@
1//---------------------------------------------------------------------
2// name: kurtosis.ck
3// desc: chroma unit anlyzer, used for feature extraction
4//
5// uncomment for Chroma API:
6// Kurtosis.help();
7//
8// author: Yikai Li
9// Ge Wang (https://ccrma.stanford.edu/~ge/)
10// date: Winter 2023
11//---------------------------------------------------------------------'
12
13// our patch
14adc => FFT fft =^ Kurtosis kurtosis => blackhole;
15
16// set parameters
171024 => fft.size;
18// set hann window
19Windowing.hann(1024) => fft.window;
20// our hop size (how often to perform analysis)
21fft.size()::samp => dur HOP;
22
23// control loop
24while( true )
25{
26 //----------------------------------------------------------------
27 // upchuck() computes our kurtosis, automatically computing upstream
28 // dependencies connected to it using =^ (e.g., FFT)
29 //----------------------------------------------------------------
30 kurtosis.upchuck() @=> UAnaBlob blob;
31 // print out Kurtosis
32 <<< blob.fval(0) >>>;
33
34 // advance time
35 HOP => now;
36}
examples/ai/features/mfcc-basic.ck+48−0
@@ -0,0 +1,48 @@
1//---------------------------------------------------------------------
2// name: mfcc-basic.ck
3// desc: mel-frequency cepstral coefficients
4// basic MFCC feature extractor
5//
6// uncomment for MFCC API:
7// MFCC.help();
8//
9// author: Ge Wang (https://ccrma.stanford.edu/~ge/)
10// date: Spring 2023
11//---------------------------------------------------------------------
12
13// synthesis / analysis network
14adc => FFT fft =^ MFCC mfcc => blackhole;
15
16// set number of coefficients in MFCC (how many we get out)
17// 13 is a commonly used value; using less here for printing
187 => mfcc.numCoeffs;
19// set number of mel filters in MFCC
2010 => mfcc.numFilters;
21
22// set FFT size
232048 => fft.size;
24// set window type and size
25Windowing.hann(fft.size()) => fft.window;
26// our hop size (how often to perform analysis)
27fft.size()::samp => dur HOP;
28
29// let one FFT-size of time pass (to buffer)
30fft.size()::samp => now;
31// control loop
32while( true )
33{
34 //----------------------------------------------------------------
35 // upchuck() computes our MFCC, automatically computing upstream
36 // dependencies connected to it using =^ (e.g., FFT)
37 //----------------------------------------------------------------
38 mfcc.upchuck();
39 // print
40 cherr <= "MFCC: ";
41 // print the MFCC results
42 for( int i; i < mfcc.fvals().size(); i++ )
43 { cherr <= mfcc.fval(i) <= " "; }
44 // endline
45 cherr <= IO.newline();
46 // advance time
47 HOP => now;
48}
examples/ai/features/mfcc-mean.ck+91−0
@@ -0,0 +1,91 @@
1//---------------------------------------------------------------------
2// name: mfcc-mean.ck
3// desc: mel-frequency cepstral coefficients
4// this example aggregates multiple MFCC frames; compute mean
5//
6// to see API, uncomment:
7// MFCC.help();
8
9// author: Yikai Li and Ge Wang
10// date: Spring 2023
11//---------------------------------------------------------------------
12
13// analysis patch
14adc => FFT fft =^ MFCC mfcc => blackhole;
15
16// FFT size
172048 => fft.size;
18// FFT hop size
19512 => int hopSize;
20// number of filters in MEL space
2110 => mfcc.numFilters;
22// number of MFCC coefficients to compute per frame
2313 => mfcc.numCoeffs => int nCoeffs;
24// used to compute the frame size
25.1::second => dur aggregateTime;
26// set FFT window
27Windowing.hamming(fft.size()) => fft.window;
28// current sample sample
29second / samp => float sampleRate;
30// this should already be set to the current chuck srate
31// but could be overridden, if desired
32// sampleRate => mfcc.sampleRate;
33
34// calculate the number of frames
35(aggregateTime/second * sampleRate / hopSize + .5) $ int => int nFrames;
36
37// print out
38chout <= IO.newline();
39<<< "--------------------------------------------", "" >>>;
40<<< "num filters:", mfcc.numFilters() >>>;
41<<< "num MFCC coefficients:", mfcc.numCoeffs() >>>;
42<<< "agregrateTime:", aggregateTime/second, "seconds" >>>;
43<<< "num frames:", nFrames >>>;
44<<< "--------------------------------------------", "" >>>;
45chout <= IO.newline();
46
47// per-frame MFCC coefficients
48float mfccs[nFrames][nCoeffs];
49// average of MFCC coefficients across all frames
50float mfccMean [nCoeffs];
51
52// let one FFTsize of time pass
53fft.size()::samp => now;
54
55// analysis loop
56while( true )
57{
58 // aggregate mfcc features
59 for( 0 => int fi; fi < nFrames; fi++ )
60 {
61 // triggers MFCC and its dependencies (e.g., FFT)
62 mfcc.upchuck();
63 // get contents
64 for( 0 => int i; i < nCoeffs; i++ )
65 {
66 // copy the resulting coeffs
67 mfcc.fval(i) => mfccs[fi][i];
68 }
69 // advance time by one hop
70 hopSize::samp => now;
71 }
72
73 // compute mean
74 for( 0 => int i; i < nCoeffs; i++ )
75 {
76 // zero out
77 0.0 => mfccMean[i];
78 // sum
79 for (0 => int j; j < nFrames; j++)
80 {
81 mfccs[j][i] +=> mfccMean[i];
82 }
83 // divide by frames
84 nFrames /=> mfccMean[i];
85 // print
86 chout <= mfccMean[i] <= " ";
87 }
88
89 // new line
90 chout <= IO.newline();
91}
examples/ai/features/rms.ckrenamed from examples/analysis/features/rms.ck+0−0

File renamed without changes.

examples/ai/features/rolloff.ckrenamed from examples/analysis/features/rolloff.ck+0−0

File renamed without changes.

examples/ai/features/rolloff2.ckrenamed from examples/analysis/features/rolloff2.ck+0−0

File renamed without changes.

examples/ai/features/sfm.ck+47−0
@@ -0,0 +1,47 @@
1//---------------------------------------------------------------------
2// name: sfm.ck
3// desc: Spectral Flatness Measure
4//
5// uncomment for SFM API:
6// SFM.help();
7//
8// author: Yikai Li
9// Ge Wang
10// date: Winter 2023
11//---------------------------------------------------------------------
12
13// synthesis / analysis network
14SinOsc s => FFT fft =^ SFM sfm => blackhole;
15
16// set FFT size
172048 => fft.size;
18// set window type and size
19Windowing.hann(fft.size()) => fft.window;
20// our hop size (how often to perform analysis)
21fft.size()::samp => dur HOP;
22
23// let one FFT-size of time pass (to buffer)
24fft.size()::samp => now;
25// control loop
26while( true )
27{
28 //----------------------------------------------------------------
29 // upchuck() computes SFM, automatically computing upstream
30 // dependencies connected to it using =^ (e.g., FFT)
31 //----------------------------------------------------------------
32 sfm.upchuck();
33 // print
34 cherr <= "SFM: ";
35 // print the SFM results
36 for( int i; i < sfm.fvals().size(); i++ )
37 {
38 Math.round(sfm.fval(i) * 10) / 10 => float tmp;
39 cherr <= tmp <= (tmp == 1 || tmp == 0?".0":"") <= " ";
40 }
41 // endline
42 cherr <= IO.newline();
43 // advance time
44 HOP => now;
45 // randomize frequency
46 Math.random2f(20, 1000) => s.freq;
47}
examples/ai/features/zerox.ckrenamed from examples/analysis/features/zerox.ck+0−0

File renamed without changes.

examples/ai/genre-classify/data/gtzan-23.txt+1000−0
@@ -0,0 +1,1000 @@
10.094776 0.656543 0.0016323 -248.387 43.9911 0.336913 2.57967 3.61398 0.720551 1.4437 -1.65657 0.568342 -0.454847 3.86889e-13 0.454847 -0.568342 1.65657 -1.4437 -0.720551 -3.61398 -2.57967 -0.336913 -43.9911 blues
20.0707113 0.56226 0.00122693 -266.855 37.8975 7.74374 4.33491 3.95315 2.69442 2.0144 -0.217602 1.56059 0.594256 4.03997e-13 -0.594256 -1.56059 0.217602 -2.0144 -2.69442 -3.95315 -4.33491 -7.74374 -37.8975 blues
30.0801188 0.696338 0.00216605 -243.609 49.1735 1.16757 1.70333 2.18707 -1.74482 2.34557 -0.204502 0.958125 -0.3666 3.86131e-13 0.3666 -0.958125 0.204502 -2.34557 1.74482 -2.18707 -1.70333 -1.16757 -49.1735 blues
40.0474175 0.418836 0.00185957 -268.353 43.4403 12.4681 3.87979 2.73242 1.57632 1.66339 0.743285 1.1124 0.624885 4.12555e-13 -0.624885 -1.1124 -0.743285 -1.66339 -1.57632 -2.73242 -3.87979 -12.4681 -43.4403 blues
50.107857 0.670531 0.00130198 -249.116 41.3907 -1.19663 0.87539 0.797056 -4.59644 0.904956 -1.03792 1.17297 -0.805917 3.82971e-13 0.805917 -1.17297 1.03792 -0.904956 4.59644 -0.797056 -0.87539 1.19663 -41.3907 blues
60.0940557 0.552465 0.00132731 -255.775 40.8029 5.86899 3.58061 1.69693 -2.00106 1.2801 -1.34313 0.623947 -0.280834 3.91164e-13 0.280834 -0.623947 1.34313 -1.2801 2.00106 -1.69693 -3.58061 -5.86899 -40.8029 blues
70.0626831 0.472488 0.00147565 -262.963 43.92 7.75907 0.982827 5.40229 3.89001 1.79868 -1.81289 -0.565676 -0.0134577 4.07684e-13 0.0134577 0.565676 1.81289 -1.79868 -3.89001 -5.40229 -0.982827 -7.75907 -43.92 blues
80.0688619 0.587154 0.00150006 -259.678 44.3634 5.67171 1.57202 5.24038 3.92032 2.5693 -1.58223 -0.0641301 0.532631 4.04172e-13 -0.532631 0.0641301 1.58223 -2.5693 -3.92032 -5.24038 -1.57202 -5.67171 -44.3634 blues
90.091842 0.614496 0.00194205 -245.366 44.4959 0.394854 3.20549 3.6305 1.42828 2.98063 -2.04265 0.751465 -0.697596 3.82946e-13 0.697596 -0.751465 2.04265 -2.98063 -1.42828 -3.6305 -3.20549 -0.394854 -44.4959 blues
100.0967951 0.62757 0.00114996 -260.953 39.4053 4.34067 4.66164 4.22501 -2.29097 -0.250551 -0.760924 0.957235 -0.673282 3.95622e-13 0.673282 -0.957235 0.760924 0.250551 2.29097 -4.22501 -4.66164 -4.34067 -39.4053 blues
110.0701727 0.583397 0.00163934 -259.493 46.3253 5.7827 -2.08845 -0.938179 -2.63775 -0.653382 -1.2738 -0.144209 0.235608 4.059e-13 -0.235608 0.144209 1.2738 0.653382 2.63775 0.938179 2.08845 -5.7827 -46.3253 blues
120.0686134 0.444143 0.000681981 -286.48 28.8082 12.2139 6.8491 4.3866 2.62512 2.27881 1.33384 1.17875 0.553771 4.17757e-13 -0.553771 -1.17875 -1.33384 -2.27881 -2.62512 -4.3866 -6.8491 -12.2139 -28.8082 blues
130.0778387 0.573786 0.00145304 -260.381 41.8949 2.12533 3.52107 10.78 1.66132 -0.336912 1.09868 1.54993 -1.04243 3.98809e-13 1.04243 -1.54993 -1.09868 0.336912 -1.66132 -10.78 -3.52107 -2.12533 -41.8949 blues
140.0690982 0.629822 0.00129754 -266.019 41.7531 8.46387 5.64934 6.41876 1.39449 -0.827188 -0.621073 0.844113 -0.747725 4.05936e-13 0.747725 -0.844113 0.621073 0.827188 -1.39449 -6.41876 -5.64934 -8.46387 -41.7531 blues
150.0525012 0.571146 0.000809768 -282.066 33.7329 13.2531 6.62121 5.99685 1.97103 -0.568997 -1.09533 -1.20875 -1.68897 4.16645e-13 1.68897 1.20875 1.09533 0.568997 -1.97103 -5.99685 -6.62121 -13.2531 -33.7329 blues
160.0793699 0.674495 0.000935917 -270.91 36.6859 5.65969 2.57167 6.11587 2.02084 0.452793 0.0781596 0.468262 -0.977393 4.07284e-13 0.977393 -0.468262 -0.0781596 -0.452793 -2.02084 -6.11587 -2.57167 -5.65969 -36.6859 blues
170.0774297 0.689189 0.00111092 -266.893 40.1304 5.65312 1.41333 4.61215 1.50117 0.80422 0.36266 -0.0888416 -2.05718 4.05659e-13 2.05718 0.0888416 -0.36266 -0.80422 -1.50117 -4.61215 -1.41333 -5.65312 -40.1304 blues
180.0574543 0.596452 0.00134294 -265.441 42.4988 7.07483 4.35272 9.2069 3.07162 -0.427723 -0.534954 -0.089147 -1.24821 4.06707e-13 1.24821 0.089147 0.534954 0.427723 -3.07162 -9.2069 -4.35272 -7.07483 -42.4988 blues
190.0844697 0.551832 0.000939111 -272.51 35.4993 8.15451 7.04911 7.67329 2.39488 0.54561 -0.511962 -0.256619 -1.78678 4.0585e-13 1.78678 0.256619 0.511962 -0.54561 -2.39488 -7.67329 -7.04911 -8.15451 -35.4993 blues
200.0571708 0.609279 0.001203 -269.624 41.2452 10.1698 4.57695 6.19583 0.829363 -0.772816 -0.265492 -0.725032 -2.18483 4.09234e-13 2.18483 0.725032 0.265492 0.772816 -0.829363 -6.19583 -4.57695 -10.1698 -41.2452 blues
210.0703402 0.678218 0.00093663 -271.398 40.4066 10.9318 3.99894 3.10138 0.4874 -0.643795 -1.06124 -0.309574 -0.765582 4.1205e-13 0.765582 0.309574 1.06124 0.643795 -0.4874 -3.10138 -3.99894 -10.9318 -40.4066 blues
220.05588 0.585745 0.00119384 -271.147 39.6546 10.011 4.37196 5.93705 1.53465 0.418714 -0.18219 -1.0899 -2.38864 4.09392e-13 2.38864 1.0899 0.18219 -0.418714 -1.53465 -5.93705 -4.37196 -10.011 -39.6546 blues
230.0529446 0.596268 0.00145923 -270.052 40.0237 10.1125 5.44835 7.74417 2.3432 0.853041 0.942445 0.434093 -1.66335 4.08254e-13 1.66335 -0.434093 -0.942445 -0.853041 -2.3432 -7.74417 -5.44835 -10.1125 -40.0237 blues
240.0622054 0.61062 0.00162969 -260.342 46.4476 6.51419 2.52436 7.80647 0.877526 -0.585775 -0.525437 -0.9876 -1.16528 4.05121e-13 1.16528 0.9876 0.525437 0.585775 -0.877526 -7.80647 -2.52436 -6.51419 -46.4476 blues
250.0535359 0.614756 0.00143024 -266.567 43.3169 8.84317 4.01372 8.31675 1.84961 -0.408863 -0.16293 -0.361396 -0.716056 4.09366e-13 0.716056 0.361396 0.16293 0.408863 -1.84961 -8.31675 -4.01372 -8.84317 -43.3169 blues
260.0520959 0.576685 0.00136193 -270.588 40.8063 9.83395 5.92599 9.43755 3.01046 -0.453987 -0.557309 -0.849451 -1.13157 4.11088e-13 1.13157 0.849451 0.557309 0.453987 -3.01046 -9.43755 -5.92599 -9.83395 -40.8063 blues
270.0628458 0.590304 0.000899693 -275.579 35.7542 7.43987 4.29472 8.82161 3.55477 0.430246 0.601208 0.0769746 -1.045 4.12086e-13 1.045 -0.0769746 -0.601208 -0.430246 -3.55477 -8.82161 -4.29472 -7.43987 -35.7542 blues
280.0694364 0.557985 0.00117163 -264.084 42.1323 4.89211 4.25948 10.3348 0.693413 -2.01398 -0.819873 -0.617318 -0.897736 4.04405e-13 0.897736 0.617318 0.819873 2.01398 -0.693413 -10.3348 -4.25948 -4.89211 -42.1323 blues
290.0536213 0.634338 0.00153383 -266.142 44.9278 8.8956 0.63959 5.73206 3.21636 0.369936 -0.2793 0.0295689 -0.62233 4.1241e-13 0.62233 -0.0295689 0.2793 -0.369936 -3.21636 -5.73206 -0.63959 -8.8956 -44.9278 blues
300.079282 0.519523 0.00165912 -265.225 38.7217 13.7972 9.8695 2.31989 1.81986 2.92897 -1.88353 -0.377912 -0.897459 3.99563e-13 0.897459 0.377912 1.88353 -2.92897 -1.81986 -2.31989 -9.8695 -13.7972 -38.7217 blues
310.0712111 0.472352 0.00215832 -257.477 42.7504 13.2412 9.15323 2.03015 2.16226 3.7747 -1.9215 0.786615 0.259114 3.9515e-13 -0.259114 -0.786615 1.9215 -3.7747 -2.16226 -2.03015 -9.15323 -13.2412 -42.7504 blues
320.0729186 0.467142 0.00201897 -259.668 41.6618 14.1381 11.0454 2.20911 1.79883 3.39558 -2.67849 -0.400673 -0.170522 3.96025e-13 0.170522 0.400673 2.67849 -3.39558 -1.79883 -2.20911 -11.0454 -14.1381 -41.6618 blues
330.0512932 0.360279 0.00154851 -274.947 38.2 15.8634 8.46109 3.86512 3.82606 4.26099 1.18719 1.13702 0.587335 4.13436e-13 -0.587335 -1.13702 -1.18719 -4.26099 -3.82606 -3.86512 -8.46109 -15.8634 -38.2 blues
340.0669127 0.390866 0.00177177 -265.344 39.6512 16.5826 12.5964 2.9211 0.771276 2.44823 -1.34527 0.746979 0.141564 3.99999e-13 -0.141564 -0.746979 1.34527 -2.44823 -0.771276 -2.9211 -12.5964 -16.5826 -39.6512 blues
350.0743195 0.494192 0.00166527 -264.127 40.5279 13.8335 9.58931 1.28566 0.668524 3.53724 -0.430464 1.01728 0.0881112 4.00469e-13 -0.0881112 -1.01728 0.430464 -3.53724 -0.668524 -1.28566 -9.58931 -13.8335 -40.5279 blues
360.0778148 0.459088 0.00241455 -249.455 46.0189 10.8058 7.26375 -0.702014 0.0917107 4.14863 -1.41134 1.50828 0.473765 3.88702e-13 -0.473765 -1.50828 1.41134 -4.14863 -0.0917107 0.702014 -7.26375 -10.8058 -46.0189 blues
370.0645415 0.451467 0.00260859 -254.889 45.7257 13.4003 9.38092 1.85038 1.23073 3.28937 -1.64212 0.383319 -0.0526141 3.94956e-13 0.0526141 -0.383319 1.64212 -3.28937 -1.23073 -1.85038 -9.38092 -13.4003 -45.7257 blues
380.0641579 0.498099 0.000780921 -279.487 31.5496 11.375 6.87733 2.94449 1.74606 3.0286 0.412368 0.419421 -0.0543965 4.1126e-13 0.0543965 -0.419421 -0.412368 -3.0286 -1.74606 -2.94449 -6.87733 -11.375 -31.5496 blues
390.0763746 0.468155 0.00211999 -257.318 41.9016 12.6261 9.76404 2.14978 2.83004 4.06111 -1.63569 0.877838 -0.105381 3.93629e-13 0.105381 -0.877838 1.63569 -4.06111 -2.83004 -2.14978 -9.76404 -12.6261 -41.9016 blues
400.0420705 0.31711 0.000969185 -279.567 38.7526 19.3152 8.41221 2.52069 0.600202 0.370006 -0.511538 -0.226304 -0.0190581 4.19385e-13 0.0190581 0.226304 0.511538 -0.370006 -0.600202 -2.52069 -8.41221 -19.3152 -38.7526 blues
410.126881 0.669677 0.00176699 -240.061 37.8254 -2.79441 9.23466 6.90432 -0.830786 3.4998 -1.85146 1.54504 -1.33135 3.63828e-13 1.33135 -1.54504 1.85146 -3.4998 0.830786 -6.90432 -9.23466 2.79441 -37.8254 blues
420.13114 0.58812 0.00169654 -240.719 36.4317 -1.56508 8.08727 4.15993 -0.121177 3.75505 -1.23361 2.23901 -0.92641 3.63912e-13 0.92641 -2.23901 1.23361 -3.75505 0.121177 -4.15993 -8.08727 1.56508 -36.4317 blues
430.12925 0.473297 0.0014901 -246.643 34.0024 -5.97008 7.53021 9.2188 4.022 6.93976 -0.731585 1.44235 -0.152169 3.7094e-13 0.152169 -1.44235 0.731585 -6.93976 -4.022 -9.2188 -7.53021 5.97008 -34.0024 blues
440.112709 0.613147 0.00171232 -244.159 39.0495 0.338103 6.84052 3.04135 0.216004 3.88263 -0.487748 3.1161 -0.0840585 3.72701e-13 0.0840585 -3.1161 0.487748 -3.88263 -0.216004 -3.04135 -6.84052 -0.338103 -39.0495 blues
450.120085 0.597984 0.00186987 -242.955 37.5327 0.00437348 10.9699 6.42084 -0.490371 3.7207 -2.0134 1.34781 -0.690799 3.674e-13 0.690799 -1.34781 2.0134 -3.7207 0.490371 -6.42084 -10.9699 -0.00437348 -37.5327 blues
460.0948217 0.563474 0.00191759 -254.625 37.075 2.1073 12.4853 10.7897 3.40552 4.62073 -0.440435 0.787621 -0.412037 3.83243e-13 0.412037 -0.787621 0.440435 -4.62073 -3.40552 -10.7897 -12.4853 -2.1073 -37.075 blues
470.0953317 0.46543 0.00135599 -262.495 34.7674 5.36288 12.2136 8.84747 2.92612 4.04385 -0.354849 0.630453 0.057555 3.91285e-13 -0.057555 -0.630453 0.354849 -4.04385 -2.92612 -8.84747 -12.2136 -5.36288 -34.7674 blues
480.107711 0.435254 0.00141346 -251.232 38.2032 1.80997 11.9725 7.8063 -1.16737 2.24524 -2.14072 -0.0756429 -0.555799 3.79366e-13 0.555799 0.0756429 2.14072 -2.24524 1.16737 -7.8063 -11.9725 -1.80997 -38.2032 blues
490.115936 0.60568 0.00164684 -242.084 40.0084 -2.99309 5.97908 5.24602 0.193764 3.53262 -1.61247 1.95808 -0.69439 3.71291e-13 0.69439 -1.95808 1.61247 -3.53262 -0.193764 -5.24602 -5.97908 2.99309 -40.0084 blues
500.0699258 0.423488 0.00114293 -269.715 36.7604 9.96285 11.9665 9.89725 1.92221 2.24239 -0.358726 -1.67392 -1.17284 4.02477e-13 1.17284 1.67392 0.358726 -2.24239 -1.92221 -9.89725 -11.9665 -9.96285 -36.7604 blues
510.112997 0.620078 0.00212504 -239.564 40.3516 -3.24542 6.62253 6.70796 1.77742 4.34926 -0.958026 1.70599 -1.14041 3.68207e-13 1.14041 -1.70599 0.958026 -4.34926 -1.77742 -6.70796 -6.62253 3.24542 -40.3516 blues
520.104058 0.684975 0.00256395 -232.628 46.4065 -6.70064 2.5799 8.70665 0.144359 1.5629 -2.70157 1.01342 -0.798122 3.68057e-13 0.798122 -1.01342 2.70157 -1.5629 -0.144359 -8.70665 -2.5799 6.70064 -46.4065 blues
530.0782949 0.455302 0.00118107 -265.746 37.7178 3.38295 4.03364 9.08774 2.89339 1.46638 0.964782 1.10937 -0.55657 4.01495e-13 0.55657 -1.10937 -0.964782 -1.46638 -2.89339 -9.08774 -4.03364 -3.38295 -37.7178 blues
540.116245 0.717367 0.0021652 -235.827 43.0206 -8.60221 0.997313 8.02383 -1.02612 2.16101 -1.74484 1.22461 -0.701843 3.68293e-13 0.701843 -1.22461 1.74484 -2.16101 1.02612 -8.02383 -0.997313 8.60221 -43.0206 blues
550.107817 0.680833 0.00261664 -234.203 43.1411 -5.58363 4.25919 7.77743 1.5793 4.02005 -2.15152 1.30441 -0.593978 3.65847e-13 0.593978 -1.30441 2.15152 -4.02005 -1.5793 -7.77743 -4.25919 5.58363 -43.1411 blues
560.11953 0.659544 0.002027 -237.463 42.1024 -9.55695 1.46244 10.2151 -1.16754 0.780879 -0.649389 2.95008 -1.30015 3.68052e-13 1.30015 -2.95008 0.649389 -0.780879 1.16754 -10.2151 -1.46244 9.55695 -42.1024 blues
570.0932682 0.407423 0.00185353 -252.427 39.1817 1.38453 6.97487 8.12487 3.03057 3.12461 0.154465 2.04915 -0.780233 3.8418e-13 0.780233 -2.04915 -0.154465 -3.12461 -3.03057 -8.12487 -6.97487 -1.38453 -39.1817 blues
580.0996299 0.663232 0.00234115 -241.512 43.9037 -4.08018 2.35521 7.71269 3.40601 4.32788 -1.98136 1.25465 0.371372 3.78593e-13 -0.371372 -1.25465 1.98136 -4.32788 -3.40601 -7.71269 -2.35521 4.08018 -43.9037 blues
590.130588 0.61842 0.002277 -233.198 39.2643 -4.88147 6.92556 6.73682 -1.11555 2.69156 -2.57264 1.0966 -1.73481 3.57092e-13 1.73481 -1.0966 2.57264 -2.69156 1.11555 -6.73682 -6.92556 4.88147 -39.2643 blues
600.125723 0.669768 0.00210613 -236.395 38.7072 -8.82586 5.26894 11.48 -0.821043 1.18886 -1.8765 2.88302 -1.21711 3.61172e-13 1.21711 -2.88302 1.8765 -1.18886 0.821043 -11.48 -5.26894 8.82586 -38.7072 blues
610.114841 0.657089 0.00247367 -232.575 42.6428 -8.18921 3.06448 8.61292 1.14842 3.6533 -1.08974 2.74567 -0.712685 3.62829e-13 0.712685 -2.74567 1.08974 -3.6533 -1.14842 -8.61292 -3.06448 8.18921 -42.6428 blues
620.135772 0.680542 0.00177887 -234.503 37.249 -8.47028 7.38172 9.19912 -2.69059 5.33745 -2.34385 1.51693 0.220401 3.56792e-13 -0.220401 -1.51693 2.34385 -5.33745 2.69059 -9.19912 -7.38172 8.47028 -37.249 blues
630.121587 0.685565 0.00142485 -244.931 39.5229 -4.32176 4.50954 4.80358 -4.74321 3.39092 -0.873121 0.110129 0.0980056 3.74596e-13 -0.0980056 -0.110129 0.873121 -3.39092 4.74321 -4.80358 -4.50954 4.32176 -39.5229 blues
640.162135 0.688962 0.00119297 -244.264 32.7499 -4.02539 8.11595 3.31154 -4.83636 2.12053 -2.01514 0.561276 -0.742758 3.63598e-13 0.742758 -0.561276 2.01514 -2.12053 4.83636 -3.31154 -8.11595 4.02539 -32.7499 blues
650.140575 0.68552 0.00150178 -236.602 38.3139 -4.98908 7.84019 5.529 -5.24681 1.04321 -2.41615 0.724882 -0.2927 3.60568e-13 0.2927 -0.724882 2.41615 -1.04321 5.24681 -5.529 -7.84019 4.98908 -38.3139 blues
660.15788 0.687287 0.00137208 -237.771 34.9476 -5.48528 6.06909 2.73713 -4.32688 2.3658 -2.93338 0.341245 -0.508412 3.58857e-13 0.508412 -0.341245 2.93338 -2.3658 4.32688 -2.73713 -6.06909 5.48528 -34.9476 blues
670.130373 0.702369 0.00145916 -241.782 38.1923 -3.56842 5.48564 3.55028 -3.65006 2.15487 -1.98885 0.810495 -0.932152 3.6791e-13 0.932152 -0.810495 1.98885 -2.15487 3.65006 -3.55028 -5.48564 3.56842 -38.1923 blues
680.119668 0.745122 0.00171444 -237.967 41.9865 -3.78847 4.53654 3.27319 -3.91357 1.46436 -1.83684 0.753797 -0.541895 3.68319e-13 0.541895 -0.753797 1.83684 -1.46436 3.91357 -3.27319 -4.53654 3.78847 -41.9865 blues
690.141821 0.656718 0.00132196 -241.954 37.3932 -4.40692 7.06286 3.9528 -6.43238 -0.212297 -1.6713 2.32862 0.0878459 3.66496e-13 -0.0878459 -2.32862 1.6713 0.212297 6.43238 -3.9528 -7.06286 4.40692 -37.3932 blues
700.118264 0.640971 0.00154247 -241.954 41.8155 -3.27825 5.89515 4.67181 -6.35297 1.61444 -1.61554 -0.120766 -1.07343 3.71618e-13 1.07343 0.120766 1.61554 -1.61444 6.35297 -4.67181 -5.89515 3.27825 -41.8155 blues
710.114887 0.711403 0.00136448 -245.36 40.7944 -1.19439 4.47342 2.78963 -2.21563 1.57855 -3.28804 0.0248982 0.295001 3.78188e-13 -0.295001 -0.0248982 3.28804 -1.57855 2.21563 -2.78963 -4.47342 1.19439 -40.7944 blues
720.138309 0.693864 0.00158359 -235.546 38.3968 -5.45642 7.76101 5.44981 -5.96177 0.575654 -2.23234 2.04792 -0.105489 3.58809e-13 0.105489 -2.04792 2.23234 -0.575654 5.96177 -5.44981 -7.76101 5.45642 -38.3968 blues
730.148667 0.564768 0.00132092 -240.993 34.8334 -0.259499 10.8562 3.00426 -5.60938 2.69451 -2.04031 0.55228 0.976232 3.61906e-13 -0.976232 -0.55228 2.04031 -2.69451 5.60938 -3.00426 -10.8562 0.259499 -34.8334 blues
740.108404 0.651632 0.00328655 -225.819 45.2893 -4.31466 5.80192 5.16555 -1.8029 2.70046 -3.3482 1.70162 -1.11171 3.55236e-13 1.11171 -1.70162 3.3482 -2.70046 1.8029 -5.16555 -5.80192 4.31466 -45.2893 blues
750.134101 0.69099 0.00264674 -225.324 38.8546 -2.62386 5.7917 1.26663 0.057306 4.50294 -4.02289 1.19069 -1.28659 3.47243e-13 1.28659 -1.19069 4.02289 -4.50294 -0.057306 -1.26663 -5.7917 2.62386 -38.8546 blues
760.115125 0.702075 0.00244103 -238.258 39.4686 -2.78088 4.92032 5.01945 1.3759 3.8238 -2.14936 1.55072 -0.434953 3.66565e-13 0.434953 -1.55072 2.14936 -3.8238 -1.3759 -5.01945 -4.92032 2.78088 -39.4686 blues
770.141609 0.542383 0.00275116 -224.955 36.6072 -6.74715 5.25713 3.78892 -0.00900903 4.78623 -2.27209 2.50026 -1.4068 3.43602e-13 1.4068 -2.50026 2.27209 -4.78623 0.00900903 -3.78892 -5.25713 6.74715 -36.6072 blues
780.11547 0.697587 0.00313345 -226.161 43.1053 -4.35935 2.97932 2.11583 0.673393 5.08646 -2.2935 2.22484 -0.332473 3.55299e-13 0.332473 -2.22484 2.2935 -5.08646 -0.673393 -2.11583 -2.97932 4.35935 -43.1053 blues
790.126769 0.762922 0.00335235 -218.379 42.4099 -7.16806 2.81564 2.44154 -0.730187 4.30848 -3.21404 2.11721 -1.18629 3.43051e-13 1.18629 -2.11721 3.21404 -4.30848 0.730187 -2.44154 -2.81564 7.16806 -42.4099 blues
800.133899 0.620659 0.00342166 -216.974 38.8761 -6.39909 4.76402 3.33703 1.24508 5.90593 -1.98554 2.63918 0.0976787 3.37606e-13 -0.0976787 -2.63918 1.98554 -5.90593 -1.24508 -3.33703 -4.76402 6.39909 -38.8761 blues
810.0947063 0.642088 0.00309355 -231.958 48.13 -3.92946 1.53771 2.67097 -2.03197 3.23421 -1.39724 1.68485 -0.437259 3.69052e-13 0.437259 -1.68485 1.39724 -3.23421 2.03197 -2.67097 -1.53771 3.92946 -48.13 blues
820.12255 0.668207 0.00360729 -214.551 43.7801 -9.32046 2.59605 3.95567 -2.93359 4.19178 -2.74378 1.83616 -0.792756 3.39353e-13 0.792756 -1.83616 2.74378 -4.19178 2.93359 -3.95567 -2.59605 9.32046 -43.7801 blues
830.114302 0.68572 0.00348326 -219.805 45.5088 -5.43792 2.57206 1.04585 -3.30529 3.05695 -3.4275 1.76487 -0.633078 3.48744e-13 0.633078 -1.76487 3.4275 -3.05695 3.30529 -1.04585 -2.57206 5.43792 -45.5088 blues
840.12367 0.610505 0.00337549 -220.116 42.2324 -8.26688 3.36525 4.15529 -1.22827 4.95729 -2.83132 2.37559 -0.0555443 3.45568e-13 0.0555443 -2.37559 2.83132 -4.95729 1.22827 -4.15529 -3.36525 8.26688 -42.2324 blues
850.108192 0.631832 0.00285232 -229.529 44.5085 -5.30227 0.612802 2.36931 0.24014 2.88251 -2.64567 1.57665 -0.591592 3.62531e-13 0.591592 -1.57665 2.64567 -2.88251 -0.24014 -2.36931 -0.612802 5.30227 -44.5085 blues
860.0910881 0.53782 0.00212604 -241.724 42.5569 -1.19867 1.95739 2.10723 1.0177 5.30587 1.94465 1.39768 -0.420916 3.75999e-13 0.420916 -1.39768 -1.94465 -5.30587 -1.0177 -2.10723 -1.95739 1.19867 -42.5569 blues
870.0713937 0.561402 0.00141591 -265.004 38.9251 9.20468 6.49176 4.84434 2.14611 2.38063 -0.332197 0.292479 -0.307641 4.01253e-13 0.307641 -0.292479 0.332197 -2.38063 -2.14611 -4.84434 -6.49176 -9.20468 -38.9251 blues
880.0702727 0.507535 0.00205451 -255.447 44.3182 8.09195 7.32288 4.72958 0.81309 2.58828 -0.878563 0.169451 0.344739 3.95193e-13 -0.344739 -0.169451 0.878563 -2.58828 -0.81309 -4.72958 -7.32288 -8.09195 -44.3182 blues
890.0505433 0.563093 0.00154517 -270.508 41.1256 11.7109 5.76287 6.39389 4.65461 2.41807 -0.158985 0.276616 0.440174 4.12837e-13 -0.440174 -0.276616 0.158985 -2.41807 -4.65461 -6.39389 -5.76287 -11.7109 -41.1256 blues
900.0420183 0.45155 0.000619516 -287.788 31.2776 15.5547 6.59604 3.83237 2.33997 1.17674 0.795434 0.745355 0.345788 4.22384e-13 -0.345788 -0.745355 -0.795434 -1.17674 -2.33997 -3.83237 -6.59604 -15.5547 -31.2776 blues
910.0810321 0.515158 0.00178746 -257.598 39.526 7.27109 9.64219 6.74502 1.68181 1.98943 -1.67551 0.759581 -0.0870476 3.91044e-13 0.0870476 -0.759581 1.67551 -1.98943 -1.68181 -6.74502 -9.64219 -7.27109 -39.526 blues
920.0441391 0.446323 0.0013528 -273.302 40.1661 14.7118 5.8025 3.49837 2.96337 3.084 1.72316 1.34357 0.332731 4.14172e-13 -0.332731 -1.34357 -1.72316 -3.084 -2.96337 -3.49837 -5.8025 -14.7118 -40.1661 blues
930.0377751 0.371533 0.000694814 -289.768 28.1787 15.2876 9.97136 7.70228 5.29194 3.3797 1.66909 0.711087 -0.0137788 4.20253e-13 0.0137788 -0.711087 -1.66909 -3.3797 -5.29194 -7.70228 -9.97136 -15.2876 -28.1787 blues
940.0278032 0.317427 0.000823097 -285.455 34.5004 17.763 6.11781 2.88099 3.58609 3.43787 1.72364 0.564726 0.187268 4.23332e-13 -0.187268 -0.564726 -1.72364 -3.43787 -3.58609 -2.88099 -6.11781 -17.763 -34.5004 blues
950.0941147 0.467578 0.00196002 -245.994 40.9266 -1.7736 3.89377 4.35604 -0.180557 5.57733 1.37048 1.47732 0.69981 3.79364e-13 -0.69981 -1.47732 -1.37048 -5.57733 0.180557 -4.35604 -3.89377 1.7736 -40.9266 blues
960.069485 0.535029 0.00235791 -250.186 47.9329 7.46287 5.61323 2.626 -0.571442 0.458379 -2.08907 1.98459 1.93344 3.94096e-13 -1.93344 -1.98459 2.08907 -0.458379 0.571442 -2.626 -5.61323 -7.46287 -47.9329 blues
970.0545855 0.344298 0.000458099 -280.616 36.0231 13.2141 1.89899 -1.15735 -1.51527 -0.393935 0.840447 1.05455 -0.0320538 4.19188e-13 0.0320538 -1.05455 -0.840447 0.393935 1.51527 1.15735 -1.89899 -13.2141 -36.0231 blues
980.0777612 0.613152 0.00240976 -247.087 45.4175 2.46823 4.86092 7.00275 2.161 1.72329 -0.574963 1.39712 -1.02444 3.85327e-13 1.02444 -1.39712 0.574963 -1.72329 -2.161 -7.00275 -4.86092 -2.46823 -45.4175 blues
990.117592 0.600458 0.0016621 -240.585 40.28 -5.43639 3.79394 5.48961 -2.23973 3.22053 0.144163 2.29207 -0.94721 3.69234e-13 0.94721 -2.29207 -0.144163 -3.22053 2.23973 -5.48961 -3.79394 5.43639 -40.28 blues
1000.0730561 0.544654 0.00129553 -262.498 41.8424 4.67573 1.73033 3.54899 -1.10885 1.61282 1.39654 0.535375 -0.0413087 4.0261e-13 0.0413087 -0.535375 -1.39654 -1.61282 1.10885 -3.54899 -1.73033 -4.67573 -41.8424 blues
1010.0805354 0.562542 0.000458467 -272.108 38.1278 2.61418 -6.52588 -2.2837 -0.264191 1.20319 1.49732 0.347882 -0.627294 4.1404e-13 0.627294 -0.347882 -1.49732 -1.20319 0.264191 2.2837 6.52588 -2.61418 -38.1278 classical
1020.0663804 0.406469 0.000338849 -280.294 34.8681 8.77738 -1.2972 0.302561 1.31664 0.600447 -0.0244019 -0.310362 -0.391481 4.19591e-13 0.391481 0.310362 0.0244019 -0.600447 -1.31664 -0.302561 1.2972 -8.77738 -34.8681 classical
1030.0784647 0.558192 0.00067428 -265.157 42.3567 2.52171 -4.85681 -1.48061 -1.25442 1.38336 2.01761 0.537874 -0.636338 4.08994e-13 0.636338 -0.537874 -2.01761 -1.38336 1.25442 1.48061 4.85681 -2.52171 -42.3567 classical
1040.0844165 0.441056 0.000412288 -273.65 35.2784 -0.255948 -7.0504 -1.50828 -0.607703 1.42491 2.36884 0.0040395 -1.37315 4.12195e-13 1.37315 -0.0040395 -2.36884 -1.42491 0.607703 1.50828 7.0504 0.255948 -35.2784 classical
1050.085419 0.540494 0.000546148 -267.529 39.9159 1.73957 -3.91195 0.811345 -0.204264 0.17346 0.730186 0.710393 0.172851 4.09937e-13 -0.172851 -0.710393 -0.730186 -0.17346 0.204264 -0.811345 3.91195 -1.73957 -39.9159 classical
1060.0755185 0.556891 0.000688784 -265.544 42.2958 3.9936 -1.09208 2.97825 -0.00957002 -1.1077 -0.696726 -0.317956 -0.472574 4.08971e-13 0.472574 0.317956 0.696726 1.1077 0.00957002 -2.97825 1.09208 -3.9936 -42.2958 classical
1070.0821099 0.439229 0.000403404 -273.495 36.3162 3.69068 -1.41451 2.37794 -0.215214 -1.65948 -0.724823 -0.144992 -0.566871 4.12193e-13 0.566871 0.144992 0.724823 1.65948 0.215214 -2.37794 1.41451 -3.69068 -36.3162 classical
1080.0551558 0.446213 0.000432503 -283.461 32.2439 10.0111 1.97586 2.17791 0.869546 -0.179478 0.24812 0.537447 0.184052 4.19474e-13 -0.184052 -0.537447 -0.24812 0.179478 -0.869546 -2.17791 -1.97586 -10.0111 -32.2439 classical
1090.069303 0.515028 0.000384205 -280.705 32.9674 7.58899 0.316593 1.41781 0.0510828 -0.957821 -0.729868 -0.107953 0.042349 4.17398e-13 -0.042349 0.107953 0.729868 0.957821 -0.0510828 -1.41781 -0.316593 -7.58899 -32.9674 classical
1100.0769632 0.41863 0.000223967 -287.241 27.8084 7.98739 2.12996 2.19058 -0.697618 -2.35002 -1.17763 -0.201784 -0.270665 4.18724e-13 0.270665 0.201784 1.17763 2.35002 0.697618 -2.19058 -2.12996 -7.98739 -27.8084 classical
1110.0727876 0.54564 0.000330408 -282.717 30.7562 7.06114 0.560303 1.33901 -0.274864 -1.13107 -0.882942 -0.48183 -0.547328 4.16801e-13 0.547328 0.48183 0.882942 1.13107 0.274864 -1.33901 -0.560303 -7.06114 -30.7562 classical
1120.0483108 0.397869 0.000285886 -286.933 31.5124 13.5427 3.41303 0.900318 -0.649179 -2.09741 -2.10031 -1.20537 -0.478673 4.2223e-13 0.478673 1.20537 2.10031 2.09741 0.649179 -0.900318 -3.41303 -13.5427 -31.5124 classical
1130.061294 0.437973 0.000494607 -274.564 39.921 9.06276 -2.07186 0.136664 0.0662408 -1.47796 -1.32099 -1.09728 -1.14822 4.17841e-13 1.14822 1.09728 1.32099 1.47796 -0.0662408 -0.136664 2.07186 -9.06276 -39.921 classical
1140.0683481 0.511338 0.000413924 -277.875 34.6559 6.29384 -0.819858 1.54985 0.25204 -1.00984 -0.938441 -0.746781 -0.780507 4.15703e-13 0.780507 0.746781 0.938441 1.00984 -0.25204 -1.54985 0.819858 -6.29384 -34.6559 classical
1150.0766009 0.553908 0.000450862 -277.142 35.3639 6.1359 -1.79991 1.0159 0.496776 -1.28129 -1.90298 -1.46278 -1.06044 4.16067e-13 1.06044 1.46278 1.90298 1.28129 -0.496776 -1.0159 1.79991 -6.1359 -35.3639 classical
1160.0625801 0.506964 9.12297e-05 -299.974 17.621 6.89785 -0.442515 -2.06036 -1.08799 -0.389685 -0.613485 -1.08997 -0.945707 4.23594e-13 0.945707 1.08997 0.613485 0.389685 1.08799 2.06036 0.442515 -6.89785 -17.621 classical
1170.0426491 0.447619 6.72422e-05 -304.66 14.4337 9.92551 5.28599 2.04629 0.367799 -0.202665 -0.169595 0.0328155 0.104222 4.24581e-13 -0.104222 -0.0328155 0.169595 0.202665 -0.367799 -2.04629 -5.28599 -9.92551 -14.4337 classical
1180.0646224 0.551113 0.000768043 -267.473 42.4216 6.22066 -3.25908 -2.05713 -1.55198 -0.130279 -0.532176 -0.660506 -0.732004 4.11785e-13 0.732004 0.660506 0.532176 0.130279 1.55198 2.05713 3.25908 -6.22066 -42.4216 classical
1190.0533075 0.414713 0.00037801 -284.261 33.1533 11.3372 -0.0334572 -0.568079 -0.104097 -1.39386 -2.14067 -1.66709 -0.862018 4.21987e-13 0.862018 1.66709 2.14067 1.39386 0.104097 0.568079 0.0334572 -11.3372 -33.1533 classical
1200.0527648 0.508045 7.80672e-05 -303.264 15.0275 8.26425 3.13569 0.977505 0.206664 -0.256686 -0.437978 -0.334911 -0.155211 4.24196e-13 0.155211 0.334911 0.437978 0.256686 -0.206664 -0.977505 -3.13569 -8.26425 -15.0275 classical
1210.0594525 0.484915 0.000286228 -283.557 32.724 9.32803 -1.29454 -0.482421 0.599746 -0.253287 -0.741182 -0.591478 -0.403037 4.21243e-13 0.403037 0.591478 0.741182 0.253287 -0.599746 0.482421 1.29454 -9.32803 -32.724 classical
1220.0823521 0.595008 0.000858216 -260.704 41.622 1.64882 -1.87524 0.806843 -0.747024 0.266713 -0.752861 0.29853 -0.613178 4.0147e-13 0.613178 -0.29853 0.752861 -0.266713 0.747024 -0.806843 1.87524 -1.64882 -41.622 classical
1230.064029 0.535761 0.00083516 -264.055 46.0535 5.71284 -4.45204 -0.206231 -0.35143 -0.699847 0.124726 0.227773 -0.481334 4.12422e-13 0.481334 -0.227773 -0.124726 0.699847 0.35143 0.206231 4.45204 -5.71284 -46.0535 classical
1240.0394449 0.350145 0.000192203 -295.769 23.5441 13.0643 6.03078 3.51208 2.11587 0.712522 0.0280162 -0.0416573 -0.0368618 4.23762e-13 0.0368618 0.0416573 -0.0280162 -0.712522 -2.11587 -3.51208 -6.03078 -13.0643 -23.5441 classical
1250.0615986 0.53108 0.000868036 -265.15 45.4659 6.88793 -3.28353 -0.0121778 -0.0570773 -0.208787 0.26526 0.346655 -0.396106 4.12742e-13 0.396106 -0.346655 -0.26526 0.208787 0.0570773 0.0121778 3.28353 -6.88793 -45.4659 classical
1260.0615252 0.550295 0.000883567 -265.286 46.412 7.98363 -2.86627 0.744474 0.327186 -1.1814 -0.95049 -0.176358 -0.13289 4.14495e-13 0.13289 0.176358 0.95049 1.1814 -0.327186 -0.744474 2.86627 -7.98363 -46.412 classical
1270.0614443 0.535267 0.000970841 -262.814 45.1201 4.76476 -4.06876 -0.00619186 0.417108 1.02223 0.500399 0.0756941 -0.952541 4.09175e-13 0.952541 -0.0756941 -0.500399 -1.02223 -0.417108 0.00619186 4.06876 -4.76476 -45.1201 classical
1280.0501616 0.410353 0.000473729 -279.116 37.7217 12.5774 0.686172 -0.335588 -0.07971 0.170765 0.21834 -0.805383 -1.43716 4.1941e-13 1.43716 0.805383 -0.21834 -0.170765 0.07971 0.335588 -0.686172 -12.5774 -37.7217 classical
1290.0649462 0.522201 0.000749776 -265.833 42.4847 5.09753 -2.4417 0.0942941 -0.146465 0.728314 0.151157 -0.073674 -0.59874 4.09634e-13 0.59874 0.073674 -0.151157 -0.728314 0.146465 -0.0942941 2.4417 -5.09753 -42.4847 classical
1300.0928572 0.589894 0.00015925 -293.394 21.191 3.57244 -2.17194 -0.321364 -0.359296 -1.72727 -1.62244 -0.569558 -0.0724952 4.21011e-13 0.0724952 0.569558 1.62244 1.72727 0.359296 0.321364 2.17194 -3.57244 -21.191 classical
1310.0765643 0.564061 0.000343989 -278.07 33.8966 5.68086 -0.0985328 2.81169 0.668992 -1.38029 -0.987962 -0.180391 -0.316196 4.15186e-13 0.316196 0.180391 0.987962 1.38029 -0.668992 -2.81169 0.0985328 -5.68086 -33.8966 classical
1320.0427601 0.609411 0.000521502 -280.501 38.121 15.4432 2.39023 -0.192052 -0.169797 -0.183123 -0.00142718 0.114316 -0.0242831 4.21965e-13 0.0242831 -0.114316 0.00142718 0.183123 0.169797 0.192052 -2.39023 -15.4432 -38.121 classical
1330.0373472 0.343341 7.84221e-05 -302.948 16.7984 11.9801 6.67924 2.72795 0.705191 0.227171 0.492004 0.73878 0.557113 4.24797e-13 -0.557113 -0.73878 -0.492004 -0.227171 -0.705191 -2.72795 -6.67924 -11.9801 -16.7984 classical
1340.0469661 0.381318 9.30897e-05 -300.877 18.3552 11.0251 4.58402 1.22453 0.282239 0.565442 1.20697 1.48388 1.01666 4.24806e-13 -1.01666 -1.48388 -1.20697 -0.565442 -0.282239 -1.22453 -4.58402 -11.0251 -18.3552 classical
1350.0574252 0.415668 0.000772611 -269.621 41.2653 8.01535 1.94067 4.34993 1.32078 0.127069 0.312216 0.565729 0.390705 4.12512e-13 -0.390705 -0.565729 -0.312216 -0.127069 -1.32078 -4.34993 -1.94067 -8.01535 -41.2653 classical
1360.0849404 0.677503 0.000453644 -272.812 35.4154 0.7384 -3.72171 3.23672 2.02312 -0.456831 -0.6659 -0.315562 -1.02499 4.11308e-13 1.02499 0.315562 0.6659 0.456831 -2.02312 -3.23672 3.72171 -0.7384 -35.4154 classical
1370.0798806 0.409533 0.000290092 -291.476 26.3542 12.4437 5.88836 3.14569 0.561249 -0.406641 -0.692509 -1.2677 -1.21573 4.20583e-13 1.21573 1.2677 0.692509 0.406641 -0.561249 -3.14569 -5.88836 -12.4437 -26.3542 classical
1380.068091 0.633336 0.000673153 -270.493 39.3748 5.10861 -1.49296 2.89569 1.63562 -0.211154 -0.703717 -0.281447 -0.728929 4.12158e-13 0.728929 0.281447 0.703717 0.211154 -1.63562 -2.89569 1.49296 -5.10861 -39.3748 classical
1390.063271 0.397597 0.000281096 -283.222 32.9486 9.26958 -1.21443 -0.128449 1.11683 0.392772 -0.333425 -0.786819 -0.830899 4.20788e-13 0.830899 0.786819 0.333425 -0.392772 -1.11683 0.128449 1.21443 -9.26958 -32.9486 classical
1400.0976081 0.613155 0.000154734 -291.014 21.8443 1.93947 -2.97457 -0.741964 0.122962 0.063058 -0.793328 -1.82589 -1.85437 4.17788e-13 1.85437 1.82589 0.793328 -0.063058 -0.122962 0.741964 2.97457 -1.93947 -21.8443 classical
1410.0724564 0.447752 0.000238653 -284.492 31.1922 8.88289 -0.336403 -0.284525 0.253807 0.333583 -0.00415952 -0.395247 -0.373345 4.20086e-13 0.373345 0.395247 0.00415952 -0.333583 -0.253807 0.284525 0.336403 -8.88289 -31.1922 classical
1420.0628027 0.41155 0.000289869 -289.178 28.1441 10.3728 1.49875 0.957848 1.04474 -0.142333 -0.817205 -0.316973 0.156554 4.2255e-13 -0.156554 0.316973 0.817205 0.142333 -1.04474 -0.957848 -1.49875 -10.3728 -28.1441 classical
1430.0689193 0.540809 0.00170499 -249.198 53.6602 0.388518 -8.60431 0.175294 -0.103357 -0.191754 -0.482762 -0.629468 -1.11426 4.03423e-13 1.11426 0.629468 0.482762 0.191754 0.103357 -0.175294 8.60431 -0.388518 -53.6602 classical
1440.0568875 0.349813 0.00156282 -258.21 51.834 9.7156 -1.88893 0.066806 -0.29605 -0.662434 -1.13688 -0.794607 -0.452461 4.11006e-13 0.452461 0.794607 1.13688 0.662434 0.29605 -0.066806 1.88893 -9.7156 -51.834 classical
1450.0591073 0.405327 0.0002002 -287.623 29.452 9.69413 -0.790665 -1.24323 0.440962 0.614169 -0.543851 -1.98958 -2.00148 4.21301e-13 2.00148 1.98958 0.543851 -0.614169 -0.440962 1.24323 0.790665 -9.69413 -29.452 classical
1460.0566027 0.434215 0.0016993 -255.957 53.2578 8.63552 -4.10296 -0.996529 0.00946034 -0.178898 -0.688537 -0.303566 -0.0722267 4.10869e-13 0.0722267 0.303566 0.688537 0.178898 -0.00946034 0.996529 4.10296 -8.63552 -53.2578 classical
1470.1106 0.630022 0.00150963 -237.844 42.3242 -3.73549 0.548391 0.627906 0.706776 2.49706 -0.159163 0.0829432 0.489749 3.73108e-13 -0.489749 -0.0829432 0.159163 -2.49706 -0.706776 -0.627906 -0.548391 3.73549 -42.3242 classical
1480.055859 0.396051 0.000117867 -295.536 23.5667 11.6709 2.50005 -0.861557 -1.14251 -1.06215 -1.00046 -0.647685 -0.230069 4.24183e-13 0.230069 0.647685 1.00046 1.06215 1.14251 0.861557 -2.50005 -11.6709 -23.5667 classical
1490.0581337 0.448757 0.00222231 -246.111 54.6359 3.27748 -4.30188 2.30943 2.66755 1.71552 0.0994499 -0.870047 -1.77447 3.99e-13 1.77447 0.870047 -0.0994499 -1.71552 -2.66755 -2.30943 4.30188 -3.27748 -54.6359 classical
1500.0976687 0.57994 0.00188063 -240.926 47.304 -2.15521 0.104367 2.82792 0.406577 1.52392 -0.0800737 0.408902 -0.703764 3.81897e-13 0.703764 -0.408902 0.0800737 -1.52392 -0.406577 -2.82792 -0.104367 2.15521 -47.304 classical
1510.0652632 0.471723 9.36486e-05 -301.319 16.946 8.93533 3.60958 1.70021 0.554104 -0.664435 -1.29157 -1.18863 -0.687674 4.23684e-13 0.687674 1.18863 1.29157 0.664435 -0.554104 -1.70021 -3.60958 -8.93533 -16.946 classical
1520.0687055 0.359571 0.000240468 -296.31 24.2477 16.1597 8.69149 3.57004 0.99178 -0.140406 -0.884955 -1.26735 -0.958201 4.23527e-13 0.958201 1.26735 0.884955 0.140406 -0.99178 -3.57004 -8.69149 -16.1597 -24.2477 classical
1530.124561 0.600111 0.000912219 -253.972 35.2878 1.00174 2.96688 1.03772 1.77551 1.61153 0.683137 0.684299 -0.389484 3.84227e-13 0.389484 -0.684299 -0.683137 -1.61153 -1.77551 -1.03772 -2.96688 -1.00174 -35.2878 classical
1540.0796515 0.524884 0.00185852 -243.256 50.8763 -2.50872 -4.2782 2.11457 -0.983111 0.961014 -0.126494 0.213662 -0.755457 3.90342e-13 0.755457 -0.213662 0.126494 -0.961014 0.983111 -2.11457 4.2782 2.50872 -50.8763 classical
1550.0901486 0.675514 0.00206858 -245.511 48.4713 -3.07915 -5.4091 1.54037 -4.17901 -4.70123 -3.70666 -0.311774 -0.641481 3.90678e-13 0.641481 0.311774 3.70666 4.70123 4.17901 -1.54037 5.4091 3.07915 -48.4713 classical
1560.0737054 0.40685 5.35561e-05 -304.626 13.5395 7.74514 3.53273 1.94193 1.22374 0.293488 -0.446358 -0.556982 -0.289737 4.24246e-13 0.289737 0.556982 0.446358 -0.293488 -1.22374 -1.94193 -3.53273 -7.74514 -13.5395 classical
1570.0795354 0.416184 0.0027228 -236.723 52.6814 -3.81714 -2.76974 5.21059 -0.748463 -0.670601 -0.987131 1.74412 -0.0436178 3.83619e-13 0.0436178 -1.74412 0.987131 0.670601 0.748463 -5.21059 2.76974 3.81714 -52.6814 classical
1580.0746921 0.495823 0.000203474 -287.587 27.4644 7.98531 -0.629632 -1.39444 -0.192355 0.247255 0.492841 0.757889 0.538537 4.20188e-13 -0.538537 -0.757889 -0.492841 -0.247255 0.192355 1.39444 0.629632 -7.98531 -27.4644 classical
1590.0521547 0.340669 0.000476353 -275.714 40.4514 10.2458 -4.75181 -3.5544 0.418629 2.38987 2.33162 -0.0999081 -1.86062 4.1966e-13 1.86062 0.0999081 -2.33162 -2.38987 -0.418629 3.5544 4.75181 -10.2458 -40.4514 classical
1600.0743711 0.582322 0.00110734 -256.188 47.0983 1.50803 -3.12847 3.08243 0.52265 0.0476436 -0.202329 -0.450361 -0.593507 4.03236e-13 0.593507 0.450361 0.202329 -0.0476436 -0.52265 -3.08243 3.12847 -1.50803 -47.0983 classical
1610.0951131 0.620059 0.000741006 -261.599 41.6336 2.08443 -1.11997 2.25845 0.271132 -0.539137 -0.802768 -0.356502 -0.37205 4.03308e-13 0.37205 0.356502 0.802768 0.539137 -0.271132 -2.25845 1.11997 -2.08443 -41.6336 classical
1620.0566422 0.555316 0.000367098 -281.859 34.8912 11.2003 -1.04661 -0.906924 1.81332 1.94053 0.74207 -0.398719 -0.704685 4.21248e-13 0.704685 0.398719 -0.74207 -1.94053 -1.81332 0.906924 1.04661 -11.2003 -34.8912 classical
1630.0886876 0.601317 0.000831891 -260.116 41.9898 1.24872 -3.4495 0.682316 1.13827 1.46055 0.0480129 -0.794701 -0.147154 4.03103e-13 0.147154 0.794701 -0.0480129 -1.46055 -1.13827 -0.682316 3.4495 -1.24872 -41.9898 classical
1640.0315096 0.277131 0.00028705 -293.648 28.2932 19.4586 9.76336 2.59221 -1.13361 -2.33103 -2.25492 -1.67638 -0.888612 4.24186e-13 0.888612 1.67638 2.25492 2.33103 1.13361 -2.59221 -9.76336 -19.4586 -28.2932 classical
1650.0484022 0.279973 0.000191645 -297.435 22.7369 14.1032 5.98173 1.21637 -0.648648 -1.21551 -1.43872 -1.40581 -0.910906 4.24033e-13 0.910906 1.40581 1.43872 1.21551 0.648648 -1.21637 -5.98173 -14.1032 -22.7369 classical
1660.0382847 0.450177 0.000306397 -292.127 29.0425 17.6538 6.89906 0.645138 -1.61292 -1.92255 -1.57776 -1.02628 -0.471908 4.24245e-13 0.471908 1.02628 1.57776 1.92255 1.61292 -0.645138 -6.89906 -17.6538 -29.0425 classical
1670.043587 0.316722 0.000397875 -290.619 29.9649 16.8089 6.04462 0.811338 -1.25208 -2.41065 -3.03673 -2.80477 -1.67687 4.2338e-13 1.67687 2.80477 3.03673 2.41065 1.25208 -0.811338 -6.04462 -16.8089 -29.9649 classical
1680.0530013 0.325729 0.000233225 -297.161 23.6078 15.748 7.70503 2.28471 -0.367842 -1.41439 -1.6886 -1.44261 -0.81277 4.24203e-13 0.81277 1.44261 1.6886 1.41439 0.367842 -2.28471 -7.70503 -15.748 -23.6078 classical
1690.08138 0.534221 0.000749534 -262.865 44.3724 2.13318 -5.09594 0.872489 -0.179882 -0.90643 -0.0845451 -0.628412 -1.44634 4.08678e-13 1.44634 0.628412 0.0845451 0.90643 0.179882 -0.872489 5.09594 -2.13318 -44.3724 classical
1700.0753191 0.435943 0.000522132 -269.67 41.7084 4.32165 -6.26533 -0.839609 0.132129 -0.749368 0.202814 -0.0452414 -1.09226 4.14964e-13 1.09226 0.0452414 -0.202814 0.749368 -0.132129 0.839609 6.26533 -4.32165 -41.7084 classical
1710.0654797 0.519488 0.000449205 -281.083 32.289 6.69071 -0.413395 1.59233 0.59198 -0.600739 -0.324825 -0.245733 -0.563006 4.16982e-13 0.563006 0.245733 0.324825 0.600739 -0.59198 -1.59233 0.413395 -6.69071 -32.289 classical
1720.0662993 0.43836 0.00114618 -261.283 46.7382 5.02477 -3.70305 -0.262931 -1.92026 -1.81754 -1.14172 -1.07784 -1.03458 4.08932e-13 1.03458 1.07784 1.14172 1.81754 1.92026 0.262931 3.70305 -5.02477 -46.7382 classical
1730.0640955 0.466152 0.000322476 -285.348 30.2627 8.67804 0.791572 1.86155 1.12141 -0.664286 -0.619221 0.17626 0.305228 4.2044e-13 -0.305228 -0.17626 0.619221 0.664286 -1.12141 -1.86155 -0.791572 -8.67804 -30.2627 classical
1740.0686407 0.507961 0.000614614 -271.575 40.5316 6.34984 -3.95666 -0.74295 -0.595242 -1.47595 -1.07103 -0.945285 -1.09328 4.15287e-13 1.09328 0.945285 1.07103 1.47595 0.595242 0.74295 3.95666 -6.34984 -40.5316 classical
1750.0636205 0.490927 0.000456591 -275.759 38.4131 8.98478 -1.51002 0.0138994 0.258446 -0.488765 -0.331883 -0.191138 -0.387547 4.1775e-13 0.387547 0.191138 0.331883 0.488765 -0.258446 -0.0138994 1.51002 -8.98478 -38.4131 classical
1760.0735629 0.458385 0.000223619 -285.483 28.7115 5.32899 -1.59096 1.35576 0.332319 -2.20054 -1.66193 -0.553857 -0.493129 4.19212e-13 0.493129 0.553857 1.66193 2.20054 -0.332319 -1.35576 1.59096 -5.32899 -28.7115 classical
1770.0660034 0.465908 0.001247 -257.81 49.0681 5.64591 -2.05505 2.15796 -0.12707 -1.17562 -0.42809 -0.247732 -0.920759 4.06796e-13 0.920759 0.247732 0.42809 1.17562 0.12707 -2.15796 2.05505 -5.64591 -49.0681 classical
1780.0405635 0.188471 0.000134796 -299.744 19.9489 12.2184 4.68746 0.0295061 -2.01014 -2.74431 -2.86489 -2.39005 -1.34961 4.23981e-13 1.34961 2.39005 2.86489 2.74431 2.01014 -0.0295061 -4.68746 -12.2184 -19.9489 classical
1790.0328686 0.322263 0.000110194 -300.352 19.6465 12.978 6.0744 1.50126 -0.500885 -1.06208 -1.18036 -1.10754 -0.707119 4.24262e-13 0.707119 1.10754 1.18036 1.06208 0.500885 -1.50126 -6.0744 -12.978 -19.6465 classical
1800.0370486 0.485595 0.000272142 -290.357 30.0207 15.7727 3.7844 -1.49021 -2.32399 -2.06791 -1.73865 -1.1272 -0.444616 4.2424e-13 0.444616 1.1272 1.73865 2.06791 2.32399 1.49021 -3.7844 -15.7727 -30.0207 classical
1810.0441437 0.42999 0.000135692 -299.33 19.8652 11.494 5.00361 2.19295 0.989314 -0.124641 -0.981036 -1.19197 -0.785521 4.23932e-13 0.785521 1.19197 0.981036 0.124641 -0.989314 -2.19295 -5.00361 -11.494 -19.8652 classical
1820.05248 0.486604 0.000190088 -291.366 27.4218 12.1219 1.9477 -0.221961 0.603379 0.910852 0.7277 0.566388 0.336154 4.23941e-13 -0.336154 -0.566388 -0.7277 -0.910852 -0.603379 0.221961 -1.9477 -12.1219 -27.4218 classical
1830.0835901 0.491289 0.00062862 -263.809 41.9403 0.621009 -4.01004 1.6095 -1.42498 -1.34364 0.0115798 -0.633823 -1.12738 4.06569e-13 1.12738 0.633823 -0.0115798 1.34364 1.42498 -1.6095 4.01004 -0.621009 -41.9403 classical
1840.0369908 0.344131 0.000341401 -286.507 34.0084 16.8159 3.02463 -1.90769 -1.48252 -0.629235 -0.690148 -0.776314 -0.461881 4.2419e-13 0.461881 0.776314 0.690148 0.629235 1.48252 1.90769 -3.02463 -16.8159 -34.0084 classical
1850.0475845 0.325898 0.000203037 -289.537 29.1769 12.4173 1.61672 -0.465345 0.218801 -0.130625 -1.00048 -1.19341 -0.705759 4.23406e-13 0.705759 1.19341 1.00048 0.130625 -0.218801 0.465345 -1.61672 -12.4173 -29.1769 classical
1860.0883464 0.598962 0.000320383 -276.288 34.4372 2.49603 -5.06451 -0.561964 -0.0269167 -0.592289 -0.0697787 0.175595 0.0768751 4.15498e-13 -0.0768751 -0.175595 0.0697787 0.592289 0.0269167 0.561964 5.06451 -2.49603 -34.4372 classical
1870.0593687 0.537525 0.000309898 -281.475 34.351 9.4421 -1.20807 -0.488994 0.227364 -0.381411 -0.879197 -1.17093 -0.947488 4.20024e-13 0.947488 1.17093 0.879197 0.381411 -0.227364 0.488994 1.20807 -9.4421 -34.351 classical
1880.0405273 0.370162 0.00019453 -291.52 28.5079 14.8148 3.79458 -0.58969 -0.963826 -0.693678 -0.902506 -1.21541 -0.958983 4.2377e-13 0.958983 1.21541 0.902506 0.693678 0.963826 0.58969 -3.79458 -14.8148 -28.5079 classical
1890.0595391 0.596326 0.000200078 -288.927 29.0714 11.1562 0.846625 -0.315252 0.252322 -0.52212 -1.23095 -1.08402 -0.560601 4.22964e-13 0.560601 1.08402 1.23095 0.52212 -0.252322 0.315252 -0.846625 -11.1562 -29.0714 classical
1900.120779 0.638789 0.000487858 -267.213 31.977 -8.59758 -7.18616 -0.579415 -2.09196 -1.03014 -1.25563 0.332611 0.284034 4.01454e-13 -0.284034 -0.332611 1.25563 1.03014 2.09196 0.579415 7.18616 8.59758 -31.977 classical
1910.122172 0.628626 0.000295622 -275.5 28.672 -4.73458 -4.71266 0.00492528 -1.02462 0.0732006 -1.15415 -2.24491 -1.95309 4.06301e-13 1.95309 2.24491 1.15415 -0.0732006 1.02462 -0.00492528 4.71266 4.73458 -28.672 classical
1920.101608 0.496243 0.000562079 -264.854 36.4525 -3.65706 -2.93243 3.61571 0.9382 0.753508 0.620951 2.05162 1.05991 4.02684e-13 -1.05991 -2.05162 -0.620951 -0.753508 -0.9382 -3.61571 2.93243 3.65706 -36.4525 classical
1930.0786256 0.446343 0.000967042 -259.087 44.5708 1.07491 -0.890098 5.44617 1.5582 -0.498762 -0.649917 0.0885972 -0.646956 4.0333e-13 0.646956 -0.0885972 0.649917 0.498762 -1.5582 -5.44617 0.890098 -1.07491 -44.5708 classical
1940.083617 0.613717 0.00107708 -259.544 44.0048 -0.076037 -6.91324 -1.81862 1.60773 4.00327 1.28751 -0.133421 -0.866838 4.05104e-13 0.866838 0.133421 -1.28751 -4.00327 -1.60773 1.81862 6.91324 0.076037 -44.0048 classical
1950.0798642 0.460089 0.000267088 -282.146 30.9418 5.09171 -1.02584 2.61444 1.58905 -0.762682 -0.782432 -0.344011 -0.460543 4.1748e-13 0.460543 0.344011 0.782432 0.762682 -1.58905 -2.61444 1.02584 -5.09171 -30.9418 classical
1960.11126 0.583998 0.000123178 -291.036 19.6031 -1.41995 -2.66742 1.77053 -0.0970439 -2.18933 -1.53215 -0.463613 -0.426115 4.16128e-13 0.426115 0.463613 1.53215 2.18933 0.0970439 -1.77053 2.66742 1.41995 -19.6031 classical
1970.102343 0.569626 0.0010371 -252.096 42.1919 -5.14305 -1.53557 4.46281 0.0409608 1.03288 -0.827181 0.680902 0.0333018 3.91506e-13 -0.0333018 -0.680902 0.827181 -1.03288 -0.0409608 -4.46281 1.53557 5.14305 -42.1919 classical
1980.0798396 0.570818 0.000672945 -266.752 41.4595 3.96967 -3.41225 0.369245 0.899661 -0.406333 -1.97261 -0.317395 0.338831 4.11458e-13 -0.338831 0.317395 1.97261 0.406333 -0.899661 -0.369245 3.41225 -3.96967 -41.4595 classical
1990.0970668 0.563327 0.00044704 -271.48 33.6239 -0.02259 -1.06098 2.86724 0.967257 1.16499 -0.0676922 0.376385 0.403632 4.07099e-13 -0.403632 -0.376385 0.0676922 -1.16499 -0.967257 -2.86724 1.06098 0.02259 -33.6239 classical
2000.0767703 0.443199 0.000142791 -292.658 23.4072 7.65593 1.27736 0.497612 -0.0822465 0.0272182 0.496366 0.703275 0.507799 4.21245e-13 -0.507799 -0.703275 -0.496366 -0.0272182 0.0822465 -0.497612 -1.27736 -7.65593 -23.4072 classical
2010.141396 0.382471 0.00346898 -223.732 36.1445 0.516109 7.13827 3.56564 3.84405 0.864285 0.0907526 0.910287 -0.344154 3.44271e-13 0.344154 -0.910287 -0.0907526 -0.864285 -3.84405 -3.56564 -7.13827 -0.516109 -36.1445 country
2020.152265 0.567942 0.003027 -217.557 35.5386 -4.97472 4.12396 3.10989 2.70261 0.511928 0.180906 1.54948 -0.477164 3.35971e-13 0.477164 -1.54948 -0.180906 -0.511928 -2.70261 -3.10989 -4.12396 4.97472 -35.5386 country
2030.128211 0.567478 0.0018836 -244.169 37.9003 3.19682 7.41334 3.83347 3.37953 1.02598 -0.638266 0.997611 -0.945346 3.72571e-13 0.945346 -0.997611 0.638266 -1.02598 -3.37953 -3.83347 -7.41334 -3.19682 -37.9003 country
2040.105982 0.514032 0.00267332 -230.782 44.2592 -4.05559 2.45769 5.73473 0.838319 0.0547755 -0.578065 2.16532 -1.23372 3.62898e-13 1.23372 -2.16532 0.578065 -0.0547755 -0.838319 -5.73473 -2.45769 4.05559 -44.2592 country
2050.154946 0.57414 0.0027597 -220.502 34.969 -3.81738 6.1499 3.42686 1.07741 0.303306 -0.461082 1.13037 -0.343416 3.38101e-13 0.343416 -1.13037 0.461082 -0.303306 -1.07741 -3.42686 -6.1499 3.81738 -34.969 country
2060.151213 0.614504 0.00266214 -220.776 36.4044 -6.48465 2.26227 2.18142 2.32236 1.65342 -0.980219 1.37963 -0.393242 3.41859e-13 0.393242 -1.37963 0.980219 -1.65342 -2.32236 -2.18142 -2.26227 6.48465 -36.4044 country
2070.138865 0.531242 0.00301111 -221.683 37.9513 -1.40473 4.1859 1.33967 3.04257 0.881489 -1.37997 1.24868 0.821677 3.4567e-13 -0.821677 -1.24868 1.37997 -0.881489 -3.04257 -1.33967 -4.1859 1.40473 -37.9513 country
2080.145018 0.395324 0.00329869 -220.738 35.3591 -0.983962 6.54417 1.85807 2.53263 2.38784 -0.991148 0.606685 -0.569122 3.38817e-13 0.569122 -0.606685 0.991148 -2.38784 -2.53263 -1.85807 -6.54417 0.983962 -35.3591 country
2090.13679 0.525774 0.00357891 -216.785 38.4443 -3.96221 3.02373 1.51851 2.66055 2.20524 -0.455654 1.34864 -0.466545 3.38659e-13 0.466545 -1.34864 0.455654 -2.20524 -2.66055 -1.51851 -3.02373 3.96221 -38.4443 country
2100.174488 0.594914 0.0030485 -212.893 31.2829 -2.95413 5.0116 1.32668 3.13212 -0.208109 -0.130217 1.1745 -0.562377 3.24511e-13 0.562377 -1.1745 0.130217 0.208109 -3.13212 -1.32668 -5.0116 2.95413 -31.2829 country
2110.0965339 0.556976 0.00120911 -254.125 43.8587 0.0838584 0.114912 3.69167 -1.49215 -1.89548 -0.251034 0.790136 -0.415154 3.94879e-13 0.415154 -0.790136 0.251034 1.89548 1.49215 -3.69167 -0.114912 -0.0838584 -43.8587 country
2120.132168 0.564686 0.00106647 -256.849 34.9372 3.37959 2.87238 1.29053 0.853032 -1.34578 0.19347 0.267977 -1.96751 3.86164e-13 1.96751 -0.267977 -0.19347 1.34578 -0.853032 -1.29053 -2.87238 -3.37959 -34.9372 country
2130.0805273 0.56843 0.00157213 -254.321 46.2842 6.34261 2.7955 2.18289 -0.277376 -0.45941 -1.08061 -0.560789 -0.158333 3.97879e-13 0.158333 0.560789 1.08061 0.45941 0.277376 -2.18289 -2.7955 -6.34261 -46.2842 country
2140.138937 0.641904 0.00100855 -249.077 36.6617 -0.370231 1.79952 1.45228 1.94392 -0.720377 0.0682864 0.265016 -0.563728 3.80308e-13 0.563728 -0.265016 -0.0682864 0.720377 -1.94392 -1.45228 -1.79952 0.370231 -36.6617 country
2150.165188 0.643187 0.00110121 -247.873 31.9138 2.14977 4.87064 0.633542 3.12518 0.908393 1.3231 -0.44435 -0.627604 3.722e-13 0.627604 0.44435 -1.3231 -0.908393 -3.12518 -0.633542 -4.87064 -2.14977 -31.9138 country
2160.0997482 0.629264 0.00122745 -256.563 41.1324 3.31621 3.92918 3.56865 0.119253 0.4325 -1.95075 0.00611788 -1.06248 3.9312e-13 1.06248 -0.00611788 1.95075 -0.4325 -0.119253 -3.56865 -3.92918 -3.31621 -41.1324 country
2170.0705413 0.564226 0.00103612 -263.53 44.1615 6.27703 2.53957 5.04155 -1.50537 -1.80341 -1.27597 -1.28876 0.101688 4.07495e-13 -0.101688 1.28876 1.27597 1.80341 1.50537 -5.04155 -2.53957 -6.27703 -44.1615 country
2180.0504044 0.482088 0.00123163 -266.811 46.9243 13.9816 2.34953 2.03335 1.39858 -0.464455 -1.2746 -0.981651 -0.794202 4.14861e-13 0.794202 0.981651 1.2746 0.464455 -1.39858 -2.03335 -2.34953 -13.9816 -46.9243 country
2190.101423 0.52945 0.00117306 -254.475 41.5533 1.39756 -0.257783 3.1228 5.20464 2.91447 -0.0138211 0.466757 0.0744082 3.94914e-13 -0.0744082 -0.466757 0.0138211 -2.91447 -5.20464 -3.1228 0.257783 -1.39756 -41.5533 country
2200.0509707 0.404734 0.00101919 -272.021 42.4321 10.7384 -0.37327 3.21258 3.28491 0.731962 -0.104806 0.047193 -0.45631 4.17681e-13 0.45631 -0.047193 0.104806 -0.731962 -3.28491 -3.21258 0.37327 -10.7384 -42.4321 country
2210.125134 0.563245 0.00141722 -251.639 34.6279 4.13147 9.43684 3.7043 0.0483528 3.06827 -0.335625 0.958642 -0.269593 3.76713e-13 0.269593 -0.958642 0.335625 -3.06827 -0.0483528 -3.7043 -9.43684 -4.13147 -34.6279 country
2220.053789 0.54601 0.00136246 -264.116 47.3525 9.48526 0.141501 4.0577 2.65429 0.118697 -1.12105 -1.12536 -0.621178 4.13262e-13 0.621178 1.12536 1.12105 -0.118697 -2.65429 -4.0577 -0.141501 -9.48526 -47.3525 country
2230.0941843 0.638261 0.00117175 -257.101 42.4927 3.81755 3.98657 5.76351 0.258253 -3.13582 -2.08641 -0.373363 -1.35025 3.95811e-13 1.35025 0.373363 2.08641 3.13582 -0.258253 -5.76351 -3.98657 -3.81755 -42.4927 country
2240.0678724 0.311836 0.00052381 -288.649 28.2141 14.9553 8.24321 4.35895 2.92617 1.24109 0.44986 0.79123 0.578936 4.19678e-13 -0.578936 -0.79123 -0.44986 -1.24109 -2.92617 -4.35895 -8.24321 -14.9553 -28.2141 country
2250.097181 0.538903 0.00125745 -254.511 40.5863 1.09495 2.69503 5.09005 -0.0189358 1.01118 -1.40299 -0.360995 -1.33848 3.89784e-13 1.33848 0.360995 1.40299 -1.01118 0.0189358 -5.09005 -2.69503 -1.09495 -40.5863 country
2260.0918607 0.484388 0.000959823 -262.347 40.4268 5.42054 2.2208 2.84688 1.19982 1.367 0.00803298 -0.105085 -0.403001 4.01349e-13 0.403001 0.105085 -0.00803298 -1.367 -1.19982 -2.84688 -2.2208 -5.42054 -40.4268 country
2270.0579371 0.459637 0.00134256 -261.464 47.734 8.17053 -1.17438 2.99677 2.66328 0.474793 -0.324051 0.596808 0.0106163 4.10756e-13 -0.0106163 -0.596808 0.324051 -0.474793 -2.66328 -2.99677 1.17438 -8.17053 -47.734 country
2280.110235 0.673736 0.00172654 -240.414 45.4159 -4.18612 -0.615056 5.31182 1.45654 -0.400552 0.39769 0.17825 -1.08913 3.795e-13 1.08913 -0.17825 -0.39769 0.400552 -1.45654 -5.31182 0.615056 4.18612 -45.4159 country
2290.0766441 0.531846 0.00123624 -256.741 46.9672 3.55443 -1.04178 4.49169 1.34422 -0.585076 0.580934 -0.178014 -2.21512 4.01673e-13 2.21512 0.178014 -0.580934 0.585076 -1.34422 -4.49169 1.04178 -3.55443 -46.9672 country
2300.0639477 0.558909 0.00152523 -257.887 49.5278 6.77073 -0.531978 4.64719 1.24291 -2.31908 -1.43554 -0.421904 -0.813152 4.07492e-13 0.813152 0.421904 1.43554 2.31908 -1.24291 -4.64719 0.531978 -6.77073 -49.5278 country
2310.0528616 0.335723 0.000865736 -278.175 38.4029 17.2298 7.50383 2.8879 0.41153 -1.11202 -2.06908 -1.58889 -0.815582 4.17411e-13 0.815582 1.58889 2.06908 1.11202 -0.41153 -2.8879 -7.50383 -17.2298 -38.4029 country
2320.0943084 0.433607 0.00127434 -253.075 43.4561 0.865693 0.784248 4.65461 0.700351 -1.04647 -0.291897 0.538543 -0.873975 3.92954e-13 0.873975 -0.538543 0.291897 1.04647 -0.700351 -4.65461 -0.784248 -0.865693 -43.4561 country
2330.0918554 0.32765 0.000548881 -275.192 32.9083 6.36916 4.75152 4.52337 0.818366 0.618405 1.17972 1.15354 0.24485 4.0831e-13 -0.24485 -1.15354 -1.17972 -0.618405 -0.818366 -4.52337 -4.75152 -6.36916 -32.9083 country
2340.118183 0.597894 0.00106837 -256.196 37.3458 1.76059 5.10681 4.4536 -0.946412 0.151274 0.138262 -0.023777 -0.429267 3.87999e-13 0.429267 0.023777 -0.138262 -0.151274 0.946412 -4.4536 -5.10681 -1.76059 -37.3458 country
2350.128767 0.664311 0.000789791 -260.919 35.1128 2.85527 2.12939 0.647361 1.3423 1.64085 1.27495 0.366218 0.799584 3.94489e-13 -0.799584 -0.366218 -1.27495 -1.64085 -1.3423 -0.647361 -2.12939 -2.85527 -35.1128 country
2360.112557 0.600153 0.00135872 -246.9 41.4276 0.352087 1.06393 2.82934 1.91202 -2.42427 0.254341 1.76532 -2.09481 3.81559e-13 2.09481 -1.76532 -0.254341 2.42427 -1.91202 -2.82934 -1.06393 -0.352087 -41.4276 country
2370.0933974 0.439824 0.000354064 -285.264 25.8714 5.3279 4.8403 6.69197 3.03102 1.16845 1.39079 1.50568 0.484069 4.13684e-13 -0.484069 -1.50568 -1.39079 -1.16845 -3.03102 -6.69197 -4.8403 -5.3279 -25.8714 country
2380.108868 0.476745 0.000849652 -264.561 37.0852 5.76976 3.33477 4.33292 4.31102 0.332947 -0.808417 -0.37794 -0.924084 4.00646e-13 0.924084 0.37794 0.808417 -0.332947 -4.31102 -4.33292 -3.33477 -5.76976 -37.0852 country
2390.144681 0.64112 0.00113491 -248.184 35.3666 0.299287 4.0864 1.65481 1.5733 0.149034 -0.565758 0.211168 0.353156 3.77301e-13 -0.353156 -0.211168 0.565758 -0.149034 -1.5733 -1.65481 -4.0864 -0.299287 -35.3666 country
2400.185517 0.732544 0.00112679 -241.472 29.242 -2.87769 7.05297 4.40266 2.00137 -0.0916686 -0.865415 -0.381021 -0.169863 3.59757e-13 0.169863 0.381021 0.865415 0.0916686 -2.00137 -4.40266 -7.05297 2.87769 -29.242 country
2410.13499 0.643918 0.00124466 -248.01 36.8381 -1.24257 4.22002 5.28699 2.79879 0.0233607 -0.570046 0.00200931 -0.602456 3.78244e-13 0.602456 -0.00200931 0.570046 -0.0233607 -2.79879 -5.28699 -4.22002 1.24257 -36.8381 country
2420.137892 0.560038 0.00149348 -243.161 35.0367 0.769728 6.39583 5.8276 3.83437 -1.75461 0.762659 0.800336 -1.25969 3.68526e-13 1.25969 -0.800336 -0.762659 1.75461 -3.83437 -5.8276 -6.39583 -0.769728 -35.0367 country
2430.122427 0.566527 0.00157029 -245.963 37.8325 2.83723 7.9503 5.0898 3.03629 0.833987 0.358826 -0.361023 -1.31433 3.74761e-13 1.31433 0.361023 -0.358826 -0.833987 -3.03629 -5.0898 -7.9503 -2.83723 -37.8325 country
2440.134745 0.648681 0.00122965 -244.253 38.5426 -4.30771 -0.82412 1.27406 1.39203 1.19468 0.0648692 -0.164161 -0.72562 3.7678e-13 0.72562 0.164161 -0.0648692 -1.19468 -1.39203 -1.27406 0.82412 4.30771 -38.5426 country
2450.0699616 0.358288 0.00127618 -262.984 41.8849 9.26318 1.2221 1.59664 3.1898 0.314509 0.939559 0.479606 -0.291364 4.04995e-13 0.291364 -0.479606 -0.939559 -0.314509 -3.1898 -1.59664 -1.2221 -9.26318 -41.8849 country
2460.148956 0.727229 0.00179397 -234.374 36.8017 -2.74765 2.46737 0.988717 1.13019 0.033744 -0.689452 0.0634177 -1.10184 3.59955e-13 1.10184 -0.0634177 0.689452 -0.033744 -1.13019 -0.988717 -2.46737 2.74765 -36.8017 country
2470.115329 0.663327 0.00138913 -245.934 41.9079 -5.68329 2.86321 11.1023 -0.62782 -0.349301 -1.23022 -0.81286 -0.71826 3.80667e-13 0.71826 0.81286 1.23022 0.349301 0.62782 -11.1023 -2.86321 5.68329 -41.9079 country
2480.0940363 0.57306 0.00124376 -250.763 44.5412 -3.19511 -0.554768 6.06664 -2.02588 1.24141 1.29587 -0.0232896 -0.336042 3.91085e-13 0.336042 0.0232896 -1.29587 -1.24141 2.02588 -6.06664 0.554768 3.19511 -44.5412 country
2490.0977324 0.621268 0.00154582 -252.151 41.2165 5.14622 5.20248 4.44855 1.82469 -2.22363 0.138491 0.553288 -2.12677 3.86792e-13 2.12677 -0.553288 -0.138491 2.22363 -1.82469 -4.44855 -5.20248 -5.14622 -41.2165 country
2500.0782157 0.607349 0.0019513 -247.141 49.9676 3.32118 0.0881036 2.44982 -0.906535 -1.07542 -0.935276 -0.307642 0.130417 3.93964e-13 -0.130417 0.307642 0.935276 1.07542 0.906535 -2.44982 -0.0881036 -3.32118 -49.9676 country
2510.0865355 0.461138 0.00131534 -255.5 41.3583 2.98517 4.12624 3.52233 0.204041 2.04062 0.182046 1.29809 -0.539882 3.91819e-13 0.539882 -1.29809 -0.182046 -2.04062 -0.204041 -3.52233 -4.12624 -2.98517 -41.3583 country
2520.0716961 0.372009 0.00128699 -262.268 42.1801 7.50966 6.01059 5.9435 2.46617 1.61051 -0.835994 0.268117 -0.203225 4.02223e-13 0.203225 -0.268117 0.835994 -1.61051 -2.46617 -5.9435 -6.01059 -7.50966 -42.1801 country
2530.0516072 0.330429 0.000874244 -277.426 36.4581 12.3522 6.61985 5.15496 1.84137 0.904913 1.18973 1.62811 0.733391 4.15097e-13 -0.733391 -1.62811 -1.18973 -0.904913 -1.84137 -5.15496 -6.61985 -12.3522 -36.4581 country
2540.11883 0.558158 0.00167583 -240.357 39.5252 -0.778534 7.40167 4.0907 -0.395456 2.1582 -2.63963 0.987741 -0.929762 3.68016e-13 0.929762 -0.987741 2.63963 -2.1582 0.395456 -4.0907 -7.40167 0.778534 -39.5252 country
2550.0805512 0.374402 0.00134013 -258.787 40.1187 5.11796 8.02405 5.91074 0.974973 2.18671 -0.563673 0.634997 0.0293231 3.941e-13 -0.0293231 -0.634997 0.563673 -2.18671 -0.974973 -5.91074 -8.02405 -5.11796 -40.1187 country
2560.0982262 0.558462 0.00206817 -238.513 45.0366 -0.6426 3.41532 2.32145 0.0786366 2.14197 -2.3727 0.99253 -0.980056 3.73917e-13 0.980056 -0.99253 2.3727 -2.14197 -0.0786366 -2.32145 -3.41532 0.6426 -45.0366 country
2570.0701852 0.320824 0.00174622 -256.386 41.2302 6.27386 6.67001 4.64913 1.62276 2.56708 0.205357 1.09766 -0.680605 3.92045e-13 0.680605 -1.09766 -0.205357 -2.56708 -1.62276 -4.64913 -6.67001 -6.27386 -41.2302 country
2580.079802 0.506813 0.00149127 -254.576 44.2846 3.81469 3.56174 4.89747 0.276884 0.583173 0.14934 1.14598 -1.24321 3.93808e-13 1.24321 -1.14598 -0.14934 -0.583173 -0.276884 -4.89747 -3.56174 -3.81469 -44.2846 country
2590.0864132 0.483732 0.00217817 -245.354 43.3841 4.34237 8.69049 4.12453 -2.25192 0.662588 -1.24887 1.18461 -0.31139 3.78732e-13 0.31139 -1.18461 1.24887 -0.662588 2.25192 -4.12453 -8.69049 -4.34237 -43.3841 country
2600.0629253 0.374025 0.00147659 -267.396 38.3337 12.621 11.2614 6.19257 1.04002 0.65638 -0.724865 0.724749 -0.049905 4.01804e-13 0.049905 -0.724749 0.724865 -0.65638 -1.04002 -6.19257 -11.2614 -12.621 -38.3337 country
2610.0620577 0.311594 0.00177383 -260.794 41.5069 9.77028 8.19606 4.30891 0.970039 1.60647 0.0210585 1.79236 0.293201 3.98099e-13 -0.293201 -1.79236 -0.0210585 -1.60647 -0.970039 -4.30891 -8.19606 -9.77028 -41.5069 country
2620.0713365 0.339535 0.00118816 -264.131 39.9348 9.60228 7.48354 4.49813 1.42551 0.705861 -1.9165 -0.170641 0.339083 4.01839e-13 -0.339083 0.170641 1.9165 -0.705861 -1.42551 -4.49813 -7.48354 -9.60228 -39.9348 country
2630.111658 0.63066 0.00170673 -242.217 40.9979 0.0604274 5.65721 2.16364 -1.43698 2.10741 -2.06832 0.679328 -0.696309 3.7295e-13 0.696309 -0.679328 2.06832 -2.10741 1.43698 -2.16364 -5.65721 -0.0604274 -40.9979 country
2640.083517 0.464871 0.00170042 -256.264 39.5507 8.43478 9.16209 3.32069 -0.60606 1.69572 -1.59043 1.43642 0.628418 3.89291e-13 -0.628418 -1.43642 1.59043 -1.69572 0.60606 -3.32069 -9.16209 -8.43478 -39.5507 country
2650.0766158 0.430277 0.00100185 -263.15 41.2104 6.16131 2.85317 2.74345 0.820066 1.07033 -1.72757 -0.372876 0.321299 4.03757e-13 -0.321299 0.372876 1.72757 -1.07033 -0.820066 -2.74345 -2.85317 -6.16131 -41.2104 country
2660.0389854 0.3691 0.00134663 -271.987 43.0179 15.0367 5.18837 3.65004 1.46684 1.02689 0.610957 0.210723 -0.313843 4.1563e-13 0.313843 -0.210723 -0.610957 -1.02689 -1.46684 -3.65004 -5.18837 -15.0367 -43.0179 country
2670.0904836 0.620015 0.00189002 -241.172 49.0483 -4.82301 -3.4228 5.38477 -0.618295 0.174491 -0.553901 1.40623 -1.4975 3.83929e-13 1.4975 -1.40623 0.553901 -0.174491 0.618295 -5.38477 3.4228 4.82301 -49.0483 country
2680.0493523 0.461782 0.000823041 -278.735 36.8392 13.778 6.10776 4.77932 1.23795 -0.736709 0.445064 1.44019 0.131855 4.16868e-13 -0.131855 -1.44019 -0.445064 0.736709 -1.23795 -4.77932 -6.10776 -13.778 -36.8392 country
2690.0638598 0.541688 0.00102573 -267.316 43.2237 8.6272 -0.167512 1.31555 1.14508 1.33262 1.19194 1.43583 0.366499 4.12166e-13 -0.366499 -1.43583 -1.19194 -1.33262 -1.14508 -1.31555 0.167512 -8.6272 -43.2237 country
2700.0702157 0.436383 0.00107155 -263.352 41.1941 1.50413 0.860807 7.31416 2.81415 0.554267 0.0928814 0.418936 -0.0698595 4.04812e-13 0.0698595 -0.418936 -0.0928814 -0.554267 -2.81415 -7.31416 -0.860807 -1.50413 -41.1941 country
2710.0957562 0.602538 0.00156842 -248.417 44.1718 -0.596769 2.66751 4.81811 -0.532005 2.10893 -0.418658 0.562204 -0.988486 3.85979e-13 0.988486 -0.562204 0.418658 -2.10893 0.532005 -4.81811 -2.66751 0.596769 -44.1718 country
2720.0662922 0.471346 0.00141625 -258.514 46.0397 7.70937 1.22763 3.13299 0.882683 0.0280376 -0.80112 0.273443 -0.740726 4.02799e-13 0.740726 -0.273443 0.80112 -0.0280376 -0.882683 -3.13299 -1.22763 -7.70937 -46.0397 country
2730.0895146 0.589421 0.00182203 -246.332 46.2869 0.16115 2.32145 2.99526 -2.80123 -0.138421 -0.737141 1.88072 0.251013 3.86263e-13 -0.251013 -1.88072 0.737141 0.138421 2.80123 -2.99526 -2.32145 -0.16115 -46.2869 country
2740.0762033 0.470952 0.001155 -260.14 43.0314 4.95063 2.72852 3.75248 0.534658 1.17811 0.452291 1.09375 -0.372568 4.00804e-13 0.372568 -1.09375 -0.452291 -1.17811 -0.534658 -3.75248 -2.72852 -4.95063 -43.0314 country
2750.0575454 0.386834 0.000482238 -280.388 33.0331 10.0067 3.13321 2.23051 1.23486 1.37454 0.859984 0.459887 -0.392122 4.15391e-13 0.392122 -0.459887 -0.859984 -1.37454 -1.23486 -2.23051 -3.13321 -10.0067 -33.0331 country
2760.113438 0.594304 0.00215708 -233.983 41.408 -3.16504 3.84572 0.399345 -1.94069 5.8471 0.197635 2.59673 -0.614429 3.62039e-13 0.614429 -2.59673 -0.197635 -5.8471 1.94069 -0.399345 -3.84572 3.16504 -41.408 country
2770.0725184 0.596467 0.00179039 -251.025 48.1983 2.18161 -0.0659999 5.34743 -0.827759 0.0359457 -0.707835 0.409807 -0.388412 3.95731e-13 0.388412 -0.409807 0.707835 -0.0359457 0.827759 -5.34743 0.0659999 -2.18161 -48.1983 country
2780.0728157 0.597147 0.00152838 -250.159 50.2672 0.936553 -3.14004 2.4836 -1.18078 -1.17194 0.400537 2.0097 -0.695641 3.978e-13 0.695641 -2.0097 -0.400537 1.17194 1.18078 -2.4836 3.14004 -0.936553 -50.2672 country
2790.0655432 0.412183 0.000386999 -283.265 31.1981 9.34359 2.51317 1.8099 -0.161706 0.443075 1.35181 1.14582 0.310702 4.1729e-13 -0.310702 -1.14582 -1.35181 -0.443075 0.161706 -1.8099 -2.51317 -9.34359 -31.1981 country
2800.0469483 0.438759 0.00149128 -264.948 46.0704 14.7149 3.87929 1.43155 -0.167389 0.341766 -0.566788 0.0558883 -0.354725 4.10122e-13 0.354725 -0.0558883 0.566788 -0.341766 0.167389 -1.43155 -3.87929 -14.7149 -46.0704 country
2810.10381 0.597911 0.00192499 -243.223 41.8726 1.13323 4.9054 4.00425 1.41577 2.49516 -1.24293 1.82164 -1.53735 3.75102e-13 1.53735 -1.82164 1.24293 -2.49516 -1.41577 -4.00425 -4.9054 -1.13323 -41.8726 country
2820.103026 0.594167 0.00194449 -240.537 43.8568 -1.97799 3.78873 5.14664 0.781438 1.60931 -2.24339 0.815227 -1.47455 3.74809e-13 1.47455 -0.815227 2.24339 -1.60931 -0.781438 -5.14664 -3.78873 1.97799 -43.8568 country
2830.118434 0.644818 0.00230366 -232.545 42.3915 -3.86891 4.9296 4.97493 0.697511 2.15677 -2.82362 0.748685 -2.5862 3.60979e-13 2.5862 -0.748685 2.82362 -2.15677 -0.697511 -4.97493 -4.9296 3.86891 -42.3915 country
2840.0624082 0.417695 0.00154208 -258.77 45.4397 6.44927 2.9684 5.73046 2.44389 0.312761 -1.40399 -0.10293 -0.994685 4.0218e-13 0.994685 0.10293 1.40399 -0.312761 -2.44389 -5.73046 -2.9684 -6.44927 -45.4397 country
2850.0975952 0.551144 0.00201971 -241.298 45.0804 -1.9967 4.69905 7.26356 0.328505 0.545571 -2.49734 0.152704 -1.57682 3.76999e-13 1.57682 -0.152704 2.49734 -0.545571 -0.328505 -7.26356 -4.69905 1.9967 -45.0804 country
2860.0805416 0.426626 0.00172119 -251.581 44.2543 1.40498 2.85199 6.01757 1.83453 1.1618 -1.01942 0.765294 -1.16567 3.90753e-13 1.16567 -0.765294 1.01942 -1.1618 -1.83453 -6.01757 -2.85199 -1.40498 -44.2543 country
2870.10117 0.626316 0.00206209 -237.975 45.2286 -2.14858 3.3436 4.02599 0.633828 2.11539 -2.11642 0.681347 -1.64066 3.73136e-13 1.64066 -0.681347 2.11642 -2.11539 -0.633828 -4.02599 -3.3436 2.14858 -45.2286 country
2880.0780536 0.509228 0.0010061 -262.535 42.0375 4.98187 1.41115 3.22331 0.556919 0.503031 -0.350784 0.181878 -0.997175 4.03032e-13 0.997175 -0.181878 0.350784 -0.503031 -0.556919 -3.22331 -1.41115 -4.98187 -42.0375 country
2890.0834442 0.515613 0.00210937 -243.979 47.2476 0.406894 3.00172 5.00936 0.257885 0.0558164 -1.8345 0.683645 -1.27639 3.83989e-13 1.27639 -0.683645 1.8345 -0.0558164 -0.257885 -5.00936 -3.00172 -0.406894 -47.2476 country
2900.0692331 0.481246 0.000921267 -268.336 40.8554 8.99325 2.78357 3.56781 1.39653 -0.303507 -0.268045 0.542976 -0.743256 4.09046e-13 0.743256 -0.542976 0.268045 0.303507 -1.39653 -3.56781 -2.78357 -8.99325 -40.8554 country
2910.0998453 0.533984 0.00222468 -236.559 45.7925 -3.19352 3.02321 5.47052 0.640555 1.44114 -1.96961 1.13437 -1.83383 3.7173e-13 1.83383 -1.13437 1.96961 -1.44114 -0.640555 -5.47052 -3.02321 3.19352 -45.7925 country
2920.0803855 0.493746 0.000885114 -264.551 40.7402 4.38341 1.85262 4.57219 -0.0361965 -0.606529 -0.654296 -0.0789596 -0.774002 4.04142e-13 0.774002 0.0789596 0.654296 0.606529 0.0361965 -4.57219 -1.85262 -4.38341 -40.7402 country
2930.121164 0.586821 0.00241645 -228.145 43.1938 -6.43266 5.43266 6.45871 -1.41416 3.10718 -3.23048 0.622222 -1.75227 3.5579e-13 1.75227 -0.622222 3.23048 -3.10718 1.41416 -6.45871 -5.43266 6.43266 -43.1938 country
2940.0760324 0.404049 0.00134054 -258.958 45.4404 5.08224 2.31039 5.23939 -1.33083 -2.98423 -0.856791 1.28024 -0.28713 4.02107e-13 0.28713 -1.28024 0.856791 2.98423 1.33083 -5.23939 -2.31039 -5.08224 -45.4404 country
2950.0840165 0.488617 0.00247283 -243.556 47.0583 0.532322 3.77795 6.27065 0.996127 1.50832 -1.27535 1.46026 -0.825022 3.82954e-13 0.825022 -1.46026 1.27535 -1.50832 -0.996127 -6.27065 -3.77795 -0.532322 -47.0583 country
2960.0784589 0.463471 0.00234147 -246.238 48.0182 1.78373 2.99372 5.87458 0.559002 0.589766 -1.23606 1.32358 -0.46044 3.88277e-13 0.46044 -1.32358 1.23606 -0.589766 -0.559002 -5.87458 -2.99372 -1.78373 -48.0182 country
2970.0887174 0.464305 0.00259823 -235.613 49.1701 -3.21491 0.102148 4.81017 1.67168 2.07984 -1.14386 2.08216 -0.862696 3.76481e-13 0.862696 -2.08216 1.14386 -2.07984 -1.67168 -4.81017 -0.102148 3.21491 -49.1701 country
2980.0724307 0.407724 0.0017913 -254.961 45.6153 4.07076 2.40372 5.7317 1.92393 0.1983 -0.9828 0.585168 -1.41264 3.96894e-13 1.41264 -0.585168 0.9828 -0.1983 -1.92393 -5.7317 -2.40372 -4.07076 -45.6153 country
2990.068359 0.416314 0.00197312 -251.443 48.7638 3.53479 2.67207 6.69219 1.17838 -0.683569 -1.51619 0.2082 -0.925876 3.96439e-13 0.925876 -0.2082 1.51619 0.683569 -1.17838 -6.69219 -2.67207 -3.53479 -48.7638 country
3000.111173 0.586725 0.002754 -231.041 42.9167 -2.37299 5.99115 4.56066 -0.207312 2.69154 -1.69825 1.95088 -1.41859 3.59453e-13 1.41859 -1.95088 1.69825 -2.69154 0.207312 -4.56066 -5.99115 2.37299 -42.9167 country
3010.130037 0.561536 0.00163028 -252.133 34.8032 5.7248 7.61056 1.69665 1.04575 2.56838 0.589474 -0.194301 0.103525 3.79567e-13 -0.103525 0.194301 -0.589474 -2.56838 -1.04575 -1.69665 -7.61056 -5.7248 -34.8032 disco
3020.166422 0.790447 0.00241474 -222.696 33.8385 -6.36761 2.01013 1.07096 1.78078 3.05401 1.2656 1.74984 -0.787703 3.40532e-13 0.787703 -1.74984 -1.2656 -3.05401 -1.78078 -1.07096 -2.01013 6.36761 -33.8385 disco
3030.18566 0.626626 0.00203902 -229.013 28.9447 3.39732 6.79285 -0.0619542 5.53705 -0.163381 0.266886 -0.382074 0.132175 3.44475e-13 -0.132175 0.382074 -0.266886 0.163381 -5.53705 0.0619542 -6.79285 -3.39732 -28.9447 disco
3040.160436 0.620093 0.00262503 -222.739 32.0244 -7.29739 6.2718 5.80651 1.18506 4.33003 -0.0718605 1.85566 -0.455561 3.36291e-13 0.455561 -1.85566 0.0718605 -4.33003 -1.18506 -5.80651 -6.2718 7.29739 -32.0244 disco
3050.181767 0.686268 0.00124289 -243.089 30.8324 1.30006 5.35866 -1.20494 1.31416 -0.265499 1.20877 0.00563718 0.346831 3.64906e-13 -0.346831 -0.00563718 -1.20877 0.265499 -1.31416 1.20494 -5.35866 -1.30006 -30.8324 disco
3060.148745 0.652888 0.00277655 -221.1 36.1816 -6.04322 4.17293 3.75579 1.26577 0.939814 -0.61312 2.11251 -0.443749 3.4062e-13 0.443749 -2.11251 0.61312 -0.939814 -1.26577 -3.75579 -4.17293 6.04322 -36.1816 disco
3070.152125 0.735549 0.0023259 -225.851 36.2817 -7.8361 4.6482 5.29637 -0.319199 2.28101 -0.425304 2.01074 -0.76653 3.45793e-13 0.76653 -2.01074 0.425304 -2.28101 0.319199 -5.29637 -4.6482 7.8361 -36.2817 disco
3080.164224 0.668035 0.00198415 -230.561 33.2075 -3.86848 6.24651 3.53457 0.654817 1.97805 0.574503 0.595973 -0.209459 3.49239e-13 0.209459 -0.595973 -0.574503 -1.97805 -0.654817 -3.53457 -6.24651 3.86848 -33.2075 disco
3090.152909 0.798361 0.00247318 -225.124 35.6988 -9.82402 0.586739 3.19475 1.54471 2.43153 -0.52666 1.68359 -0.594209 3.46735e-13 0.594209 -1.68359 0.52666 -2.43153 -1.54471 -3.19475 -0.586739 9.82402 -35.6988 disco
3100.155742 0.683069 0.00140267 -239.106 34.2869 -5.29817 2.3688 4.42266 3.25712 2.07848 -0.770391 0.193178 -0.102399 3.64356e-13 0.102399 -0.193178 0.770391 -2.07848 -3.25712 -4.42266 -2.3688 5.29817 -34.2869 disco
3110.155539 0.694374 0.00299523 -219.873 34.3495 -6.42381 3.5424 2.4951 2.05831 2.98846 0.730306 1.79531 -0.233943 3.37396e-13 0.233943 -1.79531 -0.730306 -2.98846 -2.05831 -2.4951 -3.5424 6.42381 -34.3495 disco
3120.167577 0.672102 0.00250109 -226.218 32.6033 0.917584 6.5448 -0.420592 2.26915 2.61957 0.912803 2.08359 0.895582 3.43603e-13 -0.895582 -2.08359 -0.912803 -2.61957 -2.26915 0.420592 -6.5448 -0.917584 -32.6033 disco
3130.145358 0.730396 0.00221841 -232.818 35.8178 -5.03685 1.91782 1.79812 2.45642 2.56359 0.135983 1.58886 -0.892255 3.5663e-13 0.892255 -1.58886 -0.135983 -2.56359 -2.45642 -1.79812 -1.91782 5.03685 -35.8178 disco
3140.182581 0.644631 0.00206272 -228.57 29.0527 0.429337 9.95543 3.02505 1.54656 0.563008 0.209202 -0.0876773 0.0264276 3.41061e-13 -0.0264276 0.0876773 -0.209202 -0.563008 -1.54656 -3.02505 -9.95543 -0.429337 -29.0527 disco
3150.1628 0.61493 0.00220981 -224.596 33.1832 -3.48045 6.07486 2.50719 0.966909 0.957287 0.379406 1.97487 -0.482791 3.4087e-13 0.482791 -1.97487 -0.379406 -0.957287 -0.966909 -2.50719 -6.07486 3.48045 -33.1832 disco
3160.110842 0.568104 0.00299148 -232.468 42.8465 8.71154 6.18892 -2.9154 0.76995 0.1661 2.15907 1.032 -0.107983 3.63773e-13 0.107983 -1.032 -2.15907 -0.1661 -0.76995 2.9154 -6.18892 -8.71154 -42.8465 disco
3170.133289 0.665491 0.00282632 -225.825 39.0772 -3.52344 3.67737 2.94072 1.48979 0.950879 -1.0785 0.978123 -0.198316 3.51282e-13 0.198316 -0.978123 1.0785 -0.950879 -1.48979 -2.94072 -3.67737 3.52344 -39.0772 disco
3180.132686 0.681458 0.00142537 -245.804 38.1364 3.33182 4.06902 1.33898 1.95752 -0.287295 -0.485595 -0.210484 -0.352652 3.77003e-13 0.352652 0.210484 0.485595 0.287295 -1.95752 -1.33898 -4.06902 -3.33182 -38.1364 disco
3190.16792 0.741365 0.00147071 -240.535 31.9299 2.28133 4.03608 -3.24434 1.757 2.4388 0.437955 0.656375 -0.631187 3.61748e-13 0.631187 -0.656375 -0.437955 -2.4388 -1.757 3.24434 -4.03608 -2.28133 -31.9299 disco
3200.0891495 0.580173 0.00154439 -256.929 39.662 5.75243 0.629861 2.88805 6.24535 3.63076 0.628381 0.282218 0.360761 3.95762e-13 -0.360761 -0.282218 -0.628381 -3.63076 -6.24535 -2.88805 -0.629861 -5.75243 -39.662 disco
3210.107862 0.671558 0.00161694 -242.818 42.5935 -1.09806 4.21396 4.22623 -1.27362 1.7067 -0.907766 0.649774 -0.824695 3.76092e-13 0.824695 -0.649774 0.907766 -1.7067 1.27362 -4.22623 -4.21396 1.09806 -42.5935 disco
3220.146152 0.670529 0.00132297 -249.127 35.0298 4.1071 2.79763 -1.80774 2.21417 0.240996 1.04965 0.863302 -0.206613 3.78074e-13 0.206613 -0.863302 -1.04965 -0.240996 -2.21417 1.80774 -2.79763 -4.1071 -35.0298 disco
3230.186814 0.680992 0.00166165 -238.605 27.769 0.628287 9.43682 4.74959 3.96924 0.0400889 0.602644 0.0179407 -0.262235 3.53607e-13 0.262235 -0.0179407 -0.602644 -0.0400889 -3.96924 -4.74959 -9.43682 -0.628287 -27.769 disco
3240.158203 0.629629 0.00237909 -229.04 33.3694 -0.306989 6.3815 2.00422 2.41595 0.482534 0.0472845 0.64357 -0.518809 3.47844e-13 0.518809 -0.64357 -0.0472845 -0.482534 -2.41595 -2.00422 -6.3815 0.306989 -33.3694 disco
3250.128468 0.643128 0.00174143 -239.349 40.3164 -0.632945 -0.382888 -0.487121 2.22279 -0.133788 0.34199 1.15014 0.269637 3.73197e-13 -0.269637 -1.15014 -0.34199 0.133788 -2.22279 0.487121 0.382888 0.632945 -40.3164 disco
3260.121261 0.674186 0.00128441 -252.766 38.3437 3.21022 3.48357 2.04321 1.32337 -0.490761 0.17899 0.149483 -0.516403 3.86188e-13 0.516403 -0.149483 -0.17899 0.490761 -1.32337 -2.04321 -3.48357 -3.21022 -38.3437 disco
3270.144407 0.666081 0.00188247 -239.262 34.5006 1.88011 6.03494 1.15948 2.75807 1.64342 0.723114 0.75772 -0.505274 3.62846e-13 0.505274 -0.75772 -0.723114 -1.64342 -2.75807 -1.15948 -6.03494 -1.88011 -34.5006 disco
3280.148357 0.612521 0.0013706 -265.469 25.7304 6.45322 10.3591 5.88287 6.07949 3.28996 1.91493 0.357502 0.279921 3.86652e-13 -0.279921 -0.357502 -1.91493 -3.28996 -6.07949 -5.88287 -10.3591 -6.45322 -25.7304 disco
3290.195517 0.685017 0.00217404 -223.915 28.0985 0.0394376 5.01961 -0.823631 4.49203 1.51907 0.556553 0.367658 0.467351 3.36813e-13 -0.467351 -0.367658 -0.556553 -1.51907 -4.49203 0.823631 -5.01961 -0.0394376 -28.0985 disco
3300.154971 0.774661 0.00165832 -235.461 35.2782 -0.960548 2.75705 -0.0591404 2.16909 -0.516585 2.52284 0.705862 -0.538887 3.60419e-13 0.538887 -0.705862 -2.52284 0.516585 -2.16909 0.0591404 -2.75705 0.960548 -35.2782 disco
3310.16511 0.654435 0.00220666 -227.144 32.4696 -1.81344 5.06462 1.44547 3.9274 1.66146 1.21906 0.446074 0.826238 3.4663e-13 -0.826238 -0.446074 -1.21906 -1.66146 -3.9274 -1.44547 -5.06462 1.81344 -32.4696 disco
3320.171522 0.731226 0.00160351 -233.819 34.4898 -4.71062 2.33324 1.73664 1.23388 -0.0642772 0.823491 -0.280917 -0.847625 3.57024e-13 0.847625 0.280917 -0.823491 0.0642772 -1.23388 -1.73664 -2.33324 4.71062 -34.4898 disco
3330.125213 0.721657 0.0015092 -245.793 39.4017 -1.42259 -1.09482 -0.878015 1.44769 2.60363 0.751216 0.563357 -0.289771 3.79863e-13 0.289771 -0.563357 -0.751216 -2.60363 -1.44769 0.878015 1.09482 1.42259 -39.4017 disco
3340.120957 0.577214 0.00199118 -236.843 40.6082 -2.71653 3.71477 4.4706 1.07332 1.35973 -1.61666 0.427864 -0.670871 3.67122e-13 0.670871 -0.427864 1.61666 -1.35973 -1.07332 -4.4706 -3.71477 2.71653 -40.6082 disco
3350.203113 0.73328 0.00137681 -235.405 27.171 1.49128 8.05408 0.109376 2.55811 -0.0147447 -0.338058 -0.430496 -0.891012 3.48418e-13 0.891012 0.430496 0.338058 0.0147447 -2.55811 -0.109376 -8.05408 -1.49128 -27.171 disco
3360.194096 0.744204 0.00195395 -228.845 29.0151 0.175297 5.24919 0.0906951 4.05763 0.433224 0.397056 0.29219 0.74141 3.44698e-13 -0.74141 -0.29219 -0.397056 -0.433224 -4.05763 -0.0906951 -5.24919 -0.175297 -29.0151 disco
3370.17294 0.687165 0.00217624 -225.687 31.0992 -0.476754 6.94245 0.65909 1.33148 0.842877 0.704773 0.986455 0.0534448 3.40493e-13 -0.0534448 -0.986455 -0.704773 -0.842877 -1.33148 -0.65909 -6.94245 0.476754 -31.0992 disco
3380.191526 0.683736 0.00225019 -221.097 28.8341 -2.13542 3.79974 -0.193569 5.0278 1.07265 0.868545 0.278337 0.387631 3.34752e-13 -0.387631 -0.278337 -0.868545 -1.07265 -5.0278 0.193569 -3.79974 2.13542 -28.8341 disco
3390.161681 0.654225 0.00143507 -238.76 34.5856 -2.61086 1.60259 -0.238706 1.2138 -0.964338 1.22576 1.76055 0.961372 3.65132e-13 -0.961372 -1.76055 -1.22576 0.964338 -1.2138 0.238706 -1.60259 2.61086 -34.5856 disco
3400.115831 0.594453 0.00153729 -244.154 41.6049 -1.32833 2.21229 3.02438 -1.55863 -1.37911 1.11022 1.60044 1.35398 3.79745e-13 -1.35398 -1.60044 -1.11022 1.37911 1.55863 -3.02438 -2.21229 1.32833 -41.6049 disco
3410.137126 0.745025 0.00175585 -240.639 37.8224 -2.4698 3.787 1.97559 -1.64815 1.40358 2.22722 1.06282 -0.568249 3.67991e-13 0.568249 -1.06282 -2.22722 -1.40358 1.64815 -1.97559 -3.787 2.4698 -37.8224 disco
3420.0736916 0.421416 0.00221625 -255.279 43.9253 12.6934 7.77653 2.74656 1.88158 -0.275251 -0.132823 -0.242575 0.0115105 3.9501e-13 -0.0115105 0.242575 0.132823 0.275251 -1.88158 -2.74656 -7.77653 -12.6934 -43.9253 disco
3430.138734 0.613888 0.00210243 -226.179 39.9006 -7.14345 0.0843826 1.18909 -0.290586 -0.299349 -1.96163 0.337472 -0.159365 3.54172e-13 0.159365 -0.337472 1.96163 0.299349 0.290586 -1.18909 -0.0843826 7.14345 -39.9006 disco
3440.145098 0.705388 0.00230649 -229.842 37.3262 -3.2477 2.72784 2.61457 0.00159053 -0.919744 0.628464 0.353255 -0.684016 3.54382e-13 0.684016 -0.353255 -0.628464 0.919744 -0.00159053 -2.61457 -2.72784 3.2477 -37.3262 disco
3450.118073 0.685028 0.00195219 -236.282 43.1095 -2.48307 -0.328148 1.47641 0.991005 -1.02094 -0.46913 0.164387 -0.356268 3.71917e-13 0.356268 -0.164387 0.46913 1.02094 -0.991005 -1.47641 0.328148 2.48307 -43.1095 disco
3460.110721 0.639854 0.00167299 -242.861 42.133 0.3759 1.86401 2.1374 0.310207 0.518133 0.464648 0.660484 0.255771 3.78345e-13 -0.255771 -0.660484 -0.464648 -0.518133 -0.310207 -2.1374 -1.86401 -0.3759 -42.133 disco
3470.11853 0.737699 0.00130576 -250.067 37.8931 -0.567249 3.71304 2.00591 -0.703506 1.59124 -0.68623 2.02082 -0.794979 3.80066e-13 0.794979 -2.02082 0.68623 -1.59124 0.703506 -2.00591 -3.71304 0.567249 -37.8931 disco
3480.0882636 0.560995 0.000428304 -279.749 34.3096 10.4583 3.68616 3.53834 0.800391 -1.9615 -2.53144 -1.44817 -1.10362 4.16087e-13 1.10362 1.44817 2.53144 1.9615 -0.800391 -3.53834 -3.68616 -10.4583 -34.3096 disco
3490.143372 0.710491 0.00133191 -244.68 34.6944 -8.07023 2.96861 6.56349 1.20566 3.50048 -1.5247 1.7868 -0.538804 3.69962e-13 0.538804 -1.7868 1.5247 -3.50048 -1.20566 -6.56349 -2.96861 8.07023 -34.6944 disco
3500.138437 0.668437 0.00256208 -226.429 37.4419 -5.79553 4.85101 3.54742 -1.51397 2.99296 -1.60418 1.92102 -1.81994 3.46264e-13 1.81994 -1.92102 1.60418 -2.99296 1.51397 -3.54742 -4.85101 5.79553 -37.4419 disco
3510.126586 0.658239 0.00209023 -230.727 40.0904 -5.64962 2.74904 1.03341 -1.57168 3.81444 -1.44803 2.19789 -1.03897 3.56723e-13 1.03897 -2.19789 1.44803 -3.81444 1.57168 -1.03341 -2.74904 5.64962 -40.0904 disco
3520.141505 0.671828 0.00136927 -238.412 36.4758 -6.81914 2.98802 1.76343 -1.96776 3.3242 -1.33914 2.00035 -0.913732 3.62609e-13 0.913732 -2.00035 1.33914 -3.3242 1.96776 -1.76343 -2.98802 6.81914 -36.4758 disco
3530.13699 0.763095 0.00149268 -236.452 38.6215 -7.26057 1.13738 0.934436 -0.898676 3.4078 -3.02956 1.69677 -0.631272 3.64042e-13 0.631272 -1.69677 3.02956 -3.4078 0.898676 -0.934436 -1.13738 7.26057 -38.6215 disco
3540.188338 0.66527 0.00177947 -259.837 16.9577 5.8418 16.9709 5.60645 4.7637 8.57176 -0.247029 3.76813 0.308649 3.63347e-13 -0.308649 -3.76813 0.247029 -8.57176 -4.7637 -5.60645 -16.9709 -5.8418 -16.9577 disco
3550.133255 0.65821 0.000678331 -267.551 29.9285 2.98827 8.42149 6.33233 2.01826 0.88585 -0.809576 1.47366 -0.489611 3.93006e-13 0.489611 -1.47366 0.809576 -0.88585 -2.01826 -6.33233 -8.42149 -2.98827 -29.9285 disco
3560.110063 0.584714 0.00154351 -245.066 38.8845 -4.77039 3.96642 5.67387 -0.0633974 3.53219 -0.121136 1.84588 -0.501778 3.74782e-13 0.501778 -1.84588 0.121136 -3.53219 0.0633974 -5.67387 -3.96642 4.77039 -38.8845 disco
3570.087823 0.64834 0.000880493 -264.005 38.9935 4.72298 2.45724 2.0952 1.05419 2.30585 0.197061 0.877949 -0.186018 4.01489e-13 0.186018 -0.877949 -0.197061 -2.30585 -1.05419 -2.0952 -2.45724 -4.72298 -38.9935 disco
3580.102327 0.646789 0.00100577 -254.034 41.7848 0.449609 0.575245 -0.846407 -2.25711 1.34768 -0.804535 0.582502 -1.04468 3.91105e-13 1.04468 -0.582502 0.804535 -1.34768 2.25711 0.846407 -0.575245 -0.449609 -41.7848 disco
3590.121147 0.660377 0.0015703 -244.849 37.543 -1.96608 5.196 3.87049 0.465269 3.2549 -1.35246 1.31593 -1.19191 3.72141e-13 1.19191 -1.31593 1.35246 -3.2549 -0.465269 -3.87049 -5.196 1.96608 -37.543 disco
3600.123209 0.701793 0.00156475 -243.857 38.5516 -1.53891 1.2593 -1.89542 -2.01614 1.63708 -1.34964 2.00538 -0.328107 3.73739e-13 0.328107 -2.00538 1.34964 -1.63708 2.01614 1.89542 -1.2593 1.53891 -38.5516 disco
3610.101458 0.553029 0.00139405 -249.656 39.5813 -0.541711 4.05169 4.21405 1.15634 3.5869 -0.108682 1.64116 -0.448984 3.82115e-13 0.448984 -1.64116 0.108682 -3.5869 -1.15634 -4.21405 -4.05169 0.541711 -39.5813 disco
3620.148637 0.783988 0.00214544 -236.603 34.0422 3.81456 9.79728 1.09478 -0.812716 1.63258 -2.45772 2.40925 -1.09311 3.54548e-13 1.09311 -2.40925 2.45772 -1.63258 0.812716 -1.09478 -9.79728 -3.81456 -34.0422 disco
3630.123015 0.701021 0.00189271 -243.59 37.6247 -5.91 2.40399 3.95586 0.543943 3.96711 -0.863126 2.35698 0.118057 3.72525e-13 -0.118057 -2.35698 0.863126 -3.96711 -0.543943 -3.95586 -2.40399 5.91 -37.6247 disco
3640.130655 0.682501 0.00376111 -231.989 34.0981 -1.85877 9.64105 5.91601 2.80001 5.39079 -0.160697 3.3735 -0.427473 3.49634e-13 0.427473 -3.3735 0.160697 -5.39079 -2.80001 -5.91601 -9.64105 1.85877 -34.0981 disco
3650.104554 0.582759 0.00122606 -256.058 36.7437 0.779622 3.95445 2.77635 1.42478 4.62892 0.977728 2.09475 -0.672787 3.86787e-13 0.672787 -2.09475 -0.977728 -4.62892 -1.42478 -2.77635 -3.95445 -0.779622 -36.7437 disco
3660.0844396 0.556356 0.00218556 -252.751 39.2166 5.57878 9.02433 3.93637 1.28102 5.18606 -0.972174 1.10694 0.115131 3.84217e-13 -0.115131 -1.10694 0.972174 -5.18606 -1.28102 -3.93637 -9.02433 -5.57878 -39.2166 disco
3670.136001 0.740964 0.00198691 -234.316 36.7978 -4.05218 4.48711 2.54815 -0.391537 3.32808 -1.40234 2.25956 -1.15826 3.56985e-13 1.15826 -2.25956 1.40234 -3.32808 0.391537 -2.54815 -4.48711 4.05218 -36.7978 disco
3680.142446 0.671878 0.00139846 -235.339 38.3098 -8.68353 1.4454 1.94359 -2.48947 2.12106 -2.77753 0.890051 -1.05465 3.61629e-13 1.05465 -0.890051 2.77753 -2.12106 2.48947 -1.94359 -1.4454 8.68353 -38.3098 disco
3690.154849 0.69711 0.00146007 -235.084 34.4432 -6.13529 4.8189 2.7771 -0.484161 2.74908 -1.61195 2.23392 -0.897673 3.55527e-13 0.897673 -2.23392 1.61195 -2.74908 0.484161 -2.7771 -4.8189 6.13529 -34.4432 disco
3700.106013 0.567209 0.00141353 -251.629 38.7609 1.73797 7.27822 2.17108 -2.06868 3.34747 -1.56913 -0.38029 -1.21769 3.81567e-13 1.21769 0.38029 1.56913 -3.34747 2.06868 -2.17108 -7.27822 -1.73797 -38.7609 disco
3710.130775 0.655936 0.00143425 -240.234 38.1191 -4.50998 3.52046 1.56108 -1.27237 3.41248 -1.13731 1.92526 -0.861378 3.67094e-13 0.861378 -1.92526 1.13731 -3.41248 1.27237 -1.56108 -3.52046 4.50998 -38.1191 disco
3720.149755 0.67689 0.00124292 -244.047 33.0653 -3.34608 5.87097 2.15905 0.144012 2.74921 -2.34683 2.14683 -0.555233 3.65873e-13 0.555233 -2.14683 2.34683 -2.74921 -0.144012 -2.15905 -5.87097 3.34608 -33.0653 disco
3730.153344 0.719561 0.00110844 -245.662 32.3708 -6.40124 4.28157 3.6553 -0.741514 3.35736 0.315131 1.62534 -1.43273 3.66784e-13 1.43273 -1.62534 -0.315131 -3.35736 0.741514 -3.6553 -4.28157 6.40124 -32.3708 disco
3740.145973 0.646813 0.00120481 -240.756 34.989 -4.73203 3.81757 1.49641 0.114903 2.76006 -2.73978 1.92037 -0.901378 3.6439e-13 0.901378 -1.92037 2.73978 -2.76006 -0.114903 -1.49641 -3.81757 4.73203 -34.989 disco
3750.145981 0.655152 0.00216065 -228.163 36.5026 -5.12109 4.94697 1.39157 -1.42487 2.86367 -2.71016 2.10498 -1.34041 3.47999e-13 1.34041 -2.10498 2.71016 -2.86367 1.42487 -1.39157 -4.94697 5.12109 -36.5026 disco
3760.142653 0.697861 0.00147078 -239.113 35.699 -4.39779 5.50997 2.39709 -0.547291 4.18996 -1.2201 2.19545 -0.884491 3.61905e-13 0.884491 -2.19545 1.2201 -4.18996 0.547291 -2.39709 -5.50997 4.39779 -35.699 disco
3770.124489 0.694198 0.00148967 -239.456 39.9577 -6.15771 0.493355 0.735065 -2.71429 1.13237 -2.53094 1.62489 -1.38578 3.68851e-13 1.38578 -1.62489 2.53094 -1.13237 2.71429 -0.735065 -0.493355 6.15771 -39.9577 disco
3780.11936 0.598513 0.00248204 -232.269 39.7242 -4.83738 4.13289 4.62464 1.19885 4.65145 -2.2216 2.06094 0.419771 3.59738e-13 -0.419771 -2.06094 2.2216 -4.65145 -1.19885 -4.62464 -4.13289 4.83738 -39.7242 disco
3790.117254 0.618378 0.000756188 -266.24 35.6346 6.24595 1.8753 -2.38484 -1.02846 -0.581734 -2.03108 1.35132 -0.764482 3.99706e-13 0.764482 -1.35132 2.03108 0.581734 1.02846 2.38484 -1.8753 -6.24595 -35.6346 disco
3800.125518 0.631477 0.00106452 -256.937 33.2154 1.01047 6.56119 3.50218 1.08905 3.48188 -0.764749 1.68553 -0.315154 3.83203e-13 0.315154 -1.68553 0.764749 -3.48188 -1.08905 -3.50218 -6.56119 -1.01047 -33.2154 disco
3810.108704 0.56226 0.000735104 -270.619 31.8333 7.13296 9.66394 5.35728 1.4874 1.29766 -1.51235 0.857964 0.148123 3.99321e-13 -0.148123 -0.857964 1.51235 -1.29766 -1.4874 -5.35728 -9.66394 -7.13296 -31.8333 disco
3820.115766 0.710653 0.00107674 -256.937 36.0949 -0.194298 3.93137 4.70265 2.70832 2.08822 -1.06466 1.75891 -0.0518205 3.88651e-13 0.0518205 -1.75891 1.06466 -2.08822 -2.70832 -4.70265 -3.93137 0.194298 -36.0949 disco
3830.134656 0.672034 0.00231928 -231.126 37.56 -1.95137 5.42389 0.84897 -1.5498 4.09343 -2.67082 1.79992 -0.39762 3.53584e-13 0.39762 -1.79992 2.67082 -4.09343 1.5498 -0.84897 -5.42389 1.95137 -37.56 disco
3840.098579 0.551503 0.00117758 -259.691 37.7867 6.3873 8.80182 3.82314 0.302165 1.89461 -0.924108 1.13007 -0.0264017 3.91833e-13 0.0264017 -1.13007 0.924108 -1.89461 -0.302165 -3.82314 -8.80182 -6.3873 -37.7867 disco
3850.133675 0.711107 0.000665774 -271.152 27.8465 -1.22604 2.02229 3.57745 1.52055 2.17944 -0.1828 0.955485 -0.455445 3.97605e-13 0.455445 -0.955485 0.1828 -2.17944 -1.52055 -3.57745 -2.02229 1.22604 -27.8465 disco
3860.174458 0.831932 0.00106083 -261.448 24.8753 3.33753 10.7217 1.71347 1.05538 4.14102 -1.47273 2.07057 0.0357946 3.77654e-13 -0.0357946 -2.07057 1.47273 -4.14102 -1.05538 -1.71347 -10.7217 -3.33753 -24.8753 disco
3870.0929259 0.665505 0.00216515 -242.339 45.6722 -0.895818 2.3 4.73644 -0.680871 3.52238 0.915858 1.023 -1.2697 3.79134e-13 1.2697 -1.023 -0.915858 -3.52238 0.680871 -4.73644 -2.3 0.895818 -45.6722 disco
3880.102113 0.719622 0.00158303 -248.074 43.4554 2.46692 3.22529 1.62138 1.09899 1.95662 -1.21678 1.70152 -1.17059 3.84605e-13 1.17059 -1.70152 1.21678 -1.95662 -1.09899 -1.62138 -3.22529 -2.46692 -43.4554 disco
3890.120533 0.638876 0.00146929 -241.255 40.5776 -7.83958 1.48813 4.87075 -1.25975 3.13988 -0.786868 1.36087 -0.865723 3.72312e-13 0.865723 -1.36087 0.786868 -3.13988 1.25975 -4.87075 -1.48813 7.83958 -40.5776 disco
3900.111038 0.603316 0.00124934 -247.21 39.5561 -2.41222 3.09837 3.62632 0.270643 2.90759 -0.385794 1.68433 -0.606557 3.78949e-13 0.606557 -1.68433 0.385794 -2.90759 -0.270643 -3.62632 -3.09837 2.41222 -39.5561 disco
3910.150996 0.684569 0.000931259 -251.799 32.3357 -4.08886 5.03672 3.09979 0.81835 4.02264 -1.45509 1.35053 -0.267506 3.76204e-13 0.267506 -1.35053 1.45509 -4.02264 -0.81835 -3.09979 -5.03672 4.08886 -32.3357 disco
3920.112213 0.623195 0.00236745 -237.474 41.0141 -6.0482 0.973686 4.77071 1.16356 4.02517 0.804443 2.59516 -0.561821 3.6846e-13 0.561821 -2.59516 -0.804443 -4.02517 -1.16356 -4.77071 -0.973686 6.0482 -41.0141 disco
3930.125701 0.583193 0.00129167 -251.108 35.6992 1.45059 8.31224 3.56686 -1.14603 2.56739 -0.538678 1.8101 -0.888373 3.7665e-13 0.888373 -1.8101 0.538678 -2.56739 1.14603 -3.56686 -8.31224 -1.45059 -35.6992 disco
3940.143231 0.679655 0.00218596 -229.674 36.3094 -6.59919 5.03454 6.66343 1.71546 2.00952 -1.81123 2.74542 -1.04207 3.50762e-13 1.04207 -2.74542 1.81123 -2.00952 -1.71546 -6.66343 -5.03454 6.59919 -36.3094 disco
3950.119998 0.570222 0.00126109 -250.003 35.954 0.0861511 8.55279 4.44985 -0.374398 3.94076 -1.12612 1.51278 -0.0295993 3.76414e-13 0.0295993 -1.51278 1.12612 -3.94076 0.374398 -4.44985 -8.55279 -0.0861511 -35.954 disco
3960.118905 0.632566 0.00120797 -255.935 34.8892 -1.46448 4.42266 6.46869 1.8962 2.24213 -0.794735 1.45971 -0.322061 3.8506e-13 0.322061 -1.45971 0.794735 -2.24213 -1.8962 -6.46869 -4.42266 1.46448 -34.8892 disco
3970.124589 0.728366 0.00102064 -251.241 36.3007 -4.86448 4.72054 5.99587 -2.01941 2.59218 -1.33741 0.580306 -0.542112 3.79333e-13 0.542112 -0.580306 1.33741 -2.59218 2.01941 -5.99587 -4.72054 4.86448 -36.3007 disco
3980.147612 0.637228 0.00133151 -245.882 32.2497 -1.27163 6.51247 2.31508 1.84596 4.4581 -0.117237 1.98306 -0.0645461 3.67916e-13 0.0645461 -1.98306 0.117237 -4.4581 -1.84596 -2.31508 -6.51247 1.27163 -32.2497 disco
3990.123747 0.674206 0.00163138 -241.533 38.0924 0.482577 6.93491 2.35315 -0.581412 2.13913 -1.92014 1.66408 -1.44436 3.67221e-13 1.44436 -1.66408 1.92014 -2.13913 0.581412 -2.35315 -6.93491 -0.482577 -38.0924 disco
4000.123747 0.673412 0.00163138 -241.533 38.0924 0.482577 6.93491 2.35315 -0.581412 2.13913 -1.92014 1.66408 -1.44436 3.67221e-13 1.44436 -1.66408 1.92014 -2.13913 0.581412 -2.35315 -6.93491 -0.482577 -38.0924 disco
4010.139197 0.735477 0.00187392 -232.284 38.3388 -7.71067 2.97049 3.17273 -2.45235 1.80239 -2.97461 1.09745 -1.68097 3.56249e-13 1.68097 -1.09745 2.97461 -1.80239 2.45235 -3.17273 -2.97049 7.71067 -38.3388 hiphop
4020.141834 0.611887 0.00371537 -231.3 33.0245 -5.10974 8.63998 9.70451 3.82446 5.24107 0.126786 3.51974 -0.619353 3.477e-13 0.619353 -3.51974 -0.126786 -5.24107 -3.82446 -9.70451 -8.63998 5.10974 -33.0245 hiphop
4030.0781045 0.737106 0.00123458 -265.054 39.8938 9.64195 6.98239 3.52272 -0.351651 0.0456942 -1.54631 0.236077 -0.121252 4.02102e-13 0.121252 -0.236077 1.54631 -0.0456942 0.351651 -3.52272 -6.98239 -9.64195 -39.8938 hiphop
4040.12301 0.683749 0.00333157 -229.726 39.2134 -3.17335 5.69654 3.6748 -0.27258 3.8285 -0.693718 2.99634 0.418264 3.54495e-13 -0.418264 -2.99634 0.693718 -3.8285 0.27258 -3.6748 -5.69654 3.17335 -39.2134 hiphop
4050.113963 0.60826 0.00249006 -253.446 32.2952 2.84331 7.59909 4.12319 3.34502 5.3189 0.358642 2.31038 -0.021879 3.77452e-13 0.021879 -2.31038 -0.358642 -5.3189 -3.34502 -4.12319 -7.59909 -2.84331 -32.2952 hiphop
4060.149292 0.62877 0.00321874 -222.375 34.327 -3.84781 8.84118 4.0716 -0.391213 5.33948 -2.98489 2.05767 -0.538009 3.36625e-13 0.538009 -2.05767 2.98489 -5.33948 0.391213 -4.0716 -8.84118 3.84781 -34.327 hiphop
4070.15629 0.719345 0.00314738 -236.073 27.2465 0.432262 12.0303 5.2057 2.04815 4.8041 -0.610874 2.18949 -0.675605 3.45695e-13 0.675605 -2.18949 0.610874 -4.8041 -2.04815 -5.2057 -12.0303 -0.432262 -27.2465 hiphop
4080.101424 0.643972 0.00337699 -233.95 44.9516 -1.41709 4.4164 3.84567 -0.748527 0.11459 -2.43179 1.97778 -1.10443 3.66855e-13 1.10443 -1.97778 2.43179 -0.11459 0.748527 -3.84567 -4.4164 1.41709 -44.9516 hiphop
4090.166817 0.683611 0.00181871 -246.066 29.2501 -3.73705 9.35798 5.8335 -2.01449 2.39717 -2.00749 1.65667 -0.979542 3.61354e-13 0.979542 -1.65667 2.00749 -2.39717 2.01449 -5.8335 -9.35798 3.73705 -29.2501 hiphop
4100.158267 0.824303 0.00180928 -241.879 31.7975 -4.82211 6.52407 3.96272 -1.22723 2.69317 -2.06806 1.79487 -0.774004 3.60494e-13 0.774004 -1.79487 2.06806 -2.69317 1.22723 -3.96272 -6.52407 4.82211 -31.7975 hiphop
4110.129275 0.785325 0.00203351 -238.295 38.9399 -7.19029 0.776225 1.14202 0.432322 6.33901 -0.55413 1.25667 -0.982376 3.66933e-13 0.982376 -1.25667 0.55413 -6.33901 -0.432322 -1.14202 -0.776225 7.19029 -38.9399 hiphop
4120.11114 0.657928 0.00272452 -236.674 41.0287 -0.832958 7.14041 4.83611 0.966988 3.09977 -1.58063 2.40303 -0.752708 3.6499e-13 0.752708 -2.40303 1.58063 -3.09977 -0.966988 -4.83611 -7.14041 0.832958 -41.0287 hiphop
4130.107446 0.732753 0.00247334 -235.279 44.2546 -1.64831 4.49237 2.43293 -1.91802 1.89651 -2.94404 0.874992 -0.680391 3.67927e-13 0.680391 -0.874992 2.94404 -1.89651 1.91802 -2.43293 -4.49237 1.64831 -44.2546 hiphop
4140.13147 0.763224 0.00198651 -234.815 38.2793 -2.12573 6.81634 3.34237 -0.24034 3.08928 -2.80626 2.2759 -0.0260971 3.5966e-13 0.0260971 -2.2759 2.80626 -3.08928 0.24034 -3.34237 -6.81634 2.12573 -38.2793 hiphop
4150.130671 0.623491 0.00260853 -228.041 38.9444 -6.31658 7.64194 8.3986 -0.685101 3.63858 -2.57995 2.30427 -0.361163 3.50346e-13 0.361163 -2.30427 2.57995 -3.63858 0.685101 -8.3986 -7.64194 6.31658 -38.9444 hiphop
4160.133057 0.747782 0.00193686 -235.62 37.8639 -3.47407 5.54279 3.14509 -0.674897 2.19741 -3.32288 0.560742 -1.01007 3.60442e-13 1.01007 -0.560742 3.32288 -2.19741 0.674897 -3.14509 -5.54279 3.47407 -37.8639 hiphop
4170.130365 0.741238 0.00266577 -239.109 37.5225 -3.08942 6.84747 5.41253 -0.542882 2.34148 -1.64475 2.45982 0.231833 3.64559e-13 -0.231833 -2.45982 1.64475 -2.34148 0.542882 -5.41253 -6.84747 3.08942 -37.5225 hiphop
4180.111094 0.665732 0.00241928 -241.351 38.8059 0.179509 8.88686 4.85578 0.40489 4.14921 -0.237687 2.46886 -0.840929 3.6742e-13 0.840929 -2.46886 0.237687 -4.14921 -0.40489 -4.85578 -8.88686 -0.179509 -38.8059 hiphop
4190.145593 0.878396 0.00221546 -241.941 33.828 -1.67763 9.21407 5.67057 0.377519 2.85408 -2.1678 1.28189 -0.44048 3.62954e-13 0.44048 -1.28189 2.1678 -2.85408 -0.377519 -5.67057 -9.21407 1.67763 -33.828 hiphop
4200.144253 0.856579 0.0022698 -237.203 36.0754 -4.34594 4.84683 4.05981 -0.201504 3.03919 -1.02847 1.5308 -0.740293 3.60528e-13 0.740293 -1.5308 1.02847 -3.03919 0.201504 -4.05981 -4.84683 4.34594 -36.0754 hiphop
4210.134041 0.515826 0.00263023 -240.374 34.1854 -7.01661 8.22669 10.3843 1.53043 6.08495 -0.270794 2.05196 -0.392658 3.61215e-13 0.392658 -2.05196 0.270794 -6.08495 -1.53043 -10.3843 -8.22669 7.01661 -34.1854 hiphop
4220.130611 0.728586 0.00315723 -224.518 39.8513 -4.04868 5.89044 3.26295 -1.18819 2.89426 -3.13539 2.05763 -0.551991 3.47504e-13 0.551991 -2.05763 3.13539 -2.89426 1.18819 -3.26295 -5.89044 4.04868 -39.8513 hiphop
4230.103743 0.682831 0.00238888 -239.303 42.3018 0.969062 6.94764 2.85611 -1.80284 1.7486 -1.20452 1.87088 -0.902004 3.6944e-13 0.902004 -1.87088 1.20452 -1.7486 1.80284 -2.85611 -6.94764 -0.969062 -42.3018 hiphop
4240.12235 0.637125 0.00267989 -227.545 41.8912 -5.02648 5.27387 4.98537 0.216077 3.86101 -2.7133 1.66825 -0.486495 3.54801e-13 0.486495 -1.66825 2.7133 -3.86101 -0.216077 -4.98537 -5.27387 5.02648 -41.8912 hiphop
4250.136811 0.835351 0.00237883 -232.556 38.3876 -7.95326 1.93291 4.19191 -1.15849 3.086 -1.46872 1.81949 -0.82276 3.57743e-13 0.82276 -1.81949 1.46872 -3.086 1.15849 -4.19191 -1.93291 7.95326 -38.3876 hiphop
4260.122283 0.613624 0.00323151 -230.459 39.1145 -5.38019 5.70806 5.32028 -0.440835 4.42222 -1.06966 2.71776 -0.301777 3.54583e-13 0.301777 -2.71776 1.06966 -4.42222 0.440835 -5.32028 -5.70806 5.38019 -39.1145 hiphop
4270.190628 0.749302 0.00222014 -237.1 24.0367 -0.254558 11.8726 7.19938 4.21151 -0.110229 0.921018 1.30402 -0.266647 3.45652e-13 0.266647 -1.30402 -0.921018 0.110229 -4.21151 -7.19938 -11.8726 0.254558 -24.0367 hiphop
4280.150505 0.752735 0.00171189 -246.812 32.3578 1.91039 7.89417 3.25549 1.81274 2.24155 -0.906333 -0.079632 -0.357844 3.69325e-13 0.357844 0.079632 0.906333 -2.24155 -1.81274 -3.25549 -7.89417 -1.91039 -32.3578 hiphop
4290.1435 0.752022 0.00207459 -233.683 36.8284 -2.45021 4.25562 4.67786 3.52349 -0.0766291 0.0147338 2.37697 -0.882237 3.58393e-13 0.882237 -2.37697 -0.0147338 0.0766291 -3.52349 -4.67786 -4.25562 2.45021 -36.8284 hiphop
4300.162587 0.629591 0.00207746 -237.351 30.8774 -1.64821 7.20552 3.62638 2.46316 2.17733 0.473407 1.28984 -0.051177 3.55474e-13 0.051177 -1.28984 -0.473407 -2.17733 -2.46316 -3.62638 -7.20552 1.64821 -30.8774 hiphop
4310.204259 0.646021 0.00250841 -222.916 23.9704 1.04113 12.6906 3.21453 2.43845 3.39414 0.835493 1.13974 -0.164855 3.25428e-13 0.164855 -1.13974 -0.835493 -3.39414 -2.43845 -3.21453 -12.6906 -1.04113 -23.9704 hiphop
4320.152115 0.660145 0.00270898 -224.551 35.0313 -2.94977 3.09597 0.960811 2.81561 0.3408 2.56465 1.10801 -0.948465 3.45022e-13 0.948465 -1.10801 -2.56465 -0.3408 -2.81561 -0.960811 -3.09597 2.94977 -35.0313 hiphop
4330.106636 0.705232 0.00180891 -256.162 37.2411 3.25478 5.30715 6.04313 5.68356 2.5566 -0.180097 1.2075 0.714002 3.90241e-13 -0.714002 -1.2075 0.180097 -2.5566 -5.68356 -6.04313 -5.30715 -3.25478 -37.2411 hiphop
4340.177041 0.782014 0.00262066 -226.41 28.3902 -2.60389 7.01603 3.3908 4.74231 2.91677 -1.14261 0.558412 0.220495 3.39108e-13 -0.220495 -0.558412 1.14261 -2.91677 -4.74231 -3.3908 -7.01603 2.60389 -28.3902 hiphop
4350.170711 0.788073 0.00309528 -215.864 32.1982 -5.55683 6.42143 2.59131 -1.09427 1.90598 0.165063 0.950455 -0.45647 3.27416e-13 0.45647 -0.950455 -0.165063 -1.90598 1.09427 -2.59131 -6.42143 5.55683 -32.1982 hiphop
4360.151064 0.669509 0.0023695 -244.494 30.9411 2.14117 8.69737 3.44862 3.73684 2.75825 -0.562425 1.5077 0.352632 3.64954e-13 -0.352632 -1.5077 0.562425 -2.75825 -3.73684 -3.44862 -8.69737 -2.14117 -30.9411 hiphop
4370.155005 0.70922 0.000424981 -291.365 17.3171 0.519289 1.60858 3.26456 1.21354 1.33539 0.664608 -0.114457 -0.358918 4.12032e-13 0.358918 0.114457 -0.664608 -1.33539 -1.21354 -3.26456 -1.60858 -0.519289 -17.3171 hiphop
4380.186914 0.822743 0.00183392 -240.746 29.6062 -4.72312 2.74293 1.46856 -0.867035 -0.760267 -0.875057 -0.0439419 -0.748845 3.59247e-13 0.748845 0.0439419 0.875057 0.760267 0.867035 -1.46856 -2.74293 4.72312 -29.6062 hiphop
4390.232928 0.496148 0.00208728 -256.563 26.8803 -3.074 3.18543 4.31257 1.47438 0.742401 -0.344484 0.576827 -0.597164 3.76913e-13 0.597164 -0.576827 0.344484 -0.742401 -1.47438 -4.31257 -3.18543 3.074 -26.8803 hiphop
4400.157456 0.735627 0.00141392 -259.675 30.1997 7.24243 6.57428 -0.958623 0.598326 0.130716 1.09615 -0.797161 -0.348781 3.84522e-13 0.348781 0.797161 -1.09615 -0.130716 -0.598326 0.958623 -6.57428 -7.24243 -30.1997 hiphop
4410.104634 0.423947 0.000952586 -271.739 34.2496 12.5653 6.25134 1.08303 -0.528377 -3.43282 -1.05806 -0.20623 -1.24085 4.03928e-13 1.24085 0.20623 1.05806 3.43282 0.528377 -1.08303 -6.25134 -12.5653 -34.2496 hiphop
4420.134872 0.790706 0.00187957 -246.703 36.2747 0.431744 4.12172 1.90564 -0.14777 -0.816527 -0.397123 -0.314478 -0.300039 3.75454e-13 0.300039 0.314478 0.397123 0.816527 0.14777 -1.90564 -4.12172 -0.431744 -36.2747 hiphop
4430.148194 0.562921 0.00299972 -235.538 31.87 0.465082 10.3449 5.95835 1.8618 2.15404 0.423419 1.17857 0.329474 3.53024e-13 -0.329474 -1.17857 -0.423419 -2.15404 -1.8618 -5.95835 -10.3449 -0.465082 -31.87 hiphop
4440.091898 0.58514 0.0011367 -262.064 40.8612 7.38056 0.448321 -0.279649 0.957577 0.292448 0.341203 0.469996 -0.161972 4.02337e-13 0.161972 -0.469996 -0.341203 -0.292448 -0.957577 0.279649 -0.448321 -7.38056 -40.8612 hiphop
4450.161222 0.834236 0.000249273 -285.599 21.2215 -3.0276 -1.74975 3.53119 -0.768585 -2.9399 -0.205001 0.0325673 -2.10496 4.08727e-13 2.10496 -0.0325673 0.205001 2.9399 0.768585 -3.53119 1.74975 3.0276 -21.2215 hiphop
4460.157456 0.735627 0.00141392 -259.675 30.1997 7.24243 6.57428 -0.958623 0.598326 0.130716 1.09615 -0.797161 -0.348781 3.84522e-13 0.348781 0.797161 -1.09615 -0.130716 -0.598326 0.958623 -6.57428 -7.24243 -30.1997 hiphop
4470.117472 0.759626 0.00282828 -244.789 37.8844 5.66694 7.83118 3.63564 3.01204 0.911649 -0.00329789 -0.0972437 0.821653 3.75036e-13 -0.821653 0.0972437 0.00329789 -0.911649 -3.01204 -3.63564 -7.83118 -5.66694 -37.8844 hiphop
4480.176915 0.694127 0.00295353 -235.319 27.861 5.37117 11.6869 2.6222 3.52059 0.44408 0.463742 -0.708286 0.113976 3.48817e-13 -0.113976 0.708286 -0.463742 -0.44408 -3.52059 -2.6222 -11.6869 -5.37117 -27.861 hiphop
4490.095763 0.504761 0.00233262 -257.36 34.2376 7.91518 11.9588 8.22989 4.50377 3.68803 1.77665 1.28036 0.29029 3.84412e-13 -0.29029 -1.28036 -1.77665 -3.68803 -4.50377 -8.22989 -11.9588 -7.91518 -34.2376 hiphop
4500.167062 0.6835 0.00375776 -226.979 27.6345 0.579339 13.9471 7.77106 4.26461 2.29581 1.56021 0.873998 0.606978 3.36453e-13 -0.606978 -0.873998 -1.56021 -2.29581 -4.26461 -7.77106 -13.9471 -0.579339 -27.6345 hiphop
4510.07966 0.611391 0.00357655 -245.741 43.7531 10.2058 8.19244 4.67758 3.93104 -0.975137 0.602361 -0.904433 0.445182 3.83655e-13 -0.445182 0.904433 -0.602361 0.975137 -3.93104 -4.67758 -8.19244 -10.2058 -43.7531 hiphop
4520.118206 0.662386 0.00339842 -241.217 35.0229 8.19049 14.698 5.72365 1.32625 1.78964 -0.532391 -0.242612 0.0502582 3.62632e-13 -0.0502582 0.242612 0.532391 -1.78964 -1.32625 -5.72365 -14.698 -8.19049 -35.0229 hiphop
4530.113672 0.572179 0.00137791 -260.139 33.1968 7.42923 8.88993 3.96627 2.51181 2.24334 1.942 1.33087 0.583112 3.88048e-13 -0.583112 -1.33087 -1.942 -2.24334 -2.51181 -3.96627 -8.88993 -7.42923 -33.1968 hiphop
4540.154114 0.666452 0.00130775 -254.172 28.2299 4.92224 9.90162 3.58812 2.40524 0.0680098 1.85932 1.30465 0.537512 3.74272e-13 -0.537512 -1.30465 -1.85932 -0.0680098 -2.40524 -3.58812 -9.90162 -4.92224 -28.2299 hiphop
4550.169915 0.800227 0.00159413 -244.065 30.8536 4.71981 7.22754 -0.821033 3.03048 0.787243 1.50988 -0.361041 -0.201152 3.65419e-13 0.201152 0.361041 -1.50988 -0.787243 -3.03048 0.821033 -7.22754 -4.71981 -30.8536 hiphop
4560.0924402 0.527201 0.00171823 -254.276 42.3008 -1.00711 1.63917 7.03653 2.81855 1.90567 1.16544 1.1696 0.25642 3.94e-13 -0.25642 -1.1696 -1.16544 -1.90567 -2.81855 -7.03653 -1.63917 1.00711 -42.3008 hiphop
4570.124148 0.580438 0.00213204 -244.38 36.2842 -1.63582 8.11198 6.33583 1.55261 4.99701 1.76414 2.62054 0.388609 3.70093e-13 -0.388609 -2.62054 -1.76414 -4.99701 -1.55261 -6.33583 -8.11198 1.63582 -36.2842 hiphop
4580.089406 0.541235 0.00292899 -249.216 40.8399 1.95265 8.48678 9.78221 4.21506 3.36375 1.25844 1.29429 0.660715 3.83466e-13 -0.660715 -1.29429 -1.25844 -3.36375 -4.21506 -9.78221 -8.48678 -1.95265 -40.8399 hiphop
4590.140623 0.744159 0.0015939 -248.835 33.3968 -3.83946 5.65116 6.67768 1.95384 4.28385 1.9455 2.14301 0.120031 3.73557e-13 -0.120031 -2.14301 -1.9455 -4.28385 -1.95384 -6.67768 -5.65116 3.83946 -33.3968 hiphop
4600.117744 0.606619 0.00189594 -250.181 36.3363 -0.211424 6.68208 8.37235 4.01827 2.85356 2.16359 1.67929 -0.366893 3.78985e-13 0.366893 -1.67929 -2.16359 -2.85356 -4.01827 -8.37235 -6.68208 0.211424 -36.3363 hiphop
4610.0832366 0.470177 0.00244319 -257.41 38.4852 1.88148 8.39183 11.2287 3.86815 4.27516 3.53062 2.92514 1.24219 3.91053e-13 -1.24219 -2.92514 -3.53062 -4.27516 -3.86815 -11.2287 -8.39183 -1.88148 -38.4852 hiphop
4620.0934878 0.648732 0.00202251 -252.435 41.2926 -0.0338664 3.05852 6.26639 4.09315 4.7432 2.22435 0.605028 0.595856 3.90464e-13 -0.595856 -0.605028 -2.22435 -4.7432 -4.09315 -6.26639 -3.05852 0.0338664 -41.2926 hiphop
4630.128186 0.731215 0.00244279 -252.221 33.8881 3.96779 6.9967 3.55035 2.45857 2.52287 0.862723 0.732699 -0.00689194 3.78789e-13 0.00689194 -0.732699 -0.862723 -2.52287 -2.45857 -3.55035 -6.9967 -3.96779 -33.8881 hiphop
4640.156787 0.794321 0.00222118 -241.802 32.9608 -2.25655 6.05438 4.2011 1.47045 2.85768 -0.303493 -0.409839 -0.339619 3.64135e-13 0.339619 0.409839 0.303493 -2.85768 -1.47045 -4.2011 -6.05438 2.25655 -32.9608 hiphop
4650.13423 0.737177 0.00293818 -236.407 36.9967 0.915853 9.99035 6.14554 0.484049 2.01826 -0.742697 -0.181051 0.013462 3.60248e-13 -0.013462 0.181051 0.742697 -2.01826 -0.484049 -6.14554 -9.99035 -0.915853 -36.9967 hiphop
4660.133015 0.724545 0.00264503 -249.292 32.908 8.70101 11.675 4.01433 3.31746 0.966692 -0.154394 0.0419047 0.510884 3.73145e-13 -0.510884 -0.0419047 0.154394 -0.966692 -3.31746 -4.01433 -11.675 -8.70101 -32.908 hiphop
4670.110826 0.568837 0.00260473 -244.602 39.5217 4.15588 7.68866 3.62559 -0.289137 0.510852 0.0340493 1.80375 0.615492 3.74813e-13 -0.615492 -1.80375 -0.0340493 -0.510852 0.289137 -3.62559 -7.68866 -4.15588 -39.5217 hiphop
4680.167717 0.718949 0.00289123 -234.589 30.5128 1.32197 8.43461 3.32318 3.51493 0.458872 0.874202 -0.583842 0.0516903 3.52331e-13 -0.0516903 0.583842 -0.874202 -0.458872 -3.51493 -3.32318 -8.43461 -1.32197 -30.5128 hiphop
4690.134579 0.663828 0.00315395 -234.074 33.8225 2.22535 11.4337 6.24029 3.1942 3.09124 0.583466 0.558966 -0.23147 3.53058e-13 0.23147 -0.558966 -0.583466 -3.09124 -3.1942 -6.24029 -11.4337 -2.22535 -33.8225 hiphop
4700.177241 0.652043 0.00362161 -228.72 25.4609 2.42576 15.7602 7.13779 3.08195 1.76728 1.19425 0.461857 0.209685 3.34813e-13 -0.209685 -0.461857 -1.19425 -1.76728 -3.08195 -7.13779 -15.7602 -2.42576 -25.4609 hiphop
4710.137232 0.579598 0.00372068 -233.731 31.5339 8.14033 14.0868 3.8471 3.31236 1.47653 1.78998 0.785304 0.408795 3.49641e-13 -0.408795 -0.785304 -1.78998 -1.47653 -3.31236 -3.8471 -14.0868 -8.14033 -31.5339 hiphop
4720.175333 0.579663 0.00307086 -235.395 25.4444 6.47456 13.6792 4.56276 6.25462 0.794848 0.597425 0.662448 0.24959 3.45617e-13 -0.24959 -0.662448 -0.597425 -0.794848 -6.25462 -4.56276 -13.6792 -6.47456 -25.4444 hiphop
4730.0836498 0.557226 0.00359907 -251.833 39.5027 9.1313 9.41559 7.66408 6.62201 0.464274 2.02432 0.187676 0.582036 3.865e-13 -0.582036 -0.187676 -2.02432 -0.464274 -6.62201 -7.66408 -9.41559 -9.1313 -39.5027 hiphop
4740.152049 0.662139 0.00353071 -238.368 31.0387 6.44589 12.3592 3.85942 3.24751 0.970658 0.504028 -0.506955 0.186927 3.56184e-13 -0.186927 0.506955 -0.504028 -0.970658 -3.24751 -3.85942 -12.3592 -6.44589 -31.0387 hiphop
4750.145065 0.590238 0.00280006 -234.93 32.8094 0.608415 13.0951 6.25629 -0.183751 2.51061 -1.66825 1.30032 -0.275021 3.50909e-13 0.275021 -1.30032 1.66825 -2.51061 0.183751 -6.25629 -13.0951 -0.608415 -32.8094 hiphop
4760.157753 0.756559 0.00249182 -241.415 30.7673 2.50928 11.0866 4.89237 1.68864 0.531371 0.128988 -0.209064 0.009992 3.59722e-13 -0.009992 0.209064 -0.128988 -0.531371 -1.68864 -4.89237 -11.0866 -2.50928 -30.7673 hiphop
4770.113908 0.72161 0.00308998 -244.363 40.3745 4.44991 4.06282 2.44354 2.39666 -1.66442 0.402146 0.690029 -0.894086 3.77235e-13 0.894086 -0.690029 -0.402146 1.66442 -2.39666 -2.44354 -4.06282 -4.44991 -40.3745 hiphop
4780.147835 0.773601 0.00308037 -224.057 35.7146 -0.57813 6.17386 1.86638 0.921795 0.52749 0.8231 -0.293921 -0.387583 3.44125e-13 0.387583 0.293921 -0.8231 -0.52749 -0.921795 -1.86638 -6.17386 0.57813 -35.7146 hiphop
4790.113908 0.718768 0.00308998 -244.363 40.3745 4.44991 4.06282 2.44354 2.39666 -1.66442 0.402146 0.690029 -0.894086 3.77235e-13 0.894086 -0.690029 -0.402146 1.66442 -2.39666 -2.44354 -4.06282 -4.44991 -40.3745 hiphop
4800.171156 0.868139 0.00199641 -236.955 31.0055 -2.82251 2.75948 4.45398 3.89632 -1.92174 -0.652977 -0.1741 -1.32535 3.56994e-13 1.32535 0.1741 0.652977 1.92174 -3.89632 -4.45398 -2.75948 2.82251 -31.0055 hiphop
4810.178659 0.856143 0.00191538 -231.314 31.5209 -1.59792 7.48286 4.06265 2.15767 -0.690084 0.0717208 -0.533984 -0.206405 3.49049e-13 0.206405 0.533984 -0.0717208 0.690084 -2.15767 -4.06265 -7.48286 1.59792 -31.5209 hiphop
4820.0729749 0.553895 0.00106638 -273.843 34.2019 9.1603 6.74317 4.57498 2.91115 2.79919 0.743041 1.50447 0.040419 4.07322e-13 -0.040419 -1.50447 -0.743041 -2.79919 -2.91115 -4.57498 -6.74317 -9.1603 -34.2019 hiphop
4830.121035 0.763176 0.0013288 -250.228 38.8224 -2.50666 4.78847 3.68339 -1.97209 2.01382 -1.32129 0.506943 -0.00223101 3.81868e-13 0.00223101 -0.506943 1.32129 -2.01382 1.97209 -3.68339 -4.78847 2.50666 -38.8224 hiphop
4840.120929 0.716777 0.00157534 -246.495 37.6694 -3.46322 3.91845 3.75888 1.73069 3.53996 -1.67938 1.686 -0.367484 3.76146e-13 0.367484 -1.686 1.67938 -3.53996 -1.73069 -3.75888 -3.91845 3.46322 -37.6694 hiphop
4850.0956475 0.764795 0.000786264 -272.593 33.7675 2.68638 2.03207 5.42461 2.49603 0.665357 -0.954812 -0.365372 -0.547565 4.07321e-13 0.547565 0.365372 0.954812 -0.665357 -2.49603 -5.42461 -2.03207 -2.68638 -33.7675 hiphop
4860.143502 0.725537 0.00144385 -244.581 34.8411 -4.34308 6.66671 3.58704 -1.05992 3.08785 -2.35655 1.62399 -0.794664 3.67931e-13 0.794664 -1.62399 2.35655 -3.08785 1.05992 -3.58704 -6.66671 4.34308 -34.8411 hiphop
4870.106588 0.591305 0.000937946 -270.092 32.5483 2.5812 4.31728 4.47959 2.58931 4.92408 2.22228 2.16349 1.26907 4.02126e-13 -1.26907 -2.16349 -2.22228 -4.92408 -2.58931 -4.47959 -4.31728 -2.5812 -32.5483 hiphop
4880.132766 0.66223 0.00136209 -258.643 30.1237 -1.81228 9.0156 8.55522 3.19937 4.34094 1.14176 3.09384 0.884757 3.82022e-13 -0.884757 -3.09384 -1.14176 -4.34094 -3.19937 -8.55522 -9.0156 1.81228 -30.1237 hiphop
4890.14312 0.80399 0.00156769 -240.743 34.9559 -4.43827 5.89743 2.91775 -0.216475 4.41722 -1.8475 1.67144 -1.27383 3.62868e-13 1.27383 -1.67144 1.8475 -4.41722 0.216475 -2.91775 -5.89743 4.43827 -34.9559 hiphop
4900.136826 0.6962 0.00156091 -243.894 35.8008 -4.82462 5.2917 4.45142 -0.199514 3.14266 -1.71142 0.295731 -1.47974 3.68764e-13 1.47974 -0.295731 1.71142 -3.14266 0.199514 -4.45142 -5.2917 4.82462 -35.8008 hiphop
4910.12533 0.731914 0.00139717 -246.613 37.5788 -3.01845 3.42082 1.72388 0.574061 3.16533 -1.14677 2.11761 -0.584684 3.75811e-13 0.584684 -2.11761 1.14677 -3.16533 -0.574061 -1.72388 -3.42082 3.01845 -37.5788 hiphop
4920.149463 0.755909 0.00156076 -241.035 33.6027 -6.08012 6.76446 5.05597 -0.57822 3.82557 -2.23647 1.5967 -1.0246 3.61436e-13 1.0246 -1.5967 2.23647 -3.82557 0.57822 -5.05597 -6.76446 6.08012 -33.6027 hiphop
4930.11836 0.635568 0.00164362 -254.35 33.7437 3.66136 8.94762 3.57086 4.12267 5.24565 -1.02461 1.508 -1.0211 3.7973e-13 1.0211 -1.508 1.02461 -5.24565 -4.12267 -3.57086 -8.94762 -3.66136 -33.7437 hiphop
4940.1693 0.689817 0.000931426 -257.916 25.6026 -2.1434 11.8489 7.12679 1.38863 5.71191 -0.603617 1.34368 -0.79428 3.72792e-13 0.79428 -1.34368 0.603617 -5.71191 -1.38863 -7.12679 -11.8489 2.1434 -25.6026 hiphop
4950.0992144 0.666193 0.00135457 -258.583 38.3999 2.77303 4.03884 3.37243 2.82993 2.74946 -1.50879 1.02742 -0.227079 3.9356e-13 0.227079 -1.02742 1.50879 -2.74946 -2.82993 -3.37243 -4.03884 -2.77303 -38.3999 hiphop
4960.15349 0.757334 0.00146533 -239.264 33.3135 -8.44714 5.66719 6.02275 0.0364095 4.9186 -1.30019 2.69411 -0.220803 3.59568e-13 0.220803 -2.69411 1.30019 -4.9186 -0.0364095 -6.02275 -5.66719 8.44714 -33.3135 hiphop
4970.0976051 0.82846 0.00147275 -250.41 43.8491 -1.8169 1.47401 4.11468 -1.59162 0.857633 -0.574168 1.29448 0.52387 3.8978e-13 -0.52387 -1.29448 0.574168 -0.857633 1.59162 -4.11468 -1.47401 1.8169 -43.8491 hiphop
4980.127321 0.696533 0.00168698 -245.224 35.9904 0.15467 8.4446 2.69958 -0.491206 3.61466 -1.38347 1.59285 -0.878736 3.69478e-13 0.878736 -1.59285 1.38347 -3.61466 0.491206 -2.69958 -8.4446 -0.15467 -35.9904 hiphop
4990.140466 0.620189 0.00146198 -252.694 30.5042 -5.51149 8.34694 8.96083 3.55216 6.26137 0.111183 2.54834 -0.0585452 3.74084e-13 0.0585452 -2.54834 -0.111183 -6.26137 -3.55216 -8.96083 -8.34694 5.51149 -30.5042 hiphop
5000.0975958 0.764314 0.00192829 -248.871 43.9138 -0.181223 0.969217 2.98619 0.181604 0.613411 -1.74303 0.849861 -0.900511 3.8741e-13 0.900511 -0.849861 1.74303 -0.613411 -0.181604 -2.98619 -0.969217 0.181223 -43.9138 hiphop
5010.0914936 0.645289 0.000477584 -272.702 34.8661 4.2465 -2.172 -0.299251 0.475481 0.570235 0.294654 -0.029053 -0.415707 4.09828e-13 0.415707 0.029053 -0.294654 -0.570235 -0.475481 0.299251 2.172 -4.2465 -34.8661 jazz
5020.0735984 0.490958 0.000362569 -279.215 34.0687 8.89683 1.32972 1.07115 0.409891 0.425203 0.465438 -0.121775 -0.498423 4.15845e-13 0.498423 0.121775 -0.465438 -0.425203 -0.409891 -1.07115 -1.32972 -8.89683 -34.0687 jazz
5030.0509411 0.370415 0.000982696 -266.207 46.1145 8.90399 -1.68323 2.7772 2.216 0.560242 0.248684 0.219667 -0.0117622 4.15114e-13 0.0117622 -0.219667 -0.248684 -0.560242 -2.216 -2.7772 1.68323 -8.90399 -46.1145 jazz
5040.0571216 0.415306 0.00110092 -267.87 45.0434 11.8374 0.0461885 -0.082598 1.7745 0.963786 -1.19518 -0.11482 0.47216 4.15839e-13 -0.47216 0.11482 1.19518 -0.963786 -1.7745 0.082598 -0.0461885 -11.8374 -45.0434 jazz
5050.0491752 0.317662 0.00115695 -269.198 45.4583 14.0878 2.73546 0.649845 -2.39606 -2.32862 -0.334926 0.587679 -0.00208399 4.15303e-13 0.00208399 -0.587679 0.334926 2.32862 2.39606 -0.649845 -2.73546 -14.0878 -45.4583 jazz
5060.0924531 0.585245 0.00172204 -248.864 45.1751 2.12461 2.78639 0.259877 -1.72349 2.04527 -0.690349 0.960234 -0.662539 3.87797e-13 0.662539 -0.960234 0.690349 -2.04527 1.72349 -0.259877 -2.78639 -2.12461 -45.1751 jazz
5070.0618278 0.486938 0.0012517 -262.573 43.8656 6.75061 2.87955 5.56293 1.11848 -0.00546517 -0.298782 1.24684 0.719812 4.0601e-13 -0.719812 -1.24684 0.298782 0.00546517 -1.11848 -5.56293 -2.87955 -6.75061 -43.8656 jazz
5080.0602318 0.37301 0.00109087 -266.223 44.1358 7.87451 -1.74354 -1.78905 -3.35878 -0.0536101 0.831373 -0.148616 0.00232995 4.11444e-13 -0.00232995 0.148616 -0.831373 0.0536101 3.35878 1.78905 1.74354 -7.87451 -44.1358 jazz
5090.0664979 0.504228 0.00146235 -260.644 44.4263 4.48523 1.37335 6.40295 4.4878 3.52118 1.77167 1.46987 0.0296409 4.04761e-13 -0.0296409 -1.46987 -1.77167 -3.52118 -4.4878 -6.40295 -1.37335 -4.48523 -44.4263 jazz
5100.0426605 0.323596 0.00119172 -271.639 46.6524 18.7882 2.55201 -2.5981 -1.64121 0.945353 1.72047 1.75046 1.11446 4.20414e-13 -1.11446 -1.75046 -1.72047 -0.945353 1.64121 2.5981 -2.55201 -18.7882 -46.6524 jazz
5110.0404367 0.33942 0.000728364 -280.16 35.0045 11.4411 4.03514 5.56086 4.50013 2.00923 0.0979394 -0.00410167 0.00564352 4.18418e-13 -0.00564352 0.00410167 -0.0979394 -2.00923 -4.50013 -5.56086 -4.03514 -11.4411 -35.0045 jazz
5120.0934652 0.512988 0.00109821 -255.835 43.1601 0.952704 0.397092 1.80716 -0.145325 0.856448 -1.77766 -0.140823 -0.319357 3.96748e-13 0.319357 0.140823 1.77766 -0.856448 0.145325 -1.80716 -0.397092 -0.952704 -43.1601 jazz
5130.0845881 0.482221 0.000487161 -276.718 34.5852 8.21086 2.99552 2.68638 1.21289 0.480748 -0.747802 0.0446123 0.194732 4.1341e-13 -0.194732 -0.0446123 0.747802 -0.480748 -1.21289 -2.68638 -2.99552 -8.21086 -34.5852 jazz
5140.0949963 0.562522 0.000689893 -269.555 37.0609 7.76383 5.17188 2.07571 -0.254599 -0.489458 -2.07267 0.152519 -0.141278 4.05627e-13 0.141278 -0.152519 2.07267 0.489458 0.254599 -2.07571 -5.17188 -7.76383 -37.0609 jazz
5150.0733984 0.387277 0.000547595 -273.077 35.549 2.44095 -2.9389 1.85572 0.133437 -0.791063 -0.947425 -0.556778 -0.589897 4.11385e-13 0.589897 0.556778 0.947425 0.791063 -0.133437 -1.85572 2.9389 -2.44095 -35.549 jazz
5160.092912 0.616799 0.000778186 -267.108 38.2918 4.9045 2.3708 2.60514 1.11866 0.855996 -1.14669 0.296948 0.00254836 4.0534e-13 -0.00254836 -0.296948 1.14669 -0.855996 -1.11866 -2.60514 -2.3708 -4.9045 -38.2918 jazz
5170.0717749 0.362608 0.000833058 -266.847 42.5576 6.87865 -0.907511 0.982133 -0.0544725 -0.396567 -1.31432 -0.39499 0.222459 4.11423e-13 -0.222459 0.39499 1.31432 0.396567 0.0544725 -0.982133 0.907511 -6.87865 -42.5576 jazz
5180.0973431 0.649205 0.000794078 -264.925 38.9631 1.77683 -0.204447 2.33795 0.324461 0.555104 -0.948566 -0.231159 -0.399036 4.03913e-13 0.399036 0.231159 0.948566 -0.555104 -0.324461 -2.33795 0.204447 -1.77683 -38.9631 jazz
5190.105047 0.545899 0.000720281 -262.456 39.0698 0.285224 0.471683 2.6044 0.70156 1.83219 0.0691502 0.408543 -0.358512 4.00464e-13 0.358512 -0.408543 -0.0691502 -1.83219 -0.70156 -2.6044 -0.471683 -0.285224 -39.0698 jazz
5200.0696878 0.387736 0.000711626 -268.712 41.9064 6.66361 -1.98866 0.267514 -0.0189988 0.507854 0.00534112 -0.434699 -0.314324 4.12936e-13 0.314324 0.434699 -0.00534112 -0.507854 0.0189988 -0.267514 1.98866 -6.66361 -41.9064 jazz
5210.056313 0.41625 0.000342772 -292.049 26.0069 12.5382 6.43113 5.40335 3.95722 1.94523 0.640781 0.393877 0.313118 4.22281e-13 -0.313118 -0.393877 -0.640781 -1.94523 -3.95722 -5.40335 -6.43113 -12.5382 -26.0069 jazz
5220.15782 0.644985 0.000613164 -260.343 30.2547 -3.15566 6.5049 3.875 -1.59531 1.10745 -1.86596 1.40001 -0.447001 3.83805e-13 0.447001 -1.40001 1.86596 -1.10745 1.59531 -3.875 -6.5049 3.15566 -30.2547 jazz
5230.0808142 0.371334 0.000531454 -279.142 35.2043 11.4662 2.51809 -0.622943 -0.785736 0.598501 0.116865 0.18819 0.0485206 4.16637e-13 -0.0485206 -0.18819 -0.116865 -0.598501 0.785736 0.622943 -2.51809 -11.4662 -35.2043 jazz
5240.104595 0.45846 0.00102586 -256.603 41.0385 -1.20668 -0.27298 0.135257 -3.21355 -0.221749 -2.29937 -0.84222 -0.309044 3.94983e-13 0.309044 0.84222 2.29937 0.221749 3.21355 -0.135257 0.27298 1.20668 -41.0385 jazz
5250.122536 0.580608 0.000712305 -262.168 35.8547 -0.822582 2.6119 2.8417 -0.317381 1.94339 -0.542232 0.644148 0.0325329 3.95376e-13 -0.0325329 -0.644148 0.542232 -1.94339 0.317381 -2.8417 -2.6119 0.822582 -35.8547 jazz
5260.0828811 0.519127 0.000620882 -278.178 34.1609 11.2201 6.38999 3.07811 0.122969 0.375688 0.317273 1.12697 0.452106 4.12979e-13 -0.452106 -1.12697 -0.317273 -0.375688 -0.122969 -3.07811 -6.38999 -11.2201 -34.1609 jazz
5270.0591493 0.155857 0.000448281 -287.11 31.8656 14.7645 4.33004 1.26573 0.757409 0.598713 0.0110071 -0.453247 -0.315526 4.2251e-13 0.315526 0.453247 -0.0110071 -0.598713 -0.757409 -1.26573 -4.33004 -14.7645 -31.8656 jazz
5280.0962548 0.65759 0.000493987 -274.122 34.2207 4.79166 3.53604 5.47166 0.12205 -1.56989 0.584086 1.98677 -0.156515 4.08296e-13 0.156515 -1.98677 -0.584086 1.56989 -0.12205 -5.47166 -3.53604 -4.79166 -34.2207 jazz
5290.0983873 0.481603 0.000672084 -265.384 39.3303 3.33121 1.25924 2.58269 -0.589574 -1.28948 -1.12093 0.674577 -0.60095 4.03814e-13 0.60095 -0.674577 1.12093 1.28948 0.589574 -2.58269 -1.25924 -3.33121 -39.3303 jazz
5300.118728 0.619428 0.000451909 -270.918 33.9976 2.42318 3.38148 5.0072 -0.0851645 -1.64785 -0.369356 1.32747 -0.899393 4.03535e-13 0.899393 -1.32747 0.369356 1.64785 0.0851645 -5.0072 -3.38148 -2.42318 -33.9976 jazz
5310.082317 0.314278 0.000420272 -278.339 34.229 8.30712 3.85658 4.77383 -0.418056 -2.55324 -0.797267 -0.0432728 -0.881946 4.13524e-13 0.881946 0.0432728 0.797267 2.55324 0.418056 -4.77383 -3.85658 -8.30712 -34.229 jazz
5320.0943241 0.616065 0.000608427 -267.343 38.3616 2.05562 -0.546298 2.3498 -0.0996792 0.0995288 -0.771583 -0.202448 0.241711 4.06985e-13 -0.241711 0.202448 0.771583 -0.0995288 0.0996792 -2.3498 0.546298 -2.05562 -38.3616 jazz
5330.0760357 0.546508 0.000524273 -282.28 32.6648 11.4104 3.87042 1.46659 0.355397 0.938319 0.842705 1.03927 0.72419 4.17777e-13 -0.72419 -1.03927 -0.842705 -0.938319 -0.355397 -1.46659 -3.87042 -11.4104 -32.6648 jazz
5340.0570943 0.49499 0.000878807 -275.443 37.6543 10.6928 4.63605 4.66175 1.6121 1.32563 1.22685 0.532634 -0.0273464 4.14253e-13 0.0273464 -0.532634 -1.22685 -1.32563 -1.6121 -4.66175 -4.63605 -10.6928 -37.6543 jazz
5350.100245 0.702318 0.00157972 -247.374 42.1603 -3.99873 -0.179601 4.79739 -0.850899 2.4173 0.457796 1.43621 -0.103595 3.83576e-13 0.103595 -1.43621 -0.457796 -2.4173 0.850899 -4.79739 0.179601 3.99873 -42.1603 jazz
5360.0391418 0.455911 0.00115305 -270.401 45.5123 14.2438 2.64568 3.47969 1.20801 -0.572806 0.5417 0.080117 -1.32358 4.16715e-13 1.32358 -0.080117 -0.5417 0.572806 -1.20801 -3.47969 -2.64568 -14.2438 -45.5123 jazz
5370.082197 0.773493 0.00104045 -256.056 45.057 -3.13718 -5.18001 6.31428 1.54689 -0.305207 -0.300611 -0.187461 -1.21334 4.00917e-13 1.21334 0.187461 0.300611 0.305207 -1.54689 -6.31428 5.18001 3.13718 -45.057 jazz
5380.0623069 0.500267 0.00130677 -263.418 47.0588 9.2984 -1.54365 -1.06047 -0.838183 0.802418 0.688339 0.224818 -0.410209 4.11352e-13 0.410209 -0.224818 -0.688339 -0.802418 0.838183 1.06047 1.54365 -9.2984 -47.0588 jazz
5390.0784533 0.515552 0.00141215 -254.395 46.6654 2.81388 1.65488 4.61086 0.0873251 0.502537 0.238405 1.0072 -0.0491764 3.98366e-13 0.0491764 -1.0072 -0.238405 -0.502537 -0.0873251 -4.61086 -1.65488 -2.81388 -46.6654 jazz
5400.0818444 0.601223 0.00117674 -255.63 45.0015 -0.0497581 1.40582 6.35942 -2.77264 -0.0267673 -0.582504 -1.76132 1.28795 3.9932e-13 -1.28795 1.76132 0.582504 0.0267673 2.77264 -6.35942 -1.40582 0.0497581 -45.0015 jazz
5410.0685184 0.674027 0.00181065 -253.266 50.3289 4.80739 1.67954 3.97269 -4.33175 -1.88798 -0.0735282 -1.21643 -0.88366 3.99978e-13 0.88366 1.21643 0.0735282 1.88798 4.33175 -3.97269 -1.67954 -4.80739 -50.3289 jazz
5420.0938908 0.684022 0.00128423 -247.412 46.2029 -6.69519 -2.42005 8.18566 -2.98878 -0.419216 0.570178 0.693557 1.09455 3.90262e-13 -1.09455 -0.693557 -0.570178 0.419216 2.98878 -8.18566 2.42005 6.69519 -46.2029 jazz
5430.0668834 0.51308 0.0013772 -258.716 45.7561 7.47202 3.71532 3.3074 -4.26908 0.0297361 0.283843 -1.19117 -1.36425 3.99956e-13 1.36425 1.19117 -0.283843 -0.0297361 4.26908 -3.3074 -3.71532 -7.47202 -45.7561 jazz
5440.0912095 0.585796 0.00160291 -248.763 46.9483 -2.7678 -3.32129 2.61401 -1.78856 -0.0325569 -0.125081 1.42189 -0.616321 3.92025e-13 0.616321 -1.42189 0.125081 0.0325569 1.78856 -2.61401 3.32129 2.7678 -46.9483 jazz
5450.0485207 0.476631 0.0012184 -266.598 45.762 10.5468 -1.49666 -0.461967 0.319598 1.32277 0.838139 0.13002 -0.516423 4.14053e-13 0.516423 -0.13002 -0.838139 -1.32277 -0.319598 0.461967 1.49666 -10.5468 -45.762 jazz
5460.0464872 0.461808 0.00131048 -263.867 49.1508 11.202 0.0503898 3.38917 1.53334 -0.404701 0.178045 -0.213034 -1.22532 4.13877e-13 1.22532 0.213034 -0.178045 0.404701 -1.53334 -3.38917 -0.0503898 -11.202 -49.1508 jazz
5470.0727999 0.644795 0.00141455 -253.828 48.3549 2.486 0.233835 4.50766 -2.45693 0.401416 1.28921 -0.729542 -1.50816 3.98451e-13 1.50816 0.729542 -1.28921 -0.401416 2.45693 -4.50766 -0.233835 -2.486 -48.3549 jazz
5480.118506 0.506935 0.000608887 -269.114 33.9395 1.32316 2.39602 3.36752 0.198154 0.478054 -0.395612 1.08587 0.305092 4.02611e-13 -0.305092 -1.08587 0.395612 -0.478054 -0.198154 -3.36752 -2.39602 -1.32316 -33.9395 jazz
5490.08951 0.494928 0.000710687 -265.639 39.8002 3.58488 0.777602 2.9323 0.775124 0.931748 0.252761 0.626828 -0.268809 4.05337e-13 0.268809 -0.626828 -0.252761 -0.931748 -0.775124 -2.9323 -0.777602 -3.58488 -39.8002 jazz
5500.118396 0.574804 0.00246748 -244.169 41.5737 7.89454 9.43612 1.25924 -1.12445 -0.0301384 -4.05479 -0.919153 -2.72862 3.73579e-13 2.72862 0.919153 4.05479 0.0301384 1.12445 -1.25924 -9.43612 -7.89454 -41.5737 jazz
5510.12383 0.538333 0.00248241 -236.896 37.6475 1.31335 7.14114 3.01207 3.30969 2.19722 0.689803 2.56263 0.845905 3.63848e-13 -0.845905 -2.56263 -0.689803 -2.19722 -3.30969 -3.01207 -7.14114 -1.31335 -37.6475 jazz
5520.0582535 0.495173 0.000878854 -275.411 37.6474 10.6782 4.63591 4.65743 1.62017 1.3183 1.22812 0.541842 -0.0337012 4.14199e-13 0.0337012 -0.541842 -1.22812 -1.3183 -1.62017 -4.65743 -4.63591 -10.6782 -37.6474 jazz
5530.102686 0.37824 0.00278867 -236.251 42.5851 0.633626 7.41266 4.89161 -1.35196 1.81033 -0.997838 1.4645 0.97266 3.67475e-13 -0.97266 -1.4645 0.997838 -1.81033 1.35196 -4.89161 -7.41266 -0.633626 -42.5851 jazz
5540.10296 0.701492 0.00158021 -247.142 41.8852 -3.85846 -0.15908 4.65124 -0.651759 2.23665 0.579336 1.37564 -0.0829915 3.83092e-13 0.0829915 -1.37564 -0.579336 -2.23665 0.651759 -4.65124 0.15908 3.85846 -41.8852 jazz
5550.128564 0.48014 0.000772032 -264.372 35.6206 0.277621 -1.17831 -0.282843 -0.6332 0.17524 -0.194123 0.155119 -0.227773 3.99536e-13 0.227773 -0.155119 0.194123 -0.17524 0.6332 0.282843 1.17831 -0.277621 -35.6206 jazz
5560.0402185 0.458375 0.00115304 -270.39 45.5064 14.2384 2.64847 3.47895 1.21232 -0.575829 0.541922 0.0814141 -1.32644 4.16692e-13 1.32644 -0.0814141 -0.541922 0.575829 -1.21232 -3.47895 -2.64847 -14.2384 -45.5064 jazz
5570.152104 0.578616 0.00253427 -228.49 34.4623 0.882101 7.06451 1.31345 2.33039 0.971143 0.681924 1.59194 0.559797 3.4883e-13 -0.559797 -1.59194 -0.681924 -0.971143 -2.33039 -1.31345 -7.06451 -0.882101 -34.4623 jazz
5580.0591154 0.366411 0.00147335 -262.26 48.3495 11.2967 2.01659 2.32623 -0.581781 -1.419 -0.30153 0.331313 0.448683 4.11036e-13 -0.448683 -0.331313 0.30153 1.419 0.581781 -2.32623 -2.01659 -11.2967 -48.3495 jazz
5590.0852707 0.773656 0.00104047 -255.958 44.9471 -3.09724 -5.14401 6.23003 1.63366 -0.362119 -0.28505 -0.173586 -1.22977 4.00673e-13 1.22977 0.173586 0.28505 0.362119 -1.63366 -6.23003 5.14401 3.09724 -44.9471 jazz
5600.061378 0.379296 0.00266399 -255.373 47.0082 9.95219 5.15229 3.04006 0.707347 1.61248 0.0811801 0.0118493 -0.711569 3.9832e-13 0.711569 -0.0118493 -0.0811801 -1.61248 -0.707347 -3.04006 -5.15229 -9.95219 -47.0082 jazz
5610.0691243 0.499775 0.00130688 -263.034 46.6354 9.45428 -1.44871 -1.30445 -0.561992 0.587024 0.808027 0.18291 -0.406255 4.10486e-13 0.406255 -0.18291 -0.808027 -0.587024 0.561992 1.30445 1.44871 -9.45428 -46.6354 jazz
5620.12764 0.482291 0.00320482 -221.413 40.5206 -2.8368 4.72925 2.45825 1.13705 1.26959 -0.40405 1.42121 -0.170994 3.46575e-13 0.170994 -1.42121 0.40405 -1.26959 -1.13705 -2.45825 -4.72925 2.8368 -40.5206 jazz
5630.0858773 0.514111 0.00141233 -253.726 45.887 3.17368 1.7722 4.15038 0.650422 0.0562424 0.470286 0.952776 -0.0652131 3.96836e-13 0.0652131 -0.952776 -0.470286 -0.0562424 -0.650422 -4.15038 -1.7722 -3.17368 -45.887 jazz
5640.126082 0.562699 0.00213505 -235.069 39.5535 1.5669 6.5106 1.01706 0.57457 0.532951 -0.0483144 0.856319 0.43658 3.63641e-13 -0.43658 -0.856319 0.0483144 -0.532951 -0.57457 -1.01706 -6.5106 -1.5669 -39.5535 jazz
5650.089483 0.522359 0.00270867 -237.964 46.0421 2.19961 5.29421 3.18287 1.41895 0.420442 -1.12939 1.77532 -1.28162 3.73886e-13 1.28162 -1.77532 1.12939 -0.420442 -1.41895 -3.18287 -5.29421 -2.19961 -46.0421 jazz
5660.0829383 0.600424 0.00117673 -255.605 44.9731 -0.0410311 1.4174 6.33676 -2.74915 -0.0415294 -0.583536 -1.75217 1.28075 3.99251e-13 -1.28075 1.75217 0.583536 0.0415294 2.74915 -6.33676 -1.4174 0.0410311 -44.9731 jazz
5670.0826623 0.50597 0.0022197 -239.136 50.4915 -1.66595 -1.68936 2.38379 -1.04499 0.707604 -1.08113 -0.183568 0.418204 3.84767e-13 -0.418204 0.183568 1.08113 -0.707604 1.04499 -2.38379 1.68936 1.66595 -50.4915 jazz
5680.0702528 0.671537 0.00181067 -253.19 50.2465 4.83304 1.70674 3.91405 -4.27062 -1.92121 -0.0779196 -1.19114 -0.903889 3.99773e-13 0.903889 1.19114 0.0779196 1.92121 4.27062 -3.91405 -1.70674 -4.83304 -50.2465 jazz
5690.0685622 0.510746 0.00137722 -258.643 45.6782 7.4994 3.73282 3.25524 -4.20394 -0.0202619 0.306168 -1.19356 -1.36797 3.99796e-13 1.36797 1.19356 -0.306168 0.0202619 4.20394 -3.25524 -3.73282 -7.4994 -45.6782 jazz
5700.100649 0.585888 0.00160313 -247.81 45.8096 -2.16901 -3.26473 2.02037 -0.925011 -0.883879 0.528428 1.02168 -0.437948 3.90229e-13 0.437948 -1.02168 -0.528428 0.883879 0.925011 -2.02037 3.26473 2.16901 -45.8096 jazz
5710.0536911 0.476756 0.00121844 -266.324 45.462 10.6563 -1.43656 -0.618503 0.509359 1.15134 0.954718 0.0722604 -0.496929 4.13468e-13 0.496929 -0.0722604 -0.954718 -1.15134 -0.509359 0.618503 1.43656 -10.6563 -45.462 jazz
5720.0479461 0.461786 0.00131049 -263.841 49.1256 11.2059 0.0615326 3.37157 1.55071 -0.415807 0.179305 -0.206739 -1.23163 4.13811e-13 1.23163 0.206739 -0.179305 0.415807 -1.55071 -3.37157 -0.0615326 -11.2059 -49.1256 jazz
5730.0743557 0.644734 0.00141456 -253.782 48.3071 2.49896 0.24996 4.47438 -2.41952 0.375507 1.29447 -0.72206 -1.51606 3.98339e-13 1.51606 0.72206 -1.29447 -0.375507 2.41952 -4.47438 -0.24996 -2.49896 -48.3071 jazz
5740.155235 0.637123 0.00154909 -238.756 35.2365 -1.27897 4.94818 2.63995 1.67073 -1.65958 -0.444714 0.222387 0.525793 3.64903e-13 -0.525793 -0.222387 0.444714 1.65958 -1.67073 -2.63995 -4.94818 1.27897 -35.2365 jazz
5750.111993 0.44623 0.00131117 -254.976 39.7352 3.38983 4.23249 3.11075 0.146821 0.290225 0.3051 0.529701 -0.179948 3.90054e-13 0.179948 -0.529701 -0.3051 -0.290225 -0.146821 -3.11075 -4.23249 -3.38983 -39.7352 jazz
5760.156995 0.54098 0.00214961 -228.671 37.419 -2.93894 3.29644 0.698361 -0.160121 -2.52428 -1.0892 -0.857437 -0.352479 3.53977e-13 0.352479 0.857437 1.0892 2.52428 0.160121 -0.698361 -3.29644 2.93894 -37.419 jazz
5770.0861733 0.372261 0.00143704 -253.767 46.8397 3.28023 -1.20251 1.90081 0.671481 1.09039 0.834955 0.919255 0.634136 3.99678e-13 -0.634136 -0.919255 -0.834955 -1.09039 -0.671481 -1.90081 1.20251 -3.28023 -46.8397 jazz
5780.142332 0.556043 0.00230668 -226.373 38.6782 -6.49963 1.15894 2.20629 0.909478 0.438461 -2.26424 -1.14493 -0.981651 3.52513e-13 0.981651 1.14493 2.26424 -0.438461 -0.909478 -2.20629 -1.15894 6.49963 -38.6782 jazz
5790.122221 0.428767 0.0015289 -248.55 40.0365 -0.62924 3.75593 6.01242 0.139623 -2.78064 -2.27947 0.387998 0.290863 3.82969e-13 -0.290863 -0.387998 2.27947 2.78064 -0.139623 -6.01242 -3.75593 0.62924 -40.0365 jazz
5800.138279 0.524325 0.000924672 -252.101 36.3085 -2.47535 3.35359 4.34611 0.90712 -0.321184 0.234016 0.245829 0.131286 3.83527e-13 -0.131286 -0.245829 -0.234016 0.321184 -0.90712 -4.34611 -3.35359 2.47535 -36.3085 jazz
5810.168079 0.621651 0.00109708 -241.234 32.4452 -4.52496 5.34918 3.85794 0.843409 -0.414687 0.990544 1.14979 0.936681 3.64364e-13 -0.936681 -1.14979 -0.990544 0.414687 -0.843409 -3.85794 -5.34918 4.52496 -32.4452 jazz
5820.161496 0.492757 0.000477148 -279.865 23.2524 10.2211 9.8293 3.69008 4.41206 0.986618 1.05688 0.688971 0.693707 4.0282e-13 -0.693707 -0.688971 -1.05688 -0.986618 -4.41206 -3.69008 -9.8293 -10.2211 -23.2524 jazz
5830.227298 0.59444 0.000599657 -254.312 23.2235 2.53 7.31153 -0.197984 2.92281 0.0110138 1.35442 0.244672 0.319314 3.70099e-13 -0.319314 -0.244672 -1.35442 -0.0110138 -2.92281 0.197984 -7.31153 -2.53 -23.2235 jazz
5840.198573 0.545588 0.00100055 -247.306 25.8422 2.72971 11.6786 1.52359 0.0337082 0.148538 0.245453 0.0244192 0.110595 3.61149e-13 -0.110595 -0.0244192 -0.245453 -0.148538 -0.0337082 -1.52359 -11.6786 -2.72971 -25.8422 jazz
5850.149399 0.44485 0.000653071 -265.003 31.0438 1.5255 4.88231 3.32433 1.27042 0.513125 -0.382392 -0.361123 0.395811 3.93903e-13 -0.395811 0.361123 0.382392 -0.513125 -1.27042 -3.32433 -4.88231 -1.5255 -31.0438 jazz
5860.156137 0.504455 0.000873117 -249.034 34.3014 -6.52514 1.64005 2.83779 -1.4617 -0.102255 -0.926602 -0.780439 0.0542431 3.77265e-13 -0.0542431 0.780439 0.926602 0.102255 1.4617 -2.83779 -1.64005 6.52514 -34.3014 jazz
5870.21509 0.507155 0.000683914 -246.593 23.1523 -4.73221 5.82761 1.38908 0.488113 -0.217591 0.274326 -2.16856 0.284938 3.60579e-13 -0.284938 2.16856 -0.274326 0.217591 -0.488113 -1.38908 -5.82761 4.73221 -23.1523 jazz
5880.0780243 0.368896 0.000544528 -299.057 20.3834 15.2066 11.6219 8.2292 6.15088 4.65069 3.33962 1.96654 0.885569 4.23004e-13 -0.885569 -1.96654 -3.33962 -4.65069 -6.15088 -8.2292 -11.6219 -15.2066 -20.3834 jazz
5890.110398 0.299846 0.00148691 -250.459 43.6996 6.27578 -0.012181 -1.87848 2.51362 0.553819 2.66346 0.0384616 -0.933317 3.91029e-13 0.933317 -0.0384616 -2.66346 -0.553819 -2.51362 1.87848 0.012181 -6.27578 -43.6996 jazz
5900.0854394 0.32469 0.000460506 -286.466 29.2916 11.0418 5.70051 6.21486 3.86979 -0.183823 -2.0996 -1.48212 -0.495402 4.19356e-13 0.495402 1.48212 2.0996 0.183823 -3.86979 -6.21486 -5.70051 -11.0418 -29.2916 jazz
5910.0897365 0.388906 0.000842748 -266.412 40.3894 10.4835 5.7398 3.3993 -0.22601 -2.81939 -0.866033 0.418164 0.319174 4.05825e-13 -0.319174 -0.418164 0.866033 2.81939 0.22601 -3.3993 -5.7398 -10.4835 -40.3894 jazz
5920.141911 0.346163 0.00050574 -276.939 23.7604 6.08996 4.84873 2.47756 0.925241 -1.11709 -2.76376 -1.4535 0.968074 4.01313e-13 -0.968074 1.4535 2.76376 1.11709 -0.925241 -2.47756 -4.84873 -6.08996 -23.7604 jazz
5930.0826558 0.293532 0.000812116 -278.154 35.6907 14.4671 8.23823 4.88446 0.65201 -2.43677 -1.83031 0.22297 0.932787 4.15193e-13 -0.932787 -0.22297 1.83031 2.43677 -0.65201 -4.88446 -8.23823 -14.4671 -35.6907 jazz
5940.107525 0.432898 0.000539244 -271.342 36.7879 8.07791 1.05173 0.354064 2.05492 0.723948 0.607323 -0.107495 -0.626692 4.09501e-13 0.626692 0.107495 -0.607323 -0.723948 -2.05492 -0.354064 -1.05173 -8.07791 -36.7879 jazz
5950.0520317 0.364306 0.00049348 -284.284 33.7858 14.5765 4.80842 2.68001 1.63588 0.128111 -0.741152 -0.116559 0.386929 4.21784e-13 -0.386929 0.116559 0.741152 -0.128111 -1.63588 -2.68001 -4.80842 -14.5765 -33.7858 jazz
5960.106499 0.433561 0.000924667 -260.625 39.2537 1.97673 1.99834 2.45561 1.93898 2.18751 -1.32051 0.616947 0.0760991 3.98343e-13 -0.0760991 -0.616947 1.32051 -2.18751 -1.93898 -2.45561 -1.99834 -1.97673 -39.2537 jazz
5970.107579 0.413575 0.000647954 -261.796 40.005 0.272768 -2.77699 0.206265 1.34334 1.09398 -1.21439 0.930425 -0.146906 4.02278e-13 0.146906 -0.930425 1.21439 -1.09398 -1.34334 -0.206265 2.77699 -0.272768 -40.005 jazz
5980.0561988 0.295752 0.000285538 -292.958 26.9005 15.2699 6.6341 2.43021 0.639738 -0.449235 -1.34051 -1.53504 -0.9987 4.23127e-13 0.9987 1.53504 1.34051 0.449235 -0.639738 -2.43021 -6.6341 -15.2699 -26.9005 jazz
5990.100686 0.498172 0.000772789 -268.56 35.6417 5.9258 5.61872 3.58951 1.39094 2.24914 -0.446487 1.08878 1.18366 4.03544e-13 -1.18366 -1.08878 0.446487 -2.24914 -1.39094 -3.58951 -5.61872 -5.9258 -35.6417 jazz
6000.0791504 0.41938 0.000523978 -278.766 35.0816 9.71246 1.45573 0.987022 0.773142 -0.270703 -1.65517 -0.928454 -0.302712 4.17051e-13 0.302712 0.928454 1.65517 0.270703 -0.773142 -0.987022 -1.45573 -9.71246 -35.0816 jazz
6010.166433 0.579362 0.00147009 -232.841 32.0134 -8.89895 5.93007 8.20919 1.68797 1.35358 -0.0705193 -0.407475 -0.500087 3.51457e-13 0.500087 0.407475 0.0705193 -1.35358 -1.68797 -8.20919 -5.93007 8.89895 -32.0134 metal
6020.15526 0.648761 0.00138336 -236.372 33.0965 -7.11652 4.851 4.86094 2.08848 2.32648 -0.21179 2.17679 1.60781 3.59077e-13 -1.60781 -2.17679 0.21179 -2.32648 -2.08848 -4.86094 -4.851 7.11652 -33.0965 metal
6030.121161 0.69854 0.00179632 -233.814 43.2287 -8.5977 0.987505 5.10014 -1.52404 2.74289 -2.34576 0.733736 -0.520119 3.66291e-13 0.520119 -0.733736 2.34576 -2.74289 1.52404 -5.10014 -0.987505 8.5977 -43.2287 metal
6040.158087 0.738518 0.00188484 -227.838 34.0557 -10.3666 4.43311 4.54117 -1.20116 4.73372 -1.51115 3.35517 -0.414384 3.44997e-13 0.414384 -3.35517 1.51115 -4.73372 1.20116 -4.54117 -4.43311 10.3666 -34.0557 metal
6050.180739 0.678494 0.000818756 -246.335 27.5834 -6.38818 4.76828 4.23278 3.47478 1.18547 -0.451546 0.90568 0.41607 3.65698e-13 -0.41607 -0.90568 0.451546 -1.18547 -3.47478 -4.23278 -4.76828 6.38818 -27.5834 metal
6060.131851 0.634732 0.00163278 -238.546 38.8428 -5.43978 6.37654 7.13354 -1.23036 2.92448 -0.622393 1.86488 -0.096932 3.65206e-13 0.096932 -1.86488 0.622393 -2.92448 1.23036 -7.13354 -6.37654 5.43978 -38.8428 metal
6070.162587 0.609351 0.000641348 -252.574 32.2181 -6.36008 3.42342 3.48999 -1.80634 -0.481263 -1.23943 0.67791 0.676356 3.78753e-13 -0.676356 -0.67791 1.23943 0.481263 1.80634 -3.48999 -3.42342 6.36008 -32.2181 metal
6080.152718 0.6755 0.000912061 -248.342 32.7782 -6.89223 5.14162 7.15949 2.46701 1.43454 -0.79651 1.74365 0.610337 3.73813e-13 -0.610337 -1.74365 0.79651 -1.43454 -2.46701 -7.15949 -5.14162 6.89223 -32.7782 metal
6090.15983 0.512116 0.00077542 -253.097 31.4507 -1.50901 3.58894 2.831 2.30739 -0.21724 1.47444 1.03563 0.33336 3.79332e-13 -0.33336 -1.03563 -1.47444 0.21724 -2.30739 -2.831 -3.58894 1.50901 -31.4507 metal
6100.128401 0.646925 0.00389654 -219.707 38.2014 -2.53462 11.655 5.5462 -4.34902 4.22808 -1.74008 2.04179 -1.05131 3.34967e-13 1.05131 -2.04179 1.74008 -4.22808 4.34902 -5.5462 -11.655 2.53462 -38.2014 metal
6110.164079 0.647606 0.00156536 -233.858 31.8787 -6.90649 10.7318 8.60767 -1.72102 3.16797 -2.54436 2.13625 -0.206098 3.48393e-13 0.206098 -2.13625 2.54436 -3.16797 1.72102 -8.60767 -10.7318 6.90649 -31.8787 metal
6120.147143 0.642916 0.00316484 -214.064 37.2404 -8.65817 6.83636 6.97143 -1.59662 0.789459 -3.75876 3.59493 -0.29854 3.29827e-13 0.29854 -3.59493 3.75876 -0.789459 1.59662 -6.97143 -6.83636 8.65817 -37.2404 metal
6130.157962 0.629858 0.001457 -235.905 32.8326 -12.2737 4.90498 8.97904 1.49789 4.71911 -2.04449 2.56049 -0.0901632 3.55479e-13 0.0901632 -2.56049 2.04449 -4.71911 -1.49789 -8.97904 -4.90498 12.2737 -32.8326 metal
6140.166776 0.689924 0.00112979 -238.88 31.2837 -11.4798 4.69016 6.86776 0.742673 3.40594 -2.91535 2.15326 -0.266511 3.57677e-13 0.266511 -2.15326 2.91535 -3.40594 -0.742673 -6.86776 -4.69016 11.4798 -31.2837 metal
6150.159422 0.572662 0.00102422 -243.816 32.8447 -12.6535 3.39069 8.64238 1.11791 4.53526 -0.982986 2.19338 0.238968 3.67014e-13 -0.238968 -2.19338 0.982986 -4.53526 -1.11791 -8.64238 -3.39069 12.6535 -32.8447 metal
6160.173937 0.651723 0.00147207 -234.554 29.7162 -6.20295 11.6333 8.75471 -0.326622 3.07015 -3.05096 1.84296 -0.498212 3.46675e-13 0.498212 -1.84296 3.05096 -3.07015 0.326622 -8.75471 -11.6333 6.20295 -29.7162 metal
6170.154749 0.719818 0.00340177 -211.11 36.3535 -13.4349 1.54476 4.53263 -1.25835 3.64621 -3.80359 3.2219 -0.717275 3.26362e-13 0.717275 -3.2219 3.80359 -3.64621 1.25835 -4.53263 -1.54476 13.4349 -36.3535 metal
6180.151362 0.671971 0.00142465 -239.361 32.7543 -6.55301 9.20911 8.05439 0.58987 4.1356 -2.15934 2.05887 -0.965776 3.57416e-13 0.965776 -2.05887 2.15934 -4.1356 -0.58987 -8.05439 -9.20911 6.55301 -32.7543 metal
6190.124827 0.673337 0.00155773 -238.281 42.7695 -14.1187 -2.47933 10.4008 -2.34905 2.67887 -0.65793 0.116847 -0.283491 3.72753e-13 0.283491 -0.116847 0.65793 -2.67887 2.34905 -10.4008 2.47933 14.1187 -42.7695 metal
6200.148731 0.64642 0.00105409 -248.757 31.5646 -5.5621 7.47563 8.48045 1.11085 2.39913 -1.38185 1.71566 -0.797508 3.69716e-13 0.797508 -1.71566 1.38185 -2.39913 -1.11085 -8.48045 -7.47563 5.5621 -31.5646 metal
6210.156067 0.714837 0.00158066 -234.512 32.9963 -6.80354 8.43561 6.83913 0.428842 3.86873 -2.60635 2.10337 -1.14038 3.51392e-13 1.14038 -2.10337 2.60635 -3.86873 -0.428842 -6.83913 -8.43561 6.80354 -32.9963 metal
6220.169041 0.661443 0.0013567 -236.728 30.6946 -9.16835 6.54928 5.8778 -0.0268666 4.95165 -0.955033 3.50261 -0.135997 3.52508e-13 0.135997 -3.50261 0.955033 -4.95165 0.0268666 -5.8778 -6.54928 9.16835 -30.6946 metal
6230.124429 0.605454 0.00259348 -227.215 40.1629 -3.5093 9.71865 5.80787 -2.93063 1.56699 -5.08203 2.88611 -0.616709 3.49101e-13 0.616709 -2.88611 5.08203 -1.56699 2.93063 -5.80787 -9.71865 3.5093 -40.1629 metal
6240.139492 0.60163 0.00257038 -227.974 38.1178 -11.195 6.58433 11.9599 -3.87992 5.94163 0.15309 2.71661 1.32101 3.49385e-13 -1.32101 -2.71661 -0.15309 -5.94163 3.87992 -11.9599 -6.58433 11.195 -38.1178 metal
6250.123528 0.590559 0.00305936 -223.733 40.5486 -5.95978 5.26692 3.85059 -0.909645 4.68497 -1.44364 3.37721 -0.0191684 3.47499e-13 0.0191684 -3.37721 1.44364 -4.68497 0.909645 -3.85059 -5.26692 5.95978 -40.5486 metal
6260.117228 0.544168 0.00129592 -251.698 36.9588 -4.0729 5.45018 10.6296 3.98526 3.58979 0.18908 2.03868 -0.0695023 3.82111e-13 0.0695023 -2.03868 -0.18908 -3.58979 -3.98526 -10.6296 -5.45018 4.0729 -36.9588 metal
6270.163129 0.728078 0.00189623 -228.828 33.016 -13.9363 6.49466 11.3255 -2.9852 7.56615 -2.24882 1.65507 1.14296 3.44699e-13 -1.14296 -1.65507 2.24882 -7.56615 2.9852 -11.3255 -6.49466 13.9363 -33.016 metal
6280.128782 0.753137 0.00216764 -230.222 39.4304 -6.11574 4.9562 4.2226 0.0796241 4.14787 -2.16776 2.26665 -0.786365 3.55027e-13 0.786365 -2.26665 2.16776 -4.14787 -0.0796241 -4.2226 -4.9562 6.11574 -39.4304 metal
6290.154192 0.684711 0.00191155 -224.891 36.2939 -9.0012 3.72028 3.36542 -1.1961 2.7391 -3.57831 1.62071 -1.72491 3.43739e-13 1.72491 -1.62071 3.57831 -2.7391 1.1961 -3.36542 -3.72028 9.0012 -36.2939 metal
6300.156242 0.665197 0.00108431 -245.027 32.9685 -2.99065 8.10217 3.07802 -2.65369 2.49048 -1.43283 2.40004 0.0955813 3.65772e-13 -0.0955813 -2.40004 1.43283 -2.49048 2.65369 -3.07802 -8.10217 2.99065 -32.9685 metal
6310.0696181 0.447859 0.00293372 -244.915 47.9857 1.87119 4.66603 7.32175 2.46227 3.57638 0.00151458 0.621248 -0.144219 3.8666e-13 0.144219 -0.621248 -0.00151458 -3.57638 -2.46227 -7.32175 -4.66603 -1.87119 -47.9857 metal
6320.144308 0.634528 0.0027729 -220.954 36.8038 -5.11849 7.27165 4.33017 -0.51608 3.8183 -1.9623 2.39742 -1.9903 3.37162e-13 1.9903 -2.39742 1.9623 -3.8183 0.51608 -4.33017 -7.27165 5.11849 -36.8038 metal
6330.139992 0.633526 0.00181794 -231.01 38.8716 -8.32934 4.09155 5.3904 -2.1814 2.68242 -0.779551 3.36852 -0.855635 3.54649e-13 0.855635 -3.36852 0.779551 -2.68242 2.1814 -5.3904 -4.09155 8.32934 -38.8716 metal
6340.103087 0.55144 0.00349138 -230.678 43.8311 -6.58355 7.53297 12.587 -1.35085 5.52329 0.533111 1.26577 1.00765 3.60743e-13 -1.00765 -1.26577 -0.533111 -5.52329 1.35085 -12.587 -7.53297 6.58355 -43.8311 metal
6350.142878 0.697675 0.00109897 -245.09 36.77 -6.52942 3.9012 4.37936 -2.97726 1.48464 -1.81757 0.961717 -0.51488 3.71998e-13 0.51488 -0.961717 1.81757 -1.48464 2.97726 -4.37936 -3.9012 6.52942 -36.77 metal
6360.150719 0.630273 0.00292404 -221.318 34.785 -8.99538 5.55068 7.95475 0.890696 6.37501 -1.27615 1.83675 0.238654 3.37976e-13 -0.238654 -1.83675 1.27615 -6.37501 -0.890696 -7.95475 -5.55068 8.99538 -34.785 metal
6370.155766 0.707949 0.00120212 -238.511 33.205 -7.85593 5.41725 4.54198 0.184577 3.21611 -2.44013 1.86825 -0.615746 3.58917e-13 0.615746 -1.86825 2.44013 -3.21611 -0.184577 -4.54198 -5.41725 7.85593 -33.205 metal
6380.123754 0.655146 0.00153871 -237.908 41.3589 -4.5288 3.18254 1.10453 -2.72605 3.63071 -1.51464 2.08887 -0.105936 3.68182e-13 0.105936 -2.08887 1.51464 -3.63071 2.72605 -1.10453 -3.18254 4.5288 -41.3589 metal
6390.120451 0.593551 0.00129528 -253.628 35.1251 -5.58018 2.37417 11.4206 5.1886 2.89193 -1.25777 0.396654 -0.15911 3.84368e-13 0.15911 -0.396654 1.25777 -2.89193 -5.1886 -11.4206 -2.37417 5.58018 -35.1251 metal
6400.12949 0.416483 0.00189321 -236.308 40.2862 -5.6959 7.09558 6.61757 -3.71668 4.69259 0.46343 1.93662 -0.388749 3.62291e-13 0.388749 -1.93662 -0.46343 -4.69259 3.71668 -6.61757 -7.09558 5.6959 -40.2862 metal
6410.141388 0.723388 0.00140999 -238.075 37.2795 -10.3261 1.63538 5.97875 0.503244 3.71999 0.434712 3.79828 0.0517728 3.64634e-13 -0.0517728 -3.79828 -0.434712 -3.71999 -0.503244 -5.97875 -1.63538 10.3261 -37.2795 metal
6420.123065 0.589955 0.0012793 -243.888 40.2125 -7.37034 1.36584 7.19391 1.56455 2.90526 0.362837 2.78999 -0.576885 3.76046e-13 0.576885 -2.78999 -0.362837 -2.90526 -1.56455 -7.19391 -1.36584 7.37034 -40.2125 metal
6430.137511 0.670425 0.00121766 -241.159 38.4458 -9.34428 0.844812 4.53923 0.45427 3.55502 -0.855414 2.35135 -0.604872 3.70399e-13 0.604872 -2.35135 0.855414 -3.55502 -0.45427 -4.53923 -0.844812 9.34428 -38.4458 metal
6440.150916 0.708013 0.00111111 -247.059 33.5414 -7.60312 2.48229 5.33676 0.252451 1.76465 -1.00289 2.32222 -0.532864 3.71742e-13 0.532864 -2.32222 1.00289 -1.76465 -0.252451 -5.33676 -2.48229 7.60312 -33.5414 metal
6450.146765 0.634671 0.00124715 -240.423 35.3719 -8.39756 3.38797 5.94018 1.5124 3.84984 0.158632 3.40552 -0.0621104 3.65124e-13 0.0621104 -3.40552 -0.158632 -3.84984 -1.5124 -5.94018 -3.38797 8.39756 -35.3719 metal
6460.127728 0.460021 0.00112006 -246.555 38.1386 -6.67704 4.80263 8.74611 1.34372 2.38453 0.0444633 2.59352 -0.44585 3.76015e-13 0.44585 -2.59352 -0.0444633 -2.38453 -1.34372 -8.74611 -4.80263 6.67704 -38.1386 metal
6470.159953 0.657568 0.00272198 -216.745 33.8423 -8.24325 7.40931 5.53114 -0.983455 3.78931 -3.50339 1.59482 -1.48254 3.28473e-13 1.48254 -1.59482 3.50339 -3.78931 0.983455 -5.53114 -7.40931 8.24325 -33.8423 metal
6480.164421 0.709661 0.00293191 -215.243 34.2077 -8.96295 7.32403 6.07972 -2.61374 2.97343 -3.29147 1.13845 -1.94368 3.26178e-13 1.94368 -1.13845 3.29147 -2.97343 2.61374 -6.07972 -7.32403 8.96295 -34.2077 metal
6490.164586 0.660577 0.00306585 -211.531 33.4194 -8.58886 6.33573 3.88274 -2.14103 3.2433 -1.91777 2.53382 -1.00854 3.21324e-13 1.00854 -2.53382 1.91777 -3.2433 2.14103 -3.88274 -6.33573 8.58886 -33.4194 metal
6500.165115 0.646835 0.00285809 -214.829 33.432 -9.3156 7.74719 6.23675 -2.69758 3.65275 -2.8357 1.76231 -1.57924 3.24517e-13 1.57924 -1.76231 2.8357 -3.65275 2.69758 -6.23675 -7.74719 9.3156 -33.432 metal
6510.16239 0.67454 0.00330779 -211.323 34.2211 -8.71723 7.46964 5.735 -2.37393 3.67612 -2.51335 1.59867 -1.69152 3.20985e-13 1.69152 -1.59867 2.51335 -3.67612 2.37393 -5.735 -7.46964 8.71723 -34.2211 metal
6520.186477 0.638559 0.00294535 -212.369 28.102 -9.36029 8.49599 5.7262 -1.42184 4.72371 -1.90795 1.88095 -1.33282 3.14968e-13 1.33282 -1.88095 1.90795 -4.72371 1.42184 -5.7262 -8.49599 9.36029 -28.102 metal
6530.165926 0.69947 0.00318312 -210.941 33.7693 -10.4568 5.22501 5.02375 -1.81597 4.0392 -2.0461 1.75571 -1.24359 3.21367e-13 1.24359 -1.75571 2.0461 -4.0392 1.81597 -5.02375 -5.22501 10.4568 -33.7693 metal
6540.157967 0.666317 0.0028422 -216.759 34.8087 -8.35829 7.24544 5.459 -2.58885 2.90499 -2.3805 1.54979 -1.58397 3.29278e-13 1.58397 -1.54979 2.3805 -2.90499 2.58885 -5.459 -7.24544 8.35829 -34.8087 metal
6550.173252 0.651617 0.00275724 -214.742 31.3309 -8.54973 7.93213 5.3392 -1.52626 4.55534 -2.60142 1.69269 -1.47838 3.22194e-13 1.47838 -1.69269 2.60142 -4.55534 1.52626 -5.3392 -7.93213 8.54973 -31.3309 metal
6560.170041 0.6583 0.00297195 -213.195 32.4262 -9.00216 7.50972 5.56059 -2.13904 3.57603 -2.67996 1.19079 -1.6257 3.21624e-13 1.6257 -1.19079 2.67996 -3.57603 2.13904 -5.56059 -7.50972 9.00216 -32.4262 metal
6570.158614 0.664141 0.00319204 -213.724 35.3891 -8.60005 7.20657 5.61454 -3.10423 3.08386 -2.61735 1.36878 -1.80789 3.25535e-13 1.80789 -1.36878 2.61735 -3.08386 3.10423 -5.61454 -7.20657 8.60005 -35.3891 metal
6580.142586 0.485264 0.00261376 -227.204 35.252 -8.79127 7.17696 10.299 0.752347 4.55785 -0.518586 1.72452 -0.979086 3.44919e-13 0.979086 -1.72452 0.518586 -4.55785 -0.752347 -10.299 -7.17696 8.79127 -35.252 metal
6590.138236 0.727428 0.0024456 -222.033 39.2127 -6.80054 4.26109 2.73218 -1.25152 2.90572 -3.37144 2.64123 -1.45919 3.43061e-13 1.45919 -2.64123 3.37144 -2.90572 1.25152 -2.73218 -4.26109 6.80054 -39.2127 metal
6600.13351 0.590849 0.00223876 -225.522 40.1 -8.38512 4.70217 5.83652 -1.12742 3.28415 -3.1248 2.42664 -0.826073 3.49172e-13 0.826073 -2.42664 3.1248 -3.28415 1.12742 -5.83652 -4.70217 8.38512 -40.1 metal
6610.133311 0.647887 0.00155383 -234.936 39.6249 -8.83895 3.6649 5.79707 -1.53714 3.53238 -2.22569 1.94037 -0.576287 3.61812e-13 0.576287 -1.94037 2.22569 -3.53238 1.53714 -5.79707 -3.6649 8.83895 -39.6249 metal
6620.141388 0.723581 0.00140999 -238.075 37.2795 -10.3261 1.63538 5.97875 0.503244 3.71999 0.434712 3.79828 0.0517728 3.64634e-13 -0.0517728 -3.79828 -0.434712 -3.71999 -0.503244 -5.97875 -1.63538 10.3261 -37.2795 metal
6630.123065 0.589955 0.0012793 -243.888 40.2125 -7.37034 1.36584 7.19391 1.56455 2.90526 0.362837 2.78999 -0.576885 3.76046e-13 0.576885 -2.78999 -0.362837 -2.90526 -1.56455 -7.19391 -1.36584 7.37034 -40.2125 metal
6640.137511 0.670425 0.00121766 -241.159 38.4458 -9.34428 0.844812 4.53923 0.45427 3.55502 -0.855414 2.35135 -0.604872 3.70399e-13 0.604872 -2.35135 0.855414 -3.55502 -0.45427 -4.53923 -0.844812 9.34428 -38.4458 metal
6650.150916 0.708013 0.00111111 -247.059 33.5414 -7.60312 2.48229 5.33676 0.252451 1.76465 -1.00289 2.32222 -0.532864 3.71742e-13 0.532864 -2.32222 1.00289 -1.76465 -0.252451 -5.33676 -2.48229 7.60312 -33.5414 metal
6660.146765 0.634671 0.00124715 -240.423 35.3719 -8.39756 3.38797 5.94018 1.5124 3.84984 0.158632 3.40552 -0.0621104 3.65124e-13 0.0621104 -3.40552 -0.158632 -3.84984 -1.5124 -5.94018 -3.38797 8.39756 -35.3719 metal
6670.127728 0.460021 0.00112006 -246.555 38.1386 -6.67704 4.80263 8.74611 1.34372 2.38453 0.0444633 2.59352 -0.44585 3.76015e-13 0.44585 -2.59352 -0.0444633 -2.38453 -1.34372 -8.74611 -4.80263 6.67704 -38.1386 metal
6680.12071 0.618627 0.00179979 -239.434 40.2945 -6.76854 5.18456 10.1846 1.55271 1.57604 -1.96354 1.26386 -0.707323 3.69257e-13 0.707323 -1.26386 1.96354 -1.57604 -1.55271 -10.1846 -5.18456 6.76854 -40.2945 metal
6690.130263 0.648462 0.00117227 -248.179 35.955 -6.03343 3.0244 4.74987 -0.86834 2.64042 -0.515717 1.88064 0.0555465 3.76151e-13 -0.0555465 -1.88064 0.515717 -2.64042 0.86834 -4.74987 -3.0244 6.03343 -35.955 metal
6700.0910448 0.603247 0.00235731 -248.112 39.66 0.459217 10.0046 8.91488 1.5705 3.73663 -0.306647 1.53334 -0.610737 3.77808e-13 0.610737 -1.53334 0.306647 -3.73663 -1.5705 -8.91488 -10.0046 -0.459217 -39.66 metal
6710.162059 0.755992 0.000479418 -268.936 27.4885 -1.25582 4.8951 4.64582 1.54437 0.71537 -1.67111 -0.507972 -2.03602 3.9256e-13 2.03602 0.507972 1.67111 -0.71537 -1.54437 -4.64582 -4.8951 1.25582 -27.4885 metal
6720.157827 0.69011 0.00135956 -242.599 32.5166 -5.07689 6.68066 4.03484 -1.41609 2.95577 -2.29856 1.50188 -1.06087 3.62037e-13 1.06087 -1.50188 2.29856 -2.95577 1.41609 -4.03484 -6.68066 5.07689 -32.5166 metal
6730.12878 0.629985 0.00259917 -227.553 40.415 -7.46052 6.32335 7.54055 -0.359833 4.50274 -2.03181 2.55793 -0.192781 3.52212e-13 0.192781 -2.55793 2.03181 -4.50274 0.359833 -7.54055 -6.32335 7.46052 -40.415 metal
6740.146158 0.574929 0.00372439 -215.797 35.7777 -4.97356 7.8202 5.38576 1.37826 4.57982 -1.74318 3.21171 -0.351867 3.30543e-13 0.351867 -3.21171 1.74318 -4.57982 -1.37826 -5.38576 -7.8202 4.97356 -35.7777 metal
6750.142786 0.599399 0.00047281 -269.829 27.0034 -2.30558 8.19985 9.37905 1.74503 2.95135 0.635965 0.905027 0.231601 3.93133e-13 -0.231601 -0.905027 -0.635965 -2.95135 -1.74503 -9.37905 -8.19985 2.30558 -27.0034 metal
6760.131579 0.577882 0.00407332 -216.159 39.0411 -5.70981 6.15701 6.20089 1.68811 3.80087 -1.91648 2.93372 -0.272565 3.36002e-13 0.272565 -2.93372 1.91648 -3.80087 -1.68811 -6.20089 -6.15701 5.70981 -39.0411 metal
6770.144395 0.643361 0.000904916 -250.614 34.3771 -8.22955 5.09796 9.77341 -1.24717 2.11094 -0.222002 0.905064 0.569783 3.77281e-13 -0.569783 -0.905064 0.222002 -2.11094 1.24717 -9.77341 -5.09796 8.22955 -34.3771 metal
6780.15696 0.669838 0.001987 -226.327 35.0303 -8.78519 6.53077 5.29417 -2.98833 4.60793 -2.1747 2.39423 -0.684353 3.42687e-13 0.684353 -2.39423 2.1747 -4.60793 2.98833 -5.29417 -6.53077 8.78519 -35.0303 metal
6790.145224 0.576106 0.00334748 -221.968 33.9403 -5.42408 9.09188 7.20028 2.24662 6.36125 -0.972286 3.48742 -0.242019 3.36023e-13 0.242019 -3.48742 0.972286 -6.36125 -2.24662 -7.20028 -9.09188 5.42408 -33.9403 metal
6800.14633 0.616781 0.00160856 -237.193 35.6637 -7.44459 4.79854 5.43828 0.860897 5.14232 -0.903995 2.41005 -0.403478 3.60195e-13 0.403478 -2.41005 0.903995 -5.14232 -0.860897 -5.43828 -4.79854 7.44459 -35.6637 metal
6810.162905 0.688727 0.00142147 -241.208 30.2041 -4.19182 8.27443 4.94857 2.34264 5.66383 -2.24711 2.18094 -0.41792 3.57985e-13 0.41792 -2.18094 2.24711 -5.66383 -2.34264 -4.94857 -8.27443 4.19182 -30.2041 metal
6820.11765 0.587414 0.00260442 -224.806 44.0674 -7.99803 1.87733 3.05388 -2.00524 3.73413 -2.07008 3.27937 -0.749076 3.53639e-13 0.749076 -3.27937 2.07008 -3.73413 2.00524 -3.05388 -1.87733 7.99803 -44.0674 metal
6830.129649 0.65222 0.00160455 -237.11 39.7369 -7.50518 4.73401 5.6701 -2.3496 4.18465 -1.06124 1.78613 0.168605 3.64826e-13 -0.168605 -1.78613 1.06124 -4.18465 2.3496 -5.6701 -4.73401 7.50518 -39.7369 metal
6840.122911 0.553137 0.00279878 -223.971 43.2487 -6.35959 5.79401 7.16057 -2.34766 2.50985 -3.47916 1.04664 -0.422204 3.50871e-13 0.422204 -1.04664 3.47916 -2.50985 2.34766 -7.16057 -5.79401 6.35959 -43.2487 metal
6850.138778 0.672541 0.00292931 -219.241 38.9592 -8.54766 4.20882 4.70525 -1.75682 3.69709 -2.15837 1.75419 -1.21947 3.39221e-13 1.21947 -1.75419 2.15837 -3.69709 1.75682 -4.70525 -4.20882 8.54766 -38.9592 metal
6860.144617 0.689706 0.00170003 -233.12 37.4132 -7.92194 5.13893 5.29843 -2.2188 4.81374 -1.40138 0.694467 -0.674236 3.56071e-13 0.674236 -0.694467 1.40138 -4.81374 2.2188 -5.29843 -5.13893 7.92194 -37.4132 metal
6870.145425 0.6537 0.0011047 -243.789 35.1731 -5.75253 5.63006 4.63316 -1.57683 2.87697 -1.65987 1.27342 -1.09351 3.67296e-13 1.09351 -1.27342 1.65987 -2.87697 1.57683 -4.63316 -5.63006 5.75253 -35.1731 metal
6880.180575 0.665525 0.00358471 -207.214 29.153 -5.37275 9.25695 3.66229 -0.667085 3.3702 -3.26733 2.6819 -0.634223 3.09838e-13 0.634223 -2.6819 3.26733 -3.3702 0.667085 -3.66229 -9.25695 5.37275 -29.153 metal
6890.108195 0.595925 0.00164305 -250.25 38.4311 -2.79536 7.12881 9.46261 1.29757 3.59934 -0.585566 0.269819 -0.459183 3.80736e-13 0.459183 -0.269819 0.585566 -3.59934 -1.29757 -9.46261 -7.12881 2.79536 -38.4311 metal
6900.0700977 0.393089 0.00373815 -244.739 46.294 -1.79039 6.4671 12.603 3.53662 5.60702 1.77227 1.06945 0.687302 3.84289e-13 -0.687302 -1.06945 -1.77227 -5.60702 -3.53662 -12.603 -6.4671 1.79039 -46.294 metal
6910.0958152 0.471719 0.00186713 -247.697 41.3346 -0.0224892 6.6458 5.18413 1.58448 5.37104 1.36518 3.21456 0.952008 3.8146e-13 -0.952008 -3.21456 -1.36518 -5.37104 -1.58448 -5.18413 -6.6458 0.0224892 -41.3346 metal
6920.127333 0.647576 0.00180192 -232.848 40.2974 -6.18398 4.60325 3.11557 -3.9609 4.3389 -1.48516 2.11136 0.286885 3.593e-13 -0.286885 -2.11136 1.48516 -4.3389 3.9609 -3.11557 -4.60325 6.18398 -40.2974 metal
6930.109546 0.623159 0.00229098 -234.09 46.2946 -4.1864 4.51424 5.66463 -2.31824 3.01104 -0.937709 1.16262 -0.657883 3.68379e-13 0.657883 -1.16262 0.937709 -3.01104 2.31824 -5.66463 -4.51424 4.1864 -46.2946 metal
6940.148817 0.642516 0.0012151 -244.045 34.5493 -7.45193 7.9218 8.72234 -1.02434 4.22631 -0.0422153 2.47563 0.536231 3.67032e-13 -0.536231 -2.47563 0.0422153 -4.22631 1.02434 -8.72234 -7.9218 7.45193 -34.5493 metal
6950.142878 0.697492 0.00109897 -245.09 36.77 -6.52942 3.9012 4.37936 -2.97726 1.48464 -1.81757 0.961717 -0.51488 3.71998e-13 0.51488 -0.961717 1.81757 -1.48464 2.97726 -4.37936 -3.9012 6.52942 -36.77 metal
6960.135906 0.595477 0.00253464 -225.019 37.6443 -5.73749 5.45193 2.3454 -1.89821 3.62683 -1.11813 3.88294 0.421502 3.45767e-13 -0.421502 -3.88294 1.11813 -3.62683 1.89821 -2.3454 -5.45193 5.73749 -37.6443 metal
6970.15306 0.641043 0.00219483 -234.167 31.7999 -6.30872 9.58343 8.26919 1.62665 5.31793 -1.42195 2.5918 -0.345183 3.49712e-13 0.345183 -2.5918 1.42195 -5.31793 -1.62665 -8.26919 -9.58343 6.30872 -31.7999 metal
6980.0844905 0.450399 0.00212841 -253.776 37.6057 2.24038 10.4946 10.1767 2.14368 3.35443 -0.291963 1.07144 -0.426714 3.82965e-13 0.426714 -1.07144 0.291963 -3.35443 -2.14368 -10.1767 -10.4946 -2.24038 -37.6057 metal
6990.130452 0.576056 0.00174798 -239.231 38.1776 -7.95721 3.53593 6.68411 0.975471 3.49779 -1.19645 2.08268 -0.258422 3.66936e-13 0.258422 -2.08268 1.19645 -3.49779 -0.975471 -6.68411 -3.53593 7.95721 -38.1776 metal
7000.132644 0.759989 0.00194246 -239.358 36.4638 -5.02187 4.67347 3.8331 -0.853612 3.92602 -1.38332 2.12977 0.177268 3.64235e-13 -0.177268 -2.12977 1.38332 -3.92602 0.853612 -3.8331 -4.67347 5.02187 -36.4638 metal
7010.186118 0.562876 0.00205289 -239.233 28.4917 5.89657 8.73371 1.39002 5.04199 -2.03955 1.79853 -0.341687 -0.676425 3.56085e-13 0.676425 0.341687 -1.79853 2.03955 -5.04199 -1.39002 -8.73371 -5.89657 -28.4917 pop
7020.198763 0.715671 0.00335096 -229.085 24.9217 8.3346 11.1701 0.587553 4.84997 -0.751963 0.826353 0.61334 0.340898 3.37335e-13 -0.340898 -0.61334 -0.826353 0.751963 -4.84997 -0.587553 -11.1701 -8.3346 -24.9217 pop
7030.162818 0.633686 0.00284395 -233.175 30.255 6.70279 10.7853 0.785547 2.43166 0.110924 2.38527 1.23435 0.044746 3.48195e-13 -0.044746 -1.23435 -2.38527 -0.110924 -2.43166 -0.785547 -10.7853 -6.70279 -30.255 pop
7040.103649 0.585501 0.00158603 -248.103 41.823 0.33586 -0.211724 4.63994 4.63066 -0.389527 1.49027 1.09312 -0.987839 3.85873e-13 0.987839 -1.09312 -1.49027 0.389527 -4.63066 -4.63994 0.211724 -0.33586 -41.823 pop
7050.133846 0.590682 0.00257036 -229.29 38.5104 1.63579 4.4343 0.0193699 2.07543 -0.572248 0.570595 0.505386 -0.00700505 3.55859e-13 0.00700505 -0.505386 -0.570595 0.572248 -2.07543 -0.0193699 -4.4343 -1.63579 -38.5104 pop
7060.0951813 0.475303 0.000642502 -277.04 30.8489 10.6998 8.2524 4.37514 1.14839 0.530225 -0.19493 -0.0375058 0.223791 4.07286e-13 -0.223791 0.0375058 0.19493 -0.530225 -1.14839 -4.37514 -8.2524 -10.6998 -30.8489 pop
7070.10071 0.461201 0.000993029 -267.301 34.8378 7.97085 7.29394 3.88235 2.34206 2.99703 2.08865 1.59848 0.836826 3.99999e-13 -0.836826 -1.59848 -2.08865 -2.99703 -2.34206 -3.88235 -7.29394 -7.97085 -34.8378 pop
7080.109971 0.57102 0.00107533 -264.708 37.5805 4.6361 0.758203 1.45451 0.616731 -1.45942 -0.699294 0.527054 0.418334 4.0245e-13 -0.418334 -0.527054 0.699294 1.45942 -0.616731 -1.45451 -0.758203 -4.6361 -37.5805 pop
7090.130708 0.494447 0.00242164 -238.5 35.5433 5.06409 7.44248 1.4984 4.08867 0.594582 1.06329 0.451668 -0.129967 3.63609e-13 0.129967 -0.451668 -1.06329 -0.594582 -4.08867 -1.4984 -7.44248 -5.06409 -35.5433 pop
7100.185302 0.731592 0.0015598 -235.666 29.2094 0.490929 7.29433 0.761753 1.92996 0.254699 -0.609217 -0.135332 -0.172086 3.51792e-13 0.172086 0.135332 0.609217 -0.254699 -1.92996 -0.761753 -7.29433 -0.490929 -29.2094 pop
7110.0945086 0.451705 0.00227115 -246.213 40.8723 3.74669 5.50235 4.7105 3.49516 2.15403 0.927489 0.296449 -0.267562 3.80195e-13 0.267562 -0.296449 -0.927489 -2.15403 -3.49516 -4.7105 -5.50235 -3.74669 -40.8723 pop
7120.0998531 0.472381 0.000576212 -272.718 37.0782 11.4625 2.51091 -1.24592 -1.6096 -1.92519 1.19146 0.835565 -0.0989613 4.10321e-13 0.0989613 -0.835565 -1.19146 1.92519 1.6096 1.24592 -2.51091 -11.4625 -37.0782 pop
7130.130645 0.601698 0.00186957 -236.06 39.3011 -1.23842 2.60947 2.23775 3.15569 0.375887 0.176157 1.27161 -0.525077 3.65873e-13 0.525077 -1.27161 -0.176157 -0.375887 -3.15569 -2.23775 -2.60947 1.23842 -39.3011 pop
7140.093547 0.336812 0.00217072 -257.84 34.8659 11.7316 11.7344 4.45948 4.86964 2.75242 0.862914 0.862367 -0.574334 3.85604e-13 0.574334 -0.862367 -0.862914 -2.75242 -4.86964 -4.45948 -11.7344 -11.7316 -34.8659 pop
7150.100763 0.629022 0.001044 -256.385 41.0831 1.99393 1.675 2.96871 1.7478 1.15317 -0.62685 -0.0536993 -0.377296 3.94969e-13 0.377296 0.0536993 0.62685 -1.15317 -1.7478 -2.96871 -1.675 -1.99393 -41.0831 pop
7160.164387 0.695279 0.00241452 -231.351 33.1371 3.21483 6.61484 -0.101948 1.95749 -1.79216 0.923659 -0.765221 0.276171 3.52126e-13 -0.276171 0.765221 -0.923659 1.79216 -1.95749 0.101948 -6.61484 -3.21483 -33.1371 pop
7170.207071 0.597845 0.000759972 -251.685 26.3799 0.636933 7.93674 1.81758 1.84401 -0.509161 1.8598 -0.172104 -0.369774 3.69516e-13 0.369774 0.172104 -1.8598 0.509161 -1.84401 -1.81758 -7.93674 -0.636933 -26.3799 pop
7180.147185 0.539155 0.00183512 -237.963 33.8616 3.36459 8.01684 1.17295 2.43318 0.235005 -1.00623 0.726369 -0.146765 3.59993e-13 0.146765 -0.726369 1.00623 -0.235005 -2.43318 -1.17295 -8.01684 -3.36459 -33.8616 pop
7190.161947 0.692292 0.00279746 -231.059 32.3374 7.19945 8.19054 -1.31085 3.08168 -0.0157212 0.703668 0.376747 -0.701412 3.48694e-13 0.701412 -0.376747 -0.703668 0.0157212 -3.08168 1.31085 -8.19054 -7.19945 -32.3374 pop
7200.159158 0.731175 0.00247625 -228.607 35.3594 1.85228 5.08402 0.0271585 1.52619 -0.418383 1.58833 -0.309816 -0.604691 3.50334e-13 0.604691 0.309816 -1.58833 0.418383 -1.52619 -0.0271585 -5.08402 -1.85228 -35.3594 pop
7210.187067 0.733769 0.00281841 -218.3 30.6814 -0.139327 3.63428 -1.9255 2.8317 -0.831956 0.887844 -0.0801222 0.115701 3.32717e-13 -0.115701 0.0801222 -0.887844 0.831956 -2.8317 1.9255 -3.63428 0.139327 -30.6814 pop
7220.181856 0.659074 0.0022043 -231.149 29.179 -2.51892 5.50255 1.19999 1.62276 0.616731 0.193645 -0.315346 0.213749 3.46758e-13 -0.213749 0.315346 -0.193645 -0.616731 -1.62276 -1.19999 -5.50255 2.51892 -29.179 pop
7230.16296 0.685955 0.00241274 -231.617 33.3319 3.185 6.54254 -0.0753179 1.95522 -1.83622 0.947718 -0.779677 0.258208 3.52744e-13 -0.258208 0.779677 -0.947718 1.83622 -1.95522 0.0753179 -6.54254 -3.185 -33.3319 pop
7240.195956 0.749508 0.00230326 -230.62 27.4607 3.05765 8.40566 1.09144 2.73453 -0.641518 1.41027 -0.410755 -0.697209 3.42427e-13 0.697209 0.410755 -1.41027 0.641518 -2.73453 -1.09144 -8.40566 -3.05765 -27.4607 pop
7250.173335 0.668491 0.00229402 -234.713 30.1817 3.00468 6.78332 0.0161086 2.98948 -0.53103 2.00289 0.13786 0.0746019 3.52583e-13 -0.0746019 -0.13786 -2.00289 0.53103 -2.98948 -0.0161086 -6.78332 -3.00468 -30.1817 pop
7260.141077 0.593989 0.00238518 -242.736 34.9511 9.904 8.27977 -0.464222 2.12329 -0.566934 1.76091 0.0377631 -0.548277 3.6723e-13 0.548277 -0.0377631 -1.76091 0.566934 -2.12329 0.464222 -8.27977 -9.904 -34.9511 pop
7270.14206 0.702345 0.00173322 -245.119 38.1044 7.62533 4.11289 -3.62306 0.30678 -0.821756 1.32754 -1.27298 -1.60618 3.74982e-13 1.60618 1.27298 -1.32754 0.821756 -0.30678 3.62306 -4.11289 -7.62533 -38.1044 pop
7280.142354 0.719231 0.00179354 -241.827 36.1944 4.62283 4.8895 0.450152 3.57439 0.723029 1.91882 -0.771493 -0.446797 3.69754e-13 0.446797 0.771493 -1.91882 -0.723029 -3.57439 -0.450152 -4.8895 -4.62283 -36.1944 pop
7290.150729 0.699279 0.00233558 -231.872 36.0353 1.63347 5.35159 -0.101027 0.900314 -0.383169 0.798104 0.349324 0.766495 3.56279e-13 -0.766495 -0.349324 -0.798104 0.383169 -0.900314 0.101027 -5.35159 -1.63347 -36.0353 pop
7300.149165 0.654577 0.00281043 -230.584 34.6795 4.8313 6.53925 -0.638062 2.62993 0.236856 0.593749 0.632448 -0.0375076 3.51914e-13 0.0375076 -0.632448 -0.593749 -0.236856 -2.62993 0.638062 -6.53925 -4.8313 -34.6795 pop
7310.14542 0.64358 0.0022732 -230.423 37.6801 -0.00283145 1.44235 -2.19672 0.821731 -1.50726 0.194099 -0.836623 -0.30568 3.57521e-13 0.30568 0.836623 -0.194099 1.50726 -0.821731 2.19672 -1.44235 0.00283145 -37.6801 pop
7320.148019 0.665702 0.00221091 -230.41 37.1652 -0.0464324 1.53791 -2.19672 0.899947 -1.43763 0.211868 -0.772756 -0.322577 3.56815e-13 0.322577 0.772756 -0.211868 1.43763 -0.899947 2.19672 -1.53791 0.0464324 -37.1652 pop
7330.22194 0.762281 0.00106595 -250.873 22.5744 5.32095 7.92722 1.00234 4.97578 -0.834414 1.17489 -0.905668 -0.239456 3.6492e-13 0.239456 0.905668 -1.17489 0.834414 -4.97578 -1.00234 -7.92722 -5.32095 -22.5744 pop
7340.148269 0.656755 0.00199502 -230.595 36.5703 -1.64042 2.85298 -1.17799 0.335832 1.03512 0.950366 -0.0389732 -0.0311613 3.55318e-13 0.0311613 0.0389732 -0.950366 -1.03512 -0.335832 1.17799 -2.85298 1.64042 -36.5703 pop
7350.14781 0.622489 0.00235671 -233.864 37.1639 7.19756 4.64757 -3.37341 1.76595 -1.99986 1.11171 -0.257105 0.157612 3.60713e-13 -0.157612 0.257105 -1.11171 1.99986 -1.76595 3.37341 -4.64757 -7.19756 -37.1639 pop
7360.157742 0.72747 0.00297533 -221.754 35.1623 -0.573504 2.15816 -2.32498 1.34143 -1.05697 1.44575 0.223799 0.13609 3.42841e-13 -0.13609 -0.223799 -1.44575 1.05697 -1.34143 2.32498 -2.15816 0.573504 -35.1623 pop
7370.149444 0.678357 0.00290463 -233.927 33.025 6.03736 6.97887 1.10095 5.0755 -0.290774 1.10253 -0.472511 -0.599258 3.54869e-13 0.599258 0.472511 -1.10253 0.290774 -5.0755 -1.10095 -6.97887 -6.03736 -33.025 pop
7380.168749 0.714392 0.00316061 -215.4 32.7234 -3.09147 3.76135 -0.363371 1.2217 -0.0146916 1.16333 -0.544773 0.0307304 3.30774e-13 -0.0307304 0.544773 -1.16333 0.0146916 -1.2217 0.363371 -3.76135 3.09147 -32.7234 pop
7390.164242 0.696046 0.00286059 -223.408 34.6958 0.0998172 4.43812 -0.52431 1.82982 -0.94158 0.454519 -0.390518 -0.110589 3.43656e-13 0.110589 0.390518 -0.454519 0.94158 -1.82982 0.52431 -4.43812 -0.0998172 -34.6958 pop
7400.192578 0.567229 0.00297035 -226.334 24.8316 8.76483 11.8469 0.497994 3.95838 -1.22268 2.30574 0.679921 -0.956514 3.31863e-13 0.956514 -0.679921 -2.30574 1.22268 -3.95838 -0.497994 -11.8469 -8.76483 -24.8316 pop
7410.0912586 0.502946 0.00170131 -249.974 44.7218 3.38118 0.206961 2.72375 2.6075 -0.430491 -0.00176496 -0.0858083 -0.529255 3.91781e-13 0.529255 0.0858083 0.00176496 0.430491 -2.6075 -2.72375 -0.206961 -3.38118 -44.7218 pop
7420.101138 0.534865 0.000950848 -263.833 38.8048 10.1828 4.7989 -0.809878 0.497162 0.936721 -1.86207 -0.668647 0.760529 4.01591e-13 -0.760529 0.668647 1.86207 -0.936721 -0.497162 0.809878 -4.7989 -10.1828 -38.8048 pop
7430.164626 0.751239 0.00248261 -228.001 33.7301 -0.424189 5.03346 1.18175 1.86028 -0.9759 0.794037 -0.00904292 -0.588181 3.47698e-13 0.588181 0.00904292 -0.794037 0.9759 -1.86028 -1.18175 -5.03346 0.424189 -33.7301 pop
7440.129821 0.587715 0.0034149 -232.086 36.2515 0.0720311 8.31243 4.26616 1.75328 2.64664 0.946778 1.56316 0.155921 3.54299e-13 -0.155921 -1.56316 -0.946778 -2.64664 -1.75328 -4.26616 -8.31243 -0.0720311 -36.2515 pop
7450.158521 0.741423 0.00296043 -228.542 32.5438 -2.80104 4.40612 3.1828 4.04929 0.161918 3.15175 0.882097 -0.15066 3.48019e-13 0.15066 -0.882097 -3.15175 -0.161918 -4.04929 -3.1828 -4.40612 2.80104 -32.5438 pop
7460.12047 0.71807 0.00239639 -244.977 37.1739 9.01234 5.54727 0.20871 3.2228 -0.84492 2.01537 0.406797 0.411818 3.75065e-13 -0.411818 -0.406797 -2.01537 0.84492 -3.2228 -0.20871 -5.54727 -9.01234 -37.1739 pop
7470.120709 0.708931 0.00239837 -245.104 37.1679 9.13665 5.60819 0.233378 3.47407 -0.891843 2.06314 0.453703 0.347194 3.75232e-13 -0.347194 -0.453703 -2.06314 0.891843 -3.47407 -0.233378 -5.60819 -9.13665 -37.1679 pop
7480.162158 0.66244 0.0029085 -224.553 33.1763 1.53132 5.63813 -0.0804214 3.01658 -0.92122 1.9645 -0.207289 0.460263 3.43806e-13 -0.460263 0.207289 -1.9645 0.92122 -3.01658 0.0804214 -5.63813 -1.53132 -33.1763 pop
7490.178739 0.741433 0.00199825 -228.806 30.6815 -1.58882 2.87305 -1.26349 2.05746 -0.491657 3.26735 0.65185 -0.342095 3.46139e-13 0.342095 -0.65185 -3.26735 0.491657 -2.05746 1.26349 -2.87305 1.58882 -30.6815 pop
7500.120395 0.628098 0.00148283 -250.427 38.536 5.11888 3.40414 1.57085 0.192645 -2.68024 0.638364 -0.239462 -1.71735 3.82143e-13 1.71735 0.239462 -0.638364 2.68024 -0.192645 -1.57085 -3.40414 -5.11888 -38.536 pop
7510.154285 0.666287 0.00235863 -242.784 30.9504 3.89281 7.87883 2.70966 3.57115 0.126256 2.68395 0.758973 -0.476893 3.62968e-13 0.476893 -0.758973 -2.68395 -0.126256 -3.57115 -2.70966 -7.87883 -3.89281 -30.9504 pop
7520.192503 0.691738 0.00255243 -221.596 28.9084 2.94899 5.88813 -1.34081 3.19851 -2.38033 3.19218 -0.166697 0.320521 3.34723e-13 -0.320521 0.166697 -3.19218 2.38033 -3.19851 1.34081 -5.88813 -2.94899 -28.9084 pop
7530.188975 0.75882 0.00403926 -224.29 26.4739 0.23352 7.45272 2.04833 4.35028 0.955616 2.94732 1.3056 -0.181045 3.33423e-13 0.181045 -1.3056 -2.94732 -0.955616 -4.35028 -2.04833 -7.45272 -0.23352 -26.4739 pop
7540.128052 0.783331 0.00283864 -232.387 43.6373 1.57155 0.841911 -1.47998 -1.80885 -2.33232 2.54138 -0.0407595 -2.00081 3.64777e-13 2.00081 0.0407595 -2.54138 2.33232 1.80885 1.47998 -0.841911 -1.57155 -43.6373 pop
7550.178935 0.633426 0.00349238 -223.906 30.0635 6.47906 8.81015 -0.717876 2.51884 -1.93964 1.37385 0.915883 0.112309 3.36851e-13 -0.112309 -0.915883 -1.37385 1.93964 -2.51884 0.717876 -8.81015 -6.47906 -30.0635 pop
7560.206089 0.740403 0.0030242 -228.419 26.2178 3.25821 6.03384 -2.53746 3.29464 0.239672 1.82794 0.113929 -0.272722 3.39315e-13 0.272722 -0.113929 -1.82794 -0.239672 -3.29464 2.53746 -6.03384 -3.25821 -26.2178 pop
7570.166692 0.657605 0.00367397 -230.381 30.5938 2.15438 8.30932 3.93009 5.50835 1.09187 2.66075 0.206912 0.354634 3.47434e-13 -0.354634 -0.206912 -2.66075 -1.09187 -5.50835 -3.93009 -8.30932 -2.15438 -30.5938 pop
7580.193185 0.752613 0.00405682 -222.997 26.126 0.568125 7.97403 2.2036 4.29003 0.804754 3.02475 1.22952 -0.0883272 3.3118e-13 0.0883272 -1.22952 -3.02475 -0.804754 -4.29003 -2.2036 -7.97403 -0.568125 -26.126 pop
7590.159155 0.699052 0.00184642 -246.384 32.766 1.72237 6.70889 4.0511 2.26923 0.430538 1.27085 -0.0839092 -0.310598 3.70241e-13 0.310598 0.0839092 -1.27085 -0.430538 -2.26923 -4.0511 -6.70889 -1.72237 -32.766 pop
7600.170252 0.653765 0.00360333 -230.072 30.0497 2.15193 8.69079 4.06058 5.36786 0.932763 2.6163 0.180497 0.229125 3.46077e-13 -0.229125 -0.180497 -2.6163 -0.932763 -5.36786 -4.06058 -8.69079 -2.15193 -30.0497 pop
7610.178935 0.633519 0.00349238 -223.906 30.0635 6.47906 8.81015 -0.717876 2.51884 -1.93964 1.37385 0.915883 0.112309 3.36851e-13 -0.112309 -0.915883 -1.37385 1.93964 -2.51884 0.717876 -8.81015 -6.47906 -30.0635 pop
7620.146551 0.671422 0.00290772 -234.154 34.7386 0.532073 6.17774 5.58966 5.55356 -0.118993 2.51709 0.935083 -1.18124 3.56713e-13 1.18124 -0.935083 -2.51709 0.118993 -5.55356 -5.58966 -6.17774 -0.532073 -34.7386 pop
7630.132896 0.818637 0.00481269 -212.956 40.784 -1.5753 4.78023 0.848096 -0.581933 0.703635 -0.141992 0.77004 -1.77327 3.33744e-13 1.77327 -0.77004 0.141992 -0.703635 0.581933 -0.848096 -4.78023 1.5753 -40.784 pop
7640.0884614 0.580123 0.00157465 -250.76 46.1408 4.98195 0.181361 -1.30473 -0.710421 -0.133228 -0.18774 0.000494325 -0.514036 3.93531e-13 0.514036 -0.000494325 0.18774 0.133228 0.710421 1.30473 -0.181361 -4.98195 -46.1408 pop
7650.190651 0.827366 0.00192097 -234.476 30.045 -2.99614 2.58512 -1.47411 -0.0250393 -0.672227 -0.254061 1.79366 -0.247321 3.51781e-13 0.247321 -1.79366 0.254061 0.672227 0.0250393 1.47411 -2.58512 2.99614 -30.045 pop
7660.130179 0.620193 0.00161023 -246.816 37.2662 1.7765 3.65718 1.08571 1.84365 1.75837 0.13031 -0.750138 -0.713344 3.77044e-13 0.713344 0.750138 -0.13031 -1.75837 -1.84365 -1.08571 -3.65718 -1.7765 -37.2662 pop
7670.139955 0.520867 0.00291701 -232.653 34.7246 8.10477 9.14744 -1.03814 1.24065 -1.18265 1.16427 0.096883 -0.68575 3.53061e-13 0.68575 -0.096883 -1.16427 1.18265 -1.24065 1.03814 -9.14744 -8.10477 -34.7246 pop
7680.202371 0.6639 0.00258149 -222.374 26.4357 0.724167 7.83313 1.6831 4.57525 -0.592388 0.36738 0.482815 -0.560542 3.30895e-13 0.560542 -0.482815 -0.36738 0.592388 -4.57525 -1.6831 -7.83313 -0.724167 -26.4357 pop
7690.168639 0.782482 0.00304942 -225.63 33.9126 -1.01657 5.92356 2.55255 2.32565 -0.646936 0.994706 0.529224 -0.428513 3.44471e-13 0.428513 -0.529224 -0.994706 0.646936 -2.32565 -2.55255 -5.92356 1.01657 -33.9126 pop
7700.124171 0.687766 0.00276762 -229.571 39.7148 -3.51614 4.86109 4.06213 1.18769 1.63273 -0.436649 0.517045 0.401059 3.57178e-13 -0.401059 -0.517045 0.436649 -1.63273 -1.18769 -4.06213 -4.86109 3.51614 -39.7148 pop
7710.141875 0.598411 0.00194851 -247.636 30.3905 5.27129 7.47594 1.40784 1.69886 -1.17638 -0.144313 -0.40917 -0.0126687 3.69087e-13 0.0126687 0.40917 0.144313 1.17638 -1.69886 -1.40784 -7.47594 -5.27129 -30.3905 pop
7720.202371 0.666958 0.00258149 -222.374 26.4357 0.724167 7.83313 1.6831 4.57525 -0.592388 0.36738 0.482815 -0.560542 3.30895e-13 0.560542 -0.482815 -0.36738 0.592388 -4.57525 -1.6831 -7.83313 -0.724167 -26.4357 pop
7730.153293 0.671999 0.00265451 -217.522 36.7096 -4.12913 2.24293 -0.717791 0.76053 0.381133 0.510503 1.1254 -0.0910521 3.38114e-13 0.0910521 -1.1254 -0.510503 -0.381133 -0.76053 0.717791 -2.24293 4.12913 -36.7096 pop
7740.181128 0.670082 0.00250548 -225.177 30.3638 0.683408 6.0763 -0.00249462 2.16667 -0.466321 1.37965 1.65691 0.284339 3.39684e-13 -0.284339 -1.65691 -1.37965 0.466321 -2.16667 0.00249462 -6.0763 -0.683408 -30.3638 pop
7750.182269 0.710282 0.00271628 -235.926 30.3899 7.89417 8.21308 -0.382279 4.3648 -1.77696 1.20245 -0.298172 -0.894337 3.53568e-13 0.894337 0.298172 -1.20245 1.77696 -4.3648 0.382279 -8.21308 -7.89417 -30.3899 pop
7760.17213 0.67241 0.0024119 -228.687 30.9087 -1.36553 8.02179 4.63554 3.35574 -0.761071 0.83004 0.67417 -0.439685 3.4437e-13 0.439685 -0.67417 -0.83004 0.761071 -3.35574 -4.63554 -8.02179 1.36553 -30.9087 pop
7770.187304 0.630608 0.00287194 -230.485 24.9173 2.14298 9.77891 3.63858 5.44945 1.72124 3.11909 1.12054 0.729317 3.39972e-13 -0.729317 -1.12054 -3.11909 -1.72124 -5.44945 -3.63858 -9.77891 -2.14298 -24.9173 pop
7780.222685 0.815196 0.00224232 -228.951 23.2439 -0.202584 6.10205 0.282917 3.50517 -0.873759 2.63267 0.972046 -0.377608 3.36222e-13 0.377608 -0.972046 -2.63267 0.873759 -3.50517 -0.282917 -6.10205 0.202584 -23.2439 pop
7790.161724 0.727247 0.00284307 -230.141 32.3238 -0.00524955 6.96482 4.28023 3.76189 -0.662678 1.24929 0.687155 -0.887408 3.47997e-13 0.887408 -0.687155 -1.24929 0.662678 -3.76189 -4.28023 -6.96482 0.00524955 -32.3238 pop
7800.11192 0.611822 0.000537268 -278.927 30.6966 10.3372 7.93741 5.80318 2.47734 -0.936673 -0.965771 -0.22786 -0.813531 4.09432e-13 0.813531 0.22786 0.965771 0.936673 -2.47734 -5.80318 -7.93741 -10.3372 -30.6966 pop
7810.163521 0.658539 0.00283887 -224.732 32.8649 1.71869 5.85198 -0.0193287 3.14905 -0.953009 1.99671 -0.225496 0.447955 3.43627e-13 -0.447955 0.225496 -1.99671 0.953009 -3.14905 0.0193287 -5.85198 -1.71869 -32.8649 pop
7820.117414 0.559109 0.00116342 -253.303 36.7435 6.2562 6.95494 1.14012 0.838064 0.16215 0.731789 -0.657136 0.16731 3.84433e-13 -0.16731 0.657136 -0.731789 -0.16215 -0.838064 -1.14012 -6.95494 -6.2562 -36.7435 pop
7830.138378 0.504758 0.00195104 -244.783 33.6225 6.45631 7.97394 2.48915 5.20727 -0.373826 1.66714 -0.05694 -0.00176162 3.70205e-13 0.00176162 0.05694 -1.66714 0.373826 -5.20727 -2.48915 -7.97394 -6.45631 -33.6225 pop
7840.120769 0.505498 0.00135539 -246.882 40.0336 2.66766 4.10942 -0.0195159 -2.55095 -1.29436 0.508169 0.841864 0.67368 3.80058e-13 -0.67368 -0.841864 -0.508169 1.29436 2.55095 0.0195159 -4.10942 -2.66766 -40.0336 pop
7850.191372 0.731908 0.0024023 -234.556 27.6481 3.40499 7.15041 1.16181 4.95735 -0.769651 3.05811 -0.51957 -0.281342 3.4974e-13 0.281342 0.51957 -3.05811 0.769651 -4.95735 -1.16181 -7.15041 -3.40499 -27.6481 pop
7860.12391 0.851394 0.00262465 -235.85 39.8951 -6.50472 -1.02827 3.33943 0.721805 2.32935 0.470723 -0.148997 0.181509 3.67598e-13 -0.181509 0.148997 -0.470723 -2.32935 -0.721805 -3.33943 1.02827 6.50472 -39.8951 pop
7870.18735 0.676857 0.00159059 -230.207 29.8642 -1.04084 6.42995 0.315786 0.21813 -1.84026 0.549524 0.127649 -0.0310222 3.45594e-13 0.0310222 -0.127649 -0.549524 1.84026 -0.21813 -0.315786 -6.42995 1.04084 -29.8642 pop
7880.171184 0.557606 0.00237817 -227.843 32.1689 3.58826 7.48043 1.09763 3.97251 0.0753049 1.3865 0.430658 0.00841143 3.45514e-13 -0.00841143 -0.430658 -1.3865 -0.0753049 -3.97251 -1.09763 -7.48043 -3.58826 -32.1689 pop
7890.182012 0.793904 0.00240043 -236.402 27.1427 -1.63498 6.0118 2.46935 0.766705 -0.744174 1.627 -0.103875 0.0299042 3.50572e-13 -0.0299042 0.103875 -1.627 0.744174 -0.766705 -2.46935 -6.0118 1.63498 -27.1427 pop
7900.178674 0.716682 0.00298961 -219.108 30.3621 -0.157339 7.74434 1.83349 1.78332 -0.843211 0.850536 0.306206 -0.105684 3.30978e-13 0.105684 -0.306206 -0.850536 0.843211 -1.78332 -1.83349 -7.74434 0.157339 -30.3621 pop
7910.171799 0.546154 0.00243268 -227.161 32.17 3.52565 7.39697 1.06386 3.97029 0.0109285 1.4263 0.422064 -0.0381624 3.44608e-13 0.0381624 -0.422064 -1.4263 -0.0109285 -3.97029 -1.06386 -7.39697 -3.52565 -32.17 pop
7920.19396 0.71143 0.00331578 -217.66 28.8076 0.380093 6.66643 0.982835 4.38759 0.282144 1.81868 0.107136 -0.225319 3.28312e-13 0.225319 -0.107136 -1.81868 -0.282144 -4.38759 -0.982835 -6.66643 -0.380093 -28.8076 pop
7930.181915 0.725822 0.00253964 -227.236 29.6336 0.948066 7.36133 1.80851 3.94557 0.799754 1.08792 -0.121864 0.112049 3.41903e-13 -0.112049 0.121864 -1.08792 -0.799754 -3.94557 -1.80851 -7.36133 -0.948066 -29.6336 pop
7940.169863 0.667244 0.00300816 -223.25 31.2144 2.14778 8.86604 0.561985 2.59002 2.48503 0.916567 0.557536 -0.186993 3.36699e-13 0.186993 -0.557536 -0.916567 -2.48503 -2.59002 -0.561985 -8.86604 -2.14778 -31.2144 pop
7950.154222 0.573462 0.00184249 -231.413 36.8843 -1.19831 2.56328 1.38952 2.62612 -1.26763 0.707906 -0.323369 0.229062 3.58238e-13 -0.229062 0.323369 -0.707906 1.26763 -2.62612 -1.38952 -2.56328 1.19831 -36.8843 pop
7960.159329 0.58039 0.00366929 -225.018 32.726 7.73798 10.3699 0.724989 2.54393 -0.681661 2.96223 0.467382 -0.572807 3.40299e-13 0.572807 -0.467382 -2.96223 0.681661 -2.54393 -0.724989 -10.3699 -7.73798 -32.726 pop
7970.15206 0.465761 0.00305163 -234 31.3757 4.93627 10.7549 4.02414 4.53031 1.08783 2.4195 0.452218 0.92692 3.52308e-13 -0.92692 -0.452218 -2.4195 -1.08783 -4.53031 -4.02414 -10.7549 -4.93627 -31.3757 pop
7980.17767 0.548387 0.0027583 -243.364 26.9873 8.12679 9.73084 1.36714 5.12356 -0.181134 2.55072 0.813627 -0.901842 3.58227e-13 0.901842 -0.813627 -2.55072 0.181134 -5.12356 -1.36714 -9.73084 -8.12679 -26.9873 pop
7990.193794 0.72736 0.00253019 -224.743 28.3735 -0.579777 5.5173 -1.28566 1.67467 1.07442 1.31915 0.586659 -0.346382 3.36376e-13 0.346382 -0.586659 -1.31915 -1.07442 -1.67467 1.28566 -5.5173 0.579777 -28.3735 pop
8000.132115 0.580573 0.00179934 -241.826 35.83 5.07785 5.38738 0.127399 2.46344 -1.27466 1.865 0.351636 -1.57381 3.67569e-13 1.57381 -0.351636 -1.865 1.27466 -2.46344 -0.127399 -5.38738 -5.07785 -35.83 pop
8010.11126 0.644977 0.00123693 -252.463 38.208 1.22417 3.70704 0.585317 -0.67597 3.20177 -2.32909 0.0786428 -0.408895 3.84368e-13 0.408895 -0.0786428 2.32909 -3.20177 0.67597 -0.585317 -3.70704 -1.22417 -38.208 reggae
8020.0871253 0.507124 0.00108075 -261.354 40.7888 5.36248 3.45594 2.27745 0.328587 2.54596 1.22247 0.941625 -0.513651 3.99201e-13 0.513651 -0.941625 -1.22247 -2.54596 -0.328587 -2.27745 -3.45594 -5.36248 -40.7888 reggae
8030.0896819 0.674395 0.00118352 -263.563 36.8267 5.07851 6.88611 5.68643 1.21294 1.06434 -1.38741 0.321524 -0.305763 3.96773e-13 0.305763 -0.321524 1.38741 -1.06434 -1.21294 -5.68643 -6.88611 -5.07851 -36.8267 reggae
8040.0990623 0.556531 0.00121589 -260.818 37.1345 -0.103552 1.42554 5.26877 2.99681 2.2564 1.37206 1.97692 -1.29734 3.94684e-13 1.29734 -1.97692 -1.37206 -2.2564 -2.99681 -5.26877 -1.42554 0.103552 -37.1345 reggae
8050.0940692 0.701924 0.0011846 -262.983 37.519 4.27934 1.97071 1.31 0.969895 2.69297 -0.20551 0.481655 -0.133553 3.98622e-13 0.133553 -0.481655 0.20551 -2.69297 -0.969895 -1.31 -1.97071 -4.27934 -37.519 reggae
8060.0902761 0.651388 0.00132056 -259.972 39.0968 2.96576 3.24586 3.81184 0.747987 2.44448 0.44228 0.858303 -0.714154 3.95328e-13 0.714154 -0.858303 -0.44228 -2.44448 -0.747987 -3.81184 -3.24586 -2.96576 -39.0968 reggae
8070.0735807 0.489701 0.00150471 -263.199 40.5774 7.51749 5.95119 4.68627 1.76307 2.43635 -0.515829 0.337964 -0.0193276 4.01361e-13 0.0193276 -0.337964 0.515829 -2.43635 -1.76307 -4.68627 -5.95119 -7.51749 -40.5774 reggae
8080.0996633 0.690108 0.00117314 -257.681 40.2261 3.41328 2.86306 1.40216 0.598493 2.26164 -1.59872 0.0205963 -0.642284 3.94311e-13 0.642284 -0.0205963 1.59872 -2.26164 -0.598493 -1.40216 -2.86306 -3.41328 -40.2261 reggae
8090.0913312 0.656571 0.00133426 -258.27 38.6725 1.58989 5.02709 6.23485 1.518 1.72935 -0.567169 0.698085 -0.173751 3.92856e-13 0.173751 -0.698085 0.567169 -1.72935 -1.518 -6.23485 -5.02709 -1.58989 -38.6725 reggae
8100.0812854 0.593512 0.00112374 -270.003 36.6137 10.6977 4.65669 1.33261 2.62282 2.55292 -0.632304 0.267514 -0.61873 4.05714e-13 0.61873 -0.267514 0.632304 -2.55292 -2.62282 -1.33261 -4.65669 -10.6977 -36.6137 reggae
8110.110788 0.558191 0.000816336 -264.089 35.0034 2.06368 4.20869 4.16605 -0.362691 2.19414 -0.821815 -1.01157 -1.32396 3.95164e-13 1.32396 1.01157 0.821815 -2.19414 0.362691 -4.16605 -4.20869 -2.06368 -35.0034 reggae
8120.104118 0.673571 0.000957454 -266.523 35.4132 5.13612 3.26389 1.4754 1.20309 1.73293 -0.270821 1.7144 0.444964 4.00622e-13 -0.444964 -1.7144 0.270821 -1.73293 -1.20309 -1.4754 -3.26389 -5.13612 -35.4132 reggae
8130.128579 0.749025 0.000664387 -268.582 31.7335 0.731646 0.407439 0.216552 0.155688 1.40204 -1.0943 -0.200593 -0.825582 3.99338e-13 0.825582 0.200593 1.0943 -1.40204 -0.155688 -0.216552 -0.407439 -0.731646 -31.7335 reggae
8140.0789556 0.679958 0.0013763 -262.482 40.4406 7.35719 3.60651 2.69456 2.83845 2.92352 -0.505652 0.429656 -0.275297 4.01217e-13 0.275297 -0.429656 0.505652 -2.92352 -2.83845 -2.69456 -3.60651 -7.35719 -40.4406 reggae
8150.0864471 0.536703 0.0014372 -269.712 34.7153 9.10506 7.03832 4.31261 3.46357 3.3065 -0.470814 -0.0391094 0.0758948 4.03083e-13 -0.0758948 0.0391094 0.470814 -3.3065 -3.46357 -4.31261 -7.03832 -9.10506 -34.7153 reggae
8160.0876259 0.629639 0.00171772 -256.102 39.965 8.23459 7.32715 2.48229 1.74003 3.18437 -1.19455 0.494494 -0.4432 3.9027e-13 0.4432 -0.494494 1.19455 -3.18437 -1.74003 -2.48229 -7.32715 -8.23459 -39.965 reggae
8170.106942 0.566015 0.00255359 -233.435 42.0827 -2.82641 4.98511 3.33278 -0.889562 3.5513 -1.01932 2.00988 -0.618276 3.62443e-13 0.618276 -2.00988 1.01932 -3.5513 0.889562 -3.33278 -4.98511 2.82641 -42.0827 reggae
8180.0819196 0.635856 0.00187797 -253.159 43.0562 1.15981 0.527266 2.10599 1.38424 4.13279 -0.125102 0.581892 -0.250783 3.92782e-13 0.250783 -0.581892 0.125102 -4.13279 -1.38424 -2.10599 -0.527266 -1.15981 -43.0562 reggae
8190.095778 0.595784 0.00128347 -262.402 36.4676 5.10829 6.55819 4.37823 1.98046 3.11761 -0.525681 0.660044 -0.293487 3.94875e-13 0.293487 -0.660044 0.525681 -3.11761 -1.98046 -4.37823 -6.55819 -5.10829 -36.4676 reggae
8200.0815589 0.586357 0.00176672 -262.637 36.7854 6.22635 5.14414 4.33734 3.74267 4.31605 1.11895 1.74625 0.0253971 3.96303e-13 -0.0253971 -1.74625 -1.11895 -4.31605 -3.74267 -4.33734 -5.14414 -6.22635 -36.7854 reggae
8210.0799876 0.577895 0.00172383 -258.245 40.7344 6.62001 5.2939 2.64353 1.74447 3.90241 -0.272083 0.421347 -0.49603 3.94711e-13 0.49603 -0.421347 0.272083 -3.90241 -1.74447 -2.64353 -5.2939 -6.62001 -40.7344 reggae
8220.111361 0.665619 0.00194869 -238.691 42.5875 -4.16127 2.81749 3.11457 -0.898015 2.88586 -1.08486 1.68827 -0.887311 3.7089e-13 0.887311 -1.68827 1.08486 -2.88586 0.898015 -3.11457 -2.81749 4.16127 -42.5875 reggae
8230.103372 0.569899 0.00252495 -236.796 43.8656 -3.68106 2.68345 4.21118 0.916776 3.20688 -1.51908 1.66572 -0.713576 3.70611e-13 0.713576 -1.66572 1.51908 -3.20688 -0.916776 -4.21118 -2.68345 3.68106 -43.8656 reggae
8240.116887 0.607991 0.00140209 -255.035 35.2429 -1.92717 3.14114 5.29102 3.40918 3.20692 0.38268 2.33096 -0.85187 3.84529e-13 0.85187 -2.33096 -0.38268 -3.20692 -3.40918 -5.29102 -3.14114 1.92717 -35.2429 reggae
8250.0840201 0.578855 0.00157717 -256.933 41.4852 5.6243 4.73434 3.53441 1.29014 2.23513 -1.80003 -0.961586 -1.299 3.93852e-13 1.299 0.961586 1.80003 -2.23513 -1.29014 -3.53441 -4.73434 -5.6243 -41.4852 reggae
8260.0826388 0.607502 0.00163163 -261.674 38.3159 4.1881 4.22548 5.08985 2.30563 3.34659 0.157865 0.716258 -0.111302 3.97121e-13 0.111302 -0.716258 -0.157865 -3.34659 -2.30563 -5.08985 -4.22548 -4.1881 -38.3159 reggae
8270.0896963 0.571931 0.00174704 -255.484 38.9333 3.64257 5.11644 3.7317 0.586057 3.3432 0.559727 0.645625 -1.06374 3.88047e-13 1.06374 -0.645625 -0.559727 -3.3432 -0.586057 -3.7317 -5.11644 -3.64257 -38.9333 reggae
8280.112572 0.697588 0.00160229 -259.705 34.4849 4.89903 7.72947 4.23423 1.89283 2.65144 -0.257121 0.903597 -0.741721 3.8806e-13 0.741721 -0.903597 0.257121 -2.65144 -1.89283 -4.23423 -7.72947 -4.89903 -34.4849 reggae
8290.0874603 0.535618 0.000845771 -285.636 23.806 6.69467 8.747 9.25525 6.02779 4.80974 3.11527 2.53518 0.703229 4.10463e-13 -0.703229 -2.53518 -3.11527 -4.80974 -6.02779 -9.25525 -8.747 -6.69467 -23.806 reggae
8300.0856879 0.521512 0.00130532 -264.221 36.6957 5.26458 7.1873 6.30723 3.23104 3.14478 -0.261756 1.29804 0.768345 3.98446e-13 -0.768345 -1.29804 0.261756 -3.14478 -3.23104 -6.30723 -7.1873 -5.26458 -36.6957 reggae
8310.0887521 0.577647 0.00098962 -268.03 34.9385 6.99916 5.56742 2.55208 1.15622 3.79594 1.47075 1.22913 -0.136901 4.00365e-13 0.136901 -1.22913 -1.47075 -3.79594 -1.15622 -2.55208 -5.56742 -6.99916 -34.9385 reggae
8320.0764752 0.524131 0.0011153 -274.623 31.8988 7.64962 6.74522 5.94441 4.7962 5.28439 3.06009 2.41787 0.388912 4.05875e-13 -0.388912 -2.41787 -3.06009 -5.28439 -4.7962 -5.94441 -6.74522 -7.64962 -31.8988 reggae
8330.0838821 0.585225 0.000674339 -271.48 35.8457 2.15514 0.513537 5.68727 2.91026 1.81317 1.28883 1.0855 0.82763 4.09702e-13 -0.82763 -1.0855 -1.28883 -1.81317 -2.91026 -5.68727 -0.513537 -2.15514 -35.8457 reggae
8340.0824421 0.557696 0.000904306 -272.739 34.4888 7.46725 5.17185 3.50081 1.79099 2.80967 1.17196 1.5607 0.568615 4.0702e-13 -0.568615 -1.5607 -1.17196 -2.80967 -1.79099 -3.50081 -5.17185 -7.46725 -34.4888 reggae
8350.0649537 0.529915 0.000989859 -274.65 35.1786 9.2086 5.09409 5.0132 2.8957 2.21043 1.83963 2.17977 0.613128 4.10458e-13 -0.613128 -2.17977 -1.83963 -2.21043 -2.8957 -5.0132 -5.09409 -9.2086 -35.1786 reggae
8360.0804474 0.576615 0.000920533 -271.162 35.5312 7.21522 4.80586 3.99029 1.799 2.63404 1.23832 1.04782 0.0475242 4.06013e-13 -0.0475242 -1.04782 -1.23832 -2.63404 -1.799 -3.99029 -4.80586 -7.21522 -35.5312 reggae
8370.0951813 0.469475 0.000990418 -272.394 31.9542 6.50443 7.56909 5.36266 2.37077 3.20266 1.41446 1.67941 0.228941 4.02405e-13 -0.228941 -1.67941 -1.41446 -3.20266 -2.37077 -5.36266 -7.56909 -6.50443 -31.9542 reggae
8380.0854052 0.5754 0.00105771 -278.006 28.494 6.47987 6.65622 5.77559 3.97205 4.58112 2.57188 2.53828 1.14069 4.06765e-13 -1.14069 -2.53828 -2.57188 -4.58112 -3.97205 -5.77559 -6.65622 -6.47987 -28.494 reggae
8390.0915995 0.56719 0.00101912 -263.212 39.1856 3.51469 2.3693 2.77418 0.539123 1.26931 -0.0765906 0.913788 -0.249122 4.00645e-13 0.249122 -0.913788 0.0765906 -1.26931 -0.539123 -2.77418 -2.3693 -3.51469 -39.1856 reggae
8400.0618665 0.438139 0.00101782 -285.387 28.7675 16.0268 12.1791 5.84297 3.44246 2.48423 -0.30913 0.628273 0.41008 4.14442e-13 -0.41008 -0.628273 0.30913 -2.48423 -3.44246 -5.84297 -12.1791 -16.0268 -28.7675 reggae
8410.115068 0.620782 0.000379109 -283.647 24.0706 3.91124 3.42747 2.40149 -0.767231 0.3694 -0.313499 0.123215 -0.120107 4.08836e-13 0.120107 -0.123215 0.313499 -0.3694 0.767231 -2.40149 -3.42747 -3.91124 -24.0706 reggae
8420.09682 0.571996 0.00150778 -262.058 35.1513 3.15863 9.51144 10.4688 2.60798 2.15014 0.268402 0.832822 0.307639 3.92369e-13 -0.307639 -0.832822 -0.268402 -2.15014 -2.60798 -10.4688 -9.51144 -3.15863 -35.1513 reggae
8430.121317 0.647829 0.000922047 -261.134 35.5852 -1.0239 -0.818969 3.20891 4.24371 3.27623 2.12686 1.12822 0.401384 3.96499e-13 -0.401384 -1.12822 -2.12686 -3.27623 -4.24371 -3.20891 0.818969 1.0239 -35.5852 reggae
8440.0747305 0.578977 0.00134015 -256.973 46.4538 0.91514 -2.57978 6.73552 2.9548 -0.304 -0.498297 0.654906 1.02038 4.05062e-13 -1.02038 -0.654906 0.498297 0.304 -2.9548 -6.73552 2.57978 -0.91514 -46.4538 reggae
8450.123615 0.621171 0.0018918 -246.996 36.1507 3.65283 7.19293 3.80383 2.62008 0.665363 1.42885 0.369515 0.365219 3.75573e-13 -0.365219 -0.369515 -1.42885 -0.665363 -2.62008 -3.80383 -7.19293 -3.65283 -36.1507 reggae
8460.207288 0.686546 0.00121074 -239.093 24.1544 -4.15169 8.87256 4.86168 1.82703 1.50453 -0.350987 -0.455385 -0.69074 3.48946e-13 0.69074 0.455385 0.350987 -1.50453 -1.82703 -4.86168 -8.87256 4.15169 -24.1544 reggae
8470.122236 0.594476 0.00122832 -257.593 35.4099 4.65448 9.99834 6.18296 1.29544 1.61411 -0.808932 -1.91665 -0.812671 3.86522e-13 0.812671 1.91665 0.808932 -1.61411 -1.29544 -6.18296 -9.99834 -4.65448 -35.4099 reggae
8480.133619 0.71801 0.00135018 -249.85 36.2977 -3.04355 6.18259 8.13854 0.777038 0.753923 -1.93805 -0.657521 -0.504651 3.78586e-13 0.504651 0.657521 1.93805 -0.753923 -0.777038 -8.13854 -6.18259 3.04355 -36.2977 reggae
8490.133505 0.64342 0.00166057 -244.677 34.8807 -0.767847 7.55295 4.74263 0.897031 3.0961 -1.48946 0.196736 -1.0445 3.68465e-13 1.0445 -0.196736 1.48946 -3.0961 -0.897031 -4.74263 -7.55295 0.767847 -34.8807 reggae
8500.125215 0.551241 0.00167315 -248.923 36.6061 5.60545 8.36839 3.97117 2.80192 -1.4237 0.91601 0.730854 0.552615 3.78672e-13 -0.552615 -0.730854 -0.91601 1.4237 -2.80192 -3.97117 -8.36839 -5.60545 -36.6061 reggae
8510.142649 0.681711 0.00162625 -245.725 34.2421 0.196868 3.79068 2.77113 2.01308 0.962388 0.426092 0.0696372 0.207745 3.72505e-13 -0.207745 -0.0696372 -0.426092 -0.962388 -2.01308 -2.77113 -3.79068 -0.196868 -34.2421 reggae
8520.231731 0.829306 0.0013827 -256.043 12.6293 -2.38886 12.4219 5.01757 2.2117 4.29869 3.85812 2.99124 1.26886 3.56433e-13 -1.26886 -2.99124 -3.85812 -4.29869 -2.2117 -5.01757 -12.4219 2.38886 -12.6293 reggae
8530.164917 0.705879 0.00243532 -238.607 29.8062 5.09458 9.00392 1.45936 3.73805 0.53276 1.29806 0.600574 0.531521 3.5659e-13 -0.531521 -0.600574 -1.29806 -0.53276 -3.73805 -1.45936 -9.00392 -5.09458 -29.8062 reggae
8540.0974778 0.604164 0.000731442 -282.352 26.8856 9.80449 6.75066 5.08519 4.34471 2.31244 1.74359 1.44507 -0.112139 4.10027e-13 0.112139 -1.44507 -1.74359 -2.31244 -4.34471 -5.08519 -6.75066 -9.80449 -26.8856 reggae
8550.120997 0.549557 0.00128864 -258.223 34.2603 1.1046 1.85138 4.38339 4.39112 1.28942 2.36504 1.40844 -0.960587 3.88863e-13 0.960587 -1.40844 -2.36504 -1.28942 -4.39112 -4.38339 -1.85138 -1.1046 -34.2603 reggae
8560.133406 0.636017 0.00147739 -250.782 33.4856 5.10871 8.48825 2.83953 2.22021 1.51719 0.496457 -0.86946 -0.750837 3.75933e-13 0.750837 0.86946 -0.496457 -1.51719 -2.22021 -2.83953 -8.48825 -5.10871 -33.4856 reggae
8570.107226 0.646836 0.00132923 -258.199 36.6324 4.26822 3.36616 2.88043 2.22897 1.19087 1.1193 0.21017 -0.573443 3.91116e-13 0.573443 -0.21017 -1.1193 -1.19087 -2.22897 -2.88043 -3.36616 -4.26822 -36.6324 reggae
8580.111255 0.654942 0.00134559 -256.276 35.8566 3.11336 5.22695 5.01023 3.16229 0.436986 0.400832 0.138672 0.0370722 3.8803e-13 -0.0370722 -0.138672 -0.400832 -0.436986 -3.16229 -5.01023 -5.22695 -3.11336 -35.8566 reggae
8590.124963 0.702547 0.00112449 -258.606 34.7974 5.80455 3.77515 0.944562 3.31842 1.89787 0.451933 -0.117842 -0.389253 3.89919e-13 0.389253 0.117842 -0.451933 -1.89787 -3.31842 -0.944562 -3.77515 -5.80455 -34.7974 reggae
8600.144435 0.707719 0.0016508 -238.686 37.2309 -0.285381 3.93056 0.501571 0.664346 1.24184 -0.530602 -0.340698 -0.429529 3.6604e-13 0.429529 0.340698 0.530602 -1.24184 -0.664346 -0.501571 -3.93056 0.285381 -37.2309 reggae
8610.120599 0.558516 0.000330704 -280.318 27.1783 3.7117 2.78284 2.57102 0.185857 0.996585 -0.286822 -1.31374 -1.10151 4.08344e-13 1.10151 1.31374 0.286822 -0.996585 -0.185857 -2.57102 -2.78284 -3.7117 -27.1783 reggae
8620.157428 0.702913 0.00241317 -235.233 33.6972 0.313167 7.33613 5.58184 4.42534 0.092711 0.395659 0.640212 0.182186 3.57343e-13 -0.182186 -0.640212 -0.395659 -0.092711 -4.42534 -5.58184 -7.33613 -0.313167 -33.6972 reggae
8630.0994657 0.507377 0.000736009 -277.523 29.2352 6.83551 4.41686 4.86862 5.16781 3.12381 2.42656 1.85462 0.935994 4.08584e-13 -0.935994 -1.85462 -2.42656 -3.12381 -5.16781 -4.86862 -4.41686 -6.83551 -29.2352 reggae
8640.0941547 0.592915 0.00119243 -258.788 40.7615 0.334515 0.698762 6.62008 2.37739 -0.695181 -0.07722 -0.0505043 -0.472885 3.98297e-13 0.472885 0.0505043 0.07722 0.695181 -2.37739 -6.62008 -0.698762 -0.334515 -40.7615 reggae
8650.15558 0.495169 0.00356346 -231.358 30.9768 3.06218 8.55613 4.01071 7.33381 2.99387 0.842036 -0.502022 0.119196 3.49341e-13 -0.119196 0.502022 -0.842036 -2.99387 -7.33381 -4.01071 -8.55613 -3.06218 -30.9768 reggae
8660.0943665 0.60424 0.00372965 -237.793 45.0209 1.72411 2.20108 4.68471 2.13028 0.167846 1.01273 1.91545 0.523052 3.75177e-13 -0.523052 -1.91545 -1.01273 -0.167846 -2.13028 -4.68471 -2.20108 -1.72411 -45.0209 reggae
8670.083086 0.63358 0.00162296 -253.76 44.8658 2.32408 0.859299 3.80657 1.15289 0.829412 -0.762696 0.66759 1.09065 3.97179e-13 -1.09065 -0.66759 0.762696 -0.829412 -1.15289 -3.80657 -0.859299 -2.32408 -44.8658 reggae
8680.0894121 0.614636 0.0018396 -251.962 43.6023 4.52738 2.23069 3.87048 4.06409 -0.609658 0.136123 0.0557309 -0.321018 3.93015e-13 0.321018 -0.0557309 -0.136123 0.609658 -4.06409 -3.87048 -2.23069 -4.52738 -43.6023 reggae
8690.104852 0.613721 0.00124884 -261.052 36.8073 3.36359 4.31492 2.89031 0.65985 2.84773 0.88457 0.288705 0.0491175 3.94582e-13 -0.0491175 -0.288705 -0.88457 -2.84773 -0.65985 -2.89031 -4.31492 -3.36359 -36.8073 reggae
8700.12414 0.592957 0.00161561 -252.308 33.9894 4.49648 8.9149 4.70973 1.56183 1.31314 -1.46997 0.581791 2.50261 3.80486e-13 -2.50261 -0.581791 1.46997 -1.31314 -1.56183 -4.70973 -8.9149 -4.49648 -33.9894 reggae
8710.12064 0.578276 0.00203655 -244.211 39.3446 2.05958 5.69849 3.1382 2.43094 2.7452 0.263287 0.393785 0.333197 3.75907e-13 -0.333197 -0.393785 -0.263287 -2.7452 -2.43094 -3.1382 -5.69849 -2.05958 -39.3446 reggae
8720.155557 0.587819 0.00202927 -243.884 28.5703 1.06322 9.72394 6.47751 4.92175 3.3078 -0.549928 0.667687 0.544607 3.61476e-13 -0.544607 -0.667687 0.549928 -3.3078 -4.92175 -6.47751 -9.72394 -1.06322 -28.5703 reggae
8730.155565 0.687289 0.00184034 -242.398 33.1386 2.70884 4.63244 0.887112 4.19598 0.969769 -0.18178 0.175192 0.484734 3.67504e-13 -0.484734 -0.175192 0.18178 -0.969769 -4.19598 -0.887112 -4.63244 -2.70884 -33.1386 reggae
8740.102736 0.548539 0.00259743 -243.52 41.023 3.81874 7.07113 1.86762 0.160049 2.29729 0.801791 1.18584 0.110632 3.75349e-13 -0.110632 -1.18584 -0.801791 -2.29729 -0.160049 -1.86762 -7.07113 -3.81874 -41.023 reggae
8750.102052 0.55361 0.00260107 -243.468 41.2038 3.81311 6.97354 1.78768 0.0931694 2.24131 0.784286 1.18046 0.136979 3.75554e-13 -0.136979 -1.18046 -0.784286 -2.24131 -0.0931694 -1.78768 -6.97354 -3.81311 -41.2038 reggae
8760.132642 0.665634 0.00169274 -240.44 38.0825 -4.62565 1.46896 3.75463 0.791547 1.71124 -0.999702 0.53803 0.103928 3.70248e-13 -0.103928 -0.53803 0.999702 -1.71124 -0.791547 -3.75463 -1.46896 4.62565 -38.0825 reggae
8770.114385 0.531715 0.00255713 -249.536 35.3544 7.61464 10.1574 3.99994 0.766774 2.3614 0.692352 0.420271 -0.573671 3.74573e-13 0.573671 -0.420271 -0.692352 -2.3614 -0.766774 -3.99994 -10.1574 -7.61464 -35.3544 reggae
8780.0896939 0.578723 0.00143687 -259.052 40.1624 2.78417 5.04895 7.63636 2.30534 1.74818 2.03828 1.41206 0.548857 3.96337e-13 -0.548857 -1.41206 -2.03828 -1.74818 -2.30534 -7.63636 -5.04895 -2.78417 -40.1624 reggae
8790.12067 0.661753 0.00116696 -255.702 33.9758 -2.14807 4.91855 8.18895 2.80858 3.79418 1.75051 0.90799 -0.77089 3.83327e-13 0.77089 -0.90799 -1.75051 -3.79418 -2.80858 -8.18895 -4.91855 2.14807 -33.9758 reggae
8800.160418 0.688628 0.00086822 -258.146 29.5759 -6.85823 1.06536 1.96436 -4.62015 0.777906 0.161634 -0.981723 -0.349664 3.82112e-13 0.349664 0.981723 -0.161634 -0.777906 4.62015 -1.96436 -1.06536 6.85823 -29.5759 reggae
8810.126587 0.647377 0.00243484 -244.041 35.8692 -0.343609 5.25785 4.07928 1.74893 1.3296 1.42976 2.20467 -0.0553546 3.70575e-13 0.0553546 -2.20467 -1.42976 -1.3296 -1.74893 -4.07928 -5.25785 0.343609 -35.8692 reggae
8820.128802 0.648519 0.00229773 -245.005 35.36 -0.344848 5.13234 4.15821 1.77526 1.27175 1.41249 2.17041 -0.454427 3.709e-13 0.454427 -2.17041 -1.41249 -1.27175 -1.77526 -4.15821 -5.13234 0.344848 -35.36 reggae
8830.128802 0.64815 0.00229773 -245.005 35.36 -0.344848 5.13234 4.15821 1.77526 1.27175 1.41249 2.17041 -0.454427 3.709e-13 0.454427 -2.17041 -1.41249 -1.27175 -1.77526 -4.15821 -5.13234 0.344848 -35.36 reggae
8840.0679863 0.486347 0.000471539 -278.694 34.959 11.2354 3.12488 0.17976 -2.66382 -0.676782 0.24788 -0.0242482 0.0139711 4.1501e-13 -0.0139711 0.0242482 -0.24788 0.676782 2.66382 -0.17976 -3.12488 -11.2354 -34.959 reggae
8850.0996246 0.662114 0.00147065 -251.193 41.085 1.44421 5.2651 5.62071 -0.134623 1.13574 0.0477713 0.40101 -0.171381 3.86028e-13 0.171381 -0.40101 -0.0477713 -1.13574 0.134623 -5.62071 -5.2651 -1.44421 -41.085 reggae
8860.09294 0.581444 0.00140616 -260.66 38.3738 -2.30583 1.80168 11.5677 1.14057 1.25255 1.86922 1.39141 0.547468 3.96732e-13 -0.547468 -1.39141 -1.86922 -1.25255 -1.14057 -11.5677 -1.80168 2.30583 -38.3738 reggae
8870.130127 0.622628 0.00270044 -238.213 36.64 0.0380214 -1.46979 3.33716 4.90155 2.32736 2.28347 1.0947 0.675671 3.67825e-13 -0.675671 -1.0947 -2.28347 -2.32736 -4.90155 -3.33716 1.46979 -0.0380214 -36.64 reggae
8880.160868 0.629807 0.00244845 -240.565 33.1524 5.70061 9.43391 0.898807 -0.321387 -0.142132 1.31754 -0.34903 -0.849565 3.60797e-13 0.849565 0.34903 -1.31754 0.142132 0.321387 -0.898807 -9.43391 -5.70061 -33.1524 reggae
8890.205571 0.781193 0.00146201 -232.914 27.6291 0.818643 5.4926 -2.17506 1.96566 -0.579926 0.856928 -0.146692 0.220877 3.47641e-13 -0.220877 0.146692 -0.856928 0.579926 -1.96566 2.17506 -5.4926 -0.818643 -27.6291 reggae
8900.0478369 0.549119 0.00198948 -265.731 44.8973 10.7227 3.15871 4.44928 1.78199 1.70413 0.880631 0.424626 0.187572 4.10957e-13 -0.187572 -0.424626 -0.880631 -1.70413 -1.78199 -4.44928 -3.15871 -10.7227 -44.8973 reggae
8910.152264 0.637339 0.00162168 -253.105 29.5107 1.99779 7.65722 3.28603 2.33262 3.92528 -0.385457 0.067312 0.824233 3.7522e-13 -0.824233 -0.067312 0.385457 -3.92528 -2.33262 -3.28603 -7.65722 -1.99779 -29.5107 reggae
8920.125071 0.636893 0.000788882 -261.103 34.2216 -2.64304 2.52302 5.52468 1.13927 1.85003 -0.378878 0.428466 0.236896 3.92671e-13 -0.236896 -0.428466 0.378878 -1.85003 -1.13927 -5.52468 -2.52302 2.64304 -34.2216 reggae
8930.115972 0.632603 0.00106625 -254.982 37.0532 -3.80211 2.52123 6.09085 0.486693 2.15777 -0.81743 0.65073 0.164434 3.87554e-13 -0.164434 -0.65073 0.81743 -2.15777 -0.486693 -6.09085 -2.52123 3.80211 -37.0532 reggae
8940.105617 0.6781 0.00127634 -257.067 39.5314 6.10712 0.676745 1.9468 4.92288 -0.52155 0.76828 0.131159 -1.7045 3.94253e-13 1.7045 -0.131159 -0.76828 0.52155 -4.92288 -1.9468 -0.676745 -6.10712 -39.5314 reggae
8950.101307 0.641125 0.00165577 -245.573 44.8671 -1.51671 -0.912692 4.01439 2.61598 1.53792 0.519393 1.00342 -0.884675 3.85631e-13 0.884675 -1.00342 -0.519393 -1.53792 -2.61598 -4.01439 0.912692 1.51671 -44.8671 reggae
8960.135227 0.674168 0.00194412 -238.963 36.6552 0.75822 8.01191 3.82401 0.827912 1.30495 0.708684 0.478858 -0.0841976 3.64164e-13 0.0841976 -0.478858 -0.708684 -1.30495 -0.827912 -3.82401 -8.01191 -0.75822 -36.6552 reggae
8970.0849089 0.554523 0.00215204 -256.555 40.0104 -1.74334 3.90393 12.5769 2.40911 3.50543 2.11302 1.30542 0.930411 3.93011e-13 -0.930411 -1.30542 -2.11302 -3.50543 -2.40911 -12.5769 -3.90393 1.74334 -40.0104 reggae
8980.103058 0.542801 0.00129408 -251.851 42.4262 -0.672191 3.54925 6.80333 -1.66708 0.00897169 0.236436 -0.386691 -0.132771 3.89078e-13 0.132771 0.386691 -0.236436 -0.00897169 1.66708 -6.80333 -3.54925 0.672191 -42.4262 reggae
8990.100619 0.52994 0.001962 -251.959 38.1689 2.12482 6.7439 5.5859 1.52635 3.04847 1.03358 1.36058 0.463832 3.83534e-13 -0.463832 -1.36058 -1.03358 -3.04847 -1.52635 -5.5859 -6.7439 -2.12482 -38.1689 reggae
9000.131149 0.646545 0.00217069 -234.708 38.6292 -10.3516 2.69016 7.64626 -1.39448 7.20136 0.347003 1.15956 -0.394643 3.60376e-13 0.394643 -1.15956 -0.347003 -7.20136 1.39448 -7.64626 -2.69016 10.3516 -38.6292 reggae
9010.115394 0.505339 0.00269376 -228.241 41.917 -2.32618 6.92994 3.89038 -0.342593 3.94019 -1.99071 1.64259 -1.23517 3.54252e-13 1.23517 -1.64259 1.99071 -3.94019 0.342593 -3.89038 -6.92994 2.32618 -41.917 rock
9020.0771678 0.472413 0.00279188 -240.318 50.1787 -0.815872 2.50268 5.734 -0.404808 4.10404 0.477381 0.486604 0.494683 3.83761e-13 -0.494683 -0.486604 -0.477381 -4.10404 0.404808 -5.734 -2.50268 0.815872 -50.1787 rock
9030.0949557 0.586069 0.00196888 -248.415 43.3157 -0.202454 1.49408 3.88374 -0.210079 0.908581 -1.33942 1.1783 -0.24649 3.86078e-13 0.24649 -1.1783 1.33942 -0.908581 0.210079 -3.88374 -1.49408 0.202454 -43.3157 rock
9040.0695027 0.466889 0.00191072 -259.389 42.0207 8.9517 6.43383 3.19289 2.12482 3.57067 0.736272 2.04057 0.120506 3.97447e-13 -0.120506 -2.04057 -0.736272 -3.57067 -2.12482 -3.19289 -6.43383 -8.9517 -42.0207 rock
9050.0639106 0.46121 0.00247718 -257.187 42.6588 9.56059 10.2837 6.6496 2.1036 3.70903 0.0624509 0.505097 -0.092395 3.94034e-13 0.092395 -0.505097 -0.0624509 -3.70903 -2.1036 -6.6496 -10.2837 -9.56059 -42.6588 rock
9060.0838541 0.522192 0.00257308 -235.084 51.6506 -2.15098 -0.955176 2.14514 -0.0993779 2.79636 -3.12139 0.259757 0.0669084 3.80006e-13 -0.0669084 -0.259757 3.12139 -2.79636 0.0993779 -2.14514 0.955176 2.15098 -51.6506 rock
9070.0863479 0.560898 0.00221369 -243.678 48.9742 -0.793165 1.021 7.00217 0.237247 0.928618 -1.17288 1.08054 0.237821 3.87272e-13 -0.237821 -1.08054 1.17288 -0.928618 -0.237247 -7.00217 -1.021 0.793165 -48.9742 rock
9080.0578842 0.473115 0.00160946 -260.063 46.3445 9.17756 4.37364 4.28094 2.11047 1.14149 -1.04123 0.406101 0.21995 4.05245e-13 -0.21995 -0.406101 1.04123 -1.14149 -2.11047 -4.28094 -4.37364 -9.17756 -46.3445 rock
9090.0937348 0.63184 0.00357993 -222.364 50.1271 -4.23296 1.23842 0.189161 -1.97273 4.52616 -2.7932 1.60883 -1.08779 3.58238e-13 1.08779 -1.60883 2.7932 -4.52616 1.97273 -0.189161 -1.23842 4.23296 -50.1271 rock
9100.0575156 0.42445 0.00153181 -262.356 46.0584 11.518 2.37942 0.0885641 0.0306133 2.39283 1.57273 1.81504 0.892042 4.07933e-13 -0.892042 -1.81504 -1.57273 -2.39283 -0.0306133 -0.0885641 -2.37942 -11.518 -46.0584 rock
9110.0900231 0.614121 0.00185872 -250.778 41.7761 4.31807 7.15833 4.83811 1.49469 2.44727 -1.32824 1.56668 -0.25616 3.85388e-13 0.25616 -1.56668 1.32824 -2.44727 -1.49469 -4.83811 -7.15833 -4.31807 -41.7761 rock
9120.0866642 0.570147 0.00153723 -255.603 41.6257 5.90659 6.12824 3.88884 1.42409 2.1598 -0.406226 2.00757 0.260078 3.92295e-13 -0.260078 -2.00757 0.406226 -2.1598 -1.42409 -3.88884 -6.12824 -5.90659 -41.6257 rock
9130.107393 0.61347 0.000937072 -265.892 33.9853 4.28418 7.15309 6.33565 3.06497 3.75099 0.534862 1.31761 0.592491 3.97089e-13 -0.592491 -1.31761 -0.534862 -3.75099 -3.06497 -6.33565 -7.15309 -4.28418 -33.9853 rock
9140.0898061 0.522729 0.00175381 -261.069 35.1918 8.79707 13.4134 6.24832 0.692359 2.15468 -0.858894 0.883923 -0.83154 3.88004e-13 0.83154 -0.883923 0.858894 -2.15468 -0.692359 -6.24832 -13.4134 -8.79707 -35.1918 rock
9150.114097 0.650359 0.000656647 -273.031 30.3652 4.8748 7.25361 6.13748 2.10507 2.87651 -0.00664851 0.52493 0.279255 4.01793e-13 -0.279255 -0.52493 0.00664851 -2.87651 -2.10507 -6.13748 -7.25361 -4.8748 -30.3652 rock
9160.108312 0.668697 0.00114493 -257.795 39.7438 3.04744 3.86563 4.47266 0.486479 0.684916 -1.4536 0.222029 -0.35309 3.93674e-13 0.35309 -0.222029 1.4536 -0.684916 -0.486479 -4.47266 -3.86563 -3.04744 -39.7438 rock
9170.138236 0.728806 0.0024456 -222.033 39.2127 -6.80054 4.26109 2.73218 -1.25152 2.90572 -3.37144 2.64123 -1.45919 3.43061e-13 1.45919 -2.64123 3.37144 -2.90572 1.25152 -2.73218 -4.26109 6.80054 -39.2127 rock
9180.12469 0.627143 0.0021059 -229.762 42.7274 -7.35288 2.07846 4.37759 -0.427688 3.41518 -1.67048 2.31258 -1.29964 3.58889e-13 1.29964 -2.31258 1.67048 -3.41518 0.427688 -4.37759 -2.07846 7.35288 -42.7274 rock
9190.128168 0.686183 0.00185707 -236.653 39.2709 -4.20491 4.93736 4.85936 0.803709 3.2801 -1.88039 1.6938 -1.37426 3.63294e-13 1.37426 -1.6938 1.88039 -3.2801 -0.803709 -4.85936 -4.93736 4.20491 -39.2709 rock
9200.12809 0.600517 0.0011528 -243.006 39.6615 -5.19006 2.19346 2.9475 -1.16222 2.79371 -1.59852 1.48547 -0.597214 3.73545e-13 0.597214 -1.48547 1.59852 -2.79371 1.16222 -2.9475 -2.19346 5.19006 -39.6615 rock
9210.117649 0.611515 0.00197066 -234.888 41.8914 -2.99101 3.59043 2.82973 -1.2428 2.09838 -2.07359 1.80223 -1.67801 3.63745e-13 1.67801 -1.80223 2.07359 -2.09838 1.2428 -2.82973 -3.59043 2.99101 -41.8914 rock
9220.116793 0.674755 0.00193321 -233.448 43.2192 -5.32847 2.5045 3.42269 -2.6107 1.02509 -1.75916 2.69103 -2.02488 3.6295e-13 2.02488 -2.69103 1.75916 -1.02509 2.6107 -3.42269 -2.5045 5.32847 -43.2192 rock
9230.129563 0.697967 0.00231633 -226.791 42.1678 -7.55005 1.23542 1.46039 -3.50114 1.9045 -2.22061 2.55805 -1.80438 3.53265e-13 1.80438 -2.55805 2.22061 -1.9045 3.50114 -1.46039 -1.23542 7.55005 -42.1678 rock
9240.147341 0.539296 0.00193063 -228.52 36.5978 -3.38116 6.92712 2.14109 -2.57839 3.15486 -2.83052 2.63396 -0.83845 3.47473e-13 0.83845 -2.63396 2.83052 -3.15486 2.57839 -2.14109 -6.92712 3.38116 -36.5978 rock
9250.133357 0.585803 0.0018847 -231.341 40.3546 -11.3215 0.982953 5.59232 -2.31889 2.84084 -1.84204 2.47653 -0.931419 3.58219e-13 0.931419 -2.47653 1.84204 -2.84084 2.31889 -5.59232 -0.982953 11.3215 -40.3546 rock
9260.138318 0.705442 0.00184098 -230.119 39.7165 -7.94233 3.4046 3.76504 -2.86104 1.59256 -1.98326 3.01506 -1.95328 3.53824e-13 1.95328 -3.01506 1.98326 -1.59256 2.86104 -3.76504 -3.4046 7.94233 -39.7165 rock
9270.122135 0.600333 0.00195683 -233.674 41.0847 -4.24655 4.7161 3.56113 -1.1174 3.18721 -1.66475 2.39755 -1.10903 3.61031e-13 1.10903 -2.39755 1.66475 -3.18721 1.1174 -3.56113 -4.7161 4.24655 -41.0847 rock
9280.147936 0.596168 0.00111443 -243.351 34.0495 -4.64346 5.27076 3.29902 0.633072 3.73978 -1.09626 1.98871 -0.724774 3.66313e-13 0.724774 -1.98871 1.09626 -3.73978 -0.633072 -3.29902 -5.27076 4.64346 -34.0495 rock
9290.104992 0.556548 0.00176089 -242.294 43.5941 -5.59232 0.812833 7.75718 2.64188 3.66005 1.85228 1.74734 -0.184101 3.79187e-13 0.184101 -1.74734 -1.85228 -3.66005 -2.64188 -7.75718 -0.812833 5.59232 -43.5941 rock
9300.1332 0.571131 0.00218749 -231.578 38.9959 -3.67729 6.47918 4.40311 -0.647478 2.78879 -1.32408 0.852324 -0.633337 3.56315e-13 0.633337 -0.852324 1.32408 -2.78879 0.647478 -4.40311 -6.47918 3.67729 -38.9959 rock
9310.151342 0.542693 0.00134439 -249.466 31.4365 3.49807 11.8942 3.7488 0.160408 3.32206 -0.682842 1.3329 -0.0989993 3.69213e-13 0.0989993 -1.3329 0.682842 -3.32206 -0.160408 -3.7488 -11.8942 -3.49807 -31.4365 rock
9320.140848 0.650817 0.00129773 -248.194 36.9226 -0.574127 4.00852 3.50227 -0.772045 -1.37767 -0.466636 0.895298 -0.288499 3.77568e-13 0.288499 -0.895298 0.466636 1.37767 0.772045 -3.50227 -4.00852 0.574127 -36.9226 rock
9330.122361 0.624069 0.00299309 -224.75 42.8697 -5.67411 2.07667 4.20202 0.970299 1.46663 -0.83662 0.165802 -0.314666 3.55006e-13 0.314666 -0.165802 0.83662 -1.46663 -0.970299 -4.20202 -2.07667 5.67411 -42.8697 rock
9340.084956 0.528159 0.00144017 -249.91 49.1074 1.09297 -2.51435 2.92587 1.56263 0.147498 -2.8047 -1.27192 0.244251 3.98627e-13 -0.244251 1.27192 2.8047 -0.147498 -1.56263 -2.92587 2.51435 -1.09297 -49.1074 rock
9350.144808 0.59649 0.00237065 -226.672 36.9791 -4.87508 4.15971 3.50822 2.85196 3.07286 0.178266 1.70252 -0.589772 3.49302e-13 0.589772 -1.70252 -0.178266 -3.07286 -2.85196 -3.50822 -4.15971 4.87508 -36.9791 rock
9360.0886447 0.467075 0.00176168 -251.282 42.4449 3.82625 4.13287 3.47964 1.5763 1.69185 2.07786 1.88498 1.32668 3.89773e-13 -1.32668 -1.88498 -2.07786 -1.69185 -1.5763 -3.47964 -4.13287 -3.82625 -42.4449 rock
9370.147649 0.624524 0.00279869 -219.928 36.8268 -4.18424 3.21086 1.91362 2.5856 1.6721 -1.63876 1.11439 -0.488222 3.40831e-13 0.488222 -1.11439 1.63876 -1.6721 -2.5856 -1.91362 -3.21086 4.18424 -36.8268 rock
9380.136444 0.7029 0.001484 -239.753 38.145 -6.36433 2.51869 6.57195 0.977282 -0.022339 -0.23426 1.79085 -0.180399 3.68658e-13 0.180399 -1.79085 0.23426 0.022339 -0.977282 -6.57195 -2.51869 6.36433 -38.145 rock
9390.153063 0.637838 0.00301582 -219.428 35.0354 -5.32939 2.32806 0.384394 1.37925 1.99615 0.748736 1.87585 0.488439 3.38734e-13 -0.488439 -1.87585 -0.748736 -1.99615 -1.37925 -0.384394 -2.32806 5.32939 -35.0354 rock
9400.143462 0.574356 0.00171777 -236.549 37.8585 -3.85117 -0.363598 2.00514 7.02896 1.85416 1.62515 0.506732 0.875983 3.68929e-13 -0.875983 -0.506732 -1.62515 -1.85416 -7.02896 -2.00514 0.363598 3.85117 -37.8585 rock
9410.157788 0.647187 0.00195806 -232.653 34.2408 -5.4133 4.85026 4.37584 2.04944 3.14377 0.958294 0.314434 0.350264 3.54801e-13 -0.350264 -0.314434 -0.958294 -3.14377 -2.04944 -4.37584 -4.85026 5.4133 -34.2408 rock
9420.146861 0.644805 0.00225076 -225.976 38.1949 -5.11802 -0.582239 -0.252162 3.1539 0.860116 1.54218 0.0897964 0.515444 3.54092e-13 -0.515444 -0.0897964 -1.54218 -0.860116 -3.1539 0.252162 0.582239 5.11802 -38.1949 rock
9430.142376 0.602271 0.00160905 -239.128 36.3539 -1.92068 4.69822 4.73851 2.59285 0.590927 0.477508 -0.235609 -0.520184 3.65799e-13 0.520184 0.235609 -0.477508 -0.590927 -2.59285 -4.73851 -4.69822 1.92068 -36.3539 rock
9440.154401 0.634748 0.0016841 -236.319 35.2709 -5.49908 1.67016 3.02194 0.478534 0.591941 1.57692 -0.471061 -0.267766 3.61669e-13 0.267766 0.471061 -1.57692 -0.591941 -0.478534 -3.02194 -1.67016 5.49908 -35.2709 rock
9450.0855334 0.460385 0.00161556 -250.943 44.0661 4.48539 2.83327 2.76925 0.792742 0.53978 0.606497 0.641876 0.563065 3.91275e-13 -0.563065 -0.641876 -0.606497 -0.53978 -0.792742 -2.76925 -2.83327 -4.48539 -44.0661 rock
9460.0773527 0.435659 0.00117813 -259.154 43.0893 0.207452 2.82832 11.3831 1.84227 0.569678 1.41105 -0.119626 -0.615835 3.99979e-13 0.615835 0.119626 -1.41105 -0.569678 -1.84227 -11.3831 -2.82832 -0.207452 -43.0893 rock
9470.135853 0.669056 0.00188786 -232.86 40.0148 -3.33274 0.562014 0.0793653 1.02395 1.99133 0.513071 -0.295783 -0.762635 3.62766e-13 0.762635 0.295783 -0.513071 -1.99133 -1.02395 -0.0793653 -0.562014 3.33274 -40.0148 rock
9480.157265 0.615825 0.00179514 -233.977 34.6651 -5.74267 4.11756 5.19653 2.43298 0.37934 0.558842 0.54899 0.0635085 3.5756e-13 -0.0635085 -0.54899 -0.558842 -0.37934 -2.43298 -5.19653 -4.11756 5.74267 -34.6651 rock
9490.0865004 0.537124 0.00196231 -241.532 49.8791 -3.26768 -0.507636 5.17309 -0.501246 2.69368 0.131718 1.05157 0.467291 3.86157e-13 -0.467291 -1.05157 -0.131718 -2.69368 0.501246 -5.17309 0.507636 3.26768 -49.8791 rock
9500.0543928 0.426954 0.000738257 -272.313 41.5003 10.4537 0.751055 2.33121 1.0591 -0.842993 -0.77362 0.831672 1.51558 4.17708e-13 -1.51558 -0.831672 0.77362 0.842993 -1.0591 -2.33121 -0.751055 -10.4537 -41.5003 rock
9510.100632 0.534799 0.00217827 -246.418 40.8623 5.45073 6.4737 2.63559 0.761379 0.361585 1.50209 0.861335 -0.0247017 3.7957e-13 0.0247017 -0.861335 -1.50209 -0.361585 -0.761379 -2.63559 -6.4737 -5.45073 -40.8623 rock
9520.160866 0.573048 0.00202263 -232.533 32.8127 1.96342 9.2283 1.24975 -0.382642 -0.128703 0.547211 0.469218 -0.409988 3.50082e-13 0.409988 -0.469218 -0.547211 0.128703 0.382642 -1.24975 -9.2283 -1.96342 -32.8127 rock
9530.0976949 0.570991 0.00227858 -241.804 46.7247 4.43788 2.45262 3.80427 2.86487 -2.35058 0.886194 0.44385 -1.83891 3.81565e-13 1.83891 -0.44385 -0.886194 2.35058 -2.86487 -3.80427 -2.45262 -4.43788 -46.7247 rock
9540.181495 0.643254 0.00236625 -217.59 30.333 -5.88948 3.65922 1.98336 3.81083 1.10284 0.988782 0.601748 0.315929 3.31408e-13 -0.315929 -0.601748 -0.988782 -1.10284 -3.81083 -1.98336 -3.65922 5.88948 -30.333 rock
9550.145849 0.592031 0.000846489 -251.545 36.2229 -1.19875 0.22562 0.974302 2.28955 1.26541 1.25198 0.168464 0.240984 3.84276e-13 -0.240984 -0.168464 -1.25198 -1.26541 -2.28955 -0.974302 -0.22562 1.19875 -36.2229 rock
9560.0873735 0.606147 0.00180645 -247.898 45.425 5.68689 2.55091 0.957446 1.46658 -0.246072 -0.42078 0.459736 -0.116632 3.88884e-13 0.116632 -0.459736 0.42078 0.246072 -1.46658 -0.957446 -2.55091 -5.68689 -45.425 rock
9570.174393 0.596255 0.00218861 -223.128 30.5017 -2.94344 7.39168 2.79673 1.60556 1.31632 -0.34583 0.154298 0.574358 3.36959e-13 -0.574358 -0.154298 0.34583 -1.31632 -1.60556 -2.79673 -7.39168 2.94344 -30.5017 rock
9580.173593 0.659156 0.0016521 -231.839 32.1769 1.74274 4.1068 -2.78131 2.02604 0.664663 0.800745 -0.0304939 0.616124 3.52348e-13 -0.616124 0.0304939 -0.800745 -0.664663 -2.02604 2.78131 -4.1068 -1.74274 -32.1769 rock
9590.135913 0.531859 0.0012108 -247.959 37.5871 5.97172 4.42126 -2.37224 0.0274939 -0.0120651 0.0997242 0.833387 -0.248468 3.78188e-13 0.248468 -0.833387 -0.0997242 0.0120651 -0.0274939 2.37224 -4.42126 -5.97172 -37.5871 rock
9600.109743 0.461183 0.000744436 -267.383 36.1584 11.2235 5.30243 -0.880353 0.440825 0.43125 1.00557 0.532961 0.0583297 4.01904e-13 -0.0583297 -0.532961 -1.00557 -0.43125 -0.440825 0.880353 -5.30243 -11.2235 -36.1584 rock
9610.143444 0.676505 0.00138932 -240.018 37.6056 0.60571 1.37894 -1.61868 1.63998 0.34244 1.13945 -0.314846 0.136334 3.70407e-13 -0.136334 0.314846 -1.13945 -0.34244 -1.63998 1.61868 -1.37894 -0.60571 -37.6056 rock
9620.111036 0.5484 0.00122655 -256.901 39.025 9.5161 7.31026 0.593187 0.304728 0.0100846 -0.600269 -0.996822 -0.592672 3.90824e-13 0.592672 0.996822 0.600269 -0.0100846 -0.304728 -0.593187 -7.31026 -9.5161 -39.025 rock
9630.155673 0.580359 0.000843309 -262.031 31.5428 7.4204 7.25855 0.0665211 0.839485 -0.59472 -0.165795 -0.427788 0.0413431 3.8942e-13 -0.0413431 0.427788 0.165795 0.59472 -0.839485 -0.0665211 -7.25855 -7.4204 -31.5428 rock
9640.0705121 0.354909 0.000632901 -283.118 31.2359 16.8039 9.73823 4.26077 2.84412 0.110238 -0.833941 -0.404831 -0.207328 4.15282e-13 0.207328 0.404831 0.833941 -0.110238 -2.84412 -4.26077 -9.73823 -16.8039 -31.2359 rock
9650.123573 0.632349 0.00114685 -252.87 37.523 -0.760858 4.03578 1.82456 1.462 5.62379 -0.519481 1.93237 0.23678 3.84453e-13 -0.23678 -1.93237 0.519481 -5.62379 -1.462 -1.82456 -4.03578 0.760858 -37.523 rock
9660.127223 0.629105 0.0013768 -242.09 38.6869 -5.49032 3.96117 4.00773 -1.89255 3.20924 -1.53321 1.80694 -0.345614 3.7024e-13 0.345614 -1.80694 1.53321 -3.20924 1.89255 -4.00773 -3.96117 5.49032 -38.6869 rock
9670.120327 0.566241 0.000248604 -288.118 23.014 5.80002 5.63047 5.40609 2.84553 0.675202 -1.53339 -0.361779 0.163441 4.14099e-13 -0.163441 0.361779 1.53339 -0.675202 -2.84553 -5.40609 -5.63047 -5.80002 -23.014 rock
9680.138235 0.684858 0.00113687 -245.495 36.4391 -4.03438 4.59572 4.14612 0.280895 1.67021 -2.94677 1.45845 -0.729933 3.72523e-13 0.729933 -1.45845 2.94677 -1.67021 -0.280895 -4.14612 -4.59572 4.03438 -36.4391 rock
9690.134063 0.617065 0.00116902 -245.976 36.046 -2.90312 6.74412 4.43534 0.337093 3.10616 -1.69968 2.16542 -0.740374 3.71461e-13 0.740374 -2.16542 1.69968 -3.10616 -0.337093 -4.43534 -6.74412 2.90312 -36.046 rock
9700.128136 0.59611 0.000555128 -263.54 33.6042 0.886999 5.90614 4.84936 0.0298679 0.335137 -2.30606 0.327465 -0.430153 3.93061e-13 0.430153 -0.327465 2.30606 -0.335137 -0.0298679 -4.84936 -5.90614 -0.886999 -33.6042 rock
9710.134385 0.652554 0.000747227 -257.421 33.7186 -3.42034 5.9306 6.99343 0.405514 3.12438 -1.57704 -0.192035 -0.539963 3.84943e-13 0.539963 0.192035 1.57704 -3.12438 -0.405514 -6.99343 -5.9306 3.42034 -33.7186 rock
9720.113778 0.602095 0.00193527 -241.248 39.545 -1.99576 6.41045 4.03269 -1.08547 3.73102 -0.855391 1.5893 -0.378517 3.6945e-13 0.378517 -1.5893 0.855391 -3.73102 1.08547 -4.03269 -6.41045 1.99576 -39.545 rock
9730.0988421 0.534451 0.00200322 -246.342 40.6528 3.24602 8.13597 3.6737 0.0510291 3.3559 -1.21747 1.10622 -0.806515 3.76942e-13 0.806515 -1.10622 1.21747 -3.3559 -0.0510291 -3.6737 -8.13597 -3.24602 -40.6528 rock
9740.117297 0.590023 0.00227608 -233.377 40.7166 -2.36016 6.14506 2.9235 -0.789289 4.47111 -1.63489 1.93008 -0.633565 3.60177e-13 0.633565 -1.93008 1.63489 -4.47111 0.789289 -2.9235 -6.14506 2.36016 -40.7166 rock
9750.110498 0.531522 0.00199852 -240.51 41.1504 -1.71302 7.49374 5.04634 -2.23989 3.88249 -0.991341 0.433522 -0.627064 3.69704e-13 0.627064 -0.433522 0.991341 -3.88249 2.23989 -5.04634 -7.49374 1.71302 -41.1504 rock
9760.12102 0.599793 0.0015629 -246.312 36.9199 -0.253734 7.52945 3.98577 -0.490891 4.55324 -0.884816 0.971402 -0.912161 3.72253e-13 0.912161 -0.971402 0.884816 -4.55324 0.490891 -3.98577 -7.52945 0.253734 -36.9199 rock
9770.0954557 0.529532 0.0019229 -247.156 42.1775 2.06243 5.88733 4.75835 0.119684 3.16203 -1.15551 0.507807 -0.401265 3.81216e-13 0.401265 -0.507807 1.15551 -3.16203 -0.119684 -4.75835 -5.88733 -2.06243 -42.1775 rock
9780.114518 0.539076 0.00155598 -249.668 36.6287 1.37462 7.579 3.90695 1.25223 3.36756 -0.768772 2.65533 -0.278618 3.77119e-13 0.278618 -2.65533 0.768772 -3.36756 -1.25223 -3.90695 -7.579 -1.37462 -36.6287 rock
9790.094156 0.453308 0.00161848 -255.716 39.6854 6.76289 7.91676 2.6201 0.0120129 4.70203 0.810675 0.737197 -0.725741 3.88141e-13 0.725741 -0.737197 -0.810675 -4.70203 -0.0120129 -2.6201 -7.91676 -6.76289 -39.6854 rock
9800.112084 0.641497 0.00146989 -243.1 42.2222 -2.03793 4.13984 3.35082 -1.5029 2.80479 -1.36579 0.863655 -0.578422 3.76069e-13 0.578422 -0.863655 1.36579 -2.80479 1.5029 -3.35082 -4.13984 2.03793 -42.2222 rock
9810.13429 0.632706 0.00124824 -240.92 37.8832 -5.76493 3.66054 2.68868 -2.67114 2.37475 -1.78802 1.07592 -1.78546 3.66697e-13 1.78546 -1.07592 1.78802 -2.37475 2.67114 -2.68868 -3.66054 5.76493 -37.8832 rock
9820.152947 0.635659 0.0010401 -249.629 33.6116 -4.64965 4.28175 2.96822 -2.06659 1.7795 -2.18071 0.323634 -1.64073 3.73457e-13 1.64073 -0.323634 2.18071 -1.7795 2.06659 -2.96822 -4.28175 4.64965 -33.6116 rock
9830.15861 0.665271 0.00110826 -243.515 32.2345 -5.73138 4.82718 2.35547 -1.95534 2.39647 -1.74952 2.01009 -1.63754 3.62891e-13 1.63754 -2.01009 1.74952 -2.39647 1.95534 -2.35547 -4.82718 5.73138 -32.2345 rock
9840.113076 0.551105 0.00132872 -248.055 39.2637 0.0761555 7.48816 5.22091 0.148666 2.27333 -1.83701 0.969586 -1.09005 3.77835e-13 1.09005 -0.969586 1.83701 -2.27333 -0.148666 -5.22091 -7.48816 -0.0761555 -39.2637 rock
9850.137163 0.603479 0.00133472 -241.648 36.7693 -2.0066 5.73858 2.5403 -0.2338 2.80044 -2.60093 0.643024 -1.52138 3.66597e-13 1.52138 -0.643024 2.60093 -2.80044 0.2338 -2.5403 -5.73858 2.0066 -36.7693 rock
9860.124401 0.574221 0.000543053 -265.261 33.8581 -0.397174 1.66079 2.84629 -0.396966 0.766069 -0.525266 0.542438 -0.287652 3.97144e-13 0.287652 -0.542438 0.525266 -0.766069 0.396966 -2.84629 -1.66079 0.397174 -33.8581 rock
9870.136891 0.682171 0.00146378 -237.999 39.2607 -8.24119 1.68717 4.91554 -0.737712 2.80452 -2.23633 0.201973 -1.16025 3.6664e-13 1.16025 -0.201973 2.23633 -2.80452 0.737712 -4.91554 -1.68717 8.24119 -39.2607 rock
9880.122686 0.617131 0.00211737 -230.419 41.5376 -5.86112 2.58527 3.29315 1.12069 3.23174 -2.8721 2.40276 -0.991595 3.58987e-13 0.991595 -2.40276 2.8721 -3.23174 -1.12069 -3.29315 -2.58527 5.86112 -41.5376 rock
9890.138027 0.623409 0.00104434 -247.621 36.9439 -8.88485 -0.597965 3.40569 -1.45942 2.22497 -1.57927 0.578077 -0.225215 3.78145e-13 0.225215 -0.578077 1.57927 -2.22497 1.45942 -3.40569 0.597965 8.88485 -36.9439 rock
9900.0807171 0.538055 0.00126745 -257.276 43.3786 2.9635 1.90889 3.21005 -0.112955 2.03614 0.671825 1.13208 0.322296 3.98158e-13 -0.322296 -1.13208 -0.671825 -2.03614 0.112955 -3.21005 -1.90889 -2.9635 -43.3786 rock
9910.14625 0.636927 0.00146492 -239.884 36.6069 -4.03836 6.67797 3.12355 -3.97631 2.95547 -2.43981 1.51598 -0.0320681 3.63437e-13 0.0320681 -1.51598 2.43981 -2.95547 3.97631 -3.12355 -6.67797 4.03836 -36.6069 rock
9920.133894 0.603083 0.00141486 -236.849 39.7073 -6.72475 2.35293 3.79891 -0.761122 2.17569 -1.50215 2.28587 -1.46787 3.64515e-13 1.46787 -2.28587 1.50215 -2.17569 0.761122 -3.79891 -2.35293 6.72475 -39.7073 rock
9930.132126 0.620745 0.00134912 -237.468 40.8549 -8.32371 1.73306 4.5545 -0.391353 2.51712 -2.21706 1.42998 -1.30131 3.67575e-13 1.30131 -1.42998 2.21706 -2.51712 0.391353 -4.5545 -1.73306 8.32371 -40.8549 rock
9940.0989053 0.516714 0.00137439 -246.452 46.1055 -3.28948 -0.509182 4.9196 0.870979 1.00866 -0.964509 1.14892 -0.541831 3.87898e-13 0.541831 -1.14892 0.964509 -1.00866 -0.870979 -4.9196 0.509182 3.28948 -46.1055 rock
9950.141747 0.505424 0.00152927 -234.32 39.0936 -10.6591 1.3182 5.65535 1.37615 4.51862 -0.96036 2.78813 -0.567454 3.61959e-13 0.567454 -2.78813 0.96036 -4.51862 -1.37615 -5.65535 -1.3182 10.6591 -39.0936 rock
9960.104858 0.474224 0.000894387 -257.282 40.3755 0.630119 3.20409 5.57718 1.27987 0.0222821 -1.52561 0.198128 -1.10505 3.93848e-13 1.10505 -0.198128 1.52561 -0.0222821 -1.27987 -5.57718 -3.20409 -0.630119 -40.3755 rock
9970.101611 0.434367 0.000685883 -263.839 37.0731 2.1907 3.02942 4.06306 1.70956 1.19553 -1.05966 1.04912 0.461206 3.99707e-13 -0.461206 -1.04912 1.05966 -1.19553 -1.70956 -4.06306 -3.02942 -2.1907 -37.0731 rock
9980.0983492 0.545506 0.000963054 -255.357 41.4589 -1.55913 2.21569 6.4681 0.886297 1.24589 0.0749153 1.03098 0.490922 3.93923e-13 -0.490922 -1.03098 -0.0749153 -1.24589 -0.886297 -6.4681 -2.21569 1.55913 -41.4589 rock
9990.0706691 0.441445 0.00126853 -262.965 41.96 5.26274 4.36084 8.18109 5.05453 2.3438 -0.470763 -0.571053 -1.3644 4.03437e-13 1.3644 0.571053 0.470763 -2.3438 -5.05453 -8.18109 -4.36084 -5.26274 -41.96 rock
10000.0801609 0.347525 0.000721008 -268.113 35.709 3.18429 1.57404 4.13285 2.97524 3.6099 0.989195 1.10961 0.0294553 4.03696e-13 -0.0294553 -1.10961 -0.989195 -3.6099 -2.97524 -4.13285 -1.57404 -3.18429 -35.709 rock
examples/ai/genre-classify/feature-extract.ck+212−0
@@ -0,0 +1,212 @@
1//---------------------------------------------------------------------
2// name: feature-extract.ck
3// desc: sets up automated extraction over a training dataset
4// this example can be adapted to other labeled audio dataset
5//
6// version: need chuck version 1.4.2.1 or higher
7// sorting: part of ChAI (ChucK for AI)
8//
9// DATA: by default, this uses the GTZAN dataset:
10// download and unzip updated version:
11// https://chuck.stanford.edu/chai/data/gtzan/
12//
13// USAGE: this is purely for feature extraction on training data, so...
14// run chuck in non-real-time mode (this actually can be much
15// faster than real-time mode, since it doesn't synch to audio):
16//
17// extract and print
18// > chuck --silent 2-extract.ck
19//
20// extract and write to FILE
21// > chuck --silent 2-extract.ck:FILE
22//
23// date: Spring 2023
24// authors: Ge Wang (https://ccrma.stanford.edu/~ge/)
25// Yikai Li
26//---------------------------------------------------------------------
27
28
29// output file (if empty, will print to console)
30"" => string OUTPUT_FILE;
31// get from arguments
32if( me.args() > 0 ) me.arg(0) => OUTPUT_FILE;
33
34// check
35if( Machine.silent() == false )
36{
37 // print helpful message
38 <<< "-----------------", "" >>>;
39 <<< "[feature-extract]: chuck is currently running in REAL-TIME mode;", "" >>>;
40 <<< "[feature-extract]: this step has no audio; may run much faster in SILENT mode!", "" >>>;
41 <<< "[feature-extract]: to run in SILENT mode, restart chuck with --silent flag", "" >>>;
42 <<< "-----------------", "" >>>;
43}
44
45
46//---------------------------------------------------------------------
47// analysis network -- this determines which feature will be extracted
48//---------------------------------------------------------------------
49// audio input into a FFT
50SndBuf audioFile => FFT fft;
51// a thing for collecting multiple features into one vector
52FeatureCollector combo => blackhole;
53// add spectral feature: Centroid
54fft =^ Centroid centroid =^ combo;
55// add spectral feature: Flux
56fft =^ Flux flux =^ combo;
57// add spectral feature: RMS
58fft =^ RMS rms =^ combo;
59// add spectral feature: MFCC
60fft =^ MFCC mfcc =^ combo;
61
62
63//---------------------------------------------------------------------
64// setting analysis parameters -- important for tuning your extraction
65//---------------------------------------------------------------------
66// set number of coefficients in MFCC (how many we get out)
67// 13 is a commonly used value; using less here for printing
6820 => mfcc.numCoeffs;
69// set number of mel filters in MFCC
7010 => mfcc.numFilters;
71
72// do one .upchuck() so FeatureCollector knows how many total dimension
73combo.upchuck();
74// get number of total feature dimensions
75combo.fvals().size() => int NUM_DIMENSIONS;
76
77// set FFT size
782048 => fft.size;
79// set window type and size
80Windowing.hann(fft.size()) => fft.window;
81// our hop size (how often to perform analysis)
822048::samp => dur HOP;
83
84
85//---------------------------------------------------------------------
86// training data -- preparation specific to a train dataset
87//---------------------------------------------------------------------
88// labels (and filename roots)
89["blues", "classical", "country", "disco", "hiphop",
90 "jazz", "metal", "pop", "reggae", "rock"] @=> string labels[];
91// how many per label
92100 => int NUM_EXAMPLES_PER_LABEL;
93// how much time to aggregate features for each file
9410::second => dur EXTRACT_TIME;
95// given EXTRACT_TIME and HOP, how many frames per file?
96(EXTRACT_TIME / HOP) $ int => int numFrames;
97// relative path
98"data/gtzan/genres_original/" => string PATH;
99
100// a feature frame
101float featureFrame[NUM_DIMENSIONS];
102// how many input files
1030 => int NUM_FILES;
104
105// output reference, default is error stream (cherr)
106cherr @=> IO @ theOut;
107// instantiate
108FileIO fout;
109// output file
110if( OUTPUT_FILE != "" )
111{
112 // print
113 <<< "opening file for output:", OUTPUT_FILE >>>;
114 // open
115 fout.open( OUTPUT_FILE, FileIO.WRITE );
116 // test
117 if( !fout.good() )
118 {
119 <<< "cannot open file for writing...", "" >>>;
120 me.exit();
121 }
122 // override
123 fout @=> theOut;
124}
125
126
127//---------------------------------------------------------------------
128// extraction -- iterating over entire training dataset
129//---------------------------------------------------------------------
130
131// filename
132string filename;
133// loop over labels
134for( int i; i < labels.cap(); i++)
135{
136 // get current label
137 labels[i] => string label;
138 // loop over examples under each label
139 for( int j; j < NUM_EXAMPLES_PER_LABEL; j++ )
140 {
141 // construct filepath
142 me.dir() + PATH + label + "/" + label + ".000" + (j<10?"0":"") + j + ".wav" => filename;
143 // extract the file
144 if( !extractFeatures( filename, label, theOut ) )
145 {
146 // issue warning
147 cherr <= "PROBLEM during extraction: " <= filename <= IO.newline();
148 // bail out
149 me.exit();
150 }
151 }
152}
153
154
155//---------------------------------------------------------------------
156// function: extract and print features from a single file
157//---------------------------------------------------------------------
158fun int extractFeatures( string inputFilePath, string label, IO out )
159{
160 // increment
161 NUM_FILES++;
162 // log
163 cherr <= "[" <= NUM_FILES <= "] extracting features: " <= inputFilePath <= IO.newline();
164
165 // load by block to speed up IO
166 2048 => audioFile.chunks;
167 // read the audio file
168 inputFilePath => audioFile.read;
169 // zero out
170 featureFrame.zero();
171
172 // let one FFT-size of time pass (to buffer)
173 fft.size()::samp => now;
174 // loop over frames
175 for( int i; i < numFrames; i++ )
176 {
177 //-------------------------------------------------------------
178 // a single upchuck() will trigger analysis on everything
179 // connected upstream from combo via the upchuck operator (=^)
180 // the total number of output dimensions is the sum of
181 // dimensions of all the connected unit analyzers
182 //-------------------------------------------------------------
183 combo.upchuck();
184 // for each dimension
185 for( int d; d < NUM_DIMENSIONS; d++ )
186 {
187 // copy
188 combo.fval(d) +=> featureFrame[d];
189 }
190 // advance time
191 HOP => now;
192 }
193
194 //-------------------------------------------------------------
195 // average into a single feature vector per file
196 // NOTE: this can be easily modified to N feature vectors
197 // spread out over the length of an audio file; for now
198 // we will just do one feature vector per file
199 //-------------------------------------------------------------
200 for( int d; d < NUM_DIMENSIONS; d++ )
201 {
202 // average by total number of frames
203 numFrames /=> featureFrame[d];
204 // print the MFCC results
205 out <= featureFrame[d] <= " ";
206 }
207 // print label name and endline
208 out <= label <= IO.newline();
209
210 // done
211 return true;
212}
examples/ai/genre-classify/genre-classify.ck+338−0
@@ -0,0 +1,338 @@
1//------------------------------------------------------------------------------
2// name: genre-classify.ck
3// desc: a real-time genre-classifier using the features extracted using
4// GTZAN dataset + features-extract.ck
5//
6// version: need chuck version 1.4.2.1 or higher
7// sorting: part of ChAI (ChucK for AI)
8//
9// USAGE: run in any real-time mode (default)
10// > chuck classify-genres.ck
11//
12// uncomment the next line to learn more about the KNN2 object:
13// KNN2.help();
14//
15// date: Spring 2023
16// authors: Ge Wang (https://ccrma.stanford.edu/~ge/)
17// Yikai Li
18//------------------------------------------------------------------------------
19
20// input: pre-extracted features file with labels
21me.dir() + "data/gtzan-23.txt" => string FEATURES_FILE;
22// if have arguments, override filename
23if( me.args() > 0 ) me.arg(0) => FEATURES_FILE;
24//------------------------------------------------------------------------------
25// expected features file format:
26//------------------------------------------------------------------------------
27// VALUE VALUE ... VALUE LABEL
28// VALUE VALUE ... VALUE LABEL
29// ... ... ... ... LABEL
30// VALUE VALUE ... VALUE LABEL
31//------------------------------------------------------------------------------
32
33
34//------------------------------------------------------------------------------
35// unit analyzer network: this must match the features in the features file
36//------------------------------------------------------------------------------
37// audio input into a FFT
38adc => FFT fft;
39// a thing for collecting multiple features into one vector
40FeatureCollector combo => blackhole;
41// add spectral feature: Centroid
42fft =^ Centroid centroid =^ combo;
43// add spectral feature: Flux
44fft =^ Flux flux =^ combo;
45// add spectral feature: RMS
46fft =^ RMS rms =^ combo;
47// add spectral feature: MFCC
48fft =^ MFCC mfcc =^ combo;
49
50
51//-----------------------------------------------------------------------------
52// setting analysis parameters -- also should match what was used during extration
53//-----------------------------------------------------------------------------
54// set number of coefficients in MFCC (how many we get out)
55// 13 is a commonly used value; using less here for printing
5620 => mfcc.numCoeffs;
57// set number of mel filters in MFCC
5810 => mfcc.numFilters;
59
60// do one .upchuck() so FeatureCollector knows how many total dimension
61combo.upchuck();
62// get number of total feature dimensions
63combo.fvals().size() => int NUM_DIMENSIONS;
64
65// set FFT size
662048 => fft.size;
67// set window type and size
68Windowing.hann(fft.size()) => fft.window;
69// our hop size (how often to perform analysis)
702048::samp => dur HOP;
71
72
73//------------------------------------------------------------------------------
74// load feature data; read important global values like numPoints and numCoeffs
75//------------------------------------------------------------------------------
76// values to be read from file
770 => int numPoints; // number of points in data
780 => int numCoeffs; // number of dimensions in data
79// file read PART 1: read over the file to get numPoints and numCoeffs
80loadFile( FEATURES_FILE ) @=> FileIO @ fin;
81// check
82if( !fin.good() ) me.exit();
83// check dimension
84if( numCoeffs != NUM_DIMENSIONS )
85{
86 // error
87 <<< "[error] expecting:", NUM_DIMENSIONS, "dimensions; but features file has:", numCoeffs >>>;
88 // stop
89 me.exit();
90}
91
92// labels of all data points
93string inLabels[numPoints];
94// label indices of all data points
95int inLabelsInt[inLabels.size()];
96// feature vectors of data points
97float inFeatures[numPoints][numCoeffs];
98// keys
99string labels[0];
100// use as map: labels to numbers
101int label2int[0];
102
103//------------------------------------------------------------------------------
104// array for storing features
105//------------------------------------------------------------------------------
106// how much time to aggregate features for each file
107// (this does not need to match extraction; might play with this number)
108.5::second => dur EXTRACT_TIME;
109// given EXTRACT_TIME and HOP, how many frames per file?
110(EXTRACT_TIME / HOP) $ int => int numFrames;
111
112// use this for new input
113float features[numFrames][numCoeffs];
114// average values of coefficients across frames
115float featureMean[numCoeffs];
116// for printing
117int lengths[0];
118// for printing (how much to indent)
119int indents[0];
120
121
122//------------------------------------------------------------------------------
123// read the data
124//------------------------------------------------------------------------------
125readData( fin );
126
127
128//------------------------------------------------------------------------------
129// set up our KNN object to use for classification
130// (KNN2 is a fancier version of the KNN object)
131// -- run KNN2.help(); in a separate program to see its available functions --
132//------------------------------------------------------------------------------
133KNN2 knn;
134// k nearest neighbors
13510 => int K;
136// results vector
137float knnResult[labels.size()];
138// knn train
139knn.train( inFeatures, inLabelsInt );
140
141
142
143
144//------------------------------------------------------------------------------
145// real-time classification loop
146//------------------------------------------------------------------------------
147while( true )
148{
149 // aggregate features over a period of time
150 for( int frame; frame < numFrames; frame++ )
151 {
152 //-------------------------------------------------------------
153 // a single upchuck() will trigger analysis on everything
154 // connected upstream from combo via the upchuck operator (=^)
155 // the total number of output dimensions is the sum of
156 // dimensions of all the connected unit analyzers
157 //-------------------------------------------------------------
158 combo.upchuck();
159 // get features
160 for( int d; d < NUM_DIMENSIONS; d++)
161 {
162 // store them in current frame
163 combo.fval(d) => features[frame][d];
164 }
165 // advance time
166 HOP => now;
167 }
168
169 // compute means for each coefficient across frames
170 for( int d; d < NUM_DIMENSIONS; d++ )
171 {
172 // zero out
173 0.0 => featureMean[d];
174 // loop over frames
175 for( int j; j < numFrames; j++ )
176 {
177 // add
178 features[j][d] +=> featureMean[d];
179 }
180 // average
181 numFrames /=> featureMean[d];
182 }
183
184 //-------------------------------------------------
185 // predict using KNN2; results filled in knnResults
186 //-------------------------------------------------
187 knn.predict( featureMean, K, knnResult );
188
189 // print results
190 chout <= "-------------------------------------------------" <= IO.newline();
191 // print for each label
192 for( int i; i < knnResult.size(); i++ )
193 {
194 // print label
195 chout <= labels[i] <= ":";
196 // print indentatation
197 for( int ii; ii < indents[i]; ii++ ) { chout <= " "; }
198 // print probability
199 chout <= knnResult[i] <= IO.newline();
200 }
201}
202//------------------------------------------------------------------------------
203// end of real-time classification loop
204//------------------------------------------------------------------------------
205
206
207
208
209//------------------------------------------------------------------------------
210// function: load data file
211//------------------------------------------------------------------------------
212fun FileIO loadFile( string filepath )
213{
214 // reset
215 0 => numPoints;
216 0 => numCoeffs;
217
218 // load data
219 FileIO fio;
220 if( !fio.open( filepath, FileIO.READ ) )
221 {
222 // error
223 <<< "cannot open file:", filepath >>>;
224 // close
225 fio.close();
226 // return
227 return fio;
228 }
229
230 string str;
231 string line;
232 // read file int array
233 while( fio.more() )
234 {
235 // read each line
236 fio.readLine().trim() => str;
237 // check if empty line
238 if( str != "" )
239 {
240 numPoints++;
241 str => line;
242 }
243 }
244
245 // a string tokenizer
246 StringTokenizer tokenizer;
247 // set to last non-empty line
248 tokenizer.set( line );
249 // -1 (to account for label)
250 -1 => numCoeffs;
251 // see how many, including label name
252 while( tokenizer.more() )
253 {
254 tokenizer.next();
255 numCoeffs++;
256 }
257
258 // check
259 if( numPoints == 0 || numCoeffs <= 0 )
260 {
261 <<< "no data in file:", filepath >>>;
262 fio.close();
263 return fio;
264 }
265
266 // print
267 <<< "# of data points:", numPoints, "dimensions:", numCoeffs >>>;
268
269 // done for now
270 return fio;
271}
272
273
274//------------------------------------------------------------------------------
275// function: read the data
276//------------------------------------------------------------------------------
277fun void readData( FileIO fio )
278{
279 // rewind the file reader
280 fio.seek( 0 );
281
282 // read file int array
283 string str;
284 int ci, ri;
285 while( fio => str )
286 {
287 // check for last
288 if( (ci != 0) && ((ci % numCoeffs) == 0) )
289 {
290 // read in label
291 str => inLabels[ri];
292 // set in map
293 1 => label2int[str];
294 // increment row
295 ri++;
296 // reset column
297 0 => ci;
298 }
299 else
300 {
301 // store feature value
302 Std.atof(str) => inFeatures[ri][ci];
303 // increment column
304 ci++;
305 }
306 }
307
308 // get keys from map
309 label2int.getKeys( labels );
310 // assign index
311 for( int i; i < labels.size(); i++ )
312 { i => label2int[labels[i]]; }
313 // convert in labels to ints
314 for( int i; i < inLabels.size(); i++ )
315 {
316 // get index as int
317 label2int[inLabels[i]] => inLabelsInt[i];
318 }
319
320 // max length
321 0 => int maxLength;
322 // get lengths of label names for printing
323 for( int i; i < labels.size(); i++ )
324 {
325 // compare with max length
326 if( labels[i].length() > maxLength )
327 labels[i].length() => maxLength;
328 // append to array
329 lengths << labels[i].length();
330 }
331
332 // get lengths of label names for printing
333 for( int i; i < lengths.size(); i++ )
334 {
335 // get indent for length
336 indents << (maxLength + 1 ) - lengths[i];
337 }
338}
examples/ai/genre-classify/x-validate.ck+323−0
@@ -0,0 +1,323 @@
1//------------------------------------------------------------------------------
2// name: x-validate.ck
3// desc: a cross validation example using extracted features
4//
5// version: need chuck version 1.4.2.1 or higher
6// sorting: part of ChAI (ChucK for AI)
7//
8// USAGE: this is purely for cross validation on extracted features, so ...
9// run chuck in non-real-time mode (this actually can be much
10// faster than real-time mode, since it doesn't synch to audio):
11//
12// cross validation from FILE
13// > chuck --silent x-validate.ck:FILE
14//
15// date: Spring 2023
16// authors: Yikai Li
17// Ge Wang (https://ccrma.stanford.edu/~ge/)
18//------------------------------------------------------------------------------
19
20// input: pre-extracted features file with labels
21"" => string FEATURES_FILE;
22// if have arguments, override filename
23if( me.args() > 0 ) me.arg(0) => FEATURES_FILE;
24else
25{ <<< "[usage]: chuck --silent x-validate:FILE", "" >>>; me.exit();}
26//------------------------------------------------------------------------------
27// expected features file format:
28//------------------------------------------------------------------------------
29// VALUE VALUE ... VALUE LABEL
30// VALUE VALUE ... VALUE LABEL
31// ... ... ... ... LABEL
32// VALUE VALUE ... VALUE LABEL
33//------------------------------------------------------------------------------
34
35
36//------------------------------------------------------------------------------
37// load feature data; read important global values like numPoints and numCoeffs
38//------------------------------------------------------------------------------
39// values to be read from file
400 => int numPoints; // number of points in data
410 => int numCoeffs; // number of dimensions in data
42// file read PART 1: read over the file to get numPoints and numCoeffs
43loadFile( FEATURES_FILE ) @=> FileIO @ fin;
44// check
45if( !fin.good() ) me.exit();
46
47// labels of all data points
48string inLabels[numPoints];
49// label indices of all data points
50int inLabelsInt[inLabels.size()];
51// feature vectors of data points
52float inFeatures[numPoints][numCoeffs];
53// keys
54string labels[0];
55// use as map: labels to numbers
56int label2int[0];
57
58
59//------------------------------------------------------------------------------
60// read the data
61//------------------------------------------------------------------------------
62readData( fin );
63
64
65//------------------------------------------------------------------------------
66// set up our KNN object to use for classification
67// (KNN2 is a fancier version of the KNN object)
68// -- run KNN2.help(); in a separate program to see its available functions --
69//------------------------------------------------------------------------------
70KNN2 knn;
71// k nearest neighbors
7210 => int K;
73// results vector
74float knnResult[labels.size()];
75
76
77//------------------------------------------------------------------------------
78// cross validation
79//------------------------------------------------------------------------------
80// number of folds
8120 => int numFolds;
82// number of folds to use for testing
834 => int numTestFolds;
84// number of folds to use for training
85numFolds - numTestFolds => int numTrainFolds;
86// number of points in each fold
87(numPoints / numFolds) $ int => int numPointsPerFold;
88// feature vectors of training data
89float trainFeatures[numTrainFolds * numPointsPerFold][numCoeffs];
90// labels of training data
91int trainLabelsInt[numTrainFolds * numPointsPerFold];
92// feature vectors of testing data
93float testFeatures[numTestFolds * numPointsPerFold][numCoeffs];
94// labels of testing data
95int testLabelsInt[numTestFolds * numPointsPerFold];
96// normalize the data
97normalizeData();
98// shuffle the data
99shuffleData();
100// cross validation
101for( 0 => int i; i < numFolds / numTestFolds; i++)
102{
103 // prepare training and testing data
104 prepareData( i );
105 // train
106 knn.train( trainFeatures, trainLabelsInt );
107 // test
108 0.0 => float accuracy;
109 for( 0 => int j; j < testLabelsInt.size(); j++ )
110 {
111 // predict
112 knn.predict( testFeatures[j], K, knnResult );
113 // aggregate accuracy
114 knnResult[ testLabelsInt[j] ] +=> accuracy;
115 }
116 // print accuracy
117 chout <= "fold " + i + " accuracy: " + ( accuracy / testLabelsInt.size() ) <= IO.newline();
118}
119
120
121//------------------------------------------------------------------------------
122// function: normalizeData()
123//------------------------------------------------------------------------------
124fun void normalizeData()
125{
126 // for each dimension
127 for( 0 => int i; i < numCoeffs; i++ )
128 {
129 // find min and max
130 inFeatures[0][i] => float min;
131 inFeatures[0][i] => float max;
132 for( 1 => int j; j < numPoints; j++ )
133 {
134 if( inFeatures[j][i] < min ) inFeatures[j][i] => min;
135 if( inFeatures[j][i] > max ) inFeatures[j][i] => max;
136 }
137 max - min => float range;
138 // normalize
139 for( 0 => int j; j < numPoints; j++ )
140 (inFeatures[j][i] - min) / range => inFeatures[j][i];
141 }
142}
143
144
145//------------------------------------------------------------------------------
146// function: shuffleData()
147//------------------------------------------------------------------------------
148fun void shuffleData()
149{
150 // prepare swap data
151 float swapFeatures[numCoeffs];
152 int swapLabelInt;
153 // shuffle the data
154 for( numPoints - 1 => int i; i > 0; i-- )
155 {
156 // random index
157 Math.random2( 0, i ) => int j;
158 // swap features
159 for( 0 => int k; k < numCoeffs; k++ )
160 {
161 inFeatures[i][k] => swapFeatures[k];
162 inFeatures[j][k] => inFeatures[i][k];
163 swapFeatures[k] => inFeatures[j][k];
164 }
165 // swap labels
166 inLabelsInt[i] => swapLabelInt;
167 inLabelsInt[j] => inLabelsInt[i];
168 swapLabelInt => inLabelsInt[j];
169 }
170}
171
172
173//------------------------------------------------------------------------------
174// function: prepareData( int fold )
175//------------------------------------------------------------------------------
176fun void prepareData( int fold )
177{
178 // test indices
179 fold * numTestFolds * numPointsPerFold => int testStart;
180 testStart + numTestFolds * numPointsPerFold => int testEnd;
181 // index
182 0 => int train_i;
183 0 => int test_i;
184 // prepare training and testing data
185 for( 0 => int i; i < numPoints; i++ )
186 {
187 // test
188 if( i >= testStart && i < testEnd )
189 {
190 // copy features
191 for( 0 => int j; j < numCoeffs; j++ )
192 inFeatures[i][j] => testFeatures[test_i][j];
193 // copy label
194 inLabelsInt[i] => testLabelsInt[test_i];
195 // increment
196 test_i++;
197 }
198 // train
199 else
200 {
201 // copy features
202 for( 0 => int j; j < numCoeffs; j++ )
203 inFeatures[i][j] => trainFeatures[train_i][j];
204 // copy label
205 inLabelsInt[i] => trainLabelsInt[train_i];
206 // increment
207 train_i++;
208 }
209 }
210}
211
212
213//------------------------------------------------------------------------------
214// function: load data file
215//------------------------------------------------------------------------------
216fun FileIO loadFile( string filepath )
217{
218 // reset
219 0 => numPoints;
220 0 => numCoeffs;
221
222 // load data
223 FileIO fio;
224 if( !fio.open( filepath, FileIO.READ ) )
225 {
226 // error
227 <<< "cannot open file:", filepath >>>;
228 // close
229 fio.close();
230 // return
231 return fio;
232 }
233
234 string str;
235 string line;
236 // read file int array
237 while( fio.more() )
238 {
239 // read each line
240 fio.readLine().trim() => str;
241 // check if empty line
242 if( str != "" )
243 {
244 numPoints++;
245 str => line;
246 }
247 }
248
249 // a string tokenizer
250 StringTokenizer tokenizer;
251 // set to last non-empty line
252 tokenizer.set( line );
253 // -1 (to account for label)
254 -1 => numCoeffs;
255 // see how many, including label name
256 while( tokenizer.more() )
257 {
258 tokenizer.next();
259 numCoeffs++;
260 }
261
262 // check
263 if( numPoints == 0 || numCoeffs <= 0 )
264 {
265 <<< "no data in file:", filepath >>>;
266 fio.close();
267 return fio;
268 }
269
270 // print
271 <<< "# of data points:", numPoints, "dimensions:", numCoeffs >>>;
272
273 // done for now
274 return fio;
275}
276
277
278//------------------------------------------------------------------------------
279// function: read the data
280//------------------------------------------------------------------------------
281fun void readData( FileIO fio )
282{
283 // rewind the file reader
284 fio.seek( 0 );
285
286 // read file int array
287 string str;
288 int ci, ri;
289 while( fio => str )
290 {
291 // check for last
292 if( (ci != 0) && ((ci % numCoeffs) == 0) )
293 {
294 // read in label
295 str => inLabels[ri];
296 // set in map
297 1 => label2int[str];
298 // increment row
299 ri++;
300 // reset column
301 0 => ci;
302 }
303 else
304 {
305 // store feature value
306 Std.atof(str) => inFeatures[ri][ci];
307 // increment column
308 ci++;
309 }
310 }
311
312 // get keys from map
313 label2int.getKeys( labels );
314 // assign index
315 for( int i; i < labels.size(); i++ )
316 { i => label2int[labels[i]]; }
317 // convert in labels to ints
318 for( int i; i < inLabels.size(); i++ )
319 {
320 // get index as int
321 label2int[inLabels[i]] => inLabelsInt[i];
322 }
323}
examples/ai/hmm/hmm-load.ck+37−0
@@ -0,0 +1,37 @@
1//------------------------------------------------------------------------------
2// name: hmm-load.ck
3// desc: basic hidden markov model (HMM) usage example (using load)
4//
5// version: need chuck version 1.4.2.0 or higher
6// sorting: part of ChAI (ChucK for AI) [BETA]
7//
8// uncomment the next line to learn more about the KNN object:
9// HMM.help();
10//
11// author: Yikai Li
12// date: Spring 2023
13//------------------------------------------------------------------------------
14
15// init
16HMM hmm;
17
18// load
19[0.6, 0.2, 0.2] @=> float initial[];
20[[0.8, 0.1, 0.1],
21 [0.2, 0.7, 0.1],
22 [0.1, 0.3, 0.6]] @=> float transition[][];
23[[0.7, 0.0, 0.3],
24 [0.1, 0.9, 0.0],
25 [0.0, 0.2, 0.8]] @=> float emission[][];
26hmm.load( initial, transition, emission );
27
28// generate
29int observations[30];
30hmm.generate( 30, observations );
31
32// output
33for ( 0 => int i; i < observations.size(); i++ )
34{
35 chout <= observations[i] <= " ";
36}
37chout <= IO.newline();
examples/ai/hmm/hmm-train.ck+31−0
@@ -0,0 +1,31 @@
1//------------------------------------------------------------------------------
2// name: hmm-train.ck
3// desc: basic hidden markov model (HMM) usage example (using train)
4//
5// version: need chuck version 1.4.2.0 or higher
6// sorting: part of ChAI (ChucK for AI) [BETA]
7//
8// uncomment the next line to learn more about the KNN object:
9// HMM.help();
10//
11// author: Yikai Li
12// date: Spring 2023
13//------------------------------------------------------------------------------
14
15// init
16HMM hmm;
17
18// train
19[0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2] @=> int observations[];
20hmm.train( 2, 3, observations );
21
22// generate
23int results[30];
24hmm.generate( 30, results );
25
26// output
27for ( 0 => int i; i < results.size(); i++ )
28{
29 chout <= results[i] <= " ";
30}
31chout <= IO.newline();
examples/ai/knn/knn-search.ck+38−0
@@ -0,0 +1,38 @@
1//------------------------------------------------------------------------------
2// name: knn2-search.ck
3// desc: basic k-nearest-neighbor (k-NN) search example;
4//
5// version: need chuck version 1.4.2.1 or higher
6// sorting: part of ChAI (ChucK for AI) [BETA]
7//
8// uncomment the next line to learn more about the KNN object:
9// KNN.help();
10//
11// author: Yikai Li and Ge Wang
12// date: Spring 2023
13//------------------------------------------------------------------------------
14
15// create a KNN object
16KNN knn;
17
18// prepare data: using 2-dimensional feature space for this example;
19// in general, the feature space could be much higher
20[[0.0, 0.0],
21 [1.0, 1.0],
22 [2.0, 2.0]] @=> float features[][];
23// train the model
24knn.train( features );
25// optional: weigh feature dimensions
26[1.0, 1.0] @=> float weights[];
27// optional: set the weights across dimensions
28knn.weigh( weights );
29
30// provide a test query
31[0.5, 0.5] @=> float q[];
32
33// corresponding indices
34int neighbor_indices[0];
35
36// search
37knn.search( q, 2 , neighbor_indices );
38chout <= "query = ("+ q[0]+","+q[1]+"); k=2: ["+ neighbor_indices[0]+","+neighbor_indices[1]+"]" <= IO.newline();
examples/ai/knn/knn2-classify.ck+64−0
@@ -0,0 +1,64 @@
1//------------------------------------------------------------------------------
2// name: knn2-classify.ck
3// desc: k-nearest-neighbor (k-NN) classification example; it simulates a
4// simplified musical genre classification task where three labeled
5// categories are given respective locations in a 2D feature space.
6//
7// version: need chuck version 1.4.2.1 or higher
8// sorting: part of ChAI (ChucK for AI) [BETA]
9//
10// uncomment the next line to learn more about the KNN2 object:
11// KNN2.help();
12//
13// author: Yikai Li and Ge Wang
14// date: Spring 2023
15//------------------------------------------------------------------------------
16
17// create a k-NN classifier
18KNN2 knn;
19
20// prepare data: labels
21["classical", "pop", "rock"] @=> string labelNames[];
22// prepare data: using 2-dimensional feature space for this example;
23// in general, the feature space could be much higher
24[[0.0, 0.0],
25 [1.0, 1.0],
26 [2.0, 2.0]] @=> float features[][];
27// prepare data: corresponding IDs between labels and features
28[0, 1, 2] @=> int labels[];
29// number of labels
30labels.size() => int NUM_LABELS;
31// train the model
32knn.train( features, labels );
33// optional: weigh the feature dimensions
34[1.0, 1.0] @=> float weights[];
35// optional: set the weights across feature dimensions
36knn.weigh( weights );
37
38// provide an unlabeled test query
39[0.5, 0.5] @=> float q[];
40
41// predict with new query and k=1
42predict( q, 1 );
43// predict with the same query and k=2
44predict( q, 2 );
45
46// based on a new unlabeled test query and its distance to its
47// k nearest neighbors, predict and print the probabilities of
48// class membership NOTE: for the sake of the example, this
49// function assumes query has 2 dimensions
50fun void predict( float query[], int k )
51{
52 // how we get the data back
53 float prob[NUM_LABELS];
54
55 // predict with k nearest neighbors
56 knn.predict( query, k, prob );
57 // print
58 chout <= "query=(" + query[0] + "," + query[1] + "); k=" + k + ":" <= IO.newline();
59 for( 0 => int i; i < 3; i++ )
60 {
61 chout <= labelNames[i] + ": " + prob[i] <= IO.newline();
62 }
63 chout <= IO.newline();
64}
examples/ai/knn/knn2-search.ck+68−0
@@ -0,0 +1,68 @@
1//------------------------------------------------------------------------------
2// name: knn2-search.ck
3// desc: basic k-nearest-neighbor (k-NN) search example; it simulates a
4// simplified musical genre classification task where three labeled
5// categories are given respective locations in a 2D feature space.
6//
7// version: need chuck version 1.4.2.1 or higher
8// sorting: part of ChAI (ChucK for AI) [BETA]
9//
10// uncomment the next line to learn more about the KNN2 object:
11// KNN2.help();
12//
13// author: Yikai Li and Ge Wang
14// date: Spring 2023
15//------------------------------------------------------------------------------
16
17// create a k-NN object
18KNN2 knn;
19
20// prepare data: labels
21["classical", "pop", "rock"] @=> string labelNames[];
22// prepare data: using 2-dimensional feature space for this example;
23// in general, the feature space could be much higher
24[[0.0, 0.0],
25 [1.0, 1.0],
26 [2.0, 2.0]] @=> float features[][];
27// prepare data: corresponding IDs between labels and features
28[0, 1, 2] @=> int labels[];
29// number of labels
30labels.size() => int NUM_LABELS;
31// train the model
32knn.train( features, labels );
33// optional: weigh the feature dimensions
34[1.0, 1.0] @=> float weights[];
35// optional: set the weights across feature dimensions
36knn.weigh( weights );
37
38// provide an unlabled test query
39[0.5, 0.5] @=> float q[];
40
41// search for nearest neighbor label
42int neighbor_labels[0];
43// corresponding indices
44int neighbor_indices[0];
45
46// search type #1: get labels
47knn.search( q, 1 , neighbor_labels );
48chout <= "query=(" + q[0] + ", " + q[1] + "); k=1:\n" + labelNames[neighbor_labels[0]] <= IO.newline();
49
50// search type #2: get labels and indices
51knn.search( q, 2 , neighbor_labels, neighbor_indices );
52chout <= "\n" <= "query=(" + q[0] + ", " + q[1] + "); k=2:\n";
53for (int i; i < 2; i++)
54{
55 chout <= labelNames[neighbor_labels[i]] + " [" + neighbor_indices[i] + "]" <= IO.newline();
56}
57
58// search for nearest neighbor label and feature
59float neighbor_features[2][2];
60knn.search( q, 2 , neighbor_labels, neighbor_indices, neighbor_features );
61chout <= "\n" <= "query=(" + q[0] + ", " + q[1] + "); k=2:\n";
62for (int i; i < 2; i++)
63{
64 chout <= labelNames[neighbor_labels[i]] + " [" + neighbor_indices[i] + "]" +
65 " (" + neighbor_features[i][0] + ", " + neighbor_features[i][1] + ")" <= IO.newline();
66}
67
68
examples/ai/mlp/mlp-manual.ck+164−0
@@ -0,0 +1,164 @@
1//---------------------------------------------------------------------
2// name: mlp-manual.ck
3// desc: training (step-by-step) a multilayer perception (MLP):
4// (for a less manaul example, see mlp.ck)
5//
6// version: need chuck version 1.4.2.1 or higher
7// sorting: part of ChAI (ChucK for AI)
8//
9// uncomment for MLP API:
10// MLP.help();
11//
12// author: Yikai Li
13// Ge Wang (https://ccrma.stanford.edu/~ge/)
14// date: Winter 2023
15//---------------------------------------------------------------------
16// delay for each epoch (change for print speed)
17// (or run with --silent for no print delay)
18100::ms => dur T_PRINT;
19// learning rate
200.01 => float learningRate;
21// number of epochs
22100 => int epochs;
23
24// instantiate a multilayer perception (a basic neural network)
25MLP mlp;
26
27// neurons per layer: input, [hidden layer(s)], output
28[3, 5, 5, 2] @=> int nodesPerLayer[];
29// initialize with the # of neurons per layer
30mlp.init( nodesPerLayer );
31
32// input observations
33[[0.1, 0.2, 0.3], [0.4, 0.5, 0.6]] @=> float X[][];
34// output observations
35[[0.1, 0.2], [0.3, 0.4]] @=> float Y[][];
36// input and output array references
37float x[], y[];
38
39
40//---------------------------------------------------------------------
41// train the neural network epoch by epoch
42// this is a more "manual" alternative to simply calling MLP.train()
43// intended for education and curiosity
44//---------------------------------------------------------------------
45for( int i; i < epochs; i++ )
46{
47 // shuffle the observations
48 MLP.shuffle( X, Y );
49
50 // train over all observations
51 for( int j; j < X.size(); j++ )
52 {
53 // print weights and biases
54 chout <= IO.newline() <= "--- WEIGHTS AND BIASES |"
55 <= " EPOCH:" <= i+1 <= " OBSERVATION:" <= j+1 <= " ---" <= IO.newline();
56 visWeightsBiases();
57
58 // forward propagation
59 chout <= IO.newline() <= "--- FORWARD-PROPAGATION |"
60 <= " EPOCH:" <= i+1 <= " OBSERVATION:" <= j+1 <= " ---" <= IO.newline();
61 mlp.forward( X[j] );
62 visActivations();
63
64 // backpropagation
65 chout <= IO.newline() <= "--- BACKPROPAGATION |"
66 <= " EPOCH:" <= i+1 <= " OBSERVATION:" <= j+1 <= " ---" <= IO.newline();
67 mlp.backprop( Y[j], learningRate );
68 visGradients();
69 }
70
71 // print
72 chout <= IO.newline();
73 chout <= "********************************************" <= IO.newline();
74 chout <= "*** LEARNING-RATE:" <= learningRate <= " | EPOCH:" <= i+1 <= " DONE" <= IO.newline();
75 chout <= "********************************************" <= IO.newline();
76
77 // pause for print
78 T_PRINT => now;
79}
80
81// print weights and biases
82chout <= IO.newline() <= "--- FINAL WEIGHTS AND BIASES |"
83 <= " EPOCH:" <= epochs <= " ---" <= IO.newline();
84visWeightsBiases();
85chout <= IO.newline();
86
87// print
88chout <= "********************************************" <= IO.newline();
89chout <= "************* TRAINING DONE ****************" <= IO.newline();
90chout <= "********************************************" <= IO.newline();
91chout <= IO.newline();
92
93
94//---------------------------------------------------------------------
95// visualize activations
96//---------------------------------------------------------------------
97fun void visActivations()
98{
99 // chout <= "[activations]" <= IO.newline();
100 for ( 0 => int k; k < nodesPerLayer.size(); k++ )
101 {
102 // activations
103 chout <= "layer " <= k <= " ACTIVATIONS" <= IO.newline();
104 float a[nodesPerLayer[k]];
105 mlp.getActivations(k, a);
106 for ( 0 => int l; l < nodesPerLayer[k]; l++ )
107 chout <= a[l] <= " ";
108 chout <= IO.newline();
109 }
110}
111
112
113//---------------------------------------------------------------------
114// visualize weights and biases
115//---------------------------------------------------------------------
116fun void visWeightsBiases()
117{
118 // chout <= "[weights]" <= IO.newline();
119 for ( 0 => int k; k < nodesPerLayer.size() - 1; k++ )
120 {
121 // weights
122 chout <= "layer " <= k <= " WEIGHTS" <= IO.newline();
123 float w[nodesPerLayer[k]][nodesPerLayer[k+1]];
124 mlp.getWeights(k, w);
125 for ( 0 => int l; l < nodesPerLayer[k]; l++ )
126 {
127 for ( 0 => int m; m < nodesPerLayer[k+1]; m++ )
128 chout <= w[l][m] <= " ";
129 chout <= IO.newline();
130 }
131 }
132
133 chout <= "---" <= IO.newline();
134 // chout <= "[biases]" <= IO.newline();
135 for ( 0 => int k; k < nodesPerLayer.size() - 1; k++ )
136 {
137 // biases
138 chout <= "layer " <= k <= " BIASES" <= IO.newline();
139 float b[nodesPerLayer[k+1]];
140 mlp.getBiases(k, b);
141 for ( 0 => int l; l < nodesPerLayer[k+1]; l++ )
142 chout <= b[l] <= " ";
143 chout <= IO.newline();
144 }
145}
146
147
148//---------------------------------------------------------------------
149// visualize gradients
150//---------------------------------------------------------------------
151fun void visGradients()
152{
153 // chout <= "[gradients]" <= IO.newline();
154 for ( 0 => int k; k < nodesPerLayer.size(); k++ )
155 {
156 // gradients
157 chout <= "layer " <= k <= " GRADIENTS" <= IO.newline();
158 float g[nodesPerLayer[k]];
159 mlp.getGradients(k, g);
160 for ( 0 => int l; l < nodesPerLayer[k]; l++ )
161 chout <= g[l] <= " ";
162 chout <= IO.newline();
163 }
164}
examples/ai/mlp/mlp.ck+62−0
@@ -0,0 +1,62 @@
1//---------------------------------------------------------------------
2// name: mlp.ck
3// desc: training a multilayer perception (MLP),
4// a basic artificial neural network
5// (for a step-by-step example, see mlp-manual.ck)
6//
7// version: need chuck version 1.4.2.1 or higher
8// sorting: part of ChAI (ChucK for AI)
9//
10// uncomment for MLP API:
11// MLP.help();
12//
13// author: Yikai Li
14// Ge Wang (https://ccrma.stanford.edu/~ge/)
15// date: Winter 2023
16//---------------------------------------------------------------------
17
18// instantiate a multilayer perception
19MLP mlp;
20// learning rate
210.01 => float learningRate;
22// number of epochs
23100 => int epochs;
24
25// nodes per layer: input, [hidden layer(s)], output
26[3, 5, 5, 2] @=> int nodesPerLayer[];
27
28// initialize with the units per layer with default activation function
29// default: AI.Sigmoid for all layers except output layer;
30// default: AI.Linear for output layer
31mlp.init( nodesPerLayer );
32
33// (ALTERNATE #1) initialize with activation function
34// mlp.init( nodesPerLayer, AI.Sigmoid );
35
36// (ALTERNATE #2) specify activation function per layer
37// [AI.ReLU, AI.Tanh, AI.Softmax] @=> int activationPerLayer[];
38// (ALTERNATE #2) initialize with activation function per layer
39// mlp.init( nodesPerLayer, activationPerLayer );
40
41// input observations
42[[0.1, 0.2, 0.3], [0.4, 0.5, 0.6]] @=> float X[][];
43// output observations
44[[0.1, 0.2], [0.3, 0.4]] @=> float Y[][];
45// print
46<<< "training model...", "" >>>;
47// train the network
48mlp.train( X, Y, learningRate, epochs );
49// ALTERNATE: train with default learning_rate=0.01, epochs=100
50// mlp.train(X, Y);
51
52// save the network into a model file, which can loaded later
53// mlp.save( me.dir() + "model.txt" );
54
55// predict given a new input
56[0.7, 0.8, 0.9] @=> float x[];
57// array to how output
58float y[2];
59// predict output given input
60mlp.predict(x, y);
61// print the output
62<<< "predicted output:", y[0], y[1] >>>;
examples/ai/mlp/model-load.ck+34−0
@@ -0,0 +1,34 @@
1//---------------------------------------------------------------------
2// name: mlp-load.ck
3// desc: loading an MLP model from file (created by MLP.save())
4//
5// version: need chuck version 1.4.2.1 or higher
6// sorting: part of ChAI (ChucK for AI)
7//
8// uncomment for MLP API:
9// MLP.help();
10//
11// author: Yikai Li
12// Ge Wang (https://ccrma.stanford.edu/~ge/)
13// date: Winter 2023
14//---------------------------------------------------------------------
15
16// instantiate a multilayer perception
17MLP mlp;
18
19// file name
20"model.txt" => string filename;
21// print
22<<< "loading model from file:", filename >>>;
23// load the model into network (created by MLP.save() elsewhere)
24if( !mlp.load( me.dir() + filename ) ) me.exit();
25
26// predict given a new input
27[0.7, 0.8, 0.9] @=> float x[];
28// array to how output
29float y[2];
30
31// predict output given input
32mlp.predict(x, y);
33// print the output
34<<< y[0], y[1] >>>;
examples/ai/mlp/model-save.ck+54−0
@@ -0,0 +1,54 @@
1//---------------------------------------------------------------------
2// name: model-save.ck
3// desc: training a basic artificial neural network and save the
4// parameters to a model file, which can later be loaded
5// using MLP.load()
6//
7// version: need chuck version 1.4.2.1 or higher
8// sorting: part of ChAI (ChucK for AI)
9//
10// uncomment for MLP API:
11// MLP.help();
12//
13// author: Yikai Li
14// Ge Wang (https://ccrma.stanford.edu/~ge/)
15// date: Winter 2023
16//---------------------------------------------------------------------
17
18// instantiate a multilayer perception
19MLP mlp;
20
21// nodes per layer: input, [hidden layer(s)], output
22[3, 5, 2] @=> int nodesPerLayer[];
23// initialize with the units per layer with default activation function
24// default: AI.Sigmoid for all layers except output layer;
25// default: AI.Linear for output layer
26mlp.init( nodesPerLayer );
27
28// (ALTERNATE #1) initialize with activation function
29// mlp.init( nodesPerLayer, AI.Sigmoid );
30
31// (ALTERNATE #2) specify activation function per layer
32// [AI.ReLU, AI.Tanh, AI.Softmax] @=> int activationPerLayer[];
33// (ALTERNATE #2) initialize with activation function per layer
34// mlp.init( nodesPerLayer, activationPerLayer );
35
36// input observations
37[[0.1, 0.2, 0.3], [0.4, 0.5, 0.6]] @=> float X[][];
38// output observations
39[[0.1, 0.2], [0.3, 0.4]] @=> float Y[][];
40// learning rate
410.001 => float learningRate;
42// number of epochs
43100 => int epochs;
44// train the network
45mlp.train( X, Y, learningRate, epochs );
46// ALTERNATE: train with default learning_rate=0.001, epochs=100
47// mlp.train(X, Y);
48
49// file name
50"model2.txt" => string filename;
51// save the network
52mlp.save( me.dir() + filename );
53// print
54<<< "saved model to file:", filename >>>;
examples/ai/mlp/model.txt+15−0
@@ -0,0 +1,15 @@
1# layers
23 5 2
3# activation functions (0=Linear, 1=Sigmoid, 2=ReLU, 3=Tanh, 4=Softmax)
41 0
5# weights
60.47885 0.897433 0.700238
70.271321 0.804914 0.75141
80.101633 0.697392 0.144179
90.20334 0.204955 0.0650653
100.220385 0.228439 0.646953
110.435727 0.606756 -0.0535573 0.382353 0.141568
120.0211301 -0.0718241 0.458108 0.296374 0.23014
13# biases
140.097886 0.202725 0.195579 0.927591 0.262946
15-0.167411 0.269795
examples/ai/pca/pca.ck+41−0
@@ -0,0 +1,41 @@
1//---------------------------------------------------------------------
2// name: pca.ck
3// desc: principle component analysis utility
4//
5// version: need chuck version 1.4.2.1 or higher
6// sorting: part of ChAI (ChucK for AI)
7//
8// uncomment for PCA API:
9// PCA.help();
10//
11// author: Yikai Li
12// Ge Wang (https://ccrma.stanford.edu/~ge/)
13// date: Winter 2023
14//---------------------------------------------------------------------
15
16// prepare
17float input[10][10], output[10][3];
18for( 0 => int i; i < 10; i++ )
19{
20 for( 0 => int j; j < 10; j++ )
21 {
22 // put noise in
23 Math.randomf() => input[i][j];
24 }
25}
26
27// dimension reduce input (e.g., 10x10) to output (e.g., 10x3)
28// PCA.reduce() is a static method...
29// can be called with or without PCA instance
30PCA.reduce( input, 3, output );
31
32// print
33for ( 0 => int i; i < 10; i++ )
34{
35 for ( 0 => int j; j < 3; j++ )
36 {
37 // prin t
38 chout <= output[i][j] <= ",";
39 }
40 chout <= IO.newline();
41}
examples/ai/svm/svm-basic.ck+34−0
@@ -0,0 +1,34 @@
1//------------------------------------------------------------------------------
2// name: svm-basic.ck
3// desc: basic support vector machine example (SVM)
4//
5// version: need chuck version 1.4.2.0 or higher
6// sorting: part of ChAI (ChucK for AI) [BETA]
7//
8// uncomment the next line to learn more about the KNN object:
9// HMM.help();
10//
11// author: Yikai Li
12// date: Spring 2023
13//------------------------------------------------------------------------------
14
15// instance
16SVM svm;
17
18// prepare data
19[[1.0, 1.0],
20 [2.0, 2.0],
21 [3.0, 3.0]] @=> float x[][];
22[[1.0],
23 [2.0],
24 [3.0]] @=> float y[][];
25
26// train
27// <<< "training...", "" >>>;
28svm.train(x, y);
29
30// test
31float res[1];
32// <<< "predicting...", "" >>>;
33svm.predict([1.5, 1.5], res);
34<<< res[0] >>>;
examples/ai/wekinator/currentData.arff+19−0
@@ -0,0 +1,19 @@
1@relation dataset
2@attribute ID numeric@attribute Time date 'yyyy/MM/dd HH:mm:ss:SSS'@attribute 'Training round' numeric
3@attribute inputs-1 numeric
4@attribute inputs-2 numeric
5@attribute inputs-3 numeric
6@attribute outputs-1 numeric
7@attribute outputs-2 numeric
8
9@data
100, 2023/01/01 00:00:00:000, 0, 0.1, 0.1, 0.1, 48, 60
111, 2023/01/01 00:00:00:000, 0, 0.1, 0.1, 0.1, 48, 60
122, 2023/01/01 00:00:00:000, 0, 0.1, 0.1, 0.1, 48, 60
133, 2023/01/01 00:00:00:000, 0, 0.1, 0.1, 0.1, 48, 60
144, 2023/01/01 00:00:00:000, 0, 0.1, 0.1, 0.1, 48, 60
155, 2023/01/01 00:00:00:000, 0, 0.8, 0.8, 0.8, 5, 8
166, 2023/01/01 00:00:00:000, 0, 0.8, 0.8, 0.8, 5, 8
177, 2023/01/01 00:00:00:000, 0, 0.8, 0.8, 0.8, 5, 8
188, 2023/01/01 00:00:00:000, 0, 0.8, 0.8, 0.8, 5, 8
199, 2023/01/01 00:00:00:000, 0, 0.8, 0.8, 0.8, 5, 8
examples/ai/wekinator/wekinator-basic.ck+121−0
@@ -0,0 +1,121 @@
1//---------------------------------------------------------------------
2// name: wekinator-basic.ck
3// desc: basic example using the built-in Wekinator object in ChucK,
4// based on Rebecca Fiebrink's Wekinator framework;
5// This example adds two groups of 3-2 input-output
6// observations, trains, and predicts output based on new input.
7// default task: regression
8// default model: MLPs (one hidden layer with same # of nodes as input)
9//
10// version: need chuck version 1.4.2.1 or higher
11// sorting: part of ChAI (ChucK for AI)
12//
13// uncomment for Wekinator API:
14// Wekinator.help();
15//
16// authors: Yikai Li
17// Ge Wang (https://ccrma.stanford.edu/~ge/)
18// Rebecca Fiebrink (original Wekinator framework)
19// date: Winter 2023
20//---------------------------------------------------------------------
21
22// instantiate a global Wekinator, so other files can access
23global Wekinator wek;
24
25// clear training observations
26wek.clear();
27
28// group count
291 => int groupNum;
30
31cherr <= "-----------" <= IO.newline();
32// add a group of data
33addGroup( [0.1, 0.1, 0.1], [48.0, 60.0], 20 );
34addGroup( [0.4, 0.4, 0.4], [5.0, 8.0], 20 );
35addGroup( [0.8, 0.0, 0.4], [30.0, 30.0], 20 );
36cherr <= "-----------" <= IO.newline();
37
38// (optional) set model type; MLP is default
39// AI.MLP => wek.modelType;
40// (optional) set task type; regression is default
41AI.Regression => wek.taskType;
42// print
43<<< "modelType:", wek.modelTypeName(),
44 "| taskType:", wek.taskTypeName() >>>;
45
46// (optional) set properties to your liking
47// <<< "changing Wekinator MLP properties...", "" >>>;
48// wek.setProperty( AI.MLP, "hiddenLayers", 1 );
49// note: 0 nodesPerHiddenLayer means "same as input layer"
50// wek.setProperty( AI.MLP, "nodesPerHiddenLayer", 0 );
51// wek.setProperty( AI.MLP, "learningRate", 0.01 );
52// wek.setProperty( AI.MLP, "epochs", 100 );
53
54 // print model properties
55<<< "Wekinator MLP hiddenLayers:", wek.getPropertyInt( AI.MLP, "hiddenLayers" ) >>>;
56<<< "Wekinator MLP nodesPerHiddenLayer:", wek.getPropertyInt( AI.MLP, "nodesPerHiddenLayer" ) >>>;
57<<< "Wekinator MLP learningRate", wek.getPropertyFloat( AI.MLP, "learningRate" ) >>>;
58<<< "Wekinator MLP epochs:", wek.getPropertyInt( AI.MLP, "epochs" ) >>>;
59// (optional) save the observations for loading later
60// wek.exportObs( me.dir() + "currentData.arff" );
61
62// print
63cherr <= "-----------" <= IO.newline();
64cherr <= "training..." <= IO.newline();
65cherr <= "-----------" <= IO.newline();
66// train using current training set
67wek.train();
68
69// new input
70float x[];
71// to hold predicted output
72float y[2];
73
74cherr <= "given new input, predict output..." <= IO.newline();
75// predict and print
76predict( [0.101, 0.1, 0.1], y );
77predict( [0.401, 0.4, 0.4], y );
78predict( [0.801, 0.0, 0.4], y );
79
80// test run
81repeat( 20 )
82{
83 // generate random input
84 [Math.random2f(0,1), Math.random2f(0,1), Math.random2f(0,1)] @=> x;
85 // predict and print
86 predict( x, y );
87 // advance time (just for effect)
88 50::ms => now;
89}
90
91
92// add a group of training observations
93fun void addGroup( float inputs[], float outputs[], int N )
94{
95 // print
96 cherr <= "adding group " <= groupNum++;
97 // collect data
98 repeat( N )
99 {
100 // input and output (could be set in another file)
101 wek.input( inputs ); wek.output( outputs );
102 // add current input and output (typically these are different)
103 wek.add();
104 // print
105 cherr <= ".";
106 // advance time (delay on purpose to visualize the process)
107 (300.0/N)::ms => now;
108 }
109 // print
110 cherr <= IO.newline();
111}
112
113// predict and print
114fun void predict( float inputs[], float outputs[] )
115{
116 // predict output based on input; 3 inputs -> 2 outputs
117 wek.predict(inputs, outputs);
118 // print
119 cherr <= "(" <= inputs[0] <= ","<= inputs[1] <= ","<= inputs[2] <= ") -> ("
120 <= outputs[0] <= ", " <= outputs[1] <= ")" <= IO.newline();
121}
examples/ai/wekinator/wekinator-customize.ck+232−0
@@ -0,0 +1,232 @@
1//---------------------------------------------------------------------
2// name: wekinator-customize.ck
3// desc: a more extensive example of working with the Wekinator object,
4// with many options including per-output-channel configurations.
5//
6// achievement trophy to Yikai Li for the adaptation from Wekinator
7// system and source, and redesigning the API with Ge into Wekinator
8// chuck object; Yikai generated over 6000 lines of C++ code in this
9// substantial adaption effort
10//
11// lifetime achievement award to Rebecca Fiebrink from making Wekinator,
12// and showing us a humanistic and playful way forward in an AI-drenched
13// world...
14//
15// version: need chuck version 1.4.2.1 or higher
16// sorting: part of ChAI (ChucK for AI)
17//
18// uncomment for Wekinator API:
19// Wekinator.help();
20//
21// authors: Yikai Li
22// Ge Wang (https://ccrma.stanford.edu/~ge/)
23// Rebecca Fiebrink (original Wekinator framework)
24// date: Winter 2023
25//---------------------------------------------------------------------
26
27// Wekinator instance
28global Wekinator wek;
29
30<<< "---------------", "" >>>;
31// set number of expect inputs
32// (if different than exisxting, this will clear all current observations)
33wek.inputDims(2);
34<<< "# input channels:", wek.inputDims() >>>;
35// set number of expect outputs
36// (if different than exisxting, this will clear all current observations)
37wek.outputDims(3);
38<<< "# output channels:", wek.outputDims() >>>;
39// set the type of task for Wekinator to do
40// current options: AI.Classification, AI.Regression
41wek.taskType( AI.Regression );
42// print including taskType name
43<<< "task ID:", wek.taskType(), "==", wek.taskTypeName() >>>;
44
45// set regression-related attributes
46wek.setProperty( AI.Regression, "min", 0 );
47wek.setProperty( AI.Regression, "max", 1 );
48// how to handle values outside [min,max]? 0 = none, 1 = soft, 2 = hard
49wek.setProperty( AI.Regression, "limit", false );
50// set classification-related attributes
51wek.setProperty( AI.Classification, "classes", 5 );
52// set (global) MLP attributes
53// NOTE: these will overwrite the corresponding output channel-specific properties
54wek.setProperty( AI.MLP, "hiddenLayers", 1 );
55wek.setProperty( AI.MLP, "nodesPerHiddenLayer", 0 ); // 0 = same as number of inputs
56wek.setProperty( AI.MLP, "learningRate", 0.01 );
57wek.setProperty( AI.MLP, "epochs", 100 );
58// set (global) KNN attributes
59// this is the default unless a more local attribute is set for a given output channel
60wek.setProperty(AI.KNN, "k", 5);
61<<< "---------------", "" >>>;
62// how to get properties; NOTE that each numeric property is associatd with int or float type
63<<< "regression min:", wek.getPropertyFloat(AI.Regression, "min") >>>;
64<<< "regression max:", wek.getPropertyFloat(AI.Regression, "max") >>>;
65<<< "regression limit type:", wek.getPropertyInt(AI.Regression, "limit") >>>;
66<<< "MLP hiddenLayers:", wek.getPropertyInt(AI.MLP, "hiddenLayers") >>>;
67<<< "MLP nodesPerHiddenLayer:", wek.getPropertyInt(AI.MLP, "nodesPerHiddenLayer") >>>;
68<<< "MLP learningRate:", wek.getPropertyFloat(AI.MLP, "learningRate") >>>;
69<<< "MLP epochs:", wek.getPropertyInt(AI.MLP, "epochs") >>>;
70<<< "classification # classes:", wek.getPropertyInt(AI.Classification, "classes") >>>;
71<<< "KNN k:", wek.getPropertyInt(AI.KNN, "k") >>>;
72<<< "---------------", "" >>>;
73
74// set the type of underlying algorithm used
75// options: AI.Regression: AI.MLP, AI.LR (currently not implemented)
76// options: AI.Classification: AI.KNN, AI.SVM, AI.DT (current not implemented)
77wek.modelType(AI.MLP);
78// print including modelType name
79<<< "modelType ID:", wek.modelType(), "==", wek.modelTypeName() >>>;
80
81// set any output channel-specific attributes, which locally
82// overrides the global attributes set in wek.setProperty()
83wek.setOutputProperty(0, "taskType", AI.Regression); // AI.Classification, AI.Regression
84wek.setOutputProperty(0, "modelType", AI.MLP); // AI.Regression: AI.MLP, AI.LR; AI.Classification: AI.KNN, AI.SVM, AI.DT
85wek.setOutputProperty(0, AI.Regression, "min", 0);
86wek.setOutputProperty(0, AI.Regression, "max", 1);
87wek.setOutputProperty(0, AI.Regression, "limit", false); // true: limit to [min,max]; false: no limit
88wek.setOutputProperty(0, AI.MLP, "hiddenLayers", 1);
89wek.setOutputProperty(0, AI.MLP, "nodesPerHiddenLayer", 0); // 0 = same as number of inputs
90wek.setOutputProperty(0, AI.MLP, "learningRate", 0.01);
91wek.setOutputProperty(0, AI.MLP, "epochs", 100);
92wek.setOutputProperty(0, AI.Classification, "classes", 5);
93wek.setOutputProperty(0, AI.KNN, "k", 5);
94wek.setOutputProperty(0, "connectedInputs", [0, 1]); // sets which input to incorporate into the model
95
96<<< "---------------", "" >>>;
97// get output channel-specific attributes
98<<< "taskType | output channel 0:", wek.getOutputPropertyInt(0, "taskType") >>>;
99<<< "modelType | output channel 0:", wek.getOutputPropertyInt(0, "modelType") >>>;
100<<< "regression min | output channel 0:", wek.getOutputPropertyFloat(0, AI.Regression, "min") >>>;
101<<< "regression max | output channel 0:", wek.getOutputPropertyFloat(0, AI.Regression, "max") >>>;
102<<< "regression limit type | output channel 0:", wek.getOutputPropertyInt(0, AI.Regression, "limit") >>>;
103<<< "MLP hiddenLayers | output channel 0:", wek.getOutputPropertyInt(0, AI.MLP, "hiddenLayers") >>>;
104<<< "MLP nodesPerHiddenLayer | output channel 0:", wek.getOutputPropertyInt(0, AI.MLP, "nodesPerHiddenLayer") >>>;
105<<< "MLP learningRate | output channel 0:", wek.getOutputPropertyFloat(0, AI.MLP, "learningRate") >>>;
106<<< "MLP epochs | output channel 0:", wek.getOutputPropertyInt(0, AI.MLP, "epochs") >>>;
107<<< "classification # classes | output channel 0:", wek.getOutputPropertyInt(0, AI.Classification, "classes") >>>;
108<<< "KNN k | output channel 0:", wek.getOutputPropertyInt(0, AI.KNN, "k") >>>;
109<<< "---------------", "" >>>;
110
111int indices[1];
112// get indices of input channels connected to a particular output
113wek.getOutputProperty(0, "connectedInputs", indices);
114// print
115cherr <= "connected inputs | output channel 0: ";
116for( int i; i < indices.size(); i++ ) cherr <= indices[i] <= " ";
117cherr <= IO.newline();
118
119// set as the current input
120wek.input([0.5, 0.5]);
121
122// randomize output for each channel between that channels min and max
123wek.randomizeOutputs();
124// set as the current output
125wek.output([0.5, 0.5, 0.5]);
126
127// add an observation from the current input to output
128wek.add();
129// increments the training round number
130// a round consists of one or more added observations
131wek.nextRound();
132// add an observation explicitly from input and output
133wek.add([1.0, 1.0], [1.0, 1.0, 1.0]);
134// add an observation explicitly from input and output, for channel 0
135wek.add(0, [2.0, 2.0], [2.0, 2.0, 2.0]);
136
137// train on all the observations so far
138wek.train();
139
140// array to hold predictions
141float outputs[1];
142// predict output given new input
143wek.predict([3.0, 3.0], outputs);
144// print output
145cherr <= "prediction: ";
146for( int i; i < outputs.size(); i++ ) cherr <= outputs[i] <= ", ";
147cherr <= IO.newline();
148
149// get the number of observations (globally)
150<<< "number of observations (total):", wek.numObs() >>>;
151// get the number of observations for a specific output channel
152<<< "number of observations for output channel 0:", wek.numObs(0) >>>;
153
154<<< "---------------", "" >>>;
155// array to hold observations
156// due to a current ChucK language limitation, need to pre-allocate array to obs size
157float obs[wek.numObs()][0];
158// retrieve current observations
159wek.getObs(obs);
160// print what we got
161<<< "ID, time, recording round, Input-0, Input-1, Output-0, Output-1, Output-2", "" >>>;
162for( 0 => int i; i < obs.size(); i++ )
163{
164 for( 0 => int j; j < obs[i].size(); j++ )
165 {
166 cherr <= obs[i][j] <= ", ";
167 }
168 cherr <= IO.newline();
169}
170
171// array to hold observations
172// due to a current ChucK language limitation, need to pre-allocate array to obs size
173float obs1[wek.numObs(0)][0];
174// retrieve current observations for a specific channel
175wek.getObs(0, obs1);
176// print what we got
177<<< "ID, time, recording round, Input-0, Input-1, Output-0, Output-1, Output-2", "" >>>;
178for( 0 => int i; i < obs1.size(); i++ )
179{
180 for( 0 => int j; j < obs1[i].size(); j++ )
181 {
182 cherr <= obs1[i][j] <= ", ";
183 }
184 cherr <= IO.newline();
185}
186
187// delete the last round of observations (since the last wek.nextRound())
188wek.deleteLastRound();
189
190// clear observations by ID in the given range lo to hi
191wek.clearObs( 0, 1 );
192// clear observations by ID in the given range lo to hi, for a specific channel
193wek.clearObs( 0, 0, 1 );
194
195// save everything for this Wekinator (observations, model parameters, configurations)
196wek.save("./tmp.txt");
197// load Wekinator state from file
198wek.load("./tmp.txt");
199
200// export observations only (no model or configurations)
201wek.exportObs("./tmp.arff");
202// export observations only (no model or configurations), for a specific channel
203wek.exportObs(0, "./tmp0.arff");
204// import observations (NOTE: this replaces existing observations,
205// reset the round number, and will be associated with all output channels)
206wek.importObs("./tmp.arff");
207
208// clear all observations
209wek.clearAllObs();
210// clear all observations on a given channel
211wek.clearAllObs(0);
212
213<<< "---------------", "" >>>;
214// set whether Wekinator.add() should be associated with output channels (all)
215wek.setAllRecordStatus( false );
216// set whether Wekinator.add() should be associated with a specific output channel
217wek.setOutputRecordStatus( 0, true );
218// print
219<<< "record status | output channel 0:", wek.getOutputRecordStatus( 0 ) >>>;
220
221// setting this to false will "mask" out all output channels; will predict 0s
222wek.setAllRunStatus( false );
223// <<< wek.getAllRunStatus() >>>;
224// setting this to false will "mask" out a specific output channels
225// that particular output channel will predict 0s
226wek.setOutputRunStatus(0, true);
227<<< "run status | output channel 0:", wek.getOutputRunStatus(0) >>>;
228
229// clear all observations, round number, model (parameters and local properties)
230// NOTE: the global properties will remain unchanged
231wek.clear();
232<<< "---------------", "" >>>;
examples/ai/wekinator/wekinator-import.ck+48−0
@@ -0,0 +1,48 @@
1//---------------------------------------------------------------------
2// name: wekinator-import.ck
3// desc: this examples imports training data from an .arff file,
4// (which can be saved either from the Wekinator app or
5// using Wekinator.exportObs())
6//
7// version: need chuck version 1.4.2.1 or higher
8// sorting: part of ChAI (ChucK for AI)
9//
10// uncomment for Wekinator API:
11// Wekinator.help();
12//
13// authors: Yikai Li
14// Ge Wang (https://ccrma.stanford.edu/~ge/)
15// Rebecca Fiebrink (original Wekinator framework)
16// date: Winter 2023
17//---------------------------------------------------------------------
18
19// instantiate a global Wekinator, so other files can easily use
20global Wekinator wek;
21
22// print
23cherr <= "loading observations from file..." <= IO.newline();
24// load an ARFF data file containing input-output observations
25// (generated either from Wekinator.exportObs() or Wekinator app)
26// NOTE: Wekinator.importObs() clears existing training data,
27// and uses the inputDims and outputDims inferred from file
28// NOTE: it is possible to add additional observations after
29wek.importObs( me.dir() + "currentData.arff" );
30
31// print what we loaded
32cherr <= "inputDims: " <= wek.inputDims() <= " "
33<= "outputDims: " <= wek.outputDims() <= " "
34<= "numObs: " <= wek.numObs() <= IO.newline();
35
36// train using current observations
37wek.train();
38
39// input (dimensions should match inputDims)
40[0.3, 0.25, 0.4] @=> float x[];
41// output (dimensions should match outputDims)
42float y[wek.outputDims()];
43// predict output based on input
44wek.predict( x, y );
45
46// print
47for( int i; i < y.size(); i++ ) { cherr <= y[i] <= " "; }
48cherr <= IO.newline();
examples/ai/word2vec/poem-i-feel.ck+195−0
@@ -0,0 +1,195 @@
1//------------------------------------------------------------------------------
2// name: poem-i-feel.ck
3// desc: a sus poem made with chAI and word2vec
4// sorting: part of chAI (ChucK for AI)
5//
6// "i feel"
7// -- a stream of unconsciousness poem generator
8//
9// NOTE: need a pre-trained word vector model, e.g., from
10// https://chuck.stanford.edu/chai/data/glove/
11// glove-wiki-gigaword-50-tsne-2.txt (400000 words x 2 dimensions)
12//
13// author: Ge Wang
14// date: Spring 2023
15//------------------------------------------------------------------------------
16
17// random seed (if set, sequence can be reproduce)
18// Math.srandom( 515 );
19
20// instantiate
21Word2Vec model;
22// pre-trained model to load
23me.dir() + "glove-wiki-gigaword-50-tsne-2.txt" => string filepath;
24// load pre-trained model (see URLs above for download)
25if( !model.load( filepath ) )
26{
27 <<< "cannot load model:", filepath >>>;
28 me.exit();
29}
30
31// starter "i feel" emotion words with positive connotations
32["fine", "joy", "excited", "inspired", "included",
33"understood", "artful", "playful", "free", "myself",
34"grateful", "optimistic" ] @=> string positives[];
35
36// starter "i feel" emotion words with negative connotations
37["sad", "bored", "meh", "spent", "worried",
38"afraid", "marginalized", "misunderstood", "powerless",
39"undone", "small", "guilt", "cringe", "dread" ] @=> string negatives[];
40
41// starter "i feel" emotion words with other connotations
42["numb", "nothing", "weird", "meh", "disjointed", "scattered",
43"complicated", "sus" ] @=> string others[];
44
45// conditions
463 => int LINES_PER_STANZA;
473 => int NUM_SECTIONS; // here each section is a fixed stanzas format
48
49// number of nearest words to retrieve for each word
50// higher this number the higher the variance per word
5110 => int K_NEAREST;
52
53// timing
54400::ms => dur T_WORD; // duration per word
55false => int shouldScaleTimeToWordLength; // longer words take longer?
56T_WORD => dur T_LINE_PAUSE; // a little pause after each line
57T_WORD * 2 => dur T_STANZA_PAUSE; // pause after each stanza
58
59// sound
60ModalBar crystal => Gain left => dac.left;
61crystal => Gain right => dac.right;
621 => crystal.preset;
63// feedback delay for echos
64left => DelayL DL => left; .5 => DL.gain; T_WORD*1.5 => DL.max => DL.delay;
65right => DelayL DR => right; .3 => DR.gain; T_WORD*2 => DR.max => DR.delay;
66
67// current word
68string feeling;
69// word vector
70float vec[model.dim()];
71// search results
72string words[K_NEAREST];
73
74// line break
75chout <= IO.newline(); chout.flush();
76
77// loop over stanzas
78for( int s; s < NUM_SECTIONS; s++ )
79{
80 // grab a word out of the "good" bag
81 positives[Math.random2(0,positives.size()-1)] => feeling;
82 // print a stanza
83 stanza( feeling, LINES_PER_STANZA, 48, 64 );
84
85 // grab a word out of the "bad" bag
86 negatives[Math.random2(0,negatives.size()-1)] => feeling;
87 // print a stanza
88 stanza( feeling, LINES_PER_STANZA, 48, 63 );
89
90 // grab a word out of the "other" bag
91 others[Math.random2(0,others.size()-1)] => feeling;
92 // print a stanza
93 stanza( feeling, LINES_PER_STANZA, 36, Math.random2(33,36)*2 );
94
95 endStanza();
96 chout <= IO.newline() <= IO.newline(); chout.flush();
97 // pause at end of line
98 T_STANZA_PAUSE => now;
99}
100
101// print at the end
102chout <= "\"i feel\"" <= IO.newline();
103chout <= "-- a stream of unconsciousness poem" <= IO.newline();
104chout.flush();
105
106// print a stanza from a starter feeling word
107fun void stanza( string feeling, int numLines, int pitch1, int pitch2 )
108{
109 // loop over lines in a stanza
110 for( int n; n < numLines; n++ )
111 {
112 // a line
113 say("i"); play(pitch1); wait();
114 say("feel"); wait();
115 say(feeling); play(pitch2); wait();
116 endl(); wait();
117
118 // get similar words
119 model.getSimilar( feeling, words.size(), words );
120 // choose one at random
121 words[Math.random2(0,words.size()-1)] => feeling;
122 }
123 // next line!
124 chout <= IO.newline(); chout.flush();
125 // pause at end of line
126 T_LINE_PAUSE => now;
127}
128
129fun void endStanza()
130{
131 // stanza break; no new sound for now
132 say("one"); wait();
133 say("day"); wait();
134 say("ends"); wait();
135 say("as"); wait();
136 say("another"); wait();
137 say("day"); wait();
138 say("dawns..."); wait();
139}
140
141// say a word with space after
142fun void say( string word )
143{
144 say( word, " " );
145}
146
147// say a word
148fun void say( string word, string append )
149{
150 // print it
151 chout <= word <= append; chout.flush();
152}
153
154// sonify
155fun void play( int pitch )
156{
157 play( pitch, Math.random2f(.8,1) );
158}
159
160// sonify
161fun void play( int pitch, float velocity )
162{
163 // convert pitch to frequency and set it
164 pitch => Std.mtof => crystal.freq;
165 // note on
166 velocity => crystal.noteOn;
167}
168
169// wait
170fun void wait()
171{
172 wait( T_WORD );
173}
174
175// wait
176fun void wait( dur T )
177{
178 // let time pass, let sound...sound
179 T => now;
180}
181
182// new line with timing
183fun void endl()
184{
185 endl( T_WORD );
186}
187
188// new line with timing
189fun void endl( dur T )
190{
191 // new line
192 chout <= IO.newline(); chout.flush();
193 // let time pass
194 T => now;
195}
examples/ai/word2vec/poem-randomwalk.ck+122−0
@@ -0,0 +1,122 @@
1//------------------------------------------------------------------------------
2// name: poem-randomwalk.ck
3// desc: another sus poem made with chAI and word2vec
4// sorting: part of chAI (ChucK for AI)
5//
6// "Random Walk"
7// -- another stream of unconsciousness poem generator
8//
9// NOTE: need a pre-trained word vector model, e.g., from
10// https://chuck.stanford.edu/chai/data/glove/
11// glove-wiki-gigaword-50-tsne-2.txt (400000 words x 2 dimensions)
12//
13// author: Ge Wang
14// date: Spring 2023
15//------------------------------------------------------------------------------
16
17// default starting word
18"love" => string STARTING_WORD;
19// check arguments, set new starting word if present
20if( me.args() > 0 ) me.arg(0) => STARTING_WORD;
21
22// random seed (if set, sequence can be reproduce)
23// Math.srandom( 515 );
24
25// instantiate
26Word2Vec model;
27// pre-trained model to load
28me.dir() + "glove-wiki-gigaword-50-tsne-2.txt" => string filepath;
29// load a pre-trained model (see URLs above for download)
30// this could take a few seconds, depending on model size
31if( !model.load( filepath ) )
32{
33 <<< "cannot load model:", filepath >>>;
34 me.exit();
35}
36
37// conditions
387 => int WORDS_PER_LINE;
394 => int LINES_PER_STANZA;
403 => int NUM_STANZAS;
41
42// number of nearest words to retrieve for each word
43// higher this number the higher the variance per word
44100 => int K_NEAREST;
45
46// timing
47200::ms => dur T_WORD; // duration per word
48false => int shouldScaleTimeToWordLength; // longer words take longer?
49250::ms => dur T_LINE_PAUSE; // a little pause after each line
50750::ms => dur T_STANZA_PAUSE; // pause after each stanza
51
52// ranges for each dimension (for sound mapping)
53float mins[0], maxs[0];
54// get bounds for each dimension
55model.minMax( mins, maxs );
56
57// sound
58ModalBar bar => NRev reverb => dac;
59// reverb wet/dry mix
60.1 => reverb.mix;
61// which preset
627 => bar.preset;
63
64// current word
65STARTING_WORD => string word;
66// word vector
67float vec[model.dim()];
68// similarity search results from word2vec
69string words[K_NEAREST];
70// used for scaling up word timing to word length
71dur addTime;
72
73// line break
74chout <= IO.newline(); chout.flush();
75
76// loop over stanzas
77for( int s; s < NUM_STANZAS; s++ )
78{
79 // loop over lines in a stanza
80 for( int n; n < LINES_PER_STANZA; n++ )
81 {
82 // loop over words
83 for( int w; w < WORDS_PER_LINE; w++ )
84 {
85 // print the word, with a space
86 chout <= word <= " "; chout.flush();
87 // get word vector (for sonification)
88 model.getVector( word, vec );
89 // sonify from word vector (see mapping possibilities of ModalBar)
90 // https://chuck.stanford.edu/doc/program/ugen_full.html#ModalBar
91 // feel free to experiement with what parameters to control with the vector
92 Math.remap( vec[0], mins[0], maxs[0], 24, 84 ) => Std.mtof => bar.freq;
93 // use pow to expand/compress the dimensions to affect mapping sensitivity
94 Math.pow(Math.remap( vec[1], mins[1], maxs[1],0,1), 1.1) => bar.stickHardness;
95 // ding!
96 Math.random2f(.5,1) => bar.noteOn;
97 // if scale time with word length
98 if( shouldScaleTimeToWordLength )
99 word.length() * T_WORD/20 => addTime;
100 // let time pass, let sound...sound
101 T_WORD + addTime => now;
102 // get similar words
103 model.getSimilar( word, words.size(), words );
104 // choose one at random
105 words[Math.random2(0,words.size()-1)] => word;
106 }
107 // next line!
108 chout <= IO.newline(); chout.flush();
109 // pause at end of line
110 T_LINE_PAUSE => now;
111 }
112
113 // stanza break!
114 chout <= IO.newline(); chout.flush();
115 // pause at end of line
116 T_STANZA_PAUSE => now;
117}
118
119// print at the end
120chout <= "\"Random Walk\"" <= IO.newline();
121chout <= "-- a stream of unconsciousness poem" <= IO.newline();
122chout.flush();
examples/ai/word2vec/poem-spew.ck+109−0
@@ -0,0 +1,109 @@
1//------------------------------------------------------------------------------
2// name: poem-spew.ck
3// desc: yet another sus poem made with chAI and word2vec
4// sorting: part of ChAI (ChucK for AI) [BETA]
5//
6// "Spew"
7// -- yet another stream of unconsciousness poem generator
8//
9// NOTE: need a pre-trained word vector model, e.g., from
10// https://chuck.stanford.edu/chai/data/glove/
11// glove-wiki-gigaword-50-tsne-2.txt (400000 words x 2 dimensions)
12//
13// author: Ge Wang
14// date: Spring 2023
15//------------------------------------------------------------------------------
16
17// default starting word
18"love" => string STARTING_WORD;
19// check arguments, set new starting word if present
20if( me.args() > 0 ) me.arg(0) => STARTING_WORD;
21
22// random seed (if set, sequence can be reproduce)
23// Math.srandom( 515 );
24
25// instantiate
26Word2Vec model;
27// pre-trained model to load
28me.dir() + "glove-wiki-gigaword-50-tsne-2.txt" => string filepath;
29// load a pre-trained model (see URLs above for download)
30// this could take a few seconds, depending on model size
31if( !model.load( filepath ) )
32{
33 <<< "cannot load model:", filepath >>>;
34 me.exit();
35}
36
37// conditions
382500 => int TOTAL_WORDS; // to spew
391000 => int K_NEAREST; // number of nearest words to retrieve for each word
40
41// timing
4240::ms => dur T_WORD; // duration per word
4340::ms => dur T_LINE_PAUSE; // a little pause after each line
44
45// ranges for each dimension (for sound mapping)
46float mins[0], maxs[0];
47// get bounds for each dimension
48model.minMax( mins, maxs );
49
50// sound
51ModalBar bar => NRev reverb => dac;
52// reverb wet/dry mix
53.1 => reverb.mix;
54// which preset
557 => bar.preset;
56
57// current word
58STARTING_WORD => string word;
59// word vector
60float vec[model.dim()];
61// similarity search results from word2vec
62string words[K_NEAREST];
63// total number of words spewed
640 => int spew;
65// words to go on current line
660 => int lineWords;
67
68// go
69while( spew < TOTAL_WORDS )
70{
71 if( lineWords <= 0 )
72 {
73 // line break
74 chout <= IO.newline(); chout.flush();
75 // generate how many words in next line
76 Math.random2( 5, 12 ) => lineWords;
77 // a little pause after each line
78 25::ms => dur T_LINE_PAUSE;
79 }
80
81 // print the word, with a space
82 chout <= word <= " "; chout.flush();
83 // get word vector
84 model.getVector( word, vec );
85 // sonify from word vector (see mapping possibilities of ModalBar)
86 // https://chuck.stanford.edu/doc/program/ugen_full.html#ModalBar
87 // feel free to experiement with what parameters to control with the vector
88 Math.remap( vec[0], mins[0], maxs[0], 24, 96 ) => Std.mtof => bar.freq;
89 // use pow to expand/compress the dimensions to affect mapping sensitivity
90 Math.pow(Math.remap( vec[1], mins[1], maxs[1], 0, 1), .72) => bar.stickHardness;
91 // ding!
92 Math.random2f(.5,1) => bar.noteOn;
93 // let time pass, let sound...sound
94 T_WORD => now;
95 // get similar words
96 model.getSimilar( word, words.size(), words );
97 // choose one of the farthest one
98 words[Math.random2((words.size()-1*.8)$int,words.size()-1)] => word;
99
100 // count
101 spew++;
102 // count line
103 lineWords--;
104}
105
106// print at the end
107chout <= "\"Spew\"" <= IO.newline();
108chout <= "-- another stream of unconsciousness poem" <= IO.newline();
109chout.flush();
examples/ai/word2vec/poem-ungenerate.ck+284−0
@@ -0,0 +1,284 @@
1//------------------------------------------------------------------------------
2// name: poem-ungenerate.ck
3// desc: they just keep coming; more sus poem word2vec examples
4// sorting: part of chAI (ChucK for AI)
5//
6// NOTE: because this example needs ConsoleInput, it needs to
7// run command line chuck
8// > chuck poem-ungenerate.ck
9//
10// "Degenerate"
11// -- a stream of unconsciousness poem generator
12//
13// this example prompts for a line of text
14// (e.g., roses are red) and a number of iterations,
15// and outputs a series of lines that use word2vec to
16// change one word to an adjacent word from the previous
17// iteration, while generating unsettling descending
18// shepard tones
19//
20// NOTE: need a pre-trained word vector model, e.g., from
21// https://chuck.stanford.edu/chai/data/glove/
22// glove-wiki-gigaword-50-tsne-2.txt (400000 words x 2 dimensions)
23//
24// author: Ge Wang
25// date: Spring 2023
26//------------------------------------------------------------------------------
27
28// random seed (if set, sequence can be reproduce)
29// Math.srandom( 515 );
30
31// instantiate
32Word2Vec model;
33// pre-trained model to load
34me.dir() + "glove-wiki-gigaword-50-tsne-2.txt" => string filepath;
35// load pre-trained model (see URLs above for download)
36if( !model.load( filepath ) )
37{
38 <<< "cannot load model:", filepath >>>;
39 me.exit();
40}
41
42// conditions
433 => int LINES_PER_STANZA;
443 => int NUM_SECTIONS; // here each section is a fixed stanzas format
45
46// number of nearest words to retrieve for each word
47// higher this number the higher the variance per word
4810 => int K_NEAREST;
49
50// timing
51100::ms => dur T_WORD; // duration per word
52false => int shouldScaleTimeToWordLength; // longer words take longer?
53T_WORD => dur T_LINE_PAUSE; // a little pause after each line
54T_WORD * 2 => dur T_STANZA_PAUSE; // pause after each stanza
55
56// make a ConsoleInput
57ConsoleInput in;
58// tokenizer
59StringTokenizer tok;
60// line
61string line[0];
62
63// ------------ audio: shepard tone generator ---------
64// starting pitches (in MIDI note numbers, octaves apart)
65[ 12.0, 24, 36, 48, 60, 72, 84, 96, 108 ] @=> float pitches[];
66// number of tones
67pitches.size() => int N;
68// bank of tones
69TriOsc tones[N];
70// overall gain
71Gain gain => Envelope envelope => NRev reverb => dac;
721.0/N => gain.gain;
73.05 => reverb.mix;
74// connect to dac
75for( int i; i < N; i++ ) { tones[i] => gain; }
76// set envelope
77envelope.duration(1::second);
78
79// increment per unit time (use negative for descending)
80-.001 => float INC;
81
82// keep shepard tone generating in the background;
83// we will raise and lower volume
84spork ~ shepard();
85// ------------ audio: shepard tone generator ---------
86
87// current word
88string word;
89// word vector
90float vec[model.dim()];
91// search results
92string words[K_NEAREST];
93
94// state
950 => int GET_TEXT;
961 => int GET_NUM;
97GET_TEXT => int state;
98// prompt
99string prompt;
100// the line
101string theText[0];
102
103// new line
104endl();
105// print program name
106chout <= "\"Degenerate\"" <= IO.newline();
107chout <= "-- a stream of unconsciousness poem generator" <= IO.newline();
108chout.flush();
109// new line
110endl();
111
112// loop
113while( true )
114{
115 if( state == GET_TEXT )
116 {
117 "enter a line (e.g., roses are red) =>" => prompt;
118 }
119 else
120 {
121 "how many degenerations (e.g., 20) =>" => prompt;
122 }
123 // prompt
124 in.prompt( prompt ) => now;
125
126 // read
127 while( in.more() )
128 {
129 // clear tokens array
130 line.clear();
131 // clear if in text input mode
132 if( state == GET_TEXT ) theText.clear();
133 // get the input line as one string; send to tokenizer
134 tok.set( in.getLine() );
135 // tokenize line into words separated by white space
136 while( tok.more() )
137 {
138 // put into array (lowercased)
139 line << tok.next().lower();
140 // copy into our text for later
141 if( state == GET_TEXT ) theText << line[line.size()-1];
142 }
143 // if non-empty
144 if( !line.size() )
145 continue;
146
147 // check state
148 if( state == GET_TEXT )
149 {
150 // set state to GET_NUM
151 GET_NUM => state;
152 }
153 else // GET_NUM
154 {
155 // check input
156 Std.atoi( line[0] ) => int n;
157 // make sure in range
158 if( n <= 0 ) continue;
159 // degenerate the input across n iterations
160 degenerate( theText, n );
161 // reset state to get text
162 GET_TEXT => state;
163 }
164 }
165}
166
167// do something with the text input
168fun void degenerate( string input[], int iterations )
169{
170 // start envelope (bring up audio)
171 envelope.keyOn();
172
173 // endline
174 endl();
175
176 // each iteration updates one word from the previous
177 for( int i; i < iterations; i++ )
178 {
179 for( int j; j < input.size(); j++ )
180 {
181 say(input[j]); wait();
182 }
183 endl();
184
185 // random word in the line
186 Math.random2(0,input.size()-1) => int which;
187 // take that work
188 input[which] => word;
189 // find similar words
190 model.getSimilar( word, words.size(), words );
191 // randomly take one and replace the word in question
192 words[Math.random2(0,words.size()-1)] => input[which];
193 }
194
195 // close envelope (ramp down audio)
196 envelope.keyOff();
197
198 // endline
199 endl();
200 // pause
201 T_STANZA_PAUSE => now;
202}
203
204// say a word with space after
205fun void say( string word )
206{
207 say( word, " " );
208}
209
210// say a word
211fun void say( string word, string append )
212{
213 // print it
214 chout <= word <= append; chout.flush();
215}
216
217// wait
218fun void wait()
219{
220 wait( T_WORD );
221}
222
223// wait
224fun void wait( dur T )
225{
226 // let time pass, let sound...sound
227 T => now;
228}
229
230// new line with timing
231fun void endl()
232{
233 endl( T_WORD );
234}
235
236// new line with timing
237fun void endl( dur T )
238{
239 // new line
240 chout <= IO.newline(); chout.flush();
241 // let time pass
242 T => now;
243}
244
245// shepard tone generator
246fun void shepard()
247{
248//--------------------------------------------------------------------
249// continuous shepard-risset tone generator
250// adapted from https://chuck.stanford.edu/doc/examples/deep/shepard.ck
251//--------------------------------------------------------------------
252
253 // mean for normal intensity curve
254 66 => float MU;
255 // standard deviation for normal intensity curve
256 42 => float SIGMA;
257 // normalize to 1.0 at x==MU
258 1 / Math.gauss(MU, MU, SIGMA) => float SCALE;
259 // unit time (change interval)
260 1::ms => dur T;
261
262 // infinite time loop
263 while( true )
264 {
265 for( int i; i < N; i++ )
266 {
267 // set frequency from pitch
268 pitches[i] => Std.mtof => tones[i].freq;
269 // compute loundess for each tone
270 Math.gauss( pitches[i], MU, SIGMA ) * SCALE => float intensity;
271 // map intensity to amplitude
272 intensity*96 => Math.dbtorms => tones[i].gain;
273 // increment pitch
274 INC +=> pitches[i];
275 // wrap (for positive INC)
276 if( pitches[i] > 120 ) 108 -=> pitches[i];
277 // wrap (for negative INC)
278 else if( pitches[i] < 12 ) 108 +=> pitches[i];
279 }
280
281 // advance time
282 T => now;
283 }
284}
examples/ai/word2vec/word2vec-basic.ck+211−0
@@ -0,0 +1,211 @@
1//------------------------------------------------------------------------------
2// name: word2vec-basic.ck
3// desc: word2vec basic usage
4//
5// NOTE: download pre-trained word vector model from:
6// https://chuck.stanford.edu/chai/data/glove/
7// | (can use any of these)
8// glove-wiki-gigaword-50.txt (400000 words x 50 dimensions)
9// glove-wiki-gigaword-50-pca-3.txt (400000 words x 3 dimensions)
10// glove-wiki-gigaword-50-tsne-2.txt (400000 words x 2 dimensions)
11// sorting: part of ChAI (ChucK for AI) [BETA]
12//
13// author: Yikai Li and Ge Wang
14// date: Spring 2023
15//------------------------------------------------------------------------------
16
17// instantiate
18Word2Vec model;
19
20// pre-trained model to load
21"glove-wiki-gigaword-50.txt" => string filepath;
22
23<<< "loading model:", filepath >>>;
24<<< "(this could take a few seconds)...", "" >>>;
25// NOTE: while loading can take a long time initially; this is internally cached;
26// subsequent loads on the same filepath will use cached dictionary, as long as
27// ChucK VM keeps running
28// HINT: while caching should "just work" in miniAudicle, in command-line chuck
29// one could keep one chuck running (using --loop) and chuk code to it from a
30// second terminal (using chuck + code). for example:
31//------------------------------------------------------------------------------
32// terminal-1> chuck --loop ***** terminal-2> chuck + word2vec-basic
33//------------------------------------------------------------------------------
34// load a pre-trained model (see URLs above for download)
35if( !model.load( me.dir() + filepath ) )
36{
37 <<< "cannot load model file...", "" >>>;
38 me.exit();
39}
40
41// print info
42<<< "dictionary size:", model.size() >>>;
43<<< "embedding dimensions:", model.dim() >>>;
44<<< "using KDTree for search:", model.useKDTree() ? "YES" : "NO" >>>;
45float mins[0], maxs[0];
46// get bounds for each dimension
47model.minMax( mins, maxs );
48// print the min/max for each dimension
49for( int i; i < model.dim(); i++ )
50{ cherr <= "dimension " <= i <= ": [" <= mins[i]
51 <= " <-range-> " <= maxs[i] <= "]" <= IO.newline(); }
52
53string words[10];
54<<< "=========================================================", "" >>>;
55
56// get vector
57<<< "vector associated with 'cat' is:", "" >>>;
58float vector[model.dim()];
59model.getVector("cat", vector);
60for( int i; i < vector.size(); i++ ) { chout <= vector[i] <= " "; }
61chout <= IO.newline();
62
63<<< "=========================================================", "" >>>;
64
65// get most similar by word
66<<< words.size(), "words most similar to 'stanford' are:", "" >>>;
67model.getSimilar("stanford", words.size(), words);
68for( int i; i < words.size(); i++ )
69{ <<< words[i], "" >>>; }
70
71<<< "=========================================================", "" >>>;
72
73// get similar words via vector
74<<< words.size(), "words closest to the vector of 'cat' are:", "" >>>;
75model.getSimilar( vector, words.size(), words );
76for( int i; i < words.size(); i++ )
77{ <<< words[i], "" >>>; }
78
79<<< "=========================================================", "" >>>;
80
81// eval an expression
82<<< "similar words to expression 'rome - italy + china':", "" >>>;
83W2V.eval( model, "rome - italy + china", 10 ) @=> words;
84for( 0 => int i; i < words.size(); i++ )
85{ <<< words[i], "" >>>; }
86
87<<< "=========================================================", "" >>>;
88
89"dog" => string A; "puppy" => string B; "cat" => string C;
90// logical analogy
91<<< A, "is to", B, "as", C, "is to..." >>>;
92// e.g., dog:puppy::cat:[?] (this returns words for [?])
93W2V.analogy( model, A, B, C, 10 ) @=> words;
94for( 0 => int i; i < words.size(); i++ )
95{ <<< words[i], "" >>>; }
96
97<<< "=========================================================", "" >>>;
98
99
100
101
102//------------------------------------------------------------------------------
103// word2vec helper
104//------------------------------------------------------------------------------
105class W2V
106{
107 fun static void copy( float to[], float from[] )
108 {
109 to.size(from.size());
110 // add into element
111 for( int i; i < to.size(); i++ ) from[i] => to[i];
112 }
113
114 fun static float[] dup( float from[] )
115 {
116 float to[from.size()];
117 // add into element
118 for( int i; i < to.size(); i++ ) from[i] => to[i];
119 // return
120 return to;
121 }
122
123 // result stored in x
124 fun static void add( float x[], float y[] )
125 {
126 // smaller of the two
127 x.size() < y.size() ? x.size() : y.size() => int size;
128 // add into element
129 for( int i; i < size; i++ ) y[i] +=> x[i];
130 }
131
132 // result stored in x
133 fun static void minus( float x[], float y[] )
134 {
135 // smaller of the two
136 x.size() < y.size() ? x.size() : y.size() => int size;
137 // add into element
138 for( int i; i < size; i++ ) y[i] -=> x[i];
139 }
140
141 fun static void scale( float x[], float scalar )
142 {
143 // scale
144 for( int i; i < x.size(); i++ ) scalar *=> x[i];
145 }
146
147 fun static void scale( float result[], float x[], float scalar )
148 {
149 // scale
150 for( int i; i < x.size(); i++ ) scalar * x[i] => result[i];
151 }
152
153 fun static string[] eval( Word2Vec @ w, string expr, int k )
154 {
155 // init
156 int pos;
157 1.0 => float multiplier;
158 string word;
159 float wordVector[w.dim()];
160 float exprVector[w.dim()];
161
162 // compute
163 while( true )
164 {
165 expr.find(" ") => pos;
166 if( pos == -1 )
167 {
168 w.getVector(expr, wordVector);
169 for( 0 => int i; i < w.dim(); i++ )
170 {
171 wordVector[i] * multiplier +=> exprVector[i];
172 }
173 break;
174 }
175 else
176 {
177 expr.substring(0, pos) => word;
178 w.getVector(word, wordVector);
179 for( 0 => int i; i < w.dim(); i++ )
180 {
181 wordVector[i] * multiplier +=> exprVector[i];
182 }
183 expr.substring(pos + 1) => expr;
184 if( expr.charAt(0) == '+' )
185 {
186 1.0 => multiplier;
187 expr.substring(2) => expr;
188 }
189 else
190 {
191 -1.0 => multiplier;
192 expr.substring(2) => expr;
193 }
194 }
195 }
196
197 // return
198 string results[k];
199 w.getSimilar( exprVector, k, results );
200
201 return results;
202 }
203
204 // logical analogy: A to B is as C is to [what this function returns]
205 fun static string[] analogy( Word2Vec @ w, string A, string B, string C, int k )
206 {
207 // the vector sum
208 B + " - " + A + " + " + C => string v;
209 return eval( w, v, k );
210 }
211}
examples/ai/word2vec/word2vec-prompt.ck+468−0
@@ -0,0 +1,468 @@
1//------------------------------------------------------------------------------
2// name: word2vec-prompt.ck
3// desc: word2vec interative prompt explorer
4//
5// NOTE: this requires ConsoleInput which needs command line chuck
6// NOTE: download pre-trained word vector model from:
7// https://chuck.stanford.edu/chai/data/glove/
8// | (can use any of these)
9// glove-wiki-gigaword-50.txt (400000 words x 50 dimensions)
10// glove-wiki-gigaword-50-pca-3.txt (400000 words x 3 dimensions)
11// glove-wiki-gigaword-50-tsne-2.txt (400000 words x 2 dimensions)
12// sorting: part of ChAI (ChucK for AI) [BETA]
13//
14// author: Yikai Li and Ge Wang
15// date: Spring 2023
16//------------------------------------------------------------------------------
17
18// make a ConsoleInput
19ConsoleInput in;
20// tokenizer
21StringTokenizer tok;
22// line
23string line[0];
24
25// our default model
26Word2Vec model;
27
28// loading any default here
29"glove-wiki-gigaword-50-tsne-2.txt" => string filepath;
30<<< "loading 2D model:", filepath, "..." >>>;
31// load model
32if( !model.load( me.dir() + filepath ) )
33{
34 <<< "cannot load model file...", "" >>>;
35 me.exit();
36}
37// print info about model
38print( model );
39
40ModalBar bar => NRev reverb => dac;
41SndBuf doh => reverb => dac;
42"special:dope" => doh.read;
430 => doh.gain;
44
45// print info about a loaded Word2Vec model
46fun void print( Word2Vec model )
47{
48 // print info
49 <<< "dictionary size:", model.size() >>>;
50 <<< "embedding dimensions:", model.dim() >>>;
51 <<< "using KDTree for search:", model.useKDTree() ? "YES" : "NO" >>>;
52 // get bounds
53 float mins[0], maxs[0];
54 model.minMax( mins, maxs );
55 for( int i; i < model.dim(); i++ )
56 { cherr <= "dimension " <= i <= " range: [" <= mins[i] <= ", "
57 <= maxs[i] <= "]" <= IO.newline(); }
58}
59
60// loop
61while( true )
62{
63 // prompt
64 in.prompt( "word2vec2chuck =>" ) => now;
65
66 // read
67 while( in.more() )
68 {
69 // get it
70 tok.set( in.getLine() );
71 // clear array
72 line.clear();
73 // print tokens
74 while( tok.more() )
75 {
76 // put into array
77 line << tok.next().lower();
78 // print it
79 // <<< line[line.size()-1], "" >>>;
80 }
81 // if non-empty
82 if( line.size() )
83 {
84 // execute
85 execute( line) => int result;
86 }
87 }
88}
89
90
91fun int execute( string line[] )
92{
93 // check
94 line[0] => string command;
95 // index
96 1 => int index;
97
98 // which command
99 if( command == "quit" || command == "exit" )
100 {
101 // exit shred
102 me.exit();
103 }
104 else if( command == "help" || command == "h" )
105 {
106 <<< " available word2vec2chuck commands:", "" >>>;
107 <<< " load / l-- load a pre-trained model", "" >>>;
108 <<< " eval / e -- evalute a word vector expression", "" >>>;
109 <<< " analog / a-- query a logical analogy", "" >>>;
110 <<< " vector / v -- display vector associated with a word", "" >>>;
111 <<< " go / g -- from a word to another across a duration", "" >>>;
112 <<< " similar / s -- from a vector (model size) return similar words", "" >>>;
113 <<< " print / p -- print model info", "" >>>;
114 <<< " help / h -- print this message", "" >>>;
115 <<< " exit / quit -- exit from word2vec2chuck", "" >>>;
116 <<< " load-50 -- load GloVe 50D model (glove-wiki-gigaword-50)", "" >>>;
117 <<< " load-3 -- load PCA 3D model (glove-wiki-gigaword-50-pca-3)", "" >>>;
118 <<< " load-2 -- load t-SNE 2D model (glove-wiki-gigaword-50-tsne-2)", "" >>>;
119 }
120 else if( command == "load" || command == "l" )
121 {
122 if( line.size() < 2 )
123 {
124 <<< "usage: load [model]", "" >>>;
125 }
126 else
127 {
128 <<< "loading model (this could take a few seconds)...", "" >>>;
129 // load
130 if( !model.load( me.dir() + filepath ) )
131 {
132 <<< "cannot load model file...", "" >>>;
133 return 1;
134 }
135 // print info
136 print( model );
137 }
138 }
139 else if( command == "print" || command == "p" )
140 {
141 if( model.size() == 0 )
142 {
143 <<< " no model has been loaded yet.", "" >>>;
144 }
145 else
146 {
147 // print info
148 print( model );
149 }
150 }
151 else if( command == "load-50" || command == "load-3" || command == "load-2" )
152 {
153 string filepath;
154 if( command == "load-50" ) "glove-wiki-gigaword-50.txt" => filepath;
155 else if( command == "load-3" ) "glove-wiki-gigaword-50-pca-3.txt" => filepath;
156 else "glove-wiki-gigaword-50-tsne-2.txt" => filepath;
157
158 <<< "loading model:", filepath >>>;
159 <<< "(this could take a few seconds)...", "" >>>;
160 // load
161 if( !model.load( me.dir() + filepath ) )
162 {
163 <<< "cannot load model file...", "" >>>;
164 return 1;
165 }
166 // print info
167 print( model );
168 }
169 else if( command == "eval" || command == "e" )
170 {
171 if( line.size() < 2 )
172 {
173 <<< "usage: eval [word expression]", "" >>>;
174 <<< " for example: eval rome - italy + china", "" >>>;
175 <<< " (note: don't forget white spaces around + and -)", "" >>>;
176 }
177 else
178 {
179 // expression string
180 line[1] => string expr;
181 // concatenate
182 for( 2 => int i; i < line.size(); i++ )
183 { expr + " " + line[i] => expr; }
184 // eval
185 W2V.eval( model, expr, 10 ) @=> string words[];
186 // print search results
187 for (0 => int i; i < words.size(); i++)
188 { <<< " ", words[i], "" >>>; }
189 }
190 }
191 else if( command == "analog" || command == "a" )
192 {
193 if( line.size() < 4 )
194 {
195 <<< "usage: analog [wordA] [wordB] [wordC]", "" >>>;
196 <<< " for example: analog cat kitten dog", "" >>>;
197 }
198 else
199 {
200 // expression string
201 line[1] => string a;
202 line[2] => string b;
203 line[3] => string c;
204 // eval
205 W2V.analogy( model, a, b, c, 10 ) @=> string words[];
206 // print
207 <<< a, "is to", b, "as", c, "is to..." >>>;
208 for (0 => int i; i < words.size(); i++)
209 {
210 // trivially reject a b c in the output
211 if( words[i] == a || words[i] == b || words[i] == c ) continue;
212 <<< " ", words[i], "" >>>;
213 }
214 }
215 }
216 else if( command == "vector" || command == "v" )
217 {
218 if( line.size() < 2 )
219 {
220 <<< "usage: vector [word]", "" >>>;
221 }
222 else
223 {
224 float vector[model.dim()];
225 model.getVector( line[1], vector );
226 // print
227 cherr <= line[1] <= ": ";
228 for( int i; i < vector.size(); i++ ) { cherr <= vector[i] <= " "; }
229 cherr <= IO.newline();
230 }
231 }
232 else if( command == "go" || command == "g" )
233 {
234 if( line.size() < 5 )
235 {
236 <<< "usage: go [word/start] [word/end] [second] [steps] [k results]", "" >>>;
237 }
238 else
239 {
240 <<< "going from", line[1], "to", line[2], "over", line[3], "seconds in", line[4], "steps" >>>;
241 float coord1[model.dim()], coord2[model.dim()];
242 model.getVector(line[1], coord1);
243 model.getVector(line[2], coord2);
244
245 // print coordinate 1
246 // cherr <= line[1] <= ": ";
247 // for( int i; i < coord1.size(); i++ ) { cherr <= coord1[i] <= " "; }
248 // cherr <= IO.newline();
249
250 // print coordinate 2
251 // cherr <= line[2] <= ": ";
252 // for( int i; i < coord2.size(); i++ ) { cherr <= coord2[i] <= " "; }
253 // cherr <= IO.newline();
254
255 // walk
256 1 => int k;
257 if( line.size() > 5 ) Std.atoi(line[5]) => k;
258 go( line[1], line[2], Std.atof(line[3])::second, Std.atoi(line[4]), k );
259 }
260 }
261 else if( command == "similar" || command == "s" )
262 {
263 if( line.size() != model.dim()+1)
264 {
265 <<< "usage: similar [float] [float] ... model dimension", "" >>>;
266 }
267 else
268 {
269 string results[10];
270 model.getSimilar( [Std.atof(line[1]),Std.atof(line[2])], 10, results );
271 for( int i; i < results.size(); i++ )<<< results[i]>>>;
272 }
273 }
274 else
275 {
276 // not found
277 <<< " command not found:", command >>>;
278 }
279
280 return 0; // 0 is good
281}
282
283
284fun void sonifyDoh( float params[], float vstart[], float vend[] )
285{
286 if( params.size() < 2 )
287 {
288 <<< "not enough params!", "" >>>;
289 return;
290 }
291
292 // use param 1 for volume
293 Math.remap(params[0], vstart[0], vend[0], .1, 1 ) => doh.gain;
294 // use param 2 for rate
295 Math.remap(params[1], vstart[1], vend[1], 1, 1.5 ) => doh.rate;
296
297 // trigger from beginning
298 0 => doh.pos;
299}
300
301
302// this goes from one word to another word
303// > go fun disaster 5 30 1
304// > go technology famine 4 20
305fun void go( string start, string end, dur T, int steps, int k )
306{
307 float vstart[model.dim()], vend[model.dim()];
308 model.getVector(start, vstart);
309 model.getVector(end, vend);
310
311 // get bounds for mapping
312 float mins[0], maxs[0];
313 model.minMax( mins, maxs );
314
315 // duplicate
316 W2V.dup( vend ) @=> float vdiff[];
317 W2V.dup( vstart ) @=> float v[];
318
319 for( int i; i < vstart.size(); i++ ) { cherr <= vstart[i] <= " "; } cherr <= IO.newline();
320 for( int i; i < vend.size(); i++ ) { cherr <= vend[i] <= " "; } cherr <= IO.newline();
321
322 W2V.minus( vdiff, vstart );
323
324 // increment
325 1.0 / steps => float inc;
326 // time step
327 T * inc => dur Tstep;
328 // scale
329 0 => float factor;
330
331 string results[k];
332 float coord[model.dim()];
333
334 // take the steps
335 for( int i; i < steps+1; i++ )
336 {
337 // scale difference vector
338 W2V.scale( v, vdiff, factor );
339 inc +=> factor;
340 // add
341 W2V.add( v, vstart );
342 // search
343 model.getSimilar( v, k, results);
344 results[Math.random2(0,k-1)] => string word;
345 model.getVector( word, coord );
346
347 // print
348 <<< i, "->", word >>>;
349
350 // sonify
351 sonifyDoh( coord, vstart, vend);
352 // for( int i; i < v.size(); i++ ) { cherr <= v[i] <= " "; }
353 // cherr <= IO.newline();
354
355 // advance time
356 Tstep => now;
357 }
358}
359
360
361// word2vec helper
362class W2V
363{
364 fun static void copy( float to[], float from[] )
365 {
366 to.size(from.size());
367 // add into element
368 for( int i; i < to.size(); i++ ) from[i] => to[i];
369 }
370
371 fun static float[] dup( float from[] )
372 {
373 float to[from.size()];
374 // add into element
375 for( int i; i < to.size(); i++ ) from[i] => to[i];
376 // return
377 return to;
378 }
379
380 // result stored in x
381 fun static void add( float x[], float y[] )
382 {
383 // smaller of the two
384 x.size() < y.size() ? x.size() : y.size() => int size;
385 // add into element
386 for( int i; i < size; i++ ) y[i] +=> x[i];
387 }
388
389 // result stored in x
390 fun static void minus( float x[], float y[] )
391 {
392 // smaller of the two
393 x.size() < y.size() ? x.size() : y.size() => int size;
394 // add into element
395 for( int i; i < size; i++ ) y[i] -=> x[i];
396 }
397
398 fun static void scale( float x[], float scalar )
399 {
400 // scale
401 for( int i; i < x.size(); i++ ) scalar *=> x[i];
402 }
403
404 fun static void scale( float result[], float x[], float scalar )
405 {
406 // scale
407 for( int i; i < x.size(); i++ ) scalar * x[i] => result[i];
408 }
409
410 fun static string[] eval( Word2Vec @ w, string expr, int k )
411 {
412 // init
413 int pos;
414 1.0 => float multiplier;
415 string word;
416 float wordVector[w.dim()];
417 float exprVector[w.dim()];
418
419 // compute
420 while( true )
421 {
422 expr.find(" ") => pos;
423 if( pos == -1 )
424 {
425 w.getVector(expr, wordVector);
426 for( 0 => int i; i < w.dim(); i++ )
427 {
428 wordVector[i] * multiplier +=> exprVector[i];
429 }
430 break;
431 }
432 else
433 {
434 expr.substring(0, pos) => word;
435 w.getVector(word, wordVector);
436 for( 0 => int i; i < w.dim(); i++ )
437 {
438 wordVector[i] * multiplier +=> exprVector[i];
439 }
440 expr.substring(pos + 1) => expr;
441 if( expr.charAt(0) == '+' )
442 {
443 1.0 => multiplier;
444 expr.substring(2) => expr;
445 }
446 else
447 {
448 -1.0 => multiplier;
449 expr.substring(2) => expr;
450 }
451 }
452 }
453
454 // return
455 string results[k];
456 w.getSimilar( exprVector, k, results );
457
458 return results;
459 }
460
461 // logical analogy: A to B is as C is to [what this function returns]
462 fun static string[] analogy( Word2Vec @ w, string A, string B, string C, int k )
463 {
464 // the vector sum
465 B + " - " + A + " + " + C => string v;
466 return eval( w, v, k );
467 }
468}
examples/analysis/features/centroid.ck+0−23
@@ -1,23 +0,0 @@
1// our patch
2SinOsc s => FFT fft =^ Centroid cent => blackhole;
3
4// set parameters
5512 => fft.size;
6// set hann window
7Windowing.hann(512) => fft.window;
8// set sine frequency
9440 => s.freq;
10// compute srate
11second / samp => float srate;
12
13// control loop
14while( true )
15{
16 // upchuck: take fft then centroid
17 cent.upchuck();
18 // print out centroid
19 <<< cent.fval(0) * srate / 2 >>>;
20
21 // advance time
22 fft.size()::samp => now;
23}
examples/array/array_associative.ck+26−0
@@ -0,0 +1,26 @@
1// declare regular array (capacity doesn't matter so much)
2float foo[4];
3
4// use as int-based array
52.5 => foo[0];
6
7// use as associative array with key "yoyo"
84.0 => foo["yoyo"];
9
10// access as associative (print)
11<<< foo["yoyo"] >>>;
12
13// access empty element
14<<< foo["gaga"] >>>; // -> should print 0.0
15
16// add a second associative element
1744.0 => foo["yiyi"];
18
19// get the array keys with all of the keys in the array
20string keys[0];
21foo.getKeys(keys);
22
23<<< keys[0], keys[1] >>>;
24
25// call .help() on an array to get more information about its type, methods, etc.
26// foo.help();
examples/array/array_negative.ck+11−0
@@ -0,0 +1,11 @@
1// arrays can have negative indices!
2// version: need chuck-1.4.2.1 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
examples/array/array_zero.ck+14−0
@@ -0,0 +1,14 @@
1// .zero() zeros out the contents AND keeps size unchanged
2// version: need chuck-1.4.2.1 or higher
3
4// an array
5[1,3,4] @=> int array[];
6
7// should print 3 3
8<<< array[1], array.size() >>>;
9
10// zero out the array, leaving size as is
11array.zero();
12
13// now should print 0 3
14<<< array[1], array.size() >>>;
examples/basic/rec-auto-stereo.ck+1−1
@@ -1,5 +1,5 @@
1// chuck this with other shreds to record to file1// chuck this with other shreds to record to file
2// example> chuck foo.ck bar.ck rec (see also rec2.ck)2// example> chuck foo.ck bar.ck rec-auto-stereo.ck
3 3
4// pull samples from the dac4// pull samples from the dac
5// WvOut2 -> stereo operation5// WvOut2 -> stereo operation
examples/basic/rec-auto.ck+2−1
@@ -1,5 +1,6 @@
1// chuck this with other shreds to record to file1// chuck this with other shreds to record to file
2// example> chuck foo.ck bar.ck rec (see also rec2.ck)2// example> chuck foo.ck bar.ck rec-auto.ck
3// (see also rec-auto-stereo.ck)
3 4
4// pull samples from the dac5// pull samples from the dac
5dac => Gain g => WvOut w => blackhole;6dac => Gain g => WvOut w => blackhole;
examples/basic/rec.ck+2−1
@@ -1,5 +1,6 @@
1// chuck this with other shreds to record to file1// chuck this with other shreds to record to file
2// example> chuck foo.ck bar.ck rec (see also rec2.ck)2// example> chuck foo.ck bar.ck rec.ck
3// (see also rec-auto-stereo.ck)
3 4
4// arguments: rec:<filename>5// arguments: rec:<filename>
5 6
examples/deep/ks-chord.ck+149−0
@@ -0,0 +1,149 @@
1//-----------------------------------------------------------------------------
2// name: ks-chord.ck
3// desc: karplus strong comb filter bank
4//
5// authors: Madeline Huberth (mhuberth@ccrma.stanford.edu)
6// Ge Wang (ge@ccrma.stanford.edu)
7// date: summer 2014
8// Stanford Center @ Peking University
9//-----------------------------------------------------------------------------
10
11// single voice Karplus Strong chubgraph
12class KS extends Chubgraph
13{
14 // sample rate
15 second / samp => float SRATE;
16
17 // ugens!
18 DelayA delay;
19 OneZero lowpass;
20
21 // noise, only for internal use
22 Noise n => delay;
23 // silence so it doesn't play
24 0 => n.gain;
25
26 // the feedback
27 inlet => delay => lowpass => delay => outlet;
28 // max delay
29 1::second => delay.max;
30 // set lowpass
31 -1 => lowpass.zero;
32 // set feedback attenuation
33 .9 => lowpass.gain;
34
35 // mostly for testing
36 fun void play( float pitch, dur T )
37 {
38 tune( pitch ) => float length;
39 // turn on noise
40 1 => n.gain;
41 // fill delay with length samples
42 length::samp => now;
43 // silence
44 0 => n.gain;
45 // let it play
46 T-length::samp => now;
47 }
48
49 // tune the fundamental resonance
50 fun float tune( float pitch )
51 {
52 // computes further pitch tuning for higher pitches
53 pitch - 43 => float diff;
54 0 => float adjust;
55 if( diff > 0 ) diff * .0125 => adjust;
56 // compute length
57 computeDelay( Std.mtof(pitch+adjust) ) => float length;
58 // set the delay
59 length::samp => delay.delay;
60 //return
61 return length;
62 }
63
64 // set feedback attenuation
65 fun float feedback( float att )
66 {
67 // sanity check
68 if( att >= 1 || att < 0 )
69 {
70 <<< "set feedback value between 0 and 1 (non-inclusive)" >>>;
71 return lowpass.gain();
72 }
73
74 // set it
75 att => lowpass.gain;
76 // return
77 return att;
78 }
79
80 // compute delay from frequency
81 fun float computeDelay( float freq )
82 {
83 // compute delay length from srate and desired freq
84 return SRATE / freq;
85 }
86}
87
88// chord class for KS
89class KSChord extends Chubgraph
90{
91 // array of KS objects
92 KS chordArray[4];
93
94 // connect to inlet and outlet of chubgraph
95 for( int i; i < chordArray.size(); i++ ) {
96 inlet => chordArray[i] => outlet;
97 }
98
99 // set feedback
100 fun float feedback( float att )
101 {
102 // sanith check
103 if( att >= 1 || att < 0 )
104 {
105 <<< "set feedback value between 0 and 1 (non-inclusive)" >>>;
106 return att;
107 }
108
109 // set feedback on each element
110 for( int i; i < chordArray.size(); i++ )
111 {
112 att => chordArray[i].feedback;
113 }
114
115 return att;
116 }
117
118 // tune 4 objects
119 fun float tune( float pitch1, float pitch2, float pitch3, float pitch4 )
120 {
121 pitch1 => chordArray[0].tune;
122 pitch2 => chordArray[1].tune;
123 pitch3 => chordArray[2].tune;
124 pitch4 => chordArray[3].tune;
125 }
126}
127
128
129// sound to chord to dac
130SndBuf buffy => KSChord object => dac;
131// load a sound
132"special:dope" => buffy.read;
133// set feedback
134object.feedback( .96 );
135
136// offset
137-12 => int x;
138// tune
139object.tune( 60+x, 64+x, 72+x, 79+x );
140// loop
141while( true )
142{
143 // set playhead to beginning
144 0 => buffy.pos;
145 // set rate
146 1 => buffy.rate;
147 // advance time
148 550::ms / buffy.rate() => now;
149}
examples/deep/say-chu.ck+1−1
@@ -45,7 +45,7 @@ fun void doCh() { · 44 unmodified lines
45}45}
46 46
47fun void doKay() {47fun void doKay() {
48 <<< "KKK" >>>;48 <<< "kK" >>>;
49 0.0 => i.gain;49 0.0 => i.gain;
50 0.05 :: second => now;50 0.05 :: second => now;
51 0.005=>ne.time;51 0.005=>ne.time;
examples/event/event-extend.ck+4−1
@@ -1,4 +1,7 @@
1// creating custom event objects1//---------------------------------------------------------------------
2// name: event-extend.ck
3// desc: defining and using a custom Event
4//---------------------------------------------------------------------
2 5
3// new event class6// new event class
4class TheEvent extends Event7class TheEvent extends Event
examples/event/event-x-bpm-1.ck+144−0
@@ -0,0 +1,144 @@
1//---------------------------------------------------------------------
2// name: event-x-bpm-1.ck
3// desc: shows how to
4// 1) define a custom type of Event (called MyEvent here)
5// to hold our custom data; create a MyEvent called PULSE
6// 2) make a metronome to broadcast PULSE, which will wake
7// up all shreds waiting on PULSE; this metronome will also
8// update the 'measure' and 'tick' numbers in PULSE to
9// indicate where we are in the measure
10// 3) define two shreds--one() and two()--whose timing is
11// driven by the metronome to a "drum beat"
12//---------------------------------------------------------------------
13
14// sometimes it's helpful to define a custom kind of Event
15// so we can associate our own data with it
16class MyEvent extends Event
17{
18 // measure number
19 int measure;
20 // smallest beat subdivision within a measure (e.g., 16th notes)
21 // we will assume the event will be broadcast every tick
22 int tick;
23}
24
25// make a shared event that any shred can wait on
26MyEvent PULSE;
27// global bpm variable
28100 => global float BPM;
29// how many ticks per measure?
3016 => float ticksPerMeasure;
31
32// spork timekeeper
33spork ~ metronome();
34// different functions
35spork ~ one() @=> Shred @ shOne;
36spork ~ two() @=> Shred @ shTwo;
37// a function to change the BPM
38spork ~ tempoController();
39
40// keep things running
41while( true )
42{
43 1::second => now;
44}
45
46// a thing to change BPM when desired
47fun void tempoController()
48{
49 // a loop to control the BPM
50 while( true )
51 {
52 // every two measures, change the BPM for fun
53 if( PULSE.tick == 0 && (PULSE.measure%2 == 0) )
54 {
55 // randomize BPM lol
56 Math.random2f( 60, 120 ) => BPM;
57 // print BPM
58 <<< "new BPM:", BPM >>>;
59 }
60
61 // wait on the pulse
62 PULSE => now;
63 }
64}
65
66// metronome (our "conductor")
67fun void metronome()
68{
69 while( true )
70 {
71 // compute every time in case BPM changes
72 1/BPM * minute => dur BEAT;
73 // assume 4/4, compute durationm of a tick
74 BEAT*4/ticksPerMeasure => dur TICK;
75
76 // broadcast to all shreds waiting on PULSE
77 PULSE.broadcast();
78
79 // increment tick count
80 PULSE.tick++;
81 // print
82 cherr <= "."; cherr.flush();
83 // if we reached the end of a measure
84 if( PULSE.tick >= ticksPerMeasure )
85 {
86 // increment measure number
87 PULSE.measure++;
88 // reset tick count to 0
89 0 => PULSE.tick;
90 // next line
91 cherr <= IO.newline();
92 }
93
94 // advance time by a tick duration
95 TICK => now;
96 }
97}
98
99// define function
100fun void one()
101{
102 SndBuf buffy => dac;
103 "special:dope" => buffy.read;
104 0 => buffy.gain;
105
106 while( true )
107 {
108 // wait on the shared event
109 PULSE => now;
110 // play depending on tick number
111 if( PULSE.tick == 0 || PULSE.tick == 8 )
112 {
113 // LOW DOH
114 0 => buffy.pos;
115 .5 => buffy.rate;
116 .5 => buffy.gain;
117 }
118 else if( PULSE.tick == 4 || PULSE.tick == 12 )
119 {
120 0 => buffy.pos;
121 1 => buffy.rate;
122 .5 => buffy.gain;
123 }
124 }
125}
126
127// define function
128fun void two()
129{
130 SndBuf buffy => dac;
131 "special:dope" => buffy.read;
132 0 => buffy.gain;
133
134 while( true )
135 {
136 // wait on the shared event
137 PULSE => now;
138 // in this case play every tick
139 0 => buffy.pos;
140 // HIGH PITCHED DOH
141 2 => buffy.rate;
142 .1 => buffy.gain;
143 }
144}
examples/event/event-x-bpm-2.ck+139−0
@@ -0,0 +1,139 @@
1//---------------------------------------------------------------------
2// name: event-x-bpm-2.ck
3// desc: this is the same as event-x-bpm-1.ck, but one() uses array
4// lookup (instead of if/else) to figure out what to play on tick
5//---------------------------------------------------------------------
6
7// sometimes it's helpful to define a custom kind of Event
8// so we can associate our own data with it
9class MyEvent extends Event
10{
11 // measure number
12 int measure;
13 // smallest beat subdivision within a measure (e.g., 16th notes)
14 // we will assume the event will be broadcast every tick
15 int tick;
16}
17
18// make a shared event that any shred can wait on
19MyEvent PULSE;
20// bpm variable
21100 => float BPM;
22// how many ticks per measure?
2316 => float ticksPerMeasure;
24
25// play volume / probablity per tick (can think of this as a sequence)
26[1.0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0] @=> float playProbs[];
27// play rate per tick
28[.5, 0, 0, 0, 1, 0, 0, 0, .5, 0, 0, 0, 1, 0, 0, 0] @=> float playRates[];
29// NOTE: the sizes of these arrays should equal ticksPerMeasure
30
31// spork timekeeper
32spork ~ metronome();
33// different functions
34spork ~ one() @=> Shred @ shOne;
35spork ~ two() @=> Shred @ shTwo;
36// a function to change the BPM
37spork ~ tempoController();
38
39// keep things running
40while( true )
41{
42 1::second => now;
43}
44
45// a thing to change BPM when desired
46fun void tempoController()
47{
48 // a loop to control the BPM
49 while( true )
50 {
51 // every two measures, change the BPM for fun
52 if( PULSE.tick == 0 && (PULSE.measure%2 == 0) )
53 {
54 // randomize BPM lol
55 Math.random2f( 60, 120 ) => BPM;
56 // print BPM
57 <<< "new BPM:", BPM >>>;
58 }
59
60 // wait on the pulse
61 PULSE => now;
62 }
63}
64
65// metronome (our "conductor")
66fun void metronome()
67{
68 while( true )
69 {
70 // compute every time in case BPM changes
71 1/BPM * minute => dur BEAT;
72 // assume 4/4, compute durationm of a tick
73 BEAT*4/ticksPerMeasure => dur TICK;
74
75 // broadcast to all shreds waiting on PULSE
76 PULSE.broadcast();
77
78 // increment tick count
79 PULSE.tick++;
80 // print
81 cherr <= "."; cherr.flush();
82 // if we reached the end of a measure
83 if( PULSE.tick >= ticksPerMeasure )
84 {
85 // increment measure number
86 PULSE.measure++;
87 // reset tick count to 0
88 0 => PULSE.tick;
89 // next line
90 cherr <= IO.newline();
91 }
92
93 // advance time by a tick duration
94 TICK => now;
95 }
96}
97
98// define function
99fun void one()
100{
101 SndBuf buffy => dac;
102 "special:dope" => buffy.read;
103 0 => buffy.gain;
104
105 while( true )
106 {
107 // wait on the shared event
108 PULSE => now;
109 // look up
110 if( playProbs[PULSE.tick] > 0 ) // instead of 0, it could be a threshold controlled by a knob
111 {
112 // play
113 0 => buffy.pos;
114 // use the prob value also as volume
115 playProbs[PULSE.tick] => buffy.gain;
116 // look up the play rate
117 playRates[PULSE.tick] => buffy.rate;
118 }
119 }
120}
121
122// define function
123fun void two()
124{
125 SndBuf buffy => dac;
126 "special:dope" => buffy.read;
127 0 => buffy.gain;
128
129 while( true )
130 {
131 // wait on the shared event
132 PULSE => now;
133 // in this case play every tick
134 0 => buffy.pos;
135 // HIGH PITCHED DOH
136 2 => buffy.rate;
137 .1 => buffy.gain;
138 }
139}
examples/hid/kbhit/kb.ckrenamed from examples/event/kb.ck+0−0

File renamed without changes.

examples/hid/kbhit/kb2.ckrenamed from examples/event/kb2.ck+0−0

File renamed without changes.

examples/io/chout.ck+3−0
@@ -6,3 +6,6 @@ chout <= 1 <= " foo " <= 5.5 <= IO.newline(); · 5 unmodified lines
6 6
7// output to console on stderr7// output to console on stderr
8cherr <= 1 <= " bar " <= 5.5 <= IO.newline();8cherr <= 1 <= " bar " <= 5.5 <= IO.newline();
9
10// 'chout' is buffered; use chout.flush() to output immediately
11// 'cherr' prints immediately, flush() or no flush()
examples/io/jabberwocky.txt+37−0
@@ -0,0 +1,37 @@
1'Twas brillig, and the slithy toves
2Did gyre and gimble in the wabe:
3All mimsy were the borogoves,
4And the mome raths outgrabe.
5
6"Beware the Jabberwock, my son!
7The jaws that bite, the claws that catch!
8Beware the Jubjub bird, and shun
9The frumious Bandersnatch!"
10
11He took his vorpal sword in hand;
12Long time the manxome foe he sought—
13So rested he by the Tumtum tree
14And stood awhile in thought.
15
16And, as in uffish thought he stood,
17The Jabberwock, with eyes of flame,
18Came whiffling through the tulgey wood,
19And burbled as it came!
20
21One, two! One, two! And through and through
22The vorpal blade went snicker-snack!
23He left it dead, and with its head
24He went galumphing back.
25
26"And hast thou slain the Jabberwock?
27Come to my arms, my beamish boy!
28O frabjous day! Callooh! Callay!"
29He chortled in his joy.
30
31'Twas brillig, and the slithy toves
32Did gyre and gimble in the wabe:
33All mimsy were the borogoves,
34And the mome raths outgrabe.
35
36"Jabberwocky"
37-- by Lewis Carroll
examples/io/read-byte.ck+36−0
@@ -0,0 +1,36 @@
1//---------------------------------------------------------------------
2// name: read-byte.ck
3// desc: example of reading raw bytes from file
4// NOTE: file must be opened in BINARY mode for this to work
5//---------------------------------------------------------------------
6
7// default filepath
8me.dir() + "read-byte.txt" => string filename;
9// look at command line
10if( me.args() > 0 ) me.arg(0) => filename;
11
12// instantiate
13FileIO fio;
14// open a file (in BINARY mode)
15fio.open( filename, FileIO.READ | FileIO.BINARY );
16// ensure it's ok
17if( !fio.good() )
18{
19 cherr <= "can't open file: " <= filename <= " for reading..."
20 <= IO.newline();
21 me.exit();
22}
23
24// variable to read into
25int val;
26
27// loop until end
28while( fio.more() )
29{
30 // read the next byte
31 // (other options include IO.INT16 and IO.INT32)
32 fio.readInt( IO.INT8 ) => val;
33
34 // print the value
35 cherr <= val <= IO.newline();
36}
examples/io/read-byte.txt+2−0
@@ -0,0 +1,2 @@
1abcde
212345
examples/io/read-float.ck+33−0
@@ -0,0 +1,33 @@
1//---------------------------------------------------------------------
2// name: read-float.ck
3// desc: basic example of reading floats using FileIO
4//---------------------------------------------------------------------
5
6// default file
7me.dir() + "read-float.txt" => string filename;
8
9// look at command line
10if( me.args() > 0 ) me.arg(0) => filename;
11
12// instantiate
13FileIO fio;
14
15// open a file
16fio.open( filename, FileIO.READ );
17
18// ensure it's ok
19if( !fio.good() )
20{
21 cherr <= "can't open file: " <= filename <= " for reading..."
22 <= IO.newline();
23 me.exit();
24}
25
26// variable to read into
27float val;
28
29// loop until end
30while( fio => val )
31{
32 cherr <= val <= IO.newline();
33}
examples/io/read-float.txt+4−0
@@ -0,0 +1,4 @@
1.1 2.2 3.
28e-3 9e5 -2.2
3-4e-4
4
examples/io/read-int.ck+6−1
@@ -1,5 +1,10 @@
1//---------------------------------------------------------------------
2// name: read-int.ck
3// desc: basic example of reading int using FileIO
4//---------------------------------------------------------------------
5
1// default file6// default file
2me.sourceDir() + "/int.txt" => string filename;7me.dir() + "read-int.txt" => string filename;
3 8
4// look at command line9// look at command line
5if( me.args() > 0 ) me.arg(0) => filename;10if( me.args() > 0 ) me.arg(0) => filename;
examples/io/read-int.txtrenamed from examples/io/int.txt+0−1
@@ -1,4 +1,3 @@
11 2 311 2 3
28 9 -228 9 -2
3-43-4
4
examples/io/read-line.ck+6−1
@@ -1,5 +1,10 @@
1//---------------------------------------------------------------------
2// name: read-line.ck
3// desc: basic example of reading a line of text using FileIO
4//---------------------------------------------------------------------
5
1// default file6// default file
2me.sourceDir() + "line.txt" => string filename;7me.dir() + "read-line.txt" => string filename;
3 8
4// look at command line9// look at command line
5if( me.args() > 0 ) me.arg(0) => filename;10if( me.args() > 0 ) me.arg(0) => filename;
examples/io/read-line.txtrenamed from examples/io/line.txt+0−0

File renamed without changes.

examples/io/read-str.ck+1−1
@@ -1,5 +1,5 @@
1// default file1// default file
2me.sourceDir() + "/str.txt" => string filename;2me.dir() + "read-str.txt" => string filename;
3 3
4// look at command line4// look at command line
5if( me.args() > 0 ) me.arg(0) => filename;5if( me.args() > 0 ) me.arg(0) => filename;
examples/io/read-str.txtrenamed from examples/io/str.txt+0−0

File renamed without changes.

examples/io/read-tokens.ck+66−0
@@ -0,0 +1,66 @@
1//---------------------------------------------------------------------
2// name: read-tokens.ck
3// desc: this example shows how to:
4// 1) open a text file for reading
5// 2) read the file line by line
6// 3) for each line, tokenize it into words (separated by spaces)
7//
8// author: Ge Wang (https://ccrma.stanford.edu/~ge/)
9// date: Winter 2023
10//---------------------------------------------------------------------
11
12// path and name of file to read
13me.dir() + "jabberwocky.txt" => string filename;
14// or get filename from command line arguments, if any
15if( me.args() > 0 ) me.arg(0) => filename;
16
17// delay between words (for effect)
1850::ms => dur WORD_T;
19// delay between lines
20800::ms => dur LINE_T;
21
22// instantiate a file IO object
23FileIO fio;
24// a string tokenizer
25StringTokenizer tokenizer;
26// a line of text
27string line;
28// a word token
29string word;
30
31// open the file
32fio.open( filename, FileIO.READ );
33
34// ensure it's ok
35if( !fio.good() )
36{
37 cherr <= "can't open file: " <= filename <= " for reading..."
38 <= IO.newline();
39 me.exit();
40}
41
42// new line
43cherr <= IO.newline();
44
45// loop until end
46while( fio.more() )
47{
48 // read current line
49 fio.readLine() => line;
50 // for each line, tokenize
51 tokenizer.set( line );
52 // loop over tokens
53 while( tokenizer.more() )
54 {
55 // get the next word
56 tokenizer.next() => word;
57 // print word followed by a space
58 cherr <= word <= " ";
59 // delay for effect
60 WORD_T => now;
61 }
62 // done with current line
63 cherr <= IO.newline();
64 // delay for effect
65 LINE_T => now;
66}
examples/io/seek.ck+40−0
@@ -0,0 +1,40 @@
1// default file
2me.sourceDir() + "jabberwocky.txt" => string filename;
3
4// look at command line
5if( me.args() > 0 ) me.arg(0) => filename;
6
7// instantiate
8FileIO fio;
9
10// open a file
11fio.open( filename, FileIO.READ );
12
13// ensure it's ok
14if( !fio.good() )
15{
16 cherr <= "can't open file: " <= filename <= " for reading..." <= IO.nl();
17 me.exit();
18}
19
20// variable to read into
21string str;
22
23// loop until end
24while( fio.more() )
25{
26 chout <= fio.readLine() <= IO.newline();
27}
28
29<<< "\n------------", "" >>>;
30<<< "rewinding...", "" >>>;
31<<< "------------\n", "" >>>;
32fio.seek( 0 );
33
34// loop until end
35while( fio.more() )
36{
37 chout <= fio.readLine() <= IO.newline();
38}
39
40
examples/io/write-byte.ck+35−0
@@ -0,0 +1,35 @@
1//---------------------------------------------------------------------
2// name: write-byte.ck
3// desc: example of writing bytes in BINARY mode
4//---------------------------------------------------------------------
5// filename
6"write-byte.txt" => string filename;
7// instantiate a file IO object
8FileIO fout;
9// open for write (in BINARY mode)
10fout.open( filename, FileIO.WRITE | FileIO.BINARY );
11
12// test
13if( !fout.good() )
14{
15 cherr <= "can't open file for writing..." <= IO.newline();
16 me.exit();
17}
18
19// byte sequence to write; equivalent to:
20// abc\n123\n
21[97, 98, 99, 10, 49, 50, 51, 10] @=> int bytes[];
22
23// loop
24for( int i; i < bytes.size(); i++ )
25{
26 // write the next byte
27 // (other options include IO.INT16 and IO.INT32)
28 fout.write( bytes[i], IO.INT8 );
29}
30
31// close the thing
32fout.close();
33
34// print
35<<< "file written:", filename >>>;
examples/io/write.ck+8−3
@@ -1,7 +1,9 @@
1// filename
2"write.txt" => string filename;
3// instantiate a file IO object
1FileIO fout;4FileIO fout;
2 5// open for write (default mode: ASCII)
3// open for write6fout.open( filename, FileIO.WRITE );
4fout.open( "out.txt", FileIO.WRITE );
5 7
6// test8// test
7if( !fout.good() )9if( !fout.good() )
@@ -15,3 +17,6 @@ fout <= 1 <= " " <= 2 <= " " <= "foo" <= IO.newline(); · 7 unmodified lines
15 17
16// close the thing18// close the thing
17fout.close();19fout.close();
20
21// print
22<<< "file written:", filename >>>;
examples/io/write2.ck+8−3
@@ -1,7 +1,9 @@
1// filename
2"write2.txt" => string filename;
3// instantiate a file IO object
1FileIO fout;4FileIO fout;
2 5// open for write (default mode: ASCII)
3// open for write6fout.open( filename, FileIO.WRITE );
4fout.open( "out2.txt", FileIO.WRITE );
5 7
6// test8// test
7if( !fout.good() )9if( !fout.good() )
@@ -17,3 +19,6 @@ fout.write( "boo" ); · 9 unmodified lines
17 19
18// close the thing20// close the thing
19fout.close();21fout.close();
22
23// print
24<<< "file written:", filename >>>;
examples/machine/crash.ck+4−0
@@ -0,0 +1,4 @@
1// ummm this expicitly and deliberately crashes ChucK; use with caution
2Machine.crash();
3
4// if ChucK didn't crash, then something is *really* wrong
examples/machine/eval.ck+22−0
@@ -0,0 +1,22 @@
1// name: eval.ck
2// desc: use Machine.eval to run-time compile and run string as code
3// this enables chuck to generate more code to run!
4// powerful! perilous!
5//
6// version: need chuck-1.4.2.1 or higher
7//
8// uncomment this to print out info about Machine:
9// Machine.help();
10//
11// date: Spring 2023
12
13// our code to run
14"cherr <= 1+1 <= IO.newline();" => string codeStr;
15
16// compile the string as code and spork it as a new shred
17if( !Machine.eval( codeStr ) ) <<< "error evaluating code!", "" >>>;
18
19// NOTE: since Machine.eval() sporks the code as a child shred, we
20// need to give it a chance to run; (a parent shred upon ending will
21// also end all of its child shreds)
221::samp => now;
examples/machine/intsize.ck+2−0
@@ -0,0 +1,2 @@
1// get the size (in bits) of a chuck int
2cherr <= "size of chuck int: " <= Machine.intsize() <= "-bit" <= IO.newline();
examples/machine/is-realtime.ck+6−0
@@ -0,0 +1,6 @@
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
examples/machine/machine-shred.ck+24−0
@@ -0,0 +1,24 @@
1// on-the-fly shred management
2
3// this is kind of like using the OTF commands
4// add / remove / replace etc.
5// except this is done from code and also can be timed.
6// (this is also a hack for including other files)
7
8// infinite time loop
9while( true )
10{
11 // the path is relative to where 'chuck' is invoked
12 Machine.add( "../basic/moe.ck" ) => int moe;
13
14 // the operation is sample synchronous
15 500::ms => now;
16
17 // replace
18 Machine.replace( moe, "../basic/wind.ck" ) => int wind;
19
20 500::ms => now;
21
22 // remove
23 Machine.remove( wind );
24}
examples/math/map.ck+28−0
@@ -0,0 +1,28 @@
1// name: map.ck
2// desc: mapping a number in one range to a second range, using
3// Math.map( float value, float x1, float x2,
4// float y1, float y2 )
5//
6// version: need chuck-1.4.2.1 or higher
7//
8// NOTE: Math.map(...) allows 'value' to be outside range [x1,x2]
9// whereas Math.map2(...) clamps 'value' to range [x1,x2]
10//
11// uncomment this line to print Math library API
12// Math.help();
13//
14// author: Ge Wang
15// date: Spring 2023
16
17// map 2.5 from [2,4] to [0,1]
18<<< Math.map( 2.5, 2, 4, 0, 1 ), "" >>>;
19// map 5 from [1,10] to [-1,1]
20<<< Math.map( 5, 1, 10, -1, 1 ), "" >>>;
21// map 5 from [10,1] to [-1,1]
22<<< Math.map( 5, 10, 1, -1, 1 ), "" >>>;
23// map 1 from [2,3] to [0,100]
24<<< Math.map( 1, 2, 3, 0, 100 ), "(not clamped)" >>>;
25// clampf() and map()
26<<< Math.map2( Math.clampf(1,2,3), 2, 3, 0, 100 ), "(clamped using Math.clampf())" >>>;
27// same as Math.map2()
28<<< Math.map2( 1, 2, 3, 0, 100 ), "(clamped using Math.map2())" >>>;
examples/math/math-help.ck+6−0
@@ -0,0 +1,6 @@
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
6Math.help();
examples/osc/multi-msg/r-multi-msg.ck+1−2
@@ -29,7 +29,7 @@ fun void onNotes() · 28 unmodified lines
29 // use port 6449 (or whatever)29 // use port 6449 (or whatever)
30 6449 => oin.port;30 6449 => oin.port;
31 // create an address in the receiver, expect an int and a float31 // create an address in the receiver, expect an int and a float
32 oin.addAddress( "/foo/notes, i f" );32 oin.addAddress( "/foo/notes, if" );
33 33
34 // infinite event loop34 // infinite event loop
35 while( true )35 while( true )
@@ -87,4 +87,3 @@ fun void onHarmonics() · 51 unmodified lines
87 }87 }
88 }88 }
89}89}
90
examples/osc/multicast/r.ck+23−13
@@ -1,7 +1,7 @@
1//----------------------------------------------------------------------------1//----------------------------------------------------------------------------
2// name: r.ck2// name: r.ck ('r' is for "receiver")
3// desc: OpenSoundControl (OSC) receiver example3// desc: OpenSoundControl (OSC) receiver example
4// note: launch with s.ck (that's the sender)4// note: launch with s.ck (or another sender)
5//----------------------------------------------------------------------------5//----------------------------------------------------------------------------
6 6
7// the patch7// the patch
@@ -16,7 +16,7 @@ OscMsg msg; · 8 unmodified lines
16// use port 6449 (or whatever)16// use port 6449 (or whatever)
176449 => oin.port;176449 => oin.port;
18// create an address in the receiver, expect an int and a float18// create an address in the receiver, expect an int and a float
19oin.addAddress( "/foo/notes, i f" );19oin.addAddress( "/foo/notes" );
20 20
21// infinite event loop21// infinite event loop
22while( true )22while( true )
@@ -26,17 +26,27 @@ while( true ) · 3 unmodified lines
26 26
27 // grab the next message from the queue. 27 // grab the next message from the queue.
28 while( oin.recv(msg) )28 while( oin.recv(msg) )
29 { 29 {
30 // expected datatypes (note: as indicated by "i f")30 // print stuff
31 int i;31 cherr <= "received OSC message: \"" <= msg.address <= "\" "
32 float f;32 <= "typetag: \"" <= msg.typetag <= "\" "
33 <= "arguments: " <= msg.numArgs() <= IO.newline();
33 34
34 // fetch the first data element as int35 // check typetag for specific types
35 msg.getInt(0) => i => Std.mtof => s.freq;36 if( msg.typetag == "if" )
36 // fetch the second data element as float37 {
37 msg.getFloat(1) => f => s.gain;38 // expected datatypes: int float
39 // (note: as indicated by "if")
40 int i;
41 float f;
38 42
39 // print43 // fetch the first data element as int
40 <<< "got (via OSC):", i, f >>>;44 msg.getInt(0) => i => Std.mtof => s.freq;
45 // fetch the second data element as float
46 msg.getFloat(1) => f => s.gain;
47
48 // print
49 cherr <= i <= " " <= f <= IO.newline();
50 }
41 }51 }
42}52}
examples/osc/one2many/r.ck+22−12
@@ -1,7 +1,7 @@
1//----------------------------------------------------------------------------1//----------------------------------------------------------------------------
2// name: r.ck ('r' is for "receiver")2// name: r.ck ('r' is for "receiver")
3// desc: OpenSoundControl (OSC) receiver example3// desc: OpenSoundControl (OSC) receiver example
4// note: launch with s.ck (that's the sender)4// note: launch with s.ck (or another sender)
5//----------------------------------------------------------------------------5//----------------------------------------------------------------------------
6 6
7// the patch7// the patch
@@ -16,7 +16,7 @@ OscMsg msg; · 8 unmodified lines
16// use port 6449 (or whatever)16// use port 6449 (or whatever)
176449 => oin.port;176449 => oin.port;
18// create an address in the receiver, expect an int and a float18// create an address in the receiver, expect an int and a float
19oin.addAddress( "/foo/notes, i f" );19oin.addAddress( "/foo/notes" );
20 20
21// infinite event loop21// infinite event loop
22while( true )22while( true )
@@ -26,17 +26,27 @@ while( true ) · 3 unmodified lines
26 26
27 // grab the next message from the queue. 27 // grab the next message from the queue.
28 while( oin.recv(msg) )28 while( oin.recv(msg) )
29 { 29 {
30 // expected datatypes (note: as indicated by "i f")30 // print stuff
31 int i;31 cherr <= "received OSC message: \"" <= msg.address <= "\" "
32 float f;32 <= "typetag: \"" <= msg.typetag <= "\" "
33 <= "arguments: " <= msg.numArgs() <= IO.newline();
33 34
34 // fetch the first data element as int35 // check typetag for specific types
35 msg.getInt(0) => i => Std.mtof => s.freq;36 if( msg.typetag == "if" )
36 // fetch the second data element as float37 {
37 msg.getFloat(1) => f => s.gain;38 // expected datatypes: int float
39 // (note: as indicated by "if")
40 int i;
41 float f;
38 42
39 // print43 // fetch the first data element as int
40 <<< "got (via OSC):", i, f >>>;44 msg.getInt(0) => i => Std.mtof => s.freq;
45 // fetch the second data element as float
46 msg.getFloat(1) => f => s.gain;
47
48 // print
49 cherr <= i <= " " <= f <= IO.newline();
50 }
41 }51 }
42}52}
examples/osc/one2many/s-sender.ck+10−4
@@ -12,12 +12,18 @@ · 11 unmodified lines
12 12
13// array of destination hostnames13// array of destination hostnames
14string hostnames[0];14string hostnames[0];
15
16//----------------------------------------------------------------------------
15// appending names of destinations17// appending names of destinations
16hostnames << "localhost"; // localhost == this machine18//----------------------------------------------------------------------------
19
20// localhost == this machine
21hostnames << "localhost";
22
17// external hosts (add as many as needed)23// external hosts (add as many as needed)
18hostnames << "albacore.local";24// hostnames << "albacore.local";
19hostnames << "banhmi.local";25// hostnames << "192.168.0.10";
20hostnames << "chowder.local";26// hostnames << "host.domain.edu";
21// ...27// ...
22 28
23// sender object29// sender object
examples/osc/osc-dump.ck+20−11
@@ -1,12 +1,21 @@
1// osc_dump.ck1//----------------------------------------------------------------------------
2// listen to all OSC messages on specified port2// name: osc-dump.ck
3// desc: listen to and print all OSC messages on specified port
4// for example, launch this with s.ck
5// (make sure port is the same in both sender and receiver)
6//----------------------------------------------------------------------------
3 7
4// OSC in8// OSC in
5OscIn oin;9OscIn oin;
10
6// see if port is supplied on command line11// see if port is supplied on command line
7if( me.args() ) me.arg(0) => Std.atoi => oin.port;12if( me.args() ) me.arg(0) => Std.atoi => oin.port;
8// default port13// default port
9else 9999 => oin.port;14else 6449 => oin.port;
15
16// print
17cherr <= "listening for OSC messages over port: " <= oin.port()
18 <= "..." <= IO.newline();
10// listen to everything coming19// listen to everything coming
11oin.listenAll();20oin.listenAll();
12 21
@@ -14,7 +23,7 @@ oin.listenAll(); · 1 unmodified line
14OscMsg msg;23OscMsg msg;
15 24
16// infinite time loop25// infinite time loop
17while(true)26while( true )
18{27{
19 // wait for OSC input28 // wait for OSC input
20 oin => now;29 oin => now;
@@ -22,20 +31,20 @@ while(true) · 1 unmodified line
22 // drain the message queue31 // drain the message queue
23 while( oin.recv(msg) )32 while( oin.recv(msg) )
24 {33 {
25 // print address34 // print address and typetag
26 chout <= msg.address <= " ";35 cherr <= msg.address <= " " <= msg.typetag <= " ";
27 // loop over number of arguments36 // loop over number of arguments by type
28 for(int n; n < msg.numArgs(); n++)37 for(int n; n < msg.numArgs(); n++)
29 {38 {
30 // print by type39 // print by type
31 if(msg.typetag.charAt(n) == 'i')40 if(msg.typetag.charAt(n) == 'i')
32 chout <= msg.getInt(n) <= " ";41 cherr <= msg.getInt(n) <= " ";
33 else if(msg.typetag.charAt(n) == 'f')42 else if(msg.typetag.charAt(n) == 'f')
34 chout <= msg.getFloat(n) <= " ";43 cherr <= msg.getFloat(n) <= " ";
35 else if(msg.typetag.charAt(n) == 's')44 else if(msg.typetag.charAt(n) == 's')
36 chout <= msg.getString(n) <= " ";45 cherr <= msg.getString(n) <= " ";
37 }46 }
38 // print newline47 // print newline
39 chout <= IO.nl();48 cherr <= IO.nl();
40 }49 }
41}50}
examples/osc/r.ck+22−12
@@ -1,7 +1,7 @@
1//----------------------------------------------------------------------------1//----------------------------------------------------------------------------
2// name: r.ck ('r' is for "receiver")2// name: r.ck ('r' is for "receiver")
3// desc: OpenSoundControl (OSC) receiver example3// desc: OpenSoundControl (OSC) receiver example
4// note: launch with s.ck (that's the sender)4// note: launch with s.ck (or another sender)
5//----------------------------------------------------------------------------5//----------------------------------------------------------------------------
6 6
7// the patch7// the patch
@@ -16,7 +16,7 @@ OscMsg msg; · 8 unmodified lines
16// use port 6449 (or whatever)16// use port 6449 (or whatever)
176449 => oin.port;176449 => oin.port;
18// create an address in the receiver, expect an int and a float18// create an address in the receiver, expect an int and a float
19oin.addAddress( "/foo/notes, i f" );19oin.addAddress( "/foo/notes" );
20 20
21// infinite event loop21// infinite event loop
22while( true )22while( true )
@@ -26,17 +26,27 @@ while( true ) · 3 unmodified lines
26 26
27 // grab the next message from the queue. 27 // grab the next message from the queue.
28 while( oin.recv(msg) )28 while( oin.recv(msg) )
29 { 29 {
30 // expected datatypes (note: as indicated by "i f")30 // print stuff
31 int i;31 cherr <= "received OSC message: \"" <= msg.address <= "\" "
32 float f;32 <= "typetag: \"" <= msg.typetag <= "\" "
33 <= "arguments: " <= msg.numArgs() <= IO.newline();
33 34
34 // fetch the first data element as int35 // check typetag for specific types
35 msg.getInt(0) => i => Std.mtof => s.freq;36 if( msg.typetag == "if" )
36 // fetch the second data element as float37 {
37 msg.getFloat(1) => f => s.gain;38 // expected datatypes: int float
39 // (note: as indicated by "if")
40 int i;
41 float f;
38 42
39 // print43 // fetch the first data element as int
40 <<< "got (via OSC):", i, f >>>;44 msg.getInt(0) => i => Std.mtof => s.freq;
45 // fetch the second data element as float
46 msg.getFloat(1) => f => s.gain;
47
48 // print
49 cherr <= i <= " " <= f <= IO.newline();
50 }
41 }51 }
42}52}
examples/shred/machine.ck+0−1
@@ -22,4 +22,3 @@ while( true ) · 21 unmodified lines
22 // remove22 // remove
23 Machine.remove( wind );23 Machine.remove( wind );
24}24}
25
examples/special/LiSa-munger3.ck+1−1
@@ -97,7 +97,7 @@ fun void getgrain(int which, dur grainlen, dur rampup, dur rampdown, float rate) · 96 unmodified lines
97 // get an available voice97 // get an available voice
98 lisa[which].getVoice() => int newvoice;98 lisa[which].getVoice() => int newvoice;
99 99
100 // make sure we got a valid voice 100 // make sure we got a valid voice
101 if( newvoice > -1 )101 if( newvoice > -1 )
102 {102 {
103 // set play rate103 // set play rate
examples/type/polymorph.ck+71−0
@@ -0,0 +1,71 @@
1//---------------------------------------------------------------------
2// name: polymorph.ck
3// desc: example showing polymorphism using a base class and two
4// subclasses that each implement their own play() function;
5// a generic array of base class references is initialized
6// with the more specific subclass instances; this allows
7// for .play() to be called during the loop, the behavior of
8// which can take on different forms depending on the specific
9// type of underlying subclass.
10//
11// philosophically, polymorphism in programming amounts to
12// a structured way to "break" the established contract between
13// a type system and the programmer, allowing objects of
14// apparently the same type to exhibit different behaviors.
15//
16// author: Ge Wang (https://ccrma.stanford.edu/~ge/)
17// date: Winter 2023
18//---------------------------------------------------------------------
19// generic base class
20class Motif
21{
22 // default method to be potentially overridden in subclasses
23 fun void play()
24 {
25 <<< "base class Motif.play()", "" >>>;
26 }
27}
28
29// subclass that inherits from Motif
30// can think of MoA as a more specific kind of Motif
31class MoA extends Motif
32{
33 // define play behavior for MoA by overriding play()
34 fun void play()
35 {
36 <<< "do Motif A", "" >>>;
37 }
38}
39
40// subclass that inherits from Motif
41// can think of MoB as a more specific kind of Motif
42class MoB extends Motif
43{
44 // define play behavior for MoB by overriding play()
45 fun void play()
46 {
47 <<< "do Motif B", "" >>>;
48 }
49}
50
51// instantiate array of base class Motif references
52// each element is a specific kind of Motif
53[new MoA, new MoB, new MoB, new MoA] @=> Motif @ motifs[];
54
55// array index variable
560 => int which;
57
58// loop
59while( true )
60{
61 // will automatically call the right play() depending on
62 // the underlying type (MoA vs. MoB) as instantiated above
63 spork ~ motifs[which].play();
64
65 // advance time
66 300::ms => now;
67
68 // cycle which / print divider every cycel
69 which++; if( which >= motifs.size() )
70 { 0 => which; cherr <= "--" <= IO.newline(); }
71}
examples/type/type_object.ck+4−4
@@ -1,7 +1,7 @@
1// in contrast to primitive types, we have 1// in contrast to primitive types, we have Objects
2// objects ( more later ). These will display 2// <<< >>> will display a reference address when printed
3// a reference address when printed.
4 3
4// instantiate a base Object
5Object obj;5Object obj;
6 6// print
7<<<obj>>>;7<<<obj>>>;
examples/type/type_primitives.ck+4−2
@@ -1,5 +1,4 @@
1// quick survey of chuck primitives1// quick survey of chuck primitives
2
3// <<<>>> will print the type and value of any variable; 2// <<<>>> will print the type and value of any variable;
4 3
5// integers 4// integers
@@ -18,7 +17,7 @@ · 12 unmodified lines
18<<<f>>>;17<<<f>>>;
19 18
20// durations are a measure of time 19// durations are a measure of time
21// the value we print will be in audio samples. 20// the value we print will be in audio samples
22 21
239.0::second => dur d; 229.0::second => dur d;
24<<<d>>>;23<<<d>>>;
@@ -30,3 +29,6 @@ now => time t; · 5 unmodified lines
30<<<"waiting 10 seconds...">>>;29<<<"waiting 10 seconds...">>>;
3110::second => now;3010::second => now;
32<<<now>>>;31<<<now>>>;
32
33// there is more: see type_analysis.ck for more primitives
34// including complex and polar
examples/type/type_query.ck+75−0
@@ -0,0 +1,75 @@
1//---------------------------------------------------------------------
2// name: type-query.ck
3// desc: this example shows working with the Type type in ChucK
4// to query Types currently in the ChucK type system
5//
6// version: needs 1.4.2.1 or higher
7//
8// author: Ge Wang (https://ccrma.stanford.edu/~ge/)
9// date: Winter 2023
10//---------------------------------------------------------------------
11
12// instantiate an array of Type refs
13Type @ types[0];
14
15// get types currently in ChucK type system
16Type.getTypes(
17 types, // to be filled with results
18 false, // include objects
19 true, // include primitive types
20 false, // include special types (@array and @function)
21 true, // include builtin types
22 false, // include types from chugins
23 false, // include types from ck files in lib path
24 false // include user-defined classes
25);
26
27// print results of query
28for( int i; i < types.size(); i++ )
29{
30 cherr <= "(builtin primitive types): " <= types[i].name() <= IO.newline();
31}
32
33// get types currently in ChucK type system
34Type.getTypes(
35 types, // to be filled with results
36 true, // include objects
37 false, // include primitive types
38 false, // include special types (@array and @function)
39 true, // include builtin types
40 false, // include types from chugins
41 false, // include types from ck files in lib path
42 false // include user-defined classes
43);
44
45// print results of query
46for( int i; i < types.size(); i++ )
47{
48 cherr <= "(builtin object types): " <= types[i].name() <= IO.newline();
49}
50
51// get types currently in ChucK type system
52Type.getTypes(
53 types, // to be filled with results
54 true, // include objects
55 false, // include primitive types
56 false, // include special types (@array and @function)
57 false, // include builtin types
58 true, // include types from chugins
59 false, // include types from ck files in lib path
60 false // include user-defined classes
61);
62
63// print results of query
64for( int i; i < types.size(); i++ )
65{
66 cherr <= "(chugin types): " <= types[i].name() <= IO.newline();
67}
68
69// get all subclasses of UGen
70UGen.typeOf().children( types );
71// print results
72for( int i; i < types.size(); i++ )
73{
74 cherr <= "(UGens): " <= types[i].name() <= IO.newline();
75}
examples/type/type_type.ck+116−0
@@ -0,0 +1,116 @@
1//---------------------------------------------------------------------
2// name: type-type.ck
3// desc: this example shows working with the Type type in ChucK;
4// a Type instance represents a specific type currently in
5// in the ChucK VM
6//
7// version: needs 1.4.2.1 or higher
8//
9// author: Ge Wang (https://ccrma.stanford.edu/~ge/)
10// date: Winter 2023
11//---------------------------------------------------------------------
12
13// print some info about a Type
14fun void about( Type t )
15{
16 // divider
17 cherr <= "--------------------------------------------------" <= IO.newline();
18 // check
19 if( t == null )
20 {
21 cherr <= "null Type passed to about()!" <= IO.newline();
22 return;
23 }
24
25 //-----------------------------------------------------------------
26 // name
27 //-----------------------------------------------------------------
28 cherr <= "type name: " <= t.name();
29 repeat( t.arrayDepth() ) cherr <= "[]";
30 cherr <= IO.newline();
31
32 //-----------------------------------------------------------------
33 // parents
34 //-----------------------------------------------------------------
35 cherr <= "inherits: ";
36 // get parent
37 t.parent() @=> Type @ p;
38 // nothing
39 if( p == null ) cherr <= "(nothing)" <= IO.newline();
40 else
41 {
42 while( p != null )
43 {
44 // name of parent
45 cherr <= p.name();
46 // get parent's parent
47 p.parent() @=> p;
48 // null?
49 cherr <= ((p != null) ? " -> " : IO.newline());
50 }
51 }
52
53 //-----------------------------------------------------------------
54 // is a kind of?
55 //-----------------------------------------------------------------
56 cherr <= "isa...Object:" <= t.isa("Object") <= " "
57 <= "UGen:" <= t.isa("UGen") <= " "
58 <= "UAna:" <= t.isa("UAna") <= IO.newline();
59
60 //-----------------------------------------------------------------
61 // more attributes
62 //-----------------------------------------------------------------
63 cherr <= "primitive: " <= (t.isPrimitive() ? "YES" : "NO" ) <= IO.newline();
64 cherr <= "array: " <= (t.isArray() ? "YES" : "NO" )
65 <= " depth: " <= t.arrayDepth() <= IO.newline();
66}
67
68// make an array
69int array[2][2];
70about( array.typeOf() );
71about( Type.of( array ) );
72
73// a patch
74SinOsc foo;
75
76// get the type of classes
77SinOsc.typeOf() @=> Type @ tSinOsc;
78// print info
79about( tSinOsc );
80// get the type of an instance
81foo.typeOf() @=> Type @ tfoo;
82// print info (should be the same as above)
83about( tfoo );
84
85// get type of any value or variable
86about( Type.of( 1 ) );
87about( Type.of( 2.0 ) );
88about( Type.of( now ) );
89about( Type.of( 3::second ) );
90about( Type.of( #(1,2) ) );
91about( Type.of( %(1,pi/2) ) );
92about( Type.of( @(1,2,3) ) );
93about( Type.of( @(1,2,3,4) ) );
94about( Type.of( dac ) );
95
96// get type by name
97about( Type.find("MFCC") );
98
99// get the type of the Type type; should be itself
100Type.typeOf() @=> Type @ tType;
101
102// get all subclasses of StkInstrument
103StkInstrument.typeOf().children( types );
104// print results
105for( int i; i < types.size(); i++ )
106{
107 cherr <= "StkInstrument: " <= types[i].name() <= IO.newline();
108}
109
110// get all subclasses of UAna
111UAna.typeOf().children( types );
112// print results
113for( int i; i < types.size(); i++ )
114{
115 cherr <= "UAna: " <= types[i].name() <= IO.newline();
116}
notes/VERSIONS+639−6
@@ -1,23 +1,656 @@
11.4.1.1 (April 2022)11.5.0.0 (March 2023; was originally 1.4.2.1)
2---
3***************************************************************************
4* chuck-1.5.0.0 (chai)
5***************************************************************************
6* significant addition: ChAI (Chuck + AI)
7* significant update: WebChucK (chuck on browsers)
8* also: new features, new bug fixes, and new bugs!
9***************************************************************************
10---
11(NOTE) WebChucK (ChucK on browsers) [beta] was released during the
12development of this version. https://chuck.stanford.edu/webchuck/
13---
14(NOTE) ChAI (ChucK + AI), first appeared in beta as part of chuck-1.4.2.0;
15ChAI was used in the course Music 356 / CS 470 "Music and AI" [*] at
16Stanford University, taught by Ge Wang and Yikai Li (TA); Many thanks to
17the immensely creative students of "Music and AI". The v1.0 version of the
18ChAI API and modules is hereby released, with new additions on the way.
19
20[*] "Music and AI" (Winter 2023 Stanford University)
21https://ccrma.stanford.edu/courses/356-winter-2023/
22---
23(HISTORICAL NOTE for ChAI)
24Much of ChAI and its ways of thinking and doing can be foundationally
25attributed to the work of Dr. Rebecca Fiebrink, her landmark Ph.D. Thesis,
26/Real-time Human Interaction With Supervised Learning Algorithms for Music
27Composition and Performance/ (2011) [1], the Wekinator framework [2], her
28teaching at the intersections of AI, HCI, and Music [3], as well as earlier
29collaborations between Rebecca and Ge [4,5] including SMIRK [6] (Small Musical
30Information Retrieval toolKit; 2008; early efforts in on-the-fly learning),
31the unit analyzer framework [7] (2007; afford real-time audio feature
32extraction). All of these have directly or indirectly contributed the
33creation of ChAI. Additionally, ChAI benefitted from the teaching
34and design philosophy of Perry R. Cook (Ph.D. advisor to Rebecca and Ge
35at Princeton, and ChucK co-author), who argued for real-time human interaction,
36parametric sound synthesis, and playfulness in the design of musical tools.
37
38[1] Fiebrink, Rebecca. 2011. /Real-time Human Interaction With Supervised
39Learning Algorithms for Music Composition and Performance/ Ph.D. Thesis.
40Princeton University. https://www.cs.princeton.edu/techreports/2010/891.pdf
41[2] http://www.wekinator.org/
42Wekinator | Software for real-time, interactive machine learning
43[3] Fiebrink, Rebecca. "Machine Learning for Musicians and Artists" MOOC
44https://www.kadenze.com/courses/machine-learning-for-musicians-and-artists/info
45[4] Fiebrink, R., G. Wang, P. R. Cook. 2008. "Foundations for On-the-fly
46Learning in the ChucK Programming Language." /International Computer Music
47Conference/. https://mcd.stanford.edu/publish/files/2008-icmc-learning.pdf
48[5] Fiebrink, R., G. Wang, P. R. Cook. 2008. "Support for Music Information
49Retrieval in the ChucK Programming Language." /International Conference
50on Music Information Retrieval/ (ISMIR).
51https://mcd.stanford.edu/publish/files/2008-ismir-proto.pdf
52[6] http://smirk.cs.princeton.edu/
53sMIRk | Small Music Information Retrieval toolKit
54[7] Wang, G., R. Fiebrink, P. R. Cook. 2007. "Combining Analysis and
55Synthesis in the ChucK Programming Language." /International Computer
56Music Conference/. https://mcd.stanford.edu/publish/files/2007-icmc-uana.pdf
57---
58- (added) Wekinator [ChAI] (thanks Rebecca Fiebrink and Yikai Li)
59 |- A Wekinator utility that maps input vectors to output vectors,
60 commonly used for interactive machine learning combining
61 human-computer interaction and ML. Based on Rebecca Fiebrink's
62 Wekinator framework.
63 |- (inheritance) Wekinator -> Object
64 -------------------
65 void add();
66 Add current inputs and outputs to the observations.
67 void add( float[] inputs, float[] outputs );
68 Add given inputs and outputs to the observations.
69 void add( int output_index, float[] inputs, float[] outputs );
70 Add given inputs and outputs to the observations for the specified output.
71 void clear();
72 Clear everything except the global properties.
73 void clearAllObs();
74 Clear all observations.
75 void clearAllObs( int output_index );
76 Clear all observations for the specified output.
77 void clearObs( int lo, int hi );
78 Clear the observations by id range.
79 void clearObs( int output_index, int lo, int hi );
80 Clear the observations by id range for the specified output.
81 void deleteLastRound();
82 Delete the last round of observations.
83 void exportObs( string filename );
84 Export the observations to a file.
85 void exportObs( int output_index, string filename );
86 Export the observations for the specified output to a file.
87 int getAllRecordStatus();
88 Get the record status for all outputs.
89 int getAllRunStatus();
90 Get the run status for all outputs.
91 void getObs( float[][] obs );
92 Get the observations in the Wekinator.
93 void getObs( int output_index, float[][] obs );
94 Get the observations for the specified output in the Wekinator.
95 void getOutputProperty( int output_index, string property_name, int[] property_value );
96 Get the output property of the Wekinator. See the Wekinator documentation for more information.
97 float getOutputPropertyFloat( int output_index, int property_type, string property_name );
98 Get the output property of the Wekinator. See the Wekinator documentation for more information.
99 int getOutputPropertyInt( int output_index, string property_name );
100 Get the output property of the Wekinator. See the Wekinator documentation for more information.
101 int getOutputPropertyInt( int output_index, int property_type, string property_name );
102 Get the output property of the Wekinator. See the Wekinator documentation for more information.
103 int getOutputRecordStatus( int output_index );
104 Get the record status for the specified output.
105 int getOutputRunStatus( int output_index );
106 Get the run status for the specified output.
107 float getPropertyFloat( int property_type, string property_name );
108 Get the property of the Wekinator. See the Wekinator documentation for more information.
109 int getPropertyInt( int property_type, string property_name );
110 Get the property of the Wekinator. See the Wekinator documentation for more information.
111 int getRound();
112 Get the current recording round.
113 void importObs( string filename );
114 Import the observations from a file.
115 void input( float[] inputs );
116 Set the inputs of the Wekinator.
117 int inputDims( int n );
118 Set the number of input dimensions to Wekinator.
119 int inputDims();
120 Get the number of input dimensions to Wekinator.
121 void load( string filename );
122 Load the Wekinator from a file.
123 int modelType( int model_type );
124 Set the model type of the Wekinator. Options: AI.Regression: AI.MLP, AI.LR, AI.Classification: AI.KNN, AI.SVM, AI.DT
125 int modelType();
126 Get the model type id of the Wekinator.
127 string modelTypeName();
128 Get the model type name of the Wekinator.
129 void nextRound();
130 Bump the recording round.
131 int numObs();
132 Get the number of observations in the Wekinator.
133 int numObs( int output_index );
134 Get the number of observations for the specified output in the Wekinator.
135 void output( float[] outputs );
136 Set the outputs of the Wekinator.
137 int outputDims( int n );
138 Set the number of output dimensions to Wekinator.
139 int outputDims();
140 Get the number of output dimensions to Wekinator.
141 void predict( float[] inputs, float[] outputs );
142 Predict outputs for the given inputs.
143 void randomizeOutputs();
144 Randomize the outputs of the Wekinator.
145 void save( string filename );
146 Save the Wekinator to a file.
147 void setAllRecordStatus( int status );
148 Set the record status for all outputs.
149 void setAllRunStatus( int status );
150 Set the run status for all outputs.
151 void setOutputProperty( int output_index, string property_name, int property_value );
152 Set the output property of the Wekinator. See the Wekinator documentation for more information.
153 void setOutputProperty( int output_index, int property_type, string property_name, int property_value );
154 Set the output property of the Wekinator. See the Wekinator documentation for more information.
155 void setOutputProperty( int output_index, int property_type, string property_name, float property_value );
156 Set the output property of the Wekinator. See the Wekinator documentation for more information.
157 void setOutputProperty( int output_index, string property_name, int[] property_value );
158 Set the output property of the Wekinator. See the Wekinator documentation for more information.
159 void setOutputRecordStatus( int output_index, int status );
160 Set the record status for the specified output.
161 void setOutputRunStatus( int output_index, int status );
162 Set the run status for the specified output.
163 void setProperty( int property_type, string property_name, int property_value );
164 Set the property of the Wekinator. See the Wekinator documentation for more information.
165 void setProperty( int property_type, string property_name, float property_value );
166 Set the property of the Wekinator. See the Wekinator documentation for more information.
167 int taskType( int task_type );
168 Set the task type of the Wekinator. Options: AI.Regression, AI.Classification
169 int taskType();
170 Get the task type id of the Wekinator.
171 string taskTypeName();
172 Get the task type name of the Wekinator.
173 void train();
174 Train models for all outputs.
175- (added) new examples in ai/wekinator [ChAI]
176 |- wekinator-basic.ck -- example of basic Wekinator usage
177 |- wekinator-custom.ck -- more extensive customization for Wekinator
178 |- wekinator-import.ck -- example of importing observations from file
179- (added) MLP [ChAI] (thanks Yikai Li)
180 |- a multilayer perceptron (MLP)--a basic artificial neural
181 network--that maps an input layer to an output layer across a
182 number of fully-connected hidden layers. This implemention can be
183 trained either 1) by using one of the comprehensive .train()
184 functions OR 2) by iteratively calling .forward() and .backprop()
185 for each input-output observation, and using .shuffle() for each
186 epoch. Commonly used for regression or classification.
187 |- (inheritance) MLP -> Object
188 -------------
189 void backprop( float[] output, float learningRate );
190 (Manually) backpropagate from the output layer, for a single input-output
191 observation; compute the gradient of the loss function with respect to
192 the weights in the network, one layer at a time.
193 void forward( float[] input );
194 (Manually) forward-propagate the input vector through the network.
195 void getActivations( int layer, float[] activations );
196 Get the activations of the given layer, after a manual .forward().
197 void getBiases( int layer, float[] biases );
198 Get the biases of the given layer.
199 void getGradients( int layer, float[] gradients );
200 Get the gradients of the given layer, after a manual .backprop().
201 int getPropertyInt( int modelType, string key );
202 Get int property of name 'key' for the given model type (options: AI.MLP, AI.KNN, AI.SVM).
203 float getPropertyFloat( int modelType, string key );
204 Get float property of name 'key' for the given model type (options: AI.MLP, AI.KNN, AI.SVM).
205 void getWeights( int layer, float[][] weights );
206 Get the weights of the given layer.
207 void init( int[] unitsPerLayer );
208 Initialize the MLP with the given number of neurons per layer, as
209 specified in 'unitsPerLayer'.
210 void init( int[] nodesPerLayer, int[] activationPerLayer );
211 Initialize the MLP with the given number of nodes per layer and the given
212 ctivation function per layer, as specified in 'activationPerLayer'
213 (options: AI.Linear, AI.Sigmoid, AI.ReLU, AI.Tanh, or AI.Softmax).
214 void init( int[] nodesPerLayer, int activationFunction );
215 Initialize the MLP with the given number of nodes per layer and the given
216 activation function for all layers (options: AI.Linear, AI.Sigmoid,
217 I.ReLU, AI.Tanh, or AI.Softmax).
218 int load( string filename );
219 Load a MLP model from file.
220 int predict( float[] input, float[] output );
221 Predict the output layer from an input layer.
222 void setProperty( int modelType, string key, int value );
223 Set int property of name 'key' for the given model type (options: AI.MLP, AI.KNN, AI.SVM).
224 void setProperty( int modelType, string key, float value );
225 Set float property of name 'key' for the given model type (options: AI.MLP, AI.KNN, AI.SVM).
226 int save( string filename );
227 Save the MLP model to file.
228 void train( float[][] inputs, float[][] outputs );
229 Train the MLP with the given input and output observations with default
230 learning rate=.001 and epochs=100.
231 (Also see MLP.train(inputs,outputs,learningRate,epochs).)
232 void train( float[][] inputs, float[][] outputs, float learningRate, int epochs );
233 Train the MLP with the given input and output observations, the learning
234 rate, and number of epochs.
235 static void shuffle( float[][] X, float[][] Y );
236 (Manually) shuffle the given input and output vectors.
237- (added) new examples in ai/mlp [ChAI]
238 |- mlp.ck -- example training a basic artificial neural network
239 |- mlp-manual.ck -- example of step-by-step training an MLP, printing each stage
240 |- mlp-load.ck -- loading a saved MLP model from file
241 |- mlp-save.ck -- saving the MLP model to file'
242 |- model.txt -- an example model file
243- (added) Word2Vec [ChAI] (thanks Yikai Li)
244 |- A word embeddings utility that maps words to vectors; can load a
245 model and perform similiarity retrieval.
246 |- (inheritance) Word2Vec -> Object
247 ------------------
248 int contains( string word );
249 Query if 'word' is in the current model.
250 int dim();
251 Get number of dimensions for word embedding.
252 void getSimilar( string word, int k, string[] output );
253 Get the k most similar words to the given word.
254 void getSimilar( float[] vec, int k, string[] output );
255 Get the k most similar words to the given vector.
256 void getVector( string word, float[] output );
257 Get the vector of the given word.
258 int load( string path );
259 Load pre-trained word embedding model from the given path.
260 int load( string path, int useKDTreeDim );
261 Load pre-trained word embedding model from the given path; will use
262 KDTree for similarity searches if the data dimension is less than
263 or equal to 'useKDTreeDim'. Set 'useKDTreeDim' to 0 to use linear
264 (brute force) similarity search; set 'useKDTreeDim' to less than 0
265 to always use KDTree.
266 void minMax( float[] mins, float[] maxs );
267 Retrieve the minimums and maximums for each dimension.
268 int size();
269 Get number of words in dictionary.
270 int useKDTree();
271 Get whether a KDTree is used for similarity search.
272- (added) new examples in ai/word2vec [ChAI]
273 |- poem-i-feel.ck -- a stream of unconsciousness poem generator
274 |- poem-randomwalk.ck -- another stream of unconsciousness generator
275 |- poem-spew.ck -- yet another stream of unconsciousness generator
276 |- poem-ungenerate.ck -- interactive prompt un/de-generator
277 (need to use command line chuck)
278 |- word2vec-basic.ck -- demos load(), getVector(), getSimilar()
279 |- word2vec-prompt.ck -- command line interactive tool
280 (need to use command line chuck)
281- (added) Chroma unit analyzer (thanks Yikai Li)
282 |- A unit analyzer that computes pitch chroma
283 |- see examples/ai/features/chroma.ck
284- (added) Kurtosis unit analyzer (thanks Yikai Li)
285 |- A unit analyzer that computes kurtosis
286 |- see examples/ai/features/kurtosis.ck
287- (added) SFM unit analyzer (thanks Yikai Li)
288 |- A unit analyzer that computes spetral flatness measure
289 |- see examples/ai/features/sfm.ck
290- (moved) examples/analysis/features => examples/ai/features
291- (added) new examples in examples/ai/features
292 |- features-combined -- real-time extraction of multiple features
293 |- mfcc-basic.ck -- shows MFCC unit analyzer / feature extractor
294 |- mfcc-mean.ck -- averaged MFCC feature extraction
295 |- chroma.ck -- shows Chroma unit analyzer
296 |- kurtosis.ck -- shows Kurtosis unit analyzer
297 |- sfm.ck -- shows SFM (spectral flatness measure) unit analyzer
298- (added) PCA [ChAI] (thanks Yikai Li)
299 |- A principle component analysis (PCA) utility, commonly used
300 for dimensionality reduction.
301 |- (inheritance) PCA -> Object
302 -------------------
303 static void reduce( float[][] input, int D, float[][] output );
304 Dimension-reduce 'input' (NxM) to 'output' (NxD) as the projection
305 of the input data onto its first 'D' principle components
306- (added) example: ai/pca/pca.ck
307- (reworked) KNN [ChAI] (thanks Yikai Li)
308 |- A basic k-NN utility that searches for k nearest
309 neighbors from a set of observations / feature
310 vectors. (Also see KNN2. The differrence between KNN
311 and KNN2 is that KNN does not deal with labels whereas
312 KNN2 is designed to work with labels.)
313 |- (inheritance) KNN -> Object
314 -------------------
315 void search( float[] query, int k, int[] indices );
316 Search for the 'k' nearest neighbors of 'query' and
317 return their corresponding indices.
318 void search( float[] query, int k, int[] indices,
319 float[][] observations );
320 Search for the 'k' nearest neighbors of 'query' and
321 return their corresponding indices and observations
322 int train( float[][] x );
323 Train the KNN model with the given observations 'x'
324 void weigh( float[] weights );
325 Set the weights for each dimension in the data.
326- (added) KNN2 [ChAI] (thanks Yikai Li)
327 |- A k-NN utility that predicts probabilities of class
328 membership based on distances from a test input to its
329 k nearest neighbors. (Also see KNN. The differrence
330 between KNN and KNN2 is that KNN does not deal with
331 labels whereas KNN2 is designed to work with labels.)
332 |- (inheritance) KNN2 -> Object
333 -------------------
334 int predict( float[] query, int k, float[] prob );
335 Predict the output probabilities 'prob' given unlabeled test
336 input 'query' based on distances to 'k' nearest neighbors.
337 void search( float[] query, int k, int[] labels );
338 Search for the 'k' nearest neighbors of 'query' and return
339 their labels.
340 void search( float[] query, int k, int[] labels, int[] indices );
341 Search for the 'k' nearest neighbors of 'query' and return
342 their labels and indices.
343 void search( float[] query, int k, int[] labels, int[] indices,
344 float[][] observations);
345 Search for the 'k' nearest neighbors of 'query' and return
346 their labels, indices, and observations.
347 int train( float[][] x, int[] labels );
348 Train the KNN model with the given samples 'x' and
349 corresponding labels.
350 void weigh( float[] weights );
351 Set the weights for each dimension in the data.
352- (added) example: ai/knn/knn-search.ck
353- (added) example: ai/knn/knn2-classify.ck
354- (added) example: ai/knn/knn2-search.ck
355- (added) new static method for all Objects
356 Type Object.typeOf()
357 Get the type of this object (or class).
358- (added) new Type type
359 |- A representation of a ChucK type.
360 |- (inheritance) Type -> Object
361 --------------
362 int arrayDepth();
363 Return the number of array dimensions associated with this Type (e.g., 'int[][]' has 2; 'int' has 0).
364 void children( Type[] kids );
365 Retrieve this Type's children Types in the array 'kids'.
366 int equals( Type another );
367 Return whether this Type is same as 'another'.
368 int isArray();
369 Return whether this Type is some kind of an array.
370 int isPrimitive();
371 Return whether this is a primitive Type (e.g., 'int' and 'dur' are primitives types; 'Object' and its children Types are not).
372 int isa( Type another );
373 Return whether this Type is a kind of 'another'.
374 int isa( string another );
375 Return whether this Type is a kind of 'another'.
376 string name();
377 Return the name of this Type.
378 string origin();
379 Return a string decribing where this Type was defined (e.g., "builtin", "chugin", "user").
380 Type parent();
381 Return this Type's parent Type; returns null if this Type is 'Object'.
382 static Type find( string typeName );
383 Find and return the Type associated with 'typeName'; returns null if no Types currently in the VM with that name.
384 static void getTypes( Type[] types, int includeObjects, int includePrimitives, int includeSpecial, int includeBuiltin, int includeChugins, int includeImports, int includeUserDefined );
385 Retrieves in the array 'types' all top-level Types currently in the ChucK runtime type system; 'includeObjects'--include all Objects? 'includePrimitives'--include primitive types suchs as 'int' and 'dur'? 'includeSpecial'--include special types such as '@array' and '@function'? The results are further filtered by 'includeBuiltin'--include builtin types? 'includeChugins'--include types imported from chugins? 'includeImports'--include types imported from CK files in library path? 'includeUserDefined'--include types defined in ChucK code?
386 static void getTypes( Type[] types );
387 Retrieves in the array 'types' all top-level Types currently in the ChucK VM's type system; 'includeObjects' indicated whether to include all Objects; 'includePrimitives' indicates whether to include primitive types suchs as 'int' and 'dur'.
388 static Type of( Object obj );
389 Return the Type of 'obj'
390 static Type of( int val );
391 Return the Type associated with 'int'.
392 static Type of( float val );
393 Return the Type associated with 'float'.
394 static Type of( time val );
395 Return the Type associated with 'time'.
396 static Type of( dur val );
397 Return the Type associated with 'dur'.
398 static Type of( complex val );
399 Return the Type associated with 'complex'.
400 static Type of( polar val );
401 Return the Type associated with 'polar'.
402 static Type of( vec3 val );
403 Return the Type associated with 'vec3'.
404 static Type of( vec4 val );
405 Return the Type associated with 'vec4'.
406- (added) new examples in examples/type
407 |- polymorph.ck -- an example of polymorphism in ChucK
408 |- type_query.ck -- querying for a list of types from the ChucK runtime type system
409 |- type_type.ck -- example showing some functionalities of the Type type
410- (added) array.zero()
411 |- zero out the contents of the array; size is unchanged.
412- (added) negative indexing for arrays (thanks nshaheed)
413 |- [1,2,3,4] @=> int a[]; a[-1]; // evaluates to 4
414- (added) example: array/array_negative.ck
415- (added) Math functions
416 float map( float value, float x1, float y1,
417 float x2, float y2 );
418 Map 'value' from range [x1,y1] into range [x2,y2]; 'value'
419 can be outside range[x1,y1].
420 float map2( float value, float x1, float y1,
421 float x2, float y2 );
422 Map 'value' from range [x1,y1] into range [x2,y2]; 'value'
423 will be clamped to [x1,y1] if outside range.
424 (Math.remap() is the same as Math.map2())
425 float clampi( int value, int min, int max );
426 Clamp integer 'value' to range [min, max].
427 float clampf( float value, float min, float max );
428 Clamp float 'value' to range [min, max].
429 float cossim( float[] a[], float[] b[] );
430 Compute the cosine similarity between arrays a and b.
431 float cossim( vec3 a, vec3 b );
432 Compute the cosine similarity between 3D vectors a and b.
433 float cossim( vec4 a, vec4 b );
434 Compute the cosine similarity between 4D vectors a and b.
435 float euclidean( float[] a[], float[] b[] );
436 Compute the euclidean distance between arrays a and b.
437 float euclidean( vec3 a, vec3 b );
438 Compute the euclidean distance between 3D vectors a and b.
439 float euclidean( vec4 a, vec4 b );
440 Compute the euclidean distance between 4D vectors a and b.
441- (added) examples/math
442 |- map.ck -- shows mapping using Math.map() and Math.map2()
443 |- math-help.ck -- just prints Math API using Math.help();
444- (added) Machine functions
445 int eval( string code );
446 Evaluate a string as ChucK code, compiling it and spork it as a child
447 shred of the current shred.
448 int eval( string code, string args );
449 Evaluate a string as ChucK code, with optional arguments (bundled in
450 'args' as "ARG1:ARG2:...", compiling it and spork it as a child shred of
451 the current shred.
452 int eval( string code, string args, int count );
453 Evaluate a string as ChucK code, with optional arguments (bundled in
454 'args' as "ARG1:ARG2:...", compiling it and sporking 'count' instances as
455 a child shreds of the current shred.
456 int loglevel( int level );
457 Set log level
458 |- 0: NONE
459 |- 1: CORE
460 |- 2: SYSTEM
461 |- 3: SEVERE
462 |- 4: WARNING
463 |- 5: INFO
464 |- 6: CONFIG
465 |- 7: FINE
466 |- 8: FINER
467 |- 9: FINEST
468 |- 10: ALL
469 static int loglevel();
470 Get log level
471- (added) examples in machine
472 |- eval.ck -- demonstrate Machine.eval(), noting its behavior wrt
473 to schreduler
474- (modified) MFCC -- added (back) a missing and crucial log10() to
475 to the MFCC computation and updated implementation; output
476 range magnitudes now in the hundreds
477- (enhanced) overloaded functions with non-matching return types now
478 provide additional information in the compiler error message
479- (fixed) overloaded functions with identical arguments now will
480 correctly result in a compiler error
481- (fixed, hopefully) no more LPF and HPF filter explosion for small
482 values of .freq (<.2), large values of .freq (>Nyquist frequency),
483 or Q < 1 with high frequency below Nyquist; now LPF.freq and HPF .Q
484 are internally clamped to values between [1,SRATE/2];
485- (fixed) SndBuf crash in cases where file size is integer multiple
486 of .chunks and .chunks > 0 and reaching the end of the file
487- (fixed) SndBuf.valueAt(n) for n == file size in samples now returns 0;
488 previously this special case returned .valueAt(n-1)
489- (fixed) SndBuf assertation failure if SndBuf.chunks was set AFTER
490 loading a file; now .chunks will ONLY take effect for the next
491 SndBuf.read
492- (renamed) int LiSa.loop0(int) and int LiSa.loop0(); previously these
493 were incorrectly overloaded as "loop()" and was unavailable
494- (fixed) FileIO.seek() previously fails if EOF is reached in reading
495 a file; FileIO.seek() now functions after EOF is reached.
496- (fixed) FileIO.more() now looks ahead for EOF
497- (updated) all cherr prints now flushes immediately
498- (updated) IO.newline() or a solitary "\n" now automatically flushes
499 chout
500- (added) examples in examples/io
501 |- read-byte.ck -- reading raw bytes from file in binary mode
502 |- read-float.ck -- reading floats from file (in ASCII mode)
503 |- seek.ck -- shows FileIO.seek usage for rewind a file read
504 |- write-byte.ck -- writing raw bytes to file in binary mode
505- (added) examples in examples/events
506 |- event-x-bpm-1.ck -- example using custom Events to synchronize
507 multiple shreds to a common clock
508 |- event-x-bpm-2.ck -- same as event-x-bpm-2.ck but using arrays
509- (added) absyn tree printing for instruction dumping abysn2str()
510- (added) Machine.refcount() and refcount printing for object references
511- (updated and fixed) memory system upgrade (part 1); scope-sensitive
512 cleanup for each return statement; clarified reference counting
513 semantics; function argument release for builtin functions; improved
514 post-function call object cleanup; auto-reference-increment on
515 returned objects from all builtin/imported functions;
516- (updated) built-in abstract classes FM, StkInstrmnt, BLT, and
517 FilterBasic, when used directly, issues a WARNING level log
518 message in their respective synthesis tick functions (set log
519 level in chuck or miniAudicle to WARNING or higher to enable
520 printing), and allows program to procede silently. (Example that
521 previously crashed: 'FM fm => dac; 1::second => now;')
522- (developer) Chugin API clients in C++ now able to create
523 strings and access member variables (thanks Nick Shaheed!)
524
525
52601.4.2.0 (January 2023)
527---
528(NOTE) chuck-1.4.2.0 marks a beginning (in BETA) of chAI => ChucK for AI
529-- a set of functionalities for interactive machine learning and artful,
530humanistic design of music and artificial intelligence; it coincides with
531the new "Music and AI" course at Stanford University, designed and taught
532by Ge Wang with Ph.D. candidate Yikai Li.
533
534---
535 - (added) MFCC unit analyzer (thanks Yikai Li)
536 |- A unit analyzer that computes Mel-frequency Cepstral Coefficients
537 (MFCCs), and outputs a vector of coefficients.
538 |- (inheritance) MFCC -> UAna -> UGen -> Object
539 - (added) examples: analysis/features/mfcc.ck
540 - (added) all associative arrays now have a new method [thanks nshaheed]
541 void getKeys( string[] keys );
542 Return all keys found in associative array in keys
543 - (added) Machine.realtime(): "return true if the shred is in realtime
544 mode, false if it's in silent mode (i.e. --silent is enabled)"
545 -- thanks nshaheed --
546 - (added) Machine.silent(): "return false if the shred is in realtime
547 mode, true if it's in silent mode (i.e. --silent is enabled)"
548 -- thanks nshaheed --
549 - (fixed) .help() now more accurately prints ("unit analyzer")
550 for UAna types
551 - (fixed) multi-variable array declaration; the following should
552 now work:
553 int x[1], y[2];
554 int x, y[3];
555 - (fixed) resolved an issue with multi-dimensional arrays pre-maturely
556 releasing internal type data structure -- e.g., causing an assertion
557 failure in the second function call
558 fun void test()
559 {
560 [ [1,2,3], [1,2,3] ] @=> int arr[][];
561 }
562 test();
563 test();
564 - (fixed) internal array storage now (more) correctly differentiate
565 between int and float, on systems where the two are the same size
566 (e.g., both 32-bit or both 64-bit)
567 - (fixed) command line chuck: when opening default input audio device
568 (e.g., Microphone), check for mono devices (the case on some MacOS
569 systems) now happens earlier, before searching other 2-channel input
570 audio devices; this preempts chuck using virtual audio input devices
571 such as ZoomAudioDevice as the input device
572 - (dev) added test examples in 01-Basic related to multi-var array
573 declarations
574 - (dev) extraneous white spaces removed throughout src/core
575 ** thank you nshaheed for this soul-restoring measure **
576 - (dev) all tabs replaced with 4 spaces, now consistent across project
577 ** thank you nshaheed for this soul-restoring measure **
578 - (dev) nshaheed: linux makefiles now correctly inserts Debug (-g)
579 build flag when Debug build is enabled (default builds for Release)
580-----------------------
581(BETA) chAI-related additions: please note this is in Beta, meaning that
582APIs may change in the near future; many additions are in the works
583-----------------------
584 - (added) SVM object (thanks Yikai Li)
585 |- a support vector machine (SVM) utility trains a model and
586 predicts output based on new input
587 |- (inheritance) SVM -> Object
588 |- methods:
589 int predict( float[] x, float[] y );
590 Predict the output 'y' given the input 'x'.
591 int train( float[][] x, float[][] y );
592 Train the SVM model with the given samples 'x' and 'y'.
593 - (added) KNN object (thanks Yikai Li)
594 |- A k-nearest neighbor (KNN) utility that predicts the output of
595 a given input based on the training data
596 |- (inheritance) KNN -> Object
597 |- methods:
598 int predict( int k, float[] x, float[] prob );
599 Predict the output probabilities (in 'prob') given new input
600 'x' based on 'k' nearing neighbors.
601 int train( float[][] x, int[] y );
602 Train the KNN model with the given samples 'x' and
603 corresponding labels 'y'.
604 - (added) HMM object (thanks Yikai Li)
605 |- A hidden markov model (HMM) utility that generates a sequence
606 of observations based on the training data
607 |- (inheritance) SVM -> Object
608 |- methods:
609 int load( float[] initiailDistribution,
610 float[][] transitionMatrix,
611 float[][] emissionMatrix );
612 Initialize the HMM model with the given initial state
613 distribution, transition matrix, and emission matrix.
614 int train( int numStates, int numEmissions,
615 int[] observations );
616 Train the HMM model with the given observations.
617 int generate( int length, int[] output );
618 Generate a sequence of observations of the given length.
619 - (added) basic usage examples in examples/ai/ folder
620 |- also can use the built-in help() function
621 KNN.help(); // this will print KNN type info and API
622 SVM.help(); // this will print SVM type info and API
623 HMM.help(); // this will print HMM type info and API
624-----------------------
625(BETA) end chAI additions
626-----------------------
627
628
6291.4.1.1 (May 2022)
2---630---
3 - (added) native support for Apple Silicon (e.g., M1) as intel/apple 631 - (added) native support for Apple Silicon (e.g., M1) as intel/apple
4 universal binary; *significant* performance throughput observed632 universal binary; *significant* performance throughput observed
5 running chuck natively on Apple Silicon633 running chuck natively on Apple Silicon
6 - (added) array.popOut( int index )
7 removes an array element by index [thanks chamington and nshaheed]
8 - (modified) building from source, on MacOS command line:634 - (modified) building from source, on MacOS command line:
9 > make mac (compile for current architecture: arm64/x86_64)635 > make mac (compile for current architecture: arm64/x86_64)
10 > make mac-ub (compile universal binary: arm64/x86_64)636 > make mac-ub (compile universal binary: arm64+x86_64)
11 > lipo -archs ./chuck (checks architectures)637 > lipo -archs ./chuck (checks architectures)
12 > ./chuck --about (prints out compiled platform...638 > ./chuck --about (prints out compiled platform...
13 ...and if compiled as universal binary):639 ...and if compiled as universal binary):
14 ---640 ---
15 chuck version: 1.4.1.1 (numchucks)641 chuck version: 1.4.1.1 (numchucks)
16 macOS : 64-bit (universal binary)642 macOS : 64-bit [universal binary]
17 ---643 ---
18 > make osx (deprecated; use 'make mac' or 'make mac-ub')644 > make osx (deprecated; use 'make mac' or 'make mac-ub')
645 - (updated, pre-built executables, MacOS) both command line chuck and
646 miniAudicle are now built as universal binaries to support both
647 intel(x86_64) and Apple silicion/M1(arm64) architectures
648 - (updated, pre-built executables, MacOS) all packaged chugins are
649 now also built as universal binaries
19 - (added) Math.equal( float x, float y )650 - (added) Math.equal( float x, float y )
20 returns whether two floats are considered equivalent651 returns whether two floats are considered equivalent
652 - (added) array.popOut( int index )
653 removes an array element by index [thanks chamington and nshaheed]
21 - (added) OscOut.send() error reporting now includes the intended654 - (added) OscOut.send() error reporting now includes the intended
22 recipient (hostname:port)655 recipient (hostname:port)
23 - (added) examples/hid/gametra.ck656 - (added) examples/hid/gametra.ck
@@ -311,7 +944,7 @@ contributed. Happy ChucKing! · 287 unmodified lines
311 - (fixed) repeat statement now worked correctly for shreds944 - (fixed) repeat statement now worked correctly for shreds
312 - (fixed) crash with --adaptive:N and ugens that used tickf e.g. WvOut2945 - (fixed) crash with --adaptive:N and ugens that used tickf e.g. WvOut2
313 - (fixed) SndBuf occasional crash at end of file946 - (fixed) SndBuf occasional crash at end of file
314 - (fixed)(Win) install issue where chugins and/or example files were missing947 - (fixed) (windows) install issue where chugins and/or example files were missing
315 - (removed) --blocking functionality; callback only for real-time audio948 - (removed) --blocking functionality; callback only for real-time audio
316 - (internal) refactored VM to be more friendly for integration949 - (internal) refactored VM to be more friendly for integration
317 950
src/core/chuck.cpp+145−89
@@ -1,21 +1,21 @@
1/*----------------------------------------------------------------------------1/*----------------------------------------------------------------------------
2 ChucK Concurrent, On-the-fly Audio Programming Language2 ChucK Concurrent, On-the-fly Audio Programming Language
3 Compiler and Virtual Machine3 Compiler and Virtual Machine
4 4
5 Copyright (c) 2003 Ge Wang and Perry R. Cook. All rights reserved.5 Copyright (c) 2003 Ge Wang and Perry R. Cook. All rights reserved.
6 http://chuck.stanford.edu/6 http://chuck.stanford.edu/
7 http://chuck.cs.princeton.edu/7 http://chuck.cs.princeton.edu/
8 8
9 This program is free software; you can redistribute it and/or modify9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.12 (at your option) any later version.
13 13
14 This program is distributed in the hope that it will be useful,14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.17 GNU General Public License for more details.
18 18
19 You should have received a copy of the GNU General Public License19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-130721 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -23,8 +23,8 @@ · 1 unmodified line
23 -----------------------------------------------------------------------------*/23 -----------------------------------------------------------------------------*/
24 24
25//-----------------------------------------------------------------------------25//-----------------------------------------------------------------------------
26// file: chuck.h26// file: chuck.cpp
27// desc: chuck engine header; VM + compiler + state; no audio I/O27// desc: chuck engine chasis; VM + compiler + state; independent of audio I/O
28// REFACTOR-201728// REFACTOR-2017
29//29//
30// author: Ge Wang (https://ccrma.stanford.edu/~ge/)30// author: Ge Wang (https://ccrma.stanford.edu/~ge/)
@@ -55,10 +55,8 @@ · 24 unmodified lines
55#include <unistd.h>55#include <unistd.h>
56#include <netinet/in.h>56#include <netinet/in.h>
57#include <arpa/inet.h>57#include <arpa/inet.h>
58#include <sys/param.h> // added 1.3.0.0
59#else58#else
60#include <direct.h> // added 1.3.0.059#include <direct.h> // added 1.3.0.0
61#define MAXPATHLEN (255) // addec 1.3.0.0
62#endif // #ifndef __PLATFORM_WIN32__60#endif // #ifndef __PLATFORM_WIN32__
63 61
64 62
@@ -92,7 +90,7 @@ · 27 unmodified lines
92 90
93 91
94// chuck statics92// chuck statics
95const char ChucK::VERSION[] = "1.4.1.1 (numchucks)";93const char ChucK::VERSION[] = "1.4.2.1-bleed-2023.02.24 (numchucks)";
96t_CKUINT ChucK::o_numVMs = 0;94t_CKUINT ChucK::o_numVMs = 0;
97t_CKBOOL ChucK::o_isGlobalInit = FALSE;95t_CKBOOL ChucK::o_isGlobalInit = FALSE;
98t_CKBOOL ChucK::enableSystemCall = FALSE;96t_CKBOOL ChucK::enableSystemCall = FALSE;
@@ -112,7 +110,6 @@ const char * ChucK::version() · 13 unmodified lines
112 110
113 111
114 112
115#ifndef __DISABLE_OTF_SERVER__
116//-----------------------------------------------------------------------------113//-----------------------------------------------------------------------------
117// name: intSize()114// name: intSize()
118// desc: get chuck int size (in bits)115// desc: get chuck int size (in bits)
@@ -121,7 +118,6 @@ t_CKUINT ChucK::intSize() · 2 unmodified lines
121{118{
122 return machine_intsize();119 return machine_intsize();
123}120}
124#endif
125 121
126 122
127 123
@@ -146,7 +142,7 @@ ChucK::ChucK() · 18 unmodified lines
146 m_started = FALSE;142 m_started = FALSE;
147 // zero out the hook143 // zero out the hook
148 m_hook = NULL; // m_hook = nullptr144 m_hook = NULL; // m_hook = nullptr
149 145
150 // global init, if needed146 // global init, if needed
151 if( !o_isGlobalInit ) globalInit();147 if( !o_isGlobalInit ) globalInit();
152}148}
@@ -214,7 +210,7 @@ void ChucK::initDefaultParams() · 61 unmodified lines
214 m_listParams[CHUCK_PARAM_USER_CHUGINS] = CHUCK_PARAM_USER_CHUGINS_DEFAULT;210 m_listParams[CHUCK_PARAM_USER_CHUGINS] = CHUCK_PARAM_USER_CHUGINS_DEFAULT;
215 m_listParams[CHUCK_PARAM_USER_CHUGIN_DIRECTORIES] = CHUCK_PARAM_USER_CHUGIN_DIRECTORIES_DEFAULT;211 m_listParams[CHUCK_PARAM_USER_CHUGIN_DIRECTORIES] = CHUCK_PARAM_USER_CHUGIN_DIRECTORIES_DEFAULT;
216 m_params[CHUCK_PARAM_HINT_IS_REALTIME_AUDIO] = CHUCK_PARAM_HINT_IS_REALTIME_AUDIO_DEFAULT;212 m_params[CHUCK_PARAM_HINT_IS_REALTIME_AUDIO] = CHUCK_PARAM_HINT_IS_REALTIME_AUDIO_DEFAULT;
217 213
218 ck_param_types[CHUCK_PARAM_SAMPLE_RATE] = ck_param_int;214 ck_param_types[CHUCK_PARAM_SAMPLE_RATE] = ck_param_int;
219 ck_param_types[CHUCK_PARAM_INPUT_CHANNELS] = ck_param_int;215 ck_param_types[CHUCK_PARAM_INPUT_CHANNELS] = ck_param_int;
220 ck_param_types[CHUCK_PARAM_OUTPUT_CHANNELS] = ck_param_int;216 ck_param_types[CHUCK_PARAM_OUTPUT_CHANNELS] = ck_param_int;
@@ -410,25 +406,25 @@ bool ChucK::init() · 189 unmodified lines
410 406
411 // initialize VM407 // initialize VM
412 if( !initVM() ) goto cleanup;408 if( !initVM() ) goto cleanup;
413 409
414 // initialize compiler410 // initialize compiler
415 if( !initCompiler() ) goto cleanup;411 if( !initCompiler() ) goto cleanup;
416 412
417 // initialize chugin system413 // initialize chugin system
418 if( !initChugins() ) goto cleanup;414 if( !initChugins() ) goto cleanup;
419 415
420 // initialize OTF programming system416 // initialize OTF programming system
421 if( !initOTF() ) goto cleanup;417 if( !initOTF() ) goto cleanup;
422 418
423 // did user init?419 // did user init?
424 m_init = TRUE;420 m_init = TRUE;
425 421
426 return true;422 return true;
427 423
428cleanup:424cleanup:
429 // shutdown, dealloc425 // shutdown, dealloc
430 shutdown();426 shutdown();
431 427
432 return false;428 return false;
433}429}
434 430
@@ -447,7 +443,7 @@ bool ChucK::initVM() · 12 unmodified lines
447 t_CKUINT ins = getParamInt( CHUCK_PARAM_INPUT_CHANNELS );443 t_CKUINT ins = getParamInt( CHUCK_PARAM_INPUT_CHANNELS );
448 t_CKUINT adaptiveSize = getParamInt( CHUCK_PARAM_VM_ADAPTIVE );444 t_CKUINT adaptiveSize = getParamInt( CHUCK_PARAM_VM_ADAPTIVE );
449 t_CKBOOL halt = getParamInt( CHUCK_PARAM_VM_HALT ) != 0;445 t_CKBOOL halt = getParamInt( CHUCK_PARAM_VM_HALT ) != 0;
450 446
451 // instantiate VM447 // instantiate VM
452 m_carrier->vm = new Chuck_VM();448 m_carrier->vm = new Chuck_VM();
453 // reference back to carrier449 // reference back to carrier
@@ -458,7 +454,7 @@ bool ChucK::initVM() · 4 unmodified lines
458 CK_FPRINTF_STDERR( "[chuck]: %s\n", m_carrier->vm->last_error() );454 CK_FPRINTF_STDERR( "[chuck]: %s\n", m_carrier->vm->last_error() );
459 return false;455 return false;
460 }456 }
461 457
462 return true;458 return true;
463}459}
464 460
@@ -481,7 +477,7 @@ bool ChucK::initCompiler() · 16 unmodified lines
481 m_carrier->compiler = new Chuck_Compiler();477 m_carrier->compiler = new Chuck_Compiler();
482 // reference back to carrier478 // reference back to carrier
483 m_carrier->compiler->setCarrier( m_carrier );479 m_carrier->compiler->setCarrier( m_carrier );
484 480
485 // initialize compiler481 // initialize compiler
486 if( !m_carrier->compiler->initialize() )482 if( !m_carrier->compiler->initialize() )
487 {483 {
@@ -503,11 +499,13 @@ bool ChucK::initCompiler() · 15 unmodified lines
503 }499 }
504 500
505 std::string cwd;501 std::string cwd;
506 char cstr_cwd[MAXPATHLEN];502 char * cstr_cwd = NULL; // 1.4.2.1 (barak) | was: char cstr_cwd[MAXPATHLEN];
507 503
508 // figure out current working directory (added 1.3.0.0)504 // figure out current working directory (added 1.3.0.0)
509 // is this needed for current path to work correctly?!505 // is this needed for current path to work correctly?!
510 if( getcwd(cstr_cwd, MAXPATHLEN) == NULL )506 // was: if( getcwd(cstr_cwd, MAXPATHLEN) == NULL )
507 // let getcwd allocate memory | 1.4.2.1 (barak)
508 if( (cstr_cwd = getcwd(NULL, 0)) == NULL )
511 {509 {
512 // uh...510 // uh...
513 EM_log( CK_LOG_SEVERE, "error: unable to determine current working directory!" );511 EM_log( CK_LOG_SEVERE, "error: unable to determine current working directory!" );
@@ -516,6 +514,8 @@ bool ChucK::initCompiler() · 2 unmodified lines
516 {514 {
517 // make c++ string515 // make c++ string
518 cwd = std::string(cstr_cwd);516 cwd = std::string(cstr_cwd);
517 // reclaim memory from getcwd
518 SAFE_FREE(cstr_cwd);
519 // add trailing "/"519 // add trailing "/"
520 cwd += '/';520 cwd += '/';
521 // deferring this step until later, and only for Windows521 // deferring this step until later, and only for Windows
@@ -588,7 +588,7 @@ bool ChucK::initChugins() · 66 unmodified lines
588{588{
589 Chuck_VM_Code * code = NULL;589 Chuck_VM_Code * code = NULL;
590 Chuck_VM_Shred * shred = NULL;590 Chuck_VM_Shred * shred = NULL;
591 591
592 // whether or not chug should be enabled (added 1.3.0.0)592 // whether or not chug should be enabled (added 1.3.0.0)
593 if( getParamInt( CHUCK_PARAM_CHUGIN_ENABLE ) != 0 )593 if( getParamInt( CHUCK_PARAM_CHUGIN_ENABLE ) != 0 )
594 {594 {
@@ -603,6 +603,10 @@ bool ChucK::initChugins() · 8 unmodified lines
603 // list of individually named chug-ins (added 1.3.0.0)603 // list of individually named chug-ins (added 1.3.0.0)
604 std::list<std::string> named_dls = getParamStringList( CHUCK_PARAM_USER_CHUGINS );604 std::list<std::string> named_dls = getParamStringList( CHUCK_PARAM_USER_CHUGINS );
605 605
606 //---------------------------------------------------------------------
607 // set origin hint | 1.4.2.1 (ge) added
608 m_carrier->compiler->m_originHint = te_originChugin;
609 //---------------------------------------------------------------------
606 // log610 // log
607 EM_log( CK_LOG_SYSTEM, "loading chugins..." );611 EM_log( CK_LOG_SYSTEM, "loading chugins..." );
608 // push indent level612 // push indent level
@@ -618,10 +622,14 @@ bool ChucK::initChugins() · 9 unmodified lines
618 // pop log622 // pop log
619 EM_poplog();623 EM_poplog();
620 624
625 //---------------------------------------------------------------------
626 // set origin hint | 1.4.2.1 (ge) added
627 m_carrier->compiler->m_originHint = te_originImport;
628 //---------------------------------------------------------------------
621 // log629 // log
622 EM_log( CK_LOG_SYSTEM, "pre-loading ChucK libs..." );630 EM_log( CK_LOG_SYSTEM, "pre-loading ChucK libs..." );
623 EM_pushlog();631 EM_pushlog();
624 632
625 // iterate over list of ck files that the compiler found633 // iterate over list of ck files that the compiler found
626 for( std::list<std::string>::iterator j =634 for( std::list<std::string>::iterator j =
627 compiler()->m_cklibs_to_preload.begin();635 compiler()->m_cklibs_to_preload.begin();
@@ -629,40 +637,40 @@ bool ChucK::initChugins() · 1 unmodified line
629 {637 {
630 // the filename638 // the filename
631 std::string filename = *j;639 std::string filename = *j;
632 640
633 // log641 // log
634 EM_log( CK_LOG_SEVERE, "preloading '%s'...", filename.c_str() );642 EM_log( CK_LOG_SEVERE, "preloading '%s'...", filename.c_str() );
635 // push indent643 // push indent
636 EM_pushlog();644 EM_pushlog();
637 645
638 // SPENCERTODO: what to do for full path646 // SPENCERTODO: what to do for full path
639 std::string full_path = filename;647 std::string full_path = filename;
640 648
641 // parse, type-check, and emit649 // parse, type-check, and emit
642 if( compiler()->go( filename, NULL, NULL, full_path ) )650 if( compiler()->go( filename, NULL, NULL, full_path ) )
643 {651 {
644 // TODO: how to compilation handle?652 // TODO: how to compilation handle?
645 //return 1;653 //return 1;
646 654
647 // get the code655 // get the code
648 code = compiler()->output();656 code = compiler()->output();
649 // name it - TODO?657 // name it - TODO?
650 // code->name += string(argv[i]);658 // code->name += string(argv[i]);
651 659
652 // spork it660 // spork it
653 shred = vm()->spork( code, NULL, TRUE );661 shred = vm()->spork( code, NULL, TRUE );
654 }662 }
655 663
656 // pop indent664 // pop indent
657 EM_poplog();665 EM_poplog();
658 }666 }
659 667
660 // clear the list of chuck files to preload668 // clear the list of chuck files to preload
661 compiler()->m_cklibs_to_preload.clear();669 compiler()->m_cklibs_to_preload.clear();
662 670
663 // pop log671 // pop log
664 EM_poplog();672 EM_poplog();
665 673
666 return true;674 return true;
667 }675 }
668 else676 else
@@ -674,10 +682,16 @@ bool ChucK::initChugins() · 5 unmodified lines
674 // load user namespace682 // load user namespace
675 m_carrier->env->load_user_namespace();683 m_carrier->env->load_user_namespace();
676 684
685 // unset origin hint | 1.4.2.1 (ge) added
686 m_carrier->compiler->m_originHint = te_originUnknown;
687
677 return true;688 return true;
678 689
679error: // 1.4.1.0 (ge) added690error: // 1.4.1.0 (ge) added
680 // any cleanup goes here; none for now691
692 // unset origin hint | 1.4.2.1 (ge) added
693 m_carrier->compiler->m_originHint = te_originUnknown;
694
681 return false;695 return false;
682}696}
683 697
@@ -698,11 +712,11 @@ bool ChucK::initOTF() · 14 unmodified lines
698 // log712 // log
699 EM_log( CK_LOG_SYSTEM, "starting listener on port: %d...",713 EM_log( CK_LOG_SYSTEM, "starting listener on port: %d...",
700 m_carrier->otf_port );714 m_carrier->otf_port );
701 715
702 // start tcp server716 // start tcp server
703 m_carrier->otf_socket = ck_tcp_create( 1 );717 m_carrier->otf_socket = ck_tcp_create( 1 );
704 if( !m_carrier->otf_socket ||718 if( !m_carrier->otf_socket ||
705 !ck_bind( m_carrier->otf_socket, m_carrier->otf_port ) ||719 !ck_bind( m_carrier->otf_socket, (int)m_carrier->otf_port ) ||
706 !ck_listen( m_carrier->otf_socket, 10 ) )720 !ck_listen( m_carrier->otf_socket, 10 ) )
707 {721 {
708 CK_FPRINTF_STDERR( "[chuck]: cannot bind to tcp port %li...\n", m_carrier->otf_port );722 CK_FPRINTF_STDERR( "[chuck]: cannot bind to tcp port %li...\n", m_carrier->otf_port );
@@ -740,6 +754,8 @@ bool ChucK::shutdown() · 31 unmodified lines
740{754{
741 // log755 // log
742 EM_log( CK_LOG_SYSTEM, "shutting down ChucK instance..." );756 EM_log( CK_LOG_SYSTEM, "shutting down ChucK instance..." );
757 // push
758 EM_pushlog();
743 759
744 // stop VM760 // stop VM
745 if( m_carrier != NULL && m_carrier->vm != NULL )761 if( m_carrier != NULL && m_carrier->vm != NULL )
@@ -756,10 +772,10 @@ bool ChucK::shutdown() · 10 unmodified lines
756 // free vm, compiler, friends772 // free vm, compiler, friends
757 // first, otf773 // first, otf
758 // REFACTOR-2017 TODO: le_cb?774 // REFACTOR-2017 TODO: le_cb?
759 775
760 // STK-specific776 // STK-specific
761 stk_detach( m_carrier );777 stk_detach( m_carrier );
762 778
763#ifndef __DISABLE_OTF_SERVER__779#ifndef __DISABLE_OTF_SERVER__
764 // cancel otf thread780 // cancel otf thread
765 if( m_carrier->otf_thread )781 if( m_carrier->otf_thread )
@@ -774,7 +790,7 @@ bool ChucK::shutdown() · 8 unmodified lines
774 790
775 // close otf socket791 // close otf socket
776 if( m_carrier->otf_socket ) ck_close( m_carrier->otf_socket );792 if( m_carrier->otf_socket ) ck_close( m_carrier->otf_socket );
777 793
778 // reset794 // reset
779 m_carrier->otf_socket = NULL;795 m_carrier->otf_socket = NULL;
780 m_carrier->otf_port = 0;796 m_carrier->otf_port = 0;
@@ -797,6 +813,11 @@ bool ChucK::shutdown() · 16 unmodified lines
797 // clear flag813 // clear flag
798 m_started = FALSE;814 m_started = FALSE;
799 815
816 // log
817 EM_log( CK_LOG_SYSTEM, "ChucK instance shutdown complete." );
818 // pop
819 EM_poplog();
820
800 // done821 // done
801 return true;822 return true;
802}823}
@@ -808,7 +829,7 @@ bool ChucK::shutdown() · 5 unmodified lines
808// name: compileFile()829// name: compileFile()
809// desc: compile a file (can be called anytime)830// desc: compile a file (can be called anytime)
810//-----------------------------------------------------------------------------831//-----------------------------------------------------------------------------
811bool ChucK::compileFile( const std::string & path, const std::string & argsTogether, int count )832bool ChucK::compileFile( const std::string & path, const std::string & argsTogether, t_CKINT count )
812{833{
813 // sanity check834 // sanity check
814 if( !m_carrier->compiler )835 if( !m_carrier->compiler )
@@ -817,17 +838,23 @@ bool ChucK::compileFile( const std::string & path, const std::string & argsToget · 2 unmodified lines
817 CK_FPRINTF_STDERR( "[chuck]: compileFile() invoked before initialization ...\n" );838 CK_FPRINTF_STDERR( "[chuck]: compileFile() invoked before initialization ...\n" );
818 return false;839 return false;
819 }840 }
820 841
821 std::string filename;842 std::string filename;
822 std::vector<std::string> args;843 std::vector<std::string> args;
823 Chuck_VM_Code * code = NULL;844 Chuck_VM_Code * code = NULL;
824 Chuck_VM_Shred * shred = NULL;845 Chuck_VM_Shred * shred = NULL;
825 846 std::string full_path;
847
848 //-------------------------------------------------------------------------
849 // set origin hint | 1.4.2.1 (ge) added
850 m_carrier->compiler->m_originHint = te_originUserDefined;
851 //-------------------------------------------------------------------------
852
826 // log853 // log
827 EM_log( CK_LOG_FINE, "compiling '%s'...", path.c_str() );854 EM_log( CK_LOG_FINE, "compiling '%s'...", path.c_str() );
828 // push indent855 // push indent
829 EM_pushlog();856 EM_pushlog();
830 857
831 // append858 // append
832 std::string theThing = path + ":" + argsTogether;859 std::string theThing = path + ":" + argsTogether;
833#ifdef __ANDROID__860#ifdef __ANDROID__
@@ -847,35 +874,35 @@ bool ChucK::compileFile( const std::string & path, const std::string & argsToget · 13 unmodified lines
847 }874 }
848 }875 }
849#endif // __ANDROID__876#endif // __ANDROID__
850 877
851 // parse out command line arguments878 // parse out command line arguments
852 if( !extract_args( theThing, filename, args ) )879 if( !extract_args( theThing, filename, args ) )
853 {880 {
854 // error881 // error
855 CK_FPRINTF_STDERR( "[chuck]: malformed filename with argument list...\n" );882 CK_FPRINTF_STDERR( "[chuck]: malformed filename with argument list...\n" );
856 CK_FPRINTF_STDERR( " --> '%s'", theThing.c_str() );883 CK_FPRINTF_STDERR( " --> '%s'", theThing.c_str() );
857 return false;884 goto error;
858 }885 }
859 886
860 // construct full path to be associated with the file so me.sourceDir() works887 // construct full path to be associated with the file so me.sourceDir() works
861 // (added 1.3.0.0)888 // (added 1.3.0.0)
862 std::string full_path = get_full_path(filename);889 full_path = get_full_path(filename);
863 890
864 // parse, type-check, and emit (full_path added 1.3.0.0)891 // parse, type-check, and emit (full_path added 1.3.0.0)
865 if( !m_carrier->compiler->go( filename, NULL, NULL, full_path ) )892 if( !m_carrier->compiler->go( filename, NULL, NULL, full_path ) )
866 return false;893 goto error;
867 894
868 // get the code895 // get the code
869 code = m_carrier->compiler->output();896 code = m_carrier->compiler->output();
870 // name it897 // name it
871 code->name += path;898 code->name += path;
872 899
873 // log900 // log
874 EM_log( CK_LOG_FINE, "sporking %d %s...", count,901 EM_log( CK_LOG_FINE, "sporking %d %s...", count,
875 count == 1 ? "instance" : "instances" );902 count == 1 ? "instance" : "instances" );
876 903
877 // spork it904 // spork it
878 while( count-- )905 while( count > 0 ) // 1.4.2.1 (ge) | added changed to check for > 0, in case of negative count
879 {906 {
880 #ifndef __EMSCRIPTEN__907 #ifndef __EMSCRIPTEN__
881 // spork (for now, spork_immediate arg is always false)908 // spork (for now, spork_immediate arg is always false)
@@ -884,18 +911,30 @@ bool ChucK::compileFile( const std::string & path, const std::string & argsToget · 2 unmodified lines
884 // spork (in emscripten, need to spork immediately so can get shred id)911 // spork (in emscripten, need to spork immediately so can get shred id)
885 shred = m_carrier->vm->spork( code, NULL, TRUE );912 shred = m_carrier->vm->spork( code, NULL, TRUE );
886 #endif913 #endif
887 914
888 // add args915 // add args
889 shred->args = args;916 shred->args = args;
917 // decrement count
918 count--;
890 }919 }
891 920
892 // pop indent921 // pop indent
893 EM_poplog();922 EM_poplog();
894 923
895 // reset the parser924 // reset the parser
896 reset_parse();925 reset_parse();
897 926
927 // unset origin hint | 1.4.2.1 (ge) added
928 m_carrier->compiler->m_originHint = te_originUnknown;
929
898 return true;930 return true;
931
932error: // 1.4.2.1 (ge) added
933
934 // unset origin hint | 1.4.2.1 (ge) added
935 m_carrier->compiler->m_originHint = te_originUnknown;
936
937 return false;
899}938}
900 939
901 940
@@ -905,7 +944,7 @@ bool ChucK::compileFile( const std::string & path, const std::string & argsToget · 3 unmodified lines
905// name: compileCode()944// name: compileCode()
906// desc: compile code directly945// desc: compile code directly
907//-----------------------------------------------------------------------------946//-----------------------------------------------------------------------------
908bool ChucK::compileCode( const std::string & code, const std::string & argsTogether, int count)947bool ChucK::compileCode( const std::string & code, const std::string & argsTogether, t_CKINT count)
909{948{
910 // sanity check949 // sanity check
911 if( !m_carrier->compiler )950 if( !m_carrier->compiler )
@@ -914,71 +953,88 @@ bool ChucK::compileCode( const std::string & code, const std::string & argsToget · 2 unmodified lines
914 CK_FPRINTF_STDERR( "[chuck]: compileCode() invoked before initialization ...\n" );953 CK_FPRINTF_STDERR( "[chuck]: compileCode() invoked before initialization ...\n" );
915 return false;954 return false;
916 }955 }
917 956
918 std::vector<std::string> args;957 std::vector<std::string> args;
919 Chuck_VM_Code * vm_code = NULL;958 Chuck_VM_Code * vm_code = NULL;
920 Chuck_VM_Shred * shred = NULL;959 Chuck_VM_Shred * shred = NULL;
921 960 std::string workingDir;
961 std::string full_path;
962
963 //-------------------------------------------------------------------------
964 // set origin hint | 1.4.2.1 (ge) added
965 m_carrier->compiler->m_originHint = te_originUserDefined;
966 //-------------------------------------------------------------------------
967
922 // log968 // log
923 EM_log( CK_LOG_FINE, "compiling code from string..." );969 EM_log( CK_LOG_FINE, "compiling code from string..." );
924 // push indent970 // push indent
925 EM_pushlog();971 EM_pushlog();
926 972
927 // falsify filename / path for various logs973 // falsify filename / path for various logs
928 std::string theThing = "compiled.code:" + argsTogether;974 std::string theThing = "compiled.code:" + argsTogether;
929 std::string fakefakeFilename = "<result file name goes here>";975 std::string fakefakeFilename = "<result file name goes here>";
930 976
931 // parse out command line arguments977 // parse out command line arguments
932 if( !extract_args( theThing, fakefakeFilename, args ) )978 if( !extract_args( theThing, fakefakeFilename, args ) )
933 {979 {
934 // error980 // error
935 CK_FPRINTF_STDERR( "[chuck]: malformed filename with argument list...\n" );981 CK_FPRINTF_STDERR( "[chuck]: malformed filename with argument list...\n" );
936 CK_FPRINTF_STDERR( " --> '%s'", theThing.c_str() );982 CK_FPRINTF_STDERR( " --> '%s'", theThing.c_str() );
937 return false;983 goto error;
938 }984 }
939 985
940 // working directory986 // working directory
941 std::string workingDir = getParamString( CHUCK_PARAM_WORKING_DIRECTORY );987 workingDir = getParamString( CHUCK_PARAM_WORKING_DIRECTORY );
942 988
943 // construct full path to be associated with the file so me.sourceDir() works989 // construct full path to be associated with the file so me.sourceDir() works
944 std::string full_path = workingDir + "/compiled.code";990 full_path = workingDir + "/compiled.code";
945 // log991 // log
946 EM_log( CK_LOG_FINE, "full path: %s...", full_path.c_str() );992 EM_log( CK_LOG_FINE, "full path: %s...", full_path.c_str() );
947 993
948 // parse, type-check, and emit (full_path added 1.3.0.0)994 // parse, type-check, and emit (full_path added 1.3.0.0)
949 if( !m_carrier->compiler->go( "<compiled.code>", NULL, code.c_str(), full_path ) )995 if( !m_carrier->compiler->go( "<compiled.code>", NULL, code.c_str(), full_path ) )
950 return false;996 goto error;
951 997
952 // get the code998 // get the code
953 vm_code = m_carrier->compiler->output();999 vm_code = m_carrier->compiler->output();
954 // name it (no path to append)1000 // name it (no path to append)
955 vm_code->name += "compiled.code";1001 vm_code->name += "compiled.code";
956 1002
957 // log1003 // log
958 EM_log( CK_LOG_FINE, "sporking %d %s...", count,1004 EM_log( CK_LOG_FINE, "sporking %d %s...", count,
959 count == 1 ? "instance" : "instances" );1005 count == 1 ? "instance" : "instances" );
960 1006
961 // spork it1007 // spork it
962 while( count-- )1008 while( count-- )
963 {1009 {
964 #ifndef __EMSCRIPTEN__1010#ifndef __EMSCRIPTEN__
965 // spork (for now, spork_immediate arg is always false)1011 // spork (for now, spork_immediate arg is always false)
966 shred = m_carrier->vm->spork( vm_code, NULL, FALSE );1012 shred = m_carrier->vm->spork( vm_code, NULL, FALSE );
967 #else1013#else
968 // spork (in emscripten, need to spork immediately so can get shred id)1014 // spork (in emscripten, need to spork immediately so can get shred id)
969 shred = m_carrier->vm->spork( vm_code, NULL, TRUE );1015 shred = m_carrier->vm->spork( vm_code, NULL, TRUE );
970 #endif1016#endif
971 // add args1017 // add args
972 shred->args = args;1018 shred->args = args;
973 }1019 }
974 1020
975 // pop indent1021 // pop indent
976 EM_poplog();1022 EM_poplog();
977 1023
978 // reset the parser1024 // reset the parser
979 reset_parse();1025 reset_parse();
980 1026
1027 // unset origin hint | 1.4.2.1 (ge) added
1028 m_carrier->compiler->m_originHint = te_originUnknown;
1029
981 return true;1030 return true;
1031
1032error: // 1.4.2.1 (ge) added
1033
1034 // unset origin hint | 1.4.2.1 (ge) added
1035 m_carrier->compiler->m_originHint = te_originUnknown;
1036
1037 return false;
982}1038}
983 1039
984 1040
@@ -1003,7 +1059,7 @@ bool ChucK::start() · 18 unmodified lines
1003 // return VM running state1059 // return VM running state
1004 return m_carrier->vm->running();1060 return m_carrier->vm->running();
1005 }1061 }
1006 1062
1007 // start the VM!1063 // start the VM!
1008 if( !m_carrier->vm->running() ) m_carrier->vm->start();1064 if( !m_carrier->vm->running() ) m_carrier->vm->start();
1009 1065
@@ -1021,11 +1077,11 @@ bool ChucK::start() · 11 unmodified lines
1021// name: run()1077// name: run()
1022// desc: run engine (call from host callback)1078// desc: run engine (call from host callback)
1023//-----------------------------------------------------------------------------1079//-----------------------------------------------------------------------------
1024void ChucK::run( SAMPLE * input, SAMPLE * output, int numFrames )1080void ChucK::run( SAMPLE * input, SAMPLE * output, t_CKINT numFrames )
1025{1081{
1026 // make sure we started...1082 // make sure we started...
1027 if( !m_started ) this->start();1083 if( !m_started ) this->start();
1028 1084
1029 // call the callback1085 // call the callback
1030 m_carrier->vm->run( numFrames, input, output );1086 m_carrier->vm->run( numFrames, input, output );
1031}1087}
@@ -1112,12 +1168,12 @@ t_CKBOOL ChucK::globalInit() · 80 unmodified lines
1112{1168{
1113 // sanity check1169 // sanity check
1114 if( o_isGlobalInit ) return FALSE;1170 if( o_isGlobalInit ) return FALSE;
1115 1171
1116 // nothing to do, for now1172 // nothing to do, for now
1117 1173
1118 // set flag1174 // set flag
1119 o_isGlobalInit = TRUE;1175 o_isGlobalInit = TRUE;
1120 1176
1121 // done1177 // done
1122 return TRUE;1178 return TRUE;
1123}1179}
@@ -1135,22 +1191,22 @@ void ChucK::globalCleanup() · 11 unmodified lines
1135 if( !o_isGlobalInit ) return;1191 if( !o_isGlobalInit ) return;
1136 // set flag1192 // set flag
1137 o_isGlobalInit = FALSE;1193 o_isGlobalInit = FALSE;
1138 1194
1139 // log1195 // log
1140 EM_log( CK_LOG_INFO, "detaching all resources..." );1196 EM_log( CK_LOG_INFO, "detaching all resources..." );
1141 // push1197 // push
1142 EM_pushlog();1198 EM_pushlog();
1143 1199
1144 //#ifndef __DISABLE_MIDI__1200 //#ifndef __DISABLE_MIDI__
1145 // close midi file handles1201 // close midi file handles
1146 // midirw_detach();1202 // midirw_detach();
1147 //#endif // __DISABLE_MIDI__1203 //#endif // __DISABLE_MIDI__
1148 1204
1149 #ifndef __ALTER_HID__1205 #ifndef __ALTER_HID__
1150 // shutdown HID1206 // shutdown HID
1151 HidInManager::cleanup();1207 HidInManager::cleanup();
1152 #endif // __ALTER_HID__1208 #endif // __ALTER_HID__
1153 1209
1154 #ifndef __DISABLE_SERIAL__1210 #ifndef __DISABLE_SERIAL__
1155 // shutdown serial1211 // shutdown serial
1156 Chuck_IO_Serial::shutdown();1212 Chuck_IO_Serial::shutdown();
@@ -1163,7 +1219,7 @@ void ChucK::globalCleanup() · 6 unmodified lines
1163 1219
1164 // pop1220 // pop
1165 EM_poplog();1221 EM_poplog();
1166 1222
1167 // REFACTOR-2017 TODO Ge:1223 // REFACTOR-2017 TODO Ge:
1168 // stop le_cb, ...?1224 // stop le_cb, ...?
1169}1225}
src/core/chuck.h+15−17
@@ -1,21 +1,21 @@
1/*----------------------------------------------------------------------------1/*----------------------------------------------------------------------------
2 ChucK Concurrent, On-the-fly Audio Programming Language2 ChucK Concurrent, On-the-fly Audio Programming Language
3 Compiler and Virtual Machine3 Compiler and Virtual Machine
4 4
5 Copyright (c) 2003 Ge Wang and Perry R. Cook. All rights reserved.5 Copyright (c) 2003 Ge Wang and Perry R. Cook. All rights reserved.
6 http://chuck.stanford.edu/6 http://chuck.stanford.edu/
7 http://chuck.cs.princeton.edu/7 http://chuck.cs.princeton.edu/
8 8
9 This program is free software; you can redistribute it and/or modify9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.12 (at your option) any later version.
13 13
14 This program is distributed in the hope that it will be useful,14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.17 GNU General Public License for more details.
18 18
19 You should have received a copy of the GNU General Public License19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-130721 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -24,10 +24,10 @@ · 2 unmodified lines
24 24
25//-----------------------------------------------------------------------------25//-----------------------------------------------------------------------------
26// file: chuck.h26// file: chuck.h
27// desc: chuck engine header; VM + compiler + state; no audio I/O27// desc: chuck engine header; VM + compiler + state; independent of audio I/O
28// REFACTOR-201728// REFACTOR-2017
29//29//
30// author: Ge Wang (http://www.gewang.com/)30// author: Ge Wang (https://ccrma.stanford.edu/~ge/)
31// date: fall 201731// date: fall 2017
32//32//
33// additional authors:33// additional authors:
@@ -99,7 +99,7 @@ public: · 65 unmodified lines
99 ChucK();99 ChucK();
100 // desctructor100 // desctructor
101 virtual ~ChucK();101 virtual ~ChucK();
102 102
103public:103public:
104 // set parameter by name104 // set parameter by name
105 // -- all params should have reasonable defaults105 // -- all params should have reasonable defaults
@@ -115,9 +115,9 @@ public: · 9 unmodified lines
115 115
116public:116public:
117 // compile a file (can be called anytime)117 // compile a file (can be called anytime)
118 bool compileFile( const std::string & path, const std::string & argsTogether, int count = 1 );118 bool compileFile( const std::string & path, const std::string & argsTogether, t_CKINT count = 1 );
119 // compile code directly119 // compile code directly
120 bool compileCode( const std::string & code, const std::string & argsTogether, int count = 1 );120 bool compileCode( const std::string & code, const std::string & argsTogether, t_CKINT count = 1 );
121 121
122public:122public:
123 // initialize ChucK (using params)123 // initialize ChucK (using params)
@@ -127,12 +127,12 @@ public: · 3 unmodified lines
127 127
128public:128public:
129 // run engine (call from callback)129 // run engine (call from callback)
130 void run( SAMPLE * input, SAMPLE * output, int numFrames );130 void run( SAMPLE * input, SAMPLE * output, t_CKINT numFrames );
131 131
132public:132public:
133 // is initialized133 // is initialized
134 bool isInit() { return m_init; }134 bool isInit() { return m_init; }
135 135
136public:136public:
137 // additional native chuck bindings/types (use with extra caution)137 // additional native chuck bindings/types (use with extra caution)
138 bool bind( f_ck_query queryFunc, const std::string & name );138 bool bind( f_ck_query queryFunc, const std::string & name );
@@ -175,12 +175,10 @@ protected: · 36 unmodified lines
175public: // static functions175public: // static functions
176 // chuck version176 // chuck version
177 static const char * version();177 static const char * version();
178 #ifndef __DISABLE_OTF_SERVER__
179 // chuck int size (in bits)178 // chuck int size (in bits)
180 // (this depends on machine, which depends on OTF, so179 // (this depends on machine, which depends on OTF, so disable it if we don't have OTF)
181 // disable it if we don't have OTF)180 // 1.4.2.1 (ge) | reinstated for non-OTF, along with parts of machine
182 static t_CKUINT intSize();181 static t_CKUINT intSize();
183 #endif
184 // number of ChucK's182 // number of ChucK's
185 static t_CKUINT numVMs() { return o_numVMs; };183 static t_CKUINT numVMs() { return o_numVMs; };
186 // --poop compatibilty184 // --poop compatibilty
@@ -197,7 +195,7 @@ protected: · 10 unmodified lines
197 static const char VERSION[];195 static const char VERSION[];
198 // number of VMs -- managed from VM constructor/destructors196 // number of VMs -- managed from VM constructor/destructors
199 static t_CKUINT o_numVMs;197 static t_CKUINT o_numVMs;
200 198
201protected:199protected:
202 // initialize default params200 // initialize default params
203 void initDefaultParams();201 void initDefaultParams();
@@ -209,7 +207,7 @@ protected: · 5 unmodified lines
209 bool initChugins();207 bool initChugins();
210 // init OTF programming system208 // init OTF programming system
211 bool initOTF();209 bool initOTF();
212 210
213protected:211protected:
214 // core elements: compiler, VM, etc.212 // core elements: compiler, VM, etc.
215 Chuck_Carrier * m_carrier;213 Chuck_Carrier * m_carrier;
src/core/chuck.y+1−1
@@ -51,7 +51,7 @@ · 50 unmodified lines
51// function51// function
52int yylex( void );52int yylex( void );
53 53
54void yyerror( char *s )54void yyerror( char * s )
55{55{
56 EM_error( EM_tokPos, "%s", s );56 EM_error( EM_tokPos, "%s", s );
57}57}
src/core/chuck_absyn.cpp+49−49
@@ -29,11 +29,11 @@ · 28 unmodified lines
29// author: Ge Wang (ge@ccrma.stanford.edu | gewang@cs.princeton.edu)29// author: Ge Wang (ge@ccrma.stanford.edu | gewang@cs.princeton.edu)
30// date: Autumn 200230// date: Autumn 2002
31//-----------------------------------------------------------------------------31//-----------------------------------------------------------------------------
32#include <stdlib.h>
33#include <stdio.h>
34#include "chuck_absyn.h"32#include "chuck_absyn.h"
35#include "chuck_utils.h"33#include "chuck_utils.h"
36#include "chuck_errmsg.h"34#include "chuck_errmsg.h"
35#include <stdlib.h>
36#include <stdio.h>
37 37
38 38
39a_Program new_program( a_Section section, int pos )39a_Program new_program( a_Section section, int pos )
@@ -49,21 +49,21 @@ a_Program append_program( a_Program program, a_Section section, int pos ) · 9 unmodified lines
49{49{
50 a_Program a = new_program( section, pos );50 a_Program a = new_program( section, pos );
51 a_Program current;51 a_Program current;
52 52
53 current = program->next;53 current = program->next;
54 if (current == NULL) {54 if (current == NULL) {
55 program->next = a;55 program->next = a;
56 return program;56 return program;
57 }57 }
58 58
59 while (1)59 while (1)
60 {60 {
61 if (current->next == NULL) {61 if (current->next == NULL) {
62 current->next = a;62 current->next = a;
63 break;63 break;
64 } else {64 } else {
65 current = current->next;65 current = current->next;
66 }66 }
67 }67 }
68 return program;68 return program;
69}69}
@@ -84,7 +84,7 @@ a_Section new_section_func_def( a_Func_Def func_def, int pos ) · 14 unmodified lines
84 a->s_type = ae_section_func;84 a->s_type = ae_section_func;
85 a->func_def = func_def;85 a->func_def = func_def;
86 a->linepos = pos;86 a->linepos = pos;
87 87
88 return a;88 return a;
89}89}
90 90
@@ -94,7 +94,7 @@ a_Section new_section_class_def( a_Class_Def class_def, int pos ) · 3 unmodified lines
94 a->s_type = ae_section_class;94 a->s_type = ae_section_class;
95 a->class_def = class_def;95 a->class_def = class_def;
96 a->linepos = pos;96 a->linepos = pos;
97 97
98 return a;98 return a;
99}99}
100 100
@@ -118,11 +118,11 @@ a_Stmt_List append_stmt_list( a_Stmt_List stmt_list, a_Stmt stmt, int pos ) · 17 unmodified lines
118 stmt_list->next = a;118 stmt_list->next = a;
119 return stmt_list;119 return stmt_list;
120 }120 }
121 121
122 while (1)122 while (1)
123 {123 {
124 if (current->next == NULL) {124 if (current->next == NULL) {
125 current->next = a;125 current->next = a;
126 break;126 break;
127 } else {127 } else {
128 current = current->next;128 current = current->next;
@@ -137,7 +137,7 @@ a_Stmt new_stmt_from_expression( a_Exp exp, int pos ) · 8 unmodified lines
137 a->s_type = ae_stmt_exp;137 a->s_type = ae_stmt_exp;
138 a->stmt_exp = exp;138 a->stmt_exp = exp;
139 a->linepos = pos;139 a->linepos = pos;
140 140
141 return a;141 return a;
142}142}
143 143
@@ -234,7 +234,7 @@ a_Stmt new_stmt_from_for( a_Stmt c1, a_Stmt c2, a_Exp c3, a_Stmt body, int pos ) · 90 unmodified lines
234 a->linepos = pos;234 a->linepos = pos;
235 a->stmt_for.linepos = pos;235 a->stmt_for.linepos = pos;
236 a->stmt_for.self = a;236 a->stmt_for.self = a;
237 237
238 return a;238 return a;
239}239}
240 240
@@ -293,7 +293,7 @@ a_Stmt new_stmt_from_return( a_Exp exp, int pos ) · 52 unmodified lines
293 a->linepos = pos;293 a->linepos = pos;
294 a->stmt_return.linepos = pos;294 a->stmt_return.linepos = pos;
295 a->stmt_return.self = a;295 a->stmt_return.self = a;
296 296
297 return a;297 return a;
298}298}
299 299
@@ -318,7 +318,7 @@ a_Stmt new_stmt_from_case( a_Exp exp, int pos ) · 18 unmodified lines
318 a->stmt_case.linepos = pos;318 a->stmt_case.linepos = pos;
319 a->stmt_case.self = a;319 a->stmt_case.self = a;
320 320
321 return a; 321 return a;
322}322}
323 323
324a_Exp append_expression( a_Exp list, a_Exp exp, int pos )324a_Exp append_expression( a_Exp list, a_Exp exp, int pos )
@@ -353,7 +353,7 @@ a_Exp new_exp_from_binary( a_Exp lhs, ae_Operator oper, a_Exp rhs, int pos ) · 28 unmodified lines
353 a->linepos = pos;353 a->linepos = pos;
354 a->binary.linepos = pos;354 a->binary.linepos = pos;
355 a->binary.self = a;355 a->binary.self = a;
356 356
357 return a;357 return a;
358}358}
359 359
@@ -367,11 +367,11 @@ a_Exp new_exp_from_unary( ae_Operator oper, a_Exp exp, int pos ) · 7 unmodified lines
367 a->linepos = pos;367 a->linepos = pos;
368 a->unary.linepos = pos;368 a->unary.linepos = pos;
369 a->unary.self = a;369 a->unary.self = a;
370 370
371 return a;371 return a;
372}372}
373 373
374a_Exp new_exp_from_unary2( ae_Operator oper, a_Type_Decl type, 374a_Exp new_exp_from_unary2( ae_Operator oper, a_Type_Decl type,
375 a_Array_Sub array, int pos )375 a_Array_Sub array, int pos )
376{376{
377 a_Exp a = (a_Exp)checked_malloc( sizeof( struct a_Exp_ ) );377 a_Exp a = (a_Exp)checked_malloc( sizeof( struct a_Exp_ ) );
@@ -383,7 +383,7 @@ a_Exp new_exp_from_unary2( ae_Operator oper, a_Type_Decl type, · 5 unmodified lines
383 a->linepos = pos;383 a->linepos = pos;
384 a->unary.linepos = pos;384 a->unary.linepos = pos;
385 a->unary.self = a;385 a->unary.self = a;
386 386
387 return a;387 return a;
388}388}
389 389
@@ -397,7 +397,7 @@ a_Exp new_exp_from_unary3( ae_Operator oper, a_Stmt code, int pos ) · 7 unmodified lines
397 a->linepos = pos;397 a->linepos = pos;
398 a->unary.linepos = pos;398 a->unary.linepos = pos;
399 a->unary.self = a;399 a->unary.self = a;
400 400
401 return a;401 return a;
402}402}
403 403
@@ -411,7 +411,7 @@ a_Exp new_exp_from_cast( a_Type_Decl type, a_Exp exp, int pos ) · 7 unmodified lines
411 a->linepos = pos;411 a->linepos = pos;
412 a->cast.linepos = pos;412 a->cast.linepos = pos;
413 a->cast.self = a;413 a->cast.self = a;
414 414
415 return a;415 return a;
416}416}
417 417
@@ -496,7 +496,7 @@ a_Exp new_exp_from_id( c_str xid, int pos ) · 78 unmodified lines
496 a->primary.linepos = pos;496 a->primary.linepos = pos;
497 a->primary.self = a;497 a->primary.self = a;
498 498
499 return a; 499 return a;
500}500}
501 501
502a_Exp new_exp_from_int( long num, int pos )502a_Exp new_exp_from_int( long num, int pos )
@@ -509,7 +509,7 @@ a_Exp new_exp_from_int( long num, int pos ) · 6 unmodified lines
509 a->linepos = pos;509 a->linepos = pos;
510 a->primary.linepos = pos;510 a->primary.linepos = pos;
511 a->primary.self = a;511 a->primary.self = a;
512 512
513 return a;513 return a;
514}514}
515 515
@@ -537,7 +537,7 @@ a_Exp new_exp_from_str( c_str str, int pos ) · 21 unmodified lines
537 a->linepos = pos;537 a->linepos = pos;
538 a->primary.linepos = pos;538 a->primary.linepos = pos;
539 a->primary.self = a;539 a->primary.self = a;
540 540
541 return a;541 return a;
542}542}
543 543
@@ -551,7 +551,7 @@ a_Exp new_exp_from_char( c_str chr, int pos ) · 7 unmodified lines
551 a->linepos = pos;551 a->linepos = pos;
552 a->primary.linepos = pos;552 a->primary.linepos = pos;
553 a->primary.self = a;553 a->primary.self = a;
554 554
555 return a;555 return a;
556}556}
557 557
@@ -573,7 +573,7 @@ a_Exp new_exp_from_if( a_Exp cond, a_Exp if_exp, a_Exp else_exp, int pos ) · 15 unmodified lines
573{573{
574 a_Exp a = (a_Exp)checked_malloc( sizeof( struct a_Exp_ ) );574 a_Exp a = (a_Exp)checked_malloc( sizeof( struct a_Exp_ ) );
575 a->s_type = ae_exp_if;575 a->s_type = ae_exp_if;
576 a->s_meta = ( ( if_exp->s_meta == ae_meta_var && 576 a->s_meta = ( ( if_exp->s_meta == ae_meta_var &&
577 else_exp->s_meta == ae_meta_var ) ? ae_meta_var : ae_meta_value );577 else_exp->s_meta == ae_meta_var ) ? ae_meta_var : ae_meta_value );
578 a->exp_if.cond = cond;578 a->exp_if.cond = cond;
579 a->exp_if.if_exp = if_exp;579 a->exp_if.if_exp = if_exp;
@@ -672,7 +672,7 @@ a_Exp new_exp_from_vec( a_Vec exp, int pos ) // ge: added 1.3.5.3 · 92 unmodified lines
672 a->linepos = pos;672 a->linepos = pos;
673 a->primary.vec->self = a;673 a->primary.vec->self = a;
674 a->primary.self = a;674 a->primary.self = a;
675 675
676 return a;676 return a;
677}677}
678 678
@@ -695,17 +695,17 @@ a_Var_Decl new_var_decl( c_constr xid, a_Array_Sub array, int pos ) · 16 unmodified lines
695 a->xid = insert_symbol(xid);695 a->xid = insert_symbol(xid);
696 a->array = array;696 a->array = array;
697 a->linepos = pos;697 a->linepos = pos;
698 698
699 return a;699 return a;
700}700}
701 701
702a_Var_Decl_List new_var_decl_list( a_Var_Decl var_decl, int pos )702a_Var_Decl_List new_var_decl_list( a_Var_Decl var_decl, int pos )
703{703{
704 a_Var_Decl_List a = (a_Var_Decl_List)checked_malloc( 704 a_Var_Decl_List a = (a_Var_Decl_List)checked_malloc(
705 sizeof( struct a_Var_Decl_List_ ) );705 sizeof( struct a_Var_Decl_List_ ) );
706 a->var_decl = var_decl;706 a->var_decl = var_decl;
707 a->linepos = pos;707 a->linepos = pos;
708 708
709 return a;709 return a;
710}710}
711 711
@@ -713,7 +713,7 @@ a_Var_Decl_List prepend_var_decl_list( a_Var_Decl var_decl, a_Var_Decl_List list · 1 unmodified line
713{713{
714 a_Var_Decl_List a = new_var_decl_list( var_decl, pos );714 a_Var_Decl_List a = new_var_decl_list( var_decl, pos );
715 a->next = list;715 a->next = list;
716 716
717 return a;717 return a;
718}718}
719 719
@@ -732,7 +732,7 @@ a_Type_Decl add_type_decl_array( a_Type_Decl a, a_Array_Sub array, int pos ) · 12 unmodified lines
732{732{
733 assert( a->array == NULL );733 assert( a->array == NULL );
734 a->array = array;734 a->array = array;
735 735
736 return a;736 return a;
737}737}
738 738
@@ -748,7 +748,7 @@ a_Arg_List new_arg_list( a_Type_Decl type_decl, a_Var_Decl var_decl, int pos ) · 9 unmodified lines
748 return a;748 return a;
749}749}
750 750
751a_Arg_List prepend_arg_list( a_Type_Decl type_decl, a_Var_Decl var_decl, 751a_Arg_List prepend_arg_list( a_Type_Decl type_decl, a_Var_Decl var_decl,
752 a_Arg_List arg_list, int pos )752 a_Arg_List arg_list, int pos )
753{753{
754 a_Arg_List a = new_arg_list( type_decl, var_decl, pos );754 a_Arg_List a = new_arg_list( type_decl, var_decl, pos );
@@ -776,7 +776,7 @@ a_Func_Def new_func_def( ae_Keyword func_decl, ae_Keyword static_decl, · 21 unmodified lines
776 return a;776 return a;
777}777}
778 778
779a_Class_Def new_class_def( ae_Keyword class_decl, a_Id_List name, 779a_Class_Def new_class_def( ae_Keyword class_decl, a_Id_List name,
780 a_Class_Ext ext, a_Class_Body body, int pos )780 a_Class_Ext ext, a_Class_Body body, int pos )
781{781{
782 a_Class_Def a = (a_Class_Def)checked_malloc( sizeof( struct a_Class_Def_ ) );782 a_Class_Def a = (a_Class_Def)checked_malloc( sizeof( struct a_Class_Def_ ) );
@@ -794,7 +794,7 @@ a_Class_Def new_iface_def( ae_Keyword class_decl, a_Id_List name, · 11 unmodified lines
794{794{
795 a_Class_Def a = new_class_def( class_decl, name, ext, body, pos );795 a_Class_Def a = new_class_def( class_decl, name, ext, body, pos );
796 a->iface = 1;796 a->iface = 1;
797 797
798 return a;798 return a;
799}799}
800 800
@@ -849,7 +849,7 @@ void clean_exp( a_Exp exp ) · 48 unmodified lines
849{849{
850 if( !exp ) return;850 if( !exp ) return;
851 clean_exp( exp->next );851 clean_exp( exp->next );
852 free( exp ); 852 free( exp );
853}853}
854 854
855a_Array_Sub new_array_sub( a_Exp exp, int pos )855a_Array_Sub new_array_sub( a_Exp exp, int pos )
@@ -858,7 +858,7 @@ a_Array_Sub new_array_sub( a_Exp exp, int pos ) · 2 unmodified lines
858 a->exp_list = exp;858 a->exp_list = exp;
859 a->depth = 1;859 a->depth = 1;
860 a->linepos = pos;860 a->linepos = pos;
861 861
862 // make sure no multi862 // make sure no multi
863 /* if( exp && exp->next )863 /* if( exp && exp->next )
864 {864 {
@@ -875,9 +875,9 @@ a_Array_Sub new_array_sub( a_Exp exp, int pos ) · 10 unmodified lines
875 goto error;875 goto error;
876 }876 }
877 } */877 } */
878 878
879 return a;879 return a;
880 880
881/* error:881/* error:
882 clean_exp( exp );882 clean_exp( exp );
883 a->exp_list = NULL;883 a->exp_list = NULL;
@@ -896,7 +896,7 @@ a_Array_Sub prepend_array_sub( a_Array_Sub a, a_Exp exp, int pos ) · 12 unmodified lines
896 a->err_pos = exp->linepos; // set error for type-checker896 a->err_pos = exp->linepos; // set error for type-checker
897 goto error;897 goto error;
898 }898 }
899 899
900 // empty or not900 // empty or not
901 if( (exp && !a->exp_list) || (!exp && a->exp_list) )901 if( (exp && !a->exp_list) || (!exp && a->exp_list) )
902 {902 {
@@ -904,18 +904,18 @@ a_Array_Sub prepend_array_sub( a_Array_Sub a, a_Exp exp, int pos ) · 1 unmodified line
904 a->err_pos = pos; // set error for type-checker904 a->err_pos = pos; // set error for type-checker
905 goto error;905 goto error;
906 }906 }
907 907
908 // prepend908 // prepend
909 if( exp )909 if( exp )
910 {910 {
911 exp->next = a->exp_list;911 exp->next = a->exp_list;
912 a->exp_list = exp;912 a->exp_list = exp;
913 }913 }
914 914
915 // count915 // count
916 a->depth++;916 a->depth++;
917 return a;917 return a;
918 918
919error:919error:
920 clean_exp( exp );920 clean_exp( exp );
921 return a;921 return a;
@@ -927,7 +927,7 @@ a_Complex new_complex( a_Exp re, int pos ) · 5 unmodified lines
927 a->re = re;927 a->re = re;
928 if( re ) a->im = re->next;928 if( re ) a->im = re->next;
929 a->linepos = pos;929 a->linepos = pos;
930 930
931 return a;931 return a;
932}932}
933 933
@@ -937,7 +937,7 @@ a_Polar new_polar( a_Exp mod, int pos ) · 3 unmodified lines
937 a->mod = mod;937 a->mod = mod;
938 if( mod ) a->phase = mod->next;938 if( mod ) a->phase = mod->next;
939 a->linepos = pos;939 a->linepos = pos;
940 940
941 return a;941 return a;
942}942}
943 943
@@ -951,7 +951,7 @@ a_Vec new_vec( a_Exp e, int pos ) // ge: added 1.3.5.3 · 7 unmodified lines
951 e = e->next;951 e = e->next;
952 }952 }
953 a->linepos = pos;953 a->linepos = pos;
954 954
955 return a;955 return a;
956}956}
957 957
src/core/chuck_absyn.h+15−14
@@ -52,7 +52,7 @@ typedef enum { · 51 unmodified lines
52 ae_op_s_or_chuck, ae_op_s_xor_chuck, ae_op_shift_right_chuck,52 ae_op_s_or_chuck, ae_op_s_xor_chuck, ae_op_shift_right_chuck,
53 ae_op_shift_left_chuck, ae_op_percent_chuck, ae_op_s_chuck,53 ae_op_shift_left_chuck, ae_op_percent_chuck, ae_op_s_chuck,
54 ae_op_plusplus, ae_op_minusminus, ae_op_tilda, ae_op_exclamation,54 ae_op_plusplus, ae_op_minusminus, ae_op_tilda, ae_op_exclamation,
55 ae_op_at_chuck, ae_op_unchuck, ae_op_upchuck, ae_op_spork, 55 ae_op_at_chuck, ae_op_unchuck, ae_op_upchuck, ae_op_spork,
56 ae_op_typeof, ae_op_sizeof, ae_op_new, ae_op_arrow_left, ae_op_arrow_right56 ae_op_typeof, ae_op_sizeof, ae_op_new, ae_op_arrow_left, ae_op_arrow_right
57} ae_Operator;57} ae_Operator;
58 58
@@ -118,7 +118,7 @@ typedef struct a_Vec_ * a_Vec; // ge: added 1.3.5.3 · 59 unmodified lines
118 118
119// forward reference for type119// forward reference for type
120typedef struct Chuck_Type * t_CKTYPE;120typedef struct Chuck_Type * t_CKTYPE;
121typedef struct Chuck_Value * t_CKVALUE; 121typedef struct Chuck_Value * t_CKVALUE;
122typedef struct Chuck_Func * t_CKFUNC;122typedef struct Chuck_Func * t_CKFUNC;
123typedef struct Chuck_Namespace * t_CKNSPC;123typedef struct Chuck_Namespace * t_CKNSPC;
124typedef struct Chuck_VM_Code * t_CKVMCODE;124typedef struct Chuck_VM_Code * t_CKVMCODE;
@@ -226,10 +226,11 @@ struct a_Exp_Decl_ { a_Type_Decl type; a_Var_Decl_List var_decl_list; int num_va · 101 unmodified lines
226 t_CKTYPE ck_type; int linepos; a_Exp self; };226 t_CKTYPE ck_type; int linepos; a_Exp self; };
227struct a_Exp_Hack_ { a_Exp exp; int linepos; a_Exp self; };227struct a_Exp_Hack_ { a_Exp exp; int linepos; a_Exp self; };
228struct a_Var_Decl_List_ { a_Var_Decl var_decl; a_Var_Decl_List next; int linepos; a_Exp self; };228struct a_Var_Decl_List_ { a_Var_Decl var_decl; a_Var_Decl_List next; int linepos; a_Exp self; };
229// 1.4.2.0 (ge) added ck_type and ref, to handle multiple array decl (e.g., int x, y[], z[1];)
229struct a_Var_Decl_ { S_Symbol xid; a_Var_Decl var_decl; a_Array_Sub array; t_CKVALUE value;230struct a_Var_Decl_ { S_Symbol xid; a_Var_Decl var_decl; a_Array_Sub array; t_CKVALUE value;
230 void * addr; int linepos; a_Exp self; };231 void * addr; t_CKTYPE ck_type; int ref; int linepos; a_Exp self; };
231struct a_Type_Decl_ { a_Id_List xid; a_Array_Sub array; int ref; int linepos; /*a_Exp self;*/ };232struct a_Type_Decl_ { a_Id_List xid; a_Array_Sub array; int ref; int linepos; /*a_Exp self;*/ };
232struct a_Array_Sub_ { t_CKUINT depth; a_Exp exp_list; int linepos; a_Exp self; 233struct a_Array_Sub_ { t_CKUINT depth; a_Exp exp_list; int linepos; a_Exp self;
233 int err_num; int err_pos; };234 int err_num; int err_pos; };
234struct a_Arg_List_ { a_Type_Decl type_decl; a_Var_Decl var_decl; t_CKTYPE type;235struct a_Arg_List_ { a_Type_Decl type_decl; a_Var_Decl var_decl; t_CKTYPE type;
235 a_Arg_List next; int linepos; a_Exp self; };236 a_Arg_List next; int linepos; a_Exp self; };
@@ -238,7 +239,7 @@ struct a_Polar_ { a_Exp mod; a_Exp phase; int linepos; a_Exp self; }; · 2 unmodified lines
238struct a_Vec_ { a_Exp args; int numdims; int linepos; a_Exp self; }; // ge: added 1.3.5.3239struct a_Vec_ { a_Exp args; int numdims; int linepos; a_Exp self; }; // ge: added 1.3.5.3
239 240
240// enum primary exp type241// enum primary exp type
241typedef enum { ae_primary_var, ae_primary_num, ae_primary_float, 242typedef enum { ae_primary_var, ae_primary_num, ae_primary_float,
242 ae_primary_str, ae_primary_array, ae_primary_exp,243 ae_primary_str, ae_primary_array, ae_primary_exp,
243 ae_primary_hack, ae_primary_complex, ae_primary_polar,244 ae_primary_hack, ae_primary_complex, ae_primary_polar,
244 ae_primary_vec, ae_primary_char, ae_primary_nil245 ae_primary_vec, ae_primary_char, ae_primary_nil
@@ -248,7 +249,7 @@ struct a_Exp_Primary_ · 3 unmodified lines
248{249{
249 ae_Exp_Primary_Type s_type;250 ae_Exp_Primary_Type s_type;
250 t_CKVALUE value;251 t_CKVALUE value;
251 252
252 union253 union
253 {254 {
254 S_Symbol var;255 S_Symbol var;
@@ -286,7 +287,7 @@ struct a_Exp_ · 31 unmodified lines
286 t_CKUINT group_size;287 t_CKUINT group_size;
287 t_CKTYPE cast_to;288 t_CKTYPE cast_to;
288 t_CKUINT emit_var; // 1 = emit var, 2 = emit var and value289 t_CKUINT emit_var; // 1 = emit var, 2 = emit var and value
289 290
290 union291 union
291 {292 {
292 struct a_Exp_Binary_ binary;293 struct a_Exp_Binary_ binary;
@@ -320,15 +321,15 @@ struct a_Stmt_GotoLabel_ { S_Symbol name; int linepos; a_Stmt self; }; · 27 unmodified lines
320 321
321// enum values for stmt type322// enum values for stmt type
322typedef enum { ae_stmt_exp, ae_stmt_while, ae_stmt_until, ae_stmt_for, ae_stmt_loop,323typedef enum { ae_stmt_exp, ae_stmt_while, ae_stmt_until, ae_stmt_for, ae_stmt_loop,
323 ae_stmt_if, ae_stmt_code, ae_stmt_switch, ae_stmt_break, 324 ae_stmt_if, ae_stmt_code, ae_stmt_switch, ae_stmt_break,
324 ae_stmt_continue, ae_stmt_return, ae_stmt_case, ae_stmt_gotolabel325 ae_stmt_continue, ae_stmt_return, ae_stmt_case, ae_stmt_gotolabel
325 } ae_Stmt_Type;326 } ae_Stmt_Type;
326 327
327struct a_Stmt_328struct a_Stmt_
328{329{
329 ae_Stmt_Type s_type;330 ae_Stmt_Type s_type;
330 int skip;331 int skip;
331 332
332 union333 union
333 {334 {
334 a_Exp stmt_exp;335 a_Exp stmt_exp;
@@ -350,7 +351,7 @@ struct a_Stmt_ · 15 unmodified lines
350};351};
351 352
352struct a_Stmt_List_ { a_Stmt stmt; a_Stmt_List next; int linepos; };353struct a_Stmt_List_ { a_Stmt stmt; a_Stmt_List next; int linepos; };
353struct a_Class_Def_ { ae_Keyword decl; a_Id_List name; a_Class_Ext ext; 354struct a_Class_Def_ { ae_Keyword decl; a_Id_List name; a_Class_Ext ext;
354 a_Class_Body body; t_CKTYPE type; int iface; t_CKNSPC home;355 a_Class_Body body; t_CKTYPE type; int iface; t_CKNSPC home;
355 int linepos; };356 int linepos; };
356struct a_Class_Ext_ { a_Id_List extend_id; a_Id_List impl_list; int linepos; };357struct a_Class_Ext_ { a_Id_List extend_id; a_Id_List impl_list; int linepos; };
@@ -363,10 +364,10 @@ typedef enum { ae_func_user, ae_func_builtin } ae_Func_Type; · 6 unmodified lines
363// struct t_Func_BuiltIn_ { builtin_func_ptr func_ptr; int linepos; };364// struct t_Func_BuiltIn_ { builtin_func_ptr func_ptr; int linepos; };
364struct a_Func_Def_ {365struct a_Func_Def_ {
365 ae_Keyword func_decl;366 ae_Keyword func_decl;
366 ae_Keyword static_decl; 367 ae_Keyword static_decl;
367 a_Type_Decl type_decl;368 a_Type_Decl type_decl;
368 t_CKTYPE ret_type;369 t_CKTYPE ret_type;
369 S_Symbol name; 370 S_Symbol name;
370 a_Arg_List arg_list;371 a_Arg_List arg_list;
371 a_Stmt code;372 a_Stmt code;
372 t_CKFUNC ck_func;373 t_CKFUNC ck_func;
@@ -384,7 +385,7 @@ typedef enum { ae_section_stmt, ae_section_func, ae_section_class · 11 unmodified lines
384struct a_Section_385struct a_Section_
385{386{
386 ae_Section_Type s_type;387 ae_Section_Type s_type;
387 388
388 union389 union
389 {390 {
390 a_Stmt_List stmt_list;391 a_Stmt_List stmt_list;
src/core/chuck_carrier.cpp+4−4
@@ -1,21 +1,21 @@
1/*----------------------------------------------------------------------------1/*----------------------------------------------------------------------------
2 ChucK Concurrent, On-the-fly Audio Programming Language2 ChucK Concurrent, On-the-fly Audio Programming Language
3 Compiler and Virtual Machine3 Compiler and Virtual Machine
4 4
5 Copyright (c) 2003 Ge Wang and Perry R. Cook. All rights reserved.5 Copyright (c) 2003 Ge Wang and Perry R. Cook. All rights reserved.
6 http://chuck.stanford.edu/6 http://chuck.stanford.edu/
7 http://chuck.cs.princeton.edu/7 http://chuck.cs.princeton.edu/
8 8
9 This program is free software; you can redistribute it and/or modify9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.12 (at your option) any later version.
13 13
14 This program is distributed in the hope that it will be useful,14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.17 GNU General Public License for more details.
18 18
19 You should have received a copy of the GNU General Public License19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-130721 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
src/core/chuck_carrier.h+8−8
@@ -1,21 +1,21 @@
1/*----------------------------------------------------------------------------1/*----------------------------------------------------------------------------
2 ChucK Concurrent, On-the-fly Audio Programming Language2 ChucK Concurrent, On-the-fly Audio Programming Language
3 Compiler and Virtual Machine3 Compiler and Virtual Machine
4 4
5 Copyright (c) 2003 Ge Wang and Perry R. Cook. All rights reserved.5 Copyright (c) 2003 Ge Wang and Perry R. Cook. All rights reserved.
6 http://chuck.stanford.edu/6 http://chuck.stanford.edu/
7 http://chuck.cs.princeton.edu/7 http://chuck.cs.princeton.edu/
8 8
9 This program is free software; you can redistribute it and/or modify9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.12 (at your option) any later version.
13 13
14 This program is distributed in the hope that it will be useful,14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.17 GNU General Public License for more details.
18 18
19 You should have received a copy of the GNU General Public License19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-130721 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -75,20 +75,20 @@ struct Chuck_Carrier · 53 unmodified lines
75 Chuck_VM * vm;75 Chuck_VM * vm;
76 Chuck_IO_Chout * chout;76 Chuck_IO_Chout * chout;
77 Chuck_IO_Cherr * cherr;77 Chuck_IO_Cherr * cherr;
78 78
79 #ifndef __DISABLE_OTF_SERVER__79 #ifndef __DISABLE_OTF_SERVER__
80 // OTF programming things80 // OTF programming things
81 ck_socket otf_socket;81 ck_socket otf_socket;
82 t_CKINT otf_port;82 t_CKINT otf_port;
83 CHUCK_THREAD otf_thread;83 CHUCK_THREAD otf_thread;
84 #endif84 #endif
85 85
86 // STK-specific86 // STK-specific
87 #ifndef __DISABLE_WVOUT__87 #ifndef __DISABLE_WVOUT__
88 XWriteThread * stk_writeThread;88 XWriteThread * stk_writeThread;
89 std::map<WvOut *, WvOut *> stk_wvOutMap;89 std::map<WvOut *, WvOut *> stk_wvOutMap;
90 #endif90 #endif
91 91
92 // constructor92 // constructor
93 Chuck_Carrier() :93 Chuck_Carrier() :
94 chuck(NULL),94 chuck(NULL),
@@ -107,7 +107,7 @@ struct Chuck_Carrier · 12 unmodified lines
107 cherr( NULL )107 cherr( NULL )
108 108
109 { }109 { }
110 110
111 // get hint: is realtime audio?111 // get hint: is realtime audio?
112 t_CKBOOL hintIsRealtimeAudio();112 t_CKBOOL hintIsRealtimeAudio();
113};113};
src/core/chuck_compile.cpp+107−103
@@ -43,10 +43,8 @@ · 42 unmodified lines
43#include "uana_xform.h"43#include "uana_xform.h"
44#include "uana_extract.h"44#include "uana_extract.h"
45 45
46#ifndef __DISABLE_OTF_SERVER__
47#include "ulib_machine.h"46#include "ulib_machine.h"
48#endif47#include "ulib_ai.h"
49
50#include "ulib_math.h"48#include "ulib_math.h"
51#include "ulib_std.h"49#include "ulib_std.h"
52 50
@@ -71,8 +69,8 @@ using namespace std; · 18 unmodified lines
71 69
72// function prototypes70// function prototypes
73t_CKBOOL load_internal_modules( Chuck_Compiler * compiler );71t_CKBOOL load_internal_modules( Chuck_Compiler * compiler );
74t_CKBOOL load_external_modules( Chuck_Compiler * compiler, 72t_CKBOOL load_external_modules( Chuck_Compiler * compiler,
75 const char * extension, 73 const char * extension,
76 std::list<std::string> & chugin_search_paths,74 std::list<std::string> & chugin_search_paths,
77 std::list<std::string> & named_dls);75 std::list<std::string> & named_dls);
78t_CKBOOL load_module( Chuck_Compiler * compiler, Chuck_Env * env,76t_CKBOOL load_module( Chuck_Compiler * compiler, Chuck_Env * env,
@@ -89,9 +87,12 @@ Chuck_Compiler::Chuck_Compiler() · 10 unmodified lines
89{87{
90 emitter = NULL;88 emitter = NULL;
91 code = NULL;89 code = NULL;
92 90
93 // REFACTOR-2017: add carrier91 // REFACTOR-2017: add carrier
94 m_carrier = NULL;92 m_carrier = NULL;
93
94 // origin hint | 1.4.2.1 (ge) added
95 m_originHint = te_originUnknown;
95}96}
96 97
97 98
@@ -121,11 +122,14 @@ t_CKBOOL Chuck_Compiler::initialize() · 23 unmodified lines
121 // push indent level122 // push indent level
122 EM_pushlog();123 EM_pushlog();
123 124
125 // set origin hint
126 m_originHint = te_originBuiltin;
127
124 // allocate the type checker128 // allocate the type checker
125 Chuck_Env * env = type_engine_init( m_carrier );129 Chuck_Env * env = type_engine_init( m_carrier );
126 // add reference130 // add reference
127 env->add_ref();131 env->add_ref();
128 132
129 // allocate the emitter133 // allocate the emitter
130 emitter = emit_engine_init( env );134 emitter = emit_engine_init( env );
131 // add reference135 // add reference
@@ -136,7 +140,10 @@ t_CKBOOL Chuck_Compiler::initialize() · 4 unmodified lines
136 // load internal libs140 // load internal libs
137 if( !load_internal_modules( this ) )141 if( !load_internal_modules( this ) )
138 goto error;142 goto error;
139 143
144 // unset origin hint
145 m_originHint = te_originUnknown;
146
140 // pop indent147 // pop indent
141 EM_poplog();148 EM_poplog();
142 149
@@ -174,13 +181,13 @@ void Chuck_Compiler::shutdown() · 31 unmodified lines
174 code = NULL;181 code = NULL;
175 m_auto_depend = FALSE;182 m_auto_depend = FALSE;
176 m_recent.clear();183 m_recent.clear();
177 184
178 for(std::list<Chuck_DLL *>::iterator i = m_dlls.begin();185 for(std::list<Chuck_DLL *>::iterator i = m_dlls.begin();
179 i != m_dlls.end(); i++)186 i != m_dlls.end(); i++)
180 {187 {
181 delete (*i);188 delete (*i);
182 }189 }
183 190
184 m_dlls.clear();191 m_dlls.clear();
185 192
186 // pop indent193 // pop indent
@@ -203,7 +210,7 @@ t_CKBOOL Chuck_Compiler::bind( f_ck_query query_func, const std::string & name, · 16 unmodified lines
203 name.c_str() );210 name.c_str() );
204 // push indent level211 // push indent level
205 EM_pushlog();212 EM_pushlog();
206 213
207 // get env214 // get env
208 Chuck_Env * env = this->env();215 Chuck_Env * env = this->env();
209 // make context216 // make context
@@ -213,32 +220,32 @@ t_CKBOOL Chuck_Compiler::bind( f_ck_query query_func, const std::string & name, · 3 unmodified lines
213 env->reset();220 env->reset();
214 // load it221 // load it
215 type_engine_load_context( env, context );222 type_engine_load_context( env, context );
216 223
217 // do it224 // do it
218 if( !load_module( this, env, query_func, name.c_str(), nspc.c_str() ) ) goto error;225 if( !load_module( this, env, query_func, name.c_str(), nspc.c_str() ) ) goto error;
219 226
220 // clear context227 // clear context
221 type_engine_unload_context( env );228 type_engine_unload_context( env );
222 229
223 // commit what is in the type checker at this point230 // commit what is in the type checker at this point
224 env->global()->commit();231 env->global()->commit();
225 232
226 // pop indent level233 // pop indent level
227 EM_poplog();234 EM_poplog();
228 235
229 return TRUE;236 return TRUE;
230 237
231error:238error:
232 239
233 // probably dangerous: rollback240 // probably dangerous: rollback
234 env->global()->rollback();241 env->global()->rollback();
235 242
236 // clear context243 // clear context
237 type_engine_unload_context( env );244 type_engine_unload_context( env );
238 245
239 // pop indent level246 // pop indent level
240 EM_poplog();247 EM_poplog();
241 248
242 return FALSE;249 return FALSE;
243}250}
244 251
@@ -267,10 +274,10 @@ void Chuck_Compiler::set_auto_depend( t_CKBOOL v ) · 22 unmodified lines
267t_CKBOOL Chuck_Compiler::go( const string & filename, FILE * fd, const char * str_src, const string & full_path )274t_CKBOOL Chuck_Compiler::go( const string & filename, FILE * fd, const char * str_src, const string & full_path )
268{275{
269 t_CKBOOL ret = TRUE;276 t_CKBOOL ret = TRUE;
270 Chuck_Context * context = NULL;277 // Chuck_Context * context = NULL;
271 278
272 EM_reset_msg();279 EM_reset_msg();
273 280
274 // check to see if resolve dependencies automatically281 // check to see if resolve dependencies automatically
275 if( !m_auto_depend )282 if( !m_auto_depend )
276 {283 {
@@ -286,7 +293,7 @@ t_CKBOOL Chuck_Compiler::go( const string & filename, FILE * fd, const char * st · 9 unmodified lines
286 // 1.4.1.0 (ge) | added to unset the fileName reference, which determines293 // 1.4.1.0 (ge) | added to unset the fileName reference, which determines
287 // how messages print to console (e.g., [file.ck]: or [chuck]:)294 // how messages print to console (e.g., [file.ck]: or [chuck]:)
288 EM_change_file( NULL );295 EM_change_file( NULL );
289 296
290 return ret;297 return ret;
291}298}
292 299
@@ -307,7 +314,7 @@ t_CKBOOL Chuck_Compiler::resolve( const string & type ) · 14 unmodified lines
307 314
308 // look up if name is already parsed315 // look up if name is already parsed
309 316
310 317
311 318
312 return ret;319 return ret;
313}320}
@@ -450,7 +457,7 @@ t_CKBOOL Chuck_Compiler::do_normal_depend( const string & filename, FILE * fd, · 136 unmodified lines
450 // make the context457 // make the context
451 context = type_engine_make_context( g_program, filename );458 context = type_engine_make_context( g_program, filename );
452 if( !context ) return FALSE;459 if( !context ) return FALSE;
453 460
454 // remember full path (added 1.3.0.0)461 // remember full path (added 1.3.0.0)
455 context->full_path = full_path;462 context->full_path = full_path;
456 463
@@ -510,26 +517,26 @@ t_CKBOOL Chuck_Compiler::do_auto_depend( const string & filename, FILE * fd, · 53 unmodified lines
510{517{
511 t_CKBOOL ret = TRUE;518 t_CKBOOL ret = TRUE;
512 Chuck_Context * context = NULL;519 Chuck_Context * context = NULL;
513 520
514 // parse the code521 // parse the code
515 if( !chuck_parse( filename.c_str(), fd, str_src ) )522 if( !chuck_parse( filename.c_str(), fd, str_src ) )
516 return FALSE;523 return FALSE;
517 524
518 // make the context525 // make the context
519 context = type_engine_make_context( g_program, filename );526 context = type_engine_make_context( g_program, filename );
520 if( !context ) return FALSE;527 if( !context ) return FALSE;
521 528
522 // reset the env529 // reset the env
523 env()->reset();530 env()->reset();
524 531
525 // load the context532 // load the context
526 if( !type_engine_load_context( env(), context ) )533 if( !type_engine_load_context( env(), context ) )
527 return FALSE;534 return FALSE;
528 535
529 // do entire file536 // do entire file
530 if( !do_entire_file( context ) )537 if( !do_entire_file( context ) )
531 { ret = FALSE; goto cleanup; }538 { ret = FALSE; goto cleanup; }
532 539
533 // get the code540 // get the code
534 if( !(code = context->code()) )541 if( !(code = context->code()) )
535 {542 {
@@ -537,21 +544,21 @@ t_CKBOOL Chuck_Compiler::do_auto_depend( const string & filename, FILE * fd, · 1 unmodified line
537 EM_error2( 0, "internal error: context->code() NULL!" );544 EM_error2( 0, "internal error: context->code() NULL!" );
538 goto cleanup;545 goto cleanup;
539 }546 }
540 547
541cleanup:548cleanup:
542 549
543 // commit550 // commit
544 if( ret ) env()->global()->commit();551 if( ret ) env()->global()->commit();
545 // or rollback552 // or rollback
546 else env()->global()->rollback();553 else env()->global()->rollback();
547 554
548 // unload the context from the type-checker555 // unload the context from the type-checker
549 if( !type_engine_unload_context( env() ) )556 if( !type_engine_unload_context( env() ) )
550 {557 {
551 EM_error2( 0, "internal error unloading context...\n" );558 EM_error2( 0, "internal error unloading context...\n" );
552 return FALSE;559 return FALSE;
553 }560 }
554 561
555 return ret;562 return ret;
556}563}
557 564
@@ -617,15 +624,15 @@ t_CKBOOL load_module( Chuck_Compiler * compiler, Chuck_Env * env, f_ck_query que · 59 unmodified lines
617{624{
618 Chuck_DLL * dll = NULL;625 Chuck_DLL * dll = NULL;
619 t_CKBOOL query_failed = FALSE;626 t_CKBOOL query_failed = FALSE;
620 627
621 // load osc628 // load osc
622 dll = new Chuck_DLL( compiler->carrier(), name );629 dll = new Chuck_DLL( compiler->carrier(), name );
623 // (fixed: 1.3.0.0) query_failed now catches either failure of load or query630 // (fixed: 1.3.0.0) query_failed now catches either failure of load or query
624 if( (query_failed = !(dll->load( query ) && dll->query())) ||631 if( (query_failed = !(dll->load( query ) && dll->query())) ||
625 !type_engine_add_dll( env, dll, nspc ) )632 !type_engine_add_dll( env, dll, nspc ) )
626 {633 {
627 CK_FPRINTF_STDERR( 634 CK_FPRINTF_STDERR(
628 "[chuck]: internal error loading module '%s.%s'...\n", 635 "[chuck]: internal error loading module '%s.%s'...\n",
629 nspc, name );636 nspc, name );
630 if( query_failed )637 if( query_failed )
631 CK_FPRINTF_STDERR( " %s", dll->last_error() );638 CK_FPRINTF_STDERR( " %s", dll->last_error() );
@@ -649,7 +656,7 @@ t_CKBOOL load_internal_modules( Chuck_Compiler * compiler ) · 17 unmodified lines
649 EM_log( CK_LOG_SEVERE, "loading built-in modules..." );656 EM_log( CK_LOG_SEVERE, "loading built-in modules..." );
650 // push indent level657 // push indent level
651 EM_pushlog();658 EM_pushlog();
652 659
653 // get env660 // get env
654 Chuck_Env * env = compiler->env();661 Chuck_Env * env = compiler->env();
655 // make context662 // make context
@@ -658,7 +665,7 @@ t_CKBOOL load_internal_modules( Chuck_Compiler * compiler ) · 2 unmodified lines
658 env->reset();665 env->reset();
659 // load it666 // load it
660 type_engine_load_context( env, context );667 type_engine_load_context( env, context );
661 668
662 // still compile MidiMsg even if __DISABLE_MIDI__669 // still compile MidiMsg even if __DISABLE_MIDI__
663 if( !init_class_Midi( env ) ) goto error;670 if( !init_class_Midi( env ) ) goto error;
664#ifndef __DISABLE_MIDI__671#ifndef __DISABLE_MIDI__
@@ -666,75 +673,73 @@ t_CKBOOL load_internal_modules( Chuck_Compiler * compiler ) · 1 unmodified line
666#endif // __DISABLE_MIDI__673#endif // __DISABLE_MIDI__
667 674
668 // load675 // load
676 EM_log( CK_LOG_SEVERE, "module 'math'" );
677 if( !load_module( compiler, env, libmath_query, "Math", "global" ) ) goto error;
669 EM_log( CK_LOG_SEVERE, "module 'osc'" );678 EM_log( CK_LOG_SEVERE, "module 'osc'" );
670 load_module( compiler, env, osc_query, "osc", "global" );679 load_module( compiler, env, osc_query, "osc", "global" );
671 EM_log( CK_LOG_SEVERE, "module 'xxx'" );680 EM_log( CK_LOG_SEVERE, "module 'ai'" );
672 load_module( compiler, env, xxx_query, "xxx", "global" );681 if( !load_module( compiler, env, libai_query, "AI", "global" ) ) goto error;
682 EM_log( CK_LOG_SEVERE, "module 'extract'" );
683 load_module( compiler, env, extract_query, "extract", "global" );
673 EM_log( CK_LOG_SEVERE, "module 'filter'" );684 EM_log( CK_LOG_SEVERE, "module 'filter'" );
674 load_module( compiler, env, filter_query, "filter", "global" );685 load_module( compiler, env, filter_query, "filter", "global" );
675 EM_log( CK_LOG_SEVERE, "module 'STK'" );686 EM_log( CK_LOG_SEVERE, "module 'STK'" );
676 load_module( compiler, env, stk_query, "stk", "global" );687 load_module( compiler, env, stk_query, "stk", "global" );
677 EM_log( CK_LOG_SEVERE, "module 'xform'" );688 EM_log( CK_LOG_SEVERE, "module 'xform'" );
678 load_module( compiler, env, xform_query, "xform", "global" );689 load_module( compiler, env, xform_query, "xform", "global" );
679 EM_log( CK_LOG_SEVERE, "module 'extract'" );690 EM_log( CK_LOG_SEVERE, "module 'xxx'" );
680 load_module( compiler, env, extract_query, "extract", "global" );691 load_module( compiler, env, xxx_query, "xxx", "global" );
681 692 EM_log( CK_LOG_SEVERE, "module 'std'" );
693 if( !load_module( compiler, env, libstd_query, "Std", "global" ) ) goto error;
694
682 // load695 // load
683 #ifndef __DISABLE_OTF_SERVER__
684 EM_log( CK_LOG_SEVERE, "module 'machine'" );696 EM_log( CK_LOG_SEVERE, "module 'machine'" );
685 if( !load_module( compiler, env, machine_query, "Machine", "global" ) ) goto error;697 if( !load_module( compiler, env, machine_query, "Machine", "global" ) ) goto error;
686 machine_init( compiler, otf_process_msg );698 machine_init( compiler, otf_process_msg );
687 #endif
688
689 EM_log( CK_LOG_SEVERE, "module 'std'" );
690 if( !load_module( compiler, env, libstd_query, "Std", "global" ) ) goto error;
691 EM_log( CK_LOG_SEVERE, "module 'math'" );
692 if( !load_module( compiler, env, libmath_query, "Math", "global" ) ) goto error;
693 699
694 #ifndef __DISABLE_NETWORK__700 #ifndef __DISABLE_NETWORK__
695 EM_log( CK_LOG_SEVERE, "module 'opsc'" );701 EM_log( CK_LOG_SEVERE, "module 'opsc'" );
696 if( !load_module( compiler, env, opensoundcontrol_query, "opsc", "global" ) ) goto error;702 if( !load_module( compiler, env, opensoundcontrol_query, "opsc", "global" ) ) goto error;
697 #endif703 #endif
698 704
699 EM_log( CK_LOG_SEVERE, "module 'RegEx'" );705 EM_log( CK_LOG_SEVERE, "module 'RegEx'" );
700 if( !load_module( compiler, env, regex_query, "RegEx", "global" ) ) goto error;706 if( !load_module( compiler, env, regex_query, "RegEx", "global" ) ) goto error;
701 707
702 // Deprecated:708 // deprecated:
703 // if( !load_module( compiler, env, net_query, "net", "global" ) ) goto error;709 // if( !load_module( compiler, env, net_query, "net", "global" ) ) goto error;
704 710
705 #ifndef __DISABLE_HID__711 #ifndef __DISABLE_HID__
706 EM_log( CK_LOG_SEVERE, "module 'HID'" );712 EM_log( CK_LOG_SEVERE, "module 'HID'" );
707 if( !init_class_HID( env ) ) goto error;713 if( !init_class_HID( env ) ) goto error;
708 #endif714 #endif
709 715
710 #ifndef __DISABLE_SERIAL__716 #ifndef __DISABLE_SERIAL__
711 // log
712 EM_log( CK_LOG_SEVERE, "module 'SerialIO'" );717 EM_log( CK_LOG_SEVERE, "module 'SerialIO'" );
713 if( !init_class_serialio( env ) ) goto error;718 if( !init_class_serialio( env ) ) goto error;
714 #endif719 #endif
715 720
716 // clear context721 // clear context
717 type_engine_unload_context( env );722 type_engine_unload_context( env );
718 723
719 // commit what is in the type checker at this point724 // commit what is in the type checker at this point
720 env->global()->commit();725 env->global()->commit();
721 726
722 // pop indent level727 // pop indent level
723 EM_poplog();728 EM_poplog();
724 729
725 return TRUE;730 return TRUE;
726 731
727error:732error:
728 733
729 // probably dangerous: rollback734 // probably dangerous: rollback
730 env->global()->rollback();735 env->global()->rollback();
731 736
732 // clear context737 // clear context
733 type_engine_unload_context( env );738 type_engine_unload_context( env );
734 739
735 // pop indent level740 // pop indent level
736 EM_poplog();741 EM_poplog();
737 742
738 return FALSE;743 return FALSE;
739}744}
740 745
@@ -744,17 +749,17 @@ error: · 3 unmodified lines
744// name: load_external_module_at_path()749// name: load_external_module_at_path()
745// desc: ...750// desc: ...
746//-----------------------------------------------------------------------------751//-----------------------------------------------------------------------------
747t_CKBOOL load_external_module_at_path( Chuck_Compiler * compiler, 752t_CKBOOL load_external_module_at_path( Chuck_Compiler * compiler,
748 const char * name,753 const char * name,
749 const char * dl_path )754 const char * dl_path )
750{755{
751 Chuck_Env * env = compiler->env();756 Chuck_Env * env = compiler->env();
752 757
753 EM_log(CK_LOG_SEVERE, "loading chugin '%s'", name);758 EM_log(CK_LOG_SEVERE, "loading chugin '%s'", name);
754 759
755 Chuck_DLL * dll = new Chuck_DLL( compiler->carrier(), name );760 Chuck_DLL * dll = new Chuck_DLL( compiler->carrier(), name );
756 t_CKBOOL query_failed = FALSE;761 t_CKBOOL query_failed = FALSE;
757 762
758 if((query_failed = !(dll->load(dl_path) && dll->query())) ||763 if((query_failed = !(dll->load(dl_path) && dll->query())) ||
759 !type_engine_add_dll2(env, dll, "global"))764 !type_engine_add_dll2(env, dll, "global"))
760 {765 {
@@ -768,14 +773,14 @@ t_CKBOOL load_external_module_at_path( Chuck_Compiler * compiler, · 7 unmodified lines
768 }773 }
769 delete dll;774 delete dll;
770 EM_poplog();775 EM_poplog();
771 776
772 return FALSE;777 return FALSE;
773 }778 }
774 else779 else
775 {780 {
776 compiler->m_dlls.push_back(dll);781 compiler->m_dlls.push_back(dll);
777 return TRUE;782 return TRUE;
778 } 783 }
779}784}
780 785
781 786
@@ -789,8 +794,8 @@ static t_CKBOOL extension_matches( const char * filename, const char * extension · 7 unmodified lines
789{794{
790 t_CKUINT extension_length = strlen(extension);795 t_CKUINT extension_length = strlen(extension);
791 t_CKUINT filename_length = strlen(filename);796 t_CKUINT filename_length = strlen(filename);
792 797
793 return strncmp( extension, filename+(filename_length-extension_length), 798 return strncmp( extension, filename+(filename_length-extension_length),
794 extension_length) == 0;799 extension_length) == 0;
795}800}
796 801
@@ -806,24 +811,24 @@ t_CKBOOL load_external_modules_in_directory( Chuck_Compiler * compiler, · 9 unmodified lines
806 const char * extension )811 const char * extension )
807{812{
808 static const t_CKBOOL RECURSIVE_SEARCH = false;813 static const t_CKBOOL RECURSIVE_SEARCH = false;
809 814
810 DIR * dir = opendir(directory);815 DIR * dir = opendir(directory);
811 816
812 if( dir )817 if( dir )
813 {818 {
814 // log819 // log
815 EM_log( CK_LOG_INFO, "examining directory '%s' for chugins", directory );820 EM_log( CK_LOG_INFO, "examining directory '%s' for chugins", directory );
816 821
817 struct dirent *de = NULL;822 struct dirent *de = NULL;
818 823
819 while( (de = readdir(dir)) )824 while( (de = readdir(dir)) )
820 {825 {
821 t_CKBOOL is_regular = false;826 t_CKBOOL is_regular = false;
822 t_CKBOOL is_directory = false;827 t_CKBOOL is_directory = false;
823 828
824#if defined(__PLATFORM_WIN32__)829#if defined(__PLATFORM_WIN32__)
825 is_directory = de->data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;830 is_directory = de->data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
826 is_regular = ((de->data.dwFileAttributes & FILE_ATTRIBUTE_NORMAL) || 831 is_regular = ((de->data.dwFileAttributes & FILE_ATTRIBUTE_NORMAL) ||
827 (de->data.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ||832 (de->data.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ||
828 (de->data.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE));833 (de->data.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE));
829#elif defined(__WINDOWS_PTHREAD__) // Cygwin -- doesn't have dirent d_type834#elif defined(__WINDOWS_PTHREAD__) // Cygwin -- doesn't have dirent d_type
@@ -836,9 +841,9 @@ t_CKBOOL load_external_modules_in_directory( Chuck_Compiler * compiler, · 6 unmodified lines
836 }841 }
837 else842 else
838 {843 {
839 // uhh ... 844 // uhh ...
840 EM_log( CK_LOG_INFO, 845 EM_log( CK_LOG_INFO,
841 "unable to open file '%s', ignoring for chugins", 846 "unable to open file '%s', ignoring for chugins",
842 absolute_path.c_str() );847 absolute_path.c_str() );
843 continue;848 continue;
844 }849 }
@@ -846,14 +851,14 @@ t_CKBOOL load_external_modules_in_directory( Chuck_Compiler * compiler, · 1 unmodified line
846 is_directory = de->d_type == DT_DIR;851 is_directory = de->d_type == DT_DIR;
847 is_regular = de->d_type == DT_REG;852 is_regular = de->d_type == DT_REG;
848#endif853#endif
849 854
850 if( is_regular ) // TODO: follow links?855 if( is_regular ) // TODO: follow links?
851 {856 {
852 if( extension_matches(de->d_name, extension) )857 if( extension_matches(de->d_name, extension) )
853 {858 {
854 std::string absolute_path = std::string(directory) + "/" + de->d_name;859 std::string absolute_path = std::string(directory) + "/" + de->d_name;
855 860
856 load_external_module_at_path(compiler, de->d_name, 861 load_external_module_at_path(compiler, de->d_name,
857 absolute_path.c_str());862 absolute_path.c_str());
858 }863 }
859 else if( extension_matches(de->d_name, ".ck") )864 else if( extension_matches(de->d_name, ".ck") )
@@ -870,13 +875,13 @@ t_CKBOOL load_external_modules_in_directory( Chuck_Compiler * compiler, · 10 unmodified lines
870 strncmp(de->d_name, "..", sizeof("..")) != 0 )875 strncmp(de->d_name, "..", sizeof("..")) != 0 )
871 {876 {
872 std::string absolute_path = std::string(directory) + "/" + de->d_name;877 std::string absolute_path = std::string(directory) + "/" + de->d_name;
873 load_external_modules_in_directory(compiler, 878 load_external_modules_in_directory(compiler,
874 absolute_path.c_str(),879 absolute_path.c_str(),
875 extension);880 extension);
876 }881 }
877 }882 }
878 }883 }
879 884
880 // close885 // close
881 closedir( dir );886 closedir( dir );
882 }887 }
@@ -889,7 +894,7 @@ t_CKBOOL load_external_modules_in_directory( Chuck_Compiler * compiler, · 6 unmodified lines
889 EM_log( CK_LOG_INFO, "ignoring for chugins..." );894 EM_log( CK_LOG_INFO, "ignoring for chugins..." );
890 EM_poplog();895 EM_poplog();
891 }896 }
892 897
893 return TRUE;898 return TRUE;
894}899}
895 900
@@ -912,7 +917,7 @@ t_CKBOOL Chuck_Compiler:: load_external_modules( const char * extension, · 16 unmodified lines
912 env->reset();917 env->reset();
913 // load it918 // load it
914 type_engine_load_context( env, context );919 type_engine_load_context( env, context );
915 920
916 /* first load dynamic libraries explicitly named on the command line */921 /* first load dynamic libraries explicitly named on the command line */
917 for(std::list<std::string>::iterator i_dl = named_dls.begin();922 for(std::list<std::string>::iterator i_dl = named_dls.begin();
918 i_dl != named_dls.end(); i_dl++)923 i_dl != named_dls.end(); i_dl++)
@@ -920,38 +925,37 @@ t_CKBOOL Chuck_Compiler:: load_external_modules( const char * extension, · 1 unmodified line
920 std::string & dl_path = *i_dl;925 std::string & dl_path = *i_dl;
921 if(!extension_matches(dl_path.c_str(), extension))926 if(!extension_matches(dl_path.c_str(), extension))
922 dl_path += extension;927 dl_path += extension;
923 928
924 load_external_module_at_path(this, dl_path.c_str(),929 load_external_module_at_path(this, dl_path.c_str(),
925 dl_path.c_str());930 dl_path.c_str());
926 }931 }
927 932
928 /* now recurse through search paths and load any DLs or .ck files found */933 /* now recurse through search paths and load any DLs or .ck files found */
929 for(std::list<std::string>::iterator i_sp = chugin_search_paths.begin();934 for(std::list<std::string>::iterator i_sp = chugin_search_paths.begin();
930 i_sp != chugin_search_paths.end(); i_sp++)935 i_sp != chugin_search_paths.end(); i_sp++)
931 {936 {
932 load_external_modules_in_directory(this, (*i_sp).c_str(), extension);937 load_external_modules_in_directory(this, (*i_sp).c_str(), extension);
933 } 938 }
934 939
935 // clear context940 // clear context
936 type_engine_unload_context( env );941 type_engine_unload_context( env );
937 942
938 // commit what is in the type checker at this point943 // commit what is in the type checker at this point
939 env->global()->commit();944 env->global()->commit();
940 945
941 return TRUE;946 return TRUE;
942 /* 947 /*
943error:948error:
944 949
945 // probably dangerous: rollback950 // probably dangerous: rollback
946 env->global()->rollback();951 env->global()->rollback();
947 952
948 // clear context953 // clear context
949 type_engine_unload_context( env );954 type_engine_unload_context( env );
950 955
951 // pop indent level956 // pop indent level
952 EM_poplog();957 EM_poplog();
953 958
954 return FALSE;959 return FALSE;
955 */960 */
956}961}
957
src/core/chuck_compile.h+12−7
@@ -56,7 +56,7 @@ struct Chuck_Compiler · 55 unmodified lines
56protected: // data56protected: // data
57 // carrier57 // carrier
58 Chuck_Carrier * m_carrier;58 Chuck_Carrier * m_carrier;
59 59
60public: // get protected data60public: // get protected data
61 // REFACTOR-2017: get associated, per-compiler environment61 // REFACTOR-2017: get associated, per-compiler environment
62 Chuck_Env * env() const { return m_carrier->env; }62 Chuck_Env * env() const { return m_carrier->env; }
@@ -67,7 +67,6 @@ public: // get protected data · 4 unmodified lines
67 // set carrier67 // set carrier
68 t_CKBOOL setCarrier( Chuck_Carrier * c ) { m_carrier = c; return TRUE; }68 t_CKBOOL setCarrier( Chuck_Carrier * c ) { m_carrier = c; return TRUE; }
69 69
70
71public: // data70public: // data
72 // emitter71 // emitter
73 Chuck_Emitter * emitter;72 Chuck_Emitter * emitter;
@@ -78,10 +77,16 @@ public: // data · 4 unmodified lines
78 t_CKBOOL m_auto_depend;77 t_CKBOOL m_auto_depend;
79 // recent map78 // recent map
80 std::map<std::string, Chuck_Context *> m_recent;79 std::map<std::string, Chuck_Context *> m_recent;
81 80
81 // chugins
82 std::list<Chuck_DLL *> m_dlls;82 std::list<Chuck_DLL *> m_dlls;
83 // libraries (ck code) to import
83 std::list<std::string> m_cklibs_to_preload;84 std::list<std::string> m_cklibs_to_preload;
84 85
86 // origin hint; this flag is set to different te_Origin values
87 // to denote where new entities originate | 1.4.2.1 (ge) added
88 te_Origin m_originHint;
89
85public: // to all90public: // to all
86 // contructor91 // contructor
87 Chuck_Compiler();92 Chuck_Compiler();
@@ -102,19 +107,19 @@ public: // compile · 14 unmodified lines
102 // set auto depend107 // set auto depend
103 void set_auto_depend( t_CKBOOL v );108 void set_auto_depend( t_CKBOOL v );
104 // parse, type-check, and emit a program109 // parse, type-check, and emit a program
105 t_CKBOOL go( const std::string & filename, FILE * fd = NULL, 110 t_CKBOOL go( const std::string & filename, FILE * fd = NULL,
106 const char * str_src = NULL, const std::string & full_path = "" );111 const char * str_src = NULL, const std::string & full_path = "" );
107 // resolve a type automatically, if auto_depend is on112 // resolve a type automatically, if auto_depend is on
108 t_CKBOOL resolve( const std::string & type );113 t_CKBOOL resolve( const std::string & type );
109 // get the code generated from the last go()114 // get the code generated from the last go()
110 Chuck_VM_Code * output( );115 Chuck_VM_Code * output( );
111 116
112public: // replace-dac | added 1.4.1.0 (jack) 117public: // replace-dac | added 1.4.1.0 (jack)
113 // sets a "replacement dac": one global UGen is secretly used118 // sets a "replacement dac": one global UGen is secretly used
114 // as a stand-in for "dac" for this compilation;119 // as a stand-in for "dac" for this compilation;
115 // for example, ChuckSubInstances in Chunity use a global Gain as a120 // for example, ChuckSubInstances in Chunity use a global Gain as a
116 // replacement dac, then use the global getUGenSamples() function to121 // replacement dac, then use the global getUGenSamples() function to
117 // get the samples of the gain. this enables the creation 122 // get the samples of the gain. this enables the creation
118 // of a new sample sucker.123 // of a new sample sucker.
119 void setReplaceDac( t_CKBOOL shouldReplaceDac, const std::string & replacement );124 void setReplaceDac( t_CKBOOL shouldReplaceDac, const std::string & replacement );
120 125
src/core/chuck_def.h+17−7
@@ -104,12 +104,12 @@ typedef struct { t_CKUINT N ; t_CKFLOAT * values ; } t_CKVECTOR; · 103 unmodified lines
104 104
105// kinds (added 1.3.1.0 to faciliate 64-bit support)105// kinds (added 1.3.1.0 to faciliate 64-bit support)
106// to differentiate in case int and float have same size106// to differentiate in case int and float have same size
107#define kindof_VOID 0107#define kindof_VOID 0
108#define kindof_INT 1108#define kindof_INT 1
109#define kindof_FLOAT 2109#define kindof_FLOAT 2
110#define kindof_COMPLEX 3110#define kindof_COMPLEX 3
111#define kindof_VEC3 4111#define kindof_VEC3 4
112#define kindof_VEC4 5112#define kindof_VEC4 5
113 113
114typedef char * c_str;114typedef char * c_str;
115typedef const char * c_constr;115typedef const char * c_constr;
@@ -140,6 +140,9 @@ typedef struct { SAMPLE re ; SAMPLE im ; } t_CKCOMPLEX_SAMPLE; · 24 unmodified lines
140#define FALSE 0140#define FALSE 0
141#endif141#endif
142 142
143// special non-zero value to denote "no value" | added 1.4.2.0 (ge)
144#define CK_NO_VALUE 0xffffffff
145
143// 3.1415926535897932384626433832795028841971693993751058209749445...146// 3.1415926535897932384626433832795028841971693993751058209749445...
144#define ONE_PI (3.14159265358979323846)147#define ONE_PI (3.14159265358979323846)
145#define TWO_PI (2.0 * ONE_PI)148#define TWO_PI (2.0 * ONE_PI)
@@ -151,6 +154,8 @@ typedef struct { SAMPLE re ; SAMPLE im ; } t_CKCOMPLEX_SAMPLE; · 5 unmodified lines
151#define SAFE_RELEASE(x) do { if(x){ x->release(); x = NULL; } } while(0)154#define SAFE_RELEASE(x) do { if(x){ x->release(); x = NULL; } } while(0)
152#define SAFE_ADD_REF(x) do { if(x){ x->add_ref(); } } while(0)155#define SAFE_ADD_REF(x) do { if(x){ x->add_ref(); } } while(0)
153#define SAFE_REF_ASSIGN(lhs,rhs) do { SAFE_RELEASE(lhs); (lhs) = (rhs); SAFE_ADD_REF(lhs); } while(0)156#define SAFE_REF_ASSIGN(lhs,rhs) do { SAFE_RELEASE(lhs); (lhs) = (rhs); SAFE_ADD_REF(lhs); } while(0)
157#define SAFE_FREE(x) do { if(x){ free(x); x = NULL; } } while(0)
158#define SAFE_UNLOCK_DELETE(x) do { if(x){ x->unlock(); delete x; x = NULL; } } while(0)
154#endif159#endif
155 160
156// max + min161// max + min
@@ -188,7 +193,12 @@ typedef struct { SAMPLE re ; SAMPLE im ; } t_CKCOMPLEX_SAMPLE; · 31 unmodified lines
188 193
189#ifdef __PLATFORM_WIN32__194#ifdef __PLATFORM_WIN32__
190#ifndef usleep195#ifndef usleep
191#define usleep(x) Sleep( (x / 1000 <= 0 ? 1 : x / 1000) )196 #define usleep(x) Sleep( (x / 1000 <= 0 ? 1 : x / 1000) )
197#endif
198// 1.4.2.0 (ge and spencer) | added for legacy windows, as part of switch to snprintf
199// https://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010
200#if defined(_MSC_VER) && _MSC_VER < 1900
201 #define snprintf(buf,len, format,...) _snprintf_s(buf, len,len, format, __VA_ARGS__)
192#endif202#endif
193#pragma warning (disable : 4996) // stdio deprecation203#pragma warning (disable : 4996) // stdio deprecation
194#pragma warning (disable : 4786) // stl debug info204#pragma warning (disable : 4786) // stl debug info
src/core/chuck_dl.cpp+231−92
@@ -97,25 +97,25 @@ void CK_DLL_CALL ck_begin_class( Chuck_DL_Query * query, const char * name, cons · 96 unmodified lines
97 if( !parent_path )97 if( !parent_path )
98 {98 {
99 // error99 // error
100 EM_error2( 0, "class import: ck_begin_class: unknown parent type '%s'", 100 EM_error2( 0, "class import: ck_begin_class: unknown parent type '%s'",
101 query->curr_class->name.c_str(), name, parent );101 query->curr_class->name.c_str(), name, parent );
102 return;102 return;
103 }103 }
104 104
105 Chuck_Type * ck_parent_type = type_engine_find_type( query->env(), parent_path );105 Chuck_Type * ck_parent_type = type_engine_find_type( query->env(), parent_path );
106 106
107 delete_id_list( parent_path );107 delete_id_list( parent_path );
108 108
109 if( !ck_parent_type )109 if( !ck_parent_type )
110 {110 {
111 // error111 // error
112 EM_error2( 0, "class import: ck_begin_class: unable to find parent type '%s'", ck_parent_type );112 EM_error2( 0, "class import: ck_begin_class: unable to find parent type '%s'", ck_parent_type );
113 return;113 return;
114 }114 }
115 115
116 parent_offset = ck_parent_type->obj_size;116 parent_offset = ck_parent_type->obj_size;
117 }117 }
118 118
119 // push119 // push
120 query->stack.push_back( query->curr_class );120 query->stack.push_back( query->curr_class );
121 // allocate121 // allocate
@@ -134,7 +134,7 @@ void CK_DLL_CALL ck_begin_class( Chuck_DL_Query * query, const char * name, cons · 12 unmodified lines
134 c->name = name;134 c->name = name;
135 c->parent = parent;135 c->parent = parent;
136 c->current_mvar_offset = parent_offset;136 c->current_mvar_offset = parent_offset;
137 137
138 // curr138 // curr
139 query->curr_class = c;139 query->curr_class = c;
140 query->curr_func = NULL;140 query->curr_func = NULL;
@@ -162,7 +162,7 @@ void CK_DLL_CALL ck_add_ctor( Chuck_DL_Query * query, f_ctor ctor ) · 21 unmodified lines
162 f->name = "[ctor]";162 f->name = "[ctor]";
163 f->type = "void";163 f->type = "void";
164 f->ctor = ctor;164 f->ctor = ctor;
165 165
166 // add166 // add
167 query->curr_class->ctors.push_back( f );167 query->curr_class->ctors.push_back( f );
168 query->curr_func = f;168 query->curr_func = f;
@@ -198,7 +198,7 @@ void CK_DLL_CALL ck_add_dtor( Chuck_DL_Query * query, f_dtor dtor ) · 29 unmodified lines
198 f->name = "[dtor]";198 f->name = "[dtor]";
199 f->type = "void";199 f->type = "void";
200 f->dtor = dtor;200 f->dtor = dtor;
201 201
202 // add202 // add
203 query->curr_class->dtor = f;203 query->curr_class->dtor = f;
204 // set204 // set
@@ -212,7 +212,7 @@ void CK_DLL_CALL ck_add_dtor( Chuck_DL_Query * query, f_dtor dtor ) · 7 unmodified lines
212// name: ck_add_mfun()212// name: ck_add_mfun()
213// desc: add member function, can be followed by add_arg213// desc: add member function, can be followed by add_arg
214//-----------------------------------------------------------------------------214//-----------------------------------------------------------------------------
215void CK_DLL_CALL ck_add_mfun( Chuck_DL_Query * query, f_mfun addr, 215void CK_DLL_CALL ck_add_mfun( Chuck_DL_Query * query, f_mfun addr,
216 const char * type, const char * name )216 const char * type, const char * name )
217{217{
218 // make sure there is class218 // make sure there is class
@@ -228,7 +228,7 @@ void CK_DLL_CALL ck_add_mfun( Chuck_DL_Query * query, f_mfun addr, · 9 unmodified lines
228 f->name = name;228 f->name = name;
229 f->type = type;229 f->type = type;
230 f->mfun = addr;230 f->mfun = addr;
231 231
232 // add232 // add
233 query->curr_class->mfuns.push_back( f );233 query->curr_class->mfuns.push_back( f );
234 query->curr_func = f;234 query->curr_func = f;
@@ -257,7 +257,7 @@ void CK_DLL_CALL ck_add_sfun( Chuck_DL_Query * query, f_sfun addr, · 22 unmodified lines
257 f->name = name;257 f->name = name;
258 f->type = type;258 f->type = type;
259 f->sfun = addr;259 f->sfun = addr;
260 260
261 // add261 // add
262 query->curr_class->sfuns.push_back( f );262 query->curr_class->sfuns.push_back( f );
263 query->curr_func = f;263 query->curr_func = f;
@@ -270,7 +270,7 @@ void CK_DLL_CALL ck_add_sfun( Chuck_DL_Query * query, f_sfun addr, · 6 unmodified lines
270// name: ck_add_mvar()270// name: ck_add_mvar()
271// desc: add member var271// desc: add member var
272//-----------------------------------------------------------------------------272//-----------------------------------------------------------------------------
273t_CKUINT CK_DLL_CALL ck_add_mvar( Chuck_DL_Query * query, 273t_CKUINT CK_DLL_CALL ck_add_mvar( Chuck_DL_Query * query,
274 const char * type, const char * name,274 const char * type, const char * name,
275 t_CKBOOL is_const )275 t_CKBOOL is_const )
276{276{
@@ -286,22 +286,22 @@ t_CKUINT CK_DLL_CALL ck_add_mvar( Chuck_DL_Query * query, · 9 unmodified lines
286 if( !path )286 if( !path )
287 {287 {
288 // error288 // error
289 EM_error2( 0, "class import: add_mvar: mvar %s.%s has unknown type '%s'", 289 EM_error2( 0, "class import: add_mvar: mvar %s.%s has unknown type '%s'",
290 query->curr_class->name.c_str(), name, type );290 query->curr_class->name.c_str(), name, type );
291 return CK_INVALID_OFFSET;291 return CK_INVALID_OFFSET;
292 }292 }
293 293
294 Chuck_Type * ck_type = type_engine_find_type( query->env(), path );294 Chuck_Type * ck_type = type_engine_find_type( query->env(), path );
295 295
296 delete_id_list( path );296 delete_id_list( path );
297 297
298 if( !ck_type )298 if( !ck_type )
299 {299 {
300 // error300 // error
301 EM_error2( 0, "class import: add_mvar: unable to find type '%s'", type );301 EM_error2( 0, "class import: add_mvar: unable to find type '%s'", type );
302 return CK_INVALID_OFFSET;302 return CK_INVALID_OFFSET;
303 }303 }
304 304
305 // allocate305 // allocate
306 Chuck_DL_Value * v = new Chuck_DL_Value;306 Chuck_DL_Value * v = new Chuck_DL_Value;
307 v->name = name;307 v->name = name;
@@ -312,11 +312,11 @@ t_CKUINT CK_DLL_CALL ck_add_mvar( Chuck_DL_Query * query, · 4 unmodified lines
312 query->curr_class->mvars.push_back( v );312 query->curr_class->mvars.push_back( v );
313 query->curr_func = NULL;313 query->curr_func = NULL;
314 query->last_var = v;314 query->last_var = v;
315 315
316 t_CKUINT offset = query->curr_class->current_mvar_offset;316 t_CKUINT offset = query->curr_class->current_mvar_offset;
317 query->curr_class->current_mvar_offset = type_engine_next_offset( query->curr_class->current_mvar_offset,317 query->curr_class->current_mvar_offset = type_engine_next_offset( query->curr_class->current_mvar_offset,
318 ck_type );318 ck_type );
319 319
320 return offset;320 return offset;
321}321}
322 322
@@ -344,11 +344,11 @@ void CK_DLL_CALL ck_add_svar( Chuck_DL_Query * query, const char * type, const c · 21 unmodified lines
344 v->type = type;344 v->type = type;
345 v->is_const = is_const;345 v->is_const = is_const;
346 v->static_addr = addr;346 v->static_addr = addr;
347 347
348 // add348 // add
349 query->curr_class->svars.push_back( v );349 query->curr_class->svars.push_back( v );
350 query->curr_func = NULL;350 query->curr_func = NULL;
351 351
352 query->last_var = v;352 query->last_var = v;
353}353}
354 354
@@ -368,7 +368,7 @@ void CK_DLL_CALL ck_add_arg( Chuck_DL_Query * query, const char * type, const ch · 13 unmodified lines
368 EM_error2( 0, "class import: add_arg invoked without begin_class..." );368 EM_error2( 0, "class import: add_arg invoked without begin_class..." );
369 return;369 return;
370 }370 }
371 371
372 // make sure there is function372 // make sure there is function
373 if( !query->curr_func )373 if( !query->curr_func )
374 {374 {
@@ -376,12 +376,12 @@ void CK_DLL_CALL ck_add_arg( Chuck_DL_Query * query, const char * type, const ch · 1 unmodified line
376 EM_error2( 0, "class import: add_arg can only follow 'ctor', 'mfun', 'sfun', 'arg'..." );376 EM_error2( 0, "class import: add_arg can only follow 'ctor', 'mfun', 'sfun', 'arg'..." );
377 return;377 return;
378 }378 }
379 379
380 // allocate380 // allocate
381 Chuck_DL_Value * v = new Chuck_DL_Value;381 Chuck_DL_Value * v = new Chuck_DL_Value;
382 v->name = name;382 v->name = name;
383 v->type = type;383 v->type = type;
384 384
385 // add385 // add
386 query->curr_func->args.push_back( v );386 query->curr_func->args.push_back( v );
387}387}
@@ -402,7 +402,7 @@ void CK_DLL_CALL ck_add_ugen_func( Chuck_DL_Query * query, f_tick ugen_tick, f_p · 14 unmodified lines
402 EM_error2( 0, "class import: add_ugen_func invoked without begin_class..." );402 EM_error2( 0, "class import: add_ugen_func invoked without begin_class..." );
403 return;403 return;
404 }404 }
405 405
406 // make sure tick not defined already406 // make sure tick not defined already
407 if( query->curr_class->ugen_tick && ugen_tick )407 if( query->curr_class->ugen_tick && ugen_tick )
408 {408 {
@@ -410,7 +410,7 @@ void CK_DLL_CALL ck_add_ugen_func( Chuck_DL_Query * query, f_tick ugen_tick, f_p · 1 unmodified line
410 EM_error2( 0, "class import: ugen_tick already defined..." );410 EM_error2( 0, "class import: ugen_tick already defined..." );
411 return;411 return;
412 }412 }
413 413
414 // make sure pmsg not defined already414 // make sure pmsg not defined already
415 if( query->curr_class->ugen_pmsg && ugen_pmsg )415 if( query->curr_class->ugen_pmsg && ugen_pmsg )
416 {416 {
@@ -418,7 +418,7 @@ void CK_DLL_CALL ck_add_ugen_func( Chuck_DL_Query * query, f_tick ugen_tick, f_p · 1 unmodified line
418 EM_error2( 0, "class import: ugen_pmsg already defined..." );418 EM_error2( 0, "class import: ugen_pmsg already defined..." );
419 return;419 return;
420 }420 }
421 421
422 // set422 // set
423 if( ugen_tick ) query->curr_class->ugen_tick = ugen_tick;423 if( ugen_tick ) query->curr_class->ugen_tick = ugen_tick;
424 if( ugen_pmsg ) query->curr_class->ugen_pmsg = ugen_pmsg;424 if( ugen_pmsg ) query->curr_class->ugen_pmsg = ugen_pmsg;
@@ -443,7 +443,7 @@ void CK_DLL_CALL ck_add_ugen_funcf( Chuck_DL_Query * query, f_tickf ugen_tickf, · 18 unmodified lines
443 EM_error2( 0, "class import: add_ugen_func invoked without begin_class..." );443 EM_error2( 0, "class import: add_ugen_func invoked without begin_class..." );
444 return;444 return;
445 }445 }
446 446
447 // make sure tick not defined already447 // make sure tick not defined already
448 if( query->curr_class->ugen_tickf && ugen_tickf )448 if( query->curr_class->ugen_tickf && ugen_tickf )
449 {449 {
@@ -451,7 +451,7 @@ void CK_DLL_CALL ck_add_ugen_funcf( Chuck_DL_Query * query, f_tickf ugen_tickf, · 1 unmodified line
451 EM_error2( 0, "class import: ugen_tick already defined..." );451 EM_error2( 0, "class import: ugen_tick already defined..." );
452 return;452 return;
453 }453 }
454 454
455 // make sure pmsg not defined already455 // make sure pmsg not defined already
456 if( query->curr_class->ugen_pmsg && ugen_pmsg )456 if( query->curr_class->ugen_pmsg && ugen_pmsg )
457 {457 {
@@ -459,7 +459,7 @@ void CK_DLL_CALL ck_add_ugen_funcf( Chuck_DL_Query * query, f_tickf ugen_tickf, · 1 unmodified line
459 EM_error2( 0, "class import: ugen_pmsg already defined..." );459 EM_error2( 0, "class import: ugen_pmsg already defined..." );
460 return;460 return;
461 }461 }
462 462
463 // set463 // set
464 if( ugen_tickf ) query->curr_class->ugen_tickf = ugen_tickf;464 if( ugen_tickf ) query->curr_class->ugen_tickf = ugen_tickf;
465 if( ugen_pmsg ) query->curr_class->ugen_pmsg = ugen_pmsg;465 if( ugen_pmsg ) query->curr_class->ugen_pmsg = ugen_pmsg;
@@ -533,7 +533,7 @@ t_CKBOOL CK_DLL_CALL ck_end_class( Chuck_DL_Query * query ) · 67 unmodified lines
533 EM_error2( 0, "class import: end_class invoked without begin_class..." );533 EM_error2( 0, "class import: end_class invoked without begin_class..." );
534 return FALSE;534 return FALSE;
535 }535 }
536 536
537 // type check the class?537 // type check the class?
538 // 1.3.2.0: import class into type engine if at top level538 // 1.3.2.0: import class into type engine if at top level
539 if( query->stack.size() == 1 ) // top level class539 if( query->stack.size() == 1 ) // top level class
@@ -542,21 +542,21 @@ t_CKBOOL CK_DLL_CALL ck_end_class( Chuck_DL_Query * query ) · 2 unmodified lines
542 {542 {
543 EM_log(CK_LOG_SEVERE, "[chuck](DL): error importing class '%s' into type engine",543 EM_log(CK_LOG_SEVERE, "[chuck](DL): error importing class '%s' into type engine",
544 query->curr_class->name.c_str());544 query->curr_class->name.c_str());
545 545
546 // pop546 // pop
547 assert( query->stack.size() );547 assert( query->stack.size() );
548 query->curr_class = query->stack.back();548 query->curr_class = query->stack.back();
549 query->stack.pop_back();549 query->stack.pop_back();
550 550
551 return FALSE;551 return FALSE;
552 }552 }
553 }553 }
554 554
555 // pop555 // pop
556 assert( query->stack.size() );556 assert( query->stack.size() );
557 query->curr_class = query->stack.back();557 query->curr_class = query->stack.back();
558 query->stack.pop_back();558 query->stack.pop_back();
559 559
560 return TRUE;560 return TRUE;
561}561}
562 562
@@ -586,7 +586,7 @@ t_CKBOOL CK_DLL_CALL ck_doc_class( Chuck_DL_Query * query, const char * doc ) · 23 unmodified lines
586 else586 else
587 return FALSE;587 return FALSE;
588// #endif // CK_DOC588// #endif // CK_DOC
589 589
590 return TRUE;590 return TRUE;
591}591}
592 592
@@ -602,7 +602,7 @@ t_CKBOOL CK_DLL_CALL ck_add_example( Chuck_DL_Query * query, const char * ex ) · 9 unmodified lines
602 else602 else
603 return FALSE;603 return FALSE;
604// #endif // CK_DOC604// #endif // CK_DOC
605 605
606 return TRUE;606 return TRUE;
607}607}
608 608
@@ -615,7 +615,7 @@ t_CKBOOL CK_DLL_CALL ck_doc_func( Chuck_DL_Query * query, const char * doc ) · 6 unmodified lines
615 else615 else
616 return FALSE;616 return FALSE;
617// #endif // CK_DOC617// #endif // CK_DOC
618 618
619 return TRUE;619 return TRUE;
620}620}
621 621
@@ -628,7 +628,7 @@ t_CKBOOL CK_DLL_CALL ck_doc_var( Chuck_DL_Query * query, const char * doc ) · 6 unmodified lines
628 else628 else
629 return FALSE;629 return FALSE;
630// #endif // CK_DOC630// #endif // CK_DOC
631 631
632 return TRUE;632 return TRUE;
633}633}
634 634
@@ -692,11 +692,11 @@ t_CKBOOL Chuck_DLL::load( f_ck_query query_func, t_CKBOOL lazy ) · 57 unmodified lines
692 m_version_func = ck_builtin_declversion;692 m_version_func = ck_builtin_declversion;
693 m_done_query = FALSE;693 m_done_query = FALSE;
694 m_func = "ck_query";694 m_func = "ck_query";
695 695
696 // if not lazy, do it696 // if not lazy, do it
697 if( !lazy && !this->query() )697 if( !lazy && !this->query() )
698 return FALSE;698 return FALSE;
699 699
700 return TRUE;700 return TRUE;
701}701}
702 702
@@ -730,7 +730,7 @@ const Chuck_DL_Query * Chuck_DLL::query( ) · 27 unmodified lines
730 // return if there already730 // return if there already
731 if( m_done_query )731 if( m_done_query )
732 return &m_query;732 return &m_query;
733 733
734 // get the address of the DL version function from the DLL734 // get the address of the DL version function from the DLL
735 if( !m_version_func )735 if( !m_version_func )
736 m_version_func = (f_ck_declversion)this->get_addr( CK_DECLVERSION_FUNC );736 m_version_func = (f_ck_declversion)this->get_addr( CK_DECLVERSION_FUNC );
@@ -738,11 +738,11 @@ const Chuck_DL_Query * Chuck_DLL::query( ) · 1 unmodified line
738 m_version_func = (f_ck_declversion)this->get_addr( (string("_")+CK_DECLVERSION_FUNC).c_str() );738 m_version_func = (f_ck_declversion)this->get_addr( (string("_")+CK_DECLVERSION_FUNC).c_str() );
739 if( !m_version_func )739 if( !m_version_func )
740 {740 {
741 m_last_error = string("no version function found in dll '") 741 m_last_error = string("no version function found in dll '")
742 + m_filename + string("'");742 + m_filename + string("'");
743 return NULL;743 return NULL;
744 }744 }
745 745
746 // check version746 // check version
747 t_CKUINT dll_version = m_version_func();747 t_CKUINT dll_version = m_version_func();
748 t_CKBOOL version_ok = FALSE;748 t_CKBOOL version_ok = FALSE;
@@ -751,7 +751,7 @@ const Chuck_DL_Query * Chuck_DLL::query( ) · 2 unmodified lines
751 if(CK_DLL_VERSION_GETMAJOR(dll_version) == CK_DLL_VERSION_MAJOR &&751 if(CK_DLL_VERSION_GETMAJOR(dll_version) == CK_DLL_VERSION_MAJOR &&
752 CK_DLL_VERSION_GETMINOR(dll_version) <= CK_DLL_VERSION_MINOR)752 CK_DLL_VERSION_GETMINOR(dll_version) <= CK_DLL_VERSION_MINOR)
753 version_ok = TRUE;753 version_ok = TRUE;
754 754
755 if(!version_ok)755 if(!version_ok)
756 // SPENCERTODO: do they need to be equal, or can dll_version be < ?756 // SPENCERTODO: do they need to be equal, or can dll_version be < ?
757 {757 {
@@ -767,12 +767,12 @@ const Chuck_DL_Query * Chuck_DLL::query( ) · 9 unmodified lines
767 << CK_DLL_VERSION_MAJOR767 << CK_DLL_VERSION_MAJOR
768 << "."768 << "."
769 << CK_DLL_VERSION_MINOR;769 << CK_DLL_VERSION_MINOR;
770 770
771 m_last_error = oss.str();771 m_last_error = oss.str();
772 772
773 return NULL;773 return NULL;
774 }774 }
775 775
776 // get the address of the query function from the DLL776 // get the address of the query function from the DLL
777 if( !m_query_func )777 if( !m_query_func )
778 m_query_func = (f_ck_query)this->get_addr( m_func.c_str() );778 m_query_func = (f_ck_query)this->get_addr( m_func.c_str() );
@@ -780,7 +780,7 @@ const Chuck_DL_Query * Chuck_DLL::query( ) · 1 unmodified line
780 m_query_func = (f_ck_query)this->get_addr( (string("_")+m_func).c_str() );780 m_query_func = (f_ck_query)this->get_addr( (string("_")+m_func).c_str() );
781 if( !m_query_func )781 if( !m_query_func )
782 {782 {
783 m_last_error = string("no query function found in dll '") 783 m_last_error = string("no query function found in dll '")
784 + m_filename + string("'");784 + m_filename + string("'");
785 return NULL;785 return NULL;
786 }786 }
@@ -805,7 +805,7 @@ const Chuck_DL_Query * Chuck_DLL::query( ) · 18 unmodified lines
805 + string("'");805 + string("'");
806 return NULL;806 return NULL;
807 }807 }
808 808
809 // load the proto table809 // load the proto table
810 /* Chuck_DL_Proto * proto;810 /* Chuck_DL_Proto * proto;
811 m_name2proto.clear();811 m_name2proto.clear();
@@ -818,13 +818,13 @@ const Chuck_DL_Query * Chuck_DLL::query( ) · 6 unmodified lines
818 + string("'");818 + string("'");
819 return NULL;819 return NULL;
820 }820 }
821 821
822 // get the addr822 // get the addr
823 if( !proto->addr )823 if( !proto->addr )
824 proto->addr = (f_ck_func)this->get_addr( (char *)proto->name.c_str() );824 proto->addr = (f_ck_func)this->get_addr( (char *)proto->name.c_str() );
825 if( !proto->addr )825 if( !proto->addr )
826 {826 {
827 m_last_error = string("no addr associated with export '") + 827 m_last_error = string("no addr associated with export '") +
828 proto->name + string("'");828 proto->name + string("'");
829 return NULL;829 return NULL;
830 }830 }
@@ -832,7 +832,7 @@ const Chuck_DL_Query * Chuck_DLL::query( ) · 1 unmodified line
832 // put in the lookup table832 // put in the lookup table
833 m_name2proto[proto->name] = proto;833 m_name2proto[proto->name] = proto;
834 }834 }
835 835
836 // load the proto table836 // load the proto table
837 Chuck_UGen_Info * info;837 Chuck_UGen_Info * info;
838 m_name2ugen.clear();838 m_name2ugen.clear();
@@ -845,13 +845,13 @@ const Chuck_DL_Query * Chuck_DLL::query( ) · 6 unmodified lines
845 + string("'");845 + string("'");
846 return NULL;846 return NULL;
847 }847 }
848 848
849 // put in the lookup table849 // put in the lookup table
850 m_name2ugen[info->name] = info;850 m_name2ugen[info->name] = info;
851 }*/851 }*/
852 852
853 m_done_query = TRUE;853 m_done_query = TRUE;
854 854
855 // call attach855 // call attach
856 // if( m_attach_func ) m_attach_func( 0, NULL );856 // if( m_attach_func ) m_attach_func( 0, NULL );
857 857
@@ -900,7 +900,7 @@ void * Chuck_DLL::get_addr( const char * symbol ) · 42 unmodified lines
900 m_last_error = "cannot find addr from dynamic library - nothing open...";900 m_last_error = "cannot find addr from dynamic library - nothing open...";
901 return FALSE;901 return FALSE;
902 }902 }
903 903
904 return dlsym( m_handle, symbol );904 return dlsym( m_handle, symbol );
905}905}
906 906
@@ -957,14 +957,14 @@ Chuck_DL_Query::Chuck_DL_Query( Chuck_Carrier * carrier ) · 50 unmodified lines
957 doc_var = ck_doc_var;957 doc_var = ck_doc_var;
958 create_main_thread_hook = ck_create_main_thread_hook;958 create_main_thread_hook = ck_create_main_thread_hook;
959 m_carrier = carrier;959 m_carrier = carrier;
960 960
961 // memset(reserved2, NULL, sizeof(void*)*RESERVED_SIZE);961 // memset(reserved2, NULL, sizeof(void*)*RESERVED_SIZE);
962 962
963 dll_name = "[noname]";963 dll_name = "[noname]";
964 reserved = NULL;964 reserved = NULL;
965 curr_class = NULL;965 curr_class = NULL;
966 curr_func = NULL;966 curr_func = NULL;
967 967
968 srate = carrier->vm->srate();968 srate = carrier->vm->srate();
969 969
970 linepos = 0;970 linepos = 0;
@@ -1027,9 +1027,9 @@ Chuck_DL_Func::~Chuck_DL_Func() · 56 unmodified lines
1027 1027
1028 1028
1029/*******************************************************************************1029/*******************************************************************************
1030 1030
1031 Main Thread Hook stuff1031 Main Thread Hook stuff
1032 1032
1033*******************************************************************************/1033*******************************************************************************/
1034 1034
1035t_CKBOOL ck_mthook_activate(Chuck_DL_MainThreadHook *hook)1035t_CKBOOL ck_mthook_activate(Chuck_DL_MainThreadHook *hook)
@@ -1064,9 +1064,9 @@ m_active(FALSE) · 28 unmodified lines
1064 1064
1065 1065
1066/*******************************************************************************1066/*******************************************************************************
1067 1067
1068 Chuck_DL_Api stuff 1068 Chuck_DL_Api stuff
1069 1069
1070*******************************************************************************/1070*******************************************************************************/
1071 1071
1072namespace Chuck_DL_Api1072namespace Chuck_DL_Api
@@ -1080,74 +1080,212 @@ static t_CKUINT ck_get_srate(CK_DL_API api, Chuck_VM_Shred * shred) · 7 unmodified lines
1080 return shred->vm_ref->srate();1080 return shred->vm_ref->srate();
1081}1081}
1082 1082
1083static Chuck_DL_Api::Type ck_get_type( CK_DL_API api, Chuck_VM_Shred * shred, std::string & name )1083static Chuck_DL_Api::Type ck_get_type( CK_DL_API api, Chuck_VM_Shred * shred, const char * name )
1084{1084{
1085 Chuck_Env * env = shred->vm_ref->env();1085 Chuck_Env * env = shred->vm_ref->env();
1086 a_Id_List list = new_id_list( name.c_str(), 0 ); // TODO: nested types1086 a_Id_List list = new_id_list( name, 0 ); // TODO: nested types
1087 1087
1088 Chuck_Type * t = type_engine_find_type( env, list );1088 Chuck_Type * t = type_engine_find_type( env, list );
1089 1089
1090 delete_id_list( list );1090 delete_id_list( list );
1091 1091
1092 return ( Chuck_DL_Api::Type ) t;1092 return ( Chuck_DL_Api::Type ) t;
1093}1093}
1094 1094
1095static Chuck_DL_Api::Object ck_create( CK_DL_API api, Chuck_VM_Shred * shred, Chuck_DL_Api::Type t )1095static Chuck_DL_Api::Object ck_create( CK_DL_API api, Chuck_VM_Shred * shred, Chuck_DL_Api::Type t )
1096{1096{
1097 assert( t != NULL );1097 assert( t != NULL );
1098 1098
1099 Chuck_Type * type = ( Chuck_Type * ) t;1099 Chuck_Type * type = ( Chuck_Type * ) t;
1100 Chuck_Object * o = instantiate_and_initialize_object( type, shred->vm_ref );1100 Chuck_Object * o = instantiate_and_initialize_object( type, shred->vm_ref );
1101 1101
1102 return ( Chuck_DL_Api::Object ) o;1102 return ( Chuck_DL_Api::Object ) o;
1103}1103}
1104 1104
1105static Chuck_DL_Api::String ck_create_string( CK_DL_API api, Chuck_VM_Shred * shred, std::string & str )1105static Chuck_DL_Api::String ck_create_string( CK_DL_API api, Chuck_VM_Shred * shred, const char * cstr )
1106{1106{
1107 Chuck_String * string = ( Chuck_String * ) instantiate_and_initialize_object( shred->vm_ref->env()->t_string, shred->vm_ref );1107 Chuck_String * string = ( Chuck_String * ) instantiate_and_initialize_object( shred->vm_ref->env()->t_string, shred->vm_ref );
1108 1108
1109 string->set( str );1109 string->set( cstr );
1110 1110
1111 return ( Chuck_DL_Api::String ) string;1111 return ( Chuck_DL_Api::String ) string;
1112}1112}
1113 1113
1114static t_CKBOOL ck_get_mvar_int( CK_DL_API api, Chuck_DL_Api::Object, std::string &, t_CKINT & )1114//-----------------------------------------------------------------------------
1115// name: ck_get_mvar()
1116// desc: retrieve a class's member variable offset
1117//-----------------------------------------------------------------------------
1118static t_CKBOOL ck_get_mvar(Chuck_DL_Api::Object o, const char* name, te_Type basic_type, t_CKINT& offset)
1115{1119{
1120 std::string mvar(name);
1121 Chuck_Object* obj = (Chuck_Object*)o;
1122 Chuck_Type* type = obj->type_ref;
1123
1124 if (type->info == NULL) {
1125 // put error here
1126 EM_error2(0, "get mvar: ck_get_mvar: object has no type info");
1127 return FALSE;
1128 }
1129
1130 vector<Chuck_Value*> vars;
1131 Chuck_Value* var = NULL;
1132 type->info->get_values(vars);
1133
1134 // iterate over retrieved functions
1135 for (vector<Chuck_Value*>::iterator v = vars.begin(); v != vars.end(); v++)
1136 {
1137 // get pointer to chuck value
1138 Chuck_Value* value = *v;
1139 // check for NULL
1140 if (value == NULL) continue;
1141 // see if name matches
1142 if (value->name != mvar) continue;
1143 // see if name is correct type
1144 if (value->type->xid != basic_type) continue;
1145 // see if var is a member var
1146 if (!value->is_member) continue;
1147
1148 // ladies and gentlement, we've got it
1149 var = value;
1150 break;
1151 }
1152
1153 // make error
1154 if (!var) {
1155 EM_error2(0, "get mvar: ck_get_mvar: member variable %s not found", mvar.c_str());
1156 return FALSE;
1157 }
1158
1159 offset = var->offset;
1116 return TRUE;1160 return TRUE;
1117}1161}
1118 1162
1119static t_CKBOOL ck_get_mvar_float( CK_DL_API api, Chuck_DL_Api::Object, std::string &, t_CKFLOAT & )1163//-----------------------------------------------------------------------------
1164// name: ck_get_mvar_int()
1165// desc: retrieve a class's member variable of type int
1166//-----------------------------------------------------------------------------
1167static t_CKBOOL ck_get_mvar_int(CK_DL_API api, Chuck_DL_Api::Object obj, const char* name, t_CKINT & m_int)
1120{1168{
1121 return TRUE;1169 assert(obj != NULL);
1170 t_CKINT offset;
1171
1172 t_CKBOOL success = ck_get_mvar(obj, name, te_int, offset);
1173
1174 if (success)
1175 {
1176 Chuck_Object* ck_obj = (Chuck_Object*)obj;
1177 m_int = OBJ_MEMBER_INT(ck_obj, offset); // get offset
1178 }
1179 return success;
1122}1180}
1123 1181
1124static t_CKBOOL ck_get_mvar_dur( CK_DL_API api, Chuck_DL_Api::Object, std::string &, t_CKDUR & )1182//-----------------------------------------------------------------------------
1183// name: ck_get_mvar_float()
1184// desc: retrieve a class's member variable of type float
1185//-----------------------------------------------------------------------------
1186static t_CKBOOL ck_get_mvar_float( CK_DL_API api, Chuck_DL_Api::Object obj, const char* name, t_CKFLOAT & m_float )
1125{1187{
1126 return TRUE;1188 assert(obj != NULL);
1189 t_CKINT offset;
1190
1191 t_CKBOOL success = ck_get_mvar(obj, name, te_float, offset);
1192
1193 if (success)
1194 {
1195 Chuck_Object* ck_obj = (Chuck_Object*)obj;
1196 m_float = OBJ_MEMBER_FLOAT(ck_obj, offset); // get offset
1197 }
1198 return success;
1127}1199}
1128 1200
1129static t_CKBOOL ck_get_mvar_time( CK_DL_API api, Chuck_DL_Api::Object, std::string &, t_CKTIME & )1201//-----------------------------------------------------------------------------
1202// name: ck_get_mvar_dur()
1203// desc: retrieve a class's member variable of type dur
1204//-----------------------------------------------------------------------------
1205static t_CKBOOL ck_get_mvar_dur( CK_DL_API api, Chuck_DL_Api::Object obj, const char * name, t_CKDUR & value )
1130{1206{
1131 return TRUE;1207 assert(obj != NULL);
1208 t_CKINT offset;
1209
1210 t_CKBOOL success = ck_get_mvar(obj, name, te_dur, offset);
1211
1212 if (success)
1213 {
1214 Chuck_Object* ck_obj = (Chuck_Object*)obj;
1215 value = OBJ_MEMBER_DUR(ck_obj, offset); // get offset
1216 }
1217 return success;
1132}1218}
1133 1219
1134static t_CKBOOL ck_get_mvar_string( CK_DL_API api, Chuck_DL_Api::Object, std::string &, Chuck_DL_Api::String & )1220//-----------------------------------------------------------------------------
1221// name: ck_get_mvar_time()
1222// desc: retrieve a class's member variable of type time
1223//-----------------------------------------------------------------------------
1224static t_CKBOOL ck_get_mvar_time( CK_DL_API api, Chuck_DL_Api::Object obj, const char * name, t_CKTIME & value )
1135{1225{
1136 return TRUE;1226 assert(obj != NULL);
1227 t_CKINT offset;
1228
1229 t_CKBOOL success = ck_get_mvar(obj, name, te_time, offset);
1230
1231 if (success)
1232 {
1233 Chuck_Object* ck_obj = (Chuck_Object*)obj;
1234 value = OBJ_MEMBER_TIME(ck_obj, offset); // get offset
1235 }
1236 return success;
1137}1237}
1138 1238
1139static t_CKBOOL ck_get_mvar_object( CK_DL_API api, Chuck_DL_Api::Object, std::string &, Chuck_DL_Api::Object & )1239//-----------------------------------------------------------------------------
1240// name: ck_get_mvar_string()
1241// desc: retrieve a class's member variable of type string
1242//-----------------------------------------------------------------------------
1243static t_CKBOOL ck_get_mvar_string( CK_DL_API api, Chuck_DL_Api::Object obj, const char * name, Chuck_DL_Api::String & str )
1140{1244{
1141 return TRUE;1245 assert(obj != NULL);
1246 t_CKINT offset;
1247
1248 t_CKBOOL success = ck_get_mvar(obj, name, te_string, offset);
1249
1250 if (success)
1251 {
1252 Chuck_Object* ck_obj = (Chuck_Object*)obj;
1253 str = OBJ_MEMBER_STRING(ck_obj, offset); // get offset
1254 }
1255 return success;
1142}1256}
1143 1257
1144static t_CKBOOL ck_set_string( CK_DL_API api, Chuck_DL_Api::String s, std::string & str )1258//-----------------------------------------------------------------------------
1259// name: ck_get_mvar_object()
1260// desc: retrieve a class's member variable of type object
1261//-----------------------------------------------------------------------------
1262static t_CKBOOL ck_get_mvar_object( CK_DL_API api, Chuck_DL_Api::Object obj, const char * name, Chuck_DL_Api::Object & object )
1263{
1264 assert(obj != NULL);
1265 t_CKINT offset;
1266
1267 // TODO how to do this?
1268 t_CKBOOL success = ck_get_mvar(obj, name, te_object, offset);
1269
1270 if (success)
1271 {
1272 Chuck_Object* ck_obj = (Chuck_Object*)obj;
1273 object = OBJ_MEMBER_OBJECT(ck_obj, offset); // get offset
1274 }
1275 return success;
1276}
1277
1278//-----------------------------------------------------------------------------
1279// name: ck_set_string()
1280// desc: set a class's member string
1281//-----------------------------------------------------------------------------
1282static t_CKBOOL ck_set_string( CK_DL_API api, Chuck_DL_Api::String s, const char * str )
1145{1283{
1146 assert( s != NULL );1284 assert( s != NULL );
1147 1285
1148 Chuck_String * string = ( Chuck_String * ) s;1286 Chuck_String * string = (Chuck_String *) s;
1149 string->set( str );1287 string->set( str );
1150 1288
1151 return TRUE;1289 return TRUE;
1152}1290}
1153 1291
@@ -1197,7 +1335,8 @@ const char * dlerror( void ) · 43 unmodified lines
1197{1335{
1198 int error = GetLastError();1336 int error = GetLastError();
1199 if( error == 0 ) return NULL;1337 if( error == 0 ) return NULL;
1200 sprintf( dlerror_buffer, "%i", error );1338 // 1.4.2.0 (ge) | changed to snprintf
1339 snprintf( dlerror_buffer, DLERROR_BUFFER_LENGTH, "%i", error );
1201 return dlerror_buffer;1340 return dlerror_buffer;
1202}1341}
1203}1342}
src/core/chuck_dl.h+61−55
@@ -154,11 +154,11 @@ namespace Chuck_DL_Api { struct Api; } · 153 unmodified lines
154 154
155 155
156// chuck dll export linkage and calling convention156// chuck dll export linkage and calling convention
157#if defined (__PLATFORM_WIN32__) 157#if defined (__PLATFORM_WIN32__)
158 #define CK_DLL_LINKAGE extern "C" __declspec( dllexport )158 #define CK_DLL_LINKAGE extern "C" __declspec( dllexport )
159#else159#else
160 #define CK_DLL_LINKAGE extern "C" 160 #define CK_DLL_LINKAGE extern "C"
161#endif 161#endif
162 162
163// calling convention of functions provided by chuck to the dll163// calling convention of functions provided by chuck to the dll
164#if defined(__WINDOWS_DS__)164#if defined(__WINDOWS_DS__)
@@ -183,7 +183,7 @@ typedef const Chuck_DL_Api::Api *CK_DL_API; · 18 unmodified lines
183// example: CK_DLL_QUERY183// example: CK_DLL_QUERY
184#ifndef __CK_DLL_STATIC__184#ifndef __CK_DLL_STATIC__
185#define CK_DLL_QUERY(name) CK_DLL_DECLVERSION CK_DLL_EXPORT(t_CKBOOL) ck_query( Chuck_DL_Query * QUERY )185#define CK_DLL_QUERY(name) CK_DLL_DECLVERSION CK_DLL_EXPORT(t_CKBOOL) ck_query( Chuck_DL_Query * QUERY )
186#else 186#else
187#define CK_DLL_QUERY(name) CK_DLL_QUERY_STATIC(name)187#define CK_DLL_QUERY(name) CK_DLL_QUERY_STATIC(name)
188#endif // __CK_DLL_STATIC__188#endif // __CK_DLL_STATIC__
189// macro for defining ChucK DLL export allocator189// macro for defining ChucK DLL export allocator
@@ -382,13 +382,13 @@ public: · 192 unmodified lines
382 382
383 // re-added 1.4.0.1383 // re-added 1.4.0.1
384 f_create_main_thread_hook create_main_thread_hook;384 f_create_main_thread_hook create_main_thread_hook;
385 385
386 // NOTE: everything below std::anything cannot be reliably accessed386 // NOTE: everything below std::anything cannot be reliably accessed
387 // by offset between dynamic modules, since std::anything could be variable387 // by offset between dynamic modules, since std::anything could be variable
388 // size -- put everything need to be accessed across modules above here!388 // size -- put everything need to be accessed across modules above here!
389 // discovered by the vigilant and forever traumatized Jack Atherton,389 // discovered by the vigilant and forever traumatized Jack Atherton,
390 // fixed during REFACTOR-2017; warning by the guilt-ridden Ge Wang390 // fixed during REFACTOR-2017; warning by the guilt-ridden Ge Wang
391 391
392 // dll392 // dll
393 Chuck_DLL * dll_ref;393 Chuck_DLL * dll_ref;
394 // reserved394 // reserved
@@ -410,7 +410,7 @@ public: · 15 unmodified lines
410 std::vector<Chuck_DL_Class *> classes;410 std::vector<Chuck_DL_Class *> classes;
411 // stack411 // stack
412 std::vector<Chuck_DL_Class * >stack;412 std::vector<Chuck_DL_Class * >stack;
413 413
414 // constructor414 // constructor
415 Chuck_DL_Query( Chuck_Carrier * carrier );415 Chuck_DL_Query( Chuck_Carrier * carrier );
416 // desctructor416 // desctructor
@@ -458,12 +458,12 @@ struct Chuck_DL_Class · 41 unmodified lines
458 std::vector<Chuck_DL_Class *> classes;458 std::vector<Chuck_DL_Class *> classes;
459 // current mvar offset459 // current mvar offset
460 t_CKUINT current_mvar_offset;460 t_CKUINT current_mvar_offset;
461 461
462 t_CKUINT ugen_num_in, ugen_num_out;462 t_CKUINT ugen_num_in, ugen_num_out;
463 463
464 std::string doc;464 std::string doc;
465 std::vector<std::string> examples;465 std::vector<std::string> examples;
466 466
467 // constructor467 // constructor
468 Chuck_DL_Class() { dtor = NULL; ugen_tick = NULL; ugen_tickf = NULL; ugen_pmsg = NULL; uana_tock = NULL; ugen_pmsg = NULL; current_mvar_offset = 0; ugen_num_in = ugen_num_out = 0; }468 Chuck_DL_Class() { dtor = NULL; ugen_tick = NULL; ugen_tickf = NULL; ugen_pmsg = NULL; uana_tock = NULL; ugen_pmsg = NULL; current_mvar_offset = 0; ugen_num_in = ugen_num_out = 0; }
469 // destructor469 // destructor
@@ -515,7 +515,7 @@ struct Chuck_DL_Func · 45 unmodified lines
515 std::vector<Chuck_DL_Value *> args;515 std::vector<Chuck_DL_Value *> args;
516 // description516 // description
517 std::string doc;517 std::string doc;
518 518
519 // constructor519 // constructor
520 Chuck_DL_Func() { ctor = NULL; }520 Chuck_DL_Func() { ctor = NULL; }
521 Chuck_DL_Func( const char * t, const char * n, t_CKUINT a )521 Chuck_DL_Func( const char * t, const char * n, t_CKUINT a )
@@ -580,7 +580,7 @@ union Chuck_DL_Return · 58 unmodified lines
580 t_CKVEC4 v_vec4; // ge: added 1.3.5.3580 t_CKVEC4 v_vec4; // ge: added 1.3.5.3
581 Chuck_Object * v_object;581 Chuck_Object * v_object;
582 Chuck_String * v_string;582 Chuck_String * v_string;
583 583
584 Chuck_DL_Return() { v_vec4.x = v_vec4.y = v_vec4.z = v_vec4.w = 0; }584 Chuck_DL_Return() { v_vec4.x = v_vec4.y = v_vec4.z = v_vec4.w = 0; }
585};585};
586 586
@@ -595,7 +595,7 @@ struct Chuck_DLL : public Chuck_VM_Object · 8 unmodified lines
595{595{
596public:596public:
597 // load dynamic ckx/dll from filename597 // load dynamic ckx/dll from filename
598 t_CKBOOL load( const char * filename, 598 t_CKBOOL load( const char * filename,
599 const char * func = CK_QUERY_FUNC,599 const char * func = CK_QUERY_FUNC,
600 t_CKBOOL lazy = FALSE );600 t_CKBOOL lazy = FALSE );
601 t_CKBOOL load( f_ck_query query_func, t_CKBOOL lazy = FALSE );601 t_CKBOOL load( f_ck_query query_func, t_CKBOOL lazy = FALSE );
@@ -611,7 +611,7 @@ public: · 9 unmodified lines
611 t_CKBOOL good() const;611 t_CKBOOL good() const;
612 // name612 // name
613 const char * name() const;613 const char * name() const;
614 614
615public:615public:
616 // constructor616 // constructor
617 Chuck_DLL( Chuck_Carrier * carrier, const char * xid = NULL )617 Chuck_DLL( Chuck_Carrier * carrier, const char * xid = NULL )
@@ -644,7 +644,7 @@ public: · 26 unmodified lines
644 void * bindle, Chuck_Carrier * carrier);644 void * bindle, Chuck_Carrier * carrier);
645 t_CKBOOL (* const activate)(Chuck_DL_MainThreadHook *);645 t_CKBOOL (* const activate)(Chuck_DL_MainThreadHook *);
646 t_CKBOOL (* const deactivate)(Chuck_DL_MainThreadHook *);646 t_CKBOOL (* const deactivate)(Chuck_DL_MainThreadHook *);
647 647
648 Chuck_Carrier * const m_carrier;648 Chuck_Carrier * const m_carrier;
649 f_mainthreadhook const m_hook;649 f_mainthreadhook const m_hook;
650 f_mainthreadquit const m_quit;650 f_mainthreadquit const m_quit;
@@ -665,45 +665,49 @@ struct Api · 14 unmodified lines
665public:665public:
666 static Api g_api;666 static Api g_api;
667 static inline const Api * instance() { return &g_api; }667 static inline const Api * instance() { return &g_api; }
668 668
669 struct VMApi669 struct VMApi
670 {670 {
671 VMApi();671 VMApi();
672 t_CKUINT (* const get_srate)( CK_DL_API, Chuck_VM_Shred * );672 t_CKUINT (* const get_srate)( CK_DL_API, Chuck_VM_Shred * );
673 } * const vm;673 } * const vm;
674 674
675 struct ObjectApi675 struct ObjectApi
676 {676 {
677 ObjectApi();677 ObjectApi();
678 private:678
679 // 1.4.2.1 (nshaheed and ge and anonymous pr-lab member) | changed from private to public
680 // also changed all std::string & in this section to const char *
681 // intent: this allows for chugins to access member variables and create chuck strings
682 public:
679 // function pointer get_type()683 // function pointer get_type()
680 Type (* const get_type)( CK_DL_API, Chuck_VM_Shred *, std::string &name );684 Type (* const get_type)( CK_DL_API, Chuck_VM_Shred *, const char * name );
681 // function pointer create()685 // function pointer create()
682 Object (* const create)( CK_DL_API, Chuck_VM_Shred *, Type type );686 Object (* const create)( CK_DL_API, Chuck_VM_Shred *, Type type );
683 // function pointer create_string()687 // function pointer create_string()
684 String (* const create_string)( CK_DL_API, Chuck_VM_Shred *, std::string &value );688 String (* const create_string)( CK_DL_API, Chuck_VM_Shred *, const char * value );
685 // function pointers for get_mvar_*()689 // function pointers for get_mvar_*()
686 t_CKBOOL (* const get_mvar_int)( CK_DL_API, Object object, std::string &name, t_CKINT &value );690 t_CKBOOL (* const get_mvar_int)( CK_DL_API, Object object, const char * name, t_CKINT & value );
687 t_CKBOOL (* const get_mvar_float)( CK_DL_API, Object object, std::string &name, t_CKFLOAT &value );691 t_CKBOOL (* const get_mvar_float)( CK_DL_API, Object object, const char * name, t_CKFLOAT & value );
688 t_CKBOOL (* const get_mvar_dur)( CK_DL_API, Object object, std::string &name, t_CKDUR &value );692 t_CKBOOL (* const get_mvar_dur)( CK_DL_API, Object object, const char * name, t_CKDUR & value );
689 t_CKBOOL (* const get_mvar_time)( CK_DL_API, Object object, std::string &name, t_CKTIME &value );693 t_CKBOOL (* const get_mvar_time)( CK_DL_API, Object object, const char * name, t_CKTIME & value );
690 t_CKBOOL (* const get_mvar_string)( CK_DL_API, Object object, std::string &name, String &value );694 t_CKBOOL (* const get_mvar_string)( CK_DL_API, Object object, const char * name, String & value );
691 t_CKBOOL (* const get_mvar_object)( CK_DL_API, Object object, std::string &name, Object &value );695 t_CKBOOL (* const get_mvar_object)( CK_DL_API, Object object, const char * name, Object & value );
692 // function pointer for set_string()696 // function pointer for set_string()
693 t_CKBOOL (* const set_string)( CK_DL_API, String string, std::string &value );697 t_CKBOOL (* const set_string)( CK_DL_API, String string, const char * value );
694 } * const object;698 } * const object;
695 699
696 Api() :700 Api() :
697 vm(new VMApi),701 vm(new VMApi),
698 object(new ObjectApi)702 object(new ObjectApi)
699 { }703 { }
700 704
701private:705private:
702 Api( Api & a ) :706 Api( Api & a ) :
703 vm(a.vm),707 vm(a.vm),
704 object(a.object)708 object(a.object)
705 { assert(0); };709 { assert(0); };
706 710
707 Api & operator=( Api & a ) { assert(0); return a; }711 Api & operator=( Api & a ) { assert(0); return a; }
708};712};
709}713}
@@ -720,31 +724,33 @@ private: · 10 unmodified lines
720 724
721#error ChucK not support on Mac OS X 10.3 or lower725#error ChucK not support on Mac OS X 10.3 or lower
722 726
723#elif defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__) 727#elif defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__)
724 728
725 #ifdef __cplusplus 729 #ifdef __cplusplus
726 extern "C" { 730 extern "C" {
727 #endif 731 #endif
728 732
729 #define RTLD_LAZY 0x1 733 #define RTLD_LAZY 0x1
730 #define RTLD_NOW 0x2 734 #define RTLD_NOW 0x2
731 #define RTLD_LOCAL 0x4 735 #define RTLD_LOCAL 0x4
732 #define RTLD_GLOBAL 0x8 736 #define RTLD_GLOBAL 0x8
733 #define RTLD_NOLOAD 0x10 737 #define RTLD_NOLOAD 0x10
734 #define RTLD_SHARED 0x20 /* not used, the default */ 738 #define RTLD_SHARED 0x20 /* not used, the default */
735 #define RTLD_UNSHARED 0x40 739 #define RTLD_UNSHARED 0x40
736 #define RTLD_NODELETE 0x80 740 #define RTLD_NODELETE 0x80
737 #define RTLD_LAZY_UNDEF 0x100 741 #define RTLD_LAZY_UNDEF 0x100
738 742
739 void * dlopen( const char * path, int mode ); 743 void * dlopen( const char * path, int mode );
740 void * dlsym( void * handle, const char * symbol ); 744 void * dlsym( void * handle, const char * symbol );
741 const char * dlerror( void ); 745 const char * dlerror( void );
742 int dlclose( void * handle ); 746 int dlclose( void * handle );
743 static char dlerror_buffer[128]; 747 // 1.4.2.0 (ge) | added DLERROR_BUFFER_LENGTH
744 748 #define DLERROR_BUFFER_LENGTH 128
745 #ifdef __cplusplus 749 static char dlerror_buffer[DLERROR_BUFFER_LENGTH];
746 } 750
747 #endif 751 #ifdef __cplusplus
752 }
753 #endif
748 754
749#else755#else
750 #include "dlfcn.h"756 #include "dlfcn.h"
src/core/chuck_emit.cpp+357−250
@@ -35,6 +35,7 @@ · 34 unmodified lines
35#include "chuck_errmsg.h"35#include "chuck_errmsg.h"
36#include "chuck_instr.h"36#include "chuck_instr.h"
37#include "chuck_globals.h" // added 1.4.1.037#include "chuck_globals.h" // added 1.4.1.0
38#include "chuck_parse.h" // added 1.4.2.1
38#include <sstream>39#include <sstream>
39#include <iostream>40#include <iostream>
40 41
@@ -93,7 +94,7 @@ t_CKBOOL emit_engine_instantiate_object( Chuck_Emitter * emit, Chuck_Type * type · 52 unmodified lines
93 a_Array_Sub array, t_CKBOOL is_ref );94 a_Array_Sub array, t_CKBOOL is_ref );
94t_CKBOOL emit_engine_emit_spork( Chuck_Emitter * emit, a_Exp_Func_Call exp );95t_CKBOOL emit_engine_emit_spork( Chuck_Emitter * emit, a_Exp_Func_Call exp );
95t_CKBOOL emit_engine_emit_cast( Chuck_Emitter * emit, Chuck_Type * to, Chuck_Type * from );96t_CKBOOL emit_engine_emit_cast( Chuck_Emitter * emit, Chuck_Type * to, Chuck_Type * from );
96t_CKBOOL emit_engine_emit_symbol( Chuck_Emitter * emit, S_Symbol symbol, 97t_CKBOOL emit_engine_emit_symbol( Chuck_Emitter * emit, S_Symbol symbol,
97 Chuck_Value * v, t_CKBOOL emit_var, int linepos );98 Chuck_Value * v, t_CKBOOL emit_var, int linepos );
98// disabled until further notice (added 1.3.0.0)99// disabled until further notice (added 1.3.0.0)
99// t_CKBOOL emit_engine_emit_spork( Chuck_Emitter * emit, a_Stmt stmt );100// t_CKBOOL emit_engine_emit_spork( Chuck_Emitter * emit, a_Stmt stmt );
@@ -139,7 +140,7 @@ t_CKBOOL emit_engine_shutdown( Chuck_Emitter *& emit ) · 39 unmodified lines
139 delete emit;140 delete emit;
140 emit = NULL;141 emit = NULL;
141 142
142 return TRUE; 143 return TRUE;
143}144}
144 145
145 146
@@ -226,7 +227,7 @@ Chuck_VM_Code * emit_engine_emit_prog( Chuck_Emitter * emit, a_Program prog, · 80 unmodified lines
226 // the next227 // the next
227 prog = prog->next;228 prog = prog->next;
228 }229 }
229 230
230 // 1.4.1.0 (jack): error-checking: was dac-replacement initted?231 // 1.4.1.0 (jack): error-checking: was dac-replacement initted?
231 // (see chuck_compile.h for an explanation on replacement dacs)232 // (see chuck_compile.h for an explanation on replacement dacs)
232 if( emit->should_replace_dac )233 if( emit->should_replace_dac )
@@ -238,7 +239,7 @@ Chuck_VM_Code * emit_engine_emit_prog( Chuck_Emitter * emit, a_Program prog, · 5 unmodified lines
238 EM_error2( 0, " ... (hint: need to declare this variable as a global UGen)" );239 EM_error2( 0, " ... (hint: need to declare this variable as a global UGen)" );
239 ret = FALSE;240 ret = FALSE;
240 }241 }
241 242
242 // (also need to make sure it was constructed; see runtime error in243 // (also need to make sure it was constructed; see runtime error in
243 // Chuck_Instr_Reg_Push_Global)244 // Chuck_Instr_Reg_Push_Global)
244 }245 }
@@ -314,8 +315,17 @@ Chuck_VM_Code * emit_to_code( Chuck_Code * in, · 69 unmodified lines
314 // uh315 // uh
315 EM_error2( 0, "-------" );316 EM_error2( 0, "-------" );
316 for( t_CKUINT i = 0; i < code->num_instr; i++ )317 for( t_CKUINT i = 0; i < code->num_instr; i++ )
317 EM_error2( 0, "[%i] %s( %s )", i, 318 {
318 code->instr[i]->name(), code->instr[i]->params() );319 // check code str | 1.4.2.1 (ge) added
320 if( code->instr[i]->m_codestr )
321 {
322 // print the reconstructed code str
323 EM_error2( 0, "%s", code->instr[i]->m_codestr->c_str() );
324 }
325 // print the instruction
326 EM_error2( 0, "[%i] %s( %s )", i,
327 code->instr[i]->name(), code->instr[i]->params() );
328 }
319 EM_error2( 0, "-------\n" );329 EM_error2( 0, "-------\n" );
320 }330 }
321 331
@@ -377,15 +387,25 @@ t_CKBOOL emit_engine_emit_stmt( Chuck_Emitter * emit, a_Stmt stmt, t_CKBOOL pop · 55 unmodified lines
377 387
378 // return388 // return
379 t_CKBOOL ret = TRUE;389 t_CKBOOL ret = TRUE;
390 // next index
391 t_CKUINT nextIndex = 0;
392 // expression string
393 string codestr;
380 394
381 // loop over statements395 // loop over statements
382 switch( stmt->s_type )396 switch( stmt->s_type )
383 {397 {
384 case ae_stmt_exp: // expression statement398 case ae_stmt_exp: // expression statement
399 // get str
400 codestr = absyn2str( stmt->stmt_exp );
401 // get next index | 1.4.2.1 (ge) added
402 nextIndex = emit->next_index();
403
385 // emit it404 // emit it
386 ret = emit_engine_emit_exp( emit, stmt->stmt_exp );405 ret = emit_engine_emit_exp( emit, stmt->stmt_exp );
387 if( !ret )406 if( !ret )
388 return FALSE;407 return FALSE;
408
389 // need to pop the final value from stack409 // need to pop the final value from stack
390 if( ret && pop && stmt->stmt_exp->type->size > 0 )410 if( ret && pop && stmt->stmt_exp->type->size > 0 )
391 {411 {
@@ -398,17 +418,36 @@ t_CKBOOL emit_engine_emit_stmt( Chuck_Emitter * emit, a_Stmt stmt, t_CKBOOL pop · 6 unmodified lines
398 if( exp->s_type == ae_exp_primary && exp->primary.s_type == ae_primary_hack )418 if( exp->s_type == ae_exp_primary && exp->primary.s_type == ae_primary_hack )
399 exp = exp->primary.exp;419 exp = exp->primary.exp;
400 420
401 // HACK!421 // need to pop in reverse order
422 vector<a_Exp> pxe;
423 // go
402 while( exp )424 while( exp )
403 {425 {
426 pxe.push_back( exp );
427 exp = exp->next;
428 }
429
430 // loop over the expression that is the statement (prior to 1.4.2.1 comment: "HACK" hmmm...)
431 for( t_CKINT i = pxe.size()-1; i >= 0; i-- )
432 // for( t_CKINT i = 0; i < pxe.size(); i++ )
433 {
434 exp = pxe[i];
404 // if decl, then expect only one word per var435 // if decl, then expect only one word per var
405 // added 1.3.1.0: iskindofint -- since on some 64-bit systems sz_INT == sz_FLOAT436 // added 1.3.1.0: iskindofint -- since on some 64-bit systems sz_INT == sz_FLOAT
406 if( exp->s_type == ae_exp_decl )437 if( exp->s_type == ae_exp_decl )
438 {
407 // (added 1.3.1.0 -- multiply by type size; #64-bit)439 // (added 1.3.1.0 -- multiply by type size; #64-bit)
408 // (fixed 1.3.1.2 -- uh... decl should also be int-sized, so changed to INT/WORD)440 // (fixed 1.3.1.2 -- uh... decl should also be int-sized, so changed to INT/WORD)
409 emit->append( new Chuck_Instr_Reg_Pop_Word4( exp->decl.num_var_decls * sz_INT / sz_WORD ) );441 emit->append( new Chuck_Instr_Reg_Pop_Word4( exp->decl.num_var_decls * sz_INT / sz_WORD ) );
442 }
410 else if( exp->type->size == sz_INT && iskindofint(emit->env, exp->type) ) // ISSUE: 64-bit (fixed 1.3.1.0)443 else if( exp->type->size == sz_INT && iskindofint(emit->env, exp->type) ) // ISSUE: 64-bit (fixed 1.3.1.0)
411 emit->append( new Chuck_Instr_Reg_Pop_Word );444 {
445 // is an object left on the stack for the stmt
446 if( exp->s_type == ae_exp_func_call && isobj(emit->env, exp->type) )
447 { emit->append( new Chuck_Instr_Release_Object3_Pop_Word ); }
448 else // not an object
449 { emit->append( new Chuck_Instr_Reg_Pop_Word ); }
450 }
412 else if( exp->type->size == sz_FLOAT ) // ISSUE: 64-bit (fixed 1.3.1.0)451 else if( exp->type->size == sz_FLOAT ) // ISSUE: 64-bit (fixed 1.3.1.0)
413 emit->append( new Chuck_Instr_Reg_Pop_Word2 );452 emit->append( new Chuck_Instr_Reg_Pop_Word2 );
414 else if( exp->type->size == sz_COMPLEX ) // ISSUE: 64-bit (fixed 1.3.1.0)453 else if( exp->type->size == sz_COMPLEX ) // ISSUE: 64-bit (fixed 1.3.1.0)
@@ -424,11 +463,15 @@ t_CKBOOL emit_engine_emit_stmt( Chuck_Emitter * emit, a_Stmt stmt, t_CKBOOL pop · 9 unmodified lines
424 exp->type->size );463 exp->type->size );
425 return FALSE;464 return FALSE;
426 }465 }
427
428 // go
429 exp = exp->next;
430 }466 }
431 }467 }
468
469 // see if we added at least one instruction
470 if( nextIndex < emit->next_index() )
471 {
472 // set codestr (for instruction dump)
473 emit->code->code[nextIndex]->set_codestr( codestr );
474 }
432 break;475 break;
433 476
434 case ae_stmt_if: // if statement477 case ae_stmt_if: // if statement
@@ -445,7 +488,7 @@ t_CKBOOL emit_engine_emit_stmt( Chuck_Emitter * emit, a_Stmt stmt, t_CKBOOL pop · 10 unmodified lines
445 else488 else
446 ret = emit_engine_emit_while( emit, &stmt->stmt_while );489 ret = emit_engine_emit_while( emit, &stmt->stmt_while );
447 break;490 break;
448 491
449 case ae_stmt_until: // until statement492 case ae_stmt_until: // until statement
450 if( stmt->stmt_until.is_do )493 if( stmt->stmt_until.is_do )
451 ret = emit_engine_emit_do_until( emit, &stmt->stmt_until );494 ret = emit_engine_emit_do_until( emit, &stmt->stmt_until );
@@ -469,29 +512,29 @@ t_CKBOOL emit_engine_emit_stmt( Chuck_Emitter * emit, a_Stmt stmt, t_CKBOOL pop · 17 unmodified lines
469 case ae_stmt_code: // code segment512 case ae_stmt_code: // code segment
470 ret = emit_engine_emit_code_segment( emit, &stmt->stmt_code );513 ret = emit_engine_emit_code_segment( emit, &stmt->stmt_code );
471 break;514 break;
472 515
473 case ae_stmt_continue: // continue statement516 case ae_stmt_continue: // continue statement
474 ret = emit_engine_emit_continue( emit, &stmt->stmt_continue );517 ret = emit_engine_emit_continue( emit, &stmt->stmt_continue );
475 break;518 break;
476 519
477 case ae_stmt_return: // return statement520 case ae_stmt_return: // return statement
478 ret = emit_engine_emit_return( emit, &stmt->stmt_return );521 ret = emit_engine_emit_return( emit, &stmt->stmt_return );
479 break;522 break;
480 523
481 case ae_stmt_case: // case statement524 case ae_stmt_case: // case statement
482 // not implemented525 // not implemented
483 ret = FALSE;526 ret = FALSE;
484 // ret = emit_engine_emit_case( emit, &stmt->stmt_case );527 // ret = emit_engine_emit_case( emit, &stmt->stmt_case );
485 break;528 break;
486 529
487 case ae_stmt_gotolabel: // goto label statement530 case ae_stmt_gotolabel: // goto label statement
488 // not implemented531 // not implemented
489 ret = FALSE;532 ret = FALSE;
490 // ret = emit_engine_emit_gotolabel( emit, &stmt->stmt_case );533 // ret = emit_engine_emit_gotolabel( emit, &stmt->stmt_case );
491 break;534 break;
492 535
493 default: // bad536 default: // bad
494 EM_error2( stmt->linepos, 537 EM_error2( stmt->linepos,
495 "(emit): internal error: unhandled statement type '%i'...",538 "(emit): internal error: unhandled statement type '%i'...",
496 stmt->s_type );539 stmt->s_type );
497 break;540 break;
@@ -535,7 +578,7 @@ t_CKBOOL emit_engine_emit_if( Chuck_Emitter * emit, a_Stmt_If stmt ) · 37 unmodified lines
535 emit->append( new Chuck_Instr_Reg_Push_Imm2( 0.0 ) );578 emit->append( new Chuck_Instr_Reg_Push_Imm2( 0.0 ) );
536 op = new Chuck_Instr_Branch_Eq_double( 0 );579 op = new Chuck_Instr_Branch_Eq_double( 0 );
537 break;580 break;
538 581
539 default:582 default:
540 // check for IO583 // check for IO
541 if( isa( stmt->cond->type, emit->env->t_io ) )584 if( isa( stmt->cond->type, emit->env->t_io ) )
@@ -571,7 +614,7 @@ t_CKBOOL emit_engine_emit_if( Chuck_Emitter * emit, a_Stmt_If stmt ) · 29 unmodified lines
571 614
572 // emit the skip to the end615 // emit the skip to the end
573 emit->append( op2 = new Chuck_Instr_Goto(0) );616 emit->append( op2 = new Chuck_Instr_Goto(0) );
574 617
575 // set the op's target618 // set the op's target
576 op->set( emit->next_index() );619 op->set( emit->next_index() );
577 620
@@ -592,7 +635,7 @@ t_CKBOOL emit_engine_emit_if( Chuck_Emitter * emit, a_Stmt_If stmt ) · 14 unmodified lines
592 635
593 // pop stack636 // pop stack
594 emit->pop_scope();637 emit->pop_scope();
595 638
596 return ret;639 return ret;
597}640}
598 641
@@ -644,7 +687,7 @@ t_CKBOOL emit_engine_emit_for( Chuck_Emitter * emit, a_Stmt_For stmt ) · 45 unmodified lines
644 emit->append( new Chuck_Instr_Reg_Push_Imm2( 0.0 ) );687 emit->append( new Chuck_Instr_Reg_Push_Imm2( 0.0 ) );
645 op = new Chuck_Instr_Branch_Eq_double( 0 );688 op = new Chuck_Instr_Branch_Eq_double( 0 );
646 break;689 break;
647 690
648 default:691 default:
649 // check for IO692 // check for IO
650 if( isa( stmt->c2->stmt_exp->type, emit->env->t_io ) )693 if( isa( stmt->c2->stmt_exp->type, emit->env->t_io ) )
@@ -671,10 +714,10 @@ t_CKBOOL emit_engine_emit_for( Chuck_Emitter * emit, a_Stmt_For stmt ) · 20 unmodified lines
671 ret = emit_engine_emit_stmt( emit, stmt->body );714 ret = emit_engine_emit_stmt( emit, stmt->body );
672 if( !ret )715 if( !ret )
673 return FALSE;716 return FALSE;
674 717
675 // added 1.3.1.1: pop scope for loop body718 // added 1.3.1.1: pop scope for loop body
676 emit->pop_scope();719 emit->pop_scope();
677 720
678 // continue here721 // continue here
679 cont_index = emit->next_index();722 cont_index = emit->next_index();
680 723
@@ -708,7 +751,7 @@ t_CKBOOL emit_engine_emit_for( Chuck_Emitter * emit, a_Stmt_For stmt ) · 27 unmodified lines
708 // advance751 // advance
709 e = e->next;752 e = e->next;
710 }753 }
711 754
712 // pop (changed to Chuck_Instr_Reg_Pop_Word4 in 1.3.1.0)755 // pop (changed to Chuck_Instr_Reg_Pop_Word4 in 1.3.1.0)
713 if( num_words > 0 ) emit->append( new Chuck_Instr_Reg_Pop_Word4( num_words ) );756 if( num_words > 0 ) emit->append( new Chuck_Instr_Reg_Pop_Word4( num_words ) );
714 }757 }
@@ -771,7 +814,7 @@ t_CKBOOL emit_engine_emit_while( Chuck_Emitter * emit, a_Stmt_While stmt ) · 56 unmodified lines
771 ret = emit_engine_emit_exp( emit, stmt->cond );814 ret = emit_engine_emit_exp( emit, stmt->cond );
772 if( !ret )815 if( !ret )
773 return FALSE;816 return FALSE;
774 817
775 // the condition818 // the condition
776 switch( stmt->cond->type->xid )819 switch( stmt->cond->type->xid )
777 {820 {
@@ -787,7 +830,7 @@ t_CKBOOL emit_engine_emit_while( Chuck_Emitter * emit, a_Stmt_While stmt ) · 9 unmodified lines
787 emit->append( new Chuck_Instr_Reg_Push_Imm2( 0.0 ) );830 emit->append( new Chuck_Instr_Reg_Push_Imm2( 0.0 ) );
788 op = new Chuck_Instr_Branch_Eq_double( 0 );831 op = new Chuck_Instr_Branch_Eq_double( 0 );
789 break;832 break;
790 833
791 default:834 default:
792 // check for IO835 // check for IO
793 if( isa( stmt->cond->type, emit->env->t_io ) )836 if( isa( stmt->cond->type, emit->env->t_io ) )
@@ -803,24 +846,24 @@ t_CKBOOL emit_engine_emit_while( Chuck_Emitter * emit, a_Stmt_While stmt ) · 9 unmodified lines
803 stmt->cond->type->name.c_str() );846 stmt->cond->type->name.c_str() );
804 return FALSE;847 return FALSE;
805 }848 }
806 849
807 // append the op850 // append the op
808 emit->append( op );851 emit->append( op );
809 852
810 // added 1.3.1.1: new scope just for loop body853 // added 1.3.1.1: new scope just for loop body
811 emit->push_scope();854 emit->push_scope();
812 855
813 // emit the body856 // emit the body
814 ret = emit_engine_emit_stmt( emit, stmt->body );857 ret = emit_engine_emit_stmt( emit, stmt->body );
815 if( !ret )858 if( !ret )
816 return FALSE;859 return FALSE;
817 860
818 // added 1.3.1.1: pop scope for loop body861 // added 1.3.1.1: pop scope for loop body
819 emit->pop_scope();862 emit->pop_scope();
820 863
821 // go back to do check the condition864 // go back to do check the condition
822 emit->append( new Chuck_Instr_Goto( start_index ) );865 emit->append( new Chuck_Instr_Goto( start_index ) );
823 866
824 // set the op's target867 // set the op's target
825 op->set( emit->next_index() );868 op->set( emit->next_index() );
826 869
@@ -860,7 +903,7 @@ t_CKBOOL emit_engine_emit_do_while( Chuck_Emitter * emit, a_Stmt_While stmt ) · 33 unmodified lines
860 t_CKBOOL ret = TRUE;903 t_CKBOOL ret = TRUE;
861 Chuck_Instr_Branch_Op * op = NULL;904 Chuck_Instr_Branch_Op * op = NULL;
862 t_CKUINT start_index = emit->next_index();905 t_CKUINT start_index = emit->next_index();
863 906
864 // push stack907 // push stack
865 emit->push_scope();908 emit->push_scope();
866 909
@@ -876,7 +919,7 @@ t_CKBOOL emit_engine_emit_do_while( Chuck_Emitter * emit, a_Stmt_While stmt ) · 9 unmodified lines
876 ret = emit_engine_emit_stmt( emit, stmt->body );919 ret = emit_engine_emit_stmt( emit, stmt->body );
877 if( !ret )920 if( !ret )
878 return FALSE;921 return FALSE;
879 922
880 // added 1.3.1.1: pop scope for loop body923 // added 1.3.1.1: pop scope for loop body
881 emit->pop_scope();924 emit->pop_scope();
882 925
@@ -884,7 +927,7 @@ t_CKBOOL emit_engine_emit_do_while( Chuck_Emitter * emit, a_Stmt_While stmt ) · 1 unmodified line
884 ret = emit_engine_emit_exp( emit, stmt->cond );927 ret = emit_engine_emit_exp( emit, stmt->cond );
885 if( !ret )928 if( !ret )
886 return FALSE;929 return FALSE;
887 930
888 // the condition931 // the condition
889 switch( stmt->cond->type->xid )932 switch( stmt->cond->type->xid )
890 {933 {
@@ -900,7 +943,7 @@ t_CKBOOL emit_engine_emit_do_while( Chuck_Emitter * emit, a_Stmt_While stmt ) · 9 unmodified lines
900 emit->append( new Chuck_Instr_Reg_Push_Imm2( 0.0 ) );943 emit->append( new Chuck_Instr_Reg_Push_Imm2( 0.0 ) );
901 op = new Chuck_Instr_Branch_Neq_double( 0 );944 op = new Chuck_Instr_Branch_Neq_double( 0 );
902 break;945 break;
903 946
904 default:947 default:
905 // check for IO948 // check for IO
906 if( isa( stmt->cond->type, emit->env->t_io ) )949 if( isa( stmt->cond->type, emit->env->t_io ) )
@@ -916,7 +959,7 @@ t_CKBOOL emit_engine_emit_do_while( Chuck_Emitter * emit, a_Stmt_While stmt ) · 9 unmodified lines
916 stmt->cond->type->c_name() );959 stmt->cond->type->c_name() );
917 return FALSE;960 return FALSE;
918 }961 }
919 962
920 // append the op963 // append the op
921 emit->append( op );964 emit->append( op );
922 965
@@ -943,7 +986,7 @@ t_CKBOOL emit_engine_emit_do_while( Chuck_Emitter * emit, a_Stmt_While stmt ) · 20 unmodified lines
943 emit->code->stack_cont.pop_back();986 emit->code->stack_cont.pop_back();
944 // pop break stack987 // pop break stack
945 emit->code->stack_break.pop_back();988 emit->code->stack_break.pop_back();
946 989
947 return ret;990 return ret;
948}991}
949 992
@@ -989,7 +1032,7 @@ t_CKBOOL emit_engine_emit_until( Chuck_Emitter * emit, a_Stmt_Until stmt ) · 39 unmodified lines
989 emit->append( new Chuck_Instr_Reg_Push_Imm2( 0.0 ) );1032 emit->append( new Chuck_Instr_Reg_Push_Imm2( 0.0 ) );
990 op = new Chuck_Instr_Branch_Neq_double( 0 );1033 op = new Chuck_Instr_Branch_Neq_double( 0 );
991 break;1034 break;
992 1035
993 default:1036 default:
994 // check for IO1037 // check for IO
995 if( isa( stmt->cond->type, emit->env->t_io ) )1038 if( isa( stmt->cond->type, emit->env->t_io ) )
@@ -1005,7 +1048,7 @@ t_CKBOOL emit_engine_emit_until( Chuck_Emitter * emit, a_Stmt_Until stmt ) · 9 unmodified lines
1005 stmt->cond->type->name.c_str() );1048 stmt->cond->type->name.c_str() );
1006 return FALSE;1049 return FALSE;
1007 }1050 }
1008 1051
1009 // append the op1052 // append the op
1010 emit->append( op );1053 emit->append( op );
1011 1054
@@ -1014,13 +1057,13 @@ t_CKBOOL emit_engine_emit_until( Chuck_Emitter * emit, a_Stmt_Until stmt ) · 2 unmodified lines
1014 1057
1015 // emit the body1058 // emit the body
1016 emit_engine_emit_stmt( emit, stmt->body );1059 emit_engine_emit_stmt( emit, stmt->body );
1017 1060
1018 // added 1.3.1.1: pop scope for loop body1061 // added 1.3.1.1: pop scope for loop body
1019 emit->pop_scope();1062 emit->pop_scope();
1020 1063
1021 // go back to do check the condition1064 // go back to do check the condition
1022 emit->append( new Chuck_Instr_Goto( start_index ) );1065 emit->append( new Chuck_Instr_Goto( start_index ) );
1023 1066
1024 // set the op's target1067 // set the op's target
1025 op->set( emit->next_index() );1068 op->set( emit->next_index() );
1026 1069
@@ -1044,7 +1087,7 @@ t_CKBOOL emit_engine_emit_until( Chuck_Emitter * emit, a_Stmt_Until stmt ) · 17 unmodified lines
1044 emit->code->stack_cont.pop_back();1087 emit->code->stack_cont.pop_back();
1045 // pop break stack1088 // pop break stack
1046 emit->code->stack_break.pop_back();1089 emit->code->stack_break.pop_back();
1047 1090
1048 return ret;1091 return ret;
1049}1092}
1050 1093
@@ -1077,7 +1120,7 @@ t_CKBOOL emit_engine_emit_do_until( Chuck_Emitter * emit, a_Stmt_Until stmt ) · 26 unmodified lines
1077 ret = emit_engine_emit_stmt( emit, stmt->body );1120 ret = emit_engine_emit_stmt( emit, stmt->body );
1078 if( !ret )1121 if( !ret )
1079 return FALSE;1122 return FALSE;
1080 1123
1081 // added 1.3.1.1: pop scope for loop body1124 // added 1.3.1.1: pop scope for loop body
1082 emit->pop_scope();1125 emit->pop_scope();
1083 1126
@@ -1135,7 +1178,7 @@ t_CKBOOL emit_engine_emit_do_until( Chuck_Emitter * emit, a_Stmt_Until stmt ) · 51 unmodified lines
1135 emit->code->stack_cont.pop_back();1178 emit->code->stack_cont.pop_back();
1136 // pop break stack1179 // pop break stack
1137 emit->code->stack_break.pop_back();1180 emit->code->stack_break.pop_back();
1138 1181
1139 return ret;1182 return ret;
1140}1183}
1141 1184
@@ -1150,7 +1193,7 @@ t_CKBOOL emit_engine_emit_loop( Chuck_Emitter * emit, a_Stmt_Loop stmt ) · 8 unmodified lines
1150{1193{
1151 t_CKBOOL ret = TRUE;1194 t_CKBOOL ret = TRUE;
1152 Chuck_Instr_Branch_Op * op = NULL;1195 Chuck_Instr_Branch_Op * op = NULL;
1153 1196
1154 Chuck_Instr * instr = NULL;1197 Chuck_Instr * instr = NULL;
1155 1198
1156 // push stack1199 // push stack
@@ -1194,7 +1237,7 @@ t_CKBOOL emit_engine_emit_loop( Chuck_Emitter * emit, a_Stmt_Loop stmt ) · 37 unmodified lines
1194 1237
1195 return FALSE;1238 return FALSE;
1196 }1239 }
1197 1240
1198 // append the op1241 // append the op
1199 emit->append( op );1242 emit->append( op );
1200 1243
@@ -1209,16 +1252,16 @@ t_CKBOOL emit_engine_emit_loop( Chuck_Emitter * emit, a_Stmt_Loop stmt ) · 8 unmodified lines
1209 ret = emit_engine_emit_stmt( emit, stmt->body );1252 ret = emit_engine_emit_stmt( emit, stmt->body );
1210 if( !ret )1253 if( !ret )
1211 return FALSE;1254 return FALSE;
1212 1255
1213 // added 1.3.1.1: pop scope for loop body1256 // added 1.3.1.1: pop scope for loop body
1214 emit->pop_scope();1257 emit->pop_scope();
1215 1258
1216 // go back to do check the condition1259 // go back to do check the condition
1217 emit->append( new Chuck_Instr_Goto( start_index ) );1260 emit->append( new Chuck_Instr_Goto( start_index ) );
1218 1261
1219 // set the op's target1262 // set the op's target
1220 op->set( emit->next_index() );1263 op->set( emit->next_index() );
1221 1264
1222 // pop the loop counter1265 // pop the loop counter
1223 emit->append( new Chuck_Instr_Pop_Loop_Counter );1266 emit->append( new Chuck_Instr_Pop_Loop_Counter );
1224 1267
@@ -1260,7 +1303,7 @@ t_CKBOOL emit_engine_emit_break( Chuck_Emitter * emit, a_Stmt_Break br ) · 35 unmodified lines
1260 emit->append( op );1303 emit->append( op );
1261 // remember1304 // remember
1262 emit->code->stack_break.push_back( op );1305 emit->code->stack_break.push_back( op );
1263 1306
1264 return TRUE;1307 return TRUE;
1265}1308}
1266 1309
@@ -1291,12 +1334,27 @@ t_CKBOOL emit_engine_emit_continue( Chuck_Emitter * emit, a_Stmt_Continue cont ) · 24 unmodified lines
1291//-----------------------------------------------------------------------------1334//-----------------------------------------------------------------------------
1292t_CKBOOL emit_engine_emit_return( Chuck_Emitter * emit, a_Stmt_Return stmt )1335t_CKBOOL emit_engine_emit_return( Chuck_Emitter * emit, a_Stmt_Return stmt )
1293{1336{
1337 // emit the value
1294 if( !emit_engine_emit_exp( emit, stmt->val ) )1338 if( !emit_engine_emit_exp( emit, stmt->val ) )
1295 return FALSE;1339 return FALSE;
1296 1340
1341 // if return is an object type
1342 if( stmt->val && isobj( emit->env, stmt->val->type ) )
1343 {
1344 // add reference (to be released by the function caller)
1345 emit->append( new Chuck_Instr_Reg_AddRef_Object3 );
1346 }
1347
1348 // 1.4.2.1 (ge) | traverse and unwind current scope frames, release object
1349 // references given the current state of the stack frames; every `return`
1350 // statement needs its own scope unwinding; FYI: this does not change the
1351 // scope frames, which is needed to continue compilation for the rest
1352 // of the function; this does emit instructions (e.g., Release_Object2)
1353 // associated with this traversal action (also see 'break' and 'continue')
1354 emit->traverse_scope_on_jump();
1355
1297 // emit return1356 // emit return
1298 // emit->append( new Chuck_Instr_Func_Return );1357 // emit->append( new Chuck_Instr_Func_Return );
1299
1300 // determine where later1358 // determine where later
1301 Chuck_Instr_Goto * instr = new Chuck_Instr_Goto( 0 );1359 Chuck_Instr_Goto * instr = new Chuck_Instr_Goto( 0 );
1302 emit->append( instr );1360 emit->append( instr );
@@ -1329,7 +1387,7 @@ t_CKBOOL emit_engine_emit_exp( Chuck_Emitter * emit, a_Exp exp, t_CKBOOL doAddRe · 26 unmodified lines
1329 // for now...1387 // for now...
1330 // assert( exp->next == NULL );1388 // assert( exp->next == NULL );
1331 1389
1332 // loop over 1390 // loop over
1333 while( exp )1391 while( exp )
1334 {1392 {
1335 switch( exp->s_type )1393 switch( exp->s_type )
@@ -1395,7 +1453,7 @@ t_CKBOOL emit_engine_emit_exp( Chuck_Emitter * emit, a_Exp exp, t_CKBOOL doAddRe · 59 unmodified lines
1395 // break;1453 // break;
1396 1454
1397 default:1455 default:
1398 EM_error2( exp->linepos, 1456 EM_error2( exp->linepos,
1399 "(emit): internal error: unhandled expression type '%i'...",1457 "(emit): internal error: unhandled expression type '%i'...",
1400 exp->s_type );1458 exp->s_type );
1401 return FALSE;1459 return FALSE;
@@ -1405,7 +1463,7 @@ t_CKBOOL emit_engine_emit_exp( Chuck_Emitter * emit, a_Exp exp, t_CKBOOL doAddRe · 3 unmodified lines
1405 if( exp->cast_to != NULL )1463 if( exp->cast_to != NULL )
1406 if( !emit_engine_emit_cast( emit, exp->cast_to, exp->type ) )1464 if( !emit_engine_emit_cast( emit, exp->cast_to, exp->type ) )
1407 return FALSE;1465 return FALSE;
1408 1466
1409 // check if we need to handle ref (added 1.3.0.0)1467 // check if we need to handle ref (added 1.3.0.0)
1410 // (NOTE: cast shouldn't matter since pointer width should remain constant)1468 // (NOTE: cast shouldn't matter since pointer width should remain constant)
1411 if( doAddRef && isobj( emit->env, exp->type ) )1469 if( doAddRef && isobj( emit->env, exp->type ) )
@@ -1434,17 +1492,17 @@ t_CKBOOL emit_engine_emit_exp_binary( Chuck_Emitter * emit, a_Exp_Binary binary · 22 unmodified lines
1434 1492
1435 t_CKBOOL left = FALSE;1493 t_CKBOOL left = FALSE;
1436 t_CKBOOL right = FALSE;1494 t_CKBOOL right = FALSE;
1437 1495
1438 // hack to allow && to terminate as soon as possible - spencer1496 // hack to allow && to terminate as soon as possible - spencer
1439 // i.e. in ( 0 && f() ) the function f() will not be called1497 // i.e. in ( 0 && f() ) the function f() will not be called
1440 // (obviates need for boolean AND instruction)1498 // (obviates need for boolean AND instruction)
1441 if( binary->op == ae_op_and )1499 if( binary->op == ae_op_and )
1442 {1500 {
1443 Chuck_Instr_Branch_Op * op;1501 Chuck_Instr_Branch_Op * op;
1444 1502
1445 // push default result1503 // push default result
1446 emit->append( new Chuck_Instr_Reg_Push_Imm( 0 ) );1504 emit->append( new Chuck_Instr_Reg_Push_Imm( 0 ) );
1447 1505
1448 left = emit_engine_emit_exp( emit, binary->lhs );1506 left = emit_engine_emit_exp( emit, binary->lhs );
1449 if( !left )1507 if( !left )
1450 return FALSE;1508 return FALSE;
@@ -1463,39 +1521,39 @@ t_CKBOOL emit_engine_emit_exp_binary( Chuck_Emitter * emit, a_Exp_Binary binary · 12 unmodified lines
1463 1521
1464 // set branch location1522 // set branch location
1465 op->set( emit->next_index() );1523 op->set( emit->next_index() );
1466 1524
1467 return TRUE;1525 return TRUE;
1468 }1526 }
1469 1527
1470 // hack to allow || to terminate as soon as possible - spencer1528 // hack to allow || to terminate as soon as possible - spencer
1471 // i.e. in ( 1 || f() ) the function f() will not be called1529 // i.e. in ( 1 || f() ) the function f() will not be called
1472 // (obviates need for boolean OR instruction)1530 // (obviates need for boolean OR instruction)
1473 else if( binary->op == ae_op_or )1531 else if( binary->op == ae_op_or )
1474 {1532 {
1475 Chuck_Instr_Branch_Op * op;1533 Chuck_Instr_Branch_Op * op;
1476 1534
1477 // push default result1535 // push default result
1478 emit->append( new Chuck_Instr_Reg_Push_Imm( 1 ) );1536 emit->append( new Chuck_Instr_Reg_Push_Imm( 1 ) );
1479 1537
1480 left = emit_engine_emit_exp( emit, binary->lhs );1538 left = emit_engine_emit_exp( emit, binary->lhs );
1481 if( !left )1539 if( !left )
1482 return FALSE; 1540 return FALSE;
1483 1541
1484 // compare to 0; use default result if non-zero1542 // compare to 0; use default result if non-zero
1485 emit->append( new Chuck_Instr_Reg_Push_Imm( 0 ) );1543 emit->append( new Chuck_Instr_Reg_Push_Imm( 0 ) );
1486 emit->append( op = new Chuck_Instr_Branch_Neq_int( 0 ) );1544 emit->append( op = new Chuck_Instr_Branch_Neq_int( 0 ) );
1487 1545
1488 // pop default result1546 // pop default result
1489 emit->append( new Chuck_Instr_Reg_Pop_Word );1547 emit->append( new Chuck_Instr_Reg_Pop_Word );
1490 1548
1491 // result of whole expression is now result of rhs1549 // result of whole expression is now result of rhs
1492 right = emit_engine_emit_exp( emit, binary->rhs );1550 right = emit_engine_emit_exp( emit, binary->rhs );
1493 if( !right )1551 if( !right )
1494 return FALSE;1552 return FALSE;
1495 1553
1496 // set branch location1554 // set branch location
1497 op->set( emit->next_index() );1555 op->set( emit->next_index() );
1498 1556
1499 return TRUE;1557 return TRUE;
1500 }1558 }
1501 1559
@@ -1543,7 +1601,7 @@ t_CKBOOL emit_engine_emit_op( Chuck_Emitter * emit, ae_Operator op, a_Exp lhs, a · 41 unmodified lines
1543 1601
1544 // emit op1602 // emit op
1545 switch( op )1603 switch( op )
1546 { 1604 {
1547 // ----------------------------- num --------------------------------------1605 // ----------------------------- num --------------------------------------
1548 case ae_op_plus:1606 case ae_op_plus:
1549 // time + dur1607 // time + dur
@@ -1631,7 +1689,7 @@ t_CKBOOL emit_engine_emit_op( Chuck_Emitter * emit, ae_Operator op, a_Exp lhs, a · 81 unmodified lines
1631 }1689 }
1632 }1690 }
1633 break;1691 break;
1634 1692
1635 case ae_op_plus_chuck:1693 case ae_op_plus_chuck:
1636 // time advance1694 // time advance
1637 if( left == te_dur && right == te_time && rhs->s_meta == ae_meta_var &&1695 if( left == te_dur && right == te_time && rhs->s_meta == ae_meta_var &&
@@ -1741,7 +1799,7 @@ t_CKBOOL emit_engine_emit_op( Chuck_Emitter * emit, ae_Operator op, a_Exp lhs, a · 103 unmodified lines
1741 }1799 }
1742 }1800 }
1743 break;1801 break;
1744 1802
1745 case ae_op_minus_chuck:1803 case ae_op_minus_chuck:
1746 if( ( left == te_dur && right == te_time ) ) // time - dur = time1804 if( ( left == te_dur && right == te_time ) ) // time - dur = time
1747 emit->append( instr = new Chuck_Instr_Minus_double_Assign );1805 emit->append( instr = new Chuck_Instr_Minus_double_Assign );
@@ -1822,7 +1880,7 @@ t_CKBOOL emit_engine_emit_op( Chuck_Emitter * emit, ae_Operator op, a_Exp lhs, a · 74 unmodified lines
1822 }1880 }
1823 }1881 }
1824 break;1882 break;
1825 1883
1826 case ae_op_times_chuck:1884 case ae_op_times_chuck:
1827 // check1885 // check
1828 if( left == te_float && right == te_vec3 )1886 if( left == te_float && right == te_vec3 )
@@ -1886,10 +1944,10 @@ t_CKBOOL emit_engine_emit_op( Chuck_Emitter * emit, ae_Operator op, a_Exp lhs, a · 57 unmodified lines
1886 break;1944 break;
1887 1945
1888 default: break;1946 default: break;
1889 } 1947 }
1890 }1948 }
1891 break;1949 break;
1892 1950
1893 case ae_op_divide_chuck:1951 case ae_op_divide_chuck:
1894 // reverse1952 // reverse
1895 if( ( left == te_dur && right == te_time ) ) // time / dur = float1953 if( ( left == te_dur && right == te_time ) ) // time / dur = float
@@ -1932,18 +1990,18 @@ t_CKBOOL emit_engine_emit_op( Chuck_Emitter * emit, ae_Operator op, a_Exp lhs, a · 36 unmodified lines
1932 case te_int:1990 case te_int:
1933 emit->append( instr = new Chuck_Instr_Binary_Or );1991 emit->append( instr = new Chuck_Instr_Binary_Or );
1934 break;1992 break;
1935 1993
1936 default: break;1994 default: break;
1937 }1995 }
1938 break;1996 break;
1939 1997
1940 case ae_op_s_or_chuck:1998 case ae_op_s_or_chuck:
1941 switch( left )1999 switch( left )
1942 {2000 {
1943 case te_int:2001 case te_int:
1944 emit->append( instr = new Chuck_Instr_Binary_Or_Assign );2002 emit->append( instr = new Chuck_Instr_Binary_Or_Assign );
1945 break;2003 break;
1946 2004
1947 default: break;2005 default: break;
1948 }2006 }
1949 break;2007 break;
@@ -1998,7 +2056,7 @@ t_CKBOOL emit_engine_emit_op( Chuck_Emitter * emit, ae_Operator op, a_Exp lhs, a · 48 unmodified lines
1998 default: break;2056 default: break;
1999 }2057 }
2000 break;2058 break;
2001 2059
2002 case ae_op_shift_right:2060 case ae_op_shift_right:
2003 switch( left )2061 switch( left )
2004 {2062 {
@@ -2080,7 +2138,7 @@ t_CKBOOL emit_engine_emit_op( Chuck_Emitter * emit, ae_Operator op, a_Exp lhs, a · 75 unmodified lines
2080 default: break;2138 default: break;
2081 }2139 }
2082 break;2140 break;
2083 2141
2084 case ae_op_s_xor_chuck:2142 case ae_op_s_xor_chuck:
2085 switch( left )2143 switch( left )
2086 {2144 {
@@ -2101,11 +2159,11 @@ t_CKBOOL emit_engine_emit_op( Chuck_Emitter * emit, ae_Operator op, a_Exp lhs, a · 14 unmodified lines
2101 2159
2102 return TRUE;2160 return TRUE;
2103 }2161 }
2104 2162
2105 case ae_op_unchuck:2163 case ae_op_unchuck:
2106 {2164 {
2107 a_Exp cl = lhs, cr = rhs;2165 a_Exp cl = lhs, cr = rhs;
2108 2166
2109 // TODO: cross chuck2167 // TODO: cross chuck
2110 assert( cl->next == NULL && cr->next == NULL );2168 assert( cl->next == NULL && cr->next == NULL );
2111 while( cr )2169 while( cr )
@@ -2117,17 +2175,17 @@ t_CKBOOL emit_engine_emit_op( Chuck_Emitter * emit, ae_Operator op, a_Exp lhs, a · 5 unmodified lines
2117 return FALSE;2175 return FALSE;
2118 cl = cl->next;2176 cl = cl->next;
2119 }2177 }
2120 2178
2121 cr = cr->next;2179 cr = cr->next;
2122 }2180 }
2123 2181
2124 return TRUE;2182 return TRUE;
2125 }2183 }
2126 2184
2127 case ae_op_upchuck:2185 case ae_op_upchuck:
2128 {2186 {
2129 a_Exp cl = lhs, cr = rhs;2187 a_Exp cl = lhs, cr = rhs;
2130 2188
2131 // TODO: cross chuck2189 // TODO: cross chuck
2132 assert( cl->next == NULL && cr->next == NULL );2190 assert( cl->next == NULL && cr->next == NULL );
2133 while( cr )2191 while( cr )
@@ -2139,7 +2197,7 @@ t_CKBOOL emit_engine_emit_op( Chuck_Emitter * emit, ae_Operator op, a_Exp lhs, a · 5 unmodified lines
2139 return FALSE;2197 return FALSE;
2140 cl = cl->next;2198 cl = cl->next;
2141 }2199 }
2142 2200
2143 cr = cr->next;2201 cr = cr->next;
2144 }2202 }
2145 2203
@@ -2149,7 +2207,7 @@ t_CKBOOL emit_engine_emit_op( Chuck_Emitter * emit, ae_Operator op, a_Exp lhs, a · 3 unmodified lines
2149 case ae_op_at_chuck:2207 case ae_op_at_chuck:
2150 {2208 {
2151 a_Exp cl = lhs, cr = rhs;2209 a_Exp cl = lhs, cr = rhs;
2152 2210
2153 // TODO: cross chuck2211 // TODO: cross chuck
2154 assert( cl->next == NULL && cr->next == NULL );2212 assert( cl->next == NULL && cr->next == NULL );
2155 while( cr )2213 while( cr )
@@ -2161,17 +2219,17 @@ t_CKBOOL emit_engine_emit_op( Chuck_Emitter * emit, ae_Operator op, a_Exp lhs, a · 5 unmodified lines
2161 return FALSE;2219 return FALSE;
2162 cl = cl->next;2220 cl = cl->next;
2163 }2221 }
2164 2222
2165 cr = cr->next;2223 cr = cr->next;
2166 }2224 }
2167 2225
2168 return TRUE;2226 return TRUE;
2169 }2227 }
2170 2228
2171 case ae_op_s_chuck:2229 case ae_op_s_chuck:
2172 break;2230 break;
2173 2231
2174 // -------------------------------- bool ----------------------------------- 2232 // -------------------------------- bool -----------------------------------
2175 case ae_op_eq:2233 case ae_op_eq:
2176 if( isa( t_left, emit->env->t_string ) && isa( t_right, emit->env->t_string )2234 if( isa( t_left, emit->env->t_string ) && isa( t_right, emit->env->t_string )
2177 && !isa( t_left, emit->env->t_null ) && !isa( t_right, emit->env->t_null ) ) // !null2235 && !isa( t_left, emit->env->t_null ) && !isa( t_right, emit->env->t_null ) ) // !null
@@ -2208,7 +2266,7 @@ t_CKBOOL emit_engine_emit_op( Chuck_Emitter * emit, ae_Operator op, a_Exp lhs, a · 30 unmodified lines
2208 }2266 }
2209 }2267 }
2210 break;2268 break;
2211 2269
2212 case ae_op_neq:2270 case ae_op_neq:
2213 if( isa( t_left, emit->env->t_string ) && isa( t_right, emit->env->t_string )2271 if( isa( t_left, emit->env->t_string ) && isa( t_right, emit->env->t_string )
2214 && !isa( t_left, emit->env->t_null ) && !isa( t_right, emit->env->t_null ) ) // !null2272 && !isa( t_left, emit->env->t_null ) && !isa( t_right, emit->env->t_null ) ) // !null
@@ -2246,7 +2304,7 @@ t_CKBOOL emit_engine_emit_op( Chuck_Emitter * emit, ae_Operator op, a_Exp lhs, a · 31 unmodified lines
2246 }2304 }
2247 }2305 }
2248 break;2306 break;
2249 2307
2250 case ae_op_lt:2308 case ae_op_lt:
2251 switch( left )2309 switch( left )
2252 {2310 {
@@ -2268,7 +2326,7 @@ t_CKBOOL emit_engine_emit_op( Chuck_Emitter * emit, ae_Operator op, a_Exp lhs, a · 15 unmodified lines
2268 break;2326 break;
2269 }2327 }
2270 break;2328 break;
2271 2329
2272 case ae_op_le:2330 case ae_op_le:
2273 switch( left )2331 switch( left )
2274 {2332 {
@@ -2309,7 +2367,7 @@ t_CKBOOL emit_engine_emit_op( Chuck_Emitter * emit, ae_Operator op, a_Exp lhs, a · 34 unmodified lines
2309 break;2367 break;
2310 }2368 }
2311 break;2369 break;
2312 2370
2313 case ae_op_gt:2371 case ae_op_gt:
2314 switch( left )2372 switch( left )
2315 {2373 {
@@ -2331,7 +2389,7 @@ t_CKBOOL emit_engine_emit_op( Chuck_Emitter * emit, ae_Operator op, a_Exp lhs, a · 15 unmodified lines
2331 break;2389 break;
2332 }2390 }
2333 break;2391 break;
2334 2392
2335 case ae_op_ge:2393 case ae_op_ge:
2336 switch( left )2394 switch( left )
2337 {2395 {
@@ -2353,7 +2411,7 @@ t_CKBOOL emit_engine_emit_op( Chuck_Emitter * emit, ae_Operator op, a_Exp lhs, a · 15 unmodified lines
2353 break;2411 break;
2354 }2412 }
2355 break;2413 break;
2356 2414
2357 case ae_op_and:2415 case ae_op_and:
2358 switch( left )2416 switch( left )
2359 {2417 {
@@ -2364,7 +2422,7 @@ t_CKBOOL emit_engine_emit_op( Chuck_Emitter * emit, ae_Operator op, a_Exp lhs, a · 4 unmodified lines
2364 default: break;2422 default: break;
2365 }2423 }
2366 break;2424 break;
2367 2425
2368 case ae_op_or:2426 case ae_op_or:
2369 switch( left )2427 switch( left )
2370 {2428 {
@@ -2426,7 +2484,7 @@ t_CKBOOL emit_engine_emit_op( Chuck_Emitter * emit, ae_Operator op, a_Exp lhs, a · 55 unmodified lines
2426 t_left->c_name(), op2str( op ), t_right->c_name() );2484 t_left->c_name(), op2str( op ), t_right->c_name() );
2427 return FALSE;2485 return FALSE;
2428 }2486 }
2429 2487
2430 // make sure emit2488 // make sure emit
2431 if( !instr )2489 if( !instr )
2432 {2490 {
@@ -2435,7 +2493,7 @@ t_CKBOOL emit_engine_emit_op( Chuck_Emitter * emit, ae_Operator op, a_Exp lhs, a · 2 unmodified lines
2435 t_left->c_name(), op2str( op ), t_right->c_name() );2493 t_left->c_name(), op2str( op ), t_right->c_name() );
2436 return FALSE;2494 return FALSE;
2437 }2495 }
2438 2496
2439 return TRUE;2497 return TRUE;
2440}2498}
2441 2499
@@ -2451,10 +2509,10 @@ t_CKBOOL emit_engine_emit_op_chuck( Chuck_Emitter * emit, a_Exp lhs, a_Exp rhs, · 9 unmodified lines
2451 // any implicit cast happens before this2509 // any implicit cast happens before this
2452 Chuck_Type * left = lhs->cast_to ? lhs->cast_to : lhs->type;2510 Chuck_Type * left = lhs->cast_to ? lhs->cast_to : lhs->type;
2453 Chuck_Type * right = rhs->cast_to ? rhs->cast_to : rhs->type;2511 Chuck_Type * right = rhs->cast_to ? rhs->cast_to : rhs->type;
2454 2512
2455 // the pointer2513 // the pointer
2456 Chuck_Instr * instr = NULL;2514 Chuck_Instr * instr = NULL;
2457 2515
2458 // ugen => ugen2516 // ugen => ugen
2459 if( isa( left, emit->env->t_ugen ) && isa( right, emit->env->t_ugen ) )2517 if( isa( left, emit->env->t_ugen ) && isa( right, emit->env->t_ugen ) )
2460 {2518 {
@@ -2464,7 +2522,7 @@ t_CKBOOL emit_engine_emit_op_chuck( Chuck_Emitter * emit, a_Exp lhs, a_Exp rhs, · 3 unmodified lines
2464 // done2522 // done
2465 return TRUE;2523 return TRUE;
2466 }2524 }
2467 2525
2468 // ugen[] => ugen[] (or permutation)2526 // ugen[] => ugen[] (or permutation)
2469 if( ( isa( left, emit->env->t_ugen ) || ( isa( left, emit->env->t_array ) && isa( left->array_type, emit->env->t_ugen ) ) ) &&2527 if( ( isa( left, emit->env->t_ugen ) || ( isa( left, emit->env->t_array ) && isa( left->array_type, emit->env->t_ugen ) ) ) &&
2470 ( isa( right, emit->env->t_ugen ) || ( isa( right, emit->env->t_array ) && isa( right->array_type, emit->env->t_ugen ) ) ) )2528 ( isa( right, emit->env->t_ugen ) || ( isa( right, emit->env->t_array ) && isa( right->array_type, emit->env->t_ugen ) ) ) )
@@ -2475,7 +2533,7 @@ t_CKBOOL emit_engine_emit_op_chuck( Chuck_Emitter * emit, a_Exp lhs, a_Exp rhs, · 4 unmodified lines
2475 // done2533 // done
2476 return TRUE;2534 return TRUE;
2477 }2535 }
2478 2536
2479 // time advance2537 // time advance
2480 if( isa( left, emit->env->t_dur ) && isa( right, emit->env->t_time ) && rhs->s_meta == ae_meta_var )2538 if( isa( left, emit->env->t_dur ) && isa( right, emit->env->t_time ) && rhs->s_meta == ae_meta_var )
2481 {2539 {
@@ -2492,7 +2550,7 @@ t_CKBOOL emit_engine_emit_op_chuck( Chuck_Emitter * emit, a_Exp lhs, a_Exp rhs, · 10 unmodified lines
2492 2550
2493 return TRUE;2551 return TRUE;
2494 }2552 }
2495 2553
2496 // time advance2554 // time advance
2497 if( isa( left, emit->env->t_event ) && isa( right, emit->env->t_time ) && rhs->s_meta == ae_meta_var &&2555 if( isa( left, emit->env->t_event ) && isa( right, emit->env->t_time ) && rhs->s_meta == ae_meta_var &&
2498 rhs->s_type == ae_exp_primary && !strcmp( "now", S_name(rhs->primary.var) ) )2556 rhs->s_type == ae_exp_primary && !strcmp( "now", S_name(rhs->primary.var) ) )
@@ -2504,7 +2562,7 @@ t_CKBOOL emit_engine_emit_op_chuck( Chuck_Emitter * emit, a_Exp lhs, a_Exp rhs, · 5 unmodified lines
2504 2562
2505 return TRUE;2563 return TRUE;
2506 }2564 }
2507 2565
2508 // input2566 // input
2509 if( isa( left, emit->env->t_io ) )2567 if( isa( left, emit->env->t_io ) )
2510 {2568 {
@@ -2513,21 +2571,21 @@ t_CKBOOL emit_engine_emit_op_chuck( Chuck_Emitter * emit, a_Exp lhs, a_Exp rhs, · 2 unmodified lines
2513 assert( rhs->s_meta == ae_meta_var );2571 assert( rhs->s_meta == ae_meta_var );
2514 emit->append( instr = new Chuck_Instr_IO_in_int );2572 emit->append( instr = new Chuck_Instr_IO_in_int );
2515 instr->set_linepos( rhs->linepos );2573 instr->set_linepos( rhs->linepos );
2516 return TRUE;2574 return TRUE;
2517 }2575 }
2518 else if( isa( right, emit->env->t_float ) )2576 else if( isa( right, emit->env->t_float ) )
2519 {2577 {
2520 assert( rhs->s_meta == ae_meta_var );2578 assert( rhs->s_meta == ae_meta_var );
2521 emit->append( instr = new Chuck_Instr_IO_in_float );2579 emit->append( instr = new Chuck_Instr_IO_in_float );
2522 instr->set_linepos( rhs->linepos );2580 instr->set_linepos( rhs->linepos );
2523 return TRUE;2581 return TRUE;
2524 }2582 }
2525 else if( isa( right, emit->env->t_string ) )2583 else if( isa( right, emit->env->t_string ) )
2526 {2584 {
2527 assert( rhs->s_meta == ae_meta_var );2585 assert( rhs->s_meta == ae_meta_var );
2528 emit->append( instr = new Chuck_Instr_IO_in_string );2586 emit->append( instr = new Chuck_Instr_IO_in_string );
2529 instr->set_linepos( rhs->linepos );2587 instr->set_linepos( rhs->linepos );
2530 return TRUE;2588 return TRUE;
2531 }2589 }
2532 }2590 }
2533 2591
@@ -2535,7 +2593,7 @@ t_CKBOOL emit_engine_emit_op_chuck( Chuck_Emitter * emit, a_Exp lhs, a_Exp rhs, · 1 unmodified line
2535 if( isa( right, emit->env->t_function ) )2593 if( isa( right, emit->env->t_function ) )
2536 {2594 {
2537 assert( binary->ck_func != NULL );2595 assert( binary->ck_func != NULL );
2538 2596
2539 // emit2597 // emit
2540 return emit_engine_emit_exp_func_call( emit, binary->ck_func, binary->self->type, binary->linepos );2598 return emit_engine_emit_exp_func_call( emit, binary->ck_func, binary->self->type, binary->linepos );
2541 }2599 }
@@ -2574,7 +2632,7 @@ t_CKBOOL emit_engine_emit_op_unchuck( Chuck_Emitter * emit, a_Exp lhs, a_Exp rhs · 32 unmodified lines
2574 // any implicit cast happens before this2632 // any implicit cast happens before this
2575 Chuck_Type * left = lhs->cast_to ? lhs->cast_to : lhs->type;2633 Chuck_Type * left = lhs->cast_to ? lhs->cast_to : lhs->type;
2576 Chuck_Type * right = rhs->cast_to ? rhs->cast_to : rhs->type;2634 Chuck_Type * right = rhs->cast_to ? rhs->cast_to : rhs->type;
2577 2635
2578 // if ugen2636 // if ugen
2579 if( isa( left, emit->env->t_ugen ) && isa( right, emit->env->t_ugen ) )2637 if( isa( left, emit->env->t_ugen ) && isa( right, emit->env->t_ugen ) )
2580 {2638 {
@@ -2588,7 +2646,7 @@ t_CKBOOL emit_engine_emit_op_unchuck( Chuck_Emitter * emit, a_Exp lhs, a_Exp rhs · 7 unmodified lines
2588 left->c_name(), right->c_name() );2646 left->c_name(), right->c_name() );
2589 return FALSE;2647 return FALSE;
2590 }2648 }
2591 2649
2592 return TRUE;2650 return TRUE;
2593}2651}
2594 2652
@@ -2636,7 +2694,7 @@ t_CKBOOL emit_engine_emit_op_at_chuck( Chuck_Emitter * emit, a_Exp lhs, a_Exp rh · 41 unmodified lines
2636 // any implicit cast happens before this2694 // any implicit cast happens before this
2637 Chuck_Type * left = lhs->cast_to ? lhs->cast_to : lhs->type;2695 Chuck_Type * left = lhs->cast_to ? lhs->cast_to : lhs->type;
2638 Chuck_Type * right = rhs->cast_to ? rhs->cast_to : rhs->type;2696 Chuck_Type * right = rhs->cast_to ? rhs->cast_to : rhs->type;
2639 2697
2640 // assignment or something else2698 // assignment or something else
2641 if( isa( left, right ) )2699 if( isa( left, right ) )
2642 {2700 {
@@ -2743,7 +2801,7 @@ t_CKBOOL emit_engine_emit_exp_unary( Chuck_Emitter * emit, a_Exp_Unary unary ) · 100 unmodified lines
2743 emit->append( new Chuck_Instr_PreInc_int );2801 emit->append( new Chuck_Instr_PreInc_int );
2744 else2802 else
2745 {2803 {
2746 EM_error2( unary->linepos, 2804 EM_error2( unary->linepos,
2747 "(emit): internal error: unhandled type '%s' for pre '++'' operator",2805 "(emit): internal error: unhandled type '%s' for pre '++'' operator",
2748 unary->exp->type->c_name() );2806 unary->exp->type->c_name() );
2749 return FALSE;2807 return FALSE;
@@ -2764,7 +2822,7 @@ t_CKBOOL emit_engine_emit_exp_unary( Chuck_Emitter * emit, a_Exp_Unary unary ) · 14 unmodified lines
2764 emit->append( new Chuck_Instr_PreDec_int );2822 emit->append( new Chuck_Instr_PreDec_int );
2765 else2823 else
2766 {2824 {
2767 EM_error2( unary->linepos, 2825 EM_error2( unary->linepos,
2768 "(emit): internal error: unhandled type '%s' for pre '--' operator",2826 "(emit): internal error: unhandled type '%s' for pre '--' operator",
2769 unary->exp->type->c_name() );2827 unary->exp->type->c_name() );
2770 return FALSE;2828 return FALSE;
@@ -2777,7 +2835,7 @@ t_CKBOOL emit_engine_emit_exp_unary( Chuck_Emitter * emit, a_Exp_Unary unary ) · 6 unmodified lines
2777 emit->append( new Chuck_Instr_Complement_int );2835 emit->append( new Chuck_Instr_Complement_int );
2778 else2836 else
2779 {2837 {
2780 EM_error2( unary->linepos, 2838 EM_error2( unary->linepos,
2781 "(emit): internal error: unhandled type '%s' for '~' operator",2839 "(emit): internal error: unhandled type '%s' for '~' operator",
2782 unary->exp->type->c_name() );2840 unary->exp->type->c_name() );
2783 return FALSE;2841 return FALSE;
@@ -2790,13 +2848,13 @@ t_CKBOOL emit_engine_emit_exp_unary( Chuck_Emitter * emit, a_Exp_Unary unary ) · 6 unmodified lines
2790 emit->append( new Chuck_Instr_Not_int );2848 emit->append( new Chuck_Instr_Not_int );
2791 else2849 else
2792 {2850 {
2793 EM_error2( unary->linepos, 2851 EM_error2( unary->linepos,
2794 "(emit): internal error: unhandled type '%s' for '!' operator",2852 "(emit): internal error: unhandled type '%s' for '!' operator",
2795 unary->exp->type->c_name() );2853 unary->exp->type->c_name() );
2796 return FALSE;2854 return FALSE;
2797 }2855 }
2798 break;2856 break;
2799 2857
2800 case ae_op_minus:2858 case ae_op_minus:
2801 // negate2859 // negate
2802 if( equals( unary->exp->type, emit->env->t_int ) )2860 if( equals( unary->exp->type, emit->env->t_int ) )
@@ -2805,7 +2863,7 @@ t_CKBOOL emit_engine_emit_exp_unary( Chuck_Emitter * emit, a_Exp_Unary unary ) · 2 unmodified lines
2805 emit->append( new Chuck_Instr_Negate_double );2863 emit->append( new Chuck_Instr_Negate_double );
2806 else2864 else
2807 {2865 {
2808 EM_error2( unary->linepos, 2866 EM_error2( unary->linepos,
2809 "(emit): internal error: unhandled type '%s' for unary '-' operator",2867 "(emit): internal error: unhandled type '%s' for unary '-' operator",
2810 unary->exp->type->c_name() );2868 unary->exp->type->c_name() );
2811 return FALSE;2869 return FALSE;
@@ -2845,12 +2903,12 @@ t_CKBOOL emit_engine_emit_exp_unary( Chuck_Emitter * emit, a_Exp_Unary unary ) · 33 unmodified lines
2845 break;2903 break;
2846 2904
2847 default:2905 default:
2848 EM_error2( unary->linepos, 2906 EM_error2( unary->linepos,
2849 "(emit): internal error: unhandled unary op '%s",2907 "(emit): internal error: unhandled unary op '%s",
2850 op2str( unary->op ) );2908 op2str( unary->op ) );
2851 return FALSE;2909 return FALSE;
2852 }2910 }
2853 2911
2854 return TRUE;2912 return TRUE;
2855}2913}
2856 2914
@@ -2953,20 +3011,20 @@ t_CKBOOL emit_engine_emit_exp_primary( Chuck_Emitter * emit, a_Exp_Primary exp ) · 96 unmodified lines
2953 else3011 else
2954 {3012 {
2955 // emit the symbol3013 // emit the symbol
2956 return emit_engine_emit_symbol( 3014 return emit_engine_emit_symbol(
2957 emit, exp->var, exp->value, exp->self->emit_var, exp->linepos );3015 emit, exp->var, exp->value, exp->self->emit_var, exp->linepos );
2958 }3016 }
2959 break;3017 break;
2960 3018
2961 case ae_primary_num:3019 case ae_primary_num:
2962 memcpy( &temp, &exp->num, sizeof(temp) );3020 memcpy( &temp, &exp->num, sizeof(temp) );
2963 emit->append( new Chuck_Instr_Reg_Push_Imm( temp ) );3021 emit->append( new Chuck_Instr_Reg_Push_Imm( temp ) );
2964 break;3022 break;
2965 3023
2966 case ae_primary_float:3024 case ae_primary_float:
2967 emit->append( new Chuck_Instr_Reg_Push_Imm2( exp->fnum ) );3025 emit->append( new Chuck_Instr_Reg_Push_Imm2( exp->fnum ) );
2968 break;3026 break;
2969 3027
2970 case ae_primary_str:3028 case ae_primary_str:
2971 // TODO: fix this3029 // TODO: fix this
2972 str = new Chuck_String();3030 str = new Chuck_String();
@@ -2975,7 +3033,7 @@ t_CKBOOL emit_engine_emit_exp_primary( Chuck_Emitter * emit, a_Exp_Primary exp ) · 2 unmodified lines
2975 // error (TODO: why is this a SAFE_RELEASE and not SAFE_DELETE?)3033 // error (TODO: why is this a SAFE_RELEASE and not SAFE_DELETE?)
2976 SAFE_RELEASE( str );3034 SAFE_RELEASE( str );
2977 // error out3035 // error out
2978 CK_FPRINTF_STDERR( 3036 CK_FPRINTF_STDERR(
2979 "[chuck](emitter): OutOfMemory: while allocating string literal '%s'\n", exp->str );3037 "[chuck](emitter): OutOfMemory: while allocating string literal '%s'\n", exp->str );
2980 return FALSE;3038 return FALSE;
2981 }3039 }
@@ -2985,7 +3043,7 @@ t_CKBOOL emit_engine_emit_exp_primary( Chuck_Emitter * emit, a_Exp_Primary exp ) · 3 unmodified lines
2985 // add reference for string literal (added 1.3.0.2)3043 // add reference for string literal (added 1.3.0.2)
2986 str->add_ref();3044 str->add_ref();
2987 break;3045 break;
2988 3046
2989 case ae_primary_char:3047 case ae_primary_char:
2990 emit->append( new Chuck_Instr_Reg_Push_Imm( str2char(exp->chr, exp->linepos ) ) );3048 emit->append( new Chuck_Instr_Reg_Push_Imm( str2char(exp->chr, exp->linepos ) ) );
2991 break;3049 break;
@@ -2999,17 +3057,17 @@ t_CKBOOL emit_engine_emit_exp_primary( Chuck_Emitter * emit, a_Exp_Primary exp ) · 7 unmodified lines
2999 if( !emit_engine_emit_complex_lit( emit, exp->complex ) )3057 if( !emit_engine_emit_complex_lit( emit, exp->complex ) )
3000 return FALSE;3058 return FALSE;
3001 break;3059 break;
3002 3060
3003 case ae_primary_polar:3061 case ae_primary_polar:
3004 if( !emit_engine_emit_polar_lit( emit, exp->polar ) )3062 if( !emit_engine_emit_polar_lit( emit, exp->polar ) )
3005 return FALSE;3063 return FALSE;
3006 break;3064 break;
3007 3065
3008 case ae_primary_vec:3066 case ae_primary_vec:
3009 if( !emit_engine_emit_vec_lit( emit, exp->vec ) )3067 if( !emit_engine_emit_vec_lit( emit, exp->vec ) )
3010 return FALSE;3068 return FALSE;
3011 break;3069 break;
3012 3070
3013 case ae_primary_exp:3071 case ae_primary_exp:
3014 if( !emit_engine_emit_exp( emit, exp->exp ) )3072 if( !emit_engine_emit_exp( emit, exp->exp ) )
3015 return FALSE;3073 return FALSE;
@@ -3028,18 +3086,18 @@ t_CKBOOL emit_engine_emit_exp_primary( Chuck_Emitter * emit, a_Exp_Primary exp ) · 12 unmodified lines
3028 types.push_back( e->type );3086 types.push_back( e->type );
3029 e = e->next;3087 e = e->next;
3030 }3088 }
3031 3089
3032 // emit hack3090 // emit hack
3033 emit->append( new Chuck_Instr_Gack( types ) );3091 emit->append( new Chuck_Instr_Gack( types ) );
3034 3092
3035 break;3093 break;
3036 }3094 }
3037 3095
3038 // ge (april 2012): nil is void, so nothing to emit; TODO: check it (added 1.3.0.0)3096 // ge (april 2012): nil is void, so nothing to emit; TODO: check it (added 1.3.0.0)
3039 case ae_primary_nil:3097 case ae_primary_nil:
3040 break;3098 break;
3041 }3099 }
3042 3100
3043 return TRUE;3101 return TRUE;
3044}3102}
3045 3103
@@ -3086,7 +3144,7 @@ t_CKBOOL emit_engine_emit_complex_lit( Chuck_Emitter * emit, a_Complex val ) · 40 unmodified lines
3086 // go through and emit the real and imaginary3144 // go through and emit the real and imaginary
3087 if( !emit_engine_emit_exp( emit, val->re ) )3145 if( !emit_engine_emit_exp( emit, val->re ) )
3088 return FALSE;3146 return FALSE;
3089 3147
3090 // imaginary (not needed since linked after real3148 // imaginary (not needed since linked after real
3091 // if( !emit_engine_emit_exp( emit, val->im ) )3149 // if( !emit_engine_emit_exp( emit, val->im ) )
3092 // return FALSE;3150 // return FALSE;
@@ -3106,7 +3164,7 @@ t_CKBOOL emit_engine_emit_polar_lit( Chuck_Emitter * emit, a_Polar val ) · 13 unmodified lines
3106 // go through and emit the mod and phase3164 // go through and emit the mod and phase
3107 if( !emit_engine_emit_exp( emit, val->mod ) )3165 if( !emit_engine_emit_exp( emit, val->mod ) )
3108 return FALSE;3166 return FALSE;
3109 3167
3110 // phase (not needed since linked after mod)3168 // phase (not needed since linked after mod)
3111 // if( !emit_engine_emit_exp( emit, val->phase ) )3169 // if( !emit_engine_emit_exp( emit, val->phase ) )
3112 // return FALSE;3170 // return FALSE;
@@ -3137,7 +3195,7 @@ t_CKBOOL emit_engine_emit_vec_lit( Chuck_Emitter * emit, a_Vec val ) · 24 unmodified lines
3137 // decrement3195 // decrement
3138 n--;3196 n--;
3139 }3197 }
3140 3198
3141 return TRUE;3199 return TRUE;
3142}3200}
3143 3201
@@ -3168,7 +3226,7 @@ t_CKBOOL emit_engine_emit_exp_cast( Chuck_Emitter * emit, a_Exp_Cast cast ) · 24 unmodified lines
3168// name: emit_engine_emit_cast()3226// name: emit_engine_emit_cast()
3169// desc: ...3227// desc: ...
3170//-----------------------------------------------------------------------------3228//-----------------------------------------------------------------------------
3171t_CKBOOL emit_engine_emit_cast( Chuck_Emitter * emit, 3229t_CKBOOL emit_engine_emit_cast( Chuck_Emitter * emit,
3172 Chuck_Type * to, Chuck_Type * from )3230 Chuck_Type * to, Chuck_Type * from )
3173{3231{
3174 // if type is already the same3232 // if type is already the same
@@ -3255,8 +3313,8 @@ t_CKBOOL emit_engine_emit_exp_postfix( Chuck_Emitter * emit, a_Exp_Postfix postf · 80 unmodified lines
3255 "(emit): internal error: unhandled postfix operator '%s'",3313 "(emit): internal error: unhandled postfix operator '%s'",
3256 op2str( postfix->op ) );3314 op2str( postfix->op ) );
3257 return FALSE;3315 return FALSE;
3258 } 3316 }
3259 3317
3260 return TRUE;3318 return TRUE;
3261}3319}
3262 3320
@@ -3280,10 +3338,10 @@ t_CKBOOL emit_engine_emit_exp_dur( Chuck_Emitter * emit, a_Exp_Dur dur ) · 17 unmodified lines
3280 // emit unit3338 // emit unit
3281 if( !emit_engine_emit_exp( emit, dur->unit ) )3339 if( !emit_engine_emit_exp( emit, dur->unit ) )
3282 return FALSE;3340 return FALSE;
3283 3341
3284 // multiply3342 // multiply
3285 emit->append( new Chuck_Instr_Times_double );3343 emit->append( new Chuck_Instr_Times_double );
3286 3344
3287 return TRUE;3345 return TRUE;
3288}3346}
3289 3347
@@ -3408,13 +3466,6 @@ t_CKBOOL emit_engine_emit_exp_func_call( Chuck_Emitter * emit, · 118 unmodified lines
3408 // is a member?3466 // is a member?
3409 t_CKBOOL is_member = func->is_member;3467 t_CKBOOL is_member = func->is_member;
3410 3468
3411 // if member
3412 //if( is_member )
3413 //{
3414 // // this
3415 // emit->append( new Chuck_Instr_Reg_Push_This );
3416 //}
3417
3418 // translate to code3469 // translate to code
3419 emit->append( new Chuck_Instr_Func_To_Code );3470 emit->append( new Chuck_Instr_Func_To_Code );
3420 // emit->append( new Chuck_Instr_Reg_Push_Imm( (t_CKUINT)func->code ) );3471 // emit->append( new Chuck_Instr_Reg_Push_Imm( (t_CKUINT)func->code ) );
@@ -3425,7 +3476,7 @@ t_CKBOOL emit_engine_emit_exp_func_call( Chuck_Emitter * emit, · 4 unmodified lines
3425 // call the function3476 // call the function
3426 t_CKUINT size = type->size;3477 t_CKUINT size = type->size;
3427 t_CKUINT kind = getkindof( emit->env, type ); // added 1.3.1.03478 t_CKUINT kind = getkindof( emit->env, type ); // added 1.3.1.0
3428 3479
3429 // the pointer3480 // the pointer
3430 Chuck_Instr * instr = NULL;3481 Chuck_Instr * instr = NULL;
3431 if( func->def->s_type == ae_func_builtin )3482 if( func->def->s_type == ae_func_builtin )
@@ -3436,9 +3487,9 @@ t_CKBOOL emit_engine_emit_exp_func_call( Chuck_Emitter * emit, · 4 unmodified lines
3436 {3487 {
3437 // is member (1.3.1.0: changed to use kind instead of size)3488 // is member (1.3.1.0: changed to use kind instead of size)
3438 if( is_member )3489 if( is_member )
3439 emit->append( instr = new Chuck_Instr_Func_Call_Member( kind ) );3490 emit->append( instr = new Chuck_Instr_Func_Call_Member( kind, func ) );
3440 else3491 else
3441 emit->append( instr = new Chuck_Instr_Func_Call_Static( kind ) );3492 emit->append( instr = new Chuck_Instr_Func_Call_Static( kind, func ) );
3442 }3493 }
3443 else3494 else
3444 {3495 {
@@ -3507,10 +3558,10 @@ t_CKBOOL emit_engine_emit_exp_func_call( Chuck_Emitter * emit, · 62 unmodified lines
3507 "(emit): internal error in evaluating function call..." );3558 "(emit): internal error in evaluating function call..." );
3508 return FALSE;3559 return FALSE;
3509 }3560 }
3510 3561
3511 // the rest3562 // the rest
3512 return emit_engine_emit_exp_func_call( emit, func_call->ck_func, func_call->ret_type,3563 return emit_engine_emit_exp_func_call( emit, func_call->ck_func,
3513 func_call->linepos, spork );3564 func_call->ret_type, func_call->linepos, spork );
3514}3565}
3515 3566
3516 3567
@@ -3525,7 +3576,7 @@ t_CKBOOL emit_engine_emit_exp_dot_member_special( Chuck_Emitter * emit, · 8 unmodified lines
3525{3576{
3526 // whether to emit addr or value3577 // whether to emit addr or value
3527 t_CKBOOL emit_addr = member->self->emit_var;3578 t_CKBOOL emit_addr = member->self->emit_var;
3528 3579
3529 // special case: complex and polar3580 // special case: complex and polar
3530 if( member->t_base->xid == te_complex )3581 if( member->t_base->xid == te_complex )
3531 {3582 {
@@ -3538,11 +3589,11 @@ t_CKBOOL emit_engine_emit_exp_dot_member_special( Chuck_Emitter * emit, · 6 unmodified lines
3538 "(emit): cannot assign value to literal 'complex' value..." );3589 "(emit): cannot assign value to literal 'complex' value..." );
3539 return FALSE;3590 return FALSE;
3540 }3591 }
3541 3592
3542 // emit the base3593 // emit the base
3543 if( !emit_engine_emit_exp( emit, member->base ) )3594 if( !emit_engine_emit_exp( emit, member->base ) )
3544 return FALSE;3595 return FALSE;
3545 3596
3546 string str = S_name(member->xid);3597 string str = S_name(member->xid);
3547 // check3598 // check
3548 if( str == "re" )3599 if( str == "re" )
@@ -3551,7 +3602,7 @@ t_CKBOOL emit_engine_emit_exp_dot_member_special( Chuck_Emitter * emit, · 2 unmodified lines
3551 emit->append( new Chuck_Instr_Dot_Cmp_Second( member->base->s_meta == ae_meta_var, emit_addr ) );3602 emit->append( new Chuck_Instr_Dot_Cmp_Second( member->base->s_meta == ae_meta_var, emit_addr ) );
3552 else3603 else
3553 goto check_func;3604 goto check_func;
3554 3605
3555 // done3606 // done
3556 return TRUE;3607 return TRUE;
3557 }3608 }
@@ -3566,11 +3617,11 @@ t_CKBOOL emit_engine_emit_exp_dot_member_special( Chuck_Emitter * emit, · 8 unmodified lines
3566 "(emit): cannot assign value to literal 'polar' value..." );3617 "(emit): cannot assign value to literal 'polar' value..." );
3567 return FALSE;3618 return FALSE;
3568 }3619 }
3569 3620
3570 // emit the base3621 // emit the base
3571 if( !emit_engine_emit_exp( emit, member->base ) )3622 if( !emit_engine_emit_exp( emit, member->base ) )
3572 return FALSE;3623 return FALSE;
3573 3624
3574 string str = S_name(member->xid);3625 string str = S_name(member->xid);
3575 // check3626 // check
3576 if( str == "mag" )3627 if( str == "mag" )
@@ -3579,7 +3630,7 @@ t_CKBOOL emit_engine_emit_exp_dot_member_special( Chuck_Emitter * emit, · 2 unmodified lines
3579 emit->append( new Chuck_Instr_Dot_Cmp_Second( member->base->s_meta == ae_meta_var, emit_addr ) );3630 emit->append( new Chuck_Instr_Dot_Cmp_Second( member->base->s_meta == ae_meta_var, emit_addr ) );
3580 else3631 else
3581 goto check_func;3632 goto check_func;
3582 3633
3583 // done3634 // done
3584 return TRUE;3635 return TRUE;
3585 }3636 }
@@ -3595,11 +3646,11 @@ t_CKBOOL emit_engine_emit_exp_dot_member_special( Chuck_Emitter * emit, · 9 unmodified lines
3595 member->t_base->c_name() );3646 member->t_base->c_name() );
3596 return FALSE;3647 return FALSE;
3597 }3648 }
3598 3649
3599 // emit the base3650 // emit the base
3600 if( !emit_engine_emit_exp( emit, member->base ) )3651 if( !emit_engine_emit_exp( emit, member->base ) )
3601 return FALSE;3652 return FALSE;
3602 3653
3603 string str = S_name(member->xid);3654 string str = S_name(member->xid);
3604 // check for .xyz[w] .rgb[a] .value/goal/slew3655 // check for .xyz[w] .rgb[a] .value/goal/slew
3605 if( str == "x" || str == "r" || str == "value" )3656 if( str == "x" || str == "r" || str == "value" )
@@ -3612,7 +3663,7 @@ t_CKBOOL emit_engine_emit_exp_dot_member_special( Chuck_Emitter * emit, · 6 unmodified lines
3612 emit->append( new Chuck_Instr_Dot_Cmp_Fourth( member->base->s_meta == ae_meta_var, emit_addr ) );3663 emit->append( new Chuck_Instr_Dot_Cmp_Fourth( member->base->s_meta == ae_meta_var, emit_addr ) );
3613 else3664 else
3614 goto check_func;3665 goto check_func;
3615 3666
3616 // done3667 // done
3617 return TRUE;3668 return TRUE;
3618 }3669 }
@@ -3622,23 +3673,24 @@ t_CKBOOL emit_engine_emit_exp_dot_member_special( Chuck_Emitter * emit, · 3 unmodified lines
3622 "(emit): internal error in lit_special()..." );3673 "(emit): internal error in lit_special()..." );
3623 3674
3624 return FALSE;3675 return FALSE;
3625 3676
3626//-----------------------------------------------------------------------------3677//-----------------------------------------------------------------------------
3627// goto: check for special member functions, 1.3.5.33678// goto: check for special member functions, 1.3.5.3
3628//-----------------------------------------------------------------------------3679//-----------------------------------------------------------------------------
3629check_func:3680check_func:
3630 3681
3631 // the type of the base3682 // the type of the base
3632 Chuck_Type * t_base = member->t_base;3683 Chuck_Type * t_base = member->t_base;
3633 // is the base a class/namespace or a variable3684 // is the base a class/namespace or a variable
3634 t_CKBOOL base_static = isa( member->t_base, emit->env->t_class );3685 t_CKBOOL base_static = type_engine_is_base_static( emit->env, member->t_base );
3686 // t_CKBOOL base_static = isa( member->t_base, emit->env->t_class );
3635 // a function3687 // a function
3636 Chuck_Func * func = NULL;3688 Chuck_Func * func = NULL;
3637 // a non-function value3689 // a non-function value
3638 Chuck_Value * value = NULL;3690 Chuck_Value * value = NULL;
3639 // the offset3691 // the offset
3640 t_CKUINT offset = 0;3692 t_CKUINT offset = 0;
3641 3693
3642 // check error3694 // check error
3643 if( base_static )3695 if( base_static )
3644 {3696 {
@@ -3648,7 +3700,7 @@ check_func: · 3 unmodified lines
3648 // done3700 // done
3649 return FALSE;3701 return FALSE;
3650 }3702 }
3651 3703
3652 if( !isfunc( emit->env, member->self->type ) )3704 if( !isfunc( emit->env, member->self->type ) )
3653 {3705 {
3654 // should not get here3706 // should not get here
@@ -3657,13 +3709,13 @@ check_func: · 2 unmodified lines
3657 // done3709 // done
3658 return FALSE;3710 return FALSE;
3659 }3711 }
3660 3712
3661 // get the func3713 // get the func
3662 value = type_engine_find_value( t_base, member->xid );3714 value = type_engine_find_value( t_base, member->xid );
3663 func = value->func_ref;3715 func = value->func_ref;
3664 // make sure it's there3716 // make sure it's there
3665 assert( func != NULL );3717 assert( func != NULL );
3666 3718
3667 // NOTE: base already emitted earier in this function (and as var)3719 // NOTE: base already emitted earier in this function (and as var)
3668 3720
3669 // check base; 1.3.5.33721 // check base; 1.3.5.3
@@ -3677,12 +3729,12 @@ check_func: · 7 unmodified lines
3677 // dup the base pointer (as 'this' argument -- special case primitive)3729 // dup the base pointer (as 'this' argument -- special case primitive)
3678 emit->append( new Chuck_Instr_Reg_Dup_Last );3730 emit->append( new Chuck_Instr_Reg_Dup_Last );
3679 }3731 }
3680 3732
3681 // find the offset for virtual table3733 // find the offset for virtual table
3682 offset = func->vt_index;3734 offset = func->vt_index;
3683 // emit the function3735 // emit the function
3684 emit->append( new Chuck_Instr_Dot_Primitive_Func( (t_CKUINT)func ) );3736 emit->append( new Chuck_Instr_Dot_Primitive_Func( (t_CKUINT)func ) );
3685 3737
3686 return TRUE;3738 return TRUE;
3687}3739}
3688 3740
@@ -3700,15 +3752,16 @@ t_CKBOOL emit_engine_emit_exp_dot_member( Chuck_Emitter * emit, · 11 unmodified lines
3700 Chuck_Type * t_base = NULL;3752 Chuck_Type * t_base = NULL;
3701 // whether to emit addr or value3753 // whether to emit addr or value
3702 t_CKBOOL emit_addr = member->self->emit_var;3754 t_CKBOOL emit_addr = member->self->emit_var;
3703 // is the base a class/namespace or a variable3755 // is the base a class/namespace or a variable | 1.4.2.1 (ge) modified to func call
3704 t_CKBOOL base_static = isa( member->t_base, emit->env->t_class );3756 t_CKBOOL base_static = type_engine_is_base_static( emit->env, member->t_base );
3757 // t_CKBOOL base_static = isa( member->t_base, emit->env->t_class );
3705 // a function3758 // a function
3706 Chuck_Func * func = NULL;3759 Chuck_Func * func = NULL;
3707 // a non-function value3760 // a non-function value
3708 Chuck_Value * value = NULL;3761 Chuck_Value * value = NULL;
3709 // the offset3762 // the offset
3710 t_CKUINT offset = 0;3763 t_CKUINT offset = 0;
3711 3764
3712 // the pointer3765 // the pointer
3713 Chuck_Instr * instr = NULL;3766 Chuck_Instr * instr = NULL;
3714 3767
@@ -3726,7 +3779,7 @@ t_CKBOOL emit_engine_emit_exp_dot_member( Chuck_Emitter * emit, · 11 unmodified lines
3726 // done3779 // done
3727 break;3780 break;
3728 }3781 }
3729 3782
3730 // actual type - if base is class name its type is actually 'class'3783 // actual type - if base is class name its type is actually 'class'
3731 // to get the actual type use actual_type3784 // to get the actual type use actual_type
3732 t_base = base_static ? member->t_base->actual_type : member->t_base;3785 t_base = base_static ? member->t_base->actual_type : member->t_base;
@@ -3811,7 +3864,7 @@ t_CKBOOL emit_engine_emit_exp_dot_member( Chuck_Emitter * emit, · 78 unmodified lines
3811 else // static3864 else // static
3812 {3865 {
3813 // emit the type3866 // emit the type
3814 // commented out so built-in static member variables don't have an 3867 // commented out so built-in static member variables don't have an
3815 // extra thing on the stack - spencer3868 // extra thing on the stack - spencer
3816 // emit->append( new Chuck_Instr_Reg_Push_Imm( (t_CKUINT)t_base ) );3869 // emit->append( new Chuck_Instr_Reg_Push_Imm( (t_CKUINT)t_base ) );
3817 3870
@@ -3855,7 +3908,7 @@ t_CKBOOL emit_engine_emit_exp_dot_member( Chuck_Emitter * emit, · 37 unmodified lines
3855 }3908 }
3856 }3909 }
3857 }3910 }
3858 3911
3859 return TRUE;3912 return TRUE;
3860}3913}
3861 3914
@@ -3893,8 +3946,8 @@ t_CKBOOL emit_engine_emit_exp_if( Chuck_Emitter * emit, a_Exp_If exp_if ) · 31 unmodified lines
3893 // push 03946 // push 0
3894 emit->append( new Chuck_Instr_Reg_Push_Imm2( 0.0 ) );3947 emit->append( new Chuck_Instr_Reg_Push_Imm2( 0.0 ) );
3895 op = new Chuck_Instr_Branch_Eq_double( 0 );3948 op = new Chuck_Instr_Branch_Eq_double( 0 );
3896 break; 3949 break;
3897 3950
3898 default:3951 default:
3899 EM_error2( exp_if->cond->linepos,3952 EM_error2( exp_if->cond->linepos,
3900 "(emit): internal error: unhandled type '%s' in if condition",3953 "(emit): internal error: unhandled type '%s' in if condition",
@@ -3914,7 +3967,7 @@ t_CKBOOL emit_engine_emit_exp_if( Chuck_Emitter * emit, a_Exp_If exp_if ) · 13 unmodified lines
3914 3967
3915 // emit the skip to the end3968 // emit the skip to the end
3916 emit->append( op2 = new Chuck_Instr_Goto(0) );3969 emit->append( op2 = new Chuck_Instr_Goto(0) );
3917 3970
3918 // set the op's target3971 // set the op's target
3919 op->set( emit->next_index() );3972 op->set( emit->next_index() );
3920 3973
@@ -4006,7 +4059,7 @@ t_CKBOOL emit_engine_instantiate_object( Chuck_Emitter * emit, Chuck_Type * type · 85 unmodified lines
4006 Chuck_Instr * instr = NULL;4059 Chuck_Instr * instr = NULL;
4007 emit->append( instr = new Chuck_Instr_Array_Alloc( emit->env,4060 emit->append( instr = new Chuck_Instr_Array_Alloc( emit->env,
4008 type->array_depth, type->array_type, emit->code->frame->curr_offset,4061 type->array_depth, type->array_type, emit->code->frame->curr_offset,
4009 is_ref ) );4062 is_ref, type ) );
4010 instr->set_linepos( array->linepos );4063 instr->set_linepos( array->linepos );
4011 4064
4012 // handle constructor4065 // handle constructor
@@ -4020,7 +4073,7 @@ t_CKBOOL emit_engine_instantiate_object( Chuck_Emitter * emit, Chuck_Type * type · 7 unmodified lines
4020 {4073 {
4021 // emit object instantiation code, include pre constructor4074 // emit object instantiation code, include pre constructor
4022 emit->append( new Chuck_Instr_Instantiate_Object( type ) );4075 emit->append( new Chuck_Instr_Instantiate_Object( type ) );
4023 4076
4024 // call pre constructor4077 // call pre constructor
4025 emit_engine_pre_constructor( emit, type );4078 emit_engine_pre_constructor( emit, type );
4026 }4079 }
@@ -4048,10 +4101,10 @@ t_CKBOOL emit_engine_emit_exp_decl( Chuck_Emitter * emit, a_Exp_Decl decl, · 21 unmodified lines
4048 t_CKBOOL is_init = FALSE;4101 t_CKBOOL is_init = FALSE;
4049 t_CKBOOL is_array = FALSE;4102 t_CKBOOL is_array = FALSE;
4050 t_CKBOOL needs_global_ctor = FALSE;4103 t_CKBOOL needs_global_ctor = FALSE;
4051 4104
4052 t_CKTYPE t = type_engine_find_type( emit->env, decl->type->xid );4105 t_CKTYPE t = type_engine_find_type( emit->env, decl->type->xid );
4053 te_GlobalType globalType; // added 1.4.0.1 (jack)4106 te_GlobalType globalType; // added 1.4.0.1 (jack)
4054 4107
4055 if( decl->is_global )4108 if( decl->is_global )
4056 {4109 {
4057 if( isa( t, emit->env->t_int ) )4110 if( isa( t, emit->env->t_int ) )
@@ -4118,20 +4171,21 @@ t_CKBOOL emit_engine_emit_exp_decl( Chuck_Emitter * emit, a_Exp_Decl decl, · 60 unmodified lines
4118 if( is_obj )4171 if( is_obj )
4119 {4172 {
4120 // if this is an array, ...4173 // if this is an array, ...
4121 if( list->var_decl->array )4174 if( var_decl->array )
4122 {4175 {
4176 // mark as true
4123 is_array = TRUE;4177 is_array = TRUE;
4124
4125 // ... then check to see if empty []4178 // ... then check to see if empty []
4126 // and only instantiate if NOT empty4179 is_ref = ( var_decl->array->exp_list == NULL );
4180 // ...and only instantiate if NOT empty
4127 // REFACTOR-2017 TODO: do we want to4181 // REFACTOR-2017 TODO: do we want to
4128 // avoid doing this if the array is global?4182 // avoid doing this if the array is global?
4129 if( list->var_decl->array->exp_list )4183 if( !is_ref )
4130 {4184 {
4131 // set4185 // set
4132 is_init = TRUE;4186 is_init = TRUE;
4133 // instantiate object, including array4187 // instantiate object, including array
4134 if( !emit_engine_instantiate_object( emit, type, list->var_decl->array, is_ref ) )4188 if( !emit_engine_instantiate_object( emit, type, var_decl->array, is_ref ) )
4135 return FALSE;4189 return FALSE;
4136 }4190 }
4137 }4191 }
@@ -4145,7 +4199,7 @@ t_CKBOOL emit_engine_emit_exp_decl( Chuck_Emitter * emit, a_Exp_Decl decl, · 7 unmodified lines
4145 // set4199 // set
4146 is_init = TRUE;4200 is_init = TRUE;
4147 // instantiate object (not array)4201 // instantiate object (not array)
4148 if( !emit_engine_instantiate_object( emit, type, list->var_decl->array, is_ref ) )4202 if( !emit_engine_instantiate_object( emit, type, var_decl->array, is_ref ) )
4149 return FALSE;4203 return FALSE;
4150 }4204 }
4151 }4205 }
@@ -4225,7 +4279,7 @@ t_CKBOOL emit_engine_emit_exp_decl( Chuck_Emitter * emit, a_Exp_Decl decl, · 73 unmodified lines
4225 instr->m_type = globalType;4279 instr->m_type = globalType;
4226 instr->set_linepos( decl->linepos );4280 instr->set_linepos( decl->linepos );
4227 instr->m_is_array = is_array;4281 instr->m_is_array = is_array;
4228 4282
4229 // extra fields for objects that need their ctors called4283 // extra fields for objects that need their ctors called
4230 if( needs_global_ctor )4284 if( needs_global_ctor )
4231 {4285 {
@@ -4233,7 +4287,7 @@ t_CKBOOL emit_engine_emit_exp_decl( Chuck_Emitter * emit, a_Exp_Decl decl, · 1 unmodified line
4233 instr->m_stack_offset = local->offset;4287 instr->m_stack_offset = local->offset;
4234 instr->m_should_execute_ctors = TRUE;4288 instr->m_should_execute_ctors = TRUE;
4235 }4289 }
4236 4290
4237 // if it's an event, we need to initialize it and check if the exact type matches4291 // if it's an event, we need to initialize it and check if the exact type matches
4238 if( globalType == te_globalEvent )4292 if( globalType == te_globalEvent )
4239 {4293 {
@@ -4273,7 +4327,7 @@ t_CKBOOL emit_engine_emit_exp_decl( Chuck_Emitter * emit, a_Exp_Decl decl, · 33 unmodified lines
4273 return FALSE;4327 return FALSE;
4274 }4328 }
4275 }4329 }
4276 4330
4277 // add instruction4331 // add instruction
4278 emit->append( instr );4332 emit->append( instr );
4279 }4333 }
@@ -4377,7 +4431,7 @@ t_CKBOOL emit_engine_emit_exp_decl( Chuck_Emitter * emit, a_Exp_Decl decl, · 97 unmodified lines
4377 else4431 else
4378 assert( FALSE );4432 assert( FALSE );
4379 }*/4433 }*/
4380 4434
4381 list = list->next;4435 list = list->next;
4382 }4436 }
4383 4437
@@ -4391,7 +4445,7 @@ t_CKBOOL emit_engine_emit_exp_decl( Chuck_Emitter * emit, a_Exp_Decl decl, · 7 unmodified lines
4391// name: emit_engine_emit_code_segment()4445// name: emit_engine_emit_code_segment()
4392// desc: ...4446// desc: ...
4393//-----------------------------------------------------------------------------4447//-----------------------------------------------------------------------------
4394t_CKBOOL emit_engine_emit_code_segment( Chuck_Emitter * emit, 4448t_CKBOOL emit_engine_emit_code_segment( Chuck_Emitter * emit,
4395 a_Stmt_Code stmt, t_CKBOOL push )4449 a_Stmt_Code stmt, t_CKBOOL push )
4396{4450{
4397 a_Stmt_List list = stmt->stmt_list;4451 a_Stmt_List list = stmt->stmt_list;
@@ -4408,7 +4462,7 @@ t_CKBOOL emit_engine_emit_code_segment( Chuck_Emitter * emit, · 10 unmodified lines
4408 }4462 }
4409 4463
4410 // TODO: push4464 // TODO: push
4411 4465
4412 return TRUE;4466 return TRUE;
4413}4467}
4414 4468
@@ -4517,7 +4571,7 @@ t_CKBOOL emit_engine_emit_func_def( Chuck_Emitter * emit, a_Func_Def func_def ) · 102 unmodified lines
4517 return FALSE;4571 return FALSE;
4518 }4572 }
4519 }4573 }
4520 4574
4521 // ge: 2012 april: added push scope (added 1.3.0.0)4575 // ge: 2012 april: added push scope (added 1.3.0.0)
4522 emit->push_scope();4576 emit->push_scope();
4523 4577
@@ -4553,7 +4607,7 @@ t_CKBOOL emit_engine_emit_func_def( Chuck_Emitter * emit, a_Func_Def func_def ) · 29 unmodified lines
4553 4607
4554 // TODO: make sure the calculated stack depth is the same as func_def->stack depth4608 // TODO: make sure the calculated stack depth is the same as func_def->stack depth
4555 // taking into account member function4609 // taking into account member function
4556 4610
4557 // add references for objects in the arguments (added 1.3.0.0)4611 // add references for objects in the arguments (added 1.3.0.0)
4558 // NOTE: this isn't in use since currently the caller is reference counting4612 // NOTE: this isn't in use since currently the caller is reference counting
4559 // the arguments -- this is to better support sporking, which is more4613 // the arguments -- this is to better support sporking, which is more
@@ -4563,20 +4617,25 @@ t_CKBOOL emit_engine_emit_func_def( Chuck_Emitter * emit, a_Func_Def func_def ) · 3 unmodified lines
4563 // emit the code4617 // emit the code
4564 if( !emit_engine_emit_stmt( emit, func_def->code, FALSE ) )4618 if( !emit_engine_emit_stmt( emit, func_def->code, FALSE ) )
4565 return FALSE;4619 return FALSE;
4566 4620
4567 // added by spencer June 2014 (1.3.5.0) 4621 // added by spencer June 2014 (1.3.5.0) | ensure return
4568 // ensure return
4569 if( func_def->ret_type && func_def->ret_type != emit->env->t_void )4622 if( func_def->ret_type && func_def->ret_type != emit->env->t_void )
4570 {4623 {
4571 emit->append( new Chuck_Instr_Reg_Push_Imm(0) );4624 // 1.4.2.1 (ge) | account for differences in return type size
4572 4625 // push 0 for the width of the return type in question
4573 Chuck_Instr_Goto * instr = new Chuck_Instr_Goto( 0 );4626 emit->append( new Chuck_Instr_Reg_Push_Zero( func_def->ret_type->size ) );
4574 emit->append( instr );4627 // previously this pushed 0 as int, regardless of return type size
4575 emit->code->stack_return.push_back( instr );4628 // emit->append( new Chuck_Instr_Reg_Push_Imm(0) );
4629
4630 // 1.4.2.1 (ge) | commented out this goto...
4631 // (okay as long as the next instruction is Chuck_Instr_Func_Return...)
4632 // Chuck_Instr_Goto * instr = new Chuck_Instr_Goto( 0 );
4633 // emit->append( instr );
4634 // emit->code->stack_return.push_back( instr );
4576 }4635 }
4577 4636
4578 // ge: pop scope (2012 april | added 1.3.0.0)4637 // ge: pop scope (2012 april | added 1.3.0.0)
4579 // TODO: ge 2012 april: pop scope? clean up function arguments? are argument properly ref counted? 4638 // TODO: ge 2012 april: pop scope? clean up function arguments? are argument properly ref counted?
4580 emit->pop_scope();4639 emit->pop_scope();
4581 4640
4582 // set the index for next instruction for return statements4641 // set the index for next instruction for return statements
@@ -4591,7 +4650,7 @@ t_CKBOOL emit_engine_emit_func_def( Chuck_Emitter * emit, a_Func_Def func_def ) · 8 unmodified lines
4591 func->code = emit_to_code( emit->code, NULL, emit->dump );4650 func->code = emit_to_code( emit->code, NULL, emit->dump );
4592 // add reference4651 // add reference
4593 func->code->add_ref();4652 func->code->add_ref();
4594 4653
4595 // unset the func4654 // unset the func
4596 emit->env->func = NULL;4655 emit->env->func = NULL;
4597 // delete the code4656 // delete the code
@@ -4619,7 +4678,7 @@ t_CKBOOL emit_engine_emit_class_def( Chuck_Emitter * emit, a_Class_Def class_def · 21 unmodified lines
4619 t_CKBOOL ret = TRUE;4678 t_CKBOOL ret = TRUE;
4620 // the class body4679 // the class body
4621 a_Class_Body body = class_def->body;4680 a_Class_Body body = class_def->body;
4622 4681
4623 // make sure the code is empty4682 // make sure the code is empty
4624 if( type->info->pre_ctor != NULL && type->info->pre_ctor->instr != NULL )4683 if( type->info->pre_ctor != NULL && type->info->pre_ctor->instr != NULL )
4625 {4684 {
@@ -4652,7 +4711,7 @@ t_CKBOOL emit_engine_emit_class_def( Chuck_Emitter * emit, a_Class_Def class_def · 26 unmodified lines
4652 // if( type->has_constructor ) type->info->pre_ctor = new Chuck_VM_Code;4711 // if( type->has_constructor ) type->info->pre_ctor = new Chuck_VM_Code;
4653 // keep track of full path (added 1.3.0.0)4712 // keep track of full path (added 1.3.0.0)
4654 emit->code->filename = emit->context->full_path;4713 emit->code->filename = emit->context->full_path;
4655 4714
4656 // get the size4715 // get the size
4657 emit->code->stack_depth += sizeof(t_CKUINT);4716 emit->code->stack_depth += sizeof(t_CKUINT);
4658 // add this4717 // add this
@@ -4674,11 +4733,11 @@ t_CKBOOL emit_engine_emit_class_def( Chuck_Emitter * emit, a_Class_Def class_def · 15 unmodified lines
4674 case ae_section_stmt:4733 case ae_section_stmt:
4675 ret = emit_engine_emit_stmt_list( emit, body->section->stmt_list );4734 ret = emit_engine_emit_stmt_list( emit, body->section->stmt_list );
4676 break;4735 break;
4677 4736
4678 case ae_section_func:4737 case ae_section_func:
4679 ret = emit_engine_emit_func_def( emit, body->section->func_def );4738 ret = emit_engine_emit_func_def( emit, body->section->func_def );
4680 break;4739 break;
4681 4740
4682 case ae_section_class:4741 case ae_section_class:
4683 ret = emit_engine_emit_class_def( emit, body->section->class_def );4742 ret = emit_engine_emit_class_def( emit, body->section->class_def );
4684 //EM_error2( body->section->class_def->linepos,4743 //EM_error2( body->section->class_def->linepos,
@@ -4686,7 +4745,7 @@ t_CKBOOL emit_engine_emit_class_def( Chuck_Emitter * emit, a_Class_Def class_def · 1 unmodified line
4686 //ret = FALSE;4745 //ret = FALSE;
4687 break;4746 break;
4688 }4747 }
4689 4748
4690 // move to the next section4749 // move to the next section
4691 body = body->next;4750 body = body->next;
4692 }4751 }
@@ -4706,7 +4765,7 @@ t_CKBOOL emit_engine_emit_class_def( Chuck_Emitter * emit, a_Class_Def class_def · 13 unmodified lines
4706 if( !type->info->class_data )4765 if( !type->info->class_data )
4707 {4766 {
4708 // we have a problem4767 // we have a problem
4709 CK_FPRINTF_STDERR( 4768 CK_FPRINTF_STDERR(
4710 "[chuck](emitter): OutOfMemory: while allocating static data '%s'\n", type->c_name() );4769 "[chuck](emitter): OutOfMemory: while allocating static data '%s'\n", type->c_name() );
4711 // flag4770 // flag
4712 ret = FALSE;4771 ret = FALSE;
@@ -4749,16 +4808,16 @@ t_CKBOOL emit_engine_emit_spork( Chuck_Emitter * emit, a_Exp_Func_Call exp ) · 36 unmodified lines
4749{4808{
4750 // spork4809 // spork
4751 Chuck_Instr_Mem_Push_Imm * op = NULL;4810 Chuck_Instr_Mem_Push_Imm * op = NULL;
4752 4811
4753 // if member function, push this4812 // if member function, push this
4754 // TODO: this is a hack - what if exp is not func_call?4813 // TODO: this is a hack - what if exp is not func_call?
4755 // if( exp->ck_func->is_member )4814 // if( exp->ck_func->is_member )
4756 // emit->append( new Chuck_Instr_Reg_Push_This );4815 // emit->append( new Chuck_Instr_Reg_Push_This );
4757 4816
4758 // evaluate args on sporker shred4817 // evaluate args on sporker shred
4759 if( !emit_engine_emit_func_args( emit, exp ) )4818 if( !emit_engine_emit_func_args( emit, exp ) )
4760 return FALSE;4819 return FALSE;
4761 4820
4762 // emit func pointer on sporker shred4821 // emit func pointer on sporker shred
4763 if( !emit_engine_emit_exp( emit, exp->func ) )4822 if( !emit_engine_emit_exp( emit, exp->func ) )
4764 {4823 {
@@ -4766,7 +4825,7 @@ t_CKBOOL emit_engine_emit_spork( Chuck_Emitter * emit, a_Exp_Func_Call exp ) · 1 unmodified line
4766 "(emit): internal error in evaluating function call..." );4825 "(emit): internal error in evaluating function call..." );
4767 return FALSE;4826 return FALSE;
4768 }4827 }
4769 4828
4770 // push the current code4829 // push the current code
4771 emit->stack.push_back( emit->code );4830 emit->stack.push_back( emit->code );
4772 // make a new one (spork~exp shred)4831 // make a new one (spork~exp shred)
@@ -4787,25 +4846,33 @@ t_CKBOOL emit_engine_emit_spork( Chuck_Emitter * emit, a_Exp_Func_Call exp ) · 14 unmodified lines
4787 op = new Chuck_Instr_Mem_Push_Imm( 0 );4846 op = new Chuck_Instr_Mem_Push_Imm( 0 );
4788 // emit the stack depth - we don't know this yet4847 // emit the stack depth - we don't know this yet
4789 emit->append( op );4848 emit->append( op );
4790 4849
4791 // call the func on sporkee shred4850 // call the func on sporkee shred
4792 if( !emit_engine_emit_exp_func_call(4851 if( !emit_engine_emit_exp_func_call( emit,
4793 emit,4852 exp->ck_func,
4794 exp->ck_func,4853 exp->ret_type,
4795 exp->ret_type,4854 exp->linepos,
4796 exp->linepos,4855 TRUE ) ) return FALSE;
4797 TRUE ) )4856
4798 return FALSE;4857 // 1.4.2.1 (ge) | added to pop/release the returned value, which could be an object
4799 4858 if( iskindofint(emit->env, exp->ret_type) )
4859 {
4860 // is an object?
4861 if( isobj( emit->env, exp->ret_type) )
4862 { emit->append( new Chuck_Instr_Release_Object3_Pop_Word ); }
4863 else // not an object
4864 { emit->append( new Chuck_Instr_Reg_Pop_Word ); }
4865 }
4866
4800 // emit the function call, with special flag4867 // emit the function call, with special flag
4801 // if( !emit_engine_emit_exp_func_call( emit, exp, TRUE ) )4868 // if( !emit_engine_emit_exp_func_call( emit, exp, TRUE ) )
4802 // return FALSE;4869 // return FALSE;
4803 4870
4804 // done4871 // done
4805 emit->append( new Chuck_Instr_EOC );4872 emit->append( new Chuck_Instr_EOC );
4806 // set the stack depth now that we know4873 // set the stack depth now that we know
4807 op->set( emit->code->stack_depth );4874 op->set( emit->code->stack_depth );
4808 4875
4809 // emit it4876 // emit it
4810 Chuck_VM_Code * code = emit_to_code( emit->code, NULL, emit->dump );4877 Chuck_VM_Code * code = emit_to_code( emit->code, NULL, emit->dump );
4811 // remember it4878 // remember it
@@ -4813,17 +4880,17 @@ t_CKBOOL emit_engine_emit_spork( Chuck_Emitter * emit, a_Exp_Func_Call exp ) · 1 unmodified line
4813 // add reference4880 // add reference
4814 exp->ck_vm_code->add_ref();4881 exp->ck_vm_code->add_ref();
4815 // code->name = string("spork~exp");4882 // code->name = string("spork~exp");
4816 4883
4817 // restore the code to sporker shred4884 // restore the code to sporker shred
4818 assert( emit->stack.size() > 0 );4885 assert( emit->stack.size() > 0 );
4819 emit->code = emit->stack.back();4886 emit->code = emit->stack.back();
4820 // pop4887 // pop
4821 emit->stack.pop_back();4888 emit->stack.pop_back();
4822 4889
4823 a_Exp e = exp->args;4890 a_Exp e = exp->args;
4824 t_CKUINT size = 0;4891 t_CKUINT size = 0;
4825 while( e ) { size += e->cast_to ? e->cast_to->size : e->type->size; e = e->next; }4892 while( e ) { size += e->cast_to ? e->cast_to->size : e->type->size; e = e->next; }
4826 4893
4827 // handle member function4894 // handle member function
4828 // TODO: this is a hack - what if exp is not func_call?4895 // TODO: this is a hack - what if exp is not func_call?
4829 // if( emit->code->need_this )4896 // if( emit->code->need_this )
@@ -4833,7 +4900,7 @@ t_CKBOOL emit_engine_emit_spork( Chuck_Emitter * emit, a_Exp_Func_Call exp ) · 3 unmodified lines
4833 emit->append( new Chuck_Instr_Reg_Push_Imm( (t_CKUINT)code ) );4900 emit->append( new Chuck_Instr_Reg_Push_Imm( (t_CKUINT)code ) );
4834 // emit spork instruction - this will copy, func, args, this4901 // emit spork instruction - this will copy, func, args, this
4835 emit->append( new Chuck_Instr_Spork( size ) );4902 emit->append( new Chuck_Instr_Spork( size ) );
4836 4903
4837 return TRUE;4904 return TRUE;
4838}4905}
4839 4906
@@ -4856,23 +4923,23 @@ t_CKBOOL emit_engine_emit_spork( Chuck_Emitter * emit, a_Exp_Func_Call exp ) · 16 unmodified lines
4856// emit->code->name = "spork~exp";4923// emit->code->name = "spork~exp";
4857// // keep track of full path (added 1.3.0.0)4924// // keep track of full path (added 1.3.0.0)
4858// emit->code->filename = emit->context->full_path;4925// emit->code->filename = emit->context->full_path;
4859// 4926//
4860// // call the code on sporkee shred4927// // call the code on sporkee shred
4861// if( !emit_engine_emit_stmt( emit, stmt, TRUE ) )4928// if( !emit_engine_emit_stmt( emit, stmt, TRUE ) )
4862// return FALSE;4929// return FALSE;
4863// 4930//
4864// // done4931// // done
4865// emit->append( new Chuck_Instr_EOC );4932// emit->append( new Chuck_Instr_EOC );
4866// 4933//
4867// // emit it4934// // emit it
4868// Chuck_VM_Code * code = emit_to_code( emit->code, NULL, emit->dump );4935// Chuck_VM_Code * code = emit_to_code( emit->code, NULL, emit->dump );
4869// 4936//
4870// // restore the code to sporker shred4937// // restore the code to sporker shred
4871// assert( emit->stack.size() > 0 );4938// assert( emit->stack.size() > 0 );
4872// emit->code = emit->stack.back();4939// emit->code = emit->stack.back();
4873// // pop4940// // pop
4874// emit->stack.pop_back();4941// emit->stack.pop_back();
4875// 4942//
4876// if( code->need_this )4943// if( code->need_this )
4877// {4944// {
4878// // push this if needed4945// // push this if needed
@@ -4882,7 +4949,7 @@ t_CKBOOL emit_engine_emit_spork( Chuck_Emitter * emit, a_Exp_Func_Call exp ) · 3 unmodified lines
4882// emit->append( new Chuck_Instr_Reg_Push_Imm( (t_CKUINT)code ) );4949// emit->append( new Chuck_Instr_Reg_Push_Imm( (t_CKUINT)code ) );
4883// // emit spork instruction - this will copy, func, args, this4950// // emit spork instruction - this will copy, func, args, this
4884// emit->append( new Chuck_Instr_Spork_Stmt( 0 ) );4951// emit->append( new Chuck_Instr_Spork_Stmt( 0 ) );
4885// 4952//
4886// return TRUE;4953// return TRUE;
4887//}4954//}
4888 4955
@@ -4893,7 +4960,7 @@ t_CKBOOL emit_engine_emit_spork( Chuck_Emitter * emit, a_Exp_Func_Call exp ) · 4 unmodified lines
4893// name: emit_engine_emit_symbol()4960// name: emit_engine_emit_symbol()
4894// desc: ...4961// desc: ...
4895//-----------------------------------------------------------------------------4962//-----------------------------------------------------------------------------
4896t_CKBOOL emit_engine_emit_symbol( Chuck_Emitter * emit, S_Symbol symbol, 4963t_CKBOOL emit_engine_emit_symbol( Chuck_Emitter * emit, S_Symbol symbol,
4897 Chuck_Value * v, t_CKBOOL emit_var,4964 Chuck_Value * v, t_CKBOOL emit_var,
4898 int linepos )4965 int linepos )
4899{4966{
@@ -4908,7 +4975,7 @@ t_CKBOOL emit_engine_emit_symbol( Chuck_Emitter * emit, S_Symbol symbol, · 8 unmodified lines
4908 S_name(symbol) );4975 S_name(symbol) );
4909 return FALSE;4976 return FALSE;
4910 }4977 }
4911 4978
4912 // if global, find what type4979 // if global, find what type
4913 // (due to user classes, this info is only available during emit)4980 // (due to user classes, this info is only available during emit)
4914 te_GlobalType global_type;4981 te_GlobalType global_type;
@@ -5057,7 +5124,7 @@ void Chuck_Emitter::addref_on_scope() · 142 unmodified lines
5057 locals.clear();5124 locals.clear();
5058 // get the current scope5125 // get the current scope
5059 code->frame->get_scope( locals );5126 code->frame->get_scope( locals );
5060 5127
5061 // iterate over locals5128 // iterate over locals
5062 for( int i = 0; i < locals.size(); i++ )5129 for( int i = 0; i < locals.size(); i++ )
5063 {5130 {
@@ -5081,6 +5148,46 @@ void Chuck_Emitter::addref_on_scope() · 17 unmodified lines
5081 5148
5082 5149
5083 5150
5151//-----------------------------------------------------------------------------
5152// name: traverse_scope_on_jump() | 1.4.2.1 (ge) added
5153// desc: traverse the scope and emit instructions on a jump statement:
5154// 'return', 'break', 'continue'
5155// this is done to ensure proper cleanup of objects on scope frames
5156//-----------------------------------------------------------------------------
5157void Chuck_Emitter::traverse_scope_on_jump( )
5158{
5159 // this gotta be the case
5160 assert( code != NULL );
5161
5162 // clear locals
5163 locals.clear();
5164 // get locals (localOnly=false to get all locals at this point in 'code')
5165 code->frame->get_scope( locals, false );
5166
5167 // loop over
5168 for( int i = 0; i < locals.size(); i++ )
5169 {
5170 // get local
5171 Chuck_Local * local = locals[i];
5172 // skip scope boundary (denoted by NULL)
5173 if( !local ) continue;
5174
5175 // check to see if it's an object (but not global)
5176 // (REFACTOR-2017: don't release global objects)
5177 if( local->is_obj && !local->is_global )
5178 {
5179 // emit instruction to release the object
5180 this->append( new Chuck_Instr_Release_Object2( local->offset ) );
5181 }
5182 }
5183
5184 // clear it
5185 locals.clear();
5186}
5187
5188
5189
5190
5084//-----------------------------------------------------------------------------5191//-----------------------------------------------------------------------------
5085// name: pop_scope()5192// name: pop_scope()
5086// desc: ...5193// desc: ...
@@ -5111,11 +5218,11 @@ void Chuck_Emitter::pop_scope( ) · 24 unmodified lines
5111 this->append( new Chuck_Instr_Release_Object2( local->offset ) );5218 this->append( new Chuck_Instr_Release_Object2( local->offset ) );
5112 }5219 }
5113 }5220 }
5114 5221
5115 // reclaim local; null out to be safe5222 // reclaim local; null out to be safe
5116 SAFE_DELETE( local ); locals[i] = NULL;5223 SAFE_DELETE( local ); locals[i] = NULL;
5117 }5224 }
5118 5225
5119 // clear it5226 // clear it
5120 locals.clear();5227 locals.clear();
5121}5228}
@@ -5140,7 +5247,7 @@ t_CKBOOL Chuck_Emitter::find_dur( const string & name, t_CKDUR * out ) · 18 unmodified lines
5140 if( !value || !equals( value->type, env->t_dur ) ) return FALSE;5247 if( !value || !equals( value->type, env->t_dur ) ) return FALSE;
5141 // copy5248 // copy
5142 *out = *( (t_CKDUR *)value->addr );5249 *out = *( (t_CKDUR *)value->addr );
5143 5250
5144 return TRUE;5251 return TRUE;
5145}5252}
5146 5253
@@ -5161,7 +5268,7 @@ t_CKBOOL emit_engine_instantiate_object( Chuck_Emitter * emit, Chuck_Type * type · 14 unmodified lines
5161 // emit indices5268 // emit indices
5162 emit_engine_emit_exp( emit, array->exp_list );5269 emit_engine_emit_exp( emit, array->exp_list );
5163 // emit array allocation5270 // emit array allocation
5164 emit->append( new Chuck_Instr_Array_Alloc( 5271 emit->append( new Chuck_Instr_Array_Alloc(
5165 type->array_depth, type->array_type, emit->code->frame->curr_offset,5272 type->array_depth, type->array_type, emit->code->frame->curr_offset,
5166 is_ref ) );5273 is_ref ) );
5167 5274
@@ -5197,7 +5304,7 @@ t_CKBOOL emit_engine_instantiate_object( Chuck_Emitter * emit, Chuck_Type * type · 29 unmodified lines
5197 emit->append( new Chuck_Instr_Instantiate_Object( type ) );5304 emit->append( new Chuck_Instr_Instantiate_Object( type ) );
5198 5305
5199 //}5306 //}
5200 5307
5201 // call pre constructor5308 // call pre constructor
5202 emit_engine_pre_constructor( emit, type );5309 emit_engine_pre_constructor( emit, type );
5203 5310
src/core/chuck_emit.h+7−5
@@ -74,10 +74,10 @@ public: · 73 unmodified lines
74 std::vector<Chuck_Instr_Goto *> stack_break;74 std::vector<Chuck_Instr_Goto *> stack_break;
75 // return stack75 // return stack
76 std::vector<Chuck_Instr_Goto *> stack_return;76 std::vector<Chuck_Instr_Goto *> stack_return;
77 77
78 // filename this code came from (added 1.3.0.0)78 // filename this code came from (added 1.3.0.0)
79 std::string filename;79 std::string filename;
80 80
81 // constructor81 // constructor
82 Chuck_Code( )82 Chuck_Code( )
83 {83 {
@@ -122,7 +122,7 @@ struct Chuck_Emitter : public Chuck_VM_Object · 38 unmodified lines
122 122
123 // constructor123 // constructor
124 Chuck_Emitter()124 Chuck_Emitter()
125 { env = NULL; code = NULL; context = NULL; 125 { env = NULL; code = NULL; context = NULL;
126 nspc = NULL; func = NULL; dump = FALSE;126 nspc = NULL; func = NULL; dump = FALSE;
127 should_replace_dac = FALSE; }127 should_replace_dac = FALSE; }
128 128
@@ -148,11 +148,13 @@ struct Chuck_Emitter : public Chuck_VM_Object · 19 unmodified lines
148 // add references to locals on current scope (added 1.3.0.0)148 // add references to locals on current scope (added 1.3.0.0)
149 void addref_on_scope();149 void addref_on_scope();
150 // pop scope150 // pop scope
151 void pop_scope( );151 void pop_scope();
152 // traverse scope on jumps such as 'return' 'break' 'continue' | 1.4.2.1 (ge)
153 void traverse_scope_on_jump();
152 154
153 // default durations155 // default durations
154 t_CKBOOL find_dur( const std::string & name, t_CKDUR * out );156 t_CKBOOL find_dur( const std::string & name, t_CKDUR * out );
155 157
156 // post REFACTOR-2017: replace-dac158 // post REFACTOR-2017: replace-dac
157 std::string dac_replacement;159 std::string dac_replacement;
158 t_CKBOOL should_replace_dac;160 t_CKBOOL should_replace_dac;
src/core/chuck_errmsg.cpp+55−53
@@ -31,16 +31,17 @@ · 30 unmodified lines
31// based on code by: Andrew Appel (appel@cs.princeton.edu)31// based on code by: Andrew Appel (appel@cs.princeton.edu)
32// date: Summer 200232// date: Summer 2002
33//-----------------------------------------------------------------------------33//-----------------------------------------------------------------------------
34#include "chuck_errmsg.h"
35#include "chuck_utils.h"
36#ifndef __DISABLE_THREADS__
37#include "util_thread.h"
38#endif
39
34#include <stdlib.h>40#include <stdlib.h>
35#include <stdarg.h>41#include <stdarg.h>
36#include <string.h>42#include <string.h>
37#include <sstream>43#include <sstream>
38#include <iostream>44#include <iostream>
39#include "chuck_utils.h"
40#include "chuck_errmsg.h"
41#ifndef __DISABLE_THREADS__
42#include "util_thread.h"
43#endif
44 45
45// global46// global
46t_CKINT EM_tokPos = 0;47t_CKINT EM_tokPos = 0;
@@ -51,7 +52,8 @@ t_CKBOOL anyErrors= FALSE; · 4 unmodified lines
51// local global52// local global
52static const char * fileName = "";53static const char * fileName = "";
53static int lineNum = 1;54static int lineNum = 1;
54static char g_buffer[1024] = "";55#define CK_ERR_BUF_LENGTH 1024
56static char g_buffer[CK_ERR_BUF_LENGTH] = "";
55static const size_t LASTERROR_SIZE = 1024;57static const size_t LASTERROR_SIZE = 1024;
56static char g_lasterror[LASTERROR_SIZE] = "[chuck]: (no error)";58static char g_lasterror[LASTERROR_SIZE] = "[chuck]: (no error)";
57static size_t g_lasterrorIndex = strlen(g_lasterror);59static size_t g_lasterrorIndex = strlen(g_lasterror);
@@ -79,10 +81,10 @@ void ck_fprintf_stdout( const char * format, ... ) · 21 unmodified lines
79 va_start( args, format );81 va_start( args, format );
80 vsnprintf( g_buffer2, g_buffer2_size, format, args );82 vsnprintf( g_buffer2, g_buffer2_size, format, args );
81 va_end( args );83 va_end( args );
82 84
83 // send the formatted string to the buffer85 // send the formatted string to the buffer
84 g_stdout_stream << g_buffer2;86 g_stdout_stream << g_buffer2;
85 87
86 // try flushing88 // try flushing
87 ck_fflush_stdout();89 ck_fflush_stdout();
88}90}
@@ -95,10 +97,10 @@ void ck_fprintf_stderr( const char * format, ... ) · 6 unmodified lines
95 va_start( args, format );97 va_start( args, format );
96 vsnprintf( g_buffer2, g_buffer2_size, format, args );98 vsnprintf( g_buffer2, g_buffer2_size, format, args );
97 va_end( args );99 va_end( args );
98 100
99 // send the formatted string to the buffer101 // send the formatted string to the buffer
100 g_stderr_stream << g_buffer2;102 g_stderr_stream << g_buffer2;
101 103
102 // try flushing104 // try flushing
103 ck_fflush_stderr();105 ck_fflush_stderr();
104}106}
@@ -112,7 +114,7 @@ void ck_fflush_stdout() · 7 unmodified lines
112 // send to stdout114 // send to stdout
113 fprintf( stdout, "%s", g_stdout_stream.str().c_str() );115 fprintf( stdout, "%s", g_stdout_stream.str().c_str() );
114 fflush( stdout );116 fflush( stdout );
115 117
116 // and clear buffer118 // and clear buffer
117 g_stdout_stream.str( std::string() );119 g_stdout_stream.str( std::string() );
118 }120 }
@@ -124,7 +126,7 @@ void ck_fflush_stdout() · 5 unmodified lines
124 {126 {
125 // if so, emit to callback127 // if so, emit to callback
126 g_stdout_callback( g_stdout_stream.str().c_str() );128 g_stdout_callback( g_stdout_stream.str().c_str() );
127 129
128 // and clear buffer130 // and clear buffer
129 g_stdout_stream.str( std::string() );131 g_stdout_stream.str( std::string() );
130 }132 }
@@ -140,7 +142,7 @@ void ck_fflush_stderr() · 9 unmodified lines
140 // send to stderr142 // send to stderr
141 fprintf( stderr, "%s", g_stderr_stream.str().c_str() );143 fprintf( stderr, "%s", g_stderr_stream.str().c_str() );
142 fflush( stderr );144 fflush( stderr );
143 145
144 // and clear buffer146 // and clear buffer
145 g_stderr_stream.str( std::string() );147 g_stderr_stream.str( std::string() );
146 }148 }
@@ -152,7 +154,7 @@ void ck_fflush_stderr() · 5 unmodified lines
152 {154 {
153 // if so, emit to callback155 // if so, emit to callback
154 g_stderr_callback( g_stderr_stream.str().c_str() );156 g_stderr_callback( g_stderr_stream.str().c_str() );
155 157
156 // and clear buffer158 // and clear buffer
157 g_stderr_stream.str( std::string() );159 g_stderr_stream.str( std::string() );
158 }160 }
@@ -164,10 +166,10 @@ void ck_vfprintf_stdout( const char * format, va_list args ) · 5 unmodified lines
164{166{
165 // evaluate the format string167 // evaluate the format string
166 vsnprintf( g_buffer2, g_buffer2_size, format, args );168 vsnprintf( g_buffer2, g_buffer2_size, format, args );
167 169
168 // send the formatted string to the buffer170 // send the formatted string to the buffer
169 g_stdout_stream << g_buffer2;171 g_stdout_stream << g_buffer2;
170 172
171 // try flushing173 // try flushing
172 ck_fflush_stdout();174 ck_fflush_stdout();
173}175}
@@ -177,10 +179,10 @@ void ck_vfprintf_stderr( const char * format, va_list args ) · 3 unmodified lines
177{179{
178 // evaluate the format string180 // evaluate the format string
179 vsnprintf( g_buffer2, g_buffer2_size, format, args );181 vsnprintf( g_buffer2, g_buffer2_size, format, args );
180 182
181 // send the formatted string to the buffer183 // send the formatted string to the buffer
182 g_stderr_stream << g_buffer2;184 g_stderr_stream << g_buffer2;
183 185
184 // try flushing186 // try flushing
185 ck_fflush_stderr();187 ck_fflush_stderr();
186}188}
@@ -367,27 +369,27 @@ static const char * g_str[] = { · 180 unmodified lines
367 369
368 370
369// intList371// intList
370typedef struct intList {int i; struct intList *rest;} *IntList;372typedef struct intList {t_CKINT i; struct intList *rest;} *IntList;
371static IntList linePos=NULL;373static IntList linePos=NULL;
372 374
373 375
374static int lastErrorCat(const char * str)376static int lastErrorCat(const char * str)
375{377{
376 assert(g_lasterrorIndex <= LASTERROR_SIZE-1);378 assert(g_lasterrorIndex <= LASTERROR_SIZE-1);
377 379
378 size_t len = strlen(str);380 size_t len = strlen(str);
379 381
380 strncat(g_lasterror, str, LASTERROR_SIZE-g_lasterrorIndex-1);382 strncat(g_lasterror, str, LASTERROR_SIZE-g_lasterrorIndex-1);
381 383
382 size_t appendCount = ck_min(LASTERROR_SIZE-g_lasterrorIndex-1, len);384 size_t appendCount = ck_min(LASTERROR_SIZE-g_lasterrorIndex-1, len);
383 g_lasterrorIndex += appendCount;385 g_lasterrorIndex += appendCount;
384 386
385 return appendCount > 0;387 return appendCount > 0;
386}388}
387 389
388 390
389// constructor391// constructor
390static IntList intList( int i, IntList rest )392static IntList intList( t_CKINT i, IntList rest )
391{393{
392 IntList l = (IntList)checked_malloc(sizeof *l);394 IntList l = (IntList)checked_malloc(sizeof *l);
393 l->i=i; l->rest=rest;395 l->i=i; l->rest=rest;
@@ -430,43 +432,43 @@ void EM_reset_msg() · 36 unmodified lines
430 g_lasterrorIndex = 0;432 g_lasterrorIndex = 0;
431}433}
432 434
433// [%s]:line(%d).char(%d): 435// [%s]:line(%d).char(%d):
434void EM_error( int pos, const char * message, ... )436void EM_error( t_CKINT pos, const char * message, ... )
435{437{
436 va_list ap;438 va_list ap;
437 IntList lines = linePos;439 IntList lines = linePos;
438 int num = lineNum;440 int num = lineNum;
439 441
440 anyErrors = TRUE;442 anyErrors = TRUE;
441 while( lines && lines->i >= pos ) 443 while( lines && lines->i >= pos )
442 {444 {
443 lines = lines->rest;445 lines = lines->rest;
444 num--;446 num--;
445 }447 }
446 448
447 // separate errmsgs with newlines449 // separate errmsgs with newlines
448 if( g_lasterror[0] != '\0' ) lastErrorCat( "\n" );450 if( g_lasterror[0] != '\0' ) lastErrorCat( "\n" );
449 451
450 CK_FPRINTF_STDERR( "[%s]:", *fileName ? mini(fileName) : "chuck" );452 CK_FPRINTF_STDERR( "[%s]:", *fileName ? mini(fileName) : "chuck" );
451 sprintf( g_buffer, "[%s]:", *fileName ? mini(fileName) : "chuck" );453 snprintf( g_buffer, CK_ERR_BUF_LENGTH, "[%s]:", *fileName ? mini(fileName) : "chuck" );
452 lastErrorCat( g_buffer );454 lastErrorCat( g_buffer );
453 if(lines)455 if(lines)
454 {456 {
455 CK_FPRINTF_STDERR( "line(%d).char(%d):", num, pos-lines->i );457 CK_FPRINTF_STDERR( "line(%d).char(%d):", num, pos-lines->i );
456 sprintf( g_buffer, "line(%d).char(%d):", num, pos-lines->i );458 snprintf( g_buffer, CK_ERR_BUF_LENGTH, "line(%d).char(%d):", num, (int)(pos-lines->i) );
457 lastErrorCat( g_buffer );459 lastErrorCat( g_buffer );
458 }460 }
459 CK_FPRINTF_STDERR( " " );461 CK_FPRINTF_STDERR( " " );
460 lastErrorCat( " " );462 lastErrorCat( " " );
461 463
462 va_start(ap, message);464 va_start(ap, message);
463 CK_VFPRINTF_STDERR( message, ap);465 CK_VFPRINTF_STDERR( message, ap);
464 va_end(ap);466 va_end(ap);
465 467
466 va_start(ap, message);468 va_start(ap, message);
467 vsprintf( g_buffer, message, ap );469 vsnprintf( g_buffer, CK_ERR_BUF_LENGTH, message, ap );
468 va_end(ap);470 va_end(ap);
469 471
470 CK_FPRINTF_STDERR( "\n");472 CK_FPRINTF_STDERR( "\n");
471 CK_FFLUSH_STDERR();473 CK_FFLUSH_STDERR();
472 lastErrorCat( g_buffer );474 lastErrorCat( g_buffer );
@@ -474,7 +476,7 @@ void EM_error( int pos, const char * message, ... ) · 1 unmodified line
474 476
475 477
476// [%s]:line(%d):478// [%s]:line(%d):
477void EM_error2( int line, const char * message, ... )479void EM_error2( t_CKINT line, const char * message, ... )
478{480{
479 va_list ap;481 va_list ap;
480 482
@@ -482,14 +484,14 @@ void EM_error2( int line, const char * message, ... ) · 1 unmodified line
482 484
483 // separate errmsgs with newlines485 // separate errmsgs with newlines
484 if( g_lasterror[0] != '\0' ) lastErrorCat( "\n" );486 if( g_lasterror[0] != '\0' ) lastErrorCat( "\n" );
485 487
486 CK_FPRINTF_STDERR( "[%s]:", *fileName ? mini(fileName) : "chuck" );488 CK_FPRINTF_STDERR( "[%s]:", *fileName ? mini(fileName) : "chuck" );
487 sprintf( g_buffer, "[%s]:", *fileName ? mini(fileName) : "chuck" );489 snprintf( g_buffer, CK_ERR_BUF_LENGTH, "[%s]:", *fileName ? mini(fileName) : "chuck" );
488 lastErrorCat( g_buffer );490 lastErrorCat( g_buffer );
489 if(line)491 if(line)
490 {492 {
491 CK_FPRINTF_STDERR( "line(%d):", line );493 CK_FPRINTF_STDERR( "line(%d):", (int)line );
492 sprintf( g_buffer, "line(%d):", line );494 snprintf( g_buffer, CK_ERR_BUF_LENGTH, "line(%d):", (int)line );
493 lastErrorCat( g_buffer );495 lastErrorCat( g_buffer );
494 }496 }
495 CK_FPRINTF_STDERR( " " );497 CK_FPRINTF_STDERR( " " );
@@ -500,7 +502,7 @@ void EM_error2( int line, const char * message, ... ) · 4 unmodified lines
500 va_end( ap );502 va_end( ap );
501 503
502 va_start( ap, message );504 va_start( ap, message );
503 vsprintf( g_buffer, message, ap );505 vsnprintf( g_buffer, CK_ERR_BUF_LENGTH, message, ap );
504 va_end( ap );506 va_end( ap );
505 507
506 lastErrorCat( g_buffer );508 lastErrorCat( g_buffer );
@@ -510,22 +512,22 @@ void EM_error2( int line, const char * message, ... ) · 3 unmodified lines
510 512
511 513
512// [%s]:line(%d):514// [%s]:line(%d):
513void EM_error2b( int line, const char * message, ... )515void EM_error2b( t_CKINT line, const char * message, ... )
514{516{
515 va_list ap;517 va_list ap;
516 518
517 EM_extLineNum = line;519 EM_extLineNum = line;
518 520
519 // separate errmsgs with newlines521 // separate errmsgs with newlines
520 if( g_lasterror[0] != '\0' ) lastErrorCat( "\n" );522 if( g_lasterror[0] != '\0' ) lastErrorCat( "\n" );
521 523
522 CK_FPRINTF_STDERR( "[%s]:", *fileName ? mini(fileName) : "chuck" );524 CK_FPRINTF_STDERR( "[%s]:", *fileName ? mini(fileName) : "chuck" );
523 sprintf( g_buffer, "[%s]:", *fileName ? mini(fileName) : "chuck" );525 snprintf( g_buffer, CK_ERR_BUF_LENGTH, "[%s]:", *fileName ? mini(fileName) : "chuck" );
524 lastErrorCat( g_buffer );526 lastErrorCat( g_buffer );
525 if(line)527 if(line)
526 {528 {
527 CK_FPRINTF_STDERR( "line(%d):", line );529 CK_FPRINTF_STDERR( "line(%d):", (int)line );
528 sprintf( g_buffer, "line(%d):", line );530 snprintf( g_buffer, CK_ERR_BUF_LENGTH, "line(%d):", (int)line );
529 lastErrorCat( g_buffer );531 lastErrorCat( g_buffer );
530 }532 }
531 CK_FPRINTF_STDERR( " " );533 CK_FPRINTF_STDERR( " " );
@@ -536,7 +538,7 @@ void EM_error2b( int line, const char * message, ... ) · 4 unmodified lines
536 va_end( ap );538 va_end( ap );
537 539
538 va_start( ap, message );540 va_start( ap, message );
539 vsprintf( g_buffer, message, ap );541 vsnprintf( g_buffer, CK_ERR_BUF_LENGTH, message, ap );
540 va_end( ap );542 va_end( ap );
541 543
542 lastErrorCat( g_buffer );544 lastErrorCat( g_buffer );
@@ -545,14 +547,14 @@ void EM_error2b( int line, const char * message, ... ) · 2 unmodified lines
545}547}
546 548
547 549
548// 550//
549void EM_error3( const char * message, ... )551void EM_error3( const char * message, ... )
550{552{
551 va_list ap;553 va_list ap;
552 554
553 // separate errmsgs with newlines555 // separate errmsgs with newlines
554 if( g_lasterror[0] != '\0' ) lastErrorCat( "\n" );556 if( g_lasterror[0] != '\0' ) lastErrorCat( "\n" );
555 557
556// g_lasterror[0] = '\0';558// g_lasterror[0] = '\0';
557 g_buffer[0] = '\0';559 g_buffer[0] = '\0';
558 560
@@ -561,7 +563,7 @@ void EM_error3( const char * message, ... ) · 2 unmodified lines
561 va_end( ap );563 va_end( ap );
562 564
563 va_start( ap, message );565 va_start( ap, message );
564 vsprintf( g_buffer, message, ap );566 vsnprintf( g_buffer, CK_ERR_BUF_LENGTH, message, ap );
565 va_end( ap );567 va_end( ap );
566 568
567 lastErrorCat( g_buffer );569 lastErrorCat( g_buffer );
@@ -575,7 +577,7 @@ void EM_log( t_CKINT level, const char * message, ... ) · 7 unmodified lines
575{577{
576 va_list ap;578 va_list ap;
577 579
578 if( level > CK_LOG_CRAZY ) level = CK_LOG_CRAZY;580 if( level > CK_LOG_ALL ) level = CK_LOG_ALL;
579 else if( level <= CK_LOG_NONE ) level = CK_LOG_NONE + 1;581 else if( level <= CK_LOG_NONE ) level = CK_LOG_NONE + 1;
580 582
581 // check level583 // check level
@@ -606,7 +608,7 @@ void EM_log( t_CKINT level, const char * message, ... ) · 24 unmodified lines
606// set log level608// set log level
607void EM_setlog( t_CKINT level )609void EM_setlog( t_CKINT level )
608{610{
609 if( level > CK_LOG_CRAZY ) level = CK_LOG_CRAZY;611 if( level > CK_LOG_ALL ) level = CK_LOG_ALL;
610 else if( level < CK_LOG_NONE ) level = CK_LOG_NONE;612 else if( level < CK_LOG_NONE ) level = CK_LOG_NONE;
611 g_loglevel = level;613 g_loglevel = level;
612 614
src/core/chuck_errmsg.h+7−7
@@ -46,14 +46,14 @@ extern t_CKBOOL EM_anyErrors; · 45 unmodified lines
46extern t_CKINT EM_tokPos;46extern t_CKINT EM_tokPos;
47extern t_CKINT EM_lineNum;47extern t_CKINT EM_lineNum;
48 48
49// EM_extLineNum is synced with EM_lineNum in lexer/parser phase, then synced 49// EM_extLineNum is synced with EM_lineNum in lexer/parser phase, then synced
50// with scanner/typechecker (EM_lineNum is not synced with scanner/typechecker)50// with scanner/typechecker (EM_lineNum is not synced with scanner/typechecker)
51extern t_CKINT EM_extLineNum; 51extern t_CKINT EM_extLineNum;
52 52
53void EM_newline( );53void EM_newline( );
54 54
55// levels55// levels
56#define CK_LOG_CRAZY 10 // set this to log everything56#define CK_LOG_ALL 10 // set this to log everything
57#define CK_LOG_FINEST 957#define CK_LOG_FINEST 9
58#define CK_LOG_FINER 858#define CK_LOG_FINER 8
59#define CK_LOG_FINE 759#define CK_LOG_FINE 7
@@ -155,9 +155,9 @@ extern t_CKINT g_loglevel; · 95 unmodified lines
155// macro to compare155// macro to compare
156#define DO_LOG(x) ( x <= g_loglevel )156#define DO_LOG(x) ( x <= g_loglevel )
157 157
158void EM_error( int, c_constr, ... );158void EM_error( t_CKINT, c_constr, ... );
159void EM_error2( int, c_constr, ... );159void EM_error2( t_CKINT, c_constr, ... );
160void EM_error2b( int, c_constr, ... );160void EM_error2b( t_CKINT, c_constr, ... );
161void EM_error3( c_constr, ... );161void EM_error3( c_constr, ... );
162void EM_impossible( c_constr, ... );162void EM_impossible( c_constr, ... );
163t_CKBOOL EM_reset( c_constr filename, FILE * fd );163t_CKBOOL EM_reset( c_constr filename, FILE * fd );
@@ -190,7 +190,7 @@ public: · 26 unmodified lines
190 {190 {
191 EM_pushlog();191 EM_pushlog();
192 }192 }
193 193
194 ~SmartPushLog()194 ~SmartPushLog()
195 {195 {
196 EM_poplog();196 EM_poplog();
src/core/chuck_frame.cpp+9−4
@@ -100,7 +100,7 @@ void Chuck_Frame::push_scope( ) · 99 unmodified lines
100// name: get_scope()100// name: get_scope()
101// desc: get current scope (added 1.3.0.0)101// desc: get current scope (added 1.3.0.0)
102//-----------------------------------------------------------------------------102//-----------------------------------------------------------------------------
103void Chuck_Frame::get_scope( vector<Chuck_Local *> & out ) const103void Chuck_Frame::get_scope( vector<Chuck_Local *> & out, bool localOnly ) const
104{104{
105 // sanity105 // sanity
106 assert( this->stack.size() > 0 );106 assert( this->stack.size() > 0 );
@@ -111,8 +111,13 @@ void Chuck_Frame::get_scope( vector<Chuck_Local *> & out ) const · 4 unmodified lines
111 t_CKINT index = this->stack.size() - 1;111 t_CKINT index = this->stack.size() - 1;
112 112
113 // loop113 // loop
114 while( index >= 0 && this->stack[index] != NULL )114 while( index >= 0 )
115 {115 {
116 // did we hit a stack boundary (delineated by NULL)
117 // localOnly option added 1.4.2.1 (ge) -- to get all scope in the frame
118 if( localOnly && this->stack[index] != NULL )
119 break;
120
116 // last thing121 // last thing
117 local = stack[index];122 local = stack[index];
118 // move123 // move
@@ -140,7 +145,7 @@ void Chuck_Frame::pop_scope( vector<Chuck_Local *> & out ) · 21 unmodified lines
140 145
141 // the local146 // the local
142 Chuck_Local * local = NULL;147 Chuck_Local * local = NULL;
143 148
144 // loop149 // loop
145 while( this->stack.size() && this->stack.back() )150 while( this->stack.size() && this->stack.back() )
146 {151 {
@@ -157,7 +162,7 @@ void Chuck_Frame::pop_scope( vector<Chuck_Local *> & out ) · 10 unmodified lines
157 out.push_back( local );162 out.push_back( local );
158 }163 }
159 }164 }
160 165
161 // sanity (should be at least one left)166 // sanity (should be at least one left)
162 assert( this->stack.size() > 0 );167 assert( this->stack.size() > 0 );
163 // get ride of null boundary character (added 1.3.0.0)168 // get ride of null boundary character (added 1.3.0.0)
src/core/chuck_frame.h+1−1
@@ -92,7 +92,7 @@ public: · 91 unmodified lines
92 Chuck_Local * alloc_local( t_CKUINT size, const std::string & name,92 Chuck_Local * alloc_local( t_CKUINT size, const std::string & name,
93 t_CKBOOL is_ref, t_CKBOOL is_obj, t_CKBOOL is_global );93 t_CKBOOL is_ref, t_CKBOOL is_obj, t_CKBOOL is_global );
94 // get the current scope (added 1.3.0.0)94 // get the current scope (added 1.3.0.0)
95 void get_scope( std::vector<Chuck_Local *> & out ) const;95 void get_scope( std::vector<Chuck_Local *> & out, bool localOnly = true ) const;
96 // pop scope96 // pop scope
97 void pop_scope( std::vector<Chuck_Local *> & out );97 void pop_scope( std::vector<Chuck_Local *> & out );
98};98};
src/core/chuck_globals.cpp+206−206
@@ -436,7 +436,7 @@ struct Chuck_Execute_Chuck_Msg_Request · 435 unmodified lines
436struct Chuck_Global_Int_Container436struct Chuck_Global_Int_Container
437{437{
438 t_CKINT val;438 t_CKINT val;
439 439
440 Chuck_Global_Int_Container() { val = 0; }440 Chuck_Global_Int_Container() { val = 0; }
441};441};
442 442
@@ -450,7 +450,7 @@ struct Chuck_Global_Int_Container · 7 unmodified lines
450struct Chuck_Global_Float_Container450struct Chuck_Global_Float_Container
451{451{
452 t_CKFLOAT val;452 t_CKFLOAT val;
453 453
454 Chuck_Global_Float_Container() { val = 0; }454 Chuck_Global_Float_Container() { val = 0; }
455};455};
456 456
@@ -464,7 +464,7 @@ struct Chuck_Global_Float_Container · 7 unmodified lines
464struct Chuck_Global_String_Container464struct Chuck_Global_String_Container
465{465{
466 Chuck_String * val;466 Chuck_String * val;
467 467
468 Chuck_Global_String_Container() { val = NULL; }468 Chuck_Global_String_Container() { val = NULL; }
469};469};
470 470
@@ -480,7 +480,7 @@ struct Chuck_Global_Event_Container · 9 unmodified lines
480 Chuck_Event * val;480 Chuck_Event * val;
481 Chuck_Type * type;481 Chuck_Type * type;
482 t_CKBOOL ctor_needs_to_be_called;482 t_CKBOOL ctor_needs_to_be_called;
483 483
484 Chuck_Global_Event_Container() { val = NULL; type = NULL;484 Chuck_Global_Event_Container() { val = NULL; type = NULL;
485 ctor_needs_to_be_called = TRUE; }485 ctor_needs_to_be_called = TRUE; }
486};486};
@@ -497,7 +497,7 @@ struct Chuck_Global_UGen_Container · 10 unmodified lines
497 Chuck_UGen * val;497 Chuck_UGen * val;
498 Chuck_Type * type;498 Chuck_Type * type;
499 t_CKBOOL ctor_needs_to_be_called;499 t_CKBOOL ctor_needs_to_be_called;
500 500
501 Chuck_Global_UGen_Container() { val = NULL; type = NULL;501 Chuck_Global_UGen_Container() { val = NULL; type = NULL;
502 ctor_needs_to_be_called = TRUE; }502 ctor_needs_to_be_called = TRUE; }
503};503};
@@ -514,7 +514,7 @@ struct Chuck_Global_Array_Container · 10 unmodified lines
514 Chuck_Object * array;514 Chuck_Object * array;
515 te_GlobalType array_type;515 te_GlobalType array_type;
516 t_CKBOOL ctor_needs_to_be_called;516 t_CKBOOL ctor_needs_to_be_called;
517 517
518 Chuck_Global_Array_Container( te_GlobalType arr_type )518 Chuck_Global_Array_Container( te_GlobalType arr_type )
519 {519 {
520 array = NULL;520 array = NULL;
@@ -535,7 +535,7 @@ struct Chuck_Global_Object_Container · 14 unmodified lines
535 Chuck_Object * val;535 Chuck_Object * val;
536 Chuck_Type * type;536 Chuck_Type * type;
537 t_CKBOOL ctor_needs_to_be_called;537 t_CKBOOL ctor_needs_to_be_called;
538 538
539 Chuck_Global_Object_Container() { val = NULL; type = NULL;539 Chuck_Global_Object_Container() { val = NULL; type = NULL;
540 ctor_needs_to_be_called = TRUE; }540 ctor_needs_to_be_called = TRUE; }
541};541};
@@ -551,7 +551,7 @@ Chuck_Globals_Manager::Chuck_Globals_Manager( Chuck_VM * vm ) · 9 unmodified lines
551{551{
552 // store552 // store
553 m_vm = vm;553 m_vm = vm;
554 554
555 // REFACTOR-2017: TODO might want to dynamically grow queue?555 // REFACTOR-2017: TODO might want to dynamically grow queue?
556 m_global_request_queue.init( 16384 );556 m_global_request_queue.init( 16384 );
557 m_global_request_retry_queue.init( 16384 );557 m_global_request_retry_queue.init( 16384 );
@@ -609,13 +609,13 @@ t_CKBOOL Chuck_Globals_Manager::getGlobalInt( const char * name, · 51 unmodified lines
609 get_int_message->name = name;609 get_int_message->name = name;
610 get_int_message->cb = callback;610 get_int_message->cb = callback;
611 get_int_message->cb_type = ck_get_plain;611 get_int_message->cb_type = ck_get_plain;
612 612
613 Chuck_Global_Request r;613 Chuck_Global_Request r;
614 r.type = get_global_int_request;614 r.type = get_global_int_request;
615 r.getIntRequest = get_int_message;615 r.getIntRequest = get_int_message;
616 616
617 m_global_request_queue.put( r );617 m_global_request_queue.put( r );
618 618
619 return TRUE;619 return TRUE;
620}620}
621 621
@@ -634,13 +634,13 @@ t_CKBOOL Chuck_Globals_Manager::getGlobalInt( const char * name, · 12 unmodified lines
634 get_int_message->name = name;634 get_int_message->name = name;
635 get_int_message->cb_with_name = callback;635 get_int_message->cb_with_name = callback;
636 get_int_message->cb_type = ck_get_name;636 get_int_message->cb_type = ck_get_name;
637 637
638 Chuck_Global_Request r;638 Chuck_Global_Request r;
639 r.type = get_global_int_request;639 r.type = get_global_int_request;
640 r.getIntRequest = get_int_message;640 r.getIntRequest = get_int_message;
641 641
642 m_global_request_queue.put( r );642 m_global_request_queue.put( r );
643 643
644 return TRUE;644 return TRUE;
645}645}
646 646
@@ -660,13 +660,13 @@ t_CKBOOL Chuck_Globals_Manager::getGlobalInt( const char * name, t_CKINT id, · 13 unmodified lines
660 get_int_message->cb_with_id = callback;660 get_int_message->cb_with_id = callback;
661 get_int_message->id = id;661 get_int_message->id = id;
662 get_int_message->cb_type = ck_get_id;662 get_int_message->cb_type = ck_get_id;
663 663
664 Chuck_Global_Request r;664 Chuck_Global_Request r;
665 r.type = get_global_int_request;665 r.type = get_global_int_request;
666 r.getIntRequest = get_int_message;666 r.getIntRequest = get_int_message;
667 667
668 m_global_request_queue.put( r );668 m_global_request_queue.put( r );
669 669
670 return TRUE;670 return TRUE;
671}671}
672 672
@@ -684,13 +684,13 @@ t_CKBOOL Chuck_Globals_Manager::setGlobalInt( const char * name, t_CKINT val ) · 11 unmodified lines
684 new Chuck_Set_Global_Int_Request;684 new Chuck_Set_Global_Int_Request;
685 set_int_message->name = name;685 set_int_message->name = name;
686 set_int_message->val = val;686 set_int_message->val = val;
687 687
688 Chuck_Global_Request r;688 Chuck_Global_Request r;
689 r.type = set_global_int_request;689 r.type = set_global_int_request;
690 r.setIntRequest = set_int_message;690 r.setIntRequest = set_int_message;
691 691
692 m_global_request_queue.put( r );692 m_global_request_queue.put( r );
693 693
694 return TRUE;694 return TRUE;
695}695}
696 696
@@ -707,7 +707,7 @@ t_CKBOOL Chuck_Globals_Manager::init_global_int( const std::string & name ) · 10 unmodified lines
707 {707 {
708 m_global_ints[name] = new Chuck_Global_Int_Container;708 m_global_ints[name] = new Chuck_Global_Int_Container;
709 }709 }
710 710
711 return TRUE;711 return TRUE;
712}712}
713 713
@@ -722,7 +722,7 @@ t_CKINT Chuck_Globals_Manager::get_global_int_value( const std::string & name ) · 8 unmodified lines
722{722{
723 // ensure exists723 // ensure exists
724 init_global_int( name );724 init_global_int( name );
725 725
726 return m_global_ints[name]->val;726 return m_global_ints[name]->val;
727}727}
728 728
@@ -753,13 +753,13 @@ t_CKBOOL Chuck_Globals_Manager::getGlobalFloat( const char * name, · 24 unmodified lines
753 get_float_message->name = name;753 get_float_message->name = name;
754 get_float_message->cb = callback;754 get_float_message->cb = callback;
755 get_float_message->cb_type = ck_get_plain;755 get_float_message->cb_type = ck_get_plain;
756 756
757 Chuck_Global_Request r;757 Chuck_Global_Request r;
758 r.type = get_global_float_request;758 r.type = get_global_float_request;
759 r.getFloatRequest = get_float_message;759 r.getFloatRequest = get_float_message;
760 760
761 m_global_request_queue.put( r );761 m_global_request_queue.put( r );
762 762
763 return TRUE;763 return TRUE;
764}764}
765 765
@@ -778,13 +778,13 @@ t_CKBOOL Chuck_Globals_Manager::getGlobalFloat( const char * name, · 12 unmodified lines
778 get_float_message->name = name;778 get_float_message->name = name;
779 get_float_message->cb_with_name = callback;779 get_float_message->cb_with_name = callback;
780 get_float_message->cb_type = ck_get_name;780 get_float_message->cb_type = ck_get_name;
781 781
782 Chuck_Global_Request r;782 Chuck_Global_Request r;
783 r.type = get_global_float_request;783 r.type = get_global_float_request;
784 r.getFloatRequest = get_float_message;784 r.getFloatRequest = get_float_message;
785 785
786 m_global_request_queue.put( r );786 m_global_request_queue.put( r );
787 787
788 return TRUE;788 return TRUE;
789}789}
790 790
@@ -804,13 +804,13 @@ t_CKBOOL Chuck_Globals_Manager::getGlobalFloat( const char * name, t_CKINT id, · 13 unmodified lines
804 get_float_message->cb_with_id = callback;804 get_float_message->cb_with_id = callback;
805 get_float_message->id = id;805 get_float_message->id = id;
806 get_float_message->cb_type = ck_get_id;806 get_float_message->cb_type = ck_get_id;
807 807
808 Chuck_Global_Request r;808 Chuck_Global_Request r;
809 r.type = get_global_float_request;809 r.type = get_global_float_request;
810 r.getFloatRequest = get_float_message;810 r.getFloatRequest = get_float_message;
811 811
812 m_global_request_queue.put( r );812 m_global_request_queue.put( r );
813 813
814 return TRUE;814 return TRUE;
815}815}
816 816
@@ -828,13 +828,13 @@ t_CKBOOL Chuck_Globals_Manager::setGlobalFloat( const char * name, · 11 unmodified lines
828 new Chuck_Set_Global_Float_Request;828 new Chuck_Set_Global_Float_Request;
829 set_float_message->name = name;829 set_float_message->name = name;
830 set_float_message->val = val;830 set_float_message->val = val;
831 831
832 Chuck_Global_Request r;832 Chuck_Global_Request r;
833 r.type = set_global_float_request;833 r.type = set_global_float_request;
834 r.setFloatRequest = set_float_message;834 r.setFloatRequest = set_float_message;
835 835
836 m_global_request_queue.put( r );836 m_global_request_queue.put( r );
837 837
838 return TRUE;838 return TRUE;
839}839}
840 840
@@ -851,7 +851,7 @@ t_CKBOOL Chuck_Globals_Manager::init_global_float( const std::string & name ) · 10 unmodified lines
851 {851 {
852 m_global_floats[name] = new Chuck_Global_Float_Container;852 m_global_floats[name] = new Chuck_Global_Float_Container;
853 }853 }
854 854
855 return TRUE;855 return TRUE;
856}856}
857 857
@@ -866,7 +866,7 @@ t_CKFLOAT Chuck_Globals_Manager::get_global_float_value( const std::string & nam · 8 unmodified lines
866{866{
867 // ensure exists867 // ensure exists
868 init_global_float( name );868 init_global_float( name );
869 869
870 return m_global_floats[name]->val;870 return m_global_floats[name]->val;
871}871}
872 872
@@ -897,13 +897,13 @@ t_CKBOOL Chuck_Globals_Manager::getGlobalString( const char * name, · 24 unmodified lines
897 get_string_message->name = name;897 get_string_message->name = name;
898 get_string_message->cb = callback;898 get_string_message->cb = callback;
899 get_string_message->cb_type = ck_get_plain;899 get_string_message->cb_type = ck_get_plain;
900 900
901 Chuck_Global_Request r;901 Chuck_Global_Request r;
902 r.type = get_global_string_request;902 r.type = get_global_string_request;
903 r.getStringRequest = get_string_message;903 r.getStringRequest = get_string_message;
904 904
905 m_global_request_queue.put( r );905 m_global_request_queue.put( r );
906 906
907 return TRUE;907 return TRUE;
908}908}
909 909
@@ -922,13 +922,13 @@ t_CKBOOL Chuck_Globals_Manager::getGlobalString( const char * name, · 12 unmodified lines
922 get_string_message->name = name;922 get_string_message->name = name;
923 get_string_message->cb_with_name = callback;923 get_string_message->cb_with_name = callback;
924 get_string_message->cb_type = ck_get_name;924 get_string_message->cb_type = ck_get_name;
925 925
926 Chuck_Global_Request r;926 Chuck_Global_Request r;
927 r.type = get_global_string_request;927 r.type = get_global_string_request;
928 r.getStringRequest = get_string_message;928 r.getStringRequest = get_string_message;
929 929
930 m_global_request_queue.put( r );930 m_global_request_queue.put( r );
931 931
932 return TRUE;932 return TRUE;
933}933}
934 934
@@ -948,13 +948,13 @@ t_CKBOOL Chuck_Globals_Manager::getGlobalString( const char * name, t_CKINT id, · 13 unmodified lines
948 get_string_message->cb_with_id = callback;948 get_string_message->cb_with_id = callback;
949 get_string_message->id = id;949 get_string_message->id = id;
950 get_string_message->cb_type = ck_get_id;950 get_string_message->cb_type = ck_get_id;
951 951
952 Chuck_Global_Request r;952 Chuck_Global_Request r;
953 r.type = get_global_string_request;953 r.type = get_global_string_request;
954 r.getStringRequest = get_string_message;954 r.getStringRequest = get_string_message;
955 955
956 m_global_request_queue.put( r );956 m_global_request_queue.put( r );
957 957
958 return TRUE;958 return TRUE;
959}959}
960 960
@@ -972,13 +972,13 @@ t_CKBOOL Chuck_Globals_Manager::setGlobalString( const char * name, · 11 unmodified lines
972 new Chuck_Set_Global_String_Request;972 new Chuck_Set_Global_String_Request;
973 set_string_message->name = name;973 set_string_message->name = name;
974 set_string_message->val = val;974 set_string_message->val = val;
975 975
976 Chuck_Global_Request r;976 Chuck_Global_Request r;
977 r.type = set_global_string_request;977 r.type = set_global_string_request;
978 r.setStringRequest = set_string_message;978 r.setStringRequest = set_string_message;
979 979
980 m_global_request_queue.put( r );980 m_global_request_queue.put( r );
981 981
982 return TRUE;982 return TRUE;
983}983}
984 984
@@ -998,12 +998,12 @@ t_CKBOOL Chuck_Globals_Manager::init_global_string( const std::string & name ) · 13 unmodified lines
998 // init998 // init
999 m_global_strings[name]->val = (Chuck_String *)999 m_global_strings[name]->val = (Chuck_String *)
1000 instantiate_and_initialize_object( m_vm->env()->t_string, m_vm );1000 instantiate_and_initialize_object( m_vm->env()->t_string, m_vm );
1001 1001
1002 // add reference to prevent deletion1002 // add reference to prevent deletion
1003 m_global_strings[name]->val->add_ref();1003 m_global_strings[name]->val->add_ref();
1004 1004
1005 }1005 }
1006 1006
1007 return TRUE;1007 return TRUE;
1008}1008}
1009 1009
@@ -1018,7 +1018,7 @@ Chuck_String * Chuck_Globals_Manager::get_global_string( const std::string & nam · 8 unmodified lines
1018{1018{
1019 // ensure exists1019 // ensure exists
1020 init_global_string( name );1020 init_global_string( name );
1021 1021
1022 return m_global_strings[name]->val;1022 return m_global_strings[name]->val;
1023}1023}
1024 1024
@@ -1047,13 +1047,13 @@ t_CKBOOL Chuck_Globals_Manager::signalGlobalEvent( const char * name ) · 22 unmodified lines
1047 new Chuck_Signal_Global_Event_Request;1047 new Chuck_Signal_Global_Event_Request;
1048 signal_event_message->name = name;1048 signal_event_message->name = name;
1049 signal_event_message->is_broadcast = FALSE;1049 signal_event_message->is_broadcast = FALSE;
1050 1050
1051 Chuck_Global_Request r;1051 Chuck_Global_Request r;
1052 r.type = signal_global_event_request;1052 r.type = signal_global_event_request;
1053 r.signalEventRequest = signal_event_message;1053 r.signalEventRequest = signal_event_message;
1054 1054
1055 m_global_request_queue.put( r );1055 m_global_request_queue.put( r );
1056 1056
1057 return TRUE;1057 return TRUE;
1058}1058}
1059 1059
@@ -1070,15 +1070,15 @@ t_CKBOOL Chuck_Globals_Manager::broadcastGlobalEvent( const char * name ) · 10 unmodified lines
1070 new Chuck_Signal_Global_Event_Request;1070 new Chuck_Signal_Global_Event_Request;
1071 signal_event_message->name = name;1071 signal_event_message->name = name;
1072 signal_event_message->is_broadcast = TRUE;1072 signal_event_message->is_broadcast = TRUE;
1073 1073
1074 Chuck_Global_Request r;1074 Chuck_Global_Request r;
1075 r.type = signal_global_event_request;1075 r.type = signal_global_event_request;
1076 r.signalEventRequest = signal_event_message;1076 r.signalEventRequest = signal_event_message;
1077 // chuck object might not be constructed on time. retry only once1077 // chuck object might not be constructed on time. retry only once
1078 r.retries = 1;1078 r.retries = 1;
1079 1079
1080 m_global_request_queue.put( r );1080 m_global_request_queue.put( r );
1081 1081
1082 return TRUE;1082 return TRUE;
1083}1083}
1084 1084
@@ -1099,15 +1099,15 @@ t_CKBOOL Chuck_Globals_Manager::listenForGlobalEvent( const char * name, · 14 unmodified lines
1099 listen_event_message->name = name;1099 listen_event_message->name = name;
1100 listen_event_message->listen_forever = listen_forever;1100 listen_event_message->listen_forever = listen_forever;
1101 listen_event_message->deregister = FALSE;1101 listen_event_message->deregister = FALSE;
1102 1102
1103 Chuck_Global_Request r;1103 Chuck_Global_Request r;
1104 r.type = listen_for_global_event_request;1104 r.type = listen_for_global_event_request;
1105 r.listenForEventRequest = listen_event_message;1105 r.listenForEventRequest = listen_event_message;
1106 // chuck object might not be constructed on time. retry only once1106 // chuck object might not be constructed on time. retry only once
1107 r.retries = 1;1107 r.retries = 1;
1108 1108
1109 m_global_request_queue.put( r );1109 m_global_request_queue.put( r );
1110 1110
1111 return TRUE;1111 return TRUE;
1112}1112}
1113 1113
@@ -1129,15 +1129,15 @@ t_CKBOOL Chuck_Globals_Manager::listenForGlobalEvent( const char * name, · 15 unmodified lines
1129 listen_event_message->name = name;1129 listen_event_message->name = name;
1130 listen_event_message->listen_forever = listen_forever;1130 listen_event_message->listen_forever = listen_forever;
1131 listen_event_message->deregister = FALSE;1131 listen_event_message->deregister = FALSE;
1132 1132
1133 Chuck_Global_Request r;1133 Chuck_Global_Request r;
1134 r.type = listen_for_global_event_request;1134 r.type = listen_for_global_event_request;
1135 r.listenForEventRequest = listen_event_message;1135 r.listenForEventRequest = listen_event_message;
1136 // chuck object might not be constructed on time. retry only once1136 // chuck object might not be constructed on time. retry only once
1137 r.retries = 1;1137 r.retries = 1;
1138 1138
1139 m_global_request_queue.put( r );1139 m_global_request_queue.put( r );
1140 1140
1141 return TRUE;1141 return TRUE;
1142}1142}
1143 1143
@@ -1161,15 +1161,15 @@ t_CKBOOL Chuck_Globals_Manager::listenForGlobalEvent( const char * name, · 17 unmodified lines
1161 listen_event_message->name = name;1161 listen_event_message->name = name;
1162 listen_event_message->listen_forever = listen_forever;1162 listen_event_message->listen_forever = listen_forever;
1163 listen_event_message->deregister = FALSE;1163 listen_event_message->deregister = FALSE;
1164 1164
1165 Chuck_Global_Request r;1165 Chuck_Global_Request r;
1166 r.type = listen_for_global_event_request;1166 r.type = listen_for_global_event_request;
1167 r.listenForEventRequest = listen_event_message;1167 r.listenForEventRequest = listen_event_message;
1168 // chuck object might not be constructed on time. retry only once1168 // chuck object might not be constructed on time. retry only once
1169 r.retries = 1;1169 r.retries = 1;
1170 1170
1171 m_global_request_queue.put( r );1171 m_global_request_queue.put( r );
1172 1172
1173 return TRUE;1173 return TRUE;
1174}1174}
1175 1175
@@ -1190,13 +1190,13 @@ t_CKBOOL Chuck_Globals_Manager::stopListeningForGlobalEvent( const char * name, · 14 unmodified lines
1190 listen_event_message->name = name;1190 listen_event_message->name = name;
1191 listen_event_message->listen_forever = FALSE;1191 listen_event_message->listen_forever = FALSE;
1192 listen_event_message->deregister = TRUE;1192 listen_event_message->deregister = TRUE;
1193 1193
1194 Chuck_Global_Request r;1194 Chuck_Global_Request r;
1195 r.type = listen_for_global_event_request;1195 r.type = listen_for_global_event_request;
1196 r.listenForEventRequest = listen_event_message;1196 r.listenForEventRequest = listen_event_message;
1197 1197
1198 m_global_request_queue.put( r );1198 m_global_request_queue.put( r );
1199 1199
1200 return TRUE;1200 return TRUE;
1201}1201}
1202 1202
@@ -1217,13 +1217,13 @@ t_CKBOOL Chuck_Globals_Manager::stopListeningForGlobalEvent( const char * name, · 14 unmodified lines
1217 listen_event_message->name = name;1217 listen_event_message->name = name;
1218 listen_event_message->listen_forever = FALSE;1218 listen_event_message->listen_forever = FALSE;
1219 listen_event_message->deregister = TRUE;1219 listen_event_message->deregister = TRUE;
1220 1220
1221 Chuck_Global_Request r;1221 Chuck_Global_Request r;
1222 r.type = listen_for_global_event_request;1222 r.type = listen_for_global_event_request;
1223 r.listenForEventRequest = listen_event_message;1223 r.listenForEventRequest = listen_event_message;
1224 1224
1225 m_global_request_queue.put( r );1225 m_global_request_queue.put( r );
1226 1226
1227 return TRUE;1227 return TRUE;
1228}1228}
1229 1229
@@ -1245,13 +1245,13 @@ t_CKBOOL Chuck_Globals_Manager::stopListeningForGlobalEvent( const char * name, · 15 unmodified lines
1245 listen_event_message->name = name;1245 listen_event_message->name = name;
1246 listen_event_message->listen_forever = FALSE;1246 listen_event_message->listen_forever = FALSE;
1247 listen_event_message->deregister = TRUE;1247 listen_event_message->deregister = TRUE;
1248 1248
1249 Chuck_Global_Request r;1249 Chuck_Global_Request r;
1250 r.type = listen_for_global_event_request;1250 r.type = listen_for_global_event_request;
1251 r.listenForEventRequest = listen_event_message;1251 r.listenForEventRequest = listen_event_message;
1252 1252
1253 m_global_request_queue.put( r );1253 m_global_request_queue.put( r );
1254 1254
1255 return TRUE;1255 return TRUE;
1256}1256}
1257 1257
@@ -1284,7 +1284,7 @@ t_CKBOOL Chuck_Globals_Manager::init_global_event( const std::string & name, · 26 unmodified lines
1284 {1284 {
1285 return FALSE;1285 return FALSE;
1286 }1286 }
1287 1287
1288 return TRUE;1288 return TRUE;
1289}1289}
1290 1290
@@ -1329,10 +1329,10 @@ t_CKBOOL Chuck_Globals_Manager::getGlobalUGenSamples( const char * name, · 38 unmodified lines
1329 // fail without doing anything1329 // fail without doing anything
1330 return FALSE;1330 return FALSE;
1331 }1331 }
1332 1332
1333 // else, fill (if the ugen isn't buffered, then it will fill with zeroes)1333 // else, fill (if the ugen isn't buffered, then it will fill with zeroes)
1334 m_global_ugens[name]->val->get_buffer( buffer, numFrames );1334 m_global_ugens[name]->val->get_buffer( buffer, numFrames );
1335 1335
1336 return TRUE;1336 return TRUE;
1337}1337}
1338 1338
@@ -1346,7 +1346,7 @@ t_CKBOOL Chuck_Globals_Manager::getGlobalUGenSamples( const char * name, · 7 unmodified lines
1346t_CKBOOL Chuck_Globals_Manager::init_global_ugen( const std::string & name,1346t_CKBOOL Chuck_Globals_Manager::init_global_ugen( const std::string & name,
1347 Chuck_Type * type )1347 Chuck_Type * type )
1348{1348{
1349 1349
1350 // if it hasn't been initted yet1350 // if it hasn't been initted yet
1351 if( m_global_ugens.count( name ) == 0 )1351 if( m_global_ugens.count( name ) == 0 )
1352 {1352 {
@@ -1366,7 +1366,7 @@ t_CKBOOL Chuck_Globals_Manager::init_global_ugen( const std::string & name, · 13 unmodified lines
1366 {1366 {
1367 return FALSE;1367 return FALSE;
1368 }1368 }
1369 1369
1370 return TRUE;1370 return TRUE;
1371}1371}
1372 1372
@@ -1439,15 +1439,15 @@ t_CKBOOL Chuck_Globals_Manager::setGlobalIntArray( const char * name, · 66 unmodified lines
1439 {1439 {
1440 message->arrayValues[i] = arrayValues[i];1440 message->arrayValues[i] = arrayValues[i];
1441 }1441 }
1442 1442
1443 Chuck_Global_Request r;1443 Chuck_Global_Request r;
1444 r.type = set_global_int_array_request;1444 r.type = set_global_int_array_request;
1445 r.setIntArrayRequest = message;1445 r.setIntArrayRequest = message;
1446 // chuck object might not be constructed on time. retry only once1446 // chuck object might not be constructed on time. retry only once
1447 r.retries = 1;1447 r.retries = 1;
1448 1448
1449 m_global_request_queue.put( r );1449 m_global_request_queue.put( r );
1450 1450
1451 return TRUE;1451 return TRUE;
1452}1452}
1453 1453
@@ -1466,15 +1466,15 @@ t_CKBOOL Chuck_Globals_Manager::getGlobalIntArray( const char * name, · 12 unmodified lines
1466 message->name = name;1466 message->name = name;
1467 message->cb = callback;1467 message->cb = callback;
1468 message->cb_type = ck_get_plain;1468 message->cb_type = ck_get_plain;
1469 1469
1470 Chuck_Global_Request r;1470 Chuck_Global_Request r;
1471 r.type = get_global_int_array_request;1471 r.type = get_global_int_array_request;
1472 r.getIntArrayRequest = message;1472 r.getIntArrayRequest = message;
1473 // chuck object might not be constructed on time. retry only once1473 // chuck object might not be constructed on time. retry only once
1474 r.retries = 1;1474 r.retries = 1;
1475 1475
1476 m_global_request_queue.put( r );1476 m_global_request_queue.put( r );
1477 1477
1478 return TRUE;1478 return TRUE;
1479}1479}
1480 1480
@@ -1493,15 +1493,15 @@ t_CKBOOL Chuck_Globals_Manager::getGlobalIntArray( const char * name, · 12 unmodified lines
1493 message->name = name;1493 message->name = name;
1494 message->cb_with_name = callback;1494 message->cb_with_name = callback;
1495 message->cb_type = ck_get_name;1495 message->cb_type = ck_get_name;
1496 1496
1497 Chuck_Global_Request r;1497 Chuck_Global_Request r;
1498 r.type = get_global_int_array_request;1498 r.type = get_global_int_array_request;
1499 r.getIntArrayRequest = message;1499 r.getIntArrayRequest = message;
1500 // chuck object might not be constructed on time. retry only once1500 // chuck object might not be constructed on time. retry only once
1501 r.retries = 1;1501 r.retries = 1;
1502 1502
1503 m_global_request_queue.put( r );1503 m_global_request_queue.put( r );
1504 1504
1505 return TRUE;1505 return TRUE;
1506}1506}
1507 1507
@@ -1521,15 +1521,15 @@ t_CKBOOL Chuck_Globals_Manager::getGlobalIntArray( const char * name, · 13 unmodified lines
1521 message->cb_with_id = callback;1521 message->cb_with_id = callback;
1522 message->id = id;1522 message->id = id;
1523 message->cb_type = ck_get_id;1523 message->cb_type = ck_get_id;
1524 1524
1525 Chuck_Global_Request r;1525 Chuck_Global_Request r;
1526 r.type = get_global_int_array_request;1526 r.type = get_global_int_array_request;
1527 r.getIntArrayRequest = message;1527 r.getIntArrayRequest = message;
1528 // chuck object might not be constructed on time. retry only once1528 // chuck object might not be constructed on time. retry only once
1529 r.retries = 1;1529 r.retries = 1;
1530 1530
1531 m_global_request_queue.put( r );1531 m_global_request_queue.put( r );
1532 1532
1533 return TRUE;1533 return TRUE;
1534}1534}
1535 1535
@@ -1548,15 +1548,15 @@ t_CKBOOL Chuck_Globals_Manager::setGlobalIntArrayValue( const char * name, · 12 unmodified lines
1548 message->name = name;1548 message->name = name;
1549 message->index = index;1549 message->index = index;
1550 message->value = value;1550 message->value = value;
1551 1551
1552 Chuck_Global_Request r;1552 Chuck_Global_Request r;
1553 r.type = set_global_int_array_value_request;1553 r.type = set_global_int_array_value_request;
1554 r.setIntArrayValueRequest = message;1554 r.setIntArrayValueRequest = message;
1555 // chuck object might not be constructed on time. retry only once1555 // chuck object might not be constructed on time. retry only once
1556 r.retries = 1;1556 r.retries = 1;
1557 1557
1558 m_global_request_queue.put( r );1558 m_global_request_queue.put( r );
1559 1559
1560 return TRUE;1560 return TRUE;
1561}1561}
1562 1562
@@ -1576,15 +1576,15 @@ t_CKBOOL Chuck_Globals_Manager::getGlobalIntArrayValue( const char * name, · 13 unmodified lines
1576 message->index = index;1576 message->index = index;
1577 message->cb = callback;1577 message->cb = callback;
1578 message->cb_type = ck_get_plain;1578 message->cb_type = ck_get_plain;
1579 1579
1580 Chuck_Global_Request r;1580 Chuck_Global_Request r;
1581 r.type = get_global_int_array_value_request;1581 r.type = get_global_int_array_value_request;
1582 r.getIntArrayValueRequest = message;1582 r.getIntArrayValueRequest = message;
1583 // chuck object might not be constructed on time. retry only once1583 // chuck object might not be constructed on time. retry only once
1584 r.retries = 1;1584 r.retries = 1;
1585 1585
1586 m_global_request_queue.put( r );1586 m_global_request_queue.put( r );
1587 1587
1588 return TRUE;1588 return TRUE;
1589}1589}
1590 1590
@@ -1604,15 +1604,15 @@ t_CKBOOL Chuck_Globals_Manager::getGlobalIntArrayValue( const char * name, · 13 unmodified lines
1604 message->index = index;1604 message->index = index;
1605 message->cb_with_name = callback;1605 message->cb_with_name = callback;
1606 message->cb_type = ck_get_name;1606 message->cb_type = ck_get_name;
1607 1607
1608 Chuck_Global_Request r;1608 Chuck_Global_Request r;
1609 r.type = get_global_int_array_value_request;1609 r.type = get_global_int_array_value_request;
1610 r.getIntArrayValueRequest = message;1610 r.getIntArrayValueRequest = message;
1611 // chuck object might not be constructed on time. retry only once1611 // chuck object might not be constructed on time. retry only once
1612 r.retries = 1;1612 r.retries = 1;
1613 1613
1614 m_global_request_queue.put( r );1614 m_global_request_queue.put( r );
1615 1615
1616 return TRUE;1616 return TRUE;
1617}1617}
1618 1618
@@ -1633,15 +1633,15 @@ t_CKBOOL Chuck_Globals_Manager::getGlobalIntArrayValue( const char * name, · 14 unmodified lines
1633 message->cb_with_id = callback;1633 message->cb_with_id = callback;
1634 message->id = id;1634 message->id = id;
1635 message->cb_type = ck_get_id;1635 message->cb_type = ck_get_id;
1636 1636
1637 Chuck_Global_Request r;1637 Chuck_Global_Request r;
1638 r.type = get_global_int_array_value_request;1638 r.type = get_global_int_array_value_request;
1639 r.getIntArrayValueRequest = message;1639 r.getIntArrayValueRequest = message;
1640 // chuck object might not be constructed on time. retry only once1640 // chuck object might not be constructed on time. retry only once
1641 r.retries = 1;1641 r.retries = 1;
1642 1642
1643 m_global_request_queue.put( r );1643 m_global_request_queue.put( r );
1644 1644
1645 return TRUE;1645 return TRUE;
1646}1646}
1647 1647
@@ -1660,15 +1660,15 @@ t_CKBOOL Chuck_Globals_Manager::setGlobalAssociativeIntArrayValue( · 12 unmodified lines
1660 message->name = name;1660 message->name = name;
1661 message->key = key;1661 message->key = key;
1662 message->value = value;1662 message->value = value;
1663 1663
1664 Chuck_Global_Request r;1664 Chuck_Global_Request r;
1665 r.type = set_global_associative_int_array_value_request;1665 r.type = set_global_associative_int_array_value_request;
1666 r.setAssociativeIntArrayValueRequest = message;1666 r.setAssociativeIntArrayValueRequest = message;
1667 // chuck object might not be constructed on time. retry only once1667 // chuck object might not be constructed on time. retry only once
1668 r.retries = 1;1668 r.retries = 1;
1669 1669
1670 m_global_request_queue.put( r );1670 m_global_request_queue.put( r );
1671 1671
1672 return TRUE;1672 return TRUE;
1673}1673}
1674 1674
@@ -1688,15 +1688,15 @@ t_CKBOOL Chuck_Globals_Manager::getGlobalAssociativeIntArrayValue( · 13 unmodified lines
1688 message->key = key;1688 message->key = key;
1689 message->cb = callback;1689 message->cb = callback;
1690 message->cb_type = ck_get_plain;1690 message->cb_type = ck_get_plain;
1691 1691
1692 Chuck_Global_Request r;1692 Chuck_Global_Request r;
1693 r.type = get_global_associative_int_array_value_request;1693 r.type = get_global_associative_int_array_value_request;
1694 r.getAssociativeIntArrayValueRequest = message;1694 r.getAssociativeIntArrayValueRequest = message;
1695 // chuck object might not be constructed on time. retry only once1695 // chuck object might not be constructed on time. retry only once
1696 r.retries = 1;1696 r.retries = 1;
1697 1697
1698 m_global_request_queue.put( r );1698 m_global_request_queue.put( r );
1699 1699
1700 return TRUE;1700 return TRUE;
1701}1701}
1702 1702
@@ -1716,15 +1716,15 @@ t_CKBOOL Chuck_Globals_Manager::getGlobalAssociativeIntArrayValue( const char * · 13 unmodified lines
1716 message->key = key;1716 message->key = key;
1717 message->cb_with_name = callback;1717 message->cb_with_name = callback;
1718 message->cb_type = ck_get_name;1718 message->cb_type = ck_get_name;
1719 1719
1720 Chuck_Global_Request r;1720 Chuck_Global_Request r;
1721 r.type = get_global_associative_int_array_value_request;1721 r.type = get_global_associative_int_array_value_request;
1722 r.getAssociativeIntArrayValueRequest = message;1722 r.getAssociativeIntArrayValueRequest = message;
1723 // chuck object might not be constructed on time. retry only once1723 // chuck object might not be constructed on time. retry only once
1724 r.retries = 1;1724 r.retries = 1;
1725 1725
1726 m_global_request_queue.put( r );1726 m_global_request_queue.put( r );
1727 1727
1728 return TRUE;1728 return TRUE;
1729}1729}
1730 1730
@@ -1745,15 +1745,15 @@ t_CKBOOL Chuck_Globals_Manager::getGlobalAssociativeIntArrayValue( const char * · 14 unmodified lines
1745 message->cb_with_id = callback;1745 message->cb_with_id = callback;
1746 message->id = id;1746 message->id = id;
1747 message->cb_type = ck_get_id;1747 message->cb_type = ck_get_id;
1748 1748
1749 Chuck_Global_Request r;1749 Chuck_Global_Request r;
1750 r.type = get_global_associative_int_array_value_request;1750 r.type = get_global_associative_int_array_value_request;
1751 r.getAssociativeIntArrayValueRequest = message;1751 r.getAssociativeIntArrayValueRequest = message;
1752 // chuck object might not be constructed on time. retry only once1752 // chuck object might not be constructed on time. retry only once
1753 r.retries = 1;1753 r.retries = 1;
1754 1754
1755 m_global_request_queue.put( r );1755 m_global_request_queue.put( r );
1756 1756
1757 return TRUE;1757 return TRUE;
1758}1758}
1759 1759
@@ -1775,15 +1775,15 @@ t_CKBOOL Chuck_Globals_Manager::setGlobalFloatArray( const char * name, · 15 unmodified lines
1775 {1775 {
1776 message->arrayValues[i] = arrayValues[i];1776 message->arrayValues[i] = arrayValues[i];
1777 }1777 }
1778 1778
1779 Chuck_Global_Request r;1779 Chuck_Global_Request r;
1780 r.type = set_global_float_array_request;1780 r.type = set_global_float_array_request;
1781 r.setFloatArrayRequest = message;1781 r.setFloatArrayRequest = message;
1782 // chuck object might not be constructed on time. retry only once1782 // chuck object might not be constructed on time. retry only once
1783 r.retries = 1;1783 r.retries = 1;
1784 1784
1785 m_global_request_queue.put( r );1785 m_global_request_queue.put( r );
1786 1786
1787 return TRUE;1787 return TRUE;
1788}1788}
1789 1789
@@ -1802,15 +1802,15 @@ t_CKBOOL Chuck_Globals_Manager::getGlobalFloatArray( const char * name, · 12 unmodified lines
1802 message->name = name;1802 message->name = name;
1803 message->cb = callback;1803 message->cb = callback;
1804 message->cb_type = ck_get_plain;1804 message->cb_type = ck_get_plain;
1805 1805
1806 Chuck_Global_Request r;1806 Chuck_Global_Request r;
1807 r.type = get_global_float_array_request;1807 r.type = get_global_float_array_request;
1808 r.getFloatArrayRequest = message;1808 r.getFloatArrayRequest = message;
1809 // chuck object might not be constructed on time. retry only once1809 // chuck object might not be constructed on time. retry only once
1810 r.retries = 1;1810 r.retries = 1;
1811 1811
1812 m_global_request_queue.put( r );1812 m_global_request_queue.put( r );
1813 1813
1814 return TRUE;1814 return TRUE;
1815}1815}
1816 1816
@@ -1829,15 +1829,15 @@ t_CKBOOL Chuck_Globals_Manager::getGlobalFloatArray( const char * name, · 12 unmodified lines
1829 message->name = name;1829 message->name = name;
1830 message->cb_with_name = callback;1830 message->cb_with_name = callback;
1831 message->cb_type = ck_get_name;1831 message->cb_type = ck_get_name;
1832 1832
1833 Chuck_Global_Request r;1833 Chuck_Global_Request r;
1834 r.type = get_global_float_array_request;1834 r.type = get_global_float_array_request;
1835 r.getFloatArrayRequest = message;1835 r.getFloatArrayRequest = message;
1836 // chuck object might not be constructed on time. retry only once1836 // chuck object might not be constructed on time. retry only once
1837 r.retries = 1;1837 r.retries = 1;
1838 1838
1839 m_global_request_queue.put( r );1839 m_global_request_queue.put( r );
1840 1840
1841 return TRUE;1841 return TRUE;
1842}1842}
1843 1843
@@ -1857,15 +1857,15 @@ t_CKBOOL Chuck_Globals_Manager::getGlobalFloatArray( const char * name, · 13 unmodified lines
1857 message->cb_with_id = callback;1857 message->cb_with_id = callback;
1858 message->id = id;1858 message->id = id;
1859 message->cb_type = ck_get_id;1859 message->cb_type = ck_get_id;
1860 1860
1861 Chuck_Global_Request r;1861 Chuck_Global_Request r;
1862 r.type = get_global_float_array_request;1862 r.type = get_global_float_array_request;
1863 r.getFloatArrayRequest = message;1863 r.getFloatArrayRequest = message;
1864 // chuck object might not be constructed on time. retry only once1864 // chuck object might not be constructed on time. retry only once
1865 r.retries = 1;1865 r.retries = 1;
1866 1866
1867 m_global_request_queue.put( r );1867 m_global_request_queue.put( r );
1868 1868
1869 return TRUE;1869 return TRUE;
1870}1870}
1871 1871
@@ -1884,15 +1884,15 @@ t_CKBOOL Chuck_Globals_Manager::setGlobalFloatArrayValue( const char * name, · 12 unmodified lines
1884 message->name = name;1884 message->name = name;
1885 message->index = index;1885 message->index = index;
1886 message->value = value;1886 message->value = value;
1887 1887
1888 Chuck_Global_Request r;1888 Chuck_Global_Request r;
1889 r.type = set_global_float_array_value_request;1889 r.type = set_global_float_array_value_request;
1890 r.setFloatArrayValueRequest = message;1890 r.setFloatArrayValueRequest = message;
1891 // chuck object might not be constructed on time. retry only once1891 // chuck object might not be constructed on time. retry only once
1892 r.retries = 1;1892 r.retries = 1;
1893 1893
1894 m_global_request_queue.put( r );1894 m_global_request_queue.put( r );
1895 1895
1896 return TRUE;1896 return TRUE;
1897}1897}
1898 1898
@@ -1912,15 +1912,15 @@ t_CKBOOL Chuck_Globals_Manager::getGlobalFloatArrayValue( const char * name, · 13 unmodified lines
1912 message->index = index;1912 message->index = index;
1913 message->cb = callback;1913 message->cb = callback;
1914 message->cb_type = ck_get_plain;1914 message->cb_type = ck_get_plain;
1915 1915
1916 Chuck_Global_Request r;1916 Chuck_Global_Request r;
1917 r.type = get_global_float_array_value_request;1917 r.type = get_global_float_array_value_request;
1918 r.getFloatArrayValueRequest = message;1918 r.getFloatArrayValueRequest = message;
1919 // chuck object might not be constructed on time. retry only once1919 // chuck object might not be constructed on time. retry only once
1920 r.retries = 1;1920 r.retries = 1;
1921 1921
1922 m_global_request_queue.put( r );1922 m_global_request_queue.put( r );
1923 1923
1924 return TRUE;1924 return TRUE;
1925}1925}
1926 1926
@@ -1940,15 +1940,15 @@ t_CKBOOL Chuck_Globals_Manager::getGlobalFloatArrayValue( const char * name, · 13 unmodified lines
1940 message->index = index;1940 message->index = index;
1941 message->cb_with_name = callback;1941 message->cb_with_name = callback;
1942 message->cb_type = ck_get_name;1942 message->cb_type = ck_get_name;
1943 1943
1944 Chuck_Global_Request r;1944 Chuck_Global_Request r;
1945 r.type = get_global_float_array_value_request;1945 r.type = get_global_float_array_value_request;
1946 r.getFloatArrayValueRequest = message;1946 r.getFloatArrayValueRequest = message;
1947 // chuck object might not be constructed on time. retry only once1947 // chuck object might not be constructed on time. retry only once
1948 r.retries = 1;1948 r.retries = 1;
1949 1949
1950 m_global_request_queue.put( r );1950 m_global_request_queue.put( r );
1951 1951
1952 return TRUE;1952 return TRUE;
1953}1953}
1954 1954
@@ -1969,15 +1969,15 @@ t_CKBOOL Chuck_Globals_Manager::getGlobalFloatArrayValue( const char * name, · 14 unmodified lines
1969 message->cb_with_id = callback;1969 message->cb_with_id = callback;
1970 message->id = id;1970 message->id = id;
1971 message->cb_type = ck_get_id;1971 message->cb_type = ck_get_id;
1972 1972
1973 Chuck_Global_Request r;1973 Chuck_Global_Request r;
1974 r.type = get_global_float_array_value_request;1974 r.type = get_global_float_array_value_request;
1975 r.getFloatArrayValueRequest = message;1975 r.getFloatArrayValueRequest = message;
1976 // chuck object might not be constructed on time. retry only once1976 // chuck object might not be constructed on time. retry only once
1977 r.retries = 1;1977 r.retries = 1;
1978 1978
1979 m_global_request_queue.put( r );1979 m_global_request_queue.put( r );
1980 1980
1981 return TRUE;1981 return TRUE;
1982}1982}
1983 1983
@@ -1996,15 +1996,15 @@ t_CKBOOL Chuck_Globals_Manager::setGlobalAssociativeFloatArrayValue( const char · 12 unmodified lines
1996 message->name = name;1996 message->name = name;
1997 message->key = key;1997 message->key = key;
1998 message->value = value;1998 message->value = value;
1999 1999
2000 Chuck_Global_Request r;2000 Chuck_Global_Request r;
2001 r.type = set_global_associative_float_array_value_request;2001 r.type = set_global_associative_float_array_value_request;
2002 r.setAssociativeFloatArrayValueRequest = message;2002 r.setAssociativeFloatArrayValueRequest = message;
2003 // chuck object might not be constructed on time. retry only once2003 // chuck object might not be constructed on time. retry only once
2004 r.retries = 1;2004 r.retries = 1;
2005 2005
2006 m_global_request_queue.put( r );2006 m_global_request_queue.put( r );
2007 2007
2008 return TRUE;2008 return TRUE;
2009}2009}
2010 2010
@@ -2024,15 +2024,15 @@ t_CKBOOL Chuck_Globals_Manager::getGlobalAssociativeFloatArrayValue( const char · 13 unmodified lines
2024 message->key = key;2024 message->key = key;
2025 message->cb = callback;2025 message->cb = callback;
2026 message->cb_type = ck_get_plain;2026 message->cb_type = ck_get_plain;
2027 2027
2028 Chuck_Global_Request r;2028 Chuck_Global_Request r;
2029 r.type = get_global_associative_float_array_value_request;2029 r.type = get_global_associative_float_array_value_request;
2030 r.getAssociativeFloatArrayValueRequest = message;2030 r.getAssociativeFloatArrayValueRequest = message;
2031 // chuck object might not be constructed on time. retry only once2031 // chuck object might not be constructed on time. retry only once
2032 r.retries = 1;2032 r.retries = 1;
2033 2033
2034 m_global_request_queue.put( r );2034 m_global_request_queue.put( r );
2035 2035
2036 return TRUE;2036 return TRUE;
2037}2037}
2038 2038
@@ -2052,15 +2052,15 @@ t_CKBOOL Chuck_Globals_Manager::getGlobalAssociativeFloatArrayValue( const char · 13 unmodified lines
2052 message->key = key;2052 message->key = key;
2053 message->cb_with_name = callback;2053 message->cb_with_name = callback;
2054 message->cb_type = ck_get_name;2054 message->cb_type = ck_get_name;
2055 2055
2056 Chuck_Global_Request r;2056 Chuck_Global_Request r;
2057 r.type = get_global_associative_float_array_value_request;2057 r.type = get_global_associative_float_array_value_request;
2058 r.getAssociativeFloatArrayValueRequest = message;2058 r.getAssociativeFloatArrayValueRequest = message;
2059 // chuck object might not be constructed on time. retry only once2059 // chuck object might not be constructed on time. retry only once
2060 r.retries = 1;2060 r.retries = 1;
2061 2061
2062 m_global_request_queue.put( r );2062 m_global_request_queue.put( r );
2063 2063
2064 return TRUE;2064 return TRUE;
2065}2065}
2066 2066
@@ -2082,15 +2082,15 @@ t_CKBOOL Chuck_Globals_Manager::getGlobalAssociativeFloatArrayValue( · 15 unmodified lines
2082 message->cb_with_id = callback;2082 message->cb_with_id = callback;
2083 message->id = id;2083 message->id = id;
2084 message->cb_type = ck_get_id;2084 message->cb_type = ck_get_id;
2085 2085
2086 Chuck_Global_Request r;2086 Chuck_Global_Request r;
2087 r.type = get_global_associative_float_array_value_request;2087 r.type = get_global_associative_float_array_value_request;
2088 r.getAssociativeFloatArrayValueRequest = message;2088 r.getAssociativeFloatArrayValueRequest = message;
2089 // chuck object might not be constructed on time. retry only once2089 // chuck object might not be constructed on time. retry only once
2090 r.retries = 1;2090 r.retries = 1;
2091 2091
2092 m_global_request_queue.put( r );2092 m_global_request_queue.put( r );
2093 2093
2094 return TRUE;2094 return TRUE;
2095}2095}
2096 2096
@@ -2106,14 +2106,14 @@ t_CKBOOL Chuck_Globals_Manager::execute_chuck_msg_with_globals( Chuck_Msg * msg · 9 unmodified lines
2106 Chuck_Execute_Chuck_Msg_Request * message =2106 Chuck_Execute_Chuck_Msg_Request * message =
2107 new Chuck_Execute_Chuck_Msg_Request;2107 new Chuck_Execute_Chuck_Msg_Request;
2108 message->msg = msg;2108 message->msg = msg;
2109 2109
2110 Chuck_Global_Request r;2110 Chuck_Global_Request r;
2111 r.type = execute_chuck_msg_request;2111 r.type = execute_chuck_msg_request;
2112 r.executeChuckMsgRequest = message;2112 r.executeChuckMsgRequest = message;
2113 r.retries = 0;2113 r.retries = 0;
2114 2114
2115 m_global_request_queue.put( r );2115 m_global_request_queue.put( r );
2116 2116
2117 return TRUE;2117 return TRUE;
2118}2118}
2119 2119
@@ -2139,7 +2139,7 @@ t_CKBOOL Chuck_Globals_Manager::init_global_array( const std::string & name, Chu · 19 unmodified lines
2139 // TODO: how to keep reference to prevent from being deleted if2139 // TODO: how to keep reference to prevent from being deleted if
2140 // a script ends and takes the array with it?2140 // a script ends and takes the array with it?
2141 }2141 }
2142 2142
2143 return TRUE;2143 return TRUE;
2144}2144}
2145 2145
@@ -2281,7 +2281,7 @@ t_CKBOOL Chuck_Globals_Manager::init_global_object( const std::string & name, · 135 unmodified lines
2281 {2281 {
2282 return FALSE;2282 return FALSE;
2283 }2283 }
2284 2284
2285 return TRUE;2285 return TRUE;
2286}2286}
2287 2287
@@ -2432,7 +2432,7 @@ void Chuck_Globals_Manager::cleanup_global_variables() · 144 unmodified lines
2432 delete (it->second);2432 delete (it->second);
2433 }2433 }
2434 m_global_ints.clear();2434 m_global_ints.clear();
2435 2435
2436 // floats: delete containers and clear map2436 // floats: delete containers and clear map
2437 for( std::map< std::string, Chuck_Global_Float_Container * >::iterator it=2437 for( std::map< std::string, Chuck_Global_Float_Container * >::iterator it=
2438 m_global_floats.begin(); it!=m_global_floats.end(); it++ )2438 m_global_floats.begin(); it!=m_global_floats.end(); it++ )
@@ -2440,7 +2440,7 @@ void Chuck_Globals_Manager::cleanup_global_variables() · 1 unmodified line
2440 delete (it->second);2440 delete (it->second);
2441 }2441 }
2442 m_global_floats.clear();2442 m_global_floats.clear();
2443 2443
2444 // strings: release strings, delete containers, and clear map2444 // strings: release strings, delete containers, and clear map
2445 for( std::map< std::string, Chuck_Global_String_Container * >::iterator it=2445 for( std::map< std::string, Chuck_Global_String_Container * >::iterator it=
2446 m_global_strings.begin(); it!=m_global_strings.end(); it++ )2446 m_global_strings.begin(); it!=m_global_strings.end(); it++ )
@@ -2449,7 +2449,7 @@ void Chuck_Globals_Manager::cleanup_global_variables() · 2 unmodified lines
2449 delete (it->second);2449 delete (it->second);
2450 }2450 }
2451 m_global_strings.clear();2451 m_global_strings.clear();
2452 2452
2453 // events: release events, delete containers, and clear map2453 // events: release events, delete containers, and clear map
2454 for( std::map< std::string, Chuck_Global_Event_Container * >::iterator it=2454 for( std::map< std::string, Chuck_Global_Event_Container * >::iterator it=
2455 m_global_events.begin(); it!=m_global_events.end(); it++ )2455 m_global_events.begin(); it!=m_global_events.end(); it++ )
@@ -2458,7 +2458,7 @@ void Chuck_Globals_Manager::cleanup_global_variables() · 2 unmodified lines
2458 delete (it->second);2458 delete (it->second);
2459 }2459 }
2460 m_global_events.clear();2460 m_global_events.clear();
2461 2461
2462 // ugens: release ugens, delete containers, and clear map2462 // ugens: release ugens, delete containers, and clear map
2463 for( std::map< std::string, Chuck_Global_UGen_Container * >::iterator it=2463 for( std::map< std::string, Chuck_Global_UGen_Container * >::iterator it=
2464 m_global_ugens.begin(); it!=m_global_ugens.end(); it++ )2464 m_global_ugens.begin(); it!=m_global_ugens.end(); it++ )
@@ -2467,7 +2467,7 @@ void Chuck_Globals_Manager::cleanup_global_variables() · 2 unmodified lines
2467 delete (it->second);2467 delete (it->second);
2468 }2468 }
2469 m_global_ugens.clear();2469 m_global_ugens.clear();
2470 2470
2471 // arrays: release arrays, delete containers, and clear map2471 // arrays: release arrays, delete containers, and clear map
2472 for( std::map< std::string, Chuck_Global_Array_Container * >::iterator it=2472 for( std::map< std::string, Chuck_Global_Array_Container * >::iterator it=
2473 m_global_arrays.begin(); it!=m_global_arrays.end(); it++ )2473 m_global_arrays.begin(); it!=m_global_arrays.end(); it++ )
@@ -2479,7 +2479,7 @@ void Chuck_Globals_Manager::cleanup_global_variables() · 5 unmodified lines
2479 delete (it->second);2479 delete (it->second);
2480 }2480 }
2481 m_global_arrays.clear();2481 m_global_arrays.clear();
2482 2482
2483 // ugens: release objects, delete containers, and clear map2483 // ugens: release objects, delete containers, and clear map
2484 for( std::map< std::string, Chuck_Global_Object_Container * >::iterator it=2484 for( std::map< std::string, Chuck_Global_Object_Container * >::iterator it=
2485 m_global_objects.begin(); it!=m_global_objects.end(); it++ )2485 m_global_objects.begin(); it!=m_global_objects.end(); it++ )
@@ -2500,11 +2500,11 @@ void Chuck_Globals_Manager::cleanup_global_variables() · 14 unmodified lines
2500void Chuck_Globals_Manager::handle_global_queue_messages()2500void Chuck_Globals_Manager::handle_global_queue_messages()
2501{2501{
2502 bool should_retry_this_request = false;2502 bool should_retry_this_request = false;
2503 2503
2504 while( m_global_request_queue.more() )2504 while( m_global_request_queue.more() )
2505 {2505 {
2506 should_retry_this_request = false;2506 should_retry_this_request = false;
2507 2507
2508 Chuck_Global_Request message;2508 Chuck_Global_Request message;
2509 if( m_global_request_queue.get( & message ) )2509 if( m_global_request_queue.get( & message ) )
2510 {2510 {
@@ -2519,12 +2519,12 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 8 unmodified lines
2519 // clean up request storage2519 // clean up request storage
2520 SAFE_DELETE( message.executeChuckMsgRequest );2520 SAFE_DELETE( message.executeChuckMsgRequest );
2521 break;2521 break;
2522 2522
2523 case spork_shred_request:2523 case spork_shred_request:
2524 // spork the shred!2524 // spork the shred!
2525 m_vm->spork( message.shred );2525 m_vm->spork( message.shred );
2526 break;2526 break;
2527 2527
2528 case set_global_int_request:2528 case set_global_int_request:
2529 // ensure the container exists2529 // ensure the container exists
2530 init_global_int( message.setIntRequest->name );2530 init_global_int( message.setIntRequest->name );
@@ -2533,7 +2533,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 2 unmodified lines
2533 // clean up request storage2533 // clean up request storage
2534 SAFE_DELETE( message.setIntRequest );2534 SAFE_DELETE( message.setIntRequest );
2535 break;2535 break;
2536 2536
2537 case get_global_int_request:2537 case get_global_int_request:
2538 // ensure one of the callbacks is not null (union)2538 // ensure one of the callbacks is not null (union)
2539 if( message.getIntRequest->cb != NULL )2539 if( message.getIntRequest->cb != NULL )
@@ -2557,7 +2557,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 17 unmodified lines
2557 // clean up request storage2557 // clean up request storage
2558 SAFE_DELETE( message.getIntRequest );2558 SAFE_DELETE( message.getIntRequest );
2559 break;2559 break;
2560 2560
2561 case set_global_float_request:2561 case set_global_float_request:
2562 // ensure the container exists2562 // ensure the container exists
2563 init_global_float( message.setFloatRequest->name );2563 init_global_float( message.setFloatRequest->name );
@@ -2566,7 +2566,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 2 unmodified lines
2566 // clean up request storage2566 // clean up request storage
2567 SAFE_DELETE( message.setFloatRequest );2567 SAFE_DELETE( message.setFloatRequest );
2568 break;2568 break;
2569 2569
2570 case get_global_float_request:2570 case get_global_float_request:
2571 // ensure one cb is not null (union)2571 // ensure one cb is not null (union)
2572 if( message.getFloatRequest->cb != NULL )2572 if( message.getFloatRequest->cb != NULL )
@@ -2590,7 +2590,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 17 unmodified lines
2590 // clean up request storage2590 // clean up request storage
2591 SAFE_DELETE( message.getFloatRequest );2591 SAFE_DELETE( message.getFloatRequest );
2592 break;2592 break;
2593 2593
2594 case set_global_string_request:2594 case set_global_string_request:
2595 // ensure the container exists2595 // ensure the container exists
2596 init_global_string( message.setStringRequest->name );2596 init_global_string( message.setStringRequest->name );
@@ -2599,7 +2599,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 2 unmodified lines
2599 // clean up request storage2599 // clean up request storage
2600 SAFE_DELETE( message.setStringRequest );2600 SAFE_DELETE( message.setStringRequest );
2601 break;2601 break;
2602 2602
2603 case get_global_string_request:2603 case get_global_string_request:
2604 // ensure one callback is not null (union)2604 // ensure one callback is not null (union)
2605 if( message.getStringRequest->cb != NULL )2605 if( message.getStringRequest->cb != NULL )
@@ -2623,7 +2623,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 17 unmodified lines
2623 // clean up request storage2623 // clean up request storage
2624 SAFE_DELETE( message.getStringRequest );2624 SAFE_DELETE( message.getStringRequest );
2625 break;2625 break;
2626 2626
2627 case signal_global_event_request:2627 case signal_global_event_request:
2628 // ensure it exists and it doesn't need its ctor called2628 // ensure it exists and it doesn't need its ctor called
2629 if( m_global_events.count( message.signalEventRequest->name ) > 0 &&2629 if( m_global_events.count( message.signalEventRequest->name ) > 0 &&
@@ -2651,7 +2651,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 21 unmodified lines
2651 should_retry_this_request = true;2651 should_retry_this_request = true;
2652 }2652 }
2653 }2653 }
2654 2654
2655 // clean up request storage2655 // clean up request storage
2656 if( should_retry_this_request )2656 if( should_retry_this_request )
2657 {2657 {
@@ -2662,7 +2662,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 4 unmodified lines
2662 SAFE_DELETE( message.signalEventRequest );2662 SAFE_DELETE( message.signalEventRequest );
2663 }2663 }
2664 break;2664 break;
2665 2665
2666 case listen_for_global_event_request:2666 case listen_for_global_event_request:
2667 // ensure a callback is not null (union)2667 // ensure a callback is not null (union)
2668 if( message.listenForEventRequest->cb != NULL )2668 if( message.listenForEventRequest->cb != NULL )
@@ -2689,7 +2689,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 20 unmodified lines
2689 message.listenForEventRequest->cb_with_id );2689 message.listenForEventRequest->cb_with_id );
2690 break;2690 break;
2691 }2691 }
2692 2692
2693 }2693 }
2694 else2694 else
2695 {2695 {
@@ -2711,7 +2711,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 15 unmodified lines
2711 message.listenForEventRequest->listen_forever );2711 message.listenForEventRequest->listen_forever );
2712 break;2712 break;
2713 }2713 }
2714 2714
2715 }2715 }
2716 }2716 }
2717 else2717 else
@@ -2733,7 +2733,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 15 unmodified lines
2733 SAFE_DELETE( message.listenForEventRequest );2733 SAFE_DELETE( message.listenForEventRequest );
2734 }2734 }
2735 break;2735 break;
2736 2736
2737 case set_global_int_array_request:2737 case set_global_int_array_request:
2738 {2738 {
2739 // replace an entire array, if it exists2739 // replace an entire array, if it exists
@@ -2749,7 +2749,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 9 unmodified lines
2749 // it exists! get existing array, new size2749 // it exists! get existing array, new size
2750 Chuck_Array4 * intArray = (Chuck_Array4 *) array;2750 Chuck_Array4 * intArray = (Chuck_Array4 *) array;
2751 t_CKUINT newSize = request->arrayValues.size();2751 t_CKUINT newSize = request->arrayValues.size();
2752 2752
2753 // resize and copy in2753 // resize and copy in
2754 intArray->set_size( newSize );2754 intArray->set_size( newSize );
2755 for( int i = 0; i < newSize; i++ )2755 for( int i = 0; i < newSize; i++ )
@@ -2767,7 +2767,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 11 unmodified lines
2767 }2767 }
2768 }2768 }
2769 }2769 }
2770 2770
2771 // clean up request storage2771 // clean up request storage
2772 if( should_retry_this_request )2772 if( should_retry_this_request )
2773 {2773 {
@@ -2778,7 +2778,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 4 unmodified lines
2778 SAFE_DELETE( message.setIntArrayRequest );2778 SAFE_DELETE( message.setIntArrayRequest );
2779 }2779 }
2780 break;2780 break;
2781 2781
2782 case get_global_int_array_request:2782 case get_global_int_array_request:
2783 {2783 {
2784 // fetch an entire array, if it exists2784 // fetch an entire array, if it exists
@@ -2828,7 +2828,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 43 unmodified lines
2828 }2828 }
2829 }2829 }
2830 }2830 }
2831 2831
2832 // clean up request storage2832 // clean up request storage
2833 if( should_retry_this_request )2833 if( should_retry_this_request )
2834 {2834 {
@@ -2839,7 +2839,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 4 unmodified lines
2839 SAFE_DELETE( message.getIntArrayRequest );2839 SAFE_DELETE( message.getIntArrayRequest );
2840 }2840 }
2841 break;2841 break;
2842 2842
2843 case set_global_int_array_value_request:2843 case set_global_int_array_value_request:
2844 {2844 {
2845 // set a single value, if array exists and index in range2845 // set a single value, if array exists and index in range
@@ -2870,7 +2870,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 24 unmodified lines
2870 }2870 }
2871 }2871 }
2872 }2872 }
2873 2873
2874 // clean up request storage2874 // clean up request storage
2875 if( should_retry_this_request )2875 if( should_retry_this_request )
2876 {2876 {
@@ -2881,7 +2881,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 4 unmodified lines
2881 SAFE_DELETE( message.setIntArrayValueRequest );2881 SAFE_DELETE( message.setIntArrayValueRequest );
2882 }2882 }
2883 break;2883 break;
2884 2884
2885 case get_global_int_array_value_request:2885 case get_global_int_array_value_request:
2886 {2886 {
2887 // get a single value, if array exists and index in range2887 // get a single value, if array exists and index in range
@@ -2923,7 +2923,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 35 unmodified lines
2923 }2923 }
2924 }2924 }
2925 }2925 }
2926 2926
2927 // clean up request storage2927 // clean up request storage
2928 if( should_retry_this_request )2928 if( should_retry_this_request )
2929 {2929 {
@@ -2934,7 +2934,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 4 unmodified lines
2934 SAFE_DELETE( message.getIntArrayValueRequest );2934 SAFE_DELETE( message.getIntArrayValueRequest );
2935 }2935 }
2936 break;2936 break;
2937 2937
2938 case set_global_associative_int_array_value_request:2938 case set_global_associative_int_array_value_request:
2939 {2939 {
2940 // set a single value by key, if array exists2940 // set a single value by key, if array exists
@@ -2962,7 +2962,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 21 unmodified lines
2962 }2962 }
2963 }2963 }
2964 }2964 }
2965 2965
2966 // clean up request storage2966 // clean up request storage
2967 if( should_retry_this_request )2967 if( should_retry_this_request )
2968 {2968 {
@@ -2973,7 +2973,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 4 unmodified lines
2973 SAFE_DELETE( message.setAssociativeIntArrayValueRequest );2973 SAFE_DELETE( message.setAssociativeIntArrayValueRequest );
2974 }2974 }
2975 break;2975 break;
2976 2976
2977 case get_global_associative_int_array_value_request:2977 case get_global_associative_int_array_value_request:
2978 {2978 {
2979 // get a single value by key, if array exists and key in map2979 // get a single value by key, if array exists and key in map
@@ -3015,7 +3015,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 35 unmodified lines
3015 }3015 }
3016 }3016 }
3017 }3017 }
3018 3018
3019 // clean up request storage3019 // clean up request storage
3020 if( should_retry_this_request )3020 if( should_retry_this_request )
3021 {3021 {
@@ -3026,7 +3026,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 4 unmodified lines
3026 SAFE_DELETE( message.getAssociativeIntArrayValueRequest );3026 SAFE_DELETE( message.getAssociativeIntArrayValueRequest );
3027 }3027 }
3028 break;3028 break;
3029 3029
3030 case set_global_float_array_request:3030 case set_global_float_array_request:
3031 {3031 {
3032 // replace an entire array, if it exists3032 // replace an entire array, if it exists
@@ -3042,7 +3042,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 9 unmodified lines
3042 // it exists! get existing array, new size3042 // it exists! get existing array, new size
3043 Chuck_Array8 * floatArray = (Chuck_Array8 *) array;3043 Chuck_Array8 * floatArray = (Chuck_Array8 *) array;
3044 t_CKUINT newSize = request->arrayValues.size();3044 t_CKUINT newSize = request->arrayValues.size();
3045 3045
3046 // resize and copy in3046 // resize and copy in
3047 floatArray->set_size( newSize );3047 floatArray->set_size( newSize );
3048 for( int i = 0; i < newSize; i++ )3048 for( int i = 0; i < newSize; i++ )
@@ -3060,7 +3060,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 11 unmodified lines
3060 }3060 }
3061 }3061 }
3062 }3062 }
3063 3063
3064 // clean up request storage3064 // clean up request storage
3065 if( should_retry_this_request )3065 if( should_retry_this_request )
3066 {3066 {
@@ -3071,7 +3071,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 4 unmodified lines
3071 SAFE_DELETE( message.setFloatArrayRequest );3071 SAFE_DELETE( message.setFloatArrayRequest );
3072 }3072 }
3073 break;3073 break;
3074 3074
3075 case get_global_float_array_request:3075 case get_global_float_array_request:
3076 {3076 {
3077 // fetch an entire array, if it exists3077 // fetch an entire array, if it exists
@@ -3120,7 +3120,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 42 unmodified lines
3120 }3120 }
3121 }3121 }
3122 }3122 }
3123 3123
3124 // clean up request storage3124 // clean up request storage
3125 if( should_retry_this_request )3125 if( should_retry_this_request )
3126 {3126 {
@@ -3131,7 +3131,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 4 unmodified lines
3131 SAFE_DELETE( message.getFloatArrayRequest );3131 SAFE_DELETE( message.getFloatArrayRequest );
3132 }3132 }
3133 break;3133 break;
3134 3134
3135 case set_global_float_array_value_request:3135 case set_global_float_array_value_request:
3136 {3136 {
3137 // set a single value, if array exists and index in range3137 // set a single value, if array exists and index in range
@@ -3162,7 +3162,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 24 unmodified lines
3162 }3162 }
3163 }3163 }
3164 }3164 }
3165 3165
3166 // clean up request storage3166 // clean up request storage
3167 if( should_retry_this_request )3167 if( should_retry_this_request )
3168 {3168 {
@@ -3173,7 +3173,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 4 unmodified lines
3173 SAFE_DELETE( message.setFloatArrayValueRequest );3173 SAFE_DELETE( message.setFloatArrayValueRequest );
3174 }3174 }
3175 break;3175 break;
3176 3176
3177 case get_global_float_array_value_request:3177 case get_global_float_array_value_request:
3178 {3178 {
3179 // get a single value, if array exists and index in range3179 // get a single value, if array exists and index in range
@@ -3214,7 +3214,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 34 unmodified lines
3214 }3214 }
3215 }3215 }
3216 }3216 }
3217 3217
3218 // clean up request storage3218 // clean up request storage
3219 if( should_retry_this_request )3219 if( should_retry_this_request )
3220 {3220 {
@@ -3225,7 +3225,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 4 unmodified lines
3225 SAFE_DELETE( message.getFloatArrayValueRequest );3225 SAFE_DELETE( message.getFloatArrayValueRequest );
3226 }3226 }
3227 break;3227 break;
3228 3228
3229 case set_global_associative_float_array_value_request:3229 case set_global_associative_float_array_value_request:
3230 {3230 {
3231 // set a single value by key, if array exists3231 // set a single value by key, if array exists
@@ -3253,7 +3253,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 21 unmodified lines
3253 }3253 }
3254 }3254 }
3255 }3255 }
3256 3256
3257 // clean up request storage3257 // clean up request storage
3258 if( should_retry_this_request )3258 if( should_retry_this_request )
3259 {3259 {
@@ -3264,7 +3264,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 4 unmodified lines
3264 SAFE_DELETE( message.setAssociativeFloatArrayValueRequest );3264 SAFE_DELETE( message.setAssociativeFloatArrayValueRequest );
3265 }3265 }
3266 break;3266 break;
3267 3267
3268 case get_global_associative_float_array_value_request:3268 case get_global_associative_float_array_value_request:
3269 {3269 {
3270 // get a single value by key, if array exists and key in map3270 // get a single value by key, if array exists and key in map
@@ -3305,7 +3305,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 34 unmodified lines
3305 }3305 }
3306 }3306 }
3307 }3307 }
3308 3308
3309 // clean up request storage3309 // clean up request storage
3310 if( should_retry_this_request )3310 if( should_retry_this_request )
3311 {3311 {
@@ -3324,7 +3324,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 12 unmodified lines
3324 break;3324 break;
3325 }3325 }
3326 }3326 }
3327 3327
3328 // process retries3328 // process retries
3329 while( m_global_request_retry_queue.more() )3329 while( m_global_request_retry_queue.more() )
3330 {3330 {
@@ -3338,7 +3338,7 @@ void Chuck_Globals_Manager::handle_global_queue_messages() · 7 unmodified lines
3338 // trying to retry something that shouldn't be.3338 // trying to retry something that shouldn't be.
3339 continue;3339 continue;
3340 }3340 }
3341 3341
3342 // decrement the number of retries3342 // decrement the number of retries
3343 message.retries--;3343 message.retries--;
3344 // add it back to the queue for next time3344 // add it back to the queue for next time
src/core/chuck_globals.h+21−21
@@ -164,7 +164,7 @@ struct Chuck_Global_Request · 163 unmodified lines
164 // chuck_msg164 // chuck_msg
165 Chuck_Execute_Chuck_Msg_Request* executeChuckMsgRequest;165 Chuck_Execute_Chuck_Msg_Request* executeChuckMsgRequest;
166 };166 };
167 167
168 Chuck_Global_Request()168 Chuck_Global_Request()
169 {169 {
170 retries = 0;170 retries = 0;
@@ -183,7 +183,7 @@ struct Chuck_Globals_Manager · 12 unmodified lines
183public:183public:
184 Chuck_Globals_Manager( Chuck_VM * vm );184 Chuck_Globals_Manager( Chuck_VM * vm );
185 ~Chuck_Globals_Manager();185 ~Chuck_Globals_Manager();
186 186
187public:187public:
188 // REFACTOR-2017: externally accessible + global variables.188 // REFACTOR-2017: externally accessible + global variables.
189 // use these getters and setters from outside the audio thread189 // use these getters and setters from outside the audio thread
@@ -191,17 +191,17 @@ public: · 1 unmodified line
191 t_CKBOOL getGlobalInt( const char * name, void (*callback)(const char*, t_CKINT) );191 t_CKBOOL getGlobalInt( const char * name, void (*callback)(const char*, t_CKINT) );
192 t_CKBOOL getGlobalInt( const char * name, t_CKINT callbackID, void (*callback)(t_CKINT, t_CKINT) );192 t_CKBOOL getGlobalInt( const char * name, t_CKINT callbackID, void (*callback)(t_CKINT, t_CKINT) );
193 t_CKBOOL setGlobalInt( const char * name, t_CKINT val );193 t_CKBOOL setGlobalInt( const char * name, t_CKINT val );
194 194
195 t_CKBOOL getGlobalFloat( const char * name, void (*callback)(t_CKFLOAT) );195 t_CKBOOL getGlobalFloat( const char * name, void (*callback)(t_CKFLOAT) );
196 t_CKBOOL getGlobalFloat( const char * name, void (*callback)(const char*, t_CKFLOAT) );196 t_CKBOOL getGlobalFloat( const char * name, void (*callback)(const char*, t_CKFLOAT) );
197 t_CKBOOL getGlobalFloat( const char * name, t_CKINT callbackID, void (*callback)(t_CKINT, t_CKFLOAT) );197 t_CKBOOL getGlobalFloat( const char * name, t_CKINT callbackID, void (*callback)(t_CKINT, t_CKFLOAT) );
198 t_CKBOOL setGlobalFloat( const char * name, t_CKFLOAT val );198 t_CKBOOL setGlobalFloat( const char * name, t_CKFLOAT val );
199 199
200 t_CKBOOL getGlobalString( const char * name, void (*callback)(const char*) );200 t_CKBOOL getGlobalString( const char * name, void (*callback)(const char*) );
201 t_CKBOOL getGlobalString( const char * name, void (*callback)(const char*, const char*) );201 t_CKBOOL getGlobalString( const char * name, void (*callback)(const char*, const char*) );
202 t_CKBOOL getGlobalString( const char * name, t_CKINT callbackID, void (*callback)(t_CKINT, const char*) );202 t_CKBOOL getGlobalString( const char * name, t_CKINT callbackID, void (*callback)(t_CKINT, const char*) );
203 t_CKBOOL setGlobalString( const char * name, const char * val );203 t_CKBOOL setGlobalString( const char * name, const char * val );
204 204
205 t_CKBOOL signalGlobalEvent( const char * name );205 t_CKBOOL signalGlobalEvent( const char * name );
206 t_CKBOOL broadcastGlobalEvent( const char * name );206 t_CKBOOL broadcastGlobalEvent( const char * name );
207 t_CKBOOL listenForGlobalEvent( const char * name, void (*callback)(void), t_CKBOOL listen_forever );207 t_CKBOOL listenForGlobalEvent( const char * name, void (*callback)(void), t_CKBOOL listen_forever );
@@ -210,9 +210,9 @@ public: · 2 unmodified lines
210 t_CKBOOL stopListeningForGlobalEvent( const char * name, void (*callback)(void) );210 t_CKBOOL stopListeningForGlobalEvent( const char * name, void (*callback)(void) );
211 t_CKBOOL stopListeningForGlobalEvent( const char * name, void (*callback)(const char*) );211 t_CKBOOL stopListeningForGlobalEvent( const char * name, void (*callback)(const char*) );
212 t_CKBOOL stopListeningForGlobalEvent( const char * name, t_CKINT callbackID, void (*callback)(t_CKINT) );212 t_CKBOOL stopListeningForGlobalEvent( const char * name, t_CKINT callbackID, void (*callback)(t_CKINT) );
213 213
214 t_CKBOOL getGlobalUGenSamples( const char * name, SAMPLE* buffer, int numFrames );214 t_CKBOOL getGlobalUGenSamples( const char * name, SAMPLE* buffer, int numFrames );
215 215
216 t_CKBOOL setGlobalIntArray( const char * name, t_CKINT arrayValues[], t_CKUINT numValues );216 t_CKBOOL setGlobalIntArray( const char * name, t_CKINT arrayValues[], t_CKUINT numValues );
217 t_CKBOOL getGlobalIntArray( const char * name, void (*callback)(t_CKINT[], t_CKUINT) );217 t_CKBOOL getGlobalIntArray( const char * name, void (*callback)(t_CKINT[], t_CKUINT) );
218 t_CKBOOL getGlobalIntArray( const char * name, void (*callback)(const char*, t_CKINT[], t_CKUINT) );218 t_CKBOOL getGlobalIntArray( const char * name, void (*callback)(const char*, t_CKINT[], t_CKUINT) );
@@ -225,7 +225,7 @@ public: · 6 unmodified lines
225 t_CKBOOL getGlobalAssociativeIntArrayValue( const char * name, const char * key, void (*callback)(t_CKINT) );225 t_CKBOOL getGlobalAssociativeIntArrayValue( const char * name, const char * key, void (*callback)(t_CKINT) );
226 t_CKBOOL getGlobalAssociativeIntArrayValue( const char * name, const char * key, void (*callback)(const char*, t_CKINT) );226 t_CKBOOL getGlobalAssociativeIntArrayValue( const char * name, const char * key, void (*callback)(const char*, t_CKINT) );
227 t_CKBOOL getGlobalAssociativeIntArrayValue( const char * name, t_CKINT callbackID, const char * key, void (*callback)(t_CKINT, t_CKINT) );227 t_CKBOOL getGlobalAssociativeIntArrayValue( const char * name, t_CKINT callbackID, const char * key, void (*callback)(t_CKINT, t_CKINT) );
228 228
229 t_CKBOOL setGlobalFloatArray( const char * name, t_CKFLOAT arrayValues[], t_CKUINT numValues );229 t_CKBOOL setGlobalFloatArray( const char * name, t_CKFLOAT arrayValues[], t_CKUINT numValues );
230 t_CKBOOL getGlobalFloatArray( const char * name, void (*callback)(t_CKFLOAT[], t_CKUINT) );230 t_CKBOOL getGlobalFloatArray( const char * name, void (*callback)(t_CKFLOAT[], t_CKUINT) );
231 t_CKBOOL getGlobalFloatArray( const char * name, void (*callback)(const char*, t_CKFLOAT[], t_CKUINT) );231 t_CKBOOL getGlobalFloatArray( const char * name, void (*callback)(const char*, t_CKFLOAT[], t_CKUINT) );
@@ -238,11 +238,11 @@ public: · 6 unmodified lines
238 t_CKBOOL getGlobalAssociativeFloatArrayValue( const char * name, const char * key, void (*callback)(t_CKFLOAT) );238 t_CKBOOL getGlobalAssociativeFloatArrayValue( const char * name, const char * key, void (*callback)(t_CKFLOAT) );
239 t_CKBOOL getGlobalAssociativeFloatArrayValue( const char * name, const char * key, void (*callback)(const char*, t_CKFLOAT) );239 t_CKBOOL getGlobalAssociativeFloatArrayValue( const char * name, const char * key, void (*callback)(const char*, t_CKFLOAT) );
240 t_CKBOOL getGlobalAssociativeFloatArrayValue( const char * name, t_CKINT callbackID, const char * key, void (*callback)(t_CKINT, t_CKFLOAT) );240 t_CKBOOL getGlobalAssociativeFloatArrayValue( const char * name, t_CKINT callbackID, const char * key, void (*callback)(t_CKINT, t_CKFLOAT) );
241 241
242public:242public:
243 // run Chuck_Msg in the globals order243 // run Chuck_Msg in the globals order
244 t_CKBOOL execute_chuck_msg_with_globals( Chuck_Msg* msg );244 t_CKBOOL execute_chuck_msg_with_globals( Chuck_Msg* msg );
245 245
246public:246public:
247 // REFACTOR-2017: externally accessible + global variables.247 // REFACTOR-2017: externally accessible + global variables.
248 // WARNING: these internal functions are to be used only by other248 // WARNING: these internal functions are to be used only by other
@@ -250,25 +250,25 @@ public: · 1 unmodified line
250 t_CKBOOL init_global_int( const std::string & name );250 t_CKBOOL init_global_int( const std::string & name );
251 t_CKINT get_global_int_value( const std::string & name );251 t_CKINT get_global_int_value( const std::string & name );
252 t_CKINT* get_ptr_to_global_int( const std::string & name );252 t_CKINT* get_ptr_to_global_int( const std::string & name );
253 253
254 t_CKBOOL init_global_float( const std::string & name );254 t_CKBOOL init_global_float( const std::string & name );
255 t_CKFLOAT get_global_float_value( const std::string & name );255 t_CKFLOAT get_global_float_value( const std::string & name );
256 t_CKFLOAT* get_ptr_to_global_float( const std::string & name );256 t_CKFLOAT* get_ptr_to_global_float( const std::string & name );
257 257
258 t_CKBOOL init_global_string( const std::string & name );258 t_CKBOOL init_global_string( const std::string & name );
259 Chuck_String* get_global_string( const std::string & name );259 Chuck_String* get_global_string( const std::string & name );
260 Chuck_String** get_ptr_to_global_string( const std::string & name );260 Chuck_String** get_ptr_to_global_string( const std::string & name );
261 261
262 t_CKBOOL init_global_event( const std::string & name, Chuck_Type* type );262 t_CKBOOL init_global_event( const std::string & name, Chuck_Type* type );
263 Chuck_Event* get_global_event( const std::string & name );263 Chuck_Event* get_global_event( const std::string & name );
264 Chuck_Event** get_ptr_to_global_event( const std::string & name );264 Chuck_Event** get_ptr_to_global_event( const std::string & name );
265 265
266 t_CKBOOL init_global_ugen( const std::string & name, Chuck_Type* type );266 t_CKBOOL init_global_ugen( const std::string & name, Chuck_Type* type );
267 t_CKBOOL is_global_ugen_init( const std::string & name );267 t_CKBOOL is_global_ugen_init( const std::string & name );
268 t_CKBOOL is_global_ugen_valid( const std::string & name );268 t_CKBOOL is_global_ugen_valid( const std::string & name );
269 Chuck_UGen* get_global_ugen( const std::string & name );269 Chuck_UGen* get_global_ugen( const std::string & name );
270 Chuck_UGen** get_ptr_to_global_ugen( const std::string & name );270 Chuck_UGen** get_ptr_to_global_ugen( const std::string & name );
271 271
272 t_CKBOOL init_global_array( const std::string & name, Chuck_Type* type, te_GlobalType arr_type );272 t_CKBOOL init_global_array( const std::string & name, Chuck_Type* type, te_GlobalType arr_type );
273 Chuck_Object* get_global_array( const std::string & name );273 Chuck_Object* get_global_array( const std::string & name );
274 Chuck_Object** get_ptr_to_global_array( const std::string & name );274 Chuck_Object** get_ptr_to_global_array( const std::string & name );
@@ -282,24 +282,24 @@ public: · 7 unmodified lines
282 t_CKBOOL is_global_object_valid( const std::string & name );282 t_CKBOOL is_global_object_valid( const std::string & name );
283 Chuck_Object* get_global_object( const std::string & name );283 Chuck_Object* get_global_object( const std::string & name );
284 Chuck_Object** get_ptr_to_global_object( const std::string & name );284 Chuck_Object** get_ptr_to_global_object( const std::string & name );
285 285
286 t_CKBOOL should_call_global_ctor( const std::string & name, te_GlobalType type );286 t_CKBOOL should_call_global_ctor( const std::string & name, te_GlobalType type );
287 void global_ctor_was_called( const std::string & name, te_GlobalType type );287 void global_ctor_was_called( const std::string & name, te_GlobalType type );
288 288
289 // global variables -- clean up289 // global variables -- clean up
290 void cleanup_global_variables();290 void cleanup_global_variables();
291 291
292public: // these should ever ONLY be called from within the VM292public: // these should ever ONLY be called from within the VM
293 // request queue: add, query for size293 // request queue: add, query for size
294 t_CKBOOL add_request( Chuck_Global_Request request );294 t_CKBOOL add_request( Chuck_Global_Request request );
295 t_CKBOOL more_requests();295 t_CKBOOL more_requests();
296 // REFACTOR-2017: execute the messages from the global queue296 // REFACTOR-2017: execute the messages from the global queue
297 void handle_global_queue_messages();297 void handle_global_queue_messages();
298 298
299private:299private:
300 // ptr to my vm300 // ptr to my vm
301 Chuck_VM * m_vm;301 Chuck_VM * m_vm;
302 302
303 // global variables -- storage303 // global variables -- storage
304 std::map< std::string, Chuck_Global_Int_Container* > m_global_ints;304 std::map< std::string, Chuck_Global_Int_Container* > m_global_ints;
305 std::map< std::string, Chuck_Global_Float_Container* > m_global_floats;305 std::map< std::string, Chuck_Global_Float_Container* > m_global_floats;
@@ -311,7 +311,7 @@ private: · 5 unmodified lines
311 311
312 // global variables -- messages for set, get, etc.312 // global variables -- messages for set, get, etc.
313 XCircleBuffer< Chuck_Global_Request > m_global_request_queue;313 XCircleBuffer< Chuck_Global_Request > m_global_request_queue;
314 314
315 // retry queue: sometimes a request comes through exactly 1 sample315 // retry queue: sometimes a request comes through exactly 1 sample
316 // before the relevant global variable is constructed316 // before the relevant global variable is constructed
317 // (e.g. signalEvent before the compileCode that would construct the event)317 // (e.g. signalEvent before the compileCode that would construct the event)
src/core/chuck_instr.cpp+594−302
@@ -29,20 +29,19 @@ · 28 unmodified lines
29// author: Ge Wang (ge@ccrma.stanford.edu | gewang@cs.princeton.edu)29// author: Ge Wang (ge@ccrma.stanford.edu | gewang@cs.princeton.edu)
30// date: Autumn 200230// date: Autumn 2002
31//-----------------------------------------------------------------------------31//-----------------------------------------------------------------------------
32#include <math.h>32#include "chuck_instr.h"
33#include <limits.h>
34
35#include "chuck_type.h"33#include "chuck_type.h"
36#include "chuck_lang.h"34#include "chuck_lang.h"
37#include "chuck_instr.h"
38#include "chuck_vm.h"35#include "chuck_vm.h"
39#include "chuck_ugen.h"36#include "chuck_ugen.h"
40#include "chuck_dl.h"37#include "chuck_dl.h"
41#include "chuck_errmsg.h"38#include "chuck_errmsg.h"
42#include "chuck_globals.h" // added 1.4.1.039#include "chuck_globals.h" // added 1.4.1.0
43 40#include "util_math.h"
44#include "util_string.h"41#include "util_string.h"
45 42
43#include <math.h>
44#include <limits.h>
46#include <typeinfo>45#include <typeinfo>
47using namespace std;46using namespace std;
48 47
@@ -53,9 +52,12 @@ using namespace std; · 4 unmodified lines
53// name: Chuck_Instr()52// name: Chuck_Instr()
54// desc: base class constructor53// desc: base class constructor
55//-----------------------------------------------------------------------------54//-----------------------------------------------------------------------------
56Chuck_Instr::Chuck_Instr() {55Chuck_Instr::Chuck_Instr()
56{
57 // set linepos to 0 so we can tell later whether it has been set properly57 // set linepos to 0 so we can tell later whether it has been set properly
58 m_linepos = 0;58 m_linepos = 0;
59 // default codestr
60 m_codestr = NULL;
59}61}
60 62
61 63
@@ -73,11 +75,28 @@ const char * Chuck_Instr::name() const · 11 unmodified lines
73 75
74 76
75 77
78//-----------------------------------------------------------------------------
79// name: set_codestr()
80// desc: set codestr associated with this instruction
81// only certain instructions (e.g., start of stmts) have this
82//-----------------------------------------------------------------------------
83void Chuck_Instr::set_codestr( const string & str )
84{
85 // cleanup
86 SAFE_DELETE( m_codestr );
87 // allocate
88 m_codestr = new string( str );
89}
90
91
92
93
76//-----------------------------------------------------------------------------94//-----------------------------------------------------------------------------
77// name: set_linepos()95// name: set_linepos()
78// desc: store line position for error messages96// desc: store line position for error messages
79//-----------------------------------------------------------------------------97//-----------------------------------------------------------------------------
80void Chuck_Instr::set_linepos(t_CKUINT linepos) {98void Chuck_Instr::set_linepos(t_CKUINT linepos)
99{
81 m_linepos = linepos;100 m_linepos = linepos;
82}101}
83 102
@@ -91,7 +110,7 @@ void Chuck_Instr::set_linepos(t_CKUINT linepos) { · 7 unmodified lines
91static void handle_overflow( Chuck_VM_Shred * shred, Chuck_VM * vm )110static void handle_overflow( Chuck_VM_Shred * shred, Chuck_VM * vm )
92{111{
93 // we have a problem112 // we have a problem
94 CK_FPRINTF_STDERR( 113 CK_FPRINTF_STDERR(
95 "[chuck](VM): Exception StackOverflow in shred[id=%lu:%s], PC=[%lu]\n",114 "[chuck](VM): Exception StackOverflow in shred[id=%lu:%s], PC=[%lu]\n",
96 shred->xid, shred->name.c_str(), shred->pc );115 shred->xid, shred->name.c_str(), shred->pc );
97 // do something!116 // do something!
@@ -109,7 +128,7 @@ static void handle_overflow( Chuck_VM_Shred * shred, Chuck_VM * vm ) · 11 unmodified lines
109//-----------------------------------------------------------------------------128//-----------------------------------------------------------------------------
110void Chuck_Instr_Add_int::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )129void Chuck_Instr_Add_int::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
111{130{
112 t_CKINT *& sp = (t_CKINT *&)shred->reg->sp; 131 t_CKINT *& sp = (t_CKINT *&)shred->reg->sp;
113 pop_( sp, 2 );132 pop_( sp, 2 );
114 push_( sp, val_(sp) + val_(sp+1) );133 push_( sp, val_(sp) + val_(sp+1) );
115}134}
@@ -239,7 +258,7 @@ void Chuck_Instr_Complement_int::execute( Chuck_VM * vm, Chuck_VM_Shred * shred · 123 unmodified lines
239//-----------------------------------------------------------------------------258//-----------------------------------------------------------------------------
240void Chuck_Instr_Mod_int::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )259void Chuck_Instr_Mod_int::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
241{260{
242 t_CKINT *& sp = (t_CKINT *&)shred->reg->sp; 261 t_CKINT *& sp = (t_CKINT *&)shred->reg->sp;
243 pop_( sp, 2 );262 pop_( sp, 2 );
244 push_( sp, val_(sp) % val_(sp+1) );263 push_( sp, val_(sp) % val_(sp+1) );
245}264}
@@ -253,7 +272,7 @@ void Chuck_Instr_Mod_int::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 7 unmodified lines
253//-----------------------------------------------------------------------------272//-----------------------------------------------------------------------------
254void Chuck_Instr_Mod_int_Reverse::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )273void Chuck_Instr_Mod_int_Reverse::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
255{274{
256 t_CKINT *& sp = (t_CKINT *&)shred->reg->sp; 275 t_CKINT *& sp = (t_CKINT *&)shred->reg->sp;
257 pop_( sp, 2 );276 pop_( sp, 2 );
258 push_( sp, val_(sp+1) % val_(sp) );277 push_( sp, val_(sp+1) % val_(sp) );
259}278}
@@ -267,7 +286,7 @@ void Chuck_Instr_Mod_int_Reverse::execute( Chuck_VM * vm, Chuck_VM_Shred * shred · 7 unmodified lines
267//-----------------------------------------------------------------------------286//-----------------------------------------------------------------------------
268void Chuck_Instr_Minus_int::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )287void Chuck_Instr_Minus_int::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
269{288{
270 t_CKINT *& sp = (t_CKINT *&)shred->reg->sp; 289 t_CKINT *& sp = (t_CKINT *&)shred->reg->sp;
271 pop_( sp, 2 );290 pop_( sp, 2 );
272 push_( sp, val_(sp) - val_(sp+1) );291 push_( sp, val_(sp) - val_(sp+1) );
273}292}
@@ -281,7 +300,7 @@ void Chuck_Instr_Minus_int::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 7 unmodified lines
281//-----------------------------------------------------------------------------300//-----------------------------------------------------------------------------
282void Chuck_Instr_Minus_int_Reverse::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )301void Chuck_Instr_Minus_int_Reverse::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
283{302{
284 t_CKINT *& sp = (t_CKINT *&)shred->reg->sp; 303 t_CKINT *& sp = (t_CKINT *&)shred->reg->sp;
285 pop_( sp, 2 );304 pop_( sp, 2 );
286 push_( sp, val_(sp+1) - val_(sp) );305 push_( sp, val_(sp+1) - val_(sp) );
287}306}
@@ -313,7 +332,7 @@ void Chuck_Instr_Divide_int::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 25 unmodified lines
313 pop_( sp, 2 );332 pop_( sp, 2 );
314 if( val_(sp+1) == 0 ) goto div_zero;333 if( val_(sp+1) == 0 ) goto div_zero;
315 push_( sp, val_(sp) / val_(sp+1) );334 push_( sp, val_(sp) / val_(sp+1) );
316 335
317 return;336 return;
318div_zero:337div_zero:
319 // we have a problem338 // we have a problem
@@ -341,7 +360,7 @@ void Chuck_Instr_Divide_int_Reverse::execute( Chuck_VM * vm, Chuck_VM_Shred * sh · 21 unmodified lines
341 pop_( sp, 2 );360 pop_( sp, 2 );
342 if( val_(sp) == 0 ) goto div_zero;361 if( val_(sp) == 0 ) goto div_zero;
343 push_( sp, val_(sp+1) / val_(sp) );362 push_( sp, val_(sp+1) / val_(sp) );
344 363
345 return;364 return;
346div_zero:365div_zero:
347 // we have a problem366 // we have a problem
@@ -452,7 +471,7 @@ void Chuck_Instr_Divide_double_Reverse::execute( Chuck_VM * vm, Chuck_VM_Shred * · 104 unmodified lines
452//-----------------------------------------------------------------------------471//-----------------------------------------------------------------------------
453void Chuck_Instr_Mod_double::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )472void Chuck_Instr_Mod_double::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
454{473{
455 t_CKFLOAT *& sp = (t_CKFLOAT *&)shred->reg->sp; 474 t_CKFLOAT *& sp = (t_CKFLOAT *&)shred->reg->sp;
456 pop_( sp, 2 );475 pop_( sp, 2 );
457 push_( sp, ::fmod( val_(sp), val_(sp+1) ) );476 push_( sp, ::fmod( val_(sp), val_(sp+1) ) );
458}477}
@@ -466,7 +485,7 @@ void Chuck_Instr_Mod_double::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 7 unmodified lines
466//-----------------------------------------------------------------------------485//-----------------------------------------------------------------------------
467void Chuck_Instr_Mod_double_Reverse::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )486void Chuck_Instr_Mod_double_Reverse::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
468{487{
469 t_CKFLOAT *& sp = (t_CKFLOAT *&)shred->reg->sp; 488 t_CKFLOAT *& sp = (t_CKFLOAT *&)shred->reg->sp;
470 pop_( sp, 2 );489 pop_( sp, 2 );
471 push_( sp, ::fmod( val_(sp+1), val_(sp) ) );490 push_( sp, ::fmod( val_(sp+1), val_(sp) ) );
472}491}
@@ -1113,7 +1132,7 @@ void Chuck_Instr_Divide_int_Assign::execute( Chuck_VM * vm, Chuck_VM_Shred * shr · 640 unmodified lines
1113 if( val_(sp) == 0 ) goto div_zero;1132 if( val_(sp) == 0 ) goto div_zero;
1114 temp = **(t_CKINT **)(sp+1) /= val_(sp);1133 temp = **(t_CKINT **)(sp+1) /= val_(sp);
1115 push_( sp, temp );1134 push_( sp, temp );
1116 1135
1117 return;1136 return;
1118div_zero:1137div_zero:
1119 // we have a problem1138 // we have a problem
@@ -1440,7 +1459,7 @@ void Chuck_Instr_Add_vec3_Assign::execute( Chuck_VM * vm, Chuck_VM_Shred * shred · 320 unmodified lines
1440 t_CKVEC3 temp;1459 t_CKVEC3 temp;
1441 // pop value + pointer1460 // pop value + pointer
1442 pop_( sp, sz_VEC3 + sz_UINT );1461 pop_( sp, sz_VEC3 + sz_UINT );
1443 1462
1444 // assign1463 // assign
1445 temp.x = (*(t_CKVEC3 **)(sp+sz_VEC3))->x += ((t_CKVEC3 *&)sp)->x;1464 temp.x = (*(t_CKVEC3 **)(sp+sz_VEC3))->x += ((t_CKVEC3 *&)sp)->x;
1446 temp.y = (*(t_CKVEC3 **)(sp+sz_VEC3))->y += ((t_CKVEC3 *&)sp)->y;1465 temp.y = (*(t_CKVEC3 **)(sp+sz_VEC3))->y += ((t_CKVEC3 *&)sp)->y;
@@ -1462,7 +1481,7 @@ void Chuck_Instr_Minus_vec3_Assign::execute( Chuck_VM * vm, Chuck_VM_Shred * shr · 15 unmodified lines
1462 t_CKVEC3 temp;1481 t_CKVEC3 temp;
1463 // pop value + pointer1482 // pop value + pointer
1464 pop_( sp, sz_VEC3 + sz_UINT );1483 pop_( sp, sz_VEC3 + sz_UINT );
1465 1484
1466 // assign1485 // assign
1467 temp.x = (*(t_CKVEC3 **)(sp+sz_VEC3))->x -= ((t_CKVEC3 *&)sp)->x;1486 temp.x = (*(t_CKVEC3 **)(sp+sz_VEC3))->x -= ((t_CKVEC3 *&)sp)->x;
1468 temp.y = (*(t_CKVEC3 **)(sp+sz_VEC3))->y -= ((t_CKVEC3 *&)sp)->y;1487 temp.y = (*(t_CKVEC3 **)(sp+sz_VEC3))->y -= ((t_CKVEC3 *&)sp)->y;
@@ -1484,7 +1503,7 @@ void Chuck_Instr_float_Times_vec3_Assign::execute( Chuck_VM * vm, Chuck_VM_Shred · 15 unmodified lines
1484 t_CKVEC3 temp;1503 t_CKVEC3 temp;
1485 // pop float + pointer1504 // pop float + pointer
1486 pop_( sp, sz_FLOAT + sz_UINT );1505 pop_( sp, sz_FLOAT + sz_UINT );
1487 1506
1488 // assign1507 // assign
1489 temp.x = (*(t_CKVEC3 **)(sp+sz_FLOAT))->x *= *((t_CKFLOAT *)sp);1508 temp.x = (*(t_CKVEC3 **)(sp+sz_FLOAT))->x *= *((t_CKFLOAT *)sp);
1490 temp.y = (*(t_CKVEC3 **)(sp+sz_FLOAT))->y *= *((t_CKFLOAT *)sp);1509 temp.y = (*(t_CKVEC3 **)(sp+sz_FLOAT))->y *= *((t_CKFLOAT *)sp);
@@ -1506,7 +1525,7 @@ void Chuck_Instr_vec3_Divide_float_Assign::execute( Chuck_VM * vm, Chuck_VM_Shre · 15 unmodified lines
1506 t_CKVEC3 temp;1525 t_CKVEC3 temp;
1507 // pop float + pointer1526 // pop float + pointer
1508 pop_( sp, sz_FLOAT + sz_UINT );1527 pop_( sp, sz_FLOAT + sz_UINT );
1509 1528
1510 // assign1529 // assign
1511 temp.x = (*(t_CKVEC3 **)(sp+sz_FLOAT))->x /= *((t_CKFLOAT *)sp);1530 temp.x = (*(t_CKVEC3 **)(sp+sz_FLOAT))->x /= *((t_CKFLOAT *)sp);
1512 temp.y = (*(t_CKVEC3 **)(sp+sz_FLOAT))->y /= *((t_CKFLOAT *)sp);1531 temp.y = (*(t_CKVEC3 **)(sp+sz_FLOAT))->y /= *((t_CKFLOAT *)sp);
@@ -1528,7 +1547,7 @@ void Chuck_Instr_Add_vec4_Assign::execute( Chuck_VM * vm, Chuck_VM_Shred * shred · 15 unmodified lines
1528 t_CKVEC4 temp;1547 t_CKVEC4 temp;
1529 // pop value + pointer1548 // pop value + pointer
1530 pop_( sp, sz_VEC4 + sz_UINT );1549 pop_( sp, sz_VEC4 + sz_UINT );
1531 1550
1532 // assign1551 // assign
1533 temp.x = (*(t_CKVEC4 **)(sp+sz_VEC4))->x += ((t_CKVEC4 *&)sp)->x;1552 temp.x = (*(t_CKVEC4 **)(sp+sz_VEC4))->x += ((t_CKVEC4 *&)sp)->x;
1534 temp.y = (*(t_CKVEC4 **)(sp+sz_VEC4))->y += ((t_CKVEC4 *&)sp)->y;1553 temp.y = (*(t_CKVEC4 **)(sp+sz_VEC4))->y += ((t_CKVEC4 *&)sp)->y;
@@ -1551,7 +1570,7 @@ void Chuck_Instr_Minus_vec4_Assign::execute( Chuck_VM * vm, Chuck_VM_Shred * shr · 16 unmodified lines
1551 t_CKVEC4 temp;1570 t_CKVEC4 temp;
1552 // pop value + pointer1571 // pop value + pointer
1553 pop_( sp, sz_VEC4 + sz_UINT );1572 pop_( sp, sz_VEC4 + sz_UINT );
1554 1573
1555 // assign1574 // assign
1556 temp.x = (*(t_CKVEC4 **)(sp+sz_VEC4))->x -= ((t_CKVEC4 *&)sp)->x;1575 temp.x = (*(t_CKVEC4 **)(sp+sz_VEC4))->x -= ((t_CKVEC4 *&)sp)->x;
1557 temp.y = (*(t_CKVEC4 **)(sp+sz_VEC4))->y -= ((t_CKVEC4 *&)sp)->y;1576 temp.y = (*(t_CKVEC4 **)(sp+sz_VEC4))->y -= ((t_CKVEC4 *&)sp)->y;
@@ -1574,7 +1593,7 @@ void Chuck_Instr_float_Times_vec4_Assign::execute( Chuck_VM * vm, Chuck_VM_Shred · 16 unmodified lines
1574 t_CKVEC4 temp;1593 t_CKVEC4 temp;
1575 // pop float + pointer1594 // pop float + pointer
1576 pop_( sp, sz_FLOAT + sz_UINT );1595 pop_( sp, sz_FLOAT + sz_UINT );
1577 1596
1578 // assign1597 // assign
1579 temp.x = (*(t_CKVEC4 **)(sp+sz_FLOAT))->x *= *((t_CKFLOAT *)sp);1598 temp.x = (*(t_CKVEC4 **)(sp+sz_FLOAT))->x *= *((t_CKFLOAT *)sp);
1580 temp.y = (*(t_CKVEC4 **)(sp+sz_FLOAT))->y *= *((t_CKFLOAT *)sp);1599 temp.y = (*(t_CKVEC4 **)(sp+sz_FLOAT))->y *= *((t_CKFLOAT *)sp);
@@ -1597,7 +1616,7 @@ void Chuck_Instr_vec4_Divide_float_Assign::execute( Chuck_VM * vm, Chuck_VM_Shre · 16 unmodified lines
1597 t_CKVEC4 temp;1616 t_CKVEC4 temp;
1598 // pop float + pointer1617 // pop float + pointer
1599 pop_( sp, sz_FLOAT + sz_UINT );1618 pop_( sp, sz_FLOAT + sz_UINT );
1600 1619
1601 // assign1620 // assign
1602 temp.x = (*(t_CKVEC4 **)(sp+sz_FLOAT))->x *= *((t_CKFLOAT *)sp);1621 temp.x = (*(t_CKVEC4 **)(sp+sz_FLOAT))->x *= *((t_CKFLOAT *)sp);
1603 temp.y = (*(t_CKVEC4 **)(sp+sz_FLOAT))->y *= *((t_CKFLOAT *)sp);1622 temp.y = (*(t_CKVEC4 **)(sp+sz_FLOAT))->y *= *((t_CKFLOAT *)sp);
@@ -1647,7 +1666,7 @@ void Chuck_Instr_Add_string::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 43 unmodified lines
1647 1666
1648null_pointer:1667null_pointer:
1649 // we have a problem1668 // we have a problem
1650 CK_FPRINTF_STDERR( 1669 CK_FPRINTF_STDERR(
1651 "[chuck](VM): NullPointerException: (string + string) on line[%lu] in shred[id=%lu:%s]\n",1670 "[chuck](VM): NullPointerException: (string + string) on line[%lu] in shred[id=%lu:%s]\n",
1652 m_linepos, shred->xid, shred->name.c_str() ); // , shred->pc );1671 m_linepos, shred->xid, shred->name.c_str() ); // , shred->pc );
1653 goto done;1672 goto done;
@@ -1692,7 +1711,7 @@ void Chuck_Instr_Add_string_Assign::execute( Chuck_VM * vm, Chuck_VM_Shred * shr · 38 unmodified lines
1692 1711
1693null_pointer:1712null_pointer:
1694 // we have a problem1713 // we have a problem
1695 CK_FPRINTF_STDERR( 1714 CK_FPRINTF_STDERR(
1696 "[chuck](VM): NullPointerException: (string +=> string) on line[%lu] in shred[id=%lu:%s]\n",1715 "[chuck](VM): NullPointerException: (string +=> string) on line[%lu] in shred[id=%lu:%s]\n",
1697 m_linepos, shred->xid, shred->name.c_str() );1716 m_linepos, shred->xid, shred->name.c_str() );
1698 goto done;1717 goto done;
@@ -1741,7 +1760,7 @@ void Chuck_Instr_Add_string_int::execute( Chuck_VM * vm, Chuck_VM_Shred * shred · 42 unmodified lines
1741 1760
1742null_pointer:1761null_pointer:
1743 // we have a problem1762 // we have a problem
1744 CK_FPRINTF_STDERR( 1763 CK_FPRINTF_STDERR(
1745 "[chuck](VM): NullPointerException: (string + int) on line[%lu] in shred[id=%lu:%s]\n",1764 "[chuck](VM): NullPointerException: (string + int) on line[%lu] in shred[id=%lu:%s]\n",
1746 m_linepos, shred->xid, shred->name.c_str() );1765 m_linepos, shred->xid, shred->name.c_str() );
1747 goto done;1766 goto done;
@@ -1790,7 +1809,7 @@ void Chuck_Instr_Add_string_float::execute( Chuck_VM * vm, Chuck_VM_Shred * shre · 42 unmodified lines
1790 1809
1791null_pointer:1810null_pointer:
1792 // we have a problem1811 // we have a problem
1793 CK_FPRINTF_STDERR( 1812 CK_FPRINTF_STDERR(
1794 "[chuck](VM): NullPointerException: (string + float) on line[%lu] in shred[id=%lu:%s]\n",1813 "[chuck](VM): NullPointerException: (string + float) on line[%lu] in shred[id=%lu:%s]\n",
1795 m_linepos, shred->xid, shred->name.c_str() );1814 m_linepos, shred->xid, shred->name.c_str() );
1796 goto done;1815 goto done;
@@ -1839,7 +1858,7 @@ void Chuck_Instr_Add_int_string::execute( Chuck_VM * vm, Chuck_VM_Shred * shred · 42 unmodified lines
1839 1858
1840null_pointer:1859null_pointer:
1841 // we have a problem1860 // we have a problem
1842 CK_FPRINTF_STDERR( 1861 CK_FPRINTF_STDERR(
1843 "[chuck](VM): NullPointerException: (int + string) on line[%lu] in shred[id=%lu:%s]\n",1862 "[chuck](VM): NullPointerException: (int + string) on line[%lu] in shred[id=%lu:%s]\n",
1844 m_linepos, shred->xid, shred->name.c_str() );1863 m_linepos, shred->xid, shred->name.c_str() );
1845 goto done;1864 goto done;
@@ -1888,7 +1907,7 @@ void Chuck_Instr_Add_float_string::execute( Chuck_VM * vm, Chuck_VM_Shred * shre · 42 unmodified lines
1888 1907
1889null_pointer:1908null_pointer:
1890 // we have a problem1909 // we have a problem
1891 CK_FPRINTF_STDERR( 1910 CK_FPRINTF_STDERR(
1892 "[chuck](VM): NullPointerException: (int + string) on line[%lu] in shred[id=%lu:%s]\n",1911 "[chuck](VM): NullPointerException: (int + string) on line[%lu] in shred[id=%lu:%s]\n",
1893 m_linepos, shred->xid, shred->name.c_str() );1912 m_linepos, shred->xid, shred->name.c_str() );
1894 goto done;1913 goto done;
@@ -1933,7 +1952,7 @@ void Chuck_Instr_Add_int_string_Assign::execute( Chuck_VM * vm, Chuck_VM_Shred * · 38 unmodified lines
1933 1952
1934null_pointer:1953null_pointer:
1935 // we have a problem1954 // we have a problem
1936 CK_FPRINTF_STDERR( 1955 CK_FPRINTF_STDERR(
1937 "[chuck](VM): NullPointerException: () on line[%lu] in shred[id=%lu:%s]\n",1956 "[chuck](VM): NullPointerException: () on line[%lu] in shred[id=%lu:%s]\n",
1938 m_linepos, shred->xid, shred->name.c_str() );1957 m_linepos, shred->xid, shred->name.c_str() );
1939 goto done;1958 goto done;
@@ -1978,7 +1997,7 @@ void Chuck_Instr_Add_float_string_Assign::execute( Chuck_VM * vm, Chuck_VM_Shred · 38 unmodified lines
1978 1997
1979null_pointer:1998null_pointer:
1980 // we have a problem1999 // we have a problem
1981 CK_FPRINTF_STDERR( 2000 CK_FPRINTF_STDERR(
1982 "[chuck](VM): NullPointerException: (float + string) on line[%lu] in shred[id=%lu:%s]\n",2001 "[chuck](VM): NullPointerException: (float + string) on line[%lu] in shred[id=%lu:%s]\n",
1983 m_linepos, shred->xid, shred->name.c_str() );2002 m_linepos, shred->xid, shred->name.c_str() );
1984 goto done;2003 goto done;
@@ -2040,6 +2059,23 @@ void Chuck_Instr_Reg_Push_Imm4::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 55 unmodified lines
2040 2059
2041 2060
2042 2061
2062//-----------------------------------------------------------------------------
2063// name: execute()
2064// desc: ...
2065//-----------------------------------------------------------------------------
2066void Chuck_Instr_Reg_Push_Zero::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
2067{
2068 t_CKBYTE *& reg_sp = (t_CKBYTE *&)shred->reg->sp;
2069
2070 // push val into reg stack
2071 memset( reg_sp, 0, m_val );
2072 // move stack pointer
2073 reg_sp += m_val;
2074}
2075
2076
2077
2078
2043//-----------------------------------------------------------------------------2079//-----------------------------------------------------------------------------
2044// name: execute()2080// name: execute()
2045// desc: ...2081// desc: ...
@@ -2079,7 +2115,7 @@ void Chuck_Instr_Reg_Dup_Last_As_Pointer::execute( · 33 unmodified lines
2079{2115{
2080 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;2116 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;
2081 t_CKBYTE * where = (t_CKBYTE *)shred->reg->sp;2117 t_CKBYTE * where = (t_CKBYTE *)shred->reg->sp;
2082 2118
2083 // push pointer into reg stack2119 // push pointer into reg stack
2084 push_( reg_sp, (t_CKUINT)(where-(m_val*sz_WORD)) );2120 push_( reg_sp, (t_CKUINT)(where-(m_val*sz_WORD)) );
2085}2121}
@@ -2125,7 +2161,7 @@ void Chuck_Instr_Reg_Push_This::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 39 unmodified lines
2125{2161{
2126 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;2162 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;
2127 t_CKUINT *& mem_sp = (t_CKUINT *&)shred->mem->sp;2163 t_CKUINT *& mem_sp = (t_CKUINT *&)shred->mem->sp;
2128 2164
2129 // push val into reg stack2165 // push val into reg stack
2130 push_( reg_sp, *(mem_sp) );2166 push_( reg_sp, *(mem_sp) );
2131}2167}
@@ -2157,7 +2193,7 @@ void Chuck_Instr_Reg_Push_Maybe::execute( Chuck_VM * vm, Chuck_VM_Shred * shred · 25 unmodified lines
2157 t_CKINT *& reg_sp = (t_CKINT *&)shred->reg->sp;2193 t_CKINT *& reg_sp = (t_CKINT *&)shred->reg->sp;
2158 2194
2159 // push val into reg stack2195 // push val into reg stack
2160 float num = (float)rand() / (float)RAND_MAX;2196 t_CKFLOAT num = ck_random()/(t_CKFLOAT)CK_RANDOM_MAX;
2161 push_( reg_sp, num > .5 );2197 push_( reg_sp, num > .5 );
2162}2198}
2163 2199
@@ -2187,7 +2223,7 @@ void Chuck_Instr_Reg_Push_Deref::execute( Chuck_VM * vm, Chuck_VM_Shred * shred · 23 unmodified lines
2187void Chuck_Instr_Reg_Push_Deref2::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )2223void Chuck_Instr_Reg_Push_Deref2::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
2188{2224{
2189 t_CKFLOAT *& reg_sp = (t_CKFLOAT *&)shred->reg->sp;2225 t_CKFLOAT *& reg_sp = (t_CKFLOAT *&)shred->reg->sp;
2190 2226
2191 // (added 1.3.1.0)2227 // (added 1.3.1.0)
2192 push_( reg_sp, *((t_CKFLOAT *)m_val) );2228 push_( reg_sp, *((t_CKFLOAT *)m_val) );
2193}2229}
@@ -2251,7 +2287,7 @@ void Chuck_Instr_Reg_Push_Mem_Vec3::execute( Chuck_VM * vm, Chuck_VM_Shred * shr · 57 unmodified lines
2251{2287{
2252 t_CKBYTE *& mem_sp = (t_CKBYTE *&)(base?shred->base_ref->stack:shred->mem->sp);2288 t_CKBYTE *& mem_sp = (t_CKBYTE *&)(base?shred->base_ref->stack:shred->mem->sp);
2253 t_CKVEC3 *& reg_sp = (t_CKVEC3 *&)shred->reg->sp;2289 t_CKVEC3 *& reg_sp = (t_CKVEC3 *&)shred->reg->sp;
2254 2290
2255 // push mem stack content into reg stack2291 // push mem stack content into reg stack
2256 push_( reg_sp, *((t_CKVEC3 *)(mem_sp + m_val)) );2292 push_( reg_sp, *((t_CKVEC3 *)(mem_sp + m_val)) );
2257}2293}
@@ -2267,7 +2303,7 @@ void Chuck_Instr_Reg_Push_Mem_Vec4::execute( Chuck_VM * vm, Chuck_VM_Shred * shr · 9 unmodified lines
2267{2303{
2268 t_CKBYTE *& mem_sp = (t_CKBYTE *&)(base?shred->base_ref->stack:shred->mem->sp);2304 t_CKBYTE *& mem_sp = (t_CKBYTE *&)(base?shred->base_ref->stack:shred->mem->sp);
2269 t_CKVEC4 *& reg_sp = (t_CKVEC4 *&)shred->reg->sp;2305 t_CKVEC4 *& reg_sp = (t_CKVEC4 *&)shred->reg->sp;
2270 2306
2271 // push mem stack content into reg stack2307 // push mem stack content into reg stack
2272 push_( reg_sp, *((t_CKVEC4 *)(mem_sp + m_val)) );2308 push_( reg_sp, *((t_CKVEC4 *)(mem_sp + m_val)) );
2273}2309}
@@ -2288,7 +2324,7 @@ void Chuck_Instr_Reg_Push_Global::execute( Chuck_VM * vm, Chuck_VM_Shred * shred · 14 unmodified lines
2288 // int pointer to registers2324 // int pointer to registers
2289 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;2325 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;
2290 t_CKUINT val = (t_CKUINT) vm->globals_manager()->get_global_int_value( m_name );2326 t_CKUINT val = (t_CKUINT) vm->globals_manager()->get_global_int_value( m_name );
2291 2327
2292 // push global map content into int-reg stack2328 // push global map content into int-reg stack
2293 push_( reg_sp, val );2329 push_( reg_sp, val );
2294 }2330 }
@@ -2298,7 +2334,7 @@ void Chuck_Instr_Reg_Push_Global::execute( Chuck_VM * vm, Chuck_VM_Shred * shred · 3 unmodified lines
2298 // float pointer to registers2334 // float pointer to registers
2299 t_CKFLOAT *& reg_sp = (t_CKFLOAT *&)shred->reg->sp;2335 t_CKFLOAT *& reg_sp = (t_CKFLOAT *&)shred->reg->sp;
2300 t_CKFLOAT val = (t_CKFLOAT) vm->globals_manager()->get_global_float_value( m_name );2336 t_CKFLOAT val = (t_CKFLOAT) vm->globals_manager()->get_global_float_value( m_name );
2301 2337
2302 // push global map content into float-reg stack2338 // push global map content into float-reg stack
2303 push_( reg_sp, val );2339 push_( reg_sp, val );
2304 }2340 }
@@ -2308,7 +2344,7 @@ void Chuck_Instr_Reg_Push_Global::execute( Chuck_VM * vm, Chuck_VM_Shred * shred · 3 unmodified lines
2308 // pointer to registers2344 // pointer to registers
2309 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;2345 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;
2310 t_CKUINT val = (t_CKUINT) vm->globals_manager()->get_global_string( m_name );2346 t_CKUINT val = (t_CKUINT) vm->globals_manager()->get_global_string( m_name );
2311 2347
2312 // push global map content into string-reg stack2348 // push global map content into string-reg stack
2313 push_( reg_sp, val );2349 push_( reg_sp, val );
2314 }2350 }
@@ -2317,7 +2353,7 @@ void Chuck_Instr_Reg_Push_Global::execute( Chuck_VM * vm, Chuck_VM_Shred * shred · 2 unmodified lines
2317 {2353 {
2318 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;2354 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;
2319 t_CKUINT val = (t_CKUINT) vm->globals_manager()->get_global_event( m_name );2355 t_CKUINT val = (t_CKUINT) vm->globals_manager()->get_global_event( m_name );
2320 2356
2321 // push global map content into event-reg stack2357 // push global map content into event-reg stack
2322 push_( reg_sp, val );2358 push_( reg_sp, val );
2323 }2359 }
@@ -2332,10 +2368,10 @@ void Chuck_Instr_Reg_Push_Global::execute( Chuck_VM * vm, Chuck_VM_Shred * shred · 8 unmodified lines
2332 m_linepos, shred->xid, shred->name.c_str());2368 m_linepos, shred->xid, shred->name.c_str());
2333 goto error;2369 goto error;
2334 }2370 }
2335 2371
2336 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;2372 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;
2337 t_CKUINT val = (t_CKUINT) vm->globals_manager()->get_global_ugen( m_name );2373 t_CKUINT val = (t_CKUINT) vm->globals_manager()->get_global_ugen( m_name );
2338 2374
2339 // push global map content into ugen-reg stack2375 // push global map content into ugen-reg stack
2340 push_( reg_sp, val );2376 push_( reg_sp, val );
2341 }2377 }
@@ -2350,10 +2386,10 @@ void Chuck_Instr_Reg_Push_Global::execute( Chuck_VM * vm, Chuck_VM_Shred * shred · 8 unmodified lines
2350 m_linepos, shred->xid, shred->name.c_str());2386 m_linepos, shred->xid, shred->name.c_str());
2351 goto error;2387 goto error;
2352 }2388 }
2353 2389
2354 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;2390 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;
2355 t_CKUINT val = (t_CKUINT) vm->globals_manager()->get_global_object( m_name );2391 t_CKUINT val = (t_CKUINT) vm->globals_manager()->get_global_object( m_name );
2356 2392
2357 // push global map content into object-reg stack2393 // push global map content into object-reg stack
2358 push_( reg_sp, val );2394 push_( reg_sp, val );
2359 }2395 }
@@ -2364,21 +2400,21 @@ void Chuck_Instr_Reg_Push_Global::execute( Chuck_VM * vm, Chuck_VM_Shred * shred · 4 unmodified lines
2364 // --> put exactly that on the stack2400 // --> put exactly that on the stack
2365 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;2401 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;
2366 t_CKUINT val = (t_CKUINT) vm->globals_manager()->get_global_array( m_name );2402 t_CKUINT val = (t_CKUINT) vm->globals_manager()->get_global_array( m_name );
2367 2403
2368 // push global map content into object-reg stack2404 // push global map content into object-reg stack
2369 push_( reg_sp, val );2405 push_( reg_sp, val );
2370 2406
2371 }2407 }
2372 break;2408 break;
2373 }2409 }
2374 2410
2375 return;2411 return;
2376 2412
2377error:2413error:
2378 // do something!2414 // do something!
2379 shred->is_running = FALSE;2415 shred->is_running = FALSE;
2380 shred->is_done = TRUE;2416 shred->is_done = TRUE;
2381 2417
2382}2418}
2383 2419
2384 2420
@@ -2407,7 +2443,7 @@ void Chuck_Instr_Reg_Push_Mem_Addr::execute( Chuck_VM * vm, Chuck_VM_Shred * shr · 22 unmodified lines
2407void Chuck_Instr_Reg_Push_Global_Addr::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )2443void Chuck_Instr_Reg_Push_Global_Addr::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
2408{2444{
2409 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;2445 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;
2410 2446
2411 // find addr2447 // find addr
2412 t_CKUINT addr;2448 t_CKUINT addr;
2413 switch( m_type ) {2449 switch( m_type ) {
@@ -2433,7 +2469,7 @@ void Chuck_Instr_Reg_Push_Global_Addr::execute( Chuck_VM * vm, Chuck_VM_Shred * · 19 unmodified lines
2433 case te_globalArraySymbol:2469 case te_globalArraySymbol:
2434 addr = (t_CKUINT) vm->globals_manager()->get_ptr_to_global_array( m_name );2470 addr = (t_CKUINT) vm->globals_manager()->get_ptr_to_global_array( m_name );
2435 break;2471 break;
2436 2472
2437 }2473 }
2438 2474
2439 // push mem stack addr into reg stack2475 // push mem stack addr into reg stack
@@ -2469,7 +2505,7 @@ void Chuck_Instr_Reg_Pop_Word::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 29 unmodified lines
2469{2505{
2470 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;2506 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;
2471 2507
2472 // pop word from reg stack 2508 // pop word from reg stack
2473 pop_( reg_sp, 1 );2509 pop_( reg_sp, 1 );
2474}2510}
2475 2511
@@ -2484,7 +2520,7 @@ void Chuck_Instr_Reg_Pop_Word2::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 8 unmodified lines
2484{2520{
2485 t_CKFLOAT *& reg_sp = (t_CKFLOAT *&)shred->reg->sp;2521 t_CKFLOAT *& reg_sp = (t_CKFLOAT *&)shred->reg->sp;
2486 2522
2487 // pop word from reg stack 2523 // pop word from reg stack
2488 pop_( reg_sp, 1 );2524 pop_( reg_sp, 1 );
2489}2525}
2490 2526
@@ -2498,8 +2534,8 @@ void Chuck_Instr_Reg_Pop_Word2::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 7 unmodified lines
2498void Chuck_Instr_Reg_Pop_Word3::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )2534void Chuck_Instr_Reg_Pop_Word3::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
2499{2535{
2500 t_CKCOMPLEX *& reg_sp = (t_CKCOMPLEX *&)shred->reg->sp;2536 t_CKCOMPLEX *& reg_sp = (t_CKCOMPLEX *&)shred->reg->sp;
2501 2537
2502 // pop word from reg stack 2538 // pop word from reg stack
2503 pop_( reg_sp, 1 );2539 pop_( reg_sp, 1 );
2504}2540}
2505 2541
@@ -2532,7 +2568,7 @@ void Chuck_Instr_Reg_Pop_Word4::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 26 unmodified lines
2532void Chuck_Instr_Mem_Set_Imm::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )2568void Chuck_Instr_Mem_Set_Imm::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
2533{2569{
2534 t_CKUINT * mem_sp = (t_CKUINT *)(shred->mem->sp + m_offset);2570 t_CKUINT * mem_sp = (t_CKUINT *)(shred->mem->sp + m_offset);
2535 2571
2536 // set2572 // set
2537 *(mem_sp) = m_val;2573 *(mem_sp) = m_val;
2538}2574}
@@ -2547,7 +2583,7 @@ void Chuck_Instr_Mem_Set_Imm::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 8 unmodified lines
2547void Chuck_Instr_Mem_Set_Imm2::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )2583void Chuck_Instr_Mem_Set_Imm2::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
2548{2584{
2549 t_CKFLOAT * mem_sp = (t_CKFLOAT *)(shred->mem->sp + m_offset);2585 t_CKFLOAT * mem_sp = (t_CKFLOAT *)(shred->mem->sp + m_offset);
2550 2586
2551 // set2587 // set
2552 *(mem_sp) = m_val;2588 *(mem_sp) = m_val;
2553}2589}
@@ -2562,8 +2598,8 @@ void Chuck_Instr_Mem_Set_Imm2::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 8 unmodified lines
2562void Chuck_Instr_Mem_Push_Imm::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )2598void Chuck_Instr_Mem_Push_Imm::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
2563{2599{
2564 t_CKUINT *& mem_sp = (t_CKUINT *&)shred->mem->sp;2600 t_CKUINT *& mem_sp = (t_CKUINT *&)shred->mem->sp;
2565 2601
2566 // pop word from reg stack 2602 // pop word from reg stack
2567 push_( mem_sp, m_val );2603 push_( mem_sp, m_val );
2568}2604}
2569 2605
@@ -2577,8 +2613,8 @@ void Chuck_Instr_Mem_Push_Imm::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 7 unmodified lines
2577void Chuck_Instr_Mem_Push_Imm2::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )2613void Chuck_Instr_Mem_Push_Imm2::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
2578{2614{
2579 t_CKFLOAT *& mem_sp = (t_CKFLOAT *&)shred->mem->sp;2615 t_CKFLOAT *& mem_sp = (t_CKFLOAT *&)shred->mem->sp;
2580 2616
2581 // pop word from reg stack 2617 // pop word from reg stack
2582 push_( mem_sp, m_val );2618 push_( mem_sp, m_val );
2583}2619}
2584 2620
@@ -2592,8 +2628,8 @@ void Chuck_Instr_Mem_Push_Imm2::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 7 unmodified lines
2592void Chuck_Instr_Mem_Pop_Word::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )2628void Chuck_Instr_Mem_Pop_Word::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
2593{2629{
2594 t_CKUINT *& mem_sp = (t_CKUINT *&)shred->mem->sp;2630 t_CKUINT *& mem_sp = (t_CKUINT *&)shred->mem->sp;
2595 2631
2596 // pop word from reg stack 2632 // pop word from reg stack
2597 pop_( mem_sp, 1 );2633 pop_( mem_sp, 1 );
2598}2634}
2599 2635
@@ -2607,8 +2643,8 @@ void Chuck_Instr_Mem_Pop_Word::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 7 unmodified lines
2607void Chuck_Instr_Mem_Pop_Word2::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )2643void Chuck_Instr_Mem_Pop_Word2::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
2608{2644{
2609 t_CKFLOAT *& mem_sp = (t_CKFLOAT *&)shred->mem->sp;2645 t_CKFLOAT *& mem_sp = (t_CKFLOAT *&)shred->mem->sp;
2610 2646
2611 // pop word from reg stack 2647 // pop word from reg stack
2612 pop_( mem_sp, 1 );2648 pop_( mem_sp, 1 );
2613}2649}
2614 2650
@@ -2622,8 +2658,8 @@ void Chuck_Instr_Mem_Pop_Word2::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 7 unmodified lines
2622void Chuck_Instr_Mem_Pop_Word3::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )2658void Chuck_Instr_Mem_Pop_Word3::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
2623{2659{
2624 t_CKUINT *& mem_sp = (t_CKUINT *&)shred->mem->sp;2660 t_CKUINT *& mem_sp = (t_CKUINT *&)shred->mem->sp;
2625 2661
2626 // pop word from reg stack 2662 // pop word from reg stack
2627 pop_( mem_sp, m_val );2663 pop_( mem_sp, m_val );
2628}2664}
2629 2665
@@ -3488,7 +3524,7 @@ void Chuck_Instr_Alloc_Vec3::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 858 unmodified lines
3488{3524{
3489 t_CKBYTE *& mem_sp = (t_CKBYTE *&)shred->mem->sp;3525 t_CKBYTE *& mem_sp = (t_CKBYTE *&)shred->mem->sp;
3490 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;3526 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;
3491 3527
3492 // zero out the memory stack3528 // zero out the memory stack
3493 ( (t_CKVEC3 *)(mem_sp + m_val) )->x = 0.0;3529 ( (t_CKVEC3 *)(mem_sp + m_val) )->x = 0.0;
3494 ( (t_CKVEC3 *)(mem_sp + m_val) )->y = 0.0;3530 ( (t_CKVEC3 *)(mem_sp + m_val) )->y = 0.0;
@@ -3508,7 +3544,7 @@ void Chuck_Instr_Alloc_Vec4::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 13 unmodified lines
3508{3544{
3509 t_CKBYTE *& mem_sp = (t_CKBYTE *&)shred->mem->sp;3545 t_CKBYTE *& mem_sp = (t_CKBYTE *&)shred->mem->sp;
3510 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;3546 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;
3511 3547
3512 // zero out the memory stack3548 // zero out the memory stack
3513 ( (t_CKVEC4 *)(mem_sp + m_val) )->x = 0.0;3549 ( (t_CKVEC4 *)(mem_sp + m_val) )->x = 0.0;
3514 ( (t_CKVEC4 *)(mem_sp + m_val) )->y = 0.0;3550 ( (t_CKVEC4 *)(mem_sp + m_val) )->y = 0.0;
@@ -3590,7 +3626,7 @@ void Chuck_Instr_Alloc_Member_Vec3::execute( Chuck_VM * vm, Chuck_VM_Shred * shr · 75 unmodified lines
3590{3626{
3591 t_CKUINT *& mem_sp = (t_CKUINT *&)shred->mem->sp;3627 t_CKUINT *& mem_sp = (t_CKUINT *&)shred->mem->sp;
3592 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;3628 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;
3593 3629
3594 // get the object3630 // get the object
3595 Chuck_Object * obj = (Chuck_Object *)*(mem_sp);3631 Chuck_Object * obj = (Chuck_Object *)*(mem_sp);
3596 // zero out the memory stack3632 // zero out the memory stack
@@ -3612,7 +3648,7 @@ void Chuck_Instr_Alloc_Member_Vec4::execute( Chuck_VM * vm, Chuck_VM_Shred * shr · 15 unmodified lines
3612{3648{
3613 t_CKUINT *& mem_sp = (t_CKUINT *&)shred->mem->sp;3649 t_CKUINT *& mem_sp = (t_CKUINT *&)shred->mem->sp;
3614 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;3650 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;
3615 3651
3616 // get the object3652 // get the object
3617 Chuck_Object * obj = (Chuck_Object *)*(mem_sp);3653 Chuck_Object * obj = (Chuck_Object *)*(mem_sp);
3618 // zero out the memory stack3654 // zero out the memory stack
@@ -3690,7 +3726,7 @@ void Chuck_Instr_Alloc_Word_Global::execute( Chuck_VM * vm, Chuck_VM_Shred * shr · 71 unmodified lines
3690 EM_error2( 0, "(internal error) symbol-only global type used in allocation" );3726 EM_error2( 0, "(internal error) symbol-only global type used in allocation" );
3691 goto error;3727 goto error;
3692 }3728 }
3693 3729
3694 }3730 }
3695 else3731 else
3696 {3732 {
@@ -3728,11 +3764,11 @@ void Chuck_Instr_Alloc_Word_Global::execute( Chuck_VM * vm, Chuck_VM_Shred * shr · 31 unmodified lines
3728 goto error;3764 goto error;
3729 }3765 }
3730 }3766 }
3731 3767
3732 3768
3733 // push addr onto operand stack3769 // push addr onto operand stack
3734 push_( reg_sp, addr );3770 push_( reg_sp, addr );
3735 3771
3736 // if we have ctors to execute, do it3772 // if we have ctors to execute, do it
3737 if( m_should_execute_ctors &&3773 if( m_should_execute_ctors &&
3738 vm->globals_manager()->should_call_global_ctor( m_name, m_type ) )3774 vm->globals_manager()->should_call_global_ctor( m_name, m_type ) )
@@ -3743,9 +3779,9 @@ void Chuck_Instr_Alloc_Word_Global::execute( Chuck_VM * vm, Chuck_VM_Shred * shr · 4 unmodified lines
3743 // tell VM we did it so that it will never be done again for m_name3779 // tell VM we did it so that it will never be done again for m_name
3744 vm->globals_manager()->global_ctor_was_called( m_name, m_type );3780 vm->globals_manager()->global_ctor_was_called( m_name, m_type );
3745 }3781 }
3746 3782
3747 return;3783 return;
3748 3784
3749error:3785error:
3750 // do something!3786 // do something!
3751 shred->is_running = FALSE;3787 shred->is_running = FALSE;
@@ -3759,12 +3795,12 @@ error: · 7 unmodified lines
3759 3795
3760 3796
3761static Chuck_Instr_Func_Call g_func_call;3797static Chuck_Instr_Func_Call g_func_call;
3762static Chuck_Instr_Func_Call_Member g_func_call_member( 0 );3798static Chuck_Instr_Func_Call_Member g_func_call_member( 0, NULL );
3763//-----------------------------------------------------------------------------3799//-----------------------------------------------------------------------------
3764// name: call_pre_constructor()3800// name: call_pre_constructor()
3765// desc: ...3801// desc: ...
3766//-----------------------------------------------------------------------------3802//-----------------------------------------------------------------------------
3767inline void call_pre_constructor( Chuck_VM * vm, Chuck_VM_Shred * shred, 3803inline void call_pre_constructor( Chuck_VM * vm, Chuck_VM_Shred * shred,
3768 Chuck_VM_Code * pre_ctor, t_CKUINT stack_offset )3804 Chuck_VM_Code * pre_ctor, t_CKUINT stack_offset )
3769{3805{
3770 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;3806 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;
@@ -3779,6 +3815,10 @@ inline void call_pre_constructor( Chuck_VM * vm, Chuck_VM_Shred * shred, · 8 unmodified lines
3779 // push the stack offset3815 // push the stack offset
3780 push_( reg_sp, stack_offset );3816 push_( reg_sp, stack_offset );
3781 3817
3818 // NOTE (1.4.2.1): pre-constructors by their nature have no arguments...
3819 // if they did, they would need to clean up argument list, in the built-in/native
3820 // func case, by setting g_func_call_member.m_func_ref with the appropriate func
3821
3782 // call the function3822 // call the function
3783 if( pre_ctor->native_func != 0 )3823 if( pre_ctor->native_func != 0 )
3784 g_func_call_member.execute( vm, shred );3824 g_func_call_member.execute( vm, shred );
@@ -3817,9 +3857,9 @@ t_CKBOOL initialize_object( Chuck_Object * object, Chuck_Type * type ) · 32 unmodified lines
3817 // copy the object's virtual table3857 // copy the object's virtual table
3818 object->vtable->funcs = type->info->obj_v_table.funcs;3858 object->vtable->funcs = type->info->obj_v_table.funcs;
3819 // set the type reference3859 // set the type reference
3820 // TODO: reference count
3821 object->type_ref = type;3860 object->type_ref = type;
3822 object->type_ref->add_ref();3861 // reference count
3862 SAFE_ADD_REF(object->type_ref);
3823 // get the size3863 // get the size
3824 object->size = type->obj_size;3864 object->size = type->obj_size;
3825 // allocate memory3865 // allocate memory
@@ -3845,7 +3885,7 @@ t_CKBOOL initialize_object( Chuck_Object * object, Chuck_Type * type ) · 19 unmodified lines
3845 // TODO: another hack!3885 // TODO: another hack!
3846 if( type->ugen_info->tock ) ((Chuck_UAna *)ugen)->tock = type->ugen_info->tock;3886 if( type->ugen_info->tock ) ((Chuck_UAna *)ugen)->tock = type->ugen_info->tock;
3847 // allocate multi chan3887 // allocate multi chan
3848 ugen->alloc_multi_chan( type->ugen_info->num_ins, 3888 ugen->alloc_multi_chan( type->ugen_info->num_ins,
3849 type->ugen_info->num_outs );3889 type->ugen_info->num_outs );
3850 // allocate the channels3890 // allocate the channels
3851 for( t_CKUINT i = 0; i < ugen->m_multi_chan_size; i++ )3891 for( t_CKUINT i = 0; i < ugen->m_multi_chan_size; i++ )
@@ -3871,7 +3911,7 @@ t_CKBOOL initialize_object( Chuck_Object * object, Chuck_Type * type ) · 19 unmodified lines
3871out_of_memory:3911out_of_memory:
3872 3912
3873 // we have a problem3913 // we have a problem
3874 CK_FPRINTF_STDERR( 3914 CK_FPRINTF_STDERR(
3875 "[chuck](VM): OutOfMemory: while instantiating object '%s'\n",3915 "[chuck](VM): OutOfMemory: while instantiating object '%s'\n",
3876 type->c_name() );3916 type->c_name() );
3877 3917
@@ -3932,9 +3972,9 @@ Chuck_Object * instantiate_and_initialize_object( Chuck_Type * type, Chuck_VM_Sh · 54 unmodified lines
3932 // check type TODO: make this faster3972 // check type TODO: make this faster
3933 if( type->allocator )3973 if( type->allocator )
3934 object = type->allocator( vm, shred, Chuck_DL_Api::Api::instance() );3974 object = type->allocator( vm, shred, Chuck_DL_Api::Api::instance() );
3935 #ifndef __DISABLE_FILEIO__3975 // #ifndef __DISABLE_FILEIO__
3936 else if( isa( type, vm->env()->t_fileio ) ) object = new Chuck_IO_File( vm );3976 else if( isa( type, vm->env()->t_fileio ) ) object = new Chuck_IO_File( vm );
3937 #endif3977 // #endif
3938 else if( isa( type, vm->env()->t_event ) ) object = new Chuck_Event;3978 else if( isa( type, vm->env()->t_event ) ) object = new Chuck_Event;
3939 else if( isa( type, vm->env()->t_string ) ) object = new Chuck_String;3979 else if( isa( type, vm->env()->t_string ) ) object = new Chuck_String;
3940 // TODO: is this ok?3980 // TODO: is this ok?
@@ -3943,6 +3983,8 @@ Chuck_Object * instantiate_and_initialize_object( Chuck_Type * type, Chuck_VM_Sh · 2 unmodified lines
3943 object = new Chuck_VM_Shred;3983 object = new Chuck_VM_Shred;
3944 ((Chuck_VM_Shred * )object)->vm_ref = vm; // REFACTOR-20173984 ((Chuck_VM_Shred * )object)->vm_ref = vm; // REFACTOR-2017
3945 }3985 }
3986 // 1.4.2.1 (ge) added -- here my feeble brain starts leaking out of my eyeballs
3987 else if( isa( type, vm->env()->t_class ) ) object = new Chuck_Type( vm->env(), te_class, type->name, type, type->size );
3946 // TODO: is this ok?3988 // TODO: is this ok?
3947 else object = new Chuck_Object;3989 else object = new Chuck_Object;
3948 }3990 }
@@ -3957,7 +3999,7 @@ Chuck_Object * instantiate_and_initialize_object( Chuck_Type * type, Chuck_VM_Sh · 8 unmodified lines
3957 object = ugen = uana = new Chuck_UAna;3999 object = ugen = uana = new Chuck_UAna;
3958 ugen->alloc_v( vm->shreduler()->m_max_block_size );4000 ugen->alloc_v( vm->shreduler()->m_max_block_size );
3959 }4001 }
3960 else 4002 else
3961 {4003 {
3962 object = ugen = new Chuck_UGen;4004 object = ugen = new Chuck_UGen;
3963 ugen->alloc_v( vm->shreduler()->m_max_block_size );4005 ugen->alloc_v( vm->shreduler()->m_max_block_size );
@@ -3968,11 +4010,11 @@ Chuck_Object * instantiate_and_initialize_object( Chuck_Type * type, Chuck_VM_Sh · 4 unmodified lines
3968 ugen->shred = shred;4010 ugen->shred = shred;
3969 shred->add( ugen );4011 shred->add( ugen );
3970 }4012 }
3971 4013
3972 // REFACTOR-2017: added4014 // REFACTOR-2017: added
3973 ugen->vm = vm;4015 ugen->vm = vm;
3974 }4016 }
3975 4017
3976 // check to see enough memory4018 // check to see enough memory
3977 if( !object ) goto out_of_memory;4019 if( !object ) goto out_of_memory;
3978 4020
@@ -3984,7 +4026,7 @@ Chuck_Object * instantiate_and_initialize_object( Chuck_Type * type, Chuck_VM_Sh · 5 unmodified lines
3984out_of_memory:4026out_of_memory:
3985 4027
3986 // we have a problem4028 // we have a problem
3987 CK_FPRINTF_STDERR( 4029 CK_FPRINTF_STDERR(
3988 "[chuck](VM): OutOfMemory: while instantiating object '%s'\n",4030 "[chuck](VM): OutOfMemory: while instantiating object '%s'\n",
3989 type->c_name() );4031 type->c_name() );
3990 4032
@@ -4049,8 +4091,8 @@ void Chuck_Instr_Instantiate_Object::execute( Chuck_VM * vm, Chuck_VM_Shred * sh · 58 unmodified lines
4049//-----------------------------------------------------------------------------4091//-----------------------------------------------------------------------------
4050const char * Chuck_Instr_Instantiate_Object::params() const4092const char * Chuck_Instr_Instantiate_Object::params() const
4051{4093{
4052 static char buffer[256];4094 static char buffer[CK_PRINT_BUF_LENGTH];
4053 sprintf( buffer, "%s", this->type->c_name() );4095 snprintf( buffer, CK_PRINT_BUF_LENGTH, "%s", this->type->c_name() );
4054 return buffer;4096 return buffer;
4055}4097}
4056 4098
@@ -4063,8 +4105,8 @@ const char * Chuck_Instr_Instantiate_Object::params() const · 6 unmodified lines
4063//-----------------------------------------------------------------------------4105//-----------------------------------------------------------------------------
4064const char * Chuck_Instr_Pre_Ctor_Array_Top::params() const4106const char * Chuck_Instr_Pre_Ctor_Array_Top::params() const
4065{4107{
4066 static char buffer[256];4108 static char buffer[CK_PRINT_BUF_LENGTH];
4067 sprintf( buffer, "val=%ld, type=\"%s\"", (long)m_val, type ? type->c_name() : "[empty]" );4109 snprintf( buffer, CK_PRINT_BUF_LENGTH, "val=%ld, type=\"%s\"", (long)m_val, type ? type->c_name() : "[empty]" );
4068 return buffer;4110 return buffer;
4069}4111}
4070 4112
@@ -4102,7 +4144,7 @@ void Chuck_Instr_Pre_Ctor_Array_Bottom::execute( Chuck_VM * vm, Chuck_VM_Shred * · 31 unmodified lines
4102 4144
4103 // pop the object4145 // pop the object
4104 pop_( reg_sp, 1 );4146 pop_( reg_sp, 1 );
4105 4147
4106 // cast the object4148 // cast the object
4107 Chuck_Object * obj = (Chuck_Object *)(*(reg_sp));4149 Chuck_Object * obj = (Chuck_Object *)(*(reg_sp));
4108 4150
@@ -4194,7 +4236,7 @@ void Chuck_Instr_Assign_Primitive4::execute( Chuck_VM * vm, Chuck_VM_Shred * shr · 85 unmodified lines
4194 4236
4195 // pop word from reg stack4237 // pop word from reg stack
4196 pop_( reg_sp, 1 + (sz_COMPLEX / sz_UINT) ); // ISSUE: 64-bit (fixed 1.3.1.0)4238 pop_( reg_sp, 1 + (sz_COMPLEX / sz_UINT) ); // ISSUE: 64-bit (fixed 1.3.1.0)
4197 // copy popped value into mem stack 4239 // copy popped value into mem stack
4198 *( (t_CKCOMPLEX*)(*(reg_sp+(sz_COMPLEX/sz_UINT))) ) = *(t_CKCOMPLEX *)reg_sp; // ISSUE: 64-bit (fixed 1.3.1.0)4240 *( (t_CKCOMPLEX*)(*(reg_sp+(sz_COMPLEX/sz_UINT))) ) = *(t_CKCOMPLEX *)reg_sp; // ISSUE: 64-bit (fixed 1.3.1.0)
4199 4241
4200 t_CKCOMPLEX *& sp_complex = (t_CKCOMPLEX *&)reg_sp;4242 t_CKCOMPLEX *& sp_complex = (t_CKCOMPLEX *&)reg_sp;
@@ -4211,12 +4253,12 @@ void Chuck_Instr_Assign_Primitive4::execute( Chuck_VM * vm, Chuck_VM_Shred * shr · 10 unmodified lines
4211void Chuck_Instr_Assign_PrimitiveVec3::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )4253void Chuck_Instr_Assign_PrimitiveVec3::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
4212{4254{
4213 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;4255 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;
4214 4256
4215 // pop word from reg stack4257 // pop word from reg stack
4216 pop_( reg_sp, 1 + (sz_VEC3 / sz_UINT) );4258 pop_( reg_sp, 1 + (sz_VEC3 / sz_UINT) );
4217 // copy popped value into mem stack4259 // copy popped value into mem stack
4218 *( (t_CKVEC3*)(*(reg_sp+(sz_VEC3/sz_UINT))) ) = *(t_CKVEC3 *)reg_sp;4260 *( (t_CKVEC3*)(*(reg_sp+(sz_VEC3/sz_UINT))) ) = *(t_CKVEC3 *)reg_sp;
4219 4261
4220 t_CKVEC3 *& sp_vec3 = (t_CKVEC3 *&)reg_sp;4262 t_CKVEC3 *& sp_vec3 = (t_CKVEC3 *&)reg_sp;
4221 push_( sp_vec3, *sp_vec3 );4263 push_( sp_vec3, *sp_vec3 );
4222}4264}
@@ -4231,12 +4273,12 @@ void Chuck_Instr_Assign_PrimitiveVec3::execute( Chuck_VM * vm, Chuck_VM_Shred * · 8 unmodified lines
4231void Chuck_Instr_Assign_PrimitiveVec4::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )4273void Chuck_Instr_Assign_PrimitiveVec4::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
4232{4274{
4233 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;4275 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;
4234 4276
4235 // pop word from reg stack4277 // pop word from reg stack
4236 pop_( reg_sp, 1 + (sz_VEC4 / sz_UINT) );4278 pop_( reg_sp, 1 + (sz_VEC4 / sz_UINT) );
4237 // copy popped value into mem stack4279 // copy popped value into mem stack
4238 *( (t_CKVEC4*)(*(reg_sp+(sz_VEC4/sz_UINT))) ) = *(t_CKVEC4 *)reg_sp;4280 *( (t_CKVEC4*)(*(reg_sp+(sz_VEC4/sz_UINT))) ) = *(t_CKVEC4 *)reg_sp;
4239 4281
4240 t_CKVEC4 *& sp_vec4 = (t_CKVEC4 *&)reg_sp;4282 t_CKVEC4 *& sp_vec4 = (t_CKVEC4 *&)reg_sp;
4241 push_( sp_vec4, *sp_vec4 );4283 push_( sp_vec4, *sp_vec4 );
4242}4284}
@@ -4341,7 +4383,7 @@ void Chuck_Instr_AddRef_Object::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 98 unmodified lines
4341 t_CKBYTE *& mem_sp = (t_CKBYTE *&)shred->mem->sp;4383 t_CKBYTE *& mem_sp = (t_CKBYTE *&)shred->mem->sp;
4342 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;4384 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;
4343 Chuck_VM_Object * obj = NULL;4385 Chuck_VM_Object * obj = NULL;
4344 4386
4345 // pop word from reg stack4387 // pop word from reg stack
4346 pop_( reg_sp, 1 );4388 pop_( reg_sp, 1 );
4347 // copy popped value into mem stack4389 // copy popped value into mem stack
@@ -4365,7 +4407,7 @@ void Chuck_Instr_AddRef_Object2::execute( Chuck_VM * vm, Chuck_VM_Shred * shred · 17 unmodified lines
4365{4407{
4366 t_CKBYTE *& mem_sp = (t_CKBYTE *&)shred->mem->sp;4408 t_CKBYTE *& mem_sp = (t_CKBYTE *&)shred->mem->sp;
4367 Chuck_VM_Object * obj = NULL;4409 Chuck_VM_Object * obj = NULL;
4368 4410
4369 // copy popped value into mem stack4411 // copy popped value into mem stack
4370 obj = *( (Chuck_VM_Object **)(mem_sp + m_val) );4412 obj = *( (Chuck_VM_Object **)(mem_sp + m_val) );
4371 // check for NULL4413 // check for NULL
@@ -4381,15 +4423,20 @@ void Chuck_Instr_AddRef_Object2::execute( Chuck_VM * vm, Chuck_VM_Shred * shred · 9 unmodified lines
4381 4423
4382//-----------------------------------------------------------------------------4424//-----------------------------------------------------------------------------
4383// name: execute()4425// name: execute()
4384// desc: add one reference on object (added 1.3.0.0)4426// desc: ref-count increment the top of the register stack (added 1.3.0.0)
4427// 1.4.2.1 (ge) additional notes...
4428// this is used to keep objects referenced while on stack;
4429// relevant for cases like `return obj;` where obj may need to
4430// released for the local stack AND need to be kept on the stack
4431// to be return; in this case, we need this additional add_ref();
4432// releasing obj from stack is responsibility of the caller
4385//-----------------------------------------------------------------------------4433//-----------------------------------------------------------------------------
4386void Chuck_Instr_Reg_AddRef_Object3::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )4434void Chuck_Instr_Reg_AddRef_Object3::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
4387{4435{
4388 // ISSUE: 64-bit?
4389 // NOTE: this pointer is NOT a reference pointer4436 // NOTE: this pointer is NOT a reference pointer
4390 t_CKUINT * reg_sp = (t_CKUINT *&)shred->reg->sp;4437 t_CKUINT * reg_sp = (t_CKUINT *&)shred->reg->sp;
4391 Chuck_VM_Object * obj = NULL;4438 Chuck_VM_Object * obj = NULL;
4392 4439
4393 // move word without popping4440 // move word without popping
4394 reg_sp--;4441 reg_sp--;
4395 // copy popped value into mem stack4442 // copy popped value into mem stack
@@ -4397,7 +4444,7 @@ void Chuck_Instr_Reg_AddRef_Object3::execute( Chuck_VM * vm, Chuck_VM_Shred * sh · 1 unmodified line
4397 // ge (2012 april): check for NULL (added 1.3.0.0)4444 // ge (2012 april): check for NULL (added 1.3.0.0)
4398 if( obj != NULL )4445 if( obj != NULL )
4399 {4446 {
4400 // release4447 // add reference
4401 obj->add_ref();4448 obj->add_ref();
4402 }4449 }
4403}4450}
@@ -4439,7 +4486,7 @@ void Chuck_Instr_Release_Object2::execute( Chuck_VM * vm, Chuck_VM_Shred * shred · 35 unmodified lines
4439{4486{
4440 t_CKBYTE *& mem_sp = (t_CKBYTE *&)shred->mem->sp;4487 t_CKBYTE *& mem_sp = (t_CKBYTE *&)shred->mem->sp;
4441 Chuck_VM_Object * obj = NULL;4488 Chuck_VM_Object * obj = NULL;
4442 4489
4443 // copy popped value into mem stack4490 // copy popped value into mem stack
4444 obj = *( (Chuck_VM_Object **)(mem_sp + m_val) );4491 obj = *( (Chuck_VM_Object **)(mem_sp + m_val) );
4445 // check for NULL4492 // check for NULL
@@ -4452,13 +4499,70 @@ void Chuck_Instr_Release_Object2::execute( Chuck_VM * vm, Chuck_VM_Shred * shred · 6 unmodified lines
4452 4499
4453 4500
4454 4501
4502
4503//-----------------------------------------------------------------------------
4504// name: execute()
4505// desc: release object reference + pop from reg stack | 1.4.2.1 (ge) added
4506// the variant assumes object pointer directly on stack (not offset)
4507// used to release returned object pointer after a function call;
4508// FYI the return value is conveyed on the reg stack; this undoes
4509// the addref before the return; see Chuck_Instr_Reg_AddRef_Object3
4510//-----------------------------------------------------------------------------
4511void Chuck_Instr_Release_Object3_Pop_Word::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
4512{
4513 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;
4514 Chuck_VM_Object * obj = NULL;
4515
4516 // pop
4517 pop_( reg_sp, 1 );
4518 // copy popped value into mem stack
4519 obj = *( (Chuck_VM_Object **)(reg_sp) );
4520 // ge (2012 april): check for NULL (added 1.3.0.0)
4521 if( obj != NULL )
4522 {
4523 // release
4524 obj->release();
4525 }
4526}
4527
4528
4529
4530
4531//-----------------------------------------------------------------------------
4532// name: execute()
4533// desc: release object reference from reg stack | 1.4.2.1 (ge) added
4534// the variant assumes object pointer directly on stack (not offset)
4535// used to release objects on function arguments, specifically for
4536// built-in / imported (chugins) functions; code-defined functions
4537// do their own argument cleanup
4538//-----------------------------------------------------------------------------
4539void Chuck_Instr_Release_Object4::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
4540{
4541 // NOTE: this pointer is NOT a reference pointer
4542 t_CKBYTE * mem_sp = (t_CKBYTE *&)shred->mem->sp;
4543 Chuck_VM_Object * obj = NULL;
4544
4545 // move it
4546 mem_sp += m_val;
4547 // copy popped value into mem stack
4548 obj = *( (Chuck_VM_Object **)(mem_sp) );
4549 if( obj != NULL )
4550 {
4551 // release
4552 obj->release();
4553 }
4554}
4555
4556
4557
4558
4455#pragma mark === Function Calls ===4559#pragma mark === Function Calls ===
4456 4560
4457 4561
4458 4562
4459//-----------------------------------------------------------------------------4563//-----------------------------------------------------------------------------
4460// name: execute()4564// name: execute()
4461// desc: ...4565// desc: converts, in place on operand stack, a Func to its Code (instructions)
4462//-----------------------------------------------------------------------------4566//-----------------------------------------------------------------------------
4463void Chuck_Instr_Func_To_Code::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )4567void Chuck_Instr_Func_To_Code::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
4464{4568{
@@ -4476,6 +4580,57 @@ void Chuck_Instr_Func_To_Code::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 11 unmodified lines
4476 4580
4477 4581
4478 4582
4583//-----------------------------------------------------------------------------
4584// name: func_release_args() | 1.4.2.1 (ge) added
4585// desc: helper function to release objects an function arg list
4586// input: VM, args list, mem stack pointer
4587// context: this is designed for builtin/imported functions
4588// functions defined in chuck code do their own arg list cleanup
4589//-----------------------------------------------------------------------------
4590t_CKBOOL func_release_args( Chuck_VM * vm, a_Arg_List args, t_CKBYTE * mem_sp )
4591{
4592 // keep track of offset
4593 t_CKUINT offset = 0;
4594 // the type in question
4595 Chuck_Type * type = NULL;
4596 // object pointer
4597 Chuck_VM_Object * object = NULL;
4598
4599 // loop over
4600 while( args )
4601 {
4602 // get the type
4603 type = args->type;
4604 // check we have one!
4605 if( type != NULL )
4606 {
4607 // is an object?
4608 if( isobj( vm->env(), args->type) )
4609 {
4610 // get the object pointer
4611 object = (Chuck_VM_Object *)(*(t_CKUINT *)(mem_sp+offset));
4612 // check
4613 if( object != NULL )
4614 {
4615 // release it
4616 object->release();
4617 }
4618 }
4619
4620 // advance offset
4621 offset += args->type->size;
4622 }
4623
4624 // go
4625 args = args->next;
4626 }
4627
4628 return TRUE;
4629}
4630
4631
4632
4633
4479//-----------------------------------------------------------------------------4634//-----------------------------------------------------------------------------
4480// name: execute()4635// name: execute()
4481// desc: ...4636// desc: ...
@@ -4541,7 +4696,7 @@ void Chuck_Instr_Func_Call::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 59 unmodified lines
4541 // one less word to copy4696 // one less word to copy
4542 stack_depth--;4697 stack_depth--;
4543 }4698 }
4544 4699
4545 // push the arguments4700 // push the arguments
4546 for( t_CKUINT i = 0; i < stack_depth; i++ )4701 for( t_CKUINT i = 0; i < stack_depth; i++ )
4547 *mem_sp2++ = *reg_sp2++;4702 *mem_sp2++ = *reg_sp2++;
@@ -4553,7 +4708,7 @@ void Chuck_Instr_Func_Call::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 5 unmodified lines
4553 return;4708 return;
4554 4709
4555error_overflow:4710error_overflow:
4556 4711
4557 handle_overflow( shred, vm );4712 handle_overflow( shred, vm );
4558}4713}
4559 4714
@@ -4598,7 +4753,7 @@ void Chuck_Instr_Func_Call_Member::execute( Chuck_VM * vm, Chuck_VM_Shred * shre · 38 unmodified lines
4598 // make copies4753 // make copies
4599 t_CKUINT * reg_sp2 = reg_sp;4754 t_CKUINT * reg_sp2 = reg_sp;
4600 t_CKUINT * mem_sp2 = mem_sp;4755 t_CKUINT * mem_sp2 = mem_sp;
4601 4756
4602 // need this4757 // need this
4603 if( func->need_this )4758 if( func->need_this )
4604 {4759 {
@@ -4630,15 +4785,25 @@ void Chuck_Instr_Func_Call_Member::execute( Chuck_VM * vm, Chuck_VM_Shred * shre · 25 unmodified lines
4630 // call the function (added 1.3.0.0 -- Chuck_DL_Api::Api::instance())4785 // call the function (added 1.3.0.0 -- Chuck_DL_Api::Api::instance())
4631 f( (Chuck_Object *)(*mem_sp), mem_sp + 1, &retval, vm, shred, Chuck_DL_Api::Api::instance() );4786 f( (Chuck_Object *)(*mem_sp), mem_sp + 1, &retval, vm, shred, Chuck_DL_Api::Api::instance() );
4632 }4787 }
4633 // pop (TODO: check if this is right)4788
4634 mem_sp -= push;
4635
4636 // push the return4789 // push the return
4637 // 1.3.1.0: check type to use kind instead of size4790 // 1.3.1.0: check type to use kind instead of size
4638 if( m_val == kindof_INT ) // ISSUE: 64-bit (fixed: 1.3.1.0)4791 if( m_val == kindof_INT ) // ISSUE: 64-bit (fixed: 1.3.1.0)
4639 {4792 {
4640 // push the return args4793 // push the return args
4641 push_( reg_sp, retval.v_uint );4794 push_( reg_sp, retval.v_uint );
4795
4796 // 1.4.2.1 (ge) | added -- ensure ref count
4797 if( m_func_ref && isobj(vm->env(), m_func_ref->def->ret_type) )
4798 {
4799 // get return value as object reference
4800 Chuck_VM_Object * obj = (Chuck_VM_Object *) retval.v_uint;
4801 if( obj )
4802 {
4803 // always add reference to returned objects (should release outside)
4804 obj->add_ref();
4805 }
4806 }
4642 }4807 }
4643 else if( m_val == kindof_FLOAT ) // ISSUE: 64-bit (fixed 1.3.1.0)4808 else if( m_val == kindof_FLOAT ) // ISSUE: 64-bit (fixed 1.3.1.0)
4644 {4809 {
@@ -4668,10 +4833,26 @@ void Chuck_Instr_Func_Call_Member::execute( Chuck_VM * vm, Chuck_VM_Shred * shre · 23 unmodified lines
4668 else if( m_val == kindof_VOID ) { }4833 else if( m_val == kindof_VOID ) { }
4669 else assert( FALSE );4834 else assert( FALSE );
4670 4835
4836 // if we have a func def | 1.4.2.1 (ge) added
4837 if( m_func_ref != NULL )
4838 {
4839 // cleanup / release objects on the arg list
4840 // context: this should be done here for builtin/import functions
4841 // user-defined functions do their own arg list cleanup
4842 // note: this is done after pushing the return value, in case the
4843 // return value is one of these args being released;
4844 // e.g., functions that pass through args;
4845 // e.g., string Sndbuf.read(string)
4846 func_release_args( vm, m_func_ref->def->arg_list, (t_CKBYTE *)(mem_sp+1) );
4847 }
4848
4849 // pop the stack pointer
4850 mem_sp -= push;
4851
4671 return;4852 return;
4672 4853
4673error_overflow:4854error_overflow:
4674 4855
4675 handle_overflow( shred, vm );4856 handle_overflow( shred, vm );
4676}4857}
4677 4858
@@ -4701,7 +4882,7 @@ void Chuck_Instr_Func_Call_Static::execute( Chuck_VM * vm, Chuck_VM_Shred * shre · 23 unmodified lines
4701 // get the stack depth of the callee function args4882 // get the stack depth of the callee function args
4702 t_CKUINT stack_depth = ( func->stack_depth / sz_INT ) + ( func->stack_depth & 0x3 ? 1 : 0 ); // ISSUE: 64-bit (fixed 1.3.1.0)4883 t_CKUINT stack_depth = ( func->stack_depth / sz_INT ) + ( func->stack_depth & 0x3 ? 1 : 0 ); // ISSUE: 64-bit (fixed 1.3.1.0)
4703 // UNUSED: get the previous stack depth - caller function args4884 // UNUSED: get the previous stack depth - caller function args
4704 // UNUSED: t_CKUINT prev_stack = ( *(mem_sp-1) >> 2 ) + ( *(mem_sp-1) & 0x3 ? 1 : 0 ); 4885 // UNUSED: t_CKUINT prev_stack = ( *(mem_sp-1) >> 2 ) + ( *(mem_sp-1) & 0x3 ? 1 : 0 );
4705 // the amount to push in 4-byte words4886 // the amount to push in 4-byte words
4706 t_CKUINT push = local_depth;4887 t_CKUINT push = local_depth;
4707 // push the mem stack past the current function variables and arguments4888 // push the mem stack past the current function variables and arguments
@@ -4716,7 +4897,7 @@ void Chuck_Instr_Func_Call_Static::execute( Chuck_VM * vm, Chuck_VM_Shred * shre · 8 unmodified lines
4716 // make copies4897 // make copies
4717 t_CKUINT * reg_sp2 = reg_sp;4898 t_CKUINT * reg_sp2 = reg_sp;
4718 t_CKUINT * mem_sp2 = mem_sp;4899 t_CKUINT * mem_sp2 = mem_sp;
4719 4900
4720 // need type4901 // need type
4721 if( func->is_static )4902 if( func->is_static )
4722 {4903 {
@@ -4737,8 +4918,6 @@ void Chuck_Instr_Func_Call_Static::execute( Chuck_VM * vm, Chuck_VM_Shred * shre · 14 unmodified lines
4737 // (added 1.3.0.0 -- Chuck_DL_Api::Api::instance())4918 // (added 1.3.0.0 -- Chuck_DL_Api::Api::instance())
4738 // (added 1.4.1.0 -- base_type)4919 // (added 1.4.1.0 -- base_type)
4739 f( (Chuck_Type *)(*mem_sp), mem_sp+1, &retval, vm, shred, Chuck_DL_Api::Api::instance() );4920 f( (Chuck_Type *)(*mem_sp), mem_sp+1, &retval, vm, shred, Chuck_DL_Api::Api::instance() );
4740 // clean up memory stack
4741 mem_sp -= push;
4742 4921
4743 // push the return4922 // push the return
4744 // 1.3.1.0: check type to use kind instead of size4923 // 1.3.1.0: check type to use kind instead of size
@@ -4746,6 +4925,18 @@ void Chuck_Instr_Func_Call_Static::execute( Chuck_VM * vm, Chuck_VM_Shred * shre · 1 unmodified line
4746 {4925 {
4747 // push the return args4926 // push the return args
4748 push_( reg_sp, retval.v_uint );4927 push_( reg_sp, retval.v_uint );
4928
4929 // 1.4.2.1 (ge) | added -- ensure ref count
4930 if( m_func_ref && isobj(vm->env(), m_func_ref->def->ret_type) )
4931 {
4932 // get return value as object reference
4933 Chuck_VM_Object * obj = (Chuck_VM_Object *) retval.v_uint;
4934 if( obj )
4935 {
4936 // always add reference to returned objects (should release outside)
4937 obj->add_ref();
4938 }
4939 }
4749 }4940 }
4750 else if( m_val == kindof_FLOAT ) // ISSUE: 64-bit (fixed 1.3.1.0)4941 else if( m_val == kindof_FLOAT ) // ISSUE: 64-bit (fixed 1.3.1.0)
4751 {4942 {
@@ -4775,10 +4966,26 @@ void Chuck_Instr_Func_Call_Static::execute( Chuck_VM * vm, Chuck_VM_Shred * shre · 23 unmodified lines
4775 else if( m_val == kindof_VOID ) { }4966 else if( m_val == kindof_VOID ) { }
4776 else assert( FALSE );4967 else assert( FALSE );
4777 4968
4969 // if we have a func def | 1.4.2.1 (ge) added
4970 if( m_func_ref != NULL )
4971 {
4972 // cleanup / release objects on the arg list
4973 // context: this should be done here for builtin/import functions
4974 // user-defined functions do their own arg list cleanup
4975 // note: this is done after pushing the return value, in case the
4976 // return value is one of these args being released;
4977 // e.g., functions that pass through args;
4978 // e.g., string Sndbuf.read(string)
4979 func_release_args( vm, m_func_ref->def->arg_list, (t_CKBYTE *)(mem_sp+1) );
4980 }
4981
4982 // pop the stack pointer
4983 mem_sp -= push;
4984
4778 return;4985 return;
4779 4986
4780error_overflow:4987error_overflow:
4781 4988
4782 handle_overflow( shred, vm );4989 handle_overflow( shred, vm );
4783}4990}
4784 4991
@@ -4805,7 +5012,7 @@ void Chuck_Instr_Func_Return::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 20 unmodified lines
4805 // jump the prev stack5012 // jump the prev stack
4806 mem_sp -= *(mem_sp);5013 mem_sp -= *(mem_sp);
4807 5014
4808 // set the shred 5015 // set the shred
4809 shred->code = func;5016 shred->code = func;
4810 shred->instr = func->instr;5017 shred->instr = func->instr;
4811}5018}
@@ -4822,7 +5029,7 @@ void Chuck_Instr_Spork::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 10 unmodified lines
4822 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;5029 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;
4823 t_CKUINT this_ptr = 0;5030 t_CKUINT this_ptr = 0;
4824 t_CKUINT type_ptr = 0;5031 t_CKUINT type_ptr = 0;
4825 5032
4826 // pop the stack5033 // pop the stack
4827 pop_( reg_sp, 1 );5034 pop_( reg_sp, 1 );
4828 // get the code5035 // get the code
@@ -4885,14 +5092,14 @@ void Chuck_Instr_Spork::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 56 unmodified lines
4885//void Chuck_Instr_Spork_Stmt::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )5092//void Chuck_Instr_Spork_Stmt::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
4886//{5093//{
4887// t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;5094// t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;
4888// 5095//
4889// // pop the stack5096// // pop the stack
4890// pop_( reg_sp, 1 );5097// pop_( reg_sp, 1 );
4891// // get the code5098// // get the code
4892// Chuck_VM_Code * code = *(Chuck_VM_Code **)reg_sp;5099// Chuck_VM_Code * code = *(Chuck_VM_Code **)reg_sp;
4893// // spork it5100// // spork it
4894// Chuck_VM_Shred * sh = vm->spork( code, shred );5101// Chuck_VM_Shred * sh = vm->spork( code, shred );
4895// 5102//
4896// if( code->need_this )5103// if( code->need_this )
4897// {5104// {
4898// // pop the stack5105// // pop the stack
@@ -4900,7 +5107,7 @@ void Chuck_Instr_Spork::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 1 unmodified line
4900// // copy this from local stack to top of new shred mem5107// // copy this from local stack to top of new shred mem
4901// *( ( t_CKUINT * ) sh->mem->sp ) = *reg_sp;5108// *( ( t_CKUINT * ) sh->mem->sp ) = *reg_sp;
4902// }5109// }
4903// 5110//
4904// // push the stack5111// // push the stack
4905// push_( reg_sp, (t_CKUINT)sh );5112// push_( reg_sp, (t_CKUINT)sh );
4906//}5113//}
@@ -4923,7 +5130,7 @@ void Chuck_Instr_Time_Advance::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 16 unmodified lines
4923 if( *sp < shred->now )5130 if( *sp < shred->now )
4924 {5131 {
4925 // we have a problem5132 // we have a problem
4926 CK_FPRINTF_STDERR( 5133 CK_FPRINTF_STDERR(
4927 "[chuck](VM): DestTimeNegativeException: '%.6f' on line[%lu] in shred[id=%lu:%s]\n",5134 "[chuck](VM): DestTimeNegativeException: '%.6f' on line[%lu] in shred[id=%lu:%s]\n",
4928 *sp, m_linepos, shred->xid, shred->name.c_str() );5135 *sp, m_linepos, shred->xid, shred->name.c_str() );
4929 // do something!5136 // do something!
@@ -4970,7 +5177,7 @@ void Chuck_Instr_Event_Wait::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 40 unmodified lines
4970 5177
4971null_pointer:5178null_pointer:
4972 // we have a problem5179 // we have a problem
4973 CK_FPRINTF_STDERR( 5180 CK_FPRINTF_STDERR(
4974 "[chuck](VM): NullPointerException: (null Event wait) on line[%lu] in shred[id=%lu:%s]\n",5181 "[chuck](VM): NullPointerException: (null Event wait) on line[%lu] in shred[id=%lu:%s]\n",
4975 m_linepos, shred->xid, shred->name.c_str() );5182 m_linepos, shred->xid, shred->name.c_str() );
4976 goto done;5183 goto done;
@@ -4996,12 +5203,17 @@ Chuck_Instr_Array_Init::Chuck_Instr_Array_Init( Chuck_Env * env, Chuck_Type * t, · 19 unmodified lines
4996 m_length = length;5203 m_length = length;
4997 // copy5204 // copy
4998 m_type_ref = t;5205 m_type_ref = t;
4999 // TODO: do this? remember?5206 // add reference
5000 // m_type_ref->add_ref();5207 m_type_ref->add_ref();
5001 // type5208 // type
5002 m_param_str = new char[64];5209 m_param_str = new char[64];
5003 // obj | REFACTOR-2017: added env5210 // obj | REFACTOR-2017: added env
5004 m_is_obj = isobj( env, m_type_ref );5211 m_is_obj = isobj( env, m_type_ref );
5212 // float | 1.4.2.0 (ge) added to differentiate between int and float arrays
5213 // -- in situations where they are the same size
5214 m_is_float = isa( t, env->t_float );
5215
5216 // copy type name
5005 const char * str = m_type_ref->c_name();5217 const char * str = m_type_ref->c_name();
5006 t_CKUINT len = strlen( str );5218 t_CKUINT len = strlen( str );
5007 // copy5219 // copy
@@ -5015,7 +5227,7 @@ Chuck_Instr_Array_Init::Chuck_Instr_Array_Init( Chuck_Env * env, Chuck_Type * t, · 7 unmodified lines
5015 5227
5016 // append length5228 // append length
5017 char buffer[16];5229 char buffer[16];
5018 sprintf( buffer, "[%ld]", (long)m_length );5230 snprintf( buffer, 16, "[%ld]", (long)m_length );
5019 strcat( m_param_str, buffer );5231 strcat( m_param_str, buffer );
5020}5232}
5021 5233
@@ -5032,8 +5244,7 @@ Chuck_Instr_Array_Init::~Chuck_Instr_Array_Init() · 10 unmodified lines
5032 delete [] m_param_str;5244 delete [] m_param_str;
5033 m_param_str = NULL;5245 m_param_str = NULL;
5034 // release5246 // release
5035 //m_type_ref->release();5247 SAFE_RELEASE( m_type_ref );
5036 m_type_ref = NULL;
5037}5248}
5038 5249
5039 5250
@@ -5049,7 +5260,8 @@ void Chuck_Instr_Array_Init::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 9 unmodified lines
5049 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;5260 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;
5050 5261
5051 // allocate the array5262 // allocate the array
5052 if( m_type_ref->size == sz_INT ) // ISSUE: 64-bit (fixed 1.3.1.0)5263 // 1.4.2.0 (ge) | added: check for float explicitly
5264 if( m_type_ref->size == sz_INT && !m_is_float ) // ISSUE: 64-bit (fixed 1.3.1.0)
5053 {5265 {
5054 // TODO: look at size and treat Chuck_Array4 as ChuckArrayInt5266 // TODO: look at size and treat Chuck_Array4 as ChuckArrayInt
5055 // pop the values5267 // pop the values
@@ -5059,6 +5271,7 @@ void Chuck_Instr_Array_Init::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 3 unmodified lines
5059 // problem5271 // problem
5060 if( !array ) goto out_of_memory;5272 if( !array ) goto out_of_memory;
5061 // initialize object5273 // initialize object
5274 // TODO: should it be this??? initialize_object( array, m_type_ref );
5062 initialize_object( array, vm->env()->t_array );5275 initialize_object( array, vm->env()->t_array );
5063 // set array type5276 // set array type
5064 array->m_array_type = m_type_ref;5277 array->m_array_type = m_type_ref;
@@ -5163,14 +5376,20 @@ void Chuck_Instr_Array_Init::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 98 unmodified lines
5163 // push the pointer5376 // push the pointer
5164 push_( reg_sp, (t_CKUINT)array );5377 push_( reg_sp, (t_CKUINT)array );
5165 }5378 }
5166 else assert( FALSE );5379 else
5380 {
5381 // we have a problem
5382 CK_FPRINTF_STDERR(
5383 "[chuck](VM): InvalidArrayTypeInfo: while initializing arrays on line[%lu]\n", m_linepos );
5384 assert( FALSE );
5385 }
5167 5386
5168 return;5387 return;
5169 5388
5170out_of_memory:5389out_of_memory:
5171 5390
5172 // we have a problem5391 // we have a problem
5173 CK_FPRINTF_STDERR( 5392 CK_FPRINTF_STDERR(
5174 "[chuck](VM): OutOfMemory: while initializing arrays on line[%lu]\n", m_linepos );5393 "[chuck](VM): OutOfMemory: while initializing arrays on line[%lu]\n", m_linepos );
5175 5394
5176 // do something!5395 // do something!
@@ -5183,26 +5402,35 @@ out_of_memory: · 6 unmodified lines
5183 5402
5184//-----------------------------------------------------------------------------5403//-----------------------------------------------------------------------------
5185// name: Chuck_Instr_Array_Alloc()5404// name: Chuck_Instr_Array_Alloc()
5186// desc: ...5405// desc: allocate a chuck array
5187//-----------------------------------------------------------------------------5406//-----------------------------------------------------------------------------
5188Chuck_Instr_Array_Alloc::Chuck_Instr_Array_Alloc( Chuck_Env * env, t_CKUINT depth, Chuck_Type * t,5407Chuck_Instr_Array_Alloc::Chuck_Instr_Array_Alloc( Chuck_Env * env, t_CKUINT depth, Chuck_Type * contentType,
5189 t_CKUINT offset, t_CKBOOL is_ref )5408 t_CKUINT offset, t_CKBOOL is_ref, Chuck_Type * arrayType )
5190{5409{
5191 // set5410 // set
5192 m_depth = depth;5411 m_depth = depth;
5193 // copy5412
5194 m_type_ref = t;5413 // 1.4.2.1 (ge) now maintains two Chuck_Types: one for the array content;
5414 // one for the array itself (which has depth > 0); the latter is so that
5415 // array object can have a reference to the array type itself
5416
5417 // copy array content type, e.g., int
5418 m_type_ref_content = contentType;
5195 // remember5419 // remember
5196 // m_type_ref->add_ref();5420 SAFE_ADD_REF( m_type_ref_content );
5197 // type5421 // remember the type of the array itself, e.g., int[][]
5422 m_type_ref_array = arrayType;
5423 SAFE_ADD_REF( m_type_ref_array );
5424
5425 // parameter string
5198 m_param_str = new char[64];5426 m_param_str = new char[64];
5199 // obj | REFACTOR-2017: added env5427 // obj | REFACTOR-2017: added env
5200 m_is_obj = isobj( env, m_type_ref );5428 m_is_obj = isobj( env, m_type_ref_content );
5201 // offset for pre constructor5429 // offset for pre constructor
5202 m_stack_offset = offset;5430 m_stack_offset = offset;
5203 // is object ref5431 // is object ref
5204 m_is_ref = is_ref;5432 m_is_ref = is_ref;
5205 const char * str = m_type_ref->c_name();5433 const char * str = m_type_ref_content->c_name();
5206 t_CKUINT len = strlen( str );5434 t_CKUINT len = strlen( str );
5207 // copy5435 // copy
5208 if( len < 64 )5436 if( len < 64 )
@@ -5223,12 +5451,11 @@ Chuck_Instr_Array_Alloc::Chuck_Instr_Array_Alloc( Chuck_Env * env, t_CKUINT dept · 14 unmodified lines
5223//-----------------------------------------------------------------------------5451//-----------------------------------------------------------------------------
5224Chuck_Instr_Array_Alloc::~Chuck_Instr_Array_Alloc()5452Chuck_Instr_Array_Alloc::~Chuck_Instr_Array_Alloc()
5225{5453{
5226 // delete5454 // delete | 1.4.2.1 (ge) convert to macro
5227 delete [] m_param_str;5455 SAFE_DELETE_ARRAY( m_param_str );
5228 m_param_str = NULL;5456 // release | 1.4.2.1 (ge) added
5229 // release5457 SAFE_RELEASE(m_type_ref_content);
5230 //m_type_ref->release();5458 SAFE_RELEASE(m_type_ref_array);
5231 m_type_ref = NULL;
5232}5459}
5233 5460
5234 5461
@@ -5241,11 +5468,13 @@ Chuck_Instr_Array_Alloc::~Chuck_Instr_Array_Alloc() · 6 unmodified lines
5241Chuck_Object * do_alloc_array( Chuck_VM * vm, // REFACTOR-2017: added5468Chuck_Object * do_alloc_array( Chuck_VM * vm, // REFACTOR-2017: added
5242 t_CKINT * capacity, const t_CKINT * top,5469 t_CKINT * capacity, const t_CKINT * top,
5243 t_CKUINT kind, t_CKBOOL is_obj,5470 t_CKUINT kind, t_CKBOOL is_obj,
5244 t_CKUINT * objs, t_CKINT & index )5471 t_CKUINT * objs, t_CKINT & index,
5472 Chuck_Type * type )
5245{5473{
5246 // not top level5474 // not top level
5247 Chuck_Array4 * base = NULL;5475 Chuck_Array4 * base = NULL;
5248 Chuck_Object * next = NULL;5476 Chuck_Object * next = NULL;
5477 Chuck_Type * typeNext = NULL;
5249 t_CKINT i = 0;5478 t_CKINT i = 0;
5250 5479
5251 // capacity5480 // capacity
@@ -5272,44 +5501,54 @@ Chuck_Object * do_alloc_array( Chuck_VM * vm, // REFACTOR-2017: added · 20 unmodified lines
5272 }5501 }
5273 }5502 }
5274 5503
5275 // initialize object5504 // initialize object | 1.4.2.1 (ge) use array type instead of base t_array
5276 initialize_object( base, vm->env()->t_array );5505 // for the object->type_ref to contain more specific information
5506 initialize_object( base, type );
5507 // initialize_object( base, vm->env()->t_array );
5277 return base;5508 return base;
5278 }5509 }
5279 else if( kind == kindof_FLOAT ) // ISSUE: 64-bit (fixed 1.3.1.0)5510 else if( kind == kindof_FLOAT ) // ISSUE: 64-bit (fixed 1.3.1.0)
5280 {5511 {
5281 Chuck_Array8 * base = new Chuck_Array8( *capacity );5512 Chuck_Array8 * base = new Chuck_Array8( *capacity );
5282 if( !base ) goto out_of_memory;5513 if( !base ) goto out_of_memory;
5283 5514
5284 // initialize object5515 // initialize object | 1.4.2.1 (ge) use array type instead of base t_array
5285 initialize_object( base, vm->env()->t_array );5516 // for the object->type_ref to contain more specific information
5517 initialize_object( base, type );
5518 // initialize_object( base, vm->env()->t_array );
5286 return base;5519 return base;
5287 }5520 }
5288 else if( kind == kindof_COMPLEX ) // ISSUE: 64-bit (fixed 1.3.1.0)5521 else if( kind == kindof_COMPLEX ) // ISSUE: 64-bit (fixed 1.3.1.0)
5289 {5522 {
5290 Chuck_Array16 * base = new Chuck_Array16( *capacity );5523 Chuck_Array16 * base = new Chuck_Array16( *capacity );
5291 if( !base ) goto out_of_memory;5524 if( !base ) goto out_of_memory;
5292 5525
5293 // initialize object5526 // initialize object | 1.4.2.1 (ge) use array type instead of base t_array
5294 initialize_object( base, vm->env()->t_array );5527 // for the object->type_ref to contain more specific information
5528 initialize_object( base, type );
5529 // initialize_object( base, vm->env()->t_array );
5295 return base;5530 return base;
5296 }5531 }
5297 else if( kind == kindof_VEC3 ) // 1.3.5.35532 else if( kind == kindof_VEC3 ) // 1.3.5.3
5298 {5533 {
5299 Chuck_Array24 * base = new Chuck_Array24( *capacity );5534 Chuck_Array24 * base = new Chuck_Array24( *capacity );
5300 if( !base ) goto out_of_memory;5535 if( !base ) goto out_of_memory;
5301 5536
5302 // initialize object5537 // initialize object | 1.4.2.1 (ge) use array type instead of base t_array
5303 initialize_object( base, vm->env()->t_array );5538 // for the object->type_ref to contain more specific information
5539 initialize_object( base, type );
5540 // initialize_object( base, vm->env()->t_array );
5304 return base;5541 return base;
5305 }5542 }
5306 else if( kind == kindof_VEC4 ) // 1.3.5.35543 else if( kind == kindof_VEC4 ) // 1.3.5.3
5307 {5544 {
5308 Chuck_Array32 * base = new Chuck_Array32( *capacity );5545 Chuck_Array32 * base = new Chuck_Array32( *capacity );
5309 if( !base ) goto out_of_memory;5546 if( !base ) goto out_of_memory;
5310 5547
5311 // initialize object5548 // initialize object | 1.4.2.1 (ge) use array type instead of base t_array
5312 initialize_object( base, vm->env()->t_array );5549 // for the object->type_ref to contain more specific information
5550 initialize_object( base, type );
5551 // initialize_object( base, vm->env()->t_array );
5313 return base;5552 return base;
5314 }5553 }
5315 5554
@@ -5321,24 +5560,40 @@ Chuck_Object * do_alloc_array( Chuck_VM * vm, // REFACTOR-2017: added · 5 unmodified lines
5321 base = new Chuck_Array4( TRUE, *capacity );5560 base = new Chuck_Array4( TRUE, *capacity );
5322 if( !base ) goto out_of_memory;5561 if( !base ) goto out_of_memory;
5323 5562
5563 // construct type for next array level | 1.4.2.1 (ge) added
5564 typeNext = type->copy( vm->env() );
5565 // check
5566 if( typeNext->array_depth == 0 ) goto internal_error_array_depth;
5567 // minus the depth
5568 typeNext->array_depth--;
5569
5324 // allocate the next level5570 // allocate the next level
5325 for( i = 0; i < *capacity; i++ )5571 for( i = 0; i < *capacity; i++ )
5326 {5572 {
5327 // the next | REFACTOR-2017: added vm5573 // the next | REFACTOR-2017: added vm
5328 next = do_alloc_array( vm, capacity+1, top, kind, is_obj, objs, index );5574 next = do_alloc_array( vm, capacity+1, top, kind, is_obj, objs, index, typeNext );
5329 // error if NULL5575 // error if NULL
5330 if( !next ) goto error;5576 if( !next ) goto error;
5331 // set that, with ref count5577 // set that, with ref count
5332 base->set( i, (t_CKUINT)next );5578 base->set( i, (t_CKUINT)next );
5333 }5579 }
5334 5580
5335 // initialize object5581 // initialize object | 1.4.2.1 (ge) use array type instead of base t_array
5336 initialize_object( base, vm->env()->t_array );5582 // for the object->type_ref to contain more specific information
5583 initialize_object( base, type );
5584 // initialize_object( base, vm->env()->t_array );
5585
5337 return base;5586 return base;
5338 5587
5588internal_error_array_depth:
5589 // we have a big problem
5590 CK_FPRINTF_STDERR(
5591 "[chuck](VM): internal error: multi-dimensional array depth mismatch while allocating arrays...\n" );
5592 goto error;
5593
5339out_of_memory:5594out_of_memory:
5340 // we have a problem5595 // we have a problem
5341 CK_FPRINTF_STDERR( 5596 CK_FPRINTF_STDERR(
5342 "[chuck](VM): OutOfMemory: while allocating arrays...\n" );5597 "[chuck](VM): OutOfMemory: while allocating arrays...\n" );
5343 goto error;5598 goto error;
5344 5599
@@ -5427,9 +5682,8 @@ void Chuck_Instr_Array_Alloc::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 82 unmodified lines
5427 ref = (t_CKUINT)do_alloc_array( vm,5682 ref = (t_CKUINT)do_alloc_array( vm,
5428 (t_CKINT *)(reg_sp - m_depth),5683 (t_CKINT *)(reg_sp - m_depth),
5429 (t_CKINT *)(reg_sp - 1),5684 (t_CKINT *)(reg_sp - 1),
5430 getkindof(vm->env(), m_type_ref), // 1.3.1.0: changed; was 'm_type_ref->size'5685 getkindof(vm->env(), m_type_ref_content), // 1.3.1.0: changed; was 'm_type_ref->size'
5431 m_is_obj,5686 m_is_obj, obj_array, index, m_type_ref_array // 1.4.2.1: added m_type_ref_array
5432 obj_array, index
5433 );5687 );
5434 5688
5435 // pop the indices - this protects the contents of the stack5689 // pop the indices - this protects the contents of the stack
@@ -5466,12 +5720,12 @@ overflow: · 30 unmodified lines
5466 5720
5467out_of_memory:5721out_of_memory:
5468 // we have a problem5722 // we have a problem
5469 CK_FPRINTF_STDERR( 5723 CK_FPRINTF_STDERR(
5470 "[chuck](VM): OutOfMemory: while allocating arrays...\n" );5724 "[chuck](VM): OutOfMemory: while allocating arrays...\n" );
5471 goto error;5725 goto error;
5472 5726
5473error:5727error:
5474 CK_FPRINTF_STDERR( 5728 CK_FPRINTF_STDERR(
5475 "[chuck](VM): (note: on line[%lu] in shred[id=%lu:%s])\n",5729 "[chuck](VM): (note: on line[%lu] in shred[id=%lu:%s])\n",
5476 m_linepos, shred->xid, shred->name.c_str() );5730 m_linepos, shred->xid, shred->name.c_str() );
5477 5731
@@ -5483,6 +5737,22 @@ error: · 5 unmodified lines
5483 5737
5484 5738
5485 5739
5740//-----------------------------------------------------------------------------
5741// name: normalize_index()
5742// desc: normalize index to allow for negative array indexing
5743// 1.4.2.1 (nshaheed) added
5744//-----------------------------------------------------------------------------
5745static t_CKINT normalize_index( t_CKINT i, t_CKINT len )
5746{
5747 // a normal array index
5748 if( i >= 0 ) return i;
5749 // start with len-1 and keep going down
5750 return len + i;
5751}
5752
5753
5754
5755
5486//-----------------------------------------------------------------------------5756//-----------------------------------------------------------------------------
5487// name: execute()5757// name: execute()
5488// desc: ...5758// desc: ...
@@ -5493,6 +5763,7 @@ void Chuck_Instr_Array_Access::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 4 unmodified lines
5493 t_CKUINT *& sp = (t_CKUINT *&)shred->reg->sp;5763 t_CKUINT *& sp = (t_CKUINT *&)shred->reg->sp;
5494 // UNUSED: t_CKUINT *& reg_sp = sp;5764 // UNUSED: t_CKUINT *& reg_sp = sp;
5495 t_CKINT i = 0;5765 t_CKINT i = 0;
5766 t_CKINT ni = 0; // normalized
5496 t_CKUINT val = 0;5767 t_CKUINT val = 0;
5497 t_CKFLOAT fval = 0;5768 t_CKFLOAT fval = 0;
5498 t_CKCOMPLEX cval;5769 t_CKCOMPLEX cval;
@@ -5515,17 +5786,19 @@ void Chuck_Instr_Array_Access::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 16 unmodified lines
5515 Chuck_Array4 * arr = (Chuck_Array4 *)(*sp);5786 Chuck_Array4 * arr = (Chuck_Array4 *)(*sp);
5516 // get index5787 // get index
5517 i = (t_CKINT)(*(sp+1));5788 i = (t_CKINT)(*(sp+1));
5789 // normalize index to allow for negative indexing | 1.4.2.1 (nshaheed) added
5790 ni = normalize_index( i, arr->size() );
5518 // check if writing5791 // check if writing
5519 if( m_emit_addr ) {5792 if( m_emit_addr ) {
5520 // get the addr5793 // get the addr
5521 val = arr->addr( i );5794 val = arr->addr( ni );
5522 // exception5795 // exception
5523 if( !val ) goto array_out_of_bound;5796 if( !val ) goto array_out_of_bound;
5524 // push the addr5797 // push the addr
5525 push_( sp, val );5798 push_( sp, val );
5526 } else {5799 } else {
5527 // get the value5800 // get the value
5528 if( !arr->get( i, &val ) )5801 if( !arr->get( ni, &val ) )
5529 goto array_out_of_bound;5802 goto array_out_of_bound;
5530 // push the value5803 // push the value
5531 push_( sp, val );5804 push_( sp, val );
@@ -5537,17 +5810,19 @@ void Chuck_Instr_Array_Access::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 5 unmodified lines
5537 Chuck_Array8 * arr = (Chuck_Array8 *)(*sp);5810 Chuck_Array8 * arr = (Chuck_Array8 *)(*sp);
5538 // get index5811 // get index
5539 i = (t_CKINT)(*(sp+1));5812 i = (t_CKINT)(*(sp+1));
5813 // normalize index to allow for negative indexing
5814 ni = normalize_index( i, arr->size() );
5540 // check if writing5815 // check if writing
5541 if( m_emit_addr ) {5816 if( m_emit_addr ) {
5542 // get the addr5817 // get the addr
5543 val = arr->addr( i );5818 val = arr->addr( ni );
5544 // exception5819 // exception
5545 if( !val ) goto array_out_of_bound;5820 if( !val ) goto array_out_of_bound;
5546 // push the addr5821 // push the addr
5547 push_( sp, val );5822 push_( sp, val );
5548 } else {5823 } else {
5549 // get the value5824 // get the value
5550 if( !arr->get( i, &fval ) )5825 if( !arr->get( ni, &fval ) )
5551 goto array_out_of_bound;5826 goto array_out_of_bound;
5552 // push the value5827 // push the value
5553 push_( ((t_CKFLOAT *&)sp), fval );5828 push_( ((t_CKFLOAT *&)sp), fval );
@@ -5559,17 +5834,19 @@ void Chuck_Instr_Array_Access::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 5 unmodified lines
5559 Chuck_Array16 * arr = (Chuck_Array16 *)(*sp);5834 Chuck_Array16 * arr = (Chuck_Array16 *)(*sp);
5560 // get index5835 // get index
5561 i = (t_CKINT)(*(sp+1));5836 i = (t_CKINT)(*(sp+1));
5837 // normalize index to allow for negative indexing
5838 ni = normalize_index( i, arr->size() );
5562 // check if writing5839 // check if writing
5563 if( m_emit_addr ) {5840 if( m_emit_addr ) {
5564 // get the addr5841 // get the addr
5565 val = arr->addr( i );5842 val = arr->addr( ni );
5566 // exception5843 // exception
5567 if( !val ) goto array_out_of_bound;5844 if( !val ) goto array_out_of_bound;
5568 // push the addr5845 // push the addr
5569 push_( sp, val );5846 push_( sp, val );
5570 } else {5847 } else {
5571 // get the value5848 // get the value
5572 if( !arr->get( i, &cval ) )5849 if( !arr->get( ni, &cval ) )
5573 goto array_out_of_bound;5850 goto array_out_of_bound;
5574 // push the value5851 // push the value
5575 push_( ((t_CKCOMPLEX *&)sp), cval );5852 push_( ((t_CKCOMPLEX *&)sp), cval );
@@ -5580,18 +5857,20 @@ void Chuck_Instr_Array_Access::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 4 unmodified lines
5580 // get array5857 // get array
5581 Chuck_Array24 * arr = (Chuck_Array24 *)(*sp);5858 Chuck_Array24 * arr = (Chuck_Array24 *)(*sp);
5582 // get index5859 // get index
5583 i = (t_CKINT)(*(sp+1));5860 i = (t_CKINT)(*(sp + 1));
5861 // normalize index to allow for negative indexing
5862 ni = normalize_index( i, arr->size() );
5584 // check if writing5863 // check if writing
5585 if( m_emit_addr ) {5864 if( m_emit_addr ) {
5586 // get the addr5865 // get the addr
5587 val = arr->addr( i );5866 val = arr->addr( ni );
5588 // exception5867 // exception
5589 if( !val ) goto array_out_of_bound;5868 if( !val ) goto array_out_of_bound;
5590 // push the addr5869 // push the addr
5591 push_( sp, val );5870 push_( sp, val );
5592 } else {5871 } else {
5593 // get the value5872 // get the value
5594 if( !arr->get( i, &v3 ) )5873 if( !arr->get( ni, &v3 ) )
5595 goto array_out_of_bound;5874 goto array_out_of_bound;
5596 // push the value5875 // push the value
5597 push_( ((t_CKVEC3 *&)sp), v3 );5876 push_( ((t_CKVEC3 *&)sp), v3 );
@@ -5603,17 +5882,19 @@ void Chuck_Instr_Array_Access::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 5 unmodified lines
5603 Chuck_Array32 * arr = (Chuck_Array32 *)(*sp);5882 Chuck_Array32 * arr = (Chuck_Array32 *)(*sp);
5604 // get index5883 // get index
5605 i = (t_CKINT)(*(sp+1));5884 i = (t_CKINT)(*(sp+1));
5885 // normalize index to allow for negative indexing
5886 ni = normalize_index( i, arr->size() );
5606 // check if writing5887 // check if writing
5607 if( m_emit_addr ) {5888 if( m_emit_addr ) {
5608 // get the addr5889 // get the addr
5609 val = arr->addr( i );5890 val = arr->addr( ni );
5610 // exception5891 // exception
5611 if( !val ) goto array_out_of_bound;5892 if( !val ) goto array_out_of_bound;
5612 // push the addr5893 // push the addr
5613 push_( sp, val );5894 push_( sp, val );
5614 } else {5895 } else {
5615 // get the value5896 // get the value
5616 if( !arr->get( i, &v4 ) )5897 if( !arr->get( ni, &v4 ) )
5617 goto array_out_of_bound;5898 goto array_out_of_bound;
5618 // push the value5899 // push the value
5619 push_( ((t_CKVEC4 *&)sp), v4 );5900 push_( ((t_CKVEC4 *&)sp), v4 );
@@ -5626,14 +5907,14 @@ void Chuck_Instr_Array_Access::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 6 unmodified lines
5626 5907
5627null_pointer:5908null_pointer:
5628 // we have a problem5909 // we have a problem
5629 CK_FPRINTF_STDERR( 5910 CK_FPRINTF_STDERR(
5630 "[chuck](VM): NullPointerException: (array access) on line[%lu] in shred[id=%lu:%s]\n",5911 "[chuck](VM): NullPointerException: (array access) on line[%lu] in shred[id=%lu:%s]\n",
5631 m_linepos, shred->xid, shred->name.c_str() ); // shred->pc removed5912 m_linepos, shred->xid, shred->name.c_str() ); // shred->pc removed
5632 goto done;5913 goto done;
5633 5914
5634array_out_of_bound:5915array_out_of_bound:
5635 // we have a problem5916 // we have a problem
5636 CK_FPRINTF_STDERR( 5917 CK_FPRINTF_STDERR(
5637 "[chuck](VM): ArrayOutofBounds: on line[%lu] in shred[id=%lu:%s], index=[%ld]\n",5918 "[chuck](VM): ArrayOutofBounds: on line[%lu] in shred[id=%lu:%s], index=[%ld]\n",
5638 m_linepos, shred->xid, shred->name.c_str(), i ); // shred->pc removed5919 m_linepos, shred->xid, shred->name.c_str(), i ); // shred->pc removed
5639 // go to done5920 // go to done
@@ -5790,14 +6071,14 @@ void Chuck_Instr_Array_Map_Access::execute( Chuck_VM * vm, Chuck_VM_Shred * shre · 150 unmodified lines
5790 6071
5791null_pointer:6072null_pointer:
5792 // we have a problem6073 // we have a problem
5793 CK_FPRINTF_STDERR( 6074 CK_FPRINTF_STDERR(
5794 "[chuck](VM): NullPointerException: (map access) on line[%lu] in shred[id=%lu:%s]\n",6075 "[chuck](VM): NullPointerException: (map access) on line[%lu] in shred[id=%lu:%s]\n",
5795 m_linepos, shred->xid, shred->name.c_str() ); // shred->pc6076 m_linepos, shred->xid, shred->name.c_str() ); // shred->pc
5796 goto done;6077 goto done;
5797 6078
5798error:6079error:
5799 // we have a problem6080 // we have a problem
5800 CK_FPRINTF_STDERR( 6081 CK_FPRINTF_STDERR(
5801 "[chuck](VM): InternalArrayMapError: on line[%lu] in shred[id=%lu:%s], index=[%s]\n",6082 "[chuck](VM): InternalArrayMapError: on line[%lu] in shred[id=%lu:%s], index=[%s]\n",
5802 m_linepos, shred->xid, shred->name.c_str(), key->str().c_str() ); // shred->pc6083 m_linepos, shred->xid, shred->name.c_str(), key->str().c_str() ); // shred->pc
5803 goto done;6084 goto done;
@@ -5858,7 +6139,7 @@ void Chuck_Instr_Array_Access_Multi::execute( Chuck_VM * vm, Chuck_VM_Shred * sh · 54 unmodified lines
5858 {6139 {
5859 // get the array6140 // get the array
5860 if( !base->get( i, &val ) )6141 if( !base->get( i, &val ) )
5861 goto array_out_of_bound; 6142 goto array_out_of_bound;
5862 }6143 }
5863 6144
5864 // set the array6145 // set the array
@@ -5991,16 +6272,16 @@ void Chuck_Instr_Array_Access_Multi::execute( Chuck_VM * vm, Chuck_VM_Shred * sh · 126 unmodified lines
5991 6272
5992null_pointer:6273null_pointer:
5993 // we have a problem6274 // we have a problem
5994 CK_FPRINTF_STDERR( 6275 CK_FPRINTF_STDERR(
5995 "[chuck](VM): NullPointerException: (array access) on line[%lu] in shred[id=%lu:%s]\n",6276 "[chuck](VM): NullPointerException: (array access) on line[%lu] in shred[id=%lu:%s]\n",
5996 m_linepos, shred->xid, shred->name.c_str() ); // shred->pc6277 m_linepos, shred->xid, shred->name.c_str() ); // shred->pc
5997 CK_FPRINTF_STDERR( 6278 CK_FPRINTF_STDERR(
5998 "[chuck](VM): (array dimension where exception occurred: %lu)\n", index );6279 "[chuck](VM): (array dimension where exception occurred: %lu)\n", index );
5999 goto done;6280 goto done;
6000 6281
6001array_out_of_bound:6282array_out_of_bound:
6002 // we have a problem6283 // we have a problem
6003 CK_FPRINTF_STDERR( 6284 CK_FPRINTF_STDERR(
6004 "[chuck](VM): ArrayOutofBounds: on line[%lu] in shred[id=%lu:%s], index=[%ld]\n",6285 "[chuck](VM): ArrayOutofBounds: on line[%lu] in shred[id=%lu:%s], index=[%ld]\n",
6005 m_linepos, shred->xid, shred->name.c_str(), i ); // shred->pc6286 m_linepos, shred->xid, shred->name.c_str(), i ); // shred->pc
6006 // go to done6287 // go to done
@@ -6114,7 +6395,7 @@ void Chuck_Instr_Array_Append::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 107 unmodified lines
6114 6395
6115null_pointer:6396null_pointer:
6116 // we have a problem6397 // we have a problem
6117 CK_FPRINTF_STDERR( 6398 CK_FPRINTF_STDERR(
6118 "[chuck](VM): NullPointerException: (array append) on line[%lu] in shred[id=%lu:%s]\n",6399 "[chuck](VM): NullPointerException: (array append) on line[%lu] in shred[id=%lu:%s]\n",
6119 m_linepos, shred->xid, shred->name.c_str() );6400 m_linepos, shred->xid, shred->name.c_str() );
6120 goto done;6401 goto done;
@@ -6139,7 +6420,7 @@ void Chuck_Instr_Dot_Member_Data::execute( Chuck_VM * vm, Chuck_VM_Shred * shred · 18 unmodified lines
6139 t_CKUINT *& sp = (t_CKUINT *&)shred->reg->sp;6420 t_CKUINT *& sp = (t_CKUINT *&)shred->reg->sp;
6140 // the pointer6421 // the pointer
6141 t_CKUINT data;6422 t_CKUINT data;
6142 6423
6143 // pop the object pointer6424 // pop the object pointer
6144 pop_( sp, 1 );6425 pop_( sp, 1 );
6145 // get the object pointer6426 // get the object pointer
@@ -6148,7 +6429,7 @@ void Chuck_Instr_Dot_Member_Data::execute( Chuck_VM * vm, Chuck_VM_Shred * shred · 2 unmodified lines
6148 if( !obj ) goto error;6429 if( !obj ) goto error;
6149 // calculate the data pointer6430 // calculate the data pointer
6150 data = (t_CKUINT)(obj->data + m_offset);6431 data = (t_CKUINT)(obj->data + m_offset);
6151 6432
6152 // emit addr or value6433 // emit addr or value
6153 if( m_emit_addr )6434 if( m_emit_addr )
6154 {6435 {
@@ -6171,7 +6452,7 @@ void Chuck_Instr_Dot_Member_Data::execute( Chuck_VM * vm, Chuck_VM_Shred * shred · 16 unmodified lines
6171 6452
6172error:6453error:
6173 // we have a problem6454 // we have a problem
6174 CK_FPRINTF_STDERR( 6455 CK_FPRINTF_STDERR(
6175 "[chuck](VM): NullPointerException: on line[%lu] in shred[id=%lu:%s]\n",6456 "[chuck](VM): NullPointerException: on line[%lu] in shred[id=%lu:%s]\n",
6176 m_linepos, shred->xid, shred->name.c_str() );6457 m_linepos, shred->xid, shred->name.c_str() );
6177 6458
@@ -6193,7 +6474,7 @@ void Chuck_Instr_Dot_Member_Func::execute( Chuck_VM * vm, Chuck_VM_Shred * shred · 15 unmodified lines
6193 t_CKUINT *& sp = (t_CKUINT *&)shred->reg->sp;6474 t_CKUINT *& sp = (t_CKUINT *&)shred->reg->sp;
6194 // the pointer6475 // the pointer
6195 t_CKUINT data;6476 t_CKUINT data;
6196 6477
6197 // pop the object pointer6478 // pop the object pointer
6198 pop_( sp, 1 );6479 pop_( sp, 1 );
6199 // get the object pointer6480 // get the object pointer
@@ -6204,7 +6485,7 @@ void Chuck_Instr_Dot_Member_Func::execute( Chuck_VM * vm, Chuck_VM_Shred * shred · 4 unmodified lines
6204 assert( m_offset < obj->vtable->funcs.size() );6485 assert( m_offset < obj->vtable->funcs.size() );
6205 // calculate the data pointer6486 // calculate the data pointer
6206 data = (t_CKUINT)(obj->vtable->funcs[m_offset]);6487 data = (t_CKUINT)(obj->vtable->funcs[m_offset]);
6207 6488
6208 // push the address6489 // push the address
6209 push_( sp, data );6490 push_( sp, data );
6210 6491
@@ -6212,7 +6493,7 @@ void Chuck_Instr_Dot_Member_Func::execute( Chuck_VM * vm, Chuck_VM_Shred * shred · 1 unmodified line
6212 6493
6213error:6494error:
6214 // we have a problem6495 // we have a problem
6215 CK_FPRINTF_STDERR( 6496 CK_FPRINTF_STDERR(
6216 "[chuck](VM): NullPointerException: on line[%lu] in shred[id=%lu:%s]\n",6497 "[chuck](VM): NullPointerException: on line[%lu] in shred[id=%lu:%s]\n",
6217 m_linepos, shred->xid, shred->name.c_str() );6498 m_linepos, shred->xid, shred->name.c_str() );
6218 6499
@@ -6232,10 +6513,10 @@ void Chuck_Instr_Dot_Primitive_Func::execute( Chuck_VM * vm, Chuck_VM_Shred * sh · 13 unmodified lines
6232{6513{
6233 // register stack pointer6514 // register stack pointer
6234 t_CKUINT *& sp = (t_CKUINT *&)shred->reg->sp;6515 t_CKUINT *& sp = (t_CKUINT *&)shred->reg->sp;
6235 6516
6236 // pop the primitive pointer6517 // pop the primitive pointer
6237 pop_( sp, 1 );6518 pop_( sp, 1 );
6238 6519
6239 // push the function address address6520 // push the function address address
6240 push_( sp, m_native_func );6521 push_( sp, m_native_func );
6241}6522}
@@ -6253,7 +6534,7 @@ void Chuck_Instr_Dot_Static_Data::execute( Chuck_VM * vm, Chuck_VM_Shred * shred · 11 unmodified lines
6253 t_CKUINT *& sp = (t_CKUINT *&)shred->reg->sp;6534 t_CKUINT *& sp = (t_CKUINT *&)shred->reg->sp;
6254 // the pointer6535 // the pointer
6255 t_CKUINT data;6536 t_CKUINT data;
6256 6537
6257 // pop the type pointer6538 // pop the type pointer
6258 pop_( sp, 1 );6539 pop_( sp, 1 );
6259 // get the object pointer6540 // get the object pointer
@@ -6262,7 +6543,7 @@ void Chuck_Instr_Dot_Static_Data::execute( Chuck_VM * vm, Chuck_VM_Shred * shred · 2 unmodified lines
6262 assert( (m_offset + m_size) <= t_class->info->class_data_size );6543 assert( (m_offset + m_size) <= t_class->info->class_data_size );
6263 // calculate the data pointer6544 // calculate the data pointer
6264 data = (t_CKUINT)(t_class->info->class_data + m_offset);6545 data = (t_CKUINT)(t_class->info->class_data + m_offset);
6265 6546
6266 // emit addr or value6547 // emit addr or value
6267 if( m_emit_addr )6548 if( m_emit_addr )
6268 {6549 {
@@ -6293,7 +6574,7 @@ void Chuck_Instr_Dot_Static_Import_Data::execute( Chuck_VM * vm, Chuck_VM_Shred · 24 unmodified lines
6293{6574{
6294 // register stack pointer6575 // register stack pointer
6295 t_CKUINT *& sp = (t_CKUINT *&)shred->reg->sp;6576 t_CKUINT *& sp = (t_CKUINT *&)shred->reg->sp;
6296 6577
6297 // emit addr or value6578 // emit addr or value
6298 if( m_emit_addr )6579 if( m_emit_addr )
6299 {6580 {
@@ -6328,7 +6609,7 @@ void Chuck_Instr_Dot_Static_Func::execute( Chuck_VM * vm, Chuck_VM_Shred * shred · 28 unmodified lines
6328 // 1.4.1.0 (ge): leave the base type on the operand stack6609 // 1.4.1.0 (ge): leave the base type on the operand stack
6329 // commented out: pop the type pointer6610 // commented out: pop the type pointer
6330 // pop_( sp, 1 );6611 // pop_( sp, 1 );
6331 6612
6332 // push the address6613 // push the address
6333 push_( sp, (t_CKUINT)(m_func) );6614 push_( sp, (t_CKUINT)(m_func) );
6334}6615}
@@ -6733,7 +7014,7 @@ void Chuck_Instr_Op_string::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 398 unmodified lines
6733 7014
6734null_pointer:7015null_pointer:
6735 // we have a problem7016 // we have a problem
6736 CK_FPRINTF_STDERR( 7017 CK_FPRINTF_STDERR(
6737 "[chuck](VM): NullPointerException: (string op) on line[%lu] in shred[id=%lu:%s]\n",7018 "[chuck](VM): NullPointerException: (string op) on line[%lu] in shred[id=%lu:%s]\n",
6738 m_linepos, shred->xid, shred->name.c_str() );7019 m_linepos, shred->xid, shred->name.c_str() );
6739 goto done;7020 goto done;
@@ -6840,7 +7121,7 @@ Chuck_Instr_UGen_Link::Chuck_Instr_UGen_Link( t_CKBOOL isUpChuck ) · 100 unmodified lines
6840void Chuck_Instr_UGen_Link::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )7121void Chuck_Instr_UGen_Link::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
6841{7122{
6842 Chuck_UGen **& sp = (Chuck_UGen **&)shred->reg->sp;7123 Chuck_UGen **& sp = (Chuck_UGen **&)shred->reg->sp;
6843 7124
6844 // pop7125 // pop
6845 pop_( sp, 2 );7126 pop_( sp, 2 );
6846 // check for null7127 // check for null
@@ -6849,15 +7130,15 @@ void Chuck_Instr_UGen_Link::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 2 unmodified lines
6849 (*(sp + 1))->add( *sp, m_isUpChuck );7130 (*(sp + 1))->add( *sp, m_isUpChuck );
6850 // push the second7131 // push the second
6851 push_( sp, *(sp + 1) );7132 push_( sp, *(sp + 1) );
6852 7133
6853 return;7134 return;
6854 7135
6855null_pointer:7136null_pointer:
6856 // we have a problem7137 // we have a problem
6857 CK_FPRINTF_STDERR(7138 CK_FPRINTF_STDERR(
6858 "[chuck](VM): NullPointerException: (UGen link) on line[%lu] in shred[id=%lu:%s]\n",7139 "[chuck](VM): NullPointerException: (UGen link) on line[%lu] in shred[id=%lu:%s]\n",
6859 m_linepos, shred->xid, shred->name.c_str() );7140 m_linepos, shred->xid, shred->name.c_str() );
6860 7141
6861 // do something!7142 // do something!
6862 shred->is_running = FALSE;7143 shred->is_running = FALSE;
6863 shred->is_done = TRUE;7144 shred->is_done = TRUE;
@@ -6874,15 +7155,15 @@ void Chuck_Instr_UGen_Array_Link::execute( Chuck_VM * vm, Chuck_VM_Shred * shred · 10 unmodified lines
6874 Chuck_Object **& sp = (Chuck_Object **&)shred->reg->sp;7155 Chuck_Object **& sp = (Chuck_Object **&)shred->reg->sp;
6875 Chuck_Object *src_obj, *dst_obj;7156 Chuck_Object *src_obj, *dst_obj;
6876 t_CKINT num_in;7157 t_CKINT num_in;
6877 7158
6878 // pop7159 // pop
6879 pop_( sp, 2 );7160 pop_( sp, 2 );
6880 // check for null7161 // check for null
6881 if( !*(sp+1) || !(*sp) ) goto null_pointer;7162 if( !*(sp+1) || !(*sp) ) goto null_pointer;
6882 7163
6883 src_obj = *sp;7164 src_obj = *sp;
6884 dst_obj = (*(sp + 1));7165 dst_obj = (*(sp + 1));
6885 7166
6886 // go for it7167 // go for it
6887 num_in = ugen_generic_num_in(dst_obj, m_dstIsArray);7168 num_in = ugen_generic_num_in(dst_obj, m_dstIsArray);
6888 for( int i = 0; i < num_in; i++ )7169 for( int i = 0; i < num_in; i++ )
@@ -6893,18 +7174,18 @@ void Chuck_Instr_UGen_Array_Link::execute( Chuck_VM * vm, Chuck_VM_Shred * shred · 4 unmodified lines
6893 goto null_pointer;7174 goto null_pointer;
6894 dst_ugen->add( src_ugen, FALSE);7175 dst_ugen->add( src_ugen, FALSE);
6895 }7176 }
6896 7177
6897 // push the second7178 // push the second
6898 push_( sp, *(sp + 1) );7179 push_( sp, *(sp + 1) );
6899 7180
6900 return;7181 return;
6901 7182
6902null_pointer:7183null_pointer:
6903 // we have a problem7184 // we have a problem
6904 CK_FPRINTF_STDERR(7185 CK_FPRINTF_STDERR(
6905 "[chuck](VM): NullPointerException: (UGen link) on line[%lu] in shred[id=%lu:%s]\n",7186 "[chuck](VM): NullPointerException: (UGen link) on line[%lu] in shred[id=%lu:%s]\n",
6906 m_linepos, shred->xid, shred->name.c_str() );7187 m_linepos, shred->xid, shred->name.c_str() );
6907 7188
6908 // do something!7189 // do something!
6909 shred->is_running = FALSE;7190 shred->is_running = FALSE;
6910 shred->is_done = TRUE;7191 shred->is_done = TRUE;
@@ -6921,7 +7202,7 @@ null_pointer: · 10 unmodified lines
6921void Chuck_Instr_UGen_UnLink::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )7202void Chuck_Instr_UGen_UnLink::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
6922{7203{
6923 Chuck_UGen **& sp = (Chuck_UGen **&)shred->reg->sp;7204 Chuck_UGen **& sp = (Chuck_UGen **&)shred->reg->sp;
6924 7205
6925 pop_( sp, 2 );7206 pop_( sp, 2 );
6926 (*(sp+1))->remove( *sp );7207 (*(sp+1))->remove( *sp );
6927 push_( sp, *(sp + 1) );7208 push_( sp, *(sp + 1) );
@@ -6937,7 +7218,7 @@ void Chuck_Instr_UGen_UnLink::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 9 unmodified lines
6937void Chuck_Instr_UGen_Ctrl::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )7218void Chuck_Instr_UGen_Ctrl::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
6938{7219{
6939 t_CKUINT *& sp = (t_CKUINT *&)shred->reg->sp;7220 t_CKUINT *& sp = (t_CKUINT *&)shred->reg->sp;
6940 7221
6941 pop_( sp, 4 );7222 pop_( sp, 4 );
6942 Chuck_UGen * ugen = (Chuck_UGen *)*(sp+1);7223 Chuck_UGen * ugen = (Chuck_UGen *)*(sp+1);
6943 f_ctrl ctrl = (f_ctrl)*(sp+2);7224 f_ctrl ctrl = (f_ctrl)*(sp+2);
@@ -6983,7 +7264,7 @@ void Chuck_Instr_UGen_CGet::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 39 unmodified lines
6983void Chuck_Instr_UGen_Ctrl2::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )7264void Chuck_Instr_UGen_Ctrl2::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
6984{7265{
6985 t_CKUINT *& sp = (t_CKUINT *&)shred->reg->sp;7266 t_CKUINT *& sp = (t_CKUINT *&)shred->reg->sp;
6986 7267
6987 pop_( sp, 4 );7268 pop_( sp, 4 );
6988 Chuck_UGen * ugen = (Chuck_UGen *)*(sp+1);7269 Chuck_UGen * ugen = (Chuck_UGen *)*(sp+1);
6989 f_ctrl ctrl = (f_ctrl)*(sp+2);7270 f_ctrl ctrl = (f_ctrl)*(sp+2);
@@ -7030,11 +7311,11 @@ void Chuck_Instr_UGen_CGet2::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 40 unmodified lines
7030void Chuck_Instr_UGen_PMsg::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )7311void Chuck_Instr_UGen_PMsg::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
7031{7312{
7032 Chuck_UGen **& sp = (Chuck_UGen **&)shred->reg->sp;7313 Chuck_UGen **& sp = (Chuck_UGen **&)shred->reg->sp;
7033 7314
7034 pop_( sp, 2 );7315 pop_( sp, 2 );
7035 7316
7036 // (*(sp + 1))->pmsg( shred->now, *sp );7317 // (*(sp + 1))->pmsg( shred->now, *sp );
7037 7318
7038 push_( sp, *(sp + 1) );7319 push_( sp, *(sp + 1) );
7039}7320}
7040 7321
@@ -7048,13 +7329,13 @@ void Chuck_Instr_UGen_PMsg::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 7 unmodified lines
7048void Chuck_Instr_Init_Loop_Counter::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )7329void Chuck_Instr_Init_Loop_Counter::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
7049{7330{
7050 t_CKINT *& sp = (t_CKINT *&)shred->reg->sp;7331 t_CKINT *& sp = (t_CKINT *&)shred->reg->sp;
7051 7332
7052 // pop the value7333 // pop the value
7053 pop_( sp, 1 );7334 pop_( sp, 1 );
7054 7335
7055 // allocate counter7336 // allocate counter
7056 t_CKUINT * p = shred->pushLoopCounter();7337 t_CKUINT * p = shred->pushLoopCounter();
7057 7338
7058 // copy it7339 // copy it
7059 *p = (t_CKUINT)(*sp >= 0 ? *sp : -*sp);7340 *p = (t_CKUINT)(*sp >= 0 ? *sp : -*sp);
7060}7341}
@@ -7070,23 +7351,23 @@ void Chuck_Instr_Dec_Loop_Counter::execute( Chuck_VM * vm, Chuck_VM_Shred * shre · 9 unmodified lines
7070{7351{
7071 // get topmost7352 // get topmost
7072 t_CKUINT * p = shred->currentLoopCounter();7353 t_CKUINT * p = shred->currentLoopCounter();
7073 7354
7074 // check7355 // check
7075 if( p == NULL ) goto error;7356 if( p == NULL ) goto error;
7076 7357
7077 // decrement7358 // decrement
7078 (*p)--;7359 (*p)--;
7079 7360
7080 // done7361 // done
7081 return;7362 return;
7082 7363
7083error:7364error:
7084 // we have a problem7365 // we have a problem
7085 CK_FPRINTF_STDERR(7366 CK_FPRINTF_STDERR(
7086 "[chuck](VM): LoopCounterError: on line[%lu] in shred[id=%lu:%s]\n",7367 "[chuck](VM): LoopCounterError: on line[%lu] in shred[id=%lu:%s]\n",
7087 m_linepos, shred->xid, shred->name.c_str() );7368 m_linepos, shred->xid, shred->name.c_str() );
7088 goto done;7369 goto done;
7089 7370
7090done:7371done:
7091 // do something!7372 // do something!
7092 shred->is_running = FALSE;7373 shred->is_running = FALSE;
@@ -7103,26 +7384,26 @@ done: · 10 unmodified lines
7103void Chuck_Instr_Reg_Push_Loop_Counter_Deref::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )7384void Chuck_Instr_Reg_Push_Loop_Counter_Deref::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
7104{7385{
7105 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;7386 t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;
7106 7387
7107 // get topmost7388 // get topmost
7108 t_CKUINT * p = shred->currentLoopCounter();7389 t_CKUINT * p = shred->currentLoopCounter();
7109 7390
7110 // check7391 // check
7111 if( p == NULL ) goto error;7392 if( p == NULL ) goto error;
7112 7393
7113 // push7394 // push
7114 push_( reg_sp, *p );7395 push_( reg_sp, *p );
7115 7396
7116 // done7397 // done
7117 return;7398 return;
7118 7399
7119error:7400error:
7120 // we have a problem7401 // we have a problem
7121 CK_FPRINTF_STDERR(7402 CK_FPRINTF_STDERR(
7122 "[chuck](VM): LoopCounterError: on line[%lu] in shred[id=%lu:%s]\n",7403 "[chuck](VM): LoopCounterError: on line[%lu] in shred[id=%lu:%s]\n",
7123 m_linepos, shred->xid, shred->name.c_str() );7404 m_linepos, shred->xid, shred->name.c_str() );
7124 goto done;7405 goto done;
7125 7406
7126done:7407done:
7127 // do something!7408 // do something!
7128 shred->is_running = FALSE;7409 shred->is_running = FALSE;
@@ -7157,28 +7438,28 @@ void Chuck_Instr_Pop_Loop_Counter::execute( Chuck_VM * vm, Chuck_VM_Shred * shre · 28 unmodified lines
7157void Chuck_Instr_IO_in_int::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )7438void Chuck_Instr_IO_in_int::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
7158{7439{
7159 t_CKINT *& sp = (t_CKINT *&)shred->reg->sp;7440 t_CKINT *& sp = (t_CKINT *&)shred->reg->sp;
7160 7441
7161 // pop the value7442 // pop the value
7162 pop_( sp, 2 );7443 pop_( sp, 2 );
7163 7444
7164 // ISSUE: 64-bit?7445 // ISSUE: 64-bit?
7165 // the IO7446 // the IO
7166 Chuck_IO **& ppIO = (Chuck_IO **&)sp;7447 Chuck_IO **& ppIO = (Chuck_IO **&)sp;
7167 7448
7168 // check it7449 // check it
7169 if( *(ppIO) == NULL ) goto null_pointer;7450 if( *(ppIO) == NULL ) goto null_pointer;
7170 7451
7171 // read into the variable7452 // read into the variable
7172 **(t_CKINT **)(sp+1) = (*ppIO)->readInt( Chuck_IO::INT32 );7453 **(t_CKINT **)(sp+1) = (*ppIO)->readInt( Chuck_IO::INT32 );
7173 7454
7174 // push the IO7455 // push the IO
7175 push_( sp, (t_CKINT)(*(ppIO)) );7456 push_( sp, (t_CKINT)(*(ppIO)) );
7176 7457
7177 return;7458 return;
7178 7459
7179null_pointer:7460null_pointer:
7180 // we have a problem7461 // we have a problem
7181 CK_FPRINTF_STDERR( 7462 CK_FPRINTF_STDERR(
7182 "[chuck](VM): NullPointerException: (IO input int) on line[%lu] in shred[id=%lu:%s]\n",7463 "[chuck](VM): NullPointerException: (IO input int) on line[%lu] in shred[id=%lu:%s]\n",
7183 m_linepos, shred->xid, shred->name.c_str() );7464 m_linepos, shred->xid, shred->name.c_str() );
7184 goto done;7465 goto done;
@@ -7199,28 +7480,28 @@ done: · 14 unmodified lines
7199void Chuck_Instr_IO_in_float::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )7480void Chuck_Instr_IO_in_float::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
7200{7481{
7201 t_CKINT *& sp = (t_CKINT *&)shred->reg->sp;7482 t_CKINT *& sp = (t_CKINT *&)shred->reg->sp;
7202 7483
7203 // issue: 64-bit7484 // issue: 64-bit
7204 // pop the value (fixed 1.3.0.0 -- changed from 3 to 2, note it's a float POINTER)7485 // pop the value (fixed 1.3.0.0 -- changed from 3 to 2, note it's a float POINTER)
7205 pop_( sp, 2 );7486 pop_( sp, 2 );
7206 7487
7207 // the IO7488 // the IO
7208 Chuck_IO **& ppIO = (Chuck_IO **&)sp;7489 Chuck_IO **& ppIO = (Chuck_IO **&)sp;
7209 7490
7210 // check it7491 // check it
7211 if( *(ppIO) == NULL ) goto null_pointer;7492 if( *(ppIO) == NULL ) goto null_pointer;
7212 7493
7213 // read into the variable7494 // read into the variable
7214 **(t_CKFLOAT **)(sp+1) = (*ppIO)->readFloat();7495 **(t_CKFLOAT **)(sp+1) = (*ppIO)->readFloat();
7215 7496
7216 // push the IO7497 // push the IO
7217 push_( sp, (t_CKINT)(*(ppIO)) );7498 push_( sp, (t_CKINT)(*(ppIO)) );
7218 7499
7219 return;7500 return;
7220 7501
7221null_pointer:7502null_pointer:
7222 // we have a problem7503 // we have a problem
7223 CK_FPRINTF_STDERR( 7504 CK_FPRINTF_STDERR(
7224 "[chuck](VM): NullPointerException: (IO input float) on line[%lu] in shred[id=%lu:%s]\n",7505 "[chuck](VM): NullPointerException: (IO input float) on line[%lu] in shred[id=%lu:%s]\n",
7225 m_linepos, shred->xid, shred->name.c_str() );7506 m_linepos, shred->xid, shred->name.c_str() );
7226 goto done;7507 goto done;
@@ -7241,36 +7522,36 @@ done: · 14 unmodified lines
7241void Chuck_Instr_IO_in_string::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )7522void Chuck_Instr_IO_in_string::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
7242{7523{
7243 t_CKINT *& sp = (t_CKINT *&)shred->reg->sp;7524 t_CKINT *& sp = (t_CKINT *&)shred->reg->sp;
7244 7525
7245 // pop the value7526 // pop the value
7246 pop_( sp, 2 );7527 pop_( sp, 2 );
7247 7528
7248 // issue: 64-bit7529 // issue: 64-bit
7249 // the IO7530 // the IO
7250 Chuck_IO ** ppIO = (Chuck_IO **)sp;7531 Chuck_IO ** ppIO = (Chuck_IO **)sp;
7251 // the string7532 // the string
7252 Chuck_String ** ppStr = (Chuck_String **)(sp+1);7533 Chuck_String ** ppStr = (Chuck_String **)(sp+1);
7253 std::string s; // = (*ppStr)->str();7534 std::string s; // = (*ppStr)->str();
7254 7535
7255// CK_FPRINTF_STDERR( "ppIO: 0x%08x\n", ppIO );7536// CK_FPRINTF_STDERR( "ppIO: 0x%08x\n", ppIO );
7256// CK_FPRINTF_STDERR( "ppStr: 0x%08x\n", ppStr );7537// CK_FPRINTF_STDERR( "ppStr: 0x%08x\n", ppStr );
7257// CK_FPRINTF_STDERR( "*ppStr: 0x%08x\n", *ppStr );7538// CK_FPRINTF_STDERR( "*ppStr: 0x%08x\n", *ppStr );
7258 7539
7259 // check it7540 // check it
7260 if( *(ppIO) == NULL || *(ppStr) == NULL ) goto null_pointer;7541 if( *(ppIO) == NULL || *(ppStr) == NULL ) goto null_pointer;
7261 7542
7262 // read into the variable7543 // read into the variable
7263 (*ppIO)->readString( s );7544 (*ppIO)->readString( s );
7264 (*ppStr)->set( s );7545 (*ppStr)->set( s );
7265 7546
7266 // push the IO7547 // push the IO
7267 push_( sp, (t_CKINT)(*(ppIO)) );7548 push_( sp, (t_CKINT)(*(ppIO)) );
7268 7549
7269 return;7550 return;
7270 7551
7271null_pointer:7552null_pointer:
7272 // we have a problem7553 // we have a problem
7273 CK_FPRINTF_STDERR( 7554 CK_FPRINTF_STDERR(
7274 "[chuck](VM): NullPointerException: (IO input string) on line[%lu] in shred[id=%lu:%s]\n",7555 "[chuck](VM): NullPointerException: (IO input string) on line[%lu] in shred[id=%lu:%s]\n",
7275 m_linepos, shred->xid, shred->name.c_str() );7556 m_linepos, shred->xid, shred->name.c_str() );
7276 goto done;7557 goto done;
@@ -7291,32 +7572,32 @@ done: · 14 unmodified lines
7291void Chuck_Instr_IO_out_int::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )7572void Chuck_Instr_IO_out_int::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
7292{7573{
7293 t_CKINT *& sp = (t_CKINT *&)shred->reg->sp;7574 t_CKINT *& sp = (t_CKINT *&)shred->reg->sp;
7294 7575
7295 // pop the value7576 // pop the value
7296 pop_( sp, 2 );7577 pop_( sp, 2 );
7297 7578
7298 // issue: 64-bit7579 // issue: 64-bit
7299 // the IO7580 // the IO
7300 Chuck_IO **& ppIO = (Chuck_IO **&)sp;7581 Chuck_IO **& ppIO = (Chuck_IO **&)sp;
7301 7582
7302 // check it7583 // check it
7303 if( *(ppIO) == NULL ) goto null_pointer;7584 if( *(ppIO) == NULL ) goto null_pointer;
7304 7585
7305 // write the value7586 // write the value
7306 (*ppIO)->write( *(sp+1) );7587 (*ppIO)->write( *(sp+1) );
7307 7588
7308 // push the IO7589 // push the IO
7309 push_( sp, (t_CKINT)(*(ppIO)) );7590 push_( sp, (t_CKINT)(*(ppIO)) );
7310 7591
7311 return;7592 return;
7312 7593
7313null_pointer:7594null_pointer:
7314 // we have a problem7595 // we have a problem
7315 CK_FPRINTF_STDERR( 7596 CK_FPRINTF_STDERR(
7316 "[chuck](VM): NullPointerException: (IO output int) on line[%lu] in shred[id=%lu:%s]\n",7597 "[chuck](VM): NullPointerException: (IO output int) on line[%lu] in shred[id=%lu:%s]\n",
7317 m_linepos, shred->xid, shred->name.c_str() );7598 m_linepos, shred->xid, shred->name.c_str() );
7318 goto done;7599 goto done;
7319 7600
7320done:7601done:
7321 // do something!7602 // do something!
7322 shred->is_running = FALSE;7603 shred->is_running = FALSE;
@@ -7333,32 +7614,32 @@ done: · 10 unmodified lines
7333void Chuck_Instr_IO_out_float::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )7614void Chuck_Instr_IO_out_float::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
7334{7615{
7335 t_CKINT *& sp = (t_CKINT *&)shred->reg->sp;7616 t_CKINT *& sp = (t_CKINT *&)shred->reg->sp;
7336 7617
7337 // pop the value7618 // pop the value
7338 pop_( sp, 1 + (sz_FLOAT / sz_INT) ); // ISSUE: 64-bit (fixed 1.3.1.0)7619 pop_( sp, 1 + (sz_FLOAT / sz_INT) ); // ISSUE: 64-bit (fixed 1.3.1.0)
7339 7620
7340 // ISSUE: 64-bit7621 // ISSUE: 64-bit
7341 // the IO7622 // the IO
7342 Chuck_IO **& ppIO = (Chuck_IO **&)sp;7623 Chuck_IO **& ppIO = (Chuck_IO **&)sp;
7343 7624
7344 // check it7625 // check it
7345 if( *(ppIO) == NULL ) goto null_pointer;7626 if( *(ppIO) == NULL ) goto null_pointer;
7346 7627
7347 // write the value7628 // write the value
7348 (*ppIO)->write( *((t_CKFLOAT *)(sp+1)) );7629 (*ppIO)->write( *((t_CKFLOAT *)(sp+1)) );
7349 7630
7350 // push the IO7631 // push the IO
7351 push_( sp, (t_CKINT)(*(ppIO)) );7632 push_( sp, (t_CKINT)(*(ppIO)) );
7352 7633
7353 return;7634 return;
7354 7635
7355null_pointer:7636null_pointer:
7356 // we have a problem7637 // we have a problem
7357 CK_FPRINTF_STDERR( 7638 CK_FPRINTF_STDERR(
7358 "[chuck](VM): NullPointerException: (IO output float) on line[%lu] in shred[id=%lu:%s]\n",7639 "[chuck](VM): NullPointerException: (IO output float) on line[%lu] in shred[id=%lu:%s]\n",
7359 m_linepos, shred->xid, shred->name.c_str() );7640 m_linepos, shred->xid, shred->name.c_str() );
7360 goto done;7641 goto done;
7361 7642
7362done:7643done:
7363 // do something!7644 // do something!
7364 shred->is_running = FALSE;7645 shred->is_running = FALSE;
@@ -7375,34 +7656,34 @@ done: · 10 unmodified lines
7375void Chuck_Instr_IO_out_string::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )7656void Chuck_Instr_IO_out_string::execute( Chuck_VM * vm, Chuck_VM_Shred * shred )
7376{7657{
7377 t_CKINT *& sp = (t_CKINT *&)shred->reg->sp;7658 t_CKINT *& sp = (t_CKINT *&)shred->reg->sp;
7378 7659
7379 // pop the value7660 // pop the value
7380 pop_( sp, 2 );7661 pop_( sp, 2 );
7381 7662
7382 // ISSUE: 64-bit7663 // ISSUE: 64-bit
7383 // the IO7664 // the IO
7384 Chuck_IO ** ppIO = (Chuck_IO **)sp;7665 Chuck_IO ** ppIO = (Chuck_IO **)sp;
7385 // the string7666 // the string
7386 Chuck_String ** ppStr = (Chuck_String **)(sp+1);7667 Chuck_String ** ppStr = (Chuck_String **)(sp+1);
7387 7668
7388 // check it7669 // check it
7389 if( *(ppIO) == NULL || *(ppStr) == NULL ) goto null_pointer;7670 if( *(ppIO) == NULL || *(ppStr) == NULL ) goto null_pointer;
7390 7671
7391 // write the variable7672 // write the variable
7392 (*ppIO)->write( (*ppStr)->str().c_str() );7673 (*ppIO)->write( (*ppStr)->str().c_str() );
7393 7674
7394 // push the IO7675 // push the IO
7395 push_( sp, (t_CKINT)(*(ppIO)) );7676 push_( sp, (t_CKINT)(*(ppIO)) );
7396 7677
7397 return;7678 return;
7398 7679
7399null_pointer:7680null_pointer:
7400 // we have a problem7681 // we have a problem
7401 CK_FPRINTF_STDERR( 7682 CK_FPRINTF_STDERR(
7402 "[chuck](VM): NullPointerException: (IO output string) on line[%lu] in shred[id=%lu:%s]\n",7683 "[chuck](VM): NullPointerException: (IO output string) on line[%lu] in shred[id=%lu:%s]\n",
7403 m_linepos, shred->xid, shred->name.c_str() );7684 m_linepos, shred->xid, shred->name.c_str() );
7404 goto done;7685 goto done;
7405 7686
7406done:7687done:
7407 // do something!7688 // do something!
7408 shred->is_running = FALSE;7689 shred->is_running = FALSE;
@@ -7430,17 +7711,27 @@ void Chuck_Instr_Hack::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 21 unmodified lines
7430 if( m_type_ref->size == sz_INT && iskindofint(vm->env(), m_type_ref) ) // ISSUE: 64-bit (fixed 1.3.1.0)7711 if( m_type_ref->size == sz_INT && iskindofint(vm->env(), m_type_ref) ) // ISSUE: 64-bit (fixed 1.3.1.0)
7431 {7712 {
7432 t_CKINT * sp = (t_CKINT *)shred->reg->sp;7713 t_CKINT * sp = (t_CKINT *)shred->reg->sp;
7433 if( !isa( m_type_ref, vm->env()->t_string ) || *(sp-1) == 0 )7714 Chuck_Object * obj = ((Chuck_Object *)*(sp-1));
7715 if( !isa( m_type_ref, vm->env()->t_string ) || *(sp-1) == 0 )
7434 {7716 {
7435 // print it7717 // print it
7436 if( *(sp-1) == 0 && isa( m_type_ref, vm->env()->t_object ) )7718 if( isa( m_type_ref, vm->env()->t_object ) )
7437 CK_FPRINTF_STDERR( "null :(%s)\n", m_type_ref->c_name() );7719 {
7720 if( obj == NULL )
7721 {
7722 CK_FPRINTF_STDERR( "null :(%s)\n", m_type_ref->c_name() );
7723 }
7724 else
7725 {
7726 CK_FPRINTF_STDERR( "0x%lx :(%s|refcount=%d)\n", *(sp-1), m_type_ref->c_name(), obj->m_ref_count );
7727 }
7728 }
7438 else7729 else
7439 CK_FPRINTF_STDERR( "%ld :(%s)\n", *(sp-1), m_type_ref->c_name() );7730 CK_FPRINTF_STDERR( "%d :(%s)\n", *(sp-1), m_type_ref->c_name() );
7440 }7731 }
7441 else7732 else
7442 {7733 {
7443 CK_FPRINTF_STDERR( "\"%s\" : (%s)\n", ((Chuck_String *)*(sp-1))->str().c_str(), m_type_ref->c_name() );7734 CK_FPRINTF_STDERR( "\"%s\" :(%s)\n", ((Chuck_String *)obj)->str().c_str(), m_type_ref->c_name() );
7444 }7735 }
7445 }7736 }
7446 else if( m_type_ref->size == sz_FLOAT ) // ISSUE: 64-bit (fixed 1.3.1.0)7737 else if( m_type_ref->size == sz_FLOAT ) // ISSUE: 64-bit (fixed 1.3.1.0)
@@ -7507,8 +7798,8 @@ void Chuck_Instr_Hack::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 60 unmodified lines
7507 7798
7508const char * Chuck_Instr_Hack::params() const7799const char * Chuck_Instr_Hack::params() const
7509{7800{
7510 static char buffer[256];7801 static char buffer[CK_PRINT_BUF_LENGTH];
7511 sprintf( buffer, "(%s)", m_type_ref->c_name() );7802 snprintf( buffer, CK_PRINT_BUF_LENGTH, "(%s)", m_type_ref->c_name() );
7512 return buffer;7803 return buffer;
7513}7804}
7514 7805
@@ -7562,11 +7853,12 @@ void Chuck_Instr_Gack::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 47 unmodified lines
7562 {7853 {
7563 if( isa( type, vm->env()->t_object ) )7854 if( isa( type, vm->env()->t_object ) )
7564 {7855 {
7856 Chuck_Object * obj = ((Chuck_Object *)(*sp));
7565 // print it7857 // print it
7566 if( *(sp) == 0 )7858 if( *(sp) == 0 )
7567 CK_FPRINTF_STDERR( "null " );7859 CK_FPRINTF_STDERR( "null " );
7568 else7860 else
7569 CK_FPRINTF_STDERR( "0x%lx ", *(sp) );7861 CK_FPRINTF_STDERR( "0x%lx (refcount=%d)", *(sp), obj->m_ref_count );
7570 }7862 }
7571 else7863 else
7572 {7864 {
@@ -7608,7 +7900,7 @@ void Chuck_Instr_Gack::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 35 unmodified lines
7608 if( type->xid == te_vec3 )7900 if( type->xid == te_vec3 )
7609 // print it7901 // print it
7610 CK_FPRINTF_STDERR( "#(%.4f,%.4f,%.4f) ", *(sp), *(sp+1), *(sp+2) );7902 CK_FPRINTF_STDERR( "#(%.4f,%.4f,%.4f) ", *(sp), *(sp+1), *(sp+2) );
7611 7903
7612 the_sp += sz_VEC3; // ISSUE: 64-bit (fixed 1.3.1.0)7904 the_sp += sz_VEC3; // ISSUE: 64-bit (fixed 1.3.1.0)
7613 }7905 }
7614 else if( type->size == sz_VEC4 ) // 1.3.5.37906 else if( type->size == sz_VEC4 ) // 1.3.5.3
@@ -7617,7 +7909,7 @@ void Chuck_Instr_Gack::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 2 unmodified lines
7617 if( type->xid == te_vec4 )7909 if( type->xid == te_vec4 )
7618 // print it7910 // print it
7619 CK_FPRINTF_STDERR( "#(%.4f,%.4f,%.4f,%.4f) ", *(sp), *(sp+1), *(sp+2), *(sp+3) );7911 CK_FPRINTF_STDERR( "#(%.4f,%.4f,%.4f,%.4f) ", *(sp), *(sp+1), *(sp+2), *(sp+3) );
7620 7912
7621 the_sp += sz_VEC4; // ISSUE: 64-bit (fixed 1.3.1.0)7913 the_sp += sz_VEC4; // ISSUE: 64-bit (fixed 1.3.1.0)
7622 }7914 }
7623 else if( type->size == 0 )7915 else if( type->size == 0 )
@@ -7629,15 +7921,15 @@ void Chuck_Instr_Gack::execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) · 5 unmodified lines
7629 }7921 }
7630 7922
7631 CK_FPRINTF_STDERR( "\n" );7923 CK_FPRINTF_STDERR( "\n" );
7632 7924
7633 // flush7925 // flush
7634 CK_FFLUSH_STDERR();7926 CK_FFLUSH_STDERR();
7635}7927}
7636 7928
7637const char * Chuck_Instr_Gack::params() const7929const char * Chuck_Instr_Gack::params() const
7638{7930{
7639 static char buffer[256];7931 static char buffer[CK_PRINT_BUF_LENGTH];
7640 sprintf( buffer, "( many types )" );7932 snprintf( buffer, CK_PRINT_BUF_LENGTH, "( many types )" );
7641 return buffer;7933 return buffer;
7642}7934}
7643 7935
src/core/chuck_instr.h+162−92
@@ -44,6 +44,9 @@ struct Chuck_VM_Shred; · 43 unmodified lines
44struct Chuck_Type;44struct Chuck_Type;
45struct Chuck_Func;45struct Chuck_Func;
46 46
47// 1.4.2.0 (ge) | added for switching from snprintf()
48#define CK_PRINT_BUF_LENGTH 256
49
47 50
48 51
49 52
@@ -55,19 +58,25 @@ struct Chuck_Instr · 5 unmodified lines
55{58{
56public:59public:
57 Chuck_Instr();60 Chuck_Instr();
58 virtual ~Chuck_Instr() { }61 virtual ~Chuck_Instr() { SAFE_DELETE(m_codestr); }
59 62
60public:63public:
61 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) = 0;64 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred ) = 0;
62 65
63public:66public:
64 virtual const char * name() const;67 virtual const char * name() const;
65 virtual const char * params() const 68 virtual const char * params() const
66 { return ""; }69 { return ""; }
67 70
68public:71public:
72 // store line position for error messages
69 void set_linepos( t_CKUINT linepos );73 void set_linepos( t_CKUINT linepos );
70 t_CKUINT m_linepos;74 t_CKUINT m_linepos;
75
76 // set codestr associated with this instruction
77 void set_codestr( const std::string & str );
78 // (used in instruction dump) | 1.4.2.1 (ge) added
79 std::string * m_codestr;
71};80};
72 81
73 82
@@ -84,7 +93,7 @@ public: · 10 unmodified lines
84 93
85public:94public:
86 virtual const char * params() const95 virtual const char * params() const
87 { static char buffer[256]; sprintf( buffer, "%ld", (long)m_jmp ); return buffer; }96 { static char buffer[CK_PRINT_BUF_LENGTH]; snprintf( buffer, CK_PRINT_BUF_LENGTH, "%ld", (long)m_jmp ); return buffer; }
88 97
89protected:98protected:
90 t_CKUINT m_jmp;99 t_CKUINT m_jmp;
@@ -105,7 +114,7 @@ public: · 14 unmodified lines
105 114
106public:115public:
107 virtual const char * params() const116 virtual const char * params() const
108 { static char buffer[256]; sprintf( buffer, "%ld", (long)m_val ); return buffer; }117 { static char buffer[CK_PRINT_BUF_LENGTH]; snprintf( buffer, CK_PRINT_BUF_LENGTH, "%ld", (long)m_val ); return buffer; }
109 118
110protected:119protected:
111 t_CKUINT m_val;120 t_CKUINT m_val;
@@ -126,7 +135,7 @@ public: · 14 unmodified lines
126 135
127public:136public:
128 virtual const char * params() const137 virtual const char * params() const
129 { static char buffer[256]; sprintf( buffer, "%.6f", m_val ); return buffer; }138 { static char buffer[CK_PRINT_BUF_LENGTH]; snprintf( buffer, CK_PRINT_BUF_LENGTH, "%.6f", m_val ); return buffer; }
130 139
131protected:140protected:
132 t_CKFLOAT m_val;141 t_CKFLOAT m_val;
@@ -2014,6 +2023,23 @@ protected: · 1881 unmodified lines
2014 2023
2015 2024
2016 2025
2026//-----------------------------------------------------------------------------
2027// name: struct Chuck_Instr_Reg_Push_Zero
2028// desc: push immediate value 0 to reg stack with specific width
2029//-----------------------------------------------------------------------------
2030struct Chuck_Instr_Reg_Push_Zero : public Chuck_Instr_Unary_Op
2031{
2032public:
2033 Chuck_Instr_Reg_Push_Zero( t_CKUINT sizeInBytes )
2034 { this->set( sizeInBytes ); }
2035
2036public:
2037 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2038};
2039
2040
2041
2042
2017//-----------------------------------------------------------------------------2043//-----------------------------------------------------------------------------
2018// name: struct Chuck_Instr_Reg_Dup_Last2044// name: struct Chuck_Instr_Reg_Dup_Last
2019// desc: duplicate last value on reg stack2045// desc: duplicate last value on reg stack
@@ -2133,8 +2159,8 @@ public: · 113 unmodified lines
2133public:2159public:
2134 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2160 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2135 virtual const char * params() const2161 virtual const char * params() const
2136 { static char buffer[256];2162 { static char buffer[CK_PRINT_BUF_LENGTH];
2137 sprintf( buffer, "src=%ld, base=%ld", (long)m_val, (long)base );2163 snprintf( buffer, CK_PRINT_BUF_LENGTH, "src=%ld, base=%ld", (long)m_val, (long)base );
2138 return buffer; }2164 return buffer; }
2139 2165
2140protected:2166protected:
@@ -2158,8 +2184,8 @@ public: · 17 unmodified lines
2158public:2184public:
2159 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2185 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2160 virtual const char * params() const2186 virtual const char * params() const
2161 { static char buffer[256];2187 { static char buffer[CK_PRINT_BUF_LENGTH];
2162 sprintf( buffer, "src=%ld, base=%ld", (long)m_val, (long)base );2188 snprintf( buffer, CK_PRINT_BUF_LENGTH, "src=%ld, base=%ld", (long)m_val, (long)base );
2163 return buffer; }2189 return buffer; }
2164 2190
2165protected:2191protected:
@@ -2183,8 +2209,8 @@ public: · 17 unmodified lines
2183public:2209public:
2184 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2210 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2185 virtual const char * params() const2211 virtual const char * params() const
2186 { static char buffer[256];2212 { static char buffer[CK_PRINT_BUF_LENGTH];
2187 sprintf( buffer, "src=%ld, base=%ld", (long)m_val, (long)base );2213 snprintf( buffer, CK_PRINT_BUF_LENGTH, "src=%ld, base=%ld", (long)m_val, (long)base );
2188 return buffer; }2214 return buffer; }
2189 2215
2190protected:2216protected:
@@ -2204,14 +2230,14 @@ struct Chuck_Instr_Reg_Push_Mem_Vec3 : public Chuck_Instr_Unary_Op · 13 unmodified lines
2204public:2230public:
2205 Chuck_Instr_Reg_Push_Mem_Vec3( t_CKUINT src, t_CKBOOL use_base = FALSE )2231 Chuck_Instr_Reg_Push_Mem_Vec3( t_CKUINT src, t_CKBOOL use_base = FALSE )
2206 { this->set( src ); base = use_base; }2232 { this->set( src ); base = use_base; }
2207 2233
2208public:2234public:
2209 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2235 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2210 virtual const char * params() const2236 virtual const char * params() const
2211 { static char buffer[256];2237 { static char buffer[CK_PRINT_BUF_LENGTH];
2212 sprintf( buffer, "src=%ld, base=%ld", (long)m_val, (long)base );2238 snprintf( buffer, CK_PRINT_BUF_LENGTH, "src=%ld, base=%ld", (long)m_val, (long)base );
2213 return buffer; }2239 return buffer; }
2214 2240
2215protected:2241protected:
2216 // use global stack base2242 // use global stack base
2217 t_CKBOOL base;2243 t_CKBOOL base;
@@ -2229,14 +2255,14 @@ struct Chuck_Instr_Reg_Push_Mem_Vec4 : public Chuck_Instr_Unary_Op · 11 unmodified lines
2229public:2255public:
2230 Chuck_Instr_Reg_Push_Mem_Vec4( t_CKUINT src, t_CKBOOL use_base = FALSE )2256 Chuck_Instr_Reg_Push_Mem_Vec4( t_CKUINT src, t_CKBOOL use_base = FALSE )
2231 { this->set( src ); base = use_base; }2257 { this->set( src ); base = use_base; }
2232 2258
2233public:2259public:
2234 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2260 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2235 virtual const char * params() const2261 virtual const char * params() const
2236 { static char buffer[256];2262 { static char buffer[CK_PRINT_BUF_LENGTH];
2237 sprintf( buffer, "src=%ld, base=%ld", (long)m_val, (long)base );2263 snprintf( buffer, CK_PRINT_BUF_LENGTH, "src=%ld, base=%ld", (long)m_val, (long)base );
2238 return buffer; }2264 return buffer; }
2239 2265
2240protected:2266protected:
2241 // use global stack base2267 // use global stack base
2242 t_CKBOOL base;2268 t_CKBOOL base;
@@ -2258,8 +2284,8 @@ public: · 15 unmodified lines
2258public:2284public:
2259 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2285 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2260 virtual const char * params() const2286 virtual const char * params() const
2261 { static char buffer[256];2287 { static char buffer[CK_PRINT_BUF_LENGTH];
2262 sprintf( buffer, "name='%s'", m_name.c_str() );2288 snprintf( buffer, CK_PRINT_BUF_LENGTH, "name='%s'", m_name.c_str() );
2263 return buffer; }2289 return buffer; }
2264 2290
2265public:2291public:
@@ -2283,8 +2309,8 @@ public: · 17 unmodified lines
2283public:2309public:
2284 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2310 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2285 virtual const char * params() const2311 virtual const char * params() const
2286 { static char buffer[256];2312 { static char buffer[CK_PRINT_BUF_LENGTH];
2287 sprintf( buffer, "src=%ld, base=%ld", (long)m_val, (long)base );2313 snprintf( buffer, CK_PRINT_BUF_LENGTH, "src=%ld, base=%ld", (long)m_val, (long)base );
2288 return buffer; }2314 return buffer; }
2289 2315
2290protected:2316protected:
@@ -2308,8 +2334,8 @@ public: · 17 unmodified lines
2308public:2334public:
2309 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2335 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2310 virtual const char * params() const2336 virtual const char * params() const
2311 { static char buffer[256];2337 { static char buffer[CK_PRINT_BUF_LENGTH];
2312 sprintf( buffer, "name='%s'", m_name.c_str() );2338 snprintf( buffer, CK_PRINT_BUF_LENGTH, "name='%s'", m_name.c_str() );
2313 return buffer; }2339 return buffer; }
2314 2340
2315protected:2341protected:
@@ -2364,12 +2390,12 @@ struct Chuck_Instr_Mem_Set_Imm : public Chuck_Instr · 48 unmodified lines
2364public:2390public:
2365 Chuck_Instr_Mem_Set_Imm( t_CKUINT offset, t_CKUINT val )2391 Chuck_Instr_Mem_Set_Imm( t_CKUINT offset, t_CKUINT val )
2366 { m_offset = offset; m_val = val; }2392 { m_offset = offset; m_val = val; }
2367 2393
2368public:2394public:
2369 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2395 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2370 virtual const char * params() const2396 virtual const char * params() const
2371 { static char buffer[256];2397 { static char buffer[CK_PRINT_BUF_LENGTH];
2372 sprintf( buffer, "offset=%ld, value=%ld", (long)m_offset, (long)m_val );2398 snprintf( buffer, CK_PRINT_BUF_LENGTH, "offset=%ld, value=%ld", (long)m_offset, (long)m_val );
2373 return buffer; }2399 return buffer; }
2374 2400
2375protected:2401protected:
@@ -2389,12 +2415,12 @@ struct Chuck_Instr_Mem_Set_Imm2 : public Chuck_Instr_Unary_Op · 13 unmodified lines
2389public:2415public:
2390 Chuck_Instr_Mem_Set_Imm2( t_CKUINT offset, t_CKFLOAT val )2416 Chuck_Instr_Mem_Set_Imm2( t_CKUINT offset, t_CKFLOAT val )
2391 { m_offset = offset; m_val = val; }2417 { m_offset = offset; m_val = val; }
2392 2418
2393public:2419public:
2394 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2420 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2395 virtual const char * params() const2421 virtual const char * params() const
2396 { static char buffer[256];2422 { static char buffer[CK_PRINT_BUF_LENGTH];
2397 sprintf( buffer, "offset=%ld, value=%f", (long)m_offset, m_val );2423 snprintf( buffer, CK_PRINT_BUF_LENGTH, "offset=%ld, value=%f", (long)m_offset, m_val );
2398 return buffer; }2424 return buffer; }
2399 2425
2400protected:2426protected:
@@ -2414,7 +2440,7 @@ struct Chuck_Instr_Mem_Push_Imm : public Chuck_Instr_Unary_Op · 13 unmodified lines
2414public:2440public:
2415 Chuck_Instr_Mem_Push_Imm( t_CKUINT src )2441 Chuck_Instr_Mem_Push_Imm( t_CKUINT src )
2416 { this->set( src ); }2442 { this->set( src ); }
2417 2443
2418public:2444public:
2419 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2445 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2420};2446};
@@ -2430,7 +2456,7 @@ struct Chuck_Instr_Mem_Push_Imm2 : public Chuck_Instr_Unary_Op2 · 9 unmodified lines
2430public:2456public:
2431 Chuck_Instr_Mem_Push_Imm2( t_CKFLOAT src )2457 Chuck_Instr_Mem_Push_Imm2( t_CKFLOAT src )
2432 { this->set( src ); }2458 { this->set( src ); }
2433 2459
2434public:2460public:
2435 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2461 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2436};2462};
@@ -2513,10 +2539,10 @@ public: · 76 unmodified lines
2513 // (added 1.3.0.0 -- is_object)2539 // (added 1.3.0.0 -- is_object)
2514 Chuck_Instr_Alloc_Word( t_CKUINT offset, t_CKBOOL is_object )2540 Chuck_Instr_Alloc_Word( t_CKUINT offset, t_CKBOOL is_object )
2515 { this->set( offset ); m_is_object = is_object; }2541 { this->set( offset ); m_is_object = is_object; }
2516 2542
2517 // was this object reference? (added 1.3.0.0)2543 // was this object reference? (added 1.3.0.0)
2518 t_CKBOOL m_is_object;2544 t_CKBOOL m_is_object;
2519 2545
2520 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2546 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2521};2547};
2522 2548
@@ -2532,7 +2558,7 @@ struct Chuck_Instr_Alloc_Word2 : public Chuck_Instr_Unary_Op · 9 unmodified lines
2532public:2558public:
2533 Chuck_Instr_Alloc_Word2( t_CKUINT offset )2559 Chuck_Instr_Alloc_Word2( t_CKUINT offset )
2534 { this->set( offset ); }2560 { this->set( offset ); }
2535 2561
2536 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2562 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2537};2563};
2538 2564
@@ -2564,7 +2590,7 @@ struct Chuck_Instr_Alloc_Vec3 : public Chuck_Instr_Unary_Op · 25 unmodified lines
2564public:2590public:
2565 Chuck_Instr_Alloc_Vec3( t_CKUINT offset )2591 Chuck_Instr_Alloc_Vec3( t_CKUINT offset )
2566 { this->set( offset ); }2592 { this->set( offset ); }
2567 2593
2568 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2594 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2569};2595};
2570 2596
@@ -2580,7 +2606,7 @@ struct Chuck_Instr_Alloc_Vec4 : public Chuck_Instr_Unary_Op · 9 unmodified lines
2580public:2606public:
2581 Chuck_Instr_Alloc_Vec4( t_CKUINT offset )2607 Chuck_Instr_Alloc_Vec4( t_CKUINT offset )
2582 { this->set( offset ); }2608 { this->set( offset ); }
2583 2609
2584 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2610 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2585};2611};
2586 2612
@@ -2644,7 +2670,7 @@ struct Chuck_Instr_Alloc_Member_Vec3 : public Chuck_Instr_Unary_Op · 57 unmodified lines
2644public:2670public:
2645 Chuck_Instr_Alloc_Member_Vec3( t_CKUINT offset )2671 Chuck_Instr_Alloc_Member_Vec3( t_CKUINT offset )
2646 { this->set( offset ); }2672 { this->set( offset ); }
2647 2673
2648 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2674 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2649};2675};
2650 2676
@@ -2660,7 +2686,7 @@ struct Chuck_Instr_Alloc_Member_Vec4 : public Chuck_Instr_Unary_Op · 9 unmodified lines
2660public:2686public:
2661 Chuck_Instr_Alloc_Member_Vec4( t_CKUINT offset )2687 Chuck_Instr_Alloc_Member_Vec4( t_CKUINT offset )
2662 { this->set( offset ); }2688 { this->set( offset ); }
2663 2689
2664 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2690 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2665};2691};
2666 2692
@@ -2678,22 +2704,22 @@ public: · 11 unmodified lines
2678 Chuck_Instr_Alloc_Word_Global()2704 Chuck_Instr_Alloc_Word_Global()
2679 { this->set( 0 ); m_stack_offset = 0; m_chuck_type = NULL;2705 { this->set( 0 ); m_stack_offset = 0; m_chuck_type = NULL;
2680 m_should_execute_ctors = FALSE; m_is_array = FALSE; }2706 m_should_execute_ctors = FALSE; m_is_array = FALSE; }
2681 2707
2682 virtual const char * params() const2708 virtual const char * params() const
2683 { static char buffer[256];2709 { static char buffer[CK_PRINT_BUF_LENGTH];
2684 sprintf( buffer, "name='%s'", m_name.c_str() );2710 snprintf( buffer, CK_PRINT_BUF_LENGTH, "name='%s'", m_name.c_str() );
2685 return buffer; }2711 return buffer; }
2686 2712
2687 // global name and type2713 // global name and type
2688 std::string m_name;2714 std::string m_name;
2689 te_GlobalType m_type;2715 te_GlobalType m_type;
2690 t_CKBOOL m_is_array;2716 t_CKBOOL m_is_array;
2691 2717
2692 // for objects2718 // for objects
2693 t_CKBOOL m_should_execute_ctors;2719 t_CKBOOL m_should_execute_ctors;
2694 t_CKUINT m_stack_offset;2720 t_CKUINT m_stack_offset;
2695 Chuck_Type * m_chuck_type;2721 Chuck_Type * m_chuck_type;
2696 2722
2697 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2723 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2698};2724};
2699 2725
@@ -2946,7 +2972,7 @@ struct Chuck_Instr_AddRef_Object2 : public Chuck_Instr_Unary_Op · 246 unmodified lines
2946public:2972public:
2947 Chuck_Instr_AddRef_Object2( t_CKUINT offset )2973 Chuck_Instr_AddRef_Object2( t_CKUINT offset )
2948 { this->set( offset ); }2974 { this->set( offset ); }
2949 2975
2950public:2976public:
2951 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );2977 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
2952};2978};
@@ -2957,6 +2983,7 @@ public: · 4 unmodified lines
2957//-----------------------------------------------------------------------------2983//-----------------------------------------------------------------------------
2958// name: struct Chuck_Instr_Reg_AddRef_Object32984// name: struct Chuck_Instr_Reg_AddRef_Object3
2959// desc: added 1.3.0.0 -- does the ref add in-place2985// desc: added 1.3.0.0 -- does the ref add in-place
2986// operates on top of the register stack
2960//-----------------------------------------------------------------------------2987//-----------------------------------------------------------------------------
2961struct Chuck_Instr_Reg_AddRef_Object3 : public Chuck_Instr2988struct Chuck_Instr_Reg_AddRef_Object3 : public Chuck_Instr
2962{2989{
@@ -2969,7 +2996,7 @@ public: · 6 unmodified lines
2969 2996
2970//-----------------------------------------------------------------------------2997//-----------------------------------------------------------------------------
2971// name: struct Chuck_Instr_Release_Object2998// name: struct Chuck_Instr_Release_Object
2972// desc: ...2999// desc: release object on stack by its offset
2973//-----------------------------------------------------------------------------3000//-----------------------------------------------------------------------------
2974struct Chuck_Instr_Release_Object : public Chuck_Instr3001struct Chuck_Instr_Release_Object : public Chuck_Instr
2975{3002{
@@ -2998,6 +3025,38 @@ public: · 22 unmodified lines
2998 3025
2999 3026
3000 3027
3028//-----------------------------------------------------------------------------
3029// name: struct Chuck_Instr_Release_Object3_Pop_Word
3030// desc: release object reference + pop from reg stack | 1.4.2.1 (ge) added
3031// the variant assumes object pointer directly on stack (not offset)
3032//-----------------------------------------------------------------------------
3033struct Chuck_Instr_Release_Object3_Pop_Word : public Chuck_Instr
3034{
3035public:
3036 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3037};
3038
3039
3040
3041
3042//-----------------------------------------------------------------------------
3043// name: struct Chuck_Instr_Release_Object4
3044// desc: release object reference from reg stack (no pop) | 1.4.2.1 (ge) added
3045// the variant assumes object pointer directly on stack (not offset)
3046//-----------------------------------------------------------------------------
3047struct Chuck_Instr_Release_Object4 : public Chuck_Instr_Unary_Op
3048{
3049public:
3050 Chuck_Instr_Release_Object4( t_CKUINT offset )
3051 { this->set( offset ); }
3052
3053public:
3054 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3055};
3056
3057
3058
3059
3001//-----------------------------------------------------------------------------3060//-----------------------------------------------------------------------------
3002// name: struct Chuck_Instr_Func_To_Code3061// name: struct Chuck_Instr_Func_To_Code
3003// desc: Chuck_Func * to Chuck_VM_Code *3062// desc: Chuck_Func * to Chuck_VM_Code *
@@ -3031,11 +3090,14 @@ public: · 27 unmodified lines
3031struct Chuck_Instr_Func_Call_Member : public Chuck_Instr_Unary_Op3090struct Chuck_Instr_Func_Call_Member : public Chuck_Instr_Unary_Op
3032{3091{
3033public:3092public:
3034 Chuck_Instr_Func_Call_Member( t_CKUINT ret_size )3093 Chuck_Instr_Func_Call_Member( t_CKUINT ret_size, Chuck_Func * func_ref )
3035 { this->set( ret_size ); }3094 { this->set( ret_size ); m_func_ref = func_ref; }
3036 3095
3037public:3096public:
3038 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3097 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3098
3099public:
3100 Chuck_Func * m_func_ref; // 1.4.2.1 (ge) | added for arg list cleanup
3039};3101};
3040 3102
3041 3103
@@ -3048,11 +3110,14 @@ public: · 6 unmodified lines
3048struct Chuck_Instr_Func_Call_Static : public Chuck_Instr_Unary_Op3110struct Chuck_Instr_Func_Call_Static : public Chuck_Instr_Unary_Op
3049{3111{
3050public:3112public:
3051 Chuck_Instr_Func_Call_Static( t_CKUINT ret_size )3113 Chuck_Instr_Func_Call_Static( t_CKUINT ret_size, Chuck_Func * func_ref )
3052 { this->set( ret_size ); }3114 { this->set( ret_size ); m_func_ref = func_ref; }
3053 3115
3054public:3116public:
3055 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3117 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3118
3119public:
3120 Chuck_Func * m_func_ref; // 1.4.2.1 (ge) | added for arg list cleanup
3056};3121};
3057 3122
3058 3123
@@ -3145,6 +3210,7 @@ protected: · 86 unmodified lines
3145 Chuck_Type * m_type_ref;3210 Chuck_Type * m_type_ref;
3146 t_CKINT m_length;3211 t_CKINT m_length;
3147 t_CKBOOL m_is_obj;3212 t_CKBOOL m_is_obj;
3213 t_CKBOOL m_is_float;
3148 char * m_param_str;3214 char * m_param_str;
3149};3215};
3150 3216
@@ -3158,8 +3224,9 @@ protected: · 7 unmodified lines
3158struct Chuck_Instr_Array_Alloc : public Chuck_Instr3224struct Chuck_Instr_Array_Alloc : public Chuck_Instr
3159{3225{
3160public: // REFACTOR-2017: added env3226public: // REFACTOR-2017: added env
3161 Chuck_Instr_Array_Alloc( Chuck_Env * env, t_CKUINT depth, Chuck_Type * the_type,3227 Chuck_Instr_Array_Alloc( Chuck_Env * env, t_CKUINT depth,
3162 t_CKUINT offset, t_CKBOOL ref );3228 Chuck_Type * contentType, t_CKUINT offset, t_CKBOOL ref,
3229 Chuck_Type * arrayType );
3163 virtual ~Chuck_Instr_Array_Alloc();3230 virtual ~Chuck_Instr_Array_Alloc();
3164 3231
3165public:3232public:
@@ -3168,7 +3235,8 @@ public: · 2 unmodified lines
3168 3235
3169protected:3236protected:
3170 t_CKUINT m_depth;3237 t_CKUINT m_depth;
3171 Chuck_Type * m_type_ref;3238 Chuck_Type * m_type_ref_content;
3239 Chuck_Type * m_type_ref_array; // 1.4.2.1 (ge) added
3172 t_CKBOOL m_is_obj;3240 t_CKBOOL m_is_obj;
3173 char * m_param_str;3241 char * m_param_str;
3174 t_CKUINT m_stack_offset;3242 t_CKUINT m_stack_offset;
@@ -3185,15 +3253,15 @@ protected: · 10 unmodified lines
3185struct Chuck_Instr_Array_Access : public Chuck_Instr3253struct Chuck_Instr_Array_Access : public Chuck_Instr
3186{3254{
3187public:3255public:
3188 Chuck_Instr_Array_Access( t_CKUINT kind, t_CKUINT emit_addr, 3256 Chuck_Instr_Array_Access( t_CKUINT kind, t_CKUINT emit_addr,
3189 t_CKUINT istr = FALSE )3257 t_CKUINT istr = FALSE )
3190 { m_kind = kind; m_emit_addr = emit_addr; m_istr = istr; }3258 { m_kind = kind; m_emit_addr = emit_addr; m_istr = istr; }
3191 3259
3192public:3260public:
3193 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3261 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3194 virtual const char * params() const3262 virtual const char * params() const
3195 { static char buffer[256];3263 { static char buffer[CK_PRINT_BUF_LENGTH];
3196 sprintf( buffer, "kind=%ld, emit_addr=%p istr=%ld", 3264 snprintf( buffer, CK_PRINT_BUF_LENGTH, "kind=%ld, emit_addr=%p istr=%ld",
3197 (long)m_kind, (void *)m_emit_addr, (long)m_istr );3265 (long)m_kind, (void *)m_emit_addr, (long)m_istr );
3198 return buffer; }3266 return buffer; }
3199 3267
@@ -3219,8 +3287,8 @@ public: · 19 unmodified lines
3219public:3287public:
3220 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3288 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3221 virtual const char * params() const3289 virtual const char * params() const
3222 { static char buffer[256];3290 { static char buffer[CK_PRINT_BUF_LENGTH];
3223 sprintf( buffer, "kind=%ld, emit_addr=%p", (long)m_kind, (void *)m_emit_addr );3291 snprintf( buffer, CK_PRINT_BUF_LENGTH, "kind=%ld, emit_addr=%p", (long)m_kind, (void *)m_emit_addr );
3224 return buffer; }3292 return buffer; }
3225 3293
3226protected:3294protected:
@@ -3246,15 +3314,15 @@ public: · 19 unmodified lines
3246public:3314public:
3247 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3315 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3248 virtual const char * params() const3316 virtual const char * params() const
3249 { static char buffer[256];3317 { static char buffer[CK_PRINT_BUF_LENGTH];
3250 sprintf( buffer, "depth=%ld, kind=%ld, emit_addr=%p", (long)m_depth, (long)m_kind, (void *)m_emit_addr );3318 snprintf( buffer, CK_PRINT_BUF_LENGTH, "depth=%ld, kind=%ld, emit_addr=%p", (long)m_depth, (long)m_kind, (void *)m_emit_addr );
3251 return buffer; }3319 return buffer; }
3252 3320
3253protected:3321protected:
3254 t_CKUINT m_depth;3322 t_CKUINT m_depth;
3255 t_CKUINT m_kind;3323 t_CKUINT m_kind;
3256 t_CKUINT m_emit_addr;3324 t_CKUINT m_emit_addr;
3257 3325
3258 // 1.3.1.0 list of types of indices3326 // 1.3.1.0 list of types of indices
3259 std::vector<t_CKBOOL> m_indexIsAssociative;3327 std::vector<t_CKBOOL> m_indexIsAssociative;
3260};3328};
@@ -3275,8 +3343,8 @@ public: · 14 unmodified lines
3275public:3343public:
3276 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3344 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3277 virtual const char * params() const3345 virtual const char * params() const
3278 { static char buffer[256];3346 { static char buffer[CK_PRINT_BUF_LENGTH];
3279 sprintf( buffer, "offset=%ld, kind=%ld, emit_addr=%p", (long)m_offset, (long)m_kind, (void *)m_emit_addr );3347 snprintf( buffer, CK_PRINT_BUF_LENGTH, "offset=%ld, kind=%ld, emit_addr=%p", (long)m_offset, (long)m_kind, (void *)m_emit_addr );
3280 return buffer; }3348 return buffer; }
3281 3349
3282protected:3350protected:
@@ -3301,8 +3369,8 @@ public: · 18 unmodified lines
3301public:3369public:
3302 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3370 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3303 virtual const char * params() const3371 virtual const char * params() const
3304 { static char buffer[256];3372 { static char buffer[CK_PRINT_BUF_LENGTH];
3305 sprintf( buffer, "offset=%ld", (long)m_offset );3373 snprintf( buffer, CK_PRINT_BUF_LENGTH, "offset=%ld", (long)m_offset );
3306 return buffer; }3374 return buffer; }
3307 3375
3308protected:3376protected:
@@ -3321,14 +3389,14 @@ struct Chuck_Instr_Dot_Primitive_Func : public Chuck_Instr · 12 unmodified lines
3321public:3389public:
3322 Chuck_Instr_Dot_Primitive_Func( t_CKUINT native_func )3390 Chuck_Instr_Dot_Primitive_Func( t_CKUINT native_func )
3323 { m_native_func = native_func; }3391 { m_native_func = native_func; }
3324 3392
3325public:3393public:
3326 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3394 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3327 virtual const char * params() const3395 virtual const char * params() const
3328 { static char buffer[256];3396 { static char buffer[CK_PRINT_BUF_LENGTH];
3329 sprintf( buffer, "native_func=%p", (void *)m_native_func );3397 snprintf( buffer, CK_PRINT_BUF_LENGTH, "native_func=%p", (void *)m_native_func );
3330 return buffer; }3398 return buffer; }
3331 3399
3332protected:3400protected:
3333 t_CKUINT m_native_func;3401 t_CKUINT m_native_func;
3334};3402};
@@ -3349,8 +3417,9 @@ public: · 14 unmodified lines
3349public:3417public:
3350 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3418 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3351 virtual const char * params() const3419 virtual const char * params() const
3352 { static char buffer[256];3420 { static char buffer[CK_PRINT_BUF_LENGTH];
3353 sprintf( buffer, "offset=%ld, size=%ld, kind=%ld, emit_addr=%p", (long)m_offset, (long)m_size, (long)m_kind, (void *)m_emit_addr );3421 snprintf( buffer, CK_PRINT_BUF_LENGTH, "offset=%ld, size=%ld, kind=%ld, emit_addr=%p",
3422 (long)m_offset, (long)m_size, (long)m_kind, (void *)m_emit_addr );
3354 return buffer; }3423 return buffer; }
3355 3424
3356protected:3425protected:
@@ -3376,8 +3445,9 @@ public: · 19 unmodified lines
3376public:3445public:
3377 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3446 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3378 virtual const char * params() const3447 virtual const char * params() const
3379 { static char buffer[256];3448 { static char buffer[CK_PRINT_BUF_LENGTH];
3380 sprintf( buffer, "addr=%p, kind=%ld, emit_addr=%p", (void *)m_addr, (long)m_kind, (void *)m_emit_addr );3449 snprintf( buffer, CK_PRINT_BUF_LENGTH, "addr=%p, kind=%ld, emit_addr=%p",
3450 (void *)m_addr, (long)m_kind, (void *)m_emit_addr );
3381 return buffer; }3451 return buffer; }
3382 3452
3383protected:3453protected:
@@ -3402,8 +3472,8 @@ public: · 18 unmodified lines
3402public:3472public:
3403 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3473 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3404 virtual const char * params() const3474 virtual const char * params() const
3405 { static char buffer[256];3475 { static char buffer[CK_PRINT_BUF_LENGTH];
3406 sprintf( buffer, "func=%p", (void *)m_func );3476 snprintf( buffer, CK_PRINT_BUF_LENGTH, "func=%p", (void *)m_func );
3407 return buffer; }3477 return buffer; }
3408 3478
3409protected:3479protected:
@@ -3426,8 +3496,8 @@ public: · 16 unmodified lines
3426public:3496public:
3427 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3497 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3428 virtual const char * params() const3498 virtual const char * params() const
3429 { static char buffer[256];3499 { static char buffer[CK_PRINT_BUF_LENGTH];
3430 sprintf( buffer, "is_mem=%ld, emit_addr=%p", (long)m_is_mem, (void *)m_emit_addr );3500 snprintf( buffer, CK_PRINT_BUF_LENGTH, "is_mem=%ld, emit_addr=%p", (long)m_is_mem, (void *)m_emit_addr );
3431 return buffer; }3501 return buffer; }
3432 3502
3433protected:3503protected:
@@ -3451,8 +3521,8 @@ public: · 17 unmodified lines
3451public:3521public:
3452 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3522 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3453 virtual const char * params() const3523 virtual const char * params() const
3454 { static char buffer[256];3524 { static char buffer[CK_PRINT_BUF_LENGTH];
3455 sprintf( buffer, "is_mem=%ld, emit_addr=%p", (long)m_is_mem, (void *)m_emit_addr );3525 snprintf( buffer, CK_PRINT_BUF_LENGTH, "is_mem=%ld, emit_addr=%p", (long)m_is_mem, (void *)m_emit_addr );
3456 return buffer; }3526 return buffer; }
3457 3527
3458protected:3528protected:
@@ -3472,14 +3542,14 @@ struct Chuck_Instr_Dot_Cmp_Third : public Chuck_Instr · 13 unmodified lines
3472public:3542public:
3473 Chuck_Instr_Dot_Cmp_Third( t_CKUINT is_mem, t_CKUINT emit_addr )3543 Chuck_Instr_Dot_Cmp_Third( t_CKUINT is_mem, t_CKUINT emit_addr )
3474 { m_is_mem = is_mem; m_emit_addr = emit_addr; }3544 { m_is_mem = is_mem; m_emit_addr = emit_addr; }
3475 3545
3476public:3546public:
3477 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3547 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3478 virtual const char * params() const3548 virtual const char * params() const
3479 { static char buffer[256];3549 { static char buffer[CK_PRINT_BUF_LENGTH];
3480 sprintf( buffer, "is_mem=%ld, emit_addr=%p", (long)m_is_mem, (void *)m_emit_addr );3550 snprintf( buffer, CK_PRINT_BUF_LENGTH, "is_mem=%ld, emit_addr=%p", (long)m_is_mem, (void *)m_emit_addr );
3481 return buffer; }3551 return buffer; }
3482 3552
3483protected:3553protected:
3484 t_CKUINT m_is_mem;3554 t_CKUINT m_is_mem;
3485 t_CKUINT m_emit_addr;3555 t_CKUINT m_emit_addr;
@@ -3497,14 +3567,14 @@ struct Chuck_Instr_Dot_Cmp_Fourth : public Chuck_Instr · 11 unmodified lines
3497public:3567public:
3498 Chuck_Instr_Dot_Cmp_Fourth( t_CKUINT is_mem, t_CKUINT emit_addr )3568 Chuck_Instr_Dot_Cmp_Fourth( t_CKUINT is_mem, t_CKUINT emit_addr )
3499 { m_is_mem = is_mem; m_emit_addr = emit_addr; }3569 { m_is_mem = is_mem; m_emit_addr = emit_addr; }
3500 3570
3501public:3571public:
3502 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3572 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3503 virtual const char * params() const3573 virtual const char * params() const
3504 { static char buffer[256];3574 { static char buffer[CK_PRINT_BUF_LENGTH];
3505 sprintf( buffer, "is_mem=%ld, emit_addr=%p", (long)m_is_mem, (void *)m_emit_addr );3575 snprintf( buffer, CK_PRINT_BUF_LENGTH, "is_mem=%ld, emit_addr=%p", (long)m_is_mem, (void *)m_emit_addr );
3506 return buffer; }3576 return buffer; }
3507 3577
3508protected:3578protected:
3509 t_CKUINT m_is_mem;3579 t_CKUINT m_is_mem;
3510 t_CKUINT m_emit_addr;3580 t_CKUINT m_emit_addr;
@@ -3586,10 +3656,10 @@ struct Chuck_Instr_UGen_Link : public Chuck_Instr · 75 unmodified lines
3586{3656{
3587public:3657public:
3588 Chuck_Instr_UGen_Link( t_CKBOOL isUpChuck = FALSE );3658 Chuck_Instr_UGen_Link( t_CKBOOL isUpChuck = FALSE );
3589 3659
3590public:3660public:
3591 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3661 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3592 3662
3593protected:3663protected:
3594 t_CKBOOL m_isUpChuck;3664 t_CKBOOL m_isUpChuck;
3595};3665};
@@ -3609,7 +3679,7 @@ public: · 13 unmodified lines
3609 { }3679 { }
3610 3680
3611 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );3681 virtual void execute( Chuck_VM * vm, Chuck_VM_Shred * shred );
3612 3682
3613protected:3683protected:
3614 t_CKBOOL m_srcIsArray, m_dstIsArray;3684 t_CKBOOL m_srcIsArray, m_dstIsArray;
3615};3685};
src/core/chuck_io.cpp+664−640
@@ -69,7 +69,7 @@ typedef WORD uint16_t; · 68 unmodified lines
69typedef __int32 int32_t; // 1.4.1.0 (ge) added69typedef __int32 int32_t; // 1.4.1.0 (ge) added
70typedef DWORD uint32_t;70typedef DWORD uint32_t;
71#endif71#endif
72#endif 72#endif
73 73
74#ifdef __PLATFORM_LINUX__74#ifdef __PLATFORM_LINUX__
75#include <stdint.h>75#include <stdint.h>
@@ -89,79 +89,79 @@ t_CKBOOL init_class_io( Chuck_Env * env, Chuck_Type * type ) · 13 unmodified lines
89{89{
90 // init as base class90 // init as base class
91 Chuck_DL_Func * func = NULL;91 Chuck_DL_Func * func = NULL;
92 92
93 // log93 // log
94 EM_log( CK_LOG_SEVERE, "class 'IO'" );94 EM_log( CK_LOG_SEVERE, "class 'IO'" );
95 95
96 // init as base class96 // init as base class
97 // TODO: ctor/dtor?97 // TODO: ctor/dtor?
98 // TODO: replace dummy with pure function98 // TODO: replace dummy with pure function
99 if( !type_engine_import_class_begin( env, type, env->global(), NULL, NULL ) )99 if( !type_engine_import_class_begin( env, type, env->global(), NULL, NULL ) )
100 return FALSE;100 return FALSE;
101 101
102 // add good()102 // add good()
103 func = make_new_mfun( "int", "good", io_dummy );103 func = make_new_mfun( "int", "good", io_dummy );
104 if( !type_engine_import_mfun( env, func ) ) goto error;104 if( !type_engine_import_mfun( env, func ) ) goto error;
105 105
106 // add close()106 // add close()
107 func = make_new_mfun( "void", "close", io_dummy );107 func = make_new_mfun( "void", "close", io_dummy );
108 if( !type_engine_import_mfun( env, func ) ) goto error;108 if( !type_engine_import_mfun( env, func ) ) goto error;
109 109
110 // add flush()110 // add flush()
111 func = make_new_mfun( "void", "flush", io_dummy );111 func = make_new_mfun( "void", "flush", io_dummy );
112 if( !type_engine_import_mfun( env, func ) ) goto error;112 if( !type_engine_import_mfun( env, func ) ) goto error;
113 113
114 // add mode(int)114 // add mode(int)
115 func = make_new_mfun( "int", "mode", io_dummy );115 func = make_new_mfun( "int", "mode", io_dummy );
116 func->add_arg( "int", "flag" );116 func->add_arg( "int", "flag" );
117 if( !type_engine_import_mfun( env, func ) ) goto error;117 if( !type_engine_import_mfun( env, func ) ) goto error;
118 118
119 // add mode()119 // add mode()
120 func = make_new_mfun( "int", "mode", io_dummy );120 func = make_new_mfun( "int", "mode", io_dummy );
121 if( !type_engine_import_mfun( env, func ) ) goto error;121 if( !type_engine_import_mfun( env, func ) ) goto error;
122 122
123 // TODO: add this later?123 // TODO: add this later?
124 // add read()124 // add read()
125 // func = make_new_mfun( "string", "read", io_dummy );125 // func = make_new_mfun( "string", "read", io_dummy );
126 // func->add_arg( "int", "length" );126 // func->add_arg( "int", "length" );
127 // if( !type_engine_import_mfun( env, func ) ) goto error;127 // if( !type_engine_import_mfun( env, func ) ) goto error;
128 128
129 // add readLine()129 // add readLine()
130 func = make_new_mfun( "string", "readLine", io_dummy );130 func = make_new_mfun( "string", "readLine", io_dummy );
131 if( !type_engine_import_mfun( env, func ) ) goto error;131 if( !type_engine_import_mfun( env, func ) ) goto error;
132 132
133 // add readInt()133 // add readInt()
134 func = make_new_mfun( "int", "readInt", io_dummy );134 func = make_new_mfun( "int", "readInt", io_dummy );
135 func->add_arg( "int", "flags" );135 func->add_arg( "int", "flags" );
136 if( !type_engine_import_mfun( env, func ) ) goto error;136 if( !type_engine_import_mfun( env, func ) ) goto error;
137 137
138 // add readFloat()138 // add readFloat()
139 // func = make_new_mfun( "float", "readFloat", io_dummy );139 // func = make_new_mfun( "float", "readFloat", io_dummy );
140 // if( !type_engine_import_mfun( env, func ) ) goto error;140 // if( !type_engine_import_mfun( env, func ) ) goto error;
141 141
142 // add eof()142 // add eof()
143 func = make_new_mfun( "int", "eof", io_dummy );143 func = make_new_mfun( "int", "eof", io_dummy );
144 if( !type_engine_import_mfun( env, func ) ) goto error;144 if( !type_engine_import_mfun( env, func ) ) goto error;
145 145
146 // add more()146 // add more()
147 func = make_new_mfun( "int", "more", io_dummy );147 func = make_new_mfun( "int", "more", io_dummy );
148 if( !type_engine_import_mfun( env, func ) ) goto error;148 if( !type_engine_import_mfun( env, func ) ) goto error;
149 149
150 // add write(string)150 // add write(string)
151 func = make_new_mfun( "void", "write", io_dummy );151 func = make_new_mfun( "void", "write", io_dummy );
152 func->add_arg( "string", "val" );152 func->add_arg( "string", "val" );
153 if( !type_engine_import_mfun( env, func ) ) goto error;153 if( !type_engine_import_mfun( env, func ) ) goto error;
154 154
155 // add write(int)155 // add write(int)
156 func = make_new_mfun( "void", "write", io_dummy );156 func = make_new_mfun( "void", "write", io_dummy );
157 func->add_arg( "int", "val" );157 func->add_arg( "int", "val" );
158 if( !type_engine_import_mfun( env, func ) ) goto error;158 if( !type_engine_import_mfun( env, func ) ) goto error;
159 159
160 // add write(float)160 // add write(float)
161 func = make_new_mfun( "void", "write", io_dummy );161 func = make_new_mfun( "void", "write", io_dummy );
162 func->add_arg( "float", "val" );162 func->add_arg( "float", "val" );
163 if( !type_engine_import_mfun( env, func ) ) goto error;163 if( !type_engine_import_mfun( env, func ) ) goto error;
164 164
165 // add newline165 // add newline
166 func = make_new_sfun( "string", "newline", io_newline );166 func = make_new_sfun( "string", "newline", io_newline );
167 if( !type_engine_import_sfun( env, func ) ) goto error;167 if( !type_engine_import_sfun( env, func ) ) goto error;
@@ -171,56 +171,69 @@ t_CKBOOL init_class_io( Chuck_Env * env, Chuck_Type * type ) · 3 unmodified lines
171 if( !type_engine_import_sfun( env, func ) ) goto error;171 if( !type_engine_import_sfun( env, func ) ) goto error;
172 initialize_object( g_newline, env->t_string );172 initialize_object( g_newline, env->t_string );
173 g_newline->set( "\n" );173 g_newline->set( "\n" );
174 174
175 // add READ_INT32175 // add TYPE_ASCII
176 if( !type_engine_import_svar( env, "int", "READ_INT32",176 if( !type_engine_import_svar( env, "int", "ASCII",
177 TRUE, (t_CKUINT)&Chuck_IO::INT32 ) ) goto error;177 TRUE, (t_CKUINT)&Chuck_IO::TYPE_ASCII ) ) goto error;
178 178 // add TYPE_BINARY
179 // add READ_INT16179 if( !type_engine_import_svar( env, "int", "BINARY",
180 if( !type_engine_import_svar( env, "int", "READ_INT16",180 TRUE, (t_CKUINT)&Chuck_IO::TYPE_BINARY ) ) goto error;
181 TRUE, (t_CKUINT)&Chuck_IO::INT16 ) ) goto error;181 // add INT8
182 182 if( !type_engine_import_svar( env, "int", "INT8",
183 // add READ_INT8
184 if( !type_engine_import_svar( env, "int", "READ_INT8",
185 TRUE, (t_CKUINT)&Chuck_IO::INT8 ) ) goto error;183 TRUE, (t_CKUINT)&Chuck_IO::INT8 ) ) goto error;
186
187 // add INT32
188 if( !type_engine_import_svar( env, "int", "INT32",
189 TRUE, (t_CKUINT)&Chuck_IO::INT32 ) ) goto error;
190
191 // add INT16184 // add INT16
192 if( !type_engine_import_svar( env, "int", "INT16",185 if( !type_engine_import_svar( env, "int", "INT16",
193 TRUE, (t_CKUINT)&Chuck_IO::INT16 ) ) goto error;186 TRUE, (t_CKUINT)&Chuck_IO::INT16 ) ) goto error;
194 187 // add INT32
195 // add INT8188 if( !type_engine_import_svar( env, "int", "INT32",
196 if( !type_engine_import_svar( env, "int", "INT8",189 TRUE, (t_CKUINT)&Chuck_IO::INT32 ) ) goto error;
190 // add READ_INT8
191 if( !type_engine_import_svar( env, "int", "READ_INT8",
197 TRUE, (t_CKUINT)&Chuck_IO::INT8 ) ) goto error;192 TRUE, (t_CKUINT)&Chuck_IO::INT8 ) ) goto error;
198 193 // add READ_INT16
194 if( !type_engine_import_svar( env, "int", "READ_INT16",
195 TRUE, (t_CKUINT)&Chuck_IO::INT16 ) ) goto error;
196 // add READ_INT32
197 if( !type_engine_import_svar( env, "int", "READ_INT32",
198 TRUE, (t_CKUINT)&Chuck_IO::INT32 ) ) goto error;
199 // add MODE_SYNC199 // add MODE_SYNC
200 if( !type_engine_import_svar( env, "int", "MODE_SYNC",200 if( !type_engine_import_svar( env, "int", "MODE_SYNC",
201 TRUE, (t_CKUINT)&Chuck_IO::MODE_SYNC ) ) goto error;201 TRUE, (t_CKUINT)&Chuck_IO::MODE_SYNC ) ) goto error;
202 202#ifndef __DISABLE_FILEIO__
203 // add MODE_ASYNC203 // add MODE_ASYNC
204 if( !type_engine_import_svar( env, "int", "MODE_ASYNC",204 if( !type_engine_import_svar( env, "int", "MODE_ASYNC",
205 TRUE, (t_CKUINT)&Chuck_IO::MODE_ASYNC ) ) goto error;205 TRUE, (t_CKUINT)&Chuck_IO::MODE_ASYNC ) ) goto error;
206 206#endif
207 // add FLAG_READONLY
208 if( !type_engine_import_svar( env, "int", "READ",
209 TRUE, (t_CKUINT)&Chuck_IO::FLAG_READONLY ) ) goto error;
210 // add FLAG_WRITEONLY
211 if( !type_engine_import_svar( env, "int", "WRITE",
212 TRUE, (t_CKUINT)&Chuck_IO::FLAG_WRITEONLY ) ) goto error;
213 // add FLAG_APPEND
214 if( !type_engine_import_svar( env, "int", "APPEND",
215 TRUE, (t_CKUINT)&Chuck_IO::FLAG_APPEND ) ) goto error;
216 // add FLAG_READ_WRITE
217 if( !type_engine_import_svar( env, "int", "READ_WRITE",
218 TRUE, (t_CKUINT)&Chuck_IO::FLAG_READ_WRITE ) ) goto error;
219
207 // end the class import220 // end the class import
208 type_engine_import_class_end( env );221 type_engine_import_class_end( env );
209 222
210 return TRUE;223 return TRUE;
211 224
212error:225error:
213 226
214 // end the class import227 // end the class import
215 type_engine_import_class_end( env );228 type_engine_import_class_end( env );
216 229
217 return FALSE;230 return FALSE;
218}231}
219 232
220 233
221 234
222 235
223#ifndef __DISABLE_FILEIO__236// #ifndef __DISABLE_FILEIO__
224//-----------------------------------------------------------------------------237//-----------------------------------------------------------------------------
225// name: init_class_fileio()238// name: init_class_fileio()
226// desc: ...239// desc: ...
@@ -229,157 +242,144 @@ t_CKBOOL init_class_fileio( Chuck_Env * env, Chuck_Type * type ) · 2 unmodified lines
229{242{
230 // init as base class243 // init as base class
231 Chuck_DL_Func * func = NULL;244 Chuck_DL_Func * func = NULL;
232 245
233 // log246 // log
234 EM_log( CK_LOG_SEVERE, "class 'FileIO'" );247 EM_log( CK_LOG_SEVERE, "class 'FileIO'" );
235 248
236 // init as base class249 // init as base class
237 // TODO: ctor/dtor?250 // TODO: ctor/dtor?
238 // TODO: replace dummy with pure function251 // TODO: replace dummy with pure function
239 if( !type_engine_import_class_begin( env, type, env->global(), fileio_ctor, fileio_dtor ) )252 if( !type_engine_import_class_begin( env, type, env->global(), fileio_ctor, fileio_dtor ) )
240 return FALSE;253 return FALSE;
241 254
242 // add open(string)255 // add open(string)
243 func = make_new_mfun( "int", "open", fileio_open );256 func = make_new_mfun( "int", "open", fileio_open );
244 func->add_arg( "string", "path" );257 func->add_arg( "string", "path" );
245 if( !type_engine_import_mfun( env, func ) ) goto error;258 if( !type_engine_import_mfun( env, func ) ) goto error;
246 259
247 // add open(string, flags)260 // add open(string, flags)
248 func = make_new_mfun( "int", "open", fileio_openflags );261 func = make_new_mfun( "int", "open", fileio_openflags );
249 func->add_arg( "string", "path" );262 func->add_arg( "string", "path" );
250 func->add_arg( "int", "flags" );263 func->add_arg( "int", "flags" );
251 if( !type_engine_import_mfun( env, func ) ) goto error;264 if( !type_engine_import_mfun( env, func ) ) goto error;
252 265
253 // add good()266 // add good()
254 func = make_new_mfun( "int", "good", fileio_good );267 func = make_new_mfun( "int", "good", fileio_good );
255 if( !type_engine_import_mfun( env, func ) ) goto error;268 if( !type_engine_import_mfun( env, func ) ) goto error;
256 269
257 // add close()270 // add close()
258 func = make_new_mfun( "void", "close", fileio_close );271 func = make_new_mfun( "void", "close", fileio_close );
259 if( !type_engine_import_mfun( env, func ) ) goto error;272 if( !type_engine_import_mfun( env, func ) ) goto error;
260 273
261 // add flush()274 // add flush()
262 func = make_new_mfun( "void", "flush", fileio_flush );275 func = make_new_mfun( "void", "flush", fileio_flush );
263 if( !type_engine_import_mfun( env, func ) ) goto error;276 if( !type_engine_import_mfun( env, func ) ) goto error;
264 277
265 // add mode()278 // add mode()
266 func = make_new_mfun( "int", "mode", fileio_getmode );279 func = make_new_mfun( "int", "mode", fileio_getmode );
267 if( !type_engine_import_mfun( env, func ) ) goto error;280 if( !type_engine_import_mfun( env, func ) ) goto error;
268 281
269 // add mode(int)282 // add mode(int)
270 func = make_new_mfun( "int", "mode", fileio_setmode );283 func = make_new_mfun( "int", "mode", fileio_setmode );
271 func->add_arg( "int", "flag" );284 func->add_arg( "int", "flag" );
272 if( !type_engine_import_mfun( env, func ) ) goto error;285 if( !type_engine_import_mfun( env, func ) ) goto error;
273 286
274 // add size()287 // add size()
275 func = make_new_mfun( "int", "size", fileio_size );288 func = make_new_mfun( "int", "size", fileio_size );
276 if( !type_engine_import_mfun( env, func ) ) goto error;289 if( !type_engine_import_mfun( env, func ) ) goto error;
277 290
278 // add seek(int)291 // add seek(int)
279 func = make_new_mfun( "void", "seek", fileio_seek );292 func = make_new_mfun( "void", "seek", fileio_seek );
280 func->add_arg( "int", "pos" );293 func->add_arg( "int", "pos" );
281 if( !type_engine_import_mfun( env, func ) ) goto error;294 if( !type_engine_import_mfun( env, func ) ) goto error;
282 295
283 // add tell()296 // add tell()
284 func = make_new_mfun( "int", "tell", fileio_tell );297 func = make_new_mfun( "int", "tell", fileio_tell );
285 if( !type_engine_import_mfun( env, func ) ) goto error;298 if( !type_engine_import_mfun( env, func ) ) goto error;
286 299
287 // add isDir()300 // add isDir()
288 func = make_new_mfun( "int", "isDir", fileio_isdir );301 func = make_new_mfun( "int", "isDir", fileio_isdir );
289 if( !type_engine_import_mfun( env, func ) ) goto error;302 if( !type_engine_import_mfun( env, func ) ) goto error;
290 303
291 // add dirList()304 // add dirList()
292 func = make_new_mfun( "string[]", "dirList", fileio_dirlist );305 func = make_new_mfun( "string[]", "dirList", fileio_dirlist );
293 if( !type_engine_import_mfun( env, func ) ) goto error;306 if( !type_engine_import_mfun( env, func ) ) goto error;
294 307
295 // add read()308 // add read()
296 // func = make_new_mfun( "string", "read", fileio_read );309 // func = make_new_mfun( "string", "read", fileio_read );
297 // func->add_arg( "int", "length" );310 // func->add_arg( "int", "length" );
298 // if( !type_engine_import_mfun( env, func ) ) goto error;311 // if( !type_engine_import_mfun( env, func ) ) goto error;
299 312
300 // add readLine()313 // add readLine()
301 func = make_new_mfun( "string", "readLine", fileio_readline );314 func = make_new_mfun( "string", "readLine", fileio_readline );
302 if( !type_engine_import_mfun( env, func ) ) goto error;315 if( !type_engine_import_mfun( env, func ) ) goto error;
303 316
304 // add readInt()317 // add readInt()
305 // func = make_new_mfun( "int", "readInt", fileio_readint );318 // func = make_new_mfun( "int", "readInt", fileio_readint );
306 // if( !type_engine_import_mfun( env, func ) ) goto error;319 // if( !type_engine_import_mfun( env, func ) ) goto error;
307 320
308 // add readInt(int)321 // add readInt(int)
309 func = make_new_mfun( "int", "readInt", fileio_readintflags );322 func = make_new_mfun( "int", "readInt", fileio_readintflags );
310 func->add_arg( "int", "flags" );323 func->add_arg( "int", "flags" );
311 if( !type_engine_import_mfun( env, func ) ) goto error;324 if( !type_engine_import_mfun( env, func ) ) goto error;
312 325
313 // add readFloat()326 // add readFloat()
314 // func = make_new_mfun( "float", "readFloat", fileio_readfloat );327 // func = make_new_mfun( "float", "readFloat", fileio_readfloat );
315 // if( !type_engine_import_mfun( env, func ) ) goto error;328 // if( !type_engine_import_mfun( env, func ) ) goto error;
316 329
317 // add eof()330 // add eof()
318 func = make_new_mfun( "int", "eof", fileio_eof );331 func = make_new_mfun( "int", "eof", fileio_eof );
319 if( !type_engine_import_mfun( env, func ) ) goto error;332 if( !type_engine_import_mfun( env, func ) ) goto error;
320 333
321 // add more()334 // add more()
322 func = make_new_mfun( "int", "more", fileio_more );335 func = make_new_mfun( "int", "more", fileio_more );
323 if( !type_engine_import_mfun( env, func ) ) goto error;336 if( !type_engine_import_mfun( env, func ) ) goto error;
324 337
325 // add write(string)338 // add write(string)
326 func = make_new_mfun( "void", "write", fileio_writestring );339 func = make_new_mfun( "void", "write", fileio_writestring );
327 func->add_arg( "string", "val" );340 func->add_arg( "string", "val" );
328 if( !type_engine_import_mfun( env, func ) ) goto error;341 if( !type_engine_import_mfun( env, func ) ) goto error;
329 342
330 // add write(int)343 // add write(int)
331 func = make_new_mfun( "void", "write", fileio_writeint );344 func = make_new_mfun( "void", "write", fileio_writeint );
332 func->add_arg( "int", "val" );345 func->add_arg( "int", "val" );
333 if( !type_engine_import_mfun( env, func ) ) goto error;346 if( !type_engine_import_mfun( env, func ) ) goto error;
334 347
335 // add write(int,flags)348 // add write(int,flags)
336 func = make_new_mfun( "void", "write", fileio_writeintflags );349 func = make_new_mfun( "void", "write", fileio_writeintflags );
337 func->add_arg( "int", "val" );350 func->add_arg( "int", "val" );
338 func->add_arg( "int", "flags" );351 func->add_arg( "int", "flags" );
339 if( !type_engine_import_mfun( env, func ) ) goto error;352 if( !type_engine_import_mfun( env, func ) ) goto error;
340 353
341 // add write(float)354 // add write(float)
342 func = make_new_mfun( "void", "write", fileio_writefloat );355 func = make_new_mfun( "void", "write", fileio_writefloat );
343 func->add_arg( "float", "val" );356 func->add_arg( "float", "val" );
344 if( !type_engine_import_mfun( env, func ) ) goto error;357 if( !type_engine_import_mfun( env, func ) ) goto error;
345 358
346 // add FLAG_READ_WRITE359 if( !type_engine_import_add_ex( env, "io/chout.ck" ) ) goto error;
347 if( !type_engine_import_svar( env, "int", "READ_WRITE",360 if( !type_engine_import_add_ex( env, "io/read-byte.ck" ) ) goto error;
348 TRUE, (t_CKUINT)&Chuck_IO_File::FLAG_READ_WRITE ) ) goto error;361 if( !type_engine_import_add_ex( env, "io/read-float.ck" ) ) goto error;
349 362 if( !type_engine_import_add_ex( env, "io/read-int.ck" ) ) goto error;
350 // add FLAG_READONLY363 if( !type_engine_import_add_ex( env, "io/read-line.ck" ) ) goto error;
351 if( !type_engine_import_svar( env, "int", "READ",364 if( !type_engine_import_add_ex( env, "io/read-str.ck" ) ) goto error;
352 TRUE, (t_CKUINT)&Chuck_IO_File::FLAG_READONLY ) ) goto error;365 if( !type_engine_import_add_ex( env, "io/read-tokens.ck" ) ) goto error;
353 366 if( !type_engine_import_add_ex( env, "io/seek.ck" ) ) goto error;
354 // add FLAG_WRITEONLY367 if( !type_engine_import_add_ex( env, "io/write-byte.ck" ) ) goto error;
355 if( !type_engine_import_svar( env, "int", "WRITE",368 if( !type_engine_import_add_ex( env, "io/write.ck" ) ) goto error;
356 TRUE, (t_CKUINT)&Chuck_IO_File::FLAG_WRITEONLY ) ) goto error;369 if( !type_engine_import_add_ex( env, "io/write2.ck" ) ) goto error;
357
358 // add FLAG_APPEND
359 if( !type_engine_import_svar( env, "int", "APPEND",
360 TRUE, (t_CKUINT)&Chuck_IO_File::FLAG_APPEND ) ) goto error;
361
362 // add TYPE_ASCII
363 if( !type_engine_import_svar( env, "int", "ASCII",
364 TRUE, (t_CKUINT)&Chuck_IO_File::TYPE_ASCII ) ) goto error;
365
366 // add TYPE_BINARY
367 if( !type_engine_import_svar( env, "int", "BINARY",
368 TRUE, (t_CKUINT)&Chuck_IO_File::TYPE_BINARY ) ) goto error;
369
370 // end the class import370 // end the class import
371 type_engine_import_class_end( env );371 type_engine_import_class_end( env );
372 372
373 return TRUE;373 return TRUE;
374 374
375error:375error:
376 376
377 // end the class import377 // end the class import
378 type_engine_import_class_end( env );378 type_engine_import_class_end( env );
379 379
380 return FALSE;380 return FALSE;
381}381}
382#endif // __DISABLE_FILEIO__382// #endif // __DISABLE_FILEIO__
383 383
384 384
385 385
@@ -392,85 +392,85 @@ t_CKBOOL init_class_chout( Chuck_Env * env, Chuck_Type * type ) · 6 unmodified lines
392{392{
393 // init as base class393 // init as base class
394 Chuck_DL_Func * func = NULL;394 Chuck_DL_Func * func = NULL;
395 395
396 // log396 // log
397 EM_log( CK_LOG_SEVERE, "class 'chout'" );397 EM_log( CK_LOG_SEVERE, "class 'chout'" );
398 398
399 // TODO: ctor/dtor?399 // TODO: ctor/dtor?
400 if( !type_engine_import_class_begin( env, type, env->global(), NULL, NULL ) )400 if( !type_engine_import_class_begin( env, type, env->global(), NULL, NULL ) )
401 return FALSE;401 return FALSE;
402 402
403 // add good()403 // add good()
404 func = make_new_mfun( "int", "good", chout_good );404 func = make_new_mfun( "int", "good", chout_good );
405 if( !type_engine_import_mfun( env, func ) ) goto error;405 if( !type_engine_import_mfun( env, func ) ) goto error;
406 406
407 // add close()407 // add close()
408 func = make_new_mfun( "void", "close", chout_close );408 func = make_new_mfun( "void", "close", chout_close );
409 if( !type_engine_import_mfun( env, func ) ) goto error;409 if( !type_engine_import_mfun( env, func ) ) goto error;
410 410
411 // add flush()411 // add flush()
412 func = make_new_mfun( "void", "flush", chout_flush );412 func = make_new_mfun( "void", "flush", chout_flush );
413 if( !type_engine_import_mfun( env, func ) ) goto error;413 if( !type_engine_import_mfun( env, func ) ) goto error;
414 414
415 // add mode()415 // add mode()
416 func = make_new_mfun( "int", "mode", chout_getmode );416 func = make_new_mfun( "int", "mode", chout_getmode );
417 if( !type_engine_import_mfun( env, func ) ) goto error;417 if( !type_engine_import_mfun( env, func ) ) goto error;
418 418
419 // add mode(int)419 // add mode(int)
420 func = make_new_mfun( "int", "mode", chout_setmode );420 func = make_new_mfun( "int", "mode", chout_setmode );
421 func->add_arg( "int", "flag" );421 func->add_arg( "int", "flag" );
422 if( !type_engine_import_mfun( env, func ) ) goto error;422 if( !type_engine_import_mfun( env, func ) ) goto error;
423 423
424 // add readLine()424 // add readLine()
425 func = make_new_mfun( "string", "readLine", chout_readline );425 func = make_new_mfun( "string", "readLine", chout_readline );
426 if( !type_engine_import_mfun( env, func ) ) goto error;426 if( !type_engine_import_mfun( env, func ) ) goto error;
427 427
428 // add readInt()428 // add readInt()
429 // func = make_new_mfun( "int", "readInt", chout_readint );429 // func = make_new_mfun( "int", "readInt", chout_readint );
430 // if( !type_engine_import_mfun( env, func ) ) goto error;430 // if( !type_engine_import_mfun( env, func ) ) goto error;
431 431
432 // add readInt(int)432 // add readInt(int)
433 func = make_new_mfun( "int", "readInt", chout_readintflags );433 func = make_new_mfun( "int", "readInt", chout_readintflags );
434 func->add_arg( "int", "flags" );434 func->add_arg( "int", "flags" );
435 if( !type_engine_import_mfun( env, func ) ) goto error;435 if( !type_engine_import_mfun( env, func ) ) goto error;
436 436
437 // add readFloat()437 // add readFloat()
438 // func = make_new_mfun( "float", "readFloat", chout_readfloat );438 // func = make_new_mfun( "float", "readFloat", chout_readfloat );
439 // if( !type_engine_import_mfun( env, func ) ) goto error;439 // if( !type_engine_import_mfun( env, func ) ) goto error;
440 440
441 // add eof()441 // add eof()
442 func = make_new_mfun( "int", "eof", chout_eof );442 func = make_new_mfun( "int", "eof", chout_eof );
443 if( !type_engine_import_mfun( env, func ) ) goto error;443 if( !type_engine_import_mfun( env, func ) ) goto error;
444 444
445 // add more()445 // add more()
446 func = make_new_mfun( "int", "more", chout_more );446 func = make_new_mfun( "int", "more", chout_more );
447 if( !type_engine_import_mfun( env, func ) ) goto error;447 if( !type_engine_import_mfun( env, func ) ) goto error;
448 448
449 // add write(string)449 // add write(string)
450 func = make_new_mfun( "void", "write", chout_writestring );450 func = make_new_mfun( "void", "write", chout_writestring );
451 func->add_arg( "string", "val" );451 func->add_arg( "string", "val" );
452 if( !type_engine_import_mfun( env, func ) ) goto error;452 if( !type_engine_import_mfun( env, func ) ) goto error;
453 453
454 // add write(int)454 // add write(int)
455 func = make_new_mfun( "void", "write", chout_writeint );455 func = make_new_mfun( "void", "write", chout_writeint );
456 func->add_arg( "int", "val" );456 func->add_arg( "int", "val" );
457 if( !type_engine_import_mfun( env, func ) ) goto error;457 if( !type_engine_import_mfun( env, func ) ) goto error;
458 458
459 // add write(float)459 // add write(float)
460 func = make_new_mfun( "void", "write", chout_writefloat );460 func = make_new_mfun( "void", "write", chout_writefloat );
461 func->add_arg( "float", "val" );461 func->add_arg( "float", "val" );
462 if( !type_engine_import_mfun( env, func ) ) goto error;462 if( !type_engine_import_mfun( env, func ) ) goto error;
463 463
464 // end the class import464 // end the class import
465 type_engine_import_class_end( env );465 type_engine_import_class_end( env );
466 466
467 return TRUE;467 return TRUE;
468 468
469error:469error:
470 470
471 // end the class import471 // end the class import
472 type_engine_import_class_end( env );472 type_engine_import_class_end( env );
473 473
474 return FALSE;474 return FALSE;
475}475}
476 476
@@ -485,85 +485,85 @@ t_CKBOOL init_class_cherr( Chuck_Env * env, Chuck_Type * type ) · 8 unmodified lines
485{485{
486 // init as base class486 // init as base class
487 Chuck_DL_Func * func = NULL;487 Chuck_DL_Func * func = NULL;
488 488
489 // log489 // log
490 EM_log( CK_LOG_SEVERE, "class 'cherr'" );490 EM_log( CK_LOG_SEVERE, "class 'cherr'" );
491 491
492 // TODO: ctor/dtor?492 // TODO: ctor/dtor?
493 if( !type_engine_import_class_begin( env, type, env->global(), NULL, NULL ) )493 if( !type_engine_import_class_begin( env, type, env->global(), NULL, NULL ) )
494 return FALSE;494 return FALSE;
495 495
496 // add good()496 // add good()
497 func = make_new_mfun( "int", "good", cherr_good );497 func = make_new_mfun( "int", "good", cherr_good );
498 if( !type_engine_import_mfun( env, func ) ) goto error;498 if( !type_engine_import_mfun( env, func ) ) goto error;
499 499
500 // add close()500 // add close()
501 func = make_new_mfun( "void", "close", cherr_close );501 func = make_new_mfun( "void", "close", cherr_close );
502 if( !type_engine_import_mfun( env, func ) ) goto error;502 if( !type_engine_import_mfun( env, func ) ) goto error;
503 503
504 // add flush()504 // add flush()
505 func = make_new_mfun( "void", "flush", cherr_flush );505 func = make_new_mfun( "void", "flush", cherr_flush );
506 if( !type_engine_import_mfun( env, func ) ) goto error;506 if( !type_engine_import_mfun( env, func ) ) goto error;
507 507
508 // add mode()508 // add mode()
509 func = make_new_mfun( "int", "mode", cherr_getmode );509 func = make_new_mfun( "int", "mode", cherr_getmode );
510 if( !type_engine_import_mfun( env, func ) ) goto error;510 if( !type_engine_import_mfun( env, func ) ) goto error;
511 511
512 // add mode(int)512 // add mode(int)
513 func = make_new_mfun( "int", "mode", cherr_setmode );513 func = make_new_mfun( "int", "mode", cherr_setmode );
514 func->add_arg( "int", "flag" );514 func->add_arg( "int", "flag" );
515 if( !type_engine_import_mfun( env, func ) ) goto error;515 if( !type_engine_import_mfun( env, func ) ) goto error;
516 516
517 // add readLine()517 // add readLine()
518 func = make_new_mfun( "string", "readLine", cherr_readline );518 func = make_new_mfun( "string", "readLine", cherr_readline );
519 if( !type_engine_import_mfun( env, func ) ) goto error;519 if( !type_engine_import_mfun( env, func ) ) goto error;
520 520
521 // add readInt()521 // add readInt()
522 // func = make_new_mfun( "int", "readInt", cherr_readint );522 // func = make_new_mfun( "int", "readInt", cherr_readint );
523 // if( !type_engine_import_mfun( env, func ) ) goto error;523 // if( !type_engine_import_mfun( env, func ) ) goto error;
524 524
525 // add readInt(int)525 // add readInt(int)
526 func = make_new_mfun( "int", "readInt", cherr_readintflags );526 func = make_new_mfun( "int", "readInt", cherr_readintflags );
527 func->add_arg( "int", "flags" );527 func->add_arg( "int", "flags" );
528 if( !type_engine_import_mfun( env, func ) ) goto error;528 if( !type_engine_import_mfun( env, func ) ) goto error;
529 529
530 // add readFloat()530 // add readFloat()
531 // func = make_new_mfun( "float", "readFloat", cherr_readfloat );531 // func = make_new_mfun( "float", "readFloat", cherr_readfloat );
532 // if( !type_engine_import_mfun( env, func ) ) goto error;532 // if( !type_engine_import_mfun( env, func ) ) goto error;
533 533
534 // add eof()534 // add eof()
535 func = make_new_mfun( "int", "eof", cherr_eof );535 func = make_new_mfun( "int", "eof", cherr_eof );
536 if( !type_engine_import_mfun( env, func ) ) goto error;536 if( !type_engine_import_mfun( env, func ) ) goto error;
537 537
538 // add more()538 // add more()
539 func = make_new_mfun( "int", "more", cherr_more );539 func = make_new_mfun( "int", "more", cherr_more );
540 if( !type_engine_import_mfun( env, func ) ) goto error;540 if( !type_engine_import_mfun( env, func ) ) goto error;
541 541
542 // add write(string)542 // add write(string)
543 func = make_new_mfun( "void", "write", cherr_writestring );543 func = make_new_mfun( "void", "write", cherr_writestring );
544 func->add_arg( "string", "val" );544 func->add_arg( "string", "val" );
545 if( !type_engine_import_mfun( env, func ) ) goto error;545 if( !type_engine_import_mfun( env, func ) ) goto error;
546 546
547 // add write(int)547 // add write(int)
548 func = make_new_mfun( "void", "write", cherr_writeint );548 func = make_new_mfun( "void", "write", cherr_writeint );
549 func->add_arg( "int", "val" );549 func->add_arg( "int", "val" );
550 if( !type_engine_import_mfun( env, func ) ) goto error;550 if( !type_engine_import_mfun( env, func ) ) goto error;
551 551
552 // add write(float)552 // add write(float)
553 func = make_new_mfun( "void", "write", cherr_writefloat );553 func = make_new_mfun( "void", "write", cherr_writefloat );
554 func->add_arg( "float", "val" );554 func->add_arg( "float", "val" );
555 if( !type_engine_import_mfun( env, func ) ) goto error;555 if( !type_engine_import_mfun( env, func ) ) goto error;
556 556
557 // end the class import557 // end the class import
558 type_engine_import_class_end( env );558 type_engine_import_class_end( env );
559 559
560 return TRUE;560 return TRUE;
561 561
562error:562error:
563 563
564 // end the class import564 // end the class import
565 type_engine_import_class_end( env );565 type_engine_import_class_end( env );
566 566
567 return FALSE;567 return FALSE;
568}568}
569 569
@@ -586,134 +586,134 @@ static t_CKUINT MidiOut_offset_data = 0; · 16 unmodified lines
586t_CKBOOL init_class_Midi( Chuck_Env * env )586t_CKBOOL init_class_Midi( Chuck_Env * env )
587{587{
588 Chuck_DL_Func * func = NULL;588 Chuck_DL_Func * func = NULL;
589 589
590 // init base class590 // init base class
591 // TODO: ctor/dtor?591 // TODO: ctor/dtor?
592 if( !type_engine_import_class_begin( env, "MidiMsg", "Object",592 if( !type_engine_import_class_begin( env, "MidiMsg", "Object",
593 env->global(), NULL, NULL ) )593 env->global(), NULL, NULL ) )
594 return FALSE;594 return FALSE;
595 595
596 // add member variable596 // add member variable
597 MidiMsg_offset_data1 = type_engine_import_mvar( env, "int", "data1", FALSE );597 MidiMsg_offset_data1 = type_engine_import_mvar( env, "int", "data1", FALSE );
598 if( MidiMsg_offset_data1 == CK_INVALID_OFFSET ) goto error;598 if( MidiMsg_offset_data1 == CK_INVALID_OFFSET ) goto error;
599 599
600 // add member variable600 // add member variable
601 MidiMsg_offset_data2 = type_engine_import_mvar( env, "int", "data2", FALSE );601 MidiMsg_offset_data2 = type_engine_import_mvar( env, "int", "data2", FALSE );
602 if( MidiMsg_offset_data2 == CK_INVALID_OFFSET ) goto error;602 if( MidiMsg_offset_data2 == CK_INVALID_OFFSET ) goto error;
603 603
604 // add member variable604 // add member variable
605 MidiMsg_offset_data3 = type_engine_import_mvar( env, "int", "data3", FALSE );605 MidiMsg_offset_data3 = type_engine_import_mvar( env, "int", "data3", FALSE );
606 if( MidiMsg_offset_data3 == CK_INVALID_OFFSET ) goto error;606 if( MidiMsg_offset_data3 == CK_INVALID_OFFSET ) goto error;
607 607
608 // add member variable608 // add member variable
609 MidiMsg_offset_when = type_engine_import_mvar( env, "dur", "when", FALSE );609 MidiMsg_offset_when = type_engine_import_mvar( env, "dur", "when", FALSE );
610 if( MidiMsg_offset_when == CK_INVALID_OFFSET ) goto error;610 if( MidiMsg_offset_when == CK_INVALID_OFFSET ) goto error;
611 611
612 // end the class import612 // end the class import
613 type_engine_import_class_end( env );613 type_engine_import_class_end( env );
614 614
615#ifndef __DISABLE_MIDI__615#ifndef __DISABLE_MIDI__
616 // init base class616 // init base class
617 if( !type_engine_import_class_begin( env, "MidiIn", "Event",617 if( !type_engine_import_class_begin( env, "MidiIn", "Event",
618 env->global(), MidiIn_ctor, MidiIn_dtor ) )618 env->global(), MidiIn_ctor, MidiIn_dtor ) )
619 return FALSE;619 return FALSE;
620 620
621 // add open()621 // add open()
622 func = make_new_mfun( "int", "open", MidiIn_open );622 func = make_new_mfun( "int", "open", MidiIn_open );
623 func->add_arg( "int", "port" );623 func->add_arg( "int", "port" );
624 if( !type_engine_import_mfun( env, func ) ) goto error;624 if( !type_engine_import_mfun( env, func ) ) goto error;
625 625
626 // add open() (added 1.3.0.0)626 // add open() (added 1.3.0.0)
627 func = make_new_mfun( "int", "open", MidiIn_open_named );627 func = make_new_mfun( "int", "open", MidiIn_open_named );
628 func->add_arg( "string", "name" );628 func->add_arg( "string", "name" );
629 if( !type_engine_import_mfun( env, func ) ) goto error;629 if( !type_engine_import_mfun( env, func ) ) goto error;
630 630
631 // add good()631 // add good()
632 func = make_new_mfun( "int", "good", MidiIn_good );632 func = make_new_mfun( "int", "good", MidiIn_good );
633 if( !type_engine_import_mfun( env, func ) ) goto error;633 if( !type_engine_import_mfun( env, func ) ) goto error;
634 634
635 // add num()635 // add num()
636 func = make_new_mfun( "int", "num", MidiIn_num );636 func = make_new_mfun( "int", "num", MidiIn_num );
637 if( !type_engine_import_mfun( env, func ) ) goto error;637 if( !type_engine_import_mfun( env, func ) ) goto error;
638 638
639 // add name()639 // add name()
640 func = make_new_mfun( "string", "name", MidiIn_name );640 func = make_new_mfun( "string", "name", MidiIn_name );
641 if( !type_engine_import_mfun( env, func ) ) goto error;641 if( !type_engine_import_mfun( env, func ) ) goto error;
642 642
643 // add printerr()643 // add printerr()
644 func = make_new_mfun( "void", "printerr", MidiIn_printerr );644 func = make_new_mfun( "void", "printerr", MidiIn_printerr );
645 func->add_arg( "int", "print_or_not" );645 func->add_arg( "int", "print_or_not" );
646 if( !type_engine_import_mfun( env, func ) ) goto error;646 if( !type_engine_import_mfun( env, func ) ) goto error;
647 647
648 // add recv()648 // add recv()
649 func = make_new_mfun( "int", "recv", MidiIn_recv );649 func = make_new_mfun( "int", "recv", MidiIn_recv );
650 func->add_arg( "MidiMsg", "msg" );650 func->add_arg( "MidiMsg", "msg" );
651 if( !type_engine_import_mfun( env, func ) ) goto error;651 if( !type_engine_import_mfun( env, func ) ) goto error;
652 652
653 // add can_wait()653 // add can_wait()
654 func = make_new_mfun( "int", "can_wait", MidiIn_can_wait );654 func = make_new_mfun( "int", "can_wait", MidiIn_can_wait );
655 if( !type_engine_import_mfun( env, func ) ) goto error;655 if( !type_engine_import_mfun( env, func ) ) goto error;
656 656
657 // add member variable657 // add member variable
658 MidiIn_offset_data = type_engine_import_mvar( env, "int", "@MidiIn_data", FALSE );658 MidiIn_offset_data = type_engine_import_mvar( env, "int", "@MidiIn_data", FALSE );
659 if( MidiIn_offset_data == CK_INVALID_OFFSET ) goto error;659 if( MidiIn_offset_data == CK_INVALID_OFFSET ) goto error;
660 660
661 // end the class import661 // end the class import
662 type_engine_import_class_end( env );662 type_engine_import_class_end( env );
663 663
664 // init base class664 // init base class
665 if( !type_engine_import_class_begin( env, "MidiOut", "Object",665 if( !type_engine_import_class_begin( env, "MidiOut", "Object",
666 env->global(), MidiOut_ctor, MidiOut_dtor ) )666 env->global(), MidiOut_ctor, MidiOut_dtor ) )
667 return FALSE;667 return FALSE;
668 668
669 // add open()669 // add open()
670 func = make_new_mfun( "int", "open", MidiOut_open );670 func = make_new_mfun( "int", "open", MidiOut_open );
671 func->add_arg( "int", "port" );671 func->add_arg( "int", "port" );
672 if( !type_engine_import_mfun( env, func ) ) goto error;672 if( !type_engine_import_mfun( env, func ) ) goto error;
673 673
674 // add open() (added 1.3.0.0)674 // add open() (added 1.3.0.0)
675 func = make_new_mfun( "int", "open", MidiOut_open_named );675 func = make_new_mfun( "int", "open", MidiOut_open_named );
676 func->add_arg( "string", "name" );676 func->add_arg( "string", "name" );
677 if( !type_engine_import_mfun( env, func ) ) goto error;677 if( !type_engine_import_mfun( env, func ) ) goto error;
678 678
679 // add good()679 // add good()
680 func = make_new_mfun( "int", "good", MidiOut_good );680 func = make_new_mfun( "int", "good", MidiOut_good );
681 if( !type_engine_import_mfun( env, func ) ) goto error;681 if( !type_engine_import_mfun( env, func ) ) goto error;
682 682
683 // add num()683 // add num()
684 func = make_new_mfun( "int", "num", MidiOut_num );684 func = make_new_mfun( "int", "num", MidiOut_num );
685 if( !type_engine_import_mfun( env, func ) ) goto error;685 if( !type_engine_import_mfun( env, func ) ) goto error;
686 686
687 // add name()687 // add name()
688 func = make_new_mfun( "string", "name", MidiOut_name );688 func = make_new_mfun( "string", "name", MidiOut_name );
689 if( !type_engine_import_mfun( env, func ) ) goto error;689 if( !type_engine_import_mfun( env, func ) ) goto error;
690 690
691 // add printerr()691 // add printerr()
692 func = make_new_mfun( "void", "printerr", MidiOut_printerr );692 func = make_new_mfun( "void", "printerr", MidiOut_printerr );
693 func->add_arg( "int", "print_or_not" );693 func->add_arg( "int", "print_or_not" );
694 if( !type_engine_import_mfun( env, func ) ) goto error;694 if( !type_engine_import_mfun( env, func ) ) goto error;
695 695
696 // add send()696 // add send()
697 func = make_new_mfun( "int", "send", MidiOut_send );697 func = make_new_mfun( "int", "send", MidiOut_send );
698 func->add_arg( "MidiMsg", "msg" );698 func->add_arg( "MidiMsg", "msg" );
699 if( !type_engine_import_mfun( env, func ) ) goto error;699 if( !type_engine_import_mfun( env, func ) ) goto error;
700 700
701 // add member variable701 // add member variable
702 MidiOut_offset_data = type_engine_import_mvar( env, "int", "@MidiOut_data", FALSE );702 MidiOut_offset_data = type_engine_import_mvar( env, "int", "@MidiOut_data", FALSE );
703 if( MidiOut_offset_data == CK_INVALID_OFFSET ) goto error;703 if( MidiOut_offset_data == CK_INVALID_OFFSET ) goto error;
704 704
705 // end the class import705 // end the class import
706 type_engine_import_class_end( env );706 type_engine_import_class_end( env );
707 707
708#endif // __DISABLE_MIDI__708#endif // __DISABLE_MIDI__
709 709
710 return TRUE;710 return TRUE;
711 711
712error:712error:
713 713
714 // end the class import714 // end the class import
715 type_engine_import_class_end( env );715 type_engine_import_class_end( env );
716 716
717 return FALSE;717 return FALSE;
718}718}
719 719
@@ -759,401 +759,401 @@ static t_CKUINT HidOut_offset_data = 0; · 39 unmodified lines
759t_CKBOOL init_class_HID( Chuck_Env * env )759t_CKBOOL init_class_HID( Chuck_Env * env )
760{760{
761 Chuck_DL_Func * func = NULL;761 Chuck_DL_Func * func = NULL;
762 762
763 // init base class763 // init base class
764 if( !type_engine_import_class_begin( env, "HidMsg", "Object",764 if( !type_engine_import_class_begin( env, "HidMsg", "Object",
765 env->global(), NULL, NULL ) )765 env->global(), NULL, NULL ) )
766 return FALSE;766 return FALSE;
767 767
768 // add member variable768 // add member variable
769 HidMsg_offset_device_type = type_engine_import_mvar( env, "int", "deviceType", FALSE );769 HidMsg_offset_device_type = type_engine_import_mvar( env, "int", "deviceType", FALSE );
770 if( HidMsg_offset_device_type == CK_INVALID_OFFSET ) goto error;770 if( HidMsg_offset_device_type == CK_INVALID_OFFSET ) goto error;
771 771
772 // add member variable772 // add member variable
773 HidMsg_offset_device_num = type_engine_import_mvar( env, "int", "deviceNum", FALSE );773 HidMsg_offset_device_num = type_engine_import_mvar( env, "int", "deviceNum", FALSE );
774 if( HidMsg_offset_device_num == CK_INVALID_OFFSET ) goto error;774 if( HidMsg_offset_device_num == CK_INVALID_OFFSET ) goto error;
775 775
776 // add member variable776 // add member variable
777 HidMsg_offset_type = type_engine_import_mvar( env, "int", "type", FALSE );777 HidMsg_offset_type = type_engine_import_mvar( env, "int", "type", FALSE );
778 if( HidMsg_offset_type == CK_INVALID_OFFSET ) goto error;778 if( HidMsg_offset_type == CK_INVALID_OFFSET ) goto error;
779 779
780 // add member variable780 // add member variable
781 HidMsg_offset_which = type_engine_import_mvar( env, "int", "which", FALSE );781 HidMsg_offset_which = type_engine_import_mvar( env, "int", "which", FALSE );
782 if( HidMsg_offset_which == CK_INVALID_OFFSET ) goto error;782 if( HidMsg_offset_which == CK_INVALID_OFFSET ) goto error;
783 783
784 // add member variable784 // add member variable
785 HidMsg_offset_idata = type_engine_import_mvar( env, "int", "idata", FALSE );785 HidMsg_offset_idata = type_engine_import_mvar( env, "int", "idata", FALSE );
786 if( HidMsg_offset_idata == CK_INVALID_OFFSET ) goto error;786 if( HidMsg_offset_idata == CK_INVALID_OFFSET ) goto error;
787 787
788 // add member variable788 // add member variable
789 HidMsg_offset_fdata = type_engine_import_mvar( env, "float", "fdata", FALSE );789 HidMsg_offset_fdata = type_engine_import_mvar( env, "float", "fdata", FALSE );
790 if( HidMsg_offset_fdata == CK_INVALID_OFFSET ) goto error;790 if( HidMsg_offset_fdata == CK_INVALID_OFFSET ) goto error;
791 791
792 // add member variable792 // add member variable
793 HidMsg_offset_when = type_engine_import_mvar( env, "time", "when", FALSE );793 HidMsg_offset_when = type_engine_import_mvar( env, "time", "when", FALSE );
794 if( HidMsg_offset_when == CK_INVALID_OFFSET ) goto error;794 if( HidMsg_offset_when == CK_INVALID_OFFSET ) goto error;
795 795
796 // add member variable796 // add member variable
797 HidMsg_offset_deltax = type_engine_import_mvar( env, "int", "deltaX", FALSE );797 HidMsg_offset_deltax = type_engine_import_mvar( env, "int", "deltaX", FALSE );
798 if( HidMsg_offset_deltax == CK_INVALID_OFFSET ) goto error;798 if( HidMsg_offset_deltax == CK_INVALID_OFFSET ) goto error;
799 799
800 // add member variable800 // add member variable
801 HidMsg_offset_deltay = type_engine_import_mvar( env, "int", "deltaY", FALSE );801 HidMsg_offset_deltay = type_engine_import_mvar( env, "int", "deltaY", FALSE );
802 if( HidMsg_offset_deltay == CK_INVALID_OFFSET ) goto error;802 if( HidMsg_offset_deltay == CK_INVALID_OFFSET ) goto error;
803 803
804 // add member variable804 // add member variable
805 HidMsg_offset_cursorx = type_engine_import_mvar( env, "int", "cursorX", FALSE );805 HidMsg_offset_cursorx = type_engine_import_mvar( env, "int", "cursorX", FALSE );
806 if( HidMsg_offset_cursorx == CK_INVALID_OFFSET ) goto error;806 if( HidMsg_offset_cursorx == CK_INVALID_OFFSET ) goto error;
807 807
808 // add member variable808 // add member variable
809 HidMsg_offset_cursory = type_engine_import_mvar( env, "int", "cursorY", FALSE );809 HidMsg_offset_cursory = type_engine_import_mvar( env, "int", "cursorY", FALSE );
810 if( HidMsg_offset_cursory == CK_INVALID_OFFSET ) goto error;810 if( HidMsg_offset_cursory == CK_INVALID_OFFSET ) goto error;
811 811
812 // add member variable812 // add member variable
813 HidMsg_offset_scaledcursorx = type_engine_import_mvar( env, "float", "scaledCursorX", FALSE );813 HidMsg_offset_scaledcursorx = type_engine_import_mvar( env, "float", "scaledCursorX", FALSE );
814 if( HidMsg_offset_scaledcursorx == CK_INVALID_OFFSET ) goto error;814 if( HidMsg_offset_scaledcursorx == CK_INVALID_OFFSET ) goto error;
815 815
816 // add member variable816 // add member variable
817 HidMsg_offset_scaledcursory = type_engine_import_mvar( env, "float", "scaledCursorY", FALSE );817 HidMsg_offset_scaledcursory = type_engine_import_mvar( env, "float", "scaledCursorY", FALSE );
818 if( HidMsg_offset_scaledcursory == CK_INVALID_OFFSET ) goto error;818 if( HidMsg_offset_scaledcursory == CK_INVALID_OFFSET ) goto error;
819 819
820 // add member variable820 // add member variable
821 HidMsg_offset_x = type_engine_import_mvar( env, "int", "x", FALSE );821 HidMsg_offset_x = type_engine_import_mvar( env, "int", "x", FALSE );
822 if( HidMsg_offset_x == CK_INVALID_OFFSET ) goto error;822 if( HidMsg_offset_x == CK_INVALID_OFFSET ) goto error;
823 823
824 // add member variable824 // add member variable
825 HidMsg_offset_y = type_engine_import_mvar( env, "int", "y", FALSE );825 HidMsg_offset_y = type_engine_import_mvar( env, "int", "y", FALSE );
826 if( HidMsg_offset_y == CK_INVALID_OFFSET ) goto error;826 if( HidMsg_offset_y == CK_INVALID_OFFSET ) goto error;
827 827
828 // add member variable828 // add member variable
829 HidMsg_offset_z = type_engine_import_mvar( env, "int", "z", FALSE );829 HidMsg_offset_z = type_engine_import_mvar( env, "int", "z", FALSE );
830 if( HidMsg_offset_z == CK_INVALID_OFFSET ) goto error;830 if( HidMsg_offset_z == CK_INVALID_OFFSET ) goto error;
831 831
832 // add member variable (added 1.3.0.0)832 // add member variable (added 1.3.0.0)
833 HidMsg_offset_touchx = type_engine_import_mvar( env, "float", "touchX", FALSE );833 HidMsg_offset_touchx = type_engine_import_mvar( env, "float", "touchX", FALSE );
834 if( HidMsg_offset_touchx == CK_INVALID_OFFSET ) goto error;834 if( HidMsg_offset_touchx == CK_INVALID_OFFSET ) goto error;
835 835
836 // add member variable (added 1.3.0.0)836 // add member variable (added 1.3.0.0)
837 HidMsg_offset_touchy = type_engine_import_mvar( env, "float", "touchY", FALSE );837 HidMsg_offset_touchy = type_engine_import_mvar( env, "float", "touchY", FALSE );
838 if( HidMsg_offset_touchy == CK_INVALID_OFFSET ) goto error;838 if( HidMsg_offset_touchy == CK_INVALID_OFFSET ) goto error;
839 839
840 // add member variable (added 1.3.0.0)840 // add member variable (added 1.3.0.0)
841 HidMsg_offset_touchsize = type_engine_import_mvar( env, "float", "touchSize", FALSE );841 HidMsg_offset_touchsize = type_engine_import_mvar( env, "float", "touchSize", FALSE );
842 if( HidMsg_offset_touchsize == CK_INVALID_OFFSET ) goto error;842 if( HidMsg_offset_touchsize == CK_INVALID_OFFSET ) goto error;
843 843
844 // add member variable844 // add member variable
845 HidMsg_offset_axis_position = type_engine_import_mvar( env, "int", "axis_position", FALSE );845 HidMsg_offset_axis_position = type_engine_import_mvar( env, "int", "axis_position", FALSE );
846 if( HidMsg_offset_axis_position == CK_INVALID_OFFSET ) goto error;846 if( HidMsg_offset_axis_position == CK_INVALID_OFFSET ) goto error;
847 847
848 // add member variable848 // add member variable
849 HidMsg_offset_axis_position2 = type_engine_import_mvar( env, "float", "axisPosition", FALSE );849 HidMsg_offset_axis_position2 = type_engine_import_mvar( env, "float", "axisPosition", FALSE );
850 if( HidMsg_offset_axis_position2 == CK_INVALID_OFFSET ) goto error;850 if( HidMsg_offset_axis_position2 == CK_INVALID_OFFSET ) goto error;
851 851
852 // add member variable852 // add member variable
853 HidMsg_offset_hat_position = type_engine_import_mvar( env, "int", "hatPosition", FALSE );853 HidMsg_offset_hat_position = type_engine_import_mvar( env, "int", "hatPosition", FALSE );
854 if( HidMsg_offset_hat_position == CK_INVALID_OFFSET ) goto error;854 if( HidMsg_offset_hat_position == CK_INVALID_OFFSET ) goto error;
855 855
856 // add member variable856 // add member variable
857 HidMsg_offset_ascii = type_engine_import_mvar( env, "int", "ascii", FALSE );857 HidMsg_offset_ascii = type_engine_import_mvar( env, "int", "ascii", FALSE );
858 if( HidMsg_offset_ascii == CK_INVALID_OFFSET ) goto error;858 if( HidMsg_offset_ascii == CK_INVALID_OFFSET ) goto error;
859 859
860 // add member variable860 // add member variable
861 HidMsg_offset_key = type_engine_import_mvar( env, "int", "key", FALSE );861 HidMsg_offset_key = type_engine_import_mvar( env, "int", "key", FALSE );
862 if( HidMsg_offset_key == CK_INVALID_OFFSET ) goto error;862 if( HidMsg_offset_key == CK_INVALID_OFFSET ) goto error;
863 863
864 // add member variable864 // add member variable
865 HidMsg_offset_scaled_axis_position = type_engine_import_mvar( env, "float", "scaled_axis_position", FALSE );865 HidMsg_offset_scaled_axis_position = type_engine_import_mvar( env, "float", "scaled_axis_position", FALSE );
866 if( HidMsg_offset_scaled_axis_position == CK_INVALID_OFFSET ) goto error;866 if( HidMsg_offset_scaled_axis_position == CK_INVALID_OFFSET ) goto error;
867 867
868 // add is_axis_motion()868 // add is_axis_motion()
869 func = make_new_mfun( "int", "is_axis_motion", HidMsg_is_axis_motion ); // deprecated869 func = make_new_mfun( "int", "is_axis_motion", HidMsg_is_axis_motion ); // deprecated
870 if( !type_engine_import_mfun( env, func ) ) goto error;870 if( !type_engine_import_mfun( env, func ) ) goto error;
871 871
872 // add isAxisMotion()872 // add isAxisMotion()
873 func = make_new_mfun( "int", "isAxisMotion", HidMsg_is_axis_motion );873 func = make_new_mfun( "int", "isAxisMotion", HidMsg_is_axis_motion );
874 if( !type_engine_import_mfun( env, func ) ) goto error;874 if( !type_engine_import_mfun( env, func ) ) goto error;
875 875
876 // add is_button_down()876 // add is_button_down()
877 func = make_new_mfun( "int", "is_button_down", HidMsg_is_button_down ); // deprecated877 func = make_new_mfun( "int", "is_button_down", HidMsg_is_button_down ); // deprecated
878 if( !type_engine_import_mfun( env, func ) ) goto error;878 if( !type_engine_import_mfun( env, func ) ) goto error;
879 879
880 // add isButtonDown()880 // add isButtonDown()
881 func = make_new_mfun( "int", "isButtonDown", HidMsg_is_button_down );881 func = make_new_mfun( "int", "isButtonDown", HidMsg_is_button_down );
882 if( !type_engine_import_mfun( env, func ) ) goto error;882 if( !type_engine_import_mfun( env, func ) ) goto error;
883 883
884 // add is_button_up()884 // add is_button_up()
885 func = make_new_mfun( "int", "is_button_up", HidMsg_is_button_up ); // deprecated885 func = make_new_mfun( "int", "is_button_up", HidMsg_is_button_up ); // deprecated
886 if( !type_engine_import_mfun( env, func ) ) goto error;886 if( !type_engine_import_mfun( env, func ) ) goto error;
887 887
888 // add isButtonUp()888 // add isButtonUp()
889 func = make_new_mfun( "int", "isButtonUp", HidMsg_is_button_up );889 func = make_new_mfun( "int", "isButtonUp", HidMsg_is_button_up );
890 if( !type_engine_import_mfun( env, func ) ) goto error;890 if( !type_engine_import_mfun( env, func ) ) goto error;
891 891
892 // add is_mouse_motion()892 // add is_mouse_motion()
893 func = make_new_mfun( "int", "is_mouse_motion", HidMsg_is_mouse_motion ); // deprecated893 func = make_new_mfun( "int", "is_mouse_motion", HidMsg_is_mouse_motion ); // deprecated
894 if( !type_engine_import_mfun( env, func ) ) goto error;894 if( !type_engine_import_mfun( env, func ) ) goto error;
895 895
896 // add isMouseMotion()896 // add isMouseMotion()
897 func = make_new_mfun( "int", "isMouseMotion", HidMsg_is_mouse_motion );897 func = make_new_mfun( "int", "isMouseMotion", HidMsg_is_mouse_motion );
898 if( !type_engine_import_mfun( env, func ) ) goto error;898 if( !type_engine_import_mfun( env, func ) ) goto error;
899 899
900 // add is_hat_motion()900 // add is_hat_motion()
901 func = make_new_mfun( "int", "is_hat_motion", HidMsg_is_hat_motion ); // deprecated901 func = make_new_mfun( "int", "is_hat_motion", HidMsg_is_hat_motion ); // deprecated
902 if( !type_engine_import_mfun( env, func ) ) goto error;902 if( !type_engine_import_mfun( env, func ) ) goto error;
903 903
904 // add isHatMotion()904 // add isHatMotion()
905 func = make_new_mfun( "int", "isHatMotion", HidMsg_is_hat_motion );905 func = make_new_mfun( "int", "isHatMotion", HidMsg_is_hat_motion );
906 if( !type_engine_import_mfun( env, func ) ) goto error;906 if( !type_engine_import_mfun( env, func ) ) goto error;
907 907
908 // add isWheelMotion()908 // add isWheelMotion()
909 func = make_new_mfun( "int", "isWheelMotion", HidMsg_is_wheel_motion );909 func = make_new_mfun( "int", "isWheelMotion", HidMsg_is_wheel_motion );
910 if( !type_engine_import_mfun( env, func ) ) goto error;910 if( !type_engine_import_mfun( env, func ) ) goto error;
911 911
912 // end the class import912 // end the class import
913 type_engine_import_class_end( env );913 type_engine_import_class_end( env );
914 914
915 915
916 // register deprecate916 // register deprecate
917 type_engine_register_deprecate( env, "HidIn", "Hid" );917 type_engine_register_deprecate( env, "HidIn", "Hid" );
918 918
919 // init base class Hid (copy of HidIn + constants)919 // init base class Hid (copy of HidIn + constants)
920 if( !type_engine_import_class_begin( env, "Hid", "Event",920 if( !type_engine_import_class_begin( env, "Hid", "Event",
921 env->global(), HidIn_ctor, HidIn_dtor ) )921 env->global(), HidIn_ctor, HidIn_dtor ) )
922 return FALSE;922 return FALSE;
923 923
924 // add open()924 // add open()
925 func = make_new_mfun( "int", "open", HidIn_open );925 func = make_new_mfun( "int", "open", HidIn_open );
926 func->add_arg( "int", "type" );926 func->add_arg( "int", "type" );
927 func->add_arg( "int", "num" );927 func->add_arg( "int", "num" );
928 if( !type_engine_import_mfun( env, func ) ) goto error;928 if( !type_engine_import_mfun( env, func ) ) goto error;
929 929
930 // add open()930 // add open()
931 func = make_new_mfun( "int", "open", HidIn_open_named );931 func = make_new_mfun( "int", "open", HidIn_open_named );
932 func->add_arg( "string", "name" );932 func->add_arg( "string", "name" );
933 if( !type_engine_import_mfun( env, func ) ) goto error;933 if( !type_engine_import_mfun( env, func ) ) goto error;
934 934
935 // add openJoystick()935 // add openJoystick()
936 func = make_new_mfun( "int", "openJoystick", HidIn_open_joystick );936 func = make_new_mfun( "int", "openJoystick", HidIn_open_joystick );
937 func->add_arg( "int", "num" );937 func->add_arg( "int", "num" );
938 if( !type_engine_import_mfun( env, func ) ) goto error;938 if( !type_engine_import_mfun( env, func ) ) goto error;
939 939
940 // add openMouse()940 // add openMouse()
941 func = make_new_mfun( "int", "openMouse", HidIn_open_mouse );941 func = make_new_mfun( "int", "openMouse", HidIn_open_mouse );
942 func->add_arg( "int", "num" );942 func->add_arg( "int", "num" );
943 if( !type_engine_import_mfun( env, func ) ) goto error;943 if( !type_engine_import_mfun( env, func ) ) goto error;
944 944
945 // add openKeyboard()945 // add openKeyboard()
946 func = make_new_mfun( "int", "openKeyboard", HidIn_open_keyboard );946 func = make_new_mfun( "int", "openKeyboard", HidIn_open_keyboard );
947 func->add_arg( "int", "num" );947 func->add_arg( "int", "num" );
948 if( !type_engine_import_mfun( env, func ) ) goto error;948 if( !type_engine_import_mfun( env, func ) ) goto error;
949 949
950 // add openTiltSensor()950 // add openTiltSensor()
951 func = make_new_mfun( "int", "openTiltSensor", HidIn_open_tiltsensor );951 func = make_new_mfun( "int", "openTiltSensor", HidIn_open_tiltsensor );
952 if( !type_engine_import_mfun( env, func ) ) goto error;952 if( !type_engine_import_mfun( env, func ) ) goto error;
953 953
954 // add good()954 // add good()
955 func = make_new_mfun( "int", "good", HidIn_good );955 func = make_new_mfun( "int", "good", HidIn_good );
956 if( !type_engine_import_mfun( env, func ) ) goto error;956 if( !type_engine_import_mfun( env, func ) ) goto error;
957 957
958 // add num()958 // add num()
959 func = make_new_mfun( "int", "num", HidIn_num );959 func = make_new_mfun( "int", "num", HidIn_num );
960 if( !type_engine_import_mfun( env, func ) ) goto error;960 if( !type_engine_import_mfun( env, func ) ) goto error;
961 961
962 // add name()962 // add name()
963 func = make_new_mfun( "string", "name", HidIn_name );963 func = make_new_mfun( "string", "name", HidIn_name );
964 if( !type_engine_import_mfun( env, func ) ) goto error;964 if( !type_engine_import_mfun( env, func ) ) goto error;
965 965
966 // add printerr()966 // add printerr()
967 func = make_new_mfun( "void", "printerr", HidIn_printerr );967 func = make_new_mfun( "void", "printerr", HidIn_printerr );
968 func->add_arg( "int", "print_or_not" );968 func->add_arg( "int", "print_or_not" );
969 if( !type_engine_import_mfun( env, func ) ) goto error;969 if( !type_engine_import_mfun( env, func ) ) goto error;
970 970
971 // add recv()971 // add recv()
972 func = make_new_mfun( "int", "recv", HidIn_recv );972 func = make_new_mfun( "int", "recv", HidIn_recv );
973 func->add_arg( "HidMsg", "msg" );973 func->add_arg( "HidMsg", "msg" );
974 if( !type_engine_import_mfun( env, func ) ) goto error;974 if( !type_engine_import_mfun( env, func ) ) goto error;
975 975
976 // add read()976 // add read()
977 func = make_new_mfun( "int", "read", HidIn_read );977 func = make_new_mfun( "int", "read", HidIn_read );
978 func->add_arg( "int", "type" );978 func->add_arg( "int", "type" );
979 func->add_arg( "int", "which" );979 func->add_arg( "int", "which" );
980 func->add_arg( "HidMsg", "msg" );980 func->add_arg( "HidMsg", "msg" );
981 if( !type_engine_import_mfun( env, func ) ) goto error;981 if( !type_engine_import_mfun( env, func ) ) goto error;
982 982
983 // add send()983 // add send()
984 func = make_new_mfun( "int", "send", HidIn_send );984 func = make_new_mfun( "int", "send", HidIn_send );
985 func->add_arg( "HidMsg", "msg" );985 func->add_arg( "HidMsg", "msg" );
986 if( !type_engine_import_mfun( env, func ) ) goto error;986 if( !type_engine_import_mfun( env, func ) ) goto error;
987 987
988 // add can_wait()988 // add can_wait()
989 func = make_new_mfun( "int", "can_wait", HidIn_can_wait );989 func = make_new_mfun( "int", "can_wait", HidIn_can_wait );
990 if( !type_engine_import_mfun( env, func ) ) goto error;990 if( !type_engine_import_mfun( env, func ) ) goto error;
991 991
992 // add readTiltSensor()992 // add readTiltSensor()
993 func = make_new_sfun( "int[]", "readTiltSensor", HidIn_read_tilt_sensor );993 func = make_new_sfun( "int[]", "readTiltSensor", HidIn_read_tilt_sensor );
994 if( !type_engine_import_sfun( env, func ) ) goto error;994 if( !type_engine_import_sfun( env, func ) ) goto error;
995 995
996 // add globalTiltPollRate()996 // add globalTiltPollRate()
997 func = make_new_sfun( "dur", "globalTiltPollRate", HidIn_ctrl_tiltPollRate );997 func = make_new_sfun( "dur", "globalTiltPollRate", HidIn_ctrl_tiltPollRate );
998 func->add_arg( "dur", "d" );998 func->add_arg( "dur", "d" );
999 if( !type_engine_import_sfun( env, func ) ) goto error;999 if( !type_engine_import_sfun( env, func ) ) goto error;
1000 1000
1001 // add globalTiltPollRate()1001 // add globalTiltPollRate()
1002 func = make_new_sfun( "dur", "globalTiltPollRate", HidIn_cget_tiltPollRate );1002 func = make_new_sfun( "dur", "globalTiltPollRate", HidIn_cget_tiltPollRate );
1003 if( !type_engine_import_sfun( env, func ) ) goto error;1003 if( !type_engine_import_sfun( env, func ) ) goto error;
1004 1004
1005 // add startCursorTrack()1005 // add startCursorTrack()
1006 func = make_new_sfun( "int", "startCursorTrack", HidIn_start_cursor_track );1006 func = make_new_sfun( "int", "startCursorTrack", HidIn_start_cursor_track );
1007 if( !type_engine_import_sfun( env, func ) ) goto error;1007 if( !type_engine_import_sfun( env, func ) ) goto error;
1008 1008
1009 // add stopCursorTrack()1009 // add stopCursorTrack()
1010 func = make_new_sfun( "int", "stopCursorTrack", HidIn_stop_cursor_track );1010 func = make_new_sfun( "int", "stopCursorTrack", HidIn_stop_cursor_track );
1011 if( !type_engine_import_sfun( env, func ) ) goto error;1011 if( !type_engine_import_sfun( env, func ) ) goto error;
1012 1012
1013 // add member variable1013 // add member variable
1014 HidIn_offset_data = type_engine_import_mvar( env, "int", "@Hid_data", FALSE );1014 HidIn_offset_data = type_engine_import_mvar( env, "int", "@Hid_data", FALSE );
1015 if( HidIn_offset_data == CK_INVALID_OFFSET ) goto error;1015 if( HidIn_offset_data == CK_INVALID_OFFSET ) goto error;
1016 1016
1017 // add static member variable joystick1017 // add static member variable joystick
1018 if( type_engine_import_svar( env, "int", "JOYSTICK", TRUE,1018 if( type_engine_import_svar( env, "int", "JOYSTICK", TRUE,
1019 ( t_CKUINT ) &CK_HID_DEV_JOYSTICK ) == FALSE )1019 ( t_CKUINT ) &CK_HID_DEV_JOYSTICK ) == FALSE )
1020 goto error;1020 goto error;
1021 1021
1022 // add static member variable keyboard1022 // add static member variable keyboard
1023 if( type_engine_import_svar( env, "int", "KEYBOARD", TRUE,1023 if( type_engine_import_svar( env, "int", "KEYBOARD", TRUE,
1024 ( t_CKUINT ) &CK_HID_DEV_KEYBOARD ) == FALSE )1024 ( t_CKUINT ) &CK_HID_DEV_KEYBOARD ) == FALSE )
1025 goto error;1025 goto error;
1026 1026
1027 // add static member variable mouse1027 // add static member variable mouse
1028 if( type_engine_import_svar( env, "int", "MOUSE", TRUE,1028 if( type_engine_import_svar( env, "int", "MOUSE", TRUE,
1029 ( t_CKUINT ) &CK_HID_DEV_MOUSE ) == FALSE )1029 ( t_CKUINT ) &CK_HID_DEV_MOUSE ) == FALSE )
1030 goto error;1030 goto error;
1031 1031
1032 // add static member variable wii_remote1032 // add static member variable wii_remote
1033 if( type_engine_import_svar( env, "int", "WII_REMOTE", TRUE,1033 if( type_engine_import_svar( env, "int", "WII_REMOTE", TRUE,
1034 ( t_CKUINT ) &CK_HID_DEV_WIIREMOTE ) == FALSE )1034 ( t_CKUINT ) &CK_HID_DEV_WIIREMOTE ) == FALSE )
1035 goto error;1035 goto error;
1036 1036
1037 // add static member variable wii_remote1037 // add static member variable wii_remote
1038 if( type_engine_import_svar( env, "int", "TILT_SENSOR", TRUE,1038 if( type_engine_import_svar( env, "int", "TILT_SENSOR", TRUE,
1039 ( t_CKUINT ) &CK_HID_DEV_TILTSENSOR ) == FALSE )1039 ( t_CKUINT ) &CK_HID_DEV_TILTSENSOR ) == FALSE )
1040 goto error;1040 goto error;
1041 1041
1042 // add static member variable tablet1042 // add static member variable tablet
1043 if( type_engine_import_svar( env, "int", "TABLET", TRUE,1043 if( type_engine_import_svar( env, "int", "TABLET", TRUE,
1044 ( t_CKUINT ) &CK_HID_DEV_TABLET ) == FALSE )1044 ( t_CKUINT ) &CK_HID_DEV_TABLET ) == FALSE )
1045 goto error;1045 goto error;
1046 1046
1047 // add static member variable axisMotion1047 // add static member variable axisMotion
1048 if( type_engine_import_svar( env, "int", "AXIS_MOTION", TRUE,1048 if( type_engine_import_svar( env, "int", "AXIS_MOTION", TRUE,
1049 ( t_CKUINT ) &CK_HID_JOYSTICK_AXIS ) == FALSE )1049 ( t_CKUINT ) &CK_HID_JOYSTICK_AXIS ) == FALSE )
1050 goto error;1050 goto error;
1051 1051
1052 // add static member variable buttonDown1052 // add static member variable buttonDown
1053 if( type_engine_import_svar( env, "int", "BUTTON_DOWN", TRUE,1053 if( type_engine_import_svar( env, "int", "BUTTON_DOWN", TRUE,
1054 ( t_CKUINT ) &CK_HID_BUTTON_DOWN ) == FALSE )1054 ( t_CKUINT ) &CK_HID_BUTTON_DOWN ) == FALSE )
1055 goto error;1055 goto error;
1056 1056
1057 // add static member variable buttonUp1057 // add static member variable buttonUp
1058 if( type_engine_import_svar( env, "int", "BUTTON_UP", TRUE,1058 if( type_engine_import_svar( env, "int", "BUTTON_UP", TRUE,
1059 ( t_CKUINT ) &CK_HID_BUTTON_UP ) == FALSE )1059 ( t_CKUINT ) &CK_HID_BUTTON_UP ) == FALSE )
1060 goto error;1060 goto error;
1061 1061
1062 // add static member variable joystickHat1062 // add static member variable joystickHat
1063 if( type_engine_import_svar( env, "int", "JOYSTICK_HAT", TRUE,1063 if( type_engine_import_svar( env, "int", "JOYSTICK_HAT", TRUE,
1064 ( t_CKUINT ) &CK_HID_JOYSTICK_HAT ) == FALSE )1064 ( t_CKUINT ) &CK_HID_JOYSTICK_HAT ) == FALSE )
1065 goto error;1065 goto error;
1066 1066
1067 // add static member variable JOYSTICK_BALL1067 // add static member variable JOYSTICK_BALL
1068 if( type_engine_import_svar( env, "int", "JOYSTICK_BALL", TRUE,1068 if( type_engine_import_svar( env, "int", "JOYSTICK_BALL", TRUE,
1069 ( t_CKUINT ) &CK_HID_JOYSTICK_BALL ) == FALSE )1069 ( t_CKUINT ) &CK_HID_JOYSTICK_BALL ) == FALSE )
1070 goto error;1070 goto error;
1071 1071
1072 // add static member variable mouseMotion1072 // add static member variable mouseMotion
1073 if( type_engine_import_svar( env, "int", "MOUSE_MOTION", TRUE,1073 if( type_engine_import_svar( env, "int", "MOUSE_MOTION", TRUE,
1074 ( t_CKUINT ) &CK_HID_MOUSE_MOTION ) == FALSE )1074 ( t_CKUINT ) &CK_HID_MOUSE_MOTION ) == FALSE )
1075 goto error;1075 goto error;
1076 1076
1077 // add static member variable mouseWheel1077 // add static member variable mouseWheel
1078 if( type_engine_import_svar( env, "int", "MOUSE_WHEEL", TRUE,1078 if( type_engine_import_svar( env, "int", "MOUSE_WHEEL", TRUE,
1079 ( t_CKUINT ) &CK_HID_MOUSE_WHEEL ) == FALSE )1079 ( t_CKUINT ) &CK_HID_MOUSE_WHEEL ) == FALSE )
1080 goto error;1080 goto error;
1081 1081
1082 // add static member variable DEVICE_CONNECTED1082 // add static member variable DEVICE_CONNECTED
1083 if( type_engine_import_svar( env, "int", "DEVICE_CONNECTED", TRUE,1083 if( type_engine_import_svar( env, "int", "DEVICE_CONNECTED", TRUE,
1084 ( t_CKUINT ) &CK_HID_DEVICE_CONNECTED ) == FALSE )1084 ( t_CKUINT ) &CK_HID_DEVICE_CONNECTED ) == FALSE )
1085 goto error;1085 goto error;
1086 1086
1087 // add static member variable DEVICE_DISCONNECTED1087 // add static member variable DEVICE_DISCONNECTED
1088 if( type_engine_import_svar( env, "int", "DEVICE_DISCONNECTED", TRUE,1088 if( type_engine_import_svar( env, "int", "DEVICE_DISCONNECTED", TRUE,
1089 ( t_CKUINT ) &CK_HID_DEVICE_DISCONNECTED ) == FALSE )1089 ( t_CKUINT ) &CK_HID_DEVICE_DISCONNECTED ) == FALSE )
1090 goto error;1090 goto error;
1091 1091
1092 // add static member variable ACCELEROMETER1092 // add static member variable ACCELEROMETER
1093 if( type_engine_import_svar( env, "int", "ACCELEROMETER", TRUE,1093 if( type_engine_import_svar( env, "int", "ACCELEROMETER", TRUE,
1094 ( t_CKUINT ) &CK_HID_ACCELEROMETER ) == FALSE )1094 ( t_CKUINT ) &CK_HID_ACCELEROMETER ) == FALSE )
1095 goto error;1095 goto error;
1096 1096
1097 // add static member variable LED1097 // add static member variable LED
1098 if( type_engine_import_svar( env, "int", "LED", TRUE,1098 if( type_engine_import_svar( env, "int", "LED", TRUE,
1099 ( t_CKUINT ) &CK_HID_LED ) == FALSE )1099 ( t_CKUINT ) &CK_HID_LED ) == FALSE )
1100 goto error;1100 goto error;
1101 1101
1102 // add static member variable LED1102 // add static member variable LED
1103 if( type_engine_import_svar( env, "int", "FORCE_FEEDBACK", TRUE,1103 if( type_engine_import_svar( env, "int", "FORCE_FEEDBACK", TRUE,
1104 ( t_CKUINT ) &CK_HID_FORCE_FEEDBACK ) == FALSE )1104 ( t_CKUINT ) &CK_HID_FORCE_FEEDBACK ) == FALSE )
1105 goto error;1105 goto error;
1106 1106
1107 // end the class import1107 // end the class import
1108 type_engine_import_class_end( env );1108 type_engine_import_class_end( env );
1109 1109
1110 /*1110 /*
1111 // init base class1111 // init base class
1112 if( !type_engine_import_class_begin( env, "HidOut", "Object",1112 if( !type_engine_import_class_begin( env, "HidOut", "Object",
1113 env->global(), HidOut_ctor ) )1113 env->global(), HidOut_ctor ) )
1114 return FALSE;1114 return FALSE;
1115 1115
1116 // add open()1116 // add open()
1117 func = make_new_mfun( "int", "open", HidOut_open );1117 func = make_new_mfun( "int", "open", HidOut_open );
1118 func->add_arg( "int", "port" );1118 func->add_arg( "int", "port" );
1119 if( !type_engine_import_mfun( env, func ) ) goto error;1119 if( !type_engine_import_mfun( env, func ) ) goto error;
1120 1120
1121 // add good()1121 // add good()
1122 func = make_new_mfun( "int", "good", HidOut_good );1122 func = make_new_mfun( "int", "good", HidOut_good );
1123 if( !type_engine_import_mfun( env, func ) ) goto error;1123 if( !type_engine_import_mfun( env, func ) ) goto error;
1124 1124
1125 // add num()1125 // add num()
1126 func = make_new_mfun( "int", "num", HidOut_num );1126 func = make_new_mfun( "int", "num", HidOut_num );
1127 if( !type_engine_import_mfun( env, func ) ) goto error;1127 if( !type_engine_import_mfun( env, func ) ) goto error;
1128 1128
1129 // add name()1129 // add name()
1130 func = make_new_mfun( "string", "name", HidOut_name );1130 func = make_new_mfun( "string", "name", HidOut_name );
1131 if( !type_engine_import_mfun( env, func ) ) goto error;1131 if( !type_engine_import_mfun( env, func ) ) goto error;
1132 1132
1133 // add printerr()1133 // add printerr()
1134 func = make_new_mfun( "void", "printerr", HidOut_printerr );1134 func = make_new_mfun( "void", "printerr", HidOut_printerr );
1135 func->add_arg( "int", "print_or_not" );1135 func->add_arg( "int", "print_or_not" );
1136 if( !type_engine_import_mfun( env, func ) ) goto error;1136 if( !type_engine_import_mfun( env, func ) ) goto error;
1137 1137
1138 // add send()1138 // add send()
1139 func = make_new_mfun( "int", "send", HidOut_send );1139 func = make_new_mfun( "int", "send", HidOut_send );
1140 func->add_arg( "HidMsg", "msg" );1140 func->add_arg( "HidMsg", "msg" );
1141 if( !type_engine_import_mfun( env, func ) ) goto error;1141 if( !type_engine_import_mfun( env, func ) ) goto error;
1142 1142
1143 // add member variable1143 // add member variable
1144 HidOut_offset_data = type_engine_import_mvar( env, "int", "@HidOut_data", FALSE );1144 HidOut_offset_data = type_engine_import_mvar( env, "int", "@HidOut_data", FALSE );
1145 if( HidOut_offset_data == CK_INVALID_OFFSET ) goto error;1145 if( HidOut_offset_data == CK_INVALID_OFFSET ) goto error;
1146 1146
1147 // end the class import1147 // end the class import
1148 type_engine_import_class_end( env );1148 type_engine_import_class_end( env );
1149 */1149 */
1150 return TRUE;1150 return TRUE;
1151 1151
1152error:1152error:
1153 1153
1154 // end the class import1154 // end the class import
1155 type_engine_import_class_end( env );1155 type_engine_import_class_end( env );
1156 1156
1157 return FALSE;1157 return FALSE;
1158}1158}
1159#endif // __DISABLE_HID__1159#endif // __DISABLE_HID__
@@ -1174,104 +1174,104 @@ static t_CKUINT MidiMsgIn_offset_data = 0; · 14 unmodified lines
1174t_CKBOOL init_class_MidiRW( Chuck_Env * env )1174t_CKBOOL init_class_MidiRW( Chuck_Env * env )
1175{1175{
1176 Chuck_DL_Func * func = NULL;1176 Chuck_DL_Func * func = NULL;
1177 1177
1178 // init base class1178 // init base class
1179 if( !type_engine_import_class_begin( env, "MidiRW", "Object",1179 if( !type_engine_import_class_begin( env, "MidiRW", "Object",
1180 env->global(), MidiRW_ctor, MidiRW_dtor ) )1180 env->global(), MidiRW_ctor, MidiRW_dtor ) )
1181 return FALSE;1181 return FALSE;
1182 1182
1183 // add open()1183 // add open()
1184 func = make_new_mfun( "int", "open", MidiRW_open );1184 func = make_new_mfun( "int", "open", MidiRW_open );
1185 func->add_arg( "string", "filename" );1185 func->add_arg( "string", "filename" );
1186 if( !type_engine_import_mfun( env, func ) ) goto error;1186 if( !type_engine_import_mfun( env, func ) ) goto error;
1187 1187
1188 // add close()1188 // add close()
1189 func = make_new_mfun( "int", "close", MidiRW_close );1189 func = make_new_mfun( "int", "close", MidiRW_close );
1190 if( !type_engine_import_mfun( env, func ) ) goto error;1190 if( !type_engine_import_mfun( env, func ) ) goto error;
1191 1191
1192 // add write()1192 // add write()
1193 func = make_new_mfun( "int", "write", MidiRW_write );1193 func = make_new_mfun( "int", "write", MidiRW_write );
1194 func->add_arg( "MidiMsg", "msg" );1194 func->add_arg( "MidiMsg", "msg" );
1195 func->add_arg( "time", "t" );1195 func->add_arg( "time", "t" );
1196 if( !type_engine_import_mfun( env, func ) ) goto error;1196 if( !type_engine_import_mfun( env, func ) ) goto error;
1197 1197
1198 // add read()1198 // add read()
1199 func = make_new_mfun( "int", "read", MidiRW_read );1199 func = make_new_mfun( "int", "read", MidiRW_read );
1200 func->add_arg( "MidiMsg", "msg" );1200 func->add_arg( "MidiMsg", "msg" );
1201 //func->add_arg( "time", "t" );1201 //func->add_arg( "time", "t" );
1202 if( !type_engine_import_mfun( env, func ) ) goto error;1202 if( !type_engine_import_mfun( env, func ) ) goto error;
1203 1203
1204 // add member variable1204 // add member variable
1205 MidiRW_offset_data = type_engine_import_mvar( env, "int", "@MidiRW_data", FALSE );1205 MidiRW_offset_data = type_engine_import_mvar( env, "int", "@MidiRW_data", FALSE );
1206 if( MidiRW_offset_data == CK_INVALID_OFFSET ) goto error;1206 if( MidiRW_offset_data == CK_INVALID_OFFSET ) goto error;
1207 1207
1208 // end the class import1208 // end the class import
1209 type_engine_import_class_end( env );1209 type_engine_import_class_end( env );
1210 1210
1211 // init base class1211 // init base class
1212 if( !type_engine_import_class_begin( env, "MidiMsgOut", "Object",1212 if( !type_engine_import_class_begin( env, "MidiMsgOut", "Object",
1213 env->global(), MidiMsgOut_ctor, MidiMsgOut_dtor ) )1213 env->global(), MidiMsgOut_ctor, MidiMsgOut_dtor ) )
1214 return FALSE;1214 return FALSE;
1215 1215
1216 // add open()1216 // add open()
1217 func = make_new_mfun( "int", "open", MidiMsgOut_open );1217 func = make_new_mfun( "int", "open", MidiMsgOut_open );
1218 func->add_arg( "string", "filename" );1218 func->add_arg( "string", "filename" );
1219 if( !type_engine_import_mfun( env, func ) ) goto error;1219 if( !type_engine_import_mfun( env, func ) ) goto error;
1220 1220
1221 // add close()1221 // add close()
1222 func = make_new_mfun( "int", "close", MidiMsgOut_close );1222 func = make_new_mfun( "int", "close", MidiMsgOut_close );
1223 if( !type_engine_import_mfun( env, func ) ) goto error;1223 if( !type_engine_import_mfun( env, func ) ) goto error;
1224 1224
1225 // add write()1225 // add write()
1226 func = make_new_mfun( "int", "write", MidiMsgOut_write );1226 func = make_new_mfun( "int", "write", MidiMsgOut_write );
1227 func->add_arg( "MidiMsg", "msg" );1227 func->add_arg( "MidiMsg", "msg" );
1228 func->add_arg( "time", "t" );1228 func->add_arg( "time", "t" );
1229 if( !type_engine_import_mfun( env, func ) ) goto error;1229 if( !type_engine_import_mfun( env, func ) ) goto error;
1230 1230
1231 // add member variable1231 // add member variable
1232 MidiMsgOut_offset_data = type_engine_import_mvar( env, "int", "@MidiMsgOut_data", FALSE );1232 MidiMsgOut_offset_data = type_engine_import_mvar( env, "int", "@MidiMsgOut_data", FALSE );
1233 if( MidiMsgOut_offset_data == CK_INVALID_OFFSET ) goto error;1233 if( MidiMsgOut_offset_data == CK_INVALID_OFFSET ) goto error;
1234 1234
1235 // end the class import1235 // end the class import
1236 type_engine_import_class_end( env );1236 type_engine_import_class_end( env );
1237 1237
1238 // init base class1238 // init base class
1239 if( !type_engine_import_class_begin( env, "MidiMsgIn", "Object",1239 if( !type_engine_import_class_begin( env, "MidiMsgIn", "Object",
1240 env->global(), MidiMsgIn_ctor, MidiMsgIn_dtor ) )1240 env->global(), MidiMsgIn_ctor, MidiMsgIn_dtor ) )
1241 return FALSE;1241 return FALSE;
1242 1242
1243 // add open()1243 // add open()
1244 func = make_new_mfun( "int", "open", MidiMsgIn_open );1244 func = make_new_mfun( "int", "open", MidiMsgIn_open );
1245 func->add_arg( "string", "filename" );1245 func->add_arg( "string", "filename" );
1246 if( !type_engine_import_mfun( env, func ) ) goto error;1246 if( !type_engine_import_mfun( env, func ) ) goto error;
1247 1247
1248 // add close()1248 // add close()
1249 func = make_new_mfun( "int", "close", MidiMsgIn_close );1249 func = make_new_mfun( "int", "close", MidiMsgIn_close );
1250 if( !type_engine_import_mfun( env, func ) ) goto error;1250 if( !type_engine_import_mfun( env, func ) ) goto error;
1251 1251
1252 // add read()1252 // add read()
1253 func = make_new_mfun( "int", "read", MidiMsgIn_read );1253 func = make_new_mfun( "int", "read", MidiMsgIn_read );
1254 func->add_arg( "MidiMsg", "msg" );1254 func->add_arg( "MidiMsg", "msg" );
1255 //func->add_arg( "time", "t" );1255 //func->add_arg( "time", "t" );
1256 if( !type_engine_import_mfun( env, func ) ) goto error;1256 if( !type_engine_import_mfun( env, func ) ) goto error;
1257 1257
1258 // add member variable1258 // add member variable
1259 MidiMsgIn_offset_data = type_engine_import_mvar( env, "int", "@MidiMsgIn_data", FALSE );1259 MidiMsgIn_offset_data = type_engine_import_mvar( env, "int", "@MidiMsgIn_data", FALSE );
1260 if( MidiMsgIn_offset_data == CK_INVALID_OFFSET ) goto error;1260 if( MidiMsgIn_offset_data == CK_INVALID_OFFSET ) goto error;
1261 1261
1262 // end the class import1262 // end the class import
1263 type_engine_import_class_end( env );1263 type_engine_import_class_end( env );
1264 1264
1265 // initialize1265 // initialize
1266 // HidInManager::init();1266 // HidInManager::init();
1267 1267
1268 return TRUE;1268 return TRUE;
1269 1269
1270error:1270error:
1271 1271
1272 // end the class import1272 // end the class import
1273 type_engine_import_class_end( env );1273 type_engine_import_class_end( env );
1274 1274
1275 return FALSE;1275 return FALSE;
1276}1276}
1277#endif // __DISABLE_MIDI__1277#endif // __DISABLE_MIDI__
@@ -1298,7 +1298,7 @@ CK_DLL_SFUN( io_newline ) · 20 unmodified lines
1298}1298}
1299 1299
1300 1300
1301#ifndef __DISABLE_FILEIO__1301// #ifndef __DISABLE_FILEIO__
1302//-----------------------------------------------------------------------------1302//-----------------------------------------------------------------------------
1303// FileIO API1303// FileIO API
1304//-----------------------------------------------------------------------------1304//-----------------------------------------------------------------------------
@@ -1313,8 +1313,8 @@ CK_DLL_MFUN( fileio_open ) · 8 unmodified lines
1313 std::string filename = GET_NEXT_STRING(ARGS)->str();1313 std::string filename = GET_NEXT_STRING(ARGS)->str();
1314 Chuck_IO_File * f = (Chuck_IO_File *)SELF;1314 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
1315 t_CKINT default_flags =1315 t_CKINT default_flags =
1316 Chuck_IO_File::FLAG_READ_WRITE | Chuck_IO_File::TYPE_ASCII;1316 Chuck_IO::FLAG_READ_WRITE | Chuck_IO::TYPE_ASCII;
1317 1317
1318 RETURN->v_int = f->open(filename, default_flags);1318 RETURN->v_int = f->open(filename, default_flags);
1319}1319}
1320 1320
@@ -1323,7 +1323,7 @@ CK_DLL_MFUN( fileio_openflags ) · 2 unmodified lines
1323 Chuck_IO_File * f = (Chuck_IO_File *)SELF;1323 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
1324 std::string filename = GET_NEXT_STRING(ARGS)->str();1324 std::string filename = GET_NEXT_STRING(ARGS)->str();
1325 t_CKINT flags = GET_NEXT_INT(ARGS);1325 t_CKINT flags = GET_NEXT_INT(ARGS);
1326 1326
1327 RETURN->v_int = f->open(filename, flags);1327 RETURN->v_int = f->open(filename, flags);
1328}1328}
1329 1329
@@ -1354,7 +1354,7 @@ CK_DLL_MFUN( fileio_getmode ) · 24 unmodified lines
1354CK_DLL_MFUN( fileio_setmode )1354CK_DLL_MFUN( fileio_setmode )
1355{1355{
1356 t_CKINT flag = GET_NEXT_INT(ARGS);1356 t_CKINT flag = GET_NEXT_INT(ARGS);
1357 1357
1358 Chuck_IO_File * f = (Chuck_IO_File *)SELF;1358 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
1359 f->mode( flag );1359 f->mode( flag );
1360 RETURN->v_int = 0;1360 RETURN->v_int = 0;
@@ -1369,7 +1369,7 @@ CK_DLL_MFUN( fileio_size ) · 8 unmodified lines
1369CK_DLL_MFUN( fileio_seek )1369CK_DLL_MFUN( fileio_seek )
1370{1370{
1371 t_CKINT pos = GET_NEXT_INT(ARGS);1371 t_CKINT pos = GET_NEXT_INT(ARGS);
1372 1372
1373 Chuck_IO_File * f = (Chuck_IO_File *)SELF;1373 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
1374 f->seek(pos);1374 f->seek(pos);
1375}1375}
@@ -1398,7 +1398,7 @@ CK_DLL_MFUN( fileio_dirlist ) · 22 unmodified lines
1398 {1398 {
1399 t_CKINT len = GET_NEXT_INT(ARGS);1399 t_CKINT len = GET_NEXT_INT(ARGS);
1400 Chuck_IO_File * f = (Chuck_IO_File *)SELF;1400 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
1401 1401
1402 Chuck_String * s = f->read( len );1402 Chuck_String * s = f->read( len );
1403 RETURN->v_object = s;1403 RETURN->v_object = s;
1404 }1404 }
@@ -1415,31 +1415,34 @@ CK_DLL_MFUN( fileio_readint ) · 10 unmodified lines
1415{1415{
1416 Chuck_IO_File * f = (Chuck_IO_File *)SELF;1416 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
1417 t_CKINT defaultflags = Chuck_IO::INT32;1417 t_CKINT defaultflags = Chuck_IO::INT32;
1418 1418
1419 /* (ATODO: doesn't look like asynchronous reading will work)1419 /* (ATODO: doesn't look like asynchronous reading will work)
1420 if (f->mode() == Chuck_IO::MODE_ASYNC)1420 if (f->mode() == Chuck_IO::MODE_ASYNC)
1421 {1421 {
1422 // set up arguments1422 // set up arguments
1423 Chuck_IO::async_args *args = new Chuck_IO::async_args;1423 Chuck_IO::async_args *args = new Chuck_IO::async_args;
1424 args->RETURN = (void *)RETURN;1424 args->RETURN = (void *)RETURN;
1425 args->fileio_obj = f;1425 args->fileio_obj = f;
1426 args->intArg = defaultflags;1426 args->intArg = defaultflags;
1427 // set shred to wait for I/O completion1427 // set shred to wait for I/O completion
1428 f->m_asyncEvent->wait( SHRED, SHRED->vm_ref );1428 f->m_asyncEvent->wait( SHRED, SHRED->vm_ref );
1429 // start thread1429 // start thread
1430 bool ret = f->m_thread->start( f->readInt_thread, (void *)args );1430 bool ret = f->m_thread->start( f->readInt_thread, (void *)args );
1431 if (!ret) {1431 if (!ret)
1432 cerr << "m_thread->start failed; recreating m_thread" << endl;1432 {
1433 delete f->m_thread;1433 cerr << "m_thread->start failed; recreating m_thread" << endl;
1434 f->m_thread = new XThread;1434 delete f->m_thread;
1435 ret = f->m_thread->start( f->readInt_thread, (void *)args );1435 f->m_thread = new XThread;
1436 if (!ret) {1436 ret = f->m_thread->start( f->readInt_thread, (void *)args );
1437 EM_error3( "(FileIO): failed to start thread for asynchronous mode I/O" );1437 if (!ret) {
1438 }1438 EM_error3( "(FileIO): failed to start thread for asynchronous mode I/O" );
1439 }1439 }
1440 } else {*/1440 }
1441 } else {*/
1442
1441 t_CKINT ret = f->readInt( defaultflags );1443 t_CKINT ret = f->readInt( defaultflags );
1442 RETURN->v_int = ret;1444 RETURN->v_int = ret;
1445
1443 //}1446 //}
1444 // ATODO: Debug1447 // ATODO: Debug
1445 //sleep(1);1448 //sleep(1);
@@ -1449,10 +1452,8 @@ CK_DLL_MFUN( fileio_readint ) · 3 unmodified lines
1449CK_DLL_MFUN( fileio_readintflags )1452CK_DLL_MFUN( fileio_readintflags )
1450{1453{
1451 t_CKINT flags = GET_NEXT_INT(ARGS);1454 t_CKINT flags = GET_NEXT_INT(ARGS);
1452
1453 Chuck_IO_File * f = (Chuck_IO_File *)SELF;1455 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
1454 t_CKINT ret = f->readInt( flags );1456 t_CKINT ret = f->readInt( flags );
1455
1456 RETURN->v_int = ret;1457 RETURN->v_int = ret;
1457}1458}
1458 1459
@@ -1480,8 +1481,9 @@ CK_DLL_MFUN( fileio_more ) · 21 unmodified lines
1480CK_DLL_MFUN( fileio_writestring )1481CK_DLL_MFUN( fileio_writestring )
1481{1482{
1482 std::string val = GET_NEXT_STRING(ARGS)->str();1483 std::string val = GET_NEXT_STRING(ARGS)->str();
1483
1484 Chuck_IO_File * f = (Chuck_IO_File *)SELF;1484 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
1485
1486#ifndef __DISABLE_FILEIO__ // 1.4.2.1 (ge) | made more granular (e.g., for WebChucK)
1485 if (f->mode() == Chuck_IO::MODE_ASYNC)1487 if (f->mode() == Chuck_IO::MODE_ASYNC)
1486 {1488 {
1487 // set up arguments1489 // set up arguments
@@ -1507,13 +1509,17 @@ CK_DLL_MFUN( fileio_writestring ) · 19 unmodified lines
1507 } else {1509 } else {
1508 f->write(val);1510 f->write(val);
1509 }1511 }
1512#else
1513 f->write(val);
1514#endif // __DISABLE_FILEIO__
1510}1515}
1511 1516
1512CK_DLL_MFUN( fileio_writeint )1517CK_DLL_MFUN( fileio_writeint )
1513{1518{
1514 t_CKINT val = GET_NEXT_INT(ARGS);1519 t_CKINT val = GET_NEXT_INT(ARGS);
1515
1516 Chuck_IO_File * f = (Chuck_IO_File *)SELF;1520 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
1521
1522#ifndef __DISABLE_FILEIO__ // 1.4.2.1 (ge) | made more granular (e.g., for WebChucK)
1517 if (f->mode() == Chuck_IO::MODE_ASYNC)1523 if (f->mode() == Chuck_IO::MODE_ASYNC)
1518 {1524 {
1519 // set up arguments1525 // set up arguments
@@ -1539,14 +1545,18 @@ CK_DLL_MFUN( fileio_writeint ) · 19 unmodified lines
1539 } else {1545 } else {
1540 f->write(val);1546 f->write(val);
1541 }1547 }
1548#else
1549 f->write(val);
1550#endif // __DISABLE_FILEIO__
1542}1551}
1543 1552
1544CK_DLL_MFUN( fileio_writeintflags )1553CK_DLL_MFUN( fileio_writeintflags )
1545{1554{
1546 t_CKINT val = GET_NEXT_INT(ARGS);1555 t_CKINT val = GET_NEXT_INT(ARGS);
1547 t_CKINT flags = GET_NEXT_INT(ARGS);1556 t_CKINT flags = GET_NEXT_INT(ARGS);
1548
1549 Chuck_IO_File * f = (Chuck_IO_File *)SELF;1557 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
1558
1559#ifndef __DISABLE_FILEIO__ // 1.4.2.1 (ge) | made more granular (e.g., for WebChucK)
1550 if (f->mode() == Chuck_IO::MODE_ASYNC)1560 if (f->mode() == Chuck_IO::MODE_ASYNC)
1551 {1561 {
1552 // TODO: pass flags in args1562 // TODO: pass flags in args
@@ -1573,13 +1583,18 @@ CK_DLL_MFUN( fileio_writeintflags ) · 20 unmodified lines
1573 } else {1583 } else {
1574 f->write(val, flags);1584 f->write(val, flags);
1575 }1585 }
1586#else
1587 f->write(val, flags);
1588#endif // __DISABLE_FILEIO__
1589
1576}1590}
1577 1591
1578CK_DLL_MFUN( fileio_writefloat )1592CK_DLL_MFUN( fileio_writefloat )
1579{1593{
1580 t_CKFLOAT val = GET_NEXT_FLOAT(ARGS);1594 t_CKFLOAT val = GET_NEXT_FLOAT(ARGS);
1581
1582 Chuck_IO_File * f = (Chuck_IO_File *)SELF;1595 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
1596
1597#ifndef __DISABLE_FILEIO__ // 1.4.2.1 (ge) | made more granular (e.g., for WebChucK)
1583 if (f->mode() == Chuck_IO::MODE_ASYNC)1598 if (f->mode() == Chuck_IO::MODE_ASYNC)
1584 {1599 {
1585 // set up arguments1600 // set up arguments
@@ -1605,8 +1620,14 @@ CK_DLL_MFUN( fileio_writefloat ) · 19 unmodified lines
1605 } else {1620 } else {
1606 f->write(val);1621 f->write(val);
1607 }1622 }
1623#else
1624 f->write(val);
1625#endif //__DISABLE_FILEIO__
1608}1626}
1609#endif // __DISABLE_FILEIO__1627
1628// #endif // __DISABLE_FILEIO__
1629
1630
1610 1631
1611 1632
1612//-----------------------------------------------------------------------------1633//-----------------------------------------------------------------------------
@@ -1651,7 +1672,7 @@ CK_DLL_MFUN( chout_setmode ) · 38 unmodified lines
1651 {1672 {
1652 t_CKINT len = GET_NEXT_INT(ARGS);1673 t_CKINT len = GET_NEXT_INT(ARGS);
1653 Chuck_IO_File * f = (Chuck_IO_File *)SELF;1674 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
1654 1675
1655 Chuck_String * s = f->read( len );1676 Chuck_String * s = f->read( len );
1656 RETURN->v_object = s;1677 RETURN->v_object = s;
1657 }1678 }
@@ -1673,10 +1694,10 @@ CK_DLL_MFUN( chout_readint ) · 15 unmodified lines
1673CK_DLL_MFUN( chout_readintflags )1694CK_DLL_MFUN( chout_readintflags )
1674{1695{
1675 t_CKINT flags = GET_NEXT_INT(ARGS);1696 t_CKINT flags = GET_NEXT_INT(ARGS);
1676 1697
1677 Chuck_IO_Chout * c = SHRED->vm_ref->chout();1698 Chuck_IO_Chout * c = SHRED->vm_ref->chout();
1678 t_CKINT ret = c->readInt( flags );1699 t_CKINT ret = c->readInt( flags );
1679 1700
1680 RETURN->v_int = ret;1701 RETURN->v_int = ret;
1681}1702}
1682 1703
@@ -1704,15 +1725,18 @@ CK_DLL_MFUN( chout_more ) · 21 unmodified lines
1704CK_DLL_MFUN( chout_writestring )1725CK_DLL_MFUN( chout_writestring )
1705{1726{
1706 std::string val = GET_NEXT_STRING(ARGS)->str();1727 std::string val = GET_NEXT_STRING(ARGS)->str();
1707 1728
1708 Chuck_IO_Chout * c = SHRED->vm_ref->chout();1729 Chuck_IO_Chout * c = SHRED->vm_ref->chout();
1709 c->write( val );1730 c->write( val );
1731
1732 // 1.4.2.1 | (ge) added a single newline -> trigger chout flush
1733 if( val == "\n" ) c->flush();
1710}1734}
1711 1735
1712CK_DLL_MFUN( chout_writeint )1736CK_DLL_MFUN( chout_writeint )
1713{1737{
1714 t_CKINT val = GET_NEXT_INT(ARGS);1738 t_CKINT val = GET_NEXT_INT(ARGS);
1715 1739
1716 Chuck_IO_Chout * c = SHRED->vm_ref->chout();1740 Chuck_IO_Chout * c = SHRED->vm_ref->chout();
1717 c->write(val);1741 c->write(val);
1718}1742}
@@ -1720,7 +1744,7 @@ CK_DLL_MFUN( chout_writeint ) · 1 unmodified line
1720CK_DLL_MFUN( chout_writefloat )1744CK_DLL_MFUN( chout_writefloat )
1721{1745{
1722 t_CKFLOAT val = GET_NEXT_FLOAT(ARGS);1746 t_CKFLOAT val = GET_NEXT_FLOAT(ARGS);
1723 1747
1724 Chuck_IO_Chout * c = SHRED->vm_ref->chout();1748 Chuck_IO_Chout * c = SHRED->vm_ref->chout();
1725 c->write(val);1749 c->write(val);
1726}1750}
@@ -1770,7 +1794,7 @@ CK_DLL_MFUN( cherr_setmode ) · 43 unmodified lines
1770 {1794 {
1771 t_CKINT len = GET_NEXT_INT(ARGS);1795 t_CKINT len = GET_NEXT_INT(ARGS);
1772 Chuck_IO_File * f = (Chuck_IO_File *)SELF;1796 Chuck_IO_File * f = (Chuck_IO_File *)SELF;
1773 1797
1774 Chuck_String * s = f->read( len );1798 Chuck_String * s = f->read( len );
1775 RETURN->v_object = s;1799 RETURN->v_object = s;
1776 }1800 }
@@ -1792,10 +1816,10 @@ CK_DLL_MFUN( cherr_readint ) · 15 unmodified lines
1792CK_DLL_MFUN( cherr_readintflags )1816CK_DLL_MFUN( cherr_readintflags )
1793{1817{
1794 t_CKINT flags = GET_NEXT_INT(ARGS);1818 t_CKINT flags = GET_NEXT_INT(ARGS);
1795 1819
1796 Chuck_IO_Cherr * c = SHRED->vm_ref->cherr();1820 Chuck_IO_Cherr * c = SHRED->vm_ref->cherr();
1797 t_CKINT ret = c->readInt( flags );1821 t_CKINT ret = c->readInt( flags );
1798 1822
1799 RETURN->v_int = ret;1823 RETURN->v_int = ret;
1800}1824}
1801 1825
@@ -1823,7 +1847,7 @@ CK_DLL_MFUN( cherr_more ) · 21 unmodified lines
1823CK_DLL_MFUN( cherr_writestring )1847CK_DLL_MFUN( cherr_writestring )
1824{1848{
1825 std::string val = GET_NEXT_STRING(ARGS)->str();1849 std::string val = GET_NEXT_STRING(ARGS)->str();
1826 1850
1827 Chuck_IO_Cherr * c = SHRED->vm_ref->cherr();1851 Chuck_IO_Cherr * c = SHRED->vm_ref->cherr();
1828 c->write( val );1852 c->write( val );
1829}1853}
@@ -1831,7 +1855,7 @@ CK_DLL_MFUN( cherr_writestring ) · 1 unmodified line
1831CK_DLL_MFUN( cherr_writeint )1855CK_DLL_MFUN( cherr_writeint )
1832{1856{
1833 t_CKINT val = GET_NEXT_INT(ARGS);1857 t_CKINT val = GET_NEXT_INT(ARGS);
1834 1858
1835 Chuck_IO_Chout * c = SHRED->vm_ref->chout();1859 Chuck_IO_Chout * c = SHRED->vm_ref->chout();
1836 c->write(val);1860 c->write(val);
1837}1861}
@@ -1839,7 +1863,7 @@ CK_DLL_MFUN( cherr_writeint ) · 1 unmodified line
1839CK_DLL_MFUN( cherr_writefloat )1863CK_DLL_MFUN( cherr_writefloat )
1840{1864{
1841 t_CKFLOAT val = GET_NEXT_FLOAT(ARGS);1865 t_CKFLOAT val = GET_NEXT_FLOAT(ARGS);
1842 1866
1843 Chuck_IO_Cherr * c = SHRED->vm_ref->cherr();1867 Chuck_IO_Cherr * c = SHRED->vm_ref->cherr();
1844 c->write(val);1868 c->write(val);
1845}1869}
@@ -2149,7 +2173,7 @@ CK_DLL_MFUN( HidIn_recv ) · 303 unmodified lines
2149 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_which) = the_msg.eid;2173 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_which) = the_msg.eid;
2150 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_idata) = the_msg.idata[0];2174 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_idata) = the_msg.idata[0];
2151 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_fdata) = the_msg.fdata[0];2175 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_fdata) = the_msg.fdata[0];
2152 2176
2153 // mouse motion specific member variables2177 // mouse motion specific member variables
2154 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_deltax) = the_msg.idata[0];2178 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_deltax) = the_msg.idata[0];
2155 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_deltay) = the_msg.idata[1];2179 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_deltay) = the_msg.idata[1];
@@ -2157,24 +2181,24 @@ CK_DLL_MFUN( HidIn_recv ) · 1 unmodified line
2157 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_cursory) = the_msg.idata[3];2181 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_cursory) = the_msg.idata[3];
2158 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaledcursorx) = the_msg.fdata[0];2182 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaledcursorx) = the_msg.fdata[0];
2159 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaledcursory) = the_msg.fdata[1];2183 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaledcursory) = the_msg.fdata[1];
2160 2184
2161 // axis motion specific member variables2185 // axis motion specific member variables
2162 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_axis_position) = the_msg.idata[0];2186 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_axis_position) = the_msg.idata[0];
2163 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaled_axis_position) = the_msg.fdata[0];2187 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaled_axis_position) = the_msg.fdata[0];
2164 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_axis_position2) = the_msg.fdata[0];2188 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_axis_position2) = the_msg.fdata[0];
2165 2189
2166 // hat motion specific variables2190 // hat motion specific variables
2167 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_hat_position) = the_msg.idata[0];2191 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_hat_position) = the_msg.idata[0];
2168 2192
2169 // keyboard specific variables2193 // keyboard specific variables
2170 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_key) = the_msg.idata[1];2194 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_key) = the_msg.idata[1];
2171 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_ascii) = the_msg.idata[2];2195 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_ascii) = the_msg.idata[2];
2172 2196
2173 // accelerometer (tilt sensor, wii remote) specific members2197 // accelerometer (tilt sensor, wii remote) specific members
2174 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_x) = the_msg.idata[0];2198 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_x) = the_msg.idata[0];
2175 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_y) = the_msg.idata[1];2199 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_y) = the_msg.idata[1];
2176 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_z) = the_msg.idata[2];2200 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_z) = the_msg.idata[2];
2177 2201
2178 // multitouch stuff - added 1.3.0.02202 // multitouch stuff - added 1.3.0.0
2179 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_touchx) = the_msg.fdata[0];2203 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_touchx) = the_msg.fdata[0];
2180 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_touchy) = the_msg.fdata[1];2204 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_touchy) = the_msg.fdata[1];
@@ -2188,21 +2212,21 @@ CK_DLL_MFUN( HidIn_read ) · 7 unmodified lines
2188 t_CKINT type = GET_NEXT_INT(ARGS);2212 t_CKINT type = GET_NEXT_INT(ARGS);
2189 t_CKINT num = GET_NEXT_INT(ARGS);2213 t_CKINT num = GET_NEXT_INT(ARGS);
2190 Chuck_Object * fake_msg = GET_NEXT_OBJECT(ARGS);2214 Chuck_Object * fake_msg = GET_NEXT_OBJECT(ARGS);
2191 2215
2192 HidMsg the_msg;2216 HidMsg the_msg;
2193 2217
2194 RETURN->v_int = min->read( type, num, &the_msg );2218 RETURN->v_int = min->read( type, num, &the_msg );
2195 2219
2196 if( RETURN->v_int )2220 if( RETURN->v_int )
2197 {2221 {
2198 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_device_type) = the_msg.device_type;2222 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_device_type) = the_msg.device_type;
2199 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_device_num) = the_msg.device_num;2223 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_device_num) = the_msg.device_num;
2200 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_type) = the_msg.type;2224 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_type) = the_msg.type;
2201 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_which) = the_msg.eid;2225 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_which) = the_msg.eid;
2202 2226
2203 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_idata) = the_msg.idata[0];2227 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_idata) = the_msg.idata[0];
2204 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_fdata) = the_msg.fdata[0];2228 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_fdata) = the_msg.fdata[0];
2205 2229
2206 // mouse motion specific member members2230 // mouse motion specific member members
2207 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_deltax) = the_msg.idata[0];2231 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_deltax) = the_msg.idata[0];
2208 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_deltay) = the_msg.idata[1];2232 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_deltay) = the_msg.idata[1];
@@ -2210,19 +2234,19 @@ CK_DLL_MFUN( HidIn_read ) · 1 unmodified line
2210 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_cursory) = the_msg.idata[3];2234 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_cursory) = the_msg.idata[3];
2211 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaledcursorx) = the_msg.fdata[0];2235 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaledcursorx) = the_msg.fdata[0];
2212 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaledcursory) = the_msg.fdata[1];2236 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaledcursory) = the_msg.fdata[1];
2213 2237
2214 // joystick axis specific member members2238 // joystick axis specific member members
2215 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_axis_position) = the_msg.idata[0];2239 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_axis_position) = the_msg.idata[0];
2216 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaled_axis_position) = the_msg.fdata[0];2240 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_scaled_axis_position) = the_msg.fdata[0];
2217 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_axis_position2) = the_msg.fdata[0];2241 OBJ_MEMBER_FLOAT(fake_msg, HidMsg_offset_axis_position2) = the_msg.fdata[0];
2218 2242
2219 // joystick hat specific member members2243 // joystick hat specific member members
2220 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_hat_position) = the_msg.idata[0];2244 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_hat_position) = the_msg.idata[0];
2221 2245
2222 // keyboard specific members2246 // keyboard specific members
2223 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_key) = the_msg.idata[1];2247 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_key) = the_msg.idata[1];
2224 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_ascii) = the_msg.idata[2];2248 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_ascii) = the_msg.idata[2];
2225 2249
2226 // accelerometer (tilt sensor, wii remote) specific members2250 // accelerometer (tilt sensor, wii remote) specific members
2227 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_x) = the_msg.idata[0];2251 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_x) = the_msg.idata[0];
2228 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_y) = the_msg.idata[1];2252 OBJ_MEMBER_INT(fake_msg, HidMsg_offset_y) = the_msg.idata[1];
@@ -2234,14 +2258,14 @@ CK_DLL_MFUN( HidIn_send ) · 5 unmodified lines
2234{2258{
2235 HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);2259 HidIn * min = (HidIn *)OBJ_MEMBER_INT(SELF, HidIn_offset_data);
2236 Chuck_Object * fake_msg = GET_NEXT_OBJECT(ARGS);2260 Chuck_Object * fake_msg = GET_NEXT_OBJECT(ARGS);
2237 2261
2238 HidMsg the_msg;2262 HidMsg the_msg;
2239 the_msg.device_type = OBJ_MEMBER_INT( fake_msg, HidMsg_offset_device_type );2263 the_msg.device_type = OBJ_MEMBER_INT( fake_msg, HidMsg_offset_device_type );
2240 the_msg.device_num = OBJ_MEMBER_INT( fake_msg, HidMsg_offset_device_num );2264 the_msg.device_num = OBJ_MEMBER_INT( fake_msg, HidMsg_offset_device_num );
2241 the_msg.type = OBJ_MEMBER_INT( fake_msg, HidMsg_offset_type );2265 the_msg.type = OBJ_MEMBER_INT( fake_msg, HidMsg_offset_type );
2242 the_msg.eid = OBJ_MEMBER_INT( fake_msg, HidMsg_offset_which );2266 the_msg.eid = OBJ_MEMBER_INT( fake_msg, HidMsg_offset_which );
2243 the_msg.idata[0] = OBJ_MEMBER_INT( fake_msg, HidMsg_offset_idata );2267 the_msg.idata[0] = OBJ_MEMBER_INT( fake_msg, HidMsg_offset_idata );
2244 2268
2245 RETURN->v_int = min->send( &the_msg );2269 RETURN->v_int = min->send( &the_msg );
2246}2270}
2247 2271
@@ -2255,19 +2279,19 @@ CK_DLL_SFUN( HidIn_read_tilt_sensor ) · 7 unmodified lines
2255{2279{
2256 static HidIn * hi;2280 static HidIn * hi;
2257 static t_CKBOOL hi_good = TRUE;2281 static t_CKBOOL hi_good = TRUE;
2258 2282
2259 Chuck_Array4 * array = new Chuck_Array4( FALSE, 3 );2283 Chuck_Array4 * array = new Chuck_Array4( FALSE, 3 );
2260 array->set( 0, 0 );2284 array->set( 0, 0 );
2261 array->set( 1, 0 );2285 array->set( 1, 0 );
2262 array->set( 2, 0 );2286 array->set( 2, 0 );
2263 2287
2264 // TODO: reference count?2288 // TODO: reference count?
2265 array->add_ref();2289 array->add_ref();
2266 RETURN->v_object = array;2290 RETURN->v_object = array;
2267 2291
2268 if( hi_good == FALSE )2292 if( hi_good == FALSE )
2269 return;2293 return;
2270 2294
2271 if( !hi )2295 if( !hi )
2272 {2296 {
2273 hi = new HidIn;2297 hi = new HidIn;
@@ -2277,14 +2301,14 @@ CK_DLL_SFUN( HidIn_read_tilt_sensor ) · 3 unmodified lines
2277 return;2301 return;
2278 }2302 }
2279 }2303 }
2280 2304
2281 HidMsg msg;2305 HidMsg msg;
2282 2306
2283 if( !hi->read( CK_HID_ACCELEROMETER, 0, &msg ) )2307 if( !hi->read( CK_HID_ACCELEROMETER, 0, &msg ) )
2284 {2308 {
2285 return;2309 return;
2286 }2310 }
2287 2311
2288 array->set( 0, msg.idata[0] );2312 array->set( 0, msg.idata[0] );
2289 array->set( 1, msg.idata[1] );2313 array->set( 1, msg.idata[1] );
2290 array->set( 2, msg.idata[2] );2314 array->set( 2, msg.idata[2] );
@@ -2301,16 +2325,16 @@ CK_DLL_SFUN( HidIn_ctrl_tiltPollRate ) · 10 unmodified lines
2301 return;2325 return;
2302 }2326 }
2303 t_CKFLOAT srate = SHRED->vm_ref->srate();2327 t_CKFLOAT srate = SHRED->vm_ref->srate();
2304 2328
2305 // get arg2329 // get arg
2306 t_CKDUR v = GET_NEXT_DUR( ARGS );2330 t_CKDUR v = GET_NEXT_DUR( ARGS );
2307 2331
2308 // get in microseconds2332 // get in microseconds
2309 t_CKINT usec = (t_CKINT)( v / srate * 1000000 );2333 t_CKINT usec = (t_CKINT)( v / srate * 1000000 );
2310 2334
2311 // make sure it's nonnegative2335 // make sure it's nonnegative
2312 if( usec < 0 ) usec = 0;2336 if( usec < 0 ) usec = 0;
2313 2337
2314 // go2338 // go
2315 RETURN->v_dur = TiltSensor_setPollRate( usec ) * srate / 1000000;2339 RETURN->v_dur = TiltSensor_setPollRate( usec ) * srate / 1000000;
2316}2340}
@@ -2326,7 +2350,7 @@ CK_DLL_SFUN( HidIn_cget_tiltPollRate ) · 9 unmodified lines
2326 return;2350 return;
2327 }2351 }
2328 t_CKFLOAT srate = SHRED->vm_ref->srate();2352 t_CKFLOAT srate = SHRED->vm_ref->srate();
2329 2353
2330 RETURN->v_dur = TiltSensor_getPollRate() * srate / 1000000;2354 RETURN->v_dur = TiltSensor_getPollRate() * srate / 1000000;
2331}2355}
2332 2356
@@ -2617,18 +2641,18 @@ CK_DLL_MFUN(serialio_canWait); · 284 unmodified lines
2617void * Chuck_IO_Serial::shell_read_cb( void *_this )2641void * Chuck_IO_Serial::shell_read_cb( void *_this )
2618{2642{
2619 Chuck_IO_Serial *cereal = (Chuck_IO_Serial *) _this;2643 Chuck_IO_Serial *cereal = (Chuck_IO_Serial *) _this;
2620 2644
2621 cereal->read_cb();2645 cereal->read_cb();
2622 2646
2623 return NULL;2647 return NULL;
2624}2648}
2625 2649
2626void * Chuck_IO_Serial::shell_write_cb( void *_this )2650void * Chuck_IO_Serial::shell_write_cb( void *_this )
2627{2651{
2628 Chuck_IO_Serial *cereal = (Chuck_IO_Serial *) _this;2652 Chuck_IO_Serial *cereal = (Chuck_IO_Serial *) _this;
2629 2653
2630 cereal->write_cb();2654 cereal->write_cb();
2631 2655
2632 return NULL;2656 return NULL;
2633}2657}
2634 2658
@@ -2651,24 +2675,24 @@ m_writeBuffer(1024) · 16 unmodified lines
2651{2675{
2652 m_fd = -1;2676 m_fd = -1;
2653 m_cfd = NULL;2677 m_cfd = NULL;
2654 2678
2655 m_io_buf_max = CHUCK_IO_DEFAULT_BUFSIZE;2679 m_io_buf_max = CHUCK_IO_DEFAULT_BUFSIZE;
2656 m_io_buf = new unsigned char[m_io_buf_max];2680 m_io_buf = new unsigned char[m_io_buf_max];
2657 m_io_buf_pos = m_io_buf_available = 0;2681 m_io_buf_pos = m_io_buf_available = 0;
2658 2682
2659 m_tmp_buf_max = CHUCK_IO_DEFAULT_BUFSIZE;2683 m_tmp_buf_max = CHUCK_IO_DEFAULT_BUFSIZE;
2660 m_tmp_buf = new unsigned char[m_tmp_buf_max];2684 m_tmp_buf = new unsigned char[m_tmp_buf_max];
2661 2685
2662 m_read_thread = NULL;2686 m_read_thread = NULL;
2663 m_event_buffer = NULL;2687 m_event_buffer = NULL;
2664 2688
2665 m_write_thread = NULL;2689 m_write_thread = NULL;
2666 m_do_write_thread = TRUE;2690 m_do_write_thread = TRUE;
2667 2691
2668 m_do_exit = FALSE;2692 m_do_exit = FALSE;
2669 2693
2670 s_serials.push_back(this);2694 s_serials.push_back(this);
2671 2695
2672 m_vmRef = vm;2696 m_vmRef = vm;
2673}2697}
2674 2698
@@ -2679,16 +2703,16 @@ Chuck_IO_Serial::~Chuck_IO_Serial() · 4 unmodified lines
2679 SAFE_DELETE(m_read_thread);2703 SAFE_DELETE(m_read_thread);
2680 if( m_event_buffer )2704 if( m_event_buffer )
2681 m_vmRef->destroy_event_buffer( m_event_buffer );2705 m_vmRef->destroy_event_buffer( m_event_buffer );
2682 2706
2683 close();2707 close();
2684 2708
2685 SAFE_DELETE(m_io_buf);2709 SAFE_DELETE(m_io_buf);
2686 m_io_buf_max = 0;2710 m_io_buf_max = 0;
2687 m_io_buf_pos = m_io_buf_available = 0;2711 m_io_buf_pos = m_io_buf_available = 0;
2688 2712
2689 SAFE_DELETE(m_tmp_buf);2713 SAFE_DELETE(m_tmp_buf);
2690 m_tmp_buf_max = 0;2714 m_tmp_buf_max = 0;
2691 2715
2692 s_serials.remove(this);2716 s_serials.remove(this);
2693}2717}
2694 2718
@@ -2699,9 +2723,9 @@ t_CKBOOL Chuck_IO_Serial::ready() · 4 unmodified lines
2699 pollfds.fd = m_fd;2723 pollfds.fd = m_fd;
2700 pollfds.events = POLLIN;2724 pollfds.events = POLLIN;
2701 pollfds.revents = 0;2725 pollfds.revents = 0;
2702 2726
2703 int result = poll(&pollfds, 1, 0);2727 int result = poll(&pollfds, 1, 0);
2704 2728
2705 if( result > 0 && (pollfds.revents & POLLIN) ) return TRUE;2729 if( result > 0 && (pollfds.revents & POLLIN) ) return TRUE;
2706 else return FALSE; // TODO: error handling2730 else return FALSE; // TODO: error handling
2707#else2731#else
@@ -2712,11 +2736,11 @@ t_CKBOOL Chuck_IO_Serial::ready() · 4 unmodified lines
2712t_CKBOOL Chuck_IO_Serial::open( const t_CKUINT i, t_CKINT flags, t_CKUINT baud )2736t_CKBOOL Chuck_IO_Serial::open( const t_CKUINT i, t_CKINT flags, t_CKUINT baud )
2713{2737{
2714 vector<string> ports = SerialIOManager::availableSerialDevices();2738 vector<string> ports = SerialIOManager::availableSerialDevices();
2715 2739
2716 if( i < ports.size() )2740 if( i < ports.size() )
2717 {2741 {
2718 const string &path = ports[i];2742 const string &path = ports[i];
2719 2743
2720 open(path, flags, baud);2744 open(path, flags, baud);
2721 }2745 }
2722 else2746 else
@@ -2724,47 +2748,47 @@ t_CKBOOL Chuck_IO_Serial::open( const t_CKUINT i, t_CKINT flags, t_CKUINT baud ) · 1 unmodified line
2724 EM_log(CK_LOG_WARNING, "(Serial.open): error: invalid port number");2748 EM_log(CK_LOG_WARNING, "(Serial.open): error: invalid port number");
2725 return FALSE;2749 return FALSE;
2726 }2750 }
2727 2751
2728 return TRUE;2752 return TRUE;
2729}2753}
2730 2754
2731 2755
2732t_CKBOOL Chuck_IO_Serial::open( const std::string & path, t_CKINT flags, t_CKUINT baud )2756t_CKBOOL Chuck_IO_Serial::open( const std::string & path, t_CKINT flags, t_CKUINT baud )
2733{2757{
2734 if( flags & Chuck_IO_File::TYPE_BINARY )2758 if( flags & Chuck_IO::TYPE_BINARY )
2735 {2759 {
2736 m_flags = Chuck_IO_File::TYPE_BINARY;2760 m_flags = Chuck_IO::TYPE_BINARY;
2737 }2761 }
2738 else if( flags & Chuck_IO_File::TYPE_ASCII )2762 else if( flags & Chuck_IO::TYPE_ASCII )
2739 {2763 {
2740 m_flags = Chuck_IO_File::TYPE_ASCII;2764 m_flags = Chuck_IO::TYPE_ASCII;
2741 }2765 }
2742 else2766 else
2743 {2767 {
2744 EM_log(CK_LOG_WARNING, "(Serial.open): warning: invalid binary/ASCII flag requested, defaulting to ASCII");2768 EM_log(CK_LOG_WARNING, "(Serial.open): warning: invalid binary/ASCII flag requested, defaulting to ASCII");
2745 m_flags = Chuck_IO_File::TYPE_ASCII;2769 m_flags = Chuck_IO::TYPE_ASCII;
2746 }2770 }
2747 2771
2748 int fd = ::open( path.c_str(), O_RDWR );2772 int fd = ::open( path.c_str(), O_RDWR );
2749 if( fd < 0 )2773 if( fd < 0 )
2750 {2774 {
2751 EM_log(CK_LOG_WARNING, "(Serial.open): error: unable to open file at '%s'", path.c_str());2775 EM_log(CK_LOG_WARNING, "(Serial.open): error: unable to open file at '%s'", path.c_str());
2752 return FALSE;2776 return FALSE;
2753 }2777 }
2754 2778
2755 m_fd = fd;2779 m_fd = fd;
2756 m_path = path;2780 m_path = path;
2757 2781
2758 // set default baud rate2782 // set default baud rate
2759 setBaudRate(baud);2783 setBaudRate(baud);
2760 2784
2761 m_cfd = fdopen(fd, "a+");2785 m_cfd = fdopen(fd, "a+");
2762 m_iomode = MODE_ASYNC;2786 m_iomode = MODE_ASYNC;
2763#ifndef WIN322787#ifndef WIN32
2764 fcntl(m_fd, F_SETFL, O_NONBLOCK);2788 fcntl(m_fd, F_SETFL, O_NONBLOCK);
2765#endif2789#endif
2766 m_eof = FALSE;2790 m_eof = FALSE;
2767 2791
2768 return TRUE;2792 return TRUE;
2769}2793}
2770 2794
@@ -2795,7 +2819,7 @@ void Chuck_IO_Serial::close() · 24 unmodified lines
2795void Chuck_IO_Serial::close_int()2819void Chuck_IO_Serial::close_int()
2796{2820{
2797 EM_log(CK_LOG_INFO, "(Serial.close): closing serial device '%s'", m_path.c_str());2821 EM_log(CK_LOG_INFO, "(Serial.close): closing serial device '%s'", m_path.c_str());
2798 2822
2799 if(good())2823 if(good())
2800 {2824 {
2801 if(m_cfd)2825 if(m_cfd)
@@ -2844,23 +2868,23 @@ t_CKINT Chuck_IO_Serial::readInt( t_CKINT flags ) · 42 unmodified lines
2844 EM_log(CK_LOG_WARNING, "(Serial.readInt): warning: file not open");2868 EM_log(CK_LOG_WARNING, "(Serial.readInt): warning: file not open");
2845 return 0;2869 return 0;
2846 }2870 }
2847 2871
2848 if( m_iomode == MODE_ASYNC )2872 if( m_iomode == MODE_ASYNC )
2849 {2873 {
2850 EM_log(CK_LOG_WARNING, "(Serial.readInt): warning: calling synchronous read function on asynchronous file");2874 EM_log(CK_LOG_WARNING, "(Serial.readInt): warning: calling synchronous read function on asynchronous file");
2851 return 0;2875 return 0;
2852 }2876 }
2853 2877
2854 long i = 0; // 1.4.1.1 (ge) changed from t_CKUINT; to clear warning for fscanf using %li2878 long i = 0; // 1.4.1.1 (ge) changed from t_CKUINT; to clear warning for fscanf using %li
2855 2879
2856 if( m_flags & Chuck_IO_File::TYPE_BINARY )2880 if( m_flags & Chuck_IO::TYPE_BINARY )
2857 {2881 {
2858 if( flags & INT8 )2882 if( flags & INT8 )
2859 {2883 {
2860 uint8_t byte = 0;2884 uint8_t byte = 0;
2861 if(!fread(&byte, 1, 1, m_cfd))2885 if(!fread(&byte, 1, 1, m_cfd))
2862 EM_log(CK_LOG_WARNING, "(Serial.readInt): error: read failed");2886 EM_log(CK_LOG_WARNING, "(Serial.readInt): error: read failed");
2863 2887
2864 i = byte;2888 i = byte;
2865 }2889 }
2866 else if( flags & INT16 )2890 else if( flags & INT16 )
@@ -2868,7 +2892,7 @@ t_CKINT Chuck_IO_Serial::readInt( t_CKINT flags ) · 1 unmodified line
2868 uint16_t word = 0;2892 uint16_t word = 0;
2869 if(!fread(&word, 2, 1, m_cfd))2893 if(!fread(&word, 2, 1, m_cfd))
2870 EM_log(CK_LOG_WARNING, "(Serial.readInt): error: read failed");2894 EM_log(CK_LOG_WARNING, "(Serial.readInt): error: read failed");
2871 2895
2872 i = word;2896 i = word;
2873 }2897 }
2874 else if( flags & INT32 )2898 else if( flags & INT32 )
@@ -2876,7 +2900,7 @@ t_CKINT Chuck_IO_Serial::readInt( t_CKINT flags ) · 1 unmodified line
2876 uint32_t dword = 0;2900 uint32_t dword = 0;
2877 if(!fread(&dword, 4, 1, m_cfd))2901 if(!fread(&dword, 4, 1, m_cfd))
2878 EM_log(CK_LOG_WARNING, "(Serial.readInt): error: read failed");2902 EM_log(CK_LOG_WARNING, "(Serial.readInt): error: read failed");
2879 2903
2880 i = dword;2904 i = dword;
2881 }2905 }
2882 }2906 }
@@ -2885,7 +2909,7 @@ t_CKINT Chuck_IO_Serial::readInt( t_CKINT flags ) · 2 unmodified lines
2885 if(!fscanf(m_cfd, "%li", &i))2909 if(!fscanf(m_cfd, "%li", &i))
2886 EM_log(CK_LOG_WARNING, "(Serial.readInt): error: read failed");2910 EM_log(CK_LOG_WARNING, "(Serial.readInt): error: read failed");
2887 }2911 }
2888 2912
2889 return i;2913 return i;
2890}2914}
2891 2915
@@ -2896,16 +2920,16 @@ t_CKFLOAT Chuck_IO_Serial::readFloat() · 4 unmodified lines
2896 EM_log(CK_LOG_WARNING, "(Serial.readFloat): warning: file not open");2920 EM_log(CK_LOG_WARNING, "(Serial.readFloat): warning: file not open");
2897 return 0;2921 return 0;
2898 }2922 }
2899 2923
2900 if( m_iomode == MODE_ASYNC )2924 if( m_iomode == MODE_ASYNC )
2901 {2925 {
2902 EM_log(CK_LOG_WARNING, "(Serial.readFloat): warning: calling synchronous read function on asynchronous file");2926 EM_log(CK_LOG_WARNING, "(Serial.readFloat): warning: calling synchronous read function on asynchronous file");
2903 return 0;2927 return 0;
2904 }2928 }
2905 2929
2906 t_CKFLOAT f = 0;2930 t_CKFLOAT f = 0;
2907 2931
2908 if( m_flags & Chuck_IO_File::TYPE_BINARY )2932 if( m_flags & Chuck_IO::TYPE_BINARY )
2909 {2933 {
2910 if(!fread(&f, 4, 1, m_cfd))2934 if(!fread(&f, 4, 1, m_cfd))
2911 EM_log(CK_LOG_WARNING, "(Serial.readFloat): error: read failed");2935 EM_log(CK_LOG_WARNING, "(Serial.readFloat): error: read failed");
@@ -2915,7 +2939,7 @@ t_CKFLOAT Chuck_IO_Serial::readFloat() · 3 unmodified lines
2915 if(!fscanf(m_cfd, "%lf", &f))2939 if(!fscanf(m_cfd, "%lf", &f))
2916 EM_log(CK_LOG_WARNING, "(Serial.readFloat): error: read failed");2940 EM_log(CK_LOG_WARNING, "(Serial.readFloat): error: read failed");
2917 }2941 }
2918 2942
2919 return f;2943 return f;
2920}2944}
2921 2945
@@ -2926,27 +2950,27 @@ t_CKBOOL Chuck_IO_Serial::readString( std::string & str ) · 4 unmodified lines
2926 EM_log(CK_LOG_WARNING, "(Serial.readString): warning: file not open");2950 EM_log(CK_LOG_WARNING, "(Serial.readString): warning: file not open");
2927 return FALSE;2951 return FALSE;
2928 }2952 }
2929 2953
2930 if( m_iomode == MODE_ASYNC )2954 if( m_iomode == MODE_ASYNC )
2931 {2955 {
2932 EM_log(CK_LOG_WARNING, "(Serial.readString): warning: calling synchronous read function on asynchronous file");2956 EM_log(CK_LOG_WARNING, "(Serial.readString): warning: calling synchronous read function on asynchronous file");
2933 return FALSE;2957 return FALSE;
2934 }2958 }
2935 2959
2936 if( m_flags & Chuck_IO_File::TYPE_BINARY )2960 if( m_flags & Chuck_IO::TYPE_BINARY )
2937 {2961 {
2938 EM_log(CK_LOG_WARNING, "(Serial.readString): warning: cannot read string from binary file");2962 EM_log(CK_LOG_WARNING, "(Serial.readString): warning: cannot read string from binary file");
2939 return FALSE;2963 return FALSE;
2940 }2964 }
2941 2965
2942 if(!fscanf(m_cfd, CHUCK_IO_SCANF_STRING, &m_tmp_buf))2966 if(!fscanf(m_cfd, CHUCK_IO_SCANF_STRING, &m_tmp_buf))
2943 {2967 {
2944 EM_log(CK_LOG_WARNING, "(Serial.readFloat): error: read failed");2968 EM_log(CK_LOG_WARNING, "(Serial.readFloat): error: read failed");
2945 return FALSE;2969 return FALSE;
2946 }2970 }
2947 2971
2948 str = (char *) m_tmp_buf;2972 str = (char *) m_tmp_buf;
2949 2973
2950 return TRUE;2974 return TRUE;
2951}2975}
2952 2976
@@ -2958,31 +2982,30 @@ Chuck_String * Chuck_IO_Serial::readLine() · 5 unmodified lines
2958 EM_log(CK_LOG_WARNING, "(Serial.readLine): warning: file not open");2982 EM_log(CK_LOG_WARNING, "(Serial.readLine): warning: file not open");
2959 return NULL;2983 return NULL;
2960 }2984 }
2961 2985
2962 if( m_iomode == MODE_ASYNC )2986 if( m_iomode == MODE_ASYNC )
2963 {2987 {
2964 EM_log(CK_LOG_WARNING, "(Serial.readLine): warning: calling synchronous read function on asynchronous file");2988 EM_log(CK_LOG_WARNING, "(Serial.readLine): warning: calling synchronous read function on asynchronous file");
2965 return NULL;2989 return NULL;
2966 }2990 }
2967 2991
2968 if( m_flags & Chuck_IO_File::TYPE_BINARY )2992 if( m_flags & Chuck_IO::TYPE_BINARY )
2969 {2993 {
2970 EM_log(CK_LOG_WARNING, "(Serial.readLine): warning: cannot read line from binary file");2994 EM_log(CK_LOG_WARNING, "(Serial.readLine): warning: cannot read line from binary file");
2971 return NULL;2995 return NULL;
2972 }2996 }
2973 2997
2974 2998 if(!fgets((char *)m_tmp_buf, (int)m_tmp_buf_max, m_cfd))
2975 if(!fgets((char *)m_tmp_buf, m_tmp_buf_max, m_cfd))
2976 {2999 {
2977 EM_log(CK_LOG_WARNING, "(Serial.readLine): error: from fgets");3000 EM_log(CK_LOG_WARNING, "(Serial.readLine): error: from fgets");
2978 return NULL;3001 return NULL;
2979 }3002 }
2980 3003
2981 Chuck_String * str = new Chuck_String;3004 Chuck_String * str = new Chuck_String;
2982 initialize_object(str, m_vmRef->env()->t_string);3005 initialize_object(str, m_vmRef->env()->t_string);
2983 3006
2984 str->set( string((char *)m_tmp_buf) );3007 str->set( string((char *)m_tmp_buf) );
2985 3008
2986 return str;3009 return str;
2987}3010}
2988 3011
@@ -2994,7 +3017,7 @@ t_CKBOOL Chuck_IO_Serial::eof() · 5 unmodified lines
2994 EM_log(CK_LOG_WARNING, "(Serial.eof): warning: file not open");3017 EM_log(CK_LOG_WARNING, "(Serial.eof): warning: file not open");
2995 return FALSE;3018 return FALSE;
2996 }3019 }
2997 3020
2998 if( MODE_SYNC )3021 if( MODE_SYNC )
2999 return (m_eof = feof( m_cfd ));3022 return (m_eof = feof( m_cfd ));
3000 else3023 else
@@ -3010,22 +3033,22 @@ void Chuck_IO_Serial::write( const std::string & val ) · 9 unmodified lines
3010 EM_log(CK_LOG_WARNING, "(Serial.write): warning: file not open");3033 EM_log(CK_LOG_WARNING, "(Serial.write): warning: file not open");
3011 return;3034 return;
3012 }3035 }
3013 3036
3014 if( m_iomode == MODE_ASYNC )3037 if( m_iomode == MODE_ASYNC )
3015 {3038 {
3016 start_read_thread();3039 start_read_thread();
3017 3040
3018 t_CKUINT len = val.length();3041 t_CKUINT len = val.length();
3019 for(t_CKUINT i = 0; i < len; i++)3042 for(t_CKUINT i = 0; i < len; i++)
3020 // TODO: efficiency3043 // TODO: efficiency
3021 m_writeBuffer.put(val[i]);3044 m_writeBuffer.put(val[i]);
3022 3045
3023 Request r;3046 Request r;
3024 r.m_type = TYPE_WRITE;3047 r.m_type = TYPE_WRITE;
3025 r.m_val = 0;3048 r.m_val = 0;
3026 r.m_num = 0;3049 r.m_num = 0;
3027 r.m_status = Request::RQ_STATUS_PENDING;3050 r.m_status = Request::RQ_STATUS_PENDING;
3028 3051
3029 m_asyncWriteRequests.put(r);3052 m_asyncWriteRequests.put(r);
3030 }3053 }
3031 else if( m_iomode == MODE_SYNC )3054 else if( m_iomode == MODE_SYNC )
@@ -3048,18 +3071,18 @@ void Chuck_IO_Serial::write( t_CKINT val, t_CKINT size ) · 16 unmodified lines
3048 EM_log(CK_LOG_WARNING, "(Serial.write): warning: file not open");3071 EM_log(CK_LOG_WARNING, "(Serial.write): warning: file not open");
3049 return;3072 return;
3050 }3073 }
3051 3074
3052 if(!(size == 1 || size == 2 || size == 4 || size == 8))3075 if(!(size == 1 || size == 2 || size == 4 || size == 8))
3053 {3076 {
3054 EM_log(CK_LOG_WARNING, "(Serial.write): warning: invalid int size %li, ignoring write request", size);3077 EM_log(CK_LOG_WARNING, "(Serial.write): warning: invalid int size %li, ignoring write request", size);
3055 return;3078 return;
3056 }3079 }
3057 3080
3058 if( m_iomode == MODE_ASYNC )3081 if( m_iomode == MODE_ASYNC )
3059 {3082 {
3060 start_read_thread();3083 start_read_thread();
3061 3084
3062 if( m_flags & Chuck_IO_File::TYPE_ASCII )3085 if( m_flags & Chuck_IO::TYPE_ASCII )
3063 {3086 {
3064 // TODO: don't use m_tmp_buf (thread safety?)3087 // TODO: don't use m_tmp_buf (thread safety?)
3065#ifdef WIN323088#ifdef WIN32
@@ -3067,40 +3090,40 @@ void Chuck_IO_Serial::write( t_CKINT val, t_CKINT size ) · 1 unmodified line
3067 m_tmp_buf[m_tmp_buf_max - 1] = '\0'; // force NULL terminator -- see http://www.di-mgt.com.au/cprog.html#snprintf3090 m_tmp_buf[m_tmp_buf_max - 1] = '\0'; // force NULL terminator -- see http://www.di-mgt.com.au/cprog.html#snprintf
3068#else3091#else
3069 snprintf((char *)m_tmp_buf, m_tmp_buf_max, "%li", val);3092 snprintf((char *)m_tmp_buf, m_tmp_buf_max, "%li", val);
3070#endif 3093#endif
3071 t_CKUINT len = strlen((char *)m_tmp_buf);3094 t_CKUINT len = strlen((char *)m_tmp_buf);
3072 for(t_CKUINT i = 0; i < len; i++)3095 for(t_CKUINT i = 0; i < len; i++)
3073 // TODO: efficiency3096 // TODO: efficiency
3074 m_writeBuffer.put(m_tmp_buf[i]);3097 m_writeBuffer.put(m_tmp_buf[i]);
3075 3098
3076 Request r;3099 Request r;
3077 r.m_type = TYPE_WRITE;3100 r.m_type = TYPE_WRITE;
3078 r.m_val = 0;3101 r.m_val = 0;
3079 r.m_num = 0;3102 r.m_num = 0;
3080 r.m_status = Request::RQ_STATUS_PENDING;3103 r.m_status = Request::RQ_STATUS_PENDING;
3081 3104
3082 m_asyncWriteRequests.put(r);3105 m_asyncWriteRequests.put(r);
3083 }3106 }
3084 else3107 else
3085 {3108 {
3086 char * buf = (char *)&val;3109 char * buf = (char *)&val;
3087 3110
3088 // assume 4-byte int3111 // assume 4-byte int
3089 for(int i = 0; i < size; i++)3112 for(int i = 0; i < size; i++)
3090 m_writeBuffer.put(buf[i]);3113 m_writeBuffer.put(buf[i]);
3091 3114
3092 Request r;3115 Request r;
3093 r.m_type = TYPE_WRITE;3116 r.m_type = TYPE_WRITE;
3094 r.m_val = 0;3117 r.m_val = 0;
3095 r.m_num = 0;3118 r.m_num = 0;
3096 r.m_status = Request::RQ_STATUS_PENDING;3119 r.m_status = Request::RQ_STATUS_PENDING;
3097 3120
3098 m_asyncWriteRequests.put(r);3121 m_asyncWriteRequests.put(r);
3099 }3122 }
3100 }3123 }
3101 else if( m_iomode == MODE_SYNC )3124 else if( m_iomode == MODE_SYNC )
3102 {3125 {
3103 if( m_flags & Chuck_IO_File::TYPE_ASCII )3126 if( m_flags & Chuck_IO::TYPE_ASCII )
3104 {3127 {
3105 fprintf( m_cfd, "%li", (long)val );3128 fprintf( m_cfd, "%li", (long)val );
3106 }3129 }
@@ -3120,53 +3143,53 @@ void Chuck_IO_Serial::write( t_CKFLOAT val ) · 13 unmodified lines
3120 EM_log(CK_LOG_WARNING, "(Serial.write): warning: file not open");3143 EM_log(CK_LOG_WARNING, "(Serial.write): warning: file not open");
3121 return;3144 return;
3122 }3145 }
3123 3146
3124 if( m_iomode == MODE_ASYNC )3147 if( m_iomode == MODE_ASYNC )
3125 {3148 {
3126 start_read_thread();3149 start_read_thread();
3127 3150
3128 if( m_flags & Chuck_IO_File::TYPE_ASCII )3151 if( m_flags & Chuck_IO::TYPE_ASCII )
3129 {3152 {
3130#ifdef WIN323153#ifdef WIN32
3131 _snprintf((char *)m_tmp_buf, m_tmp_buf_max, "%f", val);3154 _snprintf((char *)m_tmp_buf, m_tmp_buf_max, "%f", val);
3132 m_tmp_buf[m_tmp_buf_max - 1] = '\0'; // force NULL terminator -- see http://www.di-mgt.com.au/cprog.html#snprintf3155 m_tmp_buf[m_tmp_buf_max - 1] = '\0'; // force NULL terminator -- see http://www.di-mgt.com.au/cprog.html#snprintf
3133#else3156#else
3134 snprintf((char *)m_tmp_buf, m_tmp_buf_max, "%f", val);3157 snprintf((char *)m_tmp_buf, m_tmp_buf_max, "%f", val);
3135#endif 3158#endif
3136 3159
3137 t_CKUINT len = strlen((char *)m_tmp_buf);3160 t_CKUINT len = strlen((char *)m_tmp_buf);
3138 for(t_CKUINT i = 0; i < len; i++)3161 for(t_CKUINT i = 0; i < len; i++)
3139 // TODO: efficiency3162 // TODO: efficiency
3140 m_writeBuffer.put(m_tmp_buf[i]);3163 m_writeBuffer.put(m_tmp_buf[i]);
3141 3164
3142 Request r;3165 Request r;
3143 r.m_type = TYPE_WRITE;3166 r.m_type = TYPE_WRITE;
3144 r.m_val = 0;3167 r.m_val = 0;
3145 r.m_num = 0;3168 r.m_num = 0;
3146 r.m_status = Request::RQ_STATUS_PENDING;3169 r.m_status = Request::RQ_STATUS_PENDING;
3147 3170
3148 m_asyncWriteRequests.put(r);3171 m_asyncWriteRequests.put(r);
3149 }3172 }
3150 else3173 else
3151 {3174 {
3152 char * buf = (char *) &val;3175 char * buf = (char *) &val;
3153 3176
3154 // assume 4-byte float3177 // assume 4-byte float
3155 for(int i = 0; i < 4; i++)3178 for(int i = 0; i < 4; i++)
3156 m_writeBuffer.put(buf[i]);3179 m_writeBuffer.put(buf[i]);
3157 3180
3158 Request r;3181 Request r;
3159 r.m_type = TYPE_WRITE;3182 r.m_type = TYPE_WRITE;
3160 r.m_val = 0;3183 r.m_val = 0;
3161 r.m_num = 0;3184 r.m_num = 0;
3162 r.m_status = Request::RQ_STATUS_PENDING;3185 r.m_status = Request::RQ_STATUS_PENDING;
3163 3186
3164 m_asyncWriteRequests.put(r);3187 m_asyncWriteRequests.put(r);
3165 }3188 }
3166 }3189 }
3167 else if( m_iomode == MODE_SYNC )3190 else if( m_iomode == MODE_SYNC )
3168 {3191 {
3169 if( m_flags & Chuck_IO_File::TYPE_ASCII )3192 if( m_flags & Chuck_IO::TYPE_ASCII )
3170 {3193 {
3171 fprintf( m_cfd, "%f", val );3194 fprintf( m_cfd, "%f", val );
3172 }3195 }
@@ -3187,12 +3210,12 @@ void Chuck_IO_Serial::writeBytes( Chuck_Array4 * arr ) · 14 unmodified lines
3187 EM_log(CK_LOG_WARNING, "(Serial.writeBytes): warning: file not open");3210 EM_log(CK_LOG_WARNING, "(Serial.writeBytes): warning: file not open");
3188 return;3211 return;
3189 }3212 }
3190 3213
3191 if( m_iomode == MODE_ASYNC )3214 if( m_iomode == MODE_ASYNC )
3192 {3215 {
3193 start_read_thread();3216 start_read_thread();
3194 3217
3195 int len = arr->size();3218 t_CKINT len = arr->size();
3196 for(int i = 0; i < len; i++)3219 for(int i = 0; i < len; i++)
3197 {3220 {
3198 // TODO: efficiency3221 // TODO: efficiency
@@ -3200,18 +3223,18 @@ void Chuck_IO_Serial::writeBytes( Chuck_Array4 * arr ) · 1 unmodified line
3200 arr->get(i, &byte);3223 arr->get(i, &byte);
3201 m_writeBuffer.put((char) byte);3224 m_writeBuffer.put((char) byte);
3202 }3225 }
3203 3226
3204 Request r;3227 Request r;
3205 r.m_type = TYPE_WRITE;3228 r.m_type = TYPE_WRITE;
3206 r.m_val = 0;3229 r.m_val = 0;
3207 r.m_num = 0;3230 r.m_num = 0;
3208 r.m_status = Request::RQ_STATUS_PENDING;3231 r.m_status = Request::RQ_STATUS_PENDING;
3209 3232
3210 m_asyncWriteRequests.put(r);3233 m_asyncWriteRequests.put(r);
3211 }3234 }
3212 else if( m_iomode == MODE_SYNC )3235 else if( m_iomode == MODE_SYNC )
3213 {3236 {
3214 int len = arr->size();3237 t_CKINT len = arr->size();
3215 for(int i = 0; i < len; i++)3238 for(int i = 0; i < len; i++)
3216 {3239 {
3217 // TODO: efficiency3240 // TODO: efficiency
@@ -3231,7 +3254,7 @@ void Chuck_IO_Serial::start_read_thread() · 13 unmodified lines
3231 m_read_thread->start((unsigned int (__stdcall *)(void*))shell_read_cb, this);3254 m_read_thread->start((unsigned int (__stdcall *)(void*))shell_read_cb, this);
3232#else3255#else
3233 m_read_thread->start(shell_read_cb, this);3256 m_read_thread->start(shell_read_cb, this);
3234#endif 3257#endif
3235 assert(m_event_buffer == NULL);3258 assert(m_event_buffer == NULL);
3236 m_event_buffer = m_vmRef->create_event_buffer();3259 m_event_buffer = m_vmRef->create_event_buffer();
3237 }3260 }
@@ -3245,15 +3268,15 @@ t_CKBOOL Chuck_IO_Serial::readAsync( t_CKUINT type, t_CKUINT num ) · 7 unmodified lines
3245 EM_log(CK_LOG_WARNING, "(Serial.readAsync): warning: file not open");3268 EM_log(CK_LOG_WARNING, "(Serial.readAsync): warning: file not open");
3246 return FALSE;3269 return FALSE;
3247 }3270 }
3248 3271
3249 start_read_thread();3272 start_read_thread();
3250 3273
3251 Request read;3274 Request read;
3252 read.m_type = type;3275 read.m_type = type;
3253 read.m_num = num;3276 read.m_num = num;
3254 read.m_val = 0;3277 read.m_val = 0;
3255 read.m_status = Request::RQ_STATUS_PENDING;3278 read.m_status = Request::RQ_STATUS_PENDING;
3256 3279
3257 if(!m_asyncRequests.atMaximum() )3280 if(!m_asyncRequests.atMaximum() )
3258 {3281 {
3259 m_asyncRequests.put(read);3282 m_asyncRequests.put(read);
@@ -3263,7 +3286,7 @@ t_CKBOOL Chuck_IO_Serial::readAsync( t_CKUINT type, t_CKUINT num ) · 3 unmodified lines
3263 EM_log(CK_LOG_SEVERE, "(SerialIO.readAsync): warning: request buffer overflow, dropping read");3286 EM_log(CK_LOG_SEVERE, "(SerialIO.readAsync): warning: request buffer overflow, dropping read");
3264 return FALSE;3287 return FALSE;
3265 }3288 }
3266 3289
3267 return TRUE;3290 return TRUE;
3268}3291}
3269 3292
@@ -3274,18 +3297,18 @@ Chuck_String * Chuck_IO_Serial::getLine() · 4 unmodified lines
3274 EM_log(CK_LOG_WARNING, "(Serial.getLine): warning: file not open");3297 EM_log(CK_LOG_WARNING, "(Serial.getLine): warning: file not open");
3275 return NULL;3298 return NULL;
3276 }3299 }
3277 3300
3278 Request r;3301 Request r;
3279 3302
3280 Chuck_String * str = NULL;3303 Chuck_String * str = NULL;
3281 3304
3282 if(m_asyncResponses.peek(r, 1) &&3305 if(m_asyncResponses.peek(r, 1) &&
3283 r.m_type == TYPE_LINE && r.m_status == Request::RQ_STATUS_SUCCESS)3306 r.m_type == TYPE_LINE && r.m_status == Request::RQ_STATUS_SUCCESS)
3284 {3307 {
3285 str = (Chuck_String *) r.m_val;3308 str = (Chuck_String *) r.m_val;
3286 m_asyncResponses.get(r);3309 m_asyncResponses.get(r);
3287 }3310 }
3288 3311
3289 return str;3312 return str;
3290}3313}
3291 3314
@@ -3297,11 +3320,11 @@ t_CKINT Chuck_IO_Serial::getByte() · 5 unmodified lines
3297 EM_log(CK_LOG_WARNING, "(Serial.getByte): warning: file not open");3320 EM_log(CK_LOG_WARNING, "(Serial.getByte): warning: file not open");
3298 return 0;3321 return 0;
3299 }3322 }
3300 3323
3301 Request r;3324 Request r;
3302 3325
3303 t_CKINT i = 0;3326 t_CKINT i = 0;
3304 3327
3305 if(m_asyncResponses.peek(r, 1) &&3328 if(m_asyncResponses.peek(r, 1) &&
3306 r.m_type == TYPE_BYTE && r.m_num == 1 &&3329 r.m_type == TYPE_BYTE && r.m_num == 1 &&
3307 r.m_status == Request::RQ_STATUS_SUCCESS)3330 r.m_status == Request::RQ_STATUS_SUCCESS)
@@ -3309,7 +3332,7 @@ t_CKINT Chuck_IO_Serial::getByte() · 1 unmodified line
3309 i = (t_CKINT) r.m_val;3332 i = (t_CKINT) r.m_val;
3310 m_asyncResponses.get(r);3333 m_asyncResponses.get(r);
3311 }3334 }
3312 3335
3313 return i;3336 return i;
3314}3337}
3315 3338
@@ -3320,11 +3343,11 @@ Chuck_Array * Chuck_IO_Serial::getBytes() · 4 unmodified lines
3320 EM_log(CK_LOG_WARNING, "(Serial.getBytes): warning: file not open");3343 EM_log(CK_LOG_WARNING, "(Serial.getBytes): warning: file not open");
3321 return NULL;3344 return NULL;
3322 }3345 }
3323 3346
3324 Request r;3347 Request r;
3325 3348
3326 Chuck_Array * arr = NULL;3349 Chuck_Array * arr = NULL;
3327 3350
3328 if(m_asyncResponses.peek(r, 1) &&3351 if(m_asyncResponses.peek(r, 1) &&
3329 r.m_type == TYPE_BYTE && r.m_num > 1 &&3352 r.m_type == TYPE_BYTE && r.m_num > 1 &&
3330 r.m_status == Request::RQ_STATUS_SUCCESS)3353 r.m_status == Request::RQ_STATUS_SUCCESS)
@@ -3333,7 +3356,7 @@ Chuck_Array * Chuck_IO_Serial::getBytes() · 2 unmodified lines
3333 initialize_object(arr, m_vmRef->env()->t_array);3356 initialize_object(arr, m_vmRef->env()->t_array);
3334 m_asyncResponses.get(r);3357 m_asyncResponses.get(r);
3335 }3358 }
3336 3359
3337 return arr;3360 return arr;
3338}3361}
3339 3362
@@ -3346,9 +3369,9 @@ Chuck_Array * Chuck_IO_Serial::getInts() · 6 unmodified lines
3346 }3369 }
3347 3370
3348 Request r;3371 Request r;
3349 3372
3350 Chuck_Array * arr = NULL;3373 Chuck_Array * arr = NULL;
3351 3374
3352 if(m_asyncResponses.peek(r, 1) &&3375 if(m_asyncResponses.peek(r, 1) &&
3353 r.m_type == TYPE_INT && r.m_status == Request::RQ_STATUS_SUCCESS)3376 r.m_type == TYPE_INT && r.m_status == Request::RQ_STATUS_SUCCESS)
3354 {3377 {
@@ -3356,7 +3379,7 @@ Chuck_Array * Chuck_IO_Serial::getInts() · 1 unmodified line
3356 initialize_object(arr, m_vmRef->env()->t_array);3379 initialize_object(arr, m_vmRef->env()->t_array);
3357 m_asyncResponses.get(r);3380 m_asyncResponses.get(r);
3358 }3381 }
3359 3382
3360 return arr;3383 return arr;
3361}3384}
3362 3385
@@ -3369,9 +3392,9 @@ Chuck_Array * Chuck_IO_Serial::getFloats() · 6 unmodified lines
3369 }3392 }
3370 3393
3371 Request r;3394 Request r;
3372 3395
3373 Chuck_Array * arr = NULL;3396 Chuck_Array * arr = NULL;
3374 3397
3375 if(m_asyncResponses.peek(r, 1) &&3398 if(m_asyncResponses.peek(r, 1) &&
3376 r.m_type == TYPE_FLOAT && r.m_status == Request::RQ_STATUS_SUCCESS)3399 r.m_type == TYPE_FLOAT && r.m_status == Request::RQ_STATUS_SUCCESS)
3377 {3400 {
@@ -3379,7 +3402,7 @@ Chuck_Array * Chuck_IO_Serial::getFloats() · 1 unmodified line
3379 initialize_object(arr, m_vmRef->env()->t_array);3402 initialize_object(arr, m_vmRef->env()->t_array);
3380 m_asyncResponses.get(r);3403 m_asyncResponses.get(r);
3381 }3404 }
3382 3405
3383 return arr;3406 return arr;
3384}3407}
3385 3408
@@ -3390,35 +3413,35 @@ Chuck_String * Chuck_IO_Serial::getString() · 4 unmodified lines
3390 EM_log(CK_LOG_WARNING, "(Serial.getString): warning: file not open");3413 EM_log(CK_LOG_WARNING, "(Serial.getString): warning: file not open");
3391 return NULL;3414 return NULL;
3392 }3415 }
3393 3416
3394 Request r;3417 Request r;
3395 3418
3396 Chuck_String * str = NULL;3419 Chuck_String * str = NULL;
3397 3420
3398 if(m_asyncResponses.peek(r, 1) &&3421 if(m_asyncResponses.peek(r, 1) &&
3399 r.m_type == TYPE_STRING && r.m_status == Request::RQ_STATUS_SUCCESS)3422 r.m_type == TYPE_STRING && r.m_status == Request::RQ_STATUS_SUCCESS)
3400 {3423 {
3401 str = (Chuck_String *) r.m_val;3424 str = (Chuck_String *) r.m_val;
3402 m_asyncResponses.get(r);3425 m_asyncResponses.get(r);
3403 }3426 }
3404 3427
3405 return str;3428 return str;
3406}3429}
3407 3430
3408 3431
3409t_CKBOOL Chuck_IO_Serial::get_buffer(t_CKINT timeout_ms)3432t_CKBOOL Chuck_IO_Serial::get_buffer(t_CKINT timeout_ms)
3410{3433{
3411#ifndef WIN32 3434#ifndef WIN32
3412 fd_set fds;3435 fd_set fds;
3413 FD_ZERO(&fds);3436 FD_ZERO(&fds);
3414 FD_SET(m_fd, &fds);3437 FD_SET(m_fd, &fds);
3415 3438
3416 timeval tv;3439 timeval tv;
3417 tv.tv_sec = timeout_ms/1000;3440 tv.tv_sec = timeout_ms/1000;
3418 tv.tv_usec = 1000 * (timeout_ms%1000);3441 tv.tv_usec = 1000 * (timeout_ms%1000);
3419 3442
3420 int result = select(m_fd+1, &fds, NULL, NULL, &tv);3443 int result = select(m_fd+1, &fds, NULL, NULL, &tv);
3421 3444
3422 if(result > 0 && FD_ISSET(m_fd, &fds))3445 if(result > 0 && FD_ISSET(m_fd, &fds))
3423 {3446 {
3424 result = ::read(m_fd, m_io_buf, m_io_buf_max);3447 result = ::read(m_fd, m_io_buf, m_io_buf_max);
@@ -3426,9 +3449,9 @@ t_CKBOOL Chuck_IO_Serial::get_buffer(t_CKINT timeout_ms) · 1 unmodified line
3426 {3449 {
3427 m_io_buf_available = result;3450 m_io_buf_available = result;
3428 m_io_buf_pos = 0;3451 m_io_buf_pos = 0;
3429 3452
3430 EM_log(CK_LOG_FINE, "(SerialIO::get_buffer): read() returned %i bytes", result);3453 EM_log(CK_LOG_FINE, "(SerialIO::get_buffer): read() returned %i bytes", result);
3431 3454
3432 return TRUE;3455 return TRUE;
3433 }3456 }
3434 else3457 else
@@ -3440,9 +3463,9 @@ t_CKBOOL Chuck_IO_Serial::get_buffer(t_CKINT timeout_ms) · 5 unmodified lines
3440 {3463 {
3441 EM_log(CK_LOG_FINE, "(SerialIO::get_buffer): select() timeout");3464 EM_log(CK_LOG_FINE, "(SerialIO::get_buffer): select() timeout");
3442 }3465 }
3443 3466
3444 return FALSE;3467 return FALSE;
3445 3468
3446#else3469#else
3447 3470
3448 int result = ::read(m_fd, m_io_buf, m_io_buf_max);3471 int result = ::read(m_fd, m_io_buf, m_io_buf_max);
@@ -3450,7 +3473,7 @@ t_CKBOOL Chuck_IO_Serial::get_buffer(t_CKINT timeout_ms) · 1 unmodified line
3450 {3473 {
3451 m_io_buf_available = result;3474 m_io_buf_available = result;
3452 m_io_buf_pos = 0;3475 m_io_buf_pos = 0;
3453 3476
3454 return TRUE;3477 return TRUE;
3455 }3478 }
3456 3479
@@ -3465,17 +3488,17 @@ t_CKBOOL Chuck_IO_Serial::get_buffer(t_CKINT timeout_ms) · 8 unmodified lines
3465t_CKINT Chuck_IO_Serial::peek_buffer()3488t_CKINT Chuck_IO_Serial::peek_buffer()
3466{3489{
3467 // CK_FPRINTF_STDERR( "Chuck_IO_Serial::peek_buffer %i/%i\n", m_io_buf_pos, m_io_buf_available);3490 // CK_FPRINTF_STDERR( "Chuck_IO_Serial::peek_buffer %i/%i\n", m_io_buf_pos, m_io_buf_available);
3468 3491
3469 if(m_io_buf_pos >= m_io_buf_available)3492 if(m_io_buf_pos >= m_io_buf_available)
3470 {3493 {
3471 // refresh data3494 // refresh data
3472 while(!m_do_exit && !m_eof && !get_buffer(5))3495 while(!m_do_exit && !m_eof && !get_buffer(5))
3473 ;3496 ;
3474 3497
3475 if(m_do_exit || m_eof)3498 if(m_do_exit || m_eof)
3476 return -1;3499 return -1;
3477 }3500 }
3478 3501
3479 return m_io_buf[m_io_buf_pos];3502 return m_io_buf[m_io_buf_pos];
3480}3503}
3481 3504
@@ -3484,17 +3507,17 @@ t_CKINT Chuck_IO_Serial::peek_buffer() · 2 unmodified lines
3484t_CKINT Chuck_IO_Serial::pull_buffer()3507t_CKINT Chuck_IO_Serial::pull_buffer()
3485{3508{
3486 // CK_FPRINTF_STDERR( "Chuck_IO_Serial::pull_buffer %i/%i\n", m_io_buf_pos, m_io_buf_available);3509 // CK_FPRINTF_STDERR( "Chuck_IO_Serial::pull_buffer %i/%i\n", m_io_buf_pos, m_io_buf_available);
3487 3510
3488 if(m_io_buf_pos >= m_io_buf_available)3511 if(m_io_buf_pos >= m_io_buf_available)
3489 {3512 {
3490 // refresh data3513 // refresh data
3491 while(!m_do_exit && !m_eof && !get_buffer(5))3514 while(!m_do_exit && !m_eof && !get_buffer(5))
3492 ;3515 ;
3493 3516
3494 if(m_do_exit || m_eof)3517 if(m_do_exit || m_eof)
3495 return -1;3518 return -1;
3496 }3519 }
3497 3520
3498 return m_io_buf[m_io_buf_pos++];3521 return m_io_buf[m_io_buf_pos++];
3499}3522}
3500 3523
@@ -3506,10 +3529,10 @@ t_CKINT Chuck_IO_Serial::buffer_bytes_to_tmp(t_CKINT num_bytes) · 5 unmodified lines
3506 {3529 {
3507 if(peek_buffer() == -1)3530 if(peek_buffer() == -1)
3508 break;3531 break;
3509 3532
3510 m_tmp_buf[len++] = pull_buffer();3533 m_tmp_buf[len++] = pull_buffer();
3511 }3534 }
3512 3535
3513 return len;3536 return len;
3514}3537}
3515 3538
@@ -3518,12 +3541,12 @@ t_CKBOOL Chuck_IO_Serial::handle_line(Chuck_IO_Serial::Request &r) · 2 unmodified lines
3518{3541{
3519 t_CKUINT len = 0;3542 t_CKUINT len = 0;
3520 Chuck_String * str = NULL;3543 Chuck_String * str = NULL;
3521 3544
3522 while(!m_do_exit)3545 while(!m_do_exit)
3523 {3546 {
3524 if(peek_buffer() == -1)3547 if(peek_buffer() == -1)
3525 break;3548 break;
3526 3549
3527 if(peek_buffer() == '\r')3550 if(peek_buffer() == '\r')
3528 {3551 {
3529 // consume newline character3552 // consume newline character
@@ -3531,7 +3554,7 @@ t_CKBOOL Chuck_IO_Serial::handle_line(Chuck_IO_Serial::Request &r) · 1 unmodified line
3531 if(peek_buffer() == '\n') pull_buffer(); // handle \r\n3554 if(peek_buffer() == '\n') pull_buffer(); // handle \r\n
3532 break;3555 break;
3533 }3556 }
3534 3557
3535 if(peek_buffer() == '\n')3558 if(peek_buffer() == '\n')
3536 {3559 {
3537 // consume newline character3560 // consume newline character
@@ -3539,40 +3562,40 @@ t_CKBOOL Chuck_IO_Serial::handle_line(Chuck_IO_Serial::Request &r) · 1 unmodified line
3539 if(peek_buffer() == '\r') pull_buffer(); // handle \n\r (unlikely)3562 if(peek_buffer() == '\r') pull_buffer(); // handle \n\r (unlikely)
3540 break;3563 break;
3541 }3564 }
3542 3565
3543 m_tmp_buf[len++] = pull_buffer();3566 m_tmp_buf[len++] = pull_buffer();
3544 3567
3545 if(len >= m_tmp_buf_max)3568 if(len >= m_tmp_buf_max)
3546 {3569 {
3547 EM_log(CK_LOG_WARNING, "(Serial.handle_line): warning: line exceeds buffer length, truncating to %i characters", m_tmp_buf_max);3570 EM_log(CK_LOG_WARNING, "(Serial.handle_line): warning: line exceeds buffer length, truncating to %i characters", m_tmp_buf_max);
3548 break;3571 break;
3549 }3572 }
3550 }3573 }
3551 3574
3552 if(m_do_exit)3575 if(m_do_exit)
3553 goto error;3576 goto error;
3554 // TODO: eof3577 // TODO: eof
3555 3578
3556 str = new Chuck_String;3579 str = new Chuck_String;
3557 str->set( std::string((char *)m_tmp_buf, len) );3580 str->set( std::string((char *)m_tmp_buf, len) );
3558 3581
3559 r.m_val = (t_CKUINT) str;3582 r.m_val = (t_CKUINT) str;
3560 r.m_status = Chuck_IO_Serial::Request::RQ_STATUS_SUCCESS;3583 r.m_status = Chuck_IO_Serial::Request::RQ_STATUS_SUCCESS;
3561 3584
3562 return TRUE;3585 return TRUE;
3563 3586
3564error:3587error:
3565 r.m_val = 0;3588 r.m_val = 0;
3566 r.m_status = Chuck_IO_Serial::Request::RQ_STATUS_FAILURE;3589 r.m_status = Chuck_IO_Serial::Request::RQ_STATUS_FAILURE;
3567 3590
3568#ifdef WIN323591#ifdef WIN32
3569 HANDLE hFile = (HANDLE) _get_osfhandle(m_fd);3592 HANDLE hFile = (HANDLE) _get_osfhandle(m_fd);
3570 DWORD error;3593 DWORD error;
3571 ClearCommError(hFile, &error, NULL);3594 ClearCommError(hFile, &error, NULL);
3572 3595
3573 PurgeComm(hFile, PURGE_RXCLEAR);3596 PurgeComm(hFile, PURGE_RXCLEAR);
3574#endif3597#endif
3575 3598
3576 return TRUE;3599 return TRUE;
3577}3600}
3578 3601
@@ -3586,19 +3609,19 @@ t_CKBOOL Chuck_IO_Serial::handle_float_ascii(Chuck_IO_Serial::Request & r) · 7 unmodified lines
3586 t_CKFLOAT val = 0;3609 t_CKFLOAT val = 0;
3587 int numRead = 0;3610 int numRead = 0;
3588 Chuck_Array8 * array = new Chuck_Array8(0);3611 Chuck_Array8 * array = new Chuck_Array8(0);
3589 3612
3590 for(int i = 0; i < r.m_num && !m_do_exit; i++)3613 for(int i = 0; i < r.m_num && !m_do_exit; i++)
3591 {3614 {
3592 t_CKUINT len = 0;3615 t_CKUINT len = 0;
3593 3616
3594 while(!m_do_exit)3617 while(!m_do_exit)
3595 {3618 {
3596 if(peek_buffer() == -1)3619 if(peek_buffer() == -1)
3597 break;3620 break;
3598 3621
3599 // TODO: '\r'?3622 // TODO: '\r'?
3600 int c = peek_buffer();3623 int c = (int)peek_buffer();
3601 3624
3602 if(isdigit(c) || c=='.' || (len==0 && (c=='-' || c=='+')))3625 if(isdigit(c) || c=='.' || (len==0 && (c=='-' || c=='+')))
3603 {3626 {
3604 m_tmp_buf[len++] = pull_buffer();3627 m_tmp_buf[len++] = pull_buffer();
@@ -3607,29 +3630,29 @@ t_CKBOOL Chuck_IO_Serial::handle_float_ascii(Chuck_IO_Serial::Request & r) · 2 unmodified lines
3607 {3630 {
3608 m_tmp_buf[len++] = '\0';3631 m_tmp_buf[len++] = '\0';
3609 val = strtod((char *)m_tmp_buf, NULL);3632 val = strtod((char *)m_tmp_buf, NULL);
3610 3633
3611 numRead++;3634 numRead++;
3612 array->push_back(val);3635 array->push_back(val);
3613 3636
3614 break;3637 break;
3615 }3638 }
3616 }3639 }
3617 }3640 }
3618 3641
3619 if(m_do_exit || m_eof)3642 if(m_do_exit || m_eof)
3620 goto error;3643 goto error;
3621 3644
3622 r.m_num = numRead;3645 r.m_num = numRead;
3623 r.m_val = (t_CKUINT) array;3646 r.m_val = (t_CKUINT) array;
3624 r.m_status = Request::RQ_STATUS_SUCCESS;3647 r.m_status = Request::RQ_STATUS_SUCCESS;
3625 3648
3626 return TRUE;3649 return TRUE;
3627 3650
3628error:3651error:
3629 SAFE_DELETE(array);3652 SAFE_DELETE(array);
3630 r.m_val = 0;3653 r.m_val = 0;
3631 r.m_status = Chuck_IO_Serial::Request::RQ_STATUS_FAILURE;3654 r.m_status = Chuck_IO_Serial::Request::RQ_STATUS_FAILURE;
3632 3655
3633 return TRUE;3656 return TRUE;
3634}3657}
3635 3658
@@ -3641,14 +3664,14 @@ t_CKBOOL Chuck_IO_Serial::handle_int_ascii(Chuck_IO_Serial::Request & r) · 5 unmodified lines
3641 for(int i = 0; i < r.m_num; i++)3664 for(int i = 0; i < r.m_num; i++)
3642 {3665 {
3643 t_CKUINT len = 0;3666 t_CKUINT len = 0;
3644 3667
3645 while(!m_do_exit)3668 while(!m_do_exit)
3646 {3669 {
3647 if(peek_buffer() == -1)3670 if(peek_buffer() == -1)
3648 break;3671 break;
3649 3672
3650 int c = pull_buffer();3673 int c = (int)pull_buffer();
3651 3674
3652 if(isdigit(c) || (len==0 && (c=='-' || c=='+')))3675 if(isdigit(c) || (len==0 && (c=='-' || c=='+')))
3653 {3676 {
3654 m_tmp_buf[len++] = c;3677 m_tmp_buf[len++] = c;
@@ -3657,39 +3680,39 @@ t_CKBOOL Chuck_IO_Serial::handle_int_ascii(Chuck_IO_Serial::Request & r) · 2 unmodified lines
3657 {3680 {
3658 m_tmp_buf[len++] = '\0';3681 m_tmp_buf[len++] = '\0';
3659 val = strtol((char *)m_tmp_buf, NULL, 10);3682 val = strtol((char *)m_tmp_buf, NULL, 10);
3660 3683
3661 numRead++;3684 numRead++;
3662 array->push_back(val);3685 array->push_back(val);
3663 3686
3664 break;3687 break;
3665 }3688 }
3666 }3689 }
3667 }3690 }
3668 3691
3669 if(m_do_exit || m_eof)3692 if(m_do_exit || m_eof)
3670 goto error;3693 goto error;
3671 3694
3672 r.m_num = numRead;3695 r.m_num = numRead;
3673 r.m_val = (t_CKUINT) array;3696 r.m_val = (t_CKUINT) array;
3674 r.m_status = Request::RQ_STATUS_SUCCESS;3697 r.m_status = Request::RQ_STATUS_SUCCESS;
3675 3698
3676 return TRUE;3699 return TRUE;
3677 3700
3678error:3701error:
3679 SAFE_DELETE(array);3702 SAFE_DELETE(array);
3680 r.m_val = 0;3703 r.m_val = 0;
3681 r.m_status = Chuck_IO_Serial::Request::RQ_STATUS_FAILURE;3704 r.m_status = Chuck_IO_Serial::Request::RQ_STATUS_FAILURE;
3682 3705
3683 return TRUE;3706 return TRUE;
3684}3707}
3685 3708
3686t_CKBOOL Chuck_IO_Serial::handle_byte(Chuck_IO_Serial::Request & r)3709t_CKBOOL Chuck_IO_Serial::handle_byte(Chuck_IO_Serial::Request & r)
3687{3710{
3688 // binary3711 // binary
3689 int size = 1; 3712 int size = 1;
3690 int num = r.m_num;3713 int num = r.m_num;
3691 t_CKUINT val = 0;3714 t_CKUINT val = 0;
3692 3715
3693 if(size*num > m_tmp_buf_max)3716 if(size*num > m_tmp_buf_max)
3694 {3717 {
3695 int new_num = (int) floorf(((float)m_tmp_buf_max)/size);3718 int new_num = (int) floorf(((float)m_tmp_buf_max)/size);
@@ -3697,14 +3720,14 @@ t_CKBOOL Chuck_IO_Serial::handle_byte(Chuck_IO_Serial::Request & r) · 1 unmodified line
3697 num, size*num, new_num);3720 num, size*num, new_num);
3698 num = new_num;3721 num = new_num;
3699 }3722 }
3700 3723
3701 t_CKINT len = buffer_bytes_to_tmp(num);3724 t_CKINT len = buffer_bytes_to_tmp(num);
3702 3725
3703 if(m_do_exit || m_eof)3726 if(m_do_exit || m_eof)
3704 goto error;3727 goto error;
3705 3728
3706 r.m_num = len;3729 r.m_num = len;
3707 3730
3708 if(r.m_num == 1)3731 if(r.m_num == 1)
3709 val = m_tmp_buf[0];3732 val = m_tmp_buf[0];
3710 else3733 else
@@ -3714,19 +3737,19 @@ t_CKBOOL Chuck_IO_Serial::handle_byte(Chuck_IO_Serial::Request & r) · 3 unmodified lines
3714 {3737 {
3715 array->set(i, m_tmp_buf[i]);3738 array->set(i, m_tmp_buf[i]);
3716 }3739 }
3717 3740
3718 val = (t_CKUINT) array;3741 val = (t_CKUINT) array;
3719 }3742 }
3720 3743
3721 r.m_val = val;3744 r.m_val = val;
3722 r.m_status = Request::RQ_STATUS_SUCCESS;3745 r.m_status = Request::RQ_STATUS_SUCCESS;
3723 3746
3724 return TRUE;3747 return TRUE;
3725 3748
3726error:3749error:
3727 r.m_val = 0;3750 r.m_val = 0;
3728 r.m_status = Chuck_IO_Serial::Request::RQ_STATUS_FAILURE;3751 r.m_status = Chuck_IO_Serial::Request::RQ_STATUS_FAILURE;
3729 3752
3730 return TRUE;3753 return TRUE;
3731}3754}
3732 3755
@@ -3735,9 +3758,9 @@ t_CKBOOL Chuck_IO_Serial::handle_float_binary(Chuck_IO_Serial::Request & r) · 2 unmodified lines
3735 // binary3758 // binary
3736 int size = 4; // SPENCERTODO: should these be based on arch (64 bit)?3759 int size = 4; // SPENCERTODO: should these be based on arch (64 bit)?
3737 assert(sizeof(t_CKSINGLE) == 4);3760 assert(sizeof(t_CKSINGLE) == 4);
3738 3761
3739 int num = r.m_num;3762 int num = r.m_num;
3740 3763
3741 if(size*num > m_tmp_buf_max)3764 if(size*num > m_tmp_buf_max)
3742 {3765 {
3743 int new_num = (int) floorf(((float)m_tmp_buf_max)/size);3766 int new_num = (int) floorf(((float)m_tmp_buf_max)/size);
@@ -3745,23 +3768,23 @@ t_CKBOOL Chuck_IO_Serial::handle_float_binary(Chuck_IO_Serial::Request & r) · 1 unmodified line
3745 num, size*num, new_num);3768 num, size*num, new_num);
3746 num = new_num;3769 num = new_num;
3747 }3770 }
3748 3771
3749 r.m_num = buffer_bytes_to_tmp(size*num)/size;3772 r.m_num = buffer_bytes_to_tmp(size*num)/size;
3750 3773
3751 t_CKUINT val = 0;3774 t_CKUINT val = 0;
3752 t_CKSINGLE * m_floats = (t_CKSINGLE *) m_tmp_buf;3775 t_CKSINGLE * m_floats = (t_CKSINGLE *) m_tmp_buf;
3753 3776
3754 Chuck_Array8 * array = new Chuck_Array8(r.m_num);3777 Chuck_Array8 * array = new Chuck_Array8(r.m_num);
3755 for(int i = 0; i < r.m_num; i++)3778 for(int i = 0; i < r.m_num; i++)
3756 {3779 {
3757 array->set(i, m_floats[i]);3780 array->set(i, m_floats[i]);
3758 }3781 }
3759

521 more lines aren’t shown here.

src/core/chuck_io.h+29−29

This diff is large: its 189 lines aren’t shown here.

src/core/chuck_lang.cpp+749−151

This diff is large: its 1642 lines aren’t shown here.

src/core/chuck_lang.h+36−2

This diff is large: its 70 lines aren’t shown here.

src/core/chuck_oo.cpp+219−62

This diff is large: its 540 lines aren’t shown here.

src/core/chuck_oo.h+66−43

This diff is large: its 330 lines aren’t shown here.

src/core/chuck_otf.cpp+29−28

This diff is large: its 193 lines aren’t shown here.

src/core/chuck_otf.h+1−1

This diff is large: its 9 lines aren’t shown here.

src/core/chuck_parse.cpp+468−12

This diff is large: its 542 lines aren’t shown here.

src/core/chuck_parse.h+7−5

This diff is large: its 40 lines aren’t shown here.

src/core/chuck_scan.cpp+209−125

This diff is large: its 990 lines aren’t shown here.

src/core/chuck_scan.h+2−2

This diff is large: its 16 lines aren’t shown here.

src/core/chuck_shell.cpp+252−252

This diff is large: its 1682 lines aren’t shown here.

src/core/chuck_shell.h+80−80

This diff is large: its 458 lines aren’t shown here.

src/core/chuck_stats.cpp+10−10

This diff is large: its 90 lines aren’t shown here.

src/core/chuck_stats.h+10−10

This diff is large: its 75 lines aren’t shown here.

src/core/chuck_symbol.cpp+9−9

This diff is large: its 58 lines aren’t shown here.

src/core/chuck_symbol.h+1−1

This diff is large: its 9 lines aren’t shown here.

src/core/chuck_table.cpp+6−6

This diff is large: its 47 lines aren’t shown here.

src/core/chuck_table.h+2−2

This diff is large: its 18 lines aren’t shown here.

src/core/chuck_type.cpp+586−344

This diff is large: its 2601 lines aren’t shown here.

src/core/chuck_type.h+121−56

This diff is large: its 482 lines aren’t shown here.

src/core/chuck_ugen.cpp+78−78

This diff is large: its 545 lines aren’t shown here.

src/core/chuck_ugen.h+6−6

This diff is large: its 43 lines aren’t shown here.

src/core/chuck_utils.cpp+3−3

This diff is large: its 20 lines aren’t shown here.

src/core/chuck_utils.h+1−1

This diff is large: its 9 lines aren’t shown here.

src/core/chuck_vm.cpp+70−70

This diff is large: its 570 lines aren’t shown here.

src/core/chuck_vm.h+18−18

This diff is large: its 138 lines aren’t shown here.

src/core/chuck_win32.h+2−2

This diff is large: its 18 lines aren’t shown here.

src/core/dirent_win32.h+37−37

This diff is large: its 142 lines aren’t shown here.

src/core/hidio_sdl.cpp+100−100

This diff is large: its 639 lines aren’t shown here.

src/core/hidio_sdl.h+4−4

This diff is large: its 30 lines aren’t shown here.

src/core/lo/config.h+200−200

This diff is large: its 401 lines aren’t shown here.

src/core/lo/lo.h+16−16

This diff is large: its 107 lines aren’t shown here.

src/core/lo/lo_endian.h+32−32

This diff is large: its 120 lines aren’t shown here.

src/core/lo/lo_lowlevel.h+14−14

This diff is large: its 92 lines aren’t shown here.

src/core/lo/lo_macros.h+3−3

This diff is large: its 19 lines aren’t shown here.

src/core/lo/lo_osc_types.h+48−48

This diff is large: its 131 lines aren’t shown here.

src/core/lo/lo_types.h+2−2

This diff is large: its 11 lines aren’t shown here.

src/core/lo/lo_types_internal.h+52−52

This diff is large: its 154 lines aren’t shown here.

src/core/makefile+15−10

This diff is large: its 74 lines aren’t shown here.

src/core/makefile.x/makefile.alsa+8−2

This diff is large: its 13 lines aren’t shown here.

src/core/makefile.x/makefile.jack+8−2

This diff is large: its 13 lines aren’t shown here.

src/core/makefile.x/makefile.mac+5−5

This diff is large: its 18 lines aren’t shown here.

src/core/makefile.x/makefile.pulse+8−2

This diff is large: its 13 lines aren’t shown here.

src/core/midiio_rtmidi.cpp+123−123

This diff is large: its 877 lines aren’t shown here.

src/core/midiio_rtmidi.h+15−15

This diff is large: its 121 lines aren’t shown here.

src/core/regex/config.h+185−185

This diff is large: its 372 lines aren’t shown here.

src/core/regex/regex.h+4−4

This diff is large: its 15 lines aren’t shown here.

src/core/regex/tre-ast.h+14−14

This diff is large: its 72 lines aren’t shown here.

src/core/regex/tre-config.h+52−52

This diff is large: its 105 lines aren’t shown here.

src/core/regex/tre-internal.h+31−31

This diff is large: its 103 lines aren’t shown here.

src/core/regex/tre-match-utils.h+149−149

This diff is large: its 344 lines aren’t shown here.

src/core/regex/tre-mem.h+4−4

This diff is large: its 22 lines aren’t shown here.

src/core/regex/tre-parse.h+1−1

This diff is large: its 9 lines aren’t shown here.

src/core/regex/tre-stack.h+20−20

This diff is large: its 72 lines aren’t shown here.

src/core/regex/tre.h+54−54

This diff is large: its 225 lines aren’t shown here.

src/core/regex/xmalloc.h+14−14

This diff is large: its 66 lines aren’t shown here.

src/core/rtmidi.cpp+12−12

This diff is large: its 104 lines aren’t shown here.

src/core/rtmidi.h+10−10

This diff is large: its 58 lines aren’t shown here.

src/core/uana_extract.cpp+1435−180

This diff is large: its 2169 lines aren’t shown here.

src/core/uana_xform.cpp+218−212

This diff is large: its 1320 lines aren’t shown here.

src/core/ugen_filter.cpp+239−163

This diff is large: its 971 lines aren’t shown here.

src/core/ugen_osc.cpp+101−101

This diff is large: its 725 lines aren’t shown here.

src/core/ugen_osc.h+2−2

This diff is large: its 14 lines aren’t shown here.

src/core/ugen_stk.cpp+901−854

This diff is large: its 6118 lines aren’t shown here.

src/core/ugen_stk.h+139−141

This diff is large: its 1114 lines aren’t shown here.

src/core/ugen_xxx.cpp+595−553

This diff is large: its 3187 lines aren’t shown here.

src/core/ulib_ai.cpp+6921−0

This diff is large: its 6922 lines aren’t shown here.

src/core/ulib_ai.h+370−0

This diff is large: its 371 lines aren’t shown here.

src/core/ulib_machine.cpp+236−31

This diff is large: its 384 lines aren’t shown here.

src/core/ulib_machine.h+6−10

This diff is large: its 29 lines aren’t shown here.

src/core/ulib_math.cpp+389−51

This diff is large: its 661 lines aren’t shown here.

src/core/ulib_math.h+11−6

This diff is large: its 24 lines aren’t shown here.

src/core/ulib_opsc.cpp+292−286

This diff is large: its 1504 lines aren’t shown here.

src/core/ulib_regex.cpp+76−77

This diff is large: its 412 lines aren’t shown here.

src/core/ulib_regex.h+4−4

This diff is large: its 26 lines aren’t shown here.

src/core/ulib_std.cpp+101−99

This diff is large: its 443 lines aren’t shown here.

src/core/util_buffers.cpp+26−26

This diff is large: its 196 lines aren’t shown here.

src/core/util_buffers.h+52−52

This diff is large: its 353 lines aren’t shown here.

src/core/util_console.cpp+32−52

This diff is large: its 149 lines aren’t shown here.

src/core/util_hid.cpp+1310−1313

This diff is large: its 6769 lines aren’t shown here.

src/core/util_hid.h+4−2

This diff is large: its 27 lines aren’t shown here.

src/core/util_math.c+15−1

This diff is large: its 30 lines aren’t shown here.

src/core/util_math.h+18−4

This diff is large: its 48 lines aren’t shown here.

src/core/util_network.c+1−1

This diff is large: its 9 lines aren’t shown here.

src/core/util_opsc.cpp+254−275

This diff is large: its 1441 lines aren’t shown here.

src/core/util_opsc.h+51−51

This diff is large: its 318 lines aren’t shown here.

src/core/util_platforms.cpp+5−5

This diff is large: its 35 lines aren’t shown here.

src/core/util_platforms.h+4−4

This diff is large: its 26 lines aren’t shown here.

src/core/util_serial.cpp+15−17

This diff is large: its 117 lines aren’t shown here.

src/core/util_serial.h+3−1

This diff is large: its 18 lines aren’t shown here.

src/core/util_sndfile.c+154−147

This diff is large: its 807 lines aren’t shown here.

src/core/util_sndfile.h+103−97

This diff is large: its 555 lines aren’t shown here.

src/core/util_string.cpp+39−41

This diff is large: its 243 lines aren’t shown here.

src/core/util_string.h+1−1

This diff is large: its 9 lines aren’t shown here.

src/core/util_thread.cpp+39−39

This diff is large: its 256 lines aren’t shown here.

src/core/util_thread.h+18−18

This diff is large: its 104 lines aren’t shown here.

src/core/util_xforms.c+2−2

This diff is large: its 18 lines aren’t shown here.

src/host/chuck_audio.cpp+91−73

This diff is large: its 236 lines aren’t shown here.

src/host/chuck_audio.h+4−5

This diff is large: its 23 lines aren’t shown here.

src/host/chuck_main.cpp+24−5

This diff is large: its 57 lines aren’t shown here.

src/host_web/README.txt+58−0

This diff is large: its 59 lines aren’t shown here.

src/host_web/chuck_emscripten.cpp+9−6

This diff is large: its 36 lines aren’t shown here.

src/host_web/chuck_emscripten.h+0−0

File mode changed from 100755 to 100644.

src/makefile+23−19

This diff is large: its 122 lines aren’t shown here.

src/test/01-Basic/113.ck+7−0

This diff is large: its 8 lines aren’t shown here.

src/test/01-Basic/113.txt+1−0

This diff is large: its 2 lines aren’t shown here.

src/test/01-Basic/114.ck+5−0

This diff is large: its 6 lines aren’t shown here.

src/test/01-Basic/114.txt+1−0

This diff is large: its 2 lines aren’t shown here.

src/test/01-Basic/115.ck+10−0

This diff is large: its 11 lines aren’t shown here.

src/test/01-Basic/116.ck+15−0

This diff is large: its 16 lines aren’t shown here.

src/test/01-Basic/116.txt+1−0

This diff is large: its 2 lines aren’t shown here.

src/test/01-Basic/117.ck+6−0

This diff is large: its 7 lines aren’t shown here.

src/test/01-Basic/118.ck+29−0

This diff is large: its 30 lines aren’t shown here.

src/test/01-Basic/119.ck+12−0

This diff is large: its 13 lines aren’t shown here.

src/test/01-Basic/120.ck+20−0

This diff is large: its 21 lines aren’t shown here.

src/test/01-Basic/120.txt+1−0

This diff is large: its 2 lines aren’t shown here.

src/test/01-Basic/121.ck+7−0

This diff is large: its 8 lines aren’t shown here.

src/test/01-Basic/122.ck+9−0

This diff is large: its 10 lines aren’t shown here.

src/test/01-Basic/122.txt+1−0

This diff is large: its 2 lines aren’t shown here.

src/test/01-Basic/123.ck+17−0

This diff is large: its 18 lines aren’t shown here.

src/test/01-Basic/124.ck+50−0

This diff is large: its 51 lines aren’t shown here.

src/test/01-Basic/94.ck+75−0

This diff is large: its 76 lines aren’t shown here.

src/test/01-Basic/95.ck+8−0

This diff is large: its 9 lines aren’t shown here.

src/test/01-Basic/95.txt+1−0

This diff is large: its 2 lines aren’t shown here.

src/test/01-Basic/96.ck+12−0

This diff is large: its 13 lines aren’t shown here.

src/test/01-Basic/96.txt+1−0

This diff is large: its 2 lines aren’t shown here.

src/test/01-Basic/97.ck+7−0

This diff is large: its 8 lines aren’t shown here.

src/test/01-Basic/97.txt+1−0

This diff is large: its 2 lines aren’t shown here.

src/test/01-Basic/98.ck+45−0

This diff is large: its 46 lines aren’t shown here.

src/test/01-Basic/99.ck+13−0

This diff is large: its 14 lines aren’t shown here.

src/test/05-Global/01b.txt+1−1

This diff is large: its 3 lines aren’t shown here.

src/test/05-Global/102a.txt+3−3

This diff is large: its 9 lines aren’t shown here.

src/test/05-Global/113.ck+10−0

This diff is large: its 11 lines aren’t shown here.

src/test/05-Global/95.ck+5−0

This diff is large: its 6 lines aren’t shown here.

src/test/05-Global/95.txt+1−0

This diff is large: its 2 lines aren’t shown here.

src/test/05-Global/96.ck+12−0

This diff is large: its 13 lines aren’t shown here.

src/test/05-Global/96.txt+1−0

This diff is large: its 2 lines aren’t shown here.

src/test/05-Global/97.ck+7−0

This diff is large: its 8 lines aren’t shown here.

src/test/05-Global/97.txt+1−0

This diff is large: its 2 lines aren’t shown here.

src/test/README+19−6

This diff is large: its 30 lines aren’t shown here.

src/test/test.py+8−4

This diff is large: its 35 lines aren’t shown here.

src/visual-studio/chuck-vs10.vcxproj+532−530

This diff is large: its 1063 lines aren’t shown here.

src/visual-studio/chuck.dsp+17−0

This diff is large: its 31 lines aren’t shown here.

src/visual-studio/chuck.vcxproj+7−5

This diff is large: its 56 lines aren’t shown here.

src/visual-studio/chuck.vcxproj.filters+7−1

This diff is large: its 26 lines aren’t shown here.

src/xcode/chuck.xcodeproj/project.pbxproj+12−2

This diff is large: its 70 lines aren’t shown here.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t