|
Module
standard_functions
Home
--> Fact
Sheet -->
Free Source Code
--> standard_functions
About the Module
standard_functions
Go directly to Downloads
The module standard_functions exists to add some
routines of general utility to the programmer's toolkit. These are mainly
integer routines, and integer to character (and vice versa) conversion
routines. There are also some routines for changing the endian of entities.
This module uses module
standard_types, which may be obtained from
the Portability Project pages.
Back to the Top
A list of (most) constants and procedures defined
follows.
- Constants
- error_short_string,
error_bad_base, error_not_in_table are all
error codes which may be returned by encode() and decode().
- Operators
- .xor. is a binary logical operator,
synonymous with .neqv., provided for compatibility with some popular compiler's
extensions.
- .mod., .modulo.,
.pc., are binary integer operators, which provide the mod()
and modulo() functions in a more readable form. .pc. is a binary percent
operator.
- .gcd., .lcm. are binary
integer operators, which provide the greatest common divisor and least common
multiple computations as in line operators.
- .cd., .cr. are binary
integer operators, which provide the ceiling division and ceiling remainder
computations (a la HPF) as in line operators.
Back to the Top
- Library
- iseven() and isodd()
routines are useful in, for instance, porting VAX Fortran where integers are
used directly as logicals.
- gcd() and lcm() provide the
greatest common divisor and least common multiple computations as functions.
- cd() and cr() provide the
ceiling division and ceiling remainder computations (a la HPF) as functions.
- rrint() rounds its real operand up or down
randomly, weighted by the distance from either integer.
- hex(), oct() and
bin(), convert hexadecimal, octal or binary strings,
respectively, to integer, for use anywhere in a calculation.
- hexstr(), octstr() and
binstr(), convert integers to hexadecimal, octal or binary
strings, respectively, performing the inverse of the above.
- encode() and decode(),
convert integer to string or string to integer, respectively, via a user
supplied digit table. The base used is the size of the table array.
- compl() is provided for logical operands to
ease porting.
- ismin() and ismax() are
provided for real operands to ease porting.
- isamin() and isamax() are
provided for real operands to ease porting.
- icamin() and icamax() are
provided for complex operands to ease porting.
- pause() and stop() routines
are provided to allow customization of these functions, and to facilitate
porting of programs which rely on pause statements.
- swap() is provided for all intrinsic types
and kinds.
- rev_endian() is provided for all intrinsic
types and kinds of size greater than one byte. It reverses the order of bytes
within the object.
- rev_bits() is provided for all intrinsic
types and kinds of size equal to one byte. It reverses the order of bits within
the object.
- get_io_unit() searches all units, or a
selected range for an available unit which may be used.
Back to the Top
To download the standard_functions module, click
standard_functions. This module
depends on the standard_types module, see the portability project for information about how to make
one for your compiler. The standard_functions module also requires use of the
coco preprocessor to be compiled.
Back to the Top
To make comments or suggestions regarding
standard_functions, or any of our software, please
E-mail us. We're always happy to share
the experiences others have using our software. |