Sys/OS.pm untested

filter: Statementstmt n/a Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a SCAR -
1 package SPVM::Sys::OS;
2  
3 1;
4  
5 =head1 Name
6  
7 SPVM::Sys::OS - OS Information
8  
9 =head1 Description
10  
11 Sys::OS class in L<SPVM> has methods to get OS information.
12  
13 =head1 Usage
14  
15 use Sys::OS;
16
17 my $is_windows = Sys::OS->defined("_WIN32");
18  
19 my $is_windows = Sys::OS->is_windows;
20  
21 =head1 Class Methods
22  
23 =head2 defined
24  
25 C<static method defined : int ($macro_name : string, $value_ref : object of int[]|long[]|double[] = undef);>
26  
27 Checks if the macro $macro_name is defined on the system. If the macro is defined, returns 1, otherwise returns 0.
28  
29 If $value_ref is given, the macro value is set to the first element of $value_ref.
30  
31 The following macro names are supported.
32  
33 =over 2
34  
35 =item * __GNUC__
36  
37 =item * __clang__
38  
39 =item * __BORLANDC__
40  
41 =item * __INTEL_COMPILER
42  
43 =item * __unix
44  
45 =item * __unix__
46  
47 =item * __linux
48  
49 =item * __linux__
50  
51 =item * __FreeBSD__
52  
53 =item * __NetBSD__
54  
55 =item * __OpenBSD__
56  
57 =item * _WIN32
58  
59 =item * WIN32
60  
61 =item * _WIN64
62  
63 =item * _WINDOWS
64  
65 =item * _CONSOLE
66  
67 =item * WINVER
68  
69 =item * _WIN32_WINDOWS
70  
71 =item * _WIN32_WINNT
72  
73 =item * WINCEOSVER
74  
75 =item * __CYGWIN__
76  
77 =item * __CYGWIN32__
78  
79 =item * __MINGW32__
80  
81 =item * __MINGW64__
82  
83 =item * __APPLE__
84  
85 =item * __MACH__
86  
87 =item * __sun
88  
89 =item * __solaris
90  
91 =back
92  
93 Exceptions:
94  
95 $value_ref must be the int[], long[], or double[] type. Otherwise an exception is thrown.
96  
97 If the macro name is not supported, an exception is thrown.
98  
99 =head2 is_windows
100  
101 C<static method is_windows : int ();>
102  
103 If the OS is Windows(C<_WIN32> is defined), returns 1, otherwise returns 0.
104  
105 =head1 See Also
106  
107 =over 2
108  
109 =item * L<Sys|SPVM::Sys>
110  
111 =back
112  
113 =head1 Copyright & License
114  
115 Copyright (c) 2023 Yuki Kimoto
116  
117 MIT License
118