httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r816205 - in /websites/staging/httpd/trunk/content: ./ dev/styleguide.html
Date Sun, 06 May 2012 23:59:52 GMT
Author: buildbot
Date: Sun May  6 23:59:52 2012
New Revision: 816205

Log:
Staging update by buildbot for httpd

Modified:
    websites/staging/httpd/trunk/content/   (props changed)
    websites/staging/httpd/trunk/content/dev/styleguide.html

Propchange: websites/staging/httpd/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Sun May  6 23:59:52 2012
@@ -1 +1 @@
-1334836
+1334837

Modified: websites/staging/httpd/trunk/content/dev/styleguide.html
==============================================================================
--- websites/staging/httpd/trunk/content/dev/styleguide.html (original)
+++ websites/staging/httpd/trunk/content/dev/styleguide.html Sun May  6 23:59:52 2012
@@ -83,29 +83,42 @@ Comments should be provided to explain t
 obvious, and to document behavior of functions. The guidelines can be
 broken if necessary to achieve a clearer layout]</p>
 <p>This style can be generated with the following arguments to GNU indent:</p>
-<p><code>-i4 -npsl -di0 -br -nce -d0 -cli0 -npcs -nfc1 -nut</code> </p>
+<div class="codehilite"><pre><span class="o">-</span><span class="n">i4</span>
<span class="o">-</span><span class="n">npsl</span> <span class="o">-</span><span
class="n">di0</span> <span class="o">-</span><span class="n">br</span>
<span class="o">-</span><span class="n">nce</span> <span class="o">-</span><span
class="n">d0</span> <span class="o">-</span><span class="n">cli0</span>
<span class="o">-</span><span class="n">npcs</span> <span class="o">-</span><span
class="n">nfc1</span> <span class="o">-</span><span class="n">nut</span>
+</pre></div>
+
+
 <h1 id="the-guidelines">The Guidelines</h1>
-<p><UL><li>Opening braces are given on the same lines as statements, or
on the
-following line at the start of a function definition.</li><li>Code inside a
+<ul>
+<li>Opening braces are given on the same lines as statements, or on the
+following line at the start of a function definition.</li>
+<li>Code inside a
 block (whether surrounded by braces or not) is indented by four space
 characters. Tab characters are not used. Comments are indented to the same
-level as the surrounding code.</li><li>Closing braces are always on a
+level as the surrounding code.</li>
+<li>Closing braces are always on a
 separate line from surrounding code, and are indented to line up with the
 start of the text on the line containing the corresponding opening
-brace.</li><li>Functions are declared with ANSI-style
-arguments.</li><li>There is no space between the function name and the
+brace.</li>
+<li>Functions are declared with ANSI-style
+arguments.</li>
+<li>There is no space between the function name and the
 opening bracket of the arguments to the function. There is a single space
 following commas in argument lists and the semi-colons in for
-statements.</li><li>Inside a<samp>switch()</samp>statement,
-the<samp>case</samp>keywords are indented to the same level as
-the<samp>switch</samp>line.</li><li>Operators in expressions should
be
+statements.</li>
+<li>Inside a <code>switch()</code> statement,
+the <code>case</code> keywords are indented to the same level as
+the <code>switch</code> line.</li>
+<li>Operators in expressions should be
 surrounded by a single space before and after, except for unary increment
-(++), decrement (--), and negation (!) operators.</li><li>There is no
+(++), decrement (--), and negation (!) operators.</li>
+<li>There is no
 whitespace between a cast and the item modified (<EM>e.g.</EM>,
-"<samp>(int)j</samp>" and not "<samp>(int) j</samp>").</li><li>If
a cast is
+"<samp>(int)j</samp>" and not "<samp>(int) j</samp>").</li>
+<li>If a cast is
 to a pointer type, there is a space between the type and
-the<samp><em></samp>character (<EM>e.g.</EM>, "<samp>(char
</em>)i</samp>" instead
-of "<samp>(char*)i</samp>")</li></UL></p>
+the <code>*</code> character (<em>e.g.</em>, "<code>(char *)i</code>"
instead
+of "<code>(char*)i</code>")</li>
+</ul>
 <h1 id="details-and-examples">Details and Examples</h1>
 <ol>
 <li><strong>Indentation, General Style</strong> 
@@ -113,35 +126,37 @@ Each level of indentation of code is fou
 never be used. Specific indentation rules for function declarations and
 control-flow keywords are given below.</li>
 </ol>
-<p>Example:
-<code>main(int argc, char **argc)
-    {
-    if (argc != 0) {
-        fprintf(stderr, "No arguments allowed\n");
-        exit(1);
-    }
-    exit(0);
-    }</code> 
-<A NAME="long-exps">If an expression</A>(or a routine declaration or
+<p>Example:</p>
+<div class="codehilite"><pre><span class="n">main</span><span
class="p">(</span><span class="nb">int</span> <span class="n">argc</span><span
class="p">,</span> <span class="n">char</span> <span class="o">**</span><span
class="n">argc</span><span class="p">)</span>
+<span class="p">{</span>
+<span class="k">if</span> <span class="p">(</span><span class="n">argc</span>
<span class="o">!=</span> <span class="mi">0</span><span class="p">)</span>
<span class="p">{</span>
+    <span class="n">fprintf</span><span class="p">(</span><span
class="n">stderr</span><span class="p">,</span> <span class="s">&quot;No
arguments allowed\n&quot;</span><span class="p">);</span>
+    <span class="nb">exit</span><span class="p">(</span><span
class="mi">1</span><span class="p">);</span>
+<span class="p">}</span>
+<span class="nb">exit</span><span class="p">(</span><span class="mi">0</span><span
class="p">);</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<p><A NAME="long-exps">If an expression</A>(or a routine declaration or
 invocation) would extend past column 80, the terms or arguments are wrapped
 at a convenient spot and the wrapped portion is indented under the first
 term in the expression (or the first argument to the function). Conditional
 expressions should be wrapped to keep single or parenthesized terms as
 atomic as possible, and place Boolean operators at either the start
 (preferable) or end of the line.</p>
-<p>Example:
-`
-     static const char <em>really_long_name(int i, int j,
-                     const char </em>args, void *foo,
-                     int k)</p>
-<div class="codehilite"><pre> <span class="k">if</span> <span
class="p">(</span><span class="n">cond1</span> <span class="o">&amp;</span><span
class="n">amp</span><span class="p">;</span><span class="o">&amp;</span><span
class="n">amp</span><span class="p">;</span> <span class="p">(</span><span
class="n">item2</span> <span class="o">||</span> <span class="n">item3</span><span
class="p">)</span> <span class="o">&amp;</span><span class="n">amp</span><span
class="p">;</span><span class="o">&amp;</span><span class="n">amp</span><span
class="p">;</span> <span class="p">(</span><span class="o">!</span><span
class="n">item4</span><span class="p">)</span>
+<p>Example:</p>
+<div class="codehilite"><pre> <span class="n">static</span> <span
class="n">const</span> <span class="n">char</span> <span class="o">*</span><span
class="n">really_long_name</span><span class="p">(</span><span class="nb">int</span>
<span class="n">i</span><span class="p">,</span> <span class="nb">int</span>
<span class="n">j</span><span class="p">,</span>
+                 <span class="n">const</span> <span class="n">char</span>
<span class="o">*</span><span class="n">args</span><span class="p">,</span>
<span class="n">void</span> <span class="o">*</span><span class="n">foo</span><span
class="p">,</span>
+                 <span class="nb">int</span> <span class="n">k</span><span
class="p">)</span>
+
+ <span class="k">if</span> <span class="p">(</span><span class="n">cond1</span>
<span class="o">&amp;</span><span class="n">amp</span><span
class="p">;</span><span class="o">&amp;</span><span class="n">amp</span><span
class="p">;</span> <span class="p">(</span><span class="n">item2</span>
<span class="o">||</span> <span class="n">item3</span><span class="p">)</span>
<span class="o">&amp;</span><span class="n">amp</span><span
class="p">;</span><span class="o">&amp;</span><span class="n">amp</span><span
class="p">;</span> <span class="p">(</span><span class="o">!</span><span
class="n">item4</span><span class="p">)</span>
  <span class="o">&amp;</span><span class="n">amp</span><span
class="p">;</span><span class="o">&amp;</span><span class="n">amp</span><span
class="p">;</span> <span class="p">(</span><span class="n">item5</span>
<span class="o">||</span> <span class="n">item6</span><span class="p">)</span>
<span class="o">&amp;</span><span class="n">amp</span><span
class="p">;</span><span class="o">&amp;</span><span class="n">amp</span><span
class="p">;</span> <span class="n">item7</span><span class="p">)</span>
<span class="p">{</span>
  <span class="n">do_a_thing</span><span class="p">();</span>
  <span class="p">}</span>
 </pre></div>
 
 
-<p>` </p>
 <ol>
 <li><strong>Comments</strong> 
 Provide comments which explain the function of code where it is not clear
@@ -149,19 +164,24 @@ from the code itself. Provide rationale 
 of code.</li>
 </ol>
 <p>Comments should be indented to same level as the surrounding text.</p>
-<p>Example:
-<code>code;
-    /* comment */
-    code;</code> </p>
+<p>Example:</p>
+<div class="codehilite"><pre><span class="n">code</span><span
class="p">;</span>
+<span class="sr">/* comment */</span>
+<span class="n">code</span><span class="p">;</span>
+</pre></div>
+
+
 <ol>
 <li>
 <p><strong>Function Declaration and Layout</strong> 
-Functions are laid out as follows:
-<code>int main(int argc, char **argv)
-    {
-    code;
-    }</code> 
-The return type is placed on the same line as the function. Arguments (if
+Functions are laid out as follows:</p>
+<p>int main(int argc, char **argv)
+{
+code;
+}</p>
+</li>
+</ol>
+<p>The return type is placed on the same line as the function. Arguments (if
 any) are given in ANSI style. If no arguments, declare function
 as<samp>void</samp>. No space between function name and opening bracket,
 single space after comma separating each argument. The opening brace is
@@ -170,63 +190,67 @@ of the return type text. The code is ind
 closing brace is indented to line up with the opening brace. <strong>Also see the
 section on indenting<A HREF="#long-exps">long declarations and
 invocations</A>.</strong> </p>
-</li>
+<ol>
 <li>
 <p><strong>Function Calls</strong> 
 Space after commas in function calls. No space between function name and
-opening bracket.
-<code>f(a, b);</code> 
-<strong>Also see the section on indenting<A HREF="#long-exps">long declarations
-and invocations</A>.</strong> </p>
+opening bracket.</p>
+<p>f(a, b);</p>
 </li>
+</ol>
+<p><strong>Also see the section on indenting<A HREF="#long-exps">long declarations
+and invocations</A>.</strong> </p>
+<ol>
 <li>
 <p><strong>Flow-Control Layout</strong> 
 Flow-control statements
-(<samp>if</samp>,<samp>while</samp>,<samp>for</samp>,<EM>etc.</EM>)
are
-laid out as in this example:
-<code>if (expr) {
-    code;
-    }
-    else {
-    code;
-    }</code> 
-There is a space between the keyword and the opening bracket. Opening brace
+(<code>if</code>, <code>while</code>, <code>for</code>,
<em>etc.</em>) are
+laid out as in this example:</p>
+<p>if (expr) {
+code;
+}
+else {
+code;
+}</p>
+</li>
+</ol>
+<p>There is a space between the keyword and the opening bracket. Opening brace
 placed on same line as the flow keyword. The code itself is indented by
 four spaces. The closing brace is indented to line up with the opening
-brace. If an<samp>else</samp>clause is used, the<samp>else</samp>keyword
is
+brace. If an <code>else</code> clause is used, the <code>else</code>
keyword is
 placed on the line following the closing brace and is indented to line up
-with the corresponding<samp>if</samp>. <strong>Also see the section on
+with the corresponding <code>if</code>. <strong>Also see the section on
 indenting<A HREF="#long-exps">long expressions</A>.</strong> </p>
-</li>
+<ol>
 <li>
-<p><strong><samp>for</samp>Layout</strong> 
-Space after the semi-colons. Example:
-<code>for (a; b; c)</code> </p>
+<p><strong><code>for</code> Layout</strong> 
+Space after the semi-colons. Example:</p>
+<p>for (a; b; c)</p>
 </li>
 <li>
-<p><strong><samp>switch</samp>Layout</strong> 
-<samp>case</samp>lines within a<samp>switch()</samp>are indented
to same
+<p><strong><code>switch</code> Layout</strong> 
+<code>case</code> lines within a <code>switch()</code> are indented
to same
 level as the switch statement itself. The code for each case is indented by
 four spaces. Braces are laid out as for other control-flow keywords.
-Example:
-<code>switch (x) {
-    case a:
-    code;
-    case b:
-    code;
-    }</code> </p>
+Example:</p>
+<p>switch (x) {
+case a:
+code;
+case b:
+code;
+}</p>
 </li>
 <li>
 <p><strong>Expressions</strong> 
 Space before and after assignment and other and operators. No space between
 unary operators (increment, decrement, and negation) and the lvalue.
-Examples:
-<code>a = b
-    a + b
-    a &amp;lt; b
-    a = -b
-    a = !b
-    ++a</code> </p>
+Examples:</p>
+<p>a = b
+a + b
+a &lt; b
+a = -b
+a = !b
+++a</p>
 </li>
 <li>
 <p><strong>Capitalisation of Enums</strong> 



Mime
View raw message