InstallTL and ConfigML

Welcome! InstallTL is a tool to install tools. It uses a script to determine the actions, much like the classic AmigaOS Installer. The script is stored in SGML, and read using the GuiSGML toolset.

ConfigML is a toolset that is based on the GuiSGML toolset. It provides an API for reading, writing and modifying configurations which are stored in markup (SGML).

The installer can set config data from the install script - this is a valuable function.

InstallTL can:

Note this is the first release of the installer, and many functions will be added over time.

The installer can be downloaded in one complete archive - Install.lzx. As always this file needs to be renamed to .lzx because of geocities filenaming restrictions. This archive contains the GuiSGML tools, ConfigML tools, cpt and toolhead (Thanks Jesse of AI for letting me redistribute cpt and toolhead in the archive).

To install the installer, a tool called InstallInstall is included (ironic huh). This tool will install the tools in the correct places, checking the version numbers of existing tools. Don't worry - It doesn't blindly overwrite tools you already have, it simply skips them if you have a version already.

Just "source INSTALL" in the tl_install dir. You can then delete /app/stdio/InstallInstall and the install_tl dir if you wish.

Why ConfigML?

There are several reasons for storing configuration files in markup.

Other advantages of the ConfigML toolset:

The toolset is completely built on top of the SGML tools so you can pickup the latest versions of any tool and all apps would get the upgrade.

The structure of configurations is assumed to be:

  "Application Type/Application Name/Application Instance/Configuration Name"
  

This allows a tool called GuiSGML (of type doc) to have different configuration files (doctypes and user) for different versions of the application (v1, v2):

And you don't have to worry about the dir handling!

An example program, the installer and all the source is included to show how easy it is to use ConfigML and GuiSGML! So click to download the lzx file. NOTE You must move .bin to .lzx. You will also need the tools from the GuiSGML archive if you don't already have them because this archive only contains the InstallTL and ConfigML files. It is recommended that you install InstallTL first...

InstallInstall app/stdio/InstallInstall.00

InstallInstall

InstallInstall is used to install the installer. Since InstallTL uses many tools, and the tools themselves need installing, this special tool is written to help firsttime installation.

InstallTL app/stdio/InstallTL.00

InstallTL scriptname

InstallTL will read the supplied script file, and follow the directives to install the files in the correct places.

The format of the script can be found in the install_file_fmt file in the archive. It should be self-evident.

ReadConfig lib/config/ReadConfig.00

CfgErr ReadConfig(CONFIG *cfg_ptr,char *apptype,char *appname, char *appinst, char *cfgname)

ReadConfig will return a pointer to the CONFIG handle used to manage the configuration after it has been loaded. The four strings specify the category (as defined above). The application type, and application name MUST be specified. The instance and name can be supplied as NULL or "" and a default path will be used. This forces all apps to adhere to the structure prescribed and apps work consistantly with each other making it easier on the end user. It will be possible in the future to extend beyond 4 levels.
Also, supplying a configuration name of "*" will cause all files in the directory to be read. This is useful when reading all the configs during init.

See Also: config/testconfig.c, FreeConfig

ReadConfig lib/config/ReadConfig.00

CfgErr ReadConfig(CONFIG *cfg_ptr,char *apptype,char *appname, char *appinst, char *cfgname)

ReadConfig will return a pointer to the CONFIG handle used to manage the configuration after it has been loaded. The four strings specify the category (as defined above). At this point in time all these MUST be specified. This forces all apps to adhere to the structure prescribed and apps work consistantly with each other making it easier on the end user. It will be possible in the future to extend beyond 4 levels.

See Also: config/testconfig.c, FreeConfig, WriteConfig

WriteConfig lib/config/WriteConfig.00

CfgErr WriteConfig(CONFIG cfg,char *apptype,char *appname, char *appinst, char *cfgname)

WriteConfig will save the configuration, creating any dirs that are necessary. cfg is the arg returned from ReadConfig or NewConfig.

See Also: config/testconfig.c, ReadConfig, FreeConfig, NewConfig

NewConfigGrp lib/config/NewConfigGrp.00

CONFIGLINK NewConfigGrp(CONFIGBLK *cfgblk_ptr,char *grpname)

NewConfigGrp allows you to create a group of attribute/value pairs that are related. For example, you might want to group a number of attributes under an "init" category. The cfgblk_ptr is a pointer to a CONFIGBLK structure that will be allocated and returned. The name of the group name is passed in as grpname. The tool returns a CONFIGLINK so you can add it to any configuration created from NewConfig or ReadConfig.

See Also: config/testconfig.c, ReadConfig, NewConfig

NewConfigPair lib/config/NewConfigPair.00

CONFIGLINK NewConfigPair(char *attrname,char *val)

NewConfigPair creates an attribute name and value that can be added to a configuration group created with NewConfigGrp. A CONFIGLINK is returned with a newly allocated copy of the strings passed in. This must be added to a group.

See Also: config/testconfig.c, NewConfigGrp

SetCfgValue lib/config/SetCfgValue.00

CfgErr SetCfgValue(CONFIG cfg,char *group, char *attribute, char *value)

SetCfgValue will set a config attribute to the supplied value for a specific group. If the attribute exists it overwrites the existing value. If the group or attribute doesn't exist, they are created.

See Also: config/testconfig.c, stdio/SetCfgValue.00

SetCfgValue app/stdio/SetCfgValue.00

SetCfgValue apptype appname instance cfgname group attribute value

SetCfgValue (the main tool) will load the config, call SetCfgValue the tool and then save the file.

See Also: config/testconfig.c, lib/config/SetCfgValue.00

GetCfgValue app/stdio/GetCfgValue.00

GetCfgValue apptype appname instance cfgname group attribute

GetCfgValue is a main tool that will load the config and dump the value of the attribute in the specified group. This can be useful in scripts for example when a new version of software needs to update some config values. When the attribute doesn't exist, nothing is displayed. When the attribute exists but with no value, TRUE is dumped.

See Also: config/testconfig.c, app/stdio/SetCfgValue.00

GetCfgValue app/stdio/Copy.00

CopyConfig apptype appname instance cfgname dest-instance dest-cfgname

CopyConfig is a main tool that will copy an applications config file to a different file or instance of that application. Eg.: "CopyConfig test testconfig default init copied init" will copy the default init configfile to the "copied" instance. "CopyConfig test testconfig default init default init2" will copy the default init file to a new config file called init2 within the default instance.

See Also: config/testconfig.c, app/stdio/SetCfgValue.00

CONFIG_MACROS config/Config.G
The following macros are used to abstract the SGML toolset to the configuration toolset so there is a consistant naming throughout the API. It wasn't worth creating new tools for these because there are existing SGML tools that do precisely what is required - and there is no need for the additional overhead.
CONFIGLINK FindCfgGroup(CONFIG,char *name)

FindCfgGrp will search a configuration for a group with a given name.

CONFIGLINK FindCfgPair(CONFIG,char *name,char **value)

FindCfgPair will search a configuration group for a attribute with a given name. Note, that for speed and friendlyness, a pointer is returned to the value as well as the link. This allows the caller to get straight to the value and still navigate the list in one call.

CONFIGLINK FindNextGroup(CONFIGLINK,char *name)

FindNextGroup will search until the next group is found and return the link to the next group. Note, the end of the list must be checked prior to using the returned link.

CONFIGBLOCK CfgData(CONFIGLINK)

CfgData is used to return the block structure associated with a link. This will also be used to get the CONFIGARG from a link (cast needed).

CONFIG NewConfig()

NewConfig will allocate a config handle.

void FreeConfig(CONFIG)

FreeConfig will free a config handle.

void LinkCfgData(CONFIGLINK,CONFIGBLOCK)

LinkCfgData will set an SGMLLINK to point to a CONFIGBLOCK. This can be returned with CfgData.

void FreeCfgLink(CONFIGLINK)

FreeCfgLink will free a CONFIGLINK structure.

void FreeCfgBlk(CONFIGBLOCK)

FreeCfgBlk will free a CONFIGBLOCK structure.

void FreeLinkBlk(CONFIGLINK)

FreeLinkBlk will free a config block and the link that attaches the block. It is the same as calling FreeCfgBlk, LinkCfgData followed by FreeCfgLink. More macros will be added here soon to improve navigation of the list. For now, you can navigate next/prev link using the SGML macros with a cast to CONFIGLINK.

See Also: config/testconfig.c


Questions? Drop the author an email.
Hosted by www.Geocities.ws

1