annotate dmd/Macro.d @ 99:903b95002d4e

Id and Macro are quite experimental currently
author Trass3r
date Tue, 31 Aug 2010 04:04:33 +0200
parents 10317f0c89a5
children e28b18c23469
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
1 module dmd.Macro;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
2
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
3 struct Macro /// ???
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
4 {
99
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
5 }
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
6
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
7 /**
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
8 It is very important to use version control macros correctly - the
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
9 idea is that host and target are independent. If these are done
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
10 correctly, cross compilers can be built.
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
11 The host compiler and host operating system are also different,
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
12 and are predefined by the host compiler. The ones used in
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
13 dmd are:
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
14
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
15 Macros defined by the compiler, not the code:
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
16
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
17 Compiler:
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
18 __DMC__ Digital Mars compiler
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
19 _MSC_VER Microsoft compiler
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
20 __GNUC__ Gnu compiler
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
21
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
22 Host operating system:
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
23 _WIN32 Microsoft NT, Windows 95, Windows 98, Win32s,
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
24 Windows 2000, Win XP, Vista
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
25 _WIN64 Windows for AMD64
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
26 linux Linux
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
27 __APPLE__ Mac OSX
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
28 __FreeBSD__ FreeBSD
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
29 __sun&&__SVR4 Solaris, OpenSolaris (yes, both macros are necessary)
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
30
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
31 For the target systems, there are the target operating system and
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
32 the target object file format:
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
33
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
34 Target operating system:
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
35 TARGET_WINDOS Covers 32 bit windows and 64 bit windows
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
36 TARGET_LINUX Covers 32 and 64 bit linux
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
37 TARGET_OSX Covers 32 and 64 bit Mac OSX
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
38 TARGET_FREEBSD Covers 32 and 64 bit FreeBSD
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
39 TARGET_SOLARIS Covers 32 and 64 bit Solaris
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
40 TARGET_NET Covers .Net
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
41
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
42 It is expected that the compiler for each platform will be able
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
43 to generate 32 and 64 bit code from the same compiler binary.
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
44
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
45 Target object module format:
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
46 OMFOBJ Intel Object Module Format, used on Windows
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
47 ELFOBJ Elf Object Module Format, used on linux, FreeBSD and Solaris
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
48 MACHOBJ Mach-O Object Module Format, used on Mac OSX
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
49
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
50 There are currently no macros for byte endianness order.
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
51 */
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
52 //version definitions from mars.h
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
53
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
54 version(IN_GCC) // Changes for the GDC compiler by David Friedman
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
55 {
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
56 static assert(false, "GDC not supported");
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
57 }
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
58
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
59 // default to DMDV2
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
60 version(DMDV1) {} else
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
61 version = DMDV2; // Version 2.0 features
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
62 version = BREAKABI; // 0 if not ready to break the ABI just yet
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
63 version(DMDV2)
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
64 {
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
65 version = STRUCTTHISREF; // if 'this' for struct is a reference, not a pointer
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
66 version = SNAN_DEFAULT_INIT;// if floats are default initialized to signalling NaN
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
67 version = SARRAYVALUE; // static arrays are value types
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
68 }
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
69
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
70 // Set if C++ mangling is done by the front end
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
71 version(DMDV2)
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
72 {
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
73 version(POSIX) // TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_SOLARIS
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
74 version = CPP_MANGLE;
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
75 }
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
76
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
77 /* Other targets are TARGET_LINUX, TARGET_OSX, TARGET_FREEBSD and
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
78 * TARGET_SOLARIS, which are
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
79 * set on the command line via the compiler makefile.
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
80 */
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
81
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
82 version(_WIN32)
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
83 {
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
84 version = TARGET_WINDOS; // Windows dmd generates Windows targets
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
85 version = OMFOBJ;
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
86 }
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
87
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
88 version(TARGET_LINUX)
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
89 version = ELFOBJ;
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
90 version(TARGET_FREEBSD)
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
91 version = ELFOBJ;
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
92 version(TARGET_SOLARIS)
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
93 version = ELFOBJ;
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
94
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
95
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
96 version(TARGET_OSX)
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
97 version = MACHOBJ;
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
98
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
99 /* TODO:
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
100 //Modify OutBuffer::writewchar to write the correct size of wchar
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
101 #if _WIN32
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
102 #define writewchar writeword
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
103 #else
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
104 //This needs a configuration test...
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
105 #define writewchar write4
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
106 #endif
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
107
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
108 #define INTERFACE_OFFSET 0 // if 1, put classinfo as first entry
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
109 //in interface vtbl[]'s
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
110 #define INTERFACE_VIRTUAL 0 // 1 means if an interface appears
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
111 //in the inheritance graph multiple
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
112 //times, only one is used
903b95002d4e Id and Macro are quite experimental currently
Trass3r
parents: 0
diff changeset
113 */