From 2e58ba7d15ad22a725f5b96a6362169fedb635cb Mon Sep 17 00:00:00 2001 From: Stefan Sayer Date: Fri, 22 May 2009 17:47:06 +0000 Subject: [PATCH] setVar function (indirection capable) due to messed up set() parameter semantics till set([]=...) available) git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@1407 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- apps/dsm/DSMCoreModule.cpp | 10 ++++++++++ apps/dsm/DSMCoreModule.h | 1 + 2 files changed, 11 insertions(+) diff --git a/apps/dsm/DSMCoreModule.cpp b/apps/dsm/DSMCoreModule.cpp index 1d71e8f2..7d88f3e3 100644 --- a/apps/dsm/DSMCoreModule.cpp +++ b/apps/dsm/DSMCoreModule.cpp @@ -64,6 +64,7 @@ DSMAction* DSMCoreModule::getAction(const string& from_str) { DEF_CMD("disableDTMFDetection", SCDisableDTMFDetection); DEF_CMD("set", SCSetAction); + DEF_CMD("setVar", SCSetVarAction); DEF_CMD("var", SCGetVarAction); DEF_CMD("append", SCAppendAction); DEF_CMD("substr", SCSubStrAction); @@ -332,6 +333,15 @@ EXEC_ACTION_START(SCSetAction) { var_name.c_str(), sc_sess->var[var_name].c_str()); } EXEC_ACTION_END; +CONST_ACTION_2P(SCSetVarAction,'=', false); +EXEC_ACTION_START(SCSetVarAction) { + string var_name = resolveVars(par1, sess, sc_sess, event_params); + sc_sess->var[var_name] = resolveVars(par2, sess, sc_sess, event_params); + DBG("set $%s='%s'\n", + var_name.c_str(), sc_sess->var[var_name].c_str()); +} EXEC_ACTION_END; + + CONST_ACTION_2P(SCGetVarAction,'=', false); EXEC_ACTION_START(SCGetVarAction){ string dst_var_name = (par1.length() && par1[0] == '$')? diff --git a/apps/dsm/DSMCoreModule.h b/apps/dsm/DSMCoreModule.h index 167de682..43ffdd3e 100644 --- a/apps/dsm/DSMCoreModule.h +++ b/apps/dsm/DSMCoreModule.h @@ -80,6 +80,7 @@ DEF_ACTION_2P(SCSetTimerAction); DEF_ACTION_2P(SCLogAction); DEF_ACTION_1P(SCLogVarsAction); DEF_ACTION_2P(SCGetVarAction); +DEF_ACTION_2P(SCSetVarAction); DEF_ACTION_2P(SCPlayFileAction); DEF_ACTION_2P(SCPlayFileFrontAction); DEF_ACTION_2P(SCPostEventAction);