bug-cppi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-cppi] Add option --initial-i-depth


From: Werner Koch
Subject: [bug-cppi] Add option --initial-i-depth
Date: Tue, 31 Jan 2012 15:56:22 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Hi,

this tool is really useful.  However an option variable should also be
setable without GDB.  

  cppi -i -1 foo.h

is quite useful.


Shalom-Salam,

   Werner

>From a234150850ea7629f0e5806919aaf28a2b1431df Mon Sep 17 00:00:00 2001
From: Werner Koch <address@hidden>
Date: Tue, 31 Jan 2012 15:53:18 +0100
Subject: [PATCH] Add option --initial-i-depth.

* src/cppi.l: Add option --initial-i-depth / -i.  Do not reset
INITIAL_I_DEPTH.
(main): Set INITIAL_I_DEPTH.
---
 src/cppi.l |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/cppi.l b/src/cppi.l
index b2c64a4..3752971 100644
--- a/src/cppi.l
+++ b/src/cppi.l
@@ -131,6 +131,7 @@ static struct option const long_options[] =
   {"check", no_argument, NULL, 'c'},
   {"list-files-only", no_argument, NULL, 'l'},
   {"max-string-length", required_argument, NULL, 'm'},
+  {"initial-i-depth", required_argument, NULL, 'i' },
   {GETOPT_HELP_OPTION_DECL},
   {GETOPT_VERSION_OPTION_DECL},
   {NULL, 0, NULL, 0}
@@ -381,7 +382,6 @@ b [^a-zA-Z_\n]
 
   obstack_init (&opener_stack);
 
-  initial_i_depth = 0;
   i_depth = initial_i_depth;
 
 %}
@@ -668,6 +668,9 @@ With no FILE, or when FILE is -, read standard input.\n\
                          fail if there is a double-quoted string longer\n\
                          than LENGTH;  if LENGTH is 0 (the default),\n\
                          then there is no limit\n\
+  -i, --initial-i-depth=DEPTH\n\
+                         if set to -1 cause code to be intended one level\n\
+                         less than with the default depth of 0.\n\
 "), stdout);
       fputs (HELP_OPTION_DESCRIPTION, stdout);
       fputs (VERSION_OPTION_DESCRIPTION, stdout);
@@ -793,7 +796,7 @@ main (int argc, char **argv)
 
   atexit (close_stdout);
 
-  while ((c = getopt_long (argc, argv, "aclm:", long_options, NULL)) != -1)
+  while ((c = getopt_long (argc, argv, "aclm:i:", long_options, NULL)) != -1)
     {
       switch (c)
         {
@@ -822,6 +825,10 @@ main (int argc, char **argv)
             }
           break;
 
+        case 'i':
+          initial_i_depth = atoi (optarg);
+          break;
+
         case_GETOPT_HELP_CHAR;
 
         case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
-- 
1.7.7.1



-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]