]> jfr.im git - irc/evilnet/x3.git/blame - docs/coding-style.txt
Update chanserv.help
[irc/evilnet/x3.git] / docs / coding-style.txt
CommitLineData
ceafd592 1This file contains various development notes useful when coding X3.
d76ed9a9 2
3HEADER FILES
4------------
5If a file or feature is not defined in ANSI C89, an autoconf feature
6test should be used to verify that it is supported. ANSI C89
7specifies that the following header files exist:
8 <assert.h> <ctype.h> <errno.h> <float.h> <limits.h> <locale.h>
9 <math.h> <setjmp.h> <signal.h> <stdarg.h> <stddef.h> <stdio.h>
10 <stdlib.h> <string.h> <time.h>
11You may unconditionally include the above headers, or any that are
ceafd592 12shipped with X3. ALL other headers must be conditional.
d76ed9a9 13
14DEBUG MODE
15----------
16Many libraries are in debug mode by default, and require the C
17preprocessor symbol NDEBUG to be set to disable the debug features
18(this is inspired by the behavior of assert() from the C standard).
ceafd592 19Code in X3 should follow this convention.
d76ed9a9 20
21ASSERTIONS
22----------
23If you know that a certain condition is illegal, you should use the
24assert() macro to verify that it is false. Please do NOT silently
25fail by returning in these conditions.
26
27HELP FILES
28----------
29To maintain consistency, this is the format being used for the syntax
30examples in the help files:
31 - Text constants have no brackets around them
32 - Required arguments use <description-of-argument>
33 - Optional arguments use [description-of-argument]
34 Example: /msg $S COMMAND <arg1> [arg2]
35 Where COMMAND is a constant, arg1 is required, arg2 is optional
36 - If arguments have different valid values, separate them with a |
37 Example: /msg $S COMMAND <a|b|c> [foo|bar|baz]
38 - Arguments that are optional but have an extra argument (optional or not)
39 when they are used have this format: [<arg1> <arg2>] or [<arg1> [arg2]]
40 - Repeating arguments have this format: <arg1> <arg2> [<arg1> <arg2>]...
41 where both arg1 and arg2 are required for each repetition. If only one
42 argument is used in each repetition, no <> goes around the argument name
43 ([arg1]...)
44 - Commands like ChanServ's SET have the format /msg $S SET [<option> [value]]
45 - If there is a special case not covered above, try to find another command
46 that has a similar syntax, and adapt it. If that is not possible, use
47 something that makes sense.