Mercurial > projects > dil
annotate trunk/src/dil/CompilerInfo.d @ 794:a7320b7cb7dc
Removed module util/metastrings.d.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Wed, 27 Feb 2008 21:21:15 +0100 |
parents | 3b34f6a95a27 |
children |
rev | line source |
---|---|
465
e0d24e05a9ee
Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
1 /++ |
e0d24e05a9ee
Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
2 Author: Aziz Köksal |
e0d24e05a9ee
Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
3 License: GPL3 |
e0d24e05a9ee
Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
4 +/ |
e0d24e05a9ee
Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
5 module dil.CompilerInfo; |
e0d24e05a9ee
Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
6 |
e0d24e05a9ee
Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
7 version(D2) |
794
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
8 /// The major version number of this compiler. |
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
9 const uint VERSION_MAJOR = 2; |
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
10 else |
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
11 /// The major version number of this compiler. |
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
12 const uint VERSION_MAJOR = 1; |
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
13 |
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
14 /// The minor version number of this compiler. |
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
15 const uint VERSION_MINOR = 0; |
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
16 |
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
17 private char[] toString(uint x) |
465
e0d24e05a9ee
Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
18 { |
794
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
19 char[] str; |
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
20 do |
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
21 str = cast(char)('0' + (x % 10)) ~ str; |
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
22 while (x /= 10) |
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
23 return str; |
465
e0d24e05a9ee
Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
24 } |
e0d24e05a9ee
Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
25 |
794
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
26 private char[] toString(uint x, uint pad) |
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
27 { |
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
28 char[] str = toString(x); |
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
29 if (pad < str.length) |
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
30 return str; |
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
31 for (uint i = pad-str.length; i; i--) |
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
32 str = "0" ~ str; |
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
33 return str; |
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
34 } |
465
e0d24e05a9ee
Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
35 |
794
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
36 /// The compiler version formatted as a string. |
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
37 const char[] VERSION = toString(VERSION_MAJOR)~"."~toString(VERSION_MINOR, 3); |
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
38 /// The name of the compiler. |
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
39 const char[] VENDOR = "dil"; |
495
b60450804b6e
Attributes are evaluated during the parsing phase now.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
465
diff
changeset
|
40 |
513
6160ab7b1816
Refactored code related to settings.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
495
diff
changeset
|
41 /// The global, default alignment size for struct fields. |
794
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
42 const uint DEFAULT_ALIGN_SIZE = 4; |
525
a3f66502ea64
Added struct Types with pre-defined types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
513
diff
changeset
|
43 |
786
3b34f6a95a27
Added and revised documenation comments.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
629
diff
changeset
|
44 version(DDoc) |
794
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
45 const uint PTR_SIZE = 0; /// The pointer size depending on the platform. |
786
3b34f6a95a27
Added and revised documenation comments.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
629
diff
changeset
|
46 else |
525
a3f66502ea64
Added struct Types with pre-defined types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
513
diff
changeset
|
47 version(X86_64) |
794
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
48 const uint PTR_SIZE = 8; // Pointer size on 64-bit platforms. |
525
a3f66502ea64
Added struct Types with pre-defined types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
513
diff
changeset
|
49 else |
794
a7320b7cb7dc
Removed module util/metastrings.d.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
786
diff
changeset
|
50 const uint PTR_SIZE = 4; // Pointer size on 32-bit platforms. |