com presentations: C API Example: mx14.html slides/intro/capi.xml

[email protected] (Rasmus Lerdorf)
Newsgroups php.pres
Message-ID <[email protected]>
Commit:    8f30bba609b637c12bcdfb2b8b48541af8ad5baa
Author:    Rasmus Lerdorf <[email protected]>         Tue, 23 Sep 2014 21:32:46 -0700
Parents:   4d3c1016c652b3f0668a8247ffb09614d4c69d48
Branches:  master

Link:       http://git.php.net/?p=presentations.git;a=commitdiff;h=8f30bba609b637c12bcdfb2b8b48541af8ad5baa

Log:
C API Example

Changed paths:
  M  mx14.html
  M  slides/intro/capi.xml


Diff:
diff --git a/mx14.html b/mx14.html
index a623ad6..bf99a7b 100644
--- a/mx14.html
+++ b/mx14.html
@@ -204,6 +204,23 @@ http://www.io.org/~rasmus</code></pre>
 	</section>
 	<section>
 		<h2>C API for the Web</h2>
+		<pre><code class="C">void Cos(void) {
+    Stack *s;
+    char temp[64];
+
+    s = Pop();
+    if(!s) {
+        Error(&quot;Stack error in cos&quot;);
+        return;
+    }
+    sprintf(temp,&quot;%f&quot;,cos(s-&gt;douval));
+    Push(temp,DNUMBER);
+}</code></pre>
+		<h4 class="p">And you could then use it like this:</h4>
+		<pre><code>&lt;html&gt;&lt;head&gt;&lt;title&gt;Cos Example&lt;/title&gt;&lt;/head&gt;
+&lt;body&gt;&lt;h1&gt;Cos Example&lt;/h1&gt;
+&lt;?echo Cos($input)?&gt;
+&lt;/body&gt;&lt;/html&gt;</code></pre>
 	</section>
 	<section>
 		<h3 class="p">Focus on the Ecosystem</h3>
diff --git a/slides/intro/capi.xml b/slides/intro/capi.xml
index 1f41270..b1ba957 100644
--- a/slides/intro/capi.xml
+++ b/slides/intro/capi.xml
@@ -1,6 +1,26 @@
 <slide title="">
-<break lines="8"/>
+<break lines="4"/>
 
 <blurb fontsize="8em">C API for the Web</blurb>
 
+<example type="C"><![CDATA[void Cos(void) {
+    Stack *s;
+    char temp[64];
+
+    s = Pop();
+    if(!s) {
+        Error("Stack error in cos");
+        return;
+    }
+    sprintf(temp,"%f",cos(s->douval));
+    Push(temp,DNUMBER);
+}]]></example>
+
+<blurb fontsize="4em">And you could then use it like this:</blurb>
+
+<example><![CDATA[<html><head><title>Cos Example</title></head>
+<body><h1>Cos Example</h1>
+<?echo Cos($input)?>
+</body></html>]]></example>
+
 </slide>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.