ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/radcompare.c
(Generate patch)

Comparing ray/src/util/radcompare.c (file contents):
Revision 2.27 by greg, Thu Feb 18 23:16:35 2021 UTC vs.
Revision 2.30 by greg, Tue May 24 22:34:18 2022 UTC

# Line 27 | Line 27 | int    report = REP_WARN;      /* reporting level */
27  
28   int     ign_header = 0;         /* ignore header differences? */
29  
30 + int     escape_newlines = 0;    /* allow backslash to skip newlines */
31 +
32   double  rel_min = 1e-5;         /* positive for relative comparisons */
33  
34   double  rms_lim = 0.01;         /* RMS difference limit */
# Line 72 | Line 74 | enum {TYP_UNKNOWN, TYP_TEXT, TYP_ASCII, TYP_RGBE, TYP_
74  
75                                  /* header variables to always ignore */
76   const char      *hdr_ignkey[] = {
77 +                        "FORMAT",
78                          "SOFTWARE",
79                          "CAPDATE",
80                          "GMT",
# Line 132 | Line 135 | read_line(LINEBUF *bp, FILE *fp)
135          }
136          while (fgets(bp->str + bp->len, bp->siz - bp->len, fp)) {
137                  bp->len += strlen(bp->str + bp->len);
138 <                if (bp->str[bp->len-1] == '\n')
138 >                if (bp->str[bp->len-1] == '\n') {
139 >                        if (bp->len > 1 && bp->str[bp->len-2] == '\r') {
140 >                                bp->str[--bp->len] = '\0';
141 >                                bp->str[bp->len-1] = '\n';
142 >                        }
143 >                        if (escape_newlines && bp->len > 1 &&
144 >                                        bp->str[bp->len-2] == '\\') {
145 >                                bp->str[--bp->len] = '\0';
146 >                                bp->str[bp->len-1] = ' ';
147 >                                continue;
148 >                        }
149                          break;          /* found EOL */
150 +                }
151                  if (bp->len < bp->siz - 4)
152                          continue;       /* at EOF? */
153                  if (bp->siz >= MAXBUF) {
# Line 373 | Line 387 | setheadvar(char *val, void *p)
387                  tep->key = strcpy(malloc(kln+1), key);
388          if (tep->data) {        /* check for special cases */
389                  if (!strcmp(key, "EXPOSURE")) {
390 <                        sprintf(newval, "%f", atof(tep->data)*atof(val));
390 >                        sprintf(newval, "%.6e", atof(tep->data)*atof(val));
391                          vln = strlen(val = newval);
392                  }
393                  free(tep->data);
# Line 569 | Line 583 | compare_text()
583          if (report >= REP_VERBOSE) {
584                  fputs(progname, stdout);
585                  fputs(": comparing inputs as ASCII text", stdout);
586 +                if (escape_newlines)
587 +                        fputs(", allowing escaped newlines", stdout);
588                  if (comment_c) {
589                          fputs(", ignoring comments starting with '", stdout);
590                          fputc(comment_c, stdout);
# Line 916 | Line 932 | main(int argc, char *argv[])
932                  switch (argv[a][1]) {
933                  case 'h':                       /* ignore header info. */
934                          ign_header = !ign_header;
935 +                        continue;
936 +                case 'n':                       /* allow newline escapes */
937 +                        escape_newlines = !escape_newlines;
938                          continue;
939                  case 'c':                       /* ignore comments */
940                          comment_c = argv[a][2];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines