/* bbincr - build tree to increment execution point at *cp */ static void bbincr(Symbol yycounts, Coordinate* cp, Tree* e) { struct map* mp = maplist->x; Tree t; /* append *cp to source map */ if (mp->size >= NELEMS(mp->u)) { NEW(mp, PERM); mp->size = 0; maplist = append(mp, maplist); } if (IR->little_endian) { mp->u[mp->size].le.x = cp->x; mp->u[mp->size].le.y = cp->y; mp->u[mp->size++].le.index = bbfile(cp->file); } else { mp->u[mp->size].be.x = cp->x; mp->u[mp->size].be.y = cp->y; mp->u[mp->size++].be.index = bbfile(cp->file); } t = incr('+', rvalue((*optree['+'])(ADD, pointer(idtree(yycounts)), consttree(npoints++, inttype))), consttree(1, inttype)); if (*e) *e = tree(RIGHT, (*e)->type, t, *e); else *e = t; }
/* bbfunc - emit function name and src coordinates */ static void bbfunc(Symbol yylink, Symbol f) { Value v; union coordinate u; defglobal(afunc, DATA); defpointer(funclist); defpointer(NULL); defpointer(mkstr(f->name)->u.c.loc); if (IR->little_endian) { u.le.x = f->u.f.pt.x; u.le.y = f->u.f.pt.y; u.le.index = bbfile(f->u.f.pt.file); } else { u.be.x = f->u.f.pt.x; u.be.y = f->u.f.pt.y; u.be.index = bbfile(f->u.f.pt.file); } (*IR->defconst)(U, unsignedtype->size, (v.u = u.coord, v)); funclist = afunc; }
int medit0() { pMesh mesh; char data[128],*name; int k,l,ret; clock_t ct; /* default */ // fprintf(stdout," \n medit0() \n"); fprintf(stdout," Loading data file(s)\n"); ct = clock(); /* enter name */ if ( !cv.nbm ) { fprintf(stdout," File name(s) missing. Please enter : "); fflush(stdout); fflush(stdin); fgets(data,120,stdin); if ( !strlen(data) ) { fprintf(stdout," ## No data\n"); return(0); } /* parse file name(s) */ name = strtok(data," \n"); while( name ) { if ( !cv.mesh[cv.nbm] ) { cv.mesh[cv.nbm] = (pMesh)M_calloc(1,sizeof(Mesh),"medit0.mesh"); if ( !cv.mesh[cv.nbm] ) return(0); } /*(cv.mesh[cv.nbm])->name = calloc(strlen(name)+1,sizeof(char));*/ strcpy(cv.mesh[cv.nbm]->name,name); name = strtok(NULL," \n\0"); if ( ++cv.nbm == MAX_MESH ) break; } if ( !cv.nbm ) return(0); } if ( !cv.nbm ) { fprintf(stdout," Number of mesh missing:. Please enter : "); fflush(stdout); fflush(stdin); fgets(data,120,stdin); cv.nbm = atoi(data); } /* read mesh(es) */ k = 0; do { if ( !cv.mesh[k] ) { cv.mesh[k] = M_calloc(1,sizeof(Mesh),"medit0.mesh"); if ( !cv.mesh[k] ) return(0); } mesh = cv.mesh[k]; mesh->typ = 0; ret = loadMesh(mesh); if ( ret < 0 ) { mesh->typ = 1; ret = inmsh2(mesh); if ( !ret ) { mesh->typ = 2; ret = loadGIS(mesh); } } if ( ret <= 0 ) { for (l=k+1; l<cv.nbm; l++) cv.mesh[l-1] = cv.mesh[l]; cv.nbm--; k--; continue; } /* compute mesh box */ if ( (mesh->ntet && !mesh->nt) || (mesh->nhex && !mesh->nq) ) meshSurf(mesh); meshBox(mesh,1); if ( !quiet ) meshInfo(mesh); /* read metric */ if ( !loadSol(mesh,mesh->name,1) ) bbfile(mesh); if ( !quiet && mesh->nbb ) fprintf(stdout," Solutions %8d\n",mesh->nbb); } while ( ++k < cv.nbm ); cv.nbs = cv.nbm; ct = difftime(clock(),ct); fprintf(stdout," Input seconds: %.2f\n", (double)ct/(double)CLOCKS_PER_SEC); return(cv.nbm); }