cvs: presentations / PECL_Gen.xml /slides/PECL_Gen dependencies_1.xml dependencies_2.xml documentation.xml ext_skel.xml extensions.xml function.xml
function_2.xml gain.xml loading.php makefile_fragments.xml outlook.xml phpinfo.php resources.xml tests.xml title.xml /slides/PECL_Gen/examples
deps1.snippet linecount phpize resource.snippet x3.snippet x4.snippet

From: Date: Thu, 11 Nov 2004 14:57:36 +0000
Subject: cvs: presentations / PECL_Gen.xml /slides/PECL_Gen dependencies_1.xml dependencies_2.xml documentation.xml ext_skel.xml extensions.xml function.xml
function_2.xml gain.xml loading.php makefile_fragments.xml outlook.xml phpinfo.php resources.xml tests.xml title.xml /slides/PECL_Gen/examples
deps1.snippet linecount phpize resource.snippet x3.snippet x4.snippet
Groups: php.pres 
Request: Send a blank email to pres+get-1086@lists.php.net to get a copy of this message
hholzgra Thu Nov 11 09:57:36 2004 EDT Added files: /presentations/slides/PECL_Gen dependencies_1.xml ext_skel.xml extensions.xml gain.xml loading.php phpinfo.php /presentations/slides/PECL_Gen/examples deps1.snippet linecount phpize resource.snippet Modified files: /presentations PECL_Gen.xml /presentations/slides/PECL_Gen dependencies_2.xml documentation.xml function.xml function_2.xml makefile_fragments.xml outlook.xml resources.xml tests.xml title.xml /presentations/slides/PECL_Gen/examples x3.snippet x4.snippet Log: PECL_Gen talk update, talk finally happened at PHP Conf. Frankfurt

http://cvs.php.net/diff.php/presentations/PECL_Gen.xml?r1=1.3&r2=1.4&ty=u Index: presentations/PECL_Gen.xml diff -u presentations/PECL_Gen.xml:1.3 presentations/PECL_Gen.xml:1.4 --- presentations/PECL_Gen.xml:1.3 Fri Aug 27 04:24:02 2004 +++ presentations/PECL_Gen.xml Thu Nov 11 09:57:35 2004 @@ -1,15 +1,18 @@ <presentation> <title>PECL_Gen - a code generator for PHP extensions</title> - <event>PAWS - PHP and Web Standards Conference</event> - <location>Manchester</location> - <date>...rescheduled...</date> + <event>International PHP Conference 2004</event> + <location>Frankfurt</location> + <date>November 9, 2004</date> <speaker>Hartmut Holzgraefe</speaker> <navmode>html</navmode> <basefontsize>12pt</basefontsize> <topic>Internals</topic> <logo1>images/animated_elephant.gif</logo1> + <slide>slides/PECL_Gen/extensions.xml</slide> + <slide>slides/PECL_Gen/ext_skel.xml</slide> <slide>slides/PECL_Gen/title.xml</slide> + <slide>slides/PECL_Gen/gain.xml</slide> <slide>slides/PECL_Gen/modes.xml</slide> <slide>slides/PECL_Gen/extension_tag.xml</slide> <slide>slides/PECL_Gen/invocation.xml</slide> @@ -30,16 +33,17 @@ <slide>slides/PECL_Gen/returning_3.xml</slide> <slide>slides/PECL_Gen/special_functions.xml</slide> <slide>slides/PECL_Gen/constants.xml</slide> - <slide>slides/PECL_Gen/php_ini.xml</slide> <slide>slides/PECL_Gen/globals.xml</slide> + <slide>slides/PECL_Gen/php_ini.xml</slide> <slide>slides/PECL_Gen/resources.xml</slide> <slide>slides/PECL_Gen/custom_code.xml</slide> <slide>slides/PECL_Gen/dependencies.xml</slide> + <slide>slides/PECL_Gen/dependencies_1.xml</slide> <slide>slides/PECL_Gen/dependencies_2.xml</slide> <slide>slides/PECL_Gen/makefile_fragments.xml</slide> <slide>slides/PECL_Gen/documentation.xml</slide> <slide>slides/PECL_Gen/tests.xml</slide> <slide>slides/PECL_Gen/classes.xml</slide> - <slide>slides/PECL_Gen/streams.xml</slide> +<!-- <slide>slides/PECL_Gen/streams.xml</slide> --> <slide>slides/PECL_Gen/outlook.xml</slide> </presentation> http://cvs.php.net/diff.php/presentations/slides/PECL_Gen/dependencies_2.xml?r1=1.1&r2=1.2&ty=u Index: presentations/slides/PECL_Gen/dependencies_2.xml diff -u presentations/slides/PECL_Gen/dependencies_2.xml:1.1 presentations/slides/PECL_Gen/dependencies_2.xml:1.2 --- presentations/slides/PECL_Gen/dependencies_2.xml:1.1 Mon Apr 26 12:20:43 2004 +++ presentations/slides/PECL_Gen/dependencies_2.xml Thu Nov 11 09:57:35 2004 @@ -2,35 +2,31 @@ <slide> <title>%--with%</title> <blurb> - When building an extension on Unix-like systems or within the Cygwin -environment under Windows the configure script will try to figure out -where external libraries and header files needed by an extension are -installed on the target system. Using a "with" option it is possible -to specify where to actually look for libraries and headers. This way -it is possible to override search paths if things are not installed in -the default system paths or to specify the exact version of a package -to be used if multiple versions are installed on the target system. -</blurb> + The %--with% configure option is used to enable extensions that + require external libraries. %--with% takes the installation prefix + for that library as an optional argument. + </blurb> <blurb> -The %&amp;lt;with&amp;gt;% tag takes three attributes: name=... for the actual name of -the "with" option, testfile for the relative path of a file to check -for while running the configure script and a list of default paths to -check if no path is given as an argument to the "with" option in -defaults. +The %&amp;lt;with&amp;gt;% tag takes three attributes: </blurb> +<list> +<li>%name=% for the actual name of the "with" option</li> +<li>%testfile% for the relative path of a file to check for while running the configure script</li> +<li> a list of default paths to check</li> +</list> <blurb> -Name and defaults are set to the extension base name and -"/usr:/usr/local" if no values are given. The testfile attribute is +%name% and %defaults% are set to the extension base name and +"%/usr:/usr/local%" if no values are given. The testfile attribute is mandatory. </blurb> <blurb> Textual data enclosed by the %&amp;lt;with&amp;gt;% is used to describe the "with" option in the output of configure --help calls. - </blurb> +</blurb> <example filename="examples/with.snippet" fontsize="1em"/> </slide> http://cvs.php.net/diff.php/presentations/slides/PECL_Gen/documentation.xml?r1=1.1&r2=1.2&ty=u Index: presentations/slides/PECL_Gen/documentation.xml diff -u presentations/slides/PECL_Gen/documentation.xml:1.1 presentations/slides/PECL_Gen/documentation.xml:1.2 --- presentations/slides/PECL_Gen/documentation.xml:1.1 Mon Apr 26 12:20:43 2004 +++ presentations/slides/PECL_Gen/documentation.xml Thu Nov 11 09:57:35 2004 @@ -2,7 +2,12 @@ <slide> <title>Documentation</title> <blurb> - to be done ... + DocBook XML documentation templates are generated from the + %&lt;summary&gt;% and %&lt;description&gt;% tags. + </blurb> + <blurb> + The generated DocBook files are ready to be put into the + PHP manual. </blurb> </slide> http://cvs.php.net/diff.php/presentations/slides/PECL_Gen/function.xml?r1=1.1&r2=1.2&ty=u Index: presentations/slides/PECL_Gen/function.xml diff -u presentations/slides/PECL_Gen/function.xml:1.1 presentations/slides/PECL_Gen/function.xml:1.2 --- presentations/slides/PECL_Gen/function.xml:1.1 Thu Apr 22 12:14:32 2004 +++ presentations/slides/PECL_Gen/function.xml Thu Nov 11 09:57:35 2004 @@ -6,6 +6,6 @@ extensions really are about is functionality, so lets add a function to our extension: </blurb> - <example filename="examples/x3.snippet" linenumbers="1" format="xml" fontsize="1em"/> + <example filename="examples/x3.snippet" linenumbers="1" format="xml" fontsize="1.5em"/> </slide> http://cvs.php.net/diff.php/presentations/slides/PECL_Gen/function_2.xml?r1=1.1&r2=1.2&ty=u Index: presentations/slides/PECL_Gen/function_2.xml diff -u presentations/slides/PECL_Gen/function_2.xml:1.1 presentations/slides/PECL_Gen/function_2.xml:1.2 --- presentations/slides/PECL_Gen/function_2.xml:1.1 Thu Apr 22 12:14:32 2004 +++ presentations/slides/PECL_Gen/function_2.xml Thu Nov 11 09:57:35 2004 @@ -5,10 +5,10 @@ After generating and compiling the new extension we can test it using the folling small script: </blurb> - <example filename="examples/x3.php" fontsize="1em"/> + <example filename="examples/x3.php" fontsize="1.5em"/> <blurb> And, as expected, the result of this little script is %'foobar'% </blurb> - <example filename="examples/x3.result" fontsize="1em"/> + <example filename="examples/x3.result" fontsize="1.5em"/> </slide> http://cvs.php.net/diff.php/presentations/slides/PECL_Gen/makefile_fragments.xml?r1=1.1&r2=1.2&ty=u Index: presentations/slides/PECL_Gen/makefile_fragments.xml diff -u presentations/slides/PECL_Gen/makefile_fragments.xml:1.1 presentations/slides/PECL_Gen/makefile_fragments.xml:1.2 --- presentations/slides/PECL_Gen/makefile_fragments.xml:1.1 Mon Apr 26 12:20:43 2004 +++ presentations/slides/PECL_Gen/makefile_fragments.xml Thu Nov 11 09:57:35 2004 @@ -2,8 +2,19 @@ <slide> <title>Makefile fragments</title> <blurb> - to be done ... + Some extensions may require additional Makefile or config.m4 code + that can't be created by PECL_Gen. + </blurb> + <blurb> + Makefile code can be added using a %&amp;lt;makefile%&amp;gt; tag within + %&amp;lt;deps&amp;gt;% section. The tag data is written to a Makefile.fragment + file and registered within config.m4. + </blurb> + <blurb> + Additions to config.m4 itself can be put into a %&amp;lt;configm4&amp;gt;% tag + within %&amp;lt;deps&amp;gt;%. You can control whether the code is put near + the beginning or the end of config.m4 using the %position=top% or + %position=bottom% attribute. </blurb> - <example filename="examples/makefile_fragment.snippet" fontsize="1em"/> </slide> http://cvs.php.net/diff.php/presentations/slides/PECL_Gen/outlook.xml?r1=1.1&r2=1.2&ty=u Index: presentations/slides/PECL_Gen/outlook.xml diff -u presentations/slides/PECL_Gen/outlook.xml:1.1 presentations/slides/PECL_Gen/outlook.xml:1.2 --- presentations/slides/PECL_Gen/outlook.xml:1.1 Mon Apr 26 12:20:43 2004 +++ presentations/slides/PECL_Gen/outlook.xml Thu Nov 11 09:57:35 2004 @@ -1,14 +1,11 @@ <?xml version="1.0" encoding="ISO-8859-1"?> <slide> <title>What's next?</title> - <blurb> - The next TODO (after cleanups) is definetly OO support, - although this will most likely be implemented for PHP 5 - extensions only. Currently extensions generated by PECL_Gen - work with both PHP 4 and 5, but unlike the rest of the - extension API the OO related parts of it have undergone - some substantial changes. - </blurb> + <list> + <li>PHP 5 classes</li> + <li>Stream wrappers</li> + <li>Code cleanups</li> + </list> <blurb> PECL_Gen can also be used as base for other code generators. A first example showing its capabilities in this realm is http://cvs.php.net/diff.php/presentations/slides/PECL_Gen/resources.xml?r1=1.1&r2=1.2&ty=u Index: presentations/slides/PECL_Gen/resources.xml diff -u presentations/slides/PECL_Gen/resources.xml:1.1 presentations/slides/PECL_Gen/resources.xml:1.2 --- presentations/slides/PECL_Gen/resources.xml:1.1 Mon Apr 26 12:20:43 2004 +++ presentations/slides/PECL_Gen/resources.xml Thu Nov 11 09:57:35 2004 @@ -2,8 +2,16 @@ <slide> <title>Resources</title> <blurb> - to be done ... + Resources are needed to handle custom C datatypes. </blurb> - <example filename="examples/resource.snippet" fontsize="1em"/> + <blurb> + Each resource type has its own registration list that is cleaned up + on script end. Resources usually need a destructor callback that + takes care of freeing memory etc. + </blurb> + <blurb> + PECL_Gen takes care of most of the resource registration details. + </blurb> + <example filename="examples/resource.snippet" fontsize="1.5em"/> </slide> http://cvs.php.net/diff.php/presentations/slides/PECL_Gen/tests.xml?r1=1.1&r2=1.2&ty=u Index: presentations/slides/PECL_Gen/tests.xml diff -u presentations/slides/PECL_Gen/tests.xml:1.1 presentations/slides/PECL_Gen/tests.xml:1.2 --- presentations/slides/PECL_Gen/tests.xml:1.1 Mon Apr 26 12:20:43 2004 +++ presentations/slides/PECL_Gen/tests.xml Thu Nov 11 09:57:35 2004 @@ -2,8 +2,8 @@ <slide> <title>Regression tests</title> <blurb> - to be done ... + Templates for regression test scripts (%.phpt%) are + generated, too. </blurb> - <example filename="examples/tests.snippet" fontsize="1em"/> </slide> http://cvs.php.net/diff.php/presentations/slides/PECL_Gen/title.xml?r1=1.1&r2=1.2&ty=u Index: presentations/slides/PECL_Gen/title.xml diff -u presentations/slides/PECL_Gen/title.xml:1.1 presentations/slides/PECL_Gen/title.xml:1.2 --- presentations/slides/PECL_Gen/title.xml:1.1 Thu Apr 22 12:14:32 2004 +++ presentations/slides/PECL_Gen/title.xml Thu Nov 11 09:57:35 2004 @@ -1,13 +1,16 @@ <?xml version="1.0" encoding="ISO-8859-1"?> <slide> <title>PECL_GEN</title> - <list title="PECL_Gen is"> + + <blurb>PECL_Gen is</blurb> + <list> <li>an XML based PHP extension code generator</li> <li>replacing the older %ext_skel% script</li> <li>implemented using PHP 5 and PEAR only</li> </list> - <list title="PECL_Gen creates"> + <blurb>it creates</blurb> + <list> <li>functions</li> <li>constants</li> <li>%php.ini% configuration directives</li> http://cvs.php.net/diff.php/presentations/slides/PECL_Gen/examples/x3.snippet?r1=1.1&r2=1.2&ty=u Index: presentations/slides/PECL_Gen/examples/x3.snippet diff -u presentations/slides/PECL_Gen/examples/x3.snippet:1.1 presentations/slides/PECL_Gen/examples/x3.snippet:1.2 --- presentations/slides/PECL_Gen/examples/x3.snippet:1.1 Thu Apr 22 12:14:32 2004 +++ presentations/slides/PECL_Gen/examples/x3.snippet Thu Nov 11 09:57:35 2004 @@ -1,16 +1,14 @@ <extension name="x3"> [...] - <functions> <function name="foobar"> <proto>string foobar(void)</proto> <summary>A dummy function</summary> <description> -This function returns a static string. + This function returns a static string. </description> <code> -RETURN_STRING("foobar", 1); + RETURN_STRING("foobar", 1); </code> </function> - </functions> [...] </extension> \ No newline at end of file http://cvs.php.net/diff.php/presentations/slides/PECL_Gen/examples/x4.snippet?r1=1.1&r2=1.2&ty=u Index: presentations/slides/PECL_Gen/examples/x4.snippet diff -u presentations/slides/PECL_Gen/examples/x4.snippet:1.1 presentations/slides/PECL_Gen/examples/x4.snippet:1.2 --- presentations/slides/PECL_Gen/examples/x4.snippet:1.1 Thu Apr 22 12:14:32 2004 +++ presentations/slides/PECL_Gen/examples/x4.snippet Thu Nov 11 09:57:35 2004 @@ -1,9 +1,8 @@ - <functions> <function name="foobar"> <proto>string foobar(string foo, int bar)</proto> <summary>A dummy function</summary> <description> -This function returns a given string 'foo' 'bar' times. + This function returns a given string 'foo' 'bar' times. </description> <code> <![CDATA[ http://cvs.php.net/co.php/presentations/slides/PECL_Gen/dependencies_1.xml?r=1.1&p=1 Index: presentations/slides/PECL_Gen/dependencies_1.xml +++ presentations/slides/PECL_Gen/dependencies_1.xml <?xml version="1.0" encoding="ISO-8859-1"?> <slide> <title>Headers and Libraries</title> <blurb> Needed header files and libraries are specified using the %&amp;lt;header&amp;gt;% and %&lt;lib&gt;% tags. </blurb> <blurb> %&amp;lt;header&amp;gt;% just takes a filename as it would be used in an %#include% directive. </blurb> <blurb> %&amp;lt;lib&amp;gt;% takes a library basename and the name of a function known to be in the library so that configure can test for it. </blurb> <example filename="examples/deps1.snippet" fontsize="1.5em"/> </slide> http://cvs.php.net/co.php/presentations/slides/PECL_Gen/ext_skel.xml?r=1.1&p=1 Index: presentations/slides/PECL_Gen/ext_skel.xml +++ presentations/slides/PECL_Gen/ext_skel.xml <?xml version="1.0" encoding="ISO-8859-1"?> <slide> <title>ext_skel</title> <blurb> So far the only tool supporting extension writers was ext_skel: </blurb> <list> <li>takes a function prototype list as input</li> <li>requires sh, awk, sed</li> <li>generated code needs manual editing</li> <li>changes are lost on re-running ext_skel</li> </list> </slide> http://cvs.php.net/co.php/presentations/slides/PECL_Gen/extensions.xml?r=1.1&p=1 Index: presentations/slides/PECL_Gen/extensions.xml +++ presentations/slides/PECL_Gen/extensions.xml <?xml version="1.0" encoding="ISO-8859-1"?> <slide> <title>PHP Extensions</title> <blurb fontsize="3em"> PHP supports so called Extensions implemented in C or C++. Extensions can be compiled into PHP itself or loadable at runtime. </blurb> <blurb fontsize="3em"> Extensions can implement PHP functions and classes. </blurb> <blurb fontsize="3em"> Reasons for using an extension instead of plain PHP code are either performance or interfacing to an existing C/C++ library. </blurb> </slide> http://cvs.php.net/co.php/presentations/slides/PECL_Gen/gain.xml?r=1.1&p=1 Index: presentations/slides/PECL_Gen/gain.xml +++ presentations/slides/PECL_Gen/gain.xml <?xml version="1.0" encoding="ISO-8859-1"?> <slide> <title>Your Gain using PECL_Gen</title> <blurb> When looking at lines of code alone PECL_Gen doesn't seem to help that much: </blurb> <example filename="examples/linecount" fontsize="1em"/> <blurb> But you have to take into account that: </blurb> <list> <li>part of the XML lines are just contaniner and end tags</li> <li>the XML parts are less error prone</li> <li>we didn't count documentation generated, package.xml ...</li> </list> </slide> http://cvs.php.net/co.php/presentations/slides/PECL_Gen/loading.php?r=1.1&p=1 Index: presentations/slides/PECL_Gen/loading.php +++ presentations/slides/PECL_Gen/loading.php <?xml version="1.0" encoding="ISO-8859-1"?> <slide> <title>Loading the Extension</title> <blurb> You have now successfully created your new PHP shared extension. To activate it you have to load the extension into PHP. </blurb> <blurb> To load the extension at startup so that it is always available with PHP you have to add an %extension% directive to your %php.ini% file: </blurb> <example filename="examples/x1.php-ini" fontsize="1em"/> <blurb> or the %dl()% function at runtime </blurb> <example filename="examples/x1.dl" fontsize="1em"/> </slide> http://cvs.php.net/co.php/presentations/slides/PECL_Gen/phpinfo.php?r=1.1&p=1 Index: presentations/slides/PECL_Gen/phpinfo.php +++ presentations/slides/PECL_Gen/phpinfo.php <?xml version="1.0" encoding="ISO-8859-1"?> <slide> <title>A fancy %phpinfo()%</title> <blurb> Even without having specified anything but the extensions name we now already have: </blurb> <list> <li>a ready-to-compile source tree</li> <li>a loadable extension module</li> <li>a %phpinfo()% entry</li> </list> <example filename="examples/x1.phpinfo" fontsize="1em"/> <blurb> Nothing really usefull but not too bad for less than five minutes of work. </blurb> </slide> http://cvs.php.net/co.php/presentations/slides/PECL_Gen/examples/deps1.snippet?r=1.1&p=1 Index: presentations/slides/PECL_Gen/examples/deps1.snippet +++ presentations/slides/PECL_Gen/examples/deps1.snippet <deps language="c" platform="unix"> <header name="math.h"/> <lib name="m" function="floor"/> </deps> http://cvs.php.net/co.php/presentations/slides/PECL_Gen/examples/resource.snippet?r=1.1&p=1 Index: presentations/slides/PECL_Gen/examples/resource.snippet +++ presentations/slides/PECL_Gen/examples/resource.snippet <!-- Defining a resource --> <resource name="my_FILE" payload="FILE" alloc="no"> <description> A simple FILE resource </description> <destruct> fclose(resource); </destruct> </resource> <!-- creating and returning a resource --> <function name="my_fopen"> <proto>resource my_FILE my_fopen(string name, string mode)</proto> <code> return_res = fopen(name, mode); if (!return_res) RETURN_FALSE; </code> </function> <!-- removing a resource --> <function name="my_fclose"> <proto>void my_fclose(resoure my_FILE file)</proto> <code> zend_list_delete(Z_LVAL_P(file)); // there should be a Macro </code> </function> <!-- using a resource payload --> <function> <proto>void my_fputs(resource my_FILE file, string text)</proto> <code> fputs(res_file, text); </code> </function>
« previous php.pres (#1086) next »