
Package Tool Functions?

jjweimer
Function PackageSetup(name,[keywords ....]) string name .... others ... string thePackageFolder, thePackageFile, thePackageInfo, thePackageAuthor variable thePackageVersion, hasHelp // stores information about the package in root:Packages:PackageTools // as a keyword=value list // creates the root:Packages:"packagefolder" folder end Function PackageRemove(name,[options ...]) string name // removes the package (kills off its package folder) end Function PackageHelp(name) // opens a help file if the package registers that it has such // otherwise shows an alert "No Help for Package ..." end Function PackageFolderDFR(name,[options ...]) string name return (the DFREF for the given package name considering options) end
Example uses are ...
* A call to PackageSetup("ScreenSizer",hasHelp=1,version=2.3) would create the string root:Packages:PackageTools:ScreenSizer with contents "thePackage=ScreenSizer;thePackageFolder=root:Packages:ScreenSizer;hasHelp=1;version=2.3" and would also create the data folder root:Packages:ScreenSizer
* A further call can add other keywords ... PackageSetup("ScreenSizer",author="Jeffrey J Weimer", info="A way to size windows by percent values")
* A call PackageRemove("ScreenSizer",quiet=1) would (silently) kill off the package folder (remove it from the experiment)
* A call such as below gets the location of certain globals for the package ...
DFREF pf = PackageFolderDFR("ScreenSizer",folder="screenparameters") NVAR screenwidth = pf:screenwidth
As my thinking often tends toward "standardization", my thoughts are that new (and seasoned) programmers might find use in having a base set of such "package tools". In this regard, I would be generating the commands in a procedure file that should be definition always be put in the Igor Procedures folder so as not to have to #include it.
I already have similar overhead in my procedures now (through such things as StrConstant thePackageFolder="...", Constant thePackageVersion=...), and I am using Help() and RemoveMe() type functions as well (see http://www.igorexchange.com/node/976).
Any thoughts on this idea?
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
June 23, 2010 at 12:37 pm - Permalink