mirror of https://github.com/Gnucash/gnucash
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2693 57a11ea4-9604-0410-9ed3-97b8803252fdzzzoldreleases/1.6
parent
34746c6ebf
commit
7387840c76
@ -0,0 +1,64 @@
|
||||
Hacking Guidelines
|
||||
==================
|
||||
|
||||
This document is an introduction to hacking on GnuCash.
|
||||
|
||||
Related Documents
|
||||
-----------------
|
||||
|
||||
In addition to this file, you should read the README file, which
|
||||
explains the details of getting the CVS source, building GnuCash,
|
||||
and creating patches for submission.
|
||||
|
||||
The src/doc/design directory contains a preliminary design document
|
||||
which you should read as well. You should also feel free to hack on
|
||||
the design document.
|
||||
|
||||
|
||||
Coding Style Conventions
|
||||
------------------------
|
||||
|
||||
General:
|
||||
|
||||
* When modifying a file, the style convention in that file should be
|
||||
followed.
|
||||
|
||||
* When creating a new file, the style of existing files should be
|
||||
followed.
|
||||
|
||||
* When creating lots of new files in a new directory, use the GNU
|
||||
|
||||
* Do not submit patches that consist of (gratuitous) stylistic changes.
|
||||
|
||||
|
||||
C:
|
||||
|
||||
* Use ISO C.
|
||||
|
||||
* Use glib memory routines where possible. This means you should be
|
||||
using g_malloc(), g_new(), g_free(), etc., instead of malloc(),
|
||||
free(), etc. Do not mix glib memory calls with libc calls!
|
||||
|
||||
* All gnucash functions and global variables are prefixed with gnc_
|
||||
|
||||
* All private functions are enclosed in __ (i.e. _gnc_do_not_call_)
|
||||
|
||||
* Use static functions whenever possible
|
||||
|
||||
* Use const whenever possible
|
||||
|
||||
|
||||
Scheme:
|
||||
|
||||
* All gnucash functions and global variables are prefixed with gnc:
|
||||
|
||||
* All global variables are enclosed in ** (i.e. gnc:*load-path*)
|
||||
|
||||
* All private functions are enclosed in __ (i.e. gnc:_do-not-call_)
|
||||
|
||||
* All C functions wrapped with g-wrap have dashes in place of underscores.
|
||||
(xaccSplitGetBalance --> gnc:split-get-balance).
|
||||
|
||||
|
||||
Dave Peticolas <dave@krondo.com>
|
||||
August 22, 2000
|
||||
@ -1,58 +0,0 @@
|
||||
|
||||
Coding Style Conventions
|
||||
------------------------
|
||||
|
||||
I have a headache at the moment, which is probably the ideal state of mind to
|
||||
be in when approaching such discussions. My personal experience is that no
|
||||
single style will satisfy everyone, and the discussions will resume no matter
|
||||
how often they are put to bed.
|
||||
|
||||
So here is the law:
|
||||
|
||||
1) when modifying a file, the style convention in that file must be
|
||||
followed.
|
||||
|
||||
2) when creating a new file, the style of the existing files must be
|
||||
followed.
|
||||
|
||||
3) when creating eleven or more new files, you can invent your own coding
|
||||
style. (As of this writing, this means that only Robin Clark, Robb
|
||||
Browning, Jeremy Collins & Linas Vepstas get to pick a style).
|
||||
I.E. when creating about 10% or more new code.
|
||||
|
||||
4) I won't accept diffs that consist of (gratuitous) stylistic changes.
|
||||
I get to decide what "gratuitous" means.
|
||||
|
||||
5) I don't care about emacs control strings. I don't use emacs. See
|
||||
rule 3 for additional info.
|
||||
|
||||
-- Linas Vepstas
|
||||
17 August 1998
|
||||
|
||||
|
||||
Things we actually do care about:
|
||||
|
||||
* Don't use dangling if clauses. i.e. don't do this...
|
||||
|
||||
if(x) {
|
||||
foo();
|
||||
bar();
|
||||
} else
|
||||
baz();
|
||||
|
||||
|
||||
|
||||
|
||||
Rob's Style conventions (for anyone who cares):
|
||||
|
||||
Scheme:
|
||||
* all gnucash functions and global variables are prefixed with gnc:
|
||||
* all global variables are enclosed in ** (i.e. gnc:*load-path*)
|
||||
* all private functions are enclosed in __ (i.e. gnc:_do-not-call_)
|
||||
* all C functions exported via swig have underscores in place of dashes
|
||||
|
||||
C:
|
||||
* all gnucash functions and global variables are prefixed with gnc_
|
||||
* all private functions are enclosed in __ (i.e. _gnc_do_not_call_)
|
||||
* use static functions whenever possible
|
||||
* use const whenever possible
|
||||
Loading…
Reference in new issue