From 6db9db5265e9960cdcefd638ba529780376dfc00 Mon Sep 17 00:00:00 2001 From: hades Date: Sun, 10 Sep 2000 17:02:58 +0000 Subject: [PATCH] *** empty log message *** --- allParam/ca/README | 51 +++++++++++++++++++++++++++ allParam/ca/caParam.c | 6 ++-- allParam/ca/caParam.h | 2 +- allParam/file/README | 55 ++++++++++++++++++++++++++++++ allParam/file/fileParam.c | 2 +- allParam/file/fileParam.h | 4 ++- allParam/ora/Makefile | 2 +- allParam/ora/README | 57 +++++++++++++++++++++++++++++++ allParam/ora/oraParam.h | 2 +- allParam/ora/oraParam.pc | 8 ++--- allParam/psql/README | 55 ++++++++++++++++++++++++++++++ allParam/psql/psqlParam.c | 2 +- allParam/psql/psqlParam.h | 2 +- allParam/tcl/README | 72 +++++++++++++++++++++++++++++++++++++++ allParam/tcl/tclParam.c | 2 +- allParam/tcl/tclParam.h | 2 +- 16 files changed, 308 insertions(+), 16 deletions(-) create mode 100644 allParam/ca/README create mode 100644 allParam/file/README create mode 100644 allParam/ora/README create mode 100644 allParam/psql/README create mode 100644 allParam/tcl/README diff --git a/allParam/ca/README b/allParam/ca/README new file mode 100644 index 0000000..7f36757 --- /dev/null +++ b/allParam/ca/README @@ -0,0 +1,51 @@ +Author: Benjamin Sailer + TUM/E12 + Benjamin.Sailer@ph.tum.de +Version: 0.1 +Date: 2000-09-10 + +libcaParam.a +============ + +Content +------- + +1. Compiletime requirements +2. Linktime requirements +3. Runtime requirments +4. Known bugs and further developement perspectives + +1. Compiletime requirements +--------------------------- + + To compile the channel access param library, you need the enviroment variable +EPICS_HOME set to the root of the EPICS tree. Make assumes that the used base +directory is right below the EPICS_HOME and called 'base/'. Tested with +R3.13.3, libcaParam.a can happen to work with earlier versions. + +2. Linktime requirements +------------------------ + +Ensure, that the EPICS libraries linked to the final objects are the same ones +you use to compile the libcaParam.a. + +3. Runtime requirments +---------------------- + + At runtime the library assumes to have a channel access server within the +EPICS_CA_ADDR_LIST that serves the parameters requested by the hosting program. +The requested channel names are +HAD:PARA:(uppercase ):(uppercase ) +and the library only asks for DBR_STRING types (as the EPICS conversion does +not treat hex-numbers like strtoul(3) does). So conversion to integers is done +by the library itself. + +4. Known bugs and further developement perspectives +--------------------------------------------------- + + Behaviour with timeouts is not understood quite well. + +Please send bug reports to + +Benjamin.Sailer@ph.tum.de + diff --git a/allParam/ca/caParam.c b/allParam/ca/caParam.c index 450c864..c512adf 100644 --- a/allParam/ca/caParam.c +++ b/allParam/ca/caParam.c @@ -38,9 +38,9 @@ int Param_getIntArray(const Param *my, const char *name, const char *idx, int ma int retVal = 0; int i; char *endptr; - char *value[PARAM_MAX_NVALS]; + char *value[PARAM_MAX_ARRAY_LEN]; - for (i = 0 ; i < PARAM_MAX_NVALS ; i++) { + for (i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { value[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char)); } @@ -57,7 +57,7 @@ int Param_getIntArray(const Param *my, const char *name, const char *idx, int ma *rows = 0; } - for (i = 0 ; i < PARAM_MAX_NVALS ; i++) { + for (i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { free(value[i]); } return retVal; diff --git a/allParam/ca/caParam.h b/allParam/ca/caParam.h index 38eb5ab..19f2ef6 100644 --- a/allParam/ca/caParam.h +++ b/allParam/ca/caParam.h @@ -1,7 +1,7 @@ #ifndef PARAM_H #define PARAM_H -#define PARAM_MAX_NVALS 1024 +#define PARAM_MAX_ARRAY_LEN 128 #define PARAM_MAX_VALUE_LEN 128 #define PARAM_MAX_NAME_LEN 128 diff --git a/allParam/file/README b/allParam/file/README new file mode 100644 index 0000000..8330d15 --- /dev/null +++ b/allParam/file/README @@ -0,0 +1,55 @@ +Author: Benjamin Sailer + TUM/E12 + Benjamin.Sailer@ph.tum.de +Version: 0.1 +Date: 2000-09-10 + +libfileParam.a +============== + +Content +------- + +1. Compiletime requirements +2. Linktime requirments +3. Runtime requirments +4. Known bugs and further developement perspectives + +1. Compiletime requirements +--------------------------- + + libfileParam.a only needs os APIs for file opening and closing. Therefore +no special libraries are needed at compiletime. + +2. Linktime requirments +----------------------- + + See compiletime requirements. + +3. Runtime requirments +---------------------- + + At runtime a file is opened containing data in a tcl-shaped way (arrays are +sets of parameters with a succeeding array index number in the tcl idx). When +the enviroment variable DAQSLOW_PARAM_FILE is set, the library looks up there +if it can find the data. If DAQSLOW_PARAM_FILE is not set, the library assumes +the param file to be 'param.tcl' in the working directory. + +4. Known bugs and further developement perspectives +--------------------------------------------------- + + Note that libfileParam.a is only existing for historical reasons and for the +poor people who don't have tcl available on their system. It is a little clone +of the libtclParam.a without requirnig the libtcl.so and has two +disadvantages: +- The simple algorithm does not allow the string values (and notations of a int + value, too) to contain whitespaces. +- The constructor of param allocates much memory to copy the entire file to + it. There is a magic maximum size for the number of single requested elements + set to PARAM_MAX_NVALS which is now set to 1024. +libfileParam.a is not likely to be developed any further but anyhow: + +Please send bug reports to + +Benjamin.Sailer@ph.tum.de + diff --git a/allParam/file/fileParam.c b/allParam/file/fileParam.c index c2bae3f..d4c65e6 100644 --- a/allParam/file/fileParam.c +++ b/allParam/file/fileParam.c @@ -74,7 +74,7 @@ int Param_getIntArray(const Param *my, const char *name, const char *idx, int ma int retVal = 0; int i; char *endptr; - char *strval[PARAM_MAX_NVALS]; + char *strval[PARAM_MAX_ARRAY_LEN]; for (i = 0 ; i < maxrows ; i++) { strval[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char)); diff --git a/allParam/file/fileParam.h b/allParam/file/fileParam.h index 135a1cc..65b5078 100644 --- a/allParam/file/fileParam.h +++ b/allParam/file/fileParam.h @@ -1,7 +1,7 @@ #ifndef PARAM_H #define PARAM_H -#define PARAM_MAX_NVALS 1024 +#define PARAM_MAX_ARRAY_LEN 128 #define PARAM_MAX_VALUE_LEN 128 #define PARAM_MAX_NAME_LEN 128 @@ -9,6 +9,8 @@ * Section containing struct Param (different in the different param.h's) * **************************************************************************/ +#define PARAM_MAX_NVALS 1024 + typedef struct ParamS { char *strerror; int nVals; diff --git a/allParam/ora/Makefile b/allParam/ora/Makefile index bac7c62..7a66fb8 100644 --- a/allParam/ora/Makefile +++ b/allParam/ora/Makefile @@ -1,6 +1,6 @@ CFLAGS = -g -ansi -Wall -I$(ORACLE_HOME)/precomp/public/ -ORA_USER = daq/daqall@db-hades.gsi.de +ORA_USER = hades/hades@db-hades.gsi.de PROC = $(ORACLE_HOME)/bin/proc PROCFLAGS = oraca=yes parse=partial sqlcheck=semantics \ diff --git a/allParam/ora/README b/allParam/ora/README new file mode 100644 index 0000000..162035f --- /dev/null +++ b/allParam/ora/README @@ -0,0 +1,57 @@ +Author: Benjamin Sailer + TUM/E12 + Benjamin.Sailer@ph.tum.de +Version: 0.1 +Date: 2000-09-10 + +liboraParam.a +============= + +Content +------- + +1. Compiletime requirements +2. Linktime requirments +3. Runtime requirments +4. Known bugs and further developement perspectives + +1. Compiletime requirements +--------------------------- + + At compiletime liboraParam.a needs the enviroment variable ORACLE_HOME +pointing to the root of the oracle development tree (containing the precompiler +proc, the include files oraca.h and sqlca.h). Additionally, you must have a +network connection to the hades oracle database on the GSI linux cluster. User +and password for a reading access are hardwired in the code (which is not very +elegant but an intrinsic feature of proc). + +2. Linktime requirments +----------------------- + + The above mentioned ORACLE_HOME must also exist at linktime, in this case to +provide the oracle sql libraries which are listed in the test directory +Makefile. + +3. Runtime requirments +---------------------- + + At runtime you also use hard wired access information and have to have a the +connection to the database, to. Therein the used parameters are all stored in +a table (view, to be more precise) that is called DAQ.PARAMS and has the +attributes NAME, IDX, SEQ_NUM, VALUE (which correspond to name, idx and value +respectively contain the sorting criterium for any array asked for). Of course, +this view contains a lookup in various tables that hold only specific data sets +and to supply these is a vast field not yet made applicable for normal users. + +4. Known bugs and further developement perspectives +--------------------------------------------------- + + The only data yet contained in the database are not very structured. Thus, +developing power has to be invested largely to work out the different database +tables and their content rather than looking for bugs (which I have not +disvovered up to now). Anyhow: + +Please send bug reports to + +Benjamin.Sailer@ph.tum.de + diff --git a/allParam/ora/oraParam.h b/allParam/ora/oraParam.h index 41c000f..9baaf93 100644 --- a/allParam/ora/oraParam.h +++ b/allParam/ora/oraParam.h @@ -1,7 +1,7 @@ #ifndef PARAM_H #define PARAM_H -#define PARAM_MAX_NVALS 1024 +#define PARAM_MAX_ARRAY_LEN 128 #define PARAM_MAX_VALUE_LEN 128 #define PARAM_MAX_NAME_LEN 128 diff --git a/allParam/ora/oraParam.pc b/allParam/ora/oraParam.pc index 3f1bd10..4cc1a84 100644 --- a/allParam/ora/oraParam.pc +++ b/allParam/ora/oraParam.pc @@ -17,8 +17,8 @@ static void Param_strerror(const Param *, const char *); int conParam(Param *my) { my->strerror = NULL; - my->user = "daq@db-hades.gsi.de"; - my->passwd = "daqall"; + my->user = "hades@db-hades.gsi.de"; + my->passwd = "hades"; return 0; } @@ -50,7 +50,7 @@ int Param_getIntArray(const Param *my, const char *name, const char *idx, int ma const char* pw; char sqlname[PARAM_MAX_NAME_LEN]; char sqlidx[PARAM_MAX_NAME_LEN]; - char value[PARAM_MAX_NVALS][PARAM_MAX_VALUE_LEN]; + char value[PARAM_MAX_ARRAY_LEN][PARAM_MAX_VALUE_LEN]; EXEC SQL END DECLARE SECTION; for(i = 0 ; i <= strlen(name) ; i++) { @@ -101,7 +101,7 @@ int Param_getStringArray(const Param *my, const char *name, const char *idx, int const char* pw; char sqlname[PARAM_MAX_NAME_LEN]; char sqlidx[PARAM_MAX_NAME_LEN]; - char value[PARAM_MAX_NVALS][PARAM_MAX_VALUE_LEN]; + char value[PARAM_MAX_ARRAY_LEN][PARAM_MAX_VALUE_LEN]; EXEC SQL END DECLARE SECTION; for(i = 0 ; i <= strlen(name) ; i++) { diff --git a/allParam/psql/README b/allParam/psql/README new file mode 100644 index 0000000..601504e --- /dev/null +++ b/allParam/psql/README @@ -0,0 +1,55 @@ +Author: Benjamin Sailer + TUM/E12 + Benjamin.Sailer@ph.tum.de +Version: 0.1 +Date: 2000-09-10 + +libpsqlParam.a +============== + +Content +------- + +1. Compiletime requirements +2. Linktime requirments +3. Runtime requirments +4. Known bugs and further developement perspectives + +1. Compiletime requirements +--------------------------- + + The PostgreSQL frontend header used here (which is delivered with the +posrgresql-devel package on actual Linux distributions) is called libpq-fe.h +and was found in /usr/include/pgsql on my system. As libpsqlParam.a was only +developed as a side path and is not really useful for the broad hades collab, +I didn't loos time investigating the situation on other os' or only other +distributions. + +2. Linktime requirments +----------------------- + + According to the above said, there is also no information available where to +find the libpq.[a|so] and the libcrypt.[a|so] on the diverse systems while at +redhat 6.0 they can be found in the normal library search path (/usr/lib). + +3. Runtime requirments +---------------------- + + libpsqlParam.a will try to open a connection to a postgres database located +on casino.e12.physik.tu-muenchen.de and called 'hadaq'. Note that actual data +are not likely to be available there, but the testing enviroment should be +in the current setup. + +4. Known bugs and further developement perspectives +--------------------------------------------------- + + As a testing object for independent database connections, libpsqlParam.a is +not rcommended for use at normal runtime. Anyway, if developing database +concepts on another machine with a tiny free database is wanted, libpsqlParam.a +can be a good choice together with some changes to the source code. So if you +are interested in libpsqlParam.a: + +Please send bug reports to + +Benjamin.Sailer@ph.tum.de + diff --git a/allParam/psql/psqlParam.c b/allParam/psql/psqlParam.c index fe21909..a847c05 100644 --- a/allParam/psql/psqlParam.c +++ b/allParam/psql/psqlParam.c @@ -51,7 +51,7 @@ int Param_getIntArray(const Param *my, const char *name, const char *idx, int ma } *rows = 0; - conn = PQconnectdb("host=casino dbname=bsailer user=bsailer"); + conn = PQconnectdb("host=casino.e12.physik.tu-muenchen.de dbname=hadaq user=bsailer"); sprintf(whereClause, "WHERE name = '%s' AND idx = '%s' ", lname, lidx); sprintf(query, "SELECT * FROM card_params %s UNION SELECT * FROM cpus %s UNION SELECT * FROM crate_params %s UNION SELECT * FROM crate_setup %s ORDER BY seq_num;", whereClause, whereClause, whereClause, whereClause); diff --git a/allParam/psql/psqlParam.h b/allParam/psql/psqlParam.h index d7e9ea6..6f4031f 100644 --- a/allParam/psql/psqlParam.h +++ b/allParam/psql/psqlParam.h @@ -1,7 +1,7 @@ #ifndef PARAM_H #define PARAM_H -#define PARAM_MAX_NVALS 1024 +#define PARAM_MAX_ARRAY_LEN 128 #define PARAM_MAX_VALUE_LEN 128 #define PARAM_MAX_NAME_LEN 128 diff --git a/allParam/tcl/README b/allParam/tcl/README new file mode 100644 index 0000000..0b844a1 --- /dev/null +++ b/allParam/tcl/README @@ -0,0 +1,72 @@ +Author: Benjamin Sailer + TUM/E12 + Benjamin.Sailer@ph.tum.de +Version: 0.1 +Date: 2000-09-10 + +libtclParam.a +============= + +Content +------- + +1. Compiletime requirements +2. Linktime requirments +3. Runtime requirments +4. Known bugs and further developement perspectives + +1. Compiletime requirements +--------------------------- + + At compiletime the only requirement for libtclParam.a is tcl.h, which should +be available on most UNIX systems in the default include path. + +2. Linktime requirments +----------------------- + + The library needs libtcl.a (or libtcl.so), which is normally located in the +defaut library path ('/usr/lib'). Anyhow, on some systems (like GSI Linux +cluster) there is no link from the actual version of the tcl library (somthing +like libtcl8.0.so) set to libtcl.so which forces you to change the Makefile in +that respect. Additionally sometimes there seems to be no static library but +only a shared object - which must not, but can, cause trouble if required other +libraries are not available (such as libm.a or libdl.a). + +3. Runtime requirments +---------------------- + + libtclParam.a starts a tcl-interpreter the input file of which has - of +course - to be a tcl file. The library looks up for the enviroment variable +DAQSLOW_PARAM_FILE and tries to open the file pointed to by it. If the variable +is not defined, libtclParam.a looks for param.tcl in the working directory. The +simple syntax of the tcl-file is just +set () +(where is either the supplied idx string or the latter combined with a +decimal representing the sequence number within an array). and +are their corresponting values of the param function call. + +4. Known bugs and further developement perspectives +--------------------------------------------------- + + In the tcl file, arrays are only recognized up to the size where the first +sequence number is missing (this is due to performance reasons). For example +card0(threshold0) 7 +card0(threshold1) 4 +card0(threshold2) 6 +card0(threshold3) 7 +card0(threshold4) 9 +card0(threshold6) 8 +card0(threshold7) 6 +card0(threshold8) 7 +will only return the first 4 threshold values, if requested via +Param_getIntArray(param, "card0", "threshold", 8, &rows, value); +In this respect, libtclParam.a (and also libfileParam.a) have a different +behaviour than the database oriented param sources (that return all values, +while the index of the single value is lost). Both behaviors are not the best +ways and will hopefully be canged to a third one, in which a placeholder value +is sent for all missing values. As in all READMEs, my request to you is: + +Please send additional bug reports to + +Benjamin.Sailer@ph.tum.de + diff --git a/allParam/tcl/tclParam.c b/allParam/tcl/tclParam.c index 69fae6c..c76be3d 100644 --- a/allParam/tcl/tclParam.c +++ b/allParam/tcl/tclParam.c @@ -57,7 +57,7 @@ int Param_getIntArray(const Param *my, const char *name, const char *idx, int ma int retVal = 0; int i; char *endptr; - char *strval[PARAM_MAX_NVALS]; + char *strval[PARAM_MAX_ARRAY_LEN]; for (i = 0 ; i < maxrows ; i++) { strval[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char)); diff --git a/allParam/tcl/tclParam.h b/allParam/tcl/tclParam.h index 003ba05..6f177bd 100644 --- a/allParam/tcl/tclParam.h +++ b/allParam/tcl/tclParam.h @@ -1,7 +1,7 @@ #ifndef PARAM_H #define PARAM_H -#define PARAM_MAX_NVALS 1024 +#define PARAM_MAX_ARRAY_LEN 128 #define PARAM_MAX_VALUE_LEN 128 #define PARAM_MAX_NAME_LEN 128 -- 2.43.0