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

Comparing ray/src/gen/gendaylit.c (file contents):
Revision 2.1 by greg, Sat Jun 6 20:18:32 2009 UTC vs.
Revision 2.2 by greg, Mon Jun 15 22:27:21 2009 UTC

# Line 21 | Line 21 | static const char RCSid[] = "$Id$";
21   #include  <string.h>
22   #include  <math.h>
23   #include  <stdlib.h>
24 + #include  <ctype.h>
25  
26   #include  "rtio.h"
27   #include  "fvect.h"
# Line 71 | Line 72 | void   theta_phi_to_dzeta_gamma(double theta,double phi,
72   double  integ_lv(float *lv,float *theta);
73   float   *theta_ordered(char *filename);
74   float   *phi_ordered(char *filename);
75 + void    skip_comments(FILE *fp);
76  
77  
78  
# Line 608 | Line 610 | register char  **av;
610  
611  
612  
613 + void
614 + skip_comments(FILE *fp)         /* skip comments in file */
615 + {
616 +        int     c;
617 +        
618 +        while ((c = getc(fp)) != EOF)
619 +                if (c == '#') {
620 +                        while ((c = getc(fp)) != EOF)
621 +                                if (c == '\n')
622 +                                        break;
623 +                } else if (!isspace(c)) {
624 +                        ungetc(c, fp);
625 +                        break;
626 +                }
627 + }
628  
629  
630  
614
615
616
617
618
631   /* Perez models */
632  
633   /* Perez global horizontal luminous efficacy model */
# Line 998 | Line 1010 | int lect_coeff_perez(char *filename,float **coeff_pere
1010          {
1011                  /*printf("file %s  open\n", filename);*/
1012          }
1013 +        
1014 +        skip_comments(fcoeff_perez);
1015  
1002        rewind(fcoeff_perez); /* on se place en debut de fichier */
1003
1016          for (i=0;i<8;i++)
1017                  for (j=0;j<20;j++)
1018                  {
# Line 1183 | Line 1195 | float *theta_ordered(char *filename)
1195                  fprintf(stderr,"Cannot open file %s in function theta_ordered\n",filename);
1196                  exit(1);
1197          }
1198 +        
1199 +        skip_comments(file_in);
1200  
1187        rewind(file_in);
1188
1201          if ( (ptr = malloc(145*sizeof(float))) == NULL )
1202          {
1203                  fprintf(stderr,"Out of memory in function theta_ordered\n");
# Line 1229 | Line 1241 | float *phi_ordered(char *filename)
1241                  fprintf(stderr,"Cannot open file %s in function phi_ordered\n",filename);
1242                  exit(1);
1243          }
1244 <
1245 <        rewind(file_in);
1244 >        
1245 >        skip_comments(file_in);
1246  
1247          if ( (ptr = malloc(145*sizeof(float))) == NULL )
1248          {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines