Skip to content

Commit c2012f4

Browse files
committed
Deploying to stdlib-fpm from @ c6b54e1 🚀
1 parent 88d8ba6 commit c2012f4

File tree

224 files changed

+3415
-58
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

224 files changed

+3415
-58
lines changed

example/example_add_log_unit.f90

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
program example_add_log_unit
2+
use stdlib_logger, only: global_logger, read_only_error
3+
4+
character(256) :: iomsg
5+
integer :: iostat, unit, stat
6+
7+
open (newunit=unit, file='error_log.txt', &
8+
form='formatted', status='replace', &
9+
position='rewind', &
10+
action='write', iostat=iostat, iomsg=iomsg)
11+
12+
call global_logger%add_log_unit(unit, stat)
13+
14+
select case (stat)
15+
case (read_only_error)
16+
error stop 'Unable to write to "error_log.txt".'
17+
end select
18+
19+
end program example_add_log_unit

example/example_adjustl.f90

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
program example_adjustl
2+
use stdlib_string_type
3+
implicit none
4+
type(string_type) :: string
5+
6+
string = " Whitespace"
7+
string = adjustl(string)
8+
! char(string) == "Whitespace "
9+
end program example_adjustl

example/example_adjustr.f90

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
program example_adjustr
2+
use stdlib_string_type
3+
implicit none
4+
type(string_type) :: string
5+
6+
string = "Whitespace "
7+
string = adjustr(string)
8+
! char(string) == " Whitespace"
9+
end program example_adjustr

example/example_arg_select.f90

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
program example_arg_select
2+
use stdlib_selection, only: arg_select
3+
implicit none
4+
5+
real, allocatable :: array(:)
6+
integer, allocatable :: indx(:)
7+
integer :: kth_smallest
8+
integer :: k
9+
10+
array = [3., 2., 7., 4., 5., 1., 4., -1.]
11+
indx = [(k, k=1, size(array))]
12+
13+
k = 2
14+
call arg_select(array, indx, k, kth_smallest)
15+
print *, array(kth_smallest) ! print 1.0
16+
17+
k = 7
18+
! Due to the previous call to arg_select, we know for sure this is in an
19+
! index >= 2
20+
call arg_select(array, indx, k, kth_smallest, left=2)
21+
print *, array(kth_smallest) ! print 5.0
22+
23+
k = 6
24+
! Due to the previous two calls to arg_select, we know for sure this is in
25+
! an index >= 2 and <= 7
26+
call arg_select(array, indx, k, kth_smallest, left=2, right=7)
27+
print *, array(kth_smallest) ! print 4.0
28+
29+
end program example_arg_select

example/example_ascii_reverse.f90

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
program example_reverse
2+
use stdlib_ascii, only: reverse
3+
implicit none
4+
print'(a)', reverse("Hello, World!") ! returns "!dlroW ,olleH"
5+
end program example_reverse

example/example_ascii_to_lower.f90

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
program example_to_lower
2+
use stdlib_ascii, only: to_lower
3+
implicit none
4+
print'(a)', to_lower("HELLo!") ! returns "hello!"
5+
end program example_to_lower

example/example_ascii_to_sentence.f90

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
program example_to_sentence
2+
use stdlib_ascii, only: to_sentence
3+
implicit none
4+
print *, to_sentence("hello!") ! returns "Hello!"
5+
print *, to_sentence("'enquoted'") ! returns "'Enquoted'"
6+
print *, to_sentence("1st") ! returns "1st"
7+
end program example_to_sentence

example/example_ascii_to_title.f90

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
program example_to_title
2+
use stdlib_ascii, only: to_title
3+
implicit none
4+
print *, to_title("hello there!") ! returns "Hello There!"
5+
print *, to_title("'enquoted'") ! returns "'Enquoted'"
6+
print *, to_title("1st") ! returns "1st"
7+
end program example_to_title

example/example_ascii_to_upper.f90

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
program example_to_upper
2+
use stdlib_ascii, only: to_upper
3+
implicit none
4+
print'(a)', to_upper("hello!") ! returns "HELLO!"
5+
end program example_to_upper

example/example_bitsets_all.f90

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
program example_all
2+
use stdlib_bitsets
3+
character(*), parameter :: &
4+
bits_all = '111111111111111111111111111111111'
5+
type(bitset_64) :: set0
6+
call set0%from_string(bits_all)
7+
if (.not. set0%all()) then
8+
error stop "FROM_STRING failed to interpret"// &
9+
"BITS_ALL's value properly."
10+
else
11+
write (*, *) "FROM_STRING transferred BITS_ALL properly"// &
12+
" into set0."
13+
end if
14+
end program example_all

0 commit comments

Comments
 (0)