Reading formatted text input. More...
Classes | |
struct | inout_file_t |
An input file with extra data for printing messages. More... | |
struct | inout_line_t |
A single line of input data, split at whitespace. More... | |
Functions | |
subroutine | inout_open_read (filename, file) |
Open an inout file for reading. | |
subroutine | inout_open_write (filename, file) |
Open an inout file for writing. | |
subroutine | inout_close (file) |
Close an inout file. | |
subroutine | inout_line_alloc (n_data, inout_line) |
Allocates memory for an inout_line. | |
subroutine | inout_line_free (inout_line) |
Frees all storage. | |
subroutine | inout_line_copy (from_line, to_line) |
Copies a inout_line. | |
subroutine | inout_read_line_raw (file, line, eof) |
Read a single line from a inout file, signaling if we have hit EOF. | |
subroutine | inout_strip_comment (line) |
Strip the comments from a line. Comments are everything after the first # character. | |
subroutine | inout_tabs_to_spaces (line) |
Expand all tabs in a line into single spaces (one tab makes one space). | |
subroutine | inout_strip_leading_spaces (line) |
Strip leading spaces from a string. | |
subroutine | inout_read_next_data_line (file, line, eof) |
Read the next line from the inout file that contains useful data (stripping comments and blank lines). | |
subroutine | inout_read_line (file, line, eof) |
Read a inout_line from the inout_file. | |
subroutine | inout_read_line_no_eof (file, line) |
Read a inout_line from the inout_file. This will always succeed or error out, so should only be called if we know there should be a valid line coming. | |
subroutine | inout_read_line_list (file, max_lines, line_list) |
Read a list of inout_lines from a file, stopping at max_lines or EOF, whichever comes first. | |
subroutine | inout_read_line_array (file, max_lines, line_array) |
Read an array of inout_lines from a file, stopping at max_lines or EOF. All lines must have the same number of elements. | |
subroutine | inout_check_line_name (file, line, name) |
Check that the name of the line data is as given. | |
subroutine | inout_check_name (file, name, read_name) |
Checks that the read_name is the same as name. | |
subroutine | inout_check_line_length (file, line, length) |
Check that the length of the line data is as given. | |
subroutine | inout_check_read_iostat (file, ios, type) |
Check the IOSTAT and error if it is bad. | |
integer | inout_string_to_integer (file, string) |
Convert a string to an integer. | |
real *8 | inout_string_to_real (file, string) |
Convert a string to an real. | |
logical | inout_string_to_logical (file, string) |
Convert a string to an logical. | |
subroutine | inout_read_integer (file, name, var) |
Read an integer from a inout file that must have the given name. | |
subroutine | inout_read_real (file, name, var) |
Read a real number from a inout file that must have the given name. | |
subroutine | inout_read_logical (file, name, var) |
Read a logical from a inout file that must have a given name. | |
subroutine | inout_read_string (file, name, var) |
Read a string from a inout file that must have a given name. | |
subroutine | inout_read_complex (file, name, var) |
Read a complex number from a inout file that must have the given name. | |
subroutine | inout_check_index (file, index, check_index) |
Check that indices are equal as expected. | |
subroutine | inout_read_indexed_integer (file, index, var) |
Read an integer from a inout file that must have the given index. | |
subroutine | inout_read_indexed_real (file, index, var) |
Read a real from a inout file that must have the given index. | |
subroutine | inout_read_indexed_logical (file, index, var) |
Read a logical from a inout file that must have a given index. | |
subroutine | inout_read_indexed_string (file, index, var) |
Read a string from a inout file that must have a given index. | |
subroutine | inout_read_indexed_2d_real (file, index1, index2, var) |
Read a real from a inout file that must have the given indices. | |
subroutine | inout_read_integer_array (file, name, vals) |
Read an integer array. | |
subroutine | inout_read_real_array (file, name, vals) |
Read a real array. | |
subroutine | inout_read_logical_array (file, name, vals) |
Read a logical array. | |
subroutine | inout_read_string_array (file, name, vals) |
Read a string array. | |
subroutine | inout_read_real_array_2d (file, name, vals) |
Read a real 2d array. | |
subroutine | inout_read_real_named_array (file, max_lines, names, vals) |
Read an array of named lines with real data. All lines must have the same number of data elements. | |
subroutine | inout_read_timed_real_array (file, line_name, name, times, vals) |
Read an a time-indexed array of real data. | |
subroutine | inout_write_comment (file, comment) |
Write a comment string to an inout file. | |
subroutine | inout_check_comment (file, comment) |
Write a comment string to an inout file. | |
subroutine | inout_write_integer (file, name, var) |
Write an integer to an inout file. | |
subroutine | inout_write_real (file, name, var) |
Write a real to an inout file. | |
subroutine | inout_write_logical (file, name, var) |
Write a logical to an inout file. | |
subroutine | inout_write_string (file, name, var) |
Write a string to an inout file. | |
subroutine | inout_write_complex (file, name, var) |
Write a complex to an inout file. | |
subroutine | inout_write_indexed_integer (file, name, index, var) |
Write an integer to an inout file. | |
subroutine | inout_write_indexed_real (file, name, index, var) |
Write a real to an inout file. | |
subroutine | inout_write_indexed_logical (file, name, index, var) |
Write a logical to an inout file. | |
subroutine | inout_write_indexed_string (file, name, index, var) |
Write a string to an inout file. | |
subroutine | inout_write_indexed_complex (file, name, index, var) |
Write a complex to an inout file. | |
subroutine | inout_write_unnamed_real (file, var) |
Write a real to an inout file. | |
subroutine | inout_write_integer_array (file, name, vals) |
Write an integer array. | |
subroutine | inout_write_real_array (file, name, vals) |
Write a real array. | |
subroutine | inout_write_logical_array (file, name, vals) |
Write a logical array. | |
subroutine | inout_write_string_array (file, name, vals) |
Write a character array. | |
subroutine | inout_write_real_array_2d (file, name, vals) |
Write a real 2d array. | |
Variables | |
integer, parameter | MAX_LINE_LEN = 10000 |
Maximum size of a single line. | |
integer, parameter | MAX_VAR_LEN = 300 |
Maximum size of a variable. | |
integer, parameter | MAX_LIST_LINES = 1000 |
Maximum number of lines in an array. |
Reading formatted text input.
subroutine pmc_inout::inout_check_comment | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(in) | comment | |||
) |
Write a comment string to an inout file.
file | Inout file. | |
comment | Comment string. |
subroutine pmc_inout::inout_check_index | ( | type(inout_file_t),intent(in) | file, | |
integer,intent(in) | index, | |||
integer,intent(in) | check_index | |||
) |
Check that indices are equal as expected.
file | Inout file read from. | |
index | Index that was read. | |
check_index | Expected index. |
subroutine pmc_inout::inout_check_line_length | ( | type(inout_file_t),intent(in) | file, | |
type(inout_line_t),intent(in) | line, | |||
integer,intent(in) | length | |||
) |
Check that the length of the line data is as given.
file | Inout file. | |
line | Inout line. | |
length | Expected data length. |
subroutine pmc_inout::inout_check_line_name | ( | type(inout_file_t),intent(in) | file, | |
type(inout_line_t),intent(in) | line, | |||
character(len=*),intent(in) | name | |||
) |
Check that the name of the line data is as given.
file | Inout file. | |
line | Inout line. | |
name | Expected line name. |
subroutine pmc_inout::inout_check_name | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(in) | name, | |||
character(len=*),intent(in) | read_name | |||
) |
Checks that the read_name is the same as name.
file | Inout file. | |
name | Name that we should have. | |
read_name | Name that we do have. |
subroutine pmc_inout::inout_check_read_iostat | ( | type(inout_file_t),intent(in) | file, | |
integer,intent(in) | ios, | |||
character(len=*),intent(in) | type | |||
) |
Check the IOSTAT and error if it is bad.
file | Inout file. | |
ios | Iostat result. | |
type | Type being read during error. |
subroutine pmc_inout::inout_close | ( | type(inout_file_t),intent(in) | file | ) |
Close an inout file.
file | Inout file. |
subroutine pmc_inout::inout_line_alloc | ( | integer,intent(in) | n_data, | |
type(inout_line_t),intent(inout) | inout_line | |||
) |
Allocates memory for an inout_line.
n_data | Number of data items. | |
inout_line | Struct to alloc. |
subroutine pmc_inout::inout_line_copy | ( | type(inout_line_t),intent(in) | from_line, | |
type(inout_line_t),intent(out) | to_line | |||
) |
Copies a inout_line.
from_line | Original line. | |
to_line | Destination, already alloced. |
subroutine pmc_inout::inout_line_free | ( | type(inout_line_t),intent(inout) | inout_line | ) |
Frees all storage.
inout_line | Struct to free. |
subroutine pmc_inout::inout_open_read | ( | character(len=*),intent(in) | filename, | |
type(inout_file_t),intent(out) | file | |||
) |
Open an inout file for reading.
filename | Name of file to open. | |
file | Inout file. |
subroutine pmc_inout::inout_open_write | ( | character(len=*),intent(in) | filename, | |
type(inout_file_t),intent(out) | file | |||
) |
Open an inout file for writing.
filename | Name of file to open. | |
file | Inout file. |
subroutine pmc_inout::inout_read_complex | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(in) | name, | |||
complex*16,intent(out) | var | |||
) |
Read a complex number from a inout file that must have the given name.
file | Inout file. | |
name | Name. | |
var | Variable to store data. |
subroutine pmc_inout::inout_read_indexed_2d_real | ( | type(inout_file_t),intent(inout) | file, | |
integer,intent(in) | index1, | |||
integer,intent(in) | index2, | |||
real*8,intent(out) | var | |||
) |
Read a real from a inout file that must have the given indices.
file | Inout file. | |
index1 | Expected first index. | |
index2 | Expected second index. | |
var | Variable to store data. |
subroutine pmc_inout::inout_read_indexed_integer | ( | type(inout_file_t),intent(inout) | file, | |
integer,intent(in) | index, | |||
integer,intent(out) | var | |||
) |
Read an integer from a inout file that must have the given index.
file | Inout file. | |
index | Expected index. | |
var | Variable to store data. |
subroutine pmc_inout::inout_read_indexed_logical | ( | type(inout_file_t),intent(inout) | file, | |
integer,intent(in) | index, | |||
logical,intent(out) | var | |||
) |
Read a logical from a inout file that must have a given index.
file | Inout file. | |
index | Expected index. | |
var | Variable to store data. |
subroutine pmc_inout::inout_read_indexed_real | ( | type(inout_file_t),intent(inout) | file, | |
integer,intent(in) | index, | |||
real*8,intent(out) | var | |||
) |
Read a real from a inout file that must have the given index.
file | Inout file. | |
index | Expected index. | |
var | Variable to store data. |
subroutine pmc_inout::inout_read_indexed_string | ( | type(inout_file_t),intent(inout) | file, | |
integer,intent(in) | index, | |||
character(len=*),intent(out) | var | |||
) |
Read a string from a inout file that must have a given index.
file | Inout file. | |
index | Expected index. | |
var | Variable to store data. |
subroutine pmc_inout::inout_read_integer | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(in) | name, | |||
integer,intent(out) | var | |||
) |
Read an integer from a inout file that must have the given name.
file | Inout file. | |
name | Name. | |
var | Variable to store data. |
subroutine pmc_inout::inout_read_integer_array | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(in) | name, | |||
integer,dimension(:),pointer | vals | |||
) |
Read an integer array.
file | Inout file. | |
name | Name. | |
vals | Data values. |
subroutine pmc_inout::inout_read_line | ( | type(inout_file_t),intent(inout) | file, | |
type(inout_line_t),intent(out) | line, | |||
logical,intent(out) | eof | |||
) |
Read a inout_line from the inout_file.
file | Inout file. | |
line | Inout line. | |
eof | True if EOF encountered. |
subroutine pmc_inout::inout_read_line_array | ( | type(inout_file_t),intent(inout) | file, | |
integer,intent(in) | max_lines, | |||
type(inout_line_t),dimension(:),pointer | line_array | |||
) |
Read an array of inout_lines from a file, stopping at max_lines or EOF. All lines must have the same number of elements.
file | Inout file. | |
max_lines | Max lines to read (0 = no max). | |
line_array | Array of inout_lines,. |
subroutine pmc_inout::inout_read_line_list | ( | type(inout_file_t),intent(inout) | file, | |
integer,intent(in) | max_lines, | |||
type(inout_line_t),dimension(:),pointer | line_list | |||
) |
Read a list of inout_lines from a file, stopping at max_lines or EOF, whichever comes first.
file | Inout file. | |
max_lines | Max lines to read (0 = no max). | |
line_list | List of inout_lines,. |
subroutine pmc_inout::inout_read_line_no_eof | ( | type(inout_file_t),intent(inout) | file, | |
type(inout_line_t),intent(out) | line | |||
) |
Read a inout_line from the inout_file. This will always succeed or error out, so should only be called if we know there should be a valid line coming.
file | Inout file. | |
line | Inout line. |
subroutine pmc_inout::inout_read_line_raw | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(out) | line, | |||
logical,intent(out) | eof | |||
) |
Read a single line from a inout file, signaling if we have hit EOF.
file | Inout file. | |
line | Complete line read. | |
eof | True if at EOF. |
subroutine pmc_inout::inout_read_logical | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(in) | name, | |||
logical,intent(out) | var | |||
) |
Read a logical from a inout file that must have a given name.
file | Inout file. | |
name | Name. | |
var | Variable to store data. |
subroutine pmc_inout::inout_read_logical_array | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(in) | name, | |||
logical,dimension(:),pointer | vals | |||
) |
Read a logical array.
file | Inout file. | |
name | Name. | |
vals | Data values. |
subroutine pmc_inout::inout_read_next_data_line | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(out) | line, | |||
logical,intent(out) | eof | |||
) |
Read the next line from the inout file that contains useful data (stripping comments and blank lines).
file | Inout file. | |
line | Complete line read. | |
eof | True if EOF encountered. |
subroutine pmc_inout::inout_read_real | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(in) | name, | |||
real*8,intent(out) | var | |||
) |
Read a real number from a inout file that must have the given name.
file | Inout file. | |
name | Name. | |
var | Variable to store data. |
subroutine pmc_inout::inout_read_real_array | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(in) | name, | |||
real*8,dimension(:),pointer | vals | |||
) |
Read a real array.
file | Inout file. | |
name | Name. | |
vals | Data values. |
subroutine pmc_inout::inout_read_real_array_2d | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(in) | name, | |||
real*8,dimension(:,:),pointer | vals | |||
) |
Read a real 2d array.
file | Inout file. | |
name | Name. | |
vals | Data values. |
subroutine pmc_inout::inout_read_real_named_array | ( | type(inout_file_t),intent(inout) | file, | |
integer,intent(in) | max_lines, | |||
character(len=MAX_VAR_LEN),dimension(:),pointer | names, | |||
real*8,dimension(:,:),pointer | vals | |||
) |
Read an array of named lines with real data. All lines must have the same number of data elements.
file | Inout file. | |
max_lines | Max lines to read (0 = no max). | |
names | Names of lines. | |
vals | Data values. |
subroutine pmc_inout::inout_read_string | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(in) | name, | |||
character(len=*),intent(out) | var | |||
) |
Read a string from a inout file that must have a given name.
file | Inout file. | |
name | Name. | |
var | Variable to store data. |
subroutine pmc_inout::inout_read_string_array | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(in) | name, | |||
character(len=*),dimension(:),pointer | vals | |||
) |
Read a string array.
file | Inout file. | |
name | Name. | |
vals | Data values. |
subroutine pmc_inout::inout_read_timed_real_array | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(in) | line_name, | |||
character(len=*),intent(in) | name, | |||
real*8,dimension(:),pointer | times, | |||
real*8,dimension(:),pointer | vals | |||
) |
Read an a time-indexed array of real data.
file | Inout file. | |
line_name | Name of line for filename. | |
name | Variable name. | |
times | Names of lines. | |
vals | Data values. |
integer pmc_inout::inout_string_to_integer | ( | type(inout_file_t),intent(in) | file, | |
character(len=*),intent(in) | string | |||
) |
Convert a string to an integer.
file | Inout file. | |
string | String to convert. |
logical pmc_inout::inout_string_to_logical | ( | type(inout_file_t),intent(in) | file, | |
character(len=*),intent(in) | string | |||
) |
Convert a string to an logical.
file | Inout file. | |
string | String to convert. |
real*8 pmc_inout::inout_string_to_real | ( | type(inout_file_t),intent(in) | file, | |
character(len=*),intent(in) | string | |||
) |
Convert a string to an real.
file | Inout file. | |
string | String to convert. |
subroutine pmc_inout::inout_strip_comment | ( | character(len=*),intent(inout) | line | ) |
Strip the comments from a line. Comments are everything after the first # character.
line | Complete input line. |
subroutine pmc_inout::inout_strip_leading_spaces | ( | character(len=*),intent(inout) | line | ) |
Strip leading spaces from a string.
line | Complete input line. |
subroutine pmc_inout::inout_tabs_to_spaces | ( | character(len=*),intent(inout) | line | ) |
Expand all tabs in a line into single spaces (one tab makes one space).
line | Complete input line. |
subroutine pmc_inout::inout_write_comment | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(in) | comment | |||
) |
Write a comment string to an inout file.
file | Inout file. | |
comment | Comment string. |
subroutine pmc_inout::inout_write_complex | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(in) | name, | |||
complex*16,intent(in) | var | |||
) |
Write a complex to an inout file.
file | Inout file. | |
name | Name. | |
var | Variable to write. |
subroutine pmc_inout::inout_write_indexed_complex | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(in) | name, | |||
integer,intent(in) | index, | |||
complex*16,intent(in) | var | |||
) |
Write a complex to an inout file.
file | Inout file. | |
name | Name. | |
index | Index to write. | |
var | Variable to write. |
subroutine pmc_inout::inout_write_indexed_integer | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(in) | name, | |||
integer,intent(in) | index, | |||
integer,intent(in) | var | |||
) |
Write an integer to an inout file.
file | Inout file. | |
name | Name. | |
index | Index to write. | |
var | Variable to write. |
subroutine pmc_inout::inout_write_indexed_logical | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(in) | name, | |||
integer,intent(in) | index, | |||
logical,intent(in) | var | |||
) |
Write a logical to an inout file.
file | Inout file. | |
name | Name. | |
index | Index to write. | |
var | Variable to write. |
subroutine pmc_inout::inout_write_indexed_real | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(in) | name, | |||
integer,intent(in) | index, | |||
real*8,intent(in) | var | |||
) |
Write a real to an inout file.
file | Inout file. | |
name | Name. | |
index | Index to write. | |
var | Variable to write. |
subroutine pmc_inout::inout_write_indexed_string | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(in) | name, | |||
integer,intent(in) | index, | |||
character(len=*),intent(in) | var | |||
) |
Write a string to an inout file.
file | Inout file. | |
name | Name. | |
index | Index to write. | |
var | Variable to write. |
subroutine pmc_inout::inout_write_integer | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(in) | name, | |||
integer,intent(in) | var | |||
) |
Write an integer to an inout file.
file | Inout file. | |
name | Name. | |
var | Variable to write. |
subroutine pmc_inout::inout_write_integer_array | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(in) | name, | |||
integer,dimension(:),intent(in) | vals | |||
) |
Write an integer array.
file | Inout file. | |
name | Variable name. | |
vals | Values to write. |
subroutine pmc_inout::inout_write_logical | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(in) | name, | |||
logical,intent(in) | var | |||
) |
Write a logical to an inout file.
file | Inout file. | |
name | Name. | |
var | Variable to write. |
subroutine pmc_inout::inout_write_logical_array | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(in) | name, | |||
logical,dimension(:),intent(in) | vals | |||
) |
Write a logical array.
file | Inout file. | |
name | Variable name. | |
vals | Values to write. |
subroutine pmc_inout::inout_write_real | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(in) | name, | |||
real*8,intent(in) | var | |||
) |
Write a real to an inout file.
file | Inout file. | |
name | Name. | |
var | Variable to write. |
subroutine pmc_inout::inout_write_real_array | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(in) | name, | |||
real*8,dimension(:),intent(in) | vals | |||
) |
Write a real array.
file | Inout file. | |
name | Variable name. | |
vals | Values to write. |
subroutine pmc_inout::inout_write_real_array_2d | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(in) | name, | |||
real*8,dimension(:,:),intent(in) | vals | |||
) |
Write a real 2d array.
file | Inout file. | |
name | Variable name. | |
vals | Values to write. |
subroutine pmc_inout::inout_write_string | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(in) | name, | |||
character(len=*),intent(in) | var | |||
) |
Write a string to an inout file.
file | Inout file. | |
name | Name. | |
var | Variable to write. |
subroutine pmc_inout::inout_write_string_array | ( | type(inout_file_t),intent(inout) | file, | |
character(len=*),intent(in) | name, | |||
character(len=*),dimension(:),intent(in) | vals | |||
) |
Write a character array.
file | Inout file. | |
name | Variable name. | |
vals | Values to write. |
subroutine pmc_inout::inout_write_unnamed_real | ( | type(inout_file_t),intent(inout) | file, | |
real*8,intent(in) | var | |||
) |
Write a real to an inout file.
file | Inout file. | |
var | Variable to write. |
integer,parameter pmc_inout::MAX_LINE_LEN = 10000 |
Maximum size of a single line.
integer,parameter pmc_inout::MAX_LIST_LINES = 1000 |
Maximum number of lines in an array.
integer,parameter pmc_inout::MAX_VAR_LEN = 300 |
Maximum size of a variable.