| 10 |
|
#define _USE_MATH_DEFINES |
| 11 |
|
#include <stdlib.h> |
| 12 |
|
#include <math.h> |
| 13 |
+ |
#include <ctype.h> |
| 14 |
|
#include "random.h" |
| 15 |
|
#include "platform.h" |
| 16 |
|
#include "paths.h" |
| 651 |
|
static int |
| 652 |
|
wrap_up(void) |
| 653 |
|
{ |
| 654 |
< |
char cmd[8192]; |
| 654 |
> |
char cmd[32700]; |
| 655 |
|
|
| 656 |
|
if (bsdf_manuf[0]) { |
| 657 |
|
add_wbsdf("-f", 1); |
| 702 |
|
} |
| 703 |
|
#endif |
| 704 |
|
|
| 705 |
+ |
#define HEAD_BUFLEN 8192 |
| 706 |
+ |
static char head_buf[HEAD_BUFLEN]; |
| 707 |
+ |
static int cur_headlen = 0; |
| 708 |
+ |
|
| 709 |
+ |
/* Record header line as comment associated with this SIR input */ |
| 710 |
+ |
static int |
| 711 |
+ |
record2header(char *s) |
| 712 |
+ |
{ |
| 713 |
+ |
int len = strlen(s); |
| 714 |
+ |
|
| 715 |
+ |
if (cur_headlen+len >= HEAD_BUFLEN-6) |
| 716 |
+ |
return(0); |
| 717 |
+ |
/* includes EOL */ |
| 718 |
+ |
strcpy(head_buf+cur_headlen, s); |
| 719 |
+ |
cur_headlen += len; |
| 720 |
+ |
|
| 721 |
+ |
#if defined(_WIN32) || defined(_WIN64) |
| 722 |
+ |
if (head_buf[cur_headlen-1] == '\n') |
| 723 |
+ |
head_buf[cur_headlen-1] = '\t'; |
| 724 |
+ |
#endif |
| 725 |
+ |
return(1); |
| 726 |
+ |
} |
| 727 |
+ |
|
| 728 |
+ |
/* Finish off header for this file */ |
| 729 |
+ |
static void |
| 730 |
+ |
done_header(void) |
| 731 |
+ |
{ |
| 732 |
+ |
while (cur_headlen > 0 && isspace(head_buf[cur_headlen-1])) |
| 733 |
+ |
--cur_headlen; |
| 734 |
+ |
head_buf[cur_headlen] = '\0'; |
| 735 |
+ |
if (!cur_headlen) |
| 736 |
+ |
return; |
| 737 |
+ |
add_wbsdf("-C", 1); |
| 738 |
+ |
add_wbsdf(head_buf, 0); |
| 739 |
+ |
head_buf[cur_headlen=0] = '\0'; |
| 740 |
+ |
} |
| 741 |
+ |
|
| 742 |
|
/* Read in BSDF and interpolate as tensor tree representation */ |
| 743 |
|
int |
| 744 |
|
main(int argc, char *argv[]) |
| 879 |
|
progname, argv[i]); |
| 880 |
|
return(1); |
| 881 |
|
} |
| 882 |
+ |
sprintf(pbuf, "%s:\n", argv[i]); |
| 883 |
+ |
record2header(pbuf); |
| 884 |
+ |
sir_headshare = &record2header; |
| 885 |
|
if (!load_bsdf_rep(fpin)) |
| 886 |
|
return(1); |
| 887 |
|
fclose(fpin); |
| 888 |
+ |
done_header(); |
| 889 |
|
sprintf(pbuf, "Interpolating component '%s'", argv[i]); |
| 890 |
|
prog_start(pbuf); |
| 891 |
|
if (!nbsdf++) { |