Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 272eb67

Browse files
committed
further split examples and fix some autodoc links issues due to wrong declarations
1 parent c561108 commit 272eb67

File tree

10 files changed

+107
-105
lines changed

10 files changed

+107
-105
lines changed

‎doc/specs/stdlib_system.md‎

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ The result is a real value representing the elapsed time in seconds, measured fr
174174

175175
### Syntax
176176

177-
`delta_t = ` [[stdlib_system(module):elapsed(subroutine)]] `(process)`
177+
`delta_t = ` [[stdlib_system(module):elapsed(interface)]] `(process)`
178178

179179
### Arguments
180180

@@ -212,7 +212,7 @@ in case of process hang or delay.
212212

213213
### Syntax
214214

215-
`call ` [[stdlib_system(module):wait(subroutine)]] `(process [, max_wait_time])`
215+
`call ` [[stdlib_system(module):wait(interface)]] `(process [, max_wait_time])`
216216

217217
### Arguments
218218

@@ -243,7 +243,7 @@ This is especially useful for monitoring asynchronous processes and retrieving t
243243

244244
### Syntax
245245

246-
`call ` [[stdlib_system(module):update(subroutine)]] `(process)`
246+
`call ` [[stdlib_system(module):update(interface)]] `(process)`
247247

248248
### Arguments
249249

@@ -269,7 +269,7 @@ This interface is useful when a process needs to be forcefully stopped, for exam
269269

270270
### Syntax
271271

272-
`call ` [[stdlib_system(module):kill(subroutine)]] `(process, success)`
272+
`call ` [[stdlib_system(module):kill(interface)]] `(process, success)`
273273

274274
### Arguments
275275

@@ -298,7 +298,7 @@ It ensures that the requested sleep duration is honored on both Windows and Unix
298298

299299
### Syntax
300300

301-
`call ` [[stdlib_system(module):sleep(subroutine)]] `(millisec)`
301+
`call ` [[stdlib_system(module):sleep(interface)]] `(millisec)`
302302

303303
### Arguments
304304

@@ -324,7 +324,7 @@ This function is highly efficient and works during the compilation phase, avoidi
324324

325325
### Syntax
326326

327-
`result = ` [[stdlib_system(module):is_windows(function)]] `()`
327+
`result = ` [[stdlib_system(module):is_windows(interface)]] `()`
328328

329329
### Return Value
330330

@@ -359,7 +359,7 @@ If the OS cannot be identified, the function returns `OS_UNKNOWN`.
359359

360360
### Syntax
361361

362-
`os = [[stdlib_system(module):get_runtime_os(function)]]()`
362+
`os = `[[stdlib_system(module):get_runtime_os(function)]]`()`
363363

364364
### Class
365365

@@ -396,7 +396,7 @@ This caching mechanism ensures negligible overhead for repeated calls, unlike `g
396396

397397
### Syntax
398398

399-
`os = [[stdlib_system(module):OS_TYPE(function)]]()`
399+
`os = `[[stdlib_system(module):OS_TYPE(function)]]`()`
400400

401401
### Class
402402

@@ -431,7 +431,7 @@ It is designed to work across multiple platforms. On Windows, paths with both fo
431431

432432
### Syntax
433433

434-
`result = [[stdlib_system(module):is_directory(function)]](path)`
434+
`result = `[[stdlib_system(module):is_directory(function)]]`(path)`
435435

436436
### Class
437437

@@ -471,7 +471,7 @@ It reads as an empty file. The null device's path varies by operating system:
471471

472472
### Syntax
473473

474-
`path = [[stdlib_system(module):null_device(function)]]()`
474+
`path = `[[stdlib_system(module):null_device(function)]]`()`
475475

476476
### Class
477477

@@ -506,7 +506,7 @@ The function provides an optional error-handling mechanism via the `state_type`
506506

507507
### Syntax
508508

509-
`call [[stdlib_system(module):delete_file(subroutine)]] (path [, err])`
509+
`call `[[stdlib_system(module):delete_file(subroutine)]]` (path [, err])`
510510

511511
### Class
512512
Subroutine
@@ -546,8 +546,9 @@ i.e `\` for windows and `/` for others
546546

547547
### Syntax
548548

549-
`res = [[stdlib_system(module):joinpath(interface)]] (p1, p2)`
550-
`res = [[stdlib_system(module):joinpath(interface)]] (p)`
549+
`res = ` [[stdlib_system(module):joinpath(interface)]] ` (p1, p2)`
550+
551+
`res = ` [[stdlib_system(module):joinpath(interface)]] ` (p)`
551552

552553
### Class
553554
Pure function
@@ -562,24 +563,17 @@ Pure function
562563

563564
The resultant path.
564565

565-
### Example
566-
567-
```fortran
568-
{!example/system/example_path_1.f90!}
569-
```
570-
571566
## `operator(/)`
572567

573-
Join two paths according to the platform specific path-separator,
574-
Behavior exactly similar to `joinpath`
568+
Alternative syntax to`joinpath` using an overloaded operator. Join two paths according to the platform specific path-separator.
575569

576570
### Status
577571

578572
Experimental
579573

580574
### Syntax
581575

582-
`p = lval + rval`
576+
`p = lval / rval`
583577

584578
### Class
585579

@@ -588,6 +582,7 @@ Pure function.
588582
### Arguments
589583

590584
`lval`: A character string, `intent(in)`.
585+
591586
`rval`: A character string, `intent(in)`.
592587

593588
### Result value
@@ -597,7 +592,7 @@ The result is an `allocatable` character string
597592
#### Example
598593

599594
```fortran
600-
{!example/system/example_path_1.f90!}
595+
{!example/system/example_path_join.f90!}
601596
```
602597

603598
## `splitpath` - splits a path immediately following the last separator
@@ -613,7 +608,7 @@ splitting it into most of the times a directory and a file name.
613608

614609
### Syntax
615610

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

618613
### Class
619614
Subroutine
@@ -637,7 +632,7 @@ The splitted path. `head` and `tail`.
637632
### Example
638633

639634
```fortran
640-
{!example/system/example_path_1.f90!}
635+
{!example/system/example_path_splitpath.f90!}
641636
```
642637

643638
## `basename` - The last part of a path
@@ -652,7 +647,7 @@ This function returns the last part of a path after removing trailing path separ
652647

653648
### Syntax
654649

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

657652
### Class
658653
Function
@@ -672,7 +667,7 @@ A character string.
672667
### Example
673668

674669
```fortran
675-
{!example/system/example_path_1.f90!}
670+
{!example/system/example_path_basename.f90!}
676671
```
677672

678673
## `dirname` - Everything except the last part of the path
@@ -687,7 +682,7 @@ This function returns everything except the last part of a path.
687682

688683
### Syntax
689684

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

692687
### Class
693688
Function
@@ -707,5 +702,5 @@ A character string.
707702
### Example
708703

709704
```fortran
710-
{!example/system/example_path_1.f90!}
705+
{!example/system/example_path_dirname.f90!}
711706
```

‎example/system/CMakeLists.txt‎

Lines changed: 4 additions & 4 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_1)
15-
ADD_EXAMPLE(path_1_windows)
16-
ADD_EXAMPLE(path_2)
17-
ADD_EXAMPLE(path_2_windows)
14+
ADD_EXAMPLE(path_basename)
15+
ADD_EXAMPLE(path_dirname)
16+
ADD_EXAMPLE(path_join)
17+
ADD_EXAMPLE(path_splitpath)

‎example/system/example_path_1.f90‎

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

‎example/system/example_path_1_windows.f90‎

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

‎example/system/example_path_2.f90‎

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

‎example/system/example_path_2_windows.f90‎

Lines changed: 0 additions & 19 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 splitpath, dirname, basename
2+
program example_path_splitpath
3+
use stdlib_system, only: basename, 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 *, 'basename of '// p1 // ' -> ' // basename(p1)
13+
! basename of C:\Users -> Users
14+
! OR
15+
! basename of /home -> home
16+
end program example_path_splitpath
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
! Usage of splitpath, dirname, basename
2+
program example_path_splitpath
3+
use stdlib_system, only: dirname, 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 *, 'dirname of '// p1 // ' -> ' // dirname(p1)
13+
! dirname of C:\Users -> C:\
14+
! OR
15+
! dirname of /home -> /
16+
end program example_path_splitpath

‎example/system/example_path_join.f90‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
! Usage of joinpath, operator(/)
2+
program example_path_join
3+
use stdlib_system, only: joinpath, operator(/), ISWIN
4+
character(len=:), allocatable :: p1, p2, p3
5+
character(len=20) :: parr(4)
6+
7+
if( ISWIN ) then
8+
p1 = 'C:'/'Users'/'User1'/'Desktop'
9+
p2 = joinpath('C:\Users\User1', 'Desktop')
10+
else
11+
p1 = ''/'home'/'User1'/'Desktop'
12+
p2 = joinpath('/home/User1', 'Desktop')
13+
end if
14+
15+
parr = [character(len=20) :: '', 'home', 'User1', 'Desktop']
16+
p3 = joinpath(parr)
17+
18+
! (p1 == p2 == p3) = '/home/User1/Desktop' OR 'C:'/'Users'/'User1'/'Desktop'
19+
print *, p1 ! /home/User1/Desktop OR 'C:'/'Users'/'User1'/'Desktop'
20+
print *, "p1 == p2: ", p1 == p2 ! T
21+
print *, "p2 == p3: ", p2 == p3 ! T
22+
end program example_path_join
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
! Usage of splitpath, dirname, basename
2+
program example_path_splitpath
3+
use stdlib_system, only: joinpath, splitpath, ISWIN
4+
character(len=:), allocatable :: p1, head, tail
5+
6+
if( ISWIN ) then
7+
p1 = joinpath('C:\Users\User1', 'Desktop') ! C:\Users\User1\Desktop
8+
else
9+
p1 = joinpath('/home/User1', 'Desktop') ! /home/User1/Desktop
10+
endif
11+
12+
call splitpath(p1, head, tail)
13+
! head = /home/User1 OR C:\Users\User1, tail = Desktop
14+
print *, p1 // " -> " // head // " + " // tail
15+
! C:\Users\User1\Desktop -> C:\Users\User1 + Desktop
16+
! OR
17+
! /home/User1/Desktop -> /home/User1 + Desktop
18+
19+
call splitpath(head, p1, tail)
20+
! p1 = /home OR C:\Users, tail = User1
21+
print *, head // " -> " // p1 // " + " // tail
22+
! C:\Users\User1 -> C:\Users + User1
23+
! OR
24+
! /home/User1 -> /home + User1
25+
end program example_path_splitpath

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /