legacy/experimental/libimgi/trunk/HACKING

89 lines
1.5 KiB
Plaintext
Raw Normal View History

2008-03-17 22:09:12 +00:00
/* This document will contain general hacking rules for libimgi */
C Code guidelines:
-------------------
- Never more than 80 chars horizontally
- Only use C-Style commenting
- function names: lower case, separated by underscore
- Using lint is strongly recommended
- Use 4 spaces, not tabs
Code should be formatted according to following example:
# include "stdio.h"
char *buffer; /* Comments to the right of declarations */
char *start, *end, *last;
char *name;
/* This separates blocks of declarations */
int baz;
struct square {
int x;
int y;
};
#ifdef ENABLE_NLS
bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
#else /* Comments to the right of preproc directives */
textdomain(PACKAGE);
#endif
int
foo(int number, int len, char *name)
{
if (number > 0) {
for (int i = 0; i < 7; i++)
len++;
number--;
} else {
while (len) {
len--};
number++;
}
puts("Hi");
}
/*
The procedure bar is even less interesting.
it does nothing particular :)
*/
char*
bar(int nb)
{
long c;
c = (long) foo(2, 5, "end");
/* Write "Hello" to Console */
puts("Hello");
switch (nb) {
case 0:
break;
case 1:
nb++;
break;
default:
break;
}
}
int
bool_test(char *mask)
{
if (mask
&& ((mask[0] == '\0') ||
(mask[1] == '\0' && ((mask[0] == '0') || (mask[0] == '*')))))
return 0;
}
int
function_with_lots_of_arguments(char* arg1, char* arg2, int arg3, int arg4,
char* arg5, void* arg6, int arg7, float arg8, float arg9, float arg10,
int arg11, char* arg12)
{
return 0;
}