File: Resource-Syntax.html

package info (click to toggle)
pcb 1.99j%2B20050127-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 8,632 kB
  • ctags: 4,302
  • sloc: ansic: 45,369; pascal: 3,526; sh: 1,140; yacc: 1,076; makefile: 575; lex: 348; perl: 183; awk: 102; tcl: 63
file content (98 lines) | stat: -rw-r--r-- 3,395 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<html lang="en">
<head>
<title>Pcb</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Pcb">
<meta name="generator" content="makeinfo 4.6">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
--></style>
</head>
<body>
<div class="node">
<p>
Node:&nbsp;<a name="Resource%20Syntax">Resource Syntax</a>,
Next:&nbsp;<a rel="next" accesskey="n" href="Menu-Definitions.html#Menu%20Definitions">Menu Definitions</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Custom-Menus.html#Custom%20Menus">Custom Menus</a>
<hr><br>
</div>

<h3 class="section">Resource Syntax</h3>

<p>A resource file is a simple text file.  It contains curly braces to
group things, spaces between things, and double quotes when strings
need to include spaces.  There are four fundamental ways of adding
data to a resource.

   <p>First, a string (either a single word or a quoted string with spaces,
we call both "strings" in this appendix) can be added all by itself,
to add a string resource to the current resource.  This is used, for
example, to define the string printed on a menu button.  In this
example, four strings are added to the <var>File</var> resource:

<pre class="example">     File = {
       Sample
       "longer sample"
       some text
     }
     </pre>

   <p>Second, a named string may be added by giving two strings separated by
an equals sign.  This is used to specify X resources and a few other
optional parameters of menus, for example.  Note that a string all by
itself is thus an "unnamed" string.

<pre class="example">     {"Layer groups" foreground=red sensitive=false}
     </pre>

   <p>Third, an unnamed subresource may be added.  This is used to create
submenus and menu buttons.  To add a subresource, simply group other
things in curly braces.  This example describes a resource containing
one string and three subresources:

<pre class="example">     {File
       {New do_new()}
       {Save do_save()}
       {Quit do_quit()}
     }
     </pre>

   <p>Lastly, a named subresource may be added by prefixing an unnamed
subresource with a string and an equals sign, just as when naming
strings.  This syntax is used to name the resources used for the main
menu and popup menus:

<pre class="example">     MainMenu = {
       ...
       }
     </pre>

   <p>Additionally, the menu parser allows for "hooks" whereby portions of
the menu system can be programmatically created at runtime by the
application.  These hooks are invoked by a single word proceeded by an
at sign, such as this example where most of the Sizes menu is created
automatically:

<pre class="example">     {Sizes
         @sizes
         {"Adjust active sizes ..." AdjustStyle(0)}
         }
     </pre>

   <p>In addition to all that, any unquoted pound sign (<code>#</code>) begins a
comment.  Commented text continues until the end of the containing
line.  Comments may begin at the beginning of a line, or after other
text on the line:

<pre class="example">     # This is a comment
     MainMenu = { # This is also a comment
     </pre>

   </body></html>