add templates for multi-user configurations
[oweals/gnunet.git] / contrib / patches / lrn-indent.diff
1 diff -u indent-2.2.11/src/args.c indent-2.2.11.my/src/args.c
2 --- indent-2.2.11/src/args.c    2008-07-23 23:27:17 +0400
3 +++ indent-2.2.11.my/src/args.c 2011-08-16 14:07:30 +0400
4 @@ -151,6 +151,7 @@
5  static int exp_cpp  = 0;
6  static int exp_cs   = 0;
7  static int exp_d    = 0;
8 +static int exp_ddd  = 0;
9  static int exp_bfda = 0;
10  static int exp_bfde = 0;
11  static int exp_di   = 0;
12 @@ -317,6 +318,8 @@
13      {"fca",     PRO_BOOL,                            true,       ON, &settings.format_comments,                  &exp_fca},
14      {"fc1",     PRO_BOOL,                            true,       ON, &settings.format_col1_comments,             &exp_fc1},
15      {"eei",     PRO_BOOL,                           false,       ON, &settings.extra_expression_indent,          &exp_eei},
16 +    {"ddd",     PRO_BOOL,                            true,       ON, &settings.diff_decls_and_defs,              &exp_ddd},
17 +    {"nddd",    PRO_BOOL,                            true,      OFF, &settings.diff_decls_and_defs,              &exp_ddd},
18      {"dj",      PRO_BOOL,                           false,       ON, &settings.ljust_decl,                       &exp_dj},
19      {"di",      PRO_INT,                               16, ONOFF_NA, &settings.decl_indent,                      &exp_di},
20      {"d",       PRO_INT,                                0, ONOFF_NA, &settings.unindent_displace,                &exp_d},
21 @@ -436,6 +439,8 @@
22      {"fca",     PRO_BOOL,                           false,       ON, &settings.format_comments,                  &exp_fca},
23      {"fc1",     PRO_BOOL,                           false,       ON, &settings.format_col1_comments,             &exp_fc1},
24      {"eei",     PRO_BOOL,                           false,       ON, &settings.extra_expression_indent,          &exp_eei},
25 +    {"ddd",     PRO_BOOL,                            true,       ON, &settings.diff_decls_and_defs,              &exp_ddd},
26 +    {"nddd",    PRO_BOOL,                            true,      OFF, &settings.diff_decls_and_defs,              &exp_ddd},
27      {"dj",      PRO_BOOL,                           false,       ON, &settings.ljust_decl,                       &exp_dj},
28      {"di",      PRO_INT,                                2, ONOFF_NA, &settings.decl_indent,                      &exp_di},
29      {"d",       PRO_INT,                                0, ONOFF_NA, &settings.unindent_displace,                &exp_d},
30 diff -u indent-2.2.11/src/handletoken.c indent-2.2.11.my/src/handletoken.c
31 --- indent-2.2.11/src/handletoken.c     2009-02-15 14:20:42 +0300
32 +++ indent-2.2.11.my/src/handletoken.c  2011-08-16 14:18:28 +0400
33 @@ -1642,6 +1642,11 @@
34      {
35        /* what ? */
36      }
37 +    if (parser_state_tos->in_parameter_declaration_prototype)
38 +    {
39 +      parser_state_tos->in_parameter_declaration_prototype = 0;
40 +      parser_state_tos->in_parameter_declaration = 0;
41 +    }
42  }
43  
44  /**
45 diff -u indent-2.2.11/src/indent.h indent-2.2.11.my/src/indent.h
46 --- indent-2.2.11/src/indent.h  2009-10-11 23:15:34 +0400
47 +++ indent-2.2.11.my/src/indent.h       2011-08-16 14:19:37 +0400
48 @@ -318,6 +318,11 @@
49      int brace_indent; /*!< number of spaces to indent braces from the suround if, while, etc. in -bl
50                         * (bype_2 == 0) code */
51      int expect_output_file;  /*!< Means "-o" was specified. */
52 +    int diff_decls_and_defs; /*!< Makes indent think that function prototypes are terminated by ';',
53 +                              * without this option indent will not be able to tell a difference between
54 +                              * int foo (); and int foo () {}
55 +                              * This is the default.
56 +                              */
57  } user_options_ty;
58  
59  extern user_options_ty settings;
60 @@ -430,6 +435,7 @@
61                                     * slightly different */
62      int in_stmt;                  /*!<  set to 1 while in a stmt */
63      int in_parameter_declaration;
64 +    int in_parameter_declaration_prototype;
65      int ind_level;                /*!<  the current indentation level in spaces */
66      int ind_stmt;                 /*!<  set to 1 if next line should have an extra
67                                     * indentation level because we are in the
68 diff -u indent-2.2.11/src/lexi.c indent-2.2.11.my/src/lexi.c
69 --- indent-2.2.11/src/lexi.c    2009-11-11 22:36:32 +0300
70 +++ indent-2.2.11.my/src/lexi.c 2011-08-16 14:14:28 +0400
71 @@ -616,8 +616,11 @@
72                 * I've added '=' to this list to keep from breaking
73                 * a non-valid C macro from libc.  -jla */
74                      
75 -               if (*tp != ';' && *tp != ',' && *tp != '(' && *tp != '=')
76 +               if ((*tp != ';' || !settings.diff_decls_and_defs) &&
77 +                   *tp != ',' && *tp != '(' && *tp != '=')
78                 {
79 +                  if (*tp == ';')
80 +                    parser_state_tos->in_parameter_declaration_prototype = 1;
81                    parser_state_tos->in_parameter_declaration = 1;
82                 }
83              }