#include <stdio.h>#include "machine.h"#include "stack-c.h"#include "do_xxscanf.h"Include dependency graph for fileio.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Functions | |
| int StringConvert | __PARAMS ((char *str)) |
| void Free_Scan | __PARAMS ((int rowcount, int ncol, sfdir *type_s, entry **data)) |
| int Sci_Store | __PARAMS ((int nrow, int ncol, entry *data, sfdir *type, int retval)) |
| int Store_Scan | __PARAMS ((int *nrow, int *ncol, sfdir *type_s, sfdir *type, int *retval, int *retval_s, rec_entry *buf, entry **data, int rowcount, int n)) |
| int SciStrtoStr | __PARAMS ((int *Scistring, int *nstring, int *ptrstrings, char **strh)) |
Definition at line 335 of file fileio.c.
References cvstr(), F2C(), i, int, job, MALLOC, MEM_LACK, NULL, p, and s.
00336 { 00337 char *s,*p; 00338 int li,ni,*SciS,i,job=1; 00339 00340 li=ptrstrings[0]; 00341 ni=ptrstrings[*nstring] - li + *nstring +1; 00342 p=(char *) MALLOC(ni); 00343 if (p ==NULL) return MEM_LACK; 00344 SciS= Scistring; 00345 s=p; 00346 for ( i=1 ; i<*nstring+1 ; i++) 00347 { 00348 ni=ptrstrings[i]-li; 00349 li=ptrstrings[i]; 00350 F2C(cvstr)(&ni,SciS,s,&job,(long int)ni); 00351 SciS += ni; 00352 s += ni; 00353 if (i<*nstring) { 00354 *s='\n'; 00355 s++; 00356 } 00357 } 00358 *s='\0'; 00359 *strh=p; 00360 return 0; 00361 }
Here is the call graph for this function:

| int Store_Scan __PARAMS | ( | (int *nrow, int *ncol, sfdir *type_s, sfdir *type, int *retval, int *retval_s, rec_entry *buf, entry **data, int rowcount, int n) | ) |
Definition at line 218 of file fileio.c.
References buf, entry::d, data, err, f(), FREE, i, j, MALLOC, MAXSCAN, MEM_LACK, MISMATCH, nc, nr, NULL, REALLOC, s, SF_C, SF_F, SF_I, SF_LF, SF_LI, SF_LUI, SF_S, SF_SI, SF_SUI, SF_UI, and si.
00219 { 00220 int i,j,nr,nc,err; 00221 entry * Data; 00222 int blk=20; /* block size for memory allocation */ 00223 nr=*nrow; 00224 nc=*ncol; 00225 00226 if (rowcount==0) { 00227 for ( i=0 ; i < MAXSCAN ; i++) type_s[i]=SF_F; /* initialisation */ 00228 if (nr<0) nr=blk; 00229 nc=n; 00230 *ncol=nc; 00231 *retval_s=*retval; 00232 if (n==0) { 00233 return 0; 00234 } 00235 if ( (*data = (entry *) MALLOC(nc*nr*sizeof(entry)))==NULL) { 00236 err= MEM_LACK; 00237 goto bad1; 00238 } 00239 for ( i=0 ; i < nc ; i++) type_s[i]=type[i]; 00240 00241 } 00242 else { 00243 /* check if number of data read match with previous number */ 00244 if ( (n !=nc ) || (*retval_s != *retval) ){ 00245 err=MISMATCH; 00246 goto bad2; 00247 } 00248 /* check if types of data read match with previous types */ 00249 for ( i=0 ; i < nc ; i++) 00250 if (type[i] != type_s[i]) { 00251 err=MISMATCH; 00252 goto bad2; 00253 } 00254 00255 /* check for memory and REALLOC if necessary*/ 00256 if (rowcount>= nr) { 00257 nr=nr+blk; 00258 *nrow=nr; 00259 if ( (*data = (entry *) REALLOC(*data,nc*nr*sizeof(entry)))==NULL) { 00260 err= MEM_LACK; 00261 goto bad2; 00262 } 00263 } 00264 } 00265 Data=*data; 00266 /* store values scanned in a new row */ 00267 for ( i=0 ; i < nc ; i++) 00268 { 00269 switch ( type_s[i] ) 00270 { 00271 case SF_C: 00272 case SF_S: 00273 Data[i+nc*rowcount].s=buf[i].c; 00274 break; 00275 case SF_LUI: 00276 Data[i+nc*rowcount].d=(double)buf[i].lui; 00277 break; 00278 case SF_SUI: 00279 Data[i+nc*rowcount].d=(double)buf[i].sui; 00280 break; 00281 case SF_UI: 00282 Data[i+nc*rowcount].d=(double)buf[i].ui; 00283 break; 00284 case SF_LI: 00285 Data[i+nc*rowcount].d=(double)buf[i].li; 00286 break; 00287 case SF_SI: 00288 Data[i+nc*rowcount].d=(double)buf[i].si; 00289 break; 00290 case SF_I: 00291 Data[i+nc*rowcount].d=(double)buf[i].i; 00292 break; 00293 case SF_LF: 00294 Data[i+nc*rowcount].d=buf[i].lf; 00295 break; 00296 case SF_F: 00297 Data[i+nc*rowcount].d=(double)buf[i].f; 00298 break; 00299 } 00300 } /* rowcount */ 00301 return 0; 00302 bad1: 00303 /* FREE allocated strings in scan buffer */ 00304 for ( j=0 ; j < MAXSCAN ; j++) 00305 if ( (type_s[j] == SF_C) || (type_s[j] == SF_S)) FREE(buf[j].c); 00306 00307 bad2: 00308 return err; 00309 }
Here is the call graph for this function:

1.5.1