8#include "tpcclibConfig.h"
21static char *info[] = {
22 "List on screen the specified or all TACs of a TAC data file.",
23 "The concentrations are shown, if file contains <5 samples (time frames).",
24 "Accepts at least PMOD, DFT, and SIF formats.",
26 "Usage: @P [options] filename [tacname1 [tacname2...]] [> outputfile]",
30 " Do not print region volume.",
32 " Do not print region name.",
34 " Activity concentrations are never printed.",
36 " Interfile-type print.",
38 " List weights with Interfile-type print.",
44 "See also: tacmatch, tacformat, tacren, tacnames, dft2csv, tac2svg, tacsort",
46 "Keywords: TAC, SIF, tool",
65int main(
int argc,
char **argv)
67 int ai, help=0, version=0, verbose=1;
69 int printVol=1, printName=1, printType=0, printAct=1, printWeights=0;
70 char *cptr, tacfile[FILENAME_MAX];
77 if(argc==1) {
tpcPrintUsage(argv[0], info, stderr);
return(1);}
80 for(ai=1; ai<argc; ai++)
if(*argv[ai]==
'-') {
82 cptr=argv[ai]+1;
if(*cptr==
'-') cptr++;
if(!*cptr)
continue;
83 if(strcasecmp(cptr,
"NV")==0) {
85 }
else if(strcasecmp(cptr,
"NN")==0) {
86 printName=0;
continue;
87 }
else if(strcasecmp(cptr,
"NA")==0) {
89 }
else if(strncasecmp(cptr,
"WEIGHTS", 1)==0) {
90 printWeights=1;
continue;
91 }
else if(strcasecmp(cptr,
"IFT")==0) {
92 printType=1;
continue;
94 fprintf(stderr,
"Error: invalid option '%s'\n", argv[ai]);
99 if(help==2) {
tpcHtmlUsage(argv[0], info,
"");
return(0);}
105 printf(
"print_name := %d\n", printName);
106 printf(
"print_volume := %d\n", printVol);
107 printf(
"print_value := %d\n", printAct);
108 printf(
"print_type := %d\n", printType);
109 printf(
"print_weight := %d\n", printWeights);
119 for(; ai<argc; ai++) {
121 strlcpy(tacfile, argv[ai], FILENAME_MAX);
123 if(verbose>1) printf(
"reading %s\n", tacfile);
124 ret=
tacRead(&tac, tacfile, &status);
126 fprintf(stderr,
"Error (%d): %s\n", ret,
errorMsg(status.
error));
131 printf(
"tacNr := %d\n", tac.
tacNr);
132 printf(
"sampleNr := %d\n", tac.
sampleNr);
136 if(verbose>0) printf(
"%d tac(s) match name '%s'\n", m, argv[ai]);
142 if(printType==0 && printWeights) {
143 fprintf(stderr,
"Warning: weights can only be listed in Interfile-style.\n");
149 fprintf(stderr,
"Error: specified TAC names were not found.\n");
162 if(verbose>=0 && printType==0) {
164 if(printName!=0) printf(
"TAC-name\t");
165 if(printVol!=0) printf(
"Volume\t");
166 n=5;
if(printVol==0) n++;
168 printf(
"TAC-values");
180 for(
int ri=0; ri<tac.
tacNr; ri++)
if(tac.
c[ri].
sw) {
184 if(strlen(tac.
c[ri].
name)>0) printf(
"\t%s", tac.
c[ri].
name);
185 else printf(
"\t--------");
187 n=5;
if(printVol==0) n++;
189 if(printVol) printf(
"\t%g", tac.
c[ri].
size);
190 for(
int fi=0; fi<tac.
sampleNr; fi++)
191 printf(
"\t%.3e", tac.
c[ri].
y[fi]);
194 if(printVol) printf(
"\t%g\n", tac.
c[ri].
size);
198 if(printName) printf(
"tacname[%d] := %s\n", ri+1, tac.
c[ri].
name);
199 if(printVol) printf(
"volume[%d] := %g\n", ri+1, tac.
c[ri].
size);
201 for(
int fi=0; fi<tac.
sampleNr; fi++)
202 printf(
"value[%d][%d] := %g\n", ri+1, fi+1, tac.
c[ri].
y[fi]);
209 if(printType!=0 && printWeights) {
210 printf(
"weights := ");
211 if(
tacIsWeighted(&tac)) printf(
"yes\n");
else printf(
"no\n");
213 for(
int fi=0; fi<tac.
sampleNr; fi++)
214 printf(
"weight[%d] := %g\n", fi+1, tac.
w[fi]);
int iftWrite(IFT *ift, FILE *fp, TPCSTATUS *status)
int tpcProcessStdOptions(const char *s, int *print_usage, int *print_version, int *verbose_level)
int tpcHtmlUsage(const char *program, char *text[], const char *path)
void tpcPrintBuild(const char *program, FILE *fp)
void tpcPrintUsage(const char *program, char *text[], FILE *fp)
void statusInit(TPCSTATUS *s)
char * errorMsg(tpcerror e)
void statusSet(TPCSTATUS *s, const char *func, const char *srcfile, int srcline, tpcerror error)
size_t strlcpy(char *dst, const char *src, size_t dstsize)
char name[MAX_TACNAME_LEN+1]
IFT h
Optional (but often useful) header information.
int verbose
Verbose level, used by statusPrint() etc.
tpcerror error
Error code.
int tacRead(TAC *d, const char *fname, TPCSTATUS *status)
char * tacFormattxt(tacformat c)
int tacSelectedTACs(TAC *d)
int tacSelectTACs(TAC *d, const char *region_name, int reset, TPCSTATUS *status)
int tacIsWeighted(TAC *tac)
Header file for library libtpcextensions.
@ UNIT_UNKNOWN
Unknown unit.
char * unitName(int unit_code)
Header file for library libtpcift.
Header file for library libtpctac.