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

Comparing ray/src/cv/ies2rad.c (file contents):
Revision 2.28 by greg, Wed May 30 22:12:17 2018 UTC vs.
Revision 2.30 by greg, Mon Jun 4 23:05:34 2018 UTC

# Line 92 | Line 92 | static const char      RCSid[] = "$Id$";
92   /* Since 1991, LM-63 files have begun with the magic keyword IESNA */
93   #define MAGICID         "IESNA"
94   #define LMAGICID        5
95 + /* But newer files start with IESNA:LM-63- */
96 + #define MAGICID2        "IESNA:LM-63-"
97 + #define LMAGICID2       12
98   /* ies2rad supports the 1986, 1991, and 1995 versions of
99   * LM-63. FIRSTREV describes the first version; LASTREV describes the
100   * 1995 version. */
# Line 735 | Line 738 | k_match(
738          /* If we have come to the end of the keyword, and the keyword
739           * at the beginning of the matched line is terminated with
740           * ']', return 1 */
741 <        return((!*kwd) & (*hdl == ']'));
741 >        return(!kwd[-1] & (*hdl == ']'));
742   }
743  
744   /* keyargs - return the argument of a keyword, without leading spaces
# Line 840 | Line 843 | ies2rad(               /* convert IES file */
843                          continue;
844                  /* increment the header line count, and check for the
845                   * "TILT=" line that terminates the header */
846 <                if (!lineno++ && strncmp(buf, MAGICID, LMAGICID) == 0) {
847 <                        /* This code doesn't work for LM-63-95 and
848 <                         * LM-63-02 files and will instead default to
849 <                         * LM-63-86. */
850 <                        filerev = atoi(buf+LMAGICID);
846 >                if (!lineno++) {        /* first line may be magic */
847 >                        if (!strncmp(buf, MAGICID2, LMAGICID2))
848 >                                filerev = atoi(buf+LMAGICID2) - 1900;
849 >                        else if (!strncmp(buf, MAGICID, LMAGICID))
850 >                                filerev = atoi(buf+LMAGICID);
851                          if (filerev < FIRSTREV)
852                                  filerev = FIRSTREV;
853                          else if (filerev > LASTREV)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines