1XrmGetFileDatabase(3) XLIB FUNCTIONS XrmGetFileDatabase(3)
2
3
4
6 XrmGetFileDatabase, XrmPutFileDatabase, XrmGetStringDatabase, XrmLoca‐
7 leOfDatabase, XrmGetDatabase, XrmSetDatabase, XrmDestroyDatabase -
8 retrieve and store resource databases
9
11 XrmDatabase XrmGetFileDatabase(char *filename);
12
13 void XrmPutFileDatabase(XrmDatabase database, char *stored_db);
14
15 XrmDatabase XrmGetStringDatabase(char *data,
16
17 char *XrmLocaleOfDatabase(XrmDatabase database);
18
19 XrmDatabase XrmGetDatabase(Display *display);
20
21 void XrmSetDatabase(Display *display, XrmDatabase database);
22
23 void XrmDestroyDatabase(XrmDatabase database);
24
26 filename Specifies the resource database file name.
27
28 database Specifies the database that is to be used.
29
30 stored_db Specifies the file name for the stored database.
31
32 data Specifies the database contents using a string.
33
34 database Specifies the resource database.
35
36 display Specifies the connection to the X server.
37
39 The XrmGetFileDatabase function opens the specified file, creates a new
40 resource database, and loads it with the specifications read in from
41 the specified file. The specified file should contain a sequence of
42 entries in valid ResourceLine format (see section 15.1); the database
43 that results from reading a file with incorrect syntax is implementa‐
44 tion-dependent. The file is parsed in the current locale, and the
45 database is created in the current locale. If it cannot open the spec‐
46 ified file, XrmGetFileDatabase returns NULL.
47
48 The XrmPutFileDatabase function stores a copy of the specified database
49 in the specified file. Text is written to the file as a sequence of
50 entries in valid ResourceLine format (see section 15.1). The file is
51 written in the locale of the database. Entries containing resource
52 names that are not in the Host Portable Character Encoding or contain‐
53 ing values that are not in the encoding of the database locale, are
54 written in an implementation-dependent manner. The order in which
55 entries are written is implementation-dependent. Entries with repre‐
56 sentation types other than ``String'' are ignored.
57
58 The XrmGetStringDatabase function creates a new database and stores the
59 resources specified in the specified null-terminated string. XrmGet‐
60 StringDatabase is similar to XrmGetFileDatabase except that it reads
61 the information out of a string instead of out of a file. The string
62 should contain a sequence of entries in valid ResourceLine format (see
63 section 15.1) terminated by a null character; the database that results
64 from using a string with incorrect syntax is implementation-dependent.
65 The string is parsed in the current locale, and the database is created
66 in the current locale.
67
68 If database is NULL, XrmDestroyDatabase returns immediately.
69
70 The XrmLocaleOfDatabase function returns the name of the locale bound
71 to the specified database, as a null-terminated string. The returned
72 locale name string is owned by Xlib and should not be modified or freed
73 by the client. Xlib is not permitted to free the string until the
74 database is destroyed. Until the string is freed, it will not be modi‐
75 fied by Xlib.
76
77 The XrmGetDatabase function returns the database associated with the
78 specified display. It returns NULL if a database has not yet been set.
79
80 The XrmSetDatabase function associates the specified resource database
81 (or NULL) with the specified display. The database previously associ‐
82 ated with the display (if any) is not destroyed. A client or toolkit
83 may find this function convenient for retaining a database once it is
84 constructed.
85
87 The syntax of a resource file is a sequence of resource lines termi‐
88 nated by newline characters or the end of the file. The syntax of an
89 individual resource line is:
90
91 ResourceLine = Comment | IncludeFile | ResourceSpec | <empty line>
92 Comment = "!" {<any character except null or newline>}
93 IncludeFile = "#" WhiteSpace "include" WhiteSpace FileName WhiteSpace
94 FileName = <valid filename for operating system>
95 ResourceSpec = WhiteSpace ResourceName WhiteSpace ":" WhiteSpace Value
96 ResourceName = [Binding] {Component Binding} ComponentName
97 Binding = "." | "*"
98 WhiteSpace = {<space> | <horizontal tab>}
99 Component = "?" | ComponentName
100 ComponentName = NameChar {NameChar}
101 NameChar = "a"-"z" | "A"-"Z" | "0"-"9" | "_" | "-"
102 Value = {<any character except null or unescaped newline>}
103
104 Elements separated by vertical bar (|) are alternatives. Curly braces
105 ({...}) indicate zero or more repetitions of the enclosed elements.
106 Square brackets ([...]) indicate that the enclosed element is optional.
107 Quotes ("...") are used around literal characters.
108
109 IncludeFile lines are interpreted by replacing the line with the con‐
110 tents of the specified file. The word ``include'' must be in lower‐
111 case. The file name is interpreted relative to the directory of the
112 file in which the line occurs (for example, if the file name contains
113 no directory or contains a relative directory specification).
114
115 If a ResourceName contains a contiguous sequence of two or more Binding
116 characters, the sequence will be replaced with single ``.'' character
117 if the sequence contains only ``.'' characters; otherwise, the sequence
118 will be replaced with a single ``*'' character.
119
120 A resource database never contains more than one entry for a given
121 ResourceName. If a resource file contains multiple lines with the same
122 ResourceName, the last line in the file is used.
123
124 Any white space characters before or after the name or colon in a
125 ResourceSpec are ignored. To allow a Value to begin with white space,
126 the two-character sequence ``\space'' (backslash followed by space) is
127 recognized and replaced by a space character, and the two-character
128 sequence ``\tab'' (backslash followed by horizontal tab) is recognized
129 and replaced by a horizontal tab character. To allow a Value to con‐
130 tain embedded newline characters, the two-character sequence ``\n'' is
131 recognized and replaced by a newline character. To allow a Value to be
132 broken across multiple lines in a text file, the two-character sequence
133 ``\newline'' (backslash followed by newline) is recognized and removed
134 from the value. To allow a Value to contain arbitrary character codes,
135 the four-character sequence ``\nnn'', where each n is a digit character
136 in the range of ``0''-``7'', is recognized and replaced with a single
137 byte that contains the octal value specified by the sequence. Finally,
138 the two-character sequence ``\\'' is recognized and replaced with a
139 single backslash.
140
142 XrmGetResource(3), XrmInitialize(3), XrmPutResource(3)
143 Xlib - C Language X Interface
144
145
146
147X Version 11 libX11 1.3.4 XrmGetFileDatabase(3)