]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Changing to the new syntax highlighting WRT C source code
authorDaniel Gruno <humbedooh@apache.org>
Tue, 24 Apr 2012 18:12:25 +0000 (18:12 +0000)
committerDaniel Gruno <humbedooh@apache.org>
Tue, 24 Apr 2012 18:12:25 +0000 (18:12 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1329909 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/developer/hooks.html.en
docs/manual/developer/hooks.xml
docs/manual/developer/modguide.html.en
docs/manual/developer/output-filters.html.en
docs/manual/developer/output-filters.xml
docs/manual/developer/request.html.en
docs/manual/developer/request.xml

index e6fd42cddc9ac9a18ea54c7b51d9ded3e1261017..9e9e71e9f1b5e24b736f95ddf4f3886beb575dd8 100644 (file)
       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>
       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>
         <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
         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>
       <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">
       <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>
       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>
       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
index 46d778c307cb7aba0ff53e94577849b4e0c12a4f..fe6a1e14a8d76b51956d6e465ece41690ab01180 100644 (file)
@@ -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>
       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>
         <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
         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>
       <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>
 
       <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>
       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>
       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
index 00d78a0008abdc93d3116e17d286cc053ec199c5..2dbddf587d894dbe0e8f4dd43f5b01047b4dd2b5 100644 (file)
@@ -1100,7 +1100,7 @@ different meanings to the user of the server, and thus different contexts
 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 *r)
         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* r)
 
 
 
+
     
 
 </div></div>
index 8b61fc7685dd56f75b0eb75d435831ecfb172e82..c051b022067783bc90bea928c375ad6b37bf0229 100644 (file)
     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>
     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)) != APR_BRIGADE_SENTINEL(bb)) {<br />
     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, apr_bucket_brigade *bb)<br />
 
     <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>
index 93360dce32eb066a01046bc6c444fb2b38851667..ce9a9689146e4134cea44f1582f87b25c07cb470 100644 (file)
     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>
     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)) != APR_BRIGADE_SENTINEL(bb)) {<br />
     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, apr_bucket_brigade *bb)<br />
 
     <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>
index 79b894701dd22587074370d8746c65fe4f6352b1..c669861cedc6abaf308d84594a640ff1aa5a4c25 100644 (file)
 <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);
         }
         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>
index b4bc67b0a8c2101588f75efed05ae02f4f85539e..e5731cee9d6f40b5f9f94f4c71b2f443f84fcbbb 100644 (file)
 <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);
         }
         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>