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. */ |
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) |