public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: Remove ordering limitation (Tom Tromey <tromey@redhat.com>).
@ 2008-04-01 21:43 cagney
  0 siblings, 0 replies; only message in thread
From: cagney @ 2008-04-01 21:43 UTC (permalink / raw)
  To: frysk-cvs

The branch, master has been updated
       via  bcb3fa5fdc4667a15386f1ef9a116753d761fb90 (commit)
      from  a0fc4305e0afa24959ac5cd073f65c6bb50eb8b0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit bcb3fa5fdc4667a15386f1ef9a116753d761fb90
Author: Andrew Cagney <cagney@redhat.com>
Date:   Tue Apr 1 17:36:51 2008 -0400

    Remove ordering limitation (Tom Tromey <tromey@redhat.com>).
    
    frysk-imports/getopt/ChangeLog
    2008-04-01  Andrew Cagney  <cagney@redhat.com>
    
    	Import 2008-03-20  Tom Tromey  <tromey@redhat.com>
    	* tools/gnu/classpath/tools/getopt/Parser.java (options): Don't
    	initialize.
    	(add, addFinal): Don't update options.
    	(requireOptions): New method.
    	(printHelp): Synchronize.  Call requireOptions.
    	(parse): Call requireOptions.

-----------------------------------------------------------------------

Summary of changes:
 frysk-imports/getopt/ChangeLog                     |   10 +++++++
 .../getopt/gnu/classpath/tools/getopt/Parser.java  |   28 +++++++++++++++----
 2 files changed, 32 insertions(+), 6 deletions(-)

First 500 lines of diff:
diff --git a/frysk-imports/getopt/ChangeLog b/frysk-imports/getopt/ChangeLog
index 5d3fc3d..eedda6d 100644
--- a/frysk-imports/getopt/ChangeLog
+++ b/frysk-imports/getopt/ChangeLog
@@ -1,3 +1,13 @@
+2008-04-01  Andrew Cagney  <cagney@redhat.com>
+
+	Import 2008-03-20  Tom Tromey  <tromey@redhat.com>
+	* tools/gnu/classpath/tools/getopt/Parser.java (options): Don't
+	initialize.
+	(add, addFinal): Don't update options.
+	(requireOptions): New method.
+	(printHelp): Synchronize.  Call requireOptions.
+	(parse): Call requireOptions.
+
 2007-01-26  Mark Wielaard  <mark@klomp.org>
 
 	* Makefile.am (getopt.jar): Pass JAVACFLAGS to JAVAC.
diff --git a/frysk-imports/getopt/src/getopt/gnu/classpath/tools/getopt/Parser.java b/frysk-imports/getopt/src/getopt/gnu/classpath/tools/getopt/Parser.java
index b142836..5b18ecb 100644
--- a/frysk-imports/getopt/src/getopt/gnu/classpath/tools/getopt/Parser.java
+++ b/frysk-imports/getopt/src/getopt/gnu/classpath/tools/getopt/Parser.java
@@ -1,5 +1,5 @@
 /* Parser.java - parse command line options
- Copyright (C) 2006 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2008 Free Software Foundation, Inc.
 
  This file is part of GNU Classpath.
 
@@ -66,7 +66,9 @@ public class Parser
 
   private boolean longOnly;
 
-  private ArrayList options = new ArrayList();
+  // All of the options.  This is null initially; users must call
+  // requireOptions before access.
+  private ArrayList options;
 
   private ArrayList optionGroups = new ArrayList();
 
@@ -218,7 +220,6 @@ public class Parser
    */
   public synchronized void add(Option opt)
   {
-    options.add(opt);
     defaultGroup.add(opt);
   }
 
@@ -230,7 +231,6 @@ public class Parser
    */
   protected synchronized void addFinal(Option opt)
   {
-    options.add(opt);
     finalGroup.add(opt);
   }
 
@@ -242,7 +242,6 @@ public class Parser
    */
   public synchronized void add(OptionGroup group)
   {
-    options.addAll(group.options);
     // This ensures that the final group always appears at the end
     // of the options.
     if (optionGroups.isEmpty())
@@ -251,13 +250,29 @@ public class Parser
       optionGroups.add(optionGroups.size() - 1, group);
   }
 
+  // Make sure the 'options' field is properly initialized.
+  private void requireOptions()
+  {
+    if (options != null)
+      return;
+    options = new ArrayList();
+    Iterator it = optionGroups.iterator();
+    while (it.hasNext())
+      {
+	OptionGroup group = (OptionGroup) it.next();
+	options.addAll(group.options);
+      }
+  }
+
   public void printHelp()
   {
     this.printHelp(System.out);
   }
 
-  void printHelp(PrintStream out)
+  synchronized void printHelp(PrintStream out)
   {
+    requireOptions();
+
     if (headerText != null)
       {
         formatText(out, headerText);
@@ -417,6 +432,7 @@ public class Parser
    */
   public synchronized void parse(String[] inArgs, FileArgumentCallback files)
   {
+    requireOptions();
     try
       {
         args = inArgs;


hooks/post-receive
--
frysk system monitor/debugger


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-04-01 21:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-01 21:43 [SCM] master: Remove ordering limitation (Tom Tromey <tromey@redhat.com>) cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).