Skip to content

Update with latest devs from main #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 63 commits into
base: symtridiag
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
08e489a
promote ascii pure functions to elemental
wassup05 Apr 10, 2025
bb48f09
remove unused procedure in the test
wassup05 Apr 10, 2025
32b7bf3
refactor ascii validation test
perazz Apr 10, 2025
7e44eea
add ascii_table to the tests
wassup05 Apr 11, 2025
c580881
Update test/ascii/test_ascii.f90
perazz Apr 11, 2025
4bc022d
refactor test
jalvesz Apr 16, 2025
ddab1fb
add ascii constants docs
wassup05 Apr 16, 2025
11dd81e
add ascii procedure docs
wassup05 Apr 17, 2025
657b312
added interfaces and necessary build stuff
wassup05 Jun 7, 2025
f41dee4
implemented interfaces
wassup05 Jun 7, 2025
572ad46
example
wassup05 Jun 7, 2025
8a10f26
tests added
wassup05 Jun 7, 2025
1bd58b7
added specs
wassup05 Jun 7, 2025
ea71960
an edge case handled
wassup05 Jun 8, 2025
c561108
separated examples according to OS and functions
wassup05 Jun 12, 2025
272eb67
further split examples and fix some autodoc links issues due to wrong…
jalvesz Jun 15, 2025
5147094
misslocation of source file
jalvesz Jun 15, 2025
9e64094
fix example program names
jalvesz Jun 15, 2025
ca867f8
fix example_path_join.f90
wassup05 Jun 15, 2025
62bef00
Consistent naming
wassup05 Jun 19, 2025
1c87df9
windows test case for path with spaces
wassup05 Jun 21, 2025
8d00eea
added functions and relevant wrappers
wassup05 Jul 1, 2025
c9345c1
added tests
wassup05 Jul 1, 2025
d94d7fb
added specs
wassup05 Jul 1, 2025
e1f68d8
added examples
wassup05 Jul 1, 2025
c3db3a6
cleanup
wassup05 Jul 1, 2025
3832d5e
Revert "refactor test"
wassup05 Jul 5, 2025
8012ac8
improve test flow a bit
wassup05 Jul 5, 2025
45824b5
remove pre-processor parameters
wassup05 Jun 21, 2025
3501bc9
Merge branch 'master' of github.com:wassup05/stdlib into path
wassup05 Jul 6, 2025
e7a3a1f
added functions
wassup05 Jul 12, 2025
e182803
added tests
wassup05 Jul 12, 2025
5197a0c
update test
wassup05 Jul 12, 2025
ee40f44
typos and grammar
wassup05 Jul 13, 2025
e6add70
added new procedures to the interfaces
wassup05 Jul 14, 2025
616040d
implemented the new procedures
wassup05 Jul 14, 2025
812b5ed
modified the docs to add `type(string_type)` arguments
wassup05 Jul 14, 2025
a21a48b
`assignment(=)` => `move`
wassup05 Jul 16, 2025
2c47354
snake case names
wassup05 Jul 16, 2025
a932653
intel compiler hack
wassup05 Jul 17, 2025
96eed56
added specs
wassup05 Jul 18, 2025
4d1e6d0
added example
wassup05 Jul 18, 2025
03c76c9
capitalize functions + some doc changes
wassup05 Jul 20, 2025
4564868
Make script executable
wassup05 Jul 20, 2025
a0d9e22
`stdlib_system`: essential path functionality (#999)
perazz Jul 22, 2025
873bb75
Merge branch 'master' into fs_error
perazz Jul 22, 2025
a2fadac
filesystem: `FS_ERROR` helper functions (#1015)
perazz Jul 22, 2025
f02c2e2
Merge branch 'master' of https://github.com/fortran-lang/stdlib into …
wassup05 Jul 22, 2025
9d6325e
remove `mode` argument, some minor changes
wassup05 Jul 22, 2025
3c82625
add make_directory_all
wassup05 Jul 22, 2025
85b522b
add test
wassup05 Jul 22, 2025
f6829c8
add docs
wassup05 Jul 22, 2025
81339e7
add example
wassup05 Jul 22, 2025
1c4e5f7
windows specific path for tests
wassup05 Jul 22, 2025
2552c36
fix: complex dot_product formulation (#1017)
jalvesz Jul 23, 2025
ab27ae0
a little efficient
wassup05 Jul 23, 2025
880c7a5
Make collaboration script executable (#1018)
perazz Jul 23, 2025
e16f192
minor comments + doc changes
wassup05 Jul 23, 2025
95e76be
cleanup path make_directory_all + typo
wassup05 Jul 23, 2025
9d9f4bc
Promote other ascii functions to elemental (#977)
perazz Jul 24, 2025
b13edf5
add in-code comments
wassup05 Jul 24, 2025
60f5308
feat: creating and removing empty directories (#1011)
perazz Jul 30, 2025
38bb2bb
Merge branch 'symtridiag' into master
loiseaujc Jul 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified .github/collab.sh
100644 → 100755
Empty file.
533 changes: 530 additions & 3 deletions doc/specs/stdlib_ascii.md

Large diffs are not rendered by default.

111 changes: 111 additions & 0 deletions doc/specs/stdlib_system.md
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,117 @@ The function returns a `logical` value:

---

## `make_directory` - Creates an empty directory

### Status

Experimental

### Description

It creates an empty directory with default permissions.
It is designed to work across multiple platforms. On Windows, paths with both forward `/` and backward `\` slashes are accepted.

### Syntax

`call [[stdlib_system(module):make_directory(subroutine)]] (path [,err])`

### Class

Subroutine

### Arguments

`path`: Shall be a character string containing the path of the directory to create. It is an `intent(in)` argument.

`err`(optional): Shall be of type `state_type`, and is used for error handling. It is an `optional, intent(out)` argument.

### Return values

`err` is an optional state return flag. If not requested and an error occurs, an `FS_ERROR` will trigger an error stop.

### Example

```fortran
{!example/system/example_make_directory.f90!}
```

---

## `make_directory_all` - Creates an empty directory with all its parent directories

### Status

Experimental

### Description

It creates an empty directory with default permissions.
It also creates all the necessary parent directories in the path if they do not exist already.

### Syntax

`call [[stdlib_system(module):make_directory_all(subroutine)]] (path [,err])`

### Class

Subroutine

### Arguments

`path`: Shall be a character string containing the path of the directory to create. It is an `intent(in)` argument.

`err`(optional): Shall be of type `state_type`, and is used for error handling. It is an `optional, intent(out)` argument.

### Return values

`err` is an optional state return flag. If not requested and an error occurs, an `FS_ERROR` will trigger an error stop.

### Example

```fortran
{!example/system/example_make_directory.f90!}
```

---

## `remove_directory` - Removes an empty directory

### Status

Experimental

### Description

It deletes an empty directory.
It is designed to work across multiple platforms. On Windows, paths with both forward `/` and backward `\` slashes are accepted.

### Syntax

`call [[stdlib_system(module):remove_directory(subroutine)]] (path, err)`

### Class

Subroutine

### Arguments

`path`: Shall be a character string containing the path of the directory to create. It is an `intent(in)` argument.

`err`(optional): Shall be of type `state_type`, and is used for error handling. It is an `optional, intent(out)` argument.

### Return values

`err` is an optional state return flag. On error if not requested, an `FS_ERROR` will trigger an error stop.

### Example

```fortran
{!example/system/example_remove_directory.f90!}
```

---

## `null_device` - Return the null device file path

### Status
Expand Down
3 changes: 2 additions & 1 deletion example/system/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ ADD_EXAMPLE(path_join)
ADD_EXAMPLE(path_split_path)
ADD_EXAMPLE(path_base_name)
ADD_EXAMPLE(path_dir_name)

ADD_EXAMPLE(make_directory)
ADD_EXAMPLE(remove_directory)
25 changes: 25 additions & 0 deletions example/system/example_make_directory.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
! Illustrate the usage of `make_directory`, `make_directory_all`
program example_make_directory
use stdlib_system, only: make_directory, make_directory_all
use stdlib_error, only: state_type
implicit none

type(state_type) :: err

call make_directory("temp_dir", err)

if (err%error()) then
print *, err%print()
else
print *, "directory created sucessfully"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[misspell] reported by reviewdog 🐶
"sucessfully" is a misspelling of "successfully"

end if

call make_directory_all("d1/d2/d3/d4", err)

if (err%error()) then
print *, err%print()
else
print *, "nested directories created sucessfully"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[misspell] reported by reviewdog 🐶
"sucessfully" is a misspelling of "successfully"

end if

end program example_make_directory
17 changes: 17 additions & 0 deletions example/system/example_remove_directory.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
! Illustrate the usage of `remove_directory`
program example_remove_directory
use stdlib_system, only: remove_directory
use stdlib_error, only: state_type
implicit none

type(state_type) :: err

call remove_directory("directory_to_be_removed", err)

if (err%error()) then
print *, err%print()
else
print *, "directory removed successfully"
end if

end program example_remove_directory
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ set(SRC
stdlib_system_subprocess.c
stdlib_system_subprocess.F90
stdlib_system_path.f90
stdlib_system.c
stdlib_system.F90
stdlib_sparse.f90
stdlib_specialfunctions_legendre.f90
Expand Down
28 changes: 14 additions & 14 deletions src/stdlib_ascii.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -107,47 +107,47 @@ module stdlib_ascii
contains

!> Checks whether `c` is an ASCII letter (A .. Z, a .. z).
pure logical function is_alpha(c)
elemental logical function is_alpha(c)
character(len=1), intent(in) :: c !! The character to test.
is_alpha = (c >= 'A' .and. c <= 'Z') .or. (c >= 'a' .and. c <= 'z')
end function

!> Checks whether `c` is a letter or a number (0 .. 9, a .. z, A .. Z).
pure logical function is_alphanum(c)
elemental logical function is_alphanum(c)
character(len=1), intent(in) :: c !! The character to test.
is_alphanum = (c >= '0' .and. c <= '9') .or. (c >= 'a' .and. c <= 'z') &
.or. (c >= 'A' .and. c <= 'Z')
end function

!> Checks whether or not `c` is in the ASCII character set -
!> i.e. in the range 0 .. 0x7F.
pure logical function is_ascii(c)
elemental logical function is_ascii(c)
character(len=1), intent(in) :: c !! The character to test.
is_ascii = iachar(c) <= int(z'7F')
end function

!> Checks whether `c` is a control character.
pure logical function is_control(c)
elemental logical function is_control(c)
character(len=1), intent(in) :: c !! The character to test.
integer :: ic
ic = iachar(c)
is_control = ic < int(z'20') .or. ic == int(z'7F')
end function

!> Checks whether `c` is a digit (0 .. 9).
pure logical function is_digit(c)
elemental logical function is_digit(c)
character(len=1), intent(in) :: c !! The character to test.
is_digit = ('0' <= c) .and. (c <= '9')
end function

!> Checks whether `c` is a digit in base 8 (0 .. 7).
pure logical function is_octal_digit(c)
elemental logical function is_octal_digit(c)
character(len=1), intent(in) :: c !! The character to test.
is_octal_digit = (c >= '0') .and. (c <= '7');
end function

!> Checks whether `c` is a digit in base 16 (0 .. 9, A .. F, a .. f).
pure logical function is_hex_digit(c)
elemental logical function is_hex_digit(c)
character(len=1), intent(in) :: c !! The character to test.
is_hex_digit = (c >= '0' .and. c <= '9') .or. (c >= 'a' .and. c <= 'f') &
.or. (c >= 'A' .and. c <= 'F')
Expand All @@ -156,7 +156,7 @@ contains
!> Checks whether or not `c` is a punctuation character. That includes
!> all ASCII characters which are not control characters, letters,
!> digits, or whitespace.
pure logical function is_punctuation(c)
elemental logical function is_punctuation(c)
character(len=1), intent(in) :: c !! The character to test.
integer :: ic
ic = iachar(c) ! '~' '!'
Expand All @@ -166,7 +166,7 @@ contains

!> Checks whether or not `c` is a printable character other than the
!> space character.
pure logical function is_graphical(c)
elemental logical function is_graphical(c)
character(len=1), intent(in) :: c !! The character to test.
integer :: ic
ic = iachar(c)
Expand All @@ -177,7 +177,7 @@ contains

!> Checks whether or not `c` is a printable character - including the
!> space character.
pure logical function is_printable(c)
elemental logical function is_printable(c)
character(len=1), intent(in) :: c !! The character to test.
integer :: ic
ic = iachar(c)
Expand All @@ -186,23 +186,23 @@ contains
end function

!> Checks whether `c` is a lowercase ASCII letter (a .. z).
pure logical function is_lower(c)
elemental logical function is_lower(c)
character(len=1), intent(in) :: c !! The character to test.
integer :: ic
ic = iachar(c)
is_lower = ic >= iachar('a') .and. ic <= iachar('z')
end function

!> Checks whether `c` is an uppercase ASCII letter (A .. Z).
pure logical function is_upper(c)
elemental logical function is_upper(c)
character(len=1), intent(in) :: c !! The character to test.
is_upper = (c >= 'A') .and. (c <= 'Z')
end function

!> Checks whether or not `c` is a whitespace character. That includes the
!> space, tab, vertical tab, form feed, carriage return, and linefeed
!> characters.
pure logical function is_white(c)
elemental logical function is_white(c)
character(len=1), intent(in) :: c !! The character to test.
integer :: ic
ic = iachar(c) ! TAB, LF, VT, FF, CR
Expand All @@ -211,7 +211,7 @@ contains

!> Checks whether or not `c` is a blank character. That includes the
!> only the space and tab characters
pure logical function is_blank(c)
elemental logical function is_blank(c)
character(len=1), intent(in) :: c !! The character to test.
integer :: ic
ic = iachar(c) ! TAB
Expand Down
8 changes: 4 additions & 4 deletions src/stdlib_intrinsics_dot_product.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ pure module function stdlib_dot_product_${s}$(a,b) result(p)
n = size(a,kind=ilp)
r = mod(n,chunk)

abatch(1:r) = a(1:r)*${cnjg(t,'b(1:r)')}$
abatch(1:r) = ${cnjg(t,'a(1:r)')}$*b(1:r)
abatch(r+1:chunk) = zero_${s}$
do i = r+1, n-r, chunk
abatch(1:chunk) = abatch(1:chunk) + a(i:i+chunk-1)*${cnjg(t,'b(i:i+chunk-1)')}$
abatch(1:chunk) = abatch(1:chunk) + ${cnjg(t,'a(i:i+chunk-1)')}$*b(i:i+chunk-1)
end do

p = zero_${s}$
Expand All @@ -60,11 +60,11 @@ pure module function stdlib_dot_product_kahan_${s}$(a,b) result(p)
n = size(a,kind=ilp)
r = mod(n,chunk)

abatch(1:r) = a(1:r)*${cnjg(t,'b(1:r)')}$
abatch(1:r) = ${cnjg(t,'a(1:r)')}$*b(1:r)
abatch(r+1:chunk) = zero_${s}$
cbatch = zero_${s}$
do i = r+1, n-r, chunk
call kahan_kernel( a(i:i+chunk-1)*${cnjg(t,'b(i:i+chunk-1)')}$ , abatch(1:chunk) , cbatch(1:chunk) )
call kahan_kernel( ${cnjg(t,'a(i:i+chunk-1)')}$*b(i:i+chunk-1) , abatch(1:chunk) , cbatch(1:chunk) )
end do

p = zero_${s}$
Expand Down
Loading
Loading