home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1999 March B / SCO_CASTOR4RRT.iso / BASEman / root.10 / usr / lib / scohelp / en_US.ISO8859-1 / man / html.X3xlib / XrmGetResource.X3xlib.html < prev   
Encoding:
C/C++ Source or Header  |  1998-08-19  |  8.5 KB  |  210 lines

  1. <HTML>
  2. <HEAD>
  3. <META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=iso-8859-1">
  4. <TITLE>XrmGetResource(X3xlib) X Version 11 (Release 6.1) </TITLE>
  5. <SCRIPT LANGUAGE=JavaScript>
  6. <!-- comment for old browsers
  7. var Contents = "/man/html.X3xlib/CONTENTS.html"
  8. var PrintSequence = "/man/html.X3xlib/CONTENTS.html"
  9. if ( parent.RightHistory != null ) parent.RightHistory(document.URL)
  10. // end of comment -->
  11. </SCRIPT>
  12. </HEAD>
  13. <BODY>
  14. <H1>XrmGetResource(X3xlib) X Version 11 (Release 6.1)</H1> 
  15. <HR> 
  16. <B>XrmGetResource -- 
  17. <!--Meta NM "XrmGetResource"--> 
  18. retrieve database resources and search lists 
  19. </B> 
  20. <!--Meta DN "retrieve database resources and search lists"--> 
  21. <P> 
  22. <H2>Synopsis</H2> 
  23. <PRE>   Bool XrmGetResource(database, str_name, str_class, str_type_return, 
  24.                        value_return) 
  25.         XrmDatabase database; 
  26.         char *str_name; 
  27.         char *str_class; 
  28.         char **str_type_return; 
  29.         XrmValue *value_return; 
  30.    <P> 
  31.    Bool XrmQGetResource(database, quark_name, quark_class, quark_type_return, 
  32.                         value_return) 
  33.         XrmDatabase database; 
  34.         XrmNameList quark_name; 
  35.         XrmClassList quark_class; 
  36.         XrmRepresentation *quark_type_return; 
  37.         XrmValue *value_return; 
  38.    <P> 
  39.    typedef XrmHashTable *XrmSearchList; 
  40.    <P> 
  41.    Bool XrmQGetSearchList(database, names, classes, list_return, list_length) 
  42.         XrmDatabase database; 
  43.         XrmNameList names; 
  44.         XrmClassList classes; 
  45.         XrmSearchList list_return; 
  46.         int list_length; 
  47.    <P> 
  48.    Bool XrmQGetSearchResource(list, name, class, type_return, value_return) 
  49.         XrmSearchList list; 
  50.         XrmName name; 
  51.         XrmClass class; 
  52.         XrmRepresentation *type_return; 
  53.         XrmValue *value_return; 
  54. </PRE> 
  55. <H3>Arguments</H3> 
  56. <DL COMPACT> 
  57. <P><DT><B><I>class</I></B><DD> 
  58. Specifies the resource class. 
  59. <P><DT><B><I>classes</I></B><DD> 
  60. Specifies a list of resource classes. 
  61. <P><DT><B><I>database</I></B><DD> 
  62. Specifies the database that is to be used. 
  63. <P><DT><B><I>list</I></B><DD> 
  64. Specifies the search list returned by <B>XrmQGetSearchList</B>. 
  65. <P><DT><B><I>list_length</I></B><DD> 
  66. Specifies the number of entries (not the byte size) 
  67. allocated for <B><I>list_return</I></B>. 
  68. <P><DT><B><I>list_return</I></B><DD> 
  69. Returns a search list for further use. 
  70. <P><DT><B><I>name</I></B><DD> 
  71. Specifies the resource name. 
  72. <P><DT><B><I>names</I></B><DD> 
  73. Specifies a list of resource names. 
  74. <P><DT><B><I>quark_class</I></B><DD> 
  75. Specifies the fully qualified class of the value being retrieved (as a quark). 
  76. <P><DT><B><I>quark_name</I></B><DD> 
  77. Specifies the fully qualified name of the value being retrieved (as a quark). 
  78. <P><DT><B><I>quark_type_return</I></B><DD> 
  79. Returns the representation type of the destination (as a quark). 
  80. <P><DT><B><I>str_class</I></B><DD> 
  81. Specifies the fully qualified class of the value being retrieved (as a string). 
  82. <P><DT><B><I>str_name</I></B><DD> 
  83. Specifies the fully qualified name of the value being retrieved (as a string). 
  84. <P><DT><B><I>str_type_return</I></B><DD> 
  85. Returns the representation type of the destination (as a string). 
  86. <P><DT><B><I>type_return</I></B><DD> 
  87. Returns data representation type. 
  88. <P><DT><B><I>value_return</I></B><DD> 
  89. Returns the value in the database. 
  90. </DL> 
  91. <H2>Description</H2> 
  92. The <B>XrmGetResource</B> and <B>XrmQGetResource</B> 
  93. functions retrieve a resource from the specified database. 
  94. Both take a fully qualified <B><I>name</I></B>/<B><I>class</I></B> pair, 
  95. a destination resource representation, and the address of a value 
  96. (size/address pair). 
  97. The value and returned type point into database memory; 
  98. therefore, you must not modify the data. 
  99. <P> 
  100. The database only frees or overwrites entries on 
  101. <B>XrmPutResource</B>, <B>XrmQPutResource</B>, or 
  102. <B>XrmMergeDatabases</B>. 
  103. A client that is not storing new values into the database or 
  104. is not merging the database should be safe using the address 
  105. passed back at any time until it exits. 
  106. If a resource was found, both <B>XrmGetResource</B> and 
  107. <B>XrmQGetResource</B> return <B>True</B>; 
  108. otherwise, they return <B>False</B>. 
  109. <P> 
  110. The <B>XrmQGetSearchList</B> function takes a list of names and 
  111. classes and returns a list of database levels where a match might occur. 
  112. The returned list is in best-to-worst order and uses the same 
  113. algorithm as <B>XrmGetResource</B> for determining precedence. 
  114. If <B><I>list_return</I></B> was large enough for the search list, 
  115. <B>XrmQGetSearchList</B> returns <B>True</B>; 
  116. otherwise, it returns <B>False</B>. 
  117. <P> 
  118. The size of the search list that the caller must allocate is 
  119. dependent upon the number of levels and wildcards in the 
  120. resource specifiers that are stored in the database. 
  121. The worst case length is 
  122. 3^<B><I>n</I></B>, 
  123. where <B><I>n</I></B> is the number of name or 
  124. class components in names or classes. 
  125. <P> 
  126. When using <B>XrmQGetSearchList</B> followed by multiple 
  127. probes for resources with a common name and class prefix, 
  128. only the common prefix should be specified in the name 
  129. and class list to <B>XrmQGetSearchList</B>. 
  130. <P> 
  131. The <B>XrmQGetSearchResource</B> function searches 
  132. the specified database levels for the resource 
  133. that is fully identified by the specified name and class. 
  134. The search stops with the first match. 
  135. <B>XrmQGetSearchResource</B> returns <B>True</B> 
  136. if the resource was found; 
  137. otherwise, it returns <B>False</B>. 
  138. <P> 
  139. A call to <B>XrmQGetSearchList</B> with a name 
  140. and class list containing all but the last component 
  141. of a resource name followed by a call to 
  142. <B>XrmQGetSearchResource</B> with the last component 
  143. name and class returns the same database entry as 
  144. <B>XrmGetResource</B> and <B>XrmQGetResource</B> 
  145. with the fully qualified name and class. 
  146. <H3>Matching rules</H3> 
  147. The algorithm for determining which resource database entry 
  148. matches a given query is the heart of the resource manager. 
  149. All queries must fully specify the name and class of the desired 
  150. resource (use of the characters ``*'' and ``?'' are not permitted). 
  151. The library supports up to 100 components in a full name or class. 
  152. Resources are stored in the database with only partially specified 
  153. names and classes, using pattern matching constructs. 
  154. An asterisk (*) is a loose binding and is used to represent 
  155. any number of intervening components, including none. 
  156. A period (.) is a tight binding and is used to separate 
  157. immediately adjacent components. 
  158. A question mark (?) is used to match any single component name or class. 
  159. A database entry cannot end in a loose binding; 
  160. the final component (which cannot be the character ``?'') must be specified. 
  161. The lookup algorithm searches the database for the entry that most 
  162. closely matches (is most specific for) the full name and class being queried. 
  163. When more than one database entry matches the full name and class, 
  164. precedence rules are used to select just one. 
  165. <P> 
  166. The full name and class are scanned from left to right (from highest 
  167. level in the hierarchy to lowest), one component at a time. 
  168. At each level, the corresponding component and/or binding of each 
  169. matching entry is determined, and these matching components and 
  170. bindings are compared according to precedence rules. 
  171. Each of the rules is applied at each level before moving to the next level, 
  172. until a rule selects a single entry over all others. 
  173. The rules, in order of precedence, are: 
  174. <OL> 
  175. <P><LI> 
  176. An entry that contains a matching component 
  177. (whether <B><I>name</I></B>, <B><I>class</I></B>, or the character ``?'') 
  178. takes precedence over entries that elide the level (that is, entries 
  179. that match the level in a loose binding). 
  180. <P><LI> 
  181. An entry with a matching name takes precedence over both entries 
  182. with a matching class and entries that match using the character ``?''. 
  183. An entry with a matching class takes precedence over 
  184. entries that match using the character ``?''. 
  185. <P><LI> 
  186. An entry preceded by a tight binding takes precedence over 
  187. entries preceded by a loose binding. 
  188. </OL> 
  189. <H2>References</H2> 
  190. <A HREF=/cgi-bin/man/man?XrmInitialize+X3xlib><B>XrmInitialize</B>(X3xlib)</A>, 
  191. <A HREF=/cgi-bin/man/man?XrmMergeDatabases+X3xlib><B>XrmMergeDatabases</B>(X3xlib)</A>, 
  192. <A HREF=/cgi-bin/man/man?XrmPutResource+X3xlib><B>XrmPutResource</B>(X3xlib)</A>, 
  193. <A HREF=/cgi-bin/man/man?XrmUniqueQuark+X3xlib><B>XrmUniqueQuark</B>(X3xlib)</A> 
  194. <BR> 
  195. <BR> 
  196. <I>Xlib - C Language X Interface</I> 
  197. <P> 
  198. <!-- NAVBEGIN --> 
  199. <HR> 
  200. <I> 
  201. <SMALL> 
  202. 30 January 1998 
  203. <BR> 
  204. <A HREF=/man/html.X3xlib/COPYRIGHT.html>© 1998 The Santa Cruz Operation, Inc.  All rights reserved.</A> 
  205. <BR> 
  206. </SMALL> 
  207. </I> 
  208. <!-- NAVEND --> 
  209. </BODY></HTML>
  210.