Skip to content

Commit 41247e2

Browse files
authored
Merge branch 'master' into develop_clip
2 parents d17df5e + ac0f957 commit 41247e2

23 files changed

+1485
-127
lines changed

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@
33
[![Actions Status](https://github.com/fortran-lang/stdlib/workflows/CI/badge.svg)](https://github.com/fortran-lang/stdlib/actions)
44
[![Actions Status](https://github.com/fortran-lang/stdlib/workflows/CI_windows/badge.svg)](https://github.com/fortran-lang/stdlib/actions)
55

6+
* [Goals and Motivation](#goals-and-motivation)
7+
* [Scope](#scope)
8+
* [Getting started](#getting-started)
9+
- [Get the code](#get-the-code)
10+
- [Requirements](#requirements)
11+
- [Supported compilers](#supported-compilers)
12+
- [Build with CMake](#build-with-cmake)
13+
- [Build with make](#build-with-make)
14+
* [Using stdlib in your project](#using-stdlib-in-your-project)
15+
* [Documentation](#documentation)
16+
* [Contributing](#contributing)
17+
* [Links](#links)
618

719
## Goals and Motivation
820

@@ -138,7 +150,7 @@ To test your build, run the test suite after the build has finished with
138150
cmake --build build --target test
139151
```
140152

141-
Please report failing tests on our [issue tracker](https://github.com/fortran-lang/stdlib/issues/new/choose) including details on the compiler used, the operating system and platform architecture.
153+
Please report failing tests on our [issue tracker](https://github.com/fortran-lang/stdlib/issues/new/choose) including details of the compiler used, the operating system and platform architecture.
142154

143155
To install the project to the declared prefix run
144156

STYLE_GUIDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ focus on the semantics of the proposed changes rather than style and formatting.
4747
<!-- ATTENTION! This section includes intentional trailing whitespace to get decent formatting with GFM and Python Markdown. -->
4848

4949
* Always specify `intent` for dummy arguments.
50-
* Don't use `dimension` attribute to declare arrays because it is less verbose.
50+
* Don't use `dimension` attribute to declare arrays because it is more verbose.
5151
Use this:
5252
```
5353
real, allocatable :: a(:), b(:,:)

WORKFLOW.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,74 @@ PR and proposal was approved by "vast majority".
5959

6060
You are welcome to propose changes to this workflow by opening an
6161
[issue](https://github.com/fortran-lang/stdlib/issues).
62+
63+
64+
## Build system
65+
66+
This project supports two build systems right now, CMake and make.
67+
Eventually, stdlib will be using the Fortran package manager
68+
([fpm](https://github.com/fortran-lang/fpm)) as build system as well.
69+
The effort of supporting fpm is tracked in issue
70+
[#279](https://github.com/fortran-lang/stdlib/issues/279).
71+
72+
73+
### CMake build files
74+
75+
The build files for CMake allow both in-tree, *i.e.* build artifacts share
76+
the same tree as the source files, and out-of-tree builds, *i.e.* build artifacts
77+
exist in a separate directory tree.
78+
Both build types are explicitly supported and tested, the latter strategy
79+
is recommended for local development.
80+
81+
Sources for the main library target are added in ``src/CMakeLists.txt``
82+
relative to the library target, *i.e.* no absolute paths are required.
83+
84+
To add tests, the macro ``ADDTEST`` should be used instead of the CMake function
85+
``add_test``, the macro hides creation of the executable target, linking against the
86+
main library target and registering the test.
87+
The tests themselves are defined as standalone executables in the subdirectories
88+
in ``src/tests``, a new subdirectory with tests has to be registred in
89+
``src/tests/CMakeLists.txt``.
90+
91+
The source tree should be considered read-only. References to ``PROJECT_SOURCE_DIR``
92+
and ``CMAKE_CURRENT_SOURCE_DIR`` should only be used for accessing source files,
93+
never to write build outputs, use ``PROJECT_BINARY_DIR`` and ``CMAKE_CURRENT_BINARY_DIR``
94+
to write build artifacts instead.
95+
To fully support in-tree builds, build artifacts must never have the same name as
96+
source files to avoid accidentally overwriting them, *e.g.* when preprocessing or
97+
configuring a file.
98+
99+
The ``CMAKE_INSTALL_PREFIX`` should only be written to on install, never in the build
100+
process. To install generated files, create a build output in the build tree and
101+
install it with the ``install`` function.
102+
This project follows the GNU install conventions, this means that the variables
103+
``CMAKE_INSTALL_BINDIR``, ``CMAKE_INSTALL_LIBDIR``, and ``CMAKE_INSTALL_INCLUDEDIR``
104+
must be used instead of ``bin``, ``lib``, and ``include``, respectively.
105+
Library targets should be exported on install to allow correct inclusion of the
106+
project in other CMake projects.
107+
Prefer dashes as in ``project-config`` or ``project-targets`` over camel-case as in
108+
``projectConfig`` or ``projectTarget`` for file names as the former allows easier
109+
construction from the ``PROJECT_NAME`` variable by concatenation.
110+
111+
The project is usable as CMake subproject. Explicit references to
112+
``CMAKE_SOURCE_DIR`` and ``CMAKE_BINARY_DIR`` must be avoided to not
113+
break subproject builds.
114+
An example project is available [here](https://github.com/fortran-lang/stdlib-cmake-example)
115+
to test the CMake subproject integration.
116+
117+
118+
### Make build files
119+
120+
The build files for ``make`` are using the name ``Makefile.manual`` to
121+
not conflict with the in-tree build of CMake.
122+
This project uses recursive make to transverse the subdirectory structure
123+
from the top-level makefile, called ``Makefile.manual``, and the build
124+
happens in-tree, *i.e.* build artifacts are present along with the source code.
125+
126+
New source files are added in ``src/Makefile.manual`` and include manual
127+
dependency definitions through the object files to allow parallel
128+
compilation.
129+
Tests are generated by the make include file ``src/tests/Makefile.manual.test.mk``
130+
and defined in the subdirectories of the ``src/tests`` as entries in ``PROGS_SRC``.
131+
New subdirectories have to be explicitly added to ``src/tests/Makefile.manual``
132+
or are ignored.

doc/specs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ This is and index/directory of the specifications (specs) for each new module/fe
2222
- [stats](./stdlib_stats.html) - Descriptive Statistics
2323
- [stats_distribution_PRNG](./stdlib_stats_distribution_PRNG.html) - Probability Distributions random number generator
2424
- [string\_type](./stdlib_string_type.html) - Basic string support
25+
- [strings](./stdlib_strings.html) - String handling and manipulation routines
2526

2627
## Missing specs
2728

doc/specs/stdlib_ascii.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,42 @@ program demo_reverse
169169
print'(a)', reverse("Hello, World!") ! returns "!dlroW ,olleH"
170170
end program demo_reverse
171171
```
172+
173+
174+
### `to_string`
175+
176+
#### Status
177+
178+
Experimental
179+
180+
#### Description
181+
182+
Create a character string representing the value of the provided variable.
183+
184+
#### Syntax
185+
186+
`res = [[stdlib_ascii(module):to_string(interface)]] (string)`
187+
188+
#### Class
189+
190+
Pure function.
191+
192+
#### Argument
193+
194+
`val`: shall be an intrinsic integer or logical type. It is an `intent(in)` argument.
195+
196+
#### Result value
197+
198+
The result is an intrinsic character type.
199+
200+
#### Example
201+
202+
```fortran
203+
program demo_string_value
204+
use stdlib_ascii, only : to_string
205+
implicit none
206+
print'(a)', to_string(-3) ! returns "-3"
207+
print'(a)', to_string(.true.) ! returns "T"
208+
print'(a)', to_string(42) ! returns "42"
209+
end program demo_string_value
210+
```

0 commit comments

Comments
 (0)