diff --git a/apps/dsm/DSMCoreModule.cpp b/apps/dsm/DSMCoreModule.cpp index 493f9b77..6692b0c9 100644 --- a/apps/dsm/DSMCoreModule.cpp +++ b/apps/dsm/DSMCoreModule.cpp @@ -913,9 +913,9 @@ EXEC_ACTION_START(SCDIAction) { sc_sess->SET_STRERROR("converting value '"+p+"' to int\n"); EXEC_ACTION_STOP; } - } else if (p.length() > 7 && - p.substr(0, 7) =="(array)") { - p = resolveVars(p.substr(7), sess, sc_sess, event_params); + } else if (p.length() > 8 && + p.substr(0, 8) =="(struct)") { + p = p.substr(8); AmArg var_struct; string varprefix = p+"."; bool has_vars = false; @@ -935,6 +935,21 @@ EXEC_ACTION_START(SCDIAction) { has_vars = true; } di_args.push(var_struct); + } else if (p.length() > 7 && + p.substr(0, 7) =="(array)") { + p = p.substr(7); + di_args.push(AmArg()); + AmArg& var_array = di_args.get(di_args.size()-1); + + unsigned int i=0; + while (true) { + map::iterator it = + sc_sess->var.find(p+"["+int2str(i)+"]"); + if (it == sc_sess->var.end()) + break; + var_array.push(it->second); + i++; + } } else { di_args.push(resolveVars(p, sess, sc_sess, event_params).c_str()); } diff --git a/doc/dsm/dsm_syntax.txt b/doc/dsm/dsm_syntax.txt index ba1e9ef9..af029f3b 100644 --- a/doc/dsm/dsm_syntax.txt +++ b/doc/dsm/dsm_syntax.txt @@ -156,12 +156,18 @@ core actions: * sets $errno (config) DI(factory, function [, params...]) - e.g. DI(factory, function, $var_param, (int)int_param, "$str param", @select_par, ...) + e.g. DI(factory, function, $var_param, (int)int_param, "str param", @select_par, (array)arrayname, (struct)structname, ...) DI(user_timer, setTimer, (int)1, (int)5, @local_tag); + set($sweets.candy="nice"); set($sweets.fruit="superb"); set($sweets.cake.tahini="great"); - DI(myfactory, myfunc, (array)sweets); + DI(myfactory, myfunc, (struct)sweets); + + set($bi[0]="ba"); + set($bi[1]="butzki"); + DI(myfactory, myfunc, (array)bi); + * sets $errno (arg,config) DIgetResult(factory, function, param,...)