dev-libs/StringiFor: new package

A KISS pure Fortran library providing astrings (class) manipulator
for modern (2003+) Fortran projects.

From developer's page (https://github.com/szaghi/StringiFor):

What is StringiFor?
Modern Fortran standards (2003+) have introduced a better support
for characters variables, but Fortraners still do not have the power
on dealing with strings of other more-rich-programmers, e.g. Pythoners.

Allocatable deferred length character variables are now quantum-leap
with respect the old inflexible Fortran characters,
but it is still not enough for many Fortraners.

Moreover, Fortran does not provide builtin methods
for widely used strings manipulations offered by other languages,
e.g. UPPER/lowercase transformation, tokenization, etc...
StringiFor attempts to fill this lack.

Signed-off-by: Sergey Torokhov <torokhov-s-a@yandex.ru>
This commit is contained in:
Sergey Torokhov
2020-04-19 17:01:04 +03:00
parent aa9ddfff2b
commit 9228029843
5 changed files with 176 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
diff -Naur a/src/tests/stringifor/stringifor_test_csv_naive_parser.f90 b/src/tests/stringifor/stringifor_test_csv_naive_parser.f90
--- a/src/tests/stringifor/stringifor_test_csv_naive_parser.f90 2020-01-27 20:28:35.000000000 +0300
+++ b/src/tests/stringifor/stringifor_test_csv_naive_parser.f90 2020-04-17 03:48:42.000000000 +0300
@@ -49,8 +49,7 @@
print "(A)", 'A markdown-formatted table'
print "(A)", ''
print "(A)", '|'//csv%join(array=cells(:, 1), sep='|')//'|'
-columns = '----' ! re-use columns for printing separators
-print "(A)", '|'//csv%join(array=columns, sep='|')//'|'
+print "(A)", '|'//repeat('----|', size(columns)) ! printing separators
do r=2, rows_number
print "(A)", '|'//csv%join(array=cells(:, r), sep='|')//'|'
enddo
diff -Naur a/src/tests/stringifor/stringifor_test_parse_large_csv.f90 b/src/tests/stringifor/stringifor_test_parse_large_csv.f90
--- a/src/tests/stringifor/stringifor_test_parse_large_csv.f90 2020-01-27 20:28:35.000000000 +0300
+++ b/src/tests/stringifor/stringifor_test_parse_large_csv.f90 2020-04-17 16:23:57.000000000 +0300
@@ -30,8 +30,7 @@
print "(A)", 'A markdown-formatted table'
print "(A)", ''
print "(A)", '|'//csv%join(array=cells(:, 1), sep='|')//'|'
-columns = '----' ! re-use columns for printing separators
-print "(A)", '|'//csv%join(array=columns, sep='|')//'|'
+print "(A)", '|'//repeat('----|', size(columns)) ! printing separators
do r=2, rows_number
print "(A)", '|'//csv%join(array=cells(:, r), sep='|')//'|'
enddo
diff -Naur a/src/third_party/FACE/src/tests/face_test_ucs4.F90 b/src/third_party/FACE/src/tests/face_test_ucs4.F90
--- a/src/third_party/FACE/src/tests/face_test_ucs4.F90 2019-09-11 19:00:21.000000000 +0300
+++ b/src/third_party/FACE/src/tests/face_test_ucs4.F90 2020-04-19 15:40:35.000000000 +0300
@@ -2,9 +2,10 @@
program face_test_ucs4
!< FACE test.
use face
+use iso_fortran_env
implicit none
-#ifdef UCS4_SUPPORTED
+
character(kind=UCS4, len=:), allocatable :: string_1 !< A string.
character(kind=UCS4, len=:), allocatable :: string_2 !< A string.
character(kind=UCS4, len=:), allocatable :: string_3 !< A string.
@@ -13,5 +14,5 @@
string_2 = colorize(UCS4_' ÜÇŞ4', color_fg='red')
string_3 = colorize(' World', color_fg='blue')
print '(A)', string_1//string_2//string_3
-#endif
+
endprogram face_test_ucs4