1 // Written in the D programming language.
4 * Information about the target operating system, environment, and CPU.
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)
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.
25 $(DDSUBLINK spec/version,PredefinedVersions, Predefined Versions)
29 win32 = 1, /// Microsoft 32 bit Windows systems
30 win64, /// Microsoft 64 bit Windows systems
31 linux, /// All Linux Systems, except for Android
35 dragonFlyBSD, /// DragonFlyBSD
38 otherPosix /// Other Posix Systems
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.");
54 Byte order endianness.
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)).
64 $(DDSUBLINK spec/version,PredefinedVersions, Predefined Versions)
68 bigEndian, /// Big endian byte order
69 littleEndian /// Little endian byte order
72 /// The endianness that the program was compiled for.
73 version (LittleEndian) Endian endian = Endian.littleEndian;
74 else Endian endian = Endian.bigEndian;