Indent patch

"Borkholder, Brandon S" <[email protected]>
Newsgroups gmane.comp.gnu.indent.bugs
Message-ID <[email protected]>
_______________________________________________
bug-indent mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-indent
indent-2.2.9-r3.patch (text/plain, 7.1 KB)
--- orig/args.c	2002-11-10 16:02:48.000000000 -0500
+++ src/args.c	2006-12-27 00:07:29.000000000 -0500
@@ -50,17 +50,17 @@
 #define KR_SETTINGS_STRING (int *) \
      "-nbad\0-bap\0-nbc\0-bbo\0-hnl\0-br\0-brs\0-c33\0-cd33\0" \
      "-ncdb\0-ce\0-ci4\0-cli0\0-d0\0-di1\0-nfc1\0-i4\0-ip0\0-l75\0-lp\0" \
-     "-npcs\0-nprs\0-npsl\0-sai\0-saf\0-saw\0-cs\0-nsc\0-nsob\0-nfca\0-cp33\0-nss\0"
+     "-npcs\0-nprs\0-npsl\0-sai\0-saf\0-saw\0-cs\0-nsc\0-nsob\0-nfca\0-cp33\0-nss\0-npt\0"
 
 #define GNU_SETTINGS_STRING  (int *) \
      "-nbad\0-bap\0-bbo\0-hnl\0-nbc\0-bl\0-bls\0-ncdb\0-cs\0-nce\0" \
      "-di2\0-ndj\0-nfc1\0-i2\0-ip5\0-lp\0-pcs\0-nprs\0-psl\0-nsc\0-sai\0-saf\0-saw\0-nsob\0" \
-     "-bli2\0-cp1\0-nfca\0"
+     "-bli2\0-cp1\0-nfca\0-npt\0"
 
 #define ORIG_SETTINGS_STRING (int *) \
      "-nbap\0-nbad\0-bbo\0-hnl\0-bc\0-br\0-brs\0-c33\0-cd33\0-cdb\0" \
      "-ce\0-ci4\0-cli0\0-cp33\0-di16\0-fc1\0-fca\0-i4\0-l75\0-lp\0-npcs\0-nprs\0" \
-     "-psl\0-sc\0-sai\0-saf\0-saw\0-nsob\0-nss\0-ts8\0"
+     "-psl\0-sc\0-sai\0-saf\0-saw\0-nsob\0-nss\0-ts8\0-npt\0"
 
 
 /* profile types */
@@ -137,6 +137,7 @@
 static int exp_prs  = 0;
 static int exp_psl  = 0;
 static int exp_ppi  = 0;  /* force preprocessor indent at width... */
+static int exp_pt   = 0;
 static int exp_sai  = 0;
 static int exp_saf  = 0;
 static int exp_saw  = 0;
@@ -205,6 +206,7 @@
     {"saw",     PRO_BOOL,                            true,       ON, &settings.space_after_while,                &exp_saw},
     {"sai",     PRO_BOOL,                            true,       ON, &settings.space_after_if,                   &exp_sai},
     {"saf",     PRO_BOOL,                            true,       ON, &settings.space_after_for,                  &exp_saf},
+    {"pt",      PRO_BOOL,                           false,       ON, &settings.pointer_type,                     &exp_pt},
     {"psl",     PRO_BOOL,                            true,       ON, &settings.procnames_start_line,             &exp_psl},
     {"prs",     PRO_BOOL,                           false,       ON, &settings.parentheses_space,                &exp_prs},
 #ifdef PRESERVE_MTIME
@@ -221,6 +223,7 @@
     {"nsaw",    PRO_BOOL,                            true,      OFF, &settings.space_after_while,                &exp_saw},
     {"nsai",    PRO_BOOL,                            true,      OFF, &settings.space_after_if,                   &exp_sai},
     {"nsaf",    PRO_BOOL,                            true,      OFF, &settings.space_after_for,                  &exp_saf},
+    {"npt",     PRO_BOOL,                            true,      OFF, &settings.pointer_type,                     &exp_pt},
     {"npsl",    PRO_BOOL,                            true,      OFF, &settings.procnames_start_line,             &exp_psl},
     {"nprs",    PRO_BOOL,                           false,      OFF, &settings.parentheses_space,                &exp_prs},
     {"npro",    PRO_IGN,                                0, ONOFF_NA, 0,                                          &exp_pro},
@@ -317,6 +320,7 @@
     {"saw",     PRO_BOOL,                            true,       ON, &settings.space_after_while,                &exp_saw},
     {"sai",     PRO_BOOL,                            true,       ON, &settings.space_after_if,                   &exp_sai},
     {"saf",     PRO_BOOL,                            true,       ON, &settings.space_after_for,                  &exp_saf},
+    {"pt",      PRO_BOOL,                           false,       ON, &settings.pointer_type,                     &exp_pt},
     {"psl",     PRO_BOOL,                            true,       ON, &settings.procnames_start_line,             &exp_psl},
     {"prs",     PRO_BOOL,                           false,       ON, &settings.parentheses_space,                &exp_prs},
 #ifdef PRESERVE_MTIME
@@ -334,6 +338,7 @@
     {"nsaw",    PRO_BOOL,                            true,      OFF, &settings.space_after_while,                &exp_saw},
     {"nsai",    PRO_BOOL,                            true,      OFF, &settings.space_after_if,                   &exp_sai},
     {"nsaf",    PRO_BOOL,                            true,      OFF, &settings.space_after_for,                  &exp_saf},
+    {"npt",     PRO_BOOL,                            true,      OFF, &settings.pointer_type,                     &exp_pt},
     {"npsl",    PRO_BOOL,                            true,      OFF, &settings.procnames_start_line,             &exp_psl},
     {"nprs",    PRO_BOOL,                           false,      OFF, &settings.parentheses_space,                &exp_prs},
     {"npro",    PRO_IGN,                                0, ONOFF_NA, 0,                                          &exp_pro},
@@ -437,6 +442,7 @@
     {"space-after-while",                           "saw"},
     {"space-after-procedure-calls",                 "pcs"},
     {"space-after-parentheses",                     "prs"},
+    {"pointer-type",                                "pt"},
     {"space-after-if",                              "sai"},
     {"space-after-for",                             "saf"},
     {"space-after-cast",                            "cs"},
@@ -454,6 +460,7 @@
     {"no-verbosity",                                "nv"},
     {"no-tabs",                                     "nut"},
     {"no-space-after-while",                        "nsaw"},
+    {"no-pointer-type",                             "npt"},
     {"no-space-after-parentheses",                  "nprs"},
     {"no-space-after-if",                           "nsai"},
     {"no-space-after-function-call-names",          "npcs"},
--- orig/indent.c	2006-12-27 00:06:23.000000000 -0500
+++ src/indent.c	2006-12-27 00:07:29.000000000 -0500
@@ -657,8 +657,11 @@
    const bb_code_ty can_break)
 {
     char           * t_ptr;
-    
-    if (parser_state_tos->want_blank)
+
+    /* only put a single space if we are not in a declaration, or
+     * if we are using gnu or berkley or kr */
+    if (parser_state_tos->want_blank &&
+        !settings.pointer_type)
     {
         set_buf_break (bb_unary_op, paren_target);
         *e_code++ = ' ';
@@ -678,7 +681,8 @@
 
         if ((parser_state_tos->paren_depth == 0) &&
             parser_state_tos->in_decl && !buf_break_used &&
-            !parser_state_tos->block_init)
+            !parser_state_tos->block_init &&
+            !settings.pointer_type)
         {
             while ((e_code - s_code) < (*dec_ind - (token_end - token)))
             {
--- orig/indent.h	2006-12-27 00:06:23.000000000 -0500
+++ src/indent.h	2006-12-27 00:07:29.000000000 -0500
@@ -194,6 +194,7 @@
     int space_after_while;   /* Put a space after `while' */
     int space_after_if;      /* Put a space after `if' */
     int space_after_for;     /* Put a space after `for' */
+    int pointer_type;        /* if true, put * with the type names, else put it with the variable names in declarations */
     int procnames_start_line; /* if true, the names of procedures being  defined get placed in column 1 (ie. a
                                * newline is placed between the type of the procedure and its name) */
     int parentheses_space;   /* If true, parentheses will look like: ( foo ) rather than (foo) */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.