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

Comparing ray/src/util/eplus_idf.c (file contents):
Revision 2.10 by greg, Thu Feb 13 17:39:39 2014 UTC vs.
Revision 2.11 by greg, Tue Mar 4 17:06:42 2014 UTC

# Line 353 | Line 353 | idf_load(const char *fname)
353          return(idf);                    /* success! */
354   }
355  
356 + /* Check string for end-of-line */
357 + static int
358 + idf_hasEOL(const char *s)
359 + {
360 +        while (*s)
361 +                if (*s++ == '\n')
362 +                        return(1);
363 +        return(0);
364 + }
365 +
366   /* Write a object and fields to an open file */
367   int
368   idf_writeparam(IDF_OBJECT *param, FILE *fp, int incl_comm)
# Line 365 | Line 375 | idf_writeparam(IDF_OBJECT *param, FILE *fp, int incl_c
375          fputc(',', fp);
376          if (incl_comm)
377                  fputs(param->rem, fp);
378 +        else
379 +                fputc('\n', fp);
380          for (fptr = param->flist; fptr != NULL; fptr = fptr->next) {
381                  if (!incl_comm)
382 <                        fputs("\n    ", fp);
382 >                        fputs("    ", fp);
383                  fputs(fptr->val, fp);
384 <                fputc((fptr->next==NULL ? ';' : ','), fp);
384 >                if (fptr->next == NULL) {
385 >                        fputc(';', fp);
386 >                        if (incl_comm && !idf_hasEOL(fptr->rem))
387 >                                fputc('\n', fp);
388 >                } else
389 >                        fputc(',', fp);
390                  if (incl_comm)
391                          fputs(fptr->rem, fp);
392 +                else
393 +                        fputc('\n', fp);
394          }
395          if (!incl_comm)
396 <                fputs("\n\n", fp);
396 >                fputc('\n', fp);
397          return(!ferror(fp));
398   }
399  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines