From d0ed94577c5220a836c8e2d0c0e7506cc198a465 Mon Sep 17 00:00:00 2001 From: Patrick Vogler Date: Thu, 22 Jun 2023 13:50:24 +0000 Subject: [PATCH] Update 'Coding Style' --- Coding-Style.md | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/Coding-Style.md b/Coding-Style.md index 81dbf49..1057822 100644 --- a/Coding-Style.md +++ b/Coding-Style.md @@ -18,6 +18,7 @@ This document discusses practices and style for programmers working on the BigWh - [The Single Most Important Rule](#the-single-most-important-rule) - [Formatting](#formatting) - [Indentation](#indentation) + - [Line Continuation](#line-continuation) - [Braces](#braces) - [Whitespace](#whitespace) - [Functions](#functions) @@ -259,11 +260,8 @@ Do eliminate trailing whitespace on any line, preferably as a separate patch or The following general rules should be followed when defining a function in BigWhoop: * Function name must be lowercase, optionally separated with underscore _ character * Functions private to a translation unit need to be declared before they are called -* All private functions of a translation unit must appear before the public functions in their respective block, which is identified by the block header 'private functions': -* All public functions must appear in their respective block, identified by the `public functions` block header, following the `private functions` block: - - - +* All private functions of a translation unit must appear before the public functions in their respective block, which is identified by the block header `private functions`: +* All public functions of a translation unit must appear in their respective block, identified by the `public functions` block header: Functions should be declared by placing the returned value on a separate line from the function name: ```c @@ -297,6 +295,23 @@ initialize_subband (field, l); ``` +For header files, the function prototypes must be vertically aligned in six columns and separated by the function delimiter: + +```c + uchar bwc_open_file (bwc_field *const field, + char const *const filename, + char const *const mode); + //==========|==========================|======================|======|=======|==================== + uchar bwc_load_file (bwc_field *const field, + char const *const filename); + //==========|==========================|======================|======|=======|==================== + uchar bwc_compress (bwc_field *const field, + char *const rate_control); + //==========|==========================|======================|======|=======|==================== + uchar bwc_decompress (bwc_field *const field, + uint8 const layer); +``` +Each column is marked by the function delimiter with a `|` with each element in the column right aligned to the column seperator. The delimiter must precede every function prototype except the first. ```c prec_control->numCodeblocks_a = (uint64) (prec_control->numCbX