RESOURCE SPECIFICATIONS

A resource specification has the following format:

    <ResourceSpec>	::= <WhiteSp> <ResourceName> <WhiteSp> ":" <Value>

    <ResourceName>	::= (<Binding>)? (<Component> <Binding>)* <ComponentName>

    <Binding>		::= "." | "*"

    <Component>		::= "?" | <ComponentName>

    <ComponentName>	::= <NameChar> (<NameChar>)*

    <NameChar>		::= "a" ... "z" | "A" ... "Z" | "0" ... "9" | "_" | "-"

    <Value>		::= (any character other than null or an unescaped newline)*

Note that the last component in a resource name is the name of the attribute.


STYLES

A style is a database of resource specifications.


STYLE VIEWS

A style view defines a search key for a style database.  A search key consists
of a "name" and a list of aliases.  Both the name and aliases are called
``style names,'' and have the following string format:

    <StyleName>		::= <ComponentName> ("." <ComponentName>)*


MATCHING RULES

When using a style view to search for an attribute in a style database, we first
search using the name, and then each alias in order until a match is found.
We use the following algorithm (taken from X11R5) to determine if a style name
matches an entry in the style database:

The name is scanned from left to right one component at a time.  For each
component, the matching components/bindings in the style are determined,
and these are compared according to the following precedence rules:

    1)	An entry that contains a matching component (component name or "?")
	takes precedence over entries that elide the component (i.e., with
	a loose binding).

    2)	An entry with a matching name takes precedence over "?".

    3)  An entry preceeded by a tight binding takes precedence over an
	entry preceeded by a loose binding.


THINGS TO THINK ABOUT

In the current plan, a style is assumed to be a mutable data structure which
is maintained by a thread.  Searching for attributes, or adding new attributes
is done by comunicating with the style server.  In addition, attributes (at
least mutable ones) must be represented as active objects, since they are
responsible for broadcasting changes to their state to any listeners.

A style could be represented as a functional search structure, with the attributes
being active objects (i.e., threads).  This means that adding attributes to
a style creates a new style; on the other hand, it reduces the synchronization
required during lookup, which could be important.

