From 12237142da4710e8fe44fcb0ce3053de20a89582 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 19 Jun 2018 10:14:31 +0200 Subject: [PATCH] move astyle files to docs and add it's README to CONTRIBUTING.md --- README.astyle | 18 ------------------ _astylerc-c => astyle_c | 0 _astylerc-h => astyle_h | 0 docs/CONTRIBUTING.md | 11 +++++++++++ docs/astyle_c | 1 + docs/astyle_h | 1 + 6 files changed, 13 insertions(+), 18 deletions(-) delete mode 100644 README.astyle rename _astylerc-c => astyle_c (100%) rename _astylerc-h => astyle_h (100%) create mode 100644 docs/astyle_c create mode 100644 docs/astyle_h diff --git a/README.astyle b/README.astyle deleted file mode 100644 index 7e7e9d3df..000000000 --- a/README.astyle +++ /dev/null @@ -1,18 +0,0 @@ -Use the _astylerc config file and the 'astyle' util to format the -project source files in accordance with the project coding style. - -At project top level run these commands: - -1. To format the .c files: - $ find . -type f -name "*.c" | xargs astyle --options=_astylerc-c - -OR- (to skip creation of backup files) - $ find . -type f -name "*.c" | xargs astyle --options=_astylerc-c -n - -2. To format the .h files: - $ find . -type f -name "*.h" | xargs astyle --options=_astylerc-h - -OR- (to skip creation of backup files) - $ find . -type f -name "*.h" | xargs astyle --options=_astylerc-h -n - -3. To remove the backup file created by astyle: - $ find . -type f -name "*.bak" -delete # this are *.c backup files - $ find . -type f -name "*.orig" -delete # this are *.h backup files diff --git a/_astylerc-c b/astyle_c similarity index 100% rename from _astylerc-c rename to astyle_c diff --git a/_astylerc-h b/astyle_h similarity index 100% rename from _astylerc-h rename to astyle_h diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index b79352759..6a99be33d 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -161,3 +161,14 @@ void lv_label_set_text(lv_obj_t * label, const char * text) ``` Use 4 spaces indentation instead of tab. + +You can use **astyle** to format the code. The required config flies are: `docs/astyle_c` and `docs/astyle_h`. +To format the header files: + `$ find . -type f -name "*.c" | xargs astyle --options=docs/astyle_c` + +To format the sorce files: + `$ find . -type f -name "*.h" | xargs astyle --options=docs/astyle_h` + +Append `-n` to the end to skip creation of backup file or use `$ find . -type f -name "*.bak" -delete` (for source file's backups) and `find . -type f -name "*.orig" -delete` (for header file's backups) + + diff --git a/docs/astyle_c b/docs/astyle_c new file mode 100644 index 000000000..9b9d7f3c9 --- /dev/null +++ b/docs/astyle_c @@ -0,0 +1 @@ +--style=kr --convert-tabs --indent=spaces=4 --indent-switches --pad-oper --unpad-paren --align-pointer=middle --suffix=.bak --lineend=linux --min-conditional-indent= diff --git a/docs/astyle_h b/docs/astyle_h new file mode 100644 index 000000000..d9c76337c --- /dev/null +++ b/docs/astyle_h @@ -0,0 +1 @@ +--convert-tabs --indent=spaces=4