Search path discussion


RE: Search path discussion
#47
Hi guys,
it's been a while, I got involved in other projects in 2008
and haven't really followed LDraw since then,
though I did spend a lot of time with LDraw 1998-2008.


l3p was released in August 1998.
For October the change log says:

  1998.10.04 lch File search also in directory of model
  1998.10.05 lch Support for MPD files

so these two features have existed from the very early days.


l3p (and L3Lab) treats MPD subfiles as public/global, which I think was the original idea.

If an .mpd file with "0 FILE xxx.dat" is met and xxx.dat has already been seen and loaded,
you will get a warning and the second xxx.dat is skipped.
The first xxx.dat can be referenced from anywhere.

l3p is of course tightly coupled to the POV-Ray data model.

If it were to support MPD subfiles as local to the MPD and its children,
it would require adding some extra naming convention 
in stead of the straight forward _xxx_dot_dat.


l3p is a simpler app handling all loading in one run.
L3Lab uses caching, so parts loaded for the first model file are kept
readily available for reference by a second model file.
However, if the model file was an MPD file, its subfiles are wiped before loading the second model file.

In the source code I found this:

   /* Prepare for the day MPD is allowed in P and PARTS so this MPD subfile doesn't get cleared in FreeModel() */

which means that subfiles of an MPD file loaded from P and PARTS are not wiped.
Note however they are publicly available.


I never saw any MPD files in P and PARTS,
and don't know if they exist today.
l3p and L3Lab cannot cope with two MPD files in PARTS both having the same "0 FILE xxx.dat" line.

But, MPD files in PARTS could solve the namespace problem themselves using prefixing:

   PARTS\3001.mpd:  0 FILE 3001_xxx.dat
   PARTS\3002.mpd:  0 FILE 3002_xxx.dat

3001_xxx.dat and 3002_xxx.dat would still be public, but who cares/realizes ?

l3p would continue to generate correct POV-Ray code.


I also found this comment:

      /* Hmm, MPD scoping says that MPD subfiles are public. However,
        L3xx allows nested MPDs which makes scoping somewhat unclear.
        Right above you are warned if the same filename appeared in
        another MPD (or elsewhere). MPD subfiles of a part or a
        primitive should be kept private...
        -and not cleared in FreeModel()                                                  */

which suggests that I had some thoughts about scoping back then
(for technical reasons/conflicts from a programmers perspective, not about the logical application/usage)
but at that time it was never an issue.
/Lars
Reply
« Next Oldest | Next Newest »



Messages In This Thread
Search path discussion - by Orion Pobursky - 2021-03-16, 13:26
RE: Search path discussion - by Travis Cobbs - 2021-03-16, 22:11
RE: Search path discussion - by Travis Cobbs - 2021-03-16, 22:09
RE: Search path discussion - by Travis Cobbs - 2021-03-17, 19:27
RE: Search path discussion - by Travis Cobbs - 2021-04-14, 18:09
RE: Search path discussion - by Travis Cobbs - 2021-04-15, 20:14
RE: Search path discussion - by Cam's Bricks - 2022-03-15, 11:08
RE: Search path discussion - by N. W. Perry - 2022-03-15, 17:12
RE: Search path discussion - by Travis Cobbs - 2022-03-15, 21:34
RE: Search path discussion - by Travis Cobbs - 2022-03-16, 16:37
RE: Search path discussion - by Travis Cobbs - 2022-03-16, 23:53
RE: Search path discussion - by Travis Cobbs - 2022-03-19, 21:02
RE: Search path discussion - by Lars C. Hassing - 2022-03-20, 21:34

Forum Jump:


Users browsing this thread: 1 Guest(s)