Skip to content

foxy_xml_values ​

FoXy typed values: conversion of attribute values and tag contents into numbers and logicals.

A text is a list of tokens separated by XML blanks. Each token is converted by StringiFor (string%read_number: correctly rounded, exact range checks, no read statement, the same results with every compiler). An integer token must also be digits with an optional sign, as an XML integer: StringiFor would read 1e3 as 1000.

Logical values are the XML Schema ones: true, false, 1, 0.

Source: src/lib/foxy_xml_values.f90

Dependencies

Contents ​

Variables ​

NameTypeAttributesDescription
XML_NOT_FOUNDinteger(kind=I4P)parameteriostat of a missing tag or attribute.
XML_BAD_VALUEinteger(kind=I4P)parameteriostat of a value that is not of the requested type.
EXCERPT_LENinteger(kind=I8P)parameterMax length of a token quoted in a message.
BLANKScharacter(len=*)parameterXML blanks: space, tab, new line, CR.
FORMATTED_LENintegerparameterLength of the buffer of a value formatted by fmt.
INTEGER_CHARScharacter(len=*)parameterCharacters of integer tokens (XML integers).

Interfaces ​

to_value ​

Convert a text holding one value.

Module procedures: to_value_I1P, to_value_I2P, to_value_I4P, to_value_I8P, to_value_R4P, to_value_R8P, to_value_logical

to_values ​

Convert a text holding a list of values.

Module procedures: to_values_I1P, to_values_I2P, to_values_I4P, to_values_I8P, to_values_R4P, to_values_R8P

to_text ​

Convert a value, or a list of values, into text.

Module procedures: to_text_I1P, to_text_I2P, to_text_I4P, to_text_I8P, to_text_R4P, to_text_R8P, to_text_logical, to_text_I1P_1, to_text_I2P_1, to_text_I4P_1, to_text_I8P_1, to_text_R4P_1, to_text_R8P_1

Subroutines ​

report ​

Report a status (local variables) through the optional iostat and iomsg of a public procedure; the context of a value not converted (e.g. the attribute name) is appended to its message.

@note iomsg is left unchanged on success.

Attributes: pure

fortran
subroutine report(iostat_, iomsg_, iostat, iomsg, context)

Arguments

NameTypeIntentAttributesDescription
iostat_integer(kind=I4P)inIO status, local variable.
iomsg_character(len=*)inIO message, local variable.
iostatinteger(kind=I4P)outoptionalIO status.
iomsgcharacter(len=*)inoutoptionalIO message.
contextcharacter(len=*)inoptionalContext of the converted value.

Call graph

to_value_logical ​

Convert a text holding one logical value (true, false, 1, 0, blanks around); value is unchanged on error.

Attributes: pure

fortran
subroutine to_value_logical(text, value, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inText.
valuelogicalinoutValue.
iostatinteger(kind=I4P)outIO status.
iomsgcharacter(len=:)outallocatableIO message.

Call graph

to_value_I1P ​

Convert a text holding one integer(I1P) value; value is unchanged on error.

Attributes: pure

fortran
subroutine to_value_I1P(text, value, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inText.
valueinteger(kind=I1P)inoutValue.
iostatinteger(kind=I4P)outIO status.
iomsgcharacter(len=:)outallocatableIO message.

Call graph

to_value_I2P ​

Convert a text holding one integer(I2P) value; value is unchanged on error.

Attributes: pure

fortran
subroutine to_value_I2P(text, value, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inText.
valueinteger(kind=I2P)inoutValue.
iostatinteger(kind=I4P)outIO status.
iomsgcharacter(len=:)outallocatableIO message.

Call graph

to_value_I4P ​

Convert a text holding one integer(I4P) value; value is unchanged on error.

Attributes: pure

fortran
subroutine to_value_I4P(text, value, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inText.
valueinteger(kind=I4P)inoutValue.
iostatinteger(kind=I4P)outIO status.
iomsgcharacter(len=:)outallocatableIO message.

Call graph

to_value_I8P ​

Convert a text holding one integer(I8P) value; value is unchanged on error.

Attributes: pure

fortran
subroutine to_value_I8P(text, value, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inText.
valueinteger(kind=I8P)inoutValue.
iostatinteger(kind=I4P)outIO status.
iomsgcharacter(len=:)outallocatableIO message.

Call graph

to_value_R4P ​

Convert a text holding one real(R4P) value; value is unchanged on error.

Attributes: pure

fortran
subroutine to_value_R4P(text, value, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inText.
valuereal(kind=R4P)inoutValue.
iostatinteger(kind=I4P)outIO status.
iomsgcharacter(len=:)outallocatableIO message.

Call graph

to_value_R8P ​

Convert a text holding one real(R8P) value; value is unchanged on error.

Attributes: pure

fortran
subroutine to_value_R8P(text, value, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inText.
valuereal(kind=R8P)inoutValue.
iostatinteger(kind=I4P)outIO status.
iomsgcharacter(len=:)outallocatableIO message.

Call graph

to_values_I1P ​

Convert a text holding a list of integer(I1P) values; values is empty on error.

Attributes: pure

fortran
subroutine to_values_I1P(text, values, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inText.
valuesinteger(kind=I1P)outallocatableValues.
iostatinteger(kind=I4P)outIO status.
iomsgcharacter(len=:)outallocatableIO message.

Call graph

to_values_I2P ​

Convert a text holding a list of integer(I2P) values; values is empty on error.

Attributes: pure

fortran
subroutine to_values_I2P(text, values, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inText.
valuesinteger(kind=I2P)outallocatableValues.
iostatinteger(kind=I4P)outIO status.
iomsgcharacter(len=:)outallocatableIO message.

Call graph

to_values_I4P ​

Convert a text holding a list of integer(I4P) values; values is empty on error.

Attributes: pure

fortran
subroutine to_values_I4P(text, values, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inText.
valuesinteger(kind=I4P)outallocatableValues.
iostatinteger(kind=I4P)outIO status.
iomsgcharacter(len=:)outallocatableIO message.

Call graph

to_values_I8P ​

Convert a text holding a list of integer(I8P) values; values is empty on error.

Attributes: pure

fortran
subroutine to_values_I8P(text, values, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inText.
valuesinteger(kind=I8P)outallocatableValues.
iostatinteger(kind=I4P)outIO status.
iomsgcharacter(len=:)outallocatableIO message.

Call graph

to_values_R4P ​

Convert a text holding a list of real(R4P) values; values is empty on error.

Attributes: pure

fortran
subroutine to_values_R4P(text, values, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inText.
valuesreal(kind=R4P)outallocatableValues.
iostatinteger(kind=I4P)outIO status.
iomsgcharacter(len=:)outallocatableIO message.

Call graph

to_values_R8P ​

Convert a text holding a list of real(R8P) values; values is empty on error.

Attributes: pure

fortran
subroutine to_values_R8P(text, values, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inText.
valuesreal(kind=R8P)outallocatableValues.
iostatinteger(kind=I4P)outIO status.
iomsgcharacter(len=:)outallocatableIO message.

Call graph

to_text_I1P ​

Convert an integer(I1P) value into text: its digits, with a sign only if negative, or as formatted by fmt.

Attributes: pure

fortran
subroutine to_text_I1P(value, text, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
valueinteger(kind=I1P)inValue.
textcharacter(len=:)outallocatableText.
fmtcharacter(len=*)inoptionalFormat, e.g. (F6.3).
iostatinteger(kind=I4P)outIO status.
iomsgcharacter(len=:)outallocatableIO message.

Call graph

to_text_I2P ​

Convert an integer(I2P) value into text: its digits, with a sign only if negative, or as formatted by fmt.

Attributes: pure

fortran
subroutine to_text_I2P(value, text, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
valueinteger(kind=I2P)inValue.
textcharacter(len=:)outallocatableText.
fmtcharacter(len=*)inoptionalFormat, e.g. (F6.3).
iostatinteger(kind=I4P)outIO status.
iomsgcharacter(len=:)outallocatableIO message.

Call graph

to_text_I4P ​

Convert an integer(I4P) value into text: its digits, with a sign only if negative, or as formatted by fmt.

Attributes: pure

fortran
subroutine to_text_I4P(value, text, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
valueinteger(kind=I4P)inValue.
textcharacter(len=:)outallocatableText.
fmtcharacter(len=*)inoptionalFormat, e.g. (F6.3).
iostatinteger(kind=I4P)outIO status.
iomsgcharacter(len=:)outallocatableIO message.

Call graph

to_text_I8P ​

Convert an integer(I8P) value into text: its digits, with a sign only if negative, or as formatted by fmt.

Attributes: pure

fortran
subroutine to_text_I8P(value, text, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
valueinteger(kind=I8P)inValue.
textcharacter(len=:)outallocatableText.
fmtcharacter(len=*)inoptionalFormat, e.g. (F6.3).
iostatinteger(kind=I4P)outIO status.
iomsgcharacter(len=:)outallocatableIO message.

Call graph

to_text_R4P ​

Convert a real(R4P) value into text: the shortest one that reads back exactly (StringiFor shortest), or as formatted by fmt.

Attributes: pure

fortran
subroutine to_text_R4P(value, text, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
valuereal(kind=R4P)inValue.
textcharacter(len=:)outallocatableText.
fmtcharacter(len=*)inoptionalFormat, e.g. (F6.3).
iostatinteger(kind=I4P)outIO status.
iomsgcharacter(len=:)outallocatableIO message.

Call graph

to_text_R8P ​

Convert a real(R8P) value into text: the shortest one that reads back exactly (StringiFor shortest), or as formatted by fmt.

Attributes: pure

fortran
subroutine to_text_R8P(value, text, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
valuereal(kind=R8P)inValue.
textcharacter(len=:)outallocatableText.
fmtcharacter(len=*)inoptionalFormat, e.g. (F6.3).
iostatinteger(kind=I4P)outIO status.
iomsgcharacter(len=:)outallocatableIO message.

Call graph

to_text_logical ​

Convert a logical value into text: true or false.

Attributes: pure

fortran
subroutine to_text_logical(value, text, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
valuelogicalinValue.
textcharacter(len=:)outallocatableText.
iostatinteger(kind=I4P)outIO status.
iomsgcharacter(len=:)outallocatableIO message.

to_text_I1P_1 ​

Convert a list of integer(I1P) values into text, separated by one space (each as to_text of a scalar).

Attributes: pure

fortran
subroutine to_text_I1P_1(value, text, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
valueinteger(kind=I1P)inValues.
textcharacter(len=:)outallocatableText.
fmtcharacter(len=*)inoptionalFormat of each value, e.g. (F6.3).
iostatinteger(kind=I4P)outIO status.
iomsgcharacter(len=:)outallocatableIO message.

Call graph

to_text_I2P_1 ​

Convert a list of integer(I2P) values into text, separated by one space (each as to_text of a scalar).

Attributes: pure

fortran
subroutine to_text_I2P_1(value, text, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
valueinteger(kind=I2P)inValues.
textcharacter(len=:)outallocatableText.
fmtcharacter(len=*)inoptionalFormat of each value, e.g. (F6.3).
iostatinteger(kind=I4P)outIO status.
iomsgcharacter(len=:)outallocatableIO message.

Call graph

to_text_I4P_1 ​

Convert a list of integer(I4P) values into text, separated by one space (each as to_text of a scalar).

Attributes: pure

fortran
subroutine to_text_I4P_1(value, text, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
valueinteger(kind=I4P)inValues.
textcharacter(len=:)outallocatableText.
fmtcharacter(len=*)inoptionalFormat of each value, e.g. (F6.3).
iostatinteger(kind=I4P)outIO status.
iomsgcharacter(len=:)outallocatableIO message.

Call graph

to_text_I8P_1 ​

Convert a list of integer(I8P) values into text, separated by one space (each as to_text of a scalar).

Attributes: pure

fortran
subroutine to_text_I8P_1(value, text, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
valueinteger(kind=I8P)inValues.
textcharacter(len=:)outallocatableText.
fmtcharacter(len=*)inoptionalFormat of each value, e.g. (F6.3).
iostatinteger(kind=I4P)outIO status.
iomsgcharacter(len=:)outallocatableIO message.

Call graph

to_text_R4P_1 ​

Convert a list of real(R4P) values into text, separated by one space (each as to_text of a scalar).

Attributes: pure

fortran
subroutine to_text_R4P_1(value, text, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
valuereal(kind=R4P)inValues.
textcharacter(len=:)outallocatableText.
fmtcharacter(len=*)inoptionalFormat of each value, e.g. (F6.3).
iostatinteger(kind=I4P)outIO status.
iomsgcharacter(len=:)outallocatableIO message.

Call graph

to_text_R8P_1 ​

Convert a list of real(R8P) values into text, separated by one space (each as to_text of a scalar).

Attributes: pure

fortran
subroutine to_text_R8P_1(value, text, fmt, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
valuereal(kind=R8P)inValues.
textcharacter(len=:)outallocatableText.
fmtcharacter(len=*)inoptionalFormat of each value, e.g. (F6.3).
iostatinteger(kind=I4P)outIO status.
iomsgcharacter(len=:)outallocatableIO message.

Call graph

fail ​

Report a token that is not a value: its first character not allowed, or the whole token.

Attributes: pure

fortran
subroutine fail(text, what, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inToken.
whatcharacter(len=*)inKind of value, integer or real.
iostatinteger(kind=I4P)outIO status.
iomsgcharacter(len=:)outallocatableIO message.

Call graph

next_token ​

Find the next token of a text after the position last: first and last are its positions, first is 0 if there are no more tokens.

Attributes: pure

fortran
subroutine next_token(text, last, first)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inText.
lastinteger(kind=I8P)inoutLast position of the previous token on input, of the next token on output.
firstinteger(kind=I8P)outFirst position of the next token, 0 if none.

Call graph

Functions ​

excerpt ​

Return a token, cut to EXCERPT_LEN characters, to quote it in a message.

Attributes: pure

Returns: character(len=:)

fortran
function excerpt(token) result(quoted)

Arguments

NameTypeIntentAttributesDescription
tokencharacter(len=*)inToken.

Call graph

tokens_number ​

Return the number of blank-separated tokens of a text.

Attributes: pure

Returns: integer(kind=I8P)

fortran
function tokens_number(text) result(n)

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)inText.

Call graph

is_overflow ​

Return true if a formatted value is all asterisks: the value does not fit the field of the format.

Attributes: pure

Returns: logical

fortran
function is_overflow(buffer) result(is_over)

Arguments

NameTypeIntentAttributesDescription
buffercharacter(len=*)inFormatted value.

Call graph