Subject:
|
Re: Line Thickness and Antialiasing in LdGLite 0.7.3
|
Newsgroups:
|
lugnet.cad.dev
|
Date:
|
Sat, 30 Dec 2000 22:32:39 GMT
|
Viewed:
|
763 times
|
| |
| |
In lugnet.cad.dev, Lars C. Hassing writes:
> In lugnet.cad.dev, Don Heyse writes:
> > In lugnet.cad.dev, Lars C. Hassing writes:
> >
> > [snip] (a bunch of stuff about
> >
> > > I really would like to find the cause of the problem, because L3P relies on the
> > > same routines, and it does work for L3P.
> > > All filenames are internally made lowercase (FixDatName), so I don't have to worry
> > > about any following compares.
> > > Which platform(s) had the problem?
> >
> > It was on a linux system where I had copied all the DAT files from a
> > smbmounted Windows filesystem and somehow ended up with them all in UPPERCASE.
> > This is probably not a normal setup, but it happened to me and I'm too
> > lazy to write a script file to fix it. Anyhow I tried to allow for this
> > with the environment variable LDRAWDIRCASE=UPPERCASE and some code in
> > platform.c but I was thwarted by strcmp() to hardcoded lowercase special
> > filenames in L3Input.cpp. Using stricmp() fixes this and is the approach I
> > used with the LdLite parser. I can't think of any reason not to use stricmp
>
> stricmp is slower, though the difference is most likely immeasurable in the big picture.
>
> No, it is more a matter of principle, to know what you are dealing with,
> to be in control of of your data - in stead of not really knowing whether
> it is necessary or not.
OK I confess, I took the cheap and easy fix rather than digging deeper
to find the root of the problem. After further consideration I suppose
the correct solution would be to run FixDatName() on all the hardcoded
lowercase filenames when the program is initialized. Then you can use
strcmp() everywhere and not worry about any loss of speed. I didn't
really consider this option because I thought it would require more changes
to the code, and I like to keep my changes as small as possible so I'm
less likely to break something else. Plus I'm lazy and I guess I lack
principles.
So how about something like this?
Static char LightDatName = "light.dat";
Static char MPDext = ".mpd";
Static char DAText = ".dat";
FixHardcodedFileNames()
{
int i;
FixDatName(LightDatName); // NOTE: replace "light.dat" with LightDatName.
FixDatName(MPDext); // NOTE: must replace ".mpd" with MPDext in the code.
FixDatName(DAText); // NOTE: must replace ".dat" with DAText in the code.
for (i = sizeof(Dirs) / sizeof(Dirs[0]); --i >= 0;)
FixDatName(Dirs[i]);
for (i = sizeof(xzParts) / sizeof(xzParts[0]); --i >= 0;)
FixDatName(xzParts[i]);
for (i = sizeof(StudPrimitives) / sizeof(StudPrimitives[0]); --i >= 0;)
FixDatName(StudPrimitives[i]);
// This is only used for L3P right now, but it doesn't hurt to fix it.
for (i = sizeof(LineType2Primitives) / sizeof(LineType2Primitives[0]);
--i >= 0;)
FixDatName(LineType2Primitives[i]);
}
Did I miss any hardcoded lowercase file names??
Don
|
|
Message has 1 Reply: | | Re: Line Thickness and Antialiasing in LdGLite 0.7.3
|
| Don Heyse wrote... (...) Ah, I think I understand now... You require all DAT files in Linux to be in uppercase? If you let FixDatName convert to lower case (like I do), you could modify OpenDatFile to use upper case, (if that's what you require) and (...) (24 years ago, 31-Dec-00, to lugnet.cad.dev)
|
Message is in Reply To:
| | Re: Line Thickness and Antialiasing in LdGLite 0.7.3
|
| (...) stricmp is slower, though the difference is most likely immeasurable in the big picture. No, it is more a matter of principle, to know what you are dealing with, to be in control of of your data - in stead of not really knowing whether it is (...) (24 years ago, 29-Dec-00, to lugnet.cad.dev)
|
15 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|