From c40e63a6ae39b1065938a0c5444a235aa427fdf4 Mon Sep 17 00:00:00 2001 From: hades Date: Sat, 31 Mar 2001 16:26:53 +0000 Subject: [PATCH] *** empty log message *** --- allParam/README | 131 ++++++++++++++++++++++-------- allParam/RELEASE_NOTES | 38 +++++++-- allParam/ca/README | 4 +- allParam/test/string/s_conparam.c | 44 ++++++++++ allParam/test/string/s_conparam.h | 6 ++ allParam/test/string/s_no_setup.c | 44 ++++++++++ allParam/test/string/s_no_setup.h | 6 ++ 7 files changed, 229 insertions(+), 44 deletions(-) create mode 100644 allParam/test/string/s_conparam.c create mode 100644 allParam/test/string/s_conparam.h create mode 100644 allParam/test/string/s_no_setup.c create mode 100644 allParam/test/string/s_no_setup.h diff --git a/allParam/README b/allParam/README index 5f460b6..aa9dd04 100644 --- a/allParam/README +++ b/allParam/README @@ -2,7 +2,7 @@ Author: Benjamin Sailer TUM/E12 Benjamin.Sailer@ph.tum.de Version: 0.2 -Date: 2001-02-19 +Date: 2001-03-31 allParam libraries ================== @@ -32,26 +32,36 @@ compiletime). With libcaParam.a only a complete setup of a EPICS parameter server, which is contained in the HADES DAQ runctrl package, together with the param library can be tested. -2. How to install the allParam libraries ----------------------------------------- +2. How to make and install the allParam libraries +------------------------------------------------- Retrieve the libraries via ftp from -ftp://ftp.e12.physik.tu-muenchen.de/pub/hadsoft/allParam.0.2.tar.Z +ftp://ftp.e12.physik.tu-muenchen.de/pub/hadsoft/allParam-0.2.tar.Z and extract them to a directory of your own choice (which is only needed for -building, testing and installing the libraries). Although the sources are also -available via CVS, it is recommended to use only the tar archives, while CVS -is reserved for the developers of the libraries (as the checkouts are logged -by CVS). +building and testing the libraries). Although the sources are also available +via CVS, it is recommended to use only the tar archives, while CVS is reserved +for the developers of the libraries (as the checkouts are logged by CVS). Go into the extracted directory allParam and type +$ make +(where is one of 'ca', 'file', 'ora', 'psql' or 'tcl') to make a single +library. As making all of them is not very likely, (you will use only some of +them at all), this possibility is skipped in this version. +$ make _test compiles the sources for the test an performs one. The +results ca be seen in the files test/*_protocol.txt. +$ make _install +copies the libraries to $(LIBDIR) specified in the Makefile (usually +$HOME/lib/$SYSTYPE or /usr/local/lib) an the headerfile allParam.h to $(INCDIR) +($HOME/include or /usr/local/include). $ make _all -where is one of 'ca', 'file', 'ora', 'psql' or 'tcl', or simply +does the same as +$ make && make _test && make _install +. Note that +$ make _test +and +$ make _install +depend on $ make -if you want to make them all. '_all' includes installation to your home -directory respectively the subdirectories lib/$SYSTYPE and include as well as -compiling and running a test suite in the subdirectory allParam/test. A -protocol named _test_protocol.txt is created there but take care of the -fact, that failures may come due to missing parameter sources - as mentioned -above. +so the libraries will be made automatically before testing or installing. The usage of the enviroment variable $SYSTYPE applies to the fact that your home directory may be available from different os' with different binary file formats, which you should be able to use simultaneously. If you don't have this @@ -62,9 +72,6 @@ SYSTYPE=$(echo "$(uname -m)_$(uname -s)_$(uname -r)" | tr -c [:alnum:] _) export SYSTYPE into your ~/.profile. - If you want to install the libraries to another path (e.g. /usr/local/lib is -foreseen, if you want to make the libraries available systemwide as root), -the change of LIBPATH and INCPATH in the Makefiles is straight forward. 3. How to use the allParam libraries ------------------------------------ @@ -73,12 +80,15 @@ the change of LIBPATH and INCPATH in the Makefiles is straight forward. sources: - Param_getStringArray() retrieves an array of strings, +- Param_getFilename() is more specialized on strings representing files, - Param_getIntArray() makes a conversion to unsigned long integers (if all elements of the retrieved array can be converted properly; to decide this, the C-function strtoul(3) is used) -- Param_getString() and +- Param_getString(), +- Param_getFilename() and - Param_getInt() are aliases that retrieve only a scalar value (the first - element of an array) + element of an array), +- Param_getBlob() allows to receive an open file stream to read data from. Additionally, there are two functions that allow to store scalar values of unsigned integers respectively strings to the parameter source. These functions @@ -170,8 +180,23 @@ examples (one for each function): printf("%s(%s) : %s\n", name, idx2, valuei); } +/* Param_getFilename */ + const char *name = "tname"; + const char *idx3 = "tfile"; + char valuef[PARAM_MAX_VALUE_LEN]; + int row; + if(Param_getFilename(param, name, idx3, &row, valuef) != 0) { + sprintf(stderr, "%s : Param_getFilename() failed: %s", + argv[0], Param_getErrStr(param)); + exit (-1); + } else if(row == 0) { + sprintf(stderr, "%s(%s) not found.\n", name, idx3); + } else { + printf("%s(%s): %s\n", name, idx3, valuef); + } + /* Param_getStringArray */ - const char *idx3 = "tstringa"; + const char *idx4 = "tstringa"; char *valuesa[LEN]; int maxrows = LEN; int rows; @@ -183,33 +208,60 @@ examples (one for each function): exit(-1); } } - if(Param_getStringArray(param, name, idx3, maxrows, &rows, valuesa) != 0) { + if(Param_getStringArray(param, name, idx4, maxrows, &rows, valuesa) != 0) { sprintf(stderr, "%s : Param_getStringArray() failed: %s", argv[0], Param_getErrStr(param)); exit (-1); } else if(row == 0) { - sprintf(stderr, "%s(%s) not found.\n", name, idx3); + sprintf(stderr, "%s(%s) not found.\n", name, idx4); exit (-1); } else { for (i = 0 ; i < maxrows ; i++) { - printf("%s(%s %d) : %s\n", name, idx3, i, valuesa[i]); + printf("%s(%s %d) : %s\n", name, idx4, i, valuesa[i]); free(valuesa[i]); } } /* Param_getIntArray */ - const char *idx4 = "tinta"; + const char *idx5 = "tinta"; unsigned long int valueia[LEN]; - if(Param_getIntArray(param, name, idx4, maxrows, &rows, valueia) != 0) { + if(Param_getIntArray(param, name, idx5, maxrows, &rows, valueia) != 0) { sprintf(stderr, "%s : Param_getIntArray() failed: %s", argv[0], Param_getErrStr(param)); exit (-1); } else if(rows == 0) { - sprintf(stderr, "%s(%s) not found.\n", name, idx4); + sprintf(stderr, "%s(%s) not found.\n", name, idx5); + exit (-1); + } else { + for (i = 0 ; i < maxrows ; i++) { + printf("%s(%s %d) : %d\n", name, idx5, i, valueia[i]); + } + } + +/* Param_getFilenameArray */ + const char *idx6 = "tfilea"; + char *valuefa[LEN]; + int maxrows = LEN; + int rows; + int i; + for (i = 0 ; i < maxrows ; i++) { + valuesa[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char)); + if(valuefa[i] == 0) { + sprintf(stderr, "malloc() for value failed.\n"); + exit(-1); + } + } + if(Param_getFilenameArray(param, name, idx6, maxrows, &rows, valuefa) != 0) { + sprintf(stderr, "%s : Param_getFilenameArray() failed: %s", + argv[0], Param_getErrStr(param)); + exit (-1); + } else if(row == 0) { + sprintf(stderr, "%s(%s) not found.\n", name, idx6); exit (-1); } else { for (i = 0 ; i < maxrows ; i++) { - printf("%s(%s %d) : %d\n", name, idx4, i, valueia[i]); + printf("%s(%s %d) : %s\n", name, idx6, i, valuefa[i]); + free(valuefa[i]); } } @@ -228,10 +280,13 @@ currently set to 128. different value fields: - Param_getString() needs a char *, - Param_getInt() needs a unsigned long int *, +- Param_getFilename() needs a char *, - Param_getStringArray() needs a char** (which is not returned by - char valuesa[PARAM_MAX_VALUE_LEN][LEN] !) and + char valuesa[PARAM_MAX_VALUE_LEN][LEN] !), - Param_getIntArray() needs a unsigned long int *, too (but of course with - LEN * sizeof(unsigned long int) allocated memory behind) + LEN * sizeof(unsigned long int) allocated memory behind), +- Param_getFilenameArray() needs a char** (like Param_getStringArray() does) and +- Param_getBlob() needs a FILE ** 4. Known bugs and further developement perspectives --------------------------------------------------- @@ -240,14 +295,18 @@ different value fields: PARAM_MAX_NAME_LEN and PARAM_MAX_VALUE_LEN) is not checked in the testsuite yet. - EPICS has a much more strict limitation on the length of PV names (28 - including the prefix 'HAD:PARAM:'). So the full length of 127 + 127 + including the prefix 'HAD:Px::'). So the full length of 127 + 127 characters for name + idx cannot be used when including a libcaParam.a in the - data path. Also libfileParam.a only supports an overall length of 127 for the - string s when s is produced via sprintf(s, "%s(%s%d)", name, idx, i). -- As a fifth data type, blobs (binary large objects) should be supported in the - future. + data path. Although the test suite shows, that channel access may also work + with longer PV name lengths, the next version should take advantage of the + EPICS Release 3.14 which promises to skip this limitation officially. +- Limitations on the size of blobs when they are transported via channel access + should no longer be valid in the next version. +- Up to now no concept is found to easily use the correct set of libraries + depending on the host architecture and operating system. However, this should + be a general rule to be available for all the hades libraries. -Please send bug reports to +Please send further bug reports to Benjamin.Sailer@ph.tum.de diff --git a/allParam/RELEASE_NOTES b/allParam/RELEASE_NOTES index 10b8991..f42c302 100644 --- a/allParam/RELEASE_NOTES +++ b/allParam/RELEASE_NOTES @@ -2,7 +2,7 @@ Author: Benjamin Sailer TUM/E12 Benjamin.Sailer@ph.tum.de Version: 0.2 -Date: 2001-02-21 +Date: 2001-03-31 allParam library Release Notes for Version 0.2 ============================================== @@ -31,9 +31,9 @@ is an alternative to the for compatibility reasons co-existing > conParam(Param *), that will be changed to the final > conParam(Param *, const char *) -in one of the next releases. For libfileParam.a and libtclParam.a, the setup -is translated to file names. See the READMEs of those particular libraries for -details. +in one of the next releases. +For libfileParam.a and libtclParam.a, the setup is translated to file names. +See the READMEs of those particular libraries for details. 3. Storage of parameters @@ -46,9 +46,35 @@ down the same parameters more than once which changes the value to the most recent one (or at least sould do that). Like parameters to read, parameters to write are identified by "setup", "name" and "idx". -4. Test extension +4. daq_*_param_cas -The test suite has been extended to proofe the new features. +From this version on, the package does not only contain the libraries for the +channel access parameter source, but also the sources to build the server. This +seems to be more consistent and allows testing for this special source without +the requirement of a extern parameter server. + +5. Param_getFilename() and Param_getFilenameArray() + +Two new functions have been introduced that can be handled like the string- +functions but give the user the possibility to change the prefix for all of +them by editing just one line in the tcl-file. This is especially useful for +moving files pointed to to another sub tree of the directory structure but +not to be dependend on relative paths to these files. + +6. Param_getBlob() + +The possibility to transport binary data as a unit has been introduced. Up to +now, this is realized as a file-stream and thus has no limitations for most +of the parameter sources while caParam just allows sizes up to 16368 bytes +(as a limitation of channel access). This limitation may be skipped in the +next version. + +7. Test extension + +The test suite has been extended to proof the new features. Subdirectories, +scripts before and after test execution allow more sophisticated tests, while +the structure provides the flexibility to skip single tests without any changes +in the sources (exept renaming the sources of the specified test). Bugfixes: --------- diff --git a/allParam/ca/README b/allParam/ca/README index 3ee2226..52aa37e 100644 --- a/allParam/ca/README +++ b/allParam/ca/README @@ -1,8 +1,8 @@ Author: Benjamin Sailer TUM/E12 Benjamin.Sailer@ph.tum.de -Version: 0.1 -Date: 2000-09-10 +Version: 0.2 +Date: 2001-03-31 Content ======= diff --git a/allParam/test/string/s_conparam.c b/allParam/test/string/s_conparam.c new file mode 100644 index 0000000..1a7c10d --- /dev/null +++ b/allParam/test/string/s_conparam.c @@ -0,0 +1,44 @@ +#include +#include +#include + +#include + +#include "s_conparam.h" + +int s_conparam(const char *testid) { + 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 + + param = malloc(sizeof(Param)); + conParam(param); + + 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; + } + + desParam(param); + free(param); + + return myRetVal; +} + diff --git a/allParam/test/string/s_conparam.h b/allParam/test/string/s_conparam.h new file mode 100644 index 0000000..75e6a89 --- /dev/null +++ b/allParam/test/string/s_conparam.h @@ -0,0 +1,6 @@ +#ifndef S_CONPARAM_H +#define S_CONPARAM_H + +int s_conparam(const char *); + +#endif diff --git a/allParam/test/string/s_no_setup.c b/allParam/test/string/s_no_setup.c new file mode 100644 index 0000000..9da3ece --- /dev/null +++ b/allParam/test/string/s_no_setup.c @@ -0,0 +1,44 @@ +#include +#include +#include + +#include + +#include "s_no_setup.h" + +int s_no_setup(const char *testid) { + 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 + + param = malloc(sizeof(Param)); + conSetupParam(param, NULL); + + 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; + } + + desParam(param); + free(param); + + return myRetVal; +} + diff --git a/allParam/test/string/s_no_setup.h b/allParam/test/string/s_no_setup.h new file mode 100644 index 0000000..6ac206e --- /dev/null +++ b/allParam/test/string/s_no_setup.h @@ -0,0 +1,6 @@ +#ifndef S_NO_SETUP_H +#define S_NO_SETUP_H + +int s_no_setup(const char *); + +#endif -- 2.43.0