示例#1
0
static int
parse_comp(const char *s, int strict,
	   VALUE *num)
{
    char *buf, *b;
    VALUE tmp;
    int ret = 1;

    buf = ALLOCV_N(char, tmp, strlen(s) + 1);
    b = buf;

    skip_ws(&s);
    if (!read_comp(&s, strict, num, &b)) {
	ret = 0;
    }
    else {
	skip_ws(&s);

	if (strict)
	    if (*s != '\0')
		ret = 0;
    }
    ALLOCV_END(tmp);

    return ret;
}
示例#2
0
size_t read_phasediag(Phdiag * pdp, const char * filename) {
    FILE * fp;
    int i;
    size_t nr=0;
    size_t nread=0;


    fp=fopen(filename,"r");


    nr = checkread(pdp,sizeof(Phdiag),1,fp);

    alloc_phasediag(pdp);

    nr = checkread(pdp->comp, sizeof(Comp),pdp->ncomp,fp);
    for(i=0; i<pdp->ncomp; i++) {
        nr = read_comp(pdp,i,fp);
    }

    nr = checkread(pdp->phases, sizeof(Pha),pdp->n_phases,fp);
    for(i=0; i<pdp->n_phases; i++) {
        nr = read_phase(pdp,i,fp);
    }

    nr = checkread(pdp->regions,sizeof(Reg),pdp->n_regions,fp);
    for (i=0; i<pdp->n_regions; i++) {
        nr = read_region(pdp,i,fp);
    }
    nr = READARRAY(pdp->tslices,sizeof(Tslice),pdp->n_tslice,fp);
#ifndef BL_COMPRESS
    nr *= sizeof(Tslice);
#endif
    if (nr != pdp->n_tslice * sizeof(Tslice) ) {
        fprintf(stderr,"ERROR:read_phasediag: Read error, expecting %li got %li\n",pdp->n_tslice,nr);
        exit(0);
    }
    for (i=0; i<pdp->n_tslice; i++) {
        nr = read_tslice(pdp,i,fp);
    }




    return(nread);
}