]> git.ipfire.org Git - thirdparty/gcc.git/blob - libphobos/src/std/system.d
libphobos: Merge phobos and druntime with upstream.
[thirdparty/gcc.git] / libphobos / src / std / system.d
1 // Written in the D programming language.
2
3 /**
4 * Information about the target operating system, environment, and CPU.
5 *
6 * Copyright: Copyright Digital Mars 2000 - 2011
7 * License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
8 * Authors: $(HTTP digitalmars.com, Walter Bright) and Jonathan M Davis
9 * Source: $(PHOBOSSRC std/_system.d)
10 */
11 module std.system;
12
13 immutable
14 {
15 /++
16 Operating system.
17
18 Note:
19 This is for cases where you need a value representing the OS at
20 runtime. If you're doing something which should compile differently
21 on different OSes, then please use $(D version (Windows)),
22 $(D version (linux)), etc.
23
24 See_Also:
25 $(DDSUBLINK spec/version,PredefinedVersions, Predefined Versions)
26 +/
27 enum OS
28 {
29 win32 = 1, /// Microsoft 32 bit Windows systems
30 win64, /// Microsoft 64 bit Windows systems
31 linux, /// All Linux Systems, except for Android
32 osx, /// Mac OS X
33 freeBSD, /// FreeBSD
34 netBSD, /// NetBSD
35 dragonFlyBSD, /// DragonFlyBSD
36 solaris, /// Solaris
37 android, /// Android
38 otherPosix /// Other Posix Systems
39 }
40
41 /// The OS that the program was compiled for.
42 version (Win32) OS os = OS.win32;
43 else version (Win64) OS os = OS.win64;
44 else version (Android) OS os = OS.android;
45 else version (linux) OS os = OS.linux;
46 else version (OSX) OS os = OS.osx;
47 else version (FreeBSD) OS os = OS.freeBSD;
48 else version (NetBSD) OS os = OS.netBSD;
49 else version (DragonFlyBSD) OS os = OS.dragonFlyBSD;
50 else version (Posix) OS os = OS.otherPosix;
51 else static assert(0, "Unknown OS.");
52
53 /++
54 Byte order endianness.
55
56 Note:
57 This is intended for cases where you need to deal with endianness at
58 runtime. If you're doing something which should compile differently
59 depending on whether you're compiling on a big endian or little
60 endian machine, then please use $(D version (BigEndian)) and
61 $(D version (LittleEndian)).
62
63 See_Also:
64 $(DDSUBLINK spec/version,PredefinedVersions, Predefined Versions)
65 +/
66 enum Endian
67 {
68 bigEndian, /// Big endian byte order
69 littleEndian /// Little endian byte order
70 }
71
72 /// The endianness that the program was compiled for.
73 version (LittleEndian) Endian endian = Endian.littleEndian;
74 else Endian endian = Endian.bigEndian;
75 }
76