int conSetupParam(Param *my, const char *setup)
{
+ int retVal = 0;
+ int status = ECA_NORMAL;
#if ( _POSIX_VERSION < 199506L )
pthread_mutexattr_t *attr;
#endif
((CaParam *) (my->specParam))->cache = Tcl_CreateInterp();
- return 0;
+ if((status = ca_task_initialize()) != ECA_NORMAL) {
+ Param_strerror((Param *) my, ca_message(status));
+ retVal = -1;
+ }
+
+ return retVal;
}
int conParam(Param *my)
void desParam(Param *my)
{
+ ca_task_exit();
+
Tcl_DeleteInterp(((CaParam *) (my->specParam))->cache);
pthread_mutex_destroy(((CaParam *) (my->specParam))->cacheLock);
free(((CaParam *) (my->specParam))->cacheLock);
*rows = 0;
if(Param_getIntArrayCache(my, name, idx, maxrows, rows, val) || (*rows != maxrows)) {
- if((status = ca_task_initialize()) != ECA_NORMAL) {
- Param_strerror((Param *) my, ca_message(status));
- retVal = -1;
- }
-
pPVName = malloc((strlen("HAD:PI:") + (my->setup == NULL ? 0 : strlen(my->setup) + 1) + strlen(name) + 1 + strlen(idx) + 1) * sizeof(char));
Param_returnPVName(my, "PI", name, idx, pPVName);
} else if (status != ECA_NORMAL) {
Param_strerror((Param *) my, ca_message(status));
retVal = -1;
- }
-
- if((status = ca_pend_io(TIMEOUT)) != ECA_NORMAL) {
- Param_strerror((Param *) my, ca_message(status));
- found = 0;
- retVal = 0;
- }
- if(found == 1) {
- ParamIntResult resultS, *result = &resultS;
- result->val = val;
- result->rows = rows;
- result->maxrows = maxrows;
- result->my = my;
- result->retVal = &retVal;
-
- status = ca_array_get_callback(ca_field_type(chan), ca_element_count(chan), chan, Param_copyIntsToAllocMem, result);
- Param_strerror((Param *) my, ca_message(status));
+ } else {
- if((status = ca_pend_event(TIMEOUT)) == ECA_TIMEOUT) {
+ if((status = ca_pend_io(TIMEOUT)) != ECA_NORMAL) {
Param_strerror((Param *) my, ca_message(status));
- } else if (status != ECA_NORMAL) {
+ found = 0;
+ retVal = 0;
+ }
+ if(found == 1) {
+ ParamIntResult resultS, *result = &resultS;
+ result->val = val;
+ result->rows = rows;
+ result->maxrows = maxrows;
+ result->my = my;
+ result->retVal = &retVal;
+
+ status = ca_array_get_callback(ca_field_type(chan), ca_element_count(chan), chan, Param_copyIntsToAllocMem, result);
Param_strerror((Param *) my, ca_message(status));
+
+ if((status = ca_pend_event(TIMEOUT)) != ECA_NORMAL) {
+ Param_strerror((Param *) my, ca_message(status));
+ }
}
}
free(pPVName);
- if((status = ca_task_exit()) != ECA_NORMAL) {
- Param_strerror((Param *) my, ca_message(status));
- }
if(maxrows == 1) {
Param_storeIntCache(my, name, idx, *val);
} else {
*rows = 0;
if(Param_getStringArrayCache(my, name, idx, maxrows, rows, val) || (*rows != maxrows)) {
- if((status = ca_task_initialize()) != ECA_NORMAL) {
- Param_strerror((Param *) my, ca_message(status));
- retVal = -1;
- }
-
pPVName = malloc((strlen("HAD:PS:") + (my->setup == NULL ? 0 : strlen(my->setup) + 1) + strlen(name) + 1 + strlen(idx) + 1) * sizeof(char));
Param_returnPVName(my, "PS", name, idx, pPVName);
} else if (status != ECA_NORMAL) {
Param_strerror((Param *) my, ca_message(status));
retVal = -1;
- }
-
- if((status = ca_pend_io(TIMEOUT)) != ECA_NORMAL) {
- Param_strerror((Param *) my, ca_message(status));
- found = 0;
- retVal = 0;
- }
- if(found == 1) {
- ParamStringResult resultS, *result = &resultS;
- result->val = val;
- result->rows = rows;
- result->maxrows = maxrows;
- result->my = my;
- result->retVal = &retVal;
-
- status = ca_array_get_callback(ca_field_type(chan), ca_element_count(chan), chan, Param_copyStringsToAllocMem, result);
- Param_strerror((Param *) my, ca_message(status));
+ } else {
- if((status = ca_pend_event(TIMEOUT)) == ECA_TIMEOUT) {
+ if((status = ca_pend_io(TIMEOUT)) != ECA_NORMAL) {
Param_strerror((Param *) my, ca_message(status));
- } else if (status != ECA_NORMAL) {
+ found = 0;
+ retVal = 0;
+ }
+ if(found == 1) {
+ ParamStringResult resultS, *result = &resultS;
+ result->val = val;
+ result->rows = rows;
+ result->maxrows = maxrows;
+ result->my = my;
+ result->retVal = &retVal;
+
+ status = ca_array_get_callback(ca_field_type(chan), ca_element_count(chan), chan, Param_copyStringsToAllocMem, result);
Param_strerror((Param *) my, ca_message(status));
+
+ if((status = ca_pend_event(TIMEOUT)) != ECA_NORMAL) {
+ Param_strerror((Param *) my, ca_message(status));
+ }
}
- }
- if((status = ca_clear_channel(chan)) != ECA_NORMAL) {
- Param_strerror((Param *) my, ca_message(status));
+ if((status = ca_clear_channel(chan)) != ECA_NORMAL) {
+ Param_strerror((Param *) my, ca_message(status));
+ }
}
free(pPVName);
- if((status = ca_task_exit()) != ECA_NORMAL) {
- Param_strerror((Param *) my, ca_message(status));
- }
if(maxrows == 1) {
Param_storeStringCache(my, name, idx, *val);
} else {
*rows = 0;
if(Param_getFilenameArrayCache(my, name, idx, maxrows, rows, val) || (*rows != maxrows)) {
- if((status = ca_task_initialize()) != ECA_NORMAL) {
- Param_strerror((Param *) my, ca_message(status));
- retVal = -1;
- }
-
pPVName = malloc((strlen("HAD:PF:") + (my->setup == NULL ? 0 : strlen(my->setup) + 1) + strlen(name) + 1 + strlen(idx) + 1) * sizeof(char));
Param_returnPVName(my, "PF", name, idx, pPVName);
} else if (status != ECA_NORMAL) {
Param_strerror((Param *) my, ca_message(status));
retVal = -1;
- }
-
- if((status = ca_pend_io(TIMEOUT)) != ECA_NORMAL) {
- Param_strerror((Param *) my, ca_message(status));
- found = 0;
- retVal = 0;
- }
- if(found == 1) {
- ParamStringResult resultS, *result = &resultS;
- result->val = val;
- result->rows = rows;
- result->maxrows = maxrows;
- result->my = my;
- result->retVal = &retVal;
-
- status = ca_array_get_callback(ca_field_type(chan), ca_element_count(chan), chan, Param_copyStringsToAllocMem, result);
- Param_strerror((Param *) my, ca_message(status));
+ } else {
- if((status = ca_pend_event(TIMEOUT)) == ECA_TIMEOUT) {
+ if((status = ca_pend_io(TIMEOUT)) != ECA_NORMAL) {
Param_strerror((Param *) my, ca_message(status));
- } else if (status != ECA_NORMAL) {
+ found = 0;
+ retVal = 0;
+ }
+ if(found == 1) {
+ ParamStringResult resultS, *result = &resultS;
+ result->val = val;
+ result->rows = rows;
+ result->maxrows = maxrows;
+ result->my = my;
+ result->retVal = &retVal;
+
+ status = ca_array_get_callback(ca_field_type(chan), ca_element_count(chan), chan, Param_copyStringsToAllocMem, result);
Param_strerror((Param *) my, ca_message(status));
+
+ if((status = ca_pend_event(TIMEOUT)) != ECA_NORMAL) {
+ Param_strerror((Param *) my, ca_message(status));
+ }
}
}
free(pPVName);
- if((status = ca_task_exit()) != ECA_NORMAL) {
- Param_strerror((Param *) my, ca_message(status));
- }
if(maxrows == 1) {
Param_storeStringCache(my, name, idx, *val);
} else {
chid chan;
char *pPVName;
- if((status = ca_task_initialize()) != ECA_NORMAL) {
- Param_strerror((Param *) my, ca_message(status));
- retVal = -1;
- }
-
pPVName = malloc((strlen("HAD:PB:") + (my->setup == NULL ? 0 : strlen(my->setup) + 1) + strlen(name) + 1 + strlen(idx) + 1) * sizeof(char));
Param_returnPVName(my, "PB", name, idx, pPVName);
} else if (status != ECA_NORMAL) {
Param_strerror((Param *) my, ca_message(status));
retVal = -1;
- }
-
- if((status = ca_pend_io(TIMEOUT)) != ECA_NORMAL) {
- Param_strerror((Param *) my, ca_message(status));
- found = 0;
- retVal = 0;
- }
- if((*val = tmpfile()) == NULL) {
- Param_strerror((Param *) my, strerror(errno));
- found = 0;
- retVal = -1;
- }
+ } else {
- if(found == 1) {
- ParamBlobResult resultS, *result = &resultS;
- result->val = val;
- result->size = size;
- result->my = my;
- result->retVal = &retVal;
+ if((status = ca_pend_io(TIMEOUT)) != ECA_NORMAL) {
+ Param_strerror((Param *) my, ca_message(status));
+ found = 0;
+ retVal = 0;
+ }
+ if((*val = tmpfile()) == NULL) {
+ Param_strerror((Param *) my, strerror(errno));
+ found = 0;
+ retVal = -1;
+ }
- status = ca_array_get_callback(ca_field_type(chan), ca_element_count(chan), chan, Param_copyBlobToAllocMem, result);
- Param_strerror((Param *) my, ca_message(status));
+ if(found == 1) {
+ ParamBlobResult resultS, *result = &resultS;
+ result->val = val;
+ result->size = size;
+ result->my = my;
+ result->retVal = &retVal;
- if((status = ca_pend_event(TIMEOUT)) == ECA_TIMEOUT) {
- Param_strerror((Param *) my, ca_message(status));
- } else if (status != ECA_NORMAL) {
+ status = ca_array_get_callback(ca_field_type(chan), ca_element_count(chan), chan, Param_copyBlobToAllocMem, result);
Param_strerror((Param *) my, ca_message(status));
+
+ if((status = ca_pend_event(TIMEOUT)) != ECA_NORMAL) {
+ Param_strerror((Param *) my, ca_message(status));
+ }
}
}
free(pPVName);
- if((status = ca_task_exit()) != ECA_NORMAL) {
- Param_strerror((Param *) my, ca_message(status));
- }
-
return retVal;
}
chid chan;
char *pPVName;
- if((status = ca_task_initialize()) != ECA_NORMAL) {
- Param_strerror((Param *) my, ca_message(status));
- retVal = -1;
- }
-
pPVName = malloc((strlen("HAD:PI:") + (my->setup == NULL ? 0 : strlen(my->setup) + 1) + strlen(name) + 1 + strlen(idx) + 1) * sizeof(char));
Param_returnPVName(my, "PI", name, idx, pPVName);
} else if (status != ECA_NORMAL) {
Param_strerror((Param *) my, ca_message(status));
retVal = -1;
- }
-
- if((status = ca_pend_io(TIMEOUT)) != ECA_NORMAL) {
- Param_strerror((Param *) my, ca_message(status));
- found = 0;
- retVal = 0;
- }
- if(found == 1) {
- status = ca_put(DBR_LONG, chan, &value);
- Param_strerror((Param *) my, ca_message(status));
+ } else {
- if((status = ca_pend_event(TIMEOUT)) == ECA_TIMEOUT) {
+ if((status = ca_pend_io(TIMEOUT)) != ECA_NORMAL) {
Param_strerror((Param *) my, ca_message(status));
- } else if (status != ECA_NORMAL) {
+ found = 0;
+ retVal = 0;
+ }
+ if(found == 1) {
+ status = ca_put(DBR_LONG, chan, &value);
Param_strerror((Param *) my, ca_message(status));
+
+ if((status = ca_pend_event(TIMEOUT)) != ECA_NORMAL) {
+ Param_strerror((Param *) my, ca_message(status));
+ }
}
- }
- if((status = ca_clear_channel(chan)) != ECA_NORMAL) {
- Param_strerror((Param *) my, ca_message(status));
+ if((status = ca_clear_channel(chan)) != ECA_NORMAL) {
+ Param_strerror((Param *) my, ca_message(status));
+ }
}
free(pPVName);
- if((status = ca_task_exit()) != ECA_NORMAL) {
- Param_strerror((Param *) my, ca_message(status));
- }
-
return retVal;
}
chid chan;
char *pPVName;
- if((status = ca_task_initialize()) != ECA_NORMAL) {
- Param_strerror((Param *) my, ca_message(status));
- retVal = -1;
- }
-
pPVName = malloc((strlen("HAD:PS:") + (my->setup == NULL ? 0 : strlen(my->setup) + 1) + strlen(name) + 1 + strlen(idx) + 1) * sizeof(char));
Param_returnPVName(my, "PS", name, idx, pPVName);
} else if (status != ECA_NORMAL) {
Param_strerror((Param *) my, ca_message(status));
retVal = -1;
- }
-
- if((status = ca_pend_io(TIMEOUT)) != ECA_NORMAL) {
- Param_strerror((Param *) my, ca_message(status));
- found = 0;
- retVal = 0;
- }
- if(found == 1) {
- status = ca_put(DBR_STRING, chan, value);
- Param_strerror((Param *) my, ca_message(status));
+ } else {
- if((status = ca_pend_event(TIMEOUT)) == ECA_TIMEOUT) {
+ if((status = ca_pend_io(TIMEOUT)) != ECA_NORMAL) {
Param_strerror((Param *) my, ca_message(status));
- } else if (status != ECA_NORMAL) {
+ found = 0;
+ retVal = 0;
+ }
+ if(found == 1) {
+ status = ca_put(DBR_STRING, chan, value);
Param_strerror((Param *) my, ca_message(status));
+
+ if((status = ca_pend_event(TIMEOUT)) != ECA_NORMAL) {
+ Param_strerror((Param *) my, ca_message(status));
+ }
}
- }
- if((status = ca_clear_channel(chan)) != ECA_NORMAL) {
- Param_strerror((Param *) my, ca_message(status));
+ if((status = ca_clear_channel(chan)) != ECA_NORMAL) {
+ Param_strerror((Param *) my, ca_message(status));
+ }
}
free(pPVName);
- if((status = ca_task_exit()) != ECA_NORMAL) {
- Param_strerror((Param *) my, ca_message(status));
- }
-
return retVal;
}