]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
*** empty log message ***
authorhades <hades>
Wed, 16 Aug 2000 12:51:08 +0000 (12:51 +0000)
committerhades <hades>
Wed, 16 Aug 2000 12:51:08 +0000 (12:51 +0000)
allParam/file/Makefile
allParam/psql/Makefile [new file with mode: 0644]
allParam/psql/psqlParam.c [new file with mode: 0644]
allParam/psql/psqlParam.h [new file with mode: 0644]

index 52fda247aa922a30937ce7bbfa51a4c2e7f16828..bcf7a057023b7c40a4be4fb139afd19d5e77bc26 100644 (file)
@@ -1,5 +1,10 @@
 CXXFLAGS = -g -I../param
 
+libfileParam.a : param.o
+       $(AR) $(ARFLAGS) $@ $<
+
+param.o : param.c param.h
+
 fileParam.o : fileParam.cc fileParam.h ../param/enhParam.h
 
 clean :
diff --git a/allParam/psql/Makefile b/allParam/psql/Makefile
new file mode 100644 (file)
index 0000000..11c3685
--- /dev/null
@@ -0,0 +1,13 @@
+CFLAGS = -g
+
+libpsqlParam.a : param.o
+       $(AR) $(ARFLAGS) $@ $<
+
+param.o : param.c param.h
+
+clean :
+       rm -f *.o
+
+lib_clean :
+       rm -f *.o *.a
+
diff --git a/allParam/psql/psqlParam.c b/allParam/psql/psqlParam.c
new file mode 100644 (file)
index 0000000..8c1819a
--- /dev/null
@@ -0,0 +1,44 @@
+#define _POSIX_C_SOURCE 199509L
+
+/* Oracle communication area */
+#include <oraca.h>
+/* SQL communication area */ 
+#include <sqlca.h>
+
+#include "param.h"
+
+int conParam(Param *my)
+{
+       return 0;
+}
+
+void desParam(Param *my)
+{
+}
+
+int Param_getInt(const Param *my, const char *n, const char *i, int *v)
+{
+       return Param_getIntArray(my, n, i, 1, v);
+}
+
+int Param_getString(const Param *my, const char *n, const char *i, char *v)
+{
+       return Param_getStringArray(my, n, i, 1, &v);
+}
+
+int Param_getIntArray(const Param *my, const char *n, const char *i, int num, int *v)
+{
+       for (int i = 0 ; i<num ; i++) {
+               v[i] = 0;
+       }
+       return num;
+}
+
+int Param_getStringArray(const Param *my, const char *n, const char *i, int num, char **v)
+{
+       for (int i = 0 ; i<num ; i++) {
+               v[i] = "Blub";
+       }
+       return num;
+}
+
diff --git a/allParam/psql/psqlParam.h b/allParam/psql/psqlParam.h
new file mode 100644 (file)
index 0000000..ea8515c
--- /dev/null
@@ -0,0 +1,59 @@
+#ifndef PARAM_H
+#define PARAM_H
+
+/**************************************************************************
+ * Section containing struct Param (different in the different param.h's) *
+ **************************************************************************/
+
+typedef struct ParamS {
+} Param;
+
+/******************************************************************
+ * Section containing the API for param (common to all param.h's) *
+ ******************************************************************/
+
+int conParam(Param *);
+void desParam(Param *);
+
+/*
+ * All functions have a status as return value. If the return value is positive,
+ * it contains the number of array members returned (1 in case of
+ * Param_getString and Param_getInt, between 1 and num in case of
+ * Param_getStringArray and Param_getIntArray).
+ *
+ * Memory must be allocated for the result before the function is called.
+ * For example, calling Param_getInt needs
+ *
+ * > int status;
+ * > unsigned long int value;
+ * > if(status = Param_getInt(param, name, idx, value) != 1) {
+ * >     printf("No parameter 'value' found. Exiting.\n");
+ * >     exit(-1);
+ * > }
+ * 
+ * For strings char[PARAM_MAX_VALUE_LEN] has to be allocated. Therefore the
+ * above example expands to
+ *
+ * > int status;
+ * > int num = 32;
+ * > char value[PARAM_MAX_VALUE_LEN][num];
+ * > if(status = Param_getStringArray(param, name, idx, num, value) != num) {
+ * >     printf("Not enough elements of 'value' found. Exiting.\n");
+ * >     exit(-1);
+ * > }
+ * 
+ */
+
+#define PARAM_RV_NO_SUCH_PARAMETER 0
+#define PARAM_RV_FAILED -1
+
+#define PARAM_MAX_VALUE_LEN 128
+
+int Param_getInt(const Param *, const char *, const char *, unsigned long int *);
+int Param_getString(const Param *, const char *, const char *, char *);
+
+int Param_getIntArray(const Param *, const char *, const char *, int, unsigned long int *);
+int Param_getStringArray(const Param *, const char *, const char *, int, char **);
+
+#endif
+