version 1.1, 2001/07/05 20:25:19
|
version 1.2, 2001/12/13 14:53:30
|
|
|
| |
<b>AUTHORS:</b> M. Brasher, K. Schopmeyer | <b>AUTHORS:</b> M. Brasher, K. Schopmeyer |
<p><font size="1">Last Update <!--webbot bot="Timestamp" | <p><font size="1">Last Update <!--webbot bot="Timestamp" |
S-Type="EDITED" S-Format="%A, %B %d, %Y %I:%M %p" startspan -->Thursday, July 05, 2001 05:15 PM<!--webbot bot="Timestamp" i-CheckSum="5835" endspan --> |
S-Type="EDITED" S-Format="%A, %B %d, %Y %I:%M %p" startspan -->Thursday, July 26, 2001 06:10 PM<!--webbot bot="Timestamp" i-CheckSum="6014" endspan --> |
</font></p> | </font></p> |
<p>Revision Status</p> | <p>Revision Status</p> |
<table border="1" width="80%"> | <table border="1" width="80%"> |
|
|
<td width="25%">first Draft</td> | <td width="25%">first Draft</td> |
</tr> | </tr> |
<tr> | <tr> |
<td width="25%"> </td> |
<td width="25%">0.2</td> |
<td width="25%"> </td> |
<td width="25%">24 July 2001</td> |
<td width="25%"> </td> |
<td width="25%">M. Brasher, K. Schopmeyer</td> |
<td width="25%"> </td> | <td width="25%"> </td> |
</tr> | </tr> |
<tr> | <tr> |
<td width="25%"> </td> |
<td width="25%">0.3</td> |
<td width="25%"> </td> |
<td width="25%">26 July 2001</td> |
<td width="25%"> </td> |
<td width="25%">K. Schopmeyer</td> |
<td width="25%"> </td> |
<td width="25%">Add documentation on licensing.</td> |
</tr> | </tr> |
<tr> | <tr> |
<td width="25%"> </td> | <td width="25%"> </td> |
|
|
| |
<p>NOTE: This is a draft copy for comment.</p> | <p>NOTE: This is a draft copy for comment.</p> |
| |
|
<p>RULES and GUIDELINES - A number of the guidelines below are absolute rules |
|
that we must follow in the Pegasus project. These are the things that will |
|
help insure portability and effective interoperability of the components.</p> |
|
|
|
<p>Other area are "guidelines" that we strongly suggest be followed |
|
so that 1) the code will be readable and usable, 2) we develop a single look to |
|
our source code, etc. In some cases, there may be reasons to bypass some |
|
of these guidelines but we strongly encourage everybody to follow them. |
|
In fact, if there is a real reason we will change to what the group wants and |
|
suggestions.</p> |
|
|
<h2>Coding Conventions</h2> | <h2>Coding Conventions</h2> |
<OL> | <OL> |
<LI><b>Indenting Code</b> - Indent by increments of 4 characters (with tabsize of | <LI><b>Indenting Code</b> - Indent by increments of 4 characters (with tabsize of |
8). ??? Using Tabs???. |
8). Use the TAB character. This is the accepted norm for open source |
|
code. |
| |
<LI><b>Naming Conventions</b> - <font face="Courier New"> ThisIsAClassName</font> - no underscores. | <LI><b>Naming Conventions</b> - <font face="Courier New"> ThisIsAClassName</font> - no underscores. |
<font face="Courier New"> | <font face="Courier New"> |
|
|
<LI><b>Code Line Length</b> - Lines should not span more than 80 columns. | <LI><b>Code Line Length</b> - Lines should not span more than 80 columns. |
When methods span more than 80 columns, do this: | When methods span more than 80 columns, do this: |
<pre> | <pre> |
void MyClass::myMethod( |
void MyClass::myMethod( |
|
|
const char* someReallyLongName, | const char* someReallyLongName, |
|
|
const char* someOtherReallyLongName); | const char* someOtherReallyLongName); |
</pre> | </pre> |
<LI> Use "char* x" rather than "char *x". |
<LI> Use "char* x" rather than "char *x". Either is normally legal for the |
<LI><b>Use of <font face="Courier New">const</font></b>. Use const whenever possible. |
majority of compilers. |
Use const methods whenever possible. |
<LI><b>Use of <font face="Courier New">const</font></b>. Use <font face="Courier New"> const</font> whenever possible. |
|
Use <font face="Courier New"> const</font> methods whenever possible. |
<LI><b>Braces</b> - Put opening brace on a line by itself. Braces must be aligned with control keyword: | <LI><b>Braces</b> - Put opening brace on a line by itself. Braces must be aligned with control keyword: |
<pre> | <pre> |
for(...) | for(...) |
|
|
<pre> for (...) | <pre> for (...) |
{ | { |
.... | .... |
} |
}</pre> |
</pre> |
or this:<pre> for (...){ |
|
.... |
|
}</pre> |
<LI><b>Using Space</b> - No spaces after names. | <LI><b>Using Space</b> - No spaces after names. |
<br>Separate functions with blank lines. | <br>Separate functions with blank lines. |
<pre> class X | <pre> class X |
|
|
blah3);</font>>/pre><br> | blah3);</font>>/pre><br> |
<LI> | <LI> |
<pre>Avoid this: | <pre>Avoid this: |
</pre> |
|
<pre> |
|
int x; | int x; |
float y; | float y; |
</pre> | </pre> |
|
|
platform. | platform. |
| |
Always write a regression test for everything. | Always write a regression test for everything. |
<p>No warnings should be committed. |
<p>No files with warnings should be committed to CVS. |
| |
Test big changes on at least Windows and Unix (or Linux) | Test big changes on at least Windows and Unix (or Linux) |
| |
|
|
reasons to use outside code and libraries at times. Thus, for example, the | reasons to use outside code and libraries at times. Thus, for example, the |
initial project used the ACE_wrappers libraries extensively but with the | initial project used the ACE_wrappers libraries extensively but with the |
objective of eventually providing a replacement. That replacement has been | objective of eventually providing a replacement. That replacement has been |
produced, partly because ACE was not available on all of the platforms</p> |
produced, partly because ACE was not available on all of the platforms.</p> |
|
|
|
<p>All code submitted to the Pegasus core source libraries is to be made available |
|
under the standard license used by Pegasus. If any code is to be taken |
|
from other open source projects, we expect that the code recognize both the |
|
requirements of the Pegasus standard license and the other license (ex. if we |
|
were to share code with the Caldera OpenWBEM) project, we would have to show |
|
both their license and our licenses.</p> |
|
|
|
<p>All code input to the Pegasus project must include the license statement.</p> |
|
|
|
<p>If there is a case of code that we want to use on the Pegasus project but |
|
that is licensed outside of the above rules, it can be included only with the |
|
specific permission of the Pegasus project management. We will be very |
|
hesitant to do this since it could mean weakening the whole open source nature |
|
of the project and would greatly complicate our license arrangements.</p> |
| |
<h2>Using Make</h2> | <h2>Using Make</h2> |
| |
|
|
<p><<<THIS SECTION NEED TO BE COMPLETED>>> | <p><<<THIS SECTION NEED TO BE COMPLETED>>> |
</p> | </p> |
| |
|
<h2>Portability Issues</h2> |
|
|
|
<OL> |
|
<LI>In .h files the following identifiers must be surrounded by the PEGASUS_STD() macro (which |
|
pretends std:: to the argument).<br> |
|
<br> |
|
<font face="Courier New"> ostream<br> |
|
istream<br> |
|
cout<br> |
|
cerr<br> |
|
</font><br> |
|
Do not use this macro in .cpp files. Instead put the following<br> |
|
at the beginning of the file:<br> |
|
<br> |
|
PEGASUS_USING_STD;<br> |
|
<br> |
|
<LI>The following does not compile with some compilers.<br> |
|
<br> |
|
class X<br> |
|
{<br> |
|
public:<br> |
|
<br> |
|
static const Uint32 COLOR = 225;<br> |
|
};<br> |
|
<br> |
|
Use this instead:<br> |
|
<br> |
|
class X<br> |
|
{<br> |
|
public:<br> |
|
<br> |
|
static const Uint32 COLOR;<br> |
|
};<br> |
|
<br> |
|
And place this in the .cpp file:<br> |
|
<br> |
|
const Uint32 X::COLOR = 255;<br> |
|
<br> |
|
Or use enumerated types:<br> |
|
<br> |
|
class X<br> |
|
{<br> |
|
public:<br> |
|
<br> |
|
enum { COLOR = 225 };<br> |
|
};<br> |
|
</OL> |
|
|
<h2>The Source Tree Structure</h2> | <h2>The Source Tree Structure</h2> |
| |
<p>We work from a single source tree in CVS. We have a fixed structure for | <p>We work from a single source tree in CVS. We have a fixed structure for |