|
|
CodingStyle
Describe the coding style used in Syx
Basic
- The C style is very close to the one adopted by Glib
- Typical GNU indentation 2 spaces, default in Emacs
- Use spaces instead of tabs
- Use spaces between function names and parenthesis, not necessarily for macros
Naming
- Names are lower case with underlines, except for structures.
- Each structure has its own typedef.
- Files are named as syx-COMPONENT.{c,h}
- Use macros or inline functions when possible
- Functions names have this form:
syx_COMPONENT_new syx_COMPONENT_do_something syx_COMPONENT_set_variable syx_COMPONENT_get_variable
Patches
Once you create a patch, if you can, also add a ChangeLog entry with your name, email and the files you changed and why.
Accessing objects
- Each object has its own data that can be accessed through the macro SYX_OBJECT_DATA(object), for example:
SyxOop var = SYX_OBJECT_DATA(object)[index]; SYX_OBJECT_DATA(object)[index] = var;
SyxOop var = SYX_OBJECT_VARS(object)[index]; SYX_OBJECT_VARS(object)[index] = var;
syx_symbol symbol = SYX_OBJECT_SYMBOL(oop); syx_string string = SYX_OBJECT_STRING(oop); syx_uint8 *byte_array = SYX_OBJECT_BYTE_ARRAY(oop); syx_double float_num = SYX_OBJECT_FLOAT(oop); mpz_t large_num = SYX_OBJECT_LARGE_INTEGER(oop);
SYX_CLASS_SUPERCLASS(class) SYX_METHOD_SELECTOR(method) SYX_PROCESS_STACK(process) ...
syx_object_get_class (SyxObject *object) syx_object_set_class (SyxObject *object)
Sign in to add a comment
