1 // Written in the D programming language.
2 
3 /**
4  * Identify the compiler used and its various features.
5  *
6  * Copyright: Copyright The D Language Foundation 2000 - 2011.
7  * License:   $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
8  * Authors:   $(HTTP digitalmars.com, Walter Bright), Alex Rønne Petersen
9  * Source:    $(PHOBOSSRC std/compiler.d)
10  */
11 /*          Copyright The D Language Foundation 2000 - 2011.
12  * Distributed under the Boost Software License, Version 1.0.
13  *    (See accompanying file LICENSE_1_0.txt or copy at
14  *          http://www.boost.org/LICENSE_1_0.txt)
15  */
16 module std.compiler;
17 
18 immutable
19 {
20     /// Vendor specific string naming the compiler, for example: "Digital Mars D".
21     string name = __VENDOR__;
22 
23     /// Master list of D compiler vendors.
24     enum Vendor
25     {
26         unknown = 0,     /// Compiler vendor could not be detected
27         digitalMars = 1, /// Digital Mars D (DMD)
28         gnu = 2,         /// GNU D Compiler (GDC)
29         llvm = 3,        /// LLVM D Compiler (LDC)
30         dotNET = 4,      /// D.NET
31         sdc = 5,         /// Snazzy D Compiler (SDC)
32     }
33 
34     /// Which vendor produced this compiler.
35     version (StdDdoc)          Vendor vendor;
36     else version (DigitalMars) Vendor vendor = Vendor.digitalMars;
37     else version (GNU)         Vendor vendor = Vendor.gnu;
38     else version (LDC)         Vendor vendor = Vendor.llvm;
39     else version (D_NET)       Vendor vendor = Vendor.dotNET;
40     else version (SDC)         Vendor vendor = Vendor.sdc;
41     else                      Vendor vendor = Vendor.unknown;
42 
43 
44     /**
45      * The vendor specific version number, as in
46      * version_major.version_minor
47      */
48     uint version_major = __VERSION__ / 1000;
49     uint version_minor = __VERSION__ % 1000;    /// ditto
50 
51 
52     /**
53      * The version of the D Programming Language Specification
54      * supported by the compiler.
55      */
56     uint D_major = 2;
57     uint D_minor = 0;
58 }