File: style

package info (click to toggle)
ga 5.9.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,472 kB
  • sloc: ansic: 192,963; fortran: 53,761; f90: 11,218; cpp: 5,784; makefile: 2,248; sh: 1,945; python: 1,734; perl: 534; csh: 134; asm: 106
file content (780 lines) | stat: -rw-r--r-- 21,195 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
##############################################################################
# This is the Artistic Style (astyle) options file used by Global Arrays.
##############################################################################
# 
# The command line options have precedence. If there is a conflict between
# a command line option and an option in the default options file, the
# command line option will be used.
#
# Lines within this options file that begin with '#' are considered
# line-comments.
#
# astyle looks for this file in the following locations (in order):
# 1. the file indicated by the --options= command line option;
# 2. the file and directory indicated by the environment variable
#    ARTISTIC_STYLE_OPTIONS (if it exists);
# 3. the file named .astylerc in the directory pointed to by the HOME
#    environment variable (e.g. "$HOME/.astylerc" on Linux);
# 4. the file named astylerc in the directory pointed to by the
#    USERPROFILE environment variable (e.g. "%USERPROFILE%\astylerc" on
#    Windows).
#
##############################################################################
### Global Arrays Style Options ##############################################
##############################################################################
#
--indent=spaces=2
--brackets=linux
--indent-classes
--indent-switches
--indent-namespaces
--indent-col1-comments
--max-instatement-indent=40
--pad-oper
--pad-header
--unpad-paren
--break-closing-brackets
--add-brackets
--convert-tabs
--align-pointer=name
#
##############################################################################
### Tab and Bracket Options ##################################################
##############################################################################
# 
## default indent option
## If no indentation option is set, the default option of 4 spaces will be
## used (e.g. -s4 --indent=spaces=4).
# 
# ----------------------------------------------------------------------------
# --indent=spaces / --indent=spaces=# / -s#
# Indent using # spaces per indent (e.g. -s6 --indent=spaces=6). # must be
# between 2 and 20. Not specifying # will result in a default of 4 spaces per
# indent.
# 
# ----------------------------------------------------------------------------
# --indent=tab / --indent=tab=# / -t / -t#
# Indent using tab characters. Treat each tab as # spaces
# (e.g. -t6 / --indent=tab=6). # must be between 2 and 20. If no # is set,
# treats tabs as 4 spaces.
# 
# ----------------------------------------------------------------------------
# --indent=force-tab / --indent=force-tab=# / -T / -T#
# Indent using tab characters. Treat each tab as # spaces
# (e.g. -T6 / --indent=force-tab=6). Uses tabs as indents where ‑‑indent=tab
# prefers to use spaces, such as inside multi-line statements. # must be
# between 2 and 20. If no # is set, treats tabs as 4 spaces.
# 
# ----------------------------------------------------------------------------
## default brackets option
## If no brackets option is set, the brackets will not be changed.
# 
# ----------------------------------------------------------------------------
# --brackets=break / -b
# Break brackets from their pre-block statements ( e.g. Allman / ANSI style ).
# 
# void Foo(bool isFoo)
# {
#     if (isFoo)
#     {
#         bar();
#     }
#     else
#     {
#         anotherBar();
#     }
# }
# 
# ----------------------------------------------------------------------------
# --brackets=attach / -a
# Attach brackets to their pre-block statements ( e.g. Java style ).
# 
# void Foo(bool isFoo) {
#     if (isFoo) {
#         bar();
#     } else {
#         anotherBar();
#     }
# }
#
# ----------------------------------------------------------------------------
# --brackets=linux / -l
# Break brackets from namespace, class, and function definitions, but attach
# brackets to statements within a function  ( e.g. K&R / Linux style ).
#
# With C++ files brackets are attached for function definitions within a class
# (inline class functions). The brackets are also attached for arrays, structs,
# enums, and other top level objects that are not classes or functions. This
# option is effective for C/C++ files only.
#
# void Foo(bool isFoo)
# {
#     if (isFoo) {
#         bar();
#     } else {
#         anotherBar;
#     }
# }
#
# ----------------------------------------------------------------------------
# --brackets=stroustrup / -u
# Break brackets from function definitions only. Attach brackets to
# namespaces, classes, and statements within a function ( e.g. Stroustrup
# style ).
# 
# With C++ files brackets are attached for function definitions within a class
# (inline class functions). The brackets are also attached for arrays, structs,
# enums, and other top level objects that are not classes or functions. This
# option is effective for C/C++ files only.
# 
# void Foo(bool isFoo)
# {
#     if (isFoo) {
#         bar();
#     } else {
#         anotherBar;
#     }
# }
# 
# ----------------------------------------------------------------------------
# --brackets=horstmann / -g
# Break brackets from their pre-block statements but allow run-in statements
# on the same line as an opening bracket ( e.g. Horstmann style ).
# 
# void Foo(bool isFoo)
# {   if (isFoo())
#     {   bar1();
#         bar2();
#     }
#     else
#     {   anotherBar();
#     }
# }
# 
##############################################################################
### Indentation Options ######################################################
##############################################################################
#
# --indent-classes / -C
# Indent 'class' and 'struct' blocks so that the blocks 'public:',
# 'protected:' and 'private:' are indented. The struct blocks are indented
# only if an access modifier is declared somewhere in the struct. The entire
# block is indented. This option is effective for C++ files only.
# 
# class Foo
# {
# public:
#     Foo();
#     virtual ~Foo();
# };
# 
# becomes:
# 
# class Foo
# {
#     public:
#         Foo();
#         virtual ~Foo();
# };
# 
# ----------------------------------------------------------------------------
# --indent-switches / -S
# Indent 'switch' blocks so that the 'case X:' statements are indented in the
# switch block. The entire case block is indented.
# 
# switch (foo)
# {
# case 1:
#     a += 1;
#     break;
# 
# case 2:
# {
#     a += 2;
#     break;
# }
# }
# 
# becomes:
# 
# switch (foo)
# {
#     case 1:
#         a += 1;
#         break;
# 
#     case 2:
#     {
#         a += 2;
#         break;
#     }
# }
# 
# ----------------------------------------------------------------------------
# --indent-cases / -K
# Indent 'case X:' blocks from the 'case X:' headers. Case statements not
# enclosed in blocks are NOT indented.
# 
# switch (foo)
# {
#     case 1:
#         a += 1;
#         break;
# 
#     case 2:
#     {
#         a += 2;
#         break;
#     }
# }
# 
# becomes:
# 
# switch (foo)
# {
#     case 1:
#         a += 1;
#         break;
# 
#     case 2:
#         {
#             a += 2;
#             break;
#         }
# }
# 
# ----------------------------------------------------------------------------
# --indent-brackets / -B
# Add extra indentation to brackets. This is the option used for Whitesmith
# and Banner style formatting/indenting. If both ‑‑indent‑brackets and
# ‑‑indent‑blocks are used the result will be ‑‑indent‑blocks. This option
# will be ignored if used with a predefined style.
# 
# if (isFoo)
# {
#     bar();
# }
# else
#     anotherBar();
# 
# becomes:
# 
# if (isFoo)
#     {
#     bar();
#     }
# else
#     anotherBar();
# 
# ----------------------------------------------------------------------------
# --indent-blocks / -G
# Add extra indentation to blocks within a function. The opening bracket for
# namespaces, classes, and functions is not indented. This is the option used
# for GNU style formatting/indenting. This option will be ignored if used with
# a predefined style.
# 
# if (isFoo)
# {
#     bar();
# }
# else
#     anotherBar();
# 
# becomes:
# 
# if (isFoo)
#     {
#         bar();
#     }
# else
#     anotherBar();
# 
# ----------------------------------------------------------------------------
# --indent-namespaces / -N
# Add extra indentation to namespace blocks. This option has no effect on Java
# files.
# 
# namespace foospace
# {
# class Foo
# {
#     public:
#         Foo();
#         virtual ~Foo();
# };
# }
# 
# becomes:
# 
# namespace foospace
# {
#     class Foo
#     {
#         public:
#             Foo();
#             virtual ~Foo();
#     };
# }
# 
# ----------------------------------------------------------------------------
#  --indent-labels / -L
# Add extra indentation to labels so they appear 1 indent less than the
# current indentation, rather than being flushed to the left (the default).
# 
# void Foo() {
#     while (isFoo) {
#         if (isFoo)
#             goto error;
#         ...
# error:
#         ...
#     }
# }
# 
# becomes (with indented 'error:'):
# 
# void Foo() {
#     while (isFoo) {
#         if (isFoo)
#             goto error;
#         ... 
#     error:
#         ...
#     }        
# }
#  
# ----------------------------------------------------------------------------
# --indent-preprocessor / -w
# Indent multi-line preprocessor definitions ending with a backslash. Should
# be used with --convert-tabs for proper results. Does a pretty good job, but
# can not perform miracles in obfuscated preprocessor definitions. Without
# this option the preprocessor statements remain unchanged.
# 
# #define Is_Bar(arg,a,b) \
# (Is_Foo((arg), (a)) \
# || Is_Foo((arg), (b)))
# 
# becomes:
# 
# #define Is_Bar(arg,a,b) \
#     (Is_Foo((arg), (a)) \
#      || Is_Foo((arg), (b)))
# 
# ----------------------------------------------------------------------------
# --indent-col1-comments / -Y
# Indent C++ comments beginning in column one. By default C++ comments
# beginning in column one are not indented. This option will allow the
# comments to be indented with the code.
# 
# void Foo()\n"
# {
# // comment
#     if (isFoo)
#         bar();
# }
# 
# becomes:
# 
# void Foo()\n"
# {
#     // comment
#     if (isFoo)
#         bar();
# }
# 
# ----------------------------------------------------------------------------
# --max-instatement-indent=# / -M#
# Indent a maximum of # spaces in a continuous statement, relative to the
# previous line (e.g. ‑‑max‑instatement‑indent=40). # must be less than 80. If
# no # is set, the default value of 40 will be used. A maximum of less than
# two indent lengths will be ignored.
# 
# fooArray[] = { red,
#          green,
#          blue };
# 
# fooFunction(barArg1,
#          barArg2,
#          barArg3);
# 
# becomes (with larger value):
# 
# fooArray[] = { red,
#                green,
#                blue };
# 
# fooFunction(barArg1,
#             barArg2,
#             barArg3);
#  
# ----------------------------------------------------------------------------
# --min-conditional-indent=# / -m#
# Set the minimal indent that is added when a header is built of
# multiple-lines. This indent makes helps to easily separate the header from
# the command statements that follow. The value for # must be less than 40.
# The default setting for this option is twice the current indent
# (e.g. --min-conditional-indent=8).
# 
# // default setting makes this non-bracketed code clear
# if (a < b
#         || c > d)
#     foo++;
# 
# // but creates an exaggerated indent in this bracketed code
# if (a < b
#         || c > d)
# {
#     foo++;
# }
# 
# becomes (when setting --min-conditional-indent=0):
# 
# // setting makes this non-bracketed code less clear
# if (a < b
#     || c > d)
#     foo++;
# 
# // but makes this bracketed code clearer
# if (a < b
#     || c > d)
# {
#     foo++;
# }
# 
##############################################################################
### Padding Options ##########################################################
##############################################################################
#
# --break-blocks / -f
# Pad empty lines around header blocks (e.g. 'if', 'for', 'while'...).
# 
# isFoo = true;
# if (isFoo) {
#     bar();
# } else {
#     anotherBar();
# }
# isBar = false;
# 
# becomes:
# 
# isFoo = true;
# 
# if (isFoo) {
#     bar();
# } else {
#     anotherBar();
# }
# 
# isBar = false;
# 
# ----------------------------------------------------------------------------
# --break-blocks=all / -F
# Pad empty lines around header blocks (e.g. 'if', 'for', 'while'...). Treat
# closing header blocks (e.g. 'else', 'catch') as stand-alone blocks.
# 
# isFoo = true;
# if (isFoo) {
#     bar();
# } else {
#     anotherBar();
# }
# isBar = false;
# 
# becomes:
# 
# isFoo = true;
# 
# if (isFoo) {
#     bar();
#     
# } else {
#     anotherBar();
# }
# 
# isBar = false;
# 
# ----------------------------------------------------------------------------
# --pad-oper / -p
# Insert space padding around operators. Operators inside block parens [] are
# not padded. Any end of line comments will remain in the original column, if
# possible. Note that there is no option to unpad. Once padded, they stay
# padded.
# 
# if (foo==2)
#     a=bar((b-c)*a,*d--);
# 
# becomes:
# 
# if (foo == 2)
#      a = bar((b - c) * a, * d--);
# 
# ----------------------------------------------------------------------------
# --pad-paren / -P
# Insert space padding around parenthesis on both the outside and the inside.
# Any end of line comments will remain in the original column, if possible.
# 
# if (isFoo(a, b))
#     bar(a, b);
# 
# becomes:
# 
# if ( isFoo ( a, b ) )
#     bar ( a, b );
# 
# ----------------------------------------------------------------------------
# --pad-paren-out / -d
# Insert space padding around parenthesis on the outside only. Any end of line
# comments will remain in the original column, if possible. This can be used
# with unpad-paren below to remove unwanted spaces.
# 
# if (isFoo(a, b))
#     bar(a, b);
# 
# becomes:
# 
# if (isFoo (a, b) )
#     bar (a, b);
# 
# ----------------------------------------------------------------------------
# --pad-paren-in / -D
# Insert space padding around parenthesis on the inside only. Any end of line
# comments will remain in the original column, if possible. This can be used
# with unpad-paren below to remove unwanted spaces.
# 
# if (isFoo(a, b))
#     bar(a, b);
# 
# becomes:
# 
# if ( isFoo( a, b ) )
#     bar( a, b );
# 
# ----------------------------------------------------------------------------
# --pad-header / -H
# Insert space padding after paren headers only (e.g. 'if', 'for', 'while'...).
# Any end of line comments will remain in the original column, if possible.
# This can be used with unpad-paren to remove unwanted spaces.
# 
# if(isFoo(a, b))
#     bar(a, b);
# 
# becomes:
# 
# if (isFoo(a, b))
#     bar(a, b);
# 
# ----------------------------------------------------------------------------
# --unpad-paren / -U
# Remove extra space padding around parenthesis on the inside and outside.
# Any end of line comments will remain in the original column, if possible.
# This option can be used in combination with the paren padding options
# pad‑paren, pad‑paren‑out, pad‑paren‑in, and pad‑header above. Only padding
# that has not been requested by other options will be removed.
# 
# For example, if a source has parens padded on both the inside and outside,
# and you want inside only. You need to use unpad-paren to remove the outside
# padding, and pad‑paren‑in to retain the inside padding. Using only
# pad‑paren‑in would not remove the outside padding.
# 
# if ( isFoo( a, b ) )
#     bar ( a, b );
# 
# becomes (with no padding option requested):
# 
# if (isFoo(a, b))
#     bar(a, b);
# 
# ----------------------------------------------------------------------------
# --delete-empty-lines / -x
# Delete empty lines within a function or method. Empty lines outside of
# functions or methods are NOT deleted. If used with break-blocks or
# break-blocks=all it will delete all lines EXCEPT the lines added by the
# break-blocks options.
# 
# void Foo()
# {
#     
#     foo1 = 1;
#     
#     foo2 = 2;
#     
# }
# 
# becomes:
# 
# void Foo()
# {
#     foo1 = 1;
#     foo2 = 2;
# }
# 
# ----------------------------------------------------------------------------
# --fill-empty-lines / -E
# Fill empty lines with the white space of the previous line.
#
##############################################################################
### Formatting Options #######################################################
##############################################################################
#
# --break-closing-brackets / -y
# When used with --brackets=attach, --brackets=linux, or --brackets=stroustrup,
# this breaks closing headers (e.g. 'else', 'catch', ...) from their
# immediately preceding closing brackets. Closing header brackets are always
# broken with broken brackets, horstmann brackets, indented blocks, and
# indented brackets.
# 
# void Foo(bool isFoo) {
#     if (isFoo) {
#         bar();
#     } else {
#         anotherBar();
#     }
# }
# 
# becomes (with a broken 'else'):
# 
# void Foo(bool isFoo) {
#     if (isFoo) {
#         bar();
#     }
#     else {
#         anotherBar();
#     }
# }
# 
# ----------------------------------------------------------------------------
# --break-elseifs / -e
# Break "else if" header combinations into separate lines. This option has no
# effect if keep-one-line-statements is used, the "else if" statements will
# remain as they are.
# 
# If this option is NOT used, "else if" header combinations will be placed on
# a single line.
# 
# if (isFoo) {
#     bar();
# }
# else if (isFoo1()) {
#     bar1();
# }
# else if (isFoo2()) }
#     bar2;
# }
# 
# becomes:
# 
# if (isFoo) {
#     bar();
# }
# else
#     if (isFoo1()) {
#         bar1();
#     }
#   else
#         if (isFoo2()) {
#             bar2();
#         }
# 
# ----------------------------------------------------------------------------
# --add-brackets / -j
# Add brackets to unbracketed one line conditional statements  (e.g. 'if',
# 'for', 'while'...). The statement must be on a single line. The brackets
# will be added according to the currently requested predefined style or
# bracket type. If no style or bracket type is requested the brackets will be
# attached. If --add-one-line-brackets is also used the result will be one
# line brackets.
# 
# if (isFoo)
#     isFoo = false;
# 
# becomes:
# 
# if (isFoo) {
#     isFoo = false;
# }
# 
# ----------------------------------------------------------------------------
# --add-one-line-brackets / -J
# Add one line brackets to unbracketed one line conditional statements  (e.g.
# 'if', 'for', 'while'...). The statement must be on a single line. The option
# implies --keep-one-line-blocks and will not break the one line blocks.
# 
# if (isFoo)
#     isFoo = false;
# 
# becomes:
# 
# if (isFoo)
#     { isFoo = false; }
# 
# ----------------------------------------------------------------------------
# --keep-one-line-blocks / -O
# Don't break one-line blocks.
# 
# if (isFoo)
# { isFoo = false; cout << isFoo << endl; }
# 
# remains unchanged.
# 
# ----------------------------------------------------------------------------
# --keep-one-line-statements / -o
# Don't break complex statements and multiple statements residing on a single
# line.
# 
# if (isFoo)
# {
#     isFoo = false; cout << isFoo << endl;
# }
# 
# remains unchanged.
# 
# if (isFoo) DoBar();
# 
# remains unchanged.
# 
# ----------------------------------------------------------------------------
# --convert-tabs / -c
# Converts tabs into spaces in the non-indentation part of the line. The
# number of spaces inserted will maintain the spacing of the tab. The current
# setting for spaces per tab is used. It may not produce the expected results
# if convert-tabs is used when changing spaces per tab. Tabs are not replaced
# in quotes.
# 
# ----------------------------------------------------------------------------
# --align-pointer=type   / -k1
# --align-pointer=middle / -k2
# --align-pointer=name   / -k3
# Attach a pointer or reference operator (* or &) to either the variable type
# (left) or variable name (right), or place it between the type and name. The
# spacing between the type and name will be preserved, if possible. This
# option is effective for C/C++ files only.
# 
# char *foo1;
# 
# becomes (with align-pointer=type):
# 
# char* foo1;
# 
# char* foo2;
# 
# becomes (with align-pointer=middle):
# 
# char * foo2;
# 
# char& foo3;
# 
# becomes (with align-pointer=name):
# 
# char &foo3;
# 
# ----------------------------------------------------------------------------
# --mode=c
# --mode=cs
# --mode=java
# Indent a C/C++, C#, or Java file. The option is usually set from the file
# extension for each file. You can override the setting with this entry. It
# will be used for all files regardless of the file extension. It allows the
# formatter to identify language specific syntax such as C++ classes,
# templates, and keywords.
#