Imported Upstream version 1.6.2
[platform/upstream/libX11.git] / man / XrmGetFileDatabase.man
1 .\" Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1994, 1996 X Consortium
2 .\"
3 .\" Permission is hereby granted, free of charge, to any person obtaining
4 .\" a copy of this software and associated documentation files (the
5 .\" "Software"), to deal in the Software without restriction, including
6 .\" without limitation the rights to use, copy, modify, merge, publish,
7 .\" distribute, sublicense, and/or sell copies of the Software, and to
8 .\" permit persons to whom the Software is furnished to do so, subject to
9 .\" the following conditions:
10 .\"
11 .\" The above copyright notice and this permission notice shall be included
12 .\" in all copies or substantial portions of the Software.
13 .\"
14 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 .\" IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 .\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 .\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 .\" OTHER DEALINGS IN THE SOFTWARE.
21 .\"
22 .\" Except as contained in this notice, the name of the X Consortium shall
23 .\" not be used in advertising or otherwise to promote the sale, use or
24 .\" other dealings in this Software without prior written authorization
25 .\" from the X Consortium.
26 .\"
27 .\" Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991 by
28 .\" Digital Equipment Corporation
29 .\"
30 .\" Portions Copyright \(co 1990, 1991 by
31 .\" Tektronix, Inc.
32 .\"
33 .\" Permission to use, copy, modify and distribute this documentation for
34 .\" any purpose and without fee is hereby granted, provided that the above
35 .\" copyright notice appears in all copies and that both that copyright notice
36 .\" and this permission notice appear in all copies, and that the names of
37 .\" Digital and Tektronix not be used in in advertising or publicity pertaining
38 .\" to this documentation without specific, written prior permission.
39 .\" Digital and Tektronix makes no representations about the suitability
40 .\" of this documentation for any purpose.
41 .\" It is provided ``as is'' without express or implied warranty.
42 .\" 
43 .\"
44 .ds xT X Toolkit Intrinsics \- C Language Interface
45 .ds xW Athena X Widgets \- C Language X Toolkit Interface
46 .ds xL Xlib \- C Language X Interface
47 .ds xC Inter-Client Communication Conventions Manual
48 .na
49 .de Ds
50 .nf
51 .\\$1D \\$2 \\$1
52 .ft CW
53 .\".ps \\n(PS
54 .\".if \\n(VS>=40 .vs \\n(VSu
55 .\".if \\n(VS<=39 .vs \\n(VSp
56 ..
57 .de De
58 .ce 0
59 .if \\n(BD .DF
60 .nr BD 0
61 .in \\n(OIu
62 .if \\n(TM .ls 2
63 .sp \\n(DDu
64 .fi
65 ..
66 .de IN          \" send an index entry to the stderr
67 ..
68 .de Pn
69 .ie t \\$1\fB\^\\$2\^\fR\\$3
70 .el \\$1\fI\^\\$2\^\fP\\$3
71 ..
72 .de ZN
73 .ie t \fB\^\\$1\^\fR\\$2
74 .el \fI\^\\$1\^\fP\\$2
75 ..
76 .de hN
77 .ie t <\fB\\$1\fR>\\$2
78 .el <\fI\\$1\fP>\\$2
79 ..
80 .ny0
81 .de EX
82 .sp
83 .nf
84 .ft CW
85 ..
86 .de EE
87 .ft R
88 .fi
89 .sp
90 ..
91 .TH XrmGetFileDatabase __libmansuffix__ __xorgversion__ "XLIB FUNCTIONS"
92 .SH NAME
93 XrmGetFileDatabase, XrmPutFileDatabase, XrmGetStringDatabase, XrmLocaleOfDatabase, XrmGetDatabase, XrmSetDatabase, XrmDestroyDatabase \- retrieve and store resource databases
94 .SH SYNTAX
95 .HP
96 #include <X11/Xresource.h>
97 .HP
98 XrmDatabase XrmGetFileDatabase\^(\^char *\fIfilename\fP\^); 
99 .HP
100 void XrmPutFileDatabase\^(\^XrmDatabase \fIdatabase\fP\^, char
101 *\fIstored_db\fP\^); 
102 .HP
103 XrmDatabase XrmGetStringDatabase\^(\^char *\fIdata\fP\^, 
104 .HP
105 char *XrmLocaleOfDatabase\^(\^XrmDatabase \fIdatabase\fP\^); 
106 .HP
107 XrmDatabase XrmGetDatabase\^(\^Display *\fIdisplay\fP\^); 
108 .HP
109 void XrmSetDatabase\^(\^Display *\fIdisplay\fP\^, XrmDatabase
110 \fIdatabase\fP\^); 
111 .HP
112 void XrmDestroyDatabase\^(\^XrmDatabase \fIdatabase\fP\^); 
113 .SH ARGUMENTS
114 .IP \fIfilename\fP 1i
115 Specifies the resource database file name.
116 .IP \fIdatabase\fP 1i
117 Specifies the database that is to be used.
118 .IP \fIstored_db\fP 1i
119 Specifies the file name for the stored database.
120 .IP \fIdata\fP 1i
121 Specifies the database contents using a string.
122 .IP \fIdatabase\fP 1i
123 Specifies the resource database.
124 .IP \fIdisplay\fP 1i
125 Specifies the connection to the X server.
126 .SH DESCRIPTION
127 The
128 .ZN XrmGetFileDatabase
129 function opens the specified file,
130 creates a new resource database, and loads it with the specifications
131 read in from the specified file.
132 The specified file should contain a sequence of entries in valid ResourceLine
133 format (see section 15.1); the database that results from reading a file
134 with incorrect syntax is implementation-dependent.
135 The file is parsed in the current locale, 
136 and the database is created in the current locale.
137 If it cannot open the specified file,
138 .ZN XrmGetFileDatabase
139 returns NULL.
140 .LP
141 The
142 .ZN XrmPutFileDatabase
143 function stores a copy of the specified database in the specified file.
144 Text is written to the file as a sequence of entries in valid
145 ResourceLine format (see section 15.1).
146 The file is written in the locale of the database.
147 Entries containing resource names that are not in the Host Portable Character
148 Encoding or containing values that are not in the encoding of the database
149 locale, are written in an implementation-dependent manner.
150 The order in which entries are written is implementation-dependent.
151 Entries with representation types other than ``String'' are ignored.
152 .LP
153 The
154 .ZN XrmGetStringDatabase
155 function creates a new database and stores the resources specified
156 in the specified null-terminated string.
157 .ZN XrmGetStringDatabase
158 is similar to
159 .ZN XrmGetFileDatabase
160 except that it reads the information out of a string instead of out of a file.
161 The string should contain a sequence of entries in valid ResourceLine
162 format (see section 15.1) terminated by a null character;
163 the database that results from using a string
164 with incorrect syntax is implementation-dependent.
165 The string is parsed in the current locale, 
166 and the database is created in the current locale.
167 .LP
168 If database is NULL,
169 .ZN XrmDestroyDatabase
170 returns immediately.
171 .LP
172 The
173 .ZN XrmLocaleOfDatabase
174 function returns the name of the locale bound to the specified
175 database, as a null-terminated string.
176 The returned locale name string is owned by Xlib and should not be
177 modified or freed by the client.
178 Xlib is not permitted to free the string until the database is destroyed.
179 Until the string is freed,
180 it will not be modified by Xlib.
181 .LP
182 The
183 .ZN XrmGetDatabase
184 function returns the database associated with the specified display.
185 It returns NULL if a database has not yet been set.
186 .LP
187 The
188 .ZN XrmSetDatabase
189 function associates the specified resource database (or NULL)
190 with the specified display.
191 The database previously associated with the display (if any) is not destroyed.
192 A client or toolkit may find this function convenient for retaining a database
193 once it is constructed.
194 .SH "FILE SYNTAX"
195 The syntax of a resource file is a sequence of resource lines
196 terminated by newline characters or the end of the file.
197 The syntax of an individual resource line is:
198 .LP
199 .\" Start marker code here
200 .EX
201 ResourceLine    =       Comment | IncludeFile | ResourceSpec | <empty line>
202 Comment =       "!" {<any character except null or newline>}
203 IncludeFile     =       "#" WhiteSpace "include" WhiteSpace FileName WhiteSpace
204 FileName        =       <valid filename for operating system>
205 ResourceSpec    =       WhiteSpace ResourceName WhiteSpace ":" WhiteSpace Value
206 ResourceName    =       [Binding] {Component Binding} ComponentName
207 Binding =       "\&." | "*"
208 WhiteSpace      =       {<space> | <horizontal tab>}
209 Component       =       "?" | ComponentName
210 ComponentName   =       NameChar {NameChar}
211 NameChar        =       "a"\-"z" | "A"\-"Z" | "0"\-"9" | "_" | "-"
212 Value   =       {<any character except null or unescaped newline>}
213 .EE
214 .LP
215 Elements separated by vertical bar (|) are alternatives.
216 Curly braces ({\&.\&.\&.}) indicate zero or more repetitions
217 of the enclosed elements.
218 Square brackets ([\&.\&.\&.]) indicate that the enclosed element is optional.
219 Quotes ("\&.\&.\&.") are used around literal characters.
220 .LP
221 IncludeFile lines are interpreted by replacing the line with the
222 contents of the specified file.
223 The word ``include'' must be in lowercase.
224 The file name is interpreted relative to the directory of the file in
225 which the line occurs (for example, if the file name contains no
226 directory or contains a relative directory specification).
227 .LP
228 If a ResourceName contains a contiguous sequence of two or more Binding
229 characters, the sequence will be replaced with single ``\&.'' character
230 if the sequence contains only ``\&.'' characters;
231 otherwise, the sequence will be replaced with a single ``*'' character.
232 .LP
233 A resource database never contains more than one entry for a given
234 ResourceName.  If a resource file contains multiple lines with the
235 same ResourceName, the last line in the file is used.
236 .LP
237 Any white space characters before or after the name or colon in a ResourceSpec
238 are ignored.
239 To allow a Value to begin with white space,
240 the two-character sequence ``\^\\\^\fIspace\fP'' (backslash followed by space)
241 is recognized and replaced by a space character,
242 and the two-character sequence ``\^\\\^\fItab\fP''
243 (backslash followed by horizontal tab)
244 is recognized and replaced by a horizontal tab character.
245 To allow a Value to contain embedded newline characters,
246 the two-character sequence ``\^\\\^n'' is recognized and replaced by a
247 newline character.
248 To allow a Value to be broken across multiple lines in a text file,
249 the two-character sequence ``\^\\\^\fInewline\fP''
250 (backslash followed by newline) is
251 recognized and removed from the value.
252 To allow a Value to contain arbitrary character codes,
253 the four-character sequence ``\^\\\^\fInnn\fP'',
254 where each \fIn\fP is a digit character in the range of ``0''\^\-``7'',
255 is recognized and replaced with a single byte that contains
256 the octal value specified by the sequence.
257 Finally, the two-character sequence ``\^\\\\'' is recognized
258 and replaced with a single backslash.
259 .SH "SEE ALSO"
260 XrmGetResource(__libmansuffix__),
261 XrmInitialize(__libmansuffix__),
262 XrmPutResource(__libmansuffix__)
263 .br
264 \fI\*(xL\fP