Revision: 1737
          http://svn.sourceforge.net/vexi/?rev=1737&view=rev
Author:   mkpg2
Date:     2007-03-16 11:23:54 -0700 (Fri, 16 Mar 2007)

Log Message:
-----------
Refactoring debugclient

Added Paths:
-----------
    core/trunk/org.vexi.debugclient/src/org/vexi/debugclient/core/server.t

Copied: core/trunk/org.vexi.debugclient/src/org/vexi/debugclient/core/server.t 
(from rev 1736, 
some_apps/trunk/org.vexi.debugclient/src/org/vexi/debugclient/server.t)
===================================================================
--- core/trunk/org.vexi.debugclient/src/org/vexi/debugclient/core/server.t      
                        (rev 0)
+++ core/trunk/org.vexi.debugclient/src/org/vexi/debugclient/core/server.t      
2007-03-16 18:23:54 UTC (rev 1737)
@@ -0,0 +1,141 @@
+<vexi xmlns:ui="vexi://ui" xmlns:meta="vexi://meta" xmlns:util="vexi.util" 
xmlns="org.vexi.debugclient">
+       
+       static.getServer = function(){
+               return vexi.net.rpc.xml 
("http://localhost:7785/";).XmlrpcDebugServer;
+    };
+       
+       static.statusCounter = -1;
+       
+    static.start = function(serverFactory){
+            stateCounter = 1;
+            vexi.thread = function(){
+                while(true){
+                    var r = getServer().getState(stateCounter);
+                    
+                    //vexi.log.info("r "+ r);
+                    //vexi.log.info("stateCounter "+ r.stateCounter);
+                                       //vexi.log.info(listeners.numchildren);
+                    stateCounter = r.stateCounter;
+                    
+                    // Turn it into an event
+                    r.name = "StateChanged";
+                    .event..sendEvent(r);
+                }
+            };
+       };
+       
+    //////////////
+    /// Button Actions
+    ///////
+       static.stepOver = function(){
+               vexi.thread = function(v){
+          var ret = getServer().stepOver();
+        }      
+       };
+       static.stepInto = function(){
+               vexi.thread = function(v){
+          var ret = getServer().stepInto();
+        }      
+       };
+       static.stepOut = function(){
+               vexi.thread = function(v){
+          var ret = getServer().stepOut();
+        }      
+       };
+       static.resume = function(){
+               vexi.thread = function(v){
+          var ret = getServer().resume();
+        }      
+       };
+       static.suspend = function(){
+               vexi.thread = function(v){
+          var ret = getServer().suspend();
+        }      
+       };
+       static.restart = function(){
+               vexi.thread = function(v){
+          var ret = getServer().restart();
+        }      
+       };
+       static.quit = function(){
+               vexi.thread = function(v){
+          var ret = getServer().quit();
+        }      
+       };
+       ////////////
+       // Breakpoints
+       var bpAdded = function(srcName, ln){
+               .event..sendEvent({name:"BreakPointChanged", srcName:srcName, 
ln: ln, on: true});
+       };
+       
+       var bpRemoved = function(srcName, ln){
+               .event..sendEvent({name:"BreakPointChanged", srcName:srcName, 
ln: ln, on: false});
+       };
+       
+       static.loadBreakPoints = function(){    
+               var bps = static.getBreakPoints();
+               if(bps.length > 0){
+                       for(var i=0; bps.length>i; i++){
+                               bpAdded(bps[i].srcName, bps[i].ln);
+                       }
+               }else{
+                       // REMARK we are only reloading breakpoints if none are 
already set.
+                       // Is this the right thing to do? Perhaps we should 
give the user a 
+                       // choice to see if he wants to keep the bps saved in 
the biscuit.
+                       var bpsStr = vexi.biscuits.breakpoints.bps;
+                       if(bpsStr ==null) return;
+                       var bpsArr = bpsStr.split(",");
+                       for(var i=0; bpsArr.length>i; i++){
+                               // bps stored {srcName}:{ln}
+                               var bp = bpsArr[i].split(":");
+                               bpAdded(bp[0],bp[1]);
+                       }
+               }
+       };
+
+       static.saveBreakPoints = function(){
+               // save biscuit    
+               var bps = db.server..getBreakPoints();
+               if(bps.length > 0){
+                       var str = bps[0].srcName + ":" + bps[0].ln;
+                       for(var i=1; bps.length>i; i++){
+                               str += "," + bps[i].srcName + ":" + bps[i].ln;
+                       }
+                       vexi.biscuits.breakpoints = {bps:str};
+               }else{
+                       vexi.biscuits.breakpoints = null;
+               }
+       }
+       
+       static.addBreakPoint = function(srcName, ln){
+               vexi.thread = function(){
+                       if(getServer().addBreakPoint(srcName, ln))
+                               bpAdded(srcName, ln);                           
+               }
+       };
+       
+       static.removeBreakPoint = function(srcName, ln){
+               vexi.thread = function(){
+                       if(getServer().removeBreakPoint(srcName, ln))
+                               bpRemoved(srcName, ln);                         
+               }
+       };
+       
+       ////////
+       // Fetch stuff
+       ////////
+    static.getSource = function(name){
+       var s = getServer().getSource(name);
+       /*vexi.log.info("-------");
+       vexi.log.info(s);
+       vexi.log.info("-------");*/
+       return s;
+    }
+    
+       static.getBreakPoints = function(name){
+               // FEATURE cache return result
+        return getServer().getBreakPoints();
+    }
+       
+   <ui:box/>
+</vexi>
\ No newline at end of file


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to