Hi

I have a small patch to handle the following situation "f(x)" --> "f(
x)". Some strange people prefer to use such a style and claim that it
is a coding standard :(

The patch introduces new option -sapb and
--space-after-procedure-call-bracket, and extends the functionality.

In order to apply the patch use the patch you can use something like:

cd indent-2.2.XX
patch -p2 < sapb.diff

How the patch can be approved? Is there any indent-patches mailing list?



Thank you,
Artem Shinkarov
--- ./indent-2.2.10/doc/indent.texinfo	2008-03-11 18:50:42.000000000 +0000
+++ ./indent-2.2.10-new/doc/indent.texinfo	2010-12-13 17:29:31.161249356 +0000
@@ -920,6 +920,13 @@ the procedure being called and the @samp
 ("Hi");}}.  The @option{-npcs} option would give @code{puts("Hi");}).
 @refill
 
+...@kindex -sapb
+...@kindex --space-after-procedure-call-bracket
+The @option{-sapb} option causes a space to be placed after the opening
+bracket of the procedure being called. For example, the @option{-sapb}
+would give @w...@code{puts( "Hi);}}.
+...@refill
+
 @kindex -cs
 @kindex --space-after-cast
 @kindex -ncs
@@ -1997,6 +2004,12 @@ Put a space after each @code{fo...@*
 Put a space after each @code{i...@*
 @xref{Statements}.
 
+...@item -sapb
+...@itemx --space-after-procedure-call-bracket
+Insert the space after @samp{(} of the procedure
+being call...@*
+...@xref{statements}.
+
 @item -saw
 @itemx --space-after-while
 Put a space after each @code{whil...@*
@@ -2143,6 +2156,7 @@ the corresponding short option.
 \line{ --space-after-if \leaderfill                -sai\ }
 \line{ --space-after-parentheses \leaderfill       -prs\ }
 \line{ --space-after-procedure-calls \leaderfill   -pcs\ }  
+\line{ --space-after-procedure-call-bracket \leadfill -sapb}
 \line{ --space-after-while \leaderfill             -saw\ }
 \line{ --space-special-semicolon \leaderfill       -ss\ \ } 
 \line{ --standard-output \leaderfill      -st\ \ } 
@@ -2234,6 +2248,7 @@ the corresponding short option.
 --space-after-if				-sai
 --space-after-parentheses                       -prs
 --space-after-procedure-calls                   -pcs            
+--space-after-procedure-call-bracket            -sapb
 --space-after-while				-saw
 --space-special-semicolon                       -ss             
 --standard-output                               -st             

--- ./indent-2.2.10/src/args.c	2008-03-11 18:50:42.000000000 +0000
+++ ./indent-2.2.10-new/src/args.c	2010-12-13 17:28:10.661253477 +0000
@@ -191,6 +191,7 @@ static int exp_ts   = 0;
 static int exp_ut   = 0;
 static int exp_v    = 0;
 static int exp_version = 0;
+static int exp_sapb = 0;
 
 /**
  * The following structure is controlled by command line parameters and
@@ -264,6 +265,7 @@ const pro_ty pro[] =
 #endif
     {"pi",      PRO_INT,                               -1, ONOFF_NA, &settings.paren_indent,                     &exp_pi},
     {"pcs",     PRO_BOOL,                           false,       ON, &settings.proc_calls_space,                 &exp_pcs},
+    {"sapb",    PRO_BOOL,                           false, ONOFF_NA, &settings.space_after_proc_b,               &exp_sapb},
     {"o",       PRO_BOOL,                           false,       ON, &settings.expect_output_file,               &exp_o},
     {"nv",      PRO_BOOL,                           false,      OFF, &settings.verbose,                          &exp_v},
     {"nut",     PRO_BOOL,                            true,      OFF, &settings.use_tabs,                         &exp_ut},
@@ -381,6 +383,7 @@ const pro_ty pro[] =
 #endif
     {"pi",      PRO_INT,                               -1, ONOFF_NA, &settings.paren_indent,                     &exp_pi},
     {"pcs",     PRO_BOOL,                            true,       ON, &settings.proc_calls_space,                 &exp_pcs},
+    {"sapb",    PRO_BOOL,                           false, ONOFF_NA, &settings.space_after_proc_b,               &exp_sapb},
     {"orig",    PRO_SETTINGS,                           0, ONOFF_NA, ORIG_SETTINGS_STRING,                       &exp_orig},
     {"o",       PRO_BOOL,                           false,       ON, &settings.expect_output_file,               &exp_o},
     {"nv",      PRO_BOOL,                           false,      OFF, &settings.verbose,                          &exp_v},
@@ -495,6 +498,7 @@ const long_option_conversion_ty option_c
     {"space-special-semicolon",                     "ss"},
     {"space-after-while",                           "saw"},
     {"space-after-procedure-calls",                 "pcs"},
+    {"space-after-procedure-call-bracket",          "sapb"},
     {"space-after-parentheses",                     "prs"},
     {"space-after-if",                              "sai"},
     {"space-after-for",                             "saf"},


--- ./indent-2.2.10/src/indent.c	2008-03-11 18:50:42.000000000 +0000
+++ ./indent-2.2.10-new/src/indent.c	2010-12-13 17:27:36.351232856 +0000
@@ -457,7 +457,15 @@ static void handle_token_lparen(
     {
         *e_code++ = ' ';
     }
-
+    
+    /* put space after the opening bracket of function call  */
+    if (parser_state_tos->last_token == ident  &&
+        settings.space_after_proc_b && 
+        *token != '[')
+    {
+        *e_code++ = ' ';
+    }
+ 
     parser_state_tos->paren_indents[parser_state_tos->p_l_follow - 1] =
             e_code - s_code;
 

--- ./indent-2.2.10/src/indent.h	2008-03-11 18:50:42.000000000 +0000
+++ ./indent-2.2.10-new/src/indent.h	2010-12-13 16:28:46.341291299 +0000
@@ -310,6 +310,7 @@ typedef struct user_options_st
     int brace_indent; /*!< number of spaces to indent braces from the suround if, while, etc. in -bl
                        * (bype_2 == 0) code */
     int expect_output_file;  /*!< Means "-o" was specified. */
+    int space_after_proc_b;
 } user_options_ty;
 
 extern user_options_ty settings;



_______________________________________________
bug-indent mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-indent

Reply via email to