GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> EDST / V1-2-1 > ebf_diff / rhel6-32
#include <EDS/EDSD_print.h>
#include <EDS/io/EBF_stream.h>
#include <EDS/io/LCBP.h>
#include <EDS/LCBV.h>
#include <EDS/EBF_mc.h>
#include <EDS/EBF_evt.h>
#include <EDS/EBF_cid.h>
#include <EDS/EBF_dir.h>
#include <EDS/EBF_gem.h>
#include <EDS/EBF_cal.h>
#include <EDS/EBF_tkr.h>
#include <EDS/EBF_tem.h>
#include <EDS/EBF_err.h>
#include <EDS/EBF_siv.h>
#include <EDS/EBF_match.h>
#include <EDST/EDST_compareList.h>
#include <PBI/FFS.ih>
#include <PBI/Ofs.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
Defines | |
#define | ET(_seq) "\033[" _seq "m" |
#define | ET2(_seq0, _seq1) "\033[" _seq0 ";" _seq1 "m" |
#define | ET3(_seq0, _seq1, seq2) "\033[" _seq0 ";" _seq1 ";" _seq2 "m" |
#define | ET4(_seq0, _seq1, seq2, seq3) |
#define | NORMAL "0" |
#define | BOLD "1" |
#define | DIM "2" |
#define | UNDERSCORE "4" |
#define | BLINK "5" |
#define | REVERSE "7" |
#define | FG_BLACK "30" |
#define | FG_RED "31" |
#define | FG_GREEN "32" |
#define | FG_YELLOW "33" |
#define | FG_BLUE "34" |
#define | FG_MAGENTA "35" |
#define | FG_CYAN "36" |
#define | FG_WHITE "37" |
#define | BG_BLACK "40" |
#define | BG_RED "41" |
#define | BG_GREEN "42" |
#define | BG_YELLOW "43" |
#define | BG_BLUE "44" |
#define | BG_MAGENTA "45" |
#define | BG_CYAN "46" |
#define | BG_WHITE "47" |
#define | EH(string) ET(BOLD) # string ET(NORMAL) "\n" |
#define | EA(string) ET(BOLD) # string ET(NORMAL) |
Typedefs | |
typedef enum _PARSE_REASON_K | PARSE_REASON_K |
typedef int(* | ParseProcess )(void *ctx, PARSE_REASON_K reason, int pidx, char optchr, const char *optstr) |
Parsing callback routine. | |
Enumerations | |
enum | _PARSE_REASON_K { PARSE_REASON_K_OPTNOARG = -2, PARSE_REASON_K_OPTUNK = -1, PARSE_REASON_K_PRMNEW = 0, PARSE_REASON_K_OPTION = 1 } |
Functions | |
static int | FillCtl (Ctl *ctl, int argc, char *const argv[]) |
Examines the command line parameters and fills the print control structure. | |
int | main (int argc, char *const argv[]) |
Usual entry point for the readtest. | |
static int | parse (const char *options, int argc, char *const argv[], ParseProcess process, void *ctx) |
Cheap replacement for getopt that provides some capability for global, local and positional parameters. It also allows more than one list arguments to be parsed. | |
static int | parameter_set (Prms *prms, PARSE_REASON_K reason, int pidx, char optchr, const char *optstr) |
The callback routine for parse. parse calls this back once for every new parameter, option or error that it encounters as it sequentially processes the command line tokens. | |
static void | ignore_static_compile (Ignore *ignore, unsigned int processOpts) |
Compiles the static portion of the ignore lists. | |
static int | compile (Ctl *ctl, const Prms *prms) |
static void | ReportUsage (void) |
Reports the usage of the ebf_diff utility. |
$ ebf_diff -n<# of events> -s<# to skip in file2> <file1.ebf> <file2.ebf>
CVS $Id: ebf_diff.c,v 1.10 2011/03/30 20:37:49 russell Exp $
#define ET4 | ( | _seq0, | |||
_seq1, | |||||
seq2, | |||||
seq3 | ) |
Value:
"\033[" _seq0 ";" _seq1 ";" _seq2 ";" \ _seq3 "m"
int(* ParseProcess)(void *ctx, PARSE_REASON_K reason, int parameter_idx, char optchr, const char *optstr) |
Parsing callback routine.
== | 0 Continue parsing | |
!= | 0 Stop parsing, presumably because of an non-recoverable error. |
ctx | User context parameter | |
reason | Reason for callback. These are enumerated by PARSE_REASON_K
|
pidx | The value of the parameter index. The value for pidx after the first parameter is 0, after the second 1, etc. The value before any parameters is -1. This allows one so associate options with a given parameter or with the global parameters. This roughly approximates the idea of global, local and positional parameters. | |
optchr | The option character. In the case of an error reason code or PARSE_REASON_K_OPTION, this is the option character. In the case of PARSE_REASON_K_PRMNEW, the value is 0. | |
optstr | If the reason is
|
enum _PARSE_REASON_K |
static int FillCtl | ( | Ctl * | ctl, | |
int | argc, | |||
char *const | argv[] | |||
) | [static] |
Examines the command line parameters and fills the print control structure.
ctl | The parameter control block. | |
argc | The number of command line parameters. | |
argv | The array of pointers to the command line parameters. |
0,Everything | is okay. | |
-1,Incorrect | command usage. Usually this means that the input file name was absent. |
References parameter_set(), parse(), and ReportUsage().
Referenced by main().
static void ignore_static_compile | ( | Ignore * | ignore, | |
unsigned int | processOpts | |||
) | [static] |
Compiles the static portion of the ignore lists.
void ignore_static_compile (Ignore *ignore, unsigned int processOpts)
ignore | The ignore structure to fill | |
processOpts | The list of process options |
This routine fills in the descriptors for those with fixed offsets. Since the code assumes the descriptors are sorted by offset, by good fortune all the fix offset descriptors occur first. If this were not the case, then something more complicated would have to be done.
int main | ( | int | argc, | |
char *const | argv[] | |||
) |
Usual entry point for the readtest.
argc | The number of arguments | |
argv | The vector of arguments. |
References FillCtl().
static int parameter_set | ( | Prms * | prms, | |
PARSE_REASON_K | reason, | |||
int | pidx, | |||
char | optchr, | |||
const char * | optstr | |||
) | [static] |
The callback routine for parse. parse calls this back once for every new parameter, option or error that it encounters as it sequentially processes the command line tokens.
int parameter_set (Prms *prms, PARSE_REASON_K reason, int pidx, char optchr, const char *optstr)
== | 0, continue parsing | |
!= | 0, stop parsing, presumably because of an error. |
prms | Data structure to receive the parsed parameter/option | |
reason | Reason for callback. These are enumerated by PARSE_REASON_K
|
pidx | The value of the parameter index. The value for pidx after the first parameter is 0, after the second 1, etc. The value before any parameters is -1. This allows one so associate options with a given parameter or with the global parameters. This roughly approximates the idea of global, local and positional parameters. | |
optchr | The option character. In the case of an error reason code or PARSE_REASON_K_OPTION, this is the option character. In the case of PARSE_REASON_K_PRMNEW, the value is 0. | |
optstr | If the reason is
|
References PARSE_REASON_K_OPTNOARG, PARSE_REASON_K_OPTUNK, and PARSE_REASON_K_PRMNEW.
Referenced by FillCtl().
static int parse | ( | const char * | options, | |
int | argc, | |||
char *const | argv[], | |||
ParseProcess | process, | |||
void * | ctx | |||
) | [static] |
Cheap replacement for getopt that provides some capability for global, local and positional parameters. It also allows more than one list arguments to be parsed.
options | The options string. The format is the same as for getopt. | |
argc | The count of the number of arguments in argv | |
argv | The array of arguments | |
process | A user provided callback routine to process both the command line parameters and options | |
ctx | A context parameter for process. |
printf ("Argv[%2u] = %s\n", idx, s);
printf ("Parameter: %s\n", s);
printf ("Option = %c : %s\n", c, arg ? arg : "<none>");
References PARSE_REASON_K_OPTION, PARSE_REASON_K_OPTNOARG, PARSE_REASON_K_OPTUNK, and PARSE_REASON_K_PRMNEW.
Referenced by FillCtl().