static void Param_copyIntsToAllocMem(struct event_handler_args args)
{
-#if 1
- int i;
-#endif
ParamIntResult *result = args.usr;
-#if 0
dbr_long_t *buffer = (dbr_long_t *) args.dbr;
-#endif
- *(result->rows) = (args.count > result->maxrows) ?
- result->maxrows :
- args.count;
- if(args.type == DBR_LONG && args.status == ECA_NORMAL) {
- memcpy(result->val, (dbr_long_t *) args.dbr, (sizeof(dbr_long_t) * *(result->rows)));
- for(i = 0 ; i < *(result->rows) ; i++) {
-#if 0
- (result->val)[i] = buffer[i];
-#endif
- fprintf(stderr, "val[%d] received: %ld\n", i, (result->val)[i]);
+ if (args.count == 1) {
+ *(result->rows) = 1;
+ if(args.type == DBR_LONG && args.status == ECA_NORMAL) {
+ memcpy(result->val, buffer, sizeof(dbr_long_t));
+ } else {
+ Param_strerror((Param *) result->my, ca_message(args.status));
+ *(result->rows) = 0;
}
} else {
- Param_strerror((Param *) result->my, ca_message(args.status));
- *(result->rows) = 0;
+ if (args.count - 2 <= result->maxrows) {
+ *(result->rows) = args.count - 2;
+ } else {
+ *(result->rows) = result->maxrows;
+ }
+ if(args.type == DBR_LONG && args.status == ECA_NORMAL) {
+ memcpy(result->val, buffer + 2, (sizeof(dbr_long_t) * *(result->rows)));
+ } else {
+ Param_strerror((Param *) result->my, ca_message(args.status));
+ *(result->rows) = 0;
+ }
}
}
if((retVal != 0) || (index == 0) || (index > EPICS_MAX_INDEX)) {
return S_cas_noRead;
} else {
- aitUint32 *ourValue = new aitUint32[index];
- *ourValue = size;
- fread(ourValue + 1, sizeof(aitUint32), index - 1, blob);
+ aitUint32 *intValue = new aitUint32[index];
+ *intValue = size;
+ fread(intValue + 1, sizeof(aitUint32), index - 1, blob);
fclose(blob);
- value.putRef(ourValue);
+ value.putRef(intValue);
}
return S_casApp_success;
if((retVal != 0) || (index == 0) || (index > EPICS_MAX_INDEX)) {
return S_cas_noRead;
} else {
- aitUint32 *ourValue = new aitUint32[index];
- *ourValue = size;
- fread(ourValue + 1, sizeof(aitUint32), index - 1, blob);
+ aitUint32 *intValue = new aitUint32[index];
+ *intValue = size;
+ fread(intValue + 1, sizeof(aitUint32), index - 1, blob);
fclose(blob);
- val = new gddAtomic(gddAppType_value, aitEnumString, 1, index);
+ val = new gddAtomic(gddAppType_value, aitEnumUint32, 1, index);
- val->putRef(ourValue, pDest);
+ val->putRef(intValue, pDest);
}
val->setStat(epicsAlarmNone);
unsigned long int tmp[PARAM_MAX_ARRAY_LEN];
if(Param_getIntArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, tmp) == 0) {
- index = rows == 0 ? 1 : (unsigned int) rows;
+ if ((rows == 0) || (rows == 1)) {
+ index = 1;
+ } else {
+ index = (unsigned int) rows + 2;
+ }
} else {
index = 1;
}
int retVal;
retVal = Param_getIntArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, ourValue);
- index = (unsigned int) rows;
- if((retVal != 0) || (index == 0)) {
+ if((retVal != 0) || (rows == 0)) {
index = 1;
return S_cas_noRead;
- } else if(index == 1) {
+ } else if(rows == 1) {
+ index = 1;
aitUint32 intValue;
intValue = ourValue[0];
value.putConvert(intValue);
} else {
+ index = (unsigned int) rows + 2;
aitUint32 *intValue = new aitUint32[index];
- for (unsigned int k = 0 ; k < index ; k++) {
- intValue[k] = ourValue[k];
-#if 0
- fprintf(stderr, "intValue[%d] put: %d\n", k, intValue[k]);
-#endif
- }
+ memcpy(intValue + 2, ourValue, sizeof(aitUint32) * (index - 2));
value.putRef(intValue);
delete [] intValue;
ArrayDestructor *pDest = new ArrayDestructor;
retVal = Param_getIntArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, ourValue);
- index = (unsigned int) rows;
- if((retVal != 0) || (index == 0)) {
+ if((retVal != 0) || (rows == 0)) {
index = 1;
return S_cas_noRead;
- } else if(index == 1) {
+ } else if(rows == 1) {
+ index = 1;
aitUint32 intValue;
+
val = new gddScalar(gddAppType_value, aitEnumUint32);
intValue = ourValue[0];
val->putConvert(intValue);
} else {
+ index = (unsigned int) rows + 2;
aitUint32 *intValue = new aitUint32[index];
- for (unsigned int k = 0 ; k < index ; k++) {
- intValue[k] = ourValue[k];
-#if 1
- fprintf(stderr, "intValue[%d] put: %d\n", k, intValue[k]);
-#endif
- }
+ memcpy(intValue + 2, ourValue, sizeof(aitUint32) * (index - 2));
val = new gddAtomic(gddAppType_value, aitEnumUint32, 1, index);