TPCCLIB
Toggle main menu visibility
Loading...
Searching...
No Matches
parutils
models.c
Go to the documentation of this file.
1
7
/*****************************************************************************/
8
#include "tpcclibConfig.h"
9
/*****************************************************************************/
10
#include <stdio.h>
11
#include <stdlib.h>
12
#include <math.h>
13
#include <time.h>
14
#include <string.h>
15
/*****************************************************************************/
16
#include "
tpcextensions.h
"
17
#include "
tpcmodels.h
"
18
#include "
tpcpar.h
"
19
/*****************************************************************************/
20
21
/*****************************************************************************/
22
static
char
*info[] = {
23
"List the PET models and mathematical functions that are identified by"
,
24
"most TPC software."
,
25
" "
,
26
"Usage: @P [options] [> outputfile]"
,
27
" "
,
28
"Options:"
,
29
" -model=<code>"
,
30
" Information in specified model only; by default all are listed."
,
31
" -stdoptions"
,
// List standard options like --help, -v, etc
32
" "
,
33
"See also: halflife, fit2dat, sim_rtcm"
,
34
" "
,
35
"Keywords: modelling, fitting, parameters"
,
36
0};
37
/*****************************************************************************/
38
39
/*****************************************************************************/
40
/* Turn on the globbing of the command line, since it is disabled by default in
41
mingw-w64 (_dowildcard=0); in MinGW32 define _CRT_glob instead, if necessary;
42
In Unix&Linux wildcard command line processing is enabled by default. */
43
/*
44
#undef _CRT_glob
45
#define _CRT_glob -1
46
*/
47
int
_dowildcard = -1;
48
/*****************************************************************************/
49
50
/*****************************************************************************/
54
int
main(
int
argc,
char
**argv)
55
{
56
int
ai, help=0, version=0, verbose=1;
57
unsigned
int
model=0;
58
char
*cptr;
59
60
61
/*
62
* Get arguments
63
*/
64
/* Options */
65
for
(ai=1; ai<argc; ai++)
if
(*argv[ai]==
'-'
) {
66
if
(
tpcProcessStdOptions
(argv[ai], &help, &version, &verbose)==0)
continue
;
67
cptr=argv[ai]+1;
if
(*cptr==
'-'
) cptr++;
if
(!*cptr)
continue
;
68
if
(strncasecmp(cptr,
"MODEL="
, 6)==0) {
69
model=
modelCodeIndex
(cptr+6);
70
continue
;
71
}
72
fprintf(stderr,
"Error: invalid option '%s'\n"
, argv[ai]);
73
return
(1);
74
}
75
76
/* Print help or version? */
77
if
(help==2) {
tpcHtmlUsage
(argv[0], info,
""
);
return
(0);}
78
if
(help) {
tpcPrintUsage
(argv[0], info, stdout);
return
(0);}
79
if
(version) {
tpcPrintBuild
(argv[0], stdout);
return
(0);}
80
81
/* Non-options */
82
for
(ai=1; ai<argc; ai++)
if
(*argv[ai]!=
'-'
) {
83
fprintf(stderr,
"Error: invalid argument '%s'\n"
, argv[ai]);
84
return
(1);
85
}
86
87
if
(verbose>1) {
88
if
(model>0) printf(
"model := %u\n"
, model);
89
}
90
91
/* Get the number of listed models */
92
unsigned
int
n=
modelNr
();
93
if
(verbose>0) printf(
"modelNr := %d\n"
, n);
94
95
/* Print specified model, or all models */
96
if
(model!=0) {
97
fprintf(stdout,
"code := %s\n"
,
modelCode
(model));
98
fprintf(stdout,
"desc := %s\n"
,
modelDesc
(model));
99
}
else
{
100
for
(
unsigned
int
i=1; i<n; i++) {
101
fprintf(stdout,
"code[%d] := %s\n"
, i,
modelCode
(i));
102
fprintf(stdout,
"desc[%d] := %s\n"
, i,
modelDesc
(i));
103
}
104
}
105
return
(0);
106
}
107
/*****************************************************************************/
108
109
/*****************************************************************************/
modelCode
char * modelCode(const unsigned int i)
Definition
modell.c:176
modelDesc
char * modelDesc(const unsigned int i)
Definition
modell.c:222
modelNr
unsigned int modelNr()
Definition
modell.c:162
modelCodeIndex
unsigned int modelCodeIndex(const char *s)
Definition
modell.c:237
tpcProcessStdOptions
int tpcProcessStdOptions(const char *s, int *print_usage, int *print_version, int *verbose_level)
Definition
proginfo.c:47
tpcHtmlUsage
int tpcHtmlUsage(const char *program, char *text[], const char *path)
Definition
proginfo.c:169
tpcPrintBuild
void tpcPrintBuild(const char *program, FILE *fp)
Definition
proginfo.c:339
tpcPrintUsage
void tpcPrintUsage(const char *program, char *text[], FILE *fp)
Definition
proginfo.c:114
tpcextensions.h
Header file for library libtpcextensions.
tpcmodels.h
Header file for libtpcmodels.
tpcpar.h
Header file for libtpcpar.
Generated on
for TPCCLIB by
1.17.0