# source: https://github.com/arduino/ArduinoCore-avr/issues/71#issuecomment-466763471 2019-06-09

# formatter.conf, examples_formatter.conf
mode=c


# examples_formatter.conf
# http://astyle.sourceforge.net/astyle.html#_style=java
# Considering changing this to the synonym "style=attach", which seems more descriptive
style=java


# examples_formatter.conf
attach-namespaces

# examples_formatter.conf
attach-classes

# examples_formatter.conf
attach-inlines

# examples_formatter.conf
attach-extern-c


# formatter.conf, examples_formatter.conf
indent=spaces=2

# formatter.conf, examples_formatter.conf
indent-classes

# formatter.conf, examples_formatter.conf
indent-switches

# formatter.conf, examples_formatter.conf
indent-cases

# formatter.conf, examples_formatter.conf
indent-col1-comments

# examples_formatter.conf
indent-modifiers

# examples_formatter.conf
indent-namespaces

# examples_formatter.conf
indent-labels

# examples_formatter.conf
indent-preproc-define


# formatter.conf, examples_formatter.conf
pad-header

# formatter.conf, examples_formatter.conf
pad-oper

# examples_formatter.conf
unpad-paren


# formatter.conf, examples_formatter.conf
# remove-comment-prefix

# formatter.conf, examples_formatter.conf
# http://astyle.sourceforge.net/astyle.html#_keep-one-line-statements
# "Don't break complex statements and multiple statements residing on a single line."
# I don't like one line complex statements, but I guess since it's in formatter.conf it must stay.
keep-one-line-statements



# Options from examples_formatter.conf that I think should be removed:

# http://astyle.sourceforge.net/astyle.html#_indent-preproc-block
# "Indent preprocessor blocks at brace level zero and immediately within a namespace. There are restrictions on what will be indented. Blocks within methods, classes, arrays, etc., will not be indented. Blocks containing braces or multi-line define statements will not be indented. Without this option the preprocessor block is not indented."
# This does indent for #ifdef, but not for #ifndef, so it's quite inconsistent
# Indentation of preprocessor directives as done by this option is not very common in Arduino AVR Boards core, and where it is used, it's typically done inconsistently throughout the file
indent-preproc-block

# http://astyle.sourceforge.net/astyle.html#_indent-preproc-cond
# "Indent preprocessor conditional statements to the same level as the source code."
# Indentation of preprocessor directives as done by this option is very rare in Arduino AVR Boards core
indent-preproc-cond



# Options I have not implemented from formatter.conf or examples_formatter.conf:

# examples_formatter.conf
# Not a valid option in the latest version of AStyle. I think the correct option name is "add-braces", which I do use in my configuration
# add-brackets

# formatter.conf, examples_formatter.conf
# Not a valid option in the latest version of AStyle.
# indent-preprocessor



# Options I have added:

# http://astyle.sourceforge.net/astyle.html#_add-braces
# "I believe this is the correct option name to use instead the "add-brackets" option used in examples_formatter.conf. "add-brackets" is not a valid option in the latest version of AStyle"
add-braces

# http://astyle.sourceforge.net/astyle.html#_convert-tabs
# "Converts tabs into spaces in the non-indentation part of the line."
# AStyle is already configured to use spaces for indentation by indent=spaces=2. The Arduino IDE uses spaces instead of tabs by default.
convert-tabs

# http://astyle.sourceforge.net/astyle.html#_attach-return-type
# "Attach the return type to the function name in function definitions."
attach-return-type

# http://astyle.sourceforge.net/astyle.html#_attach-return-type
# "Attach the return type to the function name in function declarations."
attach-return-type-decl

# http://astyle.sourceforge.net/astyle.html#_align-pointer
# "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 (middle)."
# In Arduino AVR Boards core, name alignment of pointers is somewhat more common, though all possible styles are used
# I don't care which style is chosen (type, middle, name), but I do think one should be chosen and used.
align-pointer=name
