-static char rcsId[] = "$Id: evt.c,v 6.1 1999-08-31 10:37:23 muench Exp $";
+static char rcsId[] = "$Id: evt.c,v 6.2 1999-09-09 14:54:44 hades Exp $";
#define _ANSI_C_SOURCE
#include <stddef.h>
void *newEvt(UInt4 decoding, UInt4 id, UInt4 runNr)
{
void *my;
+ static UInt4 seqNr = 0;
+ time_t tempo;
+ struct tm *gmTime;
+ UInt4 dummy;
- my = allocMem(Evt_hdrSize());
+
+ my = allocMem(EVT_MAXSIZE);
Evt_setSize(my, Evt_hdrSize());
Evt_setDecoding(my, decoding);
Evt_setId(my, id);
Evt_setRunNr(my, runNr);
- return my;
-}
-
-void *getEvt(void *my)
-{
- static UInt4 seqNr = 0;
- time_t tempo;
- struct tm *gmTime;
- UInt4 dummy;
-
Evt_setSeqNr(my, seqNr++);
tempo = time(NULL);
void *Evt_appendSubEvt(void *my, void *subEvt)
{
- /* BUGBUG in principal, aligned memory size must be allocated */
- my = reallocMem(my, Evt_paddedSize(my) + SubEvt_size(subEvt));
memcpy(Evt_end(my), subEvt, SubEvt_size(subEvt));
Evt_setSize(my, Evt_paddedSize(my) + SubEvt_size(subEvt));
void *Evt_fget(FILE * file)
{
- static void *evt = NULL;
-
- if (evt != NULL) {
- freeMem(evt);
- }
- evt = allocMem(Evt_hdrSize());
+ static void evt[EVT_MAXSIZE];
if (Evt_hdrSize() != fread(evt, 1, Evt_hdrSize(), file)) {
msglog(LOG_DEBUG, "%s:%d: %s\n", __FILE__, __LINE__, strerror(errno));
return NULL;
}
- evt = reallocMem(evt, Evt_paddedSize(evt));
/* BUGBUG quickhack for a "Evt_paddedDataSize" */
if (Evt_paddedSize(evt) - Evt_hdrSize() != fread(Evt_data(evt), 1, Evt_paddedSize(evt) - Evt_hdrSize(), file)) {
#include "hadtu.h"
#include "subevt.h"
+#define EVT_MAXSIZE (100 * 1024)
+
static const int evtBlockSize = 8 * 1024;
enum EvtId {
void Evt_setRunNr(void *my, UInt4 runNr);
void *newEvt(UInt4 decoding, UInt4 id, UInt4 runNr);
-void *getEvt(void *my);
void deleteEvt(void *my);
int Evt_write(void *my, FILE * file);
void *Evt_fget(FILE * file);
-static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.4 1999-09-06 07:33:14 hades Exp $";
+static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.5 1999-09-09 14:54:44 hades Exp $";
#define _XOPEN_SOURCE
#include <unistd.h>
evt = appendFile(evt, slowCtrlFiles[i]);
}
if (outFile != NULL) {
- Evt_write(getEvt(evt), outFile);
+ Evt_write(evt, outFile);
}
deleteEvt(evt);
}
}
if (currNrOfSubEvts == nrOfSubEvts) {
- evt = getEvt(evt); /* BUGBUG differnce newEvt <> getEvt not
- necessary any more */
if (outFile != NULL) {
Evt_write(evt, outFile);
}
evt = appendFile(evt, slowCtrlFiles[i]);
}
if (outFile != NULL) {
- Evt_write(getEvt(evt), outFile);
+ Evt_write(evt, outFile);
}
deleteEvt(evt);