Revision: 1738 http://svn.sourceforge.net/vexi/?rev=1738&view=rev Author: mkpg2 Date: 2007-03-16 11:25:34 -0700 (Fri, 16 Mar 2007)
Log Message: ----------- Development Modified Paths: -------------- core/trunk/org.vexi.debugclient/src/org/vexi/debugclient/core/server.t Modified: core/trunk/org.vexi.debugclient/src/org/vexi/debugclient/core/server.t =================================================================== --- core/trunk/org.vexi.debugclient/src/org/vexi/debugclient/core/server.t 2007-03-16 18:23:54 UTC (rev 1737) +++ core/trunk/org.vexi.debugclient/src/org/vexi/debugclient/core/server.t 2007-03-16 18:25:34 UTC (rev 1738) @@ -1,25 +1,36 @@ -<vexi xmlns:ui="vexi://ui" xmlns:meta="vexi://meta" xmlns:util="vexi.util" xmlns="org.vexi.debugclient"> +<vexi xmlns:ui="vexi://ui" xmlns:meta="vexi://meta" + xmlns:util="vexi.util" + xmlns:model="org.vexi.debugclient.core.model"> static.getServer = function(){ return vexi.net.rpc.xml ("http://localhost:7785/").XmlrpcDebugServer; }; - static.statusCounter = -1; + static.stateCounter = -1; + static.syncState = function(){ + var r = getServer().getState(stateCounter); + stateCounter = r.stateCounter; + model..status = r.status; + if(r.currentThread!=null){ + model..breakPosition = model..newLocation(r.currentThread.srcName, r.currentThread.ln); + } + model..currentThread = r.currentThread; + if(r.sleepingThreads!=null) model..sleepingThreads = r.sleepingThreads; + if(r.scheduledThreads!=null) model..scheduledThreads = r.scheduledThreads; + + } + static.start = function(serverFactory){ stateCounter = 1; vexi.thread = function(){ while(true){ - var r = getServer().getState(stateCounter); - + syncState(); //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); } }; }; @@ -64,14 +75,8 @@ }; //////////// // 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){ @@ -82,13 +87,21 @@ // 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]); + var instream = vexi.biscuits.breakpoints; + + var parser = {}; + parser.startElement = function(name, attrs){ + if(name="bkpt"){ + if(getServer().addBreakPoint(attrs.srcName,attrs.ln)) + bpAdded(attrs.srcName,attrs.ln); + else + vexi.log.warn("failed to add " + attrs.srcName+":"+attrs.ln); + } + }; + parser.endElement = function(name){}; + parser.characters = function(val){}; + vexi.thread = function(){ + vexi.stream.parse.xml(instream, parser); } } }; @@ -97,21 +110,28 @@ // 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; + var outstream = vexi.biscuits.breakpoints; + writer = vexi.stream.write.xml(outstream); + writer.startElement("debugsession", {}); + for(var i=0; bps.length>i; i++){ + writer.startElement("bkpt", {srcName:bps[i].srcName,ln:bps[i].ln}); + writer.endElement(); } - vexi.biscuits.breakpoints = {bps:str}; + writer.endElement(); }else{ - vexi.biscuits.breakpoints = null; + vexi.file.remove(vexi.biscuits.breakpoints); } } - static.addBreakPoint = function(srcName, ln){ - vexi.thread = function(){ - if(getServer().addBreakPoint(srcName, ln)) - bpAdded(srcName, ln); + static._setBreakPoint = function(srcName, ln){ + if(getServer().addBreakPoint(srcName, ln)){ + model..setBreakPoint(srcName, ln); + return true; } + return false; + } + static.setBreakPoint = function(srcName, ln){ + vexi.thread = function(){_setBreakPoint();}; }; static.removeBreakPoint = function(srcName, ln){ 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