Using Statit to Generate Lookup Tables
Statit to display corresponding DEC, HEX and
The most common need I have is for an ASCII
table that shows me the corresponding decimal,
octal, and hexadecimal values. I use this when
writing code and the language I'm writing in
requires one type of value or another. For example,
in HTML you may specify a color by giving the
RGB value in hexadecimal.
In Statit, the PRINTFORMAT
command provides all the functionality you need
to get such a table. No fancy tricks, just using
Statit's capabilities for displaying data in
different formats. Let's look at the following
DEC 0 to 127
let OCT = DEC
let HEX = DEC
let Char = char(DEC)
printformat DEC low to high = "%3d"
printformat OCT low to high = "%-3o"
printformat HEX low to high = "%-2x"
This macro creates 4 variables. The variable
DEC contains the decimal values 0 to 127. The
variable OCT contains the same values, but PRINTFORMAT
instructs Statit to display those values as
octal. Similarly, the variable HEX displays
the values in hexadecimal. The last variable,
Char, contains the character string of the ASCII
value, which is a printable character only for
decimal values 33 to 126. (Value 32 is the space
character; do you consider that printable?)
Additionally, you may use PRINTFORMAT
to display values in scientific notation or
even as Roman numerals. If you displayed a value
as binary, you could also use Statit to help
you with bit masking, and you might want to
check out the bit functions for additional features.
Perhaps Statit could help you with getting those
IP's correct for your sub-domains.