diff dwt/internal/gtk/OS.d @ 104:62a654ba5276

optimation of static ctors
author Frank Benoit <benoit@tionex.de>
date Fri, 18 Jan 2008 19:13:47 +0100
parents ddb19cb18d2e
children fb5cc45e0be6
line wrap: on
line diff
--- a/dwt/internal/gtk/OS.d	Fri Jan 18 17:00:39 2008 +0100
+++ b/dwt/internal/gtk/OS.d	Fri Jan 18 19:13:47 2008 +0100
@@ -620,23 +620,21 @@
 +/
 //import dwt.internal.*;
 
+// for ctfe, save static ctor
+private int buildVERSION(int major, int minor, int micro) {
+    return (major << 16) + (minor << 8) + micro;
+}
+private int GTK_VERSION(){
+    return buildVERSION(gtk_major_version, gtk_minor_version, gtk_micro_version);
+}
+
 public class OS : Platform {
 
     /** OS Constants */
-    public static /*const*/ bool IsAIX, IsSunOS, IsLinux, IsHPUX;
-    public static void static_this() {
-        /* Initialize the OS flags and locale constants */
-        char[] osName = "Linux";//System.getProperty ("os.name");
-        bool isAIX = false, isSunOS = false, isLinux = false, isHPUX = false;
-        if (osName == "Linux") isLinux = true;
-        if (osName == "AIX") isAIX = true;
-        if (osName == "Solaris") isSunOS = true;
-        if (osName == "SunOS") isSunOS = true;
-        if (osName == "HP-UX") isHPUX = true;
-        IsAIX = isAIX;  IsSunOS = isSunOS;  IsLinux = isLinux;  IsHPUX = isHPUX;
-        //PORTING_LEFT
-        GTK_VERSION = buildVERSION(gtk_major_version(), gtk_minor_version(), gtk_micro_version());
-    }
+    public static const bool IsAIX   = false;
+    public static const bool IsSunOS = false;
+    public static const bool IsLinux = true;
+    public static const bool IsHPUX  = false;
 
     /** Constants */
     public static const int ATK_RELATION_LABELLED_BY = 4;
@@ -1082,11 +1080,14 @@
     public static const char[] ypad = "ypad";
     public static const char[] GTK_PRINT_SETTINGS_OUTPUT_URI = "output-uri";
 
-    public static /*const*/ int GTK_VERSION;// see static ctor = buildVERSION(gtk_major_version(), gtk_minor_version(), gtk_micro_version());
+    public static int GTK_VERSION(){
+        return .GTK_VERSION();
+    }
+//     = buildVERSION(gtk_major_version(), gtk_minor_version(), gtk_micro_version());
 
 
 public static int buildVERSION(int major, int minor, int micro) {
-    return (major << 16) + (minor << 8) + micro;
+    return .buildVERSION( major, minor, micro );
 }
 
 /++