GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> EDS / dev > ebf2c / rhel5-32
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <EDS/io/EBF_swap.h>
#include <EDS/io/EBF_stream.h>
#include <EDS/io/EBF_evts.h>
#include <EDS/EBF_evt.h>
Classes | |
struct | _Ctl |
Collections all the control parameters together. These are essentially the interpretted command line options. More... | |
Defines | |
#define | _ADVANCE(_ptr, _nbytes) (typeof (_ptr))((unsigned char *)(_ptr) + (_nbytes)) |
Advances _ptr by _nbytes. The return value is always recast to the type of _ptr. | |
Typedefs | |
typedef struct _Ctl | Ctl |
Typedef for struct _Ctl. | |
Functions | |
int | main (int argc, char **argv) |
Entry point for filter. | |
static int | fillCtl (int argc, char *argv[], Ctl *ctl) |
Examines the command line parameters and fills the print control structure. | |
static void | printCtl (const Ctl *ctl) |
Prints the contents of the print control context. | |
static int | convert (const Ctl *ctl) |
converts the .ebf to an output .c file | |
static void | reportUsage (void) |
Describes the command line parameters for daqeb_print. | |
static const char * | constructCname (const char *iname) |
Returns a pointer to the name of the output file. | |
static const char * | constructDname (const char *cname) |
Returns a pointer to the name of data structure. | |
static __inline EBF_evts | setupEvents (EBF_evts evts, int maxevts, int nskip, int *nevts) |
Skips to the first event to be output. | |
static void | printHeader (FILE *cfile, const char *iname, const char *dname, int totsize) |
Prints the C file heading. | |
static void | printEvents (FILE *cfile, EBF_evts evts, int nevts) |
Writes out the data, ASCII, for the each event. | |
static void | printTrailer (FILE *cfile) |
Adds the trailer to words to the output file. | |
static __inline const unsigned int * | printWrds (FILE *cfile, const unsigned int *wrds, int nwrds) |
Prints the array of 32-bit words in to the output file. |
CVS $Id: ebf2c.c,v 1.5 2011/08/04 19:46:12 russell Exp $
#define _ADVANCE | ( | _ptr, | |||
_nbytes | ) | (typeof (_ptr))((unsigned char *)(_ptr) + (_nbytes)) |
Advances _ptr by _nbytes. The return value is always recast to the type of _ptr.
_ptr | The pointer to advance | |
_nbytes | The number of nbytes to advance _ptr by. |
static const char * constructCname | ( | const char * | iname | ) | [static] |
Returns a pointer to the name of the output file.
iname | The name of the input file |
Referenced by fillCtl().
static const char * constructDname | ( | const char * | cname | ) | [static] |
Returns a pointer to the name of data structure.
cname | The name of the output "C" file |
Referenced by fillCtl().
static int convert | ( | const Ctl * | ctl | ) | [static] |
converts the .ebf to an output .c file
ctl | The control parameters, assumed to be already filled in |
References _Ctl::cname, _Ctl::dname, _Ctl::iname, printCtl(), printEvents(), printHeader(), printTrailer(), setupEvents(), _Ctl::to_process, and _Ctl::to_skip.
Referenced by main().
static int fillCtl | ( | int | argc, | |
char * | argv[], | |||
Ctl * | ctl | |||
) | [static] |
Examines the command line parameters and fills the print control structure.
argc | The number of command line parameters. | |
argv | The array of pointers to the command line parameters. | |
ctl | The run time parameters control block to be filled. |
0,Everything | is okay. | |
-1,Incorrect | command usage. Usually this means that the input file name was absent. |
$> ebf2c -n10 -s5 -c my_file.c my_file.ebf
Skips 5 events, then processes the next 10 of my_file.ebf. The output is rewritten to my_file.c
References _Ctl::cname, constructCname(), constructDname(), _Ctl::dname, _Ctl::iname, _Ctl::quiet, _Ctl::to_process, and _Ctl::to_skip.
Referenced by main().
int main | ( | int | argc, | |
char ** | argv | |||
) |
Entry point for filter.
argc | Standard argument count. | |
argv | Standard vector of command line parameter strings. |
0,if | successful -1, if the file does not exist or some other internal error. |
References convert(), fillCtl(), and reportUsage().
static void printCtl | ( | const Ctl * | ctl | ) | [static] |
Prints the contents of the print control context.
ctl | Pointer to the print control context block. |
References _Ctl::cname, _Ctl::dname, _Ctl::iname, _Ctl::to_process, and _Ctl::to_skip.
Referenced by convert().
static void printEvents | ( | FILE * | cfile, | |
EBF_evts | evts, | |||
int | nevts | |||
) | [static] |
Writes out the data, ASCII, for the each event.
cfile | The output file stream. | |
evts | The array of events to write out | |
nevts | The number of events to write out |
References EBF__evtSize(), and printWrds().
Referenced by convert().
static void printHeader | ( | FILE * | cfile, | |
const char * | iname, | |||
const char * | dname, | |||
int | esize | |||
) | [static] |
Prints the C file heading.
cfile | The output file stream | |
iname | The name of the input file | |
dname | The name of the output data structure | |
esize | The size, in bytes, of the output data |
Referenced by convert().
static void printTrailer | ( | FILE * | cfile | ) | [static] |
Adds the trailer to words to the output file.
cfile | The output file stream. |
Referenced by convert().
static const unsigned int * printWrds | ( | FILE * | cfile, | |
const unsigned int * | wrds, | |||
int | nwrds | |||
) | [static] |
Prints the array of 32-bit words in to the output file.
cfile | The file handle | |
wrds | The array of words to format | |
nwrds | The number of words to format |
Referenced by printEvents().
static __inline EBF_evts setupEvents | ( | EBF_evts | evts, | |
int | maxevts, | |||
int | nskip, | |||
int * | nevts | |||
) | [static] |
Skips to the first event to be output.
evts | The events | |
maxevts | The maximum number of events to process, if -1, do all | |
nskip | The number of events to skip | |
nevts | Returned as the number of events to process |
Referenced by convert().