retrieve and store resource databases
SYNTAX
XrmDatabase XrmGetFileDatabase(char *filename);
void XrmPutFileDatabase(XrmDatabase database, char *stored_db);
XrmDatabase XrmGetStringDatabase(char *data,
char *XrmLocaleOfDatabase(XrmDatabase database);
XrmDatabase XrmGetDatabase(Display *display);
void XrmSetDatabase(Display *display, XrmDatabase database);
void XrmDestroyDatabase(XrmDatabase database);
ARGUMENTS
filename Specifies the resource database file name.
database Specifies the database that is to be used.
stored_db Specifies the file name for the stored database.
data Specifies the database contents using a string.
database Specifies the resource database.
display Specifies the connection to the X server.
DESCRIPTION
The XrmGetFileDatabase function opens the specified file, creates a new
resource database, and loads it with the specifications read in from
the specified file. The specified file should contain a sequence of
entries in valid ResourceLine format (see section 15.1); the database
that results from reading a file with incorrect syntax is implementa-
tion-dependent. The file is parsed in the current locale, and the
database is created in the current locale. If it cannot open the spec-
ified file, XrmGetFileDatabase returns NULL.
The XrmPutFileDatabase function stores a copy of the specified database
in the specified file. Text is written to the file as a sequence of
entries in valid ResourceLine format (see section 15.1). The file is
written in the locale of the database. Entries containing resource
names that are not in the Host Portable Character Encoding or contain-
ing values that are not in the encoding of the database locale, are
written in an implementation-dependent manner. The order in which
entries are written is implementation-dependent. Entries with repre-
sentation types other than ``String'' are ignored.
The XrmGetStringDatabase function creates a new database and stores the
resources specified in the specified null-terminated string. XrmGet-
database is destroyed. Until the string is freed, it will not be modi-
fied by Xlib.
The XrmGetDatabase function returns the database associated with the
specified display. It returns NULL if a database has not yet been set.
The XrmSetDatabase function associates the specified resource database
(or NULL) with the specified display. The database previously associ-
ated with the display (if any) is not destroyed. A client or toolkit
may find this function convenient for retaining a database once it is
constructed.
FILE SYNTAX
The syntax of a resource file is a sequence of resource lines termi-
nated by newline characters or the end of the file. The syntax of an
individual resource line is:
ResourceLine = Comment | IncludeFile | ResourceSpec | <empty line>
Comment = "!" {<any character except null or newline>}
IncludeFile = "#" WhiteSpace "include" WhiteSpace FileName WhiteSpace
FileName = <valid filename for operating system>
ResourceSpec = WhiteSpace ResourceName WhiteSpace ":" WhiteSpace Value
ResourceName = [Binding] {Component Binding} ComponentName
Binding = "." | "*"
WhiteSpace = {<space> | <horizontal tab>}
Component = "?" | ComponentName
ComponentName = NameChar {NameChar}
NameChar = "a"-"z" | "A"-"Z" | "0"-"9" | "_" | "-"
Value = {<any character except null or unescaped newline>}
Elements separated by vertical bar (|) are alternatives. Curly braces
({...}) indicate zero or more repetitions of the enclosed elements.
Square brackets ([...]) indicate that the enclosed element is optional.
Quotes ("...") are used around literal characters.
IncludeFile lines are interpreted by replacing the line with the con-
tents of the specified file. The word ``include'' must be in lower-
case. The file name is interpreted relative to the directory of the
file in which the line occurs (for example, if the file name contains
no directory or contains a relative directory specification).
If a ResourceName contains a contiguous sequence of two or more Binding
characters, the sequence will be replaced with single ``.'' character
if the sequence contains only ``.'' characters; otherwise, the sequence
will be replaced with a single ``*'' character.
A resource database never contains more than one entry for a given
ResourceName. If a resource file contains multiple lines with the same
ResourceName, the last line in the file is used.
Any white space characters before or after the name or colon in a
ResourceSpec are ignored. To allow a Value to begin with white space,
SEE ALSO
XrmGetResource(3X11), XrmInitialize(3X11), XrmPutResource(3X11)
Xlib - C Language X Interface
X Version 11 Release 6.6 XrmGetFileDatabase(3X11)
Man(1) output converted with
man2html
|