You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by hu...@apache.org on 2012/04/24 20:12:25 UTC

svn commit: r1329909 - in /httpd/httpd/trunk/docs/manual/developer: hooks.html.en hooks.xml modguide.html.en output-filters.html.en output-filters.xml request.html.en request.xml

Author: humbedooh
Date: Tue Apr 24 18:12:25 2012
New Revision: 1329909

URL: http://svn.apache.org/viewvc?rev=1329909&view=rev
Log:
Changing to the new syntax highlighting WRT C source code

Modified:
    httpd/httpd/trunk/docs/manual/developer/hooks.html.en
    httpd/httpd/trunk/docs/manual/developer/hooks.xml
    httpd/httpd/trunk/docs/manual/developer/modguide.html.en
    httpd/httpd/trunk/docs/manual/developer/output-filters.html.en
    httpd/httpd/trunk/docs/manual/developer/output-filters.xml
    httpd/httpd/trunk/docs/manual/developer/request.html.en
    httpd/httpd/trunk/docs/manual/developer/request.xml

Modified: httpd/httpd/trunk/docs/manual/developer/hooks.html.en
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/developer/hooks.html.en?rev=1329909&r1=1329908&r2=1329909&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/developer/hooks.html.en (original)
+++ httpd/httpd/trunk/docs/manual/developer/hooks.html.en Tue Apr 24 18:12:25 2012
@@ -49,9 +49,10 @@
       arguments. For example, if the hook returns an <code>int</code> and
       takes a <code>request_rec *</code> and an <code>int</code> and is
       called <code>do_something</code>, then declare it like this:</p>
-      <div class="example"><p><code>
+      <pre class="prettyprint lang-c">
         AP_DECLARE_HOOK(int, do_something, (request_rec *r, int n))
-      </code></p></div>
+      </pre>
+
 
       <p>This should go in a header which modules will include if
       they want to use the hook.</p>
@@ -62,14 +63,13 @@
       which is used to record the module functions that use the hook.
       This is declared as follows:</p>
 
-      <div class="example"><p><code>
-        APR_HOOK_STRUCT(<br />
-        <span class="indent">
-          APR_HOOK_LINK(do_something)<br />
-          ...<br />
-        </span>
+      <pre class="prettyprint lang-c">
+        APR_HOOK_STRUCT(
+          APR_HOOK_LINK(do_something)
+          ...
         )
-      </code></p></div>
+      </pre>
+
     
 
     <h3><a name="create-implement" id="create-implement">Implement the hook caller</a></h3>
@@ -82,33 +82,34 @@
         <p>If the return value of a hook is <code>void</code>, then all the
         hooks are called, and the caller is implemented like this:</p>
 
-        <div class="example"><p><code>
+        <pre class="prettyprint lang-c">
           AP_IMPLEMENT_HOOK_VOID(do_something, (request_rec *r, int n), (r, n))
-        </code></p></div>
+        </pre>
+
 
         <p>The second and third arguments are the dummy argument
         declaration and the dummy arguments as they will be used when
         calling the hook. In other words, this macro expands to
         something like this:</p>
 
-        <div class="example"><p><code>
-          void ap_run_do_something(request_rec *r, int n)<br />
-          {<br />
-          <span class="indent">
-            ...<br />
-            do_something(r, n);<br />
-          </span>
+        <pre class="prettyprint lang-c">
+          void ap_run_do_something(request_rec *r, int n)
+          {
+            ...
+            do_something(r, n);
           }
-        </code></p></div>
+        </pre>
+
       
 
       <h4>Hooks that return a value</h4>
         <p>If the hook returns a value, then it can either be run until
         the first hook that does something interesting, like so:</p>
 
-        <div class="example"><p><code>
+        <pre class="prettyprint lang-c">
           AP_IMPLEMENT_HOOK_RUN_FIRST(int, do_something, (request_rec *r, int n), (r, n), DECLINED)
-        </code></p></div>
+        </pre>
+
 
         <p>The first hook that does <em>not</em> return <code>DECLINED</code>
         stops the loop and its return value is returned from the hook
@@ -123,9 +124,10 @@
         value other than one of those two stops the loop, and its
         return is the return value. Declare these like so:</p>
 
-        <div class="example"><p><code>
+        <pre class="prettyprint lang-c">
           AP_IMPLEMENT_HOOK_RUN_ALL(int, do_something, (request_rec *r, int n), (r, n), OK, DECLINED)
-        </code></p></div>
+        </pre>
+
 
         <p>Again, <code>OK</code> and <code>DECLINED</code> are the traditional
         values. You can use what you want.</p>
@@ -136,12 +138,13 @@
       <p>At appropriate moments in the code, call the hook caller,
       like so:</p>
 
-      <div class="example"><p><code>
-        int n, ret;<br />
-        request_rec *r;<br />
-        <br />
+      <pre class="prettyprint lang-c">
+        int n, ret;
+        request_rec *r;
+
         ret=ap_run_do_something(r, n);
-      </code></p></div>
+      </pre>
+
     
 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
 <div class="section">
@@ -153,15 +156,14 @@
       <p>Include the appropriate header, and define a static function
       of the correct type:</p>
 
-      <div class="example"><p><code>
+      <pre class="prettyprint lang-c">
         static int my_something_doer(request_rec *r, int n)<br />
-        {<br />
-        <span class="indent">
-          ...<br />
-          return OK;<br />
-        </span>
+        {
+          ...
+          return OK;
         }
-      </code></p></div>
+      </pre>
+
     
 
     <h3><a name="hooking-add" id="hooking-add">Add a hook registering function</a></h3>
@@ -169,22 +171,19 @@
       registering function, which is included in the module
       structure:</p>
 
-      <div class="example"><p><code>
-        static void my_register_hooks()<br />
-        {<br />
-        <span class="indent">
-          ap_hook_do_something(my_something_doer, NULL, NULL, APR_HOOK_MIDDLE);<br />
-        </span>
-        }<br />
-        <br />
-        mode MODULE_VAR_EXPORT my_module =<br />
-        {<br />
-        <span class="indent">
-          ...<br />
-          my_register_hooks       /* register hooks */<br />
-        </span>
+      <pre class="prettyprint lang-c">
+        static void my_register_hooks()
+        {
+          ap_hook_do_something(my_something_doer, NULL, NULL, APR_HOOK_MIDDLE);
+        }
+
+        mode MODULE_VAR_EXPORT my_module =
+        {
+          ...
+          my_register_hooks       /* register hooks */
         };
-      </code></p></div>
+      </pre>
+
     
 
     <h3><a name="hooking-order" id="hooking-order">Controlling hook calling order</a></h3>
@@ -216,16 +215,15 @@
       example, suppose we want "mod_xyz.c" and "mod_abc.c" to run
       before we do, then we'd hook as follows:</p>
 
-      <div class="example"><p><code>
-        static void register_hooks()<br />
-        {<br />
-        <span class="indent">
-          static const char * const aszPre[] = { "mod_xyz.c", "mod_abc.c", NULL };<br />
-          <br />
-          ap_hook_do_something(my_something_doer, aszPre, NULL, APR_HOOK_MIDDLE);<br />
-        </span>
+      <pre class="prettyprint lang-c">
+        static void register_hooks()
+        {
+          static const char * const aszPre[] = { "mod_xyz.c", "mod_abc.c", NULL };
+
+          ap_hook_do_something(my_something_doer, aszPre, NULL, APR_HOOK_MIDDLE);
         }
-      </code></p></div>
+      </pre>
+
 
       <p>Note that the sort used to achieve this is stable, so
       ordering set by <code>APR_HOOK_<var>ORDER</var></code> is preserved, as far

Modified: httpd/httpd/trunk/docs/manual/developer/hooks.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/developer/hooks.xml?rev=1329909&r1=1329908&r2=1329909&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/developer/hooks.xml (original)
+++ httpd/httpd/trunk/docs/manual/developer/hooks.xml Tue Apr 24 18:12:25 2012
@@ -47,9 +47,9 @@
       arguments. For example, if the hook returns an <code>int</code> and
       takes a <code>request_rec *</code> and an <code>int</code> and is
       called <code>do_something</code>, then declare it like this:</p>
-      <example>
+      <highlight language="c">
         AP_DECLARE_HOOK(int, do_something, (request_rec *r, int n))
-      </example>
+      </highlight>
 
       <p>This should go in a header which modules will include if
       they want to use the hook.</p>
@@ -60,14 +60,12 @@
       which is used to record the module functions that use the hook.
       This is declared as follows:</p>
 
-      <example>
-        APR_HOOK_STRUCT(<br />
-        <indent>
-          APR_HOOK_LINK(do_something)<br />
-          ...<br />
-        </indent>
+      <highlight language="c">
+        APR_HOOK_STRUCT(
+          APR_HOOK_LINK(do_something)
+          ...
         )
-      </example>
+      </highlight>
     </section>
 
     <section id="create-implement"><title>Implement the hook caller</title>
@@ -80,33 +78,31 @@
         <p>If the return value of a hook is <code>void</code>, then all the
         hooks are called, and the caller is implemented like this:</p>
 
-        <example>
+        <highlight language="c">
           AP_IMPLEMENT_HOOK_VOID(do_something, (request_rec *r, int n), (r, n))
-        </example>
+        </highlight>
 
         <p>The second and third arguments are the dummy argument
         declaration and the dummy arguments as they will be used when
         calling the hook. In other words, this macro expands to
         something like this:</p>
 
-        <example>
-          void ap_run_do_something(request_rec *r, int n)<br />
-          {<br />
-          <indent>
-            ...<br />
-            do_something(r, n);<br />
-          </indent>
+        <highlight language="c">
+          void ap_run_do_something(request_rec *r, int n)
+          {
+            ...
+            do_something(r, n);
           }
-        </example>
+        </highlight>
       </section>
 
       <section><title>Hooks that return a value</title>
         <p>If the hook returns a value, then it can either be run until
         the first hook that does something interesting, like so:</p>
 
-        <example>
+        <highlight language="c">
           AP_IMPLEMENT_HOOK_RUN_FIRST(int, do_something, (request_rec *r, int n), (r, n), DECLINED)
-        </example>
+        </highlight>
 
         <p>The first hook that does <em>not</em> return <code>DECLINED</code>
         stops the loop and its return value is returned from the hook
@@ -121,9 +117,9 @@
         value other than one of those two stops the loop, and its
         return is the return value. Declare these like so:</p>
 
-        <example>
+        <highlight language="c">
           AP_IMPLEMENT_HOOK_RUN_ALL(int, do_something, (request_rec *r, int n), (r, n), OK, DECLINED)
-        </example>
+        </highlight>
 
         <p>Again, <code>OK</code> and <code>DECLINED</code> are the traditional
         values. You can use what you want.</p>
@@ -134,12 +130,12 @@
       <p>At appropriate moments in the code, call the hook caller,
       like so:</p>
 
-      <example>
-        int n, ret;<br />
-        request_rec *r;<br />
-        <br />
+      <highlight language="c">
+        int n, ret;
+        request_rec *r;
+
         ret=ap_run_do_something(r, n);
-      </example>
+      </highlight>
     </section>
 </section>
 
@@ -151,15 +147,13 @@
       <p>Include the appropriate header, and define a static function
       of the correct type:</p>
 
-      <example>
+      <highlight language="c">
         static int my_something_doer(request_rec *r, int n)<br />
-        {<br />
-        <indent>
-          ...<br />
-          return OK;<br />
-        </indent>
+        {
+          ...
+          return OK;
         }
-      </example>
+      </highlight>
     </section>
 
     <section id="hooking-add"><title>Add a hook registering function</title>
@@ -167,22 +161,18 @@
       registering function, which is included in the module
       structure:</p>
 
-      <example>
-        static void my_register_hooks()<br />
-        {<br />
-        <indent>
-          ap_hook_do_something(my_something_doer, NULL, NULL, APR_HOOK_MIDDLE);<br />
-        </indent>
-        }<br />
-        <br />
-        mode MODULE_VAR_EXPORT my_module =<br />
-        {<br />
-        <indent>
-          ...<br />
-          my_register_hooks       /* register hooks */<br />
-        </indent>
+      <highlight language="c">
+        static void my_register_hooks()
+        {
+          ap_hook_do_something(my_something_doer, NULL, NULL, APR_HOOK_MIDDLE);
+        }
+
+        mode MODULE_VAR_EXPORT my_module =
+        {
+          ...
+          my_register_hooks       /* register hooks */
         };
-      </example>
+      </highlight>
     </section>
 
     <section id="hooking-order"><title>Controlling hook calling order</title>
@@ -214,16 +204,14 @@
       example, suppose we want "mod_xyz.c" and "mod_abc.c" to run
       before we do, then we'd hook as follows:</p>
 
-      <example>
-        static void register_hooks()<br />
-        {<br />
-        <indent>
-          static const char * const aszPre[] = { "mod_xyz.c", "mod_abc.c", NULL };<br />
-          <br />
-          ap_hook_do_something(my_something_doer, aszPre, NULL, APR_HOOK_MIDDLE);<br />
-        </indent>
+      <highlight language="c">
+        static void register_hooks()
+        {
+          static const char * const aszPre[] = { "mod_xyz.c", "mod_abc.c", NULL };
+
+          ap_hook_do_something(my_something_doer, aszPre, NULL, APR_HOOK_MIDDLE);
         }
-      </example>
+      </highlight>
 
       <p>Note that the sort used to achieve this is stable, so
       ordering set by <code>APR_HOOK_<var>ORDER</var></code> is preserved, as far

Modified: httpd/httpd/trunk/docs/manual/developer/modguide.html.en
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/developer/modguide.html.en?rev=1329909&r1=1329908&r2=1329909&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/developer/modguide.html.en (original)
+++ httpd/httpd/trunk/docs/manual/developer/modguide.html.en Tue Apr 24 18:12:25 2012
@@ -1100,7 +1100,7 @@ different meanings to the user of the se
 within which modules must operate. For example, let's assume you have this 
 configuration set up for mod_rewrite:
 </p>
-<div class="example"><pre>
+<pre class="prettyprint lang-config">
 &lt;Directory "/var/www"&gt;
     RewriteCond %{HTTP_HOST} ^example.com$
     RewriteRule (.*) http://www.example.com/$1
@@ -1108,7 +1108,8 @@ configuration set up for mod_rewrite:
 &lt;Directory "/var/www/sub"&gt;
     RewriteRule ^foobar$ index.php?foobar=true
 &lt;/Directory&gt;
-</pre></div>
+</pre>
+
 <p>
 In this example, you will have set up two different contexts for 
 mod_rewrite:</p>
@@ -1654,7 +1655,8 @@ static int example_handler(request_req *
         ap_rprintf(r, "&lt;b&gt;%s&lt;/b&gt;: %s&lt;br/&gt;", e[i].key, e[i].val);
     }
     return OK;
-}</pre>
+}
+</pre>
 
 
 
@@ -1718,6 +1720,7 @@ static int example_handler(request_req* 
 
 
 
+
     
 
 </div></div>

Modified: httpd/httpd/trunk/docs/manual/developer/output-filters.html.en
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/developer/output-filters.html.en?rev=1329909&r1=1329908&r2=1329909&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/developer/output-filters.html.en (original)
+++ httpd/httpd/trunk/docs/manual/developer/output-filters.html.en Tue Apr 24 18:12:25 2012
@@ -130,16 +130,15 @@
     private to the filter).</p>
 
     <div class="example"><h3>How to handle an empty brigade</h3><p><code>
+    <pre class="prettyprint lang-c">
     apr_status_t dummy_filter(ap_filter_t *f, apr_bucket_brigade *bb)<br />
-    {<br />
-    <span class="indent">
-        if (APR_BRIGADE_EMPTY(bb)) {<br />
-        <span class="indent">
-            return APR_SUCCESS;<br />
-        </span>
-        }<br />
-        ....<br />
-    </span>
+    {
+        if (APR_BRIGADE_EMPTY(bb)) {
+            return APR_SUCCESS;
+        }
+        ....
+    </pre>
+
     </code></p></div>
 
   </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
@@ -258,18 +257,20 @@
     follows:</p>
 
     <div class="example"><h3>Bad output filter -- do not imitate!</h3><p><code>
-    apr_bucket *e = APR_BRIGADE_FIRST(bb);<br />
-const char *data;<br />
-apr_size_t len;<br />
-<br />
-while (e != APR_BRIGADE_SENTINEL(bb)) {<br />
-<span class="indent">
-    apr_bucket_read(e, &amp;data, &amp;length, APR_BLOCK_READ);<br />
-    e = APR_BUCKET_NEXT(e);<br />
-</span>
-}<br />
-<br />
+    <pre class="prettyprint lang-c">
+apr_bucket *e = APR_BRIGADE_FIRST(bb);
+const char *data;
+apr_size_t len;
+
+while (e != APR_BRIGADE_SENTINEL(bb)) {
+    apr_bucket_read(e, &amp;data, &amp;length, APR_BLOCK_READ);
+    e = APR_BUCKET_NEXT(e);
+
+}
+
 return ap_pass_brigade(bb);
+</pre>
+
     </code></p></div>
 
     <p>The above implementation would consume memory proportional to
@@ -283,24 +284,25 @@ return ap_pass_brigade(bb);
     needed and must be allocated only once per response, see the <a href="#state">Maintaining state</a> section.</p>
 
     <div class="example"><h3>Better output filter</h3><p><code>
-apr_bucket *e;<br />
-const char *data;<br />
-apr_size_t len;<br />
-<br />
-while ((e = APR_BRIGADE_FIRST(bb)) != APR_BRIGADE_SENTINEL(bb)) {<br />
-<span class="indent">
-   rv = apr_bucket_read(e, &amp;data, &amp;length, APR_BLOCK_READ);<br />
-   if (rv) ...;<br />
-   /* Remove bucket e from bb. */<br />
-   APR_BUCKET_REMOVE(e);<br />
-   /* Insert it into  temporary brigade. */<br />
-   APR_BRIGADE_INSERT_HEAD(tmpbb, e);<br />
-   /* Pass brigade downstream. */<br />
-   rv = ap_pass_brigade(f-&gt;next, tmpbb);<br />
-   if (rv) ...;<br />
-   apr_brigade_cleanup(tmpbb);<br />
-</span>
+<pre class="prettyprint lang-c">
+apr_bucket *e;
+const char *data;
+apr_size_t len;
+
+while ((e = APR_BRIGADE_FIRST(bb)) != APR_BRIGADE_SENTINEL(bb)) {
+   rv = apr_bucket_read(e, &amp;data, &amp;length, APR_BLOCK_READ);
+   if (rv) ...;
+   /* Remove bucket e from bb. */
+   APR_BUCKET_REMOVE(e);
+   /* Insert it into  temporary brigade. */
+   APR_BRIGADE_INSERT_HEAD(tmpbb, e);
+   /* Pass brigade downstream. */
+   rv = ap_pass_brigade(f-&gt;next, tmpbb);
+   if (rv) ...;
+   apr_brigade_cleanup(tmpbb);
 }
+</pre>
+
     </code></p></div>
 
   </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
@@ -316,32 +318,32 @@ while ((e = APR_BRIGADE_FIRST(bb)) != AP
     a new brigade per invocation as described in the <a href="#brigade">Brigade structure</a> section.</p>
 
   <div class="example"><h3>Example code to maintain filter state</h3><p><code>
-struct dummy_state {<br />
-<span class="indent">
-   apr_bucket_brigade *tmpbb;<br />
-   int filter_state;<br />
-   ....<br />
-</span>
-};<br />
-<br />
-apr_status_t dummy_filter(ap_filter_t *f, apr_bucket_brigade *bb)<br />
-{<br />
-<span class="indent">
-    struct dummy_state *state;<br />
-<br />
-    state = f-&gt;ctx;<br />
-    if (state == NULL) {<br />
-    <span class="indent">
+  <pre class="prettyprint lang-c">
+struct dummy_state {
+   apr_bucket_brigade *tmpbb;
+   int filter_state;
+   ....
+};
+
+apr_status_t dummy_filter(ap_filter_t *f, apr_bucket_brigade *bb)
+{
+
+    struct dummy_state *state;
+    
+    state = f-&gt;ctx;
+    if (state == NULL) {
+    
        /* First invocation for this response: initialise state structure.
-        */<br />
-       f-&gt;ctx = state = apr_palloc(sizeof *state, f-&gt;r-&gt;pool);<br />
-<br />
-       state-&gt;tmpbb = apr_brigade_create(f-&gt;r-&gt;pool, f-&gt;c-&gt;bucket_alloc);<br />
-       state-&gt;filter_state = ...;<br />
-    </span>
-    }<br />
+        */
+       f-&gt;ctx = state = apr_palloc(sizeof *state, f-&gt;r-&gt;pool);
+
+       state-&gt;tmpbb = apr_brigade_create(f-&gt;r-&gt;pool, f-&gt;c-&gt;bucket_alloc);
+       state-&gt;filter_state = ...;
+
+    }
     ...
-</span>
+</pre>
+
     </code></p></div>
 
   </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
@@ -418,37 +420,35 @@ apr_status_t dummy_filter(ap_filter_t *f
 
     <div class="example"><h3>Example code using non-blocking bucket reads</h3><p><code>
       
-apr_bucket *e;<br />
-apr_read_type_e mode = APR_NONBLOCK_READ;<br />
-<br />
-while ((e = APR_BRIGADE_FIRST(bb)) != APR_BRIGADE_SENTINEL(bb)) {<br />
-<span class="indent">
-    apr_status_t rv;<br />
-<br />
-    rv = apr_bucket_read(e, &amp;data, &amp;length, mode);<br />
-    if (rv == APR_EAGAIN &amp;&amp; mode == APR_NONBLOCK_READ) {<br />
-    <span class="indent">
-        /* Pass down a brigade containing a flush bucket: */<br />
-        APR_BRIGADE_INSERT_TAIL(tmpbb, apr_bucket_flush_create(...));<br />
-        rv = ap_pass_brigade(f-&gt;next, tmpbb);<br />
-        apr_brigade_cleanup(tmpbb);<br />
-        if (rv != APR_SUCCESS) return rv;<br />
-<br />
-        /* Retry, using a blocking read. */<br />
-        mode = APR_BLOCK_READ;<br />
-        continue;<br />
-    </span>
-    } else if (rv != APR_SUCCESS) {<br />
-    <span class="indent">
-        /* handle errors */<br />
-    </span>
-    }<br />
-<br />
-    /* Next time, try a non-blocking read first. */<br />
-    mode = APR_NONBLOCK_READ;<br />
-    ...<br />
-</span>
+      <pre class="prettyprint lang-c">
+apr_bucket *e;
+apr_read_type_e mode = APR_NONBLOCK_READ;
+
+while ((e = APR_BRIGADE_FIRST(bb)) != APR_BRIGADE_SENTINEL(bb)) {
+    apr_status_t rv;
+
+    rv = apr_bucket_read(e, &amp;data, &amp;length, mode);
+    if (rv == APR_EAGAIN &amp;&amp; mode == APR_NONBLOCK_READ) {
+
+        /* Pass down a brigade containing a flush bucket: */
+        APR_BRIGADE_INSERT_TAIL(tmpbb, apr_bucket_flush_create(...));
+        rv = ap_pass_brigade(f-&gt;next, tmpbb);
+        apr_brigade_cleanup(tmpbb);
+        if (rv != APR_SUCCESS) return rv;
+
+        /* Retry, using a blocking read. */
+        mode = APR_BLOCK_READ;
+        continue;
+    } else if (rv != APR_SUCCESS) {
+        /* handle errors */
+    }
+
+    /* Next time, try a non-blocking read first. */
+    mode = APR_NONBLOCK_READ;
+    ...
 }
+</pre>
+
     </code></p></div>
 
   </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>

Modified: httpd/httpd/trunk/docs/manual/developer/output-filters.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/developer/output-filters.xml?rev=1329909&r1=1329908&r2=1329909&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/developer/output-filters.xml (original)
+++ httpd/httpd/trunk/docs/manual/developer/output-filters.xml Tue Apr 24 18:12:25 2012
@@ -121,16 +121,14 @@
     private to the filter).</p>
 
     <example><title>How to handle an empty brigade</title>
+    <highlight language="c">
     apr_status_t dummy_filter(ap_filter_t *f, apr_bucket_brigade *bb)<br />
-    {<br />
-    <indent>
-        if (APR_BRIGADE_EMPTY(bb)) {<br />
-        <indent>
-            return APR_SUCCESS;<br />
-        </indent>
-        }<br />
-        ....<br />
-    </indent>
+    {
+        if (APR_BRIGADE_EMPTY(bb)) {
+            return APR_SUCCESS;
+        }
+        ....
+    </highlight>
     </example>
 
   </section>
@@ -251,18 +249,19 @@
     follows:</p>
 
     <example><title>Bad output filter -- do not imitate!</title>
-    apr_bucket *e = APR_BRIGADE_FIRST(bb);<br />
-const char *data;<br />
-apr_size_t len;<br />
-<br />
-while (e != APR_BRIGADE_SENTINEL(bb)) {<br />
-<indent>
-    apr_bucket_read(e, &amp;data, &amp;length, APR_BLOCK_READ);<br />
-    e = APR_BUCKET_NEXT(e);<br />
-</indent>
-}<br />
-<br />
+    <highlight language="c">
+apr_bucket *e = APR_BRIGADE_FIRST(bb);
+const char *data;
+apr_size_t len;
+
+while (e != APR_BRIGADE_SENTINEL(bb)) {
+    apr_bucket_read(e, &amp;data, &amp;length, APR_BLOCK_READ);
+    e = APR_BUCKET_NEXT(e);
+
+}
+
 return ap_pass_brigade(bb);
+</highlight>
     </example>
 
     <p>The above implementation would consume memory proportional to
@@ -277,24 +276,24 @@ return ap_pass_brigade(bb);
     href="#state">Maintaining state</a> section.</p>
 
     <example><title>Better output filter</title>
-apr_bucket *e;<br />
-const char *data;<br />
-apr_size_t len;<br />
-<br />
-while ((e = APR_BRIGADE_FIRST(bb)) != APR_BRIGADE_SENTINEL(bb)) {<br />
-<indent>
-   rv = apr_bucket_read(e, &amp;data, &amp;length, APR_BLOCK_READ);<br />
-   if (rv) ...;<br />
-   /* Remove bucket e from bb. */<br />
-   APR_BUCKET_REMOVE(e);<br />
-   /* Insert it into  temporary brigade. */<br />
-   APR_BRIGADE_INSERT_HEAD(tmpbb, e);<br />
-   /* Pass brigade downstream. */<br />
-   rv = ap_pass_brigade(f->next, tmpbb);<br />
-   if (rv) ...;<br />
-   apr_brigade_cleanup(tmpbb);<br />
-</indent>
+<highlight language="c">
+apr_bucket *e;
+const char *data;
+apr_size_t len;
+
+while ((e = APR_BRIGADE_FIRST(bb)) != APR_BRIGADE_SENTINEL(bb)) {
+   rv = apr_bucket_read(e, &amp;data, &amp;length, APR_BLOCK_READ);
+   if (rv) ...;
+   /* Remove bucket e from bb. */
+   APR_BUCKET_REMOVE(e);
+   /* Insert it into  temporary brigade. */
+   APR_BRIGADE_INSERT_HEAD(tmpbb, e);
+   /* Pass brigade downstream. */
+   rv = ap_pass_brigade(f->next, tmpbb);
+   if (rv) ...;
+   apr_brigade_cleanup(tmpbb);
 }
+</highlight>
     </example>
 
   </section>
@@ -311,32 +310,31 @@ while ((e = APR_BRIGADE_FIRST(bb)) != AP
     href="#brigade">Brigade structure</a> section.</p>
 
   <example><title>Example code to maintain filter state</title>
-struct dummy_state {<br />
-<indent>
-   apr_bucket_brigade *tmpbb;<br />
-   int filter_state;<br />
-   ....<br />
-</indent>
-};<br />
-<br />
-apr_status_t dummy_filter(ap_filter_t *f, apr_bucket_brigade *bb)<br />
-{<br />
-<indent>
-    struct dummy_state *state;<br />
-<br />
-    state = f->ctx;<br />
-    if (state == NULL) {<br />
-    <indent>
+  <highlight language="c">
+struct dummy_state {
+   apr_bucket_brigade *tmpbb;
+   int filter_state;
+   ....
+};
+
+apr_status_t dummy_filter(ap_filter_t *f, apr_bucket_brigade *bb)
+{
+
+    struct dummy_state *state;
+    
+    state = f->ctx;
+    if (state == NULL) {
+    
        /* First invocation for this response: initialise state structure.
-        */<br />
-       f->ctx = state = apr_palloc(sizeof *state, f->r->pool);<br />
-<br />
-       state->tmpbb = apr_brigade_create(f->r->pool, f->c->bucket_alloc);<br />
-       state->filter_state = ...;<br />
-    </indent>
-    }<br />
+        */
+       f->ctx = state = apr_palloc(sizeof *state, f->r->pool);
+
+       state->tmpbb = apr_brigade_create(f->r->pool, f->c->bucket_alloc);
+       state->filter_state = ...;
+
+    }
     ...
-</indent>
+</highlight>
     </example>
 
   </section>
@@ -414,37 +412,34 @@ apr_status_t dummy_filter(ap_filter_t *f
 
     <example>
       <title>Example code using non-blocking bucket reads</title>
-apr_bucket *e;<br />
-apr_read_type_e mode = APR_NONBLOCK_READ;<br />
-<br />
-while ((e = APR_BRIGADE_FIRST(bb)) != APR_BRIGADE_SENTINEL(bb)) {<br />
-<indent>
-    apr_status_t rv;<br />
-<br />
-    rv = apr_bucket_read(e, &amp;data, &amp;length, mode);<br />
-    if (rv == APR_EAGAIN &amp;&amp; mode == APR_NONBLOCK_READ) {<br />
-    <indent>
-        /* Pass down a brigade containing a flush bucket: */<br />
-        APR_BRIGADE_INSERT_TAIL(tmpbb, apr_bucket_flush_create(...));<br />
-        rv = ap_pass_brigade(f->next, tmpbb);<br />
-        apr_brigade_cleanup(tmpbb);<br />
-        if (rv != APR_SUCCESS) return rv;<br />
-<br />
-        /* Retry, using a blocking read. */<br />
-        mode = APR_BLOCK_READ;<br />
-        continue;<br />
-    </indent>
-    } else if (rv != APR_SUCCESS) {<br />
-    <indent>
-        /* handle errors */<br />
-    </indent>
-    }<br />
-<br />
-    /* Next time, try a non-blocking read first. */<br />
-    mode = APR_NONBLOCK_READ;<br />
-    ...<br />
-</indent>
+      <highlight language="c">
+apr_bucket *e;
+apr_read_type_e mode = APR_NONBLOCK_READ;
+
+while ((e = APR_BRIGADE_FIRST(bb)) != APR_BRIGADE_SENTINEL(bb)) {
+    apr_status_t rv;
+
+    rv = apr_bucket_read(e, &amp;data, &amp;length, mode);
+    if (rv == APR_EAGAIN &amp;&amp; mode == APR_NONBLOCK_READ) {
+
+        /* Pass down a brigade containing a flush bucket: */
+        APR_BRIGADE_INSERT_TAIL(tmpbb, apr_bucket_flush_create(...));
+        rv = ap_pass_brigade(f->next, tmpbb);
+        apr_brigade_cleanup(tmpbb);
+        if (rv != APR_SUCCESS) return rv;
+
+        /* Retry, using a blocking read. */
+        mode = APR_BLOCK_READ;
+        continue;
+    } else if (rv != APR_SUCCESS) {
+        /* handle errors */
+    }
+
+    /* Next time, try a non-blocking read first. */
+    mode = APR_NONBLOCK_READ;
+    ...
 }
+</highlight>
     </example>
 
   </section>

Modified: httpd/httpd/trunk/docs/manual/developer/request.html.en
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/developer/request.html.en?rev=1329909&r1=1329908&r2=1329909&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/developer/request.html.en (original)
+++ httpd/httpd/trunk/docs/manual/developer/request.html.en Tue Apr 24 18:12:25 2012
@@ -150,7 +150,7 @@
 <h2><a name="security" id="security">The Security Phase</a></h2>
     <p>Needs Documentation. Code is:</p>
 
-    <div class="example"><pre>
+    <pre class="prettyprint lang-c">
         if ((access_status = ap_run_access_checker(r)) != 0) {
             return decl_die(access_status, "check access", r);
         }
@@ -162,7 +162,8 @@
         if ((access_status = ap_run_auth_checker(r)) != 0) {
             return decl_die(access_status, "check authorization", r);
         }
-    </pre></div>
+    </pre>
+
 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
 <div class="section">
 <h2><a name="preparation" id="preparation">The Preparation Phase</a></h2>

Modified: httpd/httpd/trunk/docs/manual/developer/request.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/developer/request.xml?rev=1329909&r1=1329908&r2=1329909&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/developer/request.xml (original)
+++ httpd/httpd/trunk/docs/manual/developer/request.xml Tue Apr 24 18:12:25 2012
@@ -148,7 +148,7 @@
 <section id="security"><title>The Security Phase</title>
     <p>Needs Documentation. Code is:</p>
 
-    <example><pre>
+    <highlight language="c">
         if ((access_status = ap_run_access_checker(r)) != 0) {
             return decl_die(access_status, "check access", r);
         }
@@ -160,8 +160,7 @@
         if ((access_status = ap_run_auth_checker(r)) != 0) {
             return decl_die(access_status, "check authorization", r);
         }
-    </pre>
-    </example>
+    </highlight>
 </section>
 
 <section id="preparation"><title>The Preparation Phase</title>