NetSurf
From NetSurf Development Wiki
Jump to: navigation, search

Documentation/Modular Coding Style

Modules

NetSurf's source is organised in modules. A module usually consists of a .c and .h file. For example the html module is in html.c and html.h.

All functions (including static functions) in a module should start <module>_, for example html_create(), html_process_data(), etc. This makes functions easy to find and names unique through the source, which isĀ helpful for backtraces, documentation, etc.

Global variables in a module (including static) should also start <module>_.

Static functions should all be declared at the top.

Put functions in a logical order, for example any init function first, then functions it calls, then the next externally available function, functions it calls, etc.

Coding Style

We use K&R (2nd edition ANSI C) style, tabs for indent, 80 characters wide, lower_case_with_underscores.

See the Style Guide for further information and examples.

NetSurf Code Documentation
Organization and Conventions
  1. Modular coding style
  2. Directory structure
  3. Error handling
  4. Memory management
Features
  1. Content handling
  2. Layout engine
  3. Frames
  4. Printing
  5. Treeview
Platform-specifics
  1. Front end functions
  2. Caveat RISC OS
  3. GTK interface
References
  1. References
Personal tools