This document describes my personal coding style, hopefully consistent for all programming languages I use.
Sources:
_
to separate names, i.e no camel case for variables._
m_
(Not necessary when you have to use this
anyway)s_
doxygen -g [config_file]
- generate a Doxyfilemv Doxyfile Doxyfile.all
touch Doxyfile
doxygen
– create the documentationPROJECT_NAME = "plcext" #PROJECT_NUMBER = 47.11 JAVADOC_AUTOBRIEF = YES OPTIMIZE_OUTPUT_FOR_C = YES #EXTRACT_ALL = YES # important for c INPUT = "V/plcext.386/Source" "V/plcext.386/Include/SMC" FILE_PATTERNS = "*.h" # important for c HTML_HEADER = "doc/doxyheader.html" GENERATE_LATEX = NO #OUTPUT_LANGUAGE = "German" OUTPUT_DIRECTORY = "/var/www/htdocs/doxygen/plcext" SORT_MEMBER_DOCS = NO DISTRIBUTE_GROUP_DOC = YES
In c and c++ documentation comments go only to the header files, not to the source files, because…
/** Liest bitweise von einem Plc-Datenwort. Abkuerzung fuer PlcDwBits_io() mit doSet=false @param this Zeiger auf die Objektdaten @param value Quelle fuer die Bits die in der Maske nicht gesetzt sind @see PlcDwBits_io() @return >=0: Ergebnis | -1: Fehler beim Zugriff aufs Datenwort */ int PlcDwBits_get(const PlcDwBits *this, unsigned short value);
or short form:
/** @todo Doc me! Untested! */ PlcDwRange *PlcDwRange_init(PlcDwRange *this, int db, int dw, int len, unsigned short *values);
To doc a file:
/** @file main.c
Project: appTemplate
Target: Kaeser Sigma Air Manager on Rmos3 v3.20 on Elan520
Author: Stefan Beckert
Version: $Id$
Compiler: CAD-UL ANSI C Cross Optimizing Compiler - Version: V701D
Description:
Blah blah
Todo:
Blah blah
*/
var ths= buf[0].getElementsByTagName("th"); // all thead th elements // get real number of columns (take colspans of th's into account) for (var col=0; col<ths.length; col++) { var th= ths[col]; var colsp= th.getAttribute('colspan'); if (!colsp) colsp= 1; for (var i=0; i<colsp; i++) this.thIdx.push(col); /* Store table header text and set the sort events Firefox supports setting event handling function like this: th.setAttribute('onclick', 'ts_doSort(...)') but IE6 not! */ if (th.getAttribute('ts_sortable') != 'false') { this.thText[col]= th.innerHTML; var ih = '<span';
Some facts about hungarian notation: