Author: derek Date: Thu Sep 21 19:47:42 2006 New Revision: 110 Modified: sofaswitch/trunk/callflow/src/conditional.cpp sofaswitch/trunk/callflow/src/eventer.cpp sofaswitch/trunk/callflow/src/python.cpp sofaswitch/trunk/callflow/src/shapelist.cpp sofaswitch/trunk/callflow/src/startfor.cpp sofaswitch/trunk/callflow/src/timer.cpp sofaswitch/trunk/callflow/tests/requestnode.src sofaswitch/trunk/callflow/tests/timetest.src Log: Finish adding python regular expression testing on events. Seperate out notion on competing timer, as this is confusing. Update Test scripts. Modified: sofaswitch/trunk/callflow/src/conditional.cpp ============================================================================== --- sofaswitch/trunk/callflow/src/conditional.cpp (original) +++ sofaswitch/trunk/callflow/src/conditional.cpp Thu Sep 21 19:47:42 2006 @@ -29,7 +29,7 @@ AdjustIoPoints(); displayData[displayData.size()] = - InformationSection(wxT("Test"), wxT("variable == 0")); + InformationSection(wxT("Test (Python code)"), wxT("variable == 0")); } void DndShapeConditional::Draw(wxDC& dc) Modified: sofaswitch/trunk/callflow/src/eventer.cpp ============================================================================== --- sofaswitch/trunk/callflow/src/eventer.cpp (original) +++ sofaswitch/trunk/callflow/src/eventer.cpp Thu Sep 21 19:47:42 2006 @@ -33,9 +33,6 @@ displayData[displayData.size()] = InformationSection(wxT("Event sought (Regular Exp)"), wxT("*DTMF")); - - displayData[displayData.size()] = - InformationSection(wxT("Competing timer label"), wxT("")); } bool DndShapeEventer::TestInternalVariables() @@ -117,7 +114,12 @@ file.AddLine(" link not be connected, a None value will be returned. "); file.AddLine(" \"\"\" "); file.AddLine(" a,b,c = sTuple "); - file.AddLine(" self.currentHandlers[self.data[a][\"Event\"]] = a "); + file.AddLine(" ePyn = self.data[a][\"Event Python\"] "); + file.AddLine(" eReg = self.data[a][\"Event RegExp\"] "); + file.AddLine(" if len(ePyn) > 0: "); + file.AddLine(" self.currentHandlers[eval(ePyn)] = a "); + file.AddLine(" else: "); + file.AddLine(" self.currentHandlers[eReg] = a "); file.AddLine(" return self.data[a][\"OutputKeepGoing\"] "); file.AddLine(""); @@ -150,9 +152,6 @@ file.AddLine(wxString::Format(" \"Event RegExp\" : ")); file.AddLine(wxString::Format(" \"%s\", ", displayData[2].data.c_str())); - - file.AddLine(wxString::Format(" \"Competing timer label\" : ")); - file.AddLine(wxString::Format(" \"%s\", ", displayData[3].data.c_str())); file.AddLine(wxString::Format(" },")); Modified: sofaswitch/trunk/callflow/src/python.cpp ============================================================================== --- sofaswitch/trunk/callflow/src/python.cpp (original) +++ sofaswitch/trunk/callflow/src/python.cpp Thu Sep 21 19:47:42 2006 @@ -35,7 +35,7 @@ void DndShapePython::Draw(wxDC& dc) { DrawCompileError(dc); - dc.SetPen(*wxBLACK_PEN); + dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); wxPoint p1(m_rect.GetPosition()); wxPoint pA(p1.x + 25, p1.y + 15); Modified: sofaswitch/trunk/callflow/src/shapelist.cpp ============================================================================== --- sofaswitch/trunk/callflow/src/shapelist.cpp (original) +++ sofaswitch/trunk/callflow/src/shapelist.cpp Thu Sep 21 19:47:42 2006 @@ -285,6 +285,7 @@ file.AddLine("import time "); file.AddLine("import socket "); file.AddLine("import distutils "); + file.AddLine("import re "); file.AddLine("from twisted.internet import reactor, protocol "); file.AddLine(" "); file.AddLine("class Controller(protocol.Protocol): "); @@ -358,22 +359,22 @@ file.AddLine(" for which there was no corresponding handler. We cannot have these "); file.AddLine(" hanging around. It would give weird output if they were processed at "); file.AddLine(" some later time when the program adds a handler for this case "); - file.AddLine(" \"\"\" "); - file.AddLine(" #print \"processQueue\" "); - file.AddLine(" #print \"current handlers \", self.currentHandlers "); - file.AddLine(" #print \"current events \", self.generatedEvents "); - file.AddLine(" #print \"pending events \", self.pendingEvents "); - file.AddLine(" keys = self.generatedEvents.keys() "); - file.AddLine(" for k in range(len(keys)): "); - file.AddLine(" if self.currentHandlers.has_key(keys[k]): "); - file.AddLine(" eventNode = self.currentHandlers[keys[k]] "); - file.AddLine(" eventData = self.generatedEvents.pop(keys[k]) "); - file.AddLine(" cTimer = self.data[eventNode][\"Competing timer label\"]"); - file.AddLine(" self.DeleteThisEvent(cTimer) "); - file.AddLine(" handler = self.data[eventNode][\"Event Handler\"]"); - file.AddLine(" a,b,c = handler "); - file.AddLine(" self.data[a][\"Event Data\"] = eventData "); - file.AddLine(" self.DoWork(handler) "); + file.AddLine(" \"\"\" "); + file.AddLine(" #print \"processQueue\" "); + file.AddLine(" #print \"current handlers \", self.currentHandlers "); + file.AddLine(" #print \"current events \", self.generatedEvents "); + file.AddLine(" #print \"pending events \", self.pendingEvents "); + file.AddLine(" for handler in self.currentHandlers.keys(): "); + file.AddLine(" hre = re.compile(handler) "); + file.AddLine(" for event in self.generatedEvents.keys(): "); + file.AddLine(" if len(hre.split(event)) > 1: "); + file.AddLine(" #found a match "); + file.AddLine(" eventNode = self.currentHandlers[handler] "); + file.AddLine(" eventData = self.generatedEvents.pop(event) "); + file.AddLine(" eHandler = self.data[eventNode][\"Event Handler\"] "); + file.AddLine(" a,b,c = eHandler "); + file.AddLine(" self.data[a][\"Event Data\"] = eventData "); + file.AddLine(" self.DoWork(eHandler) "); file.AddLine(" self.generatedEvents.clear() "); file.AddLine(" "); file.AddLine(" def networkEventData(self, eName, data): "); Modified: sofaswitch/trunk/callflow/src/startfor.cpp ============================================================================== --- sofaswitch/trunk/callflow/src/startfor.cpp (original) +++ sofaswitch/trunk/callflow/src/startfor.cpp Thu Sep 21 19:47:42 2006 @@ -30,13 +30,13 @@ AdjustIoPoints(); displayData[displayData.size()] = - InformationSection(wxT("Initialise"), wxT("i = 0")); + InformationSection(wxT("Initialise (Python code)"), wxT("self.i = 0")); displayData[displayData.size()] = - InformationSection(wxT("Test for Termination"), wxT("i < loops")); + InformationSection(wxT("Test for Termination (Python code)"), wxT("self.i < loops")); displayData[displayData.size()] = - InformationSection(wxT("Increment"), wxT("i++")); + InformationSection(wxT("Increment (Python code)"), wxT("self.i++")); } void DndShapeStartFor::Draw(wxDC& dc) Modified: sofaswitch/trunk/callflow/src/timer.cpp ============================================================================== --- sofaswitch/trunk/callflow/src/timer.cpp (original) +++ sofaswitch/trunk/callflow/src/timer.cpp Thu Sep 21 19:47:42 2006 @@ -41,7 +41,7 @@ InformationSection(wxT("Timer period (seconds)"), wxT("2")); displayData[displayData.size()] = - InformationSection(wxT("Timer label"), wxT("thistimer")); + InformationSection(wxT("Timer label (string literal)"), wxT("thistimer")); AdjustIoPoints(); } Modified: sofaswitch/trunk/callflow/tests/requestnode.src ============================================================================== --- sofaswitch/trunk/callflow/tests/requestnode.src (original) +++ sofaswitch/trunk/callflow/tests/requestnode.src Thu Sep 21 19:47:42 2006 @@ -1 +1 @@ -14<B>244<B>255<B> extra <special>Tool Tip<ms>Eventer<ms><special>Event sought<ms>voipREQUESTNEWID<ms><special>Competing timer label<ms>requestnode<ms><special> <B><Shape>2<B>230<B>347<B> extra <special>Tool Tip<ms>End Processing<ms><special> <B><Shape>10<B>232<B>204<B> extra <special>Tool Tip<ms>Python<ms><special>Python Code<ms>print \"Have requested a node from voip at \", time.asctime()<ms><special> <B><Shape>1<B>231<B>108<B> extra <special>Tool Tip<ms>Start Processing<ms><special> <B><Shape>11<B>232<B>159<B> extra <special>Tool Tip<ms>Request Node<ms><special>Request node from<ms>voip<ms><special>Timer period (seconds)<ms>1<ms><special>Timer label<ms>requestnode<ms><special> <B><Shape>10<B>231<B>295<B> extra <special>Tool Tip<ms>Python<ms><special>Python Code<ms>print \"have a new node on \", self.data[self.currentNode][\"Event Data\"]<ms><special> <B><Shape> +13<B>231<B>340<B> extra <special>Tool Tip<ms>Stop Timer<ms><special>Timer to stop<ms>requestnode<ms><special> <B><Shape>1<B>231<B>108<B> extra <special>Tool Tip<ms>Start Processing<ms><special> <B><Shape>10<B>323<B>322<B> extra <special>Tool Tip<ms>Python<ms><special>Python Code<ms>print \"timer has expired at \", time.asctime()<ms><special> <B><Shape>2<B>231<B>391<B> extra <special>Tool Tip<ms>End Processing<ms><special> <B><Shape>9<B>289<B>276<B>289,277,349,276<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>11<B>232<B>159<B> extra <special>Tool Tip<ms>Request Node<ms><special>Request node from<ms>voip<ms><special>Timer period (seconds)<ms>1<ms><special>Timer label<ms>requestnode<ms><special> <B><Shape>10<B>232<B>204<B> extra <special>Tool Tip<ms>Python<ms><special>Python Code<ms>print \"Have requested a node from voip at \", time.asctime()<ms><special> <B><Shape>10<B>231<B>295<B> extra <special>Tool Tip<ms>Python<ms><special>Python Code<ms>print \"have a new node on \", self.data[self.currentNode][\"Event Data\"]<ms><special> <B><Shape>9<B>259<B>371<B>347,371,259,391<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>14<B>243<B>255<B> extra <special>Tool Tip<ms>Eventer<ms><special>Event sought (Python code)<ms><ms><special>Event sought (Regular Exp)<ms>NEWID<ms><special> <B><Shape>14<B>334<B>279<B> extra <special>Tool Tip<ms>Eventer<ms><special>Event sought (Python code)<ms><ms><special>Event sought (Regular Exp)<ms>requestnode<ms><special> <B><Shape> Modified: sofaswitch/trunk/callflow/tests/timetest.src ============================================================================== --- sofaswitch/trunk/callflow/tests/timetest.src (original) +++ sofaswitch/trunk/callflow/tests/timetest.src Thu Sep 21 19:47:42 2006 @@ -1 +1 @@ -12<B>123<B>122<B> extra <special>Tool Tip<ms>Timer<ms><special>Timer period (seconds)<ms>1<ms><special>Timer label<ms>timer1<ms><special> <B><Shape>9<B>150<B>272<B>151,272,150,344,232,354<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>10<B>126<B>221<B> extra <special>Tool Tip<ms>Python<ms><special>Python Code<ms>print \"t1 \", time.asctime(), \" data is \", self.data[self.currentNode][\"Event Data\"]<ms><special> <B><Shape>12<B>206<B>198<B> extra <special>Tool Tip<ms>Timer<ms><special>Timer period (seconds)<ms>2<ms><special>Timer label<ms>timer2<ms><special> <B><Shape>9<B>187<B>196<B>187,196,230,197<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>14<B>137<B>173<B> extra <special>Tool Tip<ms>Eventer<ms><special>Event sought<ms>timer1<ms><special>Competing timer label<ms><ms><special> <B><Shape>10<B>123<B>74<B> extra <special>Tool Tip<ms>Python<ms><special>Python Code<ms>print \"Start \", time.asctime()<ms><special> <B><Shape>1<B>123<B>26<B> extra <special>Tool Tip<ms>Start Processing<ms><special> <B><Shape>2<B>207<B>352<B> extra <special>Tool Tip<ms>End Processing<ms><special> <B><Shape>10<B>207<B>305<B> extra <special>Tool Tip<ms>Python<ms><special>Python Code<ms>print \"t2 \", time.asctime(), \" data is \", self.data[self.currentNode][\"Event Data\"]<ms><special> <B><Shape>14<B>218<B>251<B> extra <special>Tool Tip<ms>Eventer<ms><special>Event sought<ms>timer2<ms><special>Competing timer label<ms><ms><special> <B><Shape> +12<B>207<B>202<B> extra <special>Tool Tip<ms>Timer<ms><special>Timer period (seconds)<ms>2<ms><special>Timer label<ms>timer2<ms><special> <B><Shape>10<B>123<B>74<B> extra <special>Tool Tip<ms>Python<ms><special>Python Code<ms>print \"Start \", time.asctime()<ms><special> <B><Shape>14<B>218<B>254<B> extra <special>Tool Tip<ms>Eventer<ms><special>Event sought (Python code)<ms><ms><special>Event sought (Regular Exp)<ms>timer2<ms><special> <B><Shape>2<B>207<B>352<B> extra <special>Tool Tip<ms>End Processing<ms><special> <B><Shape>14<B>137<B>175<B> extra <special>Tool Tip<ms>Eventer<ms><special>Event sought (Python code)<ms><ms><special>Event sought (Regular Exp)<ms>timer1<ms><special> <B><Shape>10<B>247<B>371<B> extra <special>Tool Tip<ms>Python<ms><special>Python Code<ms>print \"t10 \", time.asctime(), \" data is \", self.data[self.currentNode][\"Event Data\"]<ms><special> <B><Shape>10<B>207<B>305<B> extra <special>Tool Tip<ms>Python<ms><special>Python Code<ms>print \"t2 \", time.asctime(), \" data is \", self.data[self.currentNode][\"Event Data\"]<ms><special> <B><Shape>10<B>126<B>221<B> extra <special>Tool Tip<ms>Python<ms><special>Python Code<ms>print \"t1 \", time.asctime(), \" data is \", self.data[self.currentNode][\"Event Data\"]<ms><special> <B><Shape>12<B>244<B>274<B> extra <special>Tool Tip<ms>Timer<ms><special>Timer period (seconds)<ms>10<ms><special>Timer label (string literal)<ms>t10<ms><special> <B><Shape>9<B>188<B>201<B>188,201,231,202<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>14<B>259<B>327<B> extra <special>Tool Tip<ms>Eventer<ms><special>Event sought (Python code)<ms><ms><special>Event sought (Regular Exp)<ms>10<ms><special> <B><Shape>9<B>175<B>354<B>275,421,175,421,181,363,228,354<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>12<B>123<B>122<B> extra <special>Tool Tip<ms>Timer<ms><special>Timer period (seconds)<ms>1<ms><special>Timer label<ms>timer1<ms><special> <B><Shape>9<B>150<B>272<B>151,272,150,344,232,354<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>1<B>123<B>26<B> extra <special>Tool Tip<ms>Start Processing<ms><special> <B><Shape>