#
#  GNOME style (GNU variant)
#


input_tab_size  = 8
output_tab_size = 8

# {
#   size = 2; // etc.
# ^^
indent_columns   = 2
indent_with_tabs = 0 # Don't use tabs for indentation

# if ()\n{} // level of endentation before '{'
#        ^
indent_brace	= 2

# exit:
#^ // indentation before label
# 2 = 1 space
indent_label    = 2

# size = size + 2; // +, -, *, /, &, |, >>, <<, etc
#            ^ ^
sp_arith = force

# int width, height
#         ^ ^
sp_after_comma  = force
sp_before_comma = remove

# size = 4; // +=, -=, |=, etc.
#     ^ ^
sp_assign = add

# success = start && go; // &&, ||
#                ^  ^
sp_bool = force

# if (size > 2) // >, <, ==, >=, etc.
#         ^ ^
sp_compare = force

# perimeter = (width + height) * 2 // remove space around '('
#              ^            ^
sp_inside_paren = remove

# int main (void) // remove spaces around '(' in functions
#           ^  ^
sp_inside_fparen = remove

# int main () // remove spaces in empty parameters
#           ^
sp_inside_fparens = remove

# int foo (void);
#        ^
sp_func_proto_paren = add

# int foo (void){}
#        ^
sp_func_def_paren   = force

# printf ("");
#       ^
sp_func_call_paren = force

# if (  // if/for/while/switch etc.
#   ^
sp_before_sparen = force

set func_call_user _ N_ C_ Q_ NC_
set func_call_user g_autoptr g_auto

# space after user defined functions (above) and paren
sp_func_call_user_paren = remove

# printf ("") ;
#            ^ // remove the space
sp_before_semi = remove

sp_inside_braces = ignore
# return (3*2);
#       ^
sp_return_paren = force

# long distance;
# int  name;
# //  ^ space b/w type and variable name
sp_after_type = add

# char *name; // add space before '*' (keep spacing if more than 1)
#     ^
sp_before_ptr_star = add

# char *name; // remove space after '*'
#      ^
sp_after_ptr_star = remove

# char **name (){} // remove space b/w 2 '*'
#      ^
sp_between_ptr_star = remove

# maximum consecutive new lines
# 3 = 2 blank lines
nl_max = 3

# char *names[] = { // remove newline if any
#                ^
nl_assign_brace = remove

# } else // insert newline
#  ^
nl_brace_else = force

# else if // remove newline if any
#     ^
nl_else_if = remove

# do {} // insert newline
#   ^
nl_do_brace     = force
nl_union_brace  = force
nl_enum_brace   = ignore # don't care for enums
nl_struct_brace = force

# while () {} // insert newline.
#         ^
nl_while_brace	= force
nl_for_brace    = force
nl_if_brace     = force
nl_switch_brace = force

# do ()\n while();
#      ^
nl_brace_while = force

# int main (void){} // newline after type
#    ^
nl_func_type_name = force

# int main () {} // insert newline
#            ^
nl_fdef_brace = force

# int main () {}
#               ^
# nl_after_func_body = 2

# int main (int argc, char **argv) // force newline at ','
#                    ^
nl_func_decl_args = force
nl_func_def_args  = force

# remove blank lines after '{' and before '}'
eat_blanks_after_open_brace   = true
eat_blanks_before_close_brace = true

# add newline at end of file
nl_end_of_file = force

# min number of newlines to be added
nl_end_of_file_min = 1

# main (int   argc, // add enough spaces to align
#       char *argv[])
#          ^^
align_func_params = true

# func (int   *square, // stick '*' to parameter
#       double match)
align_var_def_star_style = 2

# #define ADD(x,y,x) ((x)   \
#                     + (y) \
#                     + (z))
#                           ^ // align '/'
align_nl_cont = true

# Add a '*' at beginning of multiline comment lines
cmt_star_cont = true

# Remove braces for single line statements in
# while, for, if, and switch case
mod_full_brace_while = remove
mod_full_brace_for   = remove
mod_full_brace_if    = remove
mod_case_brace       = remove

# if (is_good \n || \n is_okay)
#             ^      ^ // If newline present,
# where to put &&, ||, | etc.
pos_conditional = lead
# FIXME: Not working
pos_bool        = trail

# Hack to avoid indentation of following line
# consider the following tokens as a comment
set COMMENT G_BEGIN_DECLS
