home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
InfoMagic Source Code 1993 July
/
THE_SOURCE_CODE_CD_ROM.iso
/
X
/
mit
/
doc
/
CLX
/
s13.doc
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
Interleaf document
|
1989-10-18
|
37.8 KB
|
1,326 lines
<!OPS, Version = 5.2>
<!Document,
Print Rev Bars = no,
Final Output Device = "ps",
Default Printer = "nearest-adps">
<!Font Definitions,
F2 = Times 10 Italic,
F3 = Times 10,
F4 = Times 10 Bold,
F5 = Times 8 Italic,
F6 = Times 18 Bold,
F7 = Times 18,
F8 = Times 12 Bold,
F9 = Courier 8,
F10 = Symbol_B 8>
<!Page,
Bottom Margin = 1 inches,
Left Margin = 1 inches,
Right Margin = 1.15 inches,
First Page = Right,
Starting Page # = Inherit,
Page # Prefix = "13<#1e>",
Hyphenation = on,
Consecutive Hyphens = 2,
Vert. Just. = off>
<!Autonumber Stream, List, 2,
Level 2 Suffix = ,
Level 2 Starting Value = 0,
Level 2 Show = no>
<!Autonumber Stream, Outline, 3,
Level 1 Symbol Type = UPPER ROMAN,
Level 2 Symbol Type = UPPER ALPHA>
<!Autonumber Stream, figure, 2,
Level 1 Prefix = "Figure ",
Level 1 Suffix = "<#1e>",
Level 1 Show = no,
Level 2 Suffix = ,
Level 2 Starting Value = 0,
Level 2 Show = no>
<!Autonumber Stream, figurelet, 2,
Level 1 Symbol Type = UPPER ALPHA,
Level 1 Prefix = "Figure ",
Level 1 Suffix = "<#1e>",
Level 1 Show = no,
Level 2 Suffix = "<#04>">
<!Autonumber Stream, invisible, 1,
Level 1 Suffix = ,
Level 1 Show = no>
<!Autonumber Stream, item, 2,
Level 2 Symbol Type = LOWER ALPHA,
Level 2 Trail = yes>
<!Autonumber Stream, paralet, 4,
Level 1 Symbol Type = UPPER ALPHA,
Level 1 Suffix = ,
Level 1 Show = no,
Level 2 Prefix = .,
Level 2 Suffix = ,
Level 3 Prefix = .,
Level 3 Suffix = ,
Level 4 Prefix = .,
Level 4 Suffix = >
<!Autonumber Stream, paranum, 4,
Level 1 Suffix = ,
Level 1 Show = no,
Level 2 Prefix = .,
Level 2 Suffix = ,
Level 3 Prefix = .,
Level 3 Suffix = ,
Level 4 Prefix = .,
Level 4 Suffix = >
<!Autonumber Stream, table, 2,
Level 1 Prefix = "Table ",
Level 1 Suffix = "<#1e>",
Level 1 Show = no,
Level 2 Suffix = >
<!Autonumber Stream, tablelet, 2,
Level 1 Symbol Type = UPPER ALPHA,
Level 1 Prefix = "Table ",
Level 1 Suffix = "<#1e>",
Level 1 Show = no,
Level 2 Suffix = "<#04>">
<!Class, arg,
Bottom Margin = 0.08 inches,
Left Margin = 1.85 inches,
First Indent = -0.25 inches,
Line Spacing = 1.121 lines,
Font = F2,
Left Tab = -0.25/0 inches>
<!Class, argtable,
Top Margin = 0.07 inches,
Bottom Margin = 0.07 inches,
Left Margin = 1.60 inches,
Line Spacing = 1.100 lines,
Font = F4,
Autonumber Name = table>
<!Class, bullet,
Bottom Margin = 0.153 inches,
Left Margin = 1.85 inches,
First Indent = -0.25 inches,
Line Spacing = 1.121 lines,
Font = F3,
Allow Page Break Within = no,
Left Tab = -0.50/0 inches>
<!Class, caption,
Top Margin = 0.07 inches,
Bottom Margin = 0.07 inches,
Line Spacing = 1.100 lines,
Font = F5>
<!Class, fig,
Top Margin = 0.07 inches,
Bottom Margin = 0.07 inches,
Line Spacing = 1.100 lines,
Alignment = Left,
Font = F6>
<!Class, newpage,
Bottom Margin = 0 inches,
Line Spacing = 1 lines,
Alignment = Left,
Font = F7,
Hyphenation = off,
New Page = yes,
Left Tab = >
<!Class, "note",
Top Margin = 0.177 inches,
Bottom Margin = 0.334 inches,
Left Margin = 1.60 inches,
Line Spacing = 1.121 lines,
Font = F3,
Allow Page Break Within = no,
Left Tab = 0 inches,
Right Tab = 6.50 inches>
<!Class, p1para,
Bottom Margin = 0.153 inches,
Left Margin = 1.60 inches,
First Indent = -1.60 inches,
Line Spacing = 1.121 lines,
Alignment = Left,
Font = F8,
Allow Page Break Within = no,
Allow Page Break After = no,
Left Tab = -1.70/0 inches>
<!Class, p1rule,
Bottom Margin = 0 inches,
Line Spacing = 1 lines,
Font = F3,
Hyphenation = off,
Allow Page Break After = no,
Left Tab = 0/0.75*13 inches>
<!Class, p1stacked,
Bottom Margin = 0 inches,
Left Margin = 1.60 inches,
First Indent = -1.60 inches,
Line Spacing = 1 lines,
Font = F4,
Allow Page Break Within = no,
Allow Page Break After = no,
Left Tab = -1.60/-0.17/0 inches>
<!Class, p2para,
Bottom Margin = 0.153 inches,
Left Margin = 1.60 inches,
First Indent = -1.60 inches,
Line Spacing = 1.121 lines,
Alignment = Left,
Font = F4,
Allow Page Break Within = no,
Allow Page Break After = no,
Left Tab = 0 inches,
Right Tab = -1.60/-0.17 inches,
TOC Doc Name = TOC>
<!Class, p2rule,
Bottom Margin = 0 inches,
Left Margin = 1.60 inches,
Line Spacing = 1 lines,
Alignment = Left,
Font = F3,
Hyphenation = off,
Allow Page Break After = no,
Left Tab = 0/0.75*13 inches>
<!Class, p2stacked,
Bottom Margin = 0 inches,
Left Margin = 1.60 inches,
First Indent = -1.60 inches,
Line Spacing = 1.121 lines,
Font = F4,
Allow Page Break Within = no,
Allow Page Break After = no,
Left Tab = 0 inches,
Right Tab = -1.60/-0.17 inches>
<!Class, para,
Bottom Margin = 0.153 inches,
Left Margin = 1.60 inches,
Line Spacing = 1.121 lines,
Font = F3,
Allow Page Break Within = no,
Left Tab = 0/0.75*13 inches>
<!Class, return,
Bottom Margin = 0.077 inches,
Left Margin = 1.60 inches,
First Indent = -0.90 inches,
Line Spacing = 1.121 lines,
Alignment = Left,
Font = F4,
Hyphenation = off,
Allow Page Break Within = no,
Allow Page Break After = no,
Left Tab = -0.90/0 inches,
Right Tab = 7.50 inches>
<!Class, secno,
Top Margin = 0.07 inches,
Bottom Margin = 0.07 inches,
Line Spacing = 1.100 lines,
Alignment = Left,
Font = F6,
Autonumber Name = paranum>
<!Class, secrule,
Bottom Margin = 0 inches,
Line Spacing = 1 lines,
Font = F3,
Hyphenation = off,
Allow Page Break After = no,
Left Tab = 0/0.75*13 inches,
Autonumber Name = table>
<!Class, sectitle,
Bottom Margin = 0 inches,
Line Spacing = 1 lines,
Alignment = Right,
Font = F6,
Hyphenation = off,
New Page = yes,
Left Tab = 0/0.75*13 inches>
<!Class, syntax,
Bottom Margin = 0.077 inches,
Left Margin = 1.60 inches,
First Indent = -0.90 inches,
Line Spacing = 1.121 lines,
Alignment = Left,
Font = F4,
Hyphenation = off,
Allow Page Break Within = no,
Allow Page Break After = no,
Left Tab = -0.90/0 inches,
Right Tab = 8 inches>
<!Class, syntax0,
Bottom Margin = 0 inches,
Left Margin = 1.60 inches,
First Indent = -0.90 inches,
Line Spacing = 1.121 lines,
Alignment = Left,
Font = F4,
Hyphenation = off,
Allow Page Break Within = no,
Allow Page Break After = no,
Left Tab = -0.90/0 inches,
Right Tab = 8 inches>
<!Class, t3,
Bottom Margin = 0 inches,
Left Margin = 4.20 inches,
First Indent = -2.60 inches,
Line Spacing = 1.121 lines,
Alignment = Left,
Font = F3,
Left Tab = 0 inches>
<!Class, t3head,
Bottom Margin = 0.15 inches,
Left Margin = 4.20 inches,
First Indent = -2.60 inches,
Line Spacing = 1.121 lines,
Alignment = Left,
Font = F3,
Left Tab = 0 inches>
<!Class, "table",
Top Margin = 0.07 inches,
Bottom Margin = 0.07 inches,
Line Spacing = 1.100 lines,
Font = F4,
Autonumber Name = table>
<!Class, title,
Top Margin = 0.07 inches,
Bottom Margin = 0.07 inches,
Line Spacing = 1.100 lines,
Alignment = Right,
Font = F6,
TOC Doc Name = TOC>
<!Master Frame,
Name = "At Anchor",
Placement = At Anchor,
Width = 0.41 inches,
Height = 0.137 inches,
Vertical Alignment = 0.03 inches,
Diagram =
V4,
(g9,32767,0
(E10,0,0,0,1,1,0.053333,1,15,0,0,1,0,0,0,1,0,1,1,0.066667,0.066667,6,6,0,0.066
667,6))>
<!Master Frame,
Name = p1rule,
Placement = At Anchor,
Width = 6.35 inches,
Height = 0.153 inches,
Vertical Alignment = 0.007 inches,
Shared Contents = yes,
Diagram =
V4,
(g9,1,0
(v4,1,0,0.006667,0.066723,6.326667,0.066611,17,2,0)
(E10,0,0,0,1,1,0.053333,1,15,0,0,1,0,0,0,0,0,1,1,0.066667,0.066667,6,6,0,0.066
667,6))>
<!Master Frame,
Name = p2rule,
Placement = At Anchor,
Width = 4.75 inches,
Height = 0.15 inches,
Vertical Alignment = 0.007 inches,
Shared Contents = yes,
Diagram =
V4,
(g9,1,0
(v4,1,0,4.733333,0.066611,0.006667,0.066723,17,2,0)
(E10,0,0,0,1,1,0.053333,1,15,0,0,1,0,0,0,0,0,1,1,0.066667,0.066667,6,6,0,0.066
667,6))>
<First Page Header, Frame =
V4,
(g9,0,0
(E10,0,0,0,1,1,0.053333,1,15,0,0,1,0,0,0,1,1,1,1,0.066667,0.066667,6,6,0,0.066
667,6))>
<Right Page Header, Frame =
V4,
(g9,1,0
(T8,1,12,4.533333,0.306667,1.8,1,0.333333,0,516,0,17,0,0,0,0,0,0,1,1,2048,512,
102,1101,2,
<caption,
Alignment = Right>
Resources
<End Text>)
(E10,0,0,0,1,0,0.053333,1,15,0,0,1,0,0,0,0,1,0,1,0.066667,0.066667,6,6,0,0.066
667,6))>
<Left Page Header, Frame =
V4,
(g9,1,0
(T8,1,12,0,0.293333,2.4,1,0.333333,0,516,0,17,0,0,0,0,0,0,1,1,2048,512,102,110
1,2,
<caption>
Resources
<End Text>)
(E10,0,0,0,1,1,0.053333,1,15,0,0,1,0,0,0,0,1,1,1,0.066667,0.066667,6,6,0,0.066
667,6))>
<Right Page Footer, Frame =
V4,
(g9,1,0
(t8,1,4,6.333333,0.266667,2,17,@nntimsps10b,\240)
(t8,2,4,0.006667,0.266667,0,17,@nntimsps8i,CLX\ Programmer's\ Reference)
(v4,3,0,0,0.066667,6.333333,0.066554,17,2,0)
(E10,0,0,0,1,1,0.053333,1,15,0,0,1,0,0,0,0,1,1,1,0.066667,0.066667,6,6,0,0.066
667,6))>
<Left Page Footer, Frame =
V4,
(g9,1,0
(t8,1,4,0,0.266667,0,17,@nntimsps10b,\240)
(t8,2,4,6.333333,0.266667,2,17,@nntimsps8i,CLX\ Programmer's\ Reference)
(v4,3,0,0.026667,0.066667,6.333333,0.066554,17,2,0)
(E10,0,0,0,1,0,0.053333,1,15,0,0,1,0,0,0,0,1,0,1,0.066667,0.066667,6,6,0,0.066
667,6))>
<sectitle,
Allow Page Break Within = no,
Allow Page Break After = no>
<|,"13<#1e>161">
<Frame,
Name = "At Anchor",
Placement = At Anchor,
Width = 4.72 inches,
Height = 0.94 inches,
Vertical Alignment = 0.03 inches,
Diagram =
V4,
(g9,1,0
(T8,1,12,0.133333,0.72,4.563333,1,0.333333,0,516,0,17,0,0,0,0,0,0,1,1,2048,512
,102,1101,3,
<title>
RESOURCES
<End Text>)
(E10,0,0,0,1,0,0.053333,1,15,0,0,1,0,0,0,0,1,0,1,0.066667,0.066667,6,6,0,0.066
667,6))>
<Frame,
Name = "At Anchor",
Placement = At Anchor,
Width = 1.626 inches,
Height = 0.938 inches,
Vertical Alignment = 0 inches,
Diagram =
V4,
(g9,1,0
(T8,1,12,0.066667,0.276667,0,1,0.333333,0,516,0,17,0,0,0,0,0,0,1,1,2048,512,10
2,1101,3,
<secno,
TOC Doc Name = TOC>
<Autonum, paranum, 1, First = Yes>
<End Text>)
(T8,2,12,0.026667,0.733333,0,1,0.333333,0,516,0,17,0,0,0,0,0,0,1,1,2048,512,10
2,1101,3,
<"table">
<Autonum, table, 1, First = Yes>
<End Text>)
(T8,3,12,0.066667,0.6,0,1,0.333333,0,516,0,17,0,0,0,0,0,0,1,1,2048,512,102,110
1,3,
<fig,
Alignment = Both,
Font = F4,
Autonumber Name = figure>
<Autonum, figure, 1, First = Yes>
<End Text>)
(g9,5,0
(p7,5,8,19
(g9,5,0
(g9,5,0
(v4,5,0,0.266667,0,1.6,0,17,1,0)
(v4,6,0,1.6,0,1.6,0.933333,17,1,0)
(v4,7,0,1.6,0.933333,0.266667,0.933333,17,1,0)
(v4,8,0,0.266667,0.933333,0.266667,0,17,1,0))))
(g9,10,8
(p7,10,1032,13
(g9,10,0
(g9,10,0
(v4,10,0,1.397369,0.934816,1.505789,0.822225,17,1,0)
(v4,11,0,1.505789,0.822225,1.505789,0.615804,17,1,0)
(v4,12,0,1.505789,0.615804,1.415439,0.521977,17,1,0)
(v4,13,0,1.415439,0.521977,1.505789,0.428149,17,1,0)
(v4,14,0,1.505789,0.428149,1.505789,0.259259,17,1,0)
(v4,15,0,1.505789,0.259259,1.397369,0.14667,17,1,0)
(v4,16,0,1.397369,0.14667,1.144386,0.14667,17,1,0)
(v4,17,0,1.144386,0.14667,1.035964,0.259259,17,1,0)
(v4,18,0,1.035964,0.259259,1.035964,0.371851,17,1,0)
(v4,19,0,1.035964,0.371851,1.198596,0.371851,17,1,0)
(v4,20,0,1.198596,0.371851,1.198596,0.296792,17,1,0)
(v4,21,0,1.198596,0.296792,1.343158,0.296792,17,1,0)
(v4,22,0,1.343158,0.296792,1.343158,0.446915,17,1,0)
(v4,23,0,1.343158,0.446915,1.216667,0.446915,17,1,0)
(v4,24,0,1.216667,0.446915,1.216667,0.597039,17,1,0)
(v4,25,0,1.216667,0.597039,1.343158,0.597039,17,1,0)
(v4,26,0,1.343158,0.597039,1.343158,0.784694,17,1,0)
(v4,27,0,1.343158,0.784694,1.198596,0.784694,17,1,0)
(v4,28,0,1.198596,0.784694,1.198596,0.709631,17,1,0)
(v4,29,0,1.198596,0.709631,1.035964,0.709631,17,1,0)
(v4,30,0,1.035964,0.709631,1.035964,0.822225,17,1,0)
(v4,31,0,1.035964,0.822225,1.144386,0.934816,17,1,0)
(v4,32,0,1.144386,0.934816,1.397369,0.934816,17,1,0))))
(g9,33,2048
(v4,33,33,0.999823,0.14667,0.999823,0.14667,17,0,0)
(v4,34,33,0.999823,1.16,0.999823,1.16,17,0,0)
(v4,35,33,1.56,1.16,1.56,1.16,17,0,0)
(v4,36,33,1.56,0.14667,1.56,0.14667,17,0,0)))
(g9,38,8
(p7,38,1032,13
(g9,38,0
(g9,38,0
(v4,38,0,0.941053,0.934816,0.941053,0.14667,17,1,0)
(v4,39,0,0.941053,0.14667,0.796491,0.14667,17,1,0)
(v4,40,0,0.796491,0.14667,0.65193,0.296792,17,1,0)
(v4,41,0,0.65193,0.296792,0.65193,0.371851,17,1,0)
(v4,42,0,0.65193,0.371851,0.778421,0.371851,17,1,0)
(v4,43,0,0.778421,0.371851,0.778421,0.934816,17,1,0)
(v4,44,0,0.778421,0.934816,0.941053,0.934816,17,1,0))))
(g9,45,2048
(v4,45,33,0.633859,0.14667,0.633859,0.14667,17,0,0)
(v4,46,33,0.633859,1.16,0.633859,1.16,17,0,0)
(v4,47,33,1.013333,1.16,1.013333,1.16,17,0,0)
(v4,48,33,1.013333,0.14667,1.013333,0.14667,17,0,0))))
(E10,0,0,0,1,1,0.053333,1,15,0,0,1,0,0,0,0,1,1,1,0.066667,0.066667,6,6,0,0.066
667,6))>
<secrule,
Allow Page Break Within = no,
Allow Page Break After = yes,
Autonumber Name = >
<Index, "resource", "database"><Index, "resource", To Named = sectitle>
<Frame,
Name = "At Anchor",
Placement = At Anchor,
Width = 6.35 inches,
Height = 0.153 inches,
Vertical Alignment = 0.007 inches,
Diagram =
V4,
(g9,1,0
(v4,1,0,0.006667,0.066723,6.333333,0.066611,17,2,0)
(E10,0,0,0,1,1,0.053333,1,15,0,0,1,0,0,0,0,0,1,1,0.066667,0.066667,6,6,0,0.066
667,6))>
<p1para,
Alignment = Both,
Font = F3,
Allow Page Break After = yes>
<F8>Introduction<Tab><F4>13.1<F0><#04>Users need a way to specify
preferences for various user interface values<SP>(for example, colors,
fonts, title strings, and so forth). Applications need a<SP>consistent
method for determining the default interface values that are specific<SP>to
them. It is also useful if application interface values can be modified
by users without changes to the program code. For example, this capability
can make<SP>it easy to change the color scheme of a user interface.
In CLX, such interface<SP>values are referred to as <F2>resources<F0>.
CLX defines functions for storing and<SP>retrieving interface resources
from a resource database. A user can store<SP>various user interface
values as resources in a resource database; a CLX<SP>application can
then read these resource values and modify its user interface<SP>accordingly.
<"note",
Top Margin = 0.15 inches,
Bottom Margin = 0.23 inches>
<Tab-><HR>
<Index, "server", "resource"><F4><Index, "resource", "server">NOTE: <F0>The general
term <F2>resource<F0> refers to any application user interface value<SP>store
d in a resource database. The term <F2>server resource<F0> is used
more<SP>specifically to refer to the types of objects allocated by
an X server and<SP>referenced by clients (for example, windows, fonts,
graphics contexts, and so forth).<HR>
<Tab->
<p1rule>
<Index, "resource", "name"><Index, "resource", "binding", To Named = p1rule>
<Frame,
Name = p1rule,
Placement = At Anchor,
Width = 6.35 inches,
Height = 0.153 inches,
Vertical Alignment = 0.007 inches,
Shared Contents = yes>
<p1stacked,
Font = F3,
Left Tab = -1.70/0 inches>
<F8>Resource <Tab><F4>13.2<F0><#04>Conceptually, a resource database
is a set of resource name<#1e>value<F4><FJ>
<p1para,
Alignment = Both,
Font = F3,
Allow Page Break After = yes>
<F8>Bindings<Tab><F0>pairs (or<SP><F2>resource bindings<F0>).
The name in a resource binding is a list that is <Index, "attribute name"><Index, "path list">
the<SP>concatenation of a <F2>path list<F0> and an <F2>attribute
name<F0>.
<para>
A path list is a list of symbols (or strings) that corresponds to
a path<SP>through a tree<#1e>structured hierarchy. For example, the
path:
<F9>'(top middle bottom)<F0><SP>
corresponds to a three<#1e>level hierarchy in which <F9>middle<F0>
is the child of <F9>top<F0>, and<SP><F9>bottom<F0> is the child
of <F9>middle<F0>.
Typically, the path of a resource name<SP>corresponds to a path in
a hierarchy of windows, and each symbol/string names a<SP>window in
the hierarchy. However, the first element of the path can also<SP>represent
the overall name of the entire program, and subsequent path elements<SP>can
refer to an application<#1e>specific hierarchy of resource names not
strictly<SP>related to windows. In addition, a resource name can contain
a<SP>partially<#1e>specified path list. The asterisk symbol (*) is
a wildcard that can correspond<SP>to any sequence of levels in the
hierarchy (including the null sequence). For<SP>example, the path:
<F9>'(top * bottom)<F0>
corresponds to a hierarchy of two or more<SP>levels in which <F9>top<F0>
is at the top level and <F9>bottom<F0> is at the bottom level. An<SP>element
of a path list can be the name of an individual window or the name
of a<SP>class of windows.
<para,
Bottom Margin = 0.13 inches>
<|,"13<#1e>162">The final element of a resource name list is an attribute name.
This<SP>symbol (or string) identifies a specific attribute of the
object(s) named<SP>by the preceding path list. The attribute name
can also be the symbol * or<SP>the string <#7f>*", in which case the
resource name refers to all attributes of<SP>the path object(s). However,
this form of resource name is rarely useful.
Some examples of resource bindings are shown below. In these examples,
assume that <F9>mail<F0> is the resource name of a mail reading
application. <F9>mail<F0> uses<SP>a window of the class <F9>button<F0>
whose name is <F9>reply<F0>.<Index, "resource", "binding", "examples">
<t3head>
<F4>Resource Name<Tab>Resource Value
<t3>
<F9>(mail screen<#1e>1 reply background)<Tab>'green
<F9>(mail * background)<Tab>'red
<F9>(* button background)<Tab>'blue <HR>
<para>
These resource bindings specify the following:
<bullet>
<F10>w<Tab><F0>The <F9>background<F0> attribute resource of <F9>mail<F2>
<F0>application<F2>'<F0>s<SP><F9>reply<F0> button has the value
of <F9>green<F0> on <F9>screen<#1e>1<F0>.
<F10>w<Tab><F0>The <F9>background<F0> attribute for<SP>the rest
of the <F9>mail<F0> application is always <F9>red<F0> on all screens.
<F10>w<Tab><F0>In<SP>general, the <F9>background<F0> attribute
for all <F9>button<F0> windows is <F9>blue<F0>.
<p1rule>
<Index, "resource", "database", To Named = p1rule>
<Frame,
Name = p1rule,
Placement = At Anchor,
Width = 6.35 inches,
Height = 0.153 inches,
Vertical Alignment = 0.007 inches,
Shared Contents = yes>
<p1stacked,
Font = F3,
Left Tab = -1.70/0 inches>
<F8>Basic Resource<Tab><F4>13.3<F0><#04>A <F4>resource<#1e>database<F0>
structure is a CLX object that represents a set<FJ>
<p1stacked,
Left Tab = -1.60/0 inches>
<F8>Database<F0><Tab><F3>of resource<SP>bindings. The following
paragraphs describe the CLX functions<FJ>
<p1para,
Bottom Margin = 0.13 inches,
Alignment = Both,
Font = F3,
Allow Page Break After = yes>
<F8>Functions<Tab><F0>used to:<F8>
<bullet,
Bottom Margin = 0.13 inches>
<F10>w<Tab><F0>Create a resource database
<F10>w<Tab><F0>Add a resource binding
<F10>w<Tab><F0>Remove a resource binding
<F10>w<Tab><F0>Merge two resource databases
<bullet>
<F10>w<Tab><F0>Map a function over the contents of a resource database
<syntax0>
make<#1e>resource<#1e>database<F3><Tab>Function<Index, Doc = operations, "xlib:make<#1e>resource<#1e>database", Sort String = "make<#1e>resource<#1e>database">
<return>
<Tab><F3>Returns:<HR>
<F2>resource<#1e>database<F3> <#1f> Type <F0>resource<#1e>database<F3>.
<para>
Returns an empty resource database.
<syntax>
add<#1e>resource<F3> <F2>database name<#1e>list value<F3><Tab>Function<Index, Doc = operations, "xlib:add<#1e>resource", Sort String = "add<#1e>resource">
<para>
Adds the resource binding specified by <F2>name<#1e>list<F0> and <F2>value
<F0> to the given<SP><F2>database<F0>. Only one value can be associated
with the <F2>name<#1e>list<F0> in the<SP><F2>database<F0>. This
function replaces any value previously associated with the<SP><F2>name<#1e>lis
t<F0>.
<arg>
database<F3> <#1f> The <F4>resource<#1e>database<F3> for the new
resource binding.
name<#1e>list<F3> <#1f> A list containing strings or symbols specifying
the name for the<SP>resource binding.
value<F3> <#1f> The value associated with the <F0>name<#1e>list<F3>
in the resource binding. This can be<SP>an object of any type.
<syntax>
<|,"13<#1e>163">delete<#1e>resource<F3> <F2>database name<#1e>list<F3><Tab>Function<Index, Doc = operations, "xlib:delete<#1e>resource", Sort String = "delete<#1e>resource">
<para>
Removes the resource binding specified by <F2>name<#1e>list<F0>
from the given <F2>database<F0>.
<arg>
database<F3> <#1f> The <F4>resource<#1e>database<F3> containing
the resource binding.
name<#1e>list<F3> <#1f> A list containing strings or symbols specifying
the name for the<SP>deleted resource binding.
<syntax>
map<#1e>resource<F3> <F2>database function<F3> &rest <F2>args<Tab><F3>Func
tion<Index, Doc = operations, "xlib:map<#1e>resource", Sort String = "map<#1e>resource">
<para>
Calls the function for each resource binding in the <F2>database<F0>.
For each<SP>resource binding consisting of a <F2>name<#1e>list<F0>
and a <F2>value<F0>, the form<FJ>
(<F4>apply<F0> <F2>function name<#1e>list value args<F0>) is executed.<SP>
<arg>
database<F3> <#1f> A <F4>resource<#1e>database<F3>.
function<F3> <#1f> A <F4>function<F3> object or function symbol.
args<F3> <#1f> A list of arguments to the <F0>function<F3>.
<syntax0>
merge<#1e>resources<F3> <F2>from<#1e>database to<#1e>database<F3><Tab>Functi
on<Index, Doc = operations, "xlib:merge<#1e>resources", Sort String = "merge<#1e>resources">
<return>
<Tab><F3>Returns:<HR>
<F2>to<#1e>database<F3> <#1f>Type <F0>resource<#1e>database<F3>.
<para>
Merges the contents of the <F2>from<#1e>database<F0> with the <F2>to<#1e>dat
abase<F0>. <F4>map<#1e>resource<F0><SP>invokes <F4>add<#1e>resource<F0>
in order to add each resource binding in the<SP><F2>from<#1e>database<F0>
to the <F2>to<#1e>database<F0>. The updated <F2>to<#1e>database<F0>
is returned.
<arg>
from<#1e>database<F3> <#1f> The <F4>resource<#1e>database<F3> from
which resource bindings are read.
to<#1e>database<F3> <#1f> The <F4>resource<#1e>database<F3> to
which resource bindings are added.
<p1rule>
<Index, "resource", "accessing", To Named = p1rule>
<Frame,
Name = p1rule,
Placement = At Anchor,
Width = 6.35 inches,
Height = 0.153 inches,
Vertical Alignment = 0.007 inches,
Shared Contents = yes>
<p1stacked,
Font = F3,
Left Tab = -1.70/0 inches>
<F8>Accessing<Tab><F4>13.4<F0><#04>The power and flexibility of
resource management is the result of the<F4><FJ>
<p1stacked,
Left Tab = -1.60/0 inches>
<F8>Resource <F0><Tab><F3>way<SP>resource values in a resource
database are accessed. A resource binding
<p1para,
Alignment = Both,
Font = F3,
Allow Page Break After = yes>
<F8>Values<Tab><F0>binding stored<SP>in the database generally contains
only a partial resource name consisting of a<SP>mixture of name and
class identifiers and wildcard elements (that is, *). To look<SP>up
a resource value, an application program starts with two resource
name lists<SP>of the same length containing no wildcard elements <#1f>
a <F2>complete resource<SP>name<F0> and a <F2>complete resource
class<F0>. The lookup algorithm returns the<SP>value for the resource
binding whose resource name is the closest match to the<SP>complete
name and class given. The definition of <F2>closest match<F0> takes
into<SP>account the top<#1e>down, parent<#1e>child hierarchy of resource
names and also the<SP>distinction between individual names and class
names.
<p2rule>
<Index, "complete resource name"><Index, "complete resource class"><Index, "resource", "complete name"><Index, "resource", "complete class">
<Frame,
Name = p2rule,
Placement = At Anchor,
Width = 4.75 inches,
Height = 0.15 inches,
Vertical Alignment = 0.007 inches,
Shared Contents = yes>
<p2stacked,
Font = F3>
<Tab><F4>Complete Names<Tab>13.4.1<F0><#04>A resource binding contains
a resource name list that can contain
<p2para,
Alignment = Both,
Font = F3,
Allow Page Break Within = yes,
Allow Page Break After = yes,
TOC Doc Name = >
<Tab><F4>and Classes<Tab><F0>names,<SP>class names, or a mixture
of both. A class name is a symbol or string that<SP>represents a group
of related objects. The set of names used as class names are<SP>not
specified by CLX. Instead, class names are defined by agreement between
those who<SP>use class names when creating resource bindings (that
is, users) and those who use<SP>class names when accessing resource
values (that is, application programmers).<F4>
<para>
In order to access a value in a resource database, an application
uses a key<SP>consisting of two items: a <F2>complete resource name<F0>
and a <F2>complete resource<SP>class<F0>. A complete resource name
is a resource name list containing no wildcard<SP>elements. A complete
resource class is a list of exactly the same form. The<SP>distinction
between a complete resource name and a complete resource class lies<SP>in
how they are used to access resource bindings. The elements of a complete<SP>re
source name are interpreted as names of individual objects; the elements
of a<SP>complete resource class are interpreted as names of object
classes. The<SP>complete resource name and class lists used in a resource
database access must<SP>have the same length.
<|,"13<#1e>164">Like any resource name list, a complete resource name consists
of a path list<SP>and an attribute name. The first path list element
is typically a symbol (or<SP>string) identifying the application as
a whole. The second element can be a<SP>screen root identifier. Subsequent
elements can be identifiers for each<SP>ancestor window of an application
window. Thus, a path list typically<SP>identifies a specific window
by tracing a path to it through the application<SP>window hierarchy.
The final element of a complete resource name (its<SP>attribute name)
is typically the name of a specific attribute of the window<SP>given
by the path list (for example, <F9>'background<F0>). An attribute
name can refer<SP>to a feature associated with the window by the application
but not by the X<SP>server (for example, a font identifier). Similarly,
a complete resource class<SP>typically represents a path to a window
in the application window hierarchy and a<SP>specific window attribute.
However, a complete resource class contains the<SP>class name for
each window and for the window attribute.
For instance, in the previous example, the <F9>mail<F0> application
can attempt to look<SP>up the value of the <F9>background<F0> resource
for the <F9>reply button<F0> window by using the<SP>following complete
resource name:
<t3,
Bottom Margin = 0.15 inches>
<F9>(mail screen<#1e>1 reply background)
<para>
and the following complete resource class:
<t3,
Bottom Margin = 0.15 inches>
<F9>(application root button fill)
<para>
This complete resource name contains a path list identifying the reply
button<SP>window <#1f> <F9>(mail screen<#1e>1 reply)<F0> <#1f> and
an attribute name for the window<SP>background. The corresponding
resource class contains the class names for the<SP>same path list
and window attribute.
<p2rule>
<Index, "resource", "matching">
<Frame,
Name = p2rule,
Placement = At Anchor,
Width = 4.75 inches,
Height = 0.15 inches,
Vertical Alignment = 0.007 inches,
Shared Contents = yes>
<p2stacked,
Font = F3>
<Tab><F4>Matching<Tab>13.4.2<F0><#04>The resource lookup algorithm
searches a specified resource data<F4><FJ>
<p2para,
Alignment = Both,
Font = F3,
Allow Page Break Within = yes,
Allow Page Break After = yes,
TOC Doc Name = >
<F4> <Tab>Resource Names<Tab><F0>base and returns<SP>the value for
the resource binding whose resource name is the closest match to a<SP>given
complete resource name and class. The intent of the lookup algorithm
is<SP>to formalize an intuitive notion of the closest match.
<para>
Precedence is given to a match which begins <F2>higher<F0> in the
parent<#1e>child contact<SP>hierarchy. This allows a resource binding
with a partial name to define a<SP>resource value shared by all members
of a window subtree. For example, suppose the<SP>resource database
contained the following resource bindings:
<t3head>
<F4>Resource Name<Tab>Resource Value
<t3>
<F9>(mail * background)<Tab>'red
<t3,
Bottom Margin = 0.15 inches>
<F9>(* reply background)<Tab>'blue
<para,
Bottom Margin = 0.13 inches>
Suppose an application program searched by using the following complete
resource name:
<t3,
Bottom Margin = 0.15 inches>
<F9>(mail screen<#1e>1 reply background)
<para,
Bottom Margin = 0.13 inches>
then the closest matching value returned would be <F9>'red<F0>.
Precedence is given to the more specific match. A name match is more
specific<SP>than a class match. Either a name or class match is more
specific than a<SP>wildcard match. For example, suppose the resource
database contained the following<SP>resource bindings:
<t3head>
<F4>Resource Name<Tab>Resource Value
<t3>
<F9>(mail * background)<Tab>'red
<t3,
Bottom Margin = 0.15 inches>
<|,"13<#1e>165"><F9>(mail * fill)<Tab>'blue
<para,
Bottom Margin = 0.13 inches>
Suppose an application program searched by using the following complete
resource name<SP>and complete resource class:
<t3>
<F9>(mail screen<#1e>1 reply background)
<t3,
Bottom Margin = 0.15 inches>
<F9>(application root button fill)
<para,
Bottom Margin = 0.13 inches>
then the closest matching value returned would be <F9>'red<F0>.
However, suppose the<SP>resource database contained the following
resource bindings:
<t3head>
<F4>Resource Name<Tab>Resource Value
<t3>
<F9>(mail * background)<Tab>'red
<t3,
Bottom Margin = 0.15 inches>
<F9>(mail * button background)<Tab>'blue
<para>
then the closest matching value returned would be <F9>'blue<F0>.
<p2rule>
<Frame,
Name = p2rule,
Placement = At Anchor,
Width = 4.75 inches,
Height = 0.15 inches,
Vertical Alignment = 0.007 inches,
Shared Contents = yes>
<p2stacked,
Font = F3>
<Tab><F4>Resource<Tab>13.4.3<F0><#04>The following paragraphs describe
the CLX functions used to return
<p2para,
Alignment = Both,
Font = F3,
Allow Page Break Within = yes,
Allow Page Break After = yes,
TOC Doc Name = >
<Tab><F4>Access Functions<Tab><F0>a value from a resource<SP>database.
<syntax0>
get<#1e>resource<F3> <F2>database attribute<#1e>name attribute<#1e>class
path<#1e>name path<#1e>class<F3><Tab>Function<Index, Doc = operations, "xlib:get<#1e>resources", Sort String = "get<#1e>resources">
<return>
<Tab><F3>Returns:<HR>
<F2>value <F3><#1f> Type <F0>t<F3>.
<para,
Bottom Margin = 0.13 inches>
Returns the value of the resource binding in the <F2>database<F0>
whose resource<SP>name most closely matches the complete resource
name/class given by the<SP><F2>path<#1e>name<F0>, <F2>path<#1e>class<F0>,
<F2>attribute<#1e>name<F0>, and <F2>attribute<#1e>class<F0>. The
lookup<SP>algorithm implements the precedence rules described previously
to<SP>determine the closest match. When comparing name elements, case
is<SP>significant only if both elements are strings; otherwise, element
matching<SP>is case<#1e>insensitive.
<arg>
database<F3> <#1f> A <F4>resource<#1e>database<F3>.
attribute<#1e>name<F3> <#1f> A string or symbol giving an attribute
name from a complete<SP>resource name.
attribute<#1e>class<F3> <#1f> A string or symbol giving an attribute
class name from a complete<SP>resource class.
path<#1e>name <F3><#1f> The path list from a complete resource name. <F0>path
<#1e>name<F3> and<F0> path<#1e>class<F3><SP>must have the same
length.
path<#1e>class<F3> <#1f> The path list from a complete resource class. <F0>pa
th<#1e>name <F3>and<F0> path<#1e>clas<F3>s<SP>must have the same
length.
<syntax0>
get<#1e>search<#1e>table<F3> <F2>database path<#1e>name path<#1e>class<F3><Tab>
Function<F0><Index, "resource", "search table"><Index, Doc = operations, "xlib:get<#1e>search<#1e>table", Sort String = "get<#1e>search<#1e>table">
<return>
<Tab><F3>Returns:<HR>
<F2>search<#1e>table<F3> <#1f> Type <F0>list<F3>.
<para>
Returns a table containing the subset of the <F2>database<F0> that
matches the<SP><F2>path<#1e>name<F0> and <F2>path<#1e>class<F0>.
Resources using the same <F2>path<#1e>name<F0> and <F2>path<#1e>class<F0><SP>
can be accessed much more efficiently by using this table as an<SP>argument
to <F4>get<#1e>search<#1e>resource<F0>.
<arg>
database<F3> <#1f> A <F4>resource<#1e>database<F3>.
path<#1e>name <F3><#1f> The path list from a complete resource name.<F0>
path<#1e>name<F3> and<F0> path<#1e>class<SP><F3>must have the same
length.
path<#1e>class<F3> <#1f> The path list from a complete resource class. <F0>pa
th<#1e>name<F3> and<F0> path<#1e>class<F3><SP>must have the same
length.
<syntax0>
<|,"13<#1e>166">get<#1e>search<#1e>resource<F3> <F2>table attribute<#1e>name
attribute<#1e>class<F3><Tab>Function<Index, Doc = operations, "xlib:get<#1e>search<#1e>resource", Sort String = "get<#1e>search<#1e>resource">
<return>
<Tab><F3>Returns:<HR>
<F2> value<F3> <#1f> Type <F0>t<F3>.
<para>
Returns the value of the resource binding in the search <F2>table<F0>
that most closely matches the <F2>attribute<#1e>name<F0> and <F2>attribute<#1e>
class<F0>. The <F2>table<F0> is<SP>computed by <F4>get<#1e>search<#1e>table
<F0> and represents a set of resource bindings.<SP>The closest match
is determined by the same algorithm used in<SP><F4>get<#1e>resource<F0>.
The following two forms are functionally equivalent:
<argtable,
Left Tab = 0/0.10/1.70/2.50/3/0.75*25 inches>
<F3><Tab><F9>(get<#1e>resource<HR>
<Tab> database attribute<#1e>name attribute<#1e>class path<#1e>name
path<#1e>class)
<argtable,
Bottom Margin = 0.15 inches,
Left Tab = 0/0.10/1.70/2.50/3/0.75*25 inches>
<F3><Tab><F9>(get<#1e>search<#1e>resource<HR>
<Tab> (get<#1e>search<#1e>table database path<#1e>name path<#1e>class)<HR>
<Tab> attribute<#1e>name attribute<#1e>class)
<para>
However, the hard part of the search is done by <F4>get<#1e>search<#1e>table
<F0>.<SP>Looking up values for several resource attributes that share
the same<SP>path list can be done much more efficiently with calls
to<SP><F4>get<#1e>search<#1e>resource<F0>.
<arg>
table<F3> <#1f> A search table returned by <F4>get<#1e>search<#1e>table<F3>.
attribute<#1e>name<F3> <#1f> A string or symbol giving an attribute
name from a complete<SP>resource name.
attribute<#1e>class<F3> <#1f> A string or symbol giving an attribute
class name from a complete<SP>resource class.
<p1rule>
<Index, "resource", "database", "files">
<Frame,
Name = p1rule,
Placement = At Anchor,
Width = 6.35 inches,
Height = 0.153 inches,
Vertical Alignment = 0.007 inches,
Shared Contents = yes>
<p1stacked,
Font = F3,
Left Tab = -1.70/0 inches>
<F8>Resource <Tab><F4>13.5<F0><#04>X users and application programs
can save resource bindings in a file,<FJ>
<p1para,
Alignment = Both,
Font = F3,
Allow Page Break After = yes>
<F8>Database Files<Tab><F0>using a<SP>standard file format shared
by all X clients. The following paragraphs describe the CLX<SP>functions
used to convert between the standard external format of resource files<SP>and
the internal resource<#1e>database format used by application programs.
<syntax0>
read<#1e>resources<F3> <F2>database pathname<F3> &key <F0>:key
:test :test<#1e>not<F3><Tab>Function<Index, Doc = operations, "xlib:read<#1e>resources", Sort String = "read<#1e>resources">
<return>
<Tab><F3>Returns:<HR>
<F2>database<F3> <#1f> Type <F0>resource<#1e>database<F3>.
<para>
Reads resource bindings from a resource file in standard X11 format
and<SP>merges them with the given resource <F2>database<F0>. The <F4>:key
<F0> function is called to<SP>convert a file resource value into
the value stored in the <F2>database<F0>. By<SP>default, <F4>:key<F0>
is <F4>#'identity<F0>. The <F4>:test<F0> and <F4>:test<#1e>not<F0>
functions are<SP>predicates that select resource bindings to merge,
based on the result of<SP>the <F4>:key<F0> function. For each file
resource binding consisting of a<SP><F2>resource<#1e>name<F0> and
a <F2>resource<#1e>value<F0>, the <F4>:test<F0> (or <F4>:test<#1e>not
<F0>) function is<SP>called with the arguments <F2>resource<#1e>name<F0>
and (<F4>funcall<F0> <F2>key resource<#1e>value<F0>).
<arg>
database<F3> <#1f> The <F4>resource<#1e>database<F3> to merge.
pathname<F3> <#1f> A pathname for the resource file to read.
<F4>:key<F3> <#1f> A function used to convert a value from the resource
file into a<SP>resource binding value.
<F4>:test<F3>, <F4>:test<#1e>not<F3> <#1f> Functions used to select
which resource bindings from the resource file<SP>are merged with
the <F0>database<F3>.
<syntax>
<|,"13<#1e>167">write<#1e>resources<F3> <F2>database pathname<F3> &key <F0>:write
:test :test<#1e>not<F3><Tab>Function<Index, Doc = operations, "xlib:write<#1e>resources", Sort String = "write<#1e>resources">
<para>
Writes resource bindings found in the <F2>database<F0> to the file
given by the<SP><F2>pathname<F0>. The output file is written in
the standard X11 format. The<SP><F4>:write<F0> function is used
for writing resource values; the default is <F4>#'princ<F0>.<SP>The <F4>:wri
te<F0> function is passed two arguments: a <F2>resource<#1e>value<F0>
and a <F2>stream<F0>. The <F4>:test<F0> and <F4>:test<#1e>not<F0>
functions are predicates which select resource<SP>bindings to write.
For each resource binding consisting of a <F2>resource<#1e>name<F0><SP>and
a <F2>resource<#1e>value<F0>, the <F4>:test<F0> (or <F4>:test<#1e>not
<F0>) function is called with the<SP>arguments <F2>resource<#1e>name<F0>
and <F2>resource<#1e>value<F0>.
<arg>
database<F3> <#1f> The <F4>resource<#1e>database<F3> to write.
pathname<F3> <#1f> A pathname of the file to write.
<F4>:write<F3> <#1f> A function for writing resource values.
<F4>:test<F3>, <F4>:test<#1e>not<F3> <#1f> Functions used to select
which resource bindings from the resource file<SP>are merged with
the <F0>database<F3>.
<newpage>
<|,"13<#1e>168">