| 8 |
|
*/ |
| 9 |
|
|
| 10 |
|
#include <stdlib.h> |
| 11 |
+ |
#include <ctype.h> |
| 12 |
+ |
#include "platform.h" |
| 13 |
|
#include "rtio.h" |
| 14 |
|
#include "rtmath.h" |
| 15 |
|
#include "random.h" |
| 41 |
|
#define NAME_FLD 1 /* name field always first? */ |
| 42 |
|
|
| 43 |
|
#define SS_BASE_FLD 4 /* subsurface base surface */ |
| 44 |
< |
#define SS_VERT_FLD 10 /* subsurface vertex count */ |
| 44 |
> |
#define SS_VERT_FLD 9 /* subsurface vertex count */ |
| 45 |
|
|
| 46 |
|
typedef struct { |
| 47 |
|
const char *pname; /* object type name */ |
| 205 |
|
} |
| 206 |
|
res = idf_getfield(param, surf_type[i].vert_fld); |
| 207 |
|
} |
| 208 |
< |
if (!res->val[0]) { /* hack for missing #vert */ |
| 208 |
> |
if (!res->val[0] || tolower(res->val[0]) == 'a') { /* autocalculate */ |
| 209 |
|
IDF_FIELD *fptr; |
| 210 |
|
if (next_fbp >= fld_buf+sizeof(fld_buf)) |
| 211 |
|
next_fbp = fld_buf; |
| 394 |
|
/* now subsurfaces */ |
| 395 |
|
if (zp->ntotal > zp->nsurf) { |
| 396 |
|
if (zp->area_redu != NULL) |
| 397 |
< |
memset(zp->area_redu, 0, sizeof(float)*zp->nsurf); |
| 398 |
< |
else if ((zp->area_redu = (float *)calloc(zp->nsurf, |
| 397 |
> |
memset(zp->area_redu, 0, sizeof(float)*zp->ntotal); |
| 398 |
> |
else if ((zp->area_redu = (float *)calloc(zp->ntotal, |
| 399 |
|
sizeof(float))) == NULL) |
| 400 |
|
return(0); |
| 401 |
|
} |
| 710 |
|
fputs("'\n", stderr); |
| 711 |
|
return(1); |
| 712 |
|
} |
| 713 |
+ |
/* check version (warning) */ |
| 714 |
+ |
if ((pptr = idf_getobject(our_idf, "Version")) != NULL && |
| 715 |
+ |
pptr->flist != NULL && pptr->flist->val[0] != '9') { |
| 716 |
+ |
fputs(progname, stderr); |
| 717 |
+ |
fputs(": warning - written for IDF version 9.x, not ", |
| 718 |
+ |
stderr); |
| 719 |
+ |
fputs(pptr->flist->val, stderr); |
| 720 |
+ |
fputc('\n', stderr); |
| 721 |
+ |
} |
| 722 |
|
/* remove existing UVFs */ |
| 723 |
|
if ((pptr = idf_getobject(our_idf, UVF_PNAME)) != NULL) { |
| 724 |
|
IDF_OBJECT *pnext; |
| 727 |
|
do { |
| 728 |
|
pnext = pptr->pnext; |
| 729 |
|
idf_delobject(our_idf, pptr); |
| 730 |
< |
} while (pnext != NULL); |
| 730 |
> |
} while ((pptr = pnext) != NULL); |
| 731 |
|
} |
| 732 |
|
/* add to header */ |
| 733 |
|
if (our_idf->hrem == NULL || |