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 2596c8c

Browse files
committed
add example programs
1 parent eaaa0d1 commit 2596c8c

File tree

4 files changed

+25
-26
lines changed

4 files changed

+25
-26
lines changed

‎doc/specs/stdlib_system.md‎

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -376,19 +376,7 @@ Returns one of the `integer` `OS_*` parameters representing the OS type, from th
376376
### Example
377377

378378
```fortran
379-
program example_os_detection
380-
use stdlib_system, only: OS_TYPE, get_runtime_os
381-
implicit none
382-
integer :: os_type_cached, os_type_runtime
383-
384-
! Cached OS detection
385-
os_type_cached = OS_TYPE()
386-
print *, "Cached OS Type: ", os_type_cached
387-
388-
! Runtime OS detection (full inspection)
389-
os_type_runtime = get_runtime_os()
390-
print *, "Runtime OS Type: ", os_type_runtime
391-
end program example_os_detection
379+
{!example/system/example_get_runtime_os.f90!}
392380
```
393381

394382
---
@@ -427,17 +415,5 @@ Returns one of the `integer` `OS_*` parameters representing the OS type, from th
427415
### Example
428416

429417
```fortran
430-
program example_os_detection
431-
use stdlib_system, only: OS_TYPE, get_runtime_os
432-
implicit none
433-
integer :: os_type_cached, os_type_runtime
434-
435-
! Cached OS detection
436-
os_type_cached = OS_TYPE()
437-
print *, "Cached OS Type: ", os_type_cached
438-
439-
! Runtime OS detection (full inspection)
440-
os_type_runtime = get_runtime_os()
441-
print *, "Runtime OS Type: ", os_type_runtime
442-
end program example_os_detection
418+
{!example/system/example_os_type.f90!}
443419
```

‎example/system/CMakeLists.txt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
ADD_EXAMPLE(get_runtime_os)
2+
ADD_EXAMPLE(os_type)
13
ADD_EXAMPLE(process_1)
24
ADD_EXAMPLE(process_2)
35
ADD_EXAMPLE(process_3)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
! Demonstrate usage of (non-cached) runtime OS query
2+
program example_get_runtime_os
3+
use stdlib_system, only: OS_NAME, get_runtime_os
4+
implicit none
5+
6+
! Runtime OS detection (full inspection)
7+
print *, "Runtime OS Type: ", OS_NAME(get_runtime_os())
8+
9+
end program example_get_runtime_os

‎example/system/example_os_type.f90‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
! Demonstrate OS detection
2+
program example_os_type
3+
use stdlib_system, only: OS_TYPE, OS_NAME
4+
implicit none
5+
6+
integer :: current_os
7+
8+
! Cached OS detection
9+
current_os = OS_TYPE()
10+
print *, "Current OS Type: ", OS_NAME(current_os)
11+
12+
end program example_os_type

0 commit comments

Comments
(0)

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