!>
Some Gandalf conventions are described in chapter 1 of the Gandalf tutorial documentation. You should become familiar with these. For people writing new Gandalf code, the following conventions should also be applied.for (int iCtr = 0; iCtr < iMaxIndex; iCtr++) { /* loop body */ }
/** * File: $RCSfile: conventions.html,v $ * Module: SHORT DESCRIPTION OF YOUR FILE * Part of: Gandalf Library * * Revision: $Revision: 1.4 $ * Last edited: $Date: 2003/01/31 18:30:17 $ * Author: $Author: pm $ * Copyright: (c) 2002 YOUR INSTITITION */ /* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _GAN_YOUR_FILE_H #define _GAN_YOUR_FILE_H /* ANY STANDARD HEADERS REQUIRED TO COMPILE THIS HEADER FILE, E.G. */ #include <stdlib.h> /* ANY OTHER GANDALF HEADERS REQUIRED TO COMPILE THIS HEADER FILE, E.G. */ #include <gandalf/common/misc_defs.h> #ifdef __cplusplus extern "C" { #endif /* YOUR DECLARATIONS */ #ifdef __cplusplus } #endif #endif /* #ifndef _GAN_YOUR_FILE_H */Note that there is no need to edit the revision and date. These will be updated automatically by CVS (actually the RCS file name will be updated as well). The extern "C" declaration is there so that C++ code incorporating Gandalf will correctly interpret the Gandalf header files as containing C functions. C source files will have the structure
/** * File: $RCSfile: conventions.html,v $ * Module: SHORT DESCRIPTION OF YOUR FILE * Part of: Gandalf Library * * Revision: $Revision: 1.4 $ * Last edited: $Date: 2003/01/31 18:30:17 $ * Author: $Author: pm $ * Copyright: (c) 2002 YOUR INSTITITION */ /* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* This should be the first header file included */ #include <gandalf/linalg/YOUR_FILE.h> /* any other header files your C file needs */ /* your code */
/** * \brief Macro: Allocate and return a generic matrix. * * Allocates and returns a generic rectangular matrix with given dimensions. * * Implemented as a macro call to gan_mat_form_gen(). * \sa gan_mat_form(). */ #ifdef GAN_GENERATE_DOCUMENTATION Gan_Matrix *gan_mat_alloc ( unsigned long rows, unsigned long cols ); #else #define gan_mat_alloc(rows,cols) gan_mat_form_gen(NULL,rows,cols,NULL,0) #endifThe function declaration is only parsed when Doxygen is used, in which case GAN_GENERATE_DOCUMENTATION is predefined for the purposes of Doxygen's preprocessor. In this way the macro will be documented in the same way as a normal function. It is important to retain the Macro: prefix to the brief documentation line, so that it is clear in the documentation which routines are macros and which are real functions.