public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM] frysk system monitor/debugger branch, master, updated. 3b6b68b00544cc4eb9e352de1cdc578083569f9d
@ 2007-11-08 14:45 cagney
  0 siblings, 0 replies; only message in thread
From: cagney @ 2007-11-08 14:45 UTC (permalink / raw)
  To: frysk-cvs

The branch, master has been updated
       via  3b6b68b00544cc4eb9e352de1cdc578083569f9d (commit)
      from  b64b53ab72226ccc8c0bab0372a6de8328d22f81 (commit)

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

- Log -----------------------------------------------------------------
commit 3b6b68b00544cc4eb9e352de1cdc578083569f9d
Author: Andrew Cagney <cagney@redhat.com>
Date:   Thu Nov 8 09:43:19 2007 -0500

    Make ParameterizedCommand.complet(...) abstract.
    
    frysk-core/frysk/hpd/ChangeLog
    2007-11-08  Andrew Cagney  <cagney@redhat.com>
    
    	* CompletionFactory.java (completeFileName(CLI,String,int,List)): New.
    	(completeExpression(CLI,PTSet,String,int,List)): New.
    	(completeFileName(CLI,Input,int,List)): Delete.
    	* ParameterizedCommand.java (complete(CLI,Input,int,List)): New.
    	(complete(CLI,PTSet,String,int,List)): New; abstract.
    	* CoreCommand.java (complete(CLI,PTSet,String,int,List)): New.
    	* ExamineCommand.java: Ditto.
    	* DisassembleCommand.java: Ditto.
    	* LoadCommand.java: Ditto.
    	* PeekCommand.java: Ditto.
    	* TestParameterizedCommand.java: Ditto.

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

Summary of changes:
 frysk-core/frysk/hpd/ChangeLog                     |   14 +++++++
 frysk-core/frysk/hpd/CompletionFactory.java        |   40 +++++++++++++++----
 frysk-core/frysk/hpd/CoreCommand.java              |    7 +++
 frysk-core/frysk/hpd/DisassembleCommand.java       |    8 ++++
 frysk-core/frysk/hpd/ExamineCommand.java           |    7 +++
 frysk-core/frysk/hpd/LoadCommand.java              |    8 ++-
 frysk-core/frysk/hpd/ParameterizedCommand.java     |   21 ++++++++++
 frysk-core/frysk/hpd/PeekCommand.java              |    7 +++
 frysk-core/frysk/hpd/TestParameterizedCommand.java |    6 +++
 9 files changed, 106 insertions(+), 12 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog
index 80715d0..d318cee 100644
--- a/frysk-core/frysk/hpd/ChangeLog
+++ b/frysk-core/frysk/hpd/ChangeLog
@@ -1,3 +1,17 @@
+2007-11-08  Andrew Cagney  <cagney@redhat.com>
+
+	* CompletionFactory.java (completeFileName(CLI,String,int,List)): New.
+	(completeExpression(CLI,PTSet,String,int,List)): New.	
+	(completeFileName(CLI,Input,int,List)): Delete.
+	* ParameterizedCommand.java (complete(CLI,Input,int,List)): New.
+	(complete(CLI,PTSet,String,int,List)): New; abstract.
+	* CoreCommand.java (complete(CLI,PTSet,String,int,List)): New.
+	* ExamineCommand.java: Ditto.
+	* DisassembleCommand.java: Ditto.
+	* LoadCommand.java: Ditto.
+	* PeekCommand.java: Ditto.
+	* TestParameterizedCommand.java: Ditto.
+
 2007-11-08  Phil Muldoon  <pmuldoon@redhat.com>
 
 	* TestCoreCommand.java (testCoreCommand): Append -noexe to
diff --git a/frysk-core/frysk/hpd/CompletionFactory.java b/frysk-core/frysk/hpd/CompletionFactory.java
index 3f237c2..ccf172e 100644
--- a/frysk-core/frysk/hpd/CompletionFactory.java
+++ b/frysk-core/frysk/hpd/CompletionFactory.java
@@ -90,15 +90,37 @@ class CompletionFactory {
 	}
     }
 
-    static int completeFileName(CLI cli, Input input, int cursor,
-					 List candidates) {
-	String incomplete = input.stringValue();
-	int start = input.token(0).start;
-	int end = new FileNameCompletor().complete(incomplete, cursor - start,
-						   candidates);
-	if (end >= 0)
-	    return start + end;
-	else
+    static int completeExpression(CLI cli, PTSet ptset,
+				  String incomplete, int base,
+				  List candidates) {
+	Iterator i = ptset.getTasks();
+	if (!i.hasNext()) {
+	    // Should still be able to complete $variables.
 	    return -1;
+	} else {
+	    int newCursor = -1;
+	    do {
+		Task task = (Task)i.next();
+		DebugInfoFrame frame = cli.getTaskFrame(task);
+		DebugInfo debugInfo = cli.getTaskDebugInfo(task);
+		int tmp = debugInfo.complete(frame, incomplete,
+					     base, candidates);
+		if (tmp >= 0)
+		    newCursor = tmp;
+	    } while (i.hasNext());
+	    // If only one candidate, pad out with a space.
+	    padSingleCandidate(candidates);
+	    // System.out.println("start=" + start);
+	    // System.out.println("base=" + base);
+	    // System.out.println("candidates=" + candidates);
+	    // System.out.println("newCursor=" + newCursor);
+	    return newCursor;
+	}
+    }
+
+    static int completeFileName(CLI cli, String incomplete, int base,
+				List candidates) {
+	return new FileNameCompletor().complete(incomplete, base,
+						candidates);
     }
 }
diff --git a/frysk-core/frysk/hpd/CoreCommand.java b/frysk-core/frysk/hpd/CoreCommand.java
index 2b2935e..2a7354f 100644
--- a/frysk-core/frysk/hpd/CoreCommand.java
+++ b/frysk-core/frysk/hpd/CoreCommand.java
@@ -42,6 +42,7 @@ package frysk.hpd;
 import java.io.File;
 import java.util.Iterator;
 
+import java.util.List;
 import frysk.debuginfo.DebugInfo;
 import frysk.debuginfo.DebugInfoFrame;
 import frysk.debuginfo.DebugInfoStackFactory;
@@ -174,4 +175,10 @@ public class CoreCommand extends ParameterizedCommand {
 		else
 			exeFile = new File(cli.parameter(1));
 	}
+
+    int complete(CLI cli, PTSet set, String incomplete, int base,
+		 List completions) {
+	return CompletionFactory.completeFileName(cli, incomplete, base,
+						  completions);
+    }
 }
diff --git a/frysk-core/frysk/hpd/DisassembleCommand.java b/frysk-core/frysk/hpd/DisassembleCommand.java
index c075948..4c303e4 100644
--- a/frysk-core/frysk/hpd/DisassembleCommand.java
+++ b/frysk-core/frysk/hpd/DisassembleCommand.java
@@ -292,4 +292,12 @@ public class DisassembleCommand extends ParameterizedCommand {
     interface InstructionPrinter {
 	String toPrint(Instruction instruction);
     }
+
+
+    int complete(CLI cli, PTSet ptset, String incomplete, int base,
+		 List completions) {
+	return CompletionFactory.completeExpression(cli, ptset, incomplete,
+						    base, completions);
+    }
+
 }
diff --git a/frysk-core/frysk/hpd/ExamineCommand.java b/frysk-core/frysk/hpd/ExamineCommand.java
index bf794d7..348f6ab 100644
--- a/frysk-core/frysk/hpd/ExamineCommand.java
+++ b/frysk-core/frysk/hpd/ExamineCommand.java
@@ -41,6 +41,7 @@ package frysk.hpd;
 
 import java.util.Iterator;
 import frysk.value.Value;
+import java.util.List;
 
 public class ExamineCommand extends ParameterizedCommand {
 
@@ -76,4 +77,10 @@ public class ExamineCommand extends ParameterizedCommand {
 	    }
 	}
     }
+
+    int complete(CLI cli, PTSet ptset, String incomplete, int base,
+		 List completions) {
+	return CompletionFactory.completeExpression(cli, ptset, incomplete,
+						    base, completions);
+    }
 }
diff --git a/frysk-core/frysk/hpd/LoadCommand.java b/frysk-core/frysk/hpd/LoadCommand.java
index 4ed5292..7117833 100644
--- a/frysk-core/frysk/hpd/LoadCommand.java
+++ b/frysk-core/frysk/hpd/LoadCommand.java
@@ -99,8 +99,10 @@ public class LoadCommand extends ParameterizedCommand {
 	}
     }
 
-    int complete(CLI cli, Input input, int cursor, List candidates) {
-	return CompletionFactory.completeFileName(cli, input, cursor,
-						  candidates);
+
+    int complete(CLI cli, PTSet set, String incomplete, int base,
+		 List completions) {
+	return CompletionFactory.completeFileName(cli, incomplete, base,
+						  completions);
     }
 }
diff --git a/frysk-core/frysk/hpd/ParameterizedCommand.java b/frysk-core/frysk/hpd/ParameterizedCommand.java
index 70214a5..3fbf3a2 100644
--- a/frysk-core/frysk/hpd/ParameterizedCommand.java
+++ b/frysk-core/frysk/hpd/ParameterizedCommand.java
@@ -42,6 +42,7 @@ package frysk.hpd;
 import java.util.TreeMap;
 import java.util.Iterator;
 import java.util.SortedMap;
+import java.util.List;
 
 abstract class ParameterizedCommand extends Command {
     private final SortedMap longOptions = new TreeMap();
@@ -167,4 +168,24 @@ abstract class ParameterizedCommand extends Command {
      * Interpret command, using options.
      */
     abstract void interpret(CLI cli, Input input, Object options);
+
+    /**
+     * Complete the input.
+     */
+    final int complete(CLI cli, Input input, int cursor, List candidates) {
+	int start = input.token(0).start;
+	int pos = complete(cli, cli.getCommandPTSet(input),
+			   input.stringValue(), cursor - start, candidates);
+	if (pos > 0) {
+	    return pos + start;
+	} else {
+	    return -1;
+	}
+    }
+
+    /**
+     * Complete the string.
+     */
+    abstract int complete(CLI cli, PTSet ptset, String incomplete,
+			  int base, List candidates);
 }
diff --git a/frysk-core/frysk/hpd/PeekCommand.java b/frysk-core/frysk/hpd/PeekCommand.java
index 2e6ba25..6e9da6c 100644
--- a/frysk-core/frysk/hpd/PeekCommand.java
+++ b/frysk-core/frysk/hpd/PeekCommand.java
@@ -44,6 +44,7 @@ import inua.eio.ByteBuffer;
 import frysk.proc.Proc;
 import frysk.proc.ProcId;
 import frysk.proc.Task;
+import java.util.List;
 
 /**
  * PeekCommand handles the "peek memory-location" command on the fhpd
@@ -91,4 +92,10 @@ public class PeekCommand extends ParameterizedCommand {
 	}
 	
     }
+
+    int complete(CLI cli, PTSet ptset, String incomplete, int base,
+		 List completions) {
+	return CompletionFactory.completeExpression(cli, ptset, incomplete,
+						    base, completions);
+    }
 }
diff --git a/frysk-core/frysk/hpd/TestParameterizedCommand.java b/frysk-core/frysk/hpd/TestParameterizedCommand.java
index 5bd2e1b..746154a 100644
--- a/frysk-core/frysk/hpd/TestParameterizedCommand.java
+++ b/frysk-core/frysk/hpd/TestParameterizedCommand.java
@@ -39,6 +39,8 @@
 
 package frysk.hpd;
 
+import java.util.List;
+
 public class TestParameterizedCommand extends TestLib {
 
     private ParameterizedCommand command;
@@ -62,6 +64,10 @@ public class TestParameterizedCommand extends TestLib {
 		void help(CLI cli, Input input) {
 		    helped = true;
 		}
+		int complete(CLI cli, PTSet ptset, String incomplete,
+			     int base, List candidates) {
+		    return -1;
+		}
 	    };
     }
     public void tearDown() {


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


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

only message in thread, other threads:[~2007-11-08 14:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-08 14:45 [SCM] frysk system monitor/debugger branch, master, updated. 3b6b68b00544cc4eb9e352de1cdc578083569f9d 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).