Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDietmar Maurer <dietmar@mono-cvs.ximian.com>2002-01-04 09:34:42 +0300
committerDietmar Maurer <dietmar@mono-cvs.ximian.com>2002-01-04 09:34:42 +0300
commit35867e86d6546aa0cf434aeafc4afbb05752b592 (patch)
treedeb9746fca5ce0dae7d3f4d205d53f8904d1e259
parent12d3d0ce8c28155947a4d73f08c0139aa1409672 (diff)
switched to glib2.0, unicode support, bug fixes
svn path=/trunk/mono/; revision=1802
-rw-r--r--ChangeLog4
-rw-r--r--acconfig.h1
-rw-r--r--configure.in37
-rw-r--r--doc/download45
-rw-r--r--mono/io-layer/unicode.c125
-rw-r--r--mono/jit/ChangeLog7
-rw-r--r--mono/jit/emit-x86.c24
-rw-r--r--mono/jit/jit.c2
-rw-r--r--mono/jit/x86.brg16
-rw-r--r--mono/metadata/Makefile.am2
-rw-r--r--mono/metadata/icall.c28
-rw-r--r--mono/metadata/object.c38
-rw-r--r--mono/metadata/object.h2
-rw-r--r--mono/metadata/unicode.c435
-rw-r--r--mono/metadata/unicode.h123
-rw-r--r--mono/tests/Makefile.am1
-rw-r--r--web/download45
17 files changed, 753 insertions, 182 deletions
diff --git a/ChangeLog b/ChangeLog
index 217b0c7085f..a8e8641be2d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2001-12-21 Dietmar Maurer <dietmar@ximian.com>
+
+ * mono/tests/Makefile.am (TESTSRC): disabled stream-writer test
+
2001-12-21 Aaron Weber <aaron@ximian.com>
* doc/faq (A): added a linebreak that was missing and was causing
diff --git a/acconfig.h b/acconfig.h
index 52fff9c0017..f78d17c4b8d 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -3,3 +3,4 @@
#undef HAVE_LARGE_FILE_SUPPORT
#undef PLATFORM_WIN32
#undef PLATFORM_WIN32_NATIVE
+#undef HAVE_NEW_ICONV
diff --git a/configure.in b/configure.in
index 2b22a75bc84..a28d2c00058 100644
--- a/configure.in
+++ b/configure.in
@@ -17,20 +17,19 @@ AC_CHECK_SIZEOF(void *)
CFLAGS='-g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations'
-dnl ***************************
-dnl *** Checks for glib 1.2 ***
-dnl ***************************
-AM_PATH_GLIB(1.2.0,,
- AC_MSG_ERROR([Cannot find GLIB: Is glib-config in path?]))
+## Versions of dependencies
+GLIB_REQUIRED_VERSION=1.3.11
-GLIB_CFLAGS=`glib-config --cflags glib`
-GLIB_LIBS=`glib-config --libs glib`
+PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION)
+
+GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
+GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
-GMODULE_CFLAGS=`glib-config --cflags gmodule`
-GMODULE_LIBS=`glib-config --libs gmodule`
+GMODULE_CFLAGS=`$PKG_CONFIG --cflags gmodule-2.0`
+GMODULE_LIBS=`$PKG_CONFIG --libs gmodule-2.0`
AC_SUBST(GMODULE_CFLAGS)
AC_SUBST(GMODULE_LIBS)
@@ -100,7 +99,6 @@ if test x$platform_win32 = xno; then
AC_DEFINE(HAVE_LARGE_FILE_SUPPORT)
CFLAGS="$CFLAGS $1"
large_offt=yes
- break
], [
AC_MSG_RESULT(no)
])
@@ -201,6 +199,25 @@ if test x$platform_win32 = xno; then
])
fi
+# check for new iconv version
+AC_MSG_CHECKING(for new iconv)
+AC_CACHE_VAL(new_iconv,[
+ AC_TRY_RUN([#include <stdio.h>
+ #include <iconv.h>
+
+ int main()
+ {
+ exit (iconv_open ("UTF-16le", "UTF-8") == (iconv_t)-1);
+ }
+ ],
+ new_iconv=yes)])
+if test -n "$new_iconv"; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_NEW_ICONV)
+else
+ AC_MSG_RESULT(no)
+fi
+
TARGET="unknown"
ACCESS_UNALIGNED="yes"
diff --git a/doc/download b/doc/download
index 40267a0f23b..11869427fdd 100644
--- a/doc/download
+++ b/doc/download
@@ -132,26 +132,35 @@ href="ftp://ftp.gtk.org/pub/gtk/v1.2/glib-1.2.10.tar.gz">ftp://ftp.gtk.org/pub/g
To compile the mono runtime on windows:
- <ul>
- * Install <a href="http://www.cygwin.com">CygWin</a> first.
-
- * Once installed, in a terminal window or a cygwin
- window (a shortcut should be on your desktop), untar the glib
- distribution:
-
-<pre>
-tar xzvf glib-1.2.10.tar.gz
-</pre>
+ <ul>
+ * Warning: We switched over to glib2.0, and we are still searching
+ for a volunteer who is able to provide us with binary packages
+ of glib2.0, pkgconfig and iconv. I was unable to compile
+ glib2.0 myself, so the following is only a rough outline how it
+ should work.
- * Configure, compile and install glib, like this:
+ * Install <a href="http://www.cygwin.com">CygWin</a> first.
+ * Install <a href="http://www.freedesktop.org/software/pkgconfig">pkgconfig</a>.
+ (I had to change line 674 of
+ <nobr><tt>pkgconfig-0.8.0/glib-1.2.8/gstrfuncs.c</nobr> from
+ <nobr><tt>extern char *strsignal (int sig);</nobr> to
+ <nobr><tt>extern const char *strsignal (int sig);</nobr>.
<pre>
+tar xzvf pkgconfig-0.8.0.tar.gz
+cd pkgconfig-0.8.0
./configure --prefix=/usr
make
make install
</pre>
- * You also need a patch found <a
- href="http://www.cygwin.com/ml/cygwin/2001-04/msg01792.html">here</a>.
+
+ * Install <a href="ftp://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.7.tar.gz">libiconv</a>.
+ If you dont have MS Visual C/C++ 4.0 or 5.0 or 6.0 you can also try
+ the binary package available at <a
+ href="http://www.gimp.org/win32/libiconv-dev-20001007.zip">here</a>.
+
+ * Install the newest glib (cvs head version). You can download it
+ from <a href="glib-1.3.11.tar.gz">here</a>.
* Unpack the mono distribution:
@@ -176,6 +185,16 @@ make install
To compile the mono runtime on Unix:
<ul>
+
+ * Install <a href="http://www.freedesktop.org/software/pkgconfig">pkgconfig</a>.
+
+ * Install newest glib (cvs head version). You can download it
+ from <a href="glib-1.3.11.tar.gz">here</a>. Maybe you need
+ to modify your ACLOCAL_FLAGS for pkgconfig, for example if
+ your install prefix is /usr/local:
+<pre>
+export ACLOCAL_FLAGS="-I /usr/local/share/aclocal"
+</pre>
* Download the mono distribution
diff --git a/mono/io-layer/unicode.c b/mono/io-layer/unicode.c
index 4994006faef..4b3a5b78332 100644
--- a/mono/io-layer/unicode.c
+++ b/mono/io-layer/unicode.c
@@ -7,46 +7,6 @@
#include "mono/io-layer/wapi.h"
#include "unicode.h"
-static pthread_key_t unicode_key;
-static pthread_once_t unicode_key_once=PTHREAD_ONCE_INIT;
-
-static void unicode_end(void *buf)
-{
- iconv_t cd=(iconv_t)buf;
-
- iconv_close(cd);
-}
-
-static void unicode_init(void)
-{
- pthread_key_create(&unicode_key, unicode_end);
-}
-
-static iconv_t unicode_reset(void)
-{
- iconv_t cd;
-
- pthread_once(&unicode_key_once, unicode_init);
-
- cd=pthread_getspecific(unicode_key);
- if(cd==NULL) {
- cd=iconv_open("UTF-8", "UNICODE");
- if(cd==(iconv_t)-1) {
- g_message(G_GNUC_PRETTY_FUNCTION ": Can't open iconv descriptor from UTF-8 to UNICODE");
- return(cd);
- }
- pthread_setspecific(unicode_key, cd);
- }
-
- if(cd==(iconv_t)-1) {
- return(cd);
- }
-
- iconv(cd, NULL, NULL, NULL, NULL);
-
- return(cd);
-}
-
/* This is a nasty kludge */
static guint32 unicode_len(const guchar *str)
{
@@ -64,86 +24,15 @@ static guint32 unicode_len(const guchar *str)
/* Cut&pasted from glib (switch to g_convert() when glib-2 is out */
guchar *_wapi_unicode_to_utf8(const guchar *uni)
{
- guchar *str;
- guchar *dest;
- guchar *outp;
- guchar *p;
- guint inbytes_remaining;
- guint outbytes_remaining;
- size_t err;
- guint outbuf_size;
- gint i, len;
- gboolean have_error = FALSE;
- iconv_t converter;
-
- converter=unicode_reset();
+ GError *error = NULL;
+ gchar *res;
+ int len;
- g_return_val_if_fail(uni != NULL, NULL);
- g_return_val_if_fail(converter != (iconv_t) -1, NULL);
-
len = unicode_len(uni);
-
-
- str = g_memdup(uni, (guint32)len+2); /* don't forget the double NULL */
-
- /* fixme: ugly - iconv expects big endian encoding
- UTF-16le does not work on older libc */
- if (G_BYTE_ORDER == G_LITTLE_ENDIAN) {
- for (i = 0; i < len; i += 2) {
- str [i] = uni [i + 1];
- str [i + 1] = uni [i];
- }
- }
-
- p = str;
- inbytes_remaining = len;
- outbuf_size = len + 1; /* + 1 for nul in case len == 1 */
-
- outbytes_remaining = outbuf_size - 1; /* -1 for nul */
- outp = dest = g_malloc(outbuf_size);
-
-again:
- err = iconv(converter, (char **)&p, &inbytes_remaining, (char **)&outp, &outbytes_remaining);
-
- if(err == (size_t)-1) {
- switch(errno) {
- case EINVAL:
- /* Incomplete text, do not report an error */
- break;
- case E2BIG: {
- size_t used = outp - dest;
-
- outbuf_size *= 2;
- dest = g_realloc(dest, outbuf_size);
-
- outp = dest + used;
- outbytes_remaining = outbuf_size - used - 1; /* -1 for nul */
-
- goto again;
- }
- case EILSEQ:
- have_error = TRUE;
- break;
- default:
- have_error = TRUE;
- break;
- }
- }
-
- *outp = '\0';
-
- if((p - str) != len) {
- if(!have_error) {
- have_error = TRUE;
- }
- }
+
+ res = g_utf16_to_utf8 (uni, len, NULL, NULL, &error);
- g_free(str);
+ g_assert (!error);
- if(have_error) {
- g_free (dest);
- return NULL;
- } else {
- return dest;
- }
+ return res;
}
diff --git a/mono/jit/ChangeLog b/mono/jit/ChangeLog
index 694f16af4cc..b17a87b77a1 100644
--- a/mono/jit/ChangeLog
+++ b/mono/jit/ChangeLog
@@ -1,3 +1,10 @@
+2001-12-21 Dietmar Maurer <dietmar@ximian.com>
+
+ * jit.c (mono_analyze_stack): spill MUL to avoid problem with
+ register allocation.
+
+ * emit-x86.c (arch_compile_method): fixed static delegate bug
+
2001-12-16 Miguel de Icaza <miguel@ximian.com>
* x86.brg, jit.c: Split up the nodes that we used to share on
diff --git a/mono/jit/emit-x86.c b/mono/jit/emit-x86.c
index 2d5d13ba076..b746216f411 100644
--- a/mono/jit/emit-x86.c
+++ b/mono/jit/emit-x86.c
@@ -523,6 +523,7 @@ tree_preallocate_regs (MBTree *tree, int goal, MonoRegSet *rs)
tree->exclude_mask |= (1 << X86_ECX);
tree->left->exclude_mask |= (1 << X86_ECX);
break;
+ case MB_TERM_MUL:
case MB_TERM_DIV:
case MB_TERM_DIV_UN:
case MB_TERM_REM:
@@ -821,7 +822,7 @@ arch_compile_method (MonoMethod *method)
int i, target, this_pos = 4;
guint8 *source;
- method->addr = g_malloc (32);
+ method->addr = g_malloc (64);
if (csig->ret->type == MONO_TYPE_VALUETYPE) {
g_assert (!csig->ret->byref);
@@ -838,16 +839,29 @@ arch_compile_method (MonoMethod *method)
x86_alu_reg_imm (code, X86_CMP, X86_EDX, 0);
x86_branch32 (code, X86_CC_EQ, target, TRUE);
source = code;
-
- /* virtual call - we have to replace the this pointer */
- x86_mov_membase_reg (code, X86_ESP, this_pos, X86_EDX, 4);
+ /* virtual delegate methods: we have to replace the this pointer
+ * withe the actual target */
+ x86_mov_membase_reg (code, X86_ESP, this_pos, X86_EDX, 4);
/* jump to method_ptr() */
+ x86_jump_membase (code, X86_EAX, method_offset);
+
+ /* static delegate methods: we have to remove the this pointer
+ * from the activation frame */
target = code - source;
+ if (this_pos == 8) {
+ x86_mov_reg_membase (code, X86_EDX, X86_ESP, 4, 4);
+ x86_mov_membase_reg (code, X86_ESP, 8, X86_EDX, 4);
+ }
+ x86_mov_reg_membase (code, X86_EDX, X86_ESP, 0, 4);
+ x86_mov_membase_reg (code, X86_ESP, 4, X86_EDX, 4);
+ x86_alu_reg_imm (code, X86_ADD, X86_ESP, 4);
+
+ /* jump to method_ptr() */
x86_jump_membase (code, X86_EAX, method_offset);
}
- g_assert ((code - (guint8*)method->addr) < 32);
+ g_assert ((code - (guint8*)method->addr) < 64);
} else {
if (mono_debug_handle)
diff --git a/mono/jit/jit.c b/mono/jit/jit.c
index 41e1eb0b6e6..fbe5341c98e 100644
--- a/mono/jit/jit.c
+++ b/mono/jit/jit.c
@@ -2495,7 +2495,7 @@ mono_analyze_stack (MonoFlowGraph *cfg)
MAKE_BI_ALU (SHL)
MAKE_BI_ALU (SHR)
MAKE_BI_ALU (SHR_UN)
- MAKE_BI_ALU (MUL)
+ MAKE_SPILLED_BI_ALU (MUL)
MAKE_SPILLED_BI_ALU (DIV)
MAKE_SPILLED_BI_ALU (DIV_UN)
MAKE_SPILLED_BI_ALU (REM)
diff --git a/mono/jit/x86.brg b/mono/jit/x86.brg
index 8b0b3bdc4e0..6086fe2bb52 100644
--- a/mono/jit/x86.brg
+++ b/mono/jit/x86.brg
@@ -1918,6 +1918,9 @@ lreg: MUL (lreg, lreg) {
if (mono_regset_reg_used (s->rs, X86_ECX))
x86_pop_reg (s->code, X86_ECX);
+
+ g_assert (tree->reg1 == X86_EAX &&
+ tree->reg2 == X86_EDX);
}
lreg: DIV (lreg, lreg) {
@@ -1934,6 +1937,9 @@ lreg: DIV (lreg, lreg) {
if (mono_regset_reg_used (s->rs, X86_ECX))
x86_pop_reg (s->code, X86_ECX);
+
+ g_assert (tree->reg1 == X86_EAX &&
+ tree->reg2 == X86_EDX);
}
lreg: REM (lreg, lreg) {
@@ -1950,6 +1956,9 @@ lreg: REM (lreg, lreg) {
if (mono_regset_reg_used (s->rs, X86_ECX))
x86_pop_reg (s->code, X86_ECX);
+
+ g_assert (tree->reg1 == X86_EAX &&
+ tree->reg2 == X86_EDX);
}
lreg: DIV_UN (lreg, lreg) {
@@ -1966,6 +1975,9 @@ lreg: DIV_UN (lreg, lreg) {
if (mono_regset_reg_used (s->rs, X86_ECX))
x86_pop_reg (s->code, X86_ECX);
+
+ g_assert (tree->reg1 == X86_EAX &&
+ tree->reg2 == X86_EDX);
}
lreg: REM_UN (lreg, lreg) {
@@ -1982,6 +1994,9 @@ lreg: REM_UN (lreg, lreg) {
if (mono_regset_reg_used (s->rs, X86_ECX))
x86_pop_reg (s->code, X86_ECX);
+
+ g_assert (tree->reg1 == X86_EAX &&
+ tree->reg2 == X86_EDX);
}
lreg: CALL_I8 (this, LDIND_I4 (ADDR_G)) {
@@ -2660,6 +2675,7 @@ stmt: RET_OBJ (reg) {
gint64
mono_llmult (gint64 a, gint64 b)
{
+printf ("LLMULT %lld %lld %lld\n", a,b, a*b);
return a * b;
}
diff --git a/mono/metadata/Makefile.am b/mono/metadata/Makefile.am
index 2449dd55124..9be8c8bd9d4 100644
--- a/mono/metadata/Makefile.am
+++ b/mono/metadata/Makefile.am
@@ -32,6 +32,8 @@ libmetadata_a_SOURCES = \
file-io.h \
exception.c \
exception.h \
+ unicode.c \
+ unicode.h
#
libmetadataincludedir = $(includedir)/mono/metadata
diff --git a/mono/metadata/icall.c b/mono/metadata/icall.c
index 0ccd308c74e..8722d78c63b 100644
--- a/mono/metadata/icall.c
+++ b/mono/metadata/icall.c
@@ -23,6 +23,7 @@
#include <mono/metadata/file-io.h>
#include <mono/metadata/mono-endian.h>
#include <mono/metadata/tokentype.h>
+#include <mono/metadata/unicode.h>
#include "decimal.h"
static MonoObject *
@@ -829,6 +830,33 @@ static gpointer icall_map [] = {
"System.PAL.OpSys::GetFileTime", ves_icall_System_PAL_OpSys_GetFileTime,
"System.PAL.OpSys::SetFileTime", ves_icall_System_PAL_OpSys_SetFileTime,
+ /*
+ * System.Char
+ */
+ "System.Char::GetNumericValue", ves_icall_System_Char_GetNumericValue,
+ "System.Char::GetUnicodeCategory", ves_icall_System_Char_GetUnicodeCategory,
+ "System.Char::IsControl", ves_icall_System_Char_IsControl,
+ "System.Char::IsDigit", ves_icall_System_Char_IsDigit,
+ "System.Char::IsLetter", ves_icall_System_Char_IsLetter,
+ "System.Char::IsLower", ves_icall_System_Char_IsLower,
+ "System.Char::IsUpper", ves_icall_System_Char_IsUpper,
+ "System.Char::IsNumber", ves_icall_System_Char_IsNumber,
+ "System.Char::IsPunctuation", ves_icall_System_Char_IsPunctuation,
+ "System.Char::IsSeparator", ves_icall_System_Char_IsSeparator,
+ "System.Char::IsSurrogate", ves_icall_System_Char_IsSurrogate,
+ "System.Char::IsSymbol", ves_icall_System_Char_IsSymbol,
+ "System.Char::IsWhiteSpace", ves_icall_System_Char_IsWhiteSpace,
+ "System.Char::ToLower", ves_icall_System_Char_ToLower,
+ "System.Char::ToUpper", ves_icall_System_Char_ToUpper,
+
+ "System.Text.Encoding::IConvNewEncoder", ves_icall_iconv_new_encoder,
+ "System.Text.Encoding::IConvNewDecoder", ves_icall_iconv_new_decoder,
+ "System.Text.Encoding::IConvReset", ves_icall_iconv_reset,
+ "System.Text.Encoding::IConvGetByteCount", ves_icall_iconv_get_byte_count,
+ "System.Text.Encoding::IConvGetBytes", ves_icall_iconv_get_bytes,
+ "System.Text.Encoding::IConvGetCharCount", ves_icall_iconv_get_char_count,
+ "System.Text.Encoding::IConvGetChars", ves_icall_iconv_get_chars,
+
"System.DateTime::GetNow", ves_icall_System_DateTime_GetNow,
/*
* add other internal calls here
diff --git a/mono/metadata/object.c b/mono/metadata/object.c
index 8b981256adb..dfdc92fb81f 100644
--- a/mono/metadata/object.c
+++ b/mono/metadata/object.c
@@ -220,19 +220,20 @@ mono_string_new_utf16 (const guint16 *text, gint32 len)
MonoString*
mono_string_new (const char *text)
{
- MonoString *o;
+ GError *error = NULL;
+ MonoString *o = NULL;
guint16 *ut;
- int i, l;
-
- /* fixme: use some kind of unicode library here */
+ glong items_written;
+ int l;
l = strlen (text);
- ut = g_malloc (l*2);
-
- for (i = 0; i < l; i++)
- ut [i] = text[i];
- o = mono_string_new_utf16 (ut, l);
+ ut = g_utf8_to_utf16 (text, l, NULL, &items_written, &error);
+
+ if (!error)
+ o = mono_string_new_utf16 (ut, items_written);
+ else
+ g_error_free (error);
g_free (ut);
@@ -416,7 +417,7 @@ char *
mono_string_to_utf8 (MonoString *s)
{
char *as, *vector;
- int i;
+ GError *error = NULL;
g_assert (s != NULL);
@@ -427,14 +428,9 @@ mono_string_to_utf8 (MonoString *s)
g_assert (vector != NULL);
- as = g_malloc (s->length + 1);
-
- /* fixme: replace with a real unicode/ansi conversion */
- for (i = 0; i < s->length; i++) {
- as [i] = vector [i*2];
- }
+ as = g_utf16_to_utf8 (vector, s->length, NULL, NULL, &error);
- as [i] = '\0';
+ g_assert (!error);
return as;
}
@@ -446,15 +442,15 @@ mono_string_to_utf16 (MonoString *s)
g_assert (s != NULL);
- as=g_malloc((s->length*2)+2);
- as[(s->length*2)]='\0';
- as[(s->length*2)+1]='\0';
+ as = g_malloc ((s->length * 2) + 2);
+ as [(s->length * 2)] = '\0';
+ as [(s->length * 2) + 1] = '\0';
if (!s->length || !s->c_str) {
return (as);
}
- memcpy(as, mono_string_chars(s), s->length*2);
+ memcpy (as, mono_string_chars(s), s->length * 2);
return (as);
}
diff --git a/mono/metadata/object.h b/mono/metadata/object.h
index 48309af67c4..8e7eb892256 100644
--- a/mono/metadata/object.h
+++ b/mono/metadata/object.h
@@ -46,6 +46,8 @@ typedef struct {
gpointer method_ptr;
} MonoDelegate;
+typedef guchar MonoBoolean;
+
typedef void (*MonoRuntimeObjectInit) (MonoObject *o);
extern MonoRuntimeObjectInit mono_runtime_object_init;
diff --git a/mono/metadata/unicode.c b/mono/metadata/unicode.c
new file mode 100644
index 00000000000..9caab262e7f
--- /dev/null
+++ b/mono/metadata/unicode.c
@@ -0,0 +1,435 @@
+/*
+ * unicode.h: Unicode support
+ *
+ * Author:
+ * Dietmar Maurer (dietmar@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+
+#include <config.h>
+#include <glib.h>
+#include <errno.h>
+
+#include <mono/metadata/object.h>
+#include <mono/metadata/unicode.h>
+
+#include <iconv.h>
+
+static MonoUnicodeCategory catmap[] = {
+ /* G_UNICODE_CONTROL = */ Control,
+ /* G_UNICODE_FORMAT = */ Format,
+ /* G_UNICODE_UNASSIGNED = */ OtherNotAssigned,
+ /* G_UNICODE_PRIVATE_USE = */ PrivateUse,
+ /* G_UNICODE_SURROGATE = */ Surrogate,
+ /* G_UNICODE_LOWERCASE_LETTER = */ LowercaseLetter,
+ /* G_UNICODE_MODIFIER_LETTER = */ ModifierLetter,
+ /* G_UNICODE_OTHER_LETTER = */ OtherLetter,
+ /* G_UNICODE_TITLECASE_LETTER = */ TitlecaseLetter,
+ /* G_UNICODE_UPPERCASE_LETTER = */ UppercaseLetter,
+ /* G_UNICODE_COMBINING_MARK = */ SpaceCombiningMark,
+ /* G_UNICODE_ENCLOSING_MARK = */ EnclosingMark,
+ /* G_UNICODE_NON_SPACING_MARK = */ NonSpacingMark,
+ /* G_UNICODE_DECIMAL_NUMBER = */ DecimalDigitNumber,
+ /* G_UNICODE_LETTER_NUMBER = */ LetterNumber,
+ /* G_UNICODE_OTHER_NUMBER = */ OtherNumber,
+ /* G_UNICODE_CONNECT_PUNCTUATION = */ ConnectorPunctuation,
+ /* G_UNICODE_DASH_PUNCTUATION = */ DashPunctuation,
+ /* G_UNICODE_CLOSE_PUNCTUATION = */ ClosePunctuation,
+ /* G_UNICODE_FINAL_PUNCTUATION = */ FinalQuotePunctuation,
+ /* G_UNICODE_INITIAL_PUNCTUATION = */ InitialQuotePunctuation,
+ /* G_UNICODE_OTHER_PUNCTUATION = */ OtherPunctuation,
+ /* G_UNICODE_OPEN_PUNCTUATION = */ OpenPunctuation,
+ /* G_UNICODE_CURRENCY_SYMBOL = */ CurrencySymbol,
+ /* G_UNICODE_MODIFIER_SYMBOL = */ ModifierSymbol,
+ /* G_UNICODE_MATH_SYMBOL = */ MathSymbol,
+ /* G_UNICODE_OTHER_SYMBOL = */ OtherSymbol,
+ /* G_UNICODE_LINE_SEPARATOR = */ LineSeperator,
+ /* G_UNICODE_PARAGRAPH_SEPARATOR = */ ParagraphSeperator,
+ /* G_UNICODE_SPACE_SEPARATOR = */ SpaceSeperator,
+};
+
+double
+ves_icall_System_Char_GetNumericValue (gunichar2 c)
+{
+ return (double)g_unichar_digit_value (c);
+}
+
+MonoUnicodeCategory
+ves_icall_System_Char_GetUnicodeCategory (gunichar2 c)
+{
+ return catmap [g_unichar_type (c)];
+}
+
+gboolean
+ves_icall_System_Char_IsControl (gunichar2 c)
+{
+ return g_unichar_iscntrl (c);
+}
+
+gboolean
+ves_icall_System_Char_IsDigit (gunichar2 c)
+{
+ return g_unichar_isdigit (c);
+}
+
+gboolean
+ves_icall_System_Char_IsLetter (gunichar2 c)
+{
+ return g_unichar_isalpha (c);
+}
+
+gboolean
+ves_icall_System_Char_IsLower (gunichar2 c)
+{
+ return g_unichar_islower (c);
+}
+
+gboolean
+ves_icall_System_Char_IsUpper (gunichar2 c)
+{
+ return g_unichar_isupper (c);
+}
+
+gboolean
+ves_icall_System_Char_IsNumber (gunichar2 c)
+{
+ return g_unichar_isdigit (c);
+}
+
+gboolean
+ves_icall_System_Char_IsPunctuation (gunichar2 c)
+{
+ return g_unichar_ispunct (c);
+}
+
+gboolean
+ves_icall_System_Char_IsSeparator (gunichar2 c)
+{
+ GUnicodeType t = g_unichar_type (c);
+
+ return (t == G_UNICODE_LINE_SEPARATOR ||
+ t == G_UNICODE_PARAGRAPH_SEPARATOR ||
+ t == G_UNICODE_SPACE_SEPARATOR);
+}
+
+gboolean
+ves_icall_System_Char_IsSurrogate (gunichar2 c)
+{
+ return (g_unichar_type (c) == G_UNICODE_SURROGATE);
+}
+
+gboolean
+ves_icall_System_Char_IsSymbol (gunichar2 c)
+{
+ GUnicodeType t = g_unichar_type (c);
+
+ return (t == G_UNICODE_CURRENCY_SYMBOL ||
+ t == G_UNICODE_MODIFIER_SYMBOL ||
+ t == G_UNICODE_MATH_SYMBOL ||
+ t == G_UNICODE_OTHER_SYMBOL);
+}
+
+gboolean
+ves_icall_System_Char_IsWhiteSpace (gunichar2 c)
+{
+ return g_unichar_isspace (c);
+}
+
+gunichar2
+ves_icall_System_Char_ToLower (gunichar2 c)
+{
+ return g_unichar_tolower (c);
+}
+
+gunichar2
+ves_icall_System_Char_ToUpper (gunichar2 c)
+{
+ return g_unichar_toupper (c);
+}
+
+gpointer
+ves_icall_iconv_new_encoder (MonoString *name, MonoBoolean big_endian)
+{
+ iconv_t cd;
+ char *n;
+
+ // fixme: add support big_endian
+
+ g_assert (name);
+
+ n = mono_string_to_utf8 (name);
+
+#ifdef HAVE_NEW_ICONV
+ cd = iconv_open (n, "UTF-16le");
+#else
+ cd = iconv_open (n, "UTF-16");
+#endif
+ g_assert (cd != (iconv_t)-1);
+
+ return (gpointer)cd;
+}
+
+gpointer
+ves_icall_iconv_new_decoder (MonoString *name, MonoBoolean big_endian)
+{
+ iconv_t cd;
+ char *n;
+
+ // fixme: add support big_endian
+
+ g_assert (name);
+
+ n = mono_string_to_utf8 (name);
+
+#ifdef HAVE_NEW_ICONV
+ cd = iconv_open ("UTF-16le", n);
+#else
+ cd = iconv_open ("UTF-16", n);
+#endif
+ g_assert (cd != (iconv_t)-1);
+
+ return (gpointer)cd;
+}
+
+void
+ves_icall_iconv_reset (gpointer converter)
+{
+ iconv_t cd = (iconv_t)converter;
+
+ g_assert (cd);
+
+ iconv(cd, NULL, NULL, NULL, NULL);
+}
+
+static int
+iconv_get_length (iconv_t cd, guchar *src, int len)
+{
+ guchar buf [512];
+ int i, res;
+ guchar *outp;
+ guchar *p;
+ guint inbytes_remaining;
+ guint outbytes_remaining;
+ guint outbuf_size;
+ gboolean have_error = FALSE;
+ size_t err;
+
+ g_assert (cd);
+ g_assert (src);
+
+#ifndef HAVE_NEW_ICONV
+ if (G_BYTE_ORDER == G_LITTLE_ENDIAN) {
+ src = g_memdup (src, len);
+ for (i = 0; i < len; i += 2) {
+ char t = src [i];
+ src [i] = src [i + 1];
+ src [i + 1] = t;
+ }
+ }
+#endif
+
+ p = src;
+ inbytes_remaining = len;
+ res = 0;
+
+again:
+ outbuf_size = 512;
+ outbytes_remaining = outbuf_size;
+ outp = buf;
+
+ err = iconv (cd, (const char **)&p, &inbytes_remaining,
+ (char **)&outp, &outbytes_remaining);
+
+ if(err == (size_t)-1) {
+ switch(errno) {
+ case EINVAL:
+ /* Incomplete text, do not report an error */
+ break;
+ case E2BIG: {
+ res += outp - buf;
+ goto again;
+ }
+ case EILSEQ:
+ have_error = TRUE;
+ break;
+ default:
+ have_error = TRUE;
+ break;
+ }
+ }
+
+ res += outp - buf;
+
+ if((p - src) != len) {
+ if(!have_error) {
+ have_error = TRUE;
+ }
+ }
+
+#ifndef HAVE_NEW_ICONV
+ if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
+ g_free (src);
+#endif
+
+ if (have_error) {
+ g_assert_not_reached ();
+ return 0;
+ } else {
+ return res;
+ }
+}
+
+int
+ves_icall_iconv_get_byte_count (gpointer converter, MonoArray *chars, gint32 index, gint32 count)
+{
+ iconv_t cd = (iconv_t)converter;
+ guchar *src;
+ int len;
+
+ g_assert (cd);
+ g_assert (chars);
+ g_assert (mono_array_length (chars) > index);
+ g_assert (mono_array_length (chars) >= (index + count));
+
+ if (!(len = (mono_array_length (chars) - index) * 2))
+ return 0;
+
+ src = mono_array_addr (chars, guint16, index);
+
+ return iconv_get_length (cd, src, len);
+}
+
+static int
+iconv_convert (iconv_t cd, guchar *src, int len, guchar *dest, int max_len)
+{
+ int i;
+ guchar *p, *outp;
+ guint inbytes_remaining;
+ guint outbytes_remaining;
+ guint outbuf_size;
+ gboolean have_error = FALSE;
+ size_t err;
+
+ g_assert (cd);
+ g_assert (src);
+ g_assert (dest);
+
+#ifndef HAVE_NEW_ICONV
+ if (G_BYTE_ORDER == G_LITTLE_ENDIAN) {
+ src = g_memdup (src, len);
+ for (i = 0; i < len; i += 2) {
+ char t = src [i];
+ src [i] = src [i + 1];
+ src [i + 1] = t;
+ }
+ }
+#endif
+
+ p = src;
+ inbytes_remaining = len;
+ outbuf_size = max_len;
+
+ outbytes_remaining = outbuf_size;
+ outp = dest;
+
+ err = iconv (cd, (const char **)&p, &inbytes_remaining, (char **)&outp, &outbytes_remaining);
+
+ if(err == (size_t)-1) {
+ if (errno == EINVAL) {
+ /* Incomplete text, do not report an error */
+ } else {
+ have_error = TRUE;
+ }
+ }
+
+ if ((p - src) != len) {
+ if (!have_error) {
+ have_error = TRUE;
+ }
+ }
+
+#ifndef HAVE_NEW_ICONV
+ if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
+ g_free (src);
+#endif
+ if (have_error) {
+ g_assert_not_reached ();
+ return 0;
+ } else {
+ return len;
+ }
+}
+
+int
+ves_icall_iconv_get_bytes (gpointer converter, MonoArray *chars, gint32 charIndex, gint32 charCount,
+ MonoArray *bytes, gint32 byteIndex)
+{
+ iconv_t cd = (iconv_t)converter;
+ guchar *src, *dest;
+ int len, max_len;
+
+ g_assert (cd);
+ g_assert (chars);
+ g_assert (bytes);
+ g_assert (mono_array_length (chars) > charIndex);
+ g_assert (mono_array_length (chars) >= (charIndex + charCount));
+ g_assert (mono_array_length (bytes) > byteIndex);
+ g_assert (mono_array_length (chars) >= (byteIndex + charCount));
+
+ if (!(len = (mono_array_length (chars) - charIndex) * 2))
+ return 0;
+
+ src = mono_array_addr (chars, guint16, charIndex);
+ dest = mono_array_addr (bytes, char, byteIndex);
+
+ max_len = mono_array_length (bytes) - byteIndex;
+
+ return iconv_convert (cd, src, len, dest, max_len);
+}
+
+int
+ves_icall_iconv_get_char_count (gpointer converter, MonoArray *bytes, gint32 index, gint32 count)
+{
+ iconv_t cd = (iconv_t)converter;
+ guchar *src;
+ int len;
+
+ g_assert (cd);
+ g_assert (bytes);
+ g_assert (mono_array_length (bytes) > index);
+ g_assert (mono_array_length (bytes) >= (index + count));
+
+ if (!(len = (mono_array_length (bytes) - index)))
+ return 0;
+
+ src = mono_array_addr (bytes, char, index);
+
+ return iconv_get_length (cd, src, len);
+}
+
+int
+ves_icall_iconv_get_chars (gpointer converter, MonoArray *bytes, gint32 byteIndex, gint32 byteCount,
+ MonoArray *chars, gint32 charIndex)
+{
+ iconv_t cd = (iconv_t)converter;
+ guchar *src, *dest;
+ int len, max_len;
+
+ g_assert (cd);
+ g_assert (chars);
+ g_assert (bytes);
+ g_assert (mono_array_length (bytes) > byteIndex);
+ g_assert (mono_array_length (chars) >= (byteIndex + byteCount));
+ g_assert (mono_array_length (chars) > charIndex);
+
+ if (!(len = (mono_array_length (bytes) - byteIndex)))
+ return 0;
+
+ src = mono_array_addr (bytes, char, byteIndex);
+ dest = mono_array_addr (chars, guint16, charIndex);
+
+ max_len = (mono_array_length (chars) - charIndex) * 2;
+
+ return iconv_convert (cd, src, len, dest, max_len);
+}
diff --git a/mono/metadata/unicode.h b/mono/metadata/unicode.h
new file mode 100644
index 00000000000..79a0874c142
--- /dev/null
+++ b/mono/metadata/unicode.h
@@ -0,0 +1,123 @@
+/*
+ * unicode.h: Unicode support
+ *
+ * Author:
+ * Dietmar Maurer (dietmar@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+
+#ifndef _MONO_METADATA_UNICODE_H_
+#define _MONO_METADATA_UNICODE_H_
+
+#include <config.h>
+#include <glib.h>
+
+#include <mono/metadata/object.h>
+
+typedef enum {
+ UppercaseLetter = 0,
+ LowercaseLetter = 1,
+ TitlecaseLetter = 2,
+ ModifierLetter = 3,
+ OtherLetter = 4,
+ NonSpacingMark = 5,
+ SpaceCombiningMark = 6,
+ EnclosingMark = 7,
+ DecimalDigitNumber = 8,
+ LetterNumber = 9,
+ OtherNumber = 10,
+ SpaceSeperator = 11,
+ LineSeperator = 12,
+ ParagraphSeperator = 13,
+ Control = 14,
+ Format = 15,
+ Surrogate = 16,
+ PrivateUse = 17,
+ ConnectorPunctuation = 18,
+ DashPunctuation = 19,
+ OpenPunctuation = 20,
+ ClosePunctuation = 21,
+ InitialQuotePunctuation = 22,
+ FinalQuotePunctuation = 23,
+ OtherPunctuation = 24,
+ MathSymbol = 25,
+ CurrencySymbol = 26,
+ ModifierSymbol = 27,
+ OtherSymbol = 28,
+ OtherNotAssigned = 29,
+} MonoUnicodeCategory;
+
+double
+ves_icall_System_Char_GetNumericValue (gunichar2 c);
+
+MonoUnicodeCategory
+ves_icall_System_Char_GetUnicodeCategory (gunichar2 c);
+
+gboolean
+ves_icall_System_Char_IsControl (gunichar2 c);
+
+gboolean
+ves_icall_System_Char_IsDigit (gunichar2 c);
+
+gboolean
+ves_icall_System_Char_IsLetter (gunichar2 c);
+
+gboolean
+ves_icall_System_Char_IsLower (gunichar2 c);
+
+gboolean
+ves_icall_System_Char_IsUpper (gunichar2 c);
+
+gboolean
+ves_icall_System_Char_IsNumber (gunichar2 c);
+
+gboolean
+ves_icall_System_Char_IsPunctuation (gunichar2 c);
+
+gboolean
+ves_icall_System_Char_IsSeparator (gunichar2 c);
+
+gboolean
+ves_icall_System_Char_IsSurrogate (gunichar2 c);
+
+gboolean
+ves_icall_System_Char_IsSymbol (gunichar2 c);
+
+gboolean
+ves_icall_System_Char_IsWhiteSpace (gunichar2 c);
+
+gunichar2
+ves_icall_System_Char_ToLower (gunichar2 c);
+
+gunichar2
+ves_icall_System_Char_ToUpper (gunichar2 c);
+
+gpointer
+ves_icall_iconv_new_encoder (MonoString *name, MonoBoolean big_endian);
+
+gpointer
+ves_icall_iconv_new_decoder (MonoString *name, MonoBoolean big_endian);
+
+void
+ves_icall_iconv_reset (gpointer converter);
+
+int
+ves_icall_iconv_get_byte_count (gpointer converter, MonoArray *chars,
+ gint32 index, gint32 count);
+
+int
+ves_icall_iconv_get_bytes (gpointer converter, MonoArray *chars,
+ gint32 charIndex, gint32 charCount,
+ MonoArray *bytes, gint32 byteIndex);
+
+int
+ves_icall_iconv_get_char_count (gpointer converter, MonoArray *bytes,
+ gint32 index, gint32 count);
+
+int
+ves_icall_iconv_get_chars (gpointer converter, MonoArray *bytes,
+ gint32 byteIndex, gint32 byteCount,
+ MonoArray *chars, gint32 charIndex);
+
+#endif
diff --git a/mono/tests/Makefile.am b/mono/tests/Makefile.am
index 7c9e6ef1cfd..f168f7928b3 100644
--- a/mono/tests/Makefile.am
+++ b/mono/tests/Makefile.am
@@ -40,7 +40,6 @@ TESTSRC= \
intptrcast.cs \
indexer.cs \
stream.cs \
- stream-writer.cs \
console.cs \
jit-int.cs \
jit-uint.cs \
diff --git a/web/download b/web/download
index 40267a0f23b..11869427fdd 100644
--- a/web/download
+++ b/web/download
@@ -132,26 +132,35 @@ href="ftp://ftp.gtk.org/pub/gtk/v1.2/glib-1.2.10.tar.gz">ftp://ftp.gtk.org/pub/g
To compile the mono runtime on windows:
- <ul>
- * Install <a href="http://www.cygwin.com">CygWin</a> first.
-
- * Once installed, in a terminal window or a cygwin
- window (a shortcut should be on your desktop), untar the glib
- distribution:
-
-<pre>
-tar xzvf glib-1.2.10.tar.gz
-</pre>
+ <ul>
+ * Warning: We switched over to glib2.0, and we are still searching
+ for a volunteer who is able to provide us with binary packages
+ of glib2.0, pkgconfig and iconv. I was unable to compile
+ glib2.0 myself, so the following is only a rough outline how it
+ should work.
- * Configure, compile and install glib, like this:
+ * Install <a href="http://www.cygwin.com">CygWin</a> first.
+ * Install <a href="http://www.freedesktop.org/software/pkgconfig">pkgconfig</a>.
+ (I had to change line 674 of
+ <nobr><tt>pkgconfig-0.8.0/glib-1.2.8/gstrfuncs.c</nobr> from
+ <nobr><tt>extern char *strsignal (int sig);</nobr> to
+ <nobr><tt>extern const char *strsignal (int sig);</nobr>.
<pre>
+tar xzvf pkgconfig-0.8.0.tar.gz
+cd pkgconfig-0.8.0
./configure --prefix=/usr
make
make install
</pre>
- * You also need a patch found <a
- href="http://www.cygwin.com/ml/cygwin/2001-04/msg01792.html">here</a>.
+
+ * Install <a href="ftp://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.7.tar.gz">libiconv</a>.
+ If you dont have MS Visual C/C++ 4.0 or 5.0 or 6.0 you can also try
+ the binary package available at <a
+ href="http://www.gimp.org/win32/libiconv-dev-20001007.zip">here</a>.
+
+ * Install the newest glib (cvs head version). You can download it
+ from <a href="glib-1.3.11.tar.gz">here</a>.
* Unpack the mono distribution:
@@ -176,6 +185,16 @@ make install
To compile the mono runtime on Unix:
<ul>
+
+ * Install <a href="http://www.freedesktop.org/software/pkgconfig">pkgconfig</a>.
+
+ * Install newest glib (cvs head version). You can download it
+ from <a href="glib-1.3.11.tar.gz">here</a>. Maybe you need
+ to modify your ACLOCAL_FLAGS for pkgconfig, for example if
+ your install prefix is /usr/local:
+<pre>
+export ACLOCAL_FLAGS="-I /usr/local/share/aclocal"
+</pre>
* Download the mono distribution