diff options
author | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2000-01-12 18:01:31 +0000 |
---|---|---|
committer | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2000-01-12 18:01:31 +0000 |
commit | d23c710711b89a9596f9fa1de185528a89f2a3f7 (patch) | |
tree | 2ec6154391af468aea0a36d49ba54fed9a1a5a98 /doc/MaintGuide/Style.tex | |
parent | 4aff8d3bcf540204c642ed0d8b6015b9c0e3a9d8 (diff) |
Start of the maintainers guide.
Tom
git-svn-id: http://svn.cactuscode.org/flesh/trunk@1243 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'doc/MaintGuide/Style.tex')
-rw-r--r-- | doc/MaintGuide/Style.tex | 150 |
1 files changed, 150 insertions, 0 deletions
diff --git a/doc/MaintGuide/Style.tex b/doc/MaintGuide/Style.tex new file mode 100644 index 00000000..a7537b4e --- /dev/null +++ b/doc/MaintGuide/Style.tex @@ -0,0 +1,150 @@ +% /*@@ +% @file Style.tex +% @date Wed Jan 12 15:01:09 2000 +% @author Tom Goodale +% @desc +% +% @enddesc +% @version $Header$ +% @@*/ +\begin{cactuspart}{1}{Philosphy and Style}{$RCSfile$}{$Revision$} +\renewcommand{\thepage}{\Alph{part}\arabic{page}} + +\chapter{Philosophy} + +\begin{itemize} +\item +Portable +\item +Extensable +\item +Modular +\end{itemize} + +\chapter{Coding Style} + +The flesh has been written with the following coding guidelines... + + +\section{Indentation} + +Two spaces, no tabs. + +Two spaces are enough to clearly indent, more would be a waste of +space, less not really noticeable. + +\section{Brace positioning} + +Each opening brace should appear on a line by itself, +aligned with the preceeding statement. + +Closing braces should line up with the corresponding +opening brace, and should be on lines by themselves +apart from the {\tt while} in a +% +\begin{verbatim} +do +{ + +... + +} while(...); + +\end{verbatim} +% +statement. + +This brace positioning stategy makes it easy to run ones eye from a closing +or opening brace to its matching opening or closing brace. + +\section{GRDOC} + +All files should start with a grdoc header, and all functions +should have grdoc headers. + +The file grdoc should contain a description of the contents of the file +and an \@version with the CVS \$Header\$ tag. + +The function grdoc should contain + +\begin{itemize} +\item +a description of the function, saying what it does. +\item +all function arguments with descriptions +of what they are and what they are used for. +\item +the return codes should be described. +\end{itemize} + +After the first actual release the history should be filled +in with each change. + +\section{Header Files} + +Header files should not include any system header file, but should +contain in the initial comment a list of system header files which +are assumed to have been included before this file is included. + +The body of a header should be protected against multiple inclusion +by lines of the form + +\begin{verbatim} +#ifndef _NAMEOFHEADERFILEINCAPITALS_H_ +#define _NAMEOFHEADERFILEINCAPITALS_H_ + +...body of header file... + +#endif /* _NAMEOFHEADERFILEINCAPITALS_H_ */ + +\end{verbatim} + +Function prototypes in header files should be protected +against C++ linkage by + +\begin{verbatim} +#ifdef __cplusplus +extern "C" +{ +#endif + +...prototypes... + +#ifdef __cplusplus +} +#endif +\end{verbatim} + +\section{Source Files} + +Source files should have as their first line under the +grdoc header a line containing + +\begin{verbatim} +static char *rcsid = "$Header$" +\end{verbatim} +or the expanded rcs version of this. + +Globally visable functions should appear before local +functions. + +(NOTE: currently the schedule stuff is a good example of +what I'm coming to like as a style, e.g. +src/main/ScheduleInterface.c ) + +\section{Naming Conventions} + +All functions which may be used by thorns should have names beginning +with {\tt CCTK\_}. + +All functions used internally by the flesh should have names beginning with +{\tt CCTKi\_}. + +Header files to be included by thorns should have names beginning with +{\tt cctk\_}. + + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\end{cactuspart} |