diff --git a/CodingStyle.txt b/CodingStyle.md similarity index 67% rename from CodingStyle.txt rename to CodingStyle.md index 418f7118..b51f84e8 100644 --- a/CodingStyle.txt +++ b/CodingStyle.md @@ -1,5 +1,3 @@ -$Id$ - vim: spelllang=en tw=78 This is a short introduction to the coding style that shall be used. The below @@ -7,11 +5,11 @@ rules are applicable for all C source files, except the Ethernet drivers, for which the Linux Kernel coding style shall be used to minimize the differences). -1) Line length +# Line length - Lines shall not exceed 78 characters. -2) Whitespace +# Whitespace - Indentation shall be done using 4 space characters @@ -20,36 +18,39 @@ differences). - After commas, colons and semicolons, a single space shall be placed (if not followed by a line break). -- Binary operators (=, ==, ~=, |, ||, etc.) shall be enclosed by 2 spaces - (except . and ->). +- Binary operators (`=`, `==`, `~=`, `|`, `||`, etc.) shall be enclosed by 2 spaces + (except `.` and `->`). -3) Placing braces +# Placing braces - Braces shall be placed in the following way (K&R style): - if (...) { - ... - } else if (...) { - ... - } else { - ... - } +```c +if (...) { + ... +} else if (...) { + ... +} else { + ... +} - int function(...) - { - ... - } +int function(...) +{ + ... +} +``` -4) Defines and Macros +# Defines and Macros - Defines and macros shall be named in CAPITAL letters. If a macro contains multiple statements, they should be enclosed by a 'do {} while (0)' loop. Macro parameters shall also be capital letters and shall be enclosed py parantheses if necessary. - #define MACRO(A, B) \ - do { \ - if ((A) == 1) { \ - statement(B); \ +```c +#define MACRO(A, B) \ + do { \ + if ((A) == 1) { \ + statement(B); \ } while (0) - +``` diff --git a/README.md b/README.md index b16a75b3..be19d3e7 100644 --- a/README.md +++ b/README.md @@ -3,12 +3,12 @@ This is the README file of the IgH EtherCAT Master. vim: spelllang=en spell tw=78 Contents: -- general-information -- requirements -- building-and-installing -- realtime-and-tuning -- license -- coding-style +- (#general-information) +- (#requirements) +- (#building-and-installing) +- (#realtime-and-tuning) +- (#license) +- (#coding-style) # General Information @@ -19,11 +19,13 @@ information, see http://etherlab.org/en/ethercat. or contact -> Dipl.-Ing. (FH) Florian Pose -> Ingenieurgemeinschaft IgH -> Nordsternstraße 66 -> D-45329 Essen -> http://igh.de +>>> +Dipl.-Ing. (FH) Florian Pose +Ingenieurgemeinschaft IgH +Nordsternstraße 66 +D-45329 Essen +http://igh.de +>>> # Documentation @@ -108,4 +110,4 @@ property and similar rights of Beckhoff Automation GmbH. # Coding Style Developers shall use the coding style rules in the [coding style -file](CodingStyle.txt). +file](CodingStyle.md).