root / branches / linbox-2.0.0 / HACKING

Revision 1665, 12.5 kB (checked in by wan, 4 years ago)

little doc

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1In this file are instructions for developers and those wishing to
2contribute to Linbox. It is intended both for the uninitiated and for
3the reference of existing developers.
4
5I. Compilation and installation
6
7If you are installing from a tarred distribution, please see the file
8INSTALL for basic instructions on how to install Linbox. If you are
9installing from CVS, please see the instructions in section (III)
10below.
11
12II. Basic layout
13
14Linbox is a template library, so installation requires very little
15actual compilation. Nearly all of the library is in header
16files. Directories in the source distribution are as follows, relative
17to the tree's root:
18
19doc/      - Documentation (see below)
20examples/ - Simple examples to help new users get started with the
21                library
22macros/   - Files to assist the build system
23linbox/      - All library source (i.e. header files) goes here
24        algorithms/ - Specific algorithms
25        blackbox/   - Black box (i.e. matrix) objects
26        element/    - Objects representing field elements
27        field/      - Objects representing fields (e.g. rationals,
28                        integers modulo p, etc.)
29        randiter/   - Random number generators
30        solutions/  - Easy-to-use interfaces for solutions to problems
31        vector/     - Vector implementations
32        util/       - Utility routines that don't belong anywhere else
33                integer/ - C++ source code for GMP integer wrapper
34test/     - Tests for library performance and correctness
35util/     - Scripts and other miscellaneous items, mostly for making
36                library maintenance easier
37
38N.B. Though the doc/ directory contains some top-level and tutorial
39documentation, reference documentation is stored in parallel with the
40source code, under the src/ tree.
41
42III. CVS
43
44Linbox is stored in a CVS repository at the University of Delaware. To
45access the latest bleeding edge copy of Linbox from this source, you
46will need a working copy of CVS and all of the GNU development tools
47(e.g. autoconf, automake, GNU make, and so on). To access CVS:
48
490. Make sure you have the necessary tools installed
50
51You will need CVS installed. See http://www.cvshome.org/
52
53You will need GNU Autoconf, GNU Automake, GNU Libtool, and the GNU
54multiprecision library (GMP) to compile Linbox. Make sure the bin
55directories of the first three of those are all in your PATH, e.g. if
56you have Libtool installed in /usr/local/algebra/libtool, make sure
57/usr/local/algebra/libtool/bin is in your PATH.
58
59Also, if Automake is installed in a place separate from Autoconf, you
60will need to set the environment variable ACLOCAL_FLAGS to "-I
61<automake prefix>/share/aclocal", where <prefix> is the install prefix
62of Automake. Similarly, if Libtool is installed to a separate prefix,
63you should add "-I <libtool prefix>/share/aclocal" to ACLOCAL_FLAGS,
64where <libtool prefix> is the install prefix of Libtool.
65
66Of the four tools I have mentioned, only GMP is required if you are
67installing from a tarball. GNU Autoconf, GNU Automake, and GNU Libtool
68are only required for users of CVS and those individuals interested in
69doing major development work on the library.
70
71See http://www.gnu.org/software/autoconf/ for GNU Autoconf,
72http://www.gnu.org/software/automake/ for GNU Automake, and
73http://www.gnu.org/software/libtool/ for GNU Libtool.
74
751. Set your CVSROOT environment variable (on Bourne shell):
76
77export CVSROOT=:pserver:<username>@linbox.pc.cis.udel.edu:/home/cvs
78
79(and on the C shell):
80
81setenv CVSROOT :pserver:<username>@linbox.pc.cis.udel.edu:/home/cvs
82
832. Log in to CVS; you only ever need to do this once for any given
84Unix shell account:
85
86cvs login
87
883. Check out the linbox module
89
90cvs -z3 co linbox
91
92The -z3 option compresses the data in transit, making the operation
93faster for remote users.
94
954. Switch to the newly-created linbox directory and run the script
96autogen.sh, optionally specifying the installation prefix:
97
98cd linbox
99./autogen.sh [--prefix=<prefix>] [options]
100
101[options] include the following:
102
103        --with-gmp<prefix>    Prefix of your GMP installation
104        --with-ntl=<prefix>    Prefix of your NTL installation
105
106GMP is *required* for the library to compile, so you must specify
107--with-gmp=<prefix> if <prefix> is not a standard location such
108as /usr or /usr/local otherwise you juste give the option --with-gmp.
109
1105. Install the library:
111
112make install
113
114When you want to update your tree with the contents of the main CVS
115repository, issue the following command from the linbox/ directory:
116
117cvs -z3 up -dP
118
119The -z3 option is as before and the -dP option tells CVS to update the
120directory structure as well as the files. Note that the order of items
121in that command *is* important.
122
123You should receive some information on what files have been updated.
124If any files have a "U" or "P" before them, this means that there has
125been a change.  You are getting an updated version.
126If any files have a "M" before them, this means that a change in the
127repository has been merged with your version.  The appropriate question
128is "should I commit my version to the repository?"
129If any files have a "?" before them, this means that this is a file
130that CVS (and hence the rest of the team) knows nothing about.  If it
131is not a file created by build or install activity, the appropriate
132question is "should I add this to the repository?"
133If any files have a "C" before them, this means what you have
134conflicts with what is in the repository. In other words, you made
135changes while someone else made other changes and CVS does not know
136how to reconcile the two. You will need to edit that file manually,
137looking for and fixing lines like
138
139that show the sections that could not be reconciled.
140
141If you have made changes and would like to commit them to the global
142repository, issue the command
143
144cvs -z3 ci [<filename(s)>]
145
146The optional filename(s) argument specifies what you would like to
147commit; the default is to commit everything that has changed in the
148current directory and its descendents. When you enter this command, a
149text editor will come up prompting you for a log message. *ALWAYS
150ENTER A LOG MESSAGE DESCRIBING WHAT YOU HAVE CHANGED*. Failure to do
151so may result in your changes being backed out by the
152administrator. When you are done entering your message, simply save
153and exit the text editor.
154
155If you are not a main Linbox developer but would like to submit some
156addition or modification, your code is welcome. Please email a patch
157(use 'cvs -z3 diff -u' to form a patch) to us and we will consider
158including it.
159
160IV. Coding standards
161
1621. Indentation style
163
164We use the Linux indentation style, i.e. K&R with 1-tab = 8-space indents.
165We would like to keep this standard, so please use it for any code
166submitted to the project. The first line of code files should be
167/* -*- mode: C++; style: linux -*- */
168This will ensure linux indentation for emacs users.
169We make two exceptions to this indentation pattern, however.
170        1. There is no need to indent within the "namespace LinBox" block.
171        2. public, private, protected tags may be indented a half-tab.
172Here is an example:
173
174namespace LinBox
175{
176void myFunction (int a, int b, int c)
177{
178        int d;
179
180        if (a == 0) {
181                d = 1;
182        }
183        else if (a == 1) {
184                d = 2;
185                myOtherFunction (b, c);
186        } else
187                d = 3;
188} // myFunction
189
190template <class T>
191class MyClass : public MyOtherClass
192{
193        int _b;
194
195    public:
196        MyClass (int a)
197                : MyOtherClass (a), _b (0)
198        {
199        }
200}; // MyClass
201} // LinBox
202
2032. Naming conventions
204
205We use Java/Smalltalk conventions for naming classes, methods, and
206variables. Classes whose names have several words have all the words
207juxtaposed without underscores, and each word has its first letter
208capitalized (e.g. MyClass, MyOtherClass). Methods are similar, except
209that the first letter of the first word is lower case
210(e.g. myMethod). Global constants should be all upper case with
211underscores between the words (e.g. MY_CONSTANT). In addition,
212variables that are members of classes should begin with an underscore
213to differentiate them from methods and parameters (e.g. int _myMember;
214int myMember () const;).
215
216Directory and file names should be in lower case, with words separated
217by a hyphen ('-'), e.g. my-file.h
218
219We generally avoid abbreviations so as to avoid confusion among users
220of the library. However, some very commonly used features are
221abbreviated and some words commonly used together are treated as a
222single word. For example, we use "minpoly" rather than
223"MinimalPolynomial" and "Blackbox" rather than "BlackBox".
224
2253. Licensing
226
227This code is licensed under the GNU Lesser General Public License (see
228COPYING for details); all contributed code should be similarly
229licensed. We cannot accept any code that is released under a license
230legally incompatible with the LGPL, so please either license the code
231under the LGPL or explicitly place it in the public domain if you are
232unsure. Technically, code released without a license at all and not
233explicitly placed in the public domain is incompatible with the LGPL,
234so licensing it is important.
235
2363B. Intellectual property
237
238The original author of a program holds the copyright to that program.
239If another author changes the program, the changes are copyrighted to
240that other author provided that in the preamble a change is announced
241and that the places where the changes are made are annodated by the
242initials of the author and a date.
243
2444. Checklist for adding files
245
246The procedure for adding a file is based on the type of file being
247added.
248
2494.A. Adding header files
250
251In the text below <filename> refers to the file you are adding and
252<dir> refers to the directory where the file you are adding is
253located.
254
255        1. Make sure the file has the correct format, with the
256           author's name and a copyright and license notice at the
257           file's top. Also make sure it follows coding standards to
258           the best of your ability.
259
260        2. Open <dir>/Makefile.am and locate the list that starts with
261           include_HEADERS. Add your file to that list. If you add it
262           to the end of the list, make sure the preceding line ends
263           with a backslash '/'.
264
265        3. Add an entry to linbox-new/ChangeLog of the following form:
266
267                2002-02-03  Bradford Hovinen  <hovinen@ximian.com>
268
269                        * <dir>/Makefile.am (include_HEADERS): Added <filename>
270
271           Replace the date, name, and email I have given with the
272           current date and your own name and email.
273
274        4. Run the command "cvs add <filename>" from the directory
275           where the file is located.
276
277        5. Commit your changes with "cvs ci", issued from the
278           linbox-new directory. When the editor opens up to enter
279           your log entry, use the text that you just entered in the
280           ChangeLog.
281
2824.B. Adding a test
283
284All tests should go in the directory tests. They should be in the form
285of a standalone program that can run a sensable test with no command
286line arguments, preferably with a name prefixed by "test-". In the
287text below, <test> refers to the name of your test binary,
288e.g. test-minpoly. <mod-test> refers to the result of replacing all
289"-" and "." characters in <test> with an underscore "_". <test-source>
290refers to the name of the source file; the procedure works just as
291well if you have multiple source files. By convention, the name of the
292source file should be <test>.C
293
294        1. As above, make sure the file has the correct format.
295
296        2. Open tests/Makefile.am. Add <test> to the line that starts
297           with "BASIC_TESTS = ".
298
299        3. You will see a list of blocks that look like:
300
301                test_sparse_matrix_SOURCES =            \
302                        test-0-matrix.C         \
303                        test-common.C   test-common.h
304
305           Below the last such block, add a block of the following form:
306
307                <mod-test>_SOURCES =            \
308                        <test-source>           \
309                        test-common.C   test-common.h
310
311        4. Open tests/.cvsignore and add <test> on a line by itself
312           to that file.
313
314        5. Open linbox-new/ChangeLog and add a block of the following
315           format:
316
317                2002-02-03  Bradford Hovinen  <hovinen@ximian.com>
318
319                        * tests/Makefile.am (BASIC_TESTS): Added <test>
320
321        6. Add the file to cvs with "cvs add <test-source>"
322
323        7. Commit your changes with "cvs ci tests", issued from the
324           linbox-new directory. Use the text you entered in ChangeLog
325           for your log entry.
326
3275. Miscellanae
328
329We put all of our declarations in the namespace LinBox. Please put the
330lines
331
332namespace LinBox
333{
334
335... // Your code here
336
337}
338
339in all header files of contributed code.
340
341All header files should have a set of preprocessor directives to
342prevent multiple inclusion. If your header file is named
343my-header-file.h, use
344
345#ifndef __MY_HEADER_FILE_H
346#define __MY_HEADER_FILE_H
347
348... // Your code here
349
350#endif // __MY_HEADER_FILE_H
351
352surrounding the whole file, except possibly any comments you have at
353the top.
354
355All files should contain a comment at the top indicating the file
356name, copyright, authors, and licensing. Additional documentation
357would be useful. You may use any of the files in this library as a
358template.
359
360==================
361The Linbox Team
Note: See TracBrowser for help on using the browser.