resetting manifest requested domain to floor
[platform/upstream/enchant.git] / HACKING
1 * Don't commit directly, instead send your diff to the authors (use
2   'cvs diff -Nu').
3
4 Working in libenchant
5 -------------------
6
7    When writing libenchant our priorities are
8
9         1) Portable
10         2) Maintainable & Documented
11         3) Modular and well designed
12
13     When you submit code to inclusion in libenchant, or when you modify the sources
14 directly on the CVS repository, please keep those things in mind.  While
15 performance is important please note that we do not want to hand tune code
16 to shave milliseconds at this point.  Well designed algorithms and data
17 strucutures are fertile areas for development, obfuscated code to make a
18 loop 3% faster is not.  Specifically, this means:
19
20         - Clarity of design and function are paramount
21         - Make sure your code does not generate warnings at all.
22         - Please follow the formatting style
23
24 Formatting style
25 ----------------
26
27    The formatting style of libenchant is a mix of various styles, make
28 yourself familiar with the GNU coding standards (shipped with most
29 GNU/Linux systems as the standards.info file), then read the Linux
30 kernel coding standards and ignore Linus' jokes.  Then look at the
31 Gtk+ header files to get aquainted on how to write nice header files
32 that are almost self documenting. 
33
34    Remember: Use 8 space tabs for indentation: that will keep your
35 code honest as you will be forced to split your routines in more
36 modular chunks (as detailed by Linus). 
37    
38    Emacs users can get the default indentation style with this:
39   (set-c-style "K&R")
40   (setq c-basic-offset 8)
41
42    On top of that, you will have to:
43
44         - Follow the Gtk+ cleanliness conventions for function
45           prototypes.
46
47         - Follow the Gtk+ namespace convention for function names. 
48           module_submodule_operation
49
50         - Make sure your code does not have a single warning (with the
51           default strong warnings that Gnumeric compiles with) before
52           your code is submited. (Although we do not advocate -Werror)
53
54         - Every entry point to a public routine should use the
55           g_return_if_fail and g_return_val_if_fail macros to verify
56           that the parameters passed are valid.
57
58         - Under no circunstances use magic variables.  Use typedef
59           enum { ... } type; to create enumerations.  Do not use
60           integers to hold references to enumerations, the compiler
61           can help catch various errors.
62
63         - Use g_warning to mark spots that need to be reviewed or are
64           not finished to let me fix it eventually.
65
66         - Do not submit code that is just a temporary workaround for a
67           full fledged feature.  i.e. don't submit a quick hack at
68           "search text" which is not designed to be expanded upon.  We
69           do not want to maintain limited features.  It is better submit an
70           implementation that has been designed to be expanded and enhanced,
71           even if it is not completely finished.
72
73         - It is more important to be correct than to be fast.  
74
75         - Do not optimize unnecesarly.  Do profile, do look for the
76           weak spots before applying "optimization by feeling".  This
77           is not a Ouija-based project. 
78
79         - It is more important to keep the code maintainable and
80           readable than to be fast.  If you have a great idea about
81           optimizing the code, make sure it is implemented cleanly,
82           that there is a clean and maintainable way to do it:  
83
84         - Fast code that is difficult to maintain has no place in
85           Gnumeric and will be dropped.
86
87         - Follow the libenchant commenting style, which is not the Gtk
88           style;
89                 /* ie. use this for
90                  * multi-line comments
91                  */
92
93    All of this is to ensure the libenchant code will be kept within
94 reasonable margins of maintainability for the future: Remember, in two years
95 you will probably be far too busy to maintain your own contributions, and they
96 might become a burden to the program maintainers.
97
98    libenchant is intented to be a foundation for a various document centric
99 projects.
100
101    Cleaning code in libenchant is more important than trying not to break
102 existing code.  By all means, code clean ups are always welcome.