sofaswitch-svn
Threads by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
September 2006
- 2 participants
- 78 discussions
11 Sep '06
Author: derek
Date: Mon Sep 11 00:20:15 2006
New Revision: 85
Removed:
sofaswitch/trunk/callflow/example_correct.py
Modified:
sofaswitch/trunk/callflow/src/canvas.cpp
sofaswitch/trunk/callflow/src/dnd.cpp
sofaswitch/trunk/callflow/src/eventer.cpp
sofaswitch/trunk/callflow/src/shapelist.cpp
sofaswitch/trunk/callflow/src/timer.cpp
Log:
Fixes, updates, correctly processes Eventer node.
Modified: sofaswitch/trunk/callflow/src/canvas.cpp
==============================================================================
--- sofaswitch/trunk/callflow/src/canvas.cpp (original)
+++ sofaswitch/trunk/callflow/src/canvas.cpp Mon Sep 11 00:20:15 2006
@@ -63,50 +63,49 @@
// Called when window needs to be repainted.
void MyCanvas::OnPaint(wxPaintEvent& event)
{
- activeShapes.ClearConnectionPoints();
- activeShapes.MarkConnectionPoints();
-
- wxPaintDC dc(this);
- PrepareDC(dc);
-
- // Find Out where the window is scrolled to
- int vbX,vbY; // Top left corner of client
- GetViewStart(&vbX,&vbY);
- wxRegionIterator upd(GetUpdateRegion()); // get the update rect list
-
- wxRect nrect;
- while (upd)
- {
- wxRect rect(upd.GetRect());
- wxPoint tl(rect.x, rect.y);
- wxPoint ntl;
- CalcUnscrolledPosition(tl.x, tl.y, &ntl.x, &ntl.y);
- wxSize updateSize(upd.GetWidth(), upd.GetHeight());
- nrect= wxRect(ntl, updateSize);
-
- MyListShapes::iterator it = activeShapes.begin();
- while (it != activeShapes.end()) {
- DndShape *oneShape = it->second;
- if (oneShape != NULL) {
- if (oneShape->Intersects(nrect))
- oneShape->Draw(dc);
+ activeShapes.ClearConnectionPoints();
+ activeShapes.MarkConnectionPoints();
+
+ wxPaintDC dc(this);
+ PrepareDC(dc);
+
+ // Find Out where the window is scrolled to
+ int vbX,vbY; // Top left corner of client
+ GetViewStart(&vbX,&vbY);
+ wxRegionIterator upd(GetUpdateRegion()); // get the update rect list
+
+ wxRect nrect;
+ while (upd) {
+ wxRect rect(upd.GetRect());
+ wxPoint tl(rect.x, rect.y);
+ wxPoint ntl;
+ CalcUnscrolledPosition(tl.x, tl.y, &ntl.x, &ntl.y);
+ wxSize updateSize(upd.GetWidth(), upd.GetHeight());
+ nrect= wxRect(ntl, updateSize);
+
+ MyListShapes::iterator it = activeShapes.begin();
+ while (it != activeShapes.end()) {
+ DndShape *oneShape = it->second;
+ if (oneShape != NULL) {
+ if (oneShape->Intersects(nrect))
+ oneShape->Draw(dc);
+ }
+ it++;
+ }
+ upd ++ ;
+ }
+
+ if (selectingRegion.IsSelected()) {
+ selectingRegion.Draw(dc);
+ }
+
+ if (GetEditingMode() == PlaceJoinBlocks) {
+ wxPoint last;
+ if (joinBlocks.GetLastPoint(last)) {
+ dc.DrawLine(last, lastMousePoint);
+ joinBlocks.Draw(dc);
}
- it++;
- }
- upd ++ ;
- }
-
- if (selectingRegion.IsSelected()) {
- selectingRegion.Draw(dc);
- }
-
- if (GetEditingMode() == PlaceJoinBlocks) {
- wxPoint last;
- if (joinBlocks.GetLastPoint(last)) {
- dc.DrawLine(last, lastMousePoint);
- joinBlocks.Draw(dc);
}
- }
}
wxPoint MyCanvas::GetUnscrolledPosition(wxMouseEvent & event)
@@ -157,10 +156,12 @@
MyListShapes::iterator it = activeShapes.begin();
while (it != activeShapes.end()) {
DndShape *oneShape = it->second;
- if (oneShape->Intersects(pt)) {
- oneShape->SetSelected();
- Refresh();
- return;
+ if (oneShape != NULL) {
+ if (oneShape->Intersects(pt)) {
+ oneShape->SetSelected();
+ Refresh();
+ return;
+ }
}
it++;
}
@@ -242,9 +243,11 @@
MyListShapes::iterator it = activeShapes.begin();
while (it != activeShapes.end()) {
DndShape *oneShape = it->second;
- if (oneShape->IsSelected()) {
- oneShape->AdjustPosition(delta);
- }
+ if (oneShape != NULL) {
+ if (oneShape->IsSelected()) {
+ oneShape->AdjustPosition(delta);
+ }
+ }
it++;
}
@@ -264,14 +267,16 @@
MyListShapes::iterator it = activeShapes.begin();
while (it != activeShapes.end()) {
DndShape *oneShape = it->second;
- bool isSelected = oneShape->Intersects(selectingRegion.GetRect());
- oneShape->SetSelected(isSelected);
+ if (oneShape != NULL) {
+ bool isSelected = oneShape->Intersects(selectingRegion.GetRect());
+ oneShape->SetSelected(isSelected);
+ }
it++;
- }
- Refresh();
- return;
+ }
+ Refresh();
+ return;
}
-
+
// printf("On mouse move at %d, %d %s\n",
// event.GetX(), event.GetY(),
// (event.LeftIsDown() ? "is down" : "is up"));
@@ -325,8 +330,10 @@
MyListShapes::iterator it = activeShapes.begin();
while (it != activeShapes.end()) {
DndShape *oneShape = it->second;
- if (oneShape->Intersects(pt))
- oneShape->ProcessRightMouseButton(pFrame);
+ if (oneShape != NULL) {
+ if (oneShape->Intersects(pt))
+ oneShape->ProcessRightMouseButton(pFrame);
+ }
it++;
}
}
@@ -338,8 +345,10 @@
MyListShapes::iterator it = activeShapes.begin();
while (it != activeShapes.end()) {
DndShape *oneShape = it->second;
- if (oneShape->IsSelected())
- toCopy += oneShape->GetShapeInfo();
+ if (oneShape != NULL) {
+ if (oneShape->IsSelected())
+ toCopy += oneShape->GetShapeInfo();
+ }
it++;
}
@@ -406,12 +415,15 @@
MyListShapes::iterator it = activeShapes.begin();
while (it != activeShapes.end()) {
- data += it->second->GetShapeInfo();
- it++;
+ DndShape *oneShape = it->second;
+ if (oneShape != NULL) {
+ data += oneShape->GetShapeInfo();
+ }
+ it++;
}
-
+
wxTextFile file(fileName);
-
+
if (!file.Exists())
file.Create();
file.Open();
Modified: sofaswitch/trunk/callflow/src/dnd.cpp
==============================================================================
--- sofaswitch/trunk/callflow/src/dnd.cpp (original)
+++ sofaswitch/trunk/callflow/src/dnd.cpp Mon Sep 11 00:20:15 2006
@@ -218,6 +218,8 @@
while (node != NULL) {
LabelledPoint *thisLabel = (LabelledPoint *)node->GetData();
+ if (!thisLabel->LinksToShape())
+ return false;
if (!thisLabel->SetKindValue(activeShapes))
return false;
node = node->GetNext();
@@ -465,7 +467,9 @@
{
switch (shapeRequired)
{
- case None: return NULL;
+ case None:
+ printf("Construct a shape of null\n");
+ return NULL;
case StartHere: return new DndShapeStartHere();
case EndHere: return new DndShapeEndHere();
case StartFor: return new DndShapeStartFor();
Modified: sofaswitch/trunk/callflow/src/eventer.cpp
==============================================================================
--- sofaswitch/trunk/callflow/src/eventer.cpp (original)
+++ sofaswitch/trunk/callflow/src/eventer.cpp Mon Sep 11 00:20:15 2006
@@ -29,7 +29,7 @@
AdjustIoPoints();
displayData[displayData.size()] =
- InformationSection(wxT("Event"), wxT("timer1"));
+ InformationSection(wxT("Event sought"), wxT("incoming"));
}
void DndShapeEventer::Draw(wxDC& dc)
@@ -39,15 +39,26 @@
wxPoint p1(m_rect.GetPosition());
wxPoint pA(p1.x + 13, p1.y + 0);
- wxPoint pB(p1.x + 13, p1.y + 15);
+ wxPoint pB(p1.x + 13, p1.y + 10);
wxPoint pC(p1.x + 13, p1.y + 35);
wxPoint pD(p1.x + 13, p1.y + 50);
dc.DrawLine(pA, pB);
dc.DrawLine(pC, pD);
- DrawBox(dc, 0, 15, 30, 15);
+ DrawBox(dc, 0, 10, 30, 20);
+ wxPoint polygon[10];
+
+ for (int i = 0; i < 10; i++) {
+ int radius = (i % 2) == 0 ? 9 : 4;
+ double theta = (270 + (36 * i)) * M_PI * 2.0/360.0;
+ int xx = 3 + (int)(radius * cos(theta));
+ int yy = 39 + (int)(radius * sin(theta));
+ polygon[i] = wxPoint(xx, yy);
+ }
+ dc.DrawPolygon(10, polygon, m_rect.x, m_rect.y);
+
wxPoint pI(p1.x + 30, p1.y + 17);
wxPoint pJ(p1.x + 35, p1.y + 22);
wxPoint pK(p1.x + 30, p1.y + 27);
@@ -82,29 +93,29 @@
bool DndShapeEventer::WriteThisShapeInfo(wxTextFile & file)
{
- file.AddLine(wxString::Format("\"%s\" : { ", GetKey().c_str()));
+ file.AddLine(wxString::Format(" \"%s\" : { ", GetKey().c_str()));
wxNode *inputNode = (wxNode *)GetInputPoints().GetFirst();
const wxString & inputLabel = ((LabelledPoint *)inputNode->GetData())->GetFullLabel();
- file.AddLine(wxString::Format(" \"Input\" : "));
- file.AddLine(wxString::Format(" %s, ", inputLabel.c_str()));
+ file.AddLine(wxString::Format(" \"Input\" : "));
+ file.AddLine(wxString::Format(" %s, ", inputLabel.c_str()));
wxNode *outputNode = (wxNode *)GetOutputPoints().GetFirst();
const wxString & outputLabel = ((LabelledPoint *)outputNode->GetData())->GetFullLabel();
- file.AddLine(wxString::Format(" \"OutputFromEvent\" : "));
- file.AddLine(wxString::Format(" %s, ", outputLabel.c_str()));
+ file.AddLine(wxString::Format(" \"OutputFromEvent\" : "));
+ file.AddLine(wxString::Format(" %s, ", outputLabel.c_str()));
outputNode = outputNode->GetNext();
const wxString & outputLabel2 = ((LabelledPoint *)outputNode->GetData())->GetFullLabel();
- file.AddLine(wxString::Format(" \"OutputKeepGoing\" : "));
- file.AddLine(wxString::Format(" %s, ", outputLabel2.c_str()));
+ file.AddLine(wxString::Format(" \"OutputKeepGoing\" : "));
+ file.AddLine(wxString::Format(" %s, ", outputLabel2.c_str()));
- file.AddLine(wxString::Format(" \"Event\" : "));
- file.AddLine(wxString::Format(" \"%s\", ", displayData[1].data.c_str()));
+ file.AddLine(wxString::Format(" \"Event\" : "));
+ file.AddLine(wxString::Format(" \"%s\", ", displayData[1].data.c_str()));
- file.AddLine(wxString::Format(" },"));
+ file.AddLine(wxString::Format(" },"));
return true;
}
Modified: sofaswitch/trunk/callflow/src/shapelist.cpp
==============================================================================
--- sofaswitch/trunk/callflow/src/shapelist.cpp (original)
+++ sofaswitch/trunk/callflow/src/shapelist.cpp Mon Sep 11 00:20:15 2006
@@ -34,16 +34,17 @@
}
}
-
void MyListShapesExtended::RemoveSelectedShapes()
{
MyListShapes::iterator it = begin();
while (it != end()) {
MyListShapes::iterator it_del = it;
it++;
-
- if (it_del->second->IsSelected()) {
- delete it_del->second;
+
+ if (it_del->second != NULL) {
+ if (it_del->second->IsSelected()) {
+ delete it_del->second;
+ }
erase (it_del);
}
}
@@ -65,7 +66,8 @@
{
MyListShapes::iterator it = begin();
while (it != end()) {
- it->second->SetSelected(false);
+ if (it->second != NULL)
+ it->second->SetSelected(false);
it++;
}
}
@@ -197,9 +199,11 @@
MyListShapes::iterator it = begin();
while (it != end()) {
DndShape *thisShape = it->second;
- bool writeOk = thisShape->WriteThisShapeInfo(graphFile);
- if (!writeOk)
- return false;
+ if (thisShape != NULL) {
+ bool writeOk = thisShape->WriteThisShapeInfo(graphFile);
+ if (!writeOk)
+ return false;
+ }
it++;
}
graphFile.AddLine("}");
@@ -234,6 +238,7 @@
pointsLinked = pointsLinked && thisLinked;
it++;
}
+
if (!pointsLinked)
return false;
@@ -249,31 +254,17 @@
it++;
}
-
/**third, go through and set the kind variable on all input&output points */
it = begin();
- pointsLinked = true;
while (it != end()) {
DndShape *thisShape = it->second;
if (thisShape != NULL) {
-
- bool linksOk =
- thisShape->GetOutputPoints().SetKindValue(*this) &&
- thisShape->GetInputPoints().SetKindValue(*this);
- if (linksOk) {
- it ++;
- } else{
- printf("Failed in links on %s\n", thisShape->GetName().c_str());
- thisShape->SetCompileError("Not all output points are linked");
- it = end();
- pointsLinked = false;
- }
- }
- }
- if (!pointsLinked)
- return false;
+ thisShape->GetOutputPoints().SetKindValue(*this);
+ thisShape->GetInputPoints().SetKindValue(*this);
+ }
+ it++;
+ }
-
/***
Completed all initialisation tasks. Now, we have enough information to write to disk
@@ -283,95 +274,103 @@
file.Clear();
- file.AddLine("#!/usr/bin/python");
- file.AddLine(" ");
- file.AddLine("import sys");
- file.AddLine("import os");
- file.AddLine("import time");
- file.AddLine("import socket");
- file.AddLine("import Queue");
- file.AddLine("import distutils");
- file.AddLine("import thread");
- file.AddLine("from twisted.internet import reactor, protocol");
- file.AddLine(" ");
+ file.AddLine("#!/usr/bin/python ");
+ file.AddLine(" ");
+ file.AddLine("import sys ");
+ file.AddLine("import os ");
+ file.AddLine("import time ");
+ file.AddLine("import socket ");
+ file.AddLine("import Queue ");
+ file.AddLine("import distutils ");
+ file.AddLine("import thread ");
+ file.AddLine("from twisted.internet import reactor, protocol ");
+ file.AddLine(" ");
- file.AddLine("class Controller(protocol.Protocol): ");
- file.AddLine(" def __init__(self): ");
- file.AddLine(" self.graphSet = False ");
- file.AddLine(" self.connectionIsMade = False ");
- file.AddLine(" self.endProgramNow = False ");
+ file.AddLine("class Controller(protocol.Protocol): ");
+ file.AddLine(" def __init__(self): ");
+ file.AddLine(" self.graphSet = False ");
+ file.AddLine(" self.connectionIsMade = False ");
+ file.AddLine(" self.endProgramNow = False ");
char c= 34;
wxString tString = wxString::Format(" self.quote = \"\\%c\"", c);
file.AddLine(tString.c_str());
- file.AddLine(" ");
- file.AddLine(" def setGraphData(self, graphFile): ");
- file.AddLine(" self.gd=open(graphFile, \"r\"); ");
- file.AddLine(" self.gdc=self.gd.read() ");
- file.AddLine(" self.data = eval(self.gdc) ");
- file.AddLine(" self.gd.close() ");
- file.AddLine(" ");
- file.AddLine(" self.firstNode = None ");
- file.AddLine(" for k,v in self.data.iteritems(): ");
- file.AddLine(" if k[:16] == \"Start_Processing\": ");
- file.AddLine(" self.firstNode = k ");
- file.AddLine(" print \"first node is \", k ");
- file.AddLine(" break ");
+ file.AddLine(" ");
+ file.AddLine(" def setGraphData(self, graphFile): ");
+ file.AddLine(" self.gd=open(graphFile, \"r\"); ");
+ file.AddLine(" self.gdc=self.gd.read() ");
+ file.AddLine(" self.data = eval(self.gdc) ");
+ file.AddLine(" self.gd.close() ");
+ file.AddLine(" ");
+ file.AddLine(" self.firstNode = None ");
+ file.AddLine(" for k,v in self.data.iteritems(): ");
+ file.AddLine(" if k[:16] == \"Start_Processing\": ");
+ file.AddLine(" self.firstNode = k ");
+ file.AddLine(" print \"first node is \", k ");
+ file.AddLine(" break ");
file.AddLine(" self.timeout = reactor.callLater(0, self.startTimerExpired, \"graph\")");
file.AddLine(" ");
file.AddLine(" def startTimerExpired(self, data): ");
file.AddLine(" if data == \"graph\": ");
- file.AddLine(" self.connectionIsMade = True ");
- file.AddLine(" if data == \"connected\": ");
file.AddLine(" self.graphSet = True ");
+ file.AddLine(" if data == \"connected\": ");
+ file.AddLine(" self.connectionIsMade = True ");
file.AddLine(" if self.graphSet and self.connectionIsMade:");
file.AddLine(" print \"start processing now \" ");
file.AddLine(" ");
file.AddLine(" def startWorkNow(): ");
file.AddLine(" sTuple = \"(\" + self.quote + self.firstNode + self.quote + \", 0, \" +self.quote + \"Start_Processing\" + self.quote + \")\"");
- file.AddLine(" self.DoWork(eval(sTuple))");
- file.AddLine(" ");
- file.AddLine(" def DoWork(self, sTuple): ");
- file.AddLine(" a,b,c = sTuple");
- file.AddLine(" ");
- file.AddLine(" self.keepGoing = True ");
- file.AddLine(" ");
- file.AddLine(" while self.keepGoing:");
+ file.AddLine(" self.DoWork(eval(sTuple)) ");
+ file.AddLine(" ");
+ file.AddLine(" def DoWork(self, sTuple): ");
+ file.AddLine(" a,b,c = sTuple ");
+ file.AddLine(" ");
+ file.AddLine(" self.keepGoing = True ");
+ file.AddLine(" ");
+ file.AddLine(" while self.keepGoing: ");
file.AddLine(" command = \"self.\" + str(c) + \"(\" + str(sTuple) + \")\"");
- file.AddLine(" a,b,c = sTuple = eval(command)");
- file.AddLine(" ");
- file.AddLine(" def makeConnection(self, transport): ");
- file.AddLine(" self.connected = 1 ");
- file.AddLine(" self.transport = transport ");
- file.AddLine(" self.connectionMade() ");
- file.AddLine(" ");
- file.AddLine(" def connectionMade(self): ");
- file.AddLine(" self.myId = \"\" ");
- file.AddLine(" self.countReceived = 0 ");
- file.AddLine(" self.transport.write(\"?\\0\") ");
- file.AddLine(" self.transport.write(\"whoami\\0\");");
- file.AddLine(" self.colonChar = \':\' ");
- file.AddLine(" ");
- file.AddLine(" def connectionLost(self, reason): ");
- file.AddLine(" print \"connection lost\" ");
- file.AddLine(" ");
- file.AddLine(" def dataReceived(self, data): ");
- file.AddLine(" ssdata = str(data).split(\'\\0\') ");
- file.AddLine(" for oneMessage in ssdata: ");
- file.AddLine(" self.countReceived = self.countReceived + 1");
- file.AddLine(" if self.countReceived == 1: ");
- file.AddLine(" self.myId = oneMessage; ");
+ file.AddLine(" a,b,c = sTuple = eval(command) ");
+ file.AddLine(" ");
+ file.AddLine(" def makeConnection(self, transport): ");
+ file.AddLine(" self.connected = 1 ");
+ file.AddLine(" self.transport = transport ");
+ file.AddLine(" self.connectionMade() ");
+ file.AddLine(" ");
+ file.AddLine(" def connectionMade(self): ");
+ file.AddLine(" self.myId = \"\" ");
+ file.AddLine(" self.countReceived = 0 ");
+ file.AddLine(" self.transport.write(\"?\\0\") ");
+ file.AddLine(" self.transport.write(\"whoami\\0\"); ");
+ file.AddLine(" self.colonChar = \':\' ");
+ file.AddLine(" ");
+ file.AddLine(" def connectionLost(self, reason): ");
+ file.AddLine(" print \"connection lost\" ");
+ file.AddLine(" ");
+ file.AddLine(" def dataReceived(self, data): ");
+ file.AddLine(" ssdata = str(data).split(\'\\0\') ");
+ file.AddLine(" for oneMessage in ssdata: ");
+ file.AddLine(" self.countReceived += 1 ");
+ file.AddLine(" if self.countReceived == 1: ");
+ file.AddLine(" self.myId = oneMessage; ");
file.AddLine(" self.timeout2 = reactor.callLater(0, self.startTimerExpired, \"connected\")");
- file.AddLine(" else: ");
+ file.AddLine(" else: ");
file.AddLine(" self.processReceivedMessage(oneMessage)");
- file.AddLine(" ");
+ file.AddLine(" ");
file.AddLine(" def replyNow(self, data):");
- file.AddLine(" self.transport.write(self.tstring) ");
- file.AddLine(" ");
- file.AddLine(" ");
+ file.AddLine(" self.transport.write(self.tstring) ");
+ file.AddLine(" ");
+ file.AddLine(" def processReceivedMessage(self, thisMessage): ");
+ file.AddLine(" print \"Received \", thisMessage ");
+ file.AddLine(" ");
+ file.AddLine(" ");
- for (int i = 0; i < DndShape::KnownShapes; i++) {
- DndShape *thisShape = DndShape::Construct((DndShape::Kind)i);
+ for (int i = 0; i < DndShape::KnownShapes; i++) {
+ DndShape *thisShape;
+ if (i == DndShape::None)
+ thisShape = NULL;
+ else
+ thisShape = DndShape::Construct((DndShape::Kind)i);
+
if (thisShape == NULL)
continue;
bool writeOk = thisShape->WriteSystemCode(file);
@@ -381,9 +380,6 @@
}
file.AddLine(" ");
- file.AddLine(" def processReceivedMessage(self, thisMessage): ");
- file.AddLine(" print \"Received \", thisMessage ");
- file.AddLine(" ");
file.AddLine("class MyFactory(protocol.ClientFactory): ");
file.AddLine(" protocol = Controller ");
file.AddLine(" ");
Modified: sofaswitch/trunk/callflow/src/timer.cpp
==============================================================================
--- sofaswitch/trunk/callflow/src/timer.cpp (original)
+++ sofaswitch/trunk/callflow/src/timer.cpp Mon Sep 11 00:20:15 2006
@@ -47,7 +47,6 @@
{
DrawCompileError(dc);
-
wxPoint p1(m_rect.GetPosition());
wxPoint pA(p1.x + 25, p1.y + 0);
wxPoint pE(p1.x + 25, p1.y + 10);
1
0
Author: derek
Date: Sun Sep 10 18:55:20 2006
New Revision: 84
Removed:
sofaswitch/trunk/voip/myudpep.cxx
sofaswitch/trunk/voip/myudpep.h
Log:
Remove these files, as this class is not used any more.
1
0
08 Sep '06
Author: derek
Date: Fri Sep 8 00:06:25 2006
New Revision: 83
Modified:
sofaswitch/trunk/callflow/src/shapelist.cpp
Log:
Fix file so it correctly connects with twisted, and has read in the
graph file.
Modified: sofaswitch/trunk/callflow/src/shapelist.cpp
==============================================================================
--- sofaswitch/trunk/callflow/src/shapelist.cpp (original)
+++ sofaswitch/trunk/callflow/src/shapelist.cpp Fri Sep 8 00:06:25 2006
@@ -298,7 +298,7 @@
file.AddLine("class Controller(protocol.Protocol): ");
file.AddLine(" def __init__(self): ");
file.AddLine(" self.graphSet = False ");
- file.AddLine(" self.connectionMade = False ");
+ file.AddLine(" self.connectionIsMade = False ");
file.AddLine(" self.endProgramNow = False ");
char c= 34;
wxString tString = wxString::Format(" self.quote = \"\\%c\"", c);
@@ -308,25 +308,25 @@
file.AddLine(" def setGraphData(self, graphFile): ");
file.AddLine(" self.gd=open(graphFile, \"r\"); ");
file.AddLine(" self.gdc=self.gd.read() ");
- file.AddLine(" self.data = evel(self.gdc) ");
+ file.AddLine(" self.data = eval(self.gdc) ");
file.AddLine(" self.gd.close() ");
file.AddLine(" ");
file.AddLine(" self.firstNode = None ");
- file.AddLine(" for k,v in aa.data.iteritems(): ");
+ file.AddLine(" for k,v in self.data.iteritems(): ");
file.AddLine(" if k[:16] == \"Start_Processing\": ");
file.AddLine(" self.firstNode = k ");
file.AddLine(" print \"first node is \", k ");
file.AddLine(" break ");
file.AddLine(" self.timeout = reactor.callLater(0, self.startTimerExpired, \"graph\")");
- file.AddLine(" ");
- file.AddLine(" def startTimerExpired(self, data):");
- file.AddLine(" if data == \"graph\": ");
- file.AddLine(" self.connectionMade = True ");
- file.AddLine(" if data == \"connected\": ");
- file.AddLine(" self.graphSet = True; ");
- file.AddLine(" if self.graphSet and self.connectionMade:");
- file.AddLine(" print \"start processing now \" ");
- file.AddLine(" ");
+ file.AddLine(" ");
+ file.AddLine(" def startTimerExpired(self, data): ");
+ file.AddLine(" if data == \"graph\": ");
+ file.AddLine(" self.connectionIsMade = True ");
+ file.AddLine(" if data == \"connected\": ");
+ file.AddLine(" self.graphSet = True ");
+ file.AddLine(" if self.graphSet and self.connectionIsMade:");
+ file.AddLine(" print \"start processing now \" ");
+ file.AddLine(" ");
file.AddLine(" def startWorkNow(): ");
file.AddLine(" sTuple = \"(\" + self.quote + self.firstNode + self.quote + \", 0, \" +self.quote + \"Start_Processing\" + self.quote + \")\"");
file.AddLine(" self.DoWork(eval(sTuple))");
@@ -340,7 +340,12 @@
file.AddLine(" command = \"self.\" + str(c) + \"(\" + str(sTuple) + \")\"");
file.AddLine(" a,b,c = sTuple = eval(command)");
file.AddLine(" ");
- file.AddLine(" def connectionMade(self): ");
+ file.AddLine(" def makeConnection(self, transport): ");
+ file.AddLine(" self.connected = 1 ");
+ file.AddLine(" self.transport = transport ");
+ file.AddLine(" self.connectionMade() ");
+ file.AddLine(" ");
+ file.AddLine(" def connectionMade(self): ");
file.AddLine(" self.myId = \"\" ");
file.AddLine(" self.countReceived = 0 ");
file.AddLine(" self.transport.write(\"?\\0\") ");
@@ -375,30 +380,43 @@
return false;
}
- file.AddLine(" ");
- file.AddLine(" def processReceivedMessage(self, thisMessage): ");
- file.AddLine(" print \"Received \", thisMessage ");
- file.AddLine(" ");
-
- file.AddLine("class MyFactory(protocol.ClientFactory): ");
- file.AddLine(" protocol = Controller ");
- file.AddLine(" ");
+ file.AddLine(" ");
+ file.AddLine(" def processReceivedMessage(self, thisMessage): ");
+ file.AddLine(" print \"Received \", thisMessage ");
+ file.AddLine(" ");
+ file.AddLine("class MyFactory(protocol.ClientFactory): ");
+ file.AddLine(" protocol = Controller ");
+ file.AddLine(" ");
file.AddLine(" def clientConnectionFailed(self, connector, reason): ");
- file.AddLine(" print \"Connection failed - goodbye!\" ");
- file.AddLine(" reactor.stop() ");
- file.AddLine(" ");
- file.AddLine(" def clientConnectionLost(self, connector, reason): ");
- file.AddLine(" print \"Connection lost - goodbye!\" ");
- file.AddLine(" reactor.stop() ");
- file.AddLine(" ");
- file.AddLine(" def setGraphData(self, graphFile): ");
- file.AddLine(" protocol.setGraphData(graphFile) ");
- file.AddLine(" ");
- file.AddLine("f = MyFactory() ");
- file.AddLine("f.setGraphData(\"a_graph\") ");
- file.AddLine("reactor.connectTCP(\"localhost\", 5000, f) ");
- file.AddLine("reactor.run() ");
- file.AddLine(" ");
+ file.AddLine(" print \"Connection failed - goodbye!\" ");
+ file.AddLine(" reactor.stop() ");
+ file.AddLine(" ");
+ file.AddLine(" def clientConnectionLost(self, connector, reason): ");
+ file.AddLine(" print \"Connection lost - goodbye!\" ");
+ file.AddLine(" reactor.stop() ");
+ file.AddLine(" ");
+ file.AddLine(" def buildProtocol(self, addr): ");
+ file.AddLine(" p = self.protocol() ");
+ file.AddLine(" p.factory = self ");
+ file.AddLine(" self.myController = p ");
+ file.AddLine(" self.myController.setGraphData(self.myGraphName) ");
+ file.AddLine(" print 'finished building Protocol' ");
+ file.AddLine(" return p ");
+ file.AddLine(" for key in dir(p): ");
+ file.AddLine(" if '__' not in key: ");
+ file.AddLine(" value = getattr(p,key) ");
+ file.AddLine(" print key ");
+ file.AddLine(" print key, \" \", value ");
+ file.AddLine(" return p ");
+ file.AddLine(" ");
+ file.AddLine(" def setGraph(self, newName): ");
+ file.AddLine(" self.myGraphName = newName ");
+ file.AddLine(" ");
+ file.AddLine("f = MyFactory() ");
+ file.AddLine("f.setGraph(\"a_graph\") ");
+ file.AddLine("reactor.connectTCP(\"localhost\", 5000, f) ");
+ file.AddLine("reactor.run() ");
+ file.AddLine(" ");
file.Write();
return true;
}
1
0
08 Sep '06
Author: derek
Date: Thu Sep 7 23:30:40 2006
New Revision: 82
Added:
sofaswitch/trunk/callflow/bitmaps/eventer.xpm
Log:
Add this file, so all the source is there..
Added: sofaswitch/trunk/callflow/bitmaps/eventer.xpm
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/bitmaps/eventer.xpm Thu Sep 7 23:30:40 2006
@@ -0,0 +1,162 @@
+/* XPM */
+static char * eventer_xpm[] = {
+"32 32 127 2",
+" c None",
+". c #FFE81F",
+"+ c #FFEC19",
+"@ c #FFE316",
+"# c #B6920E",
+"$ c #FFD515",
+"% c #CD9B0F",
+"& c #FFED18",
+"* c #FED712",
+"= c #F0BA10",
+"- c #A8800D",
+"; c #FFDE16",
+"> c #FDCC0F",
+", c #F9C30F",
+"' c #AC820D",
+") c #FFDC16",
+"! c #FDC70E",
+"~ c #FAC30F",
+"{ c #DBA511",
+"] c #FCE91F",
+"^ c #F6ED1A",
+"/ c #FBEA1A",
+"( c #FEEC19",
+"_ c #FFED19",
+": c #FFF21A",
+"< c #FED810",
+"[ c #FDCB0B",
+"} c #FCCA0B",
+"| c #FCC410",
+"1 c #FFC915",
+"2 c #FFE518",
+"3 c #FBE819",
+"4 c #F1CC16",
+"5 c #A07A0D",
+"6 c #916C0C",
+"7 c #CD9C0F",
+"8 c #EFB810",
+"9 c #FDC410",
+"0 c #FEC610",
+"a c #FEC510",
+"b c #FDC60F",
+"c c #FDCC0B",
+"d c #FDD007",
+"e c #FDCF08",
+"f c #F8C010",
+"g c #E5B10F",
+"h c #B1880C",
+"i c #4F3C06",
+"j c #C4960E",
+"k c #EBB70D",
+"l c #FAC50D",
+"m c #FCC80C",
+"n c #FDCB0A",
+"o c #FDD306",
+"p c #FDD206",
+"q c #FCC90B",
+"r c #F3C10C",
+"s c #C0960B",
+"t c #826309",
+"u c #392A05",
+"v c #AF860C",
+"w c #D3A10F",
+"x c #F2BE0D",
+"y c #FCCB0A",
+"z c #FDCE08",
+"A c #FDD305",
+"B c #FDCD09",
+"C c #F5C40B",
+"D c #BE950B",
+"E c #644C07",
+"F c #F8C30E",
+"G c #FBC90B",
+"H c #D0A30C",
+"I c #6C5308",
+"J c #FBC413",
+"K c #FBC60E",
+"L c #FDCC0A",
+"M c #FCCB0B",
+"N c #F9C20F",
+"O c #D4A010",
+"P c #FFE919",
+"Q c #FED512",
+"R c #FDCC09",
+"S c #FBC70D",
+"T c #E5B010",
+"U c #88660B",
+"V c #FFE318",
+"W c #FEC910",
+"X c #FAC70C",
+"Y c #F5C10D",
+"Z c #F5BE10",
+"` c #F9C40D",
+" . c #E9B40F",
+".. c #98720C",
+"+. c #FFEA18",
+"@. c #FAC20F",
+"#. c #D5A80C",
+"$. c #9F790B",
+"%. c #AD810E",
+"&. c #CC9C0E",
+"*. c #E7B20F",
+"=. c #F7C30D",
+"-. c #F5BD10",
+";. c #D7A210",
+">. c #FFED1A",
+",. c #FCDA13",
+"'. c #D3A60B",
+"). c #755A08",
+"!. c #A47A0D",
+"~. c #D4A30E",
+"{. c #F6C10D",
+"]. c #DBA80F",
+"^. c #906C0B",
+"/. c #FFDD18",
+"(. c #C1950D",
+"_. c #6B5307",
+":. c #A87E0D",
+"<. c #D3A20E",
+"[. c #DDAA0F",
+"}. c #AF830E",
+"|. c #B69510",
+"1. c #735709",
+"2. c #A77E0D",
+"3. c #B0860D",
+"4. c #B7890F",
+"5. c #A0840E",
+"6. c #6F5309",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" . ",
+" + ",
+" @ # ",
+" $ % ",
+" & * = - ",
+" ; > , ' ",
+" ) ! ~ { ",
+" ] ^ / ( + + _ : & < [ } | 1 2 + + + 3 4 5 ",
+" 6 7 8 9 0 0 a b c d e } | a a f g h i ",
+" j k l m } n d o p e } q r s t u ",
+" v w x y z p A A A B C D E ",
+" w F y d p p e G H I ",
+" J K L z z M N O ",
+" P Q m n q L R S T U ",
+" V W X Y Z ` m m ... ",
+" +.@.#.$.%.&.*.=.-.;. ",
+" >.,.'.). !.~.{.].^. ",
+" /.(._. :.<.[.}. ",
+" |.1. 2.3.4. ",
+" 5. 6. ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" "};
1
0
Author: derek
Date: Thu Sep 7 23:29:08 2006
New Revision: 81
Added:
sofaswitch/trunk/callflow/configure.in
Log:
Add this file, so autogen.sh works.
Added: sofaswitch/trunk/callflow/configure.in
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/configure.in Thu Sep 7 23:29:08 2006
@@ -0,0 +1,79 @@
+dnl Process this file with autoconf to produce a configure script.
+
+dnl ---------------------------------------------------------------------------
+dnl Name: configure.in
+dnl Purpose: Create configure for callflow sample project
+dnl Author: Linus McCabe
+dnl Created: 2004-09-17
+dnl RCS-ID: $Id$
+dnl Copyright: (c) 2004 Linus McCabe <linus(a)mccabe.nu>
+dnl Licence: The wxWidgets License
+dnl ---------------------------------------------------------------------------
+
+dnl generic init
+AC_INIT(src/callflow.cpp)
+dnl AM_CONFIG_HEADER(config.h:config.h.in)
+AM_INIT_AUTOMAKE(callflow, 0.0.1)
+dnl AC_PROG_MAKE_SET
+dnl AC_ARG_PROGRAM
+dnl AC_PROG_INSTALL
+AC_PROG_LIBTOOL
+
+dnl check for programs we use
+AC_PROG_CXX
+
+AC_PATH_PROG(WX_CONFIG, wx-config, no, $PATH:/usr/local/bin )
+if [[ "$WX_CONFIG" = "no" ]] ; then
+ AC_MSG_ERROR("Could not find wx-config: is wxWindows installed? is wx-config in your path?")
+fi
+
+WXCONFIG=wx-config
+AC_ARG_WITH(wx-config,
+[[ --with-wx-config=FILE Use the given path to wx-config when determining
+ wxWidgets configuration; defaults to "wx-config"]],
+[
+ if test "$withval" != "yes" -a "$withval" != ""; then
+ WXCONFIG=$withval
+ fi
+])
+AC_MSG_CHECKING([wxWidgets version])
+if wxversion=`$WXCONFIG --version`; then
+ AC_MSG_RESULT([$wxversion])
+else
+ AC_MSG_RESULT([not found])
+ AC_MSG_ERROR([wxWidgets is required. Try --with-wx-config.])
+fi
+
+WX_CPPFLAGS="`$WXCONFIG --cppflags`"
+WX_CXXFLAGS="`$WXCONFIG --cxxflags | sed -e 's/-fno-exceptions//'`"
+WX_LIBS="`$WXCONFIG --libs`"
+
+CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
+CXXFLAGS="$CXXFLAGS $WX_CPPFLAGS"
+
+AC_SUBST(WX_LIBS)
+
+AC_ARG_ENABLE(debug,
+[ --enable-debug, Enable debug build],
+[
+ debugbuild="y"
+ CXXFLAGS="${CXXFLAGS} -ggdb"
+])
+
+dnl that's all, folks
+AC_OUTPUT([
+ Makefile
+ src/Makefile
+ ])
+
+dnl Summarized output
+echo
+echo "***************************************"
+echo
+
+if [[ "$debugbuild" = "y" ]]; then
+echo "Debug Enabled"
+else
+echo "Debug Disabled"
+fi
+
1
0
Author: derek
Date: Thu Sep 7 22:47:31 2006
New Revision: 80
Added:
sofaswitch/trunk/callflow/example_correct.py
Log:
This works.
Added: sofaswitch/trunk/callflow/example_correct.py
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/example_correct.py Thu Sep 7 22:47:31 2006
@@ -0,0 +1,185 @@
+#!/usr/bin/python
+
+import sys
+import os
+import time
+import socket
+import Queue
+import distutils
+import thread
+from twisted.internet import reactor, protocol
+
+class Controller(protocol.Protocol):
+ def __init__(self):
+ self.graphSet = False
+ self.connectionIsMade = False
+ self.endProgramNow = False
+ self.quote = "\""
+
+ def setGraphData(self, graphFile):
+ self.gd=open(graphFile, "r");
+ self.gdc=self.gd.read()
+ self.data = eval(self.gdc)
+ self.gd.close()
+
+ self.firstNode = None
+ for k,v in self.data.iteritems():
+ if k[:16] == "Start_Processing":
+ self.firstNode = k
+ print "first node is ", k
+# break
+# self.timeout = reactor.callLater(0, self.startTimerExpired, "graph")
+
+ def startTimerExpired(self, data):
+ print 'start of start timer expired'
+ if data == "graph":
+ self.connectionIsMade = True
+ if data == "connected":
+ self.graphSet = True
+ if self.graphSet and self.connectionIsMade:
+ print "start processing now "
+
+ def startWorkNow():
+ sTuple = "(" + self.quote + self.firstNode + self.quote + ", 0, " +self.quote + "Start_Processing" + self.quote + ")"
+ self.DoWork(eval(sTuple))
+
+ def DoWork(self, sTuple):
+ a,b,c = sTuple
+
+ self.keepGoing = True
+
+ while self.keepGoing:
+ command = "self." + str(c) + "(" + str(sTuple) + ")"
+ a,b,c = sTuple = eval(command)
+
+ def makeConnection(self, transport):
+ print 'Make Connection here'
+ self.connected = 1
+ self.transport = transport
+ self.connectionMade()
+
+ def connectionMade(self):
+ print 'Start of connectionMade'
+ self.myId = ""
+ self.countReceived = 0
+ self.transport.write("?\0")
+ self.transport.write("whoami\0");
+ self.colonChar = ':'
+ print 'End of connection made'
+
+ def connectionLost(self, reason):
+ print "connection lost"
+
+ def dataReceived(self, data):
+ print "start of data received ", data
+ ssdata = str(data).split('\0')
+ for oneMessage in ssdata:
+ self.countReceived = self.countReceived + 1
+ if self.countReceived == 1:
+ self.myId = oneMessage;
+ self.timeout2 = reactor.callLater(0, self.startTimerExpired, "connected")
+ else:
+ self.processReceivedMessage(oneMessage)
+
+ def replyNow(self, data):
+ self.transport.write(self.tstring)
+
+
+ def Start_Processing(self, aTuple):
+ id,y,z = aTuple
+ return self.data[id]["Output"]
+
+ def End_Processing(self, sTuple):
+ self.keepGoing = False
+ a,b,c = sTuple
+ print "end of processing at ", a
+ return (1,2,3)
+
+ def Start_For(self, aTuple):
+ a,b,c = aTuple
+ if b==0:
+ exec(self.data[a]["Initialise"])
+ else:
+ exec(self.data[a]["Increment"])
+
+ if eval(self.data[a]["Test"]):
+ return self.data[a]["Output"]
+
+ next = self.data[a]["EndForLoop"]
+ return self.data[next]["AllDone"]
+
+ def End_For_Loop(self, aTuple):
+ a,b,c = aTuple
+ return self.data[a]["LoopAgain"]
+
+ def Conditional(self, aTuple):
+ a,b,c = aTuple
+ if variable == 0:
+ return self.data[a]["OutputTrue"]
+ return self.data[a]["OutputFalse"]
+
+ def Make_Call(self, sTuple):
+ a,b,c = sTuple
+ return self.data[a]["Output"]
+
+ def End_Call(self, sTuple):
+ a,b,c = sTuple
+ return self.data[a]["Output"]
+
+ def Python(self, sTuple):
+ a,b,c = sTuple
+ exec(self.data[a]["Python Code"])
+ return self.data[a]["Output"]
+
+ def Request_Node(self, aTuple):
+ id,y,z = aTuple
+ return data[id]["Output"]
+
+ def Timer(self, sTuple):
+ a,b,c = sTuple
+ return data[a]["Output"]
+
+ def Eventer(self, sTuple):
+ a,b,c = sTuple
+ print "Eventer ", a
+ return (1,2,3)
+
+
+ def processReceivedMessage(self, thisMessage):
+ print "Received ", thisMessage
+
+class MyFactory(protocol.ClientFactory):
+ protocol = Controller
+
+ def clientConnectionFailed(self, connector, reason):
+ print "Connection failed - goodbye!"
+ reactor.stop()
+
+ def clientConnectionLost(self, connector, reason):
+ print "Connection lost - goodbye!"
+ reactor.stop()
+
+ def buildProtocol(self, addr):
+ p = self.protocol()
+ p.factory = self
+ self.myController = p
+ self.myController.setGraphData(self.myGraphName)
+ print 'finished building Protocol'
+ return p
+ for key in dir(p):
+ if '__' not in key:
+ value = getattr(p,key)
+# print key
+# print key, " ",value
+ return p
+
+ def setGraph(self, newName):
+ self.myGraphName = newName
+
+f = MyFactory()
+f.setGraph("a_graph")
+print 'think about connect'
+reactor.connectTCP("localhost", 5000, f)
+print 'done the connect'
+reactor.run()
+
1
0
[Sofaswitch-svn] [commit] r79 - in sofaswitch/trunk/callflow: autom4te.cache src
by SofaSWITCH SVN 07 Sep '06
by SofaSWITCH SVN 07 Sep '06
07 Sep '06
Author: derek
Date: Thu Sep 7 17:56:10 2006
New Revision: 79
Removed:
sofaswitch/trunk/callflow/autom4te.cache/
Modified:
sofaswitch/trunk/callflow/src/shapelist.cpp
Log:
Update things.
Modified: sofaswitch/trunk/callflow/src/shapelist.cpp
==============================================================================
--- sofaswitch/trunk/callflow/src/shapelist.cpp (original)
+++ sofaswitch/trunk/callflow/src/shapelist.cpp Thu Sep 7 17:56:10 2006
@@ -193,11 +193,7 @@
graphFile.Clear();
- graphFile.AddLine("#!/usr/bin/python");
- graphFile.AddLine(" ");
- graphFile.AddLine("data = {");
-
-
+ graphFile.AddLine("{");
MyListShapes::iterator it = begin();
while (it != end()) {
DndShape *thisShape = it->second;
@@ -207,9 +203,6 @@
it++;
}
graphFile.AddLine("}");
-
- graphFile.AddLine(" ");
-
graphFile.Write();
graphFile.Close();
@@ -313,13 +306,16 @@
file.AddLine(" ");
file.AddLine(" def setGraphData(self, graphFile): ");
- file.AddLine(" import graphFile ");
- file.AddLine(" self.data = graphFile.data ");
+ file.AddLine(" self.gd=open(graphFile, \"r\"); ");
+ file.AddLine(" self.gdc=self.gd.read() ");
+ file.AddLine(" self.data = evel(self.gdc) ");
+ file.AddLine(" self.gd.close() ");
file.AddLine(" ");
file.AddLine(" self.firstNode = None ");
file.AddLine(" for k,v in aa.data.iteritems(): ");
file.AddLine(" if k[:16] == \"Start_Processing\": ");
file.AddLine(" self.firstNode = k ");
+ file.AddLine(" print \"first node is \", k ");
file.AddLine(" break ");
file.AddLine(" self.timeout = reactor.callLater(0, self.startTimerExpired, \"graph\")");
file.AddLine(" ");
1
0
07 Sep '06
Author: sphere
Date: Thu Sep 7 06:07:02 2006
New Revision: 78
Added:
sofaswitch/branches/tintrung/
Log:
Creating empty folder for tintrung
1
0
Author: derek
Date: Thu Sep 7 01:16:20 2006
New Revision: 77
Added:
sofaswitch/trunk/callflow/Makefile.am
Log:
Add this to svn.
Add ability to specify the number of compile jobs to run, based on it
counting the number of cpus on the system.
Added: sofaswitch/trunk/callflow/Makefile.am
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/Makefile.am Thu Sep 7 01:16:20 2006
@@ -0,0 +1,5 @@
+AUTOMAKE_OPTIONS = foreign
+EXTRA_DIST =
+MAKEFLAGS=-j$(shell cat /proc/cpuinfo | grep processor | wc -l)
+SUBDIRS = src
+
1
0
07 Sep '06
Author: derek
Date: Thu Sep 7 01:14:21 2006
New Revision: 76
Added:
sofaswitch/trunk/callflow/src/Makefile.in
sofaswitch/trunk/callflow/src/conditional.cpp
sofaswitch/trunk/callflow/src/conditional.h
sofaswitch/trunk/callflow/src/endcall.cpp
sofaswitch/trunk/callflow/src/endcall.h
sofaswitch/trunk/callflow/src/endfor.cpp
sofaswitch/trunk/callflow/src/endfor.h
sofaswitch/trunk/callflow/src/endhere.cpp
sofaswitch/trunk/callflow/src/endhere.h
sofaswitch/trunk/callflow/src/eventer.cpp
sofaswitch/trunk/callflow/src/eventer.h
sofaswitch/trunk/callflow/src/joinblocks.cpp
sofaswitch/trunk/callflow/src/joinblocks.h
sofaswitch/trunk/callflow/src/listpoints.cpp
sofaswitch/trunk/callflow/src/listpoints.h
sofaswitch/trunk/callflow/src/makecall.cpp
sofaswitch/trunk/callflow/src/makecall.h
sofaswitch/trunk/callflow/src/python.cpp
sofaswitch/trunk/callflow/src/python.h
sofaswitch/trunk/callflow/src/requestnode.cpp
sofaswitch/trunk/callflow/src/requestnode.h
sofaswitch/trunk/callflow/src/shapeselect.cpp
sofaswitch/trunk/callflow/src/shapeselect.h
sofaswitch/trunk/callflow/src/startfor.cpp
sofaswitch/trunk/callflow/src/startfor.h
sofaswitch/trunk/callflow/src/starthere.cpp
sofaswitch/trunk/callflow/src/starthere.h
sofaswitch/trunk/callflow/src/timer.cpp
sofaswitch/trunk/callflow/src/timer.h
Modified:
sofaswitch/trunk/callflow/src/Makefile.am
sofaswitch/trunk/callflow/src/callflow.cpp
sofaswitch/trunk/callflow/src/dnd.cpp
sofaswitch/trunk/callflow/src/dnd.h
sofaswitch/trunk/callflow/src/shapelist.cpp
Log:
Fixes. Move towards a saner compile process with a separate file for
call flow.
Modified: sofaswitch/trunk/callflow/src/Makefile.am
==============================================================================
--- sofaswitch/trunk/callflow/src/Makefile.am (original)
+++ sofaswitch/trunk/callflow/src/Makefile.am Thu Sep 7 01:14:21 2006
@@ -4,8 +4,7 @@
callflow_LDADD = $(WX_LIBS)
-override CXXFLAGS = @CXXFLAGS@ -I..
-
+override CXXFLAGS = @CXXFLAGS@ -I..
callflow_SOURCES = \
callflow.cpp \
Added: sofaswitch/trunk/callflow/src/Makefile.in
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/src/Makefile.in Thu Sep 7 01:14:21 2006
@@ -0,0 +1,494 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = callflow$(EXEEXT)
+subdir = src
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_callflow_OBJECTS = callflow.$(OBJEXT) canvas.$(OBJEXT) \
+ conditional.$(OBJEXT) dnd.$(OBJEXT) drawshape.$(OBJEXT) \
+ endcall.$(OBJEXT) endfor.$(OBJEXT) endhere.$(OBJEXT) \
+ eventer.$(OBJEXT) information.$(OBJEXT) joinblocks.$(OBJEXT) \
+ listpoints.$(OBJEXT) makecall.$(OBJEXT) python.$(OBJEXT) \
+ requestnode.$(OBJEXT) shapelist.$(OBJEXT) \
+ shapeselect.$(OBJEXT) startfor.$(OBJEXT) starthere.$(OBJEXT) \
+ timer.$(OBJEXT)
+callflow_OBJECTS = $(am_callflow_OBJECTS)
+am__DEPENDENCIES_1 =
+callflow_DEPENDENCIES = $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(callflow_SOURCES)
+DIST_SOURCES = $(callflow_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+WX_CONFIG = @WX_CONFIG@
+WX_LIBS = @WX_LIBS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+SUFFIXES = .cpp .rc
+callflow_LDADD = $(WX_LIBS)
+callflow_SOURCES = \
+ callflow.cpp \
+ canvas.cpp \
+ conditional.cpp \
+ dnd.cpp \
+ drawshape.cpp \
+ endcall.cpp \
+ endfor.cpp \
+ endhere.cpp \
+ eventer.cpp \
+ information.cpp \
+ joinblocks.cpp \
+ listpoints.cpp \
+ makecall.cpp \
+ python.cpp \
+ requestnode.cpp \
+ shapelist.cpp \
+ shapeselect.cpp \
+ startfor.cpp \
+ starthere.cpp \
+ timer.cpp
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .rc .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+callflow$(EXEEXT): $(callflow_OBJECTS) $(callflow_DEPENDENCIES)
+ @rm -f callflow$(EXEEXT)
+ $(CXXLINK) $(callflow_LDFLAGS) $(callflow_OBJECTS) $(callflow_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/callflow.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/canvas.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conditional.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dnd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drawshape.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/endcall.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/endfor.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/endhere.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eventer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/information.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/joinblocks.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/listpoints.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/makecall.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/python.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/requestnode.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shapelist.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shapeselect.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/startfor.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/starthere.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timer.Po@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-binPROGRAMS install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-binPROGRAMS uninstall-info-am
+
+override CXXFLAGS = @CXXFLAGS@ -I..
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
Modified: sofaswitch/trunk/callflow/src/callflow.cpp
==============================================================================
--- sofaswitch/trunk/callflow/src/callflow.cpp (original)
+++ sofaswitch/trunk/callflow/src/callflow.cpp Thu Sep 7 01:14:21 2006
@@ -474,7 +474,7 @@
}
if (canvas->Compile(file))
- wxMessageBox(wxString::Format("wrote compile code to %s", filedlg.GetFilename().c_str()));
+ SetStatusText(wxString::Format("wrote compiled code to %s", filedlg.GetFilename().c_str()));
else
wxMessageBox(wxString::Format("failed - could not compile code to %s", filedlg.GetFilename().c_str()));
Added: sofaswitch/trunk/callflow/src/conditional.cpp
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/src/conditional.cpp Thu Sep 7 01:14:21 2006
@@ -0,0 +1,119 @@
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+#include <wx/textfile.h>
+#include <wx/tokenzr.h>
+#include "shapelist.h"
+
+
+#include "conditional.h"
+
+/////////////////////////////////////////////////////////////////////////////
+DndShapeConditional::DndShapeConditional()
+ : DndShape(Conditional)
+{
+ wxSize newSize(50, 50);
+ SetSize(newSize);
+
+ relInputPoints.Add(25, 0);
+ relOutputPoints.Add(25, 50);
+ relOutputPoints.Add(50, 25);
+
+ AdjustIoPoints();
+
+ displayData[displayData.size()] =
+ InformationSection(wxT("Test"), wxT("variable == 0"));
+}
+
+void DndShapeConditional::Draw(wxDC& dc)
+{
+ DrawCompileError(dc);
+ dc.SetPen(*wxBLACK_PEN);
+
+ wxPoint p1(m_rect.GetPosition());
+ wxPoint pA(p1.x + 25, p1.y + 35);
+ wxPoint pB(p1.x + 25, p1.y + 50);
+
+ dc.DrawLine(pA, pB);
+
+ if (OutputPointConnected(0))
+ DrawArrow(dc, pB, ArrowDown, Connected);
+ else
+ DrawArrow(dc, pB, ArrowDown, Loose);
+
+ wxPoint pt(p1.x + 25, p1.y);
+ wxPoint pr(p1.x + 25, p1.y + 15);
+ dc.DrawLine(pt, pr);
+ if (InputPointConnected(0))
+ DrawArrow(dc, pr, ArrowDown, Connected);
+ else
+ DrawArrow(dc, pr, ArrowDown, Loose);
+
+ wxPoint pll(p1.x + 15, p1.y + 25);
+ wxPoint prr(p1.x + 35, p1.y + 25);
+
+ dc.DrawLine(pll, pr);
+ dc.DrawLine(pr, prr);
+ dc.DrawLine(prr, pA);
+ dc.DrawLine(pA, pll);
+
+ wxPoint pvr(p1.x + 50, p1.y + 25);
+ dc.DrawLine(pvr, prr);
+ DrawArrow(dc, pvr, ArrowRight, OutputPointConnected(1) ? Connected : Loose);
+
+ wxString text("T");
+ dc.SetFont(*wxITALIC_FONT);
+ dc.DrawText(text, m_rect.x + 10, m_rect.y + 35);
+
+ text = "F";
+ dc.DrawText(text, m_rect.x + 35, m_rect.y + 5);
+
+ DndShape::Draw(dc);
+}
+
+bool DndShapeConditional::WriteSystemCode(wxTextFile & file)
+{
+ file.AddLine(" def Conditional(self, aTuple): ");
+ file.AddLine(" a,b,c = aTuple");
+ wxString test = wxString::Format(" if %s:",
+ displayData[1].data.c_str());
+ file.AddLine(test);
+ file.AddLine(" return self.data[a][\"OutputTrue\"]");
+ file.AddLine(" return self.data[a][\"OutputFalse\"]");
+ file.AddLine("");
+
+ return true;
+}
+
+bool DndShapeConditional::WriteThisShapeInfo(wxTextFile & file)
+{
+ file.AddLine(wxString::Format(" \"%s\" : { ", GetKey().c_str()));
+
+ file.AddLine(wxString::Format(" \"Test\" : "));
+ file.AddLine(wxString::Format(" \"%s\", ", displayData[1].data.c_str()));
+
+ wxNode *outputNode = (wxNode *)GetOutputPoints().GetFirst();
+ const wxString & outputLabel = ((LabelledPoint *)outputNode->GetData())->GetFullLabel();
+
+ file.AddLine(wxString::Format(" \"OutputTrue\" : "));
+ file.AddLine(wxString::Format(" %s, ", outputLabel.c_str()));
+
+ outputNode = outputNode->GetNext();
+ const wxString & outputLabel2 = ((LabelledPoint *)outputNode->GetData())->GetFullLabel();
+ file.AddLine(wxString::Format(" \"OutputFalse\" : "));
+ file.AddLine(wxString::Format(" %s, ", outputLabel2.c_str()));
+
+ file.AddLine(wxString::Format(" },"));
+
+ return true;
+}
+
+
+
Added: sofaswitch/trunk/callflow/src/conditional.h
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/src/conditional.h Thu Sep 7 01:14:21 2006
@@ -0,0 +1,36 @@
+#ifndef SHAPE_CONDITIONAL_H
+#define SHAPE_CONDITIONAL_H
+
+#include "dnd.h"
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/**Define an if statement, or conditional shape. Store values for size, location, input & output points.
+ This instance has the ability to draw this shape to a specified location on the canvas */
+class DndShapeConditional : public DndShape
+{
+public:
+ /**Construtor, Define this shape in terms of size and points etc */
+ DndShapeConditional();
+
+ /**Destroy this shape, and log it */
+ virtual ~DndShapeConditional()
+ {
+ }
+
+ /**Draw this particular shape to the screen..*/
+ virtual void Draw(wxDC& dc);
+
+ /** Used to report the name of this particular class. */
+ static wxString GetKindName() { return wxString("Conditional"); }
+
+ /**Write the code generic to this Conditional shape */
+ virtual bool WriteSystemCode(wxTextFile & file);
+
+ /**Write the dictionary containing relevant points for this shape */
+ virtual bool WriteThisShapeInfo(wxTextFile & file);
+};
+
+
+
+#endif // SHAPE_CONDITIONAL_H
Modified: sofaswitch/trunk/callflow/src/dnd.cpp
==============================================================================
--- sofaswitch/trunk/callflow/src/dnd.cpp (original)
+++ sofaswitch/trunk/callflow/src/dnd.cpp Thu Sep 7 01:14:21 2006
@@ -463,22 +463,20 @@
DndShape * DndShape::Construct(Kind shapeRequired)
{
- if (shapeRequired == None) {
- printf("Construction failed for build shape of None.\n");
- return NULL;
- }
-
switch (shapeRequired)
{
+ case None: return NULL;
case StartHere: return new DndShapeStartHere();
case EndHere: return new DndShapeEndHere();
- case RequestNode: return new DndShapeRequestNode();
- case EndCall: return new DndShapeEndCall();
case StartFor: return new DndShapeStartFor();
case EndFor: return new DndShapeEndFor();
case Conditional: return new DndShapeConditional();
+ case MakeCall: return new DndShapeMakeCall();
+ case EndCall: return new DndShapeEndCall();
+ case Select: return new DndShapeSelect();
case JoinBlocks: return new DndShapeJoinBlocks();
case Python: return new DndShapePython();
+ case RequestNode: return new DndShapeRequestNode();
case Timer: return new DndShapeTimer();
case Eventer: return new DndShapeEventer();
default:
Modified: sofaswitch/trunk/callflow/src/dnd.h
==============================================================================
--- sofaswitch/trunk/callflow/src/dnd.h (original)
+++ sofaswitch/trunk/callflow/src/dnd.h Thu Sep 7 01:14:21 2006
@@ -264,7 +264,7 @@
/* 11*/ RequestNode /**Query a supervisor for a node to use to talk on*/,
/**12*/ Timer /**Initiate a timer, which runs for some specified time interval */,
/**13*/ Eventer /**Mark me as registering for an event. Possibly, wait for the registered for event */,
- /* 13*/ KnownShapes /**Indicates the number of known shapes we can manage */
+ /* 14*/ KnownShapes /**Indicates the number of known shapes we can manage */
};
/**Constructor to a predefined shape */
Added: sofaswitch/trunk/callflow/src/endcall.cpp
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/src/endcall.cpp Thu Sep 7 01:14:21 2006
@@ -0,0 +1,57 @@
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+#include <wx/textfile.h>
+#include <wx/tokenzr.h>
+#include "shapelist.h"
+
+
+#include "endcall.h"
+
+
+/////////////////////////////////////////////////////////////////////////////
+DndShapeEndCall::DndShapeEndCall()
+ : DndShape(EndCall)
+{
+ wxSize newSize(50, 50);
+ SetSize(newSize);
+ relInputPoints.Add(25, 0);
+ AdjustIoPoints();
+}
+
+void DndShapeEndCall::Draw(wxDC& dc)
+{
+ DrawCompileError(dc);
+ dc.SetPen(*wxBLACK_PEN);
+
+ wxPoint p1(m_rect.GetPosition());
+ wxPoint pA(p1.x + 25, p1.y);
+ wxPoint pB(p1.x + 25, p1.y + 15);
+
+ DrawBox(dc, 0, 15, 50, 35);
+ dc.DrawLine(pA, pB);
+ if (InputPointConnected(0))
+ DrawArrow(dc, pB, ArrowDown, Connected);
+ else
+ DrawArrow(dc, pB, ArrowDown, Loose);
+
+ DndShape::Draw(dc); // Draw the selected overlay if required.
+}
+
+bool DndShapeEndCall::WriteSystemCode(wxTextFile & file)
+{
+ file.AddLine(" def End_Call(self, sTuple): ");
+ file.AddLine(" a,b,c = sTuple");
+ file.AddLine(" return self.data[a][\"Output\"]");
+ file.AddLine("");
+
+ return true;
+}
+
Added: sofaswitch/trunk/callflow/src/endcall.h
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/src/endcall.h Thu Sep 7 01:14:21 2006
@@ -0,0 +1,37 @@
+#ifndef END_CALL_H
+#define END_CALL_H
+
+#include "dnd.h"
+
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/**Define a end call shape. Store values for size, location, input & output points.
+ This instance has the ability to draw this shape to a specified location on the canvas */
+class DndShapeEndCall : public DndShape
+{
+public:
+ /**Construtor, Define this shape in terms of size and points etc */
+ DndShapeEndCall();
+
+ /**Destroy this shape, and log it */
+ virtual ~DndShapeEndCall()
+ {
+ }
+
+ /**Draw this particular shape to the screen..*/
+ virtual void Draw(wxDC& dc);
+
+ /** Used to report the name of this particular class. */
+ static wxString GetKindName() { return wxString("End Call"); }
+
+ /**Write the code generic to this End Call shape */
+ virtual bool WriteSystemCode(wxTextFile & file);
+};
+
+
+
+
+
+#endif // END_CALL_H
+
Added: sofaswitch/trunk/callflow/src/endfor.cpp
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/src/endfor.cpp Thu Sep 7 01:14:21 2006
@@ -0,0 +1,94 @@
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+#include <wx/textfile.h>
+#include <wx/tokenzr.h>
+#include "shapelist.h"
+
+
+#include "endfor.h"
+
+
+/////////////////////////////////////////////////////////////////////////////
+DndShapeEndFor::DndShapeEndFor()
+ : DndShape(EndFor)
+{
+ wxSize newSize(50, 50);
+ SetSize(newSize);
+
+ relInputPoints.Add(32, 0);
+ relOutputPoints.Add(0, 25);
+ relOutputPoints.Add(32, 50);
+
+ AdjustIoPoints();
+}
+
+void DndShapeEndFor::Draw(wxDC& dc)
+{
+ DrawCompileError(dc);
+ dc.SetPen(*wxBLACK_PEN);
+
+ wxPoint tm(m_rect.x + 32, m_rect.y);
+ wxPoint tm1(tm.x, m_rect.y + 15);
+
+ wxPoint lm(m_rect.x, m_rect.y + 25);
+ wxPoint lm1(m_rect.x + 15, lm.y);
+
+ wxPoint bm(tm.x, m_rect.y + 35);
+ wxPoint bm1(tm.x, m_rect.y + 50);
+
+ DrawBox(dc, 15, 15, 35, 20);
+ dc.DrawLine(tm, tm1);
+ dc.DrawLine(lm, lm1);
+ dc.DrawLine(bm, bm1);
+
+ wxPoint ellipse(m_rect.x + 24, m_rect.y + 21);
+ wxSize eSize(16, 8);
+ dc.DrawEllipse(ellipse, eSize);
+
+ DrawArrow(dc, tm1, ArrowDown, InputPointConnected(0) ? Connected : Loose);
+ DrawArrow(dc, lm, ArrowLeft, OutputPointConnected(0) ? Connected : Loose);
+ DrawArrow(dc, bm1, ArrowDown, OutputPointConnected(1) ? Connected : Loose);
+
+ DndShape::Draw(dc); // Draw the selected overlay if required.
+}
+
+bool DndShapeEndFor::WriteSystemCode(wxTextFile & file)
+{
+ file.AddLine(" def End_For_Loop(self, aTuple): ");
+ file.AddLine(" a,b,c = aTuple");
+ file.AddLine(" return self.data[a][\"LoopAgain\"]");
+ file.AddLine("");
+
+ return true;
+}
+
+bool DndShapeEndFor::WriteThisShapeInfo(wxTextFile & file)
+{
+ file.AddLine(wxString::Format(" \"%s\" : { ", GetKey().c_str()));
+
+ wxNode *outputNode = (wxNode *)GetOutputPoints().GetFirst();
+ const wxString & outputLabel = ((LabelledPoint *)outputNode->GetData())->GetFullLabel();
+
+ file.AddLine(wxString::Format(" \"LoopAgain\" : "));
+ file.AddLine(wxString::Format(" %s, ", outputLabel.c_str()));
+
+ outputNode = outputNode->GetNext();
+ const wxString & outputLabel2 = ((LabelledPoint *)outputNode->GetData())->GetFullLabel();
+ file.AddLine(wxString::Format(" \"AllDone\" : "));
+ file.AddLine(wxString::Format(" %s, ", outputLabel2.c_str()));
+
+ file.AddLine(wxString::Format(" },"));
+
+ return true;
+}
+
+
+
Added: sofaswitch/trunk/callflow/src/endfor.h
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/src/endfor.h Thu Sep 7 01:14:21 2006
@@ -0,0 +1,38 @@
+#ifndef END_FOR_H
+
+#define END_FOR_H
+
+
+#include "dnd.h"
+
+//////////////////////////////////////////////////////////////////////
+/**Define a shape to indicate the end of a for loop. Store values for
+ size, location, input & output points. This instance has the
+ ability to draw this shape to a specified location on the canvas */
+class DndShapeEndFor : public DndShape
+{
+public:
+ /**Construtor, Define this shape in terms of size and points etc */
+ DndShapeEndFor();
+
+ /**Destroy this shape, and log it */
+ virtual ~DndShapeEndFor()
+ {
+ }
+
+ /**Draw this particular shape to the screen..*/
+ virtual void Draw(wxDC& dc);
+
+ /** Used to report the name of this particular class. */
+ static wxString GetKindName() { return wxString("End For Loop"); }
+
+ /**Write the code generic to this End For loop shape */
+ virtual bool WriteSystemCode(wxTextFile & file);
+
+ /**Write the dictionary containing relevant points for this shape */
+ virtual bool WriteThisShapeInfo(wxTextFile & file);
+};
+
+
+#endif
+
Added: sofaswitch/trunk/callflow/src/endhere.cpp
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/src/endhere.cpp Thu Sep 7 01:14:21 2006
@@ -0,0 +1,76 @@
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+#include <wx/textfile.h>
+#include <wx/tokenzr.h>
+#include "shapelist.h"
+
+
+#include "endhere.h"
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+DndShapeEndHere::DndShapeEndHere()
+ : DndShape(EndHere)
+{
+ wxSize newSize(50, 50);
+ SetSize(newSize);
+
+ relInputPoints.Add(25, 0);
+ AdjustIoPoints();
+}
+
+void DndShapeEndHere::Draw(wxDC& dc)
+{
+ DrawCompileError(dc);
+ dc.SetPen(*wxBLACK_PEN);
+
+ wxPoint p1(m_rect.GetPosition());
+ wxPoint pA(p1.x + 25, p1.y + 35);
+ wxPoint pB(p1.x + 25, p1.y + 0);
+
+ DrawBox(dc, 0, 35, 50, 15);
+ DrawBox(dc, 0, 15, 20, 20);
+ DrawBox(dc, 30, 15, 20, 20);
+
+ dc.DrawLine(pA, pB);
+ DrawArrow(dc, pA, ArrowDown, InputPointConnected(0) ? Connected : Loose);
+
+ DndShape::Draw(dc);
+}
+
+bool DndShapeEndHere::WriteSystemCode(wxTextFile & file)
+{
+ file.AddLine(" def End_Processing(self, sTuple): ");
+ file.AddLine(" self.keepGoing = False");
+ file.AddLine(" a,b,c = sTuple");
+ file.AddLine(" print \"end of processing at \", a ");
+ file.AddLine(" return (1,2,3)");
+ file.AddLine("");
+
+ return true;
+}
+
+bool DndShapeEndHere::WriteThisShapeInfo(wxTextFile & file)
+{
+ file.AddLine(wxString::Format(" \"%s\" : { ", GetKey().c_str()));
+
+ wxNode *inputNode = (wxNode *)GetInputPoints().GetFirst();
+ const wxString & inputLabel = ((LabelledPoint *)inputNode->GetData())->GetFullLabel();
+
+ file.AddLine(wxString::Format(" \"Input\" : "));
+ file.AddLine(wxString::Format(" %s, ", inputLabel.c_str()));
+
+ file.AddLine(wxString::Format(" },"));
+
+ return true;
+}
+
Added: sofaswitch/trunk/callflow/src/endhere.h
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/src/endhere.h Thu Sep 7 01:14:21 2006
@@ -0,0 +1,35 @@
+#ifndef END_HERE_H
+
+#define END_HERE_H
+
+#include "dnd.h"
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/**Define a start shape. Store values for size, location, input & output points.
+ This instance has the ability to draw this shape to a specified location on the canvas */
+class DndShapeEndHere : public DndShape
+{
+public:
+ /**Construtor, Define this shape in terms of size and points etc */
+ DndShapeEndHere();
+
+ /**Destroy this shape, and log it */
+ virtual ~DndShapeEndHere()
+ {
+ }
+
+ /**Draw this particular shape to the screen..*/
+ virtual void Draw(wxDC& dc);
+
+ /** Used to report the name of this particular class. */
+ static wxString GetKindName() { return wxString("End Processing"); }
+
+ /**Write the code generic to this EndHere shape */
+ virtual bool WriteSystemCode(wxTextFile & file);
+
+ /**Write the dictionary containing relevant points for this shape */
+ virtual bool WriteThisShapeInfo(wxTextFile & file);
+};
+
+#endif
Added: sofaswitch/trunk/callflow/src/eventer.cpp
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/src/eventer.cpp Thu Sep 7 01:14:21 2006
@@ -0,0 +1,116 @@
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+#include <wx/textfile.h>
+#include <wx/tokenzr.h>
+#include "shapelist.h"
+
+
+#include "drawshape.h"
+
+/////////////////////////////////////////////////////////////////////////////
+
+DndShapeEventer::DndShapeEventer()
+ : DndShape(Eventer)
+{
+ wxSize newSize(50, 50);
+ SetSize(newSize);
+
+ relInputPoints.Add(13, 0);
+ relOutputPoints.Add(13, 50);
+ relOutputPoints.Add(50, 22);
+ AdjustIoPoints();
+
+ displayData[displayData.size()] =
+ InformationSection(wxT("Event"), wxT("timer1"));
+}
+
+void DndShapeEventer::Draw(wxDC& dc)
+{
+ DrawCompileError(dc);
+ dc.SetPen(*wxBLACK_PEN);
+
+ wxPoint p1(m_rect.GetPosition());
+ wxPoint pA(p1.x + 13, p1.y + 0);
+ wxPoint pB(p1.x + 13, p1.y + 15);
+
+ wxPoint pC(p1.x + 13, p1.y + 35);
+ wxPoint pD(p1.x + 13, p1.y + 50);
+ dc.DrawLine(pA, pB);
+ dc.DrawLine(pC, pD);
+
+ DrawBox(dc, 0, 15, 30, 15);
+
+ wxPoint pI(p1.x + 30, p1.y + 17);
+ wxPoint pJ(p1.x + 35, p1.y + 22);
+ wxPoint pK(p1.x + 30, p1.y + 27);
+ wxPoint pL(p1.x + 50, p1.y + 22);
+ dc.DrawLine(pI, pJ);
+ dc.DrawLine(pJ, pK);
+ dc.DrawLine(pJ, pL);
+
+ wxPoint pX(p1.x + 8, p1.y + 30);
+ wxPoint pY(p1.x + 13, p1.y + 35);
+ wxPoint pZ(p1.x + 18, p1.y + 30);
+ dc.DrawLine(pX, pY);
+ dc.DrawLine(pY, pZ);
+
+ DrawArrow(dc, pA, ArrowDown, InputPointConnected(0) ? Connected : Loose);
+ DrawArrow(dc, pD, ArrowDown, OutputPointConnected(0) ? Connected : Loose);
+ DrawArrow(dc, pL, ArrowRight, OutputPointConnected(1) ? Connected : Loose);
+
+ DndShape::Draw(dc);
+}
+
+bool DndShapeEventer::WriteSystemCode(wxTextFile & file)
+{
+ file.AddLine(" def Eventer(self, sTuple): ");
+ file.AddLine(" a,b,c = sTuple");
+ file.AddLine(" print \"Eventer \", a ");
+ file.AddLine(" return (1,2,3)");
+ file.AddLine("");
+
+ return true;
+}
+
+bool DndShapeEventer::WriteThisShapeInfo(wxTextFile & file)
+{
+ file.AddLine(wxString::Format("\"%s\" : { ", GetKey().c_str()));
+
+ wxNode *inputNode = (wxNode *)GetInputPoints().GetFirst();
+ const wxString & inputLabel = ((LabelledPoint *)inputNode->GetData())->GetFullLabel();
+
+ file.AddLine(wxString::Format(" \"Input\" : "));
+ file.AddLine(wxString::Format(" %s, ", inputLabel.c_str()));
+
+ wxNode *outputNode = (wxNode *)GetOutputPoints().GetFirst();
+ const wxString & outputLabel = ((LabelledPoint *)outputNode->GetData())->GetFullLabel();
+
+ file.AddLine(wxString::Format(" \"OutputFromEvent\" : "));
+ file.AddLine(wxString::Format(" %s, ", outputLabel.c_str()));
+
+ outputNode = outputNode->GetNext();
+ const wxString & outputLabel2 = ((LabelledPoint *)outputNode->GetData())->GetFullLabel();
+ file.AddLine(wxString::Format(" \"OutputKeepGoing\" : "));
+ file.AddLine(wxString::Format(" %s, ", outputLabel2.c_str()));
+
+ file.AddLine(wxString::Format(" \"Event\" : "));
+ file.AddLine(wxString::Format(" \"%s\", ", displayData[1].data.c_str()));
+
+ file.AddLine(wxString::Format(" },"));
+
+ return true;
+}
+
+bool DndShapeEventer::CheckOutputPointsLinked()
+{
+ return outputPoints.PointLinked(0);
+}
+
Added: sofaswitch/trunk/callflow/src/eventer.h
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/src/eventer.h Thu Sep 7 01:14:21 2006
@@ -0,0 +1,38 @@
+#ifndef SHAPE_EVENTER_H
+#define SHAPE_EVENTER_H
+#include "dnd.h"
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/**Define a event registration, and wait for event shape. Normal flow of execution enters this shape,
+and an event is registered for. There is always a connection to the event detected and process output.
+There is an optional outgoing connection for the "do other things while waiting" output. */
+class DndShapeEventer : public DndShape
+{
+public:
+ /**Construtor, Define this shape in terms of size and points etc */
+ DndShapeEventer();
+
+ /**Destroy this shape, and log it */
+ virtual ~DndShapeEventer()
+ {
+ }
+
+ /**Draw this particular shape to the screen..*/
+ virtual void Draw(wxDC& dc);
+
+ /** Used to report the name of this particular class. */
+ static wxString GetKindName() { return wxString("Eventer"); }
+
+ /**Write the code generic to this End Call shape */
+ virtual bool WriteSystemCode(wxTextFile & file);
+
+ /**Write the dictionary containing relevant points for this shape */
+ virtual bool WriteThisShapeInfo(wxTextFile & file);
+
+ /**Check that every output point of this shape goes
+ somewhere. Return False if there is a dangling output point */
+ virtual bool CheckOutputPointsLinked();
+};
+
+#endif // SHAPE_EVENTER_H
Added: sofaswitch/trunk/callflow/src/joinblocks.cpp
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/src/joinblocks.cpp Thu Sep 7 01:14:21 2006
@@ -0,0 +1,280 @@
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+#include <wx/textfile.h>
+#include <wx/tokenzr.h>
+#include "shapelist.h"
+
+
+#include "joinblocks.h"
+
+
+/////////////////////////////////////////////////////////////////////////////
+DndShapeJoinBlocks::DndShapeJoinBlocks()
+ : DndShape(JoinBlocks)
+{
+ SetSelected();
+ ZeroPositionSize();
+}
+
+void DndShapeJoinBlocks::DrawSelected(wxDC & dc)
+{
+ dc.SetPen(*wxBLUE);
+ DrawShapeNow(dc);
+}
+
+void DndShapeJoinBlocks::DrawShapeNow(wxDC & dc)
+{
+ wxNode *node = (wxNode *)points.GetFirst();
+ if (node == NULL)
+ return;
+
+ wxPoint firstPoint = *((wxPoint *)node->GetData());
+ node = node->GetNext();
+ while(node != NULL) {
+ wxPoint thisPoint = *((wxPoint *)node->GetData());
+ dc.DrawLine(firstPoint, thisPoint);
+ firstPoint = thisPoint;
+ node = node->GetNext();
+ }
+
+ ioPointsLinked = false;
+}
+
+void DndShapeJoinBlocks::Draw(wxDC & dc)
+{
+ if(isSelected)
+ DrawSelected(dc);
+ else {
+ dc.SetPen(*wxBLACK_PEN);
+ DrawShapeNow(dc);
+ }
+}
+
+
+void DndShapeJoinBlocks::AdjustPosition(wxPoint &moveSize)
+{
+ m_rect.Offset(moveSize);
+
+ int minX = 1 << 30;
+ int minY = 1 << 30;
+ int maxX = 0 - minX;
+ int maxY = 0 - minY;
+
+ wxNode *node = (wxNode *)points.GetFirst();
+ if (node == NULL)
+ return;
+
+ while (node != NULL) {
+ wxPoint *firstPoint = (wxPoint *)node->GetData();
+
+ firstPoint->x += moveSize.x;
+ firstPoint->y += moveSize.y;
+
+ if (firstPoint->x < minX)
+ minX = firstPoint->x;
+ if (firstPoint->x > maxX)
+ maxX = firstPoint->x;
+
+ if (firstPoint->y < minY)
+ minY = firstPoint->y;
+ if (firstPoint->y > maxY)
+ maxY = firstPoint->y;
+
+ node = node->GetNext();
+ }
+
+ m_rect.SetWidth(maxX - minX);
+ m_rect.SetHeight(maxY - minY);
+}
+
+void DndShapeJoinBlocks::PrintSizeInformation()
+{
+ return;
+ printf("Location:: %d %d\n %d %d xxx %d %d\n %d %d\n",
+ m_rect.x, m_rect.y,
+ m_rect.GetX(), m_rect.GetY(), m_rect.GetWidth(), m_rect.GetHeight(),
+ m_rect.GetWidth(), m_rect.GetHeight());
+}
+
+void DndShapeJoinBlocks::AddNewPoint(wxPoint & newPoint)
+{
+ // printf("Add new point %d %d \n", newPoint.x, newPoint.y);
+ if (GetCount() == 0) {
+ m_rect.SetX(newPoint.x);
+ m_rect.SetY(newPoint.y);
+ m_rect.SetWidth(0);
+ m_rect.SetHeight(0);
+ } else {
+ if (newPoint.x < m_rect.x) {
+ m_rect.SetWidth(m_rect.GetWidth() + (m_rect.x - newPoint.x));
+ m_rect.SetX(newPoint.x);
+ }
+
+ if (newPoint.y < m_rect.y) {
+ m_rect.SetHeight(m_rect.GetHeight() + (m_rect.y - newPoint.y));
+ m_rect.SetY(newPoint.y);
+ }
+
+ if (newPoint.x > (m_rect.x + m_rect.GetWidth())) {
+ m_rect.SetWidth(newPoint.x - m_rect.x);
+ }
+
+ if (newPoint.y > (m_rect.y + m_rect.GetHeight())) {
+ m_rect.SetHeight(newPoint.y - m_rect.y);
+ }
+
+ }
+
+ PrintSizeInformation();
+
+ points.Add(newPoint);
+}
+
+void DndShapeJoinBlocks::RemoveCurrentPoints()
+{
+ points.RemoveCurrentPoints();
+ ZeroPositionSize();
+}
+
+void DndShapeJoinBlocks::SetPosition(wxPoint & newPosition)
+{
+
+}
+
+bool DndShapeJoinBlocks::GetFirstPoint(wxPoint & coord)
+{
+ return points.GetFirstPoint(coord);
+}
+
+bool DndShapeJoinBlocks::GetLastPoint(wxPoint & coord)
+{
+ return points.GetLastPoint(coord);
+}
+
+wxString DndShapeJoinBlocks::GetDescendantShapeInfo()
+{
+ wxNode *node = (wxNode *)points.GetFirst();
+ if (node == NULL)
+ return wxString("");
+
+ wxString answer;
+ while (node != NULL) {
+ wxPoint onePoint = *((wxPoint *)node->GetData());
+ if (answer.Length() == 0)
+ answer = answer + wxString::Format("%d,%d", onePoint.x, onePoint.y);
+ else
+ answer = answer + wxString::Format(",%d,%d", onePoint.x, onePoint.y);
+ node = node->GetNext();
+ }
+ return answer;
+}
+
+void DndShapeJoinBlocks::SetDescendantShapeInfo(const wxString & newValue)
+{
+ wxStringTokenizer bits(newValue, ",", wxTOKEN_RET_EMPTY);
+
+ if ((bits.CountTokens() % 2) != 0) {
+ wxMessageBox("invalid string to process");
+ printf(" %s \n", newValue.c_str());
+ return;
+ }
+
+ while (bits.HasMoreTokens()) {
+ long xpos, ypos;
+ if (bits.GetNextToken().ToLong(&xpos) &&
+ bits.GetNextToken().ToLong(&ypos)) {
+ wxPoint newPoint(xpos, ypos);
+ AddNewPoint(newPoint);
+ }
+ }
+}
+
+
+
+bool DndShapeJoinBlocks::Intersects(const wxRect & testRectangle) const
+{
+ if (DndShape::Intersects(testRectangle)) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+bool DndShapeJoinBlocks::Intersects(const wxPoint & testPoint) const
+{
+ wxNode *node = (wxNode *)points.GetFirst();
+ if (node == NULL)
+ return false;
+
+ wxPoint firstPoint = *((wxPoint *)node->GetData());
+ node = node->GetNext();
+ while(node != NULL) {
+ wxPoint thisPoint = *((wxPoint *)node->GetData());
+
+ if (DistancePointToLine(testPoint, firstPoint, thisPoint) < 5)
+ return true;
+
+ firstPoint = thisPoint;
+ node = node->GetNext();
+ }
+
+ return false;
+}
+
+double DndShapeJoinBlocks::DistancePointToLine(const wxPoint & point,
+ const wxPoint & lineA,
+ wxPoint & lineB) const
+{
+ /**Calculation of distance from a point to a line was derived from
+ http://www.simdesign.nl/tips/tip001.html */
+
+ double q;
+
+ if (lineA == lineB)
+ return PointToPointDist(point, lineA);
+
+ q = ((point.x - lineA.x) * (lineB.x - lineA.x) + (point.y - lineA.y)*(lineB.y - lineA.y));
+
+ q = q / (sqr(lineB.x - lineA.x) + sqr(lineB.y - lineA.y));
+
+ if (q < 0)
+ q = 0;
+ if (q > 1)
+ q = 1;
+
+ wxPoint intersection((int)((1 - q) * lineA.x + q * lineB.x),
+ (int)((1 - q) * lineA.y + q * lineB.y) );
+
+ return PointToPointDist(point, intersection);
+}
+
+int DndShapeJoinBlocks::sqr(const int & aa) const
+{
+ return aa * aa;
+}
+
+double DndShapeJoinBlocks::PointToPointDist(const wxPoint & ptA, const wxPoint & ptB) const
+{
+ return sqrt(sqr(ptA.x - ptB.x) + sqr(ptA.y - ptB.y));
+}
+
+
+
+bool DndShapeJoinBlocks::WriteSystemCode(wxTextFile & /*file*/)
+{
+ return true;
+}
+
+
+bool DndShapeJoinBlocks::WriteThisShapeInfo(wxTextFile & /*file*/)
+{
+ return true;
+}
Added: sofaswitch/trunk/callflow/src/joinblocks.h
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/src/joinblocks.h Thu Sep 7 01:14:21 2006
@@ -0,0 +1,108 @@
+#ifndef JOIN_BLOCKS_H
+#define JOIN_BLOCKS_H
+#include "dnd.h"
+
+#include "listpoints.h"
+
+///////////////////////////////////////////////////////////////////
+/**Define a shape to draw lines between individual entities. It has no
+ particular rectangle, except that which encompasses the whole thing
+ - a sort of BoundingBox type thing from postscript. This instance
+ has the ability to draw this shape to a specified location on the
+ canvas */
+class DndShapeJoinBlocks : public DndShape
+{
+public:
+ /**Construtor, Define this shape in terms of size and points etc */
+ DndShapeJoinBlocks();
+
+ /**Destroy this shape, and log it */
+ virtual ~DndShapeJoinBlocks()
+ {
+ }
+
+ /**Draw this particular shape (which is a collection of joined
+ lines) to the screen..*/
+ virtual void Draw(wxDC& dc);
+
+ /**Draw this shape (which is a collection of joined lines) in a
+ selected fashion to the screen. */
+ virtual void DrawSelected(wxDC &dc);
+
+ /** Used to report the name of this particular class. */
+ static wxString GetKindName() { return wxString("Join blocks shape"); }
+
+ /**Mark this shape as having a top left postion as determined by the parameter */
+ virtual void SetPosition(wxPoint & newPosition);
+
+ /**Modify the location of this shape by the specified delta. This is used when
+ the user is dragging this selecting region across the screen */
+ virtual void AdjustPosition(wxPoint &moveSize);
+
+ /**Report the information needed by some special shapes for internal used */
+ virtual wxString GetDescendantShapeInfo();
+
+ /**Set the special info which is relevant to the particular shape being represented */
+ virtual void SetDescendantShapeInfo(const wxString & newValue);
+
+ /**Append one new point to the this join blocks shape */
+ void AddNewPoint(wxPoint & newPoint);
+
+ /**Remove all data from this shape, and zero variables */
+ void RemoveCurrentPoints();
+
+ /**Report the number of data points in this structure right now */
+ int GetCount() { return points.GetCount(); }
+
+ /**Report the first coordinate entered in this structure. If it is
+ empty, return false. */
+ bool GetFirstPoint(wxPoint & coord);
+
+ /**Report the last coordinate entered in this structure. If it is
+ empty, return false. */
+ bool GetLastPoint(wxPoint & coord);
+
+ /**Return TRUE if any part of this shape is inside the supplied
+ rectangle */
+ virtual bool Intersects(const wxRect & testRectangle) const;
+
+ /**Return TRUE if the specified point is inside this particular shape */
+ virtual bool Intersects(const wxPoint & testPoint) const;
+
+ /**Write the code generic to this shape */
+ virtual bool WriteSystemCode(wxTextFile & file);
+
+ /**Write the dictionary containing relevant points for this shape */
+ virtual bool WriteThisShapeInfo(wxTextFile & file);
+
+
+ protected:
+ /**This has been put in for debugging, and prints the size of the
+ region surrounding this join blocks shape */
+ void PrintSizeInformation();
+
+ /**Actually render this shape now to the drawing context. It is
+ expected that the user will have set the desired pen colour etc
+ before calling this method */
+ void DrawShapeNow(wxDC & dc);
+
+ /**Report the distance between the test point and the line.which joins the endpoints of the line */
+ double DistancePointToLine(const wxPoint & point, const wxPoint & lineA, wxPoint & lineB) const;
+
+ /**Calculate the value of the argument squared */
+ int sqr(const int & aa) const;
+
+ /**The distance between the two points, calculated by determining
+ the length of the hypotenuse - square the x&y deltas, sum these
+ squares, and do a square root */
+ double PointToPointDist(const wxPoint & ptA, const wxPoint & ptB) const;
+
+ /**The location of all points in this shape. These points are
+ placed in this table in the same coordinate system as the m_rect
+ variable. Note that the m_rect variable is the location of the
+ top left corner of the boundingbox for this shape */
+ ListWxPoints points;
+};
+
+
+#endif // JOIN_BLOCKS_H
Added: sofaswitch/trunk/callflow/src/listpoints.cpp
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/src/listpoints.cpp Thu Sep 7 01:14:21 2006
@@ -0,0 +1,54 @@
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+
+#include "listpoints.h"
+
+#include <wx/listimpl.cpp>
+WX_DEFINE_LIST(AListWxPoints);
+
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+void ListWxPoints::RemoveCurrentPoints()
+{
+ DeleteContents(true);
+
+ Clear();
+}
+
+bool ListWxPoints::GetFirstPoint(wxPoint & point)
+{
+ if (GetCount() == 0)
+ return false;
+
+ wxNode *node = (wxNode *)GetFirst();
+ point = *((wxPoint *)node->GetData());
+ return true;
+}
+
+bool ListWxPoints::GetLastPoint(wxPoint & point)
+{
+ if (GetCount() == 0)
+ return false;
+
+ wxNode *node = (wxNode *)GetLast();
+ point = *((wxPoint *)node->GetData());
+ return true;
+}
+
+void ListWxPoints::Add (wxPoint & newData)
+{
+ wxPoint *newPoint = new wxPoint(newData);
+ Append(newPoint);
+}
Added: sofaswitch/trunk/callflow/src/listpoints.h
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/src/listpoints.h Thu Sep 7 01:14:21 2006
@@ -0,0 +1,39 @@
+#ifndef LIST_POINTS_H
+
+#define LIST_POINTS_H
+
+#include <wx/list.h>
+
+
+WX_DECLARE_LIST(wxPoint, AListWxPoints);
+
+/////////////////////////////////////////////////////////////////////////////
+/**A simple list of wxPoints. No additional fields are required, just the points themselves.
+ Add in some simple methods to ease access to data etc */
+class ListWxPoints : public AListWxPoints
+{
+ public:
+ /**Constructor - provided to do any initialisation */
+ ListWxPoints() { }
+
+ /**Destructor - this ensures the list is empty at the end */
+ ~ListWxPoints() { RemoveCurrentPoints(); }
+
+ /**Remove all the points in this list, and the associated data */
+ void RemoveCurrentPoints();
+
+ /**Return the first point in this list. Returns false if no
+ available point.. Returns true if the list contains 1 or more
+ points. */
+ bool GetFirstPoint(wxPoint & point);
+
+ /**Return the last point in this list. Returns false if no available
+ point..Returns true if the list contains 1 or more points. */
+ bool GetLastPoint(wxPoint & point);
+
+ /**Add a new point to this list */
+ void Add (wxPoint & newData);
+};
+
+
+#endif //LIST_POINTS_H
Added: sofaswitch/trunk/callflow/src/makecall.cpp
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/src/makecall.cpp Thu Sep 7 01:14:21 2006
@@ -0,0 +1,69 @@
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+#include <wx/textfile.h>
+#include <wx/tokenzr.h>
+#include "shapelist.h"
+
+
+#include "makecall.h"
+
+
+/////////////////////////////////////////////////////////////////////////////
+DndShapeMakeCall::DndShapeMakeCall()
+ : DndShape(MakeCall)
+{
+ wxSize newSize(50, 50);
+ SetSize(newSize);
+
+ relInputPoints.Add(25, 0);
+ relOutputPoints.Add(25, 50);
+ AdjustIoPoints();
+}
+
+bool DndShapeMakeCall::WriteSystemCode(wxTextFile & file)
+{
+ file.AddLine(" def Make_Call(self, sTuple): ");
+ file.AddLine(" a,b,c = sTuple");
+ file.AddLine(" return self.data[a][\"Output\"]");
+ file.AddLine("");
+
+ return true;
+}
+
+
+void DndShapeMakeCall::Draw(wxDC& dc)
+{
+ DrawCompileError(dc);
+ dc.SetPen(*wxBLACK_PEN);
+
+ wxPoint p1(m_rect.GetPosition());
+ wxPoint pA(p1.x + 25, p1.y);
+ wxPoint pB(p1.x + 25, p1.y + 15);
+
+ wxPoint pY(p1.x + 25, p1.y + 35);
+ wxPoint pZ(p1.x + 25, p1.y + 50);
+
+ DrawBox(dc, 0, 15, 50, 20);
+ dc.DrawLine(pA, pB);
+ if (InputPointConnected(0))
+ DrawArrow(dc, pB, ArrowDown, Connected);
+ else
+ DrawArrow(dc, pB, ArrowDown, Loose);
+
+ dc.DrawLine(pY, pZ);
+ if (OutputPointConnected(0))
+ DrawArrow(dc, pZ, ArrowDown, Connected);
+ else
+ DrawArrow(dc, pZ, ArrowDown, Loose);
+
+ DndShape::Draw(dc); // Draw the selected overlay if required.
+}
+
Added: sofaswitch/trunk/callflow/src/makecall.h
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/src/makecall.h Thu Sep 7 01:14:21 2006
@@ -0,0 +1,31 @@
+#ifndef MAKE_CALL_H
+#define MAKE_CALL_H
+
+#include "dnd.h"
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/**Define a create a call shape. Store values for size, location, input & output points.
+ This instance has the ability to draw this shape to a specified location on the canvas */
+class DndShapeMakeCall : public DndShape
+{
+public:
+ /**Construtor, Define this shape in terms of size and points etc */
+ DndShapeMakeCall();
+
+ /**Destroy this shape, and log it */
+ virtual ~DndShapeMakeCall()
+ {
+ }
+
+ /**Draw this particular shape to the screen..*/
+ virtual void Draw(wxDC& dc);
+
+ /**Write the code generic to this Make Call shape */
+ virtual bool WriteSystemCode(wxTextFile & file);
+
+ /** Used to report the name of this particular class. */
+ static wxString GetKindName() { return wxString("Make Call"); }
+};
+
+
+#endif // MAKE_CALL_H
Added: sofaswitch/trunk/callflow/src/python.cpp
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/src/python.cpp Thu Sep 7 01:14:21 2006
@@ -0,0 +1,104 @@
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+#include <wx/textfile.h>
+#include <wx/tokenzr.h>
+#include "shapelist.h"
+
+
+#include "python.h"
+
+
+/////////////////////////////////////////////////////////////////////////////
+DndShapePython::DndShapePython()
+ : DndShape(Python)
+{
+ wxSize newSize(50, 50);
+ SetSize(newSize);
+
+ relInputPoints.Add(25, 0);
+ relOutputPoints.Add(25, 50);
+
+ displayData[displayData.size()] =
+ InformationSection(wxT("Python Code"), wxT("self.i = 0"));
+
+ AdjustIoPoints();
+}
+
+void DndShapePython::Draw(wxDC& dc)
+{
+ DrawCompileError(dc);
+ dc.SetPen(*wxBLACK_PEN);
+
+ wxPoint p1(m_rect.GetPosition());
+ wxPoint pA(p1.x + 25, p1.y + 15);
+ wxPoint pB(p1.x + 25, p1.y + 0);
+ wxPoint pC(p1.x + 25, p1.y + 50);
+
+ DrawArrow(dc, pA, ArrowDown, InputPointConnected(0) ? Connected : Loose);
+ DrawArrow(dc, pC, ArrowDown, OutputPointConnected(0) ? Connected : Loose);
+ dc.DrawLine(pC, pB);
+
+ DrawBox(dc, 0, 10, 21, 21);
+ DrawBox(dc, 29, 10, 21, 21);
+
+ wxString text("Pyt");
+ dc.SetFont(*wxITALIC_FONT);
+ wxCoord w, h;
+ dc.GetTextExtent(text, &w, &h);
+ int xPos = m_rect.x + 0 + ((21 - w)/2);
+ int yPos = m_rect.y + 10 + ((21 - h)/2);
+ dc.DrawText(text, xPos, yPos);
+
+ text = "hon";
+ dc.GetTextExtent(text, &w, &h);
+ xPos = m_rect.x + 29 + ((21 - w)/2);
+ yPos = m_rect.y + 10 + ((21 - h)/2);
+ dc.DrawText(text, xPos, yPos);
+
+
+ DrawBox(dc, 0, 35, 13, 13);
+ DrawBox(dc, 37, 35, 13, 13);
+
+ DndShape::Draw(dc);
+}
+
+bool DndShapePython::WriteSystemCode(wxTextFile & file)
+{
+ file.AddLine(" def Python(self, sTuple): ");
+ file.AddLine(" a,b,c = sTuple");
+ file.AddLine(" exec(self.data[a][\"Python Code\"])");
+ file.AddLine(" return self.data[a][\"Output\"]");
+ file.AddLine("");
+
+ return true;
+}
+
+bool DndShapePython::WriteThisShapeInfo(wxTextFile & file)
+{
+ file.AddLine(wxString::Format(" \"%s\" : { ", GetKey().c_str()));
+
+ wxNode *inputNode = (wxNode *)GetInputPoints().GetFirst();
+ const wxString & inputLabel = ((LabelledPoint *)inputNode->GetData())->GetFullLabel();
+ file.AddLine(wxString::Format(" \"Input\" : "));
+ file.AddLine(wxString::Format(" %s, ", inputLabel.c_str()));
+
+ wxNode *outputNode = (wxNode *)GetOutputPoints().GetFirst();
+ const wxString & outputLabel = ((LabelledPoint *)outputNode->GetData())->GetFullLabel();
+ file.AddLine(wxString::Format(" \"Output\" : "));
+ file.AddLine(wxString::Format(" %s, ", outputLabel.c_str()));
+
+ file.AddLine(wxString::Format(" \"Python Code\" : "));
+ file.AddLine(wxString::Format(" \"%s\", ", displayData[1].data.c_str()));
+
+ file.AddLine(wxString::Format(" },"));
+
+ return true;
+}
Added: sofaswitch/trunk/callflow/src/python.h
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/src/python.h Thu Sep 7 01:14:21 2006
@@ -0,0 +1,35 @@
+#ifndef SHAPE_PYTHON_H
+
+#define SHAPE_PYTHON_H
+
+#include "dnd.h"
+
+//////////////////////////////////////////////////////////////////////////
+/**Define a shape to indicate an arbitrary block of python code.
+ */
+class DndShapePython : public DndShape
+{
+public:
+ /**Construtor, Define this shape in terms of size and points etc */
+ DndShapePython();
+
+ /**Destroy this shape, and log it */
+ virtual ~DndShapePython()
+ {
+ }
+
+ /**Draw this particular shape to the screen..*/
+ virtual void Draw(wxDC& dc);
+
+ /** Used to report the name of this particular class. */
+ static wxString GetKindName() { return wxString("Python"); }
+
+ /**Write the code generic to this Python code shape */
+ virtual bool WriteSystemCode(wxTextFile & file);
+
+ /**Write the dictionary containing relevant points for this shape */
+ virtual bool WriteThisShapeInfo(wxTextFile & file);
+};
+
+
+#endif
Added: sofaswitch/trunk/callflow/src/requestnode.cpp
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/src/requestnode.cpp Thu Sep 7 01:14:21 2006
@@ -0,0 +1,97 @@
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+#include <wx/textfile.h>
+#include <wx/tokenzr.h>
+#include "shapelist.h"
+
+
+#include "requestnode.h"
+
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+
+DndShapeRequestNode::DndShapeRequestNode()
+ : DndShape(RequestNode)
+{
+ wxSize newSize(50, 50);
+ SetSize(newSize);
+
+ displayData[displayData.size()] =
+ InformationSection(wxT("request node from "), wxT("voip"));
+
+ relInputPoints.Add(25, 0);
+ relOutputPoints.Add(25, 50);
+ AdjustIoPoints();
+}
+
+void DndShapeRequestNode::Draw(wxDC& dc)
+{
+ DrawCompileError(dc);
+ dc.SetPen(*wxBLACK_PEN);
+
+ wxPoint p1(m_rect.GetPosition());
+ wxPoint pA(p1.x + 25, p1.y + 0);
+ wxPoint pB(p1.x + 25, p1.y + 50);
+
+
+ dc.DrawLine(pA, pB);
+
+ wxString text("R ?");
+ wxFont f = wxFont(*wxITALIC_FONT);
+ f.SetPointSize(20);
+ dc.SetFont(f);//*wxITALIC_FONT);
+ wxCoord w, h;
+ dc.GetTextExtent(text, &w, &h);
+
+ int xPos = m_rect.x + 0 + ((50 - w)/2);
+ int yPos = m_rect.y + 10 + ((21 - h)/2);
+ dc.DrawText(text, xPos, yPos);
+
+ DrawArrow(dc, pA, ArrowDown, InputPointConnected(0) ? Connected : Loose);
+ DrawArrow(dc, pB, ArrowDown, OutputPointConnected(0) ? Connected : Loose);
+
+ DndShape::Draw(dc);
+}
+
+bool DndShapeRequestNode::WriteSystemCode(wxTextFile & file)
+{
+ file.AddLine(" def Request_Node(self, aTuple): ");
+ file.AddLine(" id,y,z = aTuple");
+ file.AddLine(" return data[id][\"Output\"]");
+ file.AddLine("");
+ return true;
+}
+
+bool DndShapeRequestNode::WriteThisShapeInfo(wxTextFile & file)
+{
+ file.AddLine(wxString::Format("\"%s\" : { ", GetKey().c_str()));
+
+ wxNode *inputNode = (wxNode *)GetInputPoints().GetFirst();
+ const wxString & inputLabel = ((LabelledPoint *)inputNode->GetData())->GetFullLabel();
+ file.AddLine(wxString::Format(" \"Input\" : "));
+ file.AddLine(wxString::Format(" %s, ", inputLabel.c_str()));
+
+ wxNode *outputNode = (wxNode *)GetOutputPoints().GetFirst();
+ const wxString & outputLabel = ((LabelledPoint *)outputNode->GetData())->GetFullLabel();
+ file.AddLine(wxString::Format(" \"Output\" : "));
+ file.AddLine(wxString::Format(" %s, ", outputLabel.c_str()));
+
+
+ file.AddLine(wxString::Format(" \"request node from\" : "));
+ file.AddLine(wxString::Format(" \"%s\", ", displayData[1].data.c_str()));
+
+ file.AddLine(wxString::Format(" },"));
+
+ return true;
+}
+
Added: sofaswitch/trunk/callflow/src/requestnode.h
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/src/requestnode.h Thu Sep 7 01:14:21 2006
@@ -0,0 +1,39 @@
+#ifndef REQUEST_NODE_H
+
+#define REQUEST_NODE_H
+
+#include "dnd.h"
+
+///////////////////////////////////////////////////////////////////////////
+/**Define a request node shape. This code will return almost immediately, and
+ we leave it to the timer object to recover from if there was an answer, or
+ noting Store values for size, location, input & output points. This
+ instance has the ability to draw this shape to a specified location on the
+ canvas */
+class DndShapeRequestNode : public DndShape
+{
+public:
+ /**Construtor, Define this shape in terms of size and points etc */
+ DndShapeRequestNode();
+
+ /**Destroy this shape, and log it */
+ virtual ~DndShapeRequestNode()
+ {
+ }
+
+ /**Draw this particular shape to the screen..*/
+ virtual void Draw(wxDC& dc);
+
+ /** Used to report the name of this particular class. */
+ static wxString GetKindName() { return wxString("Request Node"); }
+
+ /**Write the code generic to this StartHere shape */
+ virtual bool WriteSystemCode(wxTextFile & file);
+
+ /**Write the dictionary containing relevant points for this shape */
+ virtual bool WriteThisShapeInfo(wxTextFile & file);
+};
+
+
+#endif
+
Modified: sofaswitch/trunk/callflow/src/shapelist.cpp
==============================================================================
--- sofaswitch/trunk/callflow/src/shapelist.cpp (original)
+++ sofaswitch/trunk/callflow/src/shapelist.cpp Thu Sep 7 01:14:21 2006
@@ -179,7 +179,10 @@
bool MyListShapesExtended::WriteGraphData(wxTextFile & file)
{
wxString graphName(file.GetName());
- graphName = graphName + ".graph";
+ int index = graphName.Find(".");
+ if (index >= 0)
+ graphName = graphName.Left(index);
+ graphName = graphName + "_graph";
wxTextFile graphFile(graphName);
if (!graphFile.Exists())
graphFile.Create();
@@ -192,7 +195,7 @@
graphFile.AddLine("#!/usr/bin/python");
graphFile.AddLine(" ");
- graphFile.AddLine(" data = {");
+ graphFile.AddLine("data = {");
MyListShapes::iterator it = begin();
@@ -287,8 +290,6 @@
file.Clear();
- bool shapeInitialised[DndShape::KnownShapes];
-
file.AddLine("#!/usr/bin/python");
file.AddLine(" ");
file.AddLine("import sys");
@@ -301,60 +302,36 @@
file.AddLine("from twisted.internet import reactor, protocol");
file.AddLine(" ");
- file.AddLine("class EchoClient(protocol.Protocol):");
-
- file.AddLine(" def connectionMade(self): ");
- file.AddLine(" self.myId = \"\" ");
- file.AddLine(" self.countReceived = 0 ");
- file.AddLine(" self.transport.write(\"?\0\") ");
- file.AddLine(" self.transport.write(\"whoami\0\");");
- file.AddLine(" self.colonChar = \':\' ");
- file.AddLine(" ");
- file.AddLine(" def connectionLost(self, reason): ");
- file.AddLine(" print \"connection lost\" ");
- file.AddLine(" ");
- file.AddLine(" def dataReceived(self, data): ");
- file.AddLine(" ssdata = str(data).split(\'\0\') ");
- file.AddLine(" for oneMessage in ssdata: ");
- file.AddLine(" self.countReceived = self.countReceived + 1");
- file.AddLine(" if self.countReceived == 1: ");
- file.AddLine(" self.myId = oneMessage; ");
- file.AddLine(" else: ");
- file.AddLine(" self.processReceivedMessage(oneMessage)");
- file.AddLine(" ");
- file.AddLine(" def replyNow(self, data):");
- file.AddLine(" self.transport.write(self.tstring) ");
- file.AddLine(" ");
- file.AddLine(" ");
-
- file.AddLine("class Controller(EchoClient):");
- file.AddLine(" ");
-
- file.AddLine(" def processReceivedMessage(self, thisMessage): ");
- file.AddLine(" print \"Received \", thisMessage ");
- file.AddLine(" ");
-
- file.AddLine(" def __init__(self):");
- file.AddLine(" self.endProgramNow = False");
+ file.AddLine("class Controller(protocol.Protocol): ");
+ file.AddLine(" def __init__(self): ");
+ file.AddLine(" self.graphSet = False ");
+ file.AddLine(" self.connectionMade = False ");
+ file.AddLine(" self.endProgramNow = False ");
char c= 34;
wxString tString = wxString::Format(" self.quote = \"\\%c\"", c);
file.AddLine(tString.c_str());
- bool keepLooking = true;
- it = begin();
- while ((it != end()) && keepLooking) {
- DndShape *thisShape = it->second;
- if (thisShape->GetKind() == DndShape::StartHere)
- keepLooking = false;
- else
- it++;
- }
- if (keepLooking)
- return false;
-
- wxString startNode = wxString::Format(" self.firstNode = \"%s\"", it->second->GetKey().c_str());
- file.AddLine(startNode);
-
+ file.AddLine(" ");
+ file.AddLine(" def setGraphData(self, graphFile): ");
+ file.AddLine(" import graphFile ");
+ file.AddLine(" self.data = graphFile.data ");
+ file.AddLine(" ");
+ file.AddLine(" self.firstNode = None ");
+ file.AddLine(" for k,v in aa.data.iteritems(): ");
+ file.AddLine(" if k[:16] == \"Start_Processing\": ");
+ file.AddLine(" self.firstNode = k ");
+ file.AddLine(" break ");
+ file.AddLine(" self.timeout = reactor.callLater(0, self.startTimerExpired, \"graph\")");
+ file.AddLine(" ");
+ file.AddLine(" def startTimerExpired(self, data):");
+ file.AddLine(" if data == \"graph\": ");
+ file.AddLine(" self.connectionMade = True ");
+ file.AddLine(" if data == \"connected\": ");
+ file.AddLine(" self.graphSet = True; ");
+ file.AddLine(" if self.graphSet and self.connectionMade:");
+ file.AddLine(" print \"start processing now \" ");
+ file.AddLine(" ");
+ file.AddLine(" def startWorkNow(): ");
file.AddLine(" sTuple = \"(\" + self.quote + self.firstNode + self.quote + \", 0, \" +self.quote + \"Start_Processing\" + self.quote + \")\"");
file.AddLine(" self.DoWork(eval(sTuple))");
file.AddLine(" ");
@@ -366,29 +343,65 @@
file.AddLine(" while self.keepGoing:");
file.AddLine(" command = \"self.\" + str(c) + \"(\" + str(sTuple) + \")\"");
file.AddLine(" a,b,c = sTuple = eval(command)");
- file.AddLine(" ");
- file.AddLine(" ");
+ file.AddLine(" ");
+ file.AddLine(" def connectionMade(self): ");
+ file.AddLine(" self.myId = \"\" ");
+ file.AddLine(" self.countReceived = 0 ");
+ file.AddLine(" self.transport.write(\"?\\0\") ");
+ file.AddLine(" self.transport.write(\"whoami\\0\");");
+ file.AddLine(" self.colonChar = \':\' ");
+ file.AddLine(" ");
+ file.AddLine(" def connectionLost(self, reason): ");
+ file.AddLine(" print \"connection lost\" ");
+ file.AddLine(" ");
+ file.AddLine(" def dataReceived(self, data): ");
+ file.AddLine(" ssdata = str(data).split(\'\\0\') ");
+ file.AddLine(" for oneMessage in ssdata: ");
+ file.AddLine(" self.countReceived = self.countReceived + 1");
+ file.AddLine(" if self.countReceived == 1: ");
+ file.AddLine(" self.myId = oneMessage; ");
+ file.AddLine(" self.timeout2 = reactor.callLater(0, self.startTimerExpired, \"connected\")");
+ file.AddLine(" else: ");
+ file.AddLine(" self.processReceivedMessage(oneMessage)");
+ file.AddLine(" ");
+ file.AddLine(" def replyNow(self, data):");
+ file.AddLine(" self.transport.write(self.tstring) ");
+ file.AddLine(" ");
+ file.AddLine(" ");
-
-
- for (int i = 0; i < DndShape::KnownShapes; i++)
- shapeInitialised[i] = false;
-
- it = begin();
- while (it != end()) {
- DndShape *thisShape = it->second;
- if (!shapeInitialised[thisShape->GetKind()]) {
- shapeInitialised[thisShape->GetKind()] = true;
+ for (int i = 0; i < DndShape::KnownShapes; i++) {
+ DndShape *thisShape = DndShape::Construct((DndShape::Kind)i);
+ if (thisShape == NULL)
+ continue;
bool writeOk = thisShape->WriteSystemCode(file);
+ delete thisShape;
if (!writeOk)
- return false;
- }
- it++;
+ return false;
}
- file.AddLine("a=Controller()");
-
-
+ file.AddLine(" ");
+ file.AddLine(" def processReceivedMessage(self, thisMessage): ");
+ file.AddLine(" print \"Received \", thisMessage ");
+ file.AddLine(" ");
+
+ file.AddLine("class MyFactory(protocol.ClientFactory): ");
+ file.AddLine(" protocol = Controller ");
+ file.AddLine(" ");
+ file.AddLine(" def clientConnectionFailed(self, connector, reason): ");
+ file.AddLine(" print \"Connection failed - goodbye!\" ");
+ file.AddLine(" reactor.stop() ");
+ file.AddLine(" ");
+ file.AddLine(" def clientConnectionLost(self, connector, reason): ");
+ file.AddLine(" print \"Connection lost - goodbye!\" ");
+ file.AddLine(" reactor.stop() ");
+ file.AddLine(" ");
+ file.AddLine(" def setGraphData(self, graphFile): ");
+ file.AddLine(" protocol.setGraphData(graphFile) ");
+ file.AddLine(" ");
+ file.AddLine("f = MyFactory() ");
+ file.AddLine("f.setGraphData(\"a_graph\") ");
+ file.AddLine("reactor.connectTCP(\"localhost\", 5000, f) ");
+ file.AddLine("reactor.run() ");
file.AddLine(" ");
file.Write();
return true;
Added: sofaswitch/trunk/callflow/src/shapeselect.cpp
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/src/shapeselect.cpp Thu Sep 7 01:14:21 2006
@@ -0,0 +1,74 @@
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+#include <wx/textfile.h>
+#include <wx/tokenzr.h>
+#include "shapelist.h"
+
+
+#include "shapeselect.h"
+
+
+/////////////////////////////////////////////////////////////////////////////
+DndShapeSelect::DndShapeSelect()
+ : DndShape(Select)
+{
+ SetSelected();
+ wxSize newSize(0, 0);
+ SetSize(newSize);
+}
+
+void DndShapeSelect::DrawSelected(wxDC & dc)
+{
+ dc.SetBrush(wxBrush(*wxBLUE, wxTRANSPARENT));
+ dc.SetPen(*wxBLUE);
+ dc.DrawRoundedRectangle(m_rect.x, m_rect.y, m_rect.GetWidth(), m_rect.GetHeight(), 10);
+
+ dc.SetBrush(wxBrush(*wxBLACK, wxSOLID) );
+}
+
+
+void DndShapeSelect::AdjustPosition(wxPoint &moveSize)
+{
+ m_rect.Offset(moveSize);
+}
+
+
+void DndShapeSelect::SetOtherCorner(wxPoint & newPosition)
+{
+ wxPoint topLeft;
+ wxSize newSize;
+
+ if (newPosition.x > firstCorner.x) {
+ topLeft.x = firstCorner.x;
+ newSize.SetWidth(newPosition.x - firstCorner.x);
+ } else {
+ topLeft.x = newPosition.x;
+ newSize.SetWidth(firstCorner.x - newPosition.x);
+ }
+
+ if (newPosition.y > firstCorner.y) {
+ topLeft.y = firstCorner.y;
+ newSize.SetHeight(newPosition.y - firstCorner.y);
+ } else {
+ topLeft.y = newPosition.y;
+ newSize.SetHeight(firstCorner.y - newPosition.y);
+ }
+ // printf("Set other corner, move size to be %d %d\n", newSize.GetWidth(), newSize.GetHeight());
+ SetSize(newSize);
+ DndShape::SetPosition(topLeft);
+}
+
+
+void DndShapeSelect::SetPosition(wxPoint & newPosition)
+{
+ firstCorner = newPosition;
+ DndShape::SetPosition(newPosition);
+}
Added: sofaswitch/trunk/callflow/src/shapeselect.h
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/src/shapeselect.h Thu Sep 7 01:14:21 2006
@@ -0,0 +1,51 @@
+#ifndef SHAPE_SELECT_H
+#define SHAPE_SELECT_H
+#include "dnd.h"
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/**Define a shape to indicate the region on the screen we have
+ selected. Store values for size, location, input & output points.
+ This instance has the ability to draw this shape to a specified
+ location on the canvas */
+class DndShapeSelect : public DndShape
+{
+public:
+ /**Construtor, Define this shape in terms of size and points etc */
+ DndShapeSelect();
+
+ /**Destroy this shape, and log it */
+ virtual ~DndShapeSelect()
+ {
+ }
+
+ /**Write the python code generic to this "Shape Select" shape */
+ virtual bool WriteSystemCode(wxTextFile & file) { }
+
+ /**Draw this shape (which is a rectangle) in a selected fashion to
+ the screen. */
+ virtual void DrawSelected(wxDC &dc);
+
+ /**Set the location o the other corner of this rectangle. One corner has
+ already been specified and is stored in m_pos - now do the other corner.*/
+ void SetOtherCorner(wxPoint & newPosition);
+
+ /** Used to report the name of this particular class. */
+ static wxString GetKindName() { return wxString("Select"); }
+
+ /**Mark this shape as having a top left postion as determined by the parameter */
+ virtual void SetPosition(wxPoint & newPosition);
+
+ /**Modify the location of this shape by the specified delta. This is used when
+ the user is dragging this selecting region across the screen */
+ virtual void AdjustPosition(wxPoint &moveSize);
+
+ protected:
+ /**This is the location of the very first point marked for this
+ shape. From now on, we will make the location of the other
+ corner. */
+ wxPoint firstCorner;
+};
+
+
+
+#endif // SHAPE_SELECT_H
Added: sofaswitch/trunk/callflow/src/startfor.cpp
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/src/startfor.cpp Thu Sep 7 01:14:21 2006
@@ -0,0 +1,138 @@
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+#include <wx/textfile.h>
+#include <wx/tokenzr.h>
+#include "shapelist.h"
+
+
+#include "startfor.h"
+
+
+/////////////////////////////////////////////////////////////////////////////
+DndShapeStartFor::DndShapeStartFor()
+ : DndShape(StartFor)
+{
+ wxSize newSize(50, 50);
+ SetSize(newSize);
+
+ relInputPoints.Add(32, 0);
+ relInputPoints.Add(0, 25);
+
+ relOutputPoints.Add(32, 50);
+ AdjustIoPoints();
+
+ displayData[displayData.size()] =
+ InformationSection(wxT("Initialise"), wxT("i = 0"));
+
+ displayData[displayData.size()] =
+ InformationSection(wxT("Test for Termination"), wxT("i < loops"));
+
+ displayData[displayData.size()] =
+ InformationSection(wxT("Increment"), wxT("i++"));
+}
+
+void DndShapeStartFor::Draw(wxDC& dc)
+{
+ DrawCompileError(dc);
+ dc.SetPen(*wxBLACK_PEN);
+
+ wxPoint tm(m_rect.x + 32, m_rect.y);
+ wxPoint tm1(tm.x, m_rect.y + 15);
+
+ wxPoint lm(m_rect.x, m_rect.y + 25);
+ wxPoint lm1(m_rect.x + 15, lm.y);
+
+ wxPoint bm(tm.x, m_rect.y + 35);
+ wxPoint bm1(tm.x, m_rect.y + 50);
+
+ wxString text("For");
+ dc.SetFont(*wxITALIC_FONT);
+ wxCoord w, h;
+ dc.GetTextExtent(text, &w, &h);
+ int xPos = m_rect.x + 15 + ((35 - w)/2);
+ int yPos = m_rect.y + 15 + ((20 - h)/2);
+ dc.DrawText(text, xPos, yPos);
+ DrawBox(dc, 15, 15, 35, 20);
+ dc.DrawLine(tm, tm1);
+ dc.DrawLine(lm, lm1);
+ dc.DrawLine(bm, bm1);
+
+
+ DrawArrow(dc, tm1, ArrowDown, InputPointConnected(0)? Connected : Loose);
+ DrawArrow(dc, lm1, ArrowRight, InputPointConnected(1)? Connected : Loose);
+ DrawArrow(dc, bm1, ArrowDown, OutputPointConnected(0) ? Connected : Loose);
+
+ DndShape::Draw(dc); // Draw the selected overlay if required.
+}
+
+
+bool DndShapeStartFor::WriteSystemCode(wxTextFile & file)
+{
+ file.AddLine(" def Start_For(self, aTuple): ");
+ file.AddLine(" a,b,c = aTuple");
+
+ file.AddLine(" if b==0:");
+ file.AddLine(" exec(self.data[a][\"Initialise\"])");
+ file.AddLine(" else:");
+ file.AddLine(" exec(self.data[a][\"Increment\"])");
+ file.AddLine(" ");
+ file.AddLine(" if eval(self.data[a][\"Test\"]):");
+ file.AddLine(" return self.data[a][\"Output\"]");
+ file.AddLine(" ");
+ file.AddLine(" next = self.data[a][\"EndForLoop\"]");
+ file.AddLine(" return self.data[next][\"AllDone\"]");
+ file.AddLine(" ");
+
+ return true;
+}
+
+bool DndShapeStartFor::WriteThisShapeInfo(wxTextFile & file)
+{
+ file.AddLine(wxString::Format(" \"%s\" : { ", GetKey().c_str()));
+
+ file.AddLine(wxString::Format(" \"Initialise\" : "));
+ file.AddLine(wxString::Format(" \"%s\", ", displayData[1].data.c_str()));
+
+ file.AddLine(wxString::Format(" \"Test\" : "));
+ file.AddLine(wxString::Format(" \"%s\", ", displayData[2].data.c_str()));
+
+ file.AddLine(wxString::Format(" \"Increment\" : "));
+ file.AddLine(wxString::Format(" \"%s\", ", displayData[3].data.c_str()));
+
+ wxNode *outputNode = (wxNode *)GetOutputPoints().GetFirst();
+ const wxString & outputLabel = ((LabelledPoint *)outputNode->GetData())->GetFullLabel();
+
+ file.AddLine(wxString::Format(" \"Output\" : "));
+ file.AddLine(wxString::Format(" %s, ", outputLabel.c_str()));
+
+ /**This is the identity of the node at the bottom of the for loop. We have to jump
+ to this node on failing the test.*/
+ file.AddLine(wxString::Format(" \"EndForLoop\" : "));
+ file.AddLine(wxString::Format(" \"%s\", ", endForLoop.c_str()));
+
+ file.AddLine(wxString::Format(" },"));
+
+ return true;
+}
+
+bool DndShapeStartFor::SearchOtherNodes(const MyListShapesExtended &allCurrentShapes)
+{
+ MyListShapes::const_iterator it = allCurrentShapes.begin();
+ while (it != allCurrentShapes.end()) {
+ DndShape *oneShape = it->second;
+ if (oneShape->LinkedTo(EndFor, GetKey(), 0)) {
+ endForLoop = oneShape->GetKey();
+ return true;
+ }
+ it++;
+ }
+ return false;
+}
Added: sofaswitch/trunk/callflow/src/startfor.h
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/src/startfor.h Thu Sep 7 01:14:21 2006
@@ -0,0 +1,49 @@
+#ifndef START_FOR_H
+
+#define START_FOR_H
+
+#include "dnd.h"
+
+//////////////////////////////////////////////////////////////////////
+/**Define a shape to indicate the start of a foor loop. Store values
+ for size, location, input & output points. This instance has the
+ ability to draw this shape to a specified location on the canvas */
+class DndShapeStartFor : public DndShape
+{
+public:
+ /**Construtor, Define this shape in terms of size and points etc */
+ DndShapeStartFor();
+
+ /**Destroy this shape, and log it */
+ virtual ~DndShapeStartFor()
+ {
+ }
+
+ /**Draw this particular shape to the screen..*/
+ virtual void Draw(wxDC& dc);
+
+ /** Used to report the name of this particular class. */
+ static wxString GetKindName() { return wxString("Start For"); }
+
+ /**Write the code generic to this StartFor shape */
+ virtual bool WriteSystemCode(wxTextFile & file);
+
+ /**Write the dictionary containing relevant points for this shape */
+ virtual bool WriteThisShapeInfo(wxTextFile & file);
+
+ /**As in the case of the Start_For -- End_For pairing, there are times when
+ a node, to compile correctly, has to search the list of all other nodes.
+ This method is provided as a means for one node to search all other nodes
+
+ return true/false depending on if it satisfied by the search.*/
+ virtual bool SearchOtherNodes(const MyListShapesExtended & allCurrentShapes);
+
+ protected:
+ /**The unique key of the end_for structure, who is at the end of
+ the loop we have started */
+ wxString endForLoop;
+
+};
+
+
+#endif
Added: sofaswitch/trunk/callflow/src/starthere.cpp
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/src/starthere.cpp Thu Sep 7 01:14:21 2006
@@ -0,0 +1,72 @@
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+#include <wx/textfile.h>
+#include <wx/tokenzr.h>
+#include "shapelist.h"
+
+
+#include "starthere.h"
+
+
+/////////////////////////////////////////////////////////////////////////////
+DndShapeStartHere::DndShapeStartHere()
+ : DndShape(StartHere)
+{
+ wxSize newSize(50, 50);
+ SetSize(newSize);
+
+ relOutputPoints.Add(25, 50);
+ AdjustIoPoints();
+}
+
+void DndShapeStartHere::Draw(wxDC& dc)
+{
+ DrawCompileError(dc);
+ dc.SetPen(*wxBLACK_PEN);
+
+ wxPoint p1(m_rect.GetPosition());
+ wxPoint pA(p1.x + 25, p1.y + 15);
+ wxPoint pB(p1.x + 25, p1.y + 50);
+
+ DrawBox(dc, 0, 0, 50, 15);
+ DrawBox(dc, 0, 15, 20, 20);
+ DrawBox(dc, 30, 15, 20, 20);
+
+ dc.DrawLine(pA, pB);
+ DrawArrow(dc, pB, ArrowDown, OutputPointConnected(0) ? Connected : Loose);
+
+
+ DndShape::Draw(dc);
+}
+
+bool DndShapeStartHere::WriteSystemCode(wxTextFile & file)
+{
+ file.AddLine(" def Start_Processing(self, aTuple): ");
+ file.AddLine(" id,y,z = aTuple");
+ file.AddLine(" return self.data[id][\"Output\"]");
+ file.AddLine("");
+ return true;
+}
+
+bool DndShapeStartHere::WriteThisShapeInfo(wxTextFile & file)
+{
+ file.AddLine(wxString::Format(" \"%s\" : { ", GetKey().c_str()));
+
+ wxNode *outputNode = (wxNode *)GetOutputPoints().GetFirst();
+ const wxString & outputLabel = ((LabelledPoint *)outputNode->GetData())->GetFullLabel();
+
+ file.AddLine(wxString::Format(" \"Output\" : "));
+ file.AddLine(wxString::Format(" %s, ", outputLabel.c_str()));
+
+ file.AddLine(wxString::Format(" },"));
+
+ return true;
+}
Added: sofaswitch/trunk/callflow/src/starthere.h
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/src/starthere.h Thu Sep 7 01:14:21 2006
@@ -0,0 +1,34 @@
+#ifndef START_HERE_H
+#define START_HERE_H
+
+#include "dnd.h"
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+/**Define a start shape. Store values for size, location, input & output points.
+ This instance has the ability to draw this shape to a specified location on the canvas */
+class DndShapeStartHere : public DndShape
+{
+public:
+ /**Construtor, Define this shape in terms of size and points etc */
+ DndShapeStartHere();
+
+ /**Destroy this shape, and log it */
+ virtual ~DndShapeStartHere()
+ {
+ }
+
+ /**Draw this particular shape to the screen..*/
+ virtual void Draw(wxDC& dc);
+
+ /** Used to report the name of this particular class. */
+ static wxString GetKindName() { return wxString("Start Processing"); }
+
+ /**Write the code generic to this StartHere shape */
+ virtual bool WriteSystemCode(wxTextFile & file);
+
+ /**Write the dictionary containing relevant points for this shape */
+ virtual bool WriteThisShapeInfo(wxTextFile & file);
+};
+
+
+#endif
Added: sofaswitch/trunk/callflow/src/timer.cpp
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/src/timer.cpp Thu Sep 7 01:14:21 2006
@@ -0,0 +1,111 @@
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+#include <wx/textfile.h>
+#include <wx/tokenzr.h>
+#include "shapelist.h"
+
+
+#include "timer.h"
+
+
+/////////////////////////////////////////////////////////////////////////////
+DndShapeTimer::DndShapeTimer()
+ : DndShape(Timer)
+{
+ wxSize newSize(50, 50);
+ SetSize(newSize);
+
+ relInputPoints.Add(25, 0);
+ relOutputPoints.Add(25, 50);
+
+ displayData[displayData.size()] =
+ InformationSection(wxT("Timer period"), wxT("self.period = 2000"));
+
+ displayData[displayData.size()] =
+ InformationSection(wxT("Timer label"), wxT("self.label=\"first\""));
+
+ AdjustIoPoints();
+}
+
+wxPoint DndShapeTimer::HourLocation(int hour, int radius)
+{
+ double angle = (2 * M_PI * (hour + 9))/12.0;
+
+ wxPoint result(25 + m_rect.x + (int)(radius * cos(angle)), 25 + m_rect.y + (int)(radius * sin(angle)));
+ return result;
+}
+
+void DndShapeTimer::Draw(wxDC& dc)
+{
+ DrawCompileError(dc);
+
+
+ wxPoint p1(m_rect.GetPosition());
+ wxPoint pA(p1.x + 25, p1.y + 0);
+ wxPoint pE(p1.x + 25, p1.y + 10);
+ wxPoint pB(p1.x + 25, p1.y + 13);
+ wxPoint pC(p1.x + 25, p1.y + 37);
+ wxPoint pD(p1.x + 25, p1.y + 50);
+ wxPoint pM(p1.x + 25, p1.y + 25);
+
+ DrawArrow(dc, pE, ArrowDown, InputPointConnected(0) ? Connected : Loose);
+ DrawArrow(dc, pD, ArrowDown, OutputPointConnected(0) ? Connected : Loose);
+ dc.DrawLine(pA, pB);
+ dc.DrawLine(pC, pD);
+
+ dc.SetBrush(wxBrush(*wxBLACK, wxTRANSPARENT) );
+ dc.DrawCircle(pM, 12);
+ dc.SetBrush(wxBrush(*wxBLACK, wxSOLID) );
+
+ for(int i = 0; i < 12; i++)
+ dc.DrawLine(HourLocation(i, 10), HourLocation(i, 12));
+
+ dc.DrawLine(HourLocation(2, 10), HourLocation(0, 0));
+ dc.DrawLine(HourLocation(7, 6), HourLocation(0, 0));
+
+ DndShape::Draw(dc);
+}
+
+bool DndShapeTimer::WriteSystemCode(wxTextFile & file)
+{
+ file.AddLine(" def Timer(self, sTuple): ");
+ file.AddLine(" a,b,c = sTuple");
+ file.AddLine(" return data[a][\"Output\"]");
+ file.AddLine("");
+
+ return true;
+}
+
+bool DndShapeTimer::WriteThisShapeInfo(wxTextFile & file)
+{
+ file.AddLine(wxString::Format("\"%s\" : { ", GetKey().c_str()));
+
+ wxNode *inputNode = (wxNode *)GetInputPoints().GetFirst();
+ const wxString & inputLabel = ((LabelledPoint *)inputNode->GetData())->GetFullLabel();
+ file.AddLine(wxString::Format(" \"Input\" : "));
+ file.AddLine(wxString::Format(" %s, ", inputLabel.c_str()));
+
+ wxNode *outputNode = (wxNode *)GetOutputPoints().GetFirst();
+ const wxString & outputLabel = ((LabelledPoint *)outputNode->GetData())->GetFullLabel();
+ file.AddLine(wxString::Format(" \"Output\" : "));
+ file.AddLine(wxString::Format(" %s, ", outputLabel.c_str()));
+
+ file.AddLine(wxString::Format(" \"Timer period\" : "));
+ file.AddLine(wxString::Format(" \"%s\", ", displayData[1].data.c_str()));
+
+ file.AddLine(wxString::Format(" \"Timer label\" : "));
+ file.AddLine(wxString::Format(" \"%s\", ", displayData[2].data.c_str()));
+
+ file.AddLine(wxString::Format(" },"));
+
+ return true;
+}
+
Added: sofaswitch/trunk/callflow/src/timer.h
==============================================================================
--- (empty file)
+++ sofaswitch/trunk/callflow/src/timer.h Thu Sep 7 01:14:21 2006
@@ -0,0 +1,43 @@
+#ifndef SHAPE_TIMER_H
+#define SHAPE_TIMER_H
+
+#include "dnd.h"
+
+//////////////////////////////////////////////////////////////////////////
+/**Define a shape to indicate the setting of a timer. This timer will run for
+ some number of milliseconds
+ */
+class DndShapeTimer : public DndShape
+{
+public:
+ /**Construtor, Define this shape in terms of size and points etc */
+ DndShapeTimer();
+
+ /**Destroy this shape, and log it */
+ virtual ~DndShapeTimer()
+ {
+ }
+
+ /**Draw this particular shape to the screen..*/
+ virtual void Draw(wxDC& dc);
+
+ /** Used to report the name of this particular class. */
+ static wxString GetKindName() { return wxString("Timer"); }
+
+ /**Write the code generic to this End For loop shape */
+ virtual bool WriteSystemCode(wxTextFile & file);
+
+ /**Write the dictionary containing relevant points for this shape */
+ virtual bool WriteThisShapeInfo(wxTextFile & file);
+
+ protected:
+ /**When drawing the hour marks on the clock, determine the location of these hour marks.
+ The supplied parameter specifies the radius, which hour it is (a value of 0 == 12).
+ Returns the wxPoint value, after adding the offset of this icons location */
+ wxPoint HourLocation(int hour, int radius);
+};
+
+
+
+
+#endif //SHAPE_TIMER_H
1
0