To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cad.devOpen lugnet.cad.dev in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / Development / 9632
     
   
Subject: 
Re: LDrawIni API (was: LDRAWPREDIRS LDRAWPOSTDIRS - additional search paths)
Newsgroups: 
lugnet.cad.dev
Date: 
Tue, 16 Mar 2004 16:43:15 GMT
Viewed: 
3903 times
  

In lugnet.cad.dev, Lars C. Hassing wrote:
Here are my ideas of an API for accessing the LDrawIni settings.

<Snip ideas>

Here are a few random thoughts on those ideas...

I haven't thought about it enough to decide if I have a preference
on the format of the UnknownFlags.  Either way seems ok to me.

If directories marked with <SKIP> are excluded from the search dirs,
how would I temporarily enable a <SKIP> directory?  It looks like I might
be able to go into the PrivateData struct to find it.  Then perhaps build
up a | delimited string from the SymbolicSearchDirs, except with the <SKIP>
tag removed from the newly enabled directory.  Finally pass this string to
LDrawIniResetSearchDirs() and rerun LDrawIniComputeRealDirs() on the
modified LdrawIniS struct.  So maybe the PrivateData really shouldn't
be all that private.

I mentioned this before but apparently nobody noticed. :^) How about
having LDrawIniComputeRealDirs() also substitute the value of
%USERPROFILE% or $HOME for a <HOMEDIR> tag?  That way I can have a
platform independent way of pointing to part directories in my home
directory from a centralized ldraw.ini file on the network.  Or a
single ldraw.ini file on a dual boot PC.

Perhaps the PrivateData should tell where the info came from:  what ini
file, environment vars, or LdrawIniResetSearchDirs().  (I'm not actually
sure I need to know unless I'm planning on saving ini modifications.)

Are you planning on making a similar API for creating or modifying and
saving the ini file?  I'll probably try to use the LdrawSetup program
as an LDDP style plugin, but others may want to incorporate it directly
into their programs.

I see you've included the LGEODIR.  Have you given any thought to
making this extensible beyond that?  We might someday like to be able
to locate some other ldraw part conversion library via the ldraw.ini
file.  For example the LDRAWPOV library.  Could LDrawIniGet() be
extended to handle this, or would a more generic function be better.

char *LDrawIniGetVar(const char *LdrawDir, char *VarName, int *ErrorCode);

LgeoDir = LdrawIniGetVar(NULL, "LgeoDirectory", &err);
ldrawpovDir = LdrawIniGetVar(NULL, "LdrawpovDir", &err);


Enjoy,

Don

   
         
   
Subject: 
Re: LDrawIni API (was: LDRAWPREDIRS LDRAWPOSTDIRS - additional search paths)
Newsgroups: 
lugnet.cad.dev
Date: 
Tue, 16 Mar 2004 22:57:16 GMT
Viewed: 
3812 times
  

In lugnet.cad.dev, Don Heyse wrote:
In lugnet.cad.dev, Lars C. Hassing wrote:
Here are my ideas of an API for accessing the LDrawIni settings.

<Snip ideas>

Here are a few random thoughts on those ideas...

I haven't thought about it enough to decide if I have a preference
on the format of the UnknownFlags.  Either way seems ok to me.

If directories marked with <SKIP> are excluded from the search dirs,
how would I temporarily enable a <SKIP> directory?

By modifying ldraw.ini or setting an env var.
Why would you want to enable a <SKIP> dir from within a program?

I mentioned this before but apparently nobody noticed. :^) How about
having LDrawIniComputeRealDirs() also substitute the value of
%USERPROFILE% or $HOME for a <HOMEDIR> tag?  That way I can have a
platform independent way of pointing to part directories in my home
directory from a centralized ldraw.ini file on the network.  Or a
single ldraw.ini file on a dual boot PC.

I did notice, but forgot it, sorry.
%USERPROFILE% or $HOME for <HOMEDIR>, OK fine with me.

Perhaps the PrivateData should tell where the info came from:  what ini
file, environment vars, or LdrawIniResetSearchDirs().  (I'm not actually
sure I need to know unless I'm planning on saving ini modifications.)

Yes, I actually thought of adding
   char          *LDrawDirSource;
   char          *SearchDirsSource;
   char          *LgeoDirSource;
strings you could use for e.g. debugging.
L3P could print them in the POV header.
Any interest?

Are you planning on making a similar API for creating or modifying and
saving the ini file?  I'll probably try to use the LdrawSetup program
as an LDDP style plugin, but others may want to incorporate it directly
into their programs.

You can copy'n'paste the dialog resources and the corresponding
.h and .cpp files from the LDrawSetup project (VC6) into your program,
or you can simply launch LDrawSetup.

I see you've included the LGEODIR.  Have you given any thought to
making this extensible beyond that?  We might someday like to be able
to locate some other ldraw part conversion library via the ldraw.ini
file.  For example the LDRAWPOV library.  Could LDrawIniGet() be
extended to handle this, or would a more generic function be better.

char *LDrawIniGetVar(const char *LdrawDir, char *VarName, int *ErrorCode);

LgeoDir = LdrawIniGetVar(NULL, "LgeoDirectory", &err);
ldrawpovDir = LdrawIniGetVar(NULL, "LdrawpovDir", &err);

I had my doubts about whether to include LgeoDir or not.
I know that probably only L3P uses it, but the structure could/should contain
all data found in ldraw.ini?
In that case you would simply publish an update of the LDrawIni source code
supporting the LdrawpovDir.
However, LDrawIniGetVar is a good idea for not very common variables.
More arguments could be: const char *EnvVar, char **Source

I'm open to both.
/Lars

 

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR