diff java/src/java/mangoicu/ICU.d @ 21:9b96950f2c3c

the 'java' tree compiles on both D1-Tango and D2-Phobos
author Frank Benoit <benoit@tionex.de>
date Thu, 19 Mar 2009 20:38:55 +0100
parents dbfb303e8fb0
children f589fc20a5f9
line wrap: on
line diff
--- a/java/src/java/mangoicu/ICU.d	Wed Mar 18 12:10:17 2009 +0100
+++ b/java/src/java/mangoicu/ICU.d	Thu Mar 19 20:38:55 2009 +0100
@@ -42,6 +42,7 @@
 
 module java.mangoicu.ICU;
 
+import java.lang.util;
 /*******************************************************************************
 
         Library version identifiers
@@ -50,28 +51,28 @@
 
 version (ICU30)
         {
-        private static const final char[] ICULib = "30";
-        private static const final char[] ICUSig = "_3_0\0";
+        private static const char[] ICULib = "30";
+        private static const char[] ICUSig = "_3_0\0";
         }
 version (ICU32)
         {
-        private static const final char[] ICULib = "32";
-        private static const final char[] ICUSig = "_3_2\0";
+        private static const char[] ICULib = "32";
+        private static const char[] ICUSig = "_3_2\0";
         }
 version (ICU34)
         {
-        private static const final char[] ICULib = "34";
-        private static const final char[] ICUSig = "_3_4\0";
+        private static const char[] ICULib = "34";
+        private static const char[] ICUSig = "_3_4\0";
         }
 version (ICU36)
         {
-        private static const final char[] ICULib = "36";
-        private static const final char[] ICUSig = "_3_6\0";
+        private static const char[] ICULib = "36";
+        private static const char[] ICUSig = "_3_6\0";
         }
 else
         {
-        private static const final char[] ICULib = "38";
-        private static const final char[] ICUSig = "_3_8\0";
+        private static const char[] ICULib = "38";
+        private static const char[] ICUSig = "_3_8\0";
         }
 
 /*******************************************************************************
@@ -177,16 +178,16 @@
 
         ***********************************************************************/
 
-        package static final void exception (char[] msg)
+        package static final void exception (CString msg)
         {
-                throw new ICUException (msg);
+                throw new ICUException ( cast(String)msg);
         }
 
         /***********************************************************************
 
         ***********************************************************************/
 
-        package static final void testError (UErrorCode e, char[] msg)
+        package static final void testError (UErrorCode e, CString msg)
         {
                 if (e > 0)
                     exception (msg);
@@ -196,9 +197,9 @@
 
         ***********************************************************************/
 
-        protected static final char* toString (char[] string)
+        package static final char* toString (CString string)
         {
-                static char[] empty = "";
+                static char[] empty;
 
                 if (! string.length)
                       return (string.ptr) ? empty.ptr : null;
@@ -211,16 +212,16 @@
                    copy [string.length] = 0;
                    string = copy;
                    }
-                return string.ptr;
+                return cast(char*)string.ptr;
         }
 
         /***********************************************************************
 
         ***********************************************************************/
 
-        protected static final wchar* toString (wchar[] string)
+        package static final wchar* toString (CString16 string)
         {
-                static wchar[] empty = "";
+                static wchar[] empty;
 
                 if (! string.length)
                       return (string.ptr) ? empty.ptr : null;
@@ -233,7 +234,7 @@
                    copy [string.length] = 0;
                    string = copy;
                    }
-                return string.ptr;
+                return cast(wchar*)string.ptr;
         }
 
         /***********************************************************************
@@ -290,7 +291,7 @@
 
         ***********************************************************************/
 
-        this (char[] msg)
+        this (String msg)
         {
                 super (msg);
         }
@@ -329,7 +330,7 @@
                 protected struct Bind
                 {
                         void**  fnc;
-                        char[]  name;
+                        CString  name;
                 }
 
                 /***************************************************************
@@ -342,12 +343,12 @@
 
                         foreach (Bind b; targets)
                                 {
-                                char[] name = b.name ~ ICUSig;
-                                *b.fnc = GetProcAddress (lib, name.ptr);
+                                auto name = b.name ~ ICUSig;
+                                *b.fnc = GetProcAddress (lib, cast(char*)name.ptr);
                                 if (*b.fnc)
                                    {}// printf ("bound '%.*s'\n", name);
                                 else
-                                   throw new Exception ("required " ~ name ~ " in library " ~ library);
+                                   throw new Exception ( cast(String)("required " ~ name ~ " in library " ~ library));
                                 }
                         return lib;
                 }
@@ -400,7 +401,7 @@
                 protected struct Bind
                 {
                         void**  fnc;
-                        char[]  name;
+                        CString  name;
                 }
 
                 /***************************************************************
@@ -559,7 +560,7 @@
                 protected struct Bind
                 {
                         void**  fnc;
-                        char[]  name;
+                        CString  name;
                 }
 
                 /***************************************************************