*(result->size) = args.count;
if(args.type == DBR_LONG && args.status == ECA_NORMAL) {
- fwrite(buffer, sizeof(dbr_long_t), *(result->size), result->val);
+#if 0
+ FILE *reference;
+#endif
+ fprintf(stderr, "Seems to be the right type of data.\n");
+ fprintf(stderr, "%d blocks of each %d bytes length read.\n", *(result->size), sizeof(dbr_long_t));
+#if 0
+ reference = fopen("xx", "w+b");
+ fwrite(buffer, sizeof(dbr_long_t), *(result->size), reference);
+ fclose(reference);
+#endif
+ fwrite(buffer, sizeof(dbr_long_t), *(result->size), *result->val);
+ rewind(*result->val);
} else {
Param_strerror((Param *) result->my, ca_message(args.status));
*(result->size) = 0;
ParamBlobRecord::ParamBlobRecord(caServer& cas, const Param *p, const char *rn, const char *u) :
ParamRecord(cas, p, rn, u)
{
- index = 0;
+ size_t size;
+ FILE *tmp;
+ if(Param_getBlob(param, name, idx, &size, &tmp) == 0) {
+ index = (unsigned int) (size + 1) / sizeof(aitUint32);
+ } else {
+ index = 0;
+ }
+ fclose(tmp);
+
funcTable.installReadFunc("units", &Record::readUnits);
funcTable.installReadFunc("status", &Record::readStatus);
funcTable.installReadFunc("severity", &Record::readSeverity);
FILE *blob;
size_t size;
int retVal;
- ArrayDestructor *pDest;
+ ArrayDestructor *pDest = new ArrayDestructor;
caServer *pCAS = this->getCAS();
} else {
aitUint32 *ourValue = new aitUint32[index];
fread(ourValue, sizeof(aitUint32), index, blob);
+#if 0
+ size_t howmuch = fread(ourValue, sizeof(aitUint32), index, blob);
+ fprintf(stderr, "Called fread() with size %d\nnmemb %d\nRead %d\n", (int) sizeof(aitUint32), (int) index, (int) howmuch);
+#endif
fclose(blob);
val = new gddAtomic(gddAppType_value, aitEnumString, 1, index);
- pDest = new ArrayDestructor;
-
val->putRef(ourValue, pDest);
}
ParamFilenameRecord::ParamFilenameRecord(caServer& cas, const Param *p, const char *rn, const char *u) :
ParamRecord(cas, p, rn, u)
{
- index = 0;
+ int rows;
+ char *tmp[PARAM_MAX_ARRAY_LEN];
+
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ tmp[i] = new char[PARAM_MAX_VALUE_LEN];
+ }
+ if(Param_getFilenameArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, tmp) == 0) {
+ index = (unsigned int) rows;
+ } else {
+ index = 0;
+ }
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ delete [] tmp[i];
+ }
+
funcTable.installReadFunc("units", &Record::readUnits);
funcTable.installReadFunc("status", &Record::readStatus);
funcTable.installReadFunc("severity", &Record::readSeverity);
gddAppFuncTableStatus ParamFilenameRecord::readValue(gdd &value)
{
- if(index == 1) {
- aitString stringValue = new aitString;
+ gddAppFuncTableStatus retVal;
+ int pretVal;
+ int rows;
+
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ ourValue[i] = new char[PARAM_MAX_VALUE_LEN];
+ }
- stringValue = ourValue[0];
+ pretVal = Param_getFilenameArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, ourValue);
+ if((pretVal != 0) || ((index = (unsigned int) rows ) == 0)) {
+ retVal = S_cas_noRead;
+ } else if(index == 1) {
+ aitString stringValue = ourValue[0];
value.putConvert(stringValue);
+ retVal = S_casApp_success;
} else {
aitString *stringValue;
stringValue = new aitString[index];
}
value.putRef(stringValue);
+ retVal = S_casApp_success;
+ }
+
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ delete [] ourValue[i];
}
- return S_casApp_success;
+ return retVal;
}
caStatus ParamFilenameRecord::scan()
{
caStatus retVal;
caServer *pCAS = this->getCAS();
+ int pretVal;
+ int rows;
+ ArrayDestructor *pDest = new ArrayDestructor;
- if(index == 1) {
- aitString stringValue = new aitString;
- val = new gddScalar(gddAppType_value, aitEnumString);
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ ourValue[i] = new char[PARAM_MAX_VALUE_LEN];
+ }
- stringValue = ourValue[0];
+ pretVal = Param_getFilenameArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, ourValue);
+ if((pretVal != 0) || ((index = (unsigned int) rows ) == 0)) {
+ retVal = S_cas_noRead;
+ } else if(index == 1) {
+ aitString stringValue = ourValue[0];
+ val = new gddScalar(gddAppType_value, aitEnumString);
val->putConvert(stringValue);
+ retVal = S_casApp_success;
} else {
aitString *stringValue;
-
- val = new gddAtomic(gddAppType_value, aitEnumString, 1, index);
-
stringValue = new aitString[index];
for (unsigned int k = 0 ; k < index ; k++) {
stringValue[k] = ourValue[k];
}
- ArrayDestructor *pDest = new ArrayDestructor;
+ val = new gddAtomic(gddAppType_value, aitEnumString, 1, index);
val->putRef(stringValue, pDest);
+ retVal = S_casApp_success;
+ }
+
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ delete [] ourValue[i];
}
val->setStat(epicsAlarmNone);
this->postEvent (select, *val);
}
- retVal = S_cas_success;
+ delete pDest;
return retVal;
}
ParamIntRecord::ParamIntRecord(caServer& cas, const Param *p, const char *rn, const char *u) :
ParamRecord(cas, p, rn, u)
{
- index = 0;
+ int rows;
+ 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;
+ } else {
+ index = 1;
+ }
funcTable.installReadFunc("units", &Record::readUnits);
funcTable.installReadFunc("status", &Record::readStatus);
funcTable.installReadFunc("severity", &Record::readSeverity);
retVal = Param_getIntArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, ourValue);
index = (unsigned int) rows;
if((retVal != 0) || (index == 0)) {
+ index = 1;
return S_cas_noRead;
} else if(index == 1) {
aitUint32 intValue;
int rows;
int retVal;
- ArrayDestructor *pDest;
+ 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)) {
+ index = 1;
return S_cas_noRead;
} else if(index == 1) {
aitUint32 intValue;
val->putConvert(intValue);
} else {
- pDest = new ArrayDestructor;
aitUint32 *intValue = new aitUint32[index];
for (unsigned int k = 0 ; k < index ; k++) {
intValue[k] = ourValue[k];
switch (type) {
case('I'):
retVal = (pvs[numPv++] = new ParamIntRecord(*this, pParam(setup), pPVName, "Integer"));
+ syslog(LOG_DEBUG, "Created Integer Record %s", pPVName);
break;
case('S'):
retVal = (pvs[numPv++] = new ParamStringRecord(*this, pParam(setup), pPVName, "String"));
+ syslog(LOG_DEBUG, "Created String Record %s", pPVName);
break;
case('F'):
retVal = (pvs[numPv++] = new ParamFilenameRecord(*this, pParam(setup), pPVName, "Filename"));
+ syslog(LOG_DEBUG, "Created Filename Record %s", pPVName);
break;
case('B'):
retVal = (pvs[numPv++] = new ParamBlobRecord(*this, pParam(setup), pPVName, "Binary Large OBject"));
+ syslog(LOG_DEBUG, "Created Blob Record %s", pPVName);
break;
}
return retVal;
ParamStringRecord::ParamStringRecord(caServer& cas, const Param *p, const char *rn, const char *u) :
ParamRecord(cas, p, rn, u)
{
- index = 0;
+ int rows;
+ char *tmp[PARAM_MAX_ARRAY_LEN];
+
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ tmp[i] = new char[PARAM_MAX_VALUE_LEN];
+ }
+ if(Param_getStringArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, tmp) == 0) {
+ index = rows == 0 ? 1 : (unsigned int) rows;
+ } else {
+ index = 1;
+ }
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ delete [] tmp[i];
+ }
+
funcTable.installReadFunc("units", &Record::readUnits);
funcTable.installReadFunc("status", &Record::readStatus);
funcTable.installReadFunc("severity", &Record::readSeverity);
gddAppFuncTableStatus ParamStringRecord::readValue(gdd &value)
{
- if(index == 1) {
- aitString stringValue = new aitString;
+ gddAppFuncTableStatus retVal;
+ int pretVal;
+ int rows;
- stringValue = ourValue[0];
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ ourValue[i] = new char[PARAM_MAX_VALUE_LEN];
+ }
+
+ pretVal = Param_getStringArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, ourValue);
+ if((pretVal != 0) || ((index = (unsigned int) rows ) == 0)) {
+ index = 1;
+ retVal = S_cas_noRead;
+ } else if(index == 1) {
+ aitString stringValue = ourValue[0];
value.putConvert(stringValue);
+ retVal = S_casApp_success;
} else {
aitString *stringValue;
stringValue = new aitString[index];
}
value.putRef(stringValue);
+ retVal = S_casApp_success;
}
- return S_casApp_success;
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ delete [] ourValue[i];
+ }
+
+ return retVal;
}
caStatus ParamStringRecord::scan()
{
caStatus retVal;
caServer *pCAS = this->getCAS();
+ int pretVal;
+ int rows;
+ ArrayDestructor *pDest = new ArrayDestructor;
- if(index == 1) {
- aitString stringValue = new aitString;
- val = new gddScalar(gddAppType_value, aitEnumString);
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ ourValue[i] = new char[PARAM_MAX_VALUE_LEN];
+ }
- stringValue = ourValue[0];
+ pretVal = Param_getStringArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, ourValue);
+ if((pretVal != 0) || ((index = (unsigned int) rows ) == 0)) {
+ index = 1;
+ retVal = S_cas_noRead;
+ } else if(index == 1) {
+ aitString stringValue = ourValue[0];
+ val = new gddScalar(gddAppType_value, aitEnumString);
val->putConvert(stringValue);
+ retVal = S_casApp_success;
} else {
aitString *stringValue;
-
- val = new gddAtomic(gddAppType_value, aitEnumString, 1, index);
-
stringValue = new aitString[index];
for (unsigned int k = 0 ; k < index ; k++) {
stringValue[k] = ourValue[k];
}
- ArrayDestructor *pDest = new ArrayDestructor;
+ val = new gddAtomic(gddAppType_value, aitEnumString, 1, index);
val->putRef(stringValue, pDest);
+ retVal = S_casApp_success;
+ }
+
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ delete [] ourValue[i];
}
val->setStat(epicsAlarmNone);
this->postEvent (select, *val);
}
- retVal = S_cas_success;
+ delete pDest;
return retVal;
}
aitString stringValue;
value.getConvert(stringValue);
-
- char ourValue[PARAM_MAX_VALUE_LEN];
- strcpy(ourValue, (const char *) stringValue);
-
- Param_storeString(param, name, idx, ourValue);
+#if 0
+ char ourScalarValue[PARAM_MAX_VALUE_LEN];
+ strcpy(ourScalarValue, (const char *) stringValue);
+ Param_storeString(param, name, idx, ourScalarValue);
+#endif
+ Param_storeString(param, name, idx, (const char *) stringValue);
return S_cas_success;
}
}
gddAppFuncTableStatus Record::readStatus(gdd &value) {
- value.putConvert(alarmStatus);
+ value.putConvert((unsigned int) alarmStatus);
return S_casApp_success;
}
gddAppFuncTableStatus Record::readSeverity(gdd &value) {
- value.putConvert(alarmSeverity);
+ value.putConvert((unsigned int) alarmSeverity);
return S_casApp_success;
}
struct stat fileS, *file = &fileS;
stat(filename, file);
*size = (size_t) file->st_size;
- fprintf(stderr, "Result: %d.\n", *size);
*val = stream;
}
return retVal;
TIME = time
-MV = ./mv.sh
# Channel Access test
-# Linux
-HOST_ARCH = Linux
-EPICS_BASE = $(EPICS_HOME)/base
-CACFLAGS = -g -ansi -Wall -I../ca
-LOADCALIBES = -L../ca -L$(EPICS_BASE)/lib/$(HOST_ARCH) -lcaParam -lca -lCom
-# LynxOS
-#HOST_ARCH = LynxOS
-#EPICS_BASE = $(EPICS_HOME)/base
-#CACFLAGS = -g -ansi -Wall -I../ca
-#LOADCALIBES = -L../ca -L$(EPICS_BASE)/lib/$(HOST_ARCH) -lcaParam -lca -lCom -lnetinet
-
+LOADCALIBES = -L../ca/client -L$(EPICS_BASE)/lib/$(HOST_ARCH) -lcaParam -lca -lCom
# File test
-FILECFLAGS = -g -ansi -Wall -I../file
LOADFILELIBES = -L../file -lfileParam
-
# Oracle test
ORACLE_HOME = /usr/local/oracle/product/8.0.5
-ORACFLAGS = -g -ansi -Wall -I../ora
LOADORALIBES = -L../ora -L$(ORACLE_HOME)/lib \
-loraParam -lsql -lclntsh -lcommon -lcore4 -lnlsrtl3
-
# PostgreSQL test
-PSQLCFLAGS = -g -ansi -Wall -I../psql
LOADPSQLLIBES = -L../psql -lpsqlParam -lpq -lcrypt
-
# Tcl test
-TCLCFLAGS = -g -ansi -Wall -I../tcl
-LOADTCLLIBES = -L../tcl -ltclParam -ltcl8.0 -lm -ldl
-
-HEADERS = test1.h test2.h test3.h test4.h test5.h test6.h test7.h test8.h \
- test9.h test10.h test11.h test12.h test13.h test14.h test15.h test16.h \
- test17.h test18.h test19.h test20.h test21.h test22.h
-
-OBJS = suite.o test1.o test2.o test3.o test4.o test5.o test6.o test7.o \
- test8.o test9.o test10.o test11.o test12.o test13.o test14.o test15.o \
- test16.o test17.o test18.o test19.o test20.o test21.o test22.o
-
-CAOBJS = ca_suite.o ca_test1.o ca_test2.o ca_test3.o ca_test4.o ca_test5.o \
- ca_test6.o ca_test7.o ca_test8.o ca_test9.o ca_test10.o ca_test11.o \
- ca_test12.o ca_test13.o ca_test14.o ca_test15.o ca_test16.o ca_test17.o \
- ca_test18.o ca_test19.o ca_test20.o ca_test21.o ca_test22.o
+LOADTCLLIBES = -L../tcl -ltclParam -ltcl -lm -ldl
-FILEOBJS = file_suite.o file_test1.o file_test2.o file_test3.o file_test4.o \
- file_test5.o file_test6.o file_test7.o file_test8.o file_test9.o \
- file_test10.o file_test11.o file_test12.o file_test13.o file_test14.o \
- file_test15.o file_test16.o file_test17.o file_test18.o file_test19.o \
- file_test20.o file_test21.o file_test22.o
+#HEADERS = blob/*.h filename/*.h int/*.h string/*.h
+HEADERS = int/*.h string/*.h
-ORAOBJS = ora_suite.o ora_test1.o ora_test2.o ora_test3.o ora_test4.o \
- ora_test5.o ora_test6.o ora_test7.o ora_test8.o ora_test9.o ora_test10.o \
- ora_test11.o ora_test12.o ora_test13.o ora_test14.o ora_test15.o \
- ora_test16.o ora_test17.o ora_test18.o ora_test19.o ora_test20.o \
- ora_test21.o ora_test22.o
+VPATH=.:blob:filename:int:string
-PSQLOBJS = psql_suite.o psql_test1.o psql_test2.o psql_test3.o psql_test4.o \
- psql_test5.o psql_test6.o psql_test7.o psql_test8.o psql_test9.o \
- psql_test10.o psql_test11.o psql_test12.o psql_test13.o psql_test14.o \
- psql_test15.o psql_test16.o psql_test17.o psql_test18.o psql_test19.o \
- psql_test20.o psql_test21.o psql_test22.o
+CFLAGS = -I../include
+#OBJS = suite.o blobobjs filenameobjs intobjs stringobjs
+#OBJS_V = suite.o blobobjs_v filenameobjs_v intobjs_v stringobjs_v
+OBJS = suite.o intobjs stringobjs
+OBJS_V = suite.o intobjs_v stringobjs_v
-TCLOBJS = tcl_suite.o tcl_test1.o tcl_test2.o tcl_test3.o tcl_test4.o \
- tcl_test5.o tcl_test6.o tcl_test7.o tcl_test8.o tcl_test9.o tcl_test10.o \
- tcl_test11.o tcl_test12.o tcl_test13.o tcl_test14.o tcl_test15.o \
- tcl_test16.o tcl_test17.o tcl_test18.o tcl_test19.o tcl_test20.o \
- tcl_test21.o tcl_test22.o
-
LIBS = ca file ora psql tcl
ca_test file_test ora_test psql_test tcl_test :
$(RM) $@_suite
$(MAKE) $@_suite
+ bin/pre_$@.sh
$(TIME) ./$@_suite > $@_protocol.txt 2>&1
+ bin/post_$@.sh
-ca_test_suite :
- $(MAKE) $(OBJS) "CFLAGS=$(CACFLAGS)"
- $(MV) ca_ $(OBJS)
- $(CC) $(LDFLAGS) $(CAOBJS) $(LOADCALIBES) -o $@
-file_test_suite :
- $(MAKE) $(OBJS) "CFLAGS=$(FILECFLAGS)"
- $(MV) file_ $(OBJS)
- $(CC) $(LDFLAGS) $(FILEOBJS) $(LOADFILELIBES) -o $@
-ora_test_suite :
- $(MAKE) $(OBJS) "CFLAGS=$(ORACFLAGS)"
- $(MV) ora_ $(OBJS)
- $(CC) $(LDFLAGS) $(ORAOBJS) $(LOADORALIBES) -o $@
-psql_test_suite :
- $(MAKE) $(OBJS) "CFLAGS=$(PSQLCFLAGS)"
- $(MV) psql_ $(OBJS)
- $(CC) $(LDFLAGS) $(PSQLOBJS) $(LOADPSQLLIBES) -o $@
-tcl_test_suite :
- $(MAKE) $(OBJS) "CFLAGS=$(TCLCFLAGS)"
- $(MV) tcl_ $(OBJS)
- $(CC) $(LDFLAGS) $(TCLOBJS) $(LOADTCLLIBES) -o $@
+ca_test_v file_test_v ora_test_v psql_test_v tcl_test_v :
+ $(RM) $@_suite
+ $(MAKE) $@_suite
+ bin/pre_$@.sh
+ $(TIME) ./$@_suite > $@_protocol.txt 2>&1
+ bin/post_$@.sh
+
+#ca_test_v_suite : $(OBJS_V)
+# $(CC) $(LDFLAGS) suite.o blob/*.o filename/*.o int/*.o string/*.o \
+# $(LOADCALIBES) -o $@
+ca_test_v_suite : $(OBJS_V)
+ $(CC) $(LDFLAGS) suite.o int/*.o string/*.o \
+ $(LOADCALIBES) -o $@
+#file_test_v_suite : $(OBJS_V)
+# $(CC) $(LDFLAGS) suite.o blob/*.o filename/*.o int/*.o string/*.o \
+# $(LOADFILELIBES) -o $@
+file_test_v_suite : $(OBJS_V)
+ $(CC) $(LDFLAGS) suite.o int/*.o string/*.o \
+ $(LOADFILELIBES) -o $@
+ora_test_v_suite : $(OBJS_V)
+ $(CC) $(LDFLAGS) suite.o blob/*.o filename/*.o int/*.o string/*.o \
+ $(LOADORALIBES) -o $@
+psql_test_v_suite : $(OBJS_V)
+ $(CC) $(LDFLAGS) suite.o blob/*.o filename/*.o int/*.o string/*.o \
+ $(LOADPSQLLIBES) -o $@
+tcl_test_v_suite : $(OBJS_V)
+ $(CC) $(LDFLAGS) suite.o blob/*.o filename/*.o int/*.o string/*.o \
+ $(LOADTCLLIBES) -o $@
+
+#ca_test_suite : $(OBJS)
+# $(CC) $(LDFLAGS) suite.o blob/*.o filename/*.o int/*.o string/*.o \
+# $(LOADCALIBES) -o $@
+ca_test_suite : $(OBJS)
+ $(CC) $(LDFLAGS) suite.o int/*.o string/*.o \
+ $(LOADCALIBES) -o $@
+#file_test_suite : $(OBJS)
+# $(CC) $(LDFLAGS) suite.o blob/*.o filename/*.o int/*.o string/*.o \
+# $(LOADFILELIBES) -o $@
+file_test_suite : $(OBJS)
+ $(CC) $(LDFLAGS) suite.o int/*.o string/*.o \
+ $(LOADFILELIBES) -o $@
+ora_test_suite : $(OBJS)
+ $(CC) $(LDFLAGS) suite.o blob/*.o filename/*.o int/*.o string/*.o \
+ $(LOADORALIBES) -o $@
+psql_test_suite : $(OBJS)
+ $(CC) $(LDFLAGS) suite.o blob/*.o filename/*.o int/*.o string/*.o \
+ $(LOADPSQLLIBES) -o $@
+tcl_test_suite : $(OBJS)
+ $(CC) $(LDFLAGS) suite.o blob/*.o filename/*.o int/*.o string/*.o \
+ $(LOADTCLLIBES) -o $@
suite.o : suite.c $(HEADERS)
+suite.c :
+ bin/main.sh
+
+blobobjs :
+ cd blob ; $(MAKE) clean
+ cd blob ; $(MAKE) "CFLAGS=-I../../include"
+filenameobjs :
+ cd filename ; $(MAKE) clean
+ cd filename ; $(MAKE) "CFLAGS=-I../../include"
+intobjs :
+ cd int ; $(MAKE) clean
+ cd int ; $(MAKE) "CFLAGS=-I../../include"
+stringobjs :
+ cd string ; $(MAKE) clean
+ cd string ; $(MAKE) "CFLAGS=-I../../include"
+
+blobobjs_v :
+ cd blob ; $(MAKE) clean
+ cd blob ; $(MAKE) "CFLAGS=-DVERBOSE -I../../include"
+filenameobjs_v :
+ cd filename ; $(MAKE) clean
+ cd filename ; $(MAKE) "CFLAGS=-DVERBOSE -I../../include"
+intobjs_v :
+ cd int ; $(MAKE) clean
+ cd int ; $(MAKE) "CFLAGS=-DVERBOSE -I../../include"
+stringobjs_v :
+ cd string ; $(MAKE) clean
+ cd string ; $(MAKE) "CFLAGS=-DVERBOSE -I../../include"
clean :
- rm -f *.o *test_protocol.txt sqlnet.log
-
-bin_clean :
- rm -f *.o *_suite *test_protocol.txt sqlnet.log
-
-ca_test file_test ora_test psql_test tcl_test : dummy
-
-dummy :
+ cd blob ; $(MAKE) $@
+ cd filename ; $(MAKE) $@
+ cd int ; $(MAKE) $@
+ cd string ; $(MAKE) $@
+ rm -f *test_protocol.txt sqlnet.log *_s.tcl storage.tcl suite.c suite.o
+
+bin_clean : clean
+ rm -f *_suite
#!/bin/sh
-echo "all : $(sed s/.c/.o/g << EOF
+echo "all : $(sed s/[\.]c/.o/g << EOF
$(echo *.c)
EOF
)"
cat middle.c >> $SUITE
for i in */*.c ; do
- echo " errors -= $(basename $i .c)(\"$(dirname $i)/$(basename $i .c)\", param);" >> $SUITE
+ echo " errors -= $(basename $i \.c)(\"$(dirname $i)/$(basename $i \.c)\", param);" >> $SUITE
done
cat end.c >> $SUITE
--- /dev/null
+E 199509L
+
+extern "C" {
+ #include <string.h>
+}
+
+#include "paramStringRecord.h"
+
+ParamStringRecord::ParamStringRecord(caServer& cas, const Param *p, const char *rn, const char *u) :
+ ParamRecord(cas, p, rn, u)
+{
+ int rows;
+ char *tmp[PARAM_MAX_ARRAY_LEN];
+
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ tmp[i] = new char[PARAM_MAX_VALUE_LEN];
+ }
+ if(Param_getStringArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, tmp) == 0) {
+ index = rows == 0 ? 1 : (unsigned int) rows;
+ } else {
+ index = 1;
+ }
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ delete [] tmp[i];
+ }
+
+ funcTable.installReadFunc("units", &Record::readUnits);
+ funcTable.installReadFunc("status", &Record::readStatus);
+ funcTable.installReadFunc("severity", &Record::readSeverity);
+
+ funcTable.installReadFunc("controlLow", &ParamRecord::readLowCtrl);
+ funcTable.installReadFunc("controlHigh", &ParamRecord::readHighCtrl);
+ funcTable.installReadFunc("graphicLow", &ParamRecord::readLopr);
+ funcTable.installReadFunc("graphicHigh", &ParamRecord::readHopr);
+ funcTable.installReadFunc("precision", &ParamRecord::readPrecision);
+
+ funcTable.installReadFunc("value", &ParamStringRecord::readValue);
+}
+
+ParamStringRecord::~ParamStringRecord()
+{
+ for(unsigned int k = 0 ; k < index ; k++) {
+ delete ourValue[k];
+ }
+}
+
+epicsShareFunc aitEnum ParamStringRecord::bestExternalType() const
+{
+ return aitEnumString;
+}
+
+epicsShareFunc unsigned ParamStringRecord::maxDimension() const
+{
+ return 1u;
+}
+
+epicsShareFunc aitIndex ParamStringRecord::maxBound(unsigned dimension) const
+{
+ aitIndex retVal;
+ if(dimension == 0) {
+ retVal = index;
+ } else {
+ retVal = 1u;
+ }
+ return retVal;
+}
+
+gddAppFuncTableStatus ParamStringRecord::readValue(gdd &value)
+{
+ gddAppFuncTableStatus retVal;
+ int pretVal;
+ int rows;
+
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ ourValue[i] = new char[PARAM_MAX_VALUE_LEN];
+ }
+
+ pretVal = Param_getStringArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, ourValue);
+ if((pretVal != 0) || ((index = (unsigned int) rows ) == 0)) {
+ index = 1;
+ retVal = S_cas_noRead;
+ } else if(index == 1) {
+ aitString stringValue = ourValue[0];
+
+ value.putConvert(stringValue);
+ retVal = S_casApp_success;
+ } else {
+ aitString *stringValue;
+ stringValue = new aitString[index];
+ for (unsigned int k = 0 ; k < index ; k++) {
+ stringValue[k] = ourValue[k];
+ }
+
+ value.putRef(stringValue);
+ retVal = S_casApp_success;
+ }
+
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ delete [] ourValue[i];
+ }
+
+ return retVal;
+}
+
+caStatus ParamStringRecord::scan()
+{
+ caStatus retVal;
+ caServer *pCAS = this->getCAS();
+ int pretVal;
+ int rows;
+ ArrayDestructor *pDest = new ArrayDestructor;
+
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ ourValue[i] = new char[PARAM_MAX_VALUE_LEN];
+ }
+
+ pretVal = Param_getStringArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, ourValue);
+ if((pretVal != 0) || ((index = (unsigned int) rows ) == 0)) {
+ index = 1;
+ retVal = S_cas_noRead;
+ } else if(index == 1) {
+ aitString stringValue = ourValue[0];
+
+ val = new gddScalar(gddAppType_value, aitEnumString);
+ val->putConvert(stringValue);
+ retVal = S_casApp_success;
+ } else {
+ aitString *stringValue;
+ stringValue = new aitString[index];
+ for (unsigned int k = 0 ; k < index ; k++) {
+ stringValue[k] = ourValue[k];
+ }
+
+ val = new gddAtomic(gddAppType_value, aitEnumString, 1, index);
+
+ val->putRef(stringValue, pDest);
+ retVal = S_casApp_success;
+ }
+
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ delete [] ourValue[i];
+ }
+
+ val->setStat(epicsAlarmNone);
+ val->setSevr(epicsSevNone);
+
+ if (this->interest == aitTrue && pCAS != NULL) {
+ casEventMask select(pCAS->valueEventMask|pCAS->logEventMask|pCAS->alarmEventMask);
+ this->postEvent (select, *val);
+ }
+
+ delete pDest;
+
+ return retVal;
+}
+
+caStatus ParamStringRecord::read(const casCtx &ctx, gdd &prototype)
+{
+ return ((scan() == S_cas_success) && funcTable.read(*this, prototype));
+}
+
+caStatus ParamStringRecord::write(const casCtx &ctx, gdd &value)
+{
+ aitString stringValue;
+
+ value.getConvert(stringValue);
+#if 0
+ char ourScalarValue[PARAM_MAX_VALUE_LEN];
+ strcpy(ourScalarValue, (const char *) stringValue);
+ Param_storeString(param, name, idx, ourScalarValue);
+#endif
+ Param_storeString(param, name, idx, (const char *) stringValue);
+
+ return S_cas_success;
+}
+
+#define _POSIX_C_SOURCE 199509L
+
+extern "C" {
+ #include <string.h>
+}
+
+#include "paramFilenameRecord.h"
+
+ParamFilenameRecord::ParamFilenameRecord(caServer& cas, const Param *p, const char *rn, const char *u) :
+ ParamRecord(cas, p, rn, u)
+{
+ int rows;
+ char *tmp[PARAM_MAX_ARRAY_LEN];
+
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ tmp[i] = new char[PARAM_MAX_VALUE_LEN];
+ }
+ if(Param_getFilenameArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, tmp) == 0) {
+ index = (unsigned int) rows;
+ } else {
+ index = 0;
+ }
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ delete [] tmp[i];
+ }
+
+ funcTable.installReadFunc("units", &Record::readUnits);
+ funcTable.installReadFunc("status", &Record::readStatus);
+ funcTable.installReadFunc("severity", &Record::readSeverity);
+
+ funcTable.installReadFunc("controlLow", &ParamRecord::readLowCtrl);
+ funcTable.installReadFunc("controlHigh", &ParamRecord::readHighCtrl);
+ funcTable.installReadFunc("graphicLow", &ParamRecord::readLopr);
+ funcTable.installReadFunc("graphicHigh", &ParamRecord::readHopr);
+ funcTable.installReadFunc("precision", &ParamRecord::readPrecision);
+
+ funcTable.installReadFunc("value", &ParamFilenameRecord::readValue);
+}
+
+ParamFilenameRecord::~ParamFilenameRecord()
+{
+ for(unsigned int k = 0 ; k < index ; k++) {
+ delete ourValue[k];
+ }
+}
+
+epicsShareFunc aitEnum ParamFilenameRecord::bestExternalType() const
+{
+ return aitEnumString;
+}
+
+epicsShareFunc unsigned ParamFilenameRecord::maxDimension() const
+{
+ return 1u;
+}
+
+epicsShareFunc aitIndex ParamFilenameRecord::maxBound(unsigned dimension) const
+{
+ aitIndex retVal;
+ if(dimension == 0) {
+ retVal = index;
+ } else {
+ retVal = 1u;
+ }
+ return retVal;
+}
+
+gddAppFuncTableStatus ParamFilenameRecord::readValue(gdd &value)
+{
+ gddAppFuncTableStatus retVal;
+ int pretVal;
+ int rows;
+
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ ourValue[i] = new char[PARAM_MAX_VALUE_LEN];
+ }
+
+ pretVal = Param_getFilenameArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, ourValue);
+ if((pretVal != 0) || ((index = (unsigned int) rows ) == 0)) {
+ retVal = S_cas_noRead;
+ } else if(index == 1) {
+ aitString stringValue = ourValue[0];
+
+ value.putConvert(stringValue);
+ retVal = S_casApp_success;
+ } else {
+ aitString *stringValue;
+ stringValue = new aitString[index];
+ for (unsigned int k = 0 ; k < index ; k++) {
+ stringValue[k] = ourValue[k];
+ }
+
+ value.putRef(stringValue);
+ retVal = S_casApp_success;
+ }
+
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ delete [] ourValue[i];
+ }
+
+ return retVal;
+}
+
+caStatus ParamFilenameRecord::scan()
+{
+ caStatus retVal;
+ caServer *pCAS = this->getCAS();
+ int pretVal;
+ int rows;
+ ArrayDestructor *pDest = new ArrayDestructor;
+
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ ourValue[i] = new char[PARAM_MAX_VALUE_LEN];
+ }
+
+ pretVal = Param_getFilenameArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, ourValue);
+ if((pretVal != 0) || ((index = (unsigned int) rows ) == 0)) {
+ retVal = S_cas_noRead;
+ } else if(index == 1) {
+ aitString stringValue = ourValue[0];
+
+ val = new gddScalar(gddAppType_value, aitEnumString);
+ val->putConvert(stringValue);
+ retVal = S_casApp_success;
+ } else {
+ aitString *stringValue;
+ stringValue = new aitString[index];
+ for (unsigned int k = 0 ; k < index ; k++) {
+ stringValue[k] = ourValue[k];
+ }
+
+ val = new gddAtomic(gddAppType_value, aitEnumString, 1, index);
+
+ val->putRef(stringValue, pDest);
+ retVal = S_casApp_success;
+ }
+
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ delete [] ourValue[i];
+ }
+
+ val->setStat(epicsAlarmNone);
+ val->setSevr(epicsSevNone);
+
+ if (this->interest == aitTrue && pCAS != NULL) {
+ casEventMask select(pCAS->valueEventMask|pCAS->logEventMask|pCAS->alarmEventMask);
+ this->postEvent (select, *val);
+ }
+
+ delete pDest;
+
+ return retVal;
+}
+
+caStatus ParamFilenameRecord::read(const casCtx &ctx, gdd &prototype)
+{
+ return ((scan() == S_cas_success) && funcTable.read(*this, prototype));
+}
+
+caStatus ParamFilenameRecord::write(const casCtx &ctx, gdd &value)
+{
+ return S_cas_noWrite;
+}
+
+#define _POSIX_C_SOURCE 199509L
+
+extern "C" {
+ #include <string.h>
+}
+
+#include "paramFilenameRecord.h"
+
+ParamFilenameRecord::ParamFilenameRecord(caServer& cas, const Param *p, const char *rn, const char *u) :
+ ParamRecord(cas, p, rn, u)
+{
+ int rows;
+ char *tmp[PARAM_MAX_ARRAY_LEN];
+
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ tmp[i] = new char[PARAM_MAX_VALUE_LEN];
+ }
+ if(Param_getFilenameArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, tmp) == 0) {
+ index = (unsigned int) rows;
+ } else {
+ index = 0;
+ }
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ delete [] tmp[i];
+ }
+
+ funcTable.installReadFunc("units", &Record::readUnits);
+ funcTable.installReadFunc("status", &Record::readStatus);
+ funcTable.installReadFunc("severity", &Record::readSeverity);
+
+ funcTable.installReadFunc("controlLow", &ParamRecord::readLowCtrl);
+ funcTable.installReadFunc("controlHigh", &ParamRecord::readHighCtrl);
+ funcTable.installReadFunc("graphicLow", &ParamRecord::readLopr);
+ funcTable.installReadFunc("graphicHigh", &ParamRecord::readHopr);
+ funcTable.installReadFunc("precision", &ParamRecord::readPrecision);
+
+ funcTable.installReadFunc("value", &ParamFilenameRecord::readValue);
+}
+
+ParamFilenameRecord::~ParamFilenameRecord()
+{
+ for(unsigned int k = 0 ; k < index ; k++) {
+ delete ourValue[k];
+ }
+}
+
+epicsShareFunc aitEnum ParamFilenameRecord::bestExternalType() const
+{
+ return aitEnumString;
+}
+
+epicsShareFunc unsigned ParamFilenameRecord::maxDimension() const
+{
+ return 1u;
+}
+
+epicsShareFunc aitIndex ParamFilenameRecord::maxBound(unsigned dimension) const
+{
+ aitIndex retVal;
+ if(dimension == 0) {
+ retVal = index;
+ } else {
+ retVal = 1u;
+ }
+ return retVal;
+}
+
+gddAppFuncTableStatus ParamFilenameRecord::readValue(gdd &value)
+{
+ gddAppFuncTableStatus retVal;
+ int pretVal;
+ int rows;
+
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ ourValue[i] = new char[PARAM_MAX_VALUE_LEN];
+ }
+
+ pretVal = Param_getFilenameArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, ourValue);
+ if((pretVal != 0) || ((index = (unsigned int) rows ) == 0)) {
+ retVal = S_cas_noRead;
+ } else if(index == 1) {
+ aitString stringValue = ourValue[0];
+
+ value.putConvert(stringValue);
+ retVal = S_casApp_success;
+ } else {
+ aitString *stringValue;
+ stringValue = new aitString[index];
+ for (unsigned int k = 0 ; k < index ; k++) {
+ stringValue[k] = ourValue[k];
+ }
+
+ value.putRef(stringValue);
+ retVal = S_casApp_success;
+ }
+
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ delete [] ourValue[i];
+ }
+
+ return retVal;
+}
+
+caStatus ParamFilenameRecord::scan()
+{
+ caStatus retVal;
+ caServer *pCAS = this->getCAS();
+ int pretVal;
+ int rows;
+ ArrayDestructor *pDest = new ArrayDestructor;
+
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ ourValue[i] = new char[PARAM_MAX_VALUE_LEN];
+ }
+
+ pretVal = Param_getFilenameArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, ourValue);
+ if((pretVal != 0) || ((index = (unsigned int) rows ) == 0)) {
+ retVal = S_cas_noRead;
+ } else if(index == 1) {
+ aitString stringValue = ourValue[0];
+
+ val = new gddScalar(gddAppType_value, aitEnumString);
+ val->putConvert(stringValue);
+ retVal = S_casApp_success;
+ } else {
+ aitString *stringValue;
+ stringValue = new aitString[index];
+ for (unsigned int k = 0 ; k < index ; k++) {
+ stringValue[k] = ourValue[k];
+ }
+
+ val = new gddAtomic(gddAppType_value, aitEnumString, 1, index);
+
+ val->putRef(stringValue, pDest);
+ retVal = S_casApp_success;
+ }
+
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ delete [] ourValue[i];
+ }
+
+ val->setStat(epicsAlarmNone);
+ val->setSevr(epicsSevNone);
+
+ if (this->interest == aitTrue && pCAS != NULL) {
+ casEventMask select(pCAS->valueEventMask|pCAS->logEventMask|pCAS->alarmEventMask);
+ this->postEvent (select, *val);
+ }
+
+ delete pDest;
+
+ return retVal;
+}
+
+caStatus ParamFilenameRecord::read(const casCtx &ctx, gdd &prototype)
+{
+ return ((scan() == S_cas_success) && funcTable.read(*this, prototype));
+}
+
+caStatus ParamFilenameRecord::write(const casCtx &ctx, gdd &value)
+{
+ return S_cas_noWrite;
+}
+
+#define _POSIX_C_SOURCE 199509L
+
+extern "C" {
+ #include <string.h>
+}
+
+#include "paramFilenameRecord.h"
+
+ParamFilenameRecord::ParamFilenameRecord(caServer& cas, const Param *p, const char *rn, const char *u) :
+ ParamRecord(cas, p, rn, u)
+{
+ int rows;
+ char *tmp[PARAM_MAX_ARRAY_LEN];
+
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ tmp[i] = new char[PARAM_MAX_VALUE_LEN];
+ }
+ if(Param_getFilenameArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, tmp) == 0) {
+ index = (unsigned int) rows;
+ } else {
+ index = 0;
+ }
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ delete [] tmp[i];
+ }
+
+ funcTable.installReadFunc("units", &Record::readUnits);
+ funcTable.installReadFunc("status", &Record::readStatus);
+ funcTable.installReadFunc("severity", &Record::readSeverity);
+
+ funcTable.installReadFunc("controlLow", &ParamRecord::readLowCtrl);
+ funcTable.installReadFunc("controlHigh", &ParamRecord::readHighCtrl);
+ funcTable.installReadFunc("graphicLow", &ParamRecord::readLopr);
+ funcTable.installReadFunc("graphicHigh", &ParamRecord::readHopr);
+ funcTable.installReadFunc("precision", &ParamRecord::readPrecision);
+
+ funcTable.installReadFunc("value", &ParamFilenameRecord::readValue);
+}
+
+ParamFilenameRecord::~ParamFilenameRecord()
+{
+ for(unsigned int k = 0 ; k < index ; k++) {
+ delete ourValue[k];
+ }
+}
+
+epicsShareFunc aitEnum ParamFilenameRecord::bestExternalType() const
+{
+ return aitEnumString;
+}
+
+epicsShareFunc unsigned ParamFilenameRecord::maxDimension() const
+{
+ return 1u;
+}
+
+epicsShareFunc aitIndex ParamFilenameRecord::maxBound(unsigned dimension) const
+{
+ aitIndex retVal;
+ if(dimension == 0) {
+ retVal = index;
+ } else {
+ retVal = 1u;
+ }
+ return retVal;
+}
+
+gddAppFuncTableStatus ParamFilenameRecord::readValue(gdd &value)
+{
+ gddAppFuncTableStatus retVal;
+ int pretVal;
+ int rows;
+
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ ourValue[i] = new char[PARAM_MAX_VALUE_LEN];
+ }
+
+ pretVal = Param_getFilenameArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, ourValue);
+ if((pretVal != 0) || ((index = (unsigned int) rows ) == 0)) {
+ retVal = S_cas_noRead;
+ } else if(index == 1) {
+ aitString stringValue = ourValue[0];
+
+ value.putConvert(stringValue);
+ retVal = S_casApp_success;
+ } else {
+ aitString *stringValue;
+ stringValue = new aitString[index];
+ for (unsigned int k = 0 ; k < index ; k++) {
+ stringValue[k] = ourValue[k];
+ }
+
+ value.putRef(stringValue);
+ retVal = S_casApp_success;
+ }
+
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ delete [] ourValue[i];
+ }
+
+ return retVal;
+}
+
+caStatus ParamFilenameRecord::scan()
+{
+ caStatus retVal;
+ caServer *pCAS = this->getCAS();
+ int pretVal;
+ int rows;
+ ArrayDestructor *pDest = new ArrayDestructor;
+
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ ourValue[i] = new char[PARAM_MAX_VALUE_LEN];
+ }
+
+ pretVal = Param_getFilenameArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, ourValue);
+ if((pretVal != 0) || ((index = (unsigned int) rows ) == 0)) {
+ retVal = S_cas_noRead;
+ } else if(index == 1) {
+ aitString stringValue = ourValue[0];
+
+ val = new gddScalar(gddAppType_value, aitEnumString);
+ val->putConvert(stringValue);
+ retVal = S_casApp_success;
+ } else {
+ aitString *stringValue;
+ stringValue = new aitString[index];
+ for (unsigned int k = 0 ; k < index ; k++) {
+ stringValue[k] = ourValue[k];
+ }
+
+ val = new gddAtomic(gddAppType_value, aitEnumString, 1, index);
+
+ val->putRef(stringValue, pDest);
+ retVal = S_casApp_success;
+ }
+
+ for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) {
+ delete [] ourValue[i];
+ }
+
+ val->setStat(epicsAlarmNone);
+} xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
+xxx
--- /dev/null
+all :
+ $(MAKE) depend "CFLAGS=$(CFLAGS)"
+ $(MAKE) -f Makefile.dep "CFLAGS=$(CFLAGS)"
+
+depend :
+ rm -f Makefile.dep
+ ../bin/echoobjs.sh > Makefile.dep
+ gcc -MM $(CFLAGS) *.c >> Makefile.dep
+
+clean :
+ rm -f Makefile.dep *.o
+
--- /dev/null
+all :
+ $(MAKE) depend "CFLAGS=$(CFLAGS)"
+ $(MAKE) -f Makefile.dep "CFLAGS=$(CFLAGS)"
+
+depend :
+ rm -f Makefile.dep
+ ../bin/echoobjs.sh > Makefile.dep
+ gcc -MM $(CFLAGS) *.c >> Makefile.dep
+
+clean :
+ rm -f Makefile.dep *.o
+
--- /dev/null
+all :
+ $(MAKE) depend "CFLAGS=$(CFLAGS)"
+ $(MAKE) -f Makefile.dep "CFLAGS=$(CFLAGS)"
+
+depend :
+ rm -f Makefile.dep
+ ../bin/echoobjs.sh > Makefile.dep
+ gcc -MM $(CFLAGS) *.c >> Makefile.dep
+
+clean :
+ rm -f Makefile.dep *.o
+
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+
+#include <allParam.h>
+
+#include "i_lowercase.h"
+
+int i_lowercase(const char *testid, const Param *param) {
+ char *name = "tname";
+ char *idx = "tint";
+ unsigned long int result;
+ int rows;
+ int retVal;
+ int myRetVal;
+
+#ifdef VERBOSE
+ printf("%s : Param_getInt: Lowercase input on correct statements.\n", testid);
+#endif
+
+ retVal = Param_getInt(param, name, idx, &rows, &result);
+ if ((rows == 1) && (result == 100) && (retVal == 0)) {
+ myRetVal = 0;
+ printf("%s : Passed.\n", testid);
+ } else {
+#ifdef VERBOSE
+ printf("%s : Failed. Rows: %d, result: \'%ld\', return Value: %d.\n", testid, rows, result, retVal);
+ printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+#else
+ printf("%s : Failed.\n", testid);
+#endif
+ myRetVal = -1;
+ }
+ return myRetVal;
+}
+
--- /dev/null
+#ifndef I_LOWERCASE_H
+#define I_LOWERCASE_H
+
+#include <allParam.h>
+
+int i_lowercase(const char *, const Param *);
+
+#endif
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+
+#include <allParam.h>
+
+#include "i_no_index.h"
+
+int i_no_index(const char *testid, const Param *param) {
+ char *name = "tname";
+ char *idx = "bla";
+ unsigned long int result;
+ int rows;
+ int retVal;
+ int myRetVal;
+
+#ifdef VERBOSE
+ printf("%s : Param_getInt: Non-existing idx.\n", testid);
+#endif
+
+ retVal = Param_getInt(param, name, idx, &rows, &result);
+ if ((rows == 0) && (retVal == 0)) {
+ myRetVal = 0;
+ printf("%s : Passed.\n", testid);
+ } else {
+#if VERBOSE
+ printf("%s : Failed. Rows: %d, return Value: %d.\n", testid, rows, retVal);
+ printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+#else
+ printf("%s : Failed.\n", testid);
+#endif
+ myRetVal = -1;
+ }
+ return myRetVal;
+}
+
--- /dev/null
+#ifndef I_NO_INDEX_H
+#define I_NO_INDEX_H
+
+#include <allParam.h>
+
+int i_no_index(const char *, const Param *);
+
+#endif
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+
+#include <allParam.h>
+
+#include "i_string_available.h"
+
+int i_string_available(const char *testid, const Param *param) {
+ char *name = "tname";
+ char *idx = "tstring";
+ unsigned long int result;
+ int rows;
+ int retVal;
+ int myRetVal;
+
+#ifdef VERBOSE
+ printf("%s : Param_getInt: Integer is wanted but string-like value found.\n", testid);
+#endif
+
+ retVal = Param_getInt(param, name, idx, &rows, &result);
+ if ((rows == 0) && (retVal == -1)) {
+ myRetVal = 0;
+ printf("%s : Passed.\n", testid);
+ } else {
+#if VERBOSE
+ printf("%s : Failed. Rows: %d, return Value: %d.\n", testid, rows, retVal);
+ printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+#else
+ printf("%s : Failed.\n", testid);
+#endif
+ myRetVal = -1;
+ }
+ return myRetVal;
+}
+
--- /dev/null
+#ifndef I_STRING_AVAILABLE_H
+#define I_STRING_AVAILABLE_H
+
+#include <allParam.h>
+
+int i_string_available(const char *, const Param *);
+
+#endif
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+
+#include <allParam.h>
+
+#include "i_uppercase.h"
+
+int i_uppercase(const char *testid, const Param *param) {
+ char *name = "TNAME";
+ char *idx = "TINT";
+ unsigned long int result;
+ int rows;
+ int retVal;
+ int myRetVal;
+
+#ifdef VERBOSE
+ printf("%s : Param_getInt: Uppercase input on correct statements.\n", testid);
+#endif
+
+ retVal = Param_getInt(param, name, idx, &rows, &result);
+ if ((rows == 1) && (result == 100) && (retVal == 0)) {
+ myRetVal = 0;
+ printf("%s : Passed.\n", testid);
+ } else {
+#ifdef VERBOSE
+ printf("%s : Failed. Rows: %d, result: \'%ld\', return Value: %d.\n", testid, rows, result, retVal);
+ printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+#else
+ printf("%s : Failed.\n", testid);
+#endif
+ myRetVal = -1;
+ }
+ return myRetVal;
+}
+
--- /dev/null
+#ifndef I_UPPERCASE_H
+#define I_UPPERCASE_H
+
+#include <allParam.h>
+
+int i_uppercase(const char *, const Param *);
+
+#endif
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+
+#include <allParam.h>
+
+#include "ia_long_array.h"
+
+int ia_long_array(const char *testid, const Param *param) {
+ char *name = "tname";
+ char *idx = "tinta";
+ unsigned long int result[NUM6];
+ int rows;
+ int resultsum = 1;
+ int i;
+ int retVal;
+ int myRetVal;
+
+#ifdef VERBOSE
+ printf("%s : Param_getIntArray: To many array members available.\n", testid);
+#endif
+
+ retVal = Param_getIntArray(param, name, idx, NUM6, &rows, result);
+ for(i = 0 ; i < NUM6 ; i++) {
+ resultsum &= (result[i] == i + 1 - 2*(i%2));
+ }
+ if ((rows == NUM6) && resultsum && (retVal == 0)) {
+ myRetVal = 0;
+ printf("%s : Passed.\n", testid);
+ } else {
+#ifdef VERBOSE
+ printf("%s : Failed. Rows: %d, return Value: %d\n", testid, rows, retVal);
+ printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+#else
+ printf("%s : Failed.\n", testid);
+#endif
+ myRetVal = -1;
+ }
+ return myRetVal;
+}
+
--- /dev/null
+#ifndef IA_LONG_ARRAY_H
+#define IA_LONG_ARRAY_H
+
+#include <allParam.h>
+
+#define NUM2 32
+#define NUM6 16
+
+int ia_long_array(const char *, const Param *);
+
+#endif
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+
+#include <allParam.h>
+
+#include "ia_lowercase.h"
+
+int ia_lowercase(const char *testid, const Param *param) {
+ char *name = "tname";
+ char *idx = "tinta";
+ unsigned long int result[NUM2];
+ int rows;
+ int resultsum = 1;
+ int i;
+ int retVal;
+ int myRetVal;
+
+#ifdef VERBOSE
+ printf("%s : Param_getIntArray: Lowercase input on correct statements.\n", testid);
+#endif
+
+ retVal = Param_getIntArray(param, name, idx, NUM2, &rows, result);
+ for(i = 0 ; i < NUM2 ; i++) {
+ resultsum &= (result[i] == i + 1 - 2*(i%2));
+ }
+ if ((rows == NUM2) && resultsum && (retVal == 0)) {
+ myRetVal = 0;
+ printf("%s : Passed.\n", testid);
+ } else {
+#ifdef VERBOSE
+ printf("%s : Failed. Rows: %d, result array:\n", testid, rows);
+ for(i = 0 ; i < NUM2 ; i++) {
+ printf("result[%d]: %ld.\n", i, result[i]);
+ }
+ printf("return Value: %d.\n", retVal);
+ printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+#else
+ printf("%s : Failed.\n", testid);
+#endif
+ myRetVal = -1;
+ }
+ return myRetVal;
+}
+
--- /dev/null
+#ifndef IA_LOWERCASE_H
+#define IA_LOWERCASE_H
+
+#include <allParam.h>
+
+#define NUM2 32
+
+int ia_lowercase(const char *, const Param *);
+
+#endif
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+
+#include <allParam.h>
+
+#include "ia_no_index.h"
+
+int ia_no_index(const char *testid, const Param *param) {
+ char *name = "tname";
+ char *idx = "bla";
+ unsigned long int result[NUM2];
+ int rows;
+ int retVal;
+ int myRetVal;
+
+#ifdef VERBOSE
+ printf("%s : Param_getIntArray: Non-existing idx.\n", testid);
+#endif
+
+ retVal = Param_getIntArray(param, name, idx, NUM2, &rows, result);
+ if ((rows == 0) && (retVal == 0)) {
+ myRetVal = 0;
+ printf("%s : Passed.\n", testid);
+ } else {
+#ifdef VERBOSE
+ printf("%s : Failed. Rows: %d, return Value: %d\n", testid, rows, retVal);
+ printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+#else
+ printf("%s : Failed.\n", testid);
+#endif
+ myRetVal = -1;
+ }
+ return myRetVal;
+}
+
--- /dev/null
+#ifndef IA_NO_INDEX_H
+#define IA_NO_INDEX_H
+
+#include <allParam.h>
+
+#define NUM2 32
+
+int ia_no_index(const char *, const Param *);
+
+#endif
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+
+#include <allParam.h>
+
+#include "ia_short_array.h"
+
+int ia_short_array(const char *testid, const Param *param) {
+ char *name = "tname";
+ char *idx = "tinta";
+ unsigned long int result[NUM4];
+ int rows;
+ int resultsum = 1;
+ int i;
+ int retVal;
+ int myRetVal;
+
+#ifdef VERBOSE
+ printf("%s : Param_getIntArray: To few array members available.\n", testid);
+#endif
+
+ retVal = Param_getIntArray(param, name, idx, NUM4, &rows, result);
+ for(i = 0 ; i < NUM2 ; i++) {
+ resultsum &= (result[i] == i + 1 - 2*(i%2));
+ }
+ if ((rows == NUM2) && resultsum && (retVal == 0)) {
+ myRetVal = 0;
+ printf("%s : Passed.\n", testid);
+ } else {
+#ifdef VERBOSE
+ printf("%s : Failed. Rows: %d, return Value: %d\n", testid, rows, retVal);
+ printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+#else
+ printf("%s : Failed.\n", testid);
+#endif
+ myRetVal = -1;
+ }
+ return myRetVal;
+}
+
--- /dev/null
+#ifndef IA_SHORT_ARRAY_H
+#define IA_SHORT_ARRAY_H
+
+#include <allParam.h>
+
+#define NUM2 32
+#define NUM4 64
+
+int ia_short_array(const char *, const Param *);
+
+#endif
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+
+#include <allParam.h>
+
+#include "ia_string_available.h"
+
+int ia_string_available(const char *testid, const Param *param) {
+ char *name = "tname";
+ char *idx = "tstringa";
+ unsigned long int result[NUM1];
+ int rows;
+ int retVal;
+ int myRetVal;
+
+#ifdef VERBOSE
+ printf("%s : Param_getIntArray: Int is wanted but String-like values found.\n", testid);
+#endif
+
+ retVal = Param_getIntArray(param, name, idx, NUM1, &rows, result);
+ if ((rows == 0) && (retVal == -1)) {
+ myRetVal = 0;
+ printf("%s : Passed.\n", testid);
+ } else {
+#ifdef VERBOSE
+ printf("%s : Failed. Rows: %d, return Value: %d\n", testid, rows, retVal);
+ printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+#else
+ printf("%s : Failed.\n", testid);
+#endif
+ myRetVal = -1;
+ }
+ return myRetVal;
+}
+
--- /dev/null
+#ifndef IA_STRING_AVAILABLE_H
+#define IA_STRING_AVAILABLE_H
+
+#include <allParam.h>
+
+#define NUM1 8
+
+int ia_string_available(const char *, const Param *);
+
+#endif
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+
+#include <allParam.h>
+
+#include "ia_uppercase.h"
+
+int ia_uppercase(const char *testid, const Param *param) {
+ char *name = "TNAME";
+ char *idx = "TINTA";
+ unsigned long int result[NUM2];
+ int rows;
+ int resultsum = 1;
+ int i;
+ int retVal;
+ int myRetVal;
+
+#ifdef VERBOSE
+ printf("%s : Param_getIntArray: Uppercase input on correct statements.\n", testid);
+#endif
+
+ retVal = Param_getIntArray(param, name, idx, NUM2, &rows, result);
+ for(i = 0 ; i < NUM2 ; i++) {
+ resultsum &= (result[i] == i + 1 - 2*(i%2));
+ }
+ if ((rows == NUM2) && resultsum && (retVal == 0)) {
+ myRetVal = 0;
+ printf("%s : Passed.\n", testid);
+ } else {
+#ifdef VERBOSE
+ printf("%s : Failed. Rows: %d, result array:\n", testid, rows);
+ for(i = 0 ; i < NUM2 ; i++) {
+ printf("result[%d]: %ld.\n", i, result[i]);
+ }
+ printf("return Value: %d.\n", retVal);
+ printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+#else
+ printf("%s : Failed.\n", testid);
+#endif
+ myRetVal = -1;
+ }
+ return myRetVal;
+}
+
--- /dev/null
+#ifndef IA_UPPERCASE_H
+#define IA_UPPERCASE_H
+
+#include <allParam.h>
+
+#define NUM2 32
+
+int ia_uppercase(const char *, const Param *);
+
+#endif
--- /dev/null
+all :
+ $(MAKE) depend "CFLAGS=$(CFLAGS)"
+ $(MAKE) -f Makefile.dep "CFLAGS=$(CFLAGS)"
+
+depend :
+ rm -f Makefile.dep
+ ../bin/echoobjs.sh > Makefile.dep
+ gcc -MM $(CFLAGS) *.c >> Makefile.dep
+
+clean :
+ rm -f Makefile.dep *.o
+
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+
+#include <allParam.h>
+
+#include "s_array.h"
+
+int s_array(const char *testid, const Param *param) {
+ char *name = "tname";
+ char *idx = "tstringa";
+ char result[PARAM_MAX_VALUE_LEN];
+ int rows;
+ int retVal;
+ int myRetVal;
+
+#ifdef VERBOSE
+ printf("%s : Param_getString: Request for Array value.\n", testid);
+#endif
+
+ retVal = Param_getString(param, name, idx, &rows, result);
+ if ((rows == 1) &&
+ result && (strcmp(result, "test1") == 0) &&
+ (retVal == 0)) {
+ myRetVal = 0;
+ printf("%s : Passed.\n", testid);
+ } else {
+#ifdef VERBOSE
+ printf("%s : Failed. Rows: %d, result : \'%s\', return Value: %d.\n", testid, rows, result, retVal);
+ printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+#else
+ printf("%s : Failed.\n", testid);
+#endif
+ myRetVal = -1;
+ }
+ return myRetVal;
+}
+
--- /dev/null
+#ifndef S_ARRAY_H
+#define S_ARRAY_H
+
+#include <allParam.h>
+
+int s_array(const char *, const Param *);
+
+#endif
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+
+#include <allParam.h>
+
+#include "s_int_available.h"
+
+int s_int_available(const char *testid, const Param *param) {
+ char *name = "tname";
+ char *idx = "tint";
+ char result[PARAM_MAX_VALUE_LEN];
+ int rows;
+ int retVal;
+ int myRetVal;
+
+#ifdef VERBOSE
+ printf("%s : Param_getString: String is wanted but int-like value found.\n", testid);
+#endif
+
+ retVal = Param_getString(param, name, idx, &rows, result);
+ if ((rows == 1) && result && (strcmp(result, "100") == 0) && (retVal == 0)) {
+ myRetVal = 0;
+ printf("%s : Passed.\n", testid);
+ } else {
+#ifdef VERBOSE
+ printf("%s : Failed. Rows: %d, result: \'%s\', return Value: %d.\n", testid, rows, result, retVal);
+ printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+#else
+ printf("%s : Failed.\n", testid);
+#endif
+ myRetVal = -1;
+ }
+ return myRetVal;
+}
+
--- /dev/null
+#ifndef S_INT_AVAILABLE_H
+#define S_INT_AVAILABLE_H
+
+#include <allParam.h>
+
+int s_int_available(const char *, const Param *);
+
+#endif
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+
+#include <allParam.h>
+
+#include "s_lowercase.h"
+
+int s_lowercase(const char *testid, const Param *param) {
+ char *name = "tname";
+ char *idx = "tstring";
+ char result[PARAM_MAX_VALUE_LEN];
+ int rows;
+ int retVal;
+ int myRetVal;
+
+#ifdef VERBOSE
+ printf("%s : Param_getString: Lowercase input on correct statements.\n", testid);
+#endif
+
+ retVal = Param_getString(param, name, idx, &rows, result);
+ if ((rows == 1) && result && (strcmp(result, "test100") == 0) && (retVal == 0)) {
+ myRetVal = 0;
+ printf("%s : Passed.\n", testid);
+ } else {
+#ifdef VERBOSE
+ printf("%s : Failed. Rows: %d, result: \'%s\', return Value: %d.\n", testid, rows, result, retVal);
+ printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+ myRetVal = -1;
+#else
+ printf("%s : Failed.\n", testid);
+#endif
+ }
+ return myRetVal;
+}
+
--- /dev/null
+#ifndef S_LOWERCASE_H
+#define S_LOWERCASE_H
+
+#include <allParam.h>
+
+int s_lowercase(const char *, const Param *);
+
+#endif
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+
+#include <allParam.h>
+
+#include "s_no_index.h"
+
+int s_no_index(const char *testid, const Param *param) {
+ char *name = "tname";
+ char *idx = "bla";
+ char result[PARAM_MAX_VALUE_LEN];
+ int rows;
+ int retVal;
+ int myRetVal;
+
+#ifdef VERBOSE
+ printf("%s : Param_getString: Non-existing idx.\n", testid);
+#endif
+
+ retVal = Param_getString(param, name, idx, &rows, result);
+ if ((rows == 0) && (retVal == 0)) {
+ myRetVal = 0;
+ printf("%s : Passed.\n", testid);
+ } else {
+#ifdef VERBOSE
+ printf("%s : Failed. Rows: %d, return Value: %d.\n", testid, rows, retVal);
+ printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+#else
+ printf("%s : Failed.\n", testid);
+#endif
+ myRetVal = -1;
+ }
+ return myRetVal;
+}
+
--- /dev/null
+#ifndef S_NO_INDEX_H
+#define S_NO_INDEX_H
+
+#include <allParam.h>
+
+int s_no_index(const char *, const Param *);
+
+#endif
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+
+#include <allParam.h>
+
+#include "s_uppercase.h"
+
+int s_uppercase(const char *testid, const Param *param) {
+ char *name = "TNAME";
+ char *idx = "TSTRING";
+ char result[PARAM_MAX_VALUE_LEN];
+ int rows;
+ int retVal;
+ int myRetVal;
+
+#ifdef VERBOSE
+ printf("%s : Param_getString: Uppercase input on correct statements.\n", testid);
+#endif
+
+ retVal = Param_getString(param, name, idx, &rows, result);
+ if ((rows == 1) && result && (strcmp(result, "test100") == 0) && (retVal == 0)) {
+ myRetVal = 0;
+ printf("%s : Passed.\n", testid);
+ } else {
+#ifdef VERBOSE
+ printf("%s : Failed. Rows: %d, result: \'%s\', return Value: %d.\n", testid, rows, result, retVal);
+ printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+#else
+ printf("%s : Failed.\n", testid);
+#endif
+ myRetVal = -1;
+ }
+ return myRetVal;
+}
+
--- /dev/null
+#ifndef S_UPPERCASE_H
+#define S_UPPERCASE_H
+
+#include <allParam.h>
+
+int s_uppercase(const char *, const Param *);
+
+#endif
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <allParam.h>
+
+#include "sa_int_available.h"
+
+int sa_int_available(const char *testid, const Param *param) {
+ char *name = "tname";
+ char *idx = "tinta";
+ char *result[NUM2];
+ int rows;
+ int retVal;
+ int myRetVal;
+ int i;
+
+ for (i = 0 ; i < NUM2 ; i++) {
+ result[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char));
+ }
+#ifdef VERBOSE
+ printf("%s : Param_getStringArray: String is wanted but Int-like values found.\n", testid);
+#endif
+
+ retVal = Param_getStringArray(param, name, idx, NUM2, &rows, result);
+ if ((rows == NUM2) &&
+ result[0] && (strcmp(result[0], "1") == 0) &&
+ result[1] && (strcmp(result[1], "0") == 0) &&
+ result[2] && (strcmp(result[2], "3") == 0) &&
+ result[3] && (strcmp(result[3], "2") == 0) &&
+ result[4] && (strcmp(result[4], "5") == 0) &&
+ result[5] && (strcmp(result[5], "4") == 0) &&
+ result[6] && (strcmp(result[6], "7") == 0) &&
+ result[7] && (strcmp(result[7], "6") == 0) &&
+ result[8] && (strcmp(result[8], "9") == 0) &&
+ result[9] && (strcmp(result[9], "8") == 0) &&
+ result[10] && (strcmp(result[10], "11") == 0) &&
+ result[11] && (strcmp(result[11], "10") == 0) &&
+ result[12] && (strcmp(result[12], "13") == 0) &&
+ result[13] && (strcmp(result[13], "12") == 0) &&
+ result[14] && (strcmp(result[14], "15") == 0) &&
+ result[15] && (strcmp(result[15], "14") == 0) &&
+ result[16] && (strcmp(result[16], "17") == 0) &&
+ result[17] && (strcmp(result[17], "16") == 0) &&
+ result[18] && (strcmp(result[18], "19") == 0) &&
+ result[19] && (strcmp(result[19], "18") == 0) &&
+ result[20] && (strcmp(result[20], "21") == 0) &&
+ result[21] && (strcmp(result[21], "20") == 0) &&
+ result[22] && (strcmp(result[22], "23") == 0) &&
+ result[23] && (strcmp(result[23], "22") == 0) &&
+ result[24] && (strcmp(result[24], "25") == 0) &&
+ result[25] && (strcmp(result[25], "24") == 0) &&
+ result[26] && (strcmp(result[26], "27") == 0) &&
+ result[27] && (strcmp(result[27], "26") == 0) &&
+ result[28] && (strcmp(result[28], "29") == 0) &&
+ result[29] && (strcmp(result[29], "28") == 0) &&
+ result[30] && (strcmp(result[30], "31") == 0) &&
+ result[31] && (strcmp(result[31], "30") == 0) &&
+ (retVal == 0)) {
+ myRetVal = 0;
+ printf("%s : Passed.\n", testid);
+ } else {
+#ifdef VERBOSE
+ printf("%s : Failed. Rows: %d, return Value: %d.\n", testid, rows, retVal);
+ printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+#else
+ printf("%s : Failed.\n", testid);
+#endif
+ myRetVal = -1;
+ }
+ for (i = 0 ; i < NUM2 ; i++) {
+ free(result[i]);
+ }
+ return myRetVal;
+}
+
--- /dev/null
+#ifndef SA_INT_AVAILABLE_H
+#define SA_INT_AVAILABLE_H
+
+#include <allParam.h>
+
+#define NUM2 32
+
+int sa_int_available(const char *, const Param *);
+
+#endif
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <allParam.h>
+
+#include "sa_long_array.h"
+
+int sa_long_array(const char *testid, const Param *param) {
+ char *name = "tname";
+ char *idx = "tstringa";
+ char *result[NUM5];
+ int rows;
+ int retVal;
+ int myRetVal;
+ int i;
+
+ for (i = 0 ; i < NUM5 ; i++) {
+ result[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char));
+ }
+#ifdef VERBOSE
+ printf("%s : Param_getStringArray: To many array members available.\n", testid);
+#endif
+
+ retVal = Param_getStringArray(param, name, idx, NUM5, &rows, result);
+ if ((rows == NUM5) &&
+ result[0] && (strcmp(result[0], "test1") == 0) &&
+ result[1] && (strcmp(result[1], "test0") == 0) &&
+ result[2] && (strcmp(result[2], "test3") == 0) &&
+ result[3] && (strcmp(result[3], "test2") == 0) &&
+ (retVal == 0)) {
+ myRetVal = 0;
+ printf("%s : Passed.\n", testid);
+ } else {
+#ifdef VERBOSE
+ printf("%s : Failed. Rows: %d, return Value: %d.\n", testid, rows, retVal);
+ printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+#else
+ printf("%s : Failed.\n", testid);
+#endif
+ myRetVal = -1;
+ }
+ for (i = 0 ; i < NUM5 ; i++) {
+ free(result[i]);
+ }
+ return myRetVal;
+}
+
--- /dev/null
+#ifndef SA_LONG_ARRAY_H
+#define SA_LONG_ARRAY_H
+
+#include <allParam.h>
+
+#define NUM1 8
+#define NUM5 4
+
+int sa_long_array(const char *, const Param *);
+
+#endif
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <allParam.h>
+
+#include "sa_lowercase.h"
+
+int sa_lowercase(const char *testid, const Param *param) {
+ char *name = "tname";
+ char *idx = "tstringa";
+ char *result[NUM1];
+ int rows;
+ int retVal;
+ int myRetVal;
+ int i;
+
+ for (i = 0 ; i < NUM1 ; i++) {
+ result[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char));
+ }
+#ifdef VERBOSE
+ printf("%s : Param_getStringArray: Lowercase input on correct statements.\n", testid);
+#endif
+
+ retVal = Param_getStringArray(param, name, idx, NUM1, &rows, result);
+ if ((rows == NUM1) &&
+ result[0] && (strcmp(result[0], "test1") == 0) &&
+ result[1] && (strcmp(result[1], "test0") == 0) &&
+ result[2] && (strcmp(result[2], "test3") == 0) &&
+ result[3] && (strcmp(result[3], "test2") == 0) &&
+ result[4] && (strcmp(result[4], "test5") == 0) &&
+ result[5] && (strcmp(result[5], "test4") == 0) &&
+ result[6] && (strcmp(result[6], "test7") == 0) &&
+ result[7] && (strcmp(result[7], "test6") == 0) &&
+ (retVal == 0)) {
+ myRetVal = 0;
+ printf("%s : Passed.\n", testid);
+ } else {
+#ifdef VERBOSE
+ printf("%s : Failed. Rows: %d, result array:\n%s\n\n%s\n\n%s\n\n%s\n\n%s\n\n%s\n\n%s\n\n%s\nreturn Value: %d.\n", testid, rows,
+ result[0],
+ result[1],
+ result[2],
+ result[3],
+ result[4],
+ result[5],
+ result[6],
+ result[7],
+ retVal);
+ printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+#else
+ printf("%s : Failed.\n", testid);
+#endif
+ myRetVal = -1;
+ }
+ for (i = 0 ; i < NUM1 ; i++) {
+ free(result[i]);
+ }
+ return myRetVal;
+}
+
--- /dev/null
+#ifndef SA_LOWERCASE_H
+#define SA_LOWERCASE_H
+
+#include <allParam.h>
+
+#define NUM1 8
+
+int sa_lowercase(const char *, const Param *);
+
+#endif
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <allParam.h>
+
+#include "sa_no_index.h"
+
+int sa_no_index(const char *testid, const Param *param) {
+ char *name = "tname";
+ char *idx = "bla";
+ char *result[NUM1];
+ int rows;
+ int retVal;
+ int myRetVal;
+ int i;
+
+ for (i = 0 ; i < NUM1 ; i++) {
+ result[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char));
+ }
+#ifdef VERBOSE
+ printf("%s : Param_getStringArray: Non-existing idx.\n", testid);
+#endif
+
+ retVal = Param_getStringArray(param, name, idx, NUM1, &rows, result);
+ if ((rows == 0) && (retVal == 0)) {
+ myRetVal = 0;
+ printf("%s : Passed.\n", testid);
+ } else {
+#ifdef VERBOSE
+ printf("%s : Failed. Rows: %d, return Value: %d.\n", testid, rows, retVal);
+ printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+#else
+ printf("%s : Failed.\n", testid);
+#endif
+ myRetVal = -1;
+ }
+ for (i = 0 ; i < NUM1 ; i++) {
+ free(result[i]);
+ }
+ return myRetVal;
+}
+
--- /dev/null
+#ifndef SA_NO_INDEX_H
+#define SA_NO_INDEX_H
+
+#include <allParam.h>
+
+#define NUM1 8
+
+int sa_no_index(const char *, const Param *);
+
+#endif
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <allParam.h>
+
+#include "sa_scalar.h"
+
+int sa_scalar(const char *testid, const Param *param) {
+ char *name = "tname";
+ char *idx = "tstring";
+ char *result[NUM1];
+ int i;
+ int rows;
+ int retVal;
+ int myRetVal;
+
+ for (i = 0 ; i < NUM1 ; i++) {
+ result[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char));
+ }
+#ifdef VERBOSE
+ printf("%s : Param_getStringArray: Request for a scalar value.\n", testid);
+#endif
+
+ retVal = Param_getStringArray(param, name, idx, NUM1, &rows, result);
+ if ((rows == 1) && result && (strcmp(result[0], "test100") == 0) && (retVal == 0)) {
+ myRetVal = 0;
+ printf("%s : Passed.\n", testid);
+ } else {
+#ifdef VERBOSE
+ printf("%s : Failed. Rows: %d, result: \'%s\', return Value: %d.\n", testid, rows, result[0], retVal);
+ printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+#else
+ printf("%s : Failed.\n", testid);
+#endif
+ myRetVal = -1;
+ }
+ for (i = 0 ; i < NUM1 ; i++) {
+ free(result[i]);
+ }
+ return myRetVal;
+}
+
--- /dev/null
+#ifndef SA_SCALAR_H
+#define SA_SCALAR_H
+
+#include <allParam.h>
+
+#define NUM1 8
+
+int sa_scalar(const char *, const Param *);
+
+#endif
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <allParam.h>
+
+#include "sa_short_array.h"
+
+int sa_short_array(const char *testid, const Param *param) {
+ char *name = "tname";
+ char *idx = "tstringa";
+ char *result[NUM3];
+ int rows;
+ int retVal;
+ int myRetVal;
+ int i;
+
+ for (i = 0 ; i < NUM3 ; i++) {
+ result[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char));
+ }
+#ifdef VERBOSE
+ printf("%s : Param_getStringArray: To few array members available.\n", testid);
+#endif
+
+ retVal = Param_getStringArray(param, name, idx, NUM3, &rows, result);
+ if ((rows == NUM1) &&
+ result[0] && (strcmp(result[0], "test1") == 0) &&
+ result[1] && (strcmp(result[1], "test0") == 0) &&
+ result[2] && (strcmp(result[2], "test3") == 0) &&
+ result[3] && (strcmp(result[3], "test2") == 0) &&
+ result[4] && (strcmp(result[4], "test5") == 0) &&
+ result[5] && (strcmp(result[5], "test4") == 0) &&
+ result[6] && (strcmp(result[6], "test7") == 0) &&
+ result[7] && (strcmp(result[7], "test6") == 0) &&
+ (retVal == 0)) {
+ myRetVal = 0;
+ printf("%s : Passed.\n", testid);
+ } else {
+#ifdef VERBOSE
+ printf("%s : Failed. Rows: %d, return Value: %d.\n", testid, rows, retVal);
+ printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+#else
+ printf("%s : Failed.\n", testid);
+#endif
+ myRetVal = -1;
+ }
+ for (i = 0 ; i < NUM3 ; i++) {
+ free(result[i]);
+ }
+ return myRetVal;
+}
+
--- /dev/null
+#ifndef SA_SHORT_ARRAY_H
+#define SA_SHORT_ARRAY_H
+
+#include <allParam.h>
+
+#define NUM1 8
+#define NUM3 16
+
+int sa_short_array(const char *, const Param *);
+
+#endif
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <allParam.h>
+
+#include "sa_uppercase.h"
+
+int sa_uppercase(const char *testid, const Param *param) {
+ char *name = "TNAME";
+ char *idx = "TSTRINGA";
+ char *result[NUM1];
+ int rows;
+ int retVal;
+ int myRetVal;
+ int i;
+
+ for (i = 0 ; i < NUM1 ; i++) {
+ result[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char));
+ }
+#ifdef VERBOSE
+ printf("%s : Param_getStringArray: Uppercase input on correct statements.\n", testid);
+#endif
+
+ retVal = Param_getStringArray(param, name, idx, NUM1, &rows, result);
+ if ((rows == NUM1) &&
+ result[0] && (strcmp(result[0], "test1") == 0) &&
+ result[1] && (strcmp(result[1], "test0") == 0) &&
+ result[2] && (strcmp(result[2], "test3") == 0) &&
+ result[3] && (strcmp(result[3], "test2") == 0) &&
+ result[4] && (strcmp(result[4], "test5") == 0) &&
+ result[5] && (strcmp(result[5], "test4") == 0) &&
+ result[6] && (strcmp(result[6], "test7") == 0) &&
+ result[7] && (strcmp(result[7], "test6") == 0) &&
+ (retVal == 0)) {
+ myRetVal = 0;
+ printf("%s : Passed.\n", testid);
+ } else {
+#ifdef VERBOSE
+ printf("%s : Failed. Rows: %d, result array:\n%s\n\n%s\n\n%s\n\n%s\n\n%s\n\n%s\n\n%s\n\n%s\nreturn Value: %d.\n", testid, rows,
+ result[0],
+ result[1],
+ result[2],
+ result[3],
+ result[4],
+ result[5],
+ result[6],
+ result[7],
+ retVal);
+ printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+#else
+ printf("%s : Failed.\n", testid);
+#endif
+ myRetVal = -1;
+ }
+ for (i = 0 ; i < NUM1 ; i++) {
+ free(result[i]);
+ }
+ return myRetVal;
+}
+
--- /dev/null
+#ifndef SA_UPPERCASE_H
+#define SA_UPPERCASE_H
+
+#include <allParam.h>
+
+#define NUM1 8
+
+int sa_uppercase(const char *, const Param *);
+
+#endif
#include <allParam.h>
-#include "test1.h"
-#include "test2.h"
-#include "test3.h"
-#include "test4.h"
-#include "test5.h"
-#include "test6.h"
-#include "test7.h"
-#include "test8.h"
-#include "test9.h"
-#include "test10.h"
-#include "test11.h"
-#include "test12.h"
-#include "test13.h"
-#include "test14.h"
-#include "test15.h"
-#include "test16.h"
-#include "test17.h"
-#include "test18.h"
-#include "test19.h"
-#include "test20.h"
-#include "test21.h"
-#include "test22.h"
+#include "int/i_lowercase.h"
+#include "int/i_no_index.h"
+#include "int/i_string_available.h"
+#include "int/i_uppercase.h"
+#include "int/ia_long_array.h"
+#include "int/ia_lowercase.h"
+#include "int/ia_no_index.h"
+#include "int/ia_short_array.h"
+#include "int/ia_string_available.h"
+#include "int/ia_uppercase.h"
+#include "string/s_array.h"
+#include "string/s_int_available.h"
+#include "string/s_lowercase.h"
+#include "string/s_no_index.h"
+#include "string/s_uppercase.h"
+#include "string/sa_int_available.h"
+#include "string/sa_long_array.h"
+#include "string/sa_lowercase.h"
+#include "string/sa_no_index.h"
+#include "string/sa_scalar.h"
+#include "string/sa_short_array.h"
+#include "string/sa_uppercase.h"
int main(int argc, char *argv[]) {
Param *param;
printf("================================================================================\n");
printf("%s : Starting test ...\n", argv[0]);
printf("================================================================================\n");
- errors -= test1("Test 1", param);
- errors -= test2("Test 2", param);
- errors -= test3("Test 3", param);
- errors -= test4("Test 4", param);
- errors -= test5("Test 5", param);
- errors -= test6("Test 6", param);
- errors -= test7("Test 7", param);
- errors -= test8("Test 8", param);
- errors -= test9("Test 9", param);
- errors -= test10("Test 10", param);
- errors -= test11("Test 11", param);
- errors -= test12("Test 12", param);
- errors -= test13("Test 13", param);
- errors -= test14("Test 14", param);
- errors -= test15("Test 15", param);
- errors -= test16("Test 16", param);
- errors -= test17("Test 17", param);
- errors -= test18("Test 18", param);
- errors -= test19("Test 19", param);
- errors -= test20("Test 20", param);
- errors -= test21("Test 21", param);
- errors -= test22("Test 22", param);
+
+ errors -= i_lowercase("int/i_lowercase", param);
+ errors -= i_no_index("int/i_no_index", param);
+ errors -= i_string_available("int/i_string_available", param);
+ errors -= i_uppercase("int/i_uppercase", param);
+ errors -= ia_long_array("int/ia_long_array", param);
+ errors -= ia_lowercase("int/ia_lowercase", param);
+ errors -= ia_no_index("int/ia_no_index", param);
+ errors -= ia_short_array("int/ia_short_array", param);
+ errors -= ia_string_available("int/ia_string_available", param);
+ errors -= ia_uppercase("int/ia_uppercase", param);
+ errors -= s_array("string/s_array", param);
+ errors -= s_int_available("string/s_int_available", param);
+ errors -= s_lowercase("string/s_lowercase", param);
+ errors -= s_no_index("string/s_no_index", param);
+ errors -= s_uppercase("string/s_uppercase", param);
+ errors -= sa_int_available("string/sa_int_available", param);
+ errors -= sa_long_array("string/sa_long_array", param);
+ errors -= sa_lowercase("string/sa_lowercase", param);
+ errors -= sa_no_index("string/sa_no_index", param);
+ errors -= sa_scalar("string/sa_scalar", param);
+ errors -= sa_short_array("string/sa_short_array", param);
+ errors -= sa_uppercase("string/sa_uppercase", param);
desParam(param);
free(param);