Skip to content

Expanded stop_and_print functionality and documentation

Choose a tag to compare

@rouson rouson released this 02 Jul 23:45
· 75 commits to main since this release
632dbbe

What's New

This release expands the recently added capability for automatically- or user-formatted printing of various types and ranks of data via character stop codes, including inside pure procedures. The pure subroutine below from example/pure-printing/pure-stop-and-print.F90 demonstrates three types/ranks of printable entities: a file_t object; an intrinsic array; and an object of a type that extends Julienne's writable_t abstract type and defines the the latter type's write(formatted) generic binding.

  pure subroutine pure_subroutine(print_array, print_derived_type, file)
    logical, intent(in) :: print_array, print_derived_type
    type(file_t), intent(in), optional :: file
    if (present(file))      call stop_and_print(header = "______________", data = file, footer = "______________")
    if (print_array)        call stop_and_print(reshape([111,211,121,221, 112,212,122,222], [2,2,2]))
    if (print_derived_type) call stop_and_print(write_stuff_t())
  end subroutine

For example, if the file is not present, and print_array=.true., the above subroutine prints the following via the stop code in an error stop statement when run with the fpm command shown:

% fpm run --example pure-stop-and-print --compiler flang --profile release  -- --array
fpm: Entering directory '/Users/rouson/Repositories/julienne'
Project is up to date
Fortran ERROR STOP: 
111,121
211,221

112,122
212,222

<ERROR> Execution for object " pure-stop-and-print " returned exit code  1
<ERROR> *cmd_run*:stopping due to failed executions
STOP 1

What's Changed

Full Changelog: 4.0.0...4.1.0