32 {
33 int verbose=0;
if(status!=NULL) verbose=status->
verbose;
34 if(tac==NULL) {
37 }
42 }
43 if(verbose>0) printf("%s()\n", __func__);
44
45 int ret, n;
46
47
51 }
52
56 }
57
58
60 statusSet(status, __func__, __FILE__, __LINE__, ret);
64
65
67 if(cptr!=NULL && cptr[0] &&
strnlen(cptr, 20)<20)
69
70
72 cptr=
csvCell(csv, 0, j+1);
if(cptr==NULL) {ret++;
break;}
73 n=strlen(cptr); if(n<3) {ret++; break;}
74 char *cptr2=strchr(cptr+1, '-'); if(cptr2!=NULL) {*cptr2=(char)0; cptr2++;}
77 if(isnan(tac->
x1[j]) || isnan(tac->
x2[j])) {ret++;
break;}
78 tac->
x[j]=0.5*(tac->
x1[j]+tac->
x2[j]);
79 }
80 if(ret) {
83 }
84
85
86
87 ret=0;
88 for(
int i=0; i<tac->
tacNr; i++) {
89 cptr=
csvCell(csv, i+1, 0);
if(cptr==NULL) {ret++;
break;}
90 n=strlen(cptr); if(n>2 && cptr[n-1]=='\'') {cptr[n-1]=(char)0; n--;}
91 if(n>1 && cptr[0]=='\'') {cptr++; n--;}
93 }
94 if(ret) {
97 }
98
99
100 n=0; ret=0;
101 for(
int i=0; i<tac->
tacNr && ret==0; i++) {
102 for(
int j=0; j<tac->
sampleNr; j++) {
103 cptr=
csvCell(csv, i+1, j+1);
if(cptr==NULL) {ret++;
break;}
105 }
106 }
107 if(ret) {
110 }
111 if(n<1) {
114 }
115
116
119
122}
int csvIsRegular(CSV *csv)
char * csvCell(CSV *csv, int row, int col)
double atofVerified(const char *s)
void statusSet(TPCSTATUS *s, const char *func, const char *srcfile, int srcline, tpcerror error)
size_t strnlen(const char *s, size_t n)
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.
int tacAllocate(TAC *tac, int sampleNr, int tacNr)
int tacSetHeaderStudynr(IFT *h, const char *s)
@ WEIGHTING_OFF
Not weighted or weights not available (weights for all included samples are 1.0).
#define MAX_TACNAME_LEN
Max length of TAC ID name (not including trailing zero).
@ TPCERROR_FAIL
General error.
@ TPCERROR_INVALID_FORMAT
Invalid file format.
@ TPCERROR_NO_DATA
File contains no data.
@ TAC_FORMAT_MAT
Matlab matrix TAC format (reading supported).