[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-dev] SF.net SVN: supercollider:[8157] trunk/build/Help/Core/Kernel/Interpreter. html

Revision: 8157
Author:   jrhb
Date:     2008-12-16 00:23:54 +0000 (Tue, 16 Dec 2008)

Log Message:
improved Interpreter helpfile

Modified Paths:

Modified: trunk/build/Help/Core/Kernel/Interpreter.html
--- trunk/build/Help/Core/Kernel/Interpreter.html	2008-12-16 00:15:50 UTC (rev 8156)
+++ trunk/build/Help/Core/Kernel/Interpreter.html	2008-12-16 00:23:54 UTC (rev 8157)
@@ -5,15 +5,25 @@
 <meta http-equiv="Content-Style-Type" content="text/css">
 <meta name="Generator" content="Cocoa HTML Writer">
-<meta name="CocoaVersion" content="824.42">
+<meta name="CocoaVersion" content="949.35">
 <style type="text/css">
 p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica}
 p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
 p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
-p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco}
+p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; color: #000000}
 p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica}
+p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; color: #606060}
+p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000}
+p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; color: #bf0000}
+p.p9 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; color: #000000; min-height: 16.0px}
+p.p10 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; min-height: 16.0px}
 span.s1 {text-decoration: underline}
-span.s2 {font: 12.0px Helvetica}
+span.s2 {color: #0000bf}
+span.s3 {color: #000000}
+span.s4 {color: #606060}
+span.s5 {font: 12.0px Helvetica; color: #000000}
+span.s6 {color: #0000ff}
+span.s7 {color: #bf0000}
@@ -25,7 +35,7 @@
 <p class="p2"><br></p>
 <p class="p3">In the interpreter, <span class="s1">this</span> refers to the interpreter itself, e.g.:</p>
 <p class="p2"><br></p>
-<p class="p4">this.postln</p>
+<p class="p4"><span class="s2">this</span>.postln</p>
 <p class="p2"><br></p>
 <p class="p2"><br></p>
 <p class="p5"><b><span class="s1">Accessing</span></b></p>
@@ -39,7 +49,7 @@
 <p class="p4">(</p>
 <p class="p4">x = 123;</p>
 <p class="p4">x.postln;</p>
-<p class="p4">this.clearAll;</p>
+<p class="p4"><span class="s2">this</span>.clearAll;</p>
 <p class="p4">x.postln;</p>
 <p class="p4">)</p>
 <p class="p2"><br></p>
@@ -50,21 +60,21 @@
 <p class="p2"><br></p>
 <p class="p3">Compile and execute a String.</p>
 <p class="p2"><br></p>
-<p class="p4">this.interpret("(123 + 4000).postln");</p>
+<p class="p6"><span class="s2">this</span><span class="s3">.interpret(</span>"(123 + 4000).postln"<span class="s3">);</span></p>
 <p class="p2"><br></p>
 <p class="p3"><b>interpretPrint(aString)</b></p>
 <p class="p2"><br></p>
 <p class="p3">Compile and execute a String, printing the result.</p>
 <p class="p2"><br></p>
-<p class="p4">this.interpretPrint("123 + 4000");</p>
+<p class="p4"><span class="s2">this</span>.interpretPrint(<span class="s4">"123 + 4000"</span>);</p>
 <p class="p2"><br></p>
 <p class="p2"><br></p>
 <p class="p3"><b>compile(aString)</b></p>
 <p class="p2"><br></p>
 <p class="p3">Compile a String and return a Function.</p>
 <p class="p2"><br></p>
-<p class="p3">(</p>
-<p class="p4"><span class="s2">z = </span>this.compile("(123 + 4000).postln");</p>
+<p class="p7">(</p>
+<p class="p6"><span class="s5">z = </span><span class="s2">this</span><span class="s3">.compile(</span>"(123 + 4000).postln"<span class="s3">);</span></p>
 <p class="p4">z.postln;</p>
 <p class="p4">z.value;</p>
 <p class="p4">)</p>
@@ -81,5 +91,40 @@
 <p class="p3">The file must contain a valid SuperCollider expression, naturally.</p>
 <p class="p3">This will not compile class definitions, only expressions.</p>
 <p class="p2"><br></p>
+<p class="p3"><b>cmdLine</b></p>
+<p class="p2"><br></p>
+<p class="p3">Returns the previosly interpreted code.</p>
+<p class="p2"><br></p>
+<p class="p4">(</p>
+<p class="p4">1 + 2;</p>
+<p class="p4"><span class="s2">this</span>.cmdLine</p>
+<p class="p4">)</p>
+<p class="p2"><br></p>
+<p class="p3"><b>codeDump</b></p>
+<p class="p2"><br></p>
+<p class="p3">this interpreter variable can be set to evaluate a function with any sucessfully compiled code.</p>
+<p class="p3">see e.g. the class <a href="../../Libraries/JITLib/extras/History.html"><span class="s6">History</span></a>.</p>
+<p class="p2"><br></p>
+<p class="p8"><span class="s3">a = [ ]; </span>// store all the code evaulated in a</p>
+<p class="p4"><span class="s2">this</span>.codeDump = { <span class="s2">|code|</span> a = a.add(code) };</p>
+<p class="p4">1 + 3;</p>
+<p class="p4">f = { <span class="s4">"hallo"</span> };</p>
+<p class="p4">a.postcs;</p>
+<p class="p8"><span class="s3">codeDump = </span><span class="s2">nil</span><span class="s3">; </span>// reset to nil.</p>
+<p class="p2"><br></p>
+<p class="p2"><br></p>
+<p class="p3"><b>preProcessor</b></p>
+<p class="p2"><br></p>
+<p class="p3">can be used to modify code before it is interpreted. Given appropriate delimiters, this can be used to implement little languages.</p>
+<p class="p2"><br></p>
+<p class="p8">// silly but simple: understand a Saw for every SinOsc</p>
+<p class="p4"><span class="s2">this</span>.preProcessor = { <span class="s2">|code|</span> code.replace(<span class="s4">"SinOsc"</span>, <span class="s4">"Saw"</span>) };</p>
+<p class="p9"><br></p>
+<p class="p4">{ <span class="s2">SinOsc</span>.ar(200) * 0.1 }.play;</p>
+<p class="p9"><br></p>
+<p class="p4">preProcessor = <span class="s2">nil</span>; <span class="s7">// reset to nil.</span></p>
+<p class="p10"><br></p>
+<p class="p10"><br></p>
+<p class="p10"><br></p>

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

sc-dev mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-dev/
search: https://listarc.bham.ac.uk/lists/sc-dev/search/