Skip to content

Commit 941ee6c

Browse files
committed
Indent
1 parent 0cf3d0f commit 941ee6c

10 files changed

Lines changed: 689 additions & 410 deletions

File tree

.clang-format

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
# Copyright (C) The Paraconf development team, see COPYRIGHT.md file at the
2+
# root of the project or at https://github.com/pdidev/paraconf
3+
#
4+
# SPDX-License-Identifier: MIT
5+
---
6+
AccessModifierOffset: -4
7+
AlignAfterOpenBracket: BlockIndent
8+
AlignConsecutiveMacros: false
9+
AlignConsecutiveAssignments: false
10+
AlignConsecutiveBitFields: AcrossEmptyLinesAndComments
11+
AlignConsecutiveDeclarations: false
12+
AlignEscapedNewlines: Right
13+
AlignOperands: AlignAfterOperator
14+
AlignTrailingComments: false
15+
AllowAllArgumentsOnNextLine: false
16+
AllowAllConstructorInitializersOnNextLine: false
17+
AllowAllParametersOfDeclarationOnNextLine: false
18+
AllowShortBlocksOnASingleLine: Empty
19+
AllowShortCaseLabelsOnASingleLine: false
20+
AllowShortEnumsOnASingleLine: false
21+
AllowShortFunctionsOnASingleLine: Inline
22+
AllowShortIfStatementsOnASingleLine: WithoutElse
23+
AllowShortLambdasOnASingleLine: Inline
24+
AllowShortLoopsOnASingleLine: false
25+
AlwaysBreakAfterDefinitionReturnType: None
26+
AlwaysBreakAfterReturnType: None
27+
AlwaysBreakBeforeMultilineStrings: false
28+
AlwaysBreakTemplateDeclarations: Yes
29+
AttributeMacros:
30+
- PDI_EXPORT
31+
- PDI_NO_EXPORT
32+
- PDI_DEPRECATED
33+
- PDI_DEPRECATED_EXPORT
34+
- PDI_DEPRECATED_NO_EXPORT
35+
- PDI_NO_DEPRECATED
36+
BinPackArguments: false
37+
BinPackParameters: false
38+
BitFieldColonSpacing: After
39+
BraceWrapping:
40+
AfterCaseLabel: false
41+
AfterClass: true
42+
AfterControlStatement: MultiLine
43+
AfterEnum: false
44+
AfterFunction: true
45+
AfterNamespace: false
46+
AfterStruct: false
47+
AfterUnion: false
48+
AfterExternBlock: false
49+
BeforeCatch: false
50+
BeforeElse: false
51+
BeforeLambdaBody: false
52+
BeforeWhile: false
53+
IndentBraces: false
54+
SplitEmptyFunction: false
55+
SplitEmptyRecord: false
56+
SplitEmptyNamespace: false
57+
BreakBeforeBinaryOperators: All
58+
BreakBeforeBraces: Custom
59+
BreakBeforeConceptDeclarations: true
60+
BreakBeforeInlineASMColon: OnlyMultiline
61+
BreakBeforeTernaryOperators: true
62+
BreakConstructorInitializers: BeforeComma
63+
BreakInheritanceList: BeforeComma
64+
BreakStringLiterals: true
65+
ColumnLimit: 150
66+
CommentPragmas: '^ *IWYU *pragma:'
67+
CompactNamespaces: false
68+
ConstructorInitializerIndentWidth: 4
69+
ContinuationIndentWidth: 4
70+
Cpp11BracedListStyle: true
71+
DeriveLineEnding: false
72+
DerivePointerAlignment: false
73+
DisableFormat: false
74+
EmptyLineAfterAccessModifier: Never
75+
EmptyLineBeforeAccessModifier: LogicalBlock
76+
ExperimentalAutoDetectBinPacking: false
77+
FixNamespaceComments: true
78+
IncludeBlocks: Preserve
79+
IncludeCategories:
80+
# config must come first, before anything else
81+
- Regex: '^[<"]config\.h[">]$'
82+
Priority: -140
83+
# MPI must come first, before std headers
84+
- Regex: '^[<"]mpi\.h[">]$'
85+
Priority: -120
86+
# std (extensionless, directoryless) headers
87+
- Regex: '^<[^\./]*>$'
88+
Priority: -100
89+
# pdi main header
90+
- Regex: '^[<"]pdi\.h[>"]$'
91+
Priority: -60
92+
# pdi fwd header
93+
- Regex: '^[<"]pdi/pdi_fwd\.h[>"]$'
94+
Priority: -50
95+
# pdi headers
96+
- Regex: '^[<"]pdi/.*[>"]$'
97+
Priority: -40
98+
# library headers
99+
- Regex: '^<.*>$'
100+
Priority: -80
101+
# local headers
102+
- Regex: '^".*"$'
103+
Priority: -20
104+
IncludeIsMainRegex: '$'
105+
IncludeIsMainSourceRegex: ''
106+
IndentAccessModifiers: false
107+
IndentCaseBlocks: false
108+
IndentCaseLabels: false
109+
IndentExternBlock: NoIndent
110+
IndentGotoLabels: false
111+
IndentPPDirectives: None
112+
IndentRequires: false
113+
IndentWidth: 4
114+
IndentWrappedFunctionNames: false
115+
InsertNewlineAtEOF: true
116+
KeepEmptyLinesAtEOF: false
117+
KeepEmptyLinesAtTheStartOfBlocks: false
118+
LambdaBodyIndentation: Signature
119+
LineEnding: LF
120+
MaxEmptyLinesToKeep: 3
121+
NamespaceIndentation: None
122+
PPIndentWidth: -1
123+
PackConstructorInitializers: Never
124+
PenaltyBreakAssignment: 10
125+
PenaltyBreakBeforeFirstCallParameter: 0
126+
PenaltyBreakComment: 10000000
127+
PenaltyBreakFirstLessLess: 10000
128+
PenaltyBreakOpenParenthesis: 0
129+
PenaltyBreakString: 10000000
130+
PenaltyBreakTemplateDeclaration: 100
131+
PenaltyExcessCharacter: 500
132+
PenaltyIndentedWhitespace: 1
133+
PenaltyReturnTypeOnItsOwnLine: 100
134+
PointerAlignment: Left
135+
#QualifierAlignment: Custom
136+
#QualifierOrder: ['static', 'inline', 'constexpr', 'volatile', 'restrict', 'type', 'const']
137+
ReferenceAlignment: Pointer
138+
ReflowComments: false
139+
RemoveBracesLLVM: false
140+
RemoveParentheses: Leave
141+
RemoveSemicolon: true
142+
RequiresClausePosition: OwnLine
143+
RequiresExpressionIndentation: OuterScope
144+
SeparateDefinitionBlocks: Always
145+
ShortNamespaceLines: 1
146+
SortIncludes: true
147+
SortUsingDeclarations: LexicographicNumeric
148+
SpaceAfterCStyleCast: false
149+
SpaceAfterLogicalNot: false
150+
SpaceAfterTemplateKeyword: true
151+
SpaceAroundPointerQualifiers: After
152+
SpaceBeforeAssignmentOperators: true
153+
SpaceBeforeCaseColon: false
154+
SpaceBeforeCpp11BracedList: false
155+
SpaceBeforeCtorInitializerColon: false
156+
SpaceBeforeInheritanceColon: false
157+
SpaceBeforeParens: Custom
158+
SpaceBeforeParensOptions:
159+
AfterControlStatements: true
160+
AfterFunctionDeclarationName: false
161+
AfterFunctionDefinitionName: false
162+
AfterOverloadedOperator: true
163+
AfterRequiresInClause: false
164+
AfterRequiresInExpression: false
165+
BeforeNonEmptyParentheses: false
166+
SpaceBeforeRangeBasedForLoopColon: false
167+
SpaceBeforeSquareBrackets: false
168+
SpaceInEmptyBlock: false
169+
SpacesBeforeTrailingComments: 1
170+
SpacesInAngles: Leave
171+
SpacesInContainerLiterals: true
172+
SpacesInParens: Custom
173+
SpacesInParensOptions:
174+
InConditionalStatements: false
175+
InCStyleCasts: false
176+
InEmptyParentheses: false
177+
Other: false
178+
SpacesInSquareBrackets: false
179+
Standard: Latest
180+
TabWidth: 4
181+
UseCRLF: false
182+
UseTab: AlignWithSpaces
183+
---

COPYRIGHT.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<!--
2-
Copyright (C) The Paraconf development team, see COPYRIGHT.md file at the
3-
root of the project or at https://github.com/pdidev/paraconf
2+
Copyright (C) The Paraconf development team, see below
43
54
SPDX-License-Identifier: MIT
65
-->
@@ -9,9 +8,9 @@ SPDX-License-Identifier: MIT
98

109
The Paraconf project licencing information follows the REUSE specification.
1110

12-
It is distributed under the BSD 3-Clause License whose full text is available in
13-
the LICENSES/MIT.txt file. A small number of files in this repository do not
14-
originate from the DDC developers. These files may have their own licences
11+
It is distributed under the MIT License whose full text is available in the
12+
LICENSES/MIT.txt file. A small number of files in this repository do not
13+
originate from the Paraconf developers. These files may have their own licenses
1514
which will be indicated in the headers.
1615

1716
For the purpose of copyright, the Paraconf development team is defined as

example/example.c

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,20 @@
55
*/
66

77
#include <assert.h>
8+
#include <math.h>
9+
#include <paraconf.h>
810
#include <stdio.h>
911
#include <stdlib.h>
10-
#include <stdio.h>
1112
#include <time.h>
12-
#include <math.h>
13-
#include <paraconf.h>
14-
1513

1614
/* This file contains an example on how to use Paraconf
1715
*/
1816

1917

20-
int main(int argc, char *argv[])
18+
int main(int argc, char* argv[])
2119
{
22-
/// Creates a tree that contains all the parsed data of the parameter file
23-
if (argc != 2 ) {
20+
// Creates a tree that contains all the parsed data of the parameter file
21+
if (argc != 2) {
2422
fprintf(stderr, "Error: expected 1 argument!\n");
2523
exit(1);
2624
}
@@ -29,49 +27,58 @@ int main(int argc, char *argv[])
2927
/*For the sake of the illustration a tree is
3028
* . // origin of the tree
3129
* / | \
32-
* .a_int .a_float ... // sub-trees/node/map
30+
* .a_int .a_float ... // sub-trees/node/map
3331
*/
34-
35-
/// PC_get return the sub-tree under the node name ".a_int" (the dot is mandatory) if it is found.
36-
/// and PC_int return the leaf assuming it's an int.
37-
long a_int; PC_int(PC_get(conf, ".a_int"), &a_int);
32+
33+
// PC_get return the sub-tree under the node name ".a_int" (the dot is mandatory) if it is found.
34+
// and PC_int return the leaf assuming it's an int.
35+
long a_int;
36+
PC_int(PC_get(conf, ".a_int"), &a_int);
3837
/// Same for double
39-
double a_float; PC_double(PC_get(conf, ".a_float"), &a_float);
38+
double a_float;
39+
PC_double(PC_get(conf, ".a_float"), &a_float);
4040
/// Same for string
41-
char* a_string; PC_string(PC_get(conf, ".a_string"), &a_string);
41+
char* a_string;
42+
PC_string(PC_get(conf, ".a_string"), &a_string);
4243
/// Same for bool
43-
int a_yes; PC_bool(PC_get(conf, ".a_yes"), &a_yes);
44-
printf("a_int=%ld a_float=%f a_string=%s a_yes=%s\n", a_int, a_float, a_string, a_yes?"true":"false");
44+
int a_yes;
45+
PC_bool(PC_get(conf, ".a_yes"), &a_yes);
46+
printf("a_int=%ld a_float=%f a_string=%s a_yes=%s\n", a_int, a_float, a_string, a_yes ? "true" : "false");
4547
free(a_string);
46-
47-
/// The list and map number of elements are given by the PC_len function
48-
/// Element of a list are accessed using the '[number]' syntax so [0] is the 1st element.
48+
49+
// The list and map number of elements are given by the PC_len function
50+
// Element of a list are accessed using the '[number]' syntax so [0] is the 1st element.
4951
printf("a_list=[ ");
50-
int a_list_len; PC_len(PC_get(conf, ".a_list"), &a_list_len);
51-
for ( int ii=0; ii<a_list_len; ++ii ) {
52-
long a_list_ii; PC_int(PC_get(conf, ".a_list[%d]", ii), &a_list_ii);
52+
int a_list_len;
53+
PC_len(PC_get(conf, ".a_list"), &a_list_len);
54+
for (int ii = 0; ii < a_list_len; ++ii) {
55+
long a_list_ii;
56+
PC_int(PC_get(conf, ".a_list[%d]", ii), &a_list_ii);
5357
printf("%ld ", a_list_ii);
5458
}
5559
printf("]\n");
56-
57-
/// Sub-tree/node of a tree are accessed using the '{number}' or '<number>' is the 1st element.
60+
61+
// Sub-tree/node of a tree are accessed using the '{number}' or '<number>' is the 1st element.
5862
printf("a_map={ ");
59-
int a_map_len; PC_len(PC_get(conf, ".a_map"), &a_map_len);
60-
for ( int ii=0; ii<a_list_len; ++ii ) {
61-
char *a_map_ii_k; PC_string(PC_get(conf, ".a_map{%d}", ii), &a_map_ii_k);
62-
long a_map_ii_v; PC_int(PC_get(conf, ".a_map<%d>", ii), &a_map_ii_v);
63+
int a_map_len;
64+
PC_len(PC_get(conf, ".a_map"), &a_map_len);
65+
for (int ii = 0; ii < a_list_len; ++ii) {
66+
char* a_map_ii_k;
67+
PC_string(PC_get(conf, ".a_map{%d}", ii), &a_map_ii_k);
68+
long a_map_ii_v;
69+
PC_int(PC_get(conf, ".a_map<%d>", ii), &a_map_ii_v);
6370
printf("%s => %ld ", a_map_ii_k, a_map_ii_v);
6471
free(a_map_ii_k);
6572
}
6673
printf("}\n");
67-
74+
6875
PC_errhandler_t errh = PC_errhandler(PC_NULL_HANDLER);
6976
PC_tree_t some_key = PC_get(conf, ".some_key");
7077
PC_errhandler(errh);
71-
72-
printf("config %s `some_key'\n", PC_status(some_key)?"does not contain":"contains");
73-
78+
79+
printf("config %s `some_key'\n", PC_status(some_key) ? "does not contain" : "contains");
80+
7481
PC_tree_destroy(&conf);
75-
82+
7683
return 0;
7784
}

0 commit comments

Comments
 (0)