Skip to content

penf ​

Portability Environment for Fortran poor people.

Source: src/lib/penf.F90

Dependencies

Contents ​

Variables ​

NameTypeAttributesDescription
endianintegerBit ordering: Little endian (endianL), or Big endian (endianB).
is_initializedlogicalCheck the initialization of some variables that must be initialized.

Interfaces ​

bit_size ​

Overloading of the intrinsic bit_size function for computing the number of bits of (also) real and character variables.

digit ​

Compute the number of digits in decimal base of the input integer.

Module procedures: digit_I8, digit_I4, digit_I2, digit_I1

Subroutines ​

check_endian ​

Check the type of bit ordering (big or little endian) of the running architecture.

@note The result is stored into the endian global variable.

fortran
 use penf
 integer(I1P) :: bytes(1:4)
 call check_endian
 bytes = transfer(1_I4P, bytes)
 print "(L1)", (endian==endianL).eqv.(bytes(1)==1_I1P)
fortran
subroutine check_endian()

Call graph

penf_init ​

Initialize PENF's variables that are not initialized into the definition specification.

fortran
 use penf
 call penf_init
 print FI1P, BYR4P
fortran
 use penf
 print "(L1)", MaxR16P==huge(MaxR16P).and.MinR16P==-huge(MinR16P).and.smallR16P==tiny(smallR16P)
fortran
subroutine penf_init()

Call graph

penf_print ​

Print to the specified unit the PENF's environment data.

fortran
 use penf
 integer :: u
 open(newunit=u, status='scratch')
 call penf_print(u)
 close(u)
 print "(A)", 'done'
fortran
subroutine penf_print(unit, pref, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
unitinteger(kind=I4P)inLogic unit.
prefcharacter(len=*)inoptionalPrefixing string.
iostatinteger(kind=I4P)outoptionalIO error.
iomsgcharacter(len=*)outoptionalIO error message.

Call graph

Functions ​

digit_I8 ​

Compute the number of digits in decimal base of the input integer.

fortran
 use penf
 print FI4P, digit(100_I8P)

Attributes: elemental

Returns: integer(kind=I4P)

fortran
function digit_I8(n) result(digit)

Arguments

NameTypeIntentAttributesDescription
ninteger(kind=I8P)inInput integer.

digit_I4 ​

Compute the number of digits in decimal base of the input integer.

fortran
 use penf
 print FI4P, digit(100_I4P)

Attributes: elemental

Returns: integer(kind=I4P)

fortran
function digit_I4(n) result(digit)

Arguments

NameTypeIntentAttributesDescription
ninteger(kind=I4P)inInput integer.

digit_I2 ​

Compute the number of digits in decimal base of the input integer.

fortran
 use penf
 print FI4P, digit(100_I2P)

Attributes: elemental

Returns: integer(kind=I4P)

fortran
function digit_I2(n) result(digit)

Arguments

NameTypeIntentAttributesDescription
ninteger(kind=I2P)inInput integer.

digit_I1 ​

Compute the number of digits in decimal base of the input integer.

fortran
 use penf
 print FI4P, digit(100_I1P)

Attributes: elemental

Returns: integer(kind=I4P)

fortran
function digit_I1(n) result(digit)

Arguments

NameTypeIntentAttributesDescription
ninteger(kind=I1P)inInput integer.