annotate trunk/src/dil/CompilerInfo.d @ 525:a3f66502ea64

Added struct Types with pre-defined types. Added PTR_SIZE to dil.CompilerInfo. Fixed size of some types in metaInfoTable. Moved Cent and Ucent in a few places in enum TOK.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Sun, 16 Dec 2007 21:24:54 +0100
parents 6160ab7b1816
children d050e211402b
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;
525
a3f66502ea64 Added struct Types with pre-defined types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 513
diff changeset
44
a3f66502ea64 Added struct Types with pre-defined types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 513
diff changeset
45 version(X86_64)
a3f66502ea64 Added struct Types with pre-defined types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 513
diff changeset
46 {
a3f66502ea64 Added struct Types with pre-defined types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 513
diff changeset
47 const PTR_SIZE = 8; /// Pointer size on 64-bit platforms.
a3f66502ea64 Added struct Types with pre-defined types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 513
diff changeset
48 }
a3f66502ea64 Added struct Types with pre-defined types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 513
diff changeset
49 else
a3f66502ea64 Added struct Types with pre-defined types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 513
diff changeset
50 {
a3f66502ea64 Added struct Types with pre-defined types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 513
diff changeset
51 const PTR_SIZE = 4; /// Pointer size on 32-bit platforms.
a3f66502ea64 Added struct Types with pre-defined types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 513
diff changeset
52 }