Hello,

This is my first patch for the PHP documentation. I've just started writing extensions for PHP and found that documentation is quite limited. So I've started with describing functions as soon as I got them working. This first one is for the call_user_function ZEND API docs. If these kind of documentations look useful, just let me know and there'll probably be more.

Ron

PS. For now I'm not on the phpdoc list, I'll join if you decide my patches are worth anything. But until then, please just cc me in any reply. PS. make test worked find with the patch, however I couldn't preview the file since the tip in the doc howto chapter 16 doesn't seem to work.
Index: call_user_function.xml
===================================================================
RCS file: 
/repository/phpdoc/en/internals/zendapi/functions/call_user_function.xml,v
retrieving revision 1.5
diff -u -u -r1.5 call_user_function.xml
--- call_user_function.xml      15 Jan 2006 00:43:54 -0000      1.5
+++ call_user_function.xml      25 Oct 2006 11:08:42 -0000
@@ -3,7 +3,7 @@
 <refentry id="zend-api.call-user-function">
  <refnamediv>
   <refname>call_user_function</refname>
-  <refpurpose>...</refpurpose>
+  <refpurpose>Call a function in PHP userspace</refpurpose>
  </refnamediv>
 
  <refsect1 role="description">
@@ -40,7 +40,7 @@
      <term><parameter>object_pp</parameter></term>
      <listitem>
       <para>
-       ...
+       When calling a method, the object to use.
       </para>
      </listitem>
     </varlistentry>
@@ -48,7 +48,8 @@
      <term><parameter>function_name</parameter></term>
      <listitem>
       <para>
-       ...
+       The function (or method if object_pp is not null) to call. A zval of
+       type IS_STRING.
       </para>
      </listitem>
     </varlistentry>
@@ -56,7 +57,7 @@
      <term><parameter>retval_ptr</parameter></term>
      <listitem>
       <para>
-       ...
+       zval that will contain the return value of function_name
       </para>
      </listitem>
     </varlistentry>
@@ -64,7 +65,7 @@
      <term><parameter>param_count</parameter></term>
      <listitem>
       <para>
-       ...
+       Number of arguments to pass to function_name
       </para>
      </listitem>
     </varlistentry>
@@ -72,7 +73,8 @@
      <term><parameter>params[]</parameter></term>
      <listitem>
       <para>
-       ...
+       Array of zval with the parameters to pass to function. Only the first
+       param_count entries will be passed on.       
       </para>
      </listitem>
     </varlistentry>
@@ -91,7 +93,34 @@
  <refsect1 role="returnvalues">
   &reftitle.returnvalues;
   <para>
-   ...
+   int - SUCCESS if the function call succeeded
+  </para>
+ </refsect1>
+
+ <refsect1 role="examples">
+  &reftitle.examples;
+  <para>
+   <example>
+    <title>Example call of a function</title>
+    <programlisting role="c">
+<![CDATA[
+
+zval retval, *function_name;
+
+MAKE_STD_ZVAL(function_name);
+
+Z_TYPE_P(function_name) = IS_STRING;
+Z_STRVAL_P(function_name) = "helloWorld";
+Z_STRLEN_P(function_name) = 10;
+
+if (call_user_function(EG(function_table), NULL, function_name, &retval, 0,
+ null) != SUCCESS) {
+  zend_error(E_ERROR, "Calling of function helloWorld failed.");
+}
+
+]]>
+    </programlisting>
+   </example>
   </para>
  </refsect1>
 

Reply via email to