comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Config files
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Config files [message #47407 is a reply to message #47402] Thu, 09 February 2006 08:53 Go to previous messageGo to previous message
news.qwest.net is currently offline  news.qwest.net
Messages: 137
Registered: September 2005
Senior Member
"Edd" <eddedmondson@hotmail.com> wrote in message
news:dsf79i$fam$1@news.ox.ac.uk...
> I'd like to shift my rather clunky code with too many hardcoded
> constants over to using some sort of configuration file, ideally
> something in a sensible ASCII format. I'd want to pass my code the
> filename, and then it could read the file and pair things up in a
> structure, so I might have a file like
>
> input = myinputdata.dat
> output = myoutputwillgohere.dat
> aconstant = 1.0
> anarray = [1,2,3]
>
> and read it with something like
> foo=readconfig('configdata.txt')
> and get a datastructure from it like
> foo.input='myinputdata.dat'
> foo.aconstant=1.0 etc...
>
> Shirley I don't need to reinvent the wheel? Anything functionally
> vaguely similar would be very handy.
>
> --
> Edd


A while ago I tried to make a singleton config object.
Couldn't really do it, but what I ended up doing was making
a system variable of an object (of an array of structures),
and had a initilization routine that checked to see if it already existed.

pro initialize_qscatinfo,verbose=verbose

defsysv,'!qscatinfo',exist=exist

If exist then begin
if keyword_set(verbose) then print,'variable already defined: '
endif else begin
if keyword_set(verbose) then print,'defining variable: '
defsysv,'!qscatinfo',OBJ_NEW('qscat_info')
endelse

end ; procedure

The object was an array of structures, and it had the usual "get" method
that was based on keywords:
return = !qscatinfo->get(/keyword)


Cheers,
bob
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: help with text widget...
Next Topic: Re: IDLWave documentation generation

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 04:17:06 PDT 2025

Total time taken to generate the page: 1.36444 seconds