Skip to content

Commit 56f02ab

Browse files
committed
has_win32 -> is_windows
1 parent 4d5eb32 commit 56f02ab

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

doc/specs/stdlib_system.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -387,19 +387,21 @@ call sleep(500)
387387
print *, "Finished sleeping!"
388388
```
389389

390-
## `has_win32` - Check if the system is running on Windows
390+
## `is_windows` - Check if the system is running on Windows
391391

392392
### Status
393393

394394
Experimental
395395

396396
### Description
397397

398-
The `has_win32` interface provides a quick, compile-time check to determine if the current system is Windows. It leverages a C function that checks for the presence of the `_WIN32` macro, which is defined in C compilers when targeting Windows. This function is highly efficient and works during the compilation phase, avoiding the need for runtime checks.
398+
The `is_windows` interface provides a quick, compile-time check to determine if the current system is Windows.
399+
It leverages a C function that checks for the presence of the `_WIN32` macro, which is defined in C compilers when targeting Windows.
400+
This function is highly efficient and works during the compilation phase, avoiding the need for runtime checks.
399401

400402
### Syntax
401403

402-
`result = ` [[stdlib_system(module):has_win32(function)]] `()`
404+
`result = ` [[stdlib_system(module):is_windows(function)]] `()`
403405

404406
### Return Value
405407

@@ -408,7 +410,7 @@ Returns a `logical` flag: `.true.` if the system is Windows, or `.false.` otherw
408410
### Example
409411

410412
```fortran
411-
if (has_win32()) then
413+
if (is_windows()) then
412414
print *, "Running on Windows!"
413415
else
414416
print *, "Not running on Windows."

src/stdlib_system.F90

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module stdlib_system
1515
public :: wait
1616
public :: kill
1717
public :: elapsed
18-
public :: has_win32
18+
public :: is_windows
1919

2020
! CPU clock ticks storage
2121
integer, parameter, private :: TICKS = int64
@@ -326,7 +326,7 @@ end subroutine sleep
326326
!! version: experimental
327327
!!
328328
!! Returns a `logical` flag indicating if the system is Windows.
329-
!! ([Specification](../page/specs/stdlib_system.html#has_win32-check-if-the-system-is-running-on-windows))
329+
!! ([Specification](../page/specs/stdlib_system.html#is_windows-check-if-the-system-is-running-on-windows))
330330
!!
331331
!! ### Summary
332332
!! A fast, compile-time check to determine if the system is running Windows, based on the `_WIN32` macro.
@@ -337,13 +337,13 @@ end subroutine sleep
337337
!! wrapping a C function that tests if the `_WIN32` macro is defined. This check is fast and occurs at
338338
!! compile-time, making it a more efficient alternative to platform-specific runtime checks.
339339
!!
340-
!! The `has_win32` function is particularly useful for conditional compilation or system-specific code paths
340+
!! The `is_windows` function is particularly useful for conditional compilation or system-specific code paths
341341
!! that are dependent on whether the code is running on Windows.
342342
!!
343343
!! @note This function relies on the `_WIN32` macro, which is defined in C compilers when targeting Windows.
344344
!!
345-
module logical function has_win32()
346-
end function has_win32
345+
module logical function is_windows()
346+
end function is_windows
347347

348348
end interface
349349

src/stdlib_system_subprocess.F90

+5-5
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ type(c_ptr) function process_null_device(len) bind(C,name='process_null_device')
6060
end function process_null_device
6161

6262
! Utility: check if _WIN32 is defined in the C compiler
63-
logical(c_bool) function process_has_win32() bind(C,name='process_has_win32')
63+
logical(c_bool) function process_is_windows() bind(C,name='process_is_windows')
6464
import c_bool
6565
implicit none
66-
end function process_has_win32
66+
end function process_is_windows
6767

6868
end interface
6969

@@ -584,9 +584,9 @@ end function null_device
584584
!> Returns the file path of the null device for the current operating system.
585585
!>
586586
!> Version: Helper function.
587-
module logical function has_win32()
588-
has_win32 = logical(process_has_win32())
589-
end function has_win32
587+
module logical function is_windows()
588+
is_windows = logical(process_is_windows())
589+
end function is_windows
590590

591591
!> Reads a whole ASCII file and loads its contents into an allocatable character string..
592592
!> The function handles error states and optionally deletes the file after reading.

src/stdlib_system_subprocess.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ const char* process_null_device(int* len)
388388
}
389389

390390
// Returns a boolean flag if macro _WIN32 is defined
391-
bool process_has_win32()
391+
bool process_is_windows()
392392
{
393393
#ifdef _WIN32
394394
return true;

0 commit comments

Comments
 (0)