You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sa...@apache.org on 2005/10/11 07:30:38 UTC

svn commit: r312814 - in /webservices/axis2/trunk/c/xdocs: axis2_coding_convention.html axis2_developer_guide.html developer_guide.html

Author: samisa
Date: Mon Oct 10 22:30:31 2005
New Revision: 312814

URL: http://svn.apache.org/viewcvs?rev=312814&view=rev
Log:
Added coding convention

Added:
    webservices/axis2/trunk/c/xdocs/axis2_coding_convention.html
    webservices/axis2/trunk/c/xdocs/axis2_developer_guide.html
      - copied unchanged from r312813, webservices/axis2/trunk/c/xdocs/developer_guide.html
Removed:
    webservices/axis2/trunk/c/xdocs/developer_guide.html

Added: webservices/axis2/trunk/c/xdocs/axis2_coding_convention.html
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/xdocs/axis2_coding_convention.html?rev=312814&view=auto
==============================================================================
--- webservices/axis2/trunk/c/xdocs/axis2_coding_convention.html (added)
+++ webservices/axis2/trunk/c/xdocs/axis2_coding_convention.html Mon Oct 10 22:30:31 2005
@@ -0,0 +1,135 @@
+<html>
+<head>
+  <meta http-equiv="Content-Type" content="">
+  <title>Axis2/C Coding Convention</title>
+</head>
+
+<body>
+<h1>Axis2/C Coding Convention</h1>
+
+<p> </p>
+
+<h2>1 Naming Conventions </h2>
+
+<p></p>
+
+<p>Namespace validation is done using <strong>axis2_</strong> prefix.
+Underscore should be used to separate individuals words in identifiers.</p>
+
+<p>All identifiers should be meaningful and abbreviations must be avoided
+whenever possible.</p>
+
+<p></p>
+
+<h3> 1.1 Variables</h3>
+
+<p>Use meaningful nouns. Use all lower case letters. If it is a local
+variable or a member of a struct, no need to prefix it with axis2_</p>
+
+<p>e.g. </p>
+
+<p>int count = 0;</p>
+
+<p>char* prefix = NULL;</p>
+
+<h3>1.2 Functions </h3>
+
+<p>Function names should always start with the prefix axis2c_ except it is a
+member of a struct.</p>
+
+<p></p>
+
+<p>e.g. </p>
+
+<p>axis2_om_node_t *axis2_om_node_create(axis2_environment_t
+*environment);</p>
+
+<p></p>
+
+<h3>1.3 Structures and User Defined Data Types </h3>
+
+<p>e.g.</p>
+
+<p>typedef struct axis2_om_namespace {</p>
+
+<p> char *uri;</p>
+
+<p> char *prefix;</p>
+
+<p>} axis2_om_namespace_t;</p>
+
+<p></p>
+
+<p>Note the _t suffix in the type name.</p>
+
+<p></p>
+
+<h3>1.4 Macros</h3>
+
+<p> </p>
+
+<p>Macro names should be in all upper case letter, except that it is a macro
+to help hide the complexity of the use of function pointers in operation
+structs or is a type definition.</p>
+
+<p>e.g.</p>
+
+<p>#define AXIS2_H</p>
+
+<p>#define axis2_error_get_message(error)
+((error)-&gt;ops-&gt;get_message())</p>
+
+<p></p>
+
+<h3>1.5 Enumerations</h3>
+
+<p>e.g.</p>
+
+<p>typedef enum axis2_status_codes {</p>
+
+<p> AXIS2_FAILURE = 0,</p>
+
+<p> AXIS2_SUCCESS</p>
+
+<p>} axis2_status_codes_t;</p>
+
+<p></p>
+
+<h2>2 Indentation</h2>
+
+<p> </p>
+
+<p>Indentation rules are defined in terms of GNU indent options:</p>
+
+<p>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 </p>
+
+<p></p>
+
+<h2>3 Comments</h2>
+
+<p><a href="http://www.stack.nl/~dimitri/doxygen/docblocks.html">Doxygen
+style comments</a> should be used to help auto generate API documentation.
+All structs as well as functions including parameters and return types should
+be documented.</p>
+
+<p></p>
+
+<h2>4 Function Parameters and Return Value Conventions</h2>
+
+<p>Each function should be passed a pointer to an instance of
+axis2_environment_t 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.</p>
+
+<p>Functions returning pointers should return NULL in case of an error. The
+developer should make sure to set the relavant error code in environment's
+error struct.</p>
+
+<p>Functions returning non pointer values should always return AXIS2_FAILURE
+status code on error whenever possible, or some defined error value (in case
+of returning a struct may be). A relavant error code must also be set in
+environment's error struct.</p>
+</body>
+</html>