]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
Now using the parameter library from Benjamin Sailer
authorhades <hades>
Thu, 21 Sep 2000 09:28:47 +0000 (09:28 +0000)
committerhades <hades>
Thu, 21 Sep 2000 09:28:47 +0000 (09:28 +0000)
to be found on ftp.e12.physik.tu-muenchen.de

25 files changed:
hadaq/Makefile
hadaq/daq_lib.c
hadaq/daq_lib.h
hadaq/daqctrl.c
hadaq/hwdtu.c
hadaq/hwdtu.h
hadaq/hwmdc.c
hadaq/hwrace.c
hadaq/hwrace.h
hadaq/hwrich.c
hadaq/hwsam.c
hadaq/hwsam.h
hadaq/hwship.c
hadaq/hwship.h
hadaq/hwshow.c
hadaq/hwsoft.c
hadaq/hwtbus.c
hadaq/hwtip.c
hadaq/hwtip.h
hadaq/hwtof.c
hadaq/hwtrig.c
hadaq/makeenv
hadaq/param.c [deleted file]
hadaq/param.h [deleted file]
hadaq/param.tcl

index 979d1818672011c91ba4a1d1d64fc9a25d7eabbf..7373d0b44f64603436672a95bce4949483c8e670 100644 (file)
@@ -14,7 +14,7 @@
 COPTS = -g
 CFLAGS = $(COPTS) $(INCLUDES) $(DEFINES)
 
-DAQCTRL_OBJS = daqctrl.o daq_lib.o param.o \
+DAQCTRL_OBJS = daqctrl.o daq_lib.o \
        worker.o psxshm.o mman.o
 DAQ_XMANAGE_OBJS = tcldaq.o tkAppInit.o \
        agent_clnt.o agent_xdr.o worker.o psxshm.o mman.o
@@ -24,7 +24,7 @@ DAQ_AGENT_OBJS = agent.o agent_svc.o agent_xdr.o \
        worker.o psxshm.o mman.o
 DAQ_READOUT_OBJS = readout.o \
        worker.o \
-       $(HW_OBJS) param.o subevt.o \
+       $(HW_OBJS) subevt.o \
        shmtrans.o semaphore.o hadtuqueue.o \
                psxshm.o mman.o \
                hadtu.o
@@ -145,22 +145,22 @@ evtbuild.o: evtbuild.c worker.h psxshm.h evt.h hadtu.h subevt.h \
 hadtu.o: hadtu.c hadtu.h
 hadtuqueue.o: hadtuqueue.c hadtu.h hadtuqueue.h
 hldread.o: hldread.c evt.h hadtu.h subevt.h hldread.h
-hwdtu.o: hwdtu.c subevt.h hadtu.h param.h hwdtu.h rc.h
-hwmdc.o: hwmdc.c param.h subevt.h hadtu.h hwsam.h hardware.h
-hwrace.o: hwrace.c subevt.h hadtu.h param.h rc.h hwrace.h
-hwrich.o: hwrich.c param.h subevt.h hadtu.h hwrace.h rc.h hardware.h
-hwsam.o: hwsam.c subevt.h hadtu.h sam_defs.h hwsam.h param.h
-hwship.o: hwship.c param.h ipc_basis.h hwship.h
-hwshow.o: hwshow.c param.h subevt.h hadtu.h hwship.h hardware.h
-hwsis3801.o: hwsis3801.c subevt.h hadtu.h param.h hwsis3801.h rc.h
-hwsoft.o: hwsoft.c subevt.h hadtu.h param.h hardware.h
-hwtbus.o: hwtbus.c param.h subevt.h hadtu.h hwdtu.h rc.h hardware.h
-hwtip.o: hwtip.c subevt.h hadtu.h param.h tof_defs.h hwtip.h
-hwtof.o: hwtof.c param.h subevt.h hadtu.h hwtip.h hardware.h
-hwtrig.o: hwtrig.c subevt.h hadtu.h param.h hardware.h
-hwv488.o: hwv488.c subevt.h hadtu.h param.h hwv488.h rc.h
-hwv775.o: hwv775.c subevt.h hadtu.h param.h hwv775.h rc.h
-hwv878.o: hwv878.c subevt.h hadtu.h param.h hwv878.h rc.h
+hwdtu.o: hwdtu.c subevt.h hadtu.h hwdtu.h rc.h
+hwmdc.o: hwmdc.c subevt.h hadtu.h hwsam.h hardware.h
+hwrace.o: hwrace.c subevt.h hadtu.h rc.h hwrace.h
+hwrich.o: hwrich.c subevt.h hadtu.h hwrace.h rc.h hardware.h
+hwsam.o: hwsam.c subevt.h hadtu.h sam_defs.h hwsam.h
+hwship.o: hwship.c ipc_basis.h hwship.h
+hwshow.o: hwshow.c subevt.h hadtu.h hwship.h hardware.h
+hwsis3801.o: hwsis3801.c subevt.h hadtu.h hwsis3801.h rc.h
+hwsoft.o: hwsoft.c subevt.h hadtu.h hardware.h
+hwtbus.o: hwtbus.c subevt.h hadtu.h hwdtu.h rc.h hardware.h
+hwtip.o: hwtip.c subevt.h hadtu.h tof_defs.h hwtip.h
+hwtof.o: hwtof.c subevt.h hadtu.h hwtip.h hardware.h
+hwtrig.o: hwtrig.c subevt.h hadtu.h hardware.h
+hwv488.o: hwv488.c subevt.h hadtu.h hwv488.h rc.h
+hwv775.o: hwv775.c subevt.h hadtu.h hwv775.h rc.h
+hwv878.o: hwv878.c subevt.h hadtu.h hwv878.h rc.h
 memnet.o: memnet.c shmtrans.h semaphore.h psxshm.h hadtuqueue.h \
  hadtu.h nettrans.h worker.h
 mman.o: mman.c mman.h
@@ -172,7 +172,6 @@ online.o: online.c evt.h hadtu.h subevt.h online.h
 online_clnt.o: online_clnt.c online.h
 online_svc.o: online_svc.c online.h
 online_xdr.o: online_xdr.c online.h
-param.o: param.c param.h
 psxshm.o: psxshm.c mman.h psxshm.h
 rc.o: rc.c rc.h
 readout.o: readout.c grmblfx.h hardware.h shmtrans.h semaphore.h \
index 0b422a88e55ff90b9eaae36c8697dc0aad520616..b91c86c3181c77a09287c1c9ac74926bf891a4b2 100644 (file)
@@ -1,70 +1,93 @@
-static char rcsId[] = "$Id: daq_lib.c,v 6.1 2000-07-18 14:24:36 hades Exp $";
+static char rcsId[] = "$Id: daq_lib.c,v 6.2 2000-09-21 09:28:47 hades Exp $";
 
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <lvme.h>
-#include "param.h"
+#include <p.h>
 #include "worker.h"
 #include "daq_lib.h"
 
-int Daq_reset(const char *name, const Param *param)
+typedef struct OurParamsS {
+       char file[PARAM_MAX_VALUE_LEN];
+       char args[PARAM_MAX_VALUE_LEN];
+} OurParams;
+
+static OurParams *getParams(const char *n, const Param *p) {
+       static OurParams *pa = NULL;
+
+       if (pa == NULL) {
+               int i;
+
+               pa = malloc(sizeof(OurParams));
+
+               if (pa == NULL
+                       || -1 == Param_getString(p, n, "file", &i, pa->file) || i == 0
+                       || -1 == Param_getString(p, n, "args", &i, pa->args) || i == 0
+               ) {
+                       free(pa);
+                       pa = NULL;
+               }
+       }
+
+       return pa;
+}
+
+int Daq_reset(const char *n, const Param *p)
 {
-       Daq_stop(name, param);
+       Daq_stop(n, p);
 
        return 0;
 }
 
-int Daq_init(const char *name, const Param *param)
+int Daq_init(const char *n, const Param *p)
 {
-       Daq_reset(name, param);
+       Daq_reset(n, p);
 
        return 0;
 }
 
-int Daq_start(const char *name, const Param *param)
+int Daq_start(const char *n, const Param *p)
 {
-       const char *file;
-       const char *args;
        char *argv[512];
        int i;
        char *s;
+       OurParams *pa;
 
-       file = Param_getString(param, name, "file");
-       args = Param_getString(param, name, "args");
+       pa = getParams(n, p);
 
        i = 0;
-       s = malloc(strlen(args));
-       strcpy(s, args);
+       s = malloc(strlen(pa->args) + 1);
+       strcpy(s, pa->args);
        while((argv[i++] = strtok(s, " \t\n")) != NULL) {
                s = NULL;
        }
        free(s);
-       return Worker_start(file, argv);
+       return Worker_start(pa->file, argv);
 }
 
-int Daq_stop(const char *name, const Param *param)
+int Daq_stop(const char *n, const Param *p)
 {
-       const char *args;
        char *s;
+       OurParams *pa;
 
-       args = Param_getString(param, name, "args");
-       s = malloc(strlen(args));
-       strcpy(s, args);
+       pa = getParams(n, p);
+       s = malloc(strlen(pa->args) + 1);
+       strcpy(s, pa->args);
        strtok(s, " \t\n");
        Worker_stop(s, 15);
        free(s);
        return 0;
 }
 
-int Daq_status(const char *name, const Param *param)
+int Daq_status(const char *n, const Param *p)
 {
-       const char *args;
        char *s;
+       OurParams *pa;
 
-       args = Param_getString(param, name, "args");
-       s = malloc(strlen(args));
-       strcpy(s, args);
+       pa = getParams(n, p);
+       s = malloc(strlen(pa->args) + 1);
+       strcpy(s, pa->args);
        strtok(s, " \t\n");
        puts(Worker_status(s));
        free(s);
index dace452974d1481c4b0e8d1fcc973b5fb61aae25..1a3b2eb4018e648f4e0ef1771a4650a2e18398d5 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef Daq_LIB_H
 #define Daq_LIB_H
 
-#include "param.h"
+#include <param.h>
 
 int Daq_init(const char *name, const Param *param);
 int Daq_reset(const char *name, const Param *param);
index a944fccb604e74c02f292d15ee7871cd5d882fee..c42244e2260dc12a5c0554a85e0acf2a9cfd0fc5 100644 (file)
@@ -1,4 +1,4 @@
-static char rcsId[] = "$Id: daqctrl.c,v 6.1 2000-07-18 14:24:36 hades Exp $";
+static char rcsId[] = "$Id: daqctrl.c,v 6.2 2000-09-21 09:28:47 hades Exp $";
 
 #include <stdlib.h>
 #include <stddef.h>
@@ -7,7 +7,7 @@ static char rcsId[] = "$Id: daqctrl.c,v 6.1 2000-07-18 14:24:36 hades Exp $";
 #include <strings.h>
 #include <signal.h>
 
-#include "param.h"
+#include <param.h>
 
 #include "daq_lib.h"
 
index 0f370a78a5910457052b27f3e4d8cd781ed990ed..a43e5f190dec3e6c1f4772f3525c6c14c92795f8 100644 (file)
@@ -1,4 +1,4 @@
-static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwdtu.c,v 1.3 2000-07-18 14:24:36 hades Exp $";
+static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwdtu.c,v 1.4 2000-09-21 09:28:47 hades Exp $";
 
 #define _POSIX_C_SOURCE 199309L
 #include <unistd.h>
@@ -13,12 +13,13 @@ static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/had
 
 
 #include "subevt.h"
-#include "param.h"
+#include <param.h>
 #include "hwdtu.h"
 
 int conHwDtu(HwDtu *my, const char *name, const Param *param)
 {
        unsigned long cardBase;
+       int paramWasFound;
        int i;
 
        assert(my != NULL);
@@ -26,7 +27,13 @@ int conHwDtu(HwDtu *my, const char *name, const Param *param)
        strcpy(my->name, name);
        my->trigNr = 0;
 
-       cardBase = Param_getInt(param, my->name, "cardbase");
+       Param_getInt(param, my->name, "cardbase", &paramWasFound, &cardBase);
+       if (!paramWasFound) {
+               msglog(LOG_WARNING,
+                       "Parameter %s(%s) not found, default = 0\n", my->name, "cardbase");
+               cardBase = 0;
+       }
+
        my->lvme = allocMem(sizeof(LVme));
 
        if (0 > conLVme(my->lvme, cardBase, 0x10000, 0x09, DTU_MAGIC, 1)) {
index 2c331595b50888d6b8b53cac25ca391b1463bd7c..14ad5bd8dfac8a3d4ec1ebdd0882bceb3b5782c7 100644 (file)
@@ -4,7 +4,7 @@
 #include <lvme.h>
 #include "rc.h"
 
-#include "param.h"
+#include <param.h>
 
 typedef struct HwDtuS {
        char name[16];
index 42191513bdb1397077be4b2fffc0b0f63c847c6e..d21546124840ab0ce12ff35fcad0eee1c6701e19 100644 (file)
@@ -1,4 +1,4 @@
-static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwmdc.c,v 6.4 2000-07-18 14:24:36 hades Exp $";
+static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwmdc.c,v 6.5 2000-09-21 09:28:47 hades Exp $";
 
 #define _POSIX_C_SOURCE 199309L
 #include <unistd.h>
@@ -8,7 +8,7 @@ static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/had
 #include <string.h> 
 #include <sys/time.h>
 
-#include "param.h"
+#include <param.h>
 #include "subevt.h"
 #include "hwsam.h"
 
index 9acc8918dccdc6fed56eb0805f29f18608d05866..6569ecc5f6eee6cadc923c52d1214ce0332653ff 100644 (file)
@@ -1,4 +1,4 @@
-static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwrace.c,v 6.7 2000-07-18 14:24:36 hades Exp $";
+static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwrace.c,v 6.8 2000-09-21 09:28:47 hades Exp $";
 
 #define _POSIX_C_SOURCE 199309L
 #include <unistd.h>
@@ -14,7 +14,7 @@ static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/had
 
 
 #include "subevt.h"
-#include "param.h"
+#include <param.h>
 #include "rc.h"
 #include "hwrace.h"
 
@@ -38,6 +38,7 @@ static int endOfData(HwRace *my)
 int conHwRace(HwRace *my, const char *name, const Param *param)
 {
        unsigned long cardBase;
+       int paramWasFound;
        int i;
 
        assert(my != NULL);
@@ -46,7 +47,13 @@ int conHwRace(HwRace *my, const char *name, const Param *param)
 
        my->trigNr = 0;
 
-       cardBase = Param_getInt(param, my->name, "cardbase");
+       Param_getInt(param, my->name, "cardbase", &paramWasFound, &cardBase);
+       if (!paramWasFound) {
+               msglog(LOG_WARNING,
+                       "Parameter %s(%s) not found, default = 0\n", my->name, "cardbase");
+               cardBase = 0;
+       }
+
        my->rc = allocMem(sizeof(Rc));
 
        if (0 > conRc(my->rc, "rc", cardBase)) {
index 3818ea53692b86894276d27feb4c97a2497c0e06..250200a87fa9f5a991366d9e431a73f052726f31 100644 (file)
@@ -4,7 +4,7 @@
 #include <lvme.h>
 #include "rc.h"
 
-#include "param.h"
+#include <param.h>
 
 typedef struct HwRaceS {
   char name[16];
index a2717825ab4662ad988e1f18e3dc0027a0528c93..7d32615de2c18d942354b7e7db92f72e948d92bd 100644 (file)
@@ -1,4 +1,4 @@
-static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwrich.c,v 6.8 2000-07-18 14:24:36 hades Exp $";
+static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwrich.c,v 6.9 2000-09-21 09:28:47 hades Exp $";
 
 #define _POSIX_C_SOURCE 199309L
 #include <unistd.h>
@@ -16,7 +16,7 @@ static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/had
 #include "dtu_defs.h"
 
 #endif
-#include "param.h"
+#include <param.h>
 #include "subevt.h"
 #include "hwrace.h"
 
index 9d512b7822b8d7952488fa720cae64305c1d6ada..41f610d5a9baa5e4610e611835d3c39d989cb7b1 100644 (file)
@@ -42,13 +42,20 @@ static void acquireMode(HwSam *my) {
 int conHwSam(HwSam * my, const char *name, const Param *param)
 {
   unsigned long cardBase;
+       int paramWasFound;
   int i;
 
   assert(my != NULL);
 
   strcpy(my->name, name);
 
-  cardBase = Param_getInt(param, my->name, "cardbase");
+       Param_getInt(param, my->name, "cardbase", &paramWasFound, &cardBase);
+       if (!paramWasFound) {
+               msglog(LOG_WARNING,
+                       "Parameter %s(%s) not found, default = 0\n", my->name, "cardbase");
+               cardBase = 0;
+       }
+
   my->cram = allocMem(sizeof(LVme));
   if (0 > conLVme(my->cram, cardBase, 0x10000L, 0x09, 0x0, 4)) {
     msglog(LOG_ERR, "HwSam on %p not found\n", cardBase);
index 1ec60abe67f6b7db7d46f79877e3258546c270b2..7830b3fb6d80ce364e83bfb7e2b14fc94bbbffeb 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <lvme.h>
 
-#include "param.h"
+#include <param.h>
 
 typedef struct HwSamS {
   char name[16];
index b93779c003276042e1f20b018042ac1f79604cc8..83679a4e6f022953d3bdd9f4d9f2a495821fc3e5 100644 (file)
@@ -5,7 +5,7 @@
 #include <hadesstd.h>
 #include <lvme.h>
 
-#include "param.h"
+#include <param.h>
 
 #include "ipc_basis.h"
 #include "hwship.h"
@@ -90,13 +90,20 @@ static void acquireMode(HwShip *my) {
 int conHwShip(HwShip * my, const char *name, const Param *param)
 {
   unsigned long cardBase;
+       int paramWasFound;
   int i;
 
   assert(my != NULL);
 
   strcpy(my->name, name);
 
-  cardBase = Param_getInt(param, my->name, "cardbase");
+       Param_getInt(param, my->name, "cardbase", &paramWasFound, &cardBase);
+       if (!paramWasFound) {
+               msglog(LOG_WARNING,
+                       "Parameter %s(%s) not found, default = 0\n", my->name, "cardbase");
+               cardBase = 0;
+       }
+
   my->lvme = allocMem(sizeof(LVme));
   if (0 > conLVme(my->lvme, cardBase, 0x400000UL, 0x39UL, 0, 0)) {
     msglog(LOG_ERR, "HwShip on %p not found\n", cardBase);
index f64826fe6b213a6030c94b32de850f96454bc2b3..923742cf03001f24ae22a2af051d5cb5133aa2e6 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <lvme.h>
 
-#include "param.h"
+#include <param.h>
 
 typedef struct HwShipS {
   char name[16];
index 4a5cda874c4722188347ffedb0c71d320f4aa051..391bd43e2e37ce5d0a5ed7d7b3cfe5fa5b88bd79 100644 (file)
@@ -1,4 +1,4 @@
-static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwshow.c,v 6.7 2000-07-18 14:24:36 hades Exp $";
+static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwshow.c,v 6.8 2000-09-21 09:28:47 hades Exp $";
 
 #define _POSIX_C_SOURCE 199309L
 #include <unistd.h>
@@ -8,7 +8,7 @@ static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/had
 #include <string.h> 
 #include <sys/time.h>
 
-#include "param.h"
+#include <param.h>
 #include "subevt.h"
 #include "hwship.h"
 
index 2de1b4639d9064ab09dca9386e19fe09fe2789ff..9a03ad619d96b808ba14e8289e810c908433085e 100644 (file)
@@ -4,8 +4,9 @@
 
 #include <sys/time.h>
 
+#include <param.h>
+
 #include "subevt.h"
-#include "param.h"
 
 struct HardwareS {
        size_t maxSubEvtSize;
@@ -29,13 +30,21 @@ Hardware *newHardware(void)
 {
        Hardware *my;
        Param *param;
+       int paramWasFound;
+       unsigned long size;
 
        my = allocMem(sizeof(Hardware));
        my->maxSubEvtSize = 2 * SubEvt_hdrSize() + 5004 * sizeof(UInt4);
 
        param = allocMem(sizeof(Param));
        conParam(param);
-       printf("%d\n", Param_getInt(param, "soft", "size"));
+       Param_getInt(param, "soft", "size", &paramWasFound, &size);
+       if (!paramWasFound) {
+               msglog(LOG_WARNING,
+                       "Parameter %s(%s) not found, defaulting to 0\n", "soft", "size");
+               size = 0;
+       }
+       printf("size: %d\n", size);
        desParam(param);
        return my;
 }
index c09a5b7007db55d5b0b4d3dc262522b249761bbb..3521c0688033c77447d5726fe290a19076834764 100644 (file)
@@ -1,4 +1,4 @@
-static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwtbus.c,v 1.3 2000-07-18 14:24:36 hades Exp $";
+static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwtbus.c,v 1.4 2000-09-21 09:28:47 hades Exp $";
 
 #define _POSIX_C_SOURCE 199309L
 #include <unistd.h>
@@ -8,7 +8,7 @@ static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/had
 #include <string.h>
 #include <sys/time.h>
 
-#include "param.h"
+#include <param.h>
 #include "subevt.h"
 #include "hwdtu.h"
 
index 1769b546ca1acbfa105587e8454e51a470c3e7bb..f01cc02a862e62a914551863630fbf96a3f1b6ef 100644 (file)
@@ -9,7 +9,7 @@
 #if 1
 #include "subevt.h"
 #endif
-#include "param.h"
+#include <param.h>
 
 #include "tof_defs.h"
 #include "hwtip.h"
@@ -103,6 +103,7 @@ static int endOfData(HwTip * my)
 int conHwTip(HwTip * my, const char *name, const Param *param)
 {
        unsigned long cardBase;
+       int paramWasFound;
        int i;
 
        assert(my != NULL);
@@ -110,7 +111,13 @@ int conHwTip(HwTip * my, const char *name, const Param *param)
        signal(SIGBUS, sigbusHandler);
        strcpy(my->name, name);
 
-       cardBase = Param_getInt(param, my->name, "cardbase");
+       Param_getInt(param, my->name, "cardbase", &paramWasFound, &cardBase);
+       if (!paramWasFound) {
+               msglog(LOG_WARNING,
+                       "Parameter %s(%s) not found, default = 0\n", my->name, "cardbase");
+               cardBase = 0;
+       }
+
        my->lvme = allocMem(sizeof(LVme));
        if (0 > conLVme(my->lvme, cardBase, 0x2000000UL, 0x09UL, 0, 0)) {
                msglog(LOG_ERR, "HwTip on %p not found\n", cardBase);
index 84930e148f4396c2c72ba70117da0231b4dd978e..23178ddd3c55911646f648331d9b76ed8ea13da1 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <lvme.h>
 
-#include "param.h"
+#include <param.h>
 
 typedef struct HwTipS {
   char name[16];
index 04160f50fc5105011dadca33f8f167af336db24d..7f5785e43f37ac25338c00a7d6290b6194151b6a 100644 (file)
@@ -1,4 +1,4 @@
-static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwtof.c,v 1.12 2000-07-18 14:24:36 hades Exp $";
+static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/Attic/hwtof.c,v 1.13 2000-09-21 09:28:47 hades Exp $";
 
 #define _POSIX_C_SOURCE 199309L
 #include <unistd.h>
@@ -8,7 +8,7 @@ static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/had
 #include <string.h> 
 #include <sys/time.h>
 
-#include "param.h"
+#include <param.h>
 #include "subevt.h"
 #include "hwtip.h"
 
index f5477e5a687a9aef00685fe81fcecf97b35b4ad0..3c5bee21df56aae436d1b83caa08b1bfe48cc194 100644 (file)
@@ -6,7 +6,7 @@
 #include <lvme.h>
 
 #include "subevt.h"
-#include "param.h"
+#include <param.h>
 
 #define MU_EVT_COUNT    0x0e8014UL
 #define MU_FIFO         0x0000UL
@@ -39,6 +39,7 @@ Hardware *newHardware(void)
 {
        Hardware *my;
     unsigned long cardBase;
+       int paramWasFound;
        Param *param;
 
        my = allocMem(sizeof(Hardware));
@@ -49,7 +50,13 @@ Hardware *newHardware(void)
 
        param = allocMem(sizeof(Param));
        conParam(param);
-       cardBase = Param_getInt(param, "mu", "cardbase");
+       Param_getInt(param, "mu", "cardbase", &paramWasFound, &cardBase);
+       if (!paramWasFound) {
+               msglog(LOG_WARNING,
+                       "Parameter %s(%s) not found, default = 0\n", "mu", "cardbase");
+               cardBase = 0;
+       }
+
        desParam(param);
 
        my->lvme0 = allocMem(sizeof(LVme));
index caa0b3deaf3124b26f2a9fe2e4c65e854eb6d179..bae2a75f564d56836db35a64e80fe4225993406e 100644 (file)
@@ -26,15 +26,15 @@ elif test $HADAQ_CONF = "LINUX"
 then
        export CC="gcc"
        export RPCGEN="rpcgen"
-       export LOADLIBES="-L$HOME/lib/$SYSTYPE -lhadesstd -llatm -llvme -ltk -L/usr/X11R6/lib -lX11 -ltcl -lm -ldl -latm"
-       export INCLUDES="-I$HOME/include"
+       export LOADLIBES="-L$HOME/lib/$SYSTYPE -lhadesstd -llatm -llvme -ltclParam -ltk -L/usr/X11R6/lib -lX11 -ltcl -lm -ldl -latm"
+       export INCLUDES="-I$HOME/include -I$HOME/include/tcl"
        export DEFINES="-UNDEBUG -DHADESSTD_NEXITSTAT -DHADESSTD_NGETOPT"
 elif test $HADAQ_CONF = "LINUX_NOATM"
 then
        export CC="gcc"
        export RPCGEN="rpcgen"
-       export LOADLIBES="-L$HOME/lib/$SYSTYPE -lhadesstd -llatm -llvme -ltk -L/usr/X11R6/lib -lX11 -ltcl -lm -ldl"
-       export INCLUDES="-I$HOME/include"
+       export LOADLIBES="-L$HOME/lib/$SYSTYPE -lhadesstd -llatm -llvme -ltclParam -ltk -L/usr/X11R6/lib -lX11 -ltcl -lm -ldl"
+       export INCLUDES="-I$HOME/include -I$HOME/include/tcl"
        export DEFINES="-UNDEBUG -DHADESSTD_NEXITSTAT -DHADESSTD_NGETOPT -DNOATM"
 elif test $HADAQ_CONF = "LINUX_E128"
 then
diff --git a/hadaq/param.c b/hadaq/param.c
deleted file mode 100644 (file)
index eca5028..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-static char rcsId[] = "$Id: param.c,v 6.3 2000-07-18 14:24:36 hades Exp $";
-
-#include <unistd.h>
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <tcl.h>
-
-#include "param.h"
-
-int conParam(Param *my)
-{
-       int retVal;
-       char *fileName;
-       int code;
-
-       fileName = getenv("DAQSLOW_PARAM_FILE");
-       if (fileName == NULL) {
-               fileName = "param.tcl";
-       }
-       my->interp = Tcl_CreateInterp();
-       code = Tcl_EvalFile(my->interp, fileName);
-       if (*my->interp->result != 0) {
-               fprintf(stderr, "opening param file: %s\n", my->interp->result);
-               retVal = -1;
-       } else {
-               if (code != TCL_OK) {
-                       retVal = -1;
-               } else {
-                       retVal = 0;
-               }
-       }
-       return retVal;
-}
-
-void desParam(Param *my)
-{
-       Tcl_DeleteInterp(my->interp);
-}
-
-const char *Param_getString(const Param *my, const char *name, const char *idx)
-{
-       const char *val;
-
-       val = Tcl_GetVar2(my->interp, name, idx, 0);
-       if (val == NULL) {
-               val = "";
-               fprintf(stderr,
-                       "Parameter %s(%s) not found, default is \"\"\n", name, idx);
-       }
-       return val;
-}
-
-unsigned long Param_getInt(const Param *my, const char *name, const char *idx)
-{
-       return strtoul(Param_getString(my, name, idx), NULL, 0);
-}
diff --git a/hadaq/param.h b/hadaq/param.h
deleted file mode 100644 (file)
index fced49a..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef PARAM_H
-#define PARAM_H
-
-#include <tcl.h>
-
-typedef struct ParamS {
-       Tcl_Interp *interp;
-} Param;
-
-int conParam(Param *my);
-void desParam(Param *my);
-const char *Param_getString(const Param *my, const char *name, const char *idx);
-unsigned long Param_getInt(const Param *my, const char *name, const char *idx);
-
-#endif
index 147d891e4571c40f96b8bdcf03807f50fb35f0b4..da92502bea147db230138ddb0efe24d90ab3e89c 100644 (file)
@@ -1,5 +1,5 @@
 set evtbuild(file) ./daq_evtbuild
-set evtbuild(args) "daq_evtbuild -s 1 -m 1 -a"
+set evtbuild(args) "daq_evtbuild -s 1 -a"
 set netmem(file) ./daq_netmem
 set netmem(args) "daq_netmem -a -i UDP:0.0.0.0:3000 -m 1"
 set memnet(file) ./daq_memnet