Author: sayer
Date: 2009-10-22 01:33:09 +0200 (Thu, 22 Oct 2009)
New Revision: 1553
Modified:
trunk/apps/dsm/DSM.cpp
trunk/apps/dsm/DSM.h
trunk/apps/dsm/DSMStateDiagramCollection.cpp
trunk/apps/dsm/DSMStateDiagramCollection.h
trunk/apps/dsm/etc/dsm.conf
Log:
changed debug log with config option:
# print raw DSM text while loading to debug log?
# debug_raw_dsm=yes
Modified: trunk/apps/dsm/DSM.cpp
===================================================================
--- trunk/apps/dsm/DSM.cpp 2009-10-21 23:13:22 UTC (rev 1552)
+++ trunk/apps/dsm/DSM.cpp 2009-10-21 23:33:09 UTC (rev 1553)
@@ -57,6 +57,7 @@
return _instance;
}
+bool DSMFactory::DebugDSM;
string DSMFactory::InboundStartDiag;
string DSMFactory::OutboundStartDiag;
@@ -179,6 +180,8 @@
prompt_sets[*it] = pc;
}
+ DebugDSM = cfg.getParameter("debug_raw_dsm") == "yes";
+
string DiagPath = cfg.getParameter("diag_path");
if (DiagPath.length() && DiagPath[DiagPath.length()-1] != '/')
DiagPath += '/';
@@ -198,7 +201,7 @@
vector<string> diags_names = explode(LoadDiags, ",");
for (vector<string>::iterator it=
diags_names.begin(); it != diags_names.end(); it++) {
- if (!diags->loadFile(DiagPath+*it+".dsm", *it, ModPath)) {
+ if (!diags->loadFile(DiagPath+*it+".dsm", *it, ModPath, DebugDSM)) {
ERROR("loading %s from %s\n",
it->c_str(), (DiagPath+*it+".dsm").c_str());
return -1;
@@ -545,7 +548,7 @@
vector<string> diags_names = explode(LoadDiags, ",");
for (vector<string>::iterator it=
diags_names.begin(); it != diags_names.end(); it++) {
- if (!new_diags->loadFile(DiagPath+*it+".dsm", *it, ModPath)) {
+ if (!new_diags->loadFile(DiagPath+*it+".dsm", *it, ModPath, DebugDSM)) {
ERROR("loading %s from %s\n",
it->c_str(), (DiagPath+*it+".dsm").c_str());
ret.push(500);
@@ -694,7 +697,7 @@
string dsm_file_name = DiagPath+dsm_name+".dsm";
string res = "OK";
diags_mut.lock();
- if (!diags->loadFile(dsm_file_name, dsm_name, ModPath)) {
+ if (!diags->loadFile(dsm_file_name, dsm_name, ModPath, DebugDSM)) {
ret.push(500);
ret.push("error loading "+dsm_name+" from "+ dsm_file_name);
} else {
@@ -711,7 +714,7 @@
string res = "OK";
diags_mut.lock();
- if (!diags->loadFile(diag_path+dsm_name+".dsm", dsm_name, mod_path)) {
+ if (!diags->loadFile(diag_path+dsm_name+".dsm", dsm_name, mod_path,
DebugDSM)) {
ret.push(500);
ret.push("error loading "+dsm_name+" from "+ diag_path+dsm_name+".dsm");
} else {
Modified: trunk/apps/dsm/DSM.h
===================================================================
--- trunk/apps/dsm/DSM.h 2009-10-21 23:13:22 UTC (rev 1552)
+++ trunk/apps/dsm/DSM.h 2009-10-21 23:33:09 UTC (rev 1553)
@@ -63,6 +63,8 @@
DSMStateDiagramCollection* diags;
AmMutex diags_mut;
+ static bool DebugDSM;
+
static string InboundStartDiag;
static string OutboundStartDiag;
Modified: trunk/apps/dsm/DSMStateDiagramCollection.cpp
===================================================================
--- trunk/apps/dsm/DSMStateDiagramCollection.cpp 2009-10-21 23:13:22 UTC
(rev 1552)
+++ trunk/apps/dsm/DSMStateDiagramCollection.cpp 2009-10-21 23:33:09 UTC
(rev 1553)
@@ -37,7 +37,9 @@
}
bool DSMStateDiagramCollection::loadFile(const string& filename, const string&
name,
- const string& mod_path) {
+ const string& mod_path, bool
debug_dsm) {
+ DBG("loading DSM '%s' from '%s'\n", name.c_str(), filename.c_str());
+
DSMChartReader cr;
ifstream ifs(filename.c_str());
@@ -61,7 +63,9 @@
s += r + "\n";
}
- DBG("dsm text\n------------------\n%s\n------------------\n", s.c_str());
+ if (debug_dsm) {
+ DBG("dsm text\n------------------\n%s\n------------------\n", s.c_str());
+ }
if (!cr.decode(&diags.back(), s, mod_path, this, mods)) {
ERROR("DonkeySM decode script error!\n");
return false;
Modified: trunk/apps/dsm/DSMStateDiagramCollection.h
===================================================================
--- trunk/apps/dsm/DSMStateDiagramCollection.h 2009-10-21 23:13:22 UTC (rev
1552)
+++ trunk/apps/dsm/DSMStateDiagramCollection.h 2009-10-21 23:33:09 UTC (rev
1553)
@@ -43,7 +43,8 @@
DSMStateDiagramCollection();
~DSMStateDiagramCollection();
- bool loadFile(const string& filename, const string& name, const string&
mod_path);
+ bool loadFile(const string& filename, const string& name,
+ const string& mod_path, bool debug_dsm);
void addToEngine(DSMStateEngine* e);
bool hasDiagram(const string& name);
vector<string> getDiagramNames();
Modified: trunk/apps/dsm/etc/dsm.conf
===================================================================
--- trunk/apps/dsm/etc/dsm.conf 2009-10-21 23:13:22 UTC (rev 1552)
+++ trunk/apps/dsm/etc/dsm.conf 2009-10-21 23:33:09 UTC (rev 1553)
@@ -13,6 +13,8 @@
# preload modules which have a preload (init) function
#preload_mods=uri
+# print raw DSM text while loading to debug log?
+# debug_raw_dsm=yes
# DSM to start for in/outbound call if application to execute=dsm
# (from application=xyz in sems.conf, either application=dsm or
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev