From e82911742ee8518f9adb429e428a46444a94db49 Mon Sep 17 00:00:00 2001 From: Emden Gansner Date: Mon, 7 Nov 2011 14:48:27 -0500 Subject: [PATCH] Make the grammar used to describe types a bit cleaner; remove redundant pointf type; add new types allowing a '+' before a double or a point --- doc/info/attrs.html | 74 +++++++++++++++++++++++------------------- doc/infosrc/attrs | 16 ++++----- doc/infosrc/attrs.1 | 2 +- doc/infosrc/mkattrs.sh | 2 +- doc/infosrc/mktypes.sh | 5 +++ doc/infosrc/types | 44 ++++++++++++------------- 6 files changed, 78 insertions(+), 65 deletions(-) diff --git a/doc/info/attrs.html b/doc/info/attrs.html index 2c73b356f..d934d6da0 100644 --- a/doc/info/attrs.html +++ b/doc/info/attrs.html @@ -65,7 +65,7 @@ and any non-zero integer, and FALSE values by "false" or "no" (case-insensitive) and zero. In addition, there are a variety of specialized types such as arrowType, color, -pointf and rankdir. Legal values for these types are given +point and rankdir. Legal values for these types are given at the end.

In the Used By field, the @@ -75,7 +75,7 @@ and cluster subgraphs, respectively. This field indicates which graph component uses the attribute.


- + @@ -336,10 +337,10 @@ This field indicates which graph component uses the attribute. @@ -470,7 +472,7 @@ This field indicates which graph component uses the attribute.
NameUsed ByTypeDefaultMinimumNotes
NameUsed ByTypeDefaultMinimumNotes
Damping Gdouble0.990.0neato only
K @@ -161,7 +161,8 @@ This field indicates which graph component uses the attribute.
epsilon Gdouble.0001 * # nodes(mode == KK)
.0001(mode == major)
neato only
esep -Gdouble
pointf +
GaddDouble +
addPoint
+3not dot
fillcolor NCcolor @@ -287,7 +288,7 @@ This field indicates which graph component uses the attribute.
lwidth GCdoublewrite only
margin -NGdouble
pointf +
NGdouble
point
<device-dependent>
maxiter Gint100 * # nodes(mode == KK)
200(mode == major)
600(fdp)
fdp, neato only
GpackMode nodenot dot
pad -Gdouble
pointf +
Gdouble
point
0.0555 (4 points)
page -Gdouble
pointf +
Gdouble
point
pagedir Gpagedir @@ -402,12 +403,13 @@ This field indicates which graph component uses the attribute.
samplepoints Nint8(output)
20(overlap and image maps)
scale -Gdouble
pointf +
Gdouble
point
twopi only
searchsize Gint30dot only
sep -Gdouble
pointf +
GaddDouble +
addPoint
+4not dot
shape Nshape @@ -419,7 +421,7 @@ This field indicates which graph component uses the attribute.
sides Nint40
size -Gdouble
pointf +
Gdouble
point
skew Ndouble0.0-100.0
Gbool bitmap output only
vertices -NpointfList +NpointList write only
viewport GviewPort @@ -1869,7 +1871,18 @@ This field indicates which graph component uses the attribute.

Attribute Type Descriptions

The following list gives the legal strings corresponding to values of the given types. +The syntax for describing legal type strings is a mixture of literal strings, +stdio encodings (e.g., %f for a double), and regular expressions. +For regular expressions, (...)* indicates 0 or more copies of the expression +enclosed in the parentheses, (...)+ indicates 1 or more, and +(...)? denotes 0 or 1 copy.
+
addDouble +

A double with an optional prefix '+'. + +

addPoint +

A point with an optional prefix '+'. +

arrowType
"normal" @@ -1919,7 +1932,7 @@ the given types.
Colors can be specified using one of four formats. - +
"#%2x%2x%2x"Red-Green-Blue (RGB)
"#%2x%2x%2x%2x"Red-Green-Blue-Alpha (RGBA)
H[, ]+S[, ]+VHue-Saturation-Value (HSV) 0.0 <= H,S,V <= 1.0
"H[, ]+S[, ]+V"Hue-Saturation-Value (HSV) 0.0 <= H,S,V <= 1.0
stringcolor name
The specification for the RGB and RGBA formats are the format strings used by sscanf to scan the color value. Thus, these values have the form @@ -1984,8 +1997,8 @@ the given types. interpreting "forward" and "back".
doubleList -
A colon-separated list of doubles: d(:d)* - where each d is a double. +
A colon-separated list of doubles: "%f(:%f)*" + where each %f is a double.
escString
string allowing escape sequences which are replaced according @@ -2041,7 +2054,7 @@ the given types. "edgesfirst".
packMode -
"node", "clust" , "graph" , "array[_flags][%d]" +
"node", "clust" , "graph" , "array(_flags)?(%d)?"

The modes "node", "clust" or "graph" specify that the components should be packed together tightly, using @@ -2058,12 +2071,12 @@ the given types. example, neato does not support clusters, so a value of "clust" will have the same effect as the default "node" value.

- The mode "array[_flags][%d]" + The mode "array(_flag)?(%d)?" indicates that the components should be packed at the graph level into an array of graphs. By default, the components are in row-major order, with the number of columns roughly the square root of the number of components. If the optional flags - contains "c", then column-major order is used. Finally, if the + contains 'c', then column-major order is used. Finally, if the optional integer suffix is used, this specifies the number of columns for row-major or the number of rows for column-major. Thus, the mode "array_c4" indicates array packing, with 4 rows, @@ -2071,10 +2084,10 @@ the given types. down the second column, etc., until all components are used.

If a graph is smaller than the array cell it occupies, it is centered by default. - The optional flags may contain "t", "b", "l", or "r", indicating that the graphs + The optional flags may contain 't', 'b', 'l', or 'r', indicating that the graphs should be aligned along the top, bottom, left or right, respectively.

- If the optional flags contains "u", this causes the insertion + If the optional flags contains 'u', this causes the insertion order of elements in the array to be determined by user-supplied values. Each component can specify its sort value by a non-negative integer using the sortv attribute. @@ -2093,22 +2106,19 @@ the given types. until the topmost row is traversed.

point -
"%f,%f"('!') representing the point (x,y). The +
"%f,%f('!')?" representing the point (x,y). The optional '!' indicates the node position should not change (input-only).

- If dim is 3 or more, point may also have - the format "%f,%f,%f"('!') to represent the point (x,y,z). - -

pointf -
"%lf,%lf" representing the point (x,y). + If dim is 3, point may also have + the format "%f,%f,%f('!')?" to represent the point (x,y,z). -
pointfList -
list of pointf, separated by spaces. +
pointList +
A list of points, separated by spaces.
portPos
modifier indicating where on a node an edge should be aimed. - It has the form portname[:compass_point] + It has the form portname(:compass_point)? or compass_point. If the first form is used, the corresponding node must either have record shape with one of its fields @@ -2192,7 +2202,7 @@ the given types. Similarly for pn and endp.
startType -
has the syntax [style][seed]. +
has the syntax (style)?(seed)?.

If style is present, it must be one of the strings "regular", "self", or "random". In the first case, the nodes are @@ -2218,12 +2228,10 @@ the given types. -
where styleItem=name or name'('args')'
and args=name ( ',' name )*
and name=[^)(,  ][^)(,]*
- Note that whitespace characters are ignored, except for names which - can contain them. A - name cannot contain any comma, or left or right parenthesis, and it cannot - begin with a whitespace character. + and name can be any string of characters not containing a space, a left or + right parenthesis, or a comma. + Note that whitespace characters are ignored.

At present, the recognized style names are "dashed", "dotted", "solid", "invis" and "bold" for nodes and edges, diff --git a/doc/infosrc/attrs b/doc/infosrc/attrs index c3585f9aa..b939e18ab 100644 --- a/doc/infosrc/attrs +++ b/doc/infosrc/attrs @@ -274,7 +274,7 @@ or edgeURL attribute. :epsilon:G:double:.0001 * # nodes(mode == KK)/.0001(mode == major); neato Terminating condition. If the length squared of all energy gradients are < epsilon, the algorithm stops. -:esep:G:double/pointf:+3; notdot +:esep:G:addDouble/addPoint:+3; notdot Margin used around polygons for purposes of spline edge routing. The interpretation is the same as given for sep. This should normally be strictly less than sep. @@ -615,7 +615,7 @@ the edge is clipped to the boundary of the cluster. See limitation. :lwidth:GC:double; write Width of graph or cluster label, in inches. -:margin:NG:double/pointf:; +:margin:NG:double/point:; For graphs, this sets x and y margins of canvas, in inches. If the margin is a single double, both margins are set equal to the given value.

@@ -820,7 +820,7 @@ This indicates how connected components should be packed (cf. packMode). Note that defining packmode will automatically turn on packing as though one had set pack=true. -:pad:G:double/pointf:0.0555 (4 points); +:pad:G:double/point:0.0555 (4 points); The pad attribute specifies how much, in inches, to extend the drawing area around the minimal area needed to draw the graph. If the pad is a single double, both the x and y pad values are set @@ -830,7 +830,7 @@ drawing and will be filled with the background color, if appropriate. Normally, a small pad is used for aesthetic reasons, especially when a background color is used, to avoid having nodes and edges abutting the boundary of the drawn region. -:page:G:double/pointf; +:page:G:double/point; Width and height of output pages, in inches. If only a single value is given, this is used for both the width and height.

@@ -1040,14 +1040,14 @@ attribute, and output is dot or xdot, this gives the number of points used for a node whose shape is a circle or ellipse. It plays the same role in neato, when adjusting the layout to avoid overlapping nodes, and in image maps. -:scale:G:double/pointf; twopi +:scale:G:double/point; twopi If set, after the initial layout, twopi will scale the layout by the given factors. The scaling uses the root node of each component as the center of the scaling. If only a single number is given, this is used for both factors. :searchsize:G:int:30; dot During network simplex, maximum number of edges with negative cut values to search when looking for one with minimum cut value. -:sep:G:double/pointf:+4; notdot +:sep:G:addDouble/addPoint:+4; notdot Specifies margin to leave around nodes when removing node overlap. This guarantees a minimal non-zero distance between nodes.

@@ -1088,7 +1088,7 @@ Print guide boxes in PostScript at the beginning of routesplines if 1, or at the end if 2. (Debugging) :sides:N:int:4:0; Number of sides if shape=polygon. -:size:G:double/pointf; +:size:G:double/point; Maximum width and height of drawing, in inches. If only a single number is given, this is used for both the width and the height. @@ -1204,7 +1204,7 @@ However, if one uses bgcolor=transparent with a color palette, font antialiasing can show up as a fuzzy white area around characters. Using truecolor=true avoids this problem. -:vertices:N:pointfList; write +:vertices:N:pointList; write If the input graph defines this attribute, the node is polygonal, and output is dot or xdot, this attribute provides the coordinates of the vertices of the node's polygon, in inches. diff --git a/doc/infosrc/attrs.1 b/doc/infosrc/attrs.1 index b4ea56b6f..b67bb00e3 100644 --- a/doc/infosrc/attrs.1 +++ b/doc/infosrc/attrs.1 @@ -65,7 +65,7 @@ and any non-zero integer, and FALSE values by "false" or "no" (case-insensitive) and zero. In addition, there are a variety of specialized types such as arrowType, color, -pointf and rankdir. Legal values for these types are given +point and rankdir. Legal values for these types are given at the end.

In the Used By field, the diff --git a/doc/infosrc/mkattrs.sh b/doc/infosrc/mkattrs.sh index 08e334a6f..593045ca6 100755 --- a/doc/infosrc/mkattrs.sh +++ b/doc/infosrc/mkattrs.sh @@ -190,7 +190,7 @@ fi #exit print "" -print "" +print "" set -s ${!descs[@]} for i diff --git a/doc/infosrc/mktypes.sh b/doc/infosrc/mktypes.sh index 856260259..43124e429 100755 --- a/doc/infosrc/mktypes.sh +++ b/doc/infosrc/mktypes.sh @@ -46,6 +46,11 @@ fi print "

Attribute Type Descriptions

" print "The following list gives the legal strings corresponding to values of" print "the given types." +print "The syntax for describing legal type strings is a mixture of literal strings," +print "stdio encodings (e.g., %f for a double), and regular expressions." +print "For regular expressions, (...)* indicates 0 or more copies of the expression" +print "enclosed in the parentheses, (...)+ indicates 1 or more, and" +print "(...)? denotes 0 or 1 copy." print "
" set -s ${!desc[@]} diff --git a/doc/infosrc/types b/doc/infosrc/types index 820314285..1a5d8f958 100644 --- a/doc/infosrc/types +++ b/doc/infosrc/types @@ -5,6 +5,10 @@ # # The type is given the anchor k:, so # the description can be linked with "> +:addDouble +

A double with an optional prefix '+'. +:addPoint +

A point with an optional prefix '+'. :aspectType

An aspect ratio, double, followed optionally by a ',' and a maximum pass count. If the aspect ratio is given, but no maximum pass count, the @@ -51,7 +55,7 @@ plus some supported as special cases for backward-compatibility Colors can be specified using one of four formats.

NameUsed ByTypeDefaultMinimumNotes
NameUsed ByTypeDefaultMinimumNotes
- +
"#%2x%2x%2x"Red-Green-Blue (RGB)
"#%2x%2x%2x%2x"Red-Green-Blue-Alpha (RGBA)
H[, ]+S[, ]+VHue-Saturation-Value (HSV) 0.0 <= H,S,V <= 1.0
"H[, ]+S[, ]+V"Hue-Saturation-Value (HSV) 0.0 <= H,S,V <= 1.0
stringcolor name
The specification for the RGB and RGBA formats are the format strings used by sscanf to scan the color value. Thus, these values have the form @@ -113,8 +117,8 @@ For undirected edges T -- H;, one of the nodes, usually the righthand one, is treated as the head for the purpose of interpreting "forward" and "back". :doubleList -A colon-separated list of doubles: d(:d)* - where each d is a double. +A colon-separated list of doubles: "%f(:%f)*" + where each %f is a double. :escString string allowing escape sequences which are replaced according to the context. @@ -164,7 +168,7 @@ reasons, it may be desirable that all edges appear beneath nodes, even if the resulting drawing is ambiguous. This can be achieved by choosing "edgesfirst". :packMode -"node", "clust" , "graph" , "array[_flags][%d]" +"node", "clust" , "graph" , "array(_flags)?(%d)?"

The modes "node", "clust" or "graph" specify that the components should be packed together tightly, using @@ -181,12 +185,12 @@ What effect a value has also depends on the layout algorithm. For example, neato does not support clusters, so a value of "clust" will have the same effect as the default "node" value.

-The mode "array[_flags][%d]" +The mode "array(_flag)?(%d)?" indicates that the components should be packed at the graph level into an array of graphs. By default, the components are in row-major order, with the number of columns roughly the square root of the number of components. If the optional flags -contains "c", then column-major order is used. Finally, if the +contains 'c', then column-major order is used. Finally, if the optional integer suffix is used, this specifies the number of columns for row-major or the number of rows for column-major. Thus, the mode "array_c4" indicates array packing, with 4 rows, @@ -194,10 +198,10 @@ starting in the upper left and going down the first column, then down the second column, etc., until all components are used.

If a graph is smaller than the array cell it occupies, it is centered by default. -The optional flags may contain "t", "b", "l", or "r", indicating that the graphs +The optional flags may contain 't', 'b', 'l', or 'r', indicating that the graphs should be aligned along the top, bottom, left or right, respectively.

-If the optional flags contains "u", this causes the insertion +If the optional flags contains 'u', this causes the insertion order of elements in the array to be determined by user-supplied values. Each component can specify its sort value by a non-negative integer using the sortv attribute. @@ -214,19 +218,17 @@ to right. This means the bottom row is traversed first, from left to right, then the next row up, from left to right, and so on, until the topmost row is traversed. :point -"%f,%f"('!') representing the point (x,y). The +"%f,%f('!')?" representing the point (x,y). The optional '!' indicates the node position should not change (input-only).

-If dim is 3 or more, point may also have -the format "%f,%f,%f"('!') to represent the point (x,y,z). -:pointf -"%lf,%lf" representing the point (x,y). -:pointfList -list of pointf, separated by spaces. +If dim is 3, point may also have +the format "%f,%f,%f('!')?" to represent the point (x,y,z). +:pointList +A list of points, separated by spaces. :portPos modifier indicating where on a node an edge should be aimed. -It has the form portname[:compass_point] +It has the form portname(:compass_point)? or compass_point. If the first form is used, the corresponding node must either have record shape with one of its fields @@ -295,12 +297,10 @@ styleItem ( ',' styleItem )*
-
where styleItem=name or name'('args')'
and args=name ( ',' name )*
and name=[^)(,  ][^)(,]*
-Note that whitespace characters are ignored, except for names which -can contain them. A -name cannot contain any comma, or left or right parenthesis, and it cannot -begin with a whitespace character. +and name can be any string of characters not containing a space, a left or +right parenthesis, or a comma. +Note that whitespace characters are ignored.

At present, the recognized style names are "dashed", "dotted", "solid", "invis" and "bold" for nodes and edges, @@ -330,7 +330,7 @@ by HTML-like labels. That is, instead of using shape=record, one might consider using shape=none and an HTML-like label. :startType -has the syntax [style][seed]. +has the syntax (style)?(seed)?.

If style is present, it must be one of the strings "regular", "self", or "random". In the first case, the nodes are -- 2.40.0