Functions | |
int | mt_ConfRead (APPvar *app) |
read the configuration file and set the WinDom parameters | |
int | mt_ConfInquire (APPvar *app, char *keyword, char *fmt,...) |
read an user variable in the configuration file | |
int | mt_ConfGetLine (APPvar *app, char *line) |
read acces by line in the configuration file | |
int | mt_ConfWrite (APPvar *app, char *keyword, char *fmt,...) |
write the windom config file | |
int | mt_ConfWindom (APPvar *app) |
load winconf (windom configurator) | |
int | ConfInquire (char *keyword, char *fmt,...) |
see mt_ConfInquire() | |
int | ConfWrite (char *keyword, char *fmt,...) |
see mt_ConfWrite() |
int ConfInquire | ( | char * | keyword, | |
char * | fmt, | |||
... | ||||
) |
see mt_ConfInquire()
int ConfWrite | ( | char * | keyword, | |
char * | fmt, | |||
... | ||||
) |
see mt_ConfWrite()
int mt_ConfGetLine | ( | APPvar * | app, | |
char * | string | |||
) |
read acces by line in the configuration file
app | application descriptor | |
string | pointer to a buffer to store the line |
0 | no more lines to read | |
>0 | number of the line read |
variable = value
int mt_ConfInquire | ( | APPvar * | app, | |
char * | keyword, | |||
char * | fmt, | |||
... | ||||
) |
read an user variable in the configuration file
app | application descriptor | |
keyword | name of variable to read | |
fmt | format of value (see below) | |
... | address(es) of variable(s) to fill-in. |
>=0 | is the number of values read | |
-1 | variable not found | |
-33 | configuration file not found |
The syntax of variable definition in the configuration file have the following structure:
keyword = value[, value[, ...]]
The '[]' notation means an optional argument. The format
parameter have a similar syntax than printf(). Possible variable are :
Example of configuration file:
appli.font.name = "Helvetica Bold" appli.system.path = C:\APPLI\system\ appli.window.size = 400,300 appli.window.sizer = 'S' appli.parameters.save = TRUE appli.parameters.bubble = TRUE
void InitAppl( void) { char FontName[33], path[128]; int width, height; char car; #define PARAM_SAVE 0x1 #define PARAM_BUBBLE 0x2 int param; if( ConfInquire( "appli.font.name", "%s", FontName) != 1) strcpy( FontName, "Times"); if( ConfInquire( "appli.system.path", "%s", path) != 1) strcpy( path, ""); if( ConfInquire( "appli.window.size", "%d,%d", &width, &height) != 2) width = height = 200; if( ConfInquire( "appli.window.sizer", "%s", &car) != 1) car = 'S'; ConfInquire( "appli.parameters.save", "%B", ¶m, PARAM_SAVE); ConfInquire( "appli.parameters.bubble", "%B", ¶m, PARAM_BUBBLE); }
int mt_ConfRead | ( | APPvar * | app | ) |
read the configuration file and set the WinDom parameters
app | application descriptor |
0 | success | |
-1 | application not find in the configuration file | |
-33 | configuration file not found |
This function is used by mt_ApplInit() to initialize the WinDom settings and by mt_EvntWindom() when it receives the AP_CONF
message.
The WinDom configuration file is an unique text file grouping the configuration of all WinDom application in a similar way then the '.Xdefaults' X11 file for example. This file is typically located in the HOME folder. Actually, WinDom searchs this file in the following directories :
This file is nammed 'windom.cnf' or '.windomrc' if the file system supports the long name file.
keyword = value list ...
int mt_ConfWindom | ( | APPvar * | app | ) |
load winconf (windom configurator)
app | application descriptor |
int mt_ConfWrite | ( | APPvar * | app, | |
char * | name, | |||
char * | fmt, | |||
... | ||||
) |
write the windom config file
app | application descriptior | |
name | name of variable to write | |
fmt | format of value (similar to printf) | |
... | variables (%d or %s etc... of fmt) |
0 | success | |
<0 | error |