Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1994, 1996 X Consortium
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from the X Consortium.
Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991 by
Digital Equipment Corporation
Portions Copyright \(co 1990, 1991 by
Tektronix, Inc.
Permission to use, copy, modify and distribute this documentation for
any purpose and without fee is hereby granted, provided that the above
copyright notice appears in all copies and that both that copyright notice
and this permission notice appear in all copies, and that the names of
Digital and Tektronix not be used in in advertising or publicity pertaining
to this documentation without specific, written prior permission.
Digital and Tektronix makes no representations about the suitability
of this documentation for any purpose.
It is provided ``as is'' without express or implied warranty.
.\\$1D \\$2 \\$1 .ps \\n(PS.. .. .. .. .. .ny0 e
.if \\n(VS>=40 .vs \\n(VSu
.if \\n(VS<=39 .vs \\n(VSp
..0 .nr BD 0
#include <X11/Xresource.h>
Bool XrmGetResource\^(\^XrmDatabase database\^, char *str_name\^, char *str_class\^, char **str_type_return\^, XrmValue *value_return\^);
Bool XrmQGetResource\^(\^XrmDatabase database\^, XrmNameList quark_name\^, XrmClassList quark_class\^, XrmRepresentation *quark_type_return\^, XrmValue *value_return\^);
typedef XrmHashTable *XrmSearchList; Bool XrmQGetSearchList\^(\^XrmDatabase database\^, XrmNameList names\^, XrmClassList classes\^, XrmSearchList list_return\^, int list_length\^);
Bool XrmQGetSearchResource\^(\^XrmSearchList list\^, XrmName name\^, XrmClass class\^, XrmRepresentation *type_return\^, XrmValue *value_return\^);
The database only frees or overwrites entries on .ZN XrmPutResource , .ZN XrmQPutResource , or .ZN XrmMergeDatabases . A client that is not storing new values into the database or is not merging the database should be safe using the address passed back at any time until it exits. If a resource was found, both .ZN XrmGetResource and .ZN XrmQGetResource return .ZN True ; otherwise, they return .ZN False .
The .ZN XrmQGetSearchList function takes a list of names and classes and returns a list of database levels where a match might occur. The returned list is in best-to-worst order and uses the same algorithm as .ZN XrmGetResource for determining precedence. If list_return was large enough for the search list, .ZN XrmQGetSearchList returns .ZN True ; otherwise, it returns .ZN False .
The size of the search list that the caller must allocate is dependent upon the number of levels and wildcards in the resource specifiers that are stored in the database. The worst case length is %3 sup n%, where n is the number of name or class components in names or classes.
When using .ZN XrmQGetSearchList followed by multiple probes for resources with a common name and class prefix, only the common prefix should be specified in the name and class list to .ZN XrmQGetSearchList .
The .ZN XrmQGetSearchResource function searches the specified database levels for the resource that is fully identified by the specified name and class. The search stops with the first match. .ZN XrmQGetSearchResource returns .ZN True if the resource was found; otherwise, it returns .ZN False .
A call to .ZN XrmQGetSearchList with a name and class list containing all but the last component of a resource name followed by a call to .ZN XrmQGetSearchResource with the last component name and class returns the same database entry as .ZN XrmGetResource and .ZN XrmQGetResource with the fully qualified name and class.
The full name and class are scanned from left to right (from highest level in the hierarchy to lowest), one component at a time. At each level, the corresponding component and/or binding of each matching entry is determined, and these matching components and bindings are compared according to precedence rules. Each of the rules is applied at each level before moving to the next level, until a rule selects a single entry over all others. The rules, in order of precedence, are:
\*(xL