english
version "1.0"
identify "xyz"
#: Copyright (c) 1993-2007 by Wayne C. Gramlich.
#, All rights reserved.
module unsigned
#: This module implements the 32-bit unsigned number base type for STIPPLE:
define unsigned
external
define unsigned_data
record
buffer string
initialized logical
hyphen character
lower_b character
lower_c character
lower_d character
lower_digits string
lower_h character
lower_i character
lower_l character
lower_o character
lower_p character
lower_q character
lower_s character
lower_w character
lower_x character
percent character
space character
upper_digits string
upper_h character
upper_o character
upper_x character
zero_offset unsigned
generate allocate, erase, print
object one@unsigned
object zero@unsigned
procedure add@unsigned
takes
left unsigned
right unsigned
returns unsigned
external unsigned__add
procedure address_convert@unsigned
takes
number unsigned
returns address
external unsigned__address_convert
procedure and@unsigned
takes
left unsigned
right unsigned
returns unsigned
external unsigned__and
procedure buffer_append@unsigned
takes
number unsigned
buffer string
returns_nothing
#: This procedure will append {number
} to {buffer
} as a decimal number.
procedure byte_get@unsigned
takes
in_stream in_stream
returns unsigned
#: This procedure will read in one byte from {in_stream
} and return it.
procedure byte_put@unsigned
takes
number unsigned
out_stream out_stream
returns_nothing
#: This procedure will output the low order 8-bits of {number
}
#, to {out_stream
}.
#, This routine should be written in C.
procedure character_convert@unsigned
takes
unsigned unsigned
returns character
external unsigned__character_convert
procedure compliment@unsigned
takes
unsigned unsigned
returns unsigned
external unsigned__compliment
#: This procedure will return the bit-wise compliment of {unsigned
}.
procedure compare@unsigned
takes
unsigned1 unsigned
unsigned2 unsigned
returns integer
external unsigned__compare
#: This procedure will return -1, 0, or 1 depending upon whether
#, {unsigned1
} is less than, equal to, or greater than {unsigned2
}.
procedure copy@unsigned
takes
arg unsigned
returns unsigned
external unsigned__copy
procedure divide@unsigned
takes
left unsigned
right unsigned
returns unsigned
external unsigned__divide
procedure equal@unsigned
takes
left unsigned
right unsigned
returns logical
external unsigned__equal
procedure float_convert@unsigned
takes
arg unsigned
returns float
external unsigned__float_convert
procedure form@unsigned
takes
number unsigned
buffer string
returns_nothing
#: This procedure will replace the next occurance of "%...%" in {buffer
}
#, with a formatted representation of {number
}. The letter "x"
#, specifies hexadecimal and the letter "d" specifies decimal.
procedure form_helper@unsigned
takes
number unsigned
radix unsigned
buffer string
returns_nothing
procedure format@unsigned
takes
unsigned unsigned
out_stream out_stream
format string
offset unsigned
returns_nothing
#: This routine will output {unsigned
} to {out_stream
} using the formatting
#, characters in {format
} starting at {offset
} until a terminating "%" is
#, encountered. See the {format
} module find out more about formatted
#, output.
#,
#, The accepted formats are:
#, b Output a binary number.
#, c Center the number.
#, d Output a decimal number.
#, H Output an upper-case hexadecimal number preceeded by "0X".
#, h Output a lower-case hexadecimal number preceeded by "0x".
#, i Indent by {unsigned
} spaces.
#, l Left justify the number.
#, O Output an octal number with a preceeding zero.
#, o Output an octal number.
#, p<pad> Set padding character to <pad>.
#, q Enclose the number in double quotes.
#, s<sep> Separate every third digit with <sep>.
#, w<width> Output a minimim of <width> characters.
#, X Output as an upper-case hexadecimal number.
#, x Output as a lower-case hexadecimal number.
#, Scan the format characters:
procedure get@unsigned
takes
in_stream in_stream
returns unsigned
#: This procedure will read in 4 bytes from {in_stream
} and return
#, the associated number.
procedure greater_than@unsigned
takes
left unsigned
right unsigned
returns logical
external unsigned__greater_than
procedure hash@unsigned
takes
arg unsigned
returns unsigned
external unsigned__hash
procedure hex_buffer_append@unsigned
takes
number unsigned
buffer string
returns_nothing
#: This procedure will append {number
} to {buffer
} as a hexadecimal number.
procedure input@unsigned
takes
input in_stream
returns unsigned
procedure integer_convert@unsigned
takes
arg unsigned
returns integer
external unsigned__integer_convert
procedure left_shift@unsigned
takes
left unsigned
right unsigned
returns unsigned
external unsigned__left_shift
procedure less_than@unsigned
takes
left unsigned
right unsigned
returns logical
external unsigned__less_than
procedure maximum@unsigned
takes
left unsigned
right unsigned
returns unsigned
#: This procedure will return the maximum value of {left] and {right
}.
procedure minimum@unsigned
takes
left unsigned
right unsigned
returns unsigned
#: This procedure will return the minimum value of {left] and {right
}.
procedure minus@unsigned
takes
arg unsigned
returns unsigned
external unsigned__minus
procedure multiply@unsigned
takes
left unsigned
right unsigned
returns unsigned
external unsigned__multiply
procedure not@unsigned
takes
arg unsigned
returns unsigned
external unsigned__not
procedure output@unsigned
takes
arg unsigned
output out_stream
returns_nothing
procedure or@unsigned
takes
left unsigned
right unsigned
returns unsigned
external unsigned__or
procedure parse@unsigned
takes
input in_stream
returns unsigned
procedure print@unsigned
takes
unsigned unsigned
out_stream out_stream
returns_nothing
#: This procedure will print {unsigned
} as a decimal number to
#, {out_stream
}.
procedure put@unsigned
takes
number unsigned
out_stream out_stream
returns_nothing
#: This procedure will output {number
} to {out_stream
} as four
#, binary bytes.
procedure power@unsigned
takes
left unsigned
right unsigned
returns unsigned
external unsigned__power
procedure random_compute@unsigned
takes_nothing
returns unsigned
external unsigned__random_compute
#: This procedure will return the next random number from the
#, C library random number generator. The random number
#, generator is initialized with {random_initialize
}@{unsigned
}.
procedure random_initialize@unsigned
takes
seed unsigned
returns_nothing
external unsigned__random_initialize
#: This procedure will initialize the C library random number
#, generator with {seed
}.
procedure read@unsigned
takes
in_stream in_stream
returns unsigned
#: This procedure will read in a number from {in_stream
} that was
#, written by {write
}@{unsigned
}().
procedure remainder@unsigned
takes
left unsigned
right unsigned
returns unsigned
external unsigned__remainder
procedure right_shift@unsigned
takes
left unsigned
right unsigned
returns unsigned
external unsigned__right_shift
procedure save@unsigned
takes
unsigned unsigned
save save
offset unsigned
returns_nothing
procedure subtract@unsigned
takes
left unsigned
right unsigned
returns unsigned
external unsigned__subtract
procedure string_append@unsigned
takes
number unsigned
buffer string
returns_nothing
#: This procedure will append {number
} to {buffer
} as a decimal number.
procedure string_convert@unsigned
takes
number unsigned
returns string
#: This procedure will convert {number
} into a {string
} object and
#, return it.
procedure write@unsigned
takes
unsigned unsigned
out_stream out_stream
returns_nothing
#: This procedure will write {unsigned
} out to {out_stream
} so that
#, it can be read by {read
}@{unsigned
}().
procedure xor@unsigned
takes
left unsigned
right unsigned
returns unsigned
external unsigned__xor