13.5 Resource Database Files

X users and application programs can save resource bindings in a file, using a standard file format shared by all X clients. The following paragraphs describe the CLX functions used to convert between the standard external format of resource files and the internal resource-database format used by application programs.



read-resources database pathname &key :key :test :test-not Function
        
database
The resource-database to merge.
pathname
A pathname for the resource file to read.
:key
A function used to convert a value from the resource file into a resource binding value.
:test, :test-not
Functions used to select which resource bindings from the resource file are merged with the database.

Reads resource bindings from a resource file in standard X11 format and merges them with the given resource database. The :key function is called to convert a file resource value into the value stored in the database. By default, :key is #'identity. The :test and :test-not functions are predicates that select resource bindings to merge, based on the result of the :key function. For each file resource binding consisting of a resource-name and a resource-value, the :test (or :test-not) function is called with the arguments resource-name and (funcall key resource-value).

database
Type resource-database.


write-resources database pathname &key :write :test :test-not Function
        
database
The resource-database to write.
pathname
A pathname of the file to write.
:write
A function for writing resource values.
:test, :test-not
Functions used to select which resource bindings from the resource file are merged with the database.

Writes resource bindings found in the database to the file given by the pathname. The output file is written in the standard X11 format. The :write function is used for writing resource values; the default is #'princ. The :write function is passed two arguments: a resource-value and a stream. The :test and :test-not functions are predicates which select resource bindings to write. For each resource binding consisting of a resource-name and a resource-value, the :test (or :test-not) function is called with the arguments resource-name and resource-value.