axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sam...@apache.org
Subject svn commit: r447297 - /webservices/axis2/site/c/coding_conventions.html
Date Mon, 18 Sep 2006 07:13:26 GMT
Author: samisa
Date: Mon Sep 18 00:13:26 2006
New Revision: 447297

URL: http://svn.apache.org/viewvc?view=rev&rev=447297
Log:
Added more detail to code style guidelines

Modified:
    webservices/axis2/site/c/coding_conventions.html

Modified: webservices/axis2/site/c/coding_conventions.html
URL: http://svn.apache.org/viewvc/webservices/axis2/site/c/coding_conventions.html?view=diff&rev=447297&r1=447296&r2=447297
==============================================================================
--- webservices/axis2/site/c/coding_conventions.html (original)
+++ webservices/axis2/site/c/coding_conventions.html Mon Sep 18 00:13:26 2006
@@ -2,148 +2,123 @@
           @import url("./style/maven-base.css");
           
 			    @import url("./style/maven-classic.css");</style><link rel="stylesheet" href="./style/print.css"
type="text/css" media="print"></link><meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1"></meta></head><body class="composite"><div id="banner"><a
href="http://www.apache.org/" id="organizationLogo"><img alt="Apache Software Foundation"
src="http://www.apache.org/images/asf-logo.gif"></img></a><a href="http://ws.apache.org/axis2/c"
id="projectLogo"><img alt="Apache Axis2 C" src="http://ws.apache.org/axis2/images/axis.jpg"></img></a><div
class="clear"><hr></hr></div></div><div id="breadcrumbs"><div
class="xleft">
-                	Last published: 31 August 2006
-                  | Doc for 0.93</div><div class="xright"></div><div
class="clear"><hr></hr></div></div><div id="leftColumn"><div
id="navcolumn"><div id="menuAxis2_C"><h5>Axis2/C</h5><ul><li
class="none"><a href="index.html">Home</a></li><li class="expanded"><a
href="download.cgi">Download Axis2/C</a><ul><li class="none"><a href="download.cgi">Releases</a></li><li
class="none"><a href="http://svn.apache.org/viewcvs.cgi/webservices/axis2/trunk/c/"
class="externalLink" title="External Link">View Source Code Online</a></li><li
class="none"><a href="svn.html">Checkout Source Code</a></li></ul></li><li
class="none"><a href="docs/index.html">Documentation</a></li><li class="expanded"><a
href="mail-lists.html">Get Involved</a><ul><li class="none"><a href="mail-lists.html">Mailing
Lists</a></li></ul></li><li class="expanded"><a href="team-list.html">Project
Information</a><ul><li class="none"><a href="team-list.html">Project
Team</a></li><li class="none"><a href="issue-tracking.html
 ">Issue Tracking</a></li></ul></li></ul></div><a
href="http://maven.apache.org/" title="Built by Maven" id="poweredBy"><img alt="Built
by Maven" src="./images/logos/maven-button-1.png"></img></a></div></div><div
id="bodyColumn"><div class="contentBox"><div class="section"><a name="Axis2_C_Coding_Conventions"></a><h2>Axis2/C
Coding Conventions</h2><p> </p><div class="subsection"><a name="Contents"></a><h3>Contents</h3><ul>
-
-
+                	Last published: 18 September 2006
+                  | Doc for 0.93</div><div class="xright"></div><div
class="clear"><hr></hr></div></div><div id="leftColumn"><div
id="navcolumn"><div id="menuAxis2_C"><h5>Axis2/C</h5><ul><li
class="none"><a href="index.html">Home</a></li><li class="expanded"><a
href="download.cgi">Download Axis2/C</a><ul><li class="none"><a href="download.cgi">Releases</a></li><li
class="none"><a href="http://svn.apache.org/viewcvs.cgi/webservices/axis2/trunk/c/"
class="externalLink" title="External Link">View Source Code Online</a></li><li
class="none"><a href="svn.html">Checkout Source Code</a></li></ul></li><li
class="none"><a href="docs/index.html">Documentation</a></li><li class="expanded"><a
href="mail-lists.html">Get Involved</a><ul><li class="none"><a href="mail-lists.html">Mailing
Lists</a></li></ul></li><li class="expanded"><a href="team-list.html">Project
Information</a><ul><li class="none"><a href="team-list.html">Project
Team</a></li><li class="none"><a href="issue-tracking.html
 ">Issue Tracking</a></li></ul></li></ul></div><a
href="http://maven.apache.org/" title="Built by Maven" id="poweredBy"><img alt="Built
by Maven" src="./images/logos/maven-button-1.png"></img></a></div></div><div
id="bodyColumn"><div class="contentBox"><div class="section"><a name="Axis2_C_Coding_Conventions"></a><h2>Axis2/C
Coding Conventions</h2><div class="subsection"><a name="Contents"></a><h3>Contents</h3><ul>
   <li><a href="#1_Naming_conventions_">Naming
 Conventions</a></li>
-
-
-  
   <ul>
-
-
     <li><a href="#1_1_Variables">Variables</a></li>
-
-
     <li><a href="#1_2_Functions_">Functions</a></li>
-
-
     <li><a href="#1_3_Structures_and_user_defined_data">Structures
 and User defined data types</a></li>
-
-
     <li><a href="#1_4_Macros">Macros</a></li>
-
-
     <li><a href="#1_5_Enumerations">Enumerations</a></li>
-
-
-  
   </ul>
-
-
-  <li><a href="#2_Indentation">Indentation</a></li>
-
-
+  <li><a href="#2_Indentation">Indentation and Formatting</a></li>
   <li><a href="#3_Comments">Comments</a></li>
-
-
   <li><a href="#4_Function_parameters_and_Return_Value">Function
 parameters
 and Return value conventions</a></li>
-
-
   <li><a href="#5_Include_directives">Include
 directives</a></li>
-
-
 </ul><p><a name="1_Naming_conventions_"></a></p></div><div
class="subsection"><a name="1__Naming_conventions"></a><h3>1. Naming
conventions</h3><ul>
-
-
   <li>Namespace validation is done using the <code><strong>axis2_</strong></code>
 prefix. </li>
-
-
   <li>Underscore should be used to separate individual words in
 identifiers.</li>
-
-
   <li>All identifiers should be meaningful and abbreviations must
 be
 avoided whenever possible.</li>
-
-
 </ul><p><a name="1_1_Variables"></a></p></div><div
class="subsection"><a name="1_1_Variables"></a><h3>1.1 Variables</h3><ul>
-
-
   <li>Use meaningful nouns.</li>
-
-
   <li>Make sure to use all lowercase letters for private
 &amp; public
 variables.</li>
-
-
-  <li>If it is a local variable or a member of a struct, there's
-no
+  <li>If it is a local variable or a member of a struct, there's no
 need to prefix it with <code>axis2_</code>.</li>
-
-
 e.g.
-  
   <pre>int count = 0;<br></br>char *prefix = NULL;<br></br></pre>
-
-
 </ul><p><a name="1_2_Functions_"></a></p></div><div
class="subsection"><a name="1_2_Functions"></a><h3>1.2 Functions</h3><ul>
-
-
-  <li>Function names should always start with the prefix <code>axis2_</code>
-except
+  <li>Function names should always start with the prefix <code>axis2_</code>
except
 for members of a struct.</li>
-
-
 e.g.
-  
   <pre><p>axis2_om_node_t * axis2_om_node_create(axis2_environment_t *environment);</p></pre>
-
-
 </ul><p><a name="1_3_Structures_and_user_defined_data"></a></p></div><div
class="subsection"><a name="1_3_Structures_and_user_defined_data_types"></a><h3>1.3
Structures and user defined data types</h3><ul>
-
-
   <li>Note the _t suffix in the type name.</li>
-
-
 e.g.
-  
   <pre>typedef struct axis2_om_namespace {<br></br>	char *uri;<br></br>
char *prefix;<br></br>} axis2_om_namespace_t;<br></br></pre>
-
-
 </ul><p><a name="1_4_Macros"></a></p></div><div class="subsection"><a
name="1_4_Macros"></a><h3>1.4 Macros</h3><ul>
-
-
   <li>Macro names should be in all uppercase letters. </li>
-
-
 e.g.
-  
   <pre>#define AXIS2_H<br></br><br></br>#define AXIS2_ERROR_GET_MESSAGE(error)
((error)-&gt;ops-&gt;get_message(error))<br></br></pre>
-
-
 </ul><p><a name="1_5_Enumerations"></a></p></div><div
class="subsection"><a name="1_5_Enumerations"></a><h3>1.5 Enumerations</h3><ul>
-
-
 e.g.
-  
   <pre>typedef enum axis2_status_codes {<br></br>	AXIS2_FAILURE = 0,<br></br>
AXIS2_SUCCESS<br></br>} axis2_status_codes_t;<br></br></pre>
+</ul><p><a name="2_Indentation"></a></p></div><div
class="subsection"><a name="2__Indentation_and_Formatting"></a><h3>2.
Indentation and Formatting</h3><ul>
+Indentation rules are defined in terms of <a href="">Artistic Style</a> indent
options:
+</ul><ul>
 
-
-</ul><p><a name="2_Indentation"></a></p></div><div
class="subsection"><a name="2__Indentation"></a><h3>2. Indentation</h3><ul>
-
-
-Indentation rules are defined in terms of GNU indent options:
+astyle --style=ansi  -b -p -s4  -M0 -c -U -S
 </ul><ul>
+In detail, these options mean:
+    <ul>
+        <li>
+            Use ANSI style code layout
+            <pre>
+            int foo()
+            {
+                if (is_bar)
+                {
+                    bar();
+                    return 1;
+                }
+                else
+                    return 0;
+            }
+            </pre>
+        </li>
+        <li>
+            Use spaces around operators
+        </li>
+        <li>
+            Use four spaces for indenting 
+        </li>
+        <li>
+            No spaces between function name and parenthesis
+            <pre>
+            if (is_foo(a, b))
+                bar(a, b);
+            <pre>
+        </pre></pre></li>
+    </ul>
+    
+    There are some more formatting guidelines that could not be enforced by a 
+    formatting tool, but nevertheless should be followed
+    <ul>
+        <li>
+            Checking pointer validity:
+            <pre>
+            if (foo)
+            </pre>
+            and NOT
+            <pre>
+            if (foo != NULL)
+            </pre>
+        </li>
+        <li>
+            Checking equality:
+            <pre>
+            if (foo == 7)
+            </pre>
+            and NOT
+            <pre>
+            if (7 == foo)
+            </pre>
+        </li>
 
+    </ul>
 
-indent -nbad -bap -nbc -bbo -bl -bli0 -bls -ncdb -nce -cp1 -cs -di2
--ndj
--nfc1 -nfca -hnl -i4 -ip5 -lp -pcs -nprs -psl -saf -sai -saw -nsc -nsob
--ts4
--nut -nbfda
 </ul><p><a name="3_Comments"></a></p></div><div class="subsection"><a
name="3__Comments"></a><h3>3. Comments</h3><ul>
-
-
   <a href="http://www.stack.nl/%7Edimitri/doxygen/docblocks.html" class="newWindow" title="New
Window" target="_blank">Doxygen
 style comments</a> should be used to help auto generate API
 documentation.
@@ -151,37 +126,24 @@
 should
 be documented.
 </ul><p><a name="4_Function_parameters_and_Return_Value"></a></p></div><div
class="subsection"><a name="4__Function_parameters_and_Return_Value_conventions"></a><h3>4.
Function parameters and Return Value conventions</h3><ul>
-
-
 Each function should be passed a pointer to an instance of <code>axis2_environment_t</code>
 struct as the first parameter. If the function is
 tightly
 bound to a struct, the second parameter is a pointer to an instance of
 that struct.
 </ul><ul>
-
-
 Functions returning pointers should return NULL in case of an error.
-The developer should make sure to set the relavant error code in
+The developer should make sure to set the relevant error code in
 the environment's
 error struct.
 </ul><ul>
-
-
 Functions returning none pointer values should always return
   <code>AXIS2_FAILURE</code> status code on error whenever possible, or some
defined
-error value (in case of returning a struct may be). A relavant error
+error value (in case of returning a struct may be). A relevant error
 code must also be set
 in environment's error struct.
 </ul><p><a name="5_Include_directives"></a></p></div><div
class="subsection"><a name="5__Include_directives"></a><h3>5. Include
directives</h3><ul>
-
-
-It is prefereable to include header files in the following fashion:
+It is preferable to include header files in the following fashion:
 </ul><ul>
-
-
-  
   <pre>&lt;standard header files&gt;<br></br>&lt;other system
headers&gt;<br></br>"local header files"<br></br></pre>
-
-
 </ul></div></div></div></div><div class="clear"><hr></hr></div><div
id="footer"><div class="xright">© 2005-2006, Apache Software Foundation</div><div
class="clear"><hr></hr></div></div></body></html>



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message