cvs: peardoc /en/pecl bcompiler.xml

From: Date: Tue, 14 Jan 2003 02:40:48 +0000
Subject: cvs: peardoc /en/pecl bcompiler.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-259@lists.php.net to get a copy of this message
alan_k Mon Jan 13 21:40:48 2003 EDT Modified files: /peardoc/en/pecl bcompiler.xml Log: fixes to becompiler docs, and added the two missing funciton docs.

Index: peardoc/en/pecl/bcompiler.xml diff -u peardoc/en/pecl/bcompiler.xml:1.1 peardoc/en/pecl/bcompiler.xml:1.2 --- peardoc/en/pecl/bcompiler.xml:1.1 Wed Jul 31 06:13:54 2002 +++ peardoc/en/pecl/bcompiler.xml Mon Jan 13 21:40:48 2003 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <reference id="pecl.bcompiler"> - <title>bcompiler</title> + <title>PHP bytecode Compiler</title> <titleabbrev>bcompiler</titleabbrev> <partintro> &warn.experimental; @@ -47,6 +47,11 @@ short installation note: <itemizedlist> <listitem><simpara>You need at least PHP 4.3. for the compression to work</simpara></listitem> + <listitem><simpara>To install on PHP4.3 and later at the unix command prompt type <command>pear install bcompiler</command></simpara></listitem> + <listitem><simpara>To install on Windows, until the binary package distribution mechanism is finished please search the archives of + the pear-general mailing list for pre-built packages. (or send an email to it if you could not find a reference)</simpara></listitem> + <listitem><simpara>To install on older versions you need to make some slight changes + to the build</simpara></listitem> <listitem> <simpara> untar the bcompiler.tgz archive into php4/ext (Get it directly from PEAR @@ -63,7 +68,7 @@ </listitem> <listitem> <simpara> - If you are using php-4.2,2 or less, the you will need to copy the Makefile.in.old to Makefile.in and + If you are using versions before PHP4.3, the you will need to copy the Makefile.in.old to Makefile.in and config.m4.old to config.m4 </simpara> </listitem> @@ -71,7 +76,7 @@ <listitem><simpara>run ./buildconf in php4</simpara></listitem> <listitem> <simpara> - run configure with --with-bcompiler (and your other options) + run configure with --enable-bcompiler (and your other options) </simpara> </listitem> <listitem><simpara>make; make install</simpara></listitem> @@ -98,20 +103,113 @@ </partintro> +<!-- class --> + + + <refentry id="pecl.bcompiler.bcompile-write-class"> + <refnamediv> + <refname>bcompiler_write_class</refname> + <refpurpose>Writes an defined class as bytecodes</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef><function>bcompiler_write_class</function></funcdef> + <paramdef>resource <parameter>filehandle</parameter></paramdef> + <paramdef>string <parameter>className</parameter></paramdef> + </funcprototype> + </funcsynopsis> + &warn.experimental.func; + <para> + This reads the bytecodes from PHP for an existing class, and writes them to the + open file handle, It does not perform dependancy checking, so make sure you + write the classes in an order that will not result in an 'undefined class' + occuring when you load it. + </para> + <example> + <title><function>bcompiler_write_class</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +$fh = fopen("/tmp/example","w"); +bcompiler_write_header($fh); +bcompiler_write_class($fh,"DB"); +// you must write DB_common before DB_mysql, as DB_mysql extends DB_common. +bcompiler_write_class($fh,"DB_common"); +bcompiler_write_class($fh,"DB_mysql"); +bcompiler_write_footer($fh); +fclose($fh); + +?> +]]> + </programlisting> + </example> + <para> + See also: <function>bcompiler_write_header</function>, <function>bcompiler_write_footer</function>. + </para> + </refsect1> + </refentry> + + +<!-- function --> + + + <refentry id="pecl.bcompiler.bcompile-write-function"> + <refnamediv> + <refname>bcompiler_write_function</refname> + <refpurpose>Writes an defined function as bytecodes</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef><function>bcompiler_write_function</function></funcdef> + <paramdef>resource <parameter>filehandle</parameter></paramdef> + <paramdef>string <parameter>functionName</parameter></paramdef> + </funcprototype> + </funcsynopsis> + &warn.experimental.func; + <para> + This reads the bytecodes from PHP for an existing function, and writes them to the + open file handle. Order is not important, (eg. if function b uses function a, and you + compile it like the example below, it will work perfectly OK) + </para> + <example> + <title><function>bcompiler_write_function</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +$fh = fopen("/tmp/example","w"); +bcompiler_write_header($fh); +bcompiler_write_function($fh,"my_function_a"); +bcompiler_write_function($fh,"my_function_b"); +bcompiler_write_footer($fh); +fclose($fh); + +?> +]]> + </programlisting> + </example> + <para> + See also: <function>bcompiler_write_header</function>, <function>bcompiler_write_footer</function>. + </para> + </refsect1> + </refentry> <!-- header --> <refentry id="pecl.bcompiler.bcompile-write-header"> <refnamediv> - <refname>bcompile_write_header</refname> + <refname>bcompiler_write_header</refname> <refpurpose>Writes the bcompiler header</refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef><function>bcompile_write_header</function></funcdef> + <funcdef><function>bcompiler_write_header</function></funcdef> <paramdef>resource <parameter>filehandle</parameter></paramdef> </funcprototype> </funcsynopsis> @@ -120,14 +218,14 @@ Writes the header part of a bcompiler file. </para> <example> - <title><function>bcompile_write_header</function> example</title> + <title><function>bcompiler_write_header</function> example</title> <programlisting role="php"> <![CDATA[ <?php $fh = fopen("/tmp/example","w"); -bcompile_write_header($fh); -bcompile_write_class($fh,"DB"); -bcompile_write_footer($fh); +bcompiler_write_header($fh); +bcompiler_write_class($fh,"DB"); +bcompiler_write_footer($fh); fclose($fh); ?> @@ -135,7 +233,7 @@ </programlisting> </example> <para> - See also: <function>bcompile_write_class</function>, <function>bcompile_write_footer</function>. + See also: <function>bcompiler_write_class</function>, <function>bcompiler_write_footer</function>. </para> </refsect1> </refentry> @@ -147,14 +245,14 @@ <refentry id="pecl.bcompiler.bcompile-write-footer"> <refnamediv> - <refname>bcompile_write_footer</refname> + <refname>bcompiler_write_footer</refname> <refpurpose>Writes the a single character \x00 to indicate End of compiled data</refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef><function>bcompile_write_footer</function></funcdef> + <funcdef><function>bcompiler_write_footer</function></funcdef> <paramdef>resource <parameter>filehandle</parameter></paramdef> </funcprototype> </funcsynopsis> @@ -163,15 +261,15 @@ Writes the a single character \x00 to indicate End of compiled data </para> <example> - <title><function>bcompile_write_footer</function> example</title> + <title><function>bcompiler_write_footer</function> example</title> <programlisting role="php"> <![CDATA[ <?php $fh = fopen("/tmp/example","w"); -bcompile_write_header($fh); -bcompile_write_class($fh,"DB"); -bcompile_write_class($fh,"DB_common"); -bcompile_write_footer($fh); +bcompiler_write_header($fh); +bcompiler_write_class($fh,"DB"); +bcompiler_write_class($fh,"DB_common"); +bcompiler_write_footer($fh); fclose($fh); ?> @@ -179,7 +277,7 @@ </programlisting> </example> <para> - See also: <function>bcompile_write_header</function>, <function>bcompile_write_header</function>. + See also: <function>bcompiler_write_header</function>, <function>bcompiler_write_header</function>. </para> </refsect1> </refentry> @@ -194,14 +292,14 @@ <refentry id="pecl.bcompiler.bcompile-write-exe-footer"> <refnamediv> - <refname>bcompile_write_exe_footer</refname> + <refname>bcompiler_write_exe_footer</refname> <refpurpose>Writes the the start pos, and sig to the end of a exe type file</refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef><function>bcompile_write_exe_footer</function></funcdef> + <funcdef><function>bcompiler_write_exe_footer</function></funcdef> <paramdef>resource <parameter>filehandle</parameter></paramdef> <paramdef>int <parameter>startpos</parameter></paramdef> </funcprototype> @@ -221,7 +319,7 @@ ftell($fh), </para> <example> - <title><function>bcompile_write_footer</function> example</title> + <title><function>bcompiler_write_footer</function> example</title> <programlisting role="php"> <![CDATA[ <?php @@ -232,10 +330,10 @@ $startpos = ftell($fh); /* write bytecodes compressed */ $fz = bzopen($fh,"w"); -bcompile_write_header($fz); -bcompile_write_class($fz,"DB"); -bcompile_write_class($fz,"DB_common"); -bcompile_write_footer($fz); +bcompiler_write_header($fz); +bcompiler_write_class($fz,"DB"); +bcompiler_write_class($fz,"DB_common"); +bcompiler_write_footer($fz); /* write footer exe uncompressed */ bcompiler_write_exe_footer($fh,$startpos); fclose($fh); @@ -245,7 +343,7 @@ </programlisting> </example> <para> - See also:<function>bcompile_write_header</function> <function>bcompile_write_class</function>, <function>bcompile_write_footer</function>. + See also:<function>bcompiler_write_header</function> <function>bcompiler_write_class</function>, <function>bcompiler_write_footer</function>. </para> </refsect1> </refentry> @@ -258,14 +356,14 @@ <refentry id="pecl.bcompiler.bcompile-read"> <refnamediv> - <refname>bcompile_read</refname> + <refname>bcompiler_read</refname> <refpurpose>reads and creates classes from a filehandle</refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef><function>bcompile_read</function></funcdef> + <funcdef><function>bcompiler_read</function></funcdef> <paramdef>resource <parameter>filehandle</parameter></paramdef> </funcprototype> </funcsynopsis> @@ -274,12 +372,12 @@ Reads data from a open file handle and creates classes from the bytecodes </para> <example> - <title><function>bcompile_read</function> example</title> + <title><function>bcompiler_read</function> example</title> <programlisting role="php"> <![CDATA[ <?php $fh = fopen("/tmp/example","r"); -bcompile_read($fh); +bcompiler_read($fh); fclose($fh); print_r(get_defined_classes()); @@ -297,14 +395,14 @@ <refentry id="pecl.bcompiler.bcompile-load"> <refnamediv> - <refname>bcompile_load</refname> + <refname>bcompiler_load</refname> <refpurpose>reads and creates classes from a bz compressed file</refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef><function>bcompile_load</function></funcdef> + <funcdef><function>bcompiler_load</function></funcdef> <paramdef>string <parameter>filename</parameter></paramdef> </funcprototype> </funcsynopsis> @@ -313,12 +411,12 @@ Reads data from a bzcompressed file and creates classes from the bytecodes </para> <example> - <title><function>bcompile_load</function> example</title> + <title><function>bcompiler_load</function> example</title> <programlisting role="php"> <![CDATA[ <?php -bcompile_load("/tmp/example"); +bcompiler_load("/tmp/example"); print_r(get_defined_classes()); @@ -336,14 +434,14 @@ <refentry id="pecl.bcompiler.bcompile-load-exe"> <refnamediv> - <refname>bcompile_load_exe</refname> + <refname>bcompiler_load_exe</refname> <refpurpose>reads and creates classes from a bcompiler exe file</refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef><function>bcompile_load_exe</function></funcdef> + <funcdef><function>bcompiler_load_exe</function></funcdef> <paramdef>string <parameter>filename</parameter></paramdef> </funcprototype> </funcsynopsis> @@ -352,12 +450,12 @@ Reads data from a bcompiler exe file and creates classes from the bytecodes </para> <example> - <title><function>bcompile_load</function> example</title> + <title><function>bcompiler_load</function> example</title> <programlisting role="php"> <![CDATA[ <?php -bcompile_load_exe("/tmp/example.exe"); +bcompiler_load_exe("/tmp/example.exe"); print_r(get_defined_classes()); ?> @@ -375,14 +473,14 @@ <refentry id="pecl.bcompiler.parse_class"> <refnamediv> - <refname>bcompile_parse_class</refname> + <refname>bcompiler_parse_class</refname> <refpurpose>reads the bytecodes of a class and calls back to a user function</refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef><function>bcompile_parse_class</function></funcdef> + <funcdef><function>bcompiler_parse_class</function></funcdef> <paramdef>string <parameter>class</parameter></paramdef> <paramdef>string <parameter>callback</parameter></paramdef> </funcprototype> @@ -392,7 +490,7 @@ reads the bytecodes of a class and calls back to a user function </para> <example> - <title><function>bcompile_parse_class</function> example</title> + <title><function>bcompiler_parse_class</function> example</title> <programlisting role="php"> <![CDATA[ <?php @@ -401,7 +499,7 @@ print_r($data); } -bcompile_parse_class("DB","readByteCodes"); +bcompiler_parse_class("DB","readByteCodes"); ?>
« previous php.pear.doc (#259) next »