Debian Codegraph @

debian/external_deps/fetk/punc/doc/doxygen/prog.h

raw
1 /**
2 * <center>
3 * @mainpage PUNC Programmer's Guide
4 * </center>
5 *
6 * <hr width="100%">
7 *
8 *
9 * @section toc Table of Contents
10 * <ul>
11 * <li> @ref intro
12 * <li> @ref style
13 * <li> @ref api
14 * <ul>
15 * <li> <a href="modules.html">Modules</a>
16 * <li> <a href="annotated.html">Class list</a>
17 * <li> <a href="functions.html">Class members</a>
18 * <li> <a href="globals.html">Class methods</a>
19 * </ul>
20 * <li> @ref license
21 * </ul>
22 *
23 * <p>
24 * <i>
25 * NOTE:
26 * </i>
27 * This documentation provides information about the programming interface
28 * provided by the PUNC software and a general guide to linking to the PUNC
29 * libraries. Information about installation, configuration, and general usage
30 * can be found in the <a href="../../index.html">User's Guide</a>.
31 * <hr>
32 *
33 * \section intro Introduction
34 *
35 * <p>
36 * PUNC
37 * (Portable Understructure for Numerical Computing) was written by
38 * <a href="http://www.scicomp.ucsd.edu/~mholst/">Michael Holst</a>
39 * at Caltech and UC San Diego, primarily as a portability layer for
40 * <a href="http://www.fetk.org">FETK</a>
41 * (the Finite Element TookKit).
42 *
43 * \section formalism Clean OO C Formalism
44 *
45 * <p>
46 * PUNC was written in
47 * <a href="../../cooc.html">Clean OO C</a>,
48 * which is a self-imposed disciplined coding formalism for
49 * producing object-oriented ANSI/Standard C which can be
50 * compiled with either a C or C++ compiler.
51 * We will briefly describe the formalism here
52 * (borrowing from N. Baker's nice description in the APBS documentation).
53 *
54 * <p>
55 * Clean OO C formalism requires that all public data is
56 * enclosed in structures which resemble C++ classes. These structures and
57 * member functions are then declared in a public header file which provides a
58 * concise description of the interface (or API) for the class.
59 * Private functions and
60 * data are included in private header files (or simply the source code files
61 * themselves) which are not visible generally visible (data encapsulation).
62 * When using the library, the
63 * user only sees the public header file and the compiled library and is
64 * therefore (hopefully) oblivious to the private members and functions. Each
65 * class is also equipped with a constructor and destructor function which is
66 * responsible for allocating and freeing any memory required by the
67 * instatiated objects.
68 *
69 * <p>
70 * Public data members are enclosed in C structures which
71 * are visible to the library user. Public member functions are generated by
72 * mangling the class and function names and passing a pointer to the
73 * object on which the member function is supposed to act. For example, a
74 * public member function with the C++ declaration
75 * <pre>
76 * public double Foo::bar(int i, double d)
77 * </pre>
78 * would be declared as
79 * <pre>
80 * VEXTERNC double Foo_bar(Foo *thee, int i, double d)
81 * </pre>
82 * where <code>VEXTERNC</code> is a compiler-dependent macro, the underscore
83 * <code>_</code> replaces the C++ double-colon <code>::</code>, and
84 * <code>thee</code> replaces the <code>this</code> variable implicit in all
85 * C++ classes. Since they do not appear in public header files, private
86 * functions could be declared in any format pleasing to the user, however, the
87 * above declaration convention should generally be used for both public and
88 * private functions. Within the source code, the public and private function
89 * declarations/definitions are prefaced by the macros <code>VPUBLIC</code> and
90 * <code>VPRIVATE</code>, respectively. These are macros which reduce global
91 * name pollution, similar to encapsulating private data withing C++ classes.
92 *
93 * <p>
94 * The only C++ functions not explicitly covered by the above declaration
95 * scheme are the constructors (used to allocate and initialize class data
96 * members) and destructors (used to free allocated memory). These are
97 * declared in the following fashion: a constructor with the C++ declaration
98 * <pre>
99 * public void Foo::Foo(int i, double d)
100 * </pre>
101 * would be declared as
102 * <pre>
103 * VEXTERNC Foo* Foo_ctor(int i, double d)
104 * </pre>
105 * which returns a pointer to the newly constructed <code>Foo</code> object.
106 * Likewise, a destructor declared as
107 * <pre>
108 * public void Foo::~Foo()
109 * </pre>
110 * in C++ would be
111 * <pre>
112 * VEXTERNC void Foo_dtor(Foo **thee)
113 * </pre>
114 * in Clean OO C.
115 * <p>
116 * Finally, inline functions in C++ are simply treated as macros in Clean OO C
117 * and declared/defined using "#define" statements in the public
118 * header file.
119 * See any of the PUNC header files for more examples on the Clean OO C
120 * formalism.
121 *
122 * \section style Coding Style
123 *
124 * <p>
125 * The best (and most entertaining) description of a C coding style that is
126 * very close to what I use in PUNC is that described by Linus Torvalds in his
127 * "CodingStyle" file in the Linux kernel sources (usually found in the file
128 * "/usr/src/linux/Documentation/CodingStyle" on any Linux box). He describes
129 * a coding style that is modular, completely documented (but in a spartan way),
130 * and very practical.
131 *
132 * <p>
133 * Below are some additional notes on the coding style
134 * I use in PUNC beyond what Torvalds describes.
135 * These additional guidelines
136 * are mostly concerned with being compatible with the Clean OO C dialect,
137 * giving an object-oriented look and feel to PUNC.
138 * <ul>
139 * <li>
140 * Tabs and spaces ==> Probably the most important rule: NO TABS!
141 * <p>
142 * Use ONLY SPACES, NO TABS, in source code.
143 * When indenting a code block, ALWAYS USE EXACT 4 SPACES,
144 * no more, no less. While this single anal rule seems
145 * excessive, in my experience it is the single most useful
146 * code formatting guideline one can impose, in terms of
147 * producing code written by many different developers that
148 * can be read and understood quickly by other developers
149 * using the same convention. If four spaces (rather than
150 * two or three) forces you to use more than 80 columns for
151 * nesting loops/etc, then your routine is too complex to
152 * be read by someone else anyway and it should be split
153 * into two or more routines.
154 * <p>
155 * <li>
156 * ALLCAPS ==> A "#define"d constant or a macro. Examples:
157 * <pre>
158 * "#define" VTRUE 1
159 * "#define" VFALSE 0
160 * "#define" VABS(x) ((x) >= 0 ? (x) : -(x))
161 * </pre>
162 * <li>
163 * UpperMixed ==> Class name, or class constructor or destructor.
164 * Examples:
165 * <p>
166 * <pre>
167 * C++: class Mesh { ... };
168 * Mesh(void) { ... }
169 * ~Mesh(void) { ... }
170 *
171 * Clean C: typedef struct Mesh { ... } Mesh;
172 * void Mesh_ctor(Mesh *thee) { ... }
173 * void Mesh_dtor(Mesh *thee) { ... }
174 * </pre>
175 * NOTE: The "this" pointer is implicitly used in C++. We
176 * simulate this coding style with the "thee" pointer
177 * in Clean C. By using a name different than "this",
178 * we continue to have a legal C++ program.
179 * <p>
180 * <li>
181 * lowerMixed ==> A class member function or generic function. Examples:
182 * <p>
183 * <pre>
184 * C++: Class Mesh {
185 * ...
186 * void print(void) { ... }
187 * ...
188 * }
189 * void Mesh::plot(void) { ... }
190 *
191 * Clean C: void Mesh_print(Mesh *thee) { ... }
192 * void Mesh_plot(Mesh *thee) { ... }
193 * </pre>
194 * <li>
195 * _private data ==> Pre-fixed with an underscore, such as: vint _dim.
196 * <p>
197 * I don't always adhere to this, but it helps make
198 * it clear when you are doing something unsafe with
199 * private data that you should have written an accessor
200 * member function to handle. (UPDATE: I no longer allow
201 * this practice in PUNC, because symbols beginning with
202 * an underscore often conflict with internal compiler
203 * symbols in GCC and other ANSI-C compilers.)
204 * <li>
205 * Datatypes ==> Use only standard or compatible datatypes.
206 * <p>
207 * Beyond the stuctures used to define classes, only standard
208 * datatypes are used as primitive types in PUNC, such as
209 * char, int, float, and double.
210 * <p>
211 * <li>
212 * Core structures ==> Refer to headers vel.h and ves.h in the GEM library
213 * for examples.
214 * <p>
215 * <li>
216 * Other comments ==> We basically adhere to the GNU coding conventions,
217 * except that Richard Stallman recommends (in his GNU
218 * Coding Standards paper) writing blocks as follows:
219 * <pre>
220 * if (cond)
221 * {
222 * }
223 * </pre>
224 * whereas I find the following usually more readable:
225 * <pre>
226 * if (cond) {
227 * }
228 * </pre>
229 * However, for complete routines I do follow
230 * Richard's approach:
231 * <pre>
232 * void func(void)
233 * {
234 * ...stuff...
235 * }
236 * </pre>
237 * If something is very simple then I break all rules:
238 * <pre>
239 * int myId(void) { return id; }
240 * </pre>
241 * </ul>
242 *
243 * @section api Application programming interface documentation
244 * <p>
245 * The API documentation for this code was generated by
246 * <a href="http://www.doxygen.org">doxygen</a>. You can either view the API
247 * documentation by using the links at the top of this page, or the slight
248 * re-worded/re-interpreted list below:
249 * <ul>
250 * <li> <a href="modules.html">Class overview</a>
251 * <li> <a href="annotated.html">Class declarations</a>
252 * <li> <a href="functions.html">Class members</a>
253 * <li> <a href="globals.html">Class methods</a>
254 * </ul>
255 *
256 * @section license License
257 *
258 @verbatim
259
260 PUNC = < Portable Understructure for Numerical Computing >
261 Copyright (C) 1994-- Michael Holst <[email protected]>
262
263 This program is free software; you can redistribute it and/or modify it
264 under the terms of the GNU General Public License as published by the
265 Free Software Foundation; either version 2 of the License, or (at your
266 option) any later version.
267
268 This program is distributed in the hope that it will be useful,
269 but WITHOUT ANY WARRANTY; without even the implied warranty of
270 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
271 See the GNU General Public License for more details.
272
273 You should have received a copy of the GNU General Public License along
274 with this program; if not, write to the Free Software Foundation, Inc.,
275 675 Mass Ave, Cambridge, MA 02139, USA.
276
277 @endverbatim
278 */