- if (strcmp(what, "declare") == 0) {
- instr_new_user_link_variable_type (variable, NULL);
- } else{
- char *variable_id = instr_variable_type(variable, resource);
- char *resource_id = instr_resource_type(resource);
- if (strcmp(what, "set") == 0) {
- pajeSetVariable(time, variable_id, resource_id, valuestr);
- } else if (strcmp(what, "add") == 0) {
- pajeAddVariable(time, variable_id, resource_id, valuestr);
- } else if (strcmp(what, "sub") == 0) {
- pajeSubVariable(time, variable_id, resource_id, valuestr);
- }
+ switch (what){
+ case INSTR_US_DECLARE:
+ instr_new_user_variable_type (father_type, variable, NULL);
+ break;
+ case INSTR_US_SET:
+ {
+ container_t container = getContainerByName(resource);
+ type_t type = getVariableType (variable, NULL, container->type);
+ new_pajeSetVariable(time, container, type, value);
+ break;
+ }
+ case INSTR_US_ADD:
+ {
+ container_t container = getContainerByName(resource);
+ type_t type = getVariableType (variable, NULL, container->type);
+ new_pajeAddVariable(time, container, type, value);
+ break;
+ }
+ case INSTR_US_SUB:
+ {
+ container_t container = getContainerByName(resource);
+ type_t type = getVariableType (variable, NULL, container->type);
+ new_pajeSubVariable(time, container, type, value);
+ break;
+ }
+ default:
+ //TODO: launch exception
+ break;