annotate trunk/src/dil/CompilerInfo.d @ 513:6160ab7b1816

Refactored code related to settings.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Fri, 14 Dec 2007 19:08:21 +0100
parents b60450804b6e
children a3f66502ea64
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 import std.metastrings : FormatT = Format, ToString;
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
7
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
8 template Pad(char[] str, uint amount)
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
9 {
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
10 static if (str.length >= amount)
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
11 const char[] Pad = str;
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
12 else
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
13 const char[] Pad = "0" ~ Pad!(str, amount-1);
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
14 }
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
15
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
16 template Pad(int num, uint amount)
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
17 {
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
18 const char[] Pad = Pad!(ToString!(num), amount);
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
19 }
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
20
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
21 version(D2)
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
22 {
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
23 const VERSION_MAJOR = 2;
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
24 const VERSION_MINOR = 0;
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
25 }
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
26 else
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
27 {
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
28 const VERSION_MAJOR = 1;
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
29 const VERSION_MINOR = 0;
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
30 }
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
31
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
32 const VERSION = FormatT!("%s.%s", VERSION_MAJOR, Pad!(VERSION_MINOR, 3));
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
33 const VENDOR = "dil";
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
34
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
35 /// Used in main help message.
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
36 const COMPILED_WITH = __VENDOR__;
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
37 /// ditto
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
38 const COMPILED_VERSION = FormatT!("%s.%s", __VERSION__/1000, Pad!(__VERSION__%1000, 3));
e0d24e05a9ee Forgot to add the new module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
39 /// ditto
495
b60450804b6e Attributes are evaluated during the parsing phase now.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 465
diff changeset
40 const COMPILED_DATE = __TIMESTAMP__;
b60450804b6e Attributes are evaluated during the parsing phase now.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 465
diff changeset
41
513
6160ab7b1816 Refactored code related to settings.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 495
diff changeset
42 /// The global, default alignment size for struct fields.
6160ab7b1816 Refactored code related to settings.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 495
diff changeset
43 const DEFAULT_ALIGN_SIZE = 4;