Predefined Values
There are a number of predefined values that control the default
behavior of the functions you use to draw byte field diagrams. They
are set up as variables before your code starts running, and as
described in the introduction, you can change
their values using Clojure’s
def
mechanism.
Unless you append a specific unit type to them,
distances
and coordinates in SVG are interpreted as “user units”, which default
in these diagrams to pixels (as if you had added px after the
number).
|
Variable | Default Value | Purpose |
---|---|---|
|
|
How far from the left edge of the diagram the first
box begins. This default is large enough to accommodate the row
address labels for all but extremely long byte fields. If you are
drawing a single row (which won’t have a row label), it’s nice to set
this to |
|
|
How far from the right edge of the diagram the last box ends. This default is just large enough to make sure the box boundary doesn’t get clipped. You can make it bigger if you want to draw custom content there. |
|
|
How far from the bottom edge of the diagram the last row of boxes ends. This default is just large enough to make sure the box boundaries don’t get clipped. You can make it bigger if you want to draw custom content there. |
|
|
How much horizontal space each box takes up. |
|
|
How many boxes are drawn on a row before moving to
the next row. The default is 16, so that the hexadecimal row labels
increment by |
|
|
A sequence whose elements are used
as the actual text of each column header in order. Although you can
change this globally by redefining this value, it is more common to
simply pass a different sequence (often by transforming this one) as
the |
|
|
How much vertical space a row of boxes takes up. |
|
See the next section. |
|
|
|
The function that is called to draw the row header when necessary. See the source for more details (near the end of the file). |
You can def
any other variables that might be useful to your
diagrams, perhaps in a shared include file, but they won’t affect the
existing drawing functions the way these values do.
Copyright © 2020 Deep Symmetry, LLC