Skip to content

Commit 62bef00

Browse files
committed
Consistent naming
1 parent ca867f8 commit 62bef00

11 files changed

+136
-136
lines changed

doc/specs/stdlib_system.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ The file is removed from the filesystem if the operation is successful. If the o
533533
{!example/system/example_delete_file.f90!}
534534
```
535535

536-
## `joinpath` - Joins the provided paths according to the OS
536+
## `join_path` - Joins the provided paths according to the OS
537537

538538
### Status
539539

@@ -546,9 +546,9 @@ i.e `\` for windows and `/` for others
546546

547547
### Syntax
548548

549-
`res = ` [[stdlib_system(module):joinpath(interface)]] ` (p1, p2)`
549+
`res = ` [[stdlib_system(module):join_path(interface)]] ` (p1, p2)`
550550

551-
`res = ` [[stdlib_system(module):joinpath(interface)]] ` (p)`
551+
`res = ` [[stdlib_system(module):join_path(interface)]] ` (p)`
552552

553553
### Class
554554
Pure function
@@ -565,7 +565,7 @@ The resultant path.
565565

566566
## `operator(/)`
567567

568-
Alternative syntax to`joinpath` using an overloaded operator. Join two paths according to the platform specific path-separator.
568+
Alternative syntax to`join_path` using an overloaded operator. Join two paths according to the platform specific path-separator.
569569

570570
### Status
571571

@@ -595,7 +595,7 @@ The result is an `allocatable` character string
595595
{!example/system/example_path_join.f90!}
596596
```
597597

598-
## `splitpath` - splits a path immediately following the last separator
598+
## `split_path` - splits a path immediately following the last separator
599599

600600
### Status
601601

@@ -608,7 +608,7 @@ splitting it into most of the times a directory and a file name.
608608

609609
### Syntax
610610

611-
`call `[[stdlib_system(module):splitpath(interface)]]`(p, head, tail)`
611+
`call `[[stdlib_system(module):split_path(interface)]]`(p, head, tail)`
612612

613613
### Class
614614
Subroutine
@@ -632,10 +632,10 @@ The splitted path. `head` and `tail`.
632632
### Example
633633

634634
```fortran
635-
{!example/system/example_path_splitpath.f90!}
635+
{!example/system/example_path_split_path.f90!}
636636
```
637637

638-
## `basename` - The last part of a path
638+
## `base_name` - The last part of a path
639639

640640
### Status
641641

@@ -647,7 +647,7 @@ This function returns the last part of a path after removing trailing path separ
647647

648648
### Syntax
649649

650-
`res = ` [[stdlib_system(module):basename(interface)]]`(p)`
650+
`res = ` [[stdlib_system(module):base_name(interface)]]`(p)`
651651

652652
### Class
653653
Function
@@ -658,7 +658,7 @@ Function
658658

659659
### Behavior
660660

661-
- The `tail` of `stdlib_system(module):splitpath(interface)` is exactly what is returned. Same Behavior.
661+
- The `tail` of `stdlib_system(module):split_path(interface)` is exactly what is returned. Same Behavior.
662662

663663
### Return values
664664

@@ -667,10 +667,10 @@ A character string.
667667
### Example
668668

669669
```fortran
670-
{!example/system/example_path_basename.f90!}
670+
{!example/system/example_path_base_name.f90!}
671671
```
672672

673-
## `dirname` - Everything except the last part of the path
673+
## `dir_name` - Everything except the last part of the path
674674

675675
### Status
676676

@@ -682,7 +682,7 @@ This function returns everything except the last part of a path.
682682

683683
### Syntax
684684

685-
`res = ` [[stdlib_system(module):dirname(interface)]]`(p)`
685+
`res = ` [[stdlib_system(module):dir_name(interface)]]`(p)`
686686

687687
### Class
688688
Function
@@ -693,7 +693,7 @@ Function
693693

694694
### Behavior
695695

696-
- The `head` of `stdlib_system(module):splitpath(interface)` is exactly what is returned. Same Behavior.
696+
- The `head` of `stdlib_system(module):split_path(interface)` is exactly what is returned. Same Behavior.
697697

698698
### Return values
699699

@@ -702,5 +702,5 @@ A character string.
702702
### Example
703703

704704
```fortran
705-
{!example/system/example_path_dirname.f90!}
705+
{!example/system/example_path_dir_name.f90!}
706706
```

example/system/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ADD_EXAMPLE(process_5)
1111
ADD_EXAMPLE(process_6)
1212
ADD_EXAMPLE(process_7)
1313
ADD_EXAMPLE(sleep)
14-
ADD_EXAMPLE(path_basename)
15-
ADD_EXAMPLE(path_dirname)
1614
ADD_EXAMPLE(path_join)
17-
ADD_EXAMPLE(path_splitpath)
15+
ADD_EXAMPLE(path_split_path)
16+
ADD_EXAMPLE(path_base_name)
17+
ADD_EXAMPLE(path_dir_name)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
! Usage of base_name
2+
program example_path_base_name
3+
use stdlib_system, only: base_name, ISWIN
4+
character(len=:), allocatable :: p1
5+
6+
if( ISWIN ) then
7+
p1 = 'C:\Users'
8+
else
9+
p1 = '/home'
10+
endif
11+
12+
print *, 'base name of '// p1 // ' -> ' // base_name(p1)
13+
! base name of C:\Users -> Users
14+
! OR
15+
! base name of /home -> home
16+
end program example_path_base_name

example/system/example_path_basename.f90

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
! Usage of dir_name
2+
program example_path_dir_name
3+
use stdlib_system, only: dir_name, ISWIN
4+
character(len=:), allocatable :: p1, head, tail
5+
6+
if( ISWIN ) then
7+
p1 = 'C:\Users' ! C:\Users
8+
else
9+
p1 = '/home' ! /home
10+
endif
11+
12+
print *, 'dir_name of '// p1 // ' -> ' // dir_name(p1)
13+
! dir_name of C:\Users -> C:\
14+
! OR
15+
! dir_name of /home -> /
16+
end program example_path_dir_name

example/system/example_path_dirname.f90

Lines changed: 0 additions & 16 deletions
This file was deleted.

example/system/example_path_join.f90

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
! Usage of joinpath, operator(/)
1+
! Usage of join_path, operator(/)
22
program example_path_join
3-
use stdlib_system, only: joinpath, operator(/), ISWIN
3+
use stdlib_system, only: join_path, operator(/), ISWIN
44
character(len=:), allocatable :: p1, p2, p3
55
character(len=20) :: parr(4)
66

77
if( ISWIN ) then
88
p1 = 'C:'/'Users'/'User1'/'Desktop'
9-
p2 = joinpath('C:\Users\User1', 'Desktop')
9+
p2 = join_path('C:\Users\User1', 'Desktop')
1010
parr = [character(len=20) :: 'C:', 'Users', 'User1', 'Desktop']
11-
p3 = joinpath(parr)
11+
p3 = join_path(parr)
1212
else
1313
p1 = ''/'home'/'User1'/'Desktop'
14-
p2 = joinpath('/home/User1', 'Desktop')
14+
p2 = join_path('/home/User1', 'Desktop')
1515
parr = [character(len=20) :: '', 'home', 'User1', 'Desktop']
16-
p3 = joinpath(parr)
16+
p3 = join_path(parr)
1717
end if
1818

1919
! (p1 == p2 == p3) = '/home/User1/Desktop' OR 'C:\Users\User1\Desktop'
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
! Usage of splitpath, dirname, basename
2-
program example_path_splitpath
3-
use stdlib_system, only: joinpath, splitpath, ISWIN
1+
! Usage of split_path
2+
program example_path_split_path
3+
use stdlib_system, only: join_path, split_path, ISWIN
44
character(len=:), allocatable :: p1, head, tail
55

66
if( ISWIN ) then
7-
p1 = joinpath('C:\Users\User1', 'Desktop') ! C:\Users\User1\Desktop
7+
p1 = join_path('C:\Users\User1', 'Desktop') ! C:\Users\User1\Desktop
88
else
9-
p1 = joinpath('/home/User1', 'Desktop') ! /home/User1/Desktop
9+
p1 = join_path('/home/User1', 'Desktop') ! /home/User1/Desktop
1010
endif
1111

12-
call splitpath(p1, head, tail)
12+
call split_path(p1, head, tail)
1313
! head = /home/User1 OR C:\Users\User1, tail = Desktop
1414
print *, p1 // " -> " // head // " + " // tail
1515
! C:\Users\User1\Desktop -> C:\Users\User1 + Desktop
1616
! OR
1717
! /home/User1/Desktop -> /home/User1 + Desktop
1818

19-
call splitpath(head, p1, tail)
19+
call split_path(head, p1, tail)
2020
! p1 = /home OR C:\Users, tail = User1
2121
print *, head // " -> " // p1 // " + " // tail
2222
! C:\Users\User1 -> C:\Users + User1
2323
! OR
2424
! /home/User1 -> /home + User1
25-
end program example_path_splitpath
25+
end program example_path_split_path

src/stdlib_system.F90

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ module stdlib_system
9393
logical, parameter, public :: ISWIN = .false.
9494
#endif
9595

96-
public :: joinpath
96+
public :: join_path
9797
public :: operator(/)
98-
public :: splitpath
99-
public :: basename
100-
public :: dirname
98+
public :: split_path
99+
public :: base_name
100+
public :: dir_name
101101

102102
!! version: experimental
103103
!!
@@ -565,12 +565,12 @@ end function process_get_ID
565565

566566
end interface
567567

568-
interface joinpath
568+
interface join_path
569569
!! version: experimental
570570
!!
571571
!!### Summary
572572
!! join the paths provided according to the OS-specific path-separator
573-
!! ([Specification](../page/specs/stdlib_system.html#joinpath))
573+
!! ([Specification](../page/specs/stdlib_system.html#join_path))
574574
!!
575575
module pure function join2(p1, p2) result(path)
576576
character(:), allocatable :: path
@@ -581,7 +581,7 @@ module pure function joinarr(p) result(path)
581581
character(:), allocatable :: path
582582
character(*), intent(in) :: p(:)
583583
end function joinarr
584-
end interface joinpath
584+
end interface join_path
585585

586586
interface operator(/)
587587
!! version: experimental
@@ -596,54 +596,54 @@ module pure function join_op(p1, p2) result(path)
596596
end function join_op
597597
end interface operator(/)
598598

599-
interface splitpath
599+
interface split_path
600600
!! version: experimental
601601
!!
602602
!!### Summary
603603
!! splits the path immediately following the final path-separator
604604
!! separating into typically a directory and a file name.
605-
!! ([Specification](../page/specs/stdlib_system.html#splitpath))
605+
!! ([Specification](../page/specs/stdlib_system.html#split_path))
606606
!!
607607
!!### Description
608608
!! If the path is empty `head`='.' and tail=''
609609
!! If the path only consists of separators, `head` is set to the separator and tail is empty
610610
!! If the path is a root directory, `head` is set to that directory and tail is empty
611611
!! `head` ends with a path-separator iff the path appears to be a root directory or a child of the root directory
612-
module subroutine splitpath(p, head, tail)
612+
module subroutine split_path(p, head, tail)
613613
character(*), intent(in) :: p
614614
character(:), allocatable, intent(out) :: head, tail
615-
end subroutine splitpath
616-
end interface splitpath
615+
end subroutine split_path
616+
end interface split_path
617617

618-
interface basename
618+
interface base_name
619619
!! version: experimental
620620
!!
621621
!!### Summary
622-
!! returns the basename (last component) of the provided path
623-
!! ([Specification](../page/specs/stdlib_system.html#basename))
622+
!! returns the base name (last component) of the provided path
623+
!! ([Specification](../page/specs/stdlib_system.html#base_name))
624624
!!
625625
!!### Description
626-
!! The value returned is the `tail` of the interface `splitpath`
627-
module function basename(p) result(base)
626+
!! The value returned is the `tail` of the interface `split_path`
627+
module function base_name(p) result(base)
628628
character(:), allocatable :: base
629629
character(*), intent(in) :: p
630-
end function basename
631-
end interface basename
630+
end function base_name
631+
end interface base_name
632632

633-
interface dirname
633+
interface dir_name
634634
!! version: experimental
635635
!!
636636
!!### Summary
637637
!! returns everything but the last component of the provided path
638-
!! ([Specification](../page/specs/stdlib_system.html#dirname))
638+
!! ([Specification](../page/specs/stdlib_system.html#dir_name))
639639
!!
640640
!!### Description
641-
!! The value returned is the `head` of the interface `splitpath`
642-
module function dirname(p) result(base)
641+
!! The value returned is the `head` of the interface `split_path`
642+
module function dir_name(p) result(base)
643643
character(:), allocatable :: base
644644
character(*), intent(in) :: p
645-
end function dirname
646-
end interface dirname
645+
end function dir_name
646+
end interface dir_name
647647

648648

649649
contains

0 commit comments

Comments
 (0)