Stop and print#191
Conversation
This commit adds a pure stop_and_print subroutine and a corresponding unit test. The new subroutine facilitates printing string_t objects, including the results of string_t expressions, during error termination. Example Usage: call stop_and_print( "array = " // string_t( [1,2,3,4] ) )
This commit works around several build-time and runtime gfortran conpiler bugs.
The character_stop_code subroutine is public only for purposes of calling it from thetest suite so there's no need to have it in the public interface (julienne_m).
This commit supports using user-defined derived-type output (UDDTO) to create stop codes for derived types that extend the new writable_t abstract type, which has - A write_formatted deferred binding that obligates child types to support UDDTO, - A private maxlen_ component that sets the maximum stop-code length, - A maxlen type-bound function that returns maxlen_, and - A set_maxlen type-bound subroutine that sets maxlen_. This commit also includes a corresponding unit test.
This commit makes the command_line_t argument_present type-bound function's name a generic interface with two corresponding specific procedures: 1. character_argument_present (renamed from argument_present) 2. string_argument_present (new) The first function still has a character-array dummy argument with fixed-length elements as required by the standard. The second function allows for ragged-edged arrays of character variables by accepting a string_t array dummy argument.
This commit makes the command_line_t flag_value type-bound function's name a generic binding with two corresponding specific procedures: 1. character_flag_value (renamed from flag_value) 2. string_flag_value (new) The first function still has a character-array dummy argument. The second function accepts a string_t dummy argument.
This commit introduces the pure-stop-and-print.F90 example program,
which deonstrates the printing of a 2D integeray array, a derived
type, or a text file.
Usage:
fpm run \
--example pure-stop-and-print \
--compiler flang --profile release \
-- [-h|--help] | [--file <name>] | [--array] | [--derived-type]
where pipes (|) separate alternatives, square brackets ([]) delimit
optional arguments, and angular brackets (<>) delimit user input.
This commit updates 1. `example/README.md` 2. `pure-printing/README.md` with descriptions of the use of Julienne's `stop_and_print` utility.
Gfortran rejects valid code containing a function invocation as a stop code. This has been reported as GCC issue 126018 at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126018.
Replace `error stop` with `internal_error_stop`
|
@bonachea it appears the all |
I agree with your assessment of the symptoms, but I strongly disagree that we should jump straight to amputation as the only possible treatment. Let's discuss later today. |
| submodule(julienne_stop_and_print_m) julienne_stop_and_print_s | ||
| use julienne_string_m, only : operator(.csv.), operator(.separatedBy.) | ||
| use julienne_file_m, only : file_t | ||
| use julienne_multi_image_m, only : internal_error_stop |
There was a problem hiding this comment.
At least some of the failures appear to be caused by importing this symbol in a submodule after it has already been imported in the enclosing module. This is unnecessary and an anti-pattern that is known to break some older some compilers, so please remove the redundant use statements.
| use julienne_multi_image_m, only : internal_error_stop |
| specific subroutines: | ||
|
|
||
| 1. One with a Julienne `string_t` dummy argument and | ||
| 2. Another with `character` and unlimited-polymorphic/assumed-rank dummy arugments. |
There was a problem hiding this comment.
| 2. Another with `character` and unlimited-polymorphic/assumed-rank dummy arugments. | |
| 2. Another with `character` and unlimited-polymorphic/assumed-rank dummy arguments. |
|
|
||
| ### Printing a text file | ||
|
|
||
| The following command prints this repository's `fpm` mannifest: `fpm.toml`. |
There was a problem hiding this comment.
| The following command prints this repository's `fpm` mannifest: `fpm.toml`. | |
| The following command prints this repository's `fpm` manifest: `fpm.toml`. |
There was a problem hiding this comment.
Given the complexity of the new example, I think we should look into getting it into CI.
This doesn't necessarily block this PR, but it makes me nervous to have over 250 lines of example code with zero automated coverage to detect regressions and bit-rot.
No description provided.