diff 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
line wrap: on
line diff
--- a/dmd/Macro.d	Tue Aug 31 03:53:49 2010 +0200
+++ b/dmd/Macro.d	Tue Aug 31 04:04:33 2010 +0200
@@ -2,4 +2,112 @@
 
 struct Macro	/// ???
 {
-}
\ No newline at end of file
+}
+
+/**
+It is very important to use version control macros correctly - the
+idea is that host and target are independent. If these are done
+correctly, cross compilers can be built.
+The host compiler and host operating system are also different,
+and are predefined by the host compiler. The ones used in
+dmd are:
+
+Macros defined by the compiler, not the code:
+
+    Compiler:
+	__DMC__		Digital Mars compiler
+	_MSC_VER	Microsoft compiler
+	__GNUC__	Gnu compiler
+
+    Host operating system:
+	_WIN32		Microsoft NT, Windows 95, Windows 98, Win32s,
+			Windows 2000, Win XP, Vista
+	_WIN64		Windows for AMD64
+	linux		Linux
+	__APPLE__	Mac OSX
+	__FreeBSD__	FreeBSD
+	__sun&&__SVR4	Solaris, OpenSolaris (yes, both macros are necessary)
+
+For the target systems, there are the target operating system and
+the target object file format:
+
+    Target operating system:
+	TARGET_WINDOS	Covers 32 bit windows and 64 bit windows
+	TARGET_LINUX	Covers 32 and 64 bit linux
+	TARGET_OSX	Covers 32 and 64 bit Mac OSX
+	TARGET_FREEBSD	Covers 32 and 64 bit FreeBSD
+	TARGET_SOLARIS	Covers 32 and 64 bit Solaris
+	TARGET_NET	Covers .Net
+
+    It is expected that the compiler for each platform will be able
+    to generate 32 and 64 bit code from the same compiler binary.
+
+    Target object module format:
+	OMFOBJ		Intel Object Module Format, used on Windows
+	ELFOBJ		Elf Object Module Format, used on linux, FreeBSD and Solaris
+	MACHOBJ		Mach-O Object Module Format, used on Mac OSX
+
+    There are currently no macros for byte endianness order.
+ */
+//version definitions from mars.h
+
+version(IN_GCC) // Changes for the GDC compiler by David Friedman
+{
+	static assert(false, "GDC not supported");
+}
+
+// default to DMDV2
+version(DMDV1) {} else
+version = DMDV2; // Version 2.0 features
+version = BREAKABI;	// 0 if not ready to break the ABI just yet
+version(DMDV2)
+{
+	version = STRUCTTHISREF;	// if 'this' for struct is a reference, not a pointer
+	version = SNAN_DEFAULT_INIT;// if floats are default initialized to signalling NaN
+	version = SARRAYVALUE;		// static arrays are value types
+}
+
+// Set if C++ mangling is done by the front end
+version(DMDV2)
+{
+	version(POSIX) // TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_SOLARIS
+		version = CPP_MANGLE;
+}
+
+/* Other targets are TARGET_LINUX, TARGET_OSX, TARGET_FREEBSD and
+ * TARGET_SOLARIS, which are
+ * set on the command line via the compiler makefile.
+ */
+
+version(_WIN32)
+{
+	version = TARGET_WINDOS;		// Windows dmd generates Windows targets
+	version = OMFOBJ;
+}
+
+version(TARGET_LINUX)
+	version = ELFOBJ;
+version(TARGET_FREEBSD)
+	version = ELFOBJ;
+version(TARGET_SOLARIS)
+	version = ELFOBJ;
+
+
+version(TARGET_OSX)
+	version = MACHOBJ;
+
+/* TODO:
+//Modify OutBuffer::writewchar to write the correct size of wchar
+#if _WIN32
+#define writewchar writeword
+#else
+//This needs a configuration test...
+#define writewchar write4
+#endif
+
+#define INTERFACE_OFFSET	0	// if 1, put classinfo as first entry
+//in interface vtbl[]'s
+#define INTERFACE_VIRTUAL	0	// 1 means if an interface appears
+//in the inheritance graph multiple
+//times, only one is used
+*/
\ No newline at end of file