Skip to content

Commit 51bedb4

Browse files
committed
Merge branch 'master' of https://github.com/fortran-lang/stdlib
2 parents 65eb03c + f84f059 commit 51bedb4

12 files changed

+706
-350
lines changed

.github/workflows/ci_windows.yml

+79
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,82 @@ jobs:
4141
with:
4242
name: WindowsCMakeTestlog
4343
path: build/Testing/Temporary/LastTest.log
44+
45+
msys2-build:
46+
runs-on: windows-latest
47+
strategy:
48+
fail-fast: false
49+
matrix:
50+
include: [
51+
{ msystem: MSYS, arch: x86_64 },
52+
{ msystem: MINGW64, arch: x86_64 },
53+
{ msystem: MINGW32, arch: i686 }
54+
]
55+
defaults:
56+
run:
57+
shell: msys2 {0}
58+
steps:
59+
- uses: actions/checkout@v2
60+
61+
- name: Setup MinGW native environment
62+
uses: msys2/setup-msys2@v2
63+
if: contains(matrix.msystem, 'MINGW')
64+
with:
65+
msystem: ${{ matrix.msystem }}
66+
update: false
67+
install: >-
68+
git
69+
mingw-w64-${{ matrix.arch }}-gcc
70+
mingw-w64-${{ matrix.arch }}-gcc-fortran
71+
mingw-w64-${{ matrix.arch }}-python
72+
mingw-w64-${{ matrix.arch }}-python-pip
73+
mingw-w64-${{ matrix.arch }}-cmake
74+
mingw-w64-${{ matrix.arch }}-ninja
75+
76+
- name: Setup msys POSIX environment
77+
uses: msys2/setup-msys2@v2
78+
if: contains(matrix.msystem, 'MSYS')
79+
with:
80+
msystem: MSYS
81+
update: false
82+
install: >-
83+
git
84+
gcc
85+
gcc-fortran
86+
python
87+
python-pip
88+
cmake
89+
ninja
90+
91+
- name: Install fypp
92+
run: pip install fypp
93+
94+
- run: >-
95+
cmake -G Ninja
96+
-DCMAKE_SH="CMAKE_SH-NOTFOUND"
97+
-Wdev
98+
-B build
99+
-DCMAKE_BUILD_TYPE=Debug
100+
-DCMAKE_Fortran_FLAGS_DEBUG="-Wall -Wextra -Wimplicit-interface -fPIC -g -fcheck=all -fbacktrace"
101+
-DCMAKE_MAXIMUM_RANK=4
102+
env:
103+
FC: gfortran
104+
CC: gcc
105+
CXX: g++
106+
107+
- name: CMake build
108+
run: cmake --build build --parallel
109+
110+
- name: catch build fail
111+
run: cmake --build build --verbose --parallel 1
112+
if: failure()
113+
114+
- name: CTest
115+
run: ctest --output-on-failure --parallel -V -LE quadruple_precision
116+
working-directory: build
117+
118+
- uses: actions/upload-artifact@v1
119+
if: failure()
120+
with:
121+
name: WindowsCMakeTestlog
122+
path: build/Testing/Temporary/LastTest.log

README.md

+19
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,25 @@ Alternatively, you can build using provided Makefiles:
6666
make -f Makefile.manual
6767
```
6868

69+
## Limiting the maximum rank of generated procedures
70+
71+
Stdlib's preprocessor (fypp) by default generates specific procedures for arrays of all ranks, up to rank 15.
72+
This can result in long compilation times and, on some computers, exceeding available memory.
73+
If you know that you won't need all 15 ranks, you can specify the maximum rank for which the specific procedures will be generated.
74+
For example, with CMake:
75+
76+
```sh
77+
cmake -B build -DCMAKE_MAXIMUM_RANK=4
78+
cmake --build build
79+
cmake --build build --target test
80+
```
81+
or as follows with `make`:
82+
83+
```sh
84+
make -f Makefile.manual FYPPFLAGS=-DMAXRANK=4
85+
```
86+
Note that currently the minimum value for maximum rank is 4.
87+
6988
## Documentation
7089

7190
Documentation is a work in progress (see issue #4) but is currently available at https://stdlib.fortran-lang.org.

doc/specs/stdlib_logger.md

+52-18
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,20 @@ title: logger
88
## Introduction
99

1010
This module defines a derived type, its methods, a variable, and
11-
constants to be used for the reporting of errors and other
12-
information. The derived type, `logger_type`, is to be used to define
13-
both global and local logger variables. The `logger_type` methods serve
14-
to configure the loggers and use the logger variables to report
15-
messages to a variable specific list of I/O units termed
16-
`log_units`. The variable, `global_logger`, of type `logger_type`, is
17-
intended to serve as the default global logger. The constants serve as
18-
error flags returned by the optional integer `stat` argument.
11+
constants to be used for the reporting of errors, displaying messages,
12+
and other information. The derived type, `logger_type`, is to be used
13+
to define both global and local logger variables. The `logger_type`
14+
methods serve to configure the loggers and use the logger variables to
15+
report messages to a variable specific list of I/O units termed
16+
`log_units`. The variable, `global_logger`, of type `logger_type`,
17+
is intended to serve as the default global logger. The constants serve
18+
as error flags returned by the optional integer `stat` argument.
1919

2020
The logger variables have the option to:
2121

2222
* change which units receive the log messages;
2323
* report which units receive the log messages;
24+
* select which types of messages are logged;
2425
* precede messages by a blank line;
2526
* precede messages by a time stamp of the form
2627
`yyyy-mm-dd hh:mm:ss.sss`;
@@ -64,6 +65,18 @@ Error Code | Description
6465
`unopened_in_error` | the unit was not opened
6566
`write_fault` | one of the writes to `log_units` failed
6667

68+
The module also defines eight distinct public integer constants for
69+
selecting the messages that are logged. These constants, termed
70+
severity levels, are (sorted following their increasing order of
71+
severity): `all_level`, `debug_level`, `information_level`,
72+
`warning_level`, `error_level`, `io_error_level`, `text_error_level`,
73+
and `none_level`.
74+
All log messages with a level (e.g., `debug_level`) lower than a
75+
specified severity level (e.g., `information_level`) will be ignored.
76+
The levels `error_level` and `io_error_level` have the same severity.
77+
The default severity level is `information_level`.
78+
79+
6780
## The derived type: logger_type
6881

6982
### Status
@@ -81,14 +94,15 @@ significant events encountered during the execution of a program.
8194

8295
### Private attributes
8396

84-
| Attribute | Type | Description | Initial value |
85-
|------------------|---------------|-------------------------------------------------|--------------|
86-
| `add_blank_line` | Logical | Flag to precede output with a blank line | `.false.` |
87-
| `indent_lines` | Logical | Flag to indent subsequent lines by four columns | `.true.` |
88-
| `log_units` | Integer array | List of I/O units used for output | Unallocated |
89-
| `max_width` | Integer | Maximum column width of output | 0 |
90-
| `time_stamp` | Logical | Flag to precede output by a time stamp | `.true.` |
91-
| `units` | Integer | Count of the number of active output units | 0 |
97+
| Attribute | Type | Description | Initial value |
98+
|------------------|---------------|-------------------------------------------------|---------------------|
99+
| `add_blank_line` | Logical | Flag to precede output with a blank line | `.false.` |
100+
| `indent_lines` | Logical | Flag to indent subsequent lines by four columns | `.true.` |
101+
| `level` | Integer | Severity level | `information_level` |
102+
| `log_units` | Integer array | List of I/O units used for output | Unallocated |
103+
| `max_width` | Integer | Maximum column width of output | 0 |
104+
| `time_stamp` | Logical | Flag to precede output by a time stamp | `.true.` |
105+
| `units` | Integer | Count of the number of active output units | 0 |
92106

93107
## The `stdlib_logger` variable
94108

@@ -284,7 +298,7 @@ Reports the configuration of a logger.
284298

285299
#### Syntax
286300

287-
`call self % [[logger_type(type):configuration(bound)]]( [ add_blankline, indent, max_width, time_stamp, log_units ] )`
301+
`call self % [[logger_type(type):configuration(bound)]]( [ add_blankline, indent, level, max_width, time_stamp, log_units ] )`
288302

289303
#### Class
290304

@@ -303,6 +317,10 @@ Pure subroutine
303317
is an `intent(out)` argument. A value of `.true.` indents subsequent
304318
lines by four spaces, and `.false.` otherwise.
305319

320+
`level` (optional): shall be a scalar default integer variable. It is an
321+
`intent(out)` argument. The value corresponds to the severity level for
322+
ignoring a message.
323+
306324
`max_width` (optional): shall be a scalar default integer
307325
variable. It is an `intent(out)` argument. A positive value bigger
308326
than four defines the maximum width of the output, otherwise there
@@ -355,7 +373,7 @@ Configures the logging process for self.
355373

356374
#### Syntax
357375

358-
`call self % [[logger_type(type):configure(bound)]]( [ add_blank_line, indent, max_width, time_stamp ] )`
376+
`call self % [[logger_type(type):configure(bound)]]( [ add_blank_line, indent, level, max_width, time_stamp ] )`
359377

360378
#### Class
361379

@@ -375,6 +393,10 @@ Pure subroutine
375393
indent subsequent lines by four spaces, and to `.false.` to
376394
not indent.
377395

396+
`level` (optional): shall be a scalar default integer expression. It is
397+
an `intent(in)` argument. Set the severity level for ignoring a log
398+
message.
399+
378400
`max_width` (optional): shall be a scalar default integer
379401
expression. It is an `intent(in)` argument. Set to a positive value
380402
bigger than four to define the maximum width of the output,
@@ -416,6 +438,8 @@ If time stamps are active, a time stamp is written, followed
416438
by `module` and `procedure` if present, and then
417439
`message` is written with the prefix `'DEBUG: '`.
418440

441+
It is ignored if the `level` of `self` is higher than `debug_level`.
442+
419443
#### Class
420444

421445
Subroutine
@@ -486,6 +510,8 @@ followed by `module` and `procedure` if present, then
486510
`message` is written with the prefix `'ERROR: '`, and then
487511
if `stat` or `errmsg` are present they are written.
488512

513+
It is ignored if the `level` of `self` is higher than `error_level`.
514+
489515
#### Class
490516

491517
Subroutine
@@ -569,6 +595,8 @@ If time stamps are active, a time stamp is written, followed
569595
by `module` and `procedure` if present, and then
570596
`message` is written with the prefix `'INFO: '`.
571597

598+
It is ignored if the `level` of `self` is higher than `information_level`.
599+
572600
#### Class
573601

574602
Subroutine
@@ -637,6 +665,8 @@ written. Then `message` is written with the prefix
637665
`'I/O ERROR: '`. Then if `iostat` or `iomsg` are present they are
638666
written.
639667

668+
It is ignored if the `level` of `self` is higher than `io_error_level`.
669+
640670
#### Syntax
641671

642672
`call self % [[logger_type(type):log_io_error(bound)]]( message [, module, procedure, iostat, iomsg ] )`
@@ -714,6 +744,8 @@ If time stamps are active, a time stamp is written,
714744
then `module` and `procedure` are written if present,
715745
followed by `prefix \\ ': '`, if present, and finally `message`.
716746

747+
No severity level is applied to `log_message`.
748+
717749
#### Syntax
718750

719751
`call self % [[logger_type(type):log_message(bound)]]( message [, module, procedure, prefix ] )`
@@ -790,6 +822,8 @@ written with `column`. Then `line` is written. Then a caret, '^', is
790822
written below `line` at the column indicated by `column`. Then
791823
`summary` is written below the caret.
792824

825+
It is ignored if the `level` of `self` is higher than `text_error_level`.
826+
793827
#### Syntax
794828

795829
`call self % [[logger_type(type):log_text_error(bound)]]( line, column, summary [, filename, line_number, caret, stat ] )`

src/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ set(fppFiles
1414
stdlib_stats_cov.fypp
1515
stdlib_stats_mean.fypp
1616
stdlib_stats_moment.fypp
17+
stdlib_stats_moment_all.fypp
18+
stdlib_stats_moment_mask.fypp
19+
stdlib_stats_moment_scalar.fypp
1720
stdlib_stats_var.fypp
1821
stdlib_quadrature.fypp
1922
stdlib_quadrature_trapz.fypp

src/Makefile.manual

+6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ SRC = f18estop.f90 \
1515
stdlib_stats.f90 \
1616
stdlib_stats_mean.f90 \
1717
stdlib_stats_moment.f90 \
18+
stdlib_stats_moment_all.f90 \
19+
stdlib_stats_moment_mask.f90 \
20+
stdlib_stats_moment_scalar.f90 \
1821
stdlib_stats_var.f90
1922

2023
LIB = libstdlib.a
@@ -79,4 +82,7 @@ stdlib_quadrature.f90: stdlib_quadrature.fypp
7982
stdlib_stats.f90: stdlib_stats.fypp
8083
stdlib_stats_mean.f90: stdlib_stats_mean.fypp
8184
stdlib_stats_moment.f90: stdlib_stats_moment.fypp
85+
stdlib_stats_moment_all.f90: stdlib_stats_moment_all.fypp
86+
stdlib_stats_moment_mask.f90: stdlib_stats_moment_mask.fypp
87+
stdlib_stats_moment_scalar.f90: stdlib_stats_moment_scalar.fypp
8288
stdlib_stats_var.f90: stdlib_stats_var.fypp

0 commit comments

Comments
 (0)