mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
bcompiler docs: move from peardoc
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@166290 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
c7fe50b784
commit
39a35fd25a
13 changed files with 875 additions and 0 deletions
99
reference/bcompiler/configure.xml
Normal file
99
reference/bcompiler/configure.xml
Normal file
|
@ -0,0 +1,99 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<section id="bcompiler.installation">
|
||||
&reftitle.install;
|
||||
<para>
|
||||
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 PHP 4.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 <filename>bcompiler.tgz</filename> archive into
|
||||
<filename class="directory">php4/ext</filename>.(Get it directly from
|
||||
PECL <ulink url="&url.pecl.package.get;bcompiler">&url.pecl.package.get;bcompiler</ulink>)
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
If the new directory is now called something like bcompiler-0.x, then you
|
||||
should rename it to bcompiler (except you only want to build it as
|
||||
self-contained php-module).
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
If you are using versions before PHP 4.3, the you will need to copy the
|
||||
<filename>Makefile.in.old</filename> to <filename>Makefile.in</filename>
|
||||
and <filename>config.m4.old</filename> to <filename>config.m4</filename>.
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
run <command>phpize</command> in <filename class="directory">
|
||||
ext/bcompiler</filename>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
run <command>./buildconf</command> in <filename class="directory">php4
|
||||
</filename>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
run <command>configure</command> with <option role="configure">
|
||||
--enable-bcompiler</option> (and your other options)
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<command>make; make install</command>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem><simpara>that's it.</simpara></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
54
reference/bcompiler/functions/bcompiler-load-exe.xml
Normal file
54
reference/bcompiler/functions/bcompiler-load-exe.xml
Normal file
|
@ -0,0 +1,54 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<!-- splitted from ./en/functions/bcompiler.xml, last change in rev 1.5 -->
|
||||
<refentry id="function.bcompiler-load-exe">
|
||||
<refnamediv>
|
||||
<refname>bcompiler_load_exe</refname>
|
||||
<refpurpose>reads and creates classes from a bcompiler exe file</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>bcompiler_load_exe</methodname>
|
||||
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
&warn.experimental.func;
|
||||
<para>
|
||||
Reads data from a bcompiler exe file and creates classes from the bytecodes
|
||||
</para>
|
||||
<example>
|
||||
<title><function>bcompiler_load</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
bcompiler_load_exe("/tmp/example.exe");
|
||||
print_r(get_defined_classes());
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
55
reference/bcompiler/functions/bcompiler-load.xml
Normal file
55
reference/bcompiler/functions/bcompiler-load.xml
Normal file
|
@ -0,0 +1,55 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<!-- splitted from ./en/functions/bcompiler.xml, last change in rev 1.5 -->
|
||||
<refentry id="function.bcompiler-load">
|
||||
<refnamediv>
|
||||
<refname>bcompiler_load</refname>
|
||||
<refpurpose>reads and creates classes from a bz compressed file</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>bcompiler_load</methodname>
|
||||
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
&warn.experimental.func;
|
||||
<para>
|
||||
Reads data from a bzcompressed file and creates classes from the bytecodes
|
||||
</para>
|
||||
<example>
|
||||
<title><function>bcompiler_load</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
bcompiler_load("/tmp/example");
|
||||
|
||||
print_r(get_defined_classes());
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
58
reference/bcompiler/functions/bcompiler-parse-class.xml
Normal file
58
reference/bcompiler/functions/bcompiler-parse-class.xml
Normal file
|
@ -0,0 +1,58 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<!-- splitted from ./en/functions/bcompiler.xml, last change in rev -->
|
||||
<refentry id="pecl.bcompiler.parse_class">
|
||||
<refnamediv>
|
||||
<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>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>bcompiler_parse_class</methodname>
|
||||
<methodparam><type>string</type><parameter>class</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>callback</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
&warn.experimental.func;
|
||||
<para>
|
||||
reads the bytecodes of a class and calls back to a user function
|
||||
</para>
|
||||
<example>
|
||||
<title><function>bcompiler_parse_class</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
function readByteCodes($data) {
|
||||
print_r($data);
|
||||
}
|
||||
|
||||
bcompiler_parse_class("DB","readByteCodes");
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
55
reference/bcompiler/functions/bcompiler-read.xml
Normal file
55
reference/bcompiler/functions/bcompiler-read.xml
Normal file
|
@ -0,0 +1,55 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<!-- splitted from ./en/functions/bcompiler.xml, last change in rev 1.5 -->
|
||||
<refentry id="funcion.bcompiler-read">
|
||||
<refnamediv>
|
||||
<refname>bcompiler_read</refname>
|
||||
<refpurpose>reads and creates classes from a filehandle</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>bcompiler_read</methodname>
|
||||
<methodparam><type>resource</type><parameter>filehandle</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
&warn.experimental.func;
|
||||
<para>
|
||||
Reads data from a open file handle and creates classes from the bytecodes
|
||||
</para>
|
||||
<example>
|
||||
<title><function>bcompiler_read</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$fh = fopen("/tmp/example","r");
|
||||
bcompiler_read($fh);
|
||||
fclose($fh);
|
||||
print_r(get_defined_classes());
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
67
reference/bcompiler/functions/bcompiler-write-class.xml
Normal file
67
reference/bcompiler/functions/bcompiler-write-class.xml
Normal file
|
@ -0,0 +1,67 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<!-- splitted from ./en/functions/bcompiler.xml, last change in rev 1.5 -->
|
||||
<refentry id="function.bcompiler-write-class">
|
||||
<refnamediv>
|
||||
<refname>bcompiler_write_class</refname>
|
||||
<refpurpose>Writes an defined class as bytecodes</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>bcompiler_write_class</methodname>
|
||||
<methodparam><type>resource</type><parameter>filehandle</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>className</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
&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>,
|
||||
and <function>bcompiler_write_footer</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
64
reference/bcompiler/functions/bcompiler-write-constant.xml
Normal file
64
reference/bcompiler/functions/bcompiler-write-constant.xml
Normal file
|
@ -0,0 +1,64 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<!-- splitted from ./en/functions/bcompiler.xml, last change in rev 1.5 -->
|
||||
<refentry id="function.bcompiler-write-constant">
|
||||
<refnamediv>
|
||||
<refname>bcompiler_write_constant</refname>
|
||||
<refpurpose>Writes a defined constant as bytecodes</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>bcompiler_write_constant</methodname>
|
||||
<methodparam><type>resource</type><parameter>filehandle</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>constantName</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
&warn.experimental.func;
|
||||
<para>
|
||||
This function reads the bytecodes from PHP for an existing constant, and
|
||||
writes them to the open file handle.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>bcompiler_write_constant</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
define("MODULE_MAX", 30);
|
||||
|
||||
$fh = fopen("/tmp/example","w");
|
||||
bcompiler_write_header($fh);
|
||||
bcompiler_write_constant($fh,"MODULE_MAX");
|
||||
bcompiler_write_footer($fh);
|
||||
fclose($fh);
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
See also <function>bcompiler_write_header</function>,
|
||||
and <function>bcompiler_write_footer</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
84
reference/bcompiler/functions/bcompiler-write-exe-footer.xml
Normal file
84
reference/bcompiler/functions/bcompiler-write-exe-footer.xml
Normal file
|
@ -0,0 +1,84 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<!-- splitted from ./en/functions/bcompiler.xml, last change in rev 1.5 -->
|
||||
<refentry id="function.bcompiler-write-exe-footer">
|
||||
<refnamediv>
|
||||
<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>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>bcompiler_write_exe_footer</methodname>
|
||||
<methodparam><type>resource</type><parameter>filehandle</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>startpos</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
&warn.experimental.func;
|
||||
<para>
|
||||
An EXE (or self executable) file consists of 3 parts,
|
||||
</para>
|
||||
<para>
|
||||
<simplelist>
|
||||
<member>
|
||||
The Executable code (eg. a compiled C program that can initiate call
|
||||
the PHP bcompiler)
|
||||
</member>
|
||||
<member>The Bzip encoded Bytecodes</member>
|
||||
<member>The bcompiler exe footer</member>
|
||||
</simplelist>
|
||||
The <parameter>startpos</parameter> is the position of in the file at
|
||||
which the Bzip encoded bytecodes start, and can be obtained using
|
||||
ftell($fh).
|
||||
</para>
|
||||
<example>
|
||||
<title><function>bcompiler_write_footer</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$fh = fopen("/tmp/example.exe","w");
|
||||
$size = filesize("/tmp/base.exe");
|
||||
$fr = fopen("/tmp/base.exe","r");
|
||||
fwrite($fh,fread($fr,$size),$size);
|
||||
$startpos = ftell($fh);
|
||||
/* write bytecodes compressed */
|
||||
$fz = bzopen($fh,"w");
|
||||
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);
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
See also <function>bcompiler_write_header</function>,
|
||||
<function>bcompiler_write_class</function>, and
|
||||
<function>bcompiler_write_footer</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
61
reference/bcompiler/functions/bcompiler-write-footer.xml
Normal file
61
reference/bcompiler/functions/bcompiler-write-footer.xml
Normal file
|
@ -0,0 +1,61 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<!-- splitted from ./en/functions/bcompiler.xml, last change in rev 1.5 -->
|
||||
<refentry id="function.bcompiler-write-footer">
|
||||
<refnamediv>
|
||||
<refname>bcompiler_write_footer</refname>
|
||||
<refpurpose>Writes the single character \x00 to indicate End of compiled data</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>bcompiler_write_footer</methodname>
|
||||
<methodparam><type>resource</type><parameter>filehandle</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
&warn.experimental.func;
|
||||
<para>
|
||||
Writes the a single character \x00 to indicate End of compiled data
|
||||
</para>
|
||||
<example>
|
||||
<title><function>bcompiler_write_footer</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$fh = fopen("/tmp/example","w");
|
||||
bcompiler_write_header($fh);
|
||||
bcompiler_write_class($fh,"DB");
|
||||
bcompiler_write_class($fh,"DB_common");
|
||||
bcompiler_write_footer($fh);
|
||||
fclose($fh);
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
See also <function>bcompiler_write_header</function>, and
|
||||
<function>bcompiler_write_header</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
65
reference/bcompiler/functions/bcompiler-write-function.xml
Normal file
65
reference/bcompiler/functions/bcompiler-write-function.xml
Normal file
|
@ -0,0 +1,65 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<!-- splitted from ./en/functions/bcompiler.xml, last change in rev 1.5 -->
|
||||
<refentry id="function.bcompiler-write-function">
|
||||
<refnamediv>
|
||||
<refname>bcompiler_write_function</refname>
|
||||
<refpurpose>Writes an defined function as bytecodes</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>bcompiler_write_function</methodname>
|
||||
<methodparam><type>resource</type><parameter>filehandle</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>functionName</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
&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>, and
|
||||
<function>bcompiler_write_footer</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
|
@ -0,0 +1,65 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<!-- splitted from ./en/functions/bcompiler.xml, last change in rev 1.5 -->
|
||||
<refentry id="function.bcompiler-write-functions-from-file">
|
||||
<refnamediv>
|
||||
<refname>bcompiler_write_functions_from_file</refname>
|
||||
<refpurpose>Writes all functions defined in a file as bytecodes</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>bcompiler_write_functions_from_file</methodname>
|
||||
<methodparam><type>resource</type><parameter>filehandle</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>fileName</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
&warn.experimental.func;
|
||||
<para>
|
||||
This function searches for all functions declared in the given file, and
|
||||
writes their correspondent bytecodes to the open file handle. Always
|
||||
remember to include/require the file you intend to compile.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>bcompiler_write_functions_from_file</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
require('module.php');
|
||||
|
||||
$fh = fopen("/tmp/example","w");
|
||||
bcompiler_write_header($fh);
|
||||
bcompiler_write_functions_from_file($fh,'module.php');
|
||||
bcompiler_write_footer($fh);
|
||||
fclose($fh);
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
See also <function>bcompiler_write_header</function>, and
|
||||
<function>bcompiler_write_footer</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
60
reference/bcompiler/functions/bcompiler-write-header.xml
Normal file
60
reference/bcompiler/functions/bcompiler-write-header.xml
Normal file
|
@ -0,0 +1,60 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<!-- splitted from ./en/functions/bcompiler.xml, last change in rev 1.5 -->
|
||||
<refentry id="function.bcompiler-write-header">
|
||||
<refnamediv>
|
||||
<refname>bcompiler_write_header</refname>
|
||||
<refpurpose>Writes the bcompiler header</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>bcompiler_write_header</methodname>
|
||||
<methodparam><type>resource</type><parameter>filehandle</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
&warn.experimental.func;
|
||||
<para>
|
||||
Writes the header part of a bcompiler file.
|
||||
</para>
|
||||
<example>
|
||||
<title><function>bcompiler_write_header</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$fh = fopen("/tmp/example","w");
|
||||
bcompiler_write_header($fh);
|
||||
bcompiler_write_class($fh,"DB");
|
||||
bcompiler_write_footer($fh);
|
||||
fclose($fh);
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
See also <function>bcompiler_write_class</function>, and
|
||||
<function>bcompiler_write_footer</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
88
reference/bcompiler/reference.xml
Normal file
88
reference/bcompiler/reference.xml
Normal file
|
@ -0,0 +1,88 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<reference id="ref.bcompiler">
|
||||
<title>PHP bytecode Compiler</title>
|
||||
<titleabbrev>bcompiler</titleabbrev>
|
||||
|
||||
<partintro>
|
||||
<section id="bcompiler.intro">
|
||||
&reftitle.intro;
|
||||
&warn.experimental;
|
||||
<para>
|
||||
Bcompiler was written for two reasons:
|
||||
<simplelist>
|
||||
<member>To encode some classes in a proprietary PHP application</member>
|
||||
<member>
|
||||
To enable the production of php-gtk applications that could be used on
|
||||
client desktops, without the need for a php.exe.
|
||||
</member>
|
||||
<member>To do the feasibility study for a PHP to C converter</member>
|
||||
</simplelist>
|
||||
The first of these goals is achieved using the
|
||||
<function>bcompiler_write_header</function>,
|
||||
<function>bcompiler_write_class</function>,
|
||||
<function>bcompiler_write_footer</function>,
|
||||
<function>bcompiler_read</function>,
|
||||
and <function>bcompiler_load</function> functions. The bytecode files can
|
||||
be written as either uncompressed or plain. The
|
||||
<function>bcompiler_load</function> reads a bzip compressed bytecode file,
|
||||
which tends to be 1/3 of the size of the original file.
|
||||
</para>
|
||||
<para>
|
||||
To create EXE type files, bcompiler has to be used with a modified sapi
|
||||
file or a version of PHP which has been compiled as a shared library. In
|
||||
this scenario, bcompiler reads the compressed bytecode from the end of the
|
||||
exe file.
|
||||
</para>
|
||||
<para>
|
||||
bcompiler is unlikely to improve performance very much, as it only
|
||||
bypasses the compiler stage of the PHP running process and replaces it
|
||||
with the import process in bcompiler. It also does not do any bytecode
|
||||
optimization, this could be added in the future.
|
||||
</para>
|
||||
<para>
|
||||
In terms of code protection, it is safe to say that it would be impossible
|
||||
to recreate the exact source code that it was built from, and without the
|
||||
accompanying source code comments. It would effectively be useless to use
|
||||
the bcompiler bytecodes to recreate and modify a class. However it is
|
||||
possible to retrieve data from a bcompiled bytecode file - so don't put
|
||||
your private passwords or anything in it.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
&reference.bcompiler.configure;
|
||||
|
||||
<section id="bcompiler.contact">
|
||||
<title>Contact Information</title>
|
||||
<para>
|
||||
If you have comments, bugfixes, enhancements or want to help
|
||||
developing this beast, you can drop me a mail at <ulink
|
||||
url="mailto:alan_k@php.net">alan_k@php.net</ulink>. Any help is very
|
||||
welcome.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
</partintro>
|
||||
|
||||
&reference.bcompiler.functions;
|
||||
|
||||
</reference>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
Loading…
Reference in a new issue