diff options
747 files changed, 12534 insertions, 45353 deletions
diff --git a/ChangeLog b/ChangeLog index c3dd0f2b78f..2d5040dff93 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,56 +1,3 @@ -2003-09-08 Zoltan Varga <vargaz@freemail.hu> - - * configure.in: Added check for valgrind headers. - -2003-09-03 Zoltan Varga <vargaz@freemail.hu> - - * Makefile.am: Use $(MAKE) in even more places. Patch by Bernie Solomon - (bernard@ugsolutions.com). - -2003-08-27 Zoltan Varga <vargaz@freemail.hu> - - * Makefile.am: Use $(MAKE) instead of make. Patch by Bernie Solomon - (bernard@ugsolutions.com). - -2003-08-25 Zoltan Varga <vargaz@freemail.hu> - - * mono.pc.in: Added gthread-2.0. - -2003-08-22 Zoltan Varga <vargaz@freemail.hu> - - * configure.in: Added gthread-2.0 to GLIB_CFLAGS and GLIB_LIBS, so we - can call g_thread_init (). - -2003-08-21 Zoltan Varga <vargaz@freemail.hu> - - * mono/tests/threadpool.cs mono/tests/threadpool1.cs: Make increments - of static variables atomic. Fixes bug #47683. - -2003-08-21 Johannes Roith <johannes@jroith.de> - - * mono/Makefile.am: small update. make sure, glib makes it in the build, add optional target for dependencies - -2003-08-18 Johannes Roith <johannes@jroith.de> - - * mono/Makefile.am: add windows build option - * mono/monowiz.win32.nsi: add windows build script - * mono/mono-win32-light.bmp: add bitmap - -2003-08-16 Zoltan Varga <vargaz@freemail.hu> - - * mono/tests/checked.cs: Added mul.ovf tests. - -2003-08-15 Duncan Mak <duncan@ximian.com> - - * doc/mysql: Change references to ByteFX.Data.MySQLClient to the - correct ByteFX.Data.MySqlClient (note the change in - capitalization). Thanks to Tom Wagner <Tom.Wagner@wacker.com> for - spotting the error. - -2003-08-15 Zoltan Varga <vargaz@freemail.hu> - - * mono/tests/bug-47295.cs: Regression test for bug #47295. - 2003-08-11 Duncan Mak <duncan@ximian.com> * runtime/Makefile.am (assemblies_DATA): Add Mono.Cairo.dll. diff --git a/Makefile.am b/Makefile.am index 69a7952023b..403567fc8f2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -19,44 +19,18 @@ DISTCLEANFILES= mono.pc fullbuild: remove-binaries mcs-tree-safe-build xinstall-runtime mcs-rest install mcs-tree-safe-build: - (cd ../mcs/jay; $(MAKE)) - (cd ../mcs/mcs; $(MAKE) MCS=mcs) - (cd ../mcs/class/corlib; $(MAKE) MCS=mcs) + (cd ../mcs/jay; make) + (cd ../mcs/mcs; make MCS=mcs) + (cd ../mcs/class/corlib; make MCS=mcs) cp ../mcs/class/lib/corlib.dll runtime cp ../mcs/mcs/mcs.exe runtime xinstall-runtime: - if echo $(SUBDIRS) | grep "libgc " > /dev/null; then (cd libgc; $(MAKE) && $(MAKE) install); fi - (cd mono; $(MAKE) && $(MAKE) install) + if echo $(SUBDIRS) | grep "libgc " > /dev/null; then (cd libgc; make && make install); fi + (cd mono; make && make install) mcs-rest: - (cd ../mcs/class; $(MAKE)) + (cd ../mcs/class; make) remove-binaries: - rm ../mcs/class/lib/corlib.dll ../mcs/mcs/mcs.exe runtime/*dll runtime/*.exe >& /dev/null; echo - - -win32getdeps: - wget http://www.go-mono.com/archive/pkgconfig-0.11-20020310.zip - wget http://www.go-mono.com/archive/glib-2.0.4-20020703.zip - wget http://www.go-mono.com/archive/glib-dev-2.0.4-20020703.zip - wget http://www.go-mono.com/archive/libiconv-1.7.zip - wget http://www.go-mono.com/archive/libiconv-dev-1.7.zip - wget http://www.go-mono.com/archive/libintl-0.10.40-20020101.zip - wget http://www.jroith.de/nsis4cygwin.zip - unzip -n -d / pkgconfig-0.11-20020310.zip - unzip -n -d / glib-2.0.4-20020703.zip - unzip -n -d / glib-dev-2.0.4-20020703.zip - unzip -n -d / libiconv-1.7.zip - unzip -n -d / libiconv-dev-1.7.zip - unzip -n -d / libintl-0.10.40-20020101.zip - unzip -n -d / nsis4cygwin.zip - -win32setup: - cp /usr/lib/libglib-2.0-0.dll @prefix@/lib - cp /usr/lib/iconv.dll @prefix@/lib - cp /usr/lib/libgmodule-2.0-0.dll @prefix@/lib - cp /usr/lib/libgobject-2.0-0.dll @prefix@/lib - cp /usr/lib/libgthread-2.0-0.dll @prefix@/lib - cp /usr/lib/libintl-1.dll @prefix@/lib - makensis /DMILESTONE=@VERSION@ /DSOURCE_INSTALL_DIR=`cygpath -a -w @prefix@`\\* monowiz.win32.nsi + rm ../mcs/class/lib/corlib.dll ../mcs/mcs/mcs.exe runtime/*dll runtime/*.exe >& /dev/null; echo
\ No newline at end of file diff --git a/config.h.in b/config.h.in deleted file mode 100644 index b412155c227..00000000000 --- a/config.h.in +++ /dev/null @@ -1,51 +0,0 @@ -/* config.h.in. Generated automatically from configure.in by autoheader 2.13. */ - -/* Define if you have the ANSI C header files. */ -#undef STDC_HEADERS - -#undef HAVE_INET_PTON -#undef HAVE_INET_ATON -#undef HAVE_SOL_IP -#undef HAVE_SOL_TCP -#undef HAVE_IP_PKTINFO -#undef HAVE_STRUCT_IP_MREQN -#undef HAVE_PTHREAD -#undef HAVE_PTHREAD_MUTEX_TIMEDLOCK -#undef USE_MONO_MUTEX -#undef HAVE_LARGE_FILE_SUPPORT -#undef PLATFORM_WIN32 -#undef HAVE_NEW_ICONV -#undef NAME_DEV_RANDOM -#undef HAVE_CRYPT_RNG -#undef HAVE_BOEHM_GC - -/* The number of bytes in a void *. */ -#undef SIZEOF_VOID_P - -/* Define if you have the inet_aton function. */ -#undef HAVE_INET_ATON - -/* Define if you have the inet_pton function. */ -#undef HAVE_INET_PTON - -/* Define if you have the <dlfcn.h> header file. */ -#undef HAVE_DLFCN_H - -/* Define if you have the <netdb.h> header file. */ -#undef HAVE_NETDB_H - -/* Define if you have the <sys/filio.h> header file. */ -#undef HAVE_SYS_FILIO_H - -/* Define if you have the <sys/sockio.h> header file. */ -#undef HAVE_SYS_SOCKIO_H - -/* Define if you have the <utime.h> header file. */ -#undef HAVE_UTIME_H - -/* Name of package */ -#undef PACKAGE - -/* Version number of package */ -#undef VERSION - diff --git a/configure.in b/configure.in index 1e5623edca1..0b565a6b2f1 100644 --- a/configure.in +++ b/configure.in @@ -145,9 +145,6 @@ AM_PROG_LIBTOOL AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h semaphore.h sys/un.h) -# for mono/mini/tramp-x86.c -AC_CHECK_HEADERS(valgrind/memcheck.h) - # for mono/metadata/debug-symfile.c AC_CHECK_HEADERS(elf.h) @@ -170,8 +167,8 @@ fi dnl for use on the build system dnl pkg-config is stupid -BUILD_GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0` -BUILD_GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0 gthread-2.0` +BUILD_GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0` +BUILD_GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0` AC_SUBST(BUILD_GLIB_CFLAGS) AC_SUBST(BUILD_GLIB_LIBS) @@ -193,8 +190,8 @@ GLIB_REQUIRED_VERSION=1.3.11 PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION) -GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0` -GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0 gthread-2.0` +GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0` +GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0` GMODULE_CFLAGS=`$PKG_CONFIG --cflags gmodule-2.0` GMODULE_LIBS=`$PKG_CONFIG --libs gmodule-2.0` diff --git a/data/config.in b/data/config.in index 9d9887bc196..d5ac29cd2de 100644 --- a/data/config.in +++ b/data/config.in @@ -6,7 +6,6 @@ <dllmap dll="odbc32.dll" target="libodbc.so" /> <dllmap dll="libglib-2.0-0.dll" target="libglib-2.0.so" /> <dllmap dll="libgobject-2.0-0.dll" target="libgobject-2.0.so" /> - <dllmap dll="libgthread-2.0-0.dll" target="libgthread-2.0.so" /> <dllmap dll="libpango-1.0-0.dll" target="libpango-1.0.so" /> <dllmap dll="libatk-1.0-0.dll" target="libatk-1.0.so" /> <dllmap dll="libgdk-win32-2.0-0.dll" target="libgdk-x11-2.0.so" /> diff --git a/doc/classlib-doc b/doc/classlib-doc index 5b2c0547c2a..b002b8efd55 100644 --- a/doc/classlib-doc +++ b/doc/classlib-doc @@ -17,7 +17,6 @@ <ul> <li><a href="#monodoc">monodoc - A graphical documentation viewer.</a></li> - <li>xmllint: a tool used to validate a proper XML document. </ul> @@ -28,15 +27,11 @@ *** <a name="monodoc">MonoDoc</a> - The MonoDoc system offers both a GUI client as well as a <a - href="http://www.go-mono.com:8080">Web-based interface</a> to - the documentation. - - The GUI edition uses <a - href="http://gtk-sharp.sf.net">Gtk#</a> and the Web edition - uses Mono's ASP.NET implementation. + A graphical documentation viewer written in Gtk#. In the + future we will have an ASP.NET front-end to present the + documentation on the web as well. - <img src="images/Screenshot-Monodoc.png"> +** Status and Roadmap ** Get Involved diff --git a/doc/contributing b/doc/contributing index 0a80bcb91b1..55313175a41 100644 --- a/doc/contributing +++ b/doc/contributing @@ -128,10 +128,7 @@ You can review the list of current bugs by going <a href="http://bugzilla.ximian.com/buglist.cgi?product=Mono%2FClass+Libraries&product=Mono%2FMCS&product=Mono%2FRuntime&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&email1=&emailtype1=substring&emailassigned_to1=1&email2=&emailtype2=substring&emailreporter2=1&changedin=&chfieldfrom=&chfieldto=Now&chfieldvalue=&short_desc=&short_desc_type=substring&long_desc=&long_desc_type=substring&bug_file_loc=&bug_file_loc_type=substring&keywords=&keywords_type=anywords&op_sys_details=&op_sys_details_type=substring&version_details=&version_details_type=substring&cmdtype=doit&order=%27Importance%27&form_name=query">here</a> - Check our <a href="bugs.html">Bugs</a> that contains links to - easily add a bug report, or to query the existing bugs. - -<a name="goodbugreport"/> + <a name="goodbugreport"/> ** How to make good bug reports A mail from Paolo to mono-devel-list contained this check list: diff --git a/doc/documentation b/doc/documentation index 4cb6d0d3c5f..56721cd7777 100644 --- a/doc/documentation +++ b/doc/documentation @@ -25,11 +25,7 @@ libraries as well as the class libraries produced by the project). - * Tutorials on Mono and the specifics of running it - (The <a href="http://www.monohispano.org">Mono - Hispano</a> team has produced lots of <a - href="http://www.monohispano.org/tutoriales.php">tutorials - in spanish</a> + * Tutorials on Mono and the specifics of running it. * A guide to Mono as compared to the Microsoft.NET Framework SDK diff --git a/doc/download b/doc/download index a1bc37cefab..26f6380b3fb 100644 --- a/doc/download +++ b/doc/download @@ -12,113 +12,7 @@ href="http://www.go-mono.org/mono-beginning.html">Resources/Beginning section</a>, the <a href="http://www.go-mono.org/faq.html">FAQ</a>. - <table> - <tbody> - <tr bgcolor="#DDDDDD"> - <td> - <b>Release 0.26</b><br> - <a href="archive/mono-0.26.html">Release notes</a><br> - Aug 14, 2003 - </td> - <td> - <table cellspacing="1" cellpadding="3"> - <tr bgcolor="#BBBBBB"> - <td> - <b>Source Code</b> - </td> - <td> - <ul> - <li><a href="archive/mcs-0.26.tar.gz">Mono Class Libraries and C# Compiler.</a> - <li><a href="archive/mono-0.26.tar.gz">Mono Runtime</a> - <li><a href="archive/xsp-0.5.tar.gz">XSP web server (0.5)</a> - <li><a href="archive/mod_mono-0.4.tar.gz">Apache Mono module (mod_mono)</a> - <li><a href="archive/monodoc-0.6.tar.gz">MonoDoc 0.6</a> - </ul> - </td> - </tr> - <tr bgcolor="#BBBBBB"> - <td> - <b>Source RPMs</b><br> - (No RPMS for XSP). - </td> - <td> - <ul> - <li><a href="archive/redhat-90-i386/mono-0.26-1.ximian.6.1.src.rpm">mono-0.26-1.src.rpm (RH9)</a> - <li><a href="archive/redhat-90-i386/mono-0.26-1.ximian.5.1.src.rpm">mono-0.26-1.src.rpm (RH8)</a> - </ul> - </td> - </tr> - <tr> - <td></td> - </tr> - <tr> - <td bgcolor="#999999"> - <img src="images/redhat-36.gif"><b>Red Hat 9.0/x86</b> - <ul> - <li><a href="archive/redhat-90-i386/mono-0.26-1.ximian.6.1.i386.rpm">mono-0.26-1.ximian.6.1.i386.rpm</a> - <li><a href="archive/redhat-90-i386/mono-devel-0.26-1.ximian.6.1.i386.rpm">mono-devel-0.26-1.ximian.6.1.i386.rpm</a> - <li><a href="archive/redhat-90-i386/mono-debuginfo-0.26-1.ximian.6.1.i386.rpm">mono-debuginfo-0.26-1.i386.rpm</a> - <br> - <li><a href="archive/redhat-90-i386/libpixregion-0.1.0-1.ximian.6.1.i386.rpm">libpixregion-0.1.0-1.ximian.6.1.i386.rpm</a> - <li><a href="archive/redhat-90-i386/libpixregion-debuginfo-0.1.0-1.ximian.6.1.i386.rpm">libpixregion-debuginfo-0.1.0-1.ximian.6.1.i386.rpm</a> - <li><a href="archive/redhat-90-i386/libic-0.1.0-1.ximian.6.1.i386.rpm">libic-0.1.0-1.ximian.6.1.i386.rpm</a> - <li><a href="archive/redhat-90-i386/libic-debuginfo-0.1.0-1.ximian.6.1.i386.rpm">libic-debuginfo-0.1.0-1.ximian.6.1.i386.rpm</a> - <li><a href="archive/redhat-90-i386/xc-0.1.0-1.ximian.6.1.i386.rpm">xc-0.1.0-1.ximian.6.1.i386.rpm</a> - <li><a href="archive/redhat-90-i386/xc-debuginfo-0.1.0-1.ximian.6.1.i386.rpm">xc-debuginfo-0.1.0-1.ximian.6.1.i386.rpm</a> - <li><a href="archive/redhat-90-i386/xr-0.1.0-1.ximian.6.1.i386.rpm">xr-0.1.0-1.ximian.6.1.i386.rpm</a> - <li><a href="archive/redhat-90-i386/xr-debuginfo-0.1.0-1.ximian.6.1.i386.rpm">xr-debuginfo-0.1.0-1.ximian.6.1.i386.rpm</a> - <br> - <li><a href="archive/redhat-90-i386/monodoc-0.6-1.ximian.6.1.i386.rpm">monodoc-0.6-1.ximian.6.1.i386.rpm</a> (To be used only with CVS gtk-sharp) - <li><a href="archive/redhat-90-i386/monodoc-debuginfo-0.5-1.ximian.6.1.i386.rpm">monodoc-debuginfo-0.5-1.ximian.6.1.i386.rpm</a> - <li><a href="archive/redhat-90-i386/mono-wine-20030318-1.ximian.6.3.i386.rpm">mono-wine-20030318-1.ximian.6.3.i386.rpm</a> - <li><a href="archive/redhat-90-i386/mono-wine-debuginfo-20030318-1.ximian.6.2.i386.rpm">mono-wine-debuginfo-20030318-1.ximian.6.3.i386.rpm</a> - </ul> - </td> - <td bgcolor="#999999"> - <img src="images/redhat-36.gif"><b>Red Hat 8.0/x86</b> - <ul> - <li><a href="archive/redhat-80-i386/mono-0.26-2.ximian.5.1.i386.rpm">mono-0.26-2.ximian.5.1.i386.rpm</a> - <li><a href="archive/redhat-80-i386/mono-devel-0.26-2.ximian.5.1.i386.rpm">mono-devel-0.26-2.ximian.5.1.i386.rpm</a> - <br> - <li><a href="archive/redhat-80-i386/monodoc-0.5-1.ximian.5.1.i386.rpm">monodoc-0.5-1.ximian.5.1.i386.rpm</a> (To be used only with CVS gtk-sharp) - <li><a href="archive/redhat-80-i386/mono-wine-20030318-1.ximian.5.3.i386.rpm">mono-wine-20030318-1.ximian.5.3.i386.rpm</a> - </ul> - </td> - </tr> - <tr> - <td bgcolor="#999999"> - <img src="images/debian-36.gif"><b>Debian</b> - <ul> - <li><a href="h#ttp://www.debianplanet.com/mono/">Debian Packages here.</a> - </ul> - </td> - <td bgcolor="#999999"> - <img src="images/mandrake-36.gif"><b>Mandrake 9.1/x86</b> - <ul> - <li><a href="archive/mandrake-91-i586/mono-0.26-1.ximian.6.1.i586.rpm">mono-0.26-1.ximian.6.1.i586.rpm</a> - <li><a href="archive/mandrake-91-i586/mono-devel-0.26-1.ximian.6.1.i586.rpm">mono-devel-0.26-1.ximian.6.1.i586.rpm</a> -<!-- <li><a href="archive/mandrake-91-i586/monodoc-0.5-1.ximian.6.1.i586.rpm">monodoc-0.5-1.ximian.6.1.i586.rpm</a> --> - </ul> - </td> - </tr> - <tr> - <td bgcolor="#999999"> - <img src="images/suse-36.gif"><b>SuSE 8.2</b> - <ul> - <li><a href="archive/suse-82-i586/mono-0.26-2.ximian.7.1.i586.rpm">mono-0.26-2.ximian.7.1.i586.rpm</a> - <li><a href="archive/suse-82-i586/mono-devel-0.26-2.ximian.7.1.i586.rpm">mono-devel-0.26-2.ximian.7.1.i586.rpm</a> - </ul> - </td> - <td bgcolor="#999999"> - <img src="images/windows-36.gif"><b>Windows installer</b> - <ul> - <li><a href="archive/mono-0.26-win32-2.exe">mono-0.26-win32-2.exe</a> - </ul> - </td> - </tr> - </table> - </td> <table> <tbody> <tr bgcolor="#DDDDDD"> @@ -401,6 +401,13 @@ A: No. MS Passport is unrelated to running .NET compatible applications produced with the Mono tools. The only thing you will need is a just-in-time compiler (JIT). +Q: What is a 100% .NET application? + +A: A `100% .NET application' is one that only uses the APIs defined + under the System namespace and does not use PInvoke. These + applications would in theory run unmodified on Windows, Linux, + HP-UX, Solaris, MacOS X and others. + Q: If Microsoft will release a port of their .NET platform under the `Shared Source' license, why should I bother with anything else? @@ -438,6 +445,12 @@ A: No, it will not. Microsoft Office is a Windows application. To learn more about running Windows applications on Intel Unix systems refer to <a href="http://www.winehq.com">the Wine Project</a>. +Q: Will I be able to compile a Microsoft VB.NET application and execute + the resultant MSIL file under MONO on Linux without converting to C# + and recompiling? + +A: Once we have a complete VisualBasic runtime, yes. + Q: Can mono run the WebMatrix? A: No. That requires System.Windows.Forms support which is not @@ -491,9 +504,9 @@ A: Mono requires Unicode versions of Win32 APIs to run, <a name="compatibility"></a> ** Compatibility -Q: Can Mono run applications developed with the Microsoft.NET framework? +Q: Can Mono run applications developed with the Microsoft.NET fraemwork? -A: Yes, Mono can run applications developed with the Microsoft .NET Framework +A: Yes, Mono can run applications developed with the Microsft .NET Framework on Unix. There are a few caveats to keep in mind: Mono has not been completed yet, so a few API calls might be missing; And in some cases the Mono behavior *might* be incorrect. @@ -527,77 +540,6 @@ A: Sometimes they will. But sometimes a .NET application might invoke Win32 API calls, or assume certain patterns that are not correct for cross-platform applications. -Q: What is a 100% .NET application? - -A: A `100% .NET application' is one that only uses the APIs defined - under the System namespace and does not use P/Invoke. These - applications would in theory run unmodified on Windows, Linux, - HP-UX, Solaris, MacOS X and others. - - Note that this requirement also holds for all assemblies used by the - application. If one of them is Windows-specific, then the entire program - is not a 100% .NET application. - - Furthermore, a 100% .NET application must not contain non-standard data - streams in the assembly. For example, Visual Studio .NET will insert a - <tt>#-</tt> stream into assemblies built under the "Debug" target. - This stream contains debugging information for use by Visual Studio .NET; - however, this stream can not be interpreted by Mono (unless you're willing - to donate support). - - Thus, it is recommended that all Visual Studio .NET-compiled code be - compiled under the Release target before it is executed under Mono. - -Q: Can I execute my Visual Studio .NET program (Visual Basic .NET, Visual C#, - Managed Extensions for C++, etc.) under Mono? - -A: Yes, with some reservations. - - The .NET program must either be a 100% .NET application, or (somehow) have - all dependent assemblies available on all desired platforms. (How to do so - is outside the bounds of this FAQ.) - - For example, since Mono's System.Windows.Forms implementation will use - Wine, System.Windows.Forms is only as portable as Wine is. It's possible - that Mono may run on a platform, but Wine will not, in which case a - System.Windows.Forms app will not run on that platform. This is similarly - true for all assemblies that are not 100% managed code. - - Mono must also have an implementation for the .NET assemblies used. For - example the System.EnterpriseServices namespace is part of .NET, but it - has not been implemented in Mono. Thus, any applications using this - namespace will not run under Mono. - - With regards to languages, C# applications tend to be most portable. - - Visual Basic .NET applications are portable, but Mono's - Microsoft.VisualBasic.dll implementation is incomplete. It is recommended - to either avoid using this assembly in your own code, only use the - portions that Mono has implemented, or to help implement the missing - features. Additionally, you can set 'Option Strict On', which - eliminates the implicit calls to the unimplemented - Microsoft.VisualBasic.CompilerServices.ObjectType class. - (Thanks to Jörg Rosenkranz.) - - Managed Extensions for C++ is least likely to operate under Mono. Mono - does not support mixed mode assemblies (that is, assemblies containing both - managed and unmanaged code, which Managed C++ can produce). You need a - fully-managed assembly to run under Mono, and getting the Visual C++ .NET - compiler to generate such an executable can be difficult. You need to use - only the .NET-framework assemblies, not the C libraries (you can't use - <b>printf</b>(3) for example.), and you need to use - the linker options <tt>/nodefaultlib /entry:main mscoree.lib</tt> in - addition to the <tt>/clr</tt> compiler flag. You can still use certain - compiler intrinsic functions (such as <b>memcpy</b>(3)) and the STL. - You should also see <a - href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmex/html/vcgrfconvertingmanagedextensionsforcprojectsfrommixed-modetopureil.asp" - >Converting Managed Extensions for C++ Projects from Mixed Mode to Pure - Intermediate Language</a> at MSDN. - Finally, you can use PEVERIFY.EXE from the .NET SDK to determine if the - assembly is fully managed. - - Thanks to Serge Chaban for the linker flags to use. - <a name="pnpproject"></a> ** Mono and Portable.NET @@ -876,7 +818,7 @@ A: Replace the __stdcall attribute with the STDCALL macro, and include this Q: I want to be able to execute Mono binaries, without having to use the "mono" command. How can I do this? -A: From Carlos Perelló: +A: From Carlos Perelló: <i>I think that the best solution is the binfmt feature with the wrapper that exists with Debian packages at: @@ -945,7 +887,7 @@ A: Modules developed for Apache 2 are not compatible with Apache 1.3 Q: Can I run Apache 1 and Apache 2 on the same machine? - You can always keep a copy of Apache 2 running in parallel with your Apache + You can always keep a copy of Apache 2 running in paralell with your Apache 1.3 (either different port or using a reverse proxy). You can also bind the two servers to different IP addresses on the @@ -1207,7 +1149,7 @@ A: There should not be any need to recode. Q: What do I need to watch out for when programming in VB.NET so that I'm sure to be able to run those apps on Linux? -A: Not making any P/Invoke or DLL calls should and not using anything in +A: Not making any PInvoke or DLL calls should and not using anything in the Microsoft.* namespaces should suffice. Also do not use any Methods/Classes marked as "This type/method supports the .NET Framework infrastructure and is not intended to be used directly from your code." @@ -1364,7 +1306,7 @@ A: First some background information. The Mono strategy for dealing with these technologies is as follows: (1) work around the patent by using a different - implementation technique that retains the API, but changes the + implementation techinque that retains the API, but changes the mechanism; if that is not possible, we would (2) remove the pieces of code that were covered by those patents, and also (3) find prior art that would render the patent useless. @@ -1479,4 +1421,4 @@ A: It's possible to run VC++ generated apps under Mono, but we do not ** Credits - The FAQ contains material contributed by Miguel de Icaza, Jaime Anguiano, Lluis Sánchez. + The FAQ contains material contributed by Miguel de Icaza, Jaime Anguiano, Lluis Sánchez.
\ No newline at end of file diff --git a/doc/index b/doc/index index b006cfa09c1..7138e25e740 100644 --- a/doc/index +++ b/doc/index @@ -12,8 +12,10 @@ Common Language Infrastructure (also referred as the CLR) and a set of <a href="class-library.html">class libraries</a>. The runtime can be <a href="embedded-api.html">embedded</a> into your - application. It implements of both <a href="ado-net.html">ADO.NET</a> - and <a href="asp-net.html">ASP.NET</a>. + application. + + Mono has implementations of both <a href="ado-net">ADO.NET</a> + and <a href="asp-net">ASP.NET</a> as part of its distribution. You can read our <a href="rationale.html">rationale</a> for this project. If you have questions about the project, please @@ -32,9 +34,16 @@ href="http://www.gotmono.com/cgi-bin/yabb/YaBB.pl">forum</a> at <a href="http://www.gotmono.com">GotMono</a>. - Wikis: <a href="http://www.nullenvoid.com/gtksharp/wiki">Gtk# Wiki</a> - and <a href="http://www.nullenvoid.com/mono/wiki">Mono - Wiki</a> + You can contact the team at: <a + href="mailto:mono-list@ximian.com">mono-list@ximian.com</a> + + In order to follow the process of the project and to learn more + about the team members we have created the <a + href="http://monoevo.sf.net/mwn/index.html">Mono Weekly News letter</a>. + Which archives can be found <a + href="http://monoevo.sf.net/mwn/archives.html">here</a>. + We have a <a href="http://www.nullenvoid.com/gtksharp/wiki">Gtk# Wiki</a> + and a <a href="http://www.nullenvoid.com/mono/wiki">Mono Wiki</a> </td> <td> @@ -142,63 +151,6 @@ </tr> </table> -@item Sep 3rd, 2003: Authenticode; WSE - - -@item Sep 1st, 2003: Ice for Mono; XmlSerializer generators; Monodoc progress. - - <b>Ice:</b> Vladimir has checked into CVS (Module ginzu) an - implementation of <a href="http://www.zeroc.com">ZeroC's</a> - <a href="http://www.zeroc.com/ice.html">ICE</a> protocol. It - is implemented using Remoting. If you were looking for an - efficient binary protocol to use with Remoting, this is it. - - ICE is simpler to use than CORBA, and was created by people - who were deeply involved in CORBA and wanted to fix its - problems (you can see a <a - href="http://www.zeroc.com/iceVsCorba.html">list of - differences</a>). - - <b>XmlSerializer</b>: Lluis has checked in a new technology - for use in our XmlSerializer: the XmlSerializer code - generator. Currently our XmlSerializer generates a - description of instructions for serializing data, these - instructions are later interpreted while using it: Reflection - is used to pull all the data. The code generator is the first - step into turning the Serializer from an intepreter into a - compiler and improving the performance of it. - - Currently was used internally to implement the WSDL - serializer, in the future it will just be part of the standard - serialization process. - - <b>MonoDoc:</b> New providers! Thanks to <a - href="http://www.jaggersoft.com/">Jon Jagger</a> for providing - us with his master XML files for the C# specification we now - have integrated the C# spec into Monodoc. Another provider is - the Error provider: now we include all the C# compiler errors - in the help system. - - Alp has contributed various user interface improvement, and - updated our list widget for key navigation; Ben made the - matches window more useful and Joshua has helped us clean up - the ECMA provider even more. - -@item Aug 14th, 2003: Mono 0.26 has been released - - A new version of Mono is available, the new features include: - <a href="http://www.cairographics.org/">Cairo support</a>, <a - href="http://remoting-corba.sf.net">Remoting.Corba</a> - support, as well as a managed XSLT implementation. - - Existing features have been improved vastly: better - Windows.Forms, runtime, faster compiler, web services, better - compliance to the spec and more. - - Check out the <a - href="http://www.go-mono.com/archive/mono-0.26.html">Release - notes</a> for details. - @item Aug 9th, 2003: Python for .NET Preview 2 available; Mono Documentation site up. Brian Lloyd has <a @@ -442,7 +394,7 @@ that SourceGear Corporation will use Mono\x{2122} Project technology to offer cross-platform versions of its products. In addition, the companies have entered into a - development partnership under which Ximian will provide + development partnership under which Ximian® will provide custom Mono development to enable delivery of SourceGear products later this year. As a result, SourceGear will offer both UNIX and Linux clients for its SourceGear Vault source diff --git a/doc/languages b/doc/languages index 0f53720613b..531e8961fb4 100755 --- a/doc/languages +++ b/doc/languages @@ -111,7 +111,7 @@ <a href="mailto:brian@No.Spam.zope.com">Brian Lloyd</a> is working on linking the Python runtime with the .NET runtime. More information on the PS.NET project can be found <a - href="http://www.zope.org/Members/Brian/PythonNet">here</a>. + href="http://www.zope.org/Members/Brian/PythonNet/index_html">here</a>. An FAQ document is available <a href="http://www.zope.org/Members/Brian/PythonNet/FAQ.html">here</a>. diff --git a/doc/mysql b/doc/mysql index 7b0a4d5811b..56c5f112950 100755 --- a/doc/mysql +++ b/doc/mysql @@ -43,7 +43,7 @@ in the Microsoft .NET Environment</a> is an article by Mr. Venu who is a MySQL AB developer.</li> - <p>Testing for Mono's Mono.Data.MySql and ByteFX's ByteFX.Data.MySqlClient is below. + <p>Testing for Mono's Mono.Data.MySql and ByteFX's ByteFX.Data.MySQLClient is below. ** Current Status @@ -51,7 +51,7 @@ <ul> - <li>ByteFX.Data.MySqlClient + <li>ByteFX.Data.MySQLClient <ul> <li>Build and Runs on Microsoft .NET and Mono</li> <li>Works with SQL# (command-line and GTK# GUI versions)</li>
@@ -109,7 +109,7 @@ The current plan for the MySQL data providers: <ul> - <li>ByteFX.Data.MySqlClient + <li>ByteFX.Data.MySQLClient <ul> <li>Testing and fixes</li> <li>Implement missing features</li> @@ -163,7 +163,7 @@ <pre> using System; using System.Data; - using ByteFX.Data.MySqlClient; + using ByteFX.Data.MySQLClient; public class Test { @@ -175,7 +175,7 @@ "User ID=myuserid;" + "Password=mypassword;"; IDbConnection dbcon; - dbcon = new MySqlConnection(connectionString); + dbcon = new MySQLConnection(connectionString); dbcon.Open(); IDbCommand dbcmd = dbcon.CreateCommand(); // requires a table to be created named employee diff --git a/doc/pending-classes.in b/doc/pending-classes.in deleted file mode 100644 index 1cdb5a4cb36..00000000000 --- a/doc/pending-classes.in +++ /dev/null @@ -1,246 +0,0 @@ -System.Object -System.Exception -System.ValueType -System.Delegate -System.MulticastDelegate -System.Enum -System.Activator -System.ArgIterator -System.__ComObject -System.TypedReference -System.Security.AllowPartiallyTrustedCallersAttribute -System.Runtime.Serialization.Formatter -System.Runtime.Serialization.FormatterConverter -System.Runtime.Serialization.FormatterServices -System.Runtime.Serialization.ObjectIDGenerator -System.Runtime.Serialization.ObjectManager -System.Reflection.ModuleResolveEventHandler -System.Reflection.Pointer -System.Globalization.CompareInfo -System.Globalization.HebrewCalendar -System.Globalization.HijriCalendar -System.Globalization.JapaneseCalendar -System.Globalization.KoreanCalendar -System.Globalization.SortKey -System.Globalization.StringInfo -System.Globalization.TaiwanCalendar -System.Globalization.TextElementEnumerator -System.Globalization.TextInfo -System.Globalization.ThaiBuddhistCalendar -System.IO.IsolatedStorage.IsolatedStorageFile -System.Reflection.Emit.MethodRental -System.Runtime.CompilerServices.AccessedThroughPropertyAttribute -System.Runtime.CompilerServices.CallConvCdecl -System.Runtime.CompilerServices.CallConvStdcall -System.Runtime.CompilerServices.CallConvThiscall -System.Runtime.CompilerServices.CallConvFastcall -System.Runtime.CompilerServices.CustomConstantAttribute -System.Runtime.CompilerServices.DateTimeConstantAttribute -System.Runtime.CompilerServices.DiscardableAttribute -System.Runtime.CompilerServices.DecimalConstantAttribute -System.Runtime.CompilerServices.CompilationRelaxationsAttribute -System.Runtime.CompilerServices.CompilerGlobalScopeAttribute -System.Runtime.CompilerServices.IDispatchConstantAttribute -System.Runtime.CompilerServices.IsVolatile -System.Runtime.CompilerServices.IUnknownConstantAttribute -System.Runtime.CompilerServices.RequiredAttributeAttribute -System.Runtime.InteropServices.ArrayWithOffset -System.Runtime.InteropServices.DispIdAttribute -System.Runtime.InteropServices.ClassInterfaceType -System.Runtime.InteropServices.ClassInterfaceAttribute -System.Runtime.InteropServices.ComVisibleAttribute -System.Runtime.InteropServices.LCIDConversionAttribute -System.Runtime.InteropServices.ComRegisterFunctionAttribute -System.Runtime.InteropServices.ComUnregisterFunctionAttribute -System.Runtime.InteropServices.ProgIdAttribute -System.Runtime.InteropServices.ImportedFromTypeLibAttribute -System.Runtime.InteropServices.IDispatchImplType -System.Runtime.InteropServices.IDispatchImplAttribute -System.Runtime.InteropServices.ComSourceInterfacesAttribute -System.Runtime.InteropServices.ComConversionLossAttribute -System.Runtime.InteropServices.TypeLibTypeFlags -System.Runtime.InteropServices.TypeLibFuncFlags -System.Runtime.InteropServices.TypeLibVarFlags -System.Runtime.InteropServices.TypeLibTypeAttribute -System.Runtime.InteropServices.TypeLibFuncAttribute -System.Runtime.InteropServices.TypeLibVarAttribute -System.Runtime.InteropServices.ComImportAttribute -System.Runtime.InteropServices.PreserveSigAttribute -System.Runtime.InteropServices.ComAliasNameAttribute -System.Runtime.InteropServices.AutomationProxyAttribute -System.Runtime.InteropServices.PrimaryInteropAssemblyAttribute -System.Runtime.InteropServices.CoClassAttribute -System.Runtime.InteropServices.ComEventInterfaceAttribute -System.Runtime.InteropServices.COMException -System.Runtime.InteropServices.ComMemberType -System.Runtime.InteropServices.CurrencyWrapper -System.Runtime.InteropServices.DispatchWrapper -System.Runtime.InteropServices.ErrorWrapper -System.Runtime.InteropServices.ExtensibleClassFactory -System.Runtime.InteropServices.HandleRef -System.Runtime.InteropServices.InvalidComObjectException -System.Runtime.InteropServices.InvalidOleVariantTypeException -System.Runtime.InteropServices.TypeLibImporterFlags -System.Runtime.InteropServices.ExporterEventKind -System.Runtime.InteropServices.ITypeLibExporterNotifySink -System.Runtime.InteropServices.ITypeLibConverter -System.Runtime.InteropServices.MarshalDirectiveException -System.Runtime.InteropServices.ObjectCreationDelegate -System.Runtime.InteropServices.RuntimeEnvironment -System.Runtime.InteropServices.RegistrationServices -System.Runtime.InteropServices.SafeArrayRankMismatchException -System.Runtime.InteropServices.SafeArrayTypeMismatchException -System.Runtime.InteropServices.SEHException -System.Runtime.InteropServices.TypeLibConverter -System.Runtime.InteropServices.BIND_OPTS -System.Runtime.InteropServices.UCOMIBindCtx -System.Runtime.InteropServices.UCOMIConnectionPointContainer -System.Runtime.InteropServices.UCOMIConnectionPoint -System.Runtime.InteropServices.UCOMIEnumMoniker -System.Runtime.InteropServices.CONNECTDATA -System.Runtime.InteropServices.UCOMIEnumConnections -System.Runtime.InteropServices.UCOMIEnumConnectionPoints -System.Runtime.InteropServices.UCOMIEnumString -System.Runtime.InteropServices.UCOMIEnumVARIANT -System.Runtime.InteropServices.FILETIME -System.Runtime.InteropServices.UCOMIMoniker -System.Runtime.InteropServices.UCOMIPersistFile -System.Runtime.InteropServices.UCOMIRunningObjectTable -System.Runtime.InteropServices.STATSTG -System.Runtime.InteropServices.UCOMIStream -System.Runtime.InteropServices.DESCKIND -System.Runtime.InteropServices.BINDPTR -System.Runtime.InteropServices.UCOMITypeComp -System.Runtime.InteropServices.TYPEKIND -System.Runtime.InteropServices.TYPEFLAGS -System.Runtime.InteropServices.IMPLTYPEFLAGS -System.Runtime.InteropServices.TYPEATTR -System.Runtime.InteropServices.FUNCDESC -System.Runtime.InteropServices.IDLFLAG -System.Runtime.InteropServices.IDLDESC -System.Runtime.InteropServices.PARAMFLAG -System.Runtime.InteropServices.PARAMDESC -System.Runtime.InteropServices.TYPEDESC -System.Runtime.InteropServices.ELEMDESC -System.Runtime.InteropServices.VARDESC -System.Runtime.InteropServices.DISPPARAMS -System.Runtime.InteropServices.EXCEPINFO -System.Runtime.InteropServices.FUNCKIND -System.Runtime.InteropServices.INVOKEKIND -System.Runtime.InteropServices.CALLCONV -System.Runtime.InteropServices.FUNCFLAGS -System.Runtime.InteropServices.VARFLAGS -System.Runtime.InteropServices.UCOMITypeInfo -System.Runtime.InteropServices.SYSKIND -System.Runtime.InteropServices.LIBFLAGS -System.Runtime.InteropServices.TYPELIBATTR -System.Runtime.InteropServices.UCOMITypeLib -System.Runtime.InteropServices.UnknownWrapper -System.Runtime.Remoting.IObjectHandle -System.Runtime.Remoting.IRemotingTypeInfo -System.Runtime.Remoting.IChannelInfo -System.Runtime.Remoting.IEnvoyInfo -System.Runtime.Remoting.RemotingConfiguration -System.Runtime.Remoting.TypeEntry -System.Runtime.Remoting.ActivatedClientTypeEntry -System.Runtime.Remoting.ActivatedServiceTypeEntry -System.Runtime.Remoting.WellKnownClientTypeEntry -System.Runtime.Remoting.WellKnownServiceTypeEntry -System.Runtime.Remoting.RemotingException -System.Runtime.Remoting.ServerException -System.Runtime.Remoting.RemotingTimeoutException -System.Runtime.Remoting.RemotingServices -System.Runtime.Remoting.InternalRemotingServices -System.Runtime.Remoting.SoapServices -System.Runtime.Remoting.Activation.UrlAttribute -System.Runtime.Remoting.Messaging.IMessageSink -System.Runtime.Remoting.Messaging.AsyncResult -System.Runtime.Remoting.Messaging.CallContext -System.Runtime.Remoting.Messaging.ILogicalThreadAffinative -System.Runtime.Remoting.Messaging.InternalMessageWrapper -System.Runtime.Remoting.Messaging.IMethodCallMessage -System.Runtime.Remoting.Messaging.MethodCallMessageWrapper -System.Runtime.Remoting.Messaging.HeaderHandler -System.Runtime.Remoting.Messaging.IMessageCtrl -System.Runtime.Remoting.Messaging.IRemotingFormatter -System.Runtime.Remoting.Messaging.ReturnMessage -System.Runtime.Remoting.Messaging.MethodCall -System.Runtime.Remoting.Messaging.ConstructionCall -System.Runtime.Remoting.Messaging.MethodResponse -System.Runtime.Remoting.Messaging.ConstructionResponse -System.Runtime.Remoting.Messaging.MethodReturnMessageWrapper -System.Runtime.Remoting.Messaging.OneWayAttribute -System.Runtime.Remoting.Messaging.MessageSurrogateFilter -System.Runtime.Remoting.Messaging.RemotingSurrogateSelector -System.Runtime.Remoting.Contexts.CrossContextDelegate -System.Runtime.Remoting.Contexts.ContextProperty -System.Runtime.Remoting.Contexts.IContextPropertyActivator -System.Runtime.Remoting.Contexts.IContributeClientContextSink -System.Runtime.Remoting.Contexts.IContributeDynamicSink -System.Runtime.Remoting.Contexts.IContributeEnvoySink -System.Runtime.Remoting.Contexts.IContributeObjectSink -System.Runtime.Remoting.Contexts.IContributeServerContextSink -System.Runtime.Serialization.Formatters.InternalRM -System.Runtime.Serialization.Formatters.InternalST -System.Runtime.Serialization.Formatters.SoapMessage -System.Runtime.Serialization.Formatters.SoapFault -System.Runtime.Serialization.Formatters.ServerFault -System.Runtime.Serialization.Formatters.Binary.BinaryFormatter -System.Security.Cryptography.CryptoConfig -System.Security.Cryptography.KeyedHashAlgorithm -System.Security.Cryptography.HMACSHA1 -System.Security.Cryptography.MACTripleDES -System.Security.Cryptography.MaskGenerationMethod -System.Security.Cryptography.PasswordDeriveBytes -System.Security.Cryptography.PKCS1MaskGenerationMethod -System.Security.Cryptography.RC2 -System.Security.Cryptography.RC2CryptoServiceProvider -System.Security.Cryptography.RSACryptoServiceProvider -System.Security.Cryptography.RSAOAEPKeyExchangeDeformatter -System.Security.Cryptography.RSAOAEPKeyExchangeFormatter -System.Security.Cryptography.RSAPKCS1KeyExchangeDeformatter -System.Security.Cryptography.RSAPKCS1KeyExchangeFormatter -System.Security.Cryptography.RSAPKCS1SignatureDeformatter -System.Security.Cryptography.RSAPKCS1SignatureFormatter -System.Security.Cryptography.SHA1Managed -System.Security.Cryptography.TripleDES -System.Security.Cryptography.TripleDESCryptoServiceProvider -System.Security.Permissions.EnvironmentPermission -System.Security.Permissions.FileDialogPermission -System.Security.Permissions.IsolatedStorageFilePermission -System.Security.Permissions.PrincipalPermissionAttribute -System.Security.Permissions.SecurityPermissionAttribute -System.Security.Permissions.PublisherIdentityPermissionAttribute -System.Security.Permissions.PublisherIdentityPermission -System.Security.Permissions.ReflectionPermission -System.Security.Permissions.RegistryPermission -System.Security.Permissions.PrincipalPermission -System.Security.Permissions.SiteIdentityPermission -System.Security.Permissions.StrongNameIdentityPermission -System.Security.Permissions.StrongNamePublicKeyBlob -System.Security.Permissions.UIPermission -System.Security.Permissions.UrlIdentityPermission -System.Security.Permissions.ZoneIdentityPermission -System.Security.Policy.ApplicationDirectory -System.Security.Policy.ApplicationDirectoryMembershipCondition -System.Security.Policy.FirstMatchCodeGroup -System.Security.Policy.Hash -System.Security.Policy.HashMembershipCondition -System.Security.Policy.NetCodeGroup -System.Security.Policy.PermissionRequestEvidence -System.Security.Policy.Publisher -System.Security.Policy.PublisherMembershipCondition -System.Security.Policy.Site -System.Security.Policy.SiteMembershipCondition -System.Security.Policy.StrongName -System.Security.Policy.StrongNameMembershipCondition -System.Security.Policy.UnionCodeGroup -System.Security.Policy.Url -System.Security.Policy.UrlMembershipCondition -System.Security.Policy.Zone -System.Security.Policy.ZoneMembershipCondition -System.Security.Principal.WindowsIdentity -System.Security.Principal.WindowsImpersonationContext -System.Security.Principal.WindowsPrincipal -System.Threading.CompressedStack -
diff --git a/doc/web/commands b/doc/web/commands index a5ed1f55b83..0990b1324b1 100644 --- a/doc/web/commands +++ b/doc/web/commands @@ -5,7 +5,6 @@ 1,Team,team.html,team.src 1,Other sites,other.html,other.src 1,Old News,oldnews.html,oldnews.src -1,Bug Reporting,bugs.html,bugs.src 0,Mono,rationale.html,rationale.src 1,Runtime,runtime.html,runtime.src 2,Embedding,embedded-api.html,embedded-api.src diff --git a/doc/web/makefile b/doc/web/makefile index c8ee16c9b53..90fe990fec1 100644 --- a/doc/web/makefile +++ b/doc/web/makefile @@ -64,6 +64,20 @@ OBJECTS= \ deploy/testing.html \ deploy/tools.html \ deploy/winforms.html \ + deploy/class-status.html \ + deploy/class-status-corlib.html \ + deploy/class-status-System.html \ + deploy/class-status-System.Xml.html \ + deploy/class-status-System.Drawing.html \ + deploy/class-status-System.Data.html \ + deploy/class-status-System.Web.html \ + deploy/class-status-System.Web.Services.html \ + deploy/class-status-Microsoft.VisualBasic.html \ + deploy/class-status-System.EnterpriseServices.html \ + deploy/class-status-System.Runtime.Serialization.Formatters.Soap.html \ + deploy/class-status-System.Security.html \ + deploy/class-status-System.Windows.Forms.html \ + deploy/class-status-Cscompmgd.html \ deploy/class-library.html \ deploy/classlib-doc.html @@ -77,7 +91,7 @@ NON_HTML_SOURCES= \ ../mono-build.sh \ ../mono-build-w32.sh -all: $(OBJECT) deploy/index.rss ../team +all: $(OBJECTS) deploy/index.rss ../team perl process.pl commands template.html.in deploy -mkdir deploy/team cp team/*png deploy/team @@ -112,9 +126,8 @@ clean: push: cp -f $(NON_HTML_SOURCES) deploy - #echo scp -P 2200 -r deploy/* www@www.go-mono.com:/web/cvsmodules/mono - #(cd deploy; rsync --verbose --recursive --checksum --update --rsh='ssh' . www@www.go-mono.com:/web/cvsmodules/mono ) - (cd deploy; rsync --verbose --recursive --checksum --update --rsh='ssh' . mono-web@www.go-mono.com:/web/cvsmodules/mono ) + echo scp -P 2200 -r deploy/* www@www.go-mono.com:/web/cvsmodules/mono + (cd deploy; rsync --verbose --recursive --checksum --update --rsh='ssh' . www@www.go-mono.com:/web/cvsmodules/mono ) push2: scp -r deploy/* primates:public_html/xxx diff --git a/doc/web/mono-rss.cs b/doc/web/mono-rss.cs index 437643d25c0..a4fdd49c365 100755 --- a/doc/web/mono-rss.cs +++ b/doc/web/mono-rss.cs @@ -6,21 +6,18 @@ using System; using System.IO; using System.Xml; -using System.Text; using RSS; class X { static RSS.RSS rss; static Channel c; static int item_count; - static int line; - + static void PopulateRSS (StreamReader input) { string s; while ((s = input.ReadLine ()) != null){ - line++; if (s.StartsWith ("@item ")) break; } @@ -55,7 +52,6 @@ class X { } else { description += "\n" + (s == "\n" ? "<p>" : s); } - line++; } while ((s = input.ReadLine ()) != null); if (i != null){ @@ -80,12 +76,7 @@ class X { using (FileStream fs = new FileStream (input, FileMode.Open)){ using (StreamReader input_stream = new StreamReader (fs)){ - try { - PopulateRSS (input_stream); - } catch { - Console.WriteLine ("{0} failure while loading: {1}", line, input); - throw; - } + PopulateRSS (input_stream); } } diff --git a/doc/web/team.xml b/doc/web/team.xml index 7444d88f082..ccc9d97a16d 100644 --- a/doc/web/team.xml +++ b/doc/web/team.xml @@ -1453,7 +1453,7 @@ <e-mail>peter@newton.cx</e-mail> - <image>peterw.png</image> + <image>none.png</image> <location>Cambridge, MA</location> diff --git a/doc/web/template.html.in b/doc/web/template.html.in index 3af630dc644..2aab918a0a5 100644 --- a/doc/web/template.html.in +++ b/doc/web/template.html.in @@ -15,7 +15,6 @@ .navi0 { font-size: 14px; font-weight: bold; background: #444444; } .navi1 { font-size: 14px; font-weight: bold; left-margin: 10pt} .navi2 { font-size: 10px; font-weight: bold; left-margin: 20pt} - .topmenu { font-size: 14px; font-weight: bold; } .footnote { font-size: 12px; color: #aaaaaa; } a.navi0 { color: #ffffff; text-decoration: none} @@ -30,10 +29,6 @@ a.navi2:visited { color: #cccccc; } a.navi2:hover { color: #ee9900; text-decoration: underline; } - a.topmenu { color: #ffffff; text-decoration: none; margin-left: 7px;} - a.topmenu:visited { color: #cccccc; } - a.topmenu:hover { color: #ee9900; text-decoration: underline; } - // --> </style> #CSS# @@ -43,27 +38,11 @@ <table cellpadding="0" cellspacing="0" border="0" width="100%"> <tr> - <td><img src="images/pixel.gif" alt=""></td><!-- left border - --> - <td colspan="4"> - <table> - <tr> - <td> - <a href="http://www.go-mono.com"><img - src="images/mono-new.gif" alt="mono-logo" border="0"></a> - </td> - <td> - <a class="topmenu" href="download.html">Downloads</a> | - <a class="topmenu" href="http://go-mono.com/daily">Daily snapshots</a> | - <a class="topmenu" href="screenshots.html">Screenshots</a> | - <a class="topmenu" href="http://mono.ximian.com:8080">Documentation</a> - <a class="topmenu" href="bugs.html">Bugs</a> - </td> - </tr> - </table> - </td> - <td><img src="images/pixel.gif" alt=""></td><!-- right border - --> + <td><img src="images/pixel.gif" alt=""></td><!-- left border --> + <td colspan="4"> + <a href="http://www.go-mono.com"><img src="images/mono-new.gif" + alt="mono-logo" border="0"></a></td> + <td><img src="images/pixel.gif" alt=""></td><!-- right border --> </tr> <tr> <td><img src="images/pixel.gif" width="1" height="1" alt=""></td> diff --git a/man/mono.1 b/man/mono.1 index 8989518cdce..012f56d0bd4 100644 --- a/man/mono.1 +++ b/man/mono.1 @@ -195,12 +195,6 @@ If set, this variable overrides the default system configuration directory If set, this variable overrides the default runtime configuration file ($PREFIX/etc/mono/config). The --config command line options overrides the environment variable. -.TP -.I "MONO_DEBUG" -If set, enables some features of the runtime useful for debugging. - -Currently it only makes the runtime display the stack traces for all the -threads running and exit. It may not exit cleanly. Use at your own risk. .SH FILES On Unix assemblies are loaded from the installation lib directory. If you set `prefix' to /usr, the assemblies will be located in /usr/lib. On diff --git a/mcs/Makefile b/mcs/Makefile index cbc7d15733e..678ac7ea95a 100644 --- a/mcs/Makefile +++ b/mcs/Makefile @@ -41,6 +41,7 @@ DISTFILES = \ MIT.X11 \ MonoIcon.png \ README \ + README.building \ ScalableMonoIcon.svg \ winexe.in diff --git a/mcs/build/profiles/default.make b/mcs/build/profiles/default.make index 04fe95370e3..cabf57344f7 100644 --- a/mcs/build/profiles/default.make +++ b/mcs/build/profiles/default.make @@ -25,4 +25,5 @@ endif profile-check: -PROFILE_MCS_FLAGS = -d:NET_1_1 +# Causes some build errors +#PROFILE_MCS_FLAGS = /d:NET_1_1 diff --git a/mcs/build/profiles/generics.make b/mcs/build/profiles/generics.make index c18bee1f5a5..9df5fa57222 100644 --- a/mcs/build/profiles/generics.make +++ b/mcs/build/profiles/generics.make @@ -26,4 +26,4 @@ endif profile-check: # Causes some build errors -PROFILE_MCS_FLAGS = -d:GENERICS -d:NET_1_1 +PROFILE_MCS_FLAGS = -d:GENERICS diff --git a/mcs/build/rules.make b/mcs/build/rules.make index 75957307282..11c1fa7249e 100644 --- a/mcs/build/rules.make +++ b/mcs/build/rules.make @@ -13,7 +13,7 @@ dots := $(shell echo $(thisdir) |sed -e 's,[^./][^/]*,..,g') topdir := $(dots) -VERSION = 0.26.99 +VERSION = 0.25.99 USE_MCS_FLAGS = $(LOCAL_MCS_FLAGS) $(PLATFORM_MCS_FLAGS) $(PROFILE_MCS_FLAGS) $(MCS_FLAGS) USE_CFLAGS = $(LOCAL_CFLAGS) $(CFLAGS) diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/ChangeLog b/mcs/class/Microsoft.JScript/Microsoft.JScript/ChangeLog index e9dbb94a750..8df48da51f6 100644 --- a/mcs/class/Microsoft.JScript/Microsoft.JScript/ChangeLog +++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/ChangeLog @@ -1,13 +1,3 @@ -2003-09-07 Cesar Lopez Nataren <cesar@ciencias.unam.mx> - - * Context.cs: Added constructor and Document field. - * DocumentContext.cs: Added Name field. - * JSParser.cs: Integration of antlr's generated parser with - JSParser public API. ScriptBlock is now the principal data structure that - represents a Jscript .Net program. - * JSScanner.cs: Integration of antlr's generated lexer with - JSScanner public API. - 2003-07-27 Cesar Lopez Nataren <cesar@ciencias.unam.mx> * Added files StringLiteral.cs, CodeGenerator.cs and Print.cs. diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/Context.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/Context.cs index 7b83dc52e88..5f05fcae4f9 100644 --- a/mcs/class/Microsoft.JScript/Microsoft.JScript/Context.cs +++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/Context.cs @@ -1,10 +1,9 @@ // // Context.cs: // -// Author: -// Cesar Lopez Nataren (cesar@ciencias.unam.mx) +// Author: Cesar Octavio Lopez Nataren // -// (C) 2003, Cesar Lopez Nataren +// (C) 2003, Cesar Octavio Lopez Nataren, <cesar@ciencias.unam.mx> // namespace Microsoft.JScript.Tmp @@ -13,13 +12,6 @@ namespace Microsoft.JScript.Tmp public class Context { - internal DocumentContext Document; - - internal Context (string filename) - { - Document = new DocumentContext (filename); - } - public int EndColumn { get { throw new NotImplementedException (); } } diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/DocumentContext.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/DocumentContext.cs index 49f7f4dcc28..2638016894c 100644 --- a/mcs/class/Microsoft.JScript/Microsoft.JScript/DocumentContext.cs +++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/DocumentContext.cs @@ -10,12 +10,5 @@ namespace Microsoft.JScript.Tmp { public class DocumentContext - { - internal string Name; - - internal DocumentContext (string filename) - { - Name = filename; - } - } + {} }
\ No newline at end of file diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/JSParser.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/JSParser.cs index 7e845d41e20..785f00ac9eb 100644 --- a/mcs/class/Microsoft.JScript/Microsoft.JScript/JSParser.cs +++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/JSParser.cs @@ -13,21 +13,15 @@ namespace Microsoft.JScript.Tmp public class JSParser { - internal JScriptParser Parser; - public JSParser (Context context) { - JSScanner scanner = new JSScanner (context); - Parser = new JScriptParser (scanner.Lexer); + throw new NotImplementedException (); } public ScriptBlock Parse () { - ScriptBlock prog = new ScriptBlock (); - - Parser.program (prog); - return prog; + throw new NotImplementedException (); } diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/JSScanner.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/JSScanner.cs index 4f3325218c4..90a1f11cdbc 100644 --- a/mcs/class/Microsoft.JScript/Microsoft.JScript/JSScanner.cs +++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/JSScanner.cs @@ -10,21 +10,18 @@ namespace Microsoft.JScript.Tmp { using System; - using System.IO; public sealed class JSScanner { - internal JScriptLexer Lexer; - public JSScanner () - {} + { + throw new NotImplementedException (); + } + public JSScanner (Context sourceContext) { - string filename = sourceContext.Document.Name; - StreamReader file = new StreamReader (filename); - - Lexer = new JScriptLexer (file); + throw new NotImplementedException (); } diff --git a/mcs/class/Microsoft.Web.Services/Assembly/AssemblyInfo.cs b/mcs/class/Microsoft.Web.Services/Assembly/AssemblyInfo.cs deleted file mode 100755 index 5f27c63eb0e..00000000000 --- a/mcs/class/Microsoft.Web.Services/Assembly/AssemblyInfo.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -// AssemblyInfo.cs -// -// Author: -// Andreas Nahr (ClassDevelopment@A-SoftTech.com) -// -// (C) 2003 Ximian, Inc. http://www.ximian.com -// - -using System; -using System.Reflection; -using System.Resources; -using System.Security; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about the system assembly - -#if (WSE1) - [assembly: AssemblyVersion("1.0.0.0")] - [assembly: SatelliteContractVersion("1.0.0.0")] -#endif -#if (WSE2) - [assembly: AssemblyVersion("2.0.0.0")] - [assembly: SatelliteContractVersion("2.0.0.0")] -// [assembly: ComCompatibleVersion(1, 0, 3300, 0)] -// [assembly: TypeLibVersion(1, 10)] -#endif - -[assembly: AssemblyTitle("Microsoft.Web.Services.dll")] -[assembly: AssemblyDescription("Web Service Enhancement")] -[assembly: AssemblyConfiguration("Development version")] -[assembly: AssemblyCompany("MONO development team")] -[assembly: AssemblyProduct("MONO CLI")] -[assembly: AssemblyCopyright("(c) 2003 Various Authors")] - -[assembly: CLSCompliant(true)] -[assembly: AssemblyDefaultAlias("Microsoft.Web.Services.dll")] -[assembly: AssemblyInformationalVersion("0.0.0.1")] -[assembly: NeutralResourcesLanguage("en-US")] - -//[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")]
\ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Assembly/ChangeLog b/mcs/class/Microsoft.Web.Services/Assembly/ChangeLog deleted file mode 100755 index 85e8cbe6893..00000000000 --- a/mcs/class/Microsoft.Web.Services/Assembly/ChangeLog +++ /dev/null @@ -1,9 +0,0 @@ -2003-09-06 Sebastien Pouliot <spouliot@videotron.ca> - - * AssemblyInfo.cs: Removed AllowPartiallyTrustedCallers - -2003-09-04 Sebastien Pouliot <spouliot@videotron.ca> - - * AssemblyInfo.cs: Added. Copied from corlib and ajusted for WSE. - * Locale.cs: Added. Copied from corlib. - * ChangeLog: Added
\ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Assembly/Locale.cs b/mcs/class/Microsoft.Web.Services/Assembly/Locale.cs deleted file mode 100755 index a456449296f..00000000000 --- a/mcs/class/Microsoft.Web.Services/Assembly/Locale.cs +++ /dev/null @@ -1,24 +0,0 @@ -// -// Locale.cs -// -// Author: -// Miguel de Icaza (miguel@ximian.com) -// Andreas Nahr (ClassDevelopment@A-SoftTech.com) -// -// (C) 2001 - 2003 Ximian, Inc (http://www.ximian.com) -// - -internal sealed class Locale { - - private Locale () - { - } - - /// <summary> - /// Returns the translated message for the current locale - /// </summary> - public static string GetText (string msg) - { - return msg; - } -} diff --git a/mcs/class/Microsoft.Web.Services/ChangeLog b/mcs/class/Microsoft.Web.Services/ChangeLog deleted file mode 100644 index 8ae05825b61..00000000000 --- a/mcs/class/Microsoft.Web.Services/ChangeLog +++ /dev/null @@ -1,36 +0,0 @@ -2003-09-06 Sebastien Pouliot <spouliot@videotron.ca> - - * Microsoft.Web.Services.dll.sources: Added stubbed input/output soap - filters for Routing and Referral so Configuration can be compiled. - -2003-09-06 Sebastien Pouliot <spouliot@videotron.ca> - - * Microsoft.Web.Services.dll.sources: Added another shared (and - renamed) file from System.Security assembly (Signature.cs -> - SignedXmlSignature.cs). - -2003-09-05 Sebastien Pouliot <spouliot@videotron.ca> - - * Microsoft.Web.Services.dll.sources: Added stubbed classes from - Microsoft.Web.Services.Configuration to fix compilation. - -2003-09-04 Sebastien Pouliot <spouliot@videotron.ca> - - * Makefile: Added reference to System.Security assembly and a define - for WSE1 (required for classes shared between SS and WSE). - * Microsoft.Web.Services.dll.sources: Added (shared) files from - System.Security assembly. Removed unused files. Added Assembly files. - -2003-09-04 Duncan Mak <duncan@ximian.com> - - * Integrate the files from Sebastien. - -2003-09-02 Duncan Mak <duncan@ximian.com> - - * Microsoft.Web.Services/Soap.cs: - * Microsoft.Web.Services/IXmlElement.cs: Implemented. - -2003-09-02 Daniel Kornhauser <dkor@alum.mit.edu> - - * Microsoft.Web.Services: All Exceptions in this assembly - implemented.
\ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Makefile b/mcs/class/Microsoft.Web.Services/Makefile deleted file mode 100644 index 574bd14c66e..00000000000 --- a/mcs/class/Microsoft.Web.Services/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -thisdir = class/Microsoft.Web.Services -SUBDIRS = -include ../../build/rules.make - -LIBRARY = Microsoft.Web.Services.dll -LIB_MCS_FLAGS = /r:System.dll /r:System.Security.dll /r:System.Web.dll /r:System.Web.Services.dll /r:System.Xml.dll /r:System.Security.dll /r:Mono.Security.dll /d:WSE1 -NO_TEST = yes - -include ../../build/library.make diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/AddressingFormatException.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/AddressingFormatException.cs deleted file mode 100755 index 8bc1f83641d..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/AddressingFormatException.cs +++ /dev/null @@ -1,28 +0,0 @@ -// -// Microsoft.Web.Services.Addressing.AddressingFormatException.cs -// -// Author: Daniel Kornhauser dkor@alum.mit.edu -// -// (C) Copyright, Ximian, Inc. -// - -using System; -using System.Web.Services.Protocols; -using System.Xml; - -namespace Microsoft.Web.Services.Addressing { - - [Serializable] - public class AddressingFormatException : SoapHeaderException - { - public static readonly string MissingActionElement - = "The <{0}> element should not have any child nodes other than text."; - - - public AddressingFormatException (string message) - : base (message, XmlQualifiedName.Empty) - { - } - } -} - diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Configuration/ChangeLog b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Configuration/ChangeLog deleted file mode 100755 index cdb7626f2b2..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Configuration/ChangeLog +++ /dev/null @@ -1,11 +0,0 @@ -2003-09-06 Sebastien Pouliot <spouliot@videotron.ca> - - * ConfigurationBase.cs: Completed implementation (both WSE1 and WSE2). - * FilterConfiguration.cs: Now returns the default input/output filters. - * WebServicesConfiguration.cs: Works for WSE1. Added WSE2 stubs. - -2003-09-05 Sebastien Pouliot <spouliot@videotron.ca> - - * ConfigurationBase.cs: New. Limited implementation to fix compile. - * FilterConfiguration.cs: New. Stub to fix compile. - * WebServicesConfiguration.cs: New. Stub to fix compile.
\ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Configuration/ConfigurationBase.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Configuration/ConfigurationBase.cs deleted file mode 100755 index 5ca1a4e6bfb..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Configuration/ConfigurationBase.cs +++ /dev/null @@ -1,106 +0,0 @@ -// -// FilterConfiguration.cs: Filter Configuration -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Configuration; -using System.Xml; - -namespace Microsoft.Web.Services.Configuration { - - public class ConfigurationBase { - - public ConfigurationBase () {} - - protected static void CheckForChildNodes (XmlNode node) - { - if (node == null) - throw new ArgumentNullException ("node"); - if (node.HasChildNodes) - throw new ConfigurationException (Locale.GetText ("has child nodes")); - } - - protected static void CheckForDuplicateChildNodes (XmlNode node) - { - if (node == null) - throw new ArgumentNullException ("node"); - int n = node.ChildNodes.Count; - if (n > 1) { - // (n - 1) last is unimportant - for (int i=0; i < n - 1; i++) { - string xname = node.ChildNodes [i].Name; - // (i + 1) don't look back (again) - for (int j=i+1; j < n; i++) { - if (xname == node.ChildNodes [j].Name) - throw new ConfigurationException (Locale.GetText ("found duplicate nodes")); - } - } - } - } - - protected static void CheckForUnrecognizedAttributes (XmlNode node) - { - if (node == null) - throw new ArgumentNullException ("node"); - if (node.Attributes.Count > 0) - throw new ConfigurationException (Locale.GetText ("node has attributes")); - } - - protected static XmlNode GetAndRemoveAttribute (XmlNode node, string attrib, bool fRequired) - { - if (node == null) - throw new ArgumentNullException ("node"); - XmlNode xn = node.Attributes [attrib]; - if (xn != null) - node.Attributes.Remove (xn as XmlAttribute); - else if (fRequired) - throw new ConfigurationException (Locale.GetText ("missing required attribute")); - return xn; - } - - protected static XmlNode GetAndRemoveBoolAttribute (XmlNode node, string attrib, bool fRequired, ref bool val) - { - XmlNode xn = GetAndRemoveAttribute (node, attrib, fRequired); - if (xn != null) - val = Convert.ToBoolean (xn.Value); - return xn; - } -#if WSE2 - protected static XmlNode GetAndRemoveIntegerAttribute (XmlNode node, string attrib, bool fRequired, ref int val) - { - XmlNode xn = GetAndRemoveAttribute (node, attrib, fRequired); - if (xn != null) - val = Convert.ToInt32 (xn.Value); - return xn; - } -#endif - protected static XmlNode GetAndRemoveStringAttribute (XmlNode node, string attrib, bool fRequired, ref string val) - { - XmlNode xn = GetAndRemoveAttribute (node, attrib, fRequired); - if (xn != null) - val = xn.Value; - return xn; - } - - protected static void ThrowIfElement (XmlNode node) - { - if (node == null) - throw new ArgumentNullException ("node"); - if (node.NodeType == XmlNodeType.Element) - throw new ConfigurationException (Locale.GetText ("node is XmlNodeType.Element")); - } - - protected static void ThrowIfNotComment (XmlNode node) - { - if (node == null) - throw new ArgumentNullException ("node"); - if (node.NodeType != XmlNodeType.Comment) - throw new ConfigurationException (Locale.GetText ("node isn't XmlNodeType.Comment")); - } - } -}
\ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Configuration/FilterConfiguration.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Configuration/FilterConfiguration.cs deleted file mode 100755 index 003d28d0fc1..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Configuration/FilterConfiguration.cs +++ /dev/null @@ -1,54 +0,0 @@ -// -// FilterConfiguration.cs: Filter Configuration -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -using Microsoft.Web.Services; -using Microsoft.Web.Services.Configuration; -using Microsoft.Web.Services.Security; -using Microsoft.Web.Services.Timestamp; -using Microsoft.Web.Services.Referral; -using Microsoft.Web.Services.Routing; - -namespace Microsoft.Web.Services.Configuration { - - public sealed class FilterConfiguration : ConfigurationBase { - - private SoapInputFilterCollection input; - private SoapOutputFilterCollection output; - - [MonoTODO("see <filters> in WSE documentation")] - internal FilterConfiguration () - { - input = new SoapInputFilterCollection (); - // the following 4 filters always seems present (notwithstanding config) - input.Add (new SecurityInputFilter ()); - input.Add (new TimestampInputFilter ()); - input.Add (new ReferralInputFilter ()); - input.Add (new RoutingInputFilter ()); - // TODO: add custom input filters - - output = new SoapOutputFilterCollection (); - // the following 4 filters always seems present (notwithstanding config) - output.Add (new SecurityOutputFilter ()); - output.Add (new TimestampOutputFilter ()); - output.Add (new ReferralOutputFilter ()); - output.Add (new RoutingOutputFilter ()); - // TODO: add custom output filters - } - - public SoapInputFilterCollection InputFilters { - get { return input; } - } - - public SoapOutputFilterCollection OutputFilters { - get { return output; } - } - } -}
\ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Configuration/WebServicesConfiguration.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Configuration/WebServicesConfiguration.cs deleted file mode 100755 index 4fcdae3f882..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Configuration/WebServicesConfiguration.cs +++ /dev/null @@ -1,41 +0,0 @@ -// -// WebServicesConfiguration.cs: Web Services Configuration -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Configuration; -using System.Xml; - -namespace Microsoft.Web.Services.Configuration { - - public sealed class WebServicesConfiguration : ConfigurationBase, IConfigurationSectionHandler { - - public static FilterConfiguration FilterConfiguration { - get { return new FilterConfiguration (); } - } - -#if WSE2 - [MonoTODO()] - public static MessagingConfiguration MessagingConfiguration { - get { return null; } - } - - [MonoTODO()] - public static TokenIssuerConfiguration TokenIssuerConfiguration { - get { return null; } - } -#endif - - // from IConfigurationSectionHandler - [MonoTODO()] - object IConfigurationSectionHandler.Create (object parent, object configContext, XmlNode section) - { - return null; - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/ChangeLog b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/ChangeLog deleted file mode 100755 index cfe39a2eb38..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/ChangeLog +++ /dev/null @@ -1,4 +0,0 @@ -2003-09-04 Sebastien Pouliot <spouliot@videotron.ca> - - * DimeAttachmentCollection.cs: Fixed compilation issues - * DimeReader.cs: Fixed compilation issues diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/DimeAttachment.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/DimeAttachment.cs deleted file mode 100644 index 23a5b0196c1..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/DimeAttachment.cs +++ /dev/null @@ -1,99 +0,0 @@ -// -// Microsoft.Web.Services.Dime.DimeAttachment.cs -// -// Name: Duncan Mak (duncan@ximian.com) -// -// Copyright (C) Ximian, Inc. 2003 -// - -using System; -using System.IO; - -namespace Microsoft.Web.Services.Dime { - - public class DimeAttachment - { - int chunk_size = Int32.MaxValue; // docs list this as default - string id; - string type; - Stream stream; - TypeFormatEnum type_format; - - public DimeAttachment () - { - id = String.Empty; - stream = null; - type = null; - type_format = TypeFormatEnum.Unchanged; - } - - public DimeAttachment (string type, TypeFormatEnum typeFormat, string path) - { - this.type = type; - this.type_format = typeFormat; - - if (File.Exists (path) == false) - throw new FileNotFoundException ( - Locale.GetText ("The path is not valid.")); - } - - public DimeAttachment (string type, TypeFormatEnum typeFormat, Stream stream) - { - this.type = type; - this.type_format = typeFormat; - this.stream = stream; - } - - public DimeAttachment (string id, string type, TypeFormatEnum typeFormat, string path) - : this (type, typeFormat, path) - { - this.id = id; - } - - public DimeAttachment (string id, string type, TypeFormatEnum typeFormat, Stream stream) - : this (type, typeFormat, stream) - { - this.id = id; - } - - public int ChunkSize { - - get { return chunk_size; } - - set { chunk_size = value; } - } - - public string Id { - - get { return id; } - - set { id = value; } - } - - public Stream Stream { - - get { return stream; } - - set { - if (value == null) - throw new ArgumentNullException ( - Locale.GetText ("Argument is null.")); - stream = value; - } - } - - public string Type { - - get { return type; } - - set { type = value; } - } - - public TypeFormatEnum TypeFormat { - - get { return type_format; } - - set { type_format = value; } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/DimeAttachmentCollection.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/DimeAttachmentCollection.cs deleted file mode 100644 index 7535a2c25c2..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/DimeAttachmentCollection.cs +++ /dev/null @@ -1,91 +0,0 @@ -// -// Microsoft.Web.Services.Dime.DimeAttachmentCollection.cs -// -// Name: Daniel Kornhauser <dkor@alum.mit.edu> -// -// Copyright (C) Ximian, Inc. 2003 -// - -using Microsoft.Web.Services; -using System; -using System.Collections; -using System.Globalization; - -namespace Microsoft.Web.Services.Dime { - - - public class DimeAttachmentCollection : CollectionBase - { - - DimeReader reader; - - public DimeAttachmentCollection () - { - } - - public DimeAttachmentCollection (DimeReader reader) - { - if (reader == null) - throw new ArgumentNullException ( - Locale.GetText ("Argument is null.")); - - - if (reader.CanRead == false) - throw new ArgumentException ( - Locale.GetText ("The reader is not readable")); - - this.reader = reader; - } - - public DimeAttachment this [int key] { - get { - return (DimeAttachment) InnerList [key]; - } - } - - public DimeAttachment this [string key] { - get { - // FIXME: must iterate in collection - return null; - } - } - - public void Add (DimeAttachment attachment) - { - InnerList.Add (attachment); - } - - public void AddRange (ICollection collection) - { - foreach (object o in collection) - InnerList.Add (o); - } - - public bool Contains (string id) - { - return InnerList.Contains (id); - } - - public void CopyTo (DimeAttachment[] attachments, int index) - { - InnerList.CopyTo (attachments, index); - } - - public int IndexOf (DimeAttachment attachment) - { - return InnerList.IndexOf(attachment); - } - - public int IndexOf (string id) - { - return InnerList.IndexOf(id); - } - - public void Remove (DimeAttachment attachment) - { - InnerList.Remove (attachment); - } - } -} - - diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/DimeFormatException.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/DimeFormatException.cs deleted file mode 100755 index 2aed4b7e21c..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/DimeFormatException.cs +++ /dev/null @@ -1,29 +0,0 @@ -//
-// Microsoft.Web.Services.DimeFormatException.cs
-//
-// Author: Daniel Kornhauser dkor@alum.mit.edu
-//
-// (C) Copyright, Ximian, Inc.
-//
-
-using System;
-using System.Web.Services.Protocols;
-using System.Xml;
-
-namespace Microsoft.Web.Services.Dime {
-
- [Serializable]
- public class DimeFormatException: SoapHeaderException
- {
- public DimeFormatException (string message)
- : base (String.Empty, XmlQualifiedName.Empty)
- {
- }
-
- public DimeFormatException (string message, Exception ex)
- : base (message, XmlQualifiedName.Empty, ex)
- {
- }
- }
-}
-
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/DimeReader.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/DimeReader.cs deleted file mode 100644 index 9e39d7406a3..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/DimeReader.cs +++ /dev/null @@ -1,59 +0,0 @@ -// -// Microsoft.Web.Services.Dime.DimeReader.cs -// -// Name: Duncan Mak (duncan@ximian.com) -// -// Copyright (C) Ximian, Inc. 2003 -// - -using System; -using System.IO; - -namespace Microsoft.Web.Services.Dime { - - public class DimeReader - { - - Stream stream; - bool opened; - - public DimeReader (Stream stream) - { - if (stream == null) - throw new ArgumentNullException ( - Locale.GetText ("Argument is null.")); - - if (stream.CanRead == false) - throw new ArgumentException ( - Locale.GetText ("The stream is not readable")); - - this.stream = stream; - opened = true; - } - - public void Close () - { - if (opened == false) - throw new InvalidOperationException ( - Locale.GetText ("The stream is currently open.")); - - stream.Close (); - opened = false; - } - - public bool CanRead { - get { return stream.CanRead; } - } - - [MonoTODO] - public DimeRecord ReadRecord () - { - if (opened == false) - throw new InvalidOperationException ( - Locale.GetText ("The stream is currently closed.")); - opened = true; - - throw new NotImplementedException (); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/DimeRecord.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/DimeRecord.cs deleted file mode 100644 index 8a15c1132d4..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/DimeRecord.cs +++ /dev/null @@ -1,18 +0,0 @@ -// -// Microsoft.Web.Services.Dime.DimeRecord.cs -// -// Name: Duncan Mak (duncan@ximian.com) -// -// Copyright (C) Ximian, Inc. 2003 -// - -using System; -using System.IO; - -namespace Microsoft.Web.Services.Dime { - - [MonoTODO] - public class DimeRecord - { - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/TypeFormatEnum.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/TypeFormatEnum.cs deleted file mode 100644 index 3cca2e1aa4b..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Dime/TypeFormatEnum.cs +++ /dev/null @@ -1,20 +0,0 @@ -// -// Microsfot.Web.Services.TypeFormatEnum.cs -// -// Author: Daniel Kornhauser <dkor@alum.mit.edu> -// -// (C) Copyright, Ximian, Inc. -// - - -namespace Microsoft.Web.Services.Dime { - - public enum TypeFormatEnum - { - Unchanged = 0, - MediaType = 16, - AbsoluteUri = 32, - Unknown = 48, - None = 64 - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/ISoapFormatter.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/ISoapFormatter.cs deleted file mode 100755 index c07ee3c2999..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/ISoapFormatter.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Microsoft.Web.Services.Messaging.ISoapFormmatter.cs -// -// Author: Duncan Mak <duncan@ximian.com> -// -// (C) Ximian, Inc. 2003. - -using System.IO; -using Microsoft.Web.Services; - -namespace Microsoft.Web.Services.Messaging { - public interface ISoapFormatter { - - SoapEnvelope Deserialize (Stream stream); - - void Serialize (SoapEnvelope envelope, Stream stream); - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/ISoapTransport.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/ISoapTransport.cs deleted file mode 100755 index 096fc955737..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/ISoapTransport.cs +++ /dev/null @@ -1,50 +0,0 @@ -//
-// Microsoft.Web.Services.Messaging.ISoapTransport.cs
-//
-// Author: Daniel Kornhauser <dkor@alum.mit.edu>
-//
-// (C) Ximian, Inc. 2003.
-//
-
-using System;
-using System.IO;
-using System.Net;
-using Microsoft.Web.Services;
-
-namespace Microsoft.Web.Services.Messaging {
-
- public interface ISoapTransport {
-
- ICredentials Credentials { get; set; }
-
- int IdleTimeout { get; set; }
-
- string Scheme { get; }
-
- IAsyncResult BeginSend (
- SoapEnvelope envelope,
- Uri destination,
- AsyncCallback callback,
- object state);
-
- void EndSend (IAsyncResult result);
-
- void RegisterPort (Uri to, Type port);
-
- void RegisterPort (Uri to, SoapReceiver receiver);
-
- void Send (SoapEnvelope envelop, Uri destination);
-
- void UnregisterAll ();
-
- void UnregisterPort (Uri to);
-
- }
-}
-
-
-
-
-
-
-
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapPort.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapPort.cs deleted file mode 100755 index ffdc064f885..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapPort.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Microsoft.Web.Services.Messaging { - - public abstract class SoapPort - { - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapReceiver.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapReceiver.cs deleted file mode 100755 index be492063396..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapReceiver.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Web; -using Microsoft.Web.Services; - -namespace Microsoft.Web.Services.Messaging { - - public abstract class SoapReceiver : SoapPort, IHttpHandler - { - [MonoTODO] - public bool IsReusable { - get { - throw new NotImplementedException (); - } - } - - [MonoTODO] - public void ProcessRequest (HttpContext context) - { - throw new NotImplementedException (); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Policy/PolicyEnforcementException.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Policy/PolicyEnforcementException.cs deleted file mode 100755 index 65a663e83ca..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Policy/PolicyEnforcementException.cs +++ /dev/null @@ -1,24 +0,0 @@ -//
-// Microsoft.Web.Services.PolicyEnforcementException.cs
-//
-// Author Daniel Kornhauser dkor@alum.mit.edu
-//
-// (C) Copyright, Ximian, Inc. 2003.
-//
-
-using System;
-using System.Web.Services.Protocols;
-using System.Xml;
-
-namespace Microsoft.Web.Services.Policy {
-
- [Serializable]
- public class PolicyEnforcementException : SoapException
- {
- public PolicyEnforcementException (string message)
- : base (message, XmlQualifiedName.Empty)
- {
- }
- }
-}
-
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ChangeLog b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ChangeLog deleted file mode 100755 index b5be106ce1c..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ChangeLog +++ /dev/null @@ -1,22 +0,0 @@ -2003-09-07 Sebastien Pouliot <spouliot@videotron.ca> - - * Referral.cs: Removed virtual from Clone/GetXml/LoadXml for WSE1 - (corcompare). - * ReferralCollection.cs: Removed virtual from LoadXml/GetXml/ - GetEnumerator/CopyTo/Count/IsSynchronized/SyncRoot for WSE1 - (corcompare) - * ReferralException.cs: Removed ReferralFormatException implementation - and added ReferralException. - * ReferralFormatException.cs: Moved code from ReferralException.cs and - added missing string constants. - * ReferralInputFilter.cs: Added missing TODO. - * ReferralOutputFilter.cs: Added missing TODO. - -2003-09-06 Sebastien Pouliot <spouliot@videotron.ca> - - * ReferralInputFilter.cs: Stubbed for compilation (configuration). - * ReferralOutputFilter.cs: Stubbed for compilation (configuration) - -2003-09-04 Sebastien Pouliot <spouliot@videotron.ca> - - * ReferralCollection.cs: Added missing ICollection properties. diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/Desc.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/Desc.cs deleted file mode 100644 index 62e3b5272b9..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/Desc.cs +++ /dev/null @@ -1,34 +0,0 @@ -// -// Microsoft.Web.Services.Referral.Desc.cs -// -// Name: Daniel Kornhauser <dkor@alum.mit.edu> -// -// Copyright (C) Ximian, Inc. 2003 -// - -using System; -using System.Globalization; - -namespace Microsoft.Web.Services.Referral { - - public class Desc - { - Uri uri; - - public Desc () - { - } - - public Uri RefAddr { - get { - return uri; - } - set { - if (value.AbsoluteUri != value.ToString ()) - throw new ArgumentException ( - Locale.GetText ("uri is not absolute")); - uri = value; - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/For.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/For.cs deleted file mode 100644 index 32546a22f01..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/For.cs +++ /dev/null @@ -1,45 +0,0 @@ -// -// Microsoft.Web.Services.Referral.For.cs -// -// Name: Daniel Kornhauser <dkor@alum.mit.edu> -// -// Copyright (C) Ximian, Inc. 2003 -// - -using System; -using System.Globalization; - -namespace Microsoft.Web.Services.Referral { - - public class For - { - Uri exact; - Uri prefix; - - public For () - { - } - - [MonoTODO] - public Uri Exact { - get { - return exact; - } - set { - - exact = value; - } - } - - [MonoTODO] - public Uri Prefix { - get { - return prefix; - } - - set { - prefix = value; - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/If.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/If.cs deleted file mode 100644 index f24d93a499d..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/If.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -// Microsoft.Web.Service.Referral.If.cs -// -// Name: Daniel Kornhauser <dkor@alum.media.mit.edu> -// -// Copyright (C) Ximian, Inc. 2003 -// - -using System; -using System.Globalization; - -namespace Microsoft.Web.Services.Referral { - - public class If - { - - UriList uris; - long milliseconds; - - public If() - { - } - - public UriList Invalidates{ - get { - return uris; - } - } - - [MonoTODO] - public long Ttl { - - get { - return milliseconds; - } - - set { - milliseconds = value; - - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/Referral.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/Referral.cs deleted file mode 100644 index 091c9a43928..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/Referral.cs +++ /dev/null @@ -1,117 +0,0 @@ -// -// Microsoft.Web.Services.Referral.Referral.cs -// -// Authors: -// Duncan Mak (duncan@ximian.com) -// Daniel Kornhauser <dkor@alum.mit.edu> -// -// Copyright (C) Ximian, Inc. 2003 -// - -using System; -using System.Collections; -using System.Globalization; -using System.Web.Services.Protocols; -using System.Xml; -using Microsoft.Web.Services.Routing; - -namespace Microsoft.Web.Services.Referral { - - public class Referral : ICloneable, IXmlElement - { - Uri uri; - - public Referral () - { - } - - public Referral (Uri uri) - { - this.uri = uri; - } - - [MonoTODO] - public void CheckValid () - { - } - -#if WSE1 - public object Clone () -#else - public virtual object Clone () -#endif - { - return new Referral (uri); - } - - [MonoTODO] -#if WSE1 - public XmlElement GetXml (XmlDocument document) -#else - public virtual XmlElement GetXml (XmlDocument document) -#endif - { - if (document == null) - throw new ArgumentNullException ( - Locale.GetText ("Argument is null.")); - - throw new NotImplementedException (); - } - - [MonoTODO] -#if WSE1 - public void LoadXml (XmlElement element) -#else - public virtual void LoadXml (XmlElement element) -#endif - { - if (element == null) - throw new ArgumentNullException ( - Locale.GetText ("Argument is null.")); - - throw new NotImplementedException (); - } - - [MonoTODO] - public Desc Desc { - get { - throw new NotImplementedException (); - } - } - - [MonoTODO] - public ViaCollection Go { - get { - throw new NotImplementedException (); - } - } - - [MonoTODO] - public For For{ - get { - throw new NotImplementedException (); - } - } - - [MonoTODO] - public If If { - get { - throw new NotImplementedException (); - } - } - - [MonoTODO] - public Uri RefId { - get { - throw new NotImplementedException (); - } - set { - - if (value == null) - throw new ArgumentNullException (); - - throw new NotImplementedException (); - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ReferralCollection.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ReferralCollection.cs deleted file mode 100644 index 2fb8fdbb389..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ReferralCollection.cs +++ /dev/null @@ -1,130 +0,0 @@ -// -// Microsoft.Web.Services.Referral.ReferralCollection.cs -// -// Name: Duncan Mak (duncan@ximian.com) -// -// Copyright (C) Ximian, Inc. 2003 -// - -using System; -using System.Collections; -using System.Globalization; -using System.Web.Services.Protocols; -using System.Xml; - -namespace Microsoft.Web.Services.Referral { - - public class ReferralCollection : SoapHeader, ICollection, IEnumerable, IXmlElement - { - ArrayList list; - - public ReferralCollection () - { - list = new ArrayList (); - } - - public void Add (Referral referral) - { - list.Add (referral); - } - - public void AddRange (Referral [] referrals) - { - list.AddRange (referrals); - } - - public void Clear () - { - list.Clear (); - } - - public bool Contains (Referral referral) - { - return list.Contains (referral); - } - - public bool Contains (Uri uri) - { - return list.Contains (new Referral (uri)); - } - -#if WSE1 - public void CopyTo (Array array, int index) -#else - public virtual void CopyTo (Array array, int index) -#endif - { - list.CopyTo (array, index); - } - -#if WSE1 - public int Count { -#else - public virtual int Count { -#endif - get { return list.Count; } - } - -#if WSE1 - public IEnumerator GetEnumerator () -#else - public virtual IEnumerator GetEnumerator () -#endif - { - return list.GetEnumerator (); - } - - [MonoTODO] -#if WSE1 - public XmlElement GetXml (XmlDocument document) -#else - public virtual XmlElement GetXml (XmlDocument document) -#endif - { - if (document == null) - throw new ArgumentNullException ( - Locale.GetText ("Argument is null.")); - - throw new NotImplementedException (); - } -#if WSE1 - public bool IsSynchronized { -#else - public virtual bool IsSynchronized { -#endif - get { return list.IsSynchronized; } - } - - [MonoTODO] -#if WSE1 - public void LoadXml (XmlElement element) -#else - public virtual void LoadXml (XmlElement element) -#endif - { - if (element == null) - throw new ArgumentNullException ( - Locale.GetText ("Argument is null.")); - - throw new NotImplementedException (); - } - - public void Remove (Referral referral) - { - list.Remove (referral); - } - - public void Remove (Uri uri) - { - list.Remove (new Referral (uri)); - } - -#if WSE1 - public object SyncRoot { -#else - public virtual object SyncRoot { -#endif - get { return list.SyncRoot; } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ReferralException.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ReferralException.cs deleted file mode 100755 index 5ce2539be1d..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ReferralException.cs +++ /dev/null @@ -1,24 +0,0 @@ -// -// Microsoft.Web.Services.Referral.ReferralException.cs -// -// Authors: -// Daniel Kornhauser <dkor@alum.mit.edu> -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) Ximian, Inc. 2003. -// Portions (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Microsoft.Web.Services.Referral { - - [Serializable] - public class ReferralException : SystemException { - - public ReferralException (string message) : base (message) {} - - public ReferralException (string message, Exception ex) : base (message, ex) {} - } -} - diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ReferralFormatException.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ReferralFormatException.cs deleted file mode 100755 index f1805e2add4..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ReferralFormatException.cs +++ /dev/null @@ -1,70 +0,0 @@ -// -// Microsoft.Web.Services.Referral.ReferralFormatException.cs -// -// Authors: -// Daniel Kornhauser <dkor@alum.mit.edu> -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) Ximian, Inc. 2003. -// Portions (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -// TODO: Figure out what the Uri parameter does. - -using System; -using System.Web.Services.Protocols; -using System.Xml; - -namespace Microsoft.Web.Services.Referral { - - [Serializable] - [MonoTODO("I18N")] - public class ReferralFormatException : SoapHeaderException { - - public static readonly string BadDescValue = Locale.GetText ("BadDescValue"); - public static readonly string BadExactValue = Locale.GetText ("BadExactValue"); - public static readonly string BadMatchCombination = Locale.GetText ("BadMatchCombination"); - public static readonly string BadPrefixValue = Locale.GetText ("BadPrefixValue"); - public static readonly string BadRefAddrValue = Locale.GetText ("BadRefAddrValue"); - public static readonly string BadRefIdValue = Locale.GetText ("BadRefIdValue"); - public static readonly string BadRidValue = Locale.GetText ("BadRidValue"); - public static readonly string BadTransport = Locale.GetText ("BadTransport"); - public static readonly string BadTtlValue = Locale.GetText ("BadTtlValue"); - public static readonly string BadViaValue = Locale.GetText ("BadViaValue"); - public static readonly string DuplicateDescElement = Locale.GetText ("DuplicateDescElement"); - public static readonly string DuplicateExactElement = Locale.GetText ("DuplicateExactElement"); - public static readonly string DuplicateForElement = Locale.GetText ("DuplicateForElement"); - public static readonly string DuplicateGoElement = Locale.GetText ("DuplicateGoElement"); - public static readonly string DuplicateIfElement = Locale.GetText ("DuplicateIfElement"); - public static readonly string DuplicatePrefixElement = Locale.GetText ("DuplicatePrefixElement"); - public static readonly string DuplicateRefIdElement = Locale.GetText ("DuplicateRefIdElement"); - public static readonly string ExactIsNotAbsoluteUri = Locale.GetText ("ExactIsNotAbsoluteUri"); - public static readonly string MissingForElement = Locale.GetText ("MissingForElement"); - public static readonly string MissingGoElement = Locale.GetText ("MissingGoElement"); - public static readonly string MissingRefIdElement = Locale.GetText ("MissingRefIdElement"); - public static readonly string MissingRidElement = Locale.GetText ("MissingRidElement"); - public static readonly string MissingViaElement = Locale.GetText ("MissingViaElement"); - public static readonly string MoreThanOneReferralHeaders = Locale.GetText ("MoreThanOneReferralHeaders"); - public static readonly string NegativeTtlValue = Locale.GetText ("NegativeTtlValue"); - public static readonly string PrefixIsNotAbsoluteUri = Locale.GetText ("PrefixIsNotAbsoluteUri"); - public static readonly string RefAddrIsNotAbsoluteUri = Locale.GetText ("RefAddrIsNotAbsoluteUri"); - public static readonly string SignedTtlValue = Locale.GetText ("SignedTtlValue"); - public static readonly string ViaIsNotAbsoluteUri = Locale.GetText ("ViaIsNotAbsoluteUri"); - - Uri reference; - - public ReferralFormatException (string message) - : base (message, XmlQualifiedName.Empty) { - } - - public ReferralFormatException (Uri refid, string message) - : base (message, XmlQualifiedName.Empty) { - reference = refid; - } - - public ReferralFormatException (Uri refid, string message, Exception innerException) - : base (message, XmlQualifiedName.Empty, innerException) { - reference = refid; - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ReferralInputfilter.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ReferralInputfilter.cs deleted file mode 100755 index 24179183fee..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ReferralInputfilter.cs +++ /dev/null @@ -1,26 +0,0 @@ -// -// ReferralInputFilter.cs: Referral SOAP Input Filter -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Microsoft.Web.Services.Referral { - - public class ReferralInputFilter : SoapInputFilter { - - public ReferralInputFilter () {} - - [MonoTODO] - public override void ProcessMessage (SoapEnvelope envelope) - { - if (envelope == null) - throw new ArgumentNullException ("envelope"); - // TODO - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ReferralOutputFilter.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ReferralOutputFilter.cs deleted file mode 100755 index 5a1e62f0d6c..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Referral/ReferralOutputFilter.cs +++ /dev/null @@ -1,26 +0,0 @@ -// -// ReferralOutputFilter.cs: Referral SOAP Output Filter -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Microsoft.Web.Services.Referral { - - public class ReferralOutputFilter : SoapOutputFilter { - - public ReferralOutputFilter () {} - - [MonoTODO] - public override void ProcessMessage (SoapEnvelope envelope) - { - if (envelope == null) - throw new ArgumentNullException ("envelope"); - // TODO - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/ChangeLog b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/ChangeLog deleted file mode 100755 index 7dcf1e0f010..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/ChangeLog +++ /dev/null @@ -1,21 +0,0 @@ -2003-09-07 Sebastien Pouliot <spouliot@videotron.ca> - - * Path.cs: Constructors are internal and Clone is non virtual in WSE1 - (corcompare). Added missing properties (many are obsolete in WSE2). - * RoutingInputFilter.cs: Added missing TODO. - * RoutingOutputFilter.cs: Added missing TODO. - * Via.cs: Removed virtual from Clone for WSE1 (corcompare). - * ViaCollection.cs: Removed virtual from Clone/GetEnumerator/CopyTo/ - SyncRoot for WSE1 (corcompare). - * WSRouting.cs: New. Routing constant strings. - -2003-09-06 Sebastien Pouliot <spouliot@videotron.ca> - - * RoutingInputFilter.cs: Stubbed for compilation (configuration). - * RoutingOutputFilter.cs: Stubbed for compilation (configuration). - -2003-09-04 Sebastien Pouliot <spouliot@videotron.ca> - - * Path.cs: Corrected typos to fix compilation. - * Via.cs: Corrected typos to fix compilation. - * ViaCollection.cs: Corrected typos to fix compilation. diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/Path.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/Path.cs deleted file mode 100644 index 1756f33f5c9..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/Path.cs +++ /dev/null @@ -1,127 +0,0 @@ -// -// Microsoft.Web.Services.Routing.Path.cs -// -// Name: Duncan Mak (duncan@ximian.com) -// -// Copyright (C) Ximian, Inc. 2003 -// - -using System; -using System.Globalization; -using System.Web.Services.Protocols; -using System.Xml; - -namespace Microsoft.Web.Services.Routing { - - [MonoTODO] - public class Path : SoapHeader, ICloneable - { - XmlElement element; -#if WSE1 - internal Path () {} -#else - public Path () {} -#endif - -#if WSE1 - internal Path (XmlElement element) -#else - public Path (XmlElement element) -#endif - { - this.element = element; - } - - [MonoTODO] - public void CheckValid () - { - } - - [MonoTODO] - public XmlElement GetXml (XmlDocument document) - { - if (document == null) - throw new ArgumentNullException ( - Locale.GetText ("Argument is null.")); - throw new NotImplementedException (); - } - - [MonoTODO] - public void LoadXml (XmlElement element) - { - if (element == null) - throw new ArgumentNullException ( - Locale.GetText ("Argument is null.")); - } - - [MonoTODO] -#if WSE1 - public object Clone () -#else - public virtual object Clone () -#endif - { - throw new NotImplementedException (); - } - -#if !WSE1 - [Obsolete] -#endif - [MonoTODO] - public string Action { - get { return null; } - set { ; } - } - -/* [MonoTODO] - public RoutingFault Fault { - get { return null; } - set { ; } - }*/ - -#if !WSE1 - [Obsolete] -#endif - [MonoTODO] - public Uri From { - get { return null; } - set { ; } - } - - [MonoTODO] - public ViaCollection Fwd { - get { return null; } - } - -#if !WSE1 - [Obsolete] -#endif - [MonoTODO] - public Uri Id { - get { return null; } - } - -#if !WSE1 - [Obsolete] -#endif - [MonoTODO] - public Uri RelatesTo { - get { return null; } - set { ; } - } - - [MonoTODO] - public ViaCollection Rev { - get { return null; } - set { ; } - } - -#if !WSE1 - [Obsolete] -#endif - [MonoTODO] - public Uri To { - get { return null; } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/RoutingFormatException.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/RoutingFormatException.cs deleted file mode 100755 index 0fd80d6455c..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/RoutingFormatException.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Microsoft.Web.Services.Routing.RoutingFormatException.cs
-//
-// Author: Daniel Kornhauser <dkor@alum.mit.edu>
-//
-// (C) Ximian, Inc. 2003
-
-using System;
-using System.Web.Services.Protocols;
-using System.Xml;
-
-
-namespace Microsoft.Web.Services.Routing {
-
- [Serializable]
- public class RoutingFormatException : SoapHeaderException
- {
- public RoutingFormatException (string message) : base (message, XmlQualifiedName.Empty)
- {
- }
-
- public RoutingFormatException (string message, Exception ex) : base (message, XmlQualifiedName.Empty, ex)
- {
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/RoutingInputfilter.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/RoutingInputfilter.cs deleted file mode 100755 index 268c80d3999..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/RoutingInputfilter.cs +++ /dev/null @@ -1,26 +0,0 @@ -// -// RoutingInputFilter.cs: Routing SOAP Input Filter -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Microsoft.Web.Services.Routing { - - public class RoutingInputFilter : SoapInputFilter { - - public RoutingInputFilter () {} - - [MonoTODO] - public override void ProcessMessage (SoapEnvelope envelope) - { - if (envelope == null) - throw new ArgumentNullException ("envelope"); - // TODO - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/RoutingOutputFilter.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/RoutingOutputFilter.cs deleted file mode 100755 index afb22acce87..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/RoutingOutputFilter.cs +++ /dev/null @@ -1,26 +0,0 @@ -// -// SecurityOutputFilter.cs: Security SOAP Output Filter -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Microsoft.Web.Services.Routing { - - public class RoutingOutputFilter : SoapOutputFilter { - - public RoutingOutputFilter () {} - - [MonoTODO] - public override void ProcessMessage (SoapEnvelope envelope) - { - if (envelope == null) - throw new ArgumentNullException ("envelope"); - // TODO - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/Via.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/Via.cs deleted file mode 100644 index 9d9646ab6f2..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/Via.cs +++ /dev/null @@ -1,57 +0,0 @@ -// -// Microsfot.Web.Services.Routing.Via.cs -// -// Author: Daniel Kornhauser <dkor@alum.mit.edu> -// -// Copyright (C) Ximian, Inc. 2003 -// - -using System; - -namespace Microsoft.Web.Services.Routing { - - public class Via: ICloneable - { - Uri val; - Uri vid; - - public Via() - { - } - - public Via (Uri value) - { - this.val = value; - } - - private Via (Uri value, Uri vid) - { - this.val = value; - this.vid = vid; - } - - public Uri Value - { - get { return val; } - set { val = value; } - } - - public Uri Vid - { - get { return vid; } - set { vid = value; } - } - -#if WSE1 - public object Clone () -#else - public virtual object Clone () -#endif - { - return new Via (val, vid); - } - - } -} - - diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/ViaCollection.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/ViaCollection.cs deleted file mode 100644 index 9f83f6fd64f..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/ViaCollection.cs +++ /dev/null @@ -1,90 +0,0 @@ -// -// Microsoft.Web.Services.Routing.ViaCollection.cs -// -// Author: Daniel Kornhauser <dkor@alum.mit.edu> -// -// Copyright (C) Ximian, Inc. 2003 -// - -using System; -using System.Collections; - -namespace Microsoft.Web.Services.Routing { - - public class ViaCollection : ICollection, IEnumerable, ICloneable - { - ArrayList list; - - public ViaCollection () - { - list = new ArrayList (); - } - - ViaCollection (ArrayList list) - { - this.list = list; - } - - - public int Count { - get { return list.Count; } - } - - - public bool IsSynchronized { - get { return list.IsSynchronized; } - } - - - public Via this [int filter] { - get { - return (Via) list [filter]; - } - set { - list[filter] = value; - } - - } - - public virtual object SyncRoot { - get { - return list.SyncRoot; - } - } - - public int Add (Via via) - { - return list.Add (via); - } - - public virtual object Clone () - { - return new ViaCollection (list); - } - - public virtual void CopyTo (Array array, int index) - { - list.CopyTo(array, index); - } - - public virtual IEnumerator GetEnumerator () - { - return list.GetEnumerator(); - } - - public void Insert (int index, Via via) - { - list.Insert(index, via); - } - - public void InsertRange (int index, ViaCollection collection) - { - list.InsertRange(index, collection); - } - - public void RemoveAt (int index) - { - list.RemoveAt(index); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/WSRouting.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/WSRouting.cs deleted file mode 100755 index 56f1f9659fa..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Routing/WSRouting.cs +++ /dev/null @@ -1,51 +0,0 @@ -// -// WSRouting.cs: WSRouting definitions -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Microsoft.Web.Services.Routing { - - public class WSRouting { - - public class ActionUri { - - public const string Fault = "http://schemas.xmlsoap.org/soap/fault"; - - public ActionUri () {} - } - - public class ElementNames { - - public const string Action = "action"; - public const string Code = "code"; - public const string Endpoint = "endpoint"; - public const string Fault = "fault"; - public const string Found = "found"; - public const string From = "from"; - public const string Fwd = "fwd"; - public const string Id = "id"; - public const string MaxSize = "maxsize"; - public const string MaxTime = "maxtime"; - public const string Path = "path"; - public const string Reason = "reason"; - public const string RelatesTo = "relatesTo"; - public const string RetryAfter = "retryAfter"; - public const string Rev = "rev"; - public const string To = "to"; - public const string Via = "via"; - - public ElementNames () {} - } - - public const string NamespaceURI = "http://schemas.xmlsoap.org/rp"; - public const string Prefix = "wsrp"; - - public WSRouting () {} - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/ChangeLog b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/ChangeLog deleted file mode 100755 index dbfb5c31ce3..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/ChangeLog +++ /dev/null @@ -1,3 +0,0 @@ -2003-09-04 Sebastien Pouliot <spouliot@videotron.ca> - - * FileCertificateStore.cs: Fixed compilation. diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/FileCertificateStore.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/FileCertificateStore.cs deleted file mode 100644 index a9f2b8a84bf..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/FileCertificateStore.cs +++ /dev/null @@ -1,48 +0,0 @@ -// -// FileCertificateStore.cs: Handles a file-based certificate store. -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using Mono.Security.Authenticode; - -namespace Microsoft.Web.Services.Security.X509 { - - internal class FileCertificateStore : ICertificateStore { - - private string _storeName; - private X509CertificateStore.StoreOpenFlags _flags; - private X509CertificateStore.StoreLocation _location; - private IntPtr _handle; - - public FileCertificateStore (X509CertificateStore.StoreLocation location, string storeName, X509CertificateStore.StoreOpenFlags flags) - { - _location = location; - _storeName = storeName; - _flags = flags; - } - - public IntPtr Handle { - get { return (IntPtr) 0; } - } - - public X509CertificateCollection GetCollection () - { - if (_spc == null) { - _spc = SoftwarePublisherCertificate.CreateFromFile (_storeName); - } - X509CertificateCollection coll = new X509CertificateCollection (); - Mono.Security.X509.X509CertificateCollection spcoll = _spc.Certificates; - foreach (Mono.Security.X509.X509Certificate x in spcoll) { - coll.Add (new X509Certificate (x.RawData)); - } - return coll; - } - - public void Close () {} - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/ICertificateStore.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/ICertificateStore.cs deleted file mode 100644 index 205eeb25ada..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/ICertificateStore.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System;
-
-namespace Microsoft.Web.Services.Security.X509 {
-
- public interface ICertificateStore {
-
- void Close ();
-
- IntPtr Handle {
- get;
- }
-
- X509CertificateCollection GetCollection ();
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/MemoryCertificateStore.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/MemoryCertificateStore.cs deleted file mode 100644 index fb2470c7f91..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/MemoryCertificateStore.cs +++ /dev/null @@ -1,52 +0,0 @@ -//
-// MemoryCertificateStore.cs: Handles an in-memory certificate store.
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-
-using System;
-
-namespace Microsoft.Web.Services.Security.X509 {
-
- internal class MemoryCertificateStore : ICertificateStore {
-
- private string _storeName;
- private X509CertificateStore.StoreOpenFlags _flags;
- private X509CertificateStore.StoreLocation _location;
- private IntPtr _handle;
- private X509CertificateCollection _coll;
-
- public MemoryCertificateStore (X509CertificateStore.StoreLocation location, string storeName, X509CertificateStore.StoreOpenFlags flags)
- {
- _location = location;
- _storeName = storeName;
- _flags = flags;
- _coll = new X509CertificateCollection ();
- }
-
- public void Close ()
- {
- }
-
- public IntPtr Handle {
- get { return (IntPtr) _coll.GetHashCode (); }
- }
-
- public X509CertificateCollection GetCollection ()
- {
- if (_flags == X509CertificateStore.StoreOpenFlags.ReadOnly) {
- // return a copy of the collection so changes aren't persisted
- X509CertificateCollection copy = new X509CertificateCollection ();
- foreach (X509Certificate x in _coll) {
- copy.Add (x);
- }
- return copy;
- }
- else
- return _coll;
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/X509Certificate.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/X509Certificate.cs deleted file mode 100644 index 552058f7d3b..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/X509Certificate.cs +++ /dev/null @@ -1,182 +0,0 @@ -//
-// X509Certificates.cs: Handles (a little better) X509 certificates.
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-
-using System;
-using System.ComponentModel;
-using System.Security.Cryptography;
-using System.Security.Cryptography.X509Certificates;
-
-using Mono.Security;
-using MX = Mono.Security.X509;
-using Mono.Security.X509.Extensions;
-
-namespace Microsoft.Web.Services.Security.X509 {
-
- public class X509Certificate : System.Security.Cryptography.X509Certificates.X509Certificate, IDisposable {
-
- // do not includes: KeyUsage.keyEncipherment and KeyUsage.keyAgreement (see "OWN.cer")
- private static KeyUsage[] dataEncryption = new KeyUsage [3] { KeyUsage.dataEncipherment, KeyUsage.decipherOnly, KeyUsage.encipherOnly };
- // do not includes KeyUsage.cRLSign, KeyUsage.keyCertSign
- private static KeyUsage[] digitalSignature = new KeyUsage [2] { KeyUsage.digitalSignature, KeyUsage.nonRepudiation };
-
- private MX.X509Certificate x509;
- private bool m_disposed;
-
- public X509Certificate (byte[] rawCertificate) : base (rawCertificate)
- {
- x509 = new MX.X509Certificate (rawCertificate);
- m_disposed = false;
- }
-
- public X509Certificate (IntPtr handle) : base (handle)
- {
- x509 = new MX.X509Certificate (base.GetRawCertData ());
- m_disposed = false;
- }
-
- ~X509Certificate ()
- {
- Dispose ();
- }
-
- // IDisposable
- public void Dispose ()
- {
- if (!m_disposed) {
- // Finalization is now unnecessary
- GC.SuppressFinalize (this);
- }
- // call base class
- // no need as they all are abstract before us
- m_disposed = true;
- }
-
- // LAMESPEC: Do not confuse with CreateFromCertFile
- public static X509Certificate CreateCertFromFile (string fileName)
- {
- System.Security.Cryptography.X509Certificates.X509Certificate x = System.Security.Cryptography.X509Certificates.X509Certificate.CreateFromCertFile (fileName);
- return new X509Certificate (x.GetRawCertData ());
- }
-
- // LAMESPEC: Do not confuse with CreateFromSignedFile
- public static X509Certificate CreateCertFromSignedFile (string fileName)
- {
- System.Security.Cryptography.X509Certificates.X509Certificate x = System.Security.Cryptography.X509Certificates.X509Certificate.CreateFromSignedFile (fileName);
- return new X509Certificate (x.GetRawCertData ());
- }
-
- // I knew that using string for date were a bad idea!
- public bool IsCurrent {
- get { return x509.IsCurrent; }
- }
-
- // Well it seems that DSA certificates aren't popular enough :-(
- // Note: Private key isn't available
- [MonoTODO("Private key isn't yet supported - requires cert stores")]
- public RSA Key {
- get {
- throw new Win32Exception (0, "Private key is unavailable (TODO)");
- }
- }
-
- // Well it seems that DSA certificates aren't popular enough :-(
- public RSA PublicKey {
- get { return x509.RSA; }
- }
-
- // Just KeyUsage or also ExtendedKeyUsage ?
- // it doesn't seems to interpret NetscapeCertType
- private bool Supports (KeyUsage[] usages)
- {
- // X.509 KeyUsage
- MX.X509Extension extn = x509.Extensions ["2.5.29.15"];
- if (extn != null) {
- KeyUsageExtension keyUsage = new KeyUsageExtension (extn);
- foreach (KeyUsage usage in usages) {
- if (keyUsage.Support (usage))
- return true;
- }
- return false;
- }
- // DEPRECATED keyAttributes
- extn = x509.Extensions ["2.5.29.2"];
- if (extn != null) {
- KeyAttributesExtension keyAttr = new KeyAttributesExtension (extn);
- foreach (KeyUsage usage in usages) {
- if (keyAttr.Support (usage))
- return true;
- }
- return false;
- }
- // key usage isn't specified (so it's not limited)
- return true;
- }
-
- public bool SupportsDataEncryption {
- get {
- // always true for older certificates
- if (x509.Version < 3)
- return true;
- return Supports (dataEncryption);
- }
- }
-
- public bool SupportsDigitalSignature {
- get {
- // always true for older certificates
- if (x509.Version < 3)
- return true;
- return Supports (digitalSignature);
- }
- }
-
- public static X509Certificate FromBase64String (string rawString)
- {
- byte[] cert = Convert.FromBase64String (rawString);
- return new X509Certificate (cert);
- }
-
- public byte[] GetKeyIdentifier ()
- {
- // if present in certificate return value of the SubjectKeyIdentifier
- MX.X509Extension extn = x509.Extensions ["2.5.29.14"];
- if (extn != null) {
- ASN1 bs = new ASN1 (extn.Value.Value);
- return bs.Value;
- }
- // strangely DEPRECATED keyAttributes isn't used here (like KeyUsage)
-
- // if not then we must calculate the SubjectKeyIdentifier ourselve
- // Note: MS does that hash on the complete subjectPublicKeyInfo (unlike PKIX)
- // http://groups.google.ca/groups?selm=e7RqM%24plCHA.1488%40tkmsftngp02&oe=UTF-8&output=gplain
- ASN1 subjectPublicKeyInfo = new ASN1 (0x30);
- ASN1 algo = subjectPublicKeyInfo.Add (new ASN1 (0x30));
- algo.Add (new ASN1 (CryptoConfig.EncodeOID (x509.KeyAlgorithm)));
- // FIXME: does it work for DSA certs (without an 2.5.29.14 extension ?)
- algo.Add (new ASN1 (x509.KeyAlgorithmParameters));
- byte[] pubkey = x509.PublicKey;
- byte[] bsvalue = new byte [pubkey.Length + 1]; // add unused bits (0) before the public key
- Array.Copy (pubkey, 0, bsvalue, 1, pubkey.Length);
- subjectPublicKeyInfo.Add (new ASN1 (0x03, bsvalue));
- SHA1 sha = SHA1.Create ();
- return sha.ComputeHash (subjectPublicKeyInfo.GetBytes ());
- }
-
- // overloaded but WHY ?
- public override int GetHashCode ()
- {
- return base.GetHashCode ();
- }
-
- public string ToBase64String ()
- {
- return Convert.ToBase64String (base.GetRawCertData ());
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/X509CertificateCollection.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/X509CertificateCollection.cs deleted file mode 100644 index dbdb0d207a9..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/X509CertificateCollection.cs +++ /dev/null @@ -1,62 +0,0 @@ -//
-// X509CertificateCollection.cs: Handles certificate collection.
-// based on: mcs\class\System\System.Security.Cryptography.X509Certificates\X509CertificateCollection.cs
-//
-// Authors:
-// Lawrence Pit (loz@cable.a2000.nl) -- original work
-// Sebastien Pouliot (spouliot@motus.com) -- all modifications and bugs ;-)
-//
-
-using System;
-using System.Collections;
-
-namespace Microsoft.Web.Services.Security.X509 {
-
- public class X509CertificateCollection : CollectionBase {
-
- public X509CertificateCollection () {}
-
- public X509Certificate this [int index] {
- get {
- // required for exception ?
- if ((index < 0) || (index > InnerList.Count))
- throw new ArgumentOutOfRangeException ("index");
- return (X509Certificate) InnerList [index];
- }
- set { InnerList [index] = value; }
- }
-
- public int Add (X509Certificate certificate)
- {
- if (certificate == null)
- throw new ArgumentNullException ("value");
-
- return InnerList.Add (certificate);
- }
-
- public bool Contains (X509Certificate certificate)
- {
- return InnerList.Contains (certificate);
- }
-
- public void CopyTo (Array array, int index)
- {
- InnerList.CopyTo (array, index);
- }
-
- public int IndexOf (X509Certificate certificate)
- {
- return InnerList.IndexOf (certificate);
- }
-
- public void Insert (int index, X509Certificate certificate)
- {
- InnerList.Insert (index, certificate);
- }
-
- public void Remove (X509Certificate certificate)
- {
- InnerList.Remove (certificate);
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/X509CertificateStore.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/X509CertificateStore.cs deleted file mode 100644 index 3d4274bed4f..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security.X509/X509CertificateStore.cs +++ /dev/null @@ -1,244 +0,0 @@ -//
-// X509CertificateStore.cs: Handles certificate stores.
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-
-using System;
-using System.Security.Cryptography;
-using System.Security.Cryptography.X509Certificates;
-using System.Text;
-
-namespace Microsoft.Web.Services.Security.X509 {
-
- public class X509CertificateStore {
-
- [Serializable]
- public enum StoreLocation {
- CurrentService = 262144,
- CurrentUser = 65536,
- CurrentUserGroupPolicy = 458752,
- LocalMachine = 131072,
- LocalMachineEnterprise = 589824,
- LocalMachineGroupPolicy = 524288,
- Services = 327680,
- Unknown = 0,
- Users = 393216
- }
-
- [Flags]
- [Serializable]
- public enum StoreOpenFlags {
- CreateNew = 8192,
- DeferClose = 4,
- Delete = 16,
- None = 0,
- OpenExisting = 16384,
- ReadOnly = 32768
- }
-
- [Serializable]
- public enum StoreProvider {
- Collection = 11,
- File = 3,
- Memory = 1,
- System = 10
- }
-
- public const string CAStore = "CA";
- public const string MyStore = "My";
- public const string RootStore = "Root";
- public const string TrustStore = "Trust";
- public const string UnTrustedStore = "Disallowed";
-
- private const string storeAlreadyOpened = "store already opened";
- private const string storeNotOpened = "store not opened";
-
- private StoreOpenFlags storeOpenFlags;
- private StoreProvider storeProvider;
- private StoreLocation storeLocation;
- private string storeName;
- private ICertificateStore store;
-
- public X509CertificateStore (StoreProvider provider, StoreLocation location, string storeName)
- {
- storeProvider = provider;
- storeLocation = location;
- this.storeName = storeName;
- }
-
- ~X509CertificateStore ()
- {
- if (store != null) {
- store.Close ();
- store = null;
- }
- }
-
- public X509CertificateCollection Certificates {
- get {
- if (store == null)
- return null;
- return store.GetCollection ();
- }
- }
-
- public IntPtr Handle {
- get {
- if (store == null)
- return (IntPtr) 0;
- return store.Handle;
- }
- }
-
- public StoreLocation Location {
- get { return storeLocation; }
- }
-
- public bool Open ()
- {
- return InternalOpen (StoreOpenFlags.None);
- }
-
- public bool OpenRead ()
- {
- return InternalOpen (StoreOpenFlags.ReadOnly);
- }
-
- internal bool InternalOpen (StoreOpenFlags flags)
- {
- if (store != null)
- throw new InvalidOperationException (storeAlreadyOpened);
-
- storeOpenFlags = flags;
- switch (storeProvider) {
- case StoreProvider.Collection:
- store = null;
- break;
- case StoreProvider.File:
- store = null;
- break;
- case StoreProvider.Memory:
- store = new MemoryCertificateStore (storeLocation, storeName, flags);
- break;
- case StoreProvider.System:
- store = null;
- break;
- default:
- throw new NotSupportedException ("Unknown store provider");
- }
- return (store != null);
- }
-
- public void Close ()
- {
- store.Close ();
- store = null;
- storeOpenFlags = StoreOpenFlags.None;
- }
-
- internal bool Compare (byte[] array1, byte[] array2)
- {
- if ((array1 == null) && (array2 == null))
- return true;
- if ((array1 == null) || (array2 == null))
- return false;
- if (array1.Length != array2.Length)
- return false;
- for (int i=0; i < array1.Length; i++) {
- if (array1 [i] != array2 [i])
- return false;
- }
- return true;
- }
-
- public X509CertificateCollection FindCertificateByHash (byte[] certHash)
- {
- if (certHash == null)
- throw new ArgumentNullException ("certHash");
- if (store != null)
- throw new InvalidOperationException (storeNotOpened);
-
- X509CertificateCollection results = new X509CertificateCollection ();
- if (store != null) {
- X509CertificateCollection certs = store.GetCollection ();
- // apply filter
- foreach (X509Certificate c in certs) {
- if (Compare (c.GetCertHash (), certHash))
- results.Add (c);
- }
- }
- return results;
- }
-
- public X509CertificateCollection FindCertificateByKeyIdentifier (byte[] keyIdentifier)
- {
- if (keyIdentifier == null)
- throw new ArgumentNullException ("keyIdentifier");
- if (store != null)
- throw new InvalidOperationException (storeNotOpened);
-
- X509CertificateCollection results = new X509CertificateCollection ();
- if (store != null) {
- X509CertificateCollection certs = store.GetCollection ();
- // apply filter
- foreach (X509Certificate c in certs) {
- if (Compare (c.GetKeyIdentifier (), keyIdentifier))
- results.Add (c);
- }
- }
- return results;
- }
-
- public X509CertificateCollection FindCertificateBySubjectName (string subjectstring)
- {
- if (subjectstring == null)
- throw new ArgumentNullException ("subjectstring");
- if (store != null)
- throw new InvalidOperationException (storeNotOpened);
-
- X509CertificateCollection results = new X509CertificateCollection ();
- if (store != null) {
- X509CertificateCollection certs = store.GetCollection ();
- // apply filter
- foreach (X509Certificate c in certs) {
- if (c.GetName() != subjectstring)
- results.Add (c);
- }
- }
- return results;
- }
-
- public X509CertificateCollection FindCertificateBySubjectString (string subjectsubstring)
- {
- if (subjectsubstring == null)
- throw new ArgumentNullException ("subjectsubstring");
- if (store != null)
- throw new InvalidOperationException (storeNotOpened);
-
- X509CertificateCollection results = new X509CertificateCollection ();
- if (store != null) {
- X509CertificateCollection certs = store.GetCollection ();
- // apply filter
- foreach (X509Certificate c in certs) {
- if (c.GetName ().IndexOf (subjectsubstring) > 0)
- results.Add (c);
- }
- }
- return results;
- }
-
- public static X509CertificateStore CurrentUserStore (string storeName)
- {
- return new X509CertificateStore (StoreProvider.System, StoreLocation.CurrentUser, storeName);
- }
-
- public static X509CertificateStore LocalMachineStore (string storeName)
- {
- return new X509CertificateStore (StoreProvider.System, StoreLocation.LocalMachine, storeName);
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/AsymmetricDecryptionKey.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/AsymmetricDecryptionKey.cs deleted file mode 100644 index 52b7043fa5f..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/AsymmetricDecryptionKey.cs +++ /dev/null @@ -1,36 +0,0 @@ -//
-// AsymmetricDecryptionKey.cs: Handles WS-Security AsymmetricDecryptionKey
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-using System.Security.Cryptography;
-using System.Web.Services.Protocols;
-
-namespace Microsoft.Web.Services.Security {
-
- public sealed class AsymmetricDecryptionKey : DecryptionKey {
-
- private AsymmetricAlgorithm key;
-
- public AsymmetricDecryptionKey (AsymmetricAlgorithm key)
- {
- if (key is System.Security.Cryptography.RSACryptoServiceProvider)
- this.key = key;
- else
- throw new SecurityFault ("not RSACryptoServiceProvider", null);
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/AsymmetricEncryptionKey.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/AsymmetricEncryptionKey.cs deleted file mode 100644 index 9a90b17d886..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/AsymmetricEncryptionKey.cs +++ /dev/null @@ -1,35 +0,0 @@ -//
-// AsymmetricEncryptionKey.cs: Handles WS-Security AsymmetricEncryptionKey
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-using System.Security.Cryptography;
-
-namespace Microsoft.Web.Services.Security {
-
- public sealed class AsymmetricEncryptionKey : EncryptionKey {
-
- private AsymmetricAlgorithm key;
-
- public AsymmetricEncryptionKey (AsymmetricAlgorithm key)
- {
- if (key == null)
- throw new ArgumentNullException ("key");
- this.key = key;
- // TODO ? impact on KeyInfo ? not seen in tests !!!
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/AuthenticationKey.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/AuthenticationKey.cs deleted file mode 100644 index b61ec1f46f0..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/AuthenticationKey.cs +++ /dev/null @@ -1,50 +0,0 @@ -//
-// AuthenticationKey.cs: Handles WS-Security AuthenticationKey
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System.Security.Cryptography;
-// temp
-//using System.Security.Cryptography.Xml;
-
-namespace Microsoft.Web.Services.Security {
-
- public class AuthenticationKey {
-
- private AsymmetricAlgorithm asymKey;
- private SymmetricAlgorithm symKey;
-
- public AuthenticationKey (AsymmetricAlgorithm key)
- {
- asymKey = key;
- }
-
- public AuthenticationKey (SymmetricAlgorithm key)
- {
- symKey = key;
- }
-
- public bool CheckSignature (SignedXml signedXml)
- {
- if (asymKey != null) {
- return signedXml.CheckSignature (asymKey);
- }
- else {
- HMACSHA1 hmac = new HMACSHA1 (symKey.Key);
- return signedXml.CheckSignature (hmac);
- }
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/BinarySecurityToken.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/BinarySecurityToken.cs deleted file mode 100644 index 6d698711287..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/BinarySecurityToken.cs +++ /dev/null @@ -1,87 +0,0 @@ -//
-// BinarySecurityToken.cs: Handles WS-Security BinarySecurityToken
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-using System.Security.Cryptography.Xml;
-using System.Xml;
-
-namespace Microsoft.Web.Services.Security {
-
- public abstract class BinarySecurityToken : SecurityToken {
-
- private const string name = "Base64Binary";
- private const string ns = "http://schemas.xmlsoap.org/ws/2002/07/secext";
-
- private XmlQualifiedName encoding;
- private XmlQualifiedName valueType;
-
- public BinarySecurityToken (XmlElement element) : base (element)
- {
- encoding = new XmlQualifiedName (name, ns);
- }
-
- public BinarySecurityToken (XmlQualifiedName valueType)
- {
- if (valueType == null)
- throw new ArgumentNullException ("valueType");
-
- encoding = new XmlQualifiedName (name, ns);
- this.valueType = valueType;
- }
-
- public XmlQualifiedName EncodingType {
- get { return encoding; }
- set {
- if (value == null)
- throw new ArgumentNullException ("value");
- encoding = value;
- }
- }
-
- [MonoTODO ("used ?")]
- public virtual byte[] RawData {
- get { return null; }
- set { ; }
- }
-
- public virtual XmlQualifiedName ValueType {
- get { return valueType; }
- set {
- if (value == null)
- throw new ArgumentNullException ("value");
- valueType = value;
- }
- }
-
- public override XmlElement GetXml (XmlDocument document)
- {
- if (document == null)
- throw new ArgumentNullException ("document");
- // TODO check namespace and valueType
- throw new SecurityFormatException ("namespace");
- }
-
- public override void LoadXml (XmlElement element)
- {
- if (element == null)
- throw new ArgumentNullException ("element");
- if ((element.LocalName != name) || (element.NamespaceURI != ns))
- throw new System.ArgumentException ("invalid LocalName or NamespaceURI");
- // TODO
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/ChangeLog b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/ChangeLog deleted file mode 100755 index d471b553b92..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/ChangeLog +++ /dev/null @@ -1,21 +0,0 @@ -2003-09-06 Sebastien Pouliot <spouliot@videotron.ca> - - * EncryptedKey.cs: Fixed typo. - * Security.cs: Fixed compilation issues. - * SignedXml.cs: Fixed compilation issues. - * SignedXmlSignature.cs: Copied from System.Security assembly (where - it is known as Signature.cs) as MS duplicate the class (in WSE) to - fixed some issues. - * XmlSignature.cs: Added more missing string used in System.Security. - -2003-09-04 Sebastien Pouliot <spouliot@videotron.ca> - - * Reference.cs: Copied from System.Security assembly as MS duplicate - the class (in WSE) to fixed some issues. - * SignedInfo.cs: Copied from System.Security assembly as MS duplicate - the class (in WSE) to fixed some issues. - * SignedXml.cs: Copied from System.Security assembly as MS duplicate - the class (in WSE) to fixed some issues. - * TransformChain.cs: Copied from System.Security assembly as MS duplicate - the class (in WSE) to fixed some issues. - * XmlSignature.cs: Added missing string used in System.Security.
\ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/DecryptionKey.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/DecryptionKey.cs deleted file mode 100644 index 83979c972c3..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/DecryptionKey.cs +++ /dev/null @@ -1,33 +0,0 @@ -//
-// DecryptionKey.cs: Handles WS-Security DecryptionKey
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-
-namespace Microsoft.Web.Services.Security {
-
- public abstract class DecryptionKey {
-
- private string name;
-
- protected DecryptionKey () {}
-
- public string Name {
- get { return name; }
- set { name = value; }
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/DecryptionKeyProvider.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/DecryptionKeyProvider.cs deleted file mode 100644 index 8bfb2cedb7f..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/DecryptionKeyProvider.cs +++ /dev/null @@ -1,33 +0,0 @@ -//
-// DecryptionKeyProvider.cs: Decryption Key Provider
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-using System.Security.Cryptography.Xml;
-
-namespace Microsoft.Web.Services.Security {
-
- public class DecryptionKeyProvider : IDecryptionKeyProvider {
-
- public DecryptionKeyProvider () {}
-
- [MonoTODO]
- public virtual DecryptionKey GetDecryptionKey (string algorithmUri, KeyInfo keyInfo)
- {
- return null;
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/EncryptedData.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/EncryptedData.cs deleted file mode 100644 index 33bd99f82e5..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/EncryptedData.cs +++ /dev/null @@ -1,73 +0,0 @@ -//
-// EncryptedData.cs: Handles WS-Security EncryptedData
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-using System.Security.Cryptography.Xml;
-using System.Xml;
-
-namespace Microsoft.Web.Services.Security {
-
- public sealed class EncryptedData : ISecurityElement, IXmlElement {
-
- private EncryptionKey encryptionKey;
- private EncryptedKey encryptedKey;
- private ReferenceList list;
-
- public EncryptedData (EncryptionKey key)
- {
- this.encryptionKey = key;
- }
-
- // TODO
- public EncryptedData (SecurityToken token) {}
-
- // TODO
- public EncryptedData (XmlElement element) {}
-
- public EncryptedData (XmlElement element, EncryptedKey encryptedKey)
- {
- // TODO
- this.encryptedKey = encryptedKey;
- }
-
- public EncryptedKey EncryptedKey {
- get { return encryptedKey; }
- }
-
- public XmlElement Decrypt()
- {
- // TODO
- return null;
- }
-
- public void Encrypt (XmlDocument message)
- {
- // TODO
- }
-
- public XmlElement GetXml (XmlDocument document)
- {
- // TODO
- return null;
- }
-
- public void LoadXml (XmlElement element)
- {
- // TODO
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/EncryptedKey.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/EncryptedKey.cs deleted file mode 100644 index f6f5cd9bd90..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/EncryptedKey.cs +++ /dev/null @@ -1,80 +0,0 @@ -// -// EncryptedKey.cs: Handles WS-Security EncryptedKey -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// -// Licensed under MIT X11 (see LICENSE) with this specific addition: -// -// “This source code may incorporate intellectual property owned by Microsoft -// Corporation. Our provision of this source code does not include any licenses -// or any other rights to you under any Microsoft intellectual property. If you -// would like a license from Microsoft (e.g. rebrand, redistribute), you need -// to contact Microsoft directly.” -// - -using System; -using System.Security.Cryptography.Xml; -using System.Xml; - -namespace Microsoft.Web.Services.Security { - - public class EncryptedKey : IXmlElement { - - private AsymmetricEncryptionKey aek; - private KeyInfo ki; - private ReferenceList list; - - internal EncryptedKey () - { - list = new ReferenceList (); - } - - public EncryptedKey (AsymmetricEncryptionKey key) : this () - { - if (key == null) - throw new ArgumentNullException ("key"); - aek = key; - ki = new KeyInfo (); - } - - public EncryptedKey (XmlElement element) : this () - { - LoadXml (element); - } - - public string EncryptionMethod { - get { return null; } - } - - public KeyInfo KeyInfo { - get { return ki; } - } - - public ReferenceList ReferenceList { - get { return list; } - } - - public XmlElement GetXml (XmlDocument document) - { - if (document == null) - throw new ArgumentNullException ("document"); - return ki.GetXml (); - } - - public void LoadXml (XmlElement element) - { - if ((element.LocalName != "") || (element.NamespaceURI != "")) - throw new System.ArgumentException ("invalid LocalName or NamespaceURI"); - ki = new KeyInfo (); - try { - ki.LoadXml (element); - } - catch { - throw new ArgumentException ("element has no KeyInfo"); - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/EncryptionKey.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/EncryptionKey.cs deleted file mode 100644 index 2a9da77775b..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/EncryptionKey.cs +++ /dev/null @@ -1,36 +0,0 @@ -//
-// EncryptionKey.cs:
-// Abstract class for AsymmetricEncryptionKey and SymmetricEncryptionKey
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System.Security.Cryptography.Xml;
-
-namespace Microsoft.Web.Services.Security {
-
- public abstract class EncryptionKey {
-
- private KeyInfo ki;
-
- public EncryptionKey ()
- {
- ki = new KeyInfo ();
- }
-
- public KeyInfo KeyInfo {
- get { return ki; }
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/IDecryptionKeyProvider.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/IDecryptionKeyProvider.cs deleted file mode 100644 index 6b3bca80641..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/IDecryptionKeyProvider.cs +++ /dev/null @@ -1,28 +0,0 @@ -//
-// IDecryptionKeyProvider.cs:
-// Defines IDecryptionKeyProvider interface
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System.Security.Cryptography.Xml; -
-namespace Microsoft.Web.Services.Security {
-
- public interface IDecryptionKeyProvider {
-
- DecryptionKey GetDecryptionKey (string algorithmUri, KeyInfo keyInfo);
-
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/IPasswordProvider.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/IPasswordProvider.cs deleted file mode 100644 index 66a2f3e9f02..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/IPasswordProvider.cs +++ /dev/null @@ -1,26 +0,0 @@ -//
-// IPasswordProvider.cs:
-// Defines IPasswordProvider interface
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-namespace Microsoft.Web.Services.Security {
-
- public interface IPasswordProvider {
-
- string GetPassword (UsernameToken token);
-
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/ISecurityElement.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/ISecurityElement.cs deleted file mode 100644 index 2505b0d06fc..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/ISecurityElement.cs +++ /dev/null @@ -1,24 +0,0 @@ -//
-// ISecurityElement.cs:
-// Defines ISecurityElement interface
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-namespace Microsoft.Web.Services.Security {
-
- // complete!
- public interface ISecurityElement {}
-
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/KeyIdentifier.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/KeyIdentifier.cs deleted file mode 100644 index 985c28f75dd..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/KeyIdentifier.cs +++ /dev/null @@ -1,78 +0,0 @@ -//
-// KeyIdentifier.cs: Handles WS-Security KeyIdentifier
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-using System.Security.Cryptography.Xml;
-using System.Xml;
-using Microsoft.Web.Services;
-
-namespace Microsoft.Web.Services.Security {
-
- public class KeyIdentifier : IXmlElement {
-
- private byte[] kivalue;
- private XmlQualifiedName vtype;
-
- public KeyIdentifier (byte[] identifier)
- {
- if (identifier == null)
- throw new ArgumentNullException ("identifier");
- kivalue = (byte[]) identifier.Clone ();
- }
-
- public KeyIdentifier (XmlElement element)
- {
- LoadXml (element);
- }
-
- public KeyIdentifier (byte[] identifier, XmlQualifiedName valueType)
- {
- if (identifier == null)
- throw new ArgumentNullException ("identifier");
- kivalue = (byte[]) identifier.Clone ();
- vtype = valueType;
- }
-
- public byte[] Value {
- get { return (byte[]) kivalue.Clone (); }
- set {
- if (value == null)
- throw new ArgumentNullException ("value");
- kivalue = value;
- }
- }
-
- public XmlQualifiedName ValueType {
- get { return vtype; }
- set { vtype = value; }
- }
-
- public XmlElement GetXml (XmlDocument document)
- {
- if (document == null)
- throw new ArgumentNullException ("document");
- return null;
- }
-
- public void LoadXml (XmlElement element)
- {
- if ((element.LocalName != WSSecurity.ElementNames.KeyIdentifier) || (element.NamespaceURI != WSSecurity.NamespaceURI))
- throw new System.ArgumentException ("invalid LocalName or NamespaceURI");
- // TODO
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/Nonce.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/Nonce.cs deleted file mode 100644 index 64ac22107b5..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/Nonce.cs +++ /dev/null @@ -1,73 +0,0 @@ -//
-// Nonce.cs: Handles WS-Security Nonce
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-using System.Security.Cryptography;
-using System.Xml;
-using Microsoft.Web.Services;
-
-namespace Microsoft.Web.Services.Security {
-
- // References:
- // a. Web Services Security Addendum, Version 1.0, August 18, 2002
- // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnglobspec/html/ws-security.asp
-
- public class Nonce : IXmlElement {
-
- private byte[] nonce;
-
- internal Nonce ()
- {
- nonce = new byte [16]; // FIXME ???
- RandomNumberGenerator rng = RandomNumberGenerator.Create ();
- rng.GetBytes (nonce);
- }
-
- // default to Base64 if no EncodingType attribute is specified
- public string Value {
- get { return Convert.ToBase64String (nonce); }
- }
-
- public byte[] GetValueBytes()
- {
- return (byte[]) nonce.Clone ();
- }
-
- public XmlElement GetXml (XmlDocument document)
- {
- if (document == null)
- throw new ArgumentNullException ("document");
- // much cleaner than using StringBuilder!
- XmlElement xel = document.CreateElement (WSSecurity.Prefix, WSSecurity.ElementNames.Nonce, WSSecurity.NamespaceURI);
- xel.InnerText = Convert.ToBase64String (nonce);
- return xel;
- }
-
- public void LoadXml (XmlElement element)
- {
- if ((element.LocalName != WSSecurity.ElementNames.Nonce) || (element.NamespaceURI != WSSecurity.NamespaceURI))
- throw new System.ArgumentException ("invalid LocalName or NamespaceURI");
-
- XmlAttribute xa = element.Attributes [WSSecurity.AttributeNames.EncodingType, WSSecurity.NamespaceURI];
- if ((xa == null) || (xa.Value == "Base64Binary")) {
- nonce = Convert.FromBase64String (element.InnerText);
- }
- else
- throw new NotSupportedException (xa.Value);
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/PasswordOption.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/PasswordOption.cs deleted file mode 100644 index f3f8a10a746..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/PasswordOption.cs +++ /dev/null @@ -1,28 +0,0 @@ -//
-// PasswordOption.cs: Handles WS-Security PasswordOption
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-
-namespace Microsoft.Web.Services.Security {
-
- [Serializable]
- public enum PasswordOption {
- SendHashed,
- SendNone,
- SendPlainText
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/Reference.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/Reference.cs deleted file mode 100644 index b7ad7d74583..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/Reference.cs +++ /dev/null @@ -1,191 +0,0 @@ -// -// Reference.cs - Reference implementation for XML Signature -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.IO; -using System.Security.Cryptography; -using System.Xml; - -#if (WSE1 || WSE2) -using System.Security.Cryptography.Xml; - -namespace Microsoft.Web.Services.Security { -#else -namespace System.Security.Cryptography.Xml { -#endif - // http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/Overview.html#sec-Reference - public class Reference { - - private TransformChain chain; - private string digestMethod; - private byte[] digestValue; - private string id; - private string uri; - private string type; - private HashAlgorithm hash; - - public Reference () - { - chain = new TransformChain (); - digestMethod = XmlSignature.NamespaceURI + "sha1"; - } - - [MonoTODO()] - public Reference (Stream stream) : this () - { - } - - public Reference (string uri) : this () - { - this.uri = uri; - } - - // default to SHA1 - public string DigestMethod { - get { return digestMethod; } - set { digestMethod = value; } - } - - public byte[] DigestValue { - get { return digestValue; } - set { digestValue = value; } - } - - public string Id { - get { return id; } - set { id = value; } - } - - public TransformChain TransformChain { - get { return chain; } - } - - public string Type { - get { return type; } - set { type = value; } - } - - public string Uri { - get { return uri; } - set { uri = value; } - } - - public void AddTransform (Transform transform) - { - chain.Add (transform); - } - - public XmlElement GetXml () - { - if (digestMethod == null) - throw new CryptographicException ("DigestMethod"); - if (digestValue == null) - throw new NullReferenceException ("DigestValue"); - - XmlDocument document = new XmlDocument (); - XmlElement xel = document.CreateElement (XmlSignature.ElementNames.Reference, XmlSignature.NamespaceURI); - if (id != null) - xel.SetAttribute (XmlSignature.AttributeNames.Id, id); - if (uri != null) - xel.SetAttribute (XmlSignature.AttributeNames.URI, uri); - if (type != null) - xel.SetAttribute (XmlSignature.AttributeNames.Type, type); - - if (chain.Count > 0) { - XmlElement ts = document.CreateElement (XmlSignature.ElementNames.Transforms, XmlSignature.NamespaceURI); - foreach (Transform t in chain) { - XmlNode xn = t.GetXml (); - XmlNode newNode = document.ImportNode (xn, true); - ts.AppendChild (newNode); - } - xel.AppendChild (ts); - } - - XmlElement dm = document.CreateElement (XmlSignature.ElementNames.DigestMethod, XmlSignature.NamespaceURI); - dm.SetAttribute (XmlSignature.AttributeNames.Algorithm, digestMethod); - xel.AppendChild (dm); - - XmlElement dv = document.CreateElement (XmlSignature.ElementNames.DigestValue, XmlSignature.NamespaceURI); - dv.InnerText = Convert.ToBase64String (digestValue); - xel.AppendChild (dv); - - return xel; - } - - private string GetAttributeFromElement (XmlElement xel, string attribute, string element) - { - string result = null; - XmlNodeList xnl = xel.GetElementsByTagName (element); - if ((xnl != null) && (xnl.Count > 0)) { - XmlAttribute xa = xnl[0].Attributes [attribute]; - if (xa != null) - result = xa.InnerText; - } - return result; - } - - // note: we do NOT return null -on purpose- if attribute isn't found - private string GetAttribute (XmlElement xel, string attribute) - { - XmlAttribute xa = xel.Attributes [attribute]; - return ((xa != null) ? xa.InnerText : null); - } - - public void LoadXml (XmlElement value) - { - if (value == null) - throw new ArgumentNullException ("value"); - - if ((value.LocalName != XmlSignature.ElementNames.Reference) || (value.NamespaceURI != XmlSignature.NamespaceURI)) - throw new CryptographicException (); - - id = GetAttribute (value, XmlSignature.AttributeNames.Id); - uri = GetAttribute (value, XmlSignature.AttributeNames.URI); - type = GetAttribute (value, XmlSignature.AttributeNames.Type); - // Note: order is important for validations - XmlNodeList xnl = value.GetElementsByTagName (XmlSignature.ElementNames.Transform); - if ((xnl != null) && (xnl.Count > 0)) { - Transform t = null; - foreach (XmlNode xn in xnl) { - string a = GetAttribute ((XmlElement)xn, XmlSignature.AttributeNames.Algorithm); - switch (a) { - case "http://www.w3.org/2000/09/xmldsig#base64": - t = new XmlDsigBase64Transform (); - break; - case "http://www.w3.org/TR/2001/REC-xml-c14n-20010315": - t = new XmlDsigC14NTransform (); - break; - case "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments": - t = new XmlDsigC14NWithCommentsTransform (); - break; - case "http://www.w3.org/2000/09/xmldsig#enveloped-signature": - t = new XmlDsigEnvelopedSignatureTransform (); - break; - case "http://www.w3.org/TR/1999/REC-xpath-19991116": - t = new XmlDsigXPathTransform (); - break; - case "http://www.w3.org/TR/1999/REC-xslt-19991116": - t = new XmlDsigXsltTransform (); - break; - default: - throw new NotSupportedException (); - } - AddTransform (t); - } - } - // get DigestMethod - DigestMethod = GetAttributeFromElement (value, XmlSignature.AttributeNames.Algorithm, XmlSignature.ElementNames.DigestMethod); - // get DigestValue - xnl = value.GetElementsByTagName (XmlSignature.ElementNames.DigestValue); - if ((xnl != null) && (xnl.Count > 0)) { - DigestValue = Convert.FromBase64String (xnl[0].InnerText); - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/ReferenceList.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/ReferenceList.cs deleted file mode 100644 index 5e91c234447..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/ReferenceList.cs +++ /dev/null @@ -1,74 +0,0 @@ -//
-// ReferenceList.cs: Handles WS-Security ReferenceList
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-using System.Collections;
-using System.Security.Cryptography.Xml;
-using System.Xml;
-using Microsoft.Web.Services;
-
-namespace Microsoft.Web.Services.Security {
-
- public class ReferenceList : IXmlElement {
-
- private ArrayList list;
-
- public ReferenceList ()
- {
- list = new ArrayList ();
- }
-
- public ReferenceList (XmlElement element) : this ()
- {
- LoadXml (element);
- }
-
- public void Add (string reference)
- {
- if (reference == null)
- throw new ArgumentNullException ("reference");
- list.Add (reference);
- }
-
- public bool Contains (string reference)
- {
- if (reference == null)
- throw new ArgumentNullException ("reference");
- return list.Contains (reference);
- }
-
- public IEnumerator GetEnumerator()
- {
- return list.GetEnumerator ();
- }
-
- public XmlElement GetXml (XmlDocument document)
- {
- if (document == null)
- throw new ArgumentNullException ("document");
- // TODO
- return null;
- }
-
- public void LoadXml (XmlElement element)
- {
- if ((element.LocalName != "") || (element.NamespaceURI != ""))
- throw new System.ArgumentException ("invalid LocalName or NamespaceURI");
- // TODO
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/Security.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/Security.cs deleted file mode 100644 index c62eed241a6..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/Security.cs +++ /dev/null @@ -1,107 +0,0 @@ -// -// Security.cs: Handles WS-Security Security -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// -// Licensed under MIT X11 (see LICENSE) with this specific addition: -// -// “This source code may incorporate intellectual property owned by Microsoft -// Corporation. Our provision of this source code does not include any licenses -// or any other rights to you under any Microsoft intellectual property. If you -// would like a license from Microsoft (e.g. rebrand, redistribute), you need -// to contact Microsoft directly.” -// - -using System; -using System.Web.Services.Protocols; -using System.Xml; - -namespace Microsoft.Web.Services.Security { - - public class Security : SoapHeader, IXmlElement { - - private static string SoapActor = "actor"; // not Actor - no capital A - private static string SoapNamespaceURI = "http://www.w3.org/2001/12/soap-envelope"; - - private SecurityElementCollection elems; - private SecurityTokenCollection tokens; - - public Security (string actor) - { - if (actor == null) - throw new ArgumentNullException ("actor"); - Actor = actor; - } - - public Security (XmlElement element) - { - LoadXml (element); - } - - public SecurityElementCollection Elements { - get { return elems; } - } - - public SecurityTokenCollection Tokens { - get { return tokens; } - } - - public XmlElement GetXml (XmlDocument document) - { - if (document == null) - throw new ArgumentNullException ("document"); - - // much cleaner than using StringBuilder! - XmlElement xel = document.CreateElement (WSSecurity.Prefix, WSSecurity.ElementNames.Security, WSSecurity.NamespaceURI); - xel.SetAttribute (SoapActor, SoapNamespaceURI, Actor); - - foreach (ISecurityElement se in Elements) { - if (se is Signature) { - // TODO - } - else if (se is EncryptedData) { - xel.AppendChild ((se as EncryptedData).GetXml (document)); - } - } - - foreach (SecurityToken st in Tokens) - xel.AppendChild (st.GetXml (document)); - - return xel; - } - - // base class doesn't have a LoadXml method - public void LoadXml (XmlElement element) - { - if ((element.LocalName != WSSecurity.ElementNames.Security) || (element.NamespaceURI != WSSecurity.NamespaceURI)) - throw new System.ArgumentException ("invalid LocalName or NamespaceURI"); - - // get attributes - XmlAttribute xa = element.Attributes [SoapActor, SoapNamespaceURI]; - Actor = ((xa == null) ? null : xa.Value); - - Elements.Clear (); - Tokens.Clear (); - foreach (XmlNode xn in element.ChildNodes) { - XmlElement xel = (XmlElement) xn; - switch (xn.NamespaceURI) { - case WSSecurity.NamespaceURI: - switch (xn.LocalName) { - case WSSecurity.ElementNames.UsernameToken: - UsernameToken unt = new UsernameToken (xel); - Tokens.Add (unt); - break; - case WSSecurity.ElementNames.BinarySecurityToken: -//FIXME BinarySecurityToken bst = new BinarySecurityToken (xel); -//FIXME Tokens.Add (bst); - break; - } - break; - } - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityCollection.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityCollection.cs deleted file mode 100644 index 38469bfba54..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityCollection.cs +++ /dev/null @@ -1,112 +0,0 @@ -//
-// SecurityCollection.cs: Handles WS-Security SecurityCollection
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-using System.Collections;
-
-namespace Microsoft.Web.Services.Security {
-
- public class SecurityCollection : ICollection, IEnumerable {
-
- private ArrayList list;
-
- public SecurityCollection ()
- {
- list = new ArrayList ();
- }
-
- public int Count {
- get { return list.Count; }
- }
-
- public bool IsSynchronized {
- get { return list.IsSynchronized; }
- }
-
- public Security this [Uri actor] {
- get {
- if (actor == null)
- throw new ArgumentNullException ("actor");
- return null;
- }
- }
-
- public Security this [string actor] {
- get {
- if (actor == null)
- throw new ArgumentNullException ("actor");
- return null;
- }
- }
-
- public object SyncRoot {
- get { return list.SyncRoot; }
- }
-
- public void Add (Security security)
- {
- // note: doc says it not ArgumentNullException
- if (security == null)
- throw new ArgumentException ("security");
- if (list.Contains (security))
- throw new ArgumentException ("duplicate");
- list.Add (security);
- }
-
- public void Clear ()
- {
- list.Clear ();
- }
-
- public bool Contains (string actor)
- {
- if (actor == null)
- throw new ArgumentNullException ("actor");
- return false;
- }
-
- public bool Contains (Uri actor)
- {
- if (actor == null)
- throw new ArgumentNullException ("actor");
- return false;
- }
-
- public void CopyTo (Array array, int index)
- {
- if (array == null)
- throw new ArgumentNullException ("array");
- }
-
- public IEnumerator GetEnumerator ()
- {
- return list.GetEnumerator ();
- }
-
- public void Remove (string actor)
- {
- if (actor == null)
- throw new ArgumentNullException ("actor");
- }
-
- public void Remove (Uri actor)
- {
- if (actor == null)
- throw new ArgumentNullException ("actor");
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityElementCollection.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityElementCollection.cs deleted file mode 100644 index cee94dacefc..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityElementCollection.cs +++ /dev/null @@ -1,77 +0,0 @@ -//
-// SecurityElementCollection.cs: Handles WS-Security SecurityElementCollection
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-using System.Collections;
-
-namespace Microsoft.Web.Services.Security {
-
- public class SecurityElementCollection : ICollection, IEnumerable {
-
- private ArrayList list;
-
- public SecurityElementCollection ()
- {
- list = new ArrayList ();
- }
-
- public int Count {
- get { return list.Count; }
- }
-
- public bool IsSynchronized {
- get { return list.IsSynchronized; }
- }
-
- public ISecurityElement this [int index] {
- get { return (ISecurityElement) list [index]; }
- }
-
- public object SyncRoot {
- get { return list.SyncRoot; }
- }
-
- public void Add (ISecurityElement element)
- {
- list.Add (element);
- }
-
- public void Clear ()
- {
- list.Clear ();
- }
-
- public void CopyTo (Array array, int index)
- {
- if (array == null)
- throw new ArgumentNullException ("array");
- list.CopyTo (array, index);
- }
-
- public IEnumerator GetEnumerator ()
- {
- return list.GetEnumerator ();
- }
-
- public void Remove (ISecurityElement element)
- {
- if (element == null)
- throw new ArgumentNullException ("element");
- list.Remove (element);
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityFault.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityFault.cs deleted file mode 100644 index 7caf366c067..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityFault.cs +++ /dev/null @@ -1,29 +0,0 @@ -//
-// SecurityFault.cs: Undocument exception when a security fault happens
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-using System.Web.Services.Protocols;
-using System.Xml;
-
-namespace Microsoft.Web.Services.Security {
-
- internal class SecurityFault : SoapHeaderException {
-
- public SecurityFault (string message, XmlQualifiedName code) : base (message, code) {}
-
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityFormatException.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityFormatException.cs deleted file mode 100644 index 4c231aafa28..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityFormatException.cs +++ /dev/null @@ -1,30 +0,0 @@ -//
-// SecurityFormatException.cs:
-// Implements SecurityFormatException Exception
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-using System.Web.Services.Protocols;
-
-namespace Microsoft.Web.Services.Security {
-
- [Serializable]
- public class SecurityFormatException : SoapHeaderException {
-
- public SecurityFormatException (string message) : base (message, null) {}
-
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityInputFilter.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityInputFilter.cs deleted file mode 100644 index f7ad1e83b44..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityInputFilter.cs +++ /dev/null @@ -1,34 +0,0 @@ -//
-// SecurityInputFilter.cs: Security SOAP Input Filter
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-
-namespace Microsoft.Web.Services.Security {
-
- public class SecurityInputFilter : SoapInputFilter {
-
- public SecurityInputFilter () {}
-
- public override void ProcessMessage (SoapEnvelope envelope)
- {
- if (envelope == null)
- throw new ArgumentNullException ("envelope");
- // TODO
- }
-
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityOutputFilter.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityOutputFilter.cs deleted file mode 100644 index 98c65a85366..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityOutputFilter.cs +++ /dev/null @@ -1,33 +0,0 @@ -//
-// SecurityOutputFilter.cs: Security SOAP Output Filter
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-
-namespace Microsoft.Web.Services.Security {
-
- public class SecurityOutputFilter : SoapOutputFilter {
-
- public SecurityOutputFilter () {}
-
- public override void ProcessMessage (SoapEnvelope envelope)
- {
- if (envelope == null)
- throw new ArgumentNullException ("envelope");
- // TODO
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityToken.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityToken.cs deleted file mode 100644 index 56e516d0ed1..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityToken.cs +++ /dev/null @@ -1,62 +0,0 @@ -//
-// SecurityToken.cs: Handles WS-Security SecurityToken
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-using System.Security.Cryptography.Xml;
-using System.Xml;
-
-namespace Microsoft.Web.Services.Security {
-
- public abstract class SecurityToken : IXmlElement {
-
- private string id;
-
- public SecurityToken ()
- {
- // generate Id like WSDK
- id = "SecurityToken-" + Guid.NewGuid ().ToString ();
- }
-
- public SecurityToken (XmlElement element)
- {
- LoadXml (element);
- }
-
- public abstract AuthenticationKey AuthenticationKey {get;}
-
- public abstract DecryptionKey DecryptionKey {get;}
-
- public abstract EncryptionKey EncryptionKey {get;}
-
- public string Id {
- get { return id; }
- set { id = value; }
- }
-
- public abstract SignatureKey SignatureKey {get;}
-
- public abstract bool SupportsDataEncryption {get;}
-
- public abstract bool SupportsDigitalSignature {get;}
-
- public abstract XmlElement GetXml (XmlDocument document);
-
- public abstract void LoadXml (XmlElement element);
-
- public abstract void Verify();
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityTokenCollection.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityTokenCollection.cs deleted file mode 100644 index 3d43a33cb30..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityTokenCollection.cs +++ /dev/null @@ -1,94 +0,0 @@ -//
-// SecurityTokenCollection.cs: Handles WS-Security SecurityTokenCollection
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-using System.Collections;
-
-namespace Microsoft.Web.Services.Security {
-
- public class SecurityTokenCollection : ICollection, IEnumerable {
-
- private ArrayList list;
-
- public SecurityTokenCollection ()
- {
- list = new ArrayList ();
- }
-
- public int Count {
- get { return list.Count; }
- }
-
- public bool IsSynchronized {
- get { return list.IsSynchronized; }
- }
-
- // TODO
- public SecurityToken this [string refid] {
- get { return null; }
- }
-
- public object SyncRoot {
- get { return list.SyncRoot; }
- }
-
- public int Add (SecurityToken token)
- {
- return list.Add (token);
- }
-
- public void AddRange (ICollection collection)
- {
- IEnumerator e = collection.GetEnumerator ();
- while (e.MoveNext ()) {
- if (e.Current is SecurityToken)
- list.Add (e.Current as SecurityToken);
- else
- throw new ArgumentException (e.Current.ToString ());
- }
- }
-
- public void Clear ()
- {
- list.Clear ();
- }
-
- public bool Contains (SecurityToken token)
- {
- return list.Contains (token);
- }
-
- public void CopyTo (Array array, int index)
- {
- if (array == null)
- throw new ArgumentNullException ("array");
- list.CopyTo (array, index);
- }
-
- public IEnumerator GetEnumerator ()
- {
- return list.GetEnumerator ();
- }
-
- public void Remove (SecurityToken token)
- {
- if (token == null)
- throw new ArgumentNullException ("token");
- list.Remove (token);
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityTokenReference.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityTokenReference.cs deleted file mode 100644 index 057aa3d11ac..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SecurityTokenReference.cs +++ /dev/null @@ -1,69 +0,0 @@ -//
-// SecurityTokenReference.cs: Handles WS-Security SecurityTokenReference
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-using System.Security.Cryptography.Xml;
-using System.Xml;
-using Microsoft.Web.Services;
-
-namespace Microsoft.Web.Services.Security {
-
- public class SecurityTokenReference : KeyInfoClause, IXmlElement {
-
- private KeyIdentifier kid;
- private string reference;
-
- public SecurityTokenReference ()
- {
- }
-
- public SecurityTokenReference (XmlElement element)
- {
- }
-
- public KeyIdentifier KeyIdentifier {
- get { return kid; }
- set { kid = value; }
- }
-
- public string Reference {
- get { return reference; }
- set { reference = value; }
- }
-
- public override XmlElement GetXml()
- {
- // TODO
- return null;
- }
-
- public XmlElement GetXml (XmlDocument document)
- {
- if (document == null)
- throw new ArgumentNullException ("document");
- // TODO
- return null;
- }
-
- public override void LoadXml (XmlElement element)
- {
- if ((element.LocalName != "") || (element.NamespaceURI != ""))
- throw new System.ArgumentException ("invalid LocalName or NamespaceURI");
- // TODO
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/Signature.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/Signature.cs deleted file mode 100644 index 67f39ebb69c..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/Signature.cs +++ /dev/null @@ -1,38 +0,0 @@ -//
-// Signature.cs: Handles WS-Security Signature
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-
-namespace Microsoft.Web.Services.Security {
-
- public sealed class Signature : SignedXml, ISecurityElement {
-
- private SecurityToken token;
-
- public Signature (SecurityToken token)
- {
- // ??? null ???
- if (!token.SupportsDigitalSignature)
- throw new ArgumentException ("!SupportsDigitalSignature");
- this.token = token;
- }
-
- public SecurityToken SecurityToken {
- get { return token; }
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SignatureKey.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SignatureKey.cs deleted file mode 100644 index 18c932ed486..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SignatureKey.cs +++ /dev/null @@ -1,51 +0,0 @@ -//
-// SignatureKey.cs: Handles WS-Security SignatureKey
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System.Security.Cryptography;
-// temp
-using System.Security.Cryptography.Xml;
-
-namespace Microsoft.Web.Services.Security {
-
- public class SignatureKey {
-
- private AsymmetricAlgorithm asymKey;
- private SymmetricAlgorithm symKey;
-
- public SignatureKey (AsymmetricAlgorithm key)
- {
- asymKey = key;
- }
-
- public SignatureKey (SymmetricAlgorithm key)
- {
- symKey = key;
- }
-
- public virtual void ComputeSignature (SignedXml signedXml)
- {
- if (asymKey != null) {
- signedXml.SigningKey = asymKey;
- signedXml.ComputeSignature ();
- }
- else {
- HMACSHA1 hmac = new HMACSHA1 (symKey.Key);
- signedXml.ComputeSignature (hmac);
- }
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SignatureOptions.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SignatureOptions.cs deleted file mode 100644 index efa7c8b406a..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SignatureOptions.cs +++ /dev/null @@ -1,36 +0,0 @@ -//
-// SignatureOptions.cs: Signature options enumeration
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-
-namespace Microsoft.Web.Services.Security {
-
- [Flags]
- [Serializable]
- public enum SignatureOptions {
- IncludeNone = 0,
- IncludePath = 15,
- IncludePathAction = 1,
- IncludePathFrom = 2,
- IncludePathId = 4,
- IncludePathTo = 8,
- IncludeSoapBody = 16,
- IncludeTimestamp = 96,
- IncludeTimestampCreated = 32,
- IncludeTimestampExpires = 64,
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SignedInfo.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SignedInfo.cs deleted file mode 100755 index b3e21d8e6de..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SignedInfo.cs +++ /dev/null @@ -1,174 +0,0 @@ -// -// SignedInfo.cs - SignedInfo implementation for XML Signature -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Collections; -using System.Xml; - -#if (WSE1 || WSE2) -using System.Security.Cryptography; -using System.Security.Cryptography.Xml; - -namespace Microsoft.Web.Services.Security { -#else -namespace System.Security.Cryptography.Xml { -#endif - public class SignedInfo : ICollection, IEnumerable { - - private ArrayList references; - private string c14nMethod; - private string id; - private string signatureMethod; - private string signatureLength; - - public SignedInfo() - { - references = new ArrayList (); - c14nMethod = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"; - } - - public string CanonicalizationMethod { - get { return c14nMethod; } - set { c14nMethod = value; } - } - - // documented as not supported (and throwing exception) - public int Count { - get { throw new NotSupportedException (); } - } - - public string Id { - get { return id; } - set { id = value; } - } - - // documented as not supported (and throwing exception) - public bool IsReadOnly { - get { throw new NotSupportedException (); } - } - - // documented as not supported (and throwing exception) - public bool IsSynchronized { - get { throw new NotSupportedException (); } - } - - public ArrayList References { - get { return references; } - } - - public string SignatureLength { - get { return signatureLength; } - set { signatureLength = value; } - } - - public string SignatureMethod { - get { return signatureMethod; } - set { signatureMethod = value; } - } - - // documented as not supported (and throwing exception) - public object SyncRoot { - get { throw new NotSupportedException (); } - } - - public void AddReference (Reference reference) - { - references.Add (reference); - } - - // documented as not supported (and throwing exception) - public void CopyTo (Array array, int index) - { - throw new NotSupportedException (); - } - - public IEnumerator GetEnumerator () - { - return references.GetEnumerator (); - } - - public XmlElement GetXml() - { - if (signatureMethod == null) - throw new CryptographicException ("SignatureMethod"); - if (references.Count == 0) - throw new CryptographicException ("References empty"); - - XmlDocument document = new XmlDocument (); - XmlElement xel = document.CreateElement (XmlSignature.ElementNames.SignedInfo, XmlSignature.NamespaceURI); - if (id != null) - xel.SetAttribute (XmlSignature.AttributeNames.Id, id); - - if (c14nMethod != null) { - XmlElement c14n = document.CreateElement (XmlSignature.ElementNames.CanonicalizationMethod, XmlSignature.NamespaceURI); - c14n.SetAttribute (XmlSignature.AttributeNames.Algorithm, c14nMethod); - xel.AppendChild (c14n); - } - if (signatureMethod != null) { - XmlElement sm = document.CreateElement (XmlSignature.ElementNames.SignatureMethod, XmlSignature.NamespaceURI); - sm.SetAttribute (XmlSignature.AttributeNames.Algorithm, signatureMethod); - if (signatureLength != null) { - XmlElement hmac = document.CreateElement (XmlSignature.ElementNames.HMACOutputLength, XmlSignature.NamespaceURI); - hmac.InnerText = signatureLength; - sm.AppendChild (hmac); - } - xel.AppendChild (sm); - } - - // we add References afterward so we don't end up with extraneous - // xmlns="..." in each reference elements. - foreach (Reference r in references) { - XmlNode xn = r.GetXml (); - XmlNode newNode = document.ImportNode (xn, true); - xel.AppendChild (newNode); - } - - return xel; - } - - private string GetAttributeFromElement (XmlElement xel, string attribute, string element) - { - string result = null; - XmlNodeList xnl = xel.GetElementsByTagName (element); - if ((xnl != null) && (xnl.Count > 0)) { - XmlAttribute xa = xnl[0].Attributes [attribute]; - if (xa != null) - result = xa.InnerText; - } - return result; - } - - private string GetAttribute (XmlElement xel, string attribute) - { - XmlAttribute xa = xel.Attributes [attribute]; - return ((xa != null) ? xa.InnerText : null); - } - - [MonoTODO("signatureLength for HMAC")] - public void LoadXml (XmlElement value) - { - if (value == null) - throw new ArgumentNullException ("value"); - - if ((value.LocalName != XmlSignature.ElementNames.SignedInfo) || (value.NamespaceURI != XmlSignature.NamespaceURI)) - throw new CryptographicException (); - - id = GetAttribute (value, XmlSignature.AttributeNames.Id); - c14nMethod = GetAttributeFromElement (value, XmlSignature.AttributeNames.Algorithm, XmlSignature.ElementNames.CanonicalizationMethod); - signatureMethod = GetAttributeFromElement (value, XmlSignature.AttributeNames.Algorithm, XmlSignature.ElementNames.SignatureMethod); - // TODO signatureLength for HMAC - XmlNodeList xnl = value.GetElementsByTagName (XmlSignature.ElementNames.Reference); - foreach (XmlNode xn in xnl) { - Reference r = new Reference (); - r.LoadXml ((XmlElement) xn); - AddReference (r); - } - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SignedXml.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SignedXml.cs deleted file mode 100755 index 2be94a088b1..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SignedXml.cs +++ /dev/null @@ -1,380 +0,0 @@ -// -// SignedXml.cs - SignedXml implementation for XML Signature -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Collections; -using System.IO; -using System.Runtime.InteropServices; -using System.Security.Cryptography; -using System.Xml; - -using SSCX = System.Security.Cryptography.Xml; - -#if (WSE1 || WSE2) -using Microsoft.Web.Services.Security; - -namespace Microsoft.Web.Services.Security { -#else -using System.Security.Cryptography.Xml; - -namespace System.Security.Cryptography.Xml { -#endif - public class SignedXml { - -#if (WSE1 || WSE2) - private SignedXmlSignature signature; - - public SignedXml () - { - signature = new SignedXmlSignature (); - signature.SignedInfo = new SignedInfo (); - } -#else - private Signature signature; - - public SignedXml () - { - signature = new Signature (); - signature.SignedInfo = new SignedInfo (); - } -#endif - private AsymmetricAlgorithm key; - private string keyName; - private XmlDocument envdoc; - - public SignedXml (XmlDocument document) : this () - { - envdoc = document; - } - - public SignedXml (XmlElement elem) : this () - { - if (elem == null) - throw new ArgumentNullException ("elem"); - } - - public const string XmlDsigCanonicalizationUrl = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"; - public const string XmlDsigCanonicalizationWithCommentsUrl = XmlDsigCanonicalizationUrl + "#WithComments"; - public const string XmlDsigNamespaceUrl = "http://www.w3.org/2000/09/xmldsig#"; - public const string XmlDsigDSAUrl = XmlDsigNamespaceUrl + "dsa-sha1"; - public const string XmlDsigHMACSHA1Url = XmlDsigNamespaceUrl + "hmac-sha1"; - public const string XmlDsigMinimalCanonicalizationUrl = XmlDsigNamespaceUrl + "minimal"; - public const string XmlDsigRSASHA1Url = XmlDsigNamespaceUrl + "rsa-sha1"; - public const string XmlDsigSHA1Url = XmlDsigNamespaceUrl + "sha1"; - - public SSCX.KeyInfo KeyInfo { - get { return signature.KeyInfo; } - set { signature.KeyInfo = value; } - } - -#if (WSE1 || WSE2) - public SignedXmlSignature Signature { - get { return signature; } - } -#else - public Signature Signature { - get { return signature; } - } -#endif - public string SignatureLength { - get { return signature.SignedInfo.SignatureLength; } - } - - public string SignatureMethod { - get { return signature.SignedInfo.SignatureMethod; } - } - - public byte[] SignatureValue { - get { return signature.SignatureValue; } - } - - public SignedInfo SignedInfo { - get { return signature.SignedInfo; } - } - - public AsymmetricAlgorithm SigningKey { - get { return key; } - set { key = value; } - } - - public string SigningKeyName { - get { return keyName; } - set { keyName = value; } - } - - public void AddObject (SSCX.DataObject dataObject) - { - signature.AddObject (dataObject); - } - - public void AddReference (Reference reference) - { - signature.SignedInfo.AddReference (reference); - } - - private Stream ApplyTransform (SSCX.Transform t, XmlDocument doc) - { - t.LoadInput (doc); - if (t is SSCX.XmlDsigEnvelopedSignatureTransform) { - XmlDocument d = (XmlDocument) t.GetOutput (); - MemoryStream ms = new MemoryStream (); - d.Save (ms); - return ms; - } - else - return (Stream) t.GetOutput (); - } - - private Stream ApplyTransform (SSCX.Transform t, Stream s) - { - try { - t.LoadInput (s); - s = (Stream) t.GetOutput (); - } - catch (Exception e) { - string temp = e.ToString (); // stop debugger - } - return s; - } - - [MonoTODO("incomplete")] - private byte[] GetReferenceHash (Reference r) - { - XmlDocument doc = new XmlDocument (); - doc.PreserveWhitespace = true; - if (r.Uri == "") - doc = envdoc; - else { - foreach (SSCX.DataObject obj in signature.ObjectList) { - if ("#" + obj.Id == r.Uri) { - doc.LoadXml (obj.GetXml ().OuterXml); - break; - } - } - } - - Stream s = null; - if (r.TransformChain.Count > 0) { - foreach (SSCX.Transform t in r.TransformChain) { - if (s == null) - s = ApplyTransform (t, doc); - else - s = ApplyTransform (t, s); - } - } - else - s = ApplyTransform (new SSCX.XmlDsigC14NTransform (), doc); - - // TODO: We should reuse the same hash object (when possible) - HashAlgorithm hash = (HashAlgorithm) CryptoConfig.CreateFromName (r.DigestMethod); - return hash.ComputeHash (s); - } - - private void DigestReferences () - { - // we must tell each reference which hash algorithm to use - // before asking for the SignedInfo XML ! - foreach (Reference r in signature.SignedInfo.References) { - // assume SHA-1 if nothing is specified - if (r.DigestMethod == null) - r.DigestMethod = XmlDsigSHA1Url; - r.DigestValue = GetReferenceHash (r); - } - } - - private Stream SignedInfoTransformed () - { - SSCX.Transform t = (SSCX.Transform) CryptoConfig.CreateFromName (signature.SignedInfo.CanonicalizationMethod); - if (t == null) - return null; - - XmlDocument doc = new XmlDocument (); - doc.LoadXml (signature.SignedInfo.GetXml ().OuterXml); - return ApplyTransform (t, doc); - } - - private byte[] Hash (string hashAlgorithm) - { - HashAlgorithm hash = HashAlgorithm.Create (hashAlgorithm); - // get the hash of the C14N SignedInfo element - return hash.ComputeHash (SignedInfoTransformed ()); - } - - public bool CheckSignature () - { - // CryptographicException - if (key == null) - key = GetPublicKey (); - return CheckSignature (key); - } - - private bool CheckReferenceIntegrity () - { - // check digest (hash) for every reference - foreach (Reference r in signature.SignedInfo.References) { - // stop at first broken reference - if (! Compare (r.DigestValue, GetReferenceHash (r))) - return false; - } - return true; - } - - public bool CheckSignature (AsymmetricAlgorithm key) - { - if (key == null) - throw new ArgumentNullException ("key"); - - // Part 1: Are all references digest valid ? - bool result = CheckReferenceIntegrity (); - if (result) { - // Part 2: Is the signature (over SignedInfo) valid ? - SignatureDescription sd = (SignatureDescription) CryptoConfig.CreateFromName (signature.SignedInfo.SignatureMethod); - - byte[] hash = Hash (sd.DigestAlgorithm); - AsymmetricSignatureDeformatter verifier = (AsymmetricSignatureDeformatter) CryptoConfig.CreateFromName (sd.DeformatterAlgorithm); - - if (verifier != null) { - verifier.SetHashAlgorithm (sd.DigestAlgorithm); - result = verifier.VerifySignature (hash, signature.SignatureValue); - } - else - result = false; - } - - return result; - } - - private bool Compare (byte[] expected, byte[] actual) - { - bool result = ((expected != null) && (actual != null)); - if (result) { - int l = expected.Length; - result = (l == actual.Length); - if (result) { - for (int i=0; i < l; i++) { - if (expected[i] != actual[i]) - return false; - } - } - } - return result; - } - - public bool CheckSignature (KeyedHashAlgorithm macAlg) - { - if (macAlg == null) - throw new ArgumentNullException ("macAlg"); - - // Part 1: Are all references digest valid ? - bool result = CheckReferenceIntegrity (); - if (result) { - // Part 2: Is the signature (over SignedInfo) valid ? - byte[] actual = macAlg.ComputeHash (SignedInfoTransformed ()); - result = Compare (signature.SignatureValue, actual); - } - return result; - } - - public bool CheckSignatureReturningKey (out AsymmetricAlgorithm signingKey) - { - // here's the key used for verifying the signature - if (key == null) - key = GetPublicKey (); - signingKey = key; - // we'll find the key if we haven't already - return CheckSignature (key); - } - - public void ComputeSignature () - { - if (key != null) { - // required before hashing - signature.SignedInfo.SignatureMethod = key.SignatureAlgorithm; - DigestReferences (); - - SignatureDescription sd = (SignatureDescription) CryptoConfig.CreateFromName (signature.SignedInfo.SignatureMethod); - - // the hard part - C14Ning the KeyInfo - byte[] hash = Hash (sd.DigestAlgorithm); - AsymmetricSignatureFormatter signer = null; - - // in need for a CryptoConfig factory - if (key is DSA) - signer = new DSASignatureFormatter (key); - else if (key is RSA) - signer = new RSAPKCS1SignatureFormatter (key); - - if (signer != null) { - signer.SetHashAlgorithm ("SHA1"); - signature.SignatureValue = signer.CreateSignature (hash); - } - } - } - - public void ComputeSignature (KeyedHashAlgorithm macAlg) - { - if (macAlg == null) - throw new ArgumentNullException ("macAlg"); - - if (macAlg is HMACSHA1) { - DigestReferences (); - - signature.SignedInfo.SignatureMethod = XmlDsigHMACSHA1Url; - signature.SignatureValue = macAlg.ComputeHash (SignedInfoTransformed ()); - } - else - throw new CryptographicException ("unsupported algorithm"); - } - - // is that all ? - public virtual XmlElement GetIdElement (XmlDocument document, string idValue) - { - return document.GetElementById (idValue); - } - - protected virtual AsymmetricAlgorithm GetPublicKey () - { - AsymmetricAlgorithm key = null; - if (signature.KeyInfo != null) { - foreach (SSCX.KeyInfoClause kic in signature.KeyInfo) { - if (kic is SSCX.DSAKeyValue) - key = DSA.Create (); - else if (kic is SSCX.RSAKeyValue) - key = RSA.Create (); - - if (key != null) { - key.FromXmlString (kic.GetXml ().InnerXml); - break; - } - } - } - return key; - } - - public XmlElement GetXml () - { - return signature.GetXml (); - } - - public void LoadXml (XmlElement value) - { - signature.LoadXml (value); - } - -#if ! NET_1_0 - private XmlResolver xmlResolver; - - [MonoTODO("property not (yet) used in class")] - [ComVisible(false)] - XmlResolver Resolver { - set { xmlResolver = value; } - } -#endif - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SignedXmlSignature.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SignedXmlSignature.cs deleted file mode 100755 index 5eb379a13a8..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SignedXmlSignature.cs +++ /dev/null @@ -1,160 +0,0 @@ -// -// For System.Security.Cryptography.Xml -// Signature.cs - Signature implementation for XML Signature -// For Microsoft.Web.Services.Security -// SignedXmlSignature.cs -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Collections; -using System.Security.Cryptography; -using System.Xml; - -#if (WSE1 || WSE2) -using System.Security.Cryptography.Xml; - -namespace Microsoft.Web.Services.Security { - - public class SignedXmlSignature { - - public SignedXmlSignature () -#else -namespace System.Security.Cryptography.Xml { - - public class Signature { - - public Signature () -#endif - { - list = new ArrayList (); - } - - private ArrayList list; - private SignedInfo info; - private KeyInfo key; - private string id; - private byte[] signature; - - public string Id { - get { return id; } - set { id = value; } - } - - public KeyInfo KeyInfo { - get { return key; } - set { key = value; } - } - - public IList ObjectList { - get { return list; } - set { list = ArrayList.Adapter (value); } - } - - public byte[] SignatureValue { - get { return signature; } - set { signature = value; } - } - - public SignedInfo SignedInfo { - get { return info; } - set { info = value; } - } - - public void AddObject (DataObject dataObject) - { - list.Add (dataObject); - } - - public XmlElement GetXml () - { - if (info == null) - throw new CryptographicException ("SignedInfo"); - if (signature == null) - throw new CryptographicException ("SignatureValue"); - - XmlDocument document = new XmlDocument (); - XmlElement xel = document.CreateElement (XmlSignature.ElementNames.Signature, XmlSignature.NamespaceURI); - if (id != null) - xel.SetAttribute (XmlSignature.AttributeNames.Id, id); - - XmlNode xn = info.GetXml (); - XmlNode newNode = document.ImportNode (xn, true); - xel.AppendChild (newNode); - - if (signature != null) { - XmlElement sv = document.CreateElement (XmlSignature.ElementNames.SignatureValue, XmlSignature.NamespaceURI); - sv.InnerText = Convert.ToBase64String (signature); - xel.AppendChild (sv); - } - - if (key != null) { - xn = key.GetXml (); - newNode = document.ImportNode (xn, true); - xel.AppendChild (newNode); - } - - if (list.Count > 0) { - foreach (DataObject obj in list) { - xn = obj.GetXml (); - newNode = document.ImportNode (xn, true); - xel.AppendChild (newNode); - } - } - - return xel; - } - - private string GetAttribute (XmlElement xel, string attribute) - { - XmlAttribute xa = xel.Attributes [attribute]; - return ((xa != null) ? xa.InnerText : null); - } - - public void LoadXml (XmlElement value) - { - if (value == null) - throw new ArgumentNullException ("value"); - - if ((value.LocalName == XmlSignature.ElementNames.Signature) && (value.NamespaceURI == XmlSignature.NamespaceURI)) { - id = GetAttribute (value, XmlSignature.AttributeNames.Id); - - XmlNodeList xnl = value.GetElementsByTagName (XmlSignature.ElementNames.SignedInfo); - if ((xnl != null) && (xnl.Count == 1)) { - info = new SignedInfo (); - info.LoadXml ((XmlElement) xnl[0]); - } - - xnl = value.GetElementsByTagName (XmlSignature.ElementNames.SignatureValue); - if ((xnl != null) && (xnl.Count == 1)) { - signature = Convert.FromBase64String (xnl[0].InnerText); - } - - xnl = value.GetElementsByTagName (XmlSignature.ElementNames.KeyInfo); - if ((xnl != null) && (xnl.Count == 1)) { - key = new KeyInfo (); - key.LoadXml ((XmlElement) xnl[0]); - } - - xnl = value.GetElementsByTagName (XmlSignature.ElementNames.Object); - if ((xnl != null) && (xnl.Count > 0)) { - foreach (XmlNode xn in xnl) { - DataObject obj = new DataObject (); - obj.LoadXml ((XmlElement) xn); - AddObject (obj); - } - } - } - - // if invalid - if (info == null) - throw new CryptographicException ("SignedInfo"); - if (signature == null) - throw new CryptographicException ("SignatureValue"); - } - } -}
\ No newline at end of file diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SymmetricDecryptionKey.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SymmetricDecryptionKey.cs deleted file mode 100644 index 625206ff029..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SymmetricDecryptionKey.cs +++ /dev/null @@ -1,52 +0,0 @@ -//
-// SymmetricDecryptionKey.cs: Handles WS-Security SymmetricDecryptionKey
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-using System.Security.Cryptography;
-using System.Web.Services.Protocols;
-
-namespace Microsoft.Web.Services.Security {
-
- public sealed class SymmetricDecryptionKey : DecryptionKey {
-
- private SymmetricAlgorithm algo;
- private byte[] key;
-
- private bool IsSupported (SymmetricAlgorithm algo)
- {
- return ((algo is Rijndael) || (algo is TripleDES));
- }
-
- public SymmetricDecryptionKey (SymmetricAlgorithm key)
- {
- if (!IsSupported (key))
- throw new SecurityFault ("Unsupported algorithm", null);
- algo = key;
- }
-
- public SymmetricDecryptionKey (SymmetricAlgorithm key, byte[] keyValue)
- {
- if (!IsSupported (key))
- throw new SecurityFault ("Unsupported algorithm", null);
- if (keyValue == null)
- throw new ArgumentNullException ("KeyValue");
-
- algo = key;
- this.key = keyValue;
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SymmetricEncryptionKey.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SymmetricEncryptionKey.cs deleted file mode 100644 index ad0a69fc91c..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/SymmetricEncryptionKey.cs +++ /dev/null @@ -1,48 +0,0 @@ -//
-// SymmetricEncryptionKey.cs: Handles WS-Security SymmetricEncryptionKey
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-using System.Security.Cryptography;
-using System.Web.Services.Protocols;
-
-namespace Microsoft.Web.Services.Security {
-
- public class SymmetricEncryptionKey : EncryptionKey {
-
- private SymmetricAlgorithm algo;
- private byte[] key;
-
- public SymmetricEncryptionKey()
- {
- // uses TripleDESCryptoServiceProvider - not default (Rjindael)
- algo = SymmetricAlgorithm.Create ("TripleDES");
- }
-
- public SymmetricEncryptionKey (SymmetricAlgorithm key)
- {
- if (key == null)
- throw new NullReferenceException ("algo");
- algo = key;
- }
-
- public SymmetricEncryptionKey (SymmetricAlgorithm key, byte[] keyValue)
- {
- algo = key;
- this.key = keyValue;
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/TransformChain.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/TransformChain.cs deleted file mode 100755 index 95a0eb07b52..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/TransformChain.cs +++ /dev/null @@ -1,46 +0,0 @@ -// -// TransformChain.cs - TransformChain implementation for XML Signature -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System.Collections; - -#if (WSE1 || WSE2) -using System.Security.Cryptography.Xml; - -namespace Microsoft.Web.Services.Security { -#else -namespace System.Security.Cryptography.Xml { -#endif - public class TransformChain { - - private ArrayList chain; - - public TransformChain() - { - chain = new ArrayList (); - } - - public int Count { - get { return chain.Count; } - } - - public Transform this [int index] { - get { return (Transform) chain [index]; } - } - - public void Add (Transform transform) - { - chain.Add (transform); - } - - public IEnumerator GetEnumerator () - { - return chain.GetEnumerator (); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/UsernameToken.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/UsernameToken.cs deleted file mode 100644 index 5bdfbd0e508..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/UsernameToken.cs +++ /dev/null @@ -1,193 +0,0 @@ -//
-// UsernameToken.cs: Handles WS-Security UsernameToken
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using Microsoft.Web.Services.Timestamp;
-using System;
-using System.Security.Cryptography;
-//using System.Security.Cryptography.Xml;
-using System.Text;
-using System.Web.Services.Protocols;
-using System.Xml;
-
-namespace Microsoft.Web.Services.Security {
-
- // References:
- // a. Section 4.1
- // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnglobspec/html/ws-security.asp
- // b. ...
- //
- public sealed class UsernameToken : SecurityToken {
-
- private string username;
- private string password;
- private PasswordOption option;
- private DateTime created;
- private Nonce nonce;
-
- public UsernameToken (XmlElement element) : base (element)
- {
- }
-
- public UsernameToken (string username, string password)
- : this (username, password, PasswordOption.SendNone)
- {
- }
-
- public UsernameToken (string username, string password, PasswordOption passwordOption)
- {
- if ((username == null) || (username == ""))
- throw new ArgumentNullException ("username");
- if (password == null)
- throw new ArgumentNullException ("password");
-
- this.username = username;
- this.password = password;
- option = passwordOption;
- }
-
- public override AuthenticationKey AuthenticationKey {
- get { throw new SoapHeaderException ("AuthenticationKey", null); }
- }
-
- // TODO
- public DateTime Created {
- get { return DateTime.UtcNow; }
- }
-
- public override DecryptionKey DecryptionKey {
- get { throw new NotSupportedException ("DecryptionKey"); }
- }
-
- public override EncryptionKey EncryptionKey {
- get { throw new NotSupportedException ("EncryptionKey"); }
- }
-
- public byte[] Nonce {
- get {
- if (nonce == null)
- return null;
- return nonce.GetValueBytes ();
- }
- }
-
- public string Password {
- get { return password; }
- }
-
- public PasswordOption PasswordOption {
- get {
- if (password == null)
- throw new ArgumentException ("no password");
- return option;
- }
- set {
- if (password == null)
- throw new ArgumentException ("no password");
- option = value;
- }
- }
-
- public override SignatureKey SignatureKey {
- get {
- if (password == null)
- throw new InvalidOperationException ("no password");
- return null;
- }
- }
-
- public override bool SupportsDataEncryption {
- get { return false; }
- }
-
- public override bool SupportsDigitalSignature {
- get { return (password != null); }
- }
-
- public string Username {
- get { return username; }
- }
-
- private void Zeroize (byte[] array)
- {
- for (int i=0; i < array.Length; i++)
- array[i] = 0;
- }
-
- // Reference B, Section 6
- // Password_digest = SHA1 ( nonce + created + password )
- private string HashPassword (string password)
- {
- nonce = new Nonce ();
- byte[] n = nonce.GetValueBytes ();
- created = DateTime.UtcNow;
- byte[] c = Encoding.UTF8.GetBytes (created.ToString (WSTimestamp.TimeFormat));
- byte[] p = Encoding.UTF8.GetBytes (password);
- byte[] toBeDigested = new byte [n.Length + c.Length + p.Length];
- Array.Copy (n, 0, toBeDigested, 0, n.Length);
- Array.Copy (c, 0, toBeDigested, n.Length, c.Length);
- Array.Copy (p, 0, toBeDigested, (n.Length + c.Length), p.Length);
- // protect password
- Zeroize (p);
- SHA1 hash = SHA1.Create ();
- byte[] digest = hash.ComputeHash (toBeDigested);
- // protect password
- Zeroize (toBeDigested);
- return Convert.ToBase64String (digest);
- }
-
- public override XmlElement GetXml (XmlDocument document)
- {
- if (document == null)
- throw new ArgumentNullException ("document");
-
- // much cleaner than using StringBuilder!
- XmlElement xel = document.CreateElement (WSSecurity.Prefix, WSSecurity.ElementNames.UsernameToken, WSSecurity.NamespaceURI);
-
- XmlElement xelUsername = document.CreateElement (WSSecurity.Prefix, WSSecurity.ElementNames.Username, WSSecurity.NamespaceURI);
- xelUsername.InnerText = username;
- xel.AppendChild (xelUsername);
-
- XmlElement xelPassword = document.CreateElement (WSSecurity.Prefix, WSSecurity.ElementNames.Password, WSSecurity.NamespaceURI);
- switch (option) {
- case PasswordOption.SendNone:
- // we don't Append as we don't send the password
- break;
- case PasswordOption.SendHashed:
- xelPassword.SetAttribute (WSSecurity.AttributeNames.Type, WSSecurity.NamespaceURI, "PasswordDigest");
- xelPassword.InnerText = HashPassword (password);
- xel.AppendChild (xelPassword);
- xel.AppendChild (nonce.GetXml (document));
- // xel.AppendChild (xelCreated);
- break;
- case PasswordOption.SendPlainText:
- xelPassword.SetAttribute (WSSecurity.AttributeNames.Type, WSSecurity.NamespaceURI, "PasswordText");
- xelPassword.InnerText = password;
- xel.AppendChild (xelPassword);
- break;
- }
- return xel;
- }
-
- public override void LoadXml (XmlElement element)
- {
- if ((element.LocalName != WSSecurity.ElementNames.UsernameToken) || (element.NamespaceURI != WSSecurity.NamespaceURI))
- throw new System.ArgumentException ("invalid LocalName or NamespaceURI");
- }
-
- public override void Verify () {}
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/WSSecurity.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/WSSecurity.cs deleted file mode 100644 index 8a69362caf6..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/WSSecurity.cs +++ /dev/null @@ -1,58 +0,0 @@ -//
-// WSSecurity.cs: Handles WS-Security WSSecurity
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-
-namespace Microsoft.Web.Services.Security {
-
- public sealed class WSSecurity {
-
- // LAMESPEC AttributeNames aren't documented
- public class AttributeNames {
-
- public const string EncodingType = "EncodingType";
- public const string IdentifierType = "IdentifierType";
- public const string TokenType = "TokenType";
- public const string Type = "Type";
- public const string Uri = "URI";
- public const string ValueType = "ValueType";
-
- public AttributeNames () {}
- }
-
- // LAMESPEC ElementNames aren't documented
- public class ElementNames {
-
- public const string BinarySecurityToken = "BinarySecurityToken";
- public const string KeyIdentifier = "KeyIdentifier";
- public const string Nonce = "Nonce";
- public const string Password = "Password";
- public const string Reference = "Reference";
- public const string Security = "Security";
- public const string SecurityTokenReference = "SecurityTokenReference";
- public const string Username = "Username";
- public const string UsernameToken = "UsernameToken";
-
- public ElementNames () {}
- }
-
- public const string NamespaceURI = "http://schemas.xmlsoap.org/ws/2002/07/secext";
- public const string Prefix = "wsse";
-
- public WSSecurity () {}
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/X509SecurityToken.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/X509SecurityToken.cs deleted file mode 100644 index de412a06bfb..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/X509SecurityToken.cs +++ /dev/null @@ -1,127 +0,0 @@ -//
-// X509SecurityToken.cs: Handles WS-Security X509SecurityToken
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-using System.Web.Services.Protocols;
-using System.Xml;
-using Microsoft.Web.Services.Security.X509;
-
-namespace Microsoft.Web.Services.Security {
-
- public sealed class X509SecurityToken : BinarySecurityToken {
-
- private X509Certificate x509;
-
- public X509SecurityToken (X509Certificate certificate) : base ((XmlElement)null)
- {
- if (certificate == null)
- throw new ArgumentNullException ("certificate");
- x509 = certificate;
- }
-
- public X509SecurityToken (XmlElement element) : base (element)
- {
- // ancestor will call LoadXml (element)
- }
-
- public override AuthenticationKey AuthenticationKey {
- get {
- if (x509 == null)
- throw new InvalidOperationException ("null certificate");
-
- if (x509.SupportsDigitalSignature)
- return new AuthenticationKey (x509.PublicKey);
- else
- throw new InvalidOperationException ("not SupportsDigitalSignature");
- }
- }
-
- public X509Certificate Certificate {
- get { return x509; }
- set {
- if (value == null)
- throw new ArgumentNullException ("value");
- x509 = value;
- }
- }
-
- public override DecryptionKey DecryptionKey {
- get {
- if (x509 == null)
- throw new InvalidOperationException ("null certificate");
- return new AsymmetricDecryptionKey (x509.PublicKey);
- }
- }
-
- public override EncryptionKey EncryptionKey {
- get {
- if (x509 == null)
- throw new InvalidOperationException ("null certificate");
- return new AsymmetricEncryptionKey (x509.PublicKey);
- }
- }
-
- public override byte[] RawData {
- get { return x509.GetRawCertData(); }
- set {
- if (value == null)
- throw new ArgumentNullException ("value");
- x509 = new X509Certificate (value);
- }
- }
-
- public override SignatureKey SignatureKey {
- get {
- if (x509 == null)
- throw new InvalidOperationException ("null certificate");
- if (!x509.SupportsDigitalSignature)
- throw new InvalidOperationException ("not SupportsDigitalSignature");
- return new SignatureKey (x509.PublicKey);
- }
- }
-
- public override bool SupportsDataEncryption {
- get {
- if (x509 == null)
- throw new InvalidOperationException ("null certificate");
- return x509.SupportsDataEncryption;
- }
- }
-
- public override bool SupportsDigitalSignature {
- get {
- if (x509 == null)
- throw new InvalidOperationException ("null certificate");
- return x509.SupportsDigitalSignature;
- }
- }
-
- // TODO
- public override XmlQualifiedName ValueType {
- get { return base.ValueType; }
- set { base.ValueType = value; }
- }
-
- public override void Verify()
- {
- if (x509 == null)
- throw new SecurityFault ("null certificate", null);
- if (!x509.IsCurrent)
- throw new SecurityFault ("certificate not current", null);
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/XmlDsigExcC14NTransform.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/XmlDsigExcC14NTransform.cs deleted file mode 100644 index 6f308ce0e60..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/XmlDsigExcC14NTransform.cs +++ /dev/null @@ -1,102 +0,0 @@ -//
-// XmlDsigExcC14NTransform.cs:
-// Handles WS-Security XmlDsigExcC14NTransform
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-using System.Security.Cryptography.Xml;
-using System.Xml;
-
-namespace Microsoft.Web.Services.Security {
-
- public class XmlDsigExcC14NTransform : Transform {
-
- public const string XmlDsigExcC14NTransformUrl = "http://www.w3.org/2001/10/xml-exc-c14n#";
- public const string XmlDsigExcC14NWithCommentsTransformUrl = "http://www.w3.org/2001/10/xml-exc-c14n#WithComments";
-
- private string prefixList;
- private bool comments;
-
- public XmlDsigExcC14NTransform () {}
-
- public XmlDsigExcC14NTransform (bool includeComments) {}
-
- public XmlDsigExcC14NTransform (string inclusiveNamespacesPrefixList) {}
-
- public XmlDsigExcC14NTransform (bool includeComments, string inclusiveNamespacesPrefixList) {}
-
- public string InclusiveNamespacesPrefixList {
- get { return prefixList; }
- set { prefixList = value; }
- }
-
- public override Type[] InputTypes {
- get { return null;
- /* if (input == null) {
- lock (this) {
- // this way the result is cached if called multiple time
- input = new Type [3];
- input[0] = typeof (System.IO.Stream);
- input[1] = typeof (System.Xml.XmlDocument);
- input[2] = typeof (System.Xml.XmlNodeList);
- }
- }
- return input;*/
- }
- }
-
- public override Type[] OutputTypes {
- get { return null;
- /* if (output == null) {
- lock (this) {
- // this way the result is cached if called multiple time
- output = new Type [1];
- output[0] = typeof (System.IO.Stream);
- }
- }
- return output;*/
- }
- }
-
- protected override XmlNodeList GetInnerXml ()
- {
- return null; // THIS IS DOCUMENTED AS SUCH
- }
-
- public override object GetOutput ()
- {
- // return (object) new Stream ();
- return null;
- }
-
- public override object GetOutput (Type type)
- {
- if (type == Type.GetType ("Stream"))
- return GetOutput ();
- throw new ArgumentException ("type");
- }
-
- public override void LoadInnerXml (XmlNodeList nodeList)
- {
- // NO CHANGE
- }
-
- public override void LoadInput (object obj)
- {
- // if (type.Equals (Stream.GetType ())
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/XmlDsigExcC14NWithCommentsTransform.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/XmlDsigExcC14NWithCommentsTransform.cs deleted file mode 100644 index e7b1ebc0005..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/XmlDsigExcC14NWithCommentsTransform.cs +++ /dev/null @@ -1,33 +0,0 @@ -//
-// XmlDsigExcC14NWithCommentsTransform.cs:
-// Handles WS-Security XmlDsigExcC14NWithCommentsTransform
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-using System.Security.Cryptography.Xml;
-using System.Xml;
-
-namespace Microsoft.Web.Services.Security {
-
- public class XmlDsigExcC14NWithCommentsTransform : XmlDsigExcC14NTransform {
-
- public XmlDsigExcC14NWithCommentsTransform() : base (true) {}
-
- public XmlDsigExcC14NWithCommentsTransform (string inclusiveNamespacesPrefixList)
- : base (true, inclusiveNamespacesPrefixList) {}
-
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/XmlEncryption.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/XmlEncryption.cs deleted file mode 100644 index ac4439eb315..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/XmlEncryption.cs +++ /dev/null @@ -1,87 +0,0 @@ -//
-// XmlEncryption.cs: Handles WS-Security XmlEncryption
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-
-namespace Microsoft.Web.Services.Security {
-
- public sealed class XmlEncryption {
-
- public sealed class AlgorithmURI {
-
- public const string AES128 = "http://www.w3.org/2001/04/xmlenc#aes128-cbc";
- public const string AES128KeyWrap = "http://www.w3.org/2001/04/xmlenc#kw-aes128";
- public const string AES192 = "http://www.w3.org/2001/04/xmlenc#aes192-cbc";
- public const string AES192KeyWrap = "http://www.w3.org/2001/04/xmlenc#kw-aes192";
- public const string AES256 = "http://www.w3.org/2001/04/xmlenc#aes256-cbc";
- public const string AES256KeyWrap = "http://www.w3.org/2001/04/xmlenc#kw-aes256";
- public const string DES = "http://www.w3.org/2001/04/xmlenc#des-cbc";
- public const string RSA15 = "http://www.w3.org/2001/04/xmlenc#rsa-1_5";
- public const string RSAOAEP = "http://www.w3.org/2001/04/xmlenc#rsa-aoep-mgf1pl";
- public const string SHA1 = "http://www.w3.org/2000/09/xmldsig#sha1";
- public const string SHA256 = "http://www.w3.org/2001/04/xmlenc#sha256";
- public const string SHA512 = "http://www.w3.org/2001/04/xmlenc#sha512";
- public const string TripleDES = "http://www.w3.org/2001/04/xmlenc#tripledes-cbc";
- public const string TripleDESKeyWrap = "http://www.w3.org/2001/04/xmlenc#kw-tripledes";
-
- public AlgorithmURI () {}
- }
-
- public sealed class AttributeNames {
-
- public const string Algorithm = "Algorithm";
- //LAMESPEC public const string EncodingType = "EncodingType";
- public const string Id = "Id";
- //LAMESPEC public const string IdentifierType = "IdentifierType";
- //LAMESPEC public const string TokenType = "TokenType";
- public const string Type = "Type";
- //LAMESPEC public const string Uri = "Uri";
- public const string URI = "URI";
- //LAMESPEC public const string ValueType = "ValueType";
-
- public AttributeNames () {}
- }
-
- // LAMESPEC ElementNames aren't documented
- public sealed class ElementNames {
-
- public const string CipherData = "CipherData";
- public const string CipherValue = "CipherValue";
- public const string DataReference = "DataReference";
- public const string EncryptedData = "EncryptedData";
- public const string EncryptedKey = "EncryptedKey";
- public const string EncryptionMethod = "EncryptionMethod";
- public const string ReferenceList = "ReferenceList";
-
- public ElementNames () {}
- }
-
- public sealed class TypeURI {
-
- public const string Content = "http://www.w3.org/2001/04/xmlenc#Content";
- public const string Element = "http://www.w3.org/2001/04/xmlenc#Element";
- public const string EncryptedKey = "http://www.w3.org/2001/04/xmlenc#EncryptedKey";
-
- public TypeURI () {}
- }
-
- public const string NamespaceURI = "http://www.w3.org/2001/04/xmlenc#";
- public const string Prefix = "xenc";
-
- public XmlEncryption () {}
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/XmlSignature.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/XmlSignature.cs deleted file mode 100644 index 7194a504b56..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Security/XmlSignature.cs +++ /dev/null @@ -1,77 +0,0 @@ -// -// XmlSignature.cs: Handles WS-Security XmlSignature -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// -// Licensed under MIT X11 (see LICENSE) with this specific addition: -// -// “This source code may incorporate intellectual property owned by Microsoft -// Corporation. Our provision of this source code does not include any licenses -// or any other rights to you under any Microsoft intellectual property. If you -// would like a license from Microsoft (e.g. rebrand, redistribute), you need -// to contact Microsoft directly.” -// - -using System; - -namespace Microsoft.Web.Services.Security { - - public sealed class XmlSignature { - - public class ElementNames { - - // LAMESPEC: public const string BinarySecurityToken = ""; - // LAMESPEC: public const string CipherData = ""; - // LAMESPEC: public const string CipherValue = ""; - // LAMESPEC: public const string DataReference = ""; - // LAMESPEC: public const string EncryptedData = ""; - // LAMESPEC: public const string EncryptedKey = ""; - // LAMESPEC: public const string EncryptionMethod = ""; - // LAMESPEC: public const string KeyIdentifier = ""; - public const string KeyInfo = "KeyInfo"; - public const string KeyName = "KeyName"; - // LAMESPEC: public const string Nonce = ""; - // LAMESPEC: public const string Password = ""; - // LAMESPEC: public const string Reference = ""; - // LAMESPEC: public const string ReferenceList = ""; - // LAMESPEC: public const string Security = ""; - // LAMESPEC: public const string SecurityTokenReference = ""; - public const string Signature = "Signature"; - // LAMESPEC: public const string Username = ""; - // LAMESPEC: public const string UsernameToken = ""; - - // to be compatible with Mono implementation of System.Security - internal const string CanonicalizationMethod = "CanonicalizationMethod"; - internal const string HMACOutputLength = "HMACOutputLength"; - internal const string Reference = "Reference"; - internal const string SignatureMethod = "SignatureMethod"; - internal const string SignedInfo = "SignedInfo"; - internal const string Transform = "Transform"; - internal const string Transforms = "Transforms"; - internal const string DigestMethod = "DigestMethod"; - internal const string DigestValue = "DigestValue"; - internal const string SignatureValue = "SignatureValue"; - internal const string Object = "Object"; - - public ElementNames () {} - } - - internal class AttributeNames { - - internal const string Algorithm = "Algorithm"; - internal const string Id = "Id"; - internal const string URI = "URI"; - internal const string Type = "Type"; - - public AttributeNames () {} - } - - public const string NamespaceURI = "http://www.w3.org/2000/09/xmldsig#"; - public const string Prefix = "ds"; - - public XmlSignature () {} - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/ChangeLog b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/ChangeLog deleted file mode 100755 index 53538c78160..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/ChangeLog +++ /dev/null @@ -1,3 +0,0 @@ -2003-09-04 Sebastien Pouliot <spouliot@videotron.ca> - - * TimestampFormatException.cs: Added missing strings and #if for WSE2. diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/Received.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/Received.cs deleted file mode 100644 index 7b72934729d..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/Received.cs +++ /dev/null @@ -1,123 +0,0 @@ -//
-// Received.cs:
-// Handles WS-Security "Utility" Timestamp Received
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-using System.Xml;
-using Microsoft.Web.Services;
-
-namespace Microsoft.Web.Services.Timestamp {
-
- public class Received : IXmlElement {
-
- private string id;
- private string idNS;
- private Uri actor;
- private long delay;
- private DateTime received;
-
- public Received (Uri actor)
- {
- if (actor == null)
- throw new ArgumentNullException ("actor");
- this.actor = actor;
- received = DateTime.UtcNow;
- }
-
- public Received (XmlElement element)
- {
- LoadXml (element);
- }
-
- public Uri Actor {
- get { return actor; }
- set {
- if (value == null)
- throw new ArgumentNullException ("actor");
- actor = value;
- }
- }
-
- public long Delay {
- get { return delay; }
- set {
- if (delay < 0)
- throw new ArgumentException ("negative delay");
- delay = value;
- }
- }
-
- public DateTime Value {
- get { return received; }
- set { received = value; }
- }
-
- public XmlElement GetXml (XmlDocument document)
- {
- if (document == null)
- throw new System.ArgumentNullException ("document");
-
- // much cleaner than using StringBuilder!
- XmlElement xel = document.CreateElement (WSTimestamp.Prefix, WSTimestamp.ElementNames.Received, WSTimestamp.NamespaceURI);
- // xel.SetAttribute (WSTimestamp.AttributeNames.Actor, actor.AbsoluteUri);
- if (delay > 0)
- xel.SetAttribute (WSTimestamp.AttributeNames.Delay, delay.ToString ());
- // FIXME: commented for WSE compatibility
- // if (id != null)
- // xel.SetAttribute (WSTimestamp.AttributeNames.Id, idNS, id);
- xel.InnerText = received.ToString (WSTimestamp.TimeFormat);
- return xel;
- }
-
- public void LoadXml (XmlElement element)
- {
- if (element == null)
- throw new System.ArgumentNullException ("element");
-
- if ((element.LocalName != WSTimestamp.ElementNames.Received) || (element.NamespaceURI != WSTimestamp.NamespaceURI))
- throw new System.ArgumentException ("invalid LocalName or NamespaceURI");
-
- XmlAttribute xa = element.Attributes [WSTimestamp.AttributeNames.Id, WSTimestamp.NamespaceURI];
- id = ((xa == null) ? null : xa.Value);
- idNS = ((xa == null) ? null : xa.NamespaceURI);
-
- xa = element.Attributes [WSTimestamp.AttributeNames.Actor];
- if (xa == null)
- throw new TimestampFormatException (TimestampFormatException.MissingActorAttributeInReceivedElement);
- string actorAttribute = xa.InnerText;
- if (actorAttribute == null)
- throw new TimestampFormatException (TimestampFormatException.MissingActorAttributeInReceivedElement);
- actor = new Uri (actorAttribute);
-
- xa = element.Attributes [WSTimestamp.AttributeNames.Delay];
- if (xa != null) {
- string delayAttribute = xa.InnerText;
- if (delayAttribute.StartsWith ("+"))
- throw new TimestampFormatException (TimestampFormatException.DelayAttributeWithPlusSign);
- try {
- delay = Convert.ToInt64 (delayAttribute);
- }
- catch {
- throw new TimestampFormatException (TimestampFormatException.BadDelayAttribute);
- }
- }
-
- received = DateTime.ParseExact (element.InnerText, WSTimestamp.TimeFormat, null);
- received = received.ToUniversalTime ();
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/ReceivedCollection.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/ReceivedCollection.cs deleted file mode 100644 index 62f0c9d49cb..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/ReceivedCollection.cs +++ /dev/null @@ -1,76 +0,0 @@ -//
-// ReceivedCollection.cs:
-// Handles a collection of Received objects
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-using System.Collections;
-
-namespace Microsoft.Web.Services.Timestamp {
-
- public class ReceivedCollection : ICollection, IEnumerable {
-
- private ArrayList list;
-
- public ReceivedCollection()
- {
- list = new ArrayList ();
- }
-
- public int Count {
- get { return list.Count; }
- }
-
- public bool IsSynchronized {
- get { return list.IsSynchronized; }
- }
-
- public Received this [int index] {
- get { return (Received) list [index]; }
- }
-
- public object SyncRoot {
- get { return list.SyncRoot; }
- }
-
- public void Add (Received received)
- {
- if (received == null)
- throw new System.ArgumentNullException ("received");
- list.Add (received);
- }
-
- public bool Contains (Received received)
- {
- return list.Contains (received);
- }
-
- public void CopyTo (Array array, int index)
- {
- list.CopyTo (array, index);
- }
-
- public IEnumerator GetEnumerator ()
- {
- return list.GetEnumerator ();
- }
-
- public void Remove (Received received)
- {
- list.Remove (received);
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/Timestamp.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/Timestamp.cs deleted file mode 100644 index eb8fa20c6f6..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/Timestamp.cs +++ /dev/null @@ -1,182 +0,0 @@ -//
-// Timestamp.cs: Handles WS-Security "Utility" Timestamp
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-using System.Web.Services.Protocols;
-using System.Xml;
-using Microsoft.Web.Services;
-
-namespace Microsoft.Web.Services.Timestamp {
-
- // References
- // a. Web Services Security Addendum, Version 1.0, August 18, 2002
- // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnglobspec/html/ws-security.asp
-
- public class Timestamp : SoapHeader, IXmlElement {
-
- private string id;
- private string idNS;
- private DateTime created;
- private string createdId;
- private string createdIdNS;
- private DateTime expired;
- private string expiredId;
- private string expiredIdNS;
- private ReceivedCollection rcoll;
- private long timeToLive;
-
- public Timestamp ()
- {
- created = DateTime.MinValue;
- expired = DateTime.MaxValue;
- timeToLive = 300000; // 5 minutes
- rcoll = new ReceivedCollection ();
- }
-
- // we must be able to fix both creation and expiration
- internal void SetTimestamp (DateTime c)
- {
- created = c;
- expired = created.AddMilliseconds (timeToLive);
- }
-
- public new string Actor {
- get { return base.Actor; }
- }
-
- public DateTime Created {
- get { return created; }
- }
-
- public DateTime Expires {
- get { return expired; }
- }
-
- public ReceivedCollection Receivers {
- get { return rcoll; }
- }
-
- public long Ttl {
- get { return timeToLive; }
- set {
- if (value < 0)
- throw new System.ArgumentException ("value");
- if (value == 0)
- expired = DateTime.MaxValue;
- timeToLive = value;
- }
- }
-
- // syntactically correct
- // no checks are done on the dates themselves !
- public void CheckValid ()
- {
- if (created == DateTime.MinValue)
- throw new TimestampFormatException (TimestampFormatException.MissingCreatedElement);
- }
-
- public XmlElement GetXml (XmlDocument document)
- {
- if (document == null)
- throw new System.ArgumentNullException ("document");
-
- // much cleaner than using StringBuilder!
- XmlElement xel = document.CreateElement (WSTimestamp.Prefix, WSTimestamp.ElementNames.Timestamp, WSTimestamp.NamespaceURI);
- // FIXME: commented for WSE preview compatibility
- // if (id != null)
- // xel.SetAttribute (WSTimestamp.AttributeNames.Id, idNS, id);
-
- if (created != DateTime.MinValue) {
- XmlElement xelCreated = document.CreateElement (WSTimestamp.Prefix, WSTimestamp.ElementNames.Created, WSTimestamp.NamespaceURI);
- xelCreated.InnerText = created.ToString (WSTimestamp.TimeFormat);
- if (createdId != null)
- xelCreated.SetAttribute (WSTimestamp.AttributeNames.Id, createdIdNS, createdId);
- xel.AppendChild (xelCreated);
- }
- if (expired != DateTime.MaxValue) {
- XmlElement xelExpires = document.CreateElement (WSTimestamp.Prefix, WSTimestamp.ElementNames.Expires, WSTimestamp.NamespaceURI);
- xelExpires.InnerText = expired.ToString (WSTimestamp.TimeFormat);
- if (expiredId != null)
- xelExpires.SetAttribute (WSTimestamp.AttributeNames.Id, expiredIdNS, expiredId);
- xel.AppendChild (xelExpires);
- }
- for (int i=0; i < rcoll.Count ; i++)
- {
- XmlElement received = rcoll[i].GetXml (document);
- xel.AppendChild (received);
- }
- return xel;
- }
-
- public void LoadXml (XmlElement element)
- {
- if (element == null)
- throw new System.ArgumentNullException ("element");
-
- if ((element.LocalName != WSTimestamp.ElementNames.Timestamp) || (element.NamespaceURI != WSTimestamp.NamespaceURI))
- throw new System.ArgumentException ("invalid LocalName or NamespaceURI");
-
- XmlAttribute xa = element.Attributes [WSTimestamp.AttributeNames.Id, WSTimestamp.NamespaceURI];
- id = ((xa == null) ? null : xa.Value);
- idNS = ((xa == null) ? null : xa.NamespaceURI);
-
- XmlNodeList xnl = element.GetElementsByTagName (WSTimestamp.ElementNames.Created, WSTimestamp.NamespaceURI);
- if (xnl != null) {
- switch (xnl.Count) {
- case 0:
-// throw new TimestampFormatException (TimestampFormatException.MissingCreatedElement);
- break;
- case 1:
- created = DateTime.ParseExact (xnl[0].InnerText, WSTimestamp.TimeFormat, null);
- created = created.ToUniversalTime ();
- xa = xnl[0].Attributes [WSTimestamp.AttributeNames.Id, WSTimestamp.NamespaceURI];
- createdId = ((xa == null) ? null : xa.Value);
- createdIdNS = ((xa == null) ? null : xa.NamespaceURI);
- break;
- default:
- throw new TimestampFormatException (TimestampFormatException.DuplicateCreatedElement);
- }
- }
-
- xnl = element.GetElementsByTagName (WSTimestamp.ElementNames.Expires, WSTimestamp.NamespaceURI);
- if (xnl != null) {
- switch (xnl.Count) {
- case 0:
-// throw new TimestampFormatException (TimestampFormatException.MissingCreatedElement);
- break;
- case 1:
- expired = DateTime.ParseExact (xnl[0].InnerText, WSTimestamp.TimeFormat, null);
- expired = expired.ToUniversalTime ();
- xa = xnl[0].Attributes [WSTimestamp.AttributeNames.Id, WSTimestamp.NamespaceURI];
- expiredId = ((xa == null) ? null : xa.Value);
- expiredIdNS = ((xa == null) ? null : xa.NamespaceURI);
- break;
- default:
- throw new TimestampFormatException (TimestampFormatException.DuplicateCreatedElement);
- }
- }
-
- xnl = element.GetElementsByTagName (WSTimestamp.ElementNames.Received, WSTimestamp.NamespaceURI);
- if (xnl != null) {
- for (int i=0; i < xnl.Count; i++) {
- Received r = new Received ((XmlElement)xnl [i]);
- rcoll.Add (r);
- }
- }
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/TimestampFault.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/TimestampFault.cs deleted file mode 100644 index e69a9c115a6..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/TimestampFault.cs +++ /dev/null @@ -1,28 +0,0 @@ -//
-// TimestampFault.cs: Undocument exception when message expires
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-using System.Web.Services.Protocols;
-using System.Xml;
-
-namespace Microsoft.Web.Services.Timestamp {
-
- internal class TimestampFault : SoapHeaderException {
-
- public TimestampFault (string message, XmlQualifiedName code) : base (message, code) {}
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/TimestampFormatException.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/TimestampFormatException.cs deleted file mode 100755 index 28bc8049bd9..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/TimestampFormatException.cs +++ /dev/null @@ -1,47 +0,0 @@ -// -// Microsoft.Web.Services.Timestamp.TimestampFormatException.cs -// -// Authors: -// Daniel Kornhauser <dkor@alum.mit.edu> -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) Ximian, Inc. 2003. -// Portions (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Web.Services.Protocols; -using System.Xml; - -namespace Microsoft.Web.Services.Timestamp { - - [MonoTODO("We should support I18N")] - [Serializable] - public class TimestampFormatException : SoapHeaderException { - public static readonly string BadDelayAttribute = "Bad Delay Attribute"; - public static readonly string DelayAttributeWithPlusSign = "Delay Attribute With Plus Sign"; - public static readonly string DuplicateCreatedElement = "Duplicate Created Element"; - public static readonly string DuplicateExpiresElement = "Duplicate Expires Element"; - public static readonly string MissingActorAttributeInReceivedElement = "Missing Actor Attribute In Received Element"; - public static readonly string MissingCreatedElement = "Missing Created Element"; - public static readonly string MoreThanOneTimestampHeaders = "More Than One Timestamp Headers"; -#if WSE2 - public static readonly string BadActorAttribute = "Bad Actor Attribute"; - public static readonly string BadCreatedElement = "Bad Created Element"; - public static readonly string BadExpiresElement = "Bad Expires Element"; - public static readonly string BadNamespaceForActor = "Bad Namespace For Actor"; - public static readonly string BadNamespaceForMustUnderstand = "Bad Namespace For MustUnderstand"; - public static readonly string BadReceivedElement = "Bad Received Element"; - public static readonly string BadTimestampActorAttribute = "BadTimestamp Actor Attribute"; - public static readonly string DuplicateActorAttribute = "Duplicate Actor Attribute"; - public static readonly string DuplicateDelayAttribute = "Duplicate Delay Attribute"; -#endif - public TimestampFormatException (string message) - : base (message, XmlQualifiedName.Empty) {} - -#if WSE2 - public TimestampFormatException (string message, Exception ex) - : base (message, XmlQualifiedName.Empty, ex) {} -#endif - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/TimestampInputFilter.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/TimestampInputFilter.cs deleted file mode 100644 index 2d8d4261dff..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/TimestampInputFilter.cs +++ /dev/null @@ -1,48 +0,0 @@ -//
-// TimestampInputFilter.cs: Timestamp SOAP Input Filter
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-using System.Xml;
-
-namespace Microsoft.Web.Services.Timestamp {
-
- // Reference:
- // 1. Inside the Web Services Enhancements Pipeline
- // http://msdn.microsoft.com/library/en-us/dnwebsrv/html/insidewsepipe.asp
-
- public class TimestampInputFilter : SoapInputFilter {
-
- public TimestampInputFilter () {}
-
- public override void ProcessMessage (SoapEnvelope envelope)
- {
- if (envelope == null)
- throw new ArgumentNullException ("envelope");
-
- if (envelope.Header != null) {
- XmlNodeList xnl = envelope.Header.GetElementsByTagName (WSTimestamp.ElementNames.Timestamp, WSTimestamp.NamespaceURI);
- if ((xnl != null) && (xnl.Count > 0)) {
- XmlElement xel = (XmlElement) xnl [0];
- envelope.Context.Timestamp.LoadXml (xel);
- if (envelope.Context.Timestamp.Expires < DateTime.UtcNow)
- throw new TimestampFault ("Message Expired", null);
- envelope.Header.RemoveChild (xel);
- }
- }
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/TimestampOutputFilter.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/TimestampOutputFilter.cs deleted file mode 100644 index 4640fd77a67..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/TimestampOutputFilter.cs +++ /dev/null @@ -1,44 +0,0 @@ -//
-// TimestampOutputFilter.cs: Timestamp SOAP Output Filter
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-using System.Xml;
-
-namespace Microsoft.Web.Services.Timestamp {
-
- public class TimestampOutputFilter : SoapOutputFilter {
-
- public TimestampOutputFilter () {}
-
- public override void ProcessMessage (SoapEnvelope envelope)
- {
- if (envelope == null)
- throw new ArgumentNullException ("envelope");
-
- // internal method
- envelope.Context.Timestamp.SetTimestamp (DateTime.UtcNow);
- XmlElement xel = envelope.Context.Timestamp.GetXml (envelope);
-
- if (envelope.Header == null) {
- XmlElement header = envelope.CreateHeader ();
- envelope.Envelope.PrependChild (xel);
- }
- envelope.Header.AppendChild (xel);
- }
-
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/WSTimestamp.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/WSTimestamp.cs deleted file mode 100644 index 2c12df76a93..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Timestamp/WSTimestamp.cs +++ /dev/null @@ -1,50 +0,0 @@ -//
-// WSTimestamp.cs: WSTimestamp definitions
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-// Licensed under MIT X11 (see LICENSE) with this specific addition:
-//
-// “This source code may incorporate intellectual property owned by Microsoft
-// Corporation. Our provision of this source code does not include any licenses
-// or any other rights to you under any Microsoft intellectual property. If you
-// would like a license from Microsoft (e.g. rebrand, redistribute), you need
-// to contact Microsoft directly.”
-//
-
-using System;
-
-namespace Microsoft.Web.Services.Timestamp {
-
- public class WSTimestamp {
-
- public class AttributeNames {
-
- public const string Actor = "Actor";
- public const string Delay = "Delay";
- public const string Id = "Id";
- public const string ValueType = "ValueType";
-
- public AttributeNames () {}
- }
-
- public class ElementNames {
-
- public const string Created = "Created";
- public const string Expires = "Expires";
- public const string Received = "Received";
- public const string Timestamp = "Timestamp";
-
- public ElementNames () {}
- }
-
- public const string NamespaceURI = "http://schemas.xmlsoap.org/ws/2002/07/utility";
- public const string Prefix = "wsu";
- public const string TimeFormat = "yyyy-MM-ddTHH:mm:ssZ";
-
- public WSTimestamp () {}
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.dll.sources b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.dll.sources deleted file mode 100755 index 5493a03249a..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.dll.sources +++ /dev/null @@ -1,105 +0,0 @@ -Assembly/AssemblyInfo.cs -Assembly/Locale.cs -Microsoft.Web.Services/UriList.cs -Microsoft.Web.Services/SoapFormatException.cs -Microsoft.Web.Services/TODOAttribute.cs -Microsoft.Web.Services/WebServicesExtension.cs -Microsoft.Web.Services/WebServicesClientProtocol.cs -Microsoft.Web.Services/SoapWebResponse.cs -Microsoft.Web.Services/SoapWebRequest.cs -Microsoft.Web.Services/SoapOutputFilter.cs -Microsoft.Web.Services/SoapOutputFilterCollection.cs -Microsoft.Web.Services/SoapInputFilter.cs -Microsoft.Web.Services/SoapInputFilterCollection.cs -Microsoft.Web.Services/SoapFault.cs -Microsoft.Web.Services/SoapEnvelope.cs -Microsoft.Web.Services/Soap.cs -Microsoft.Web.Services/SoapContext.cs -Microsoft.Web.Services/Pipeline.cs -Microsoft.Web.Services/IXmlElement.cs -Microsoft.Web.Services/HttpSoapContext.cs -Microsoft.Web.Services.Configuration/ConfigurationBase.cs -Microsoft.Web.Services.Configuration/FilterConfiguration.cs -Microsoft.Web.Services.Configuration/WebServicesConfiguration.cs -Microsoft.Web.Services.Timestamp/TimestampFormatException.cs -Microsoft.Web.Services.Timestamp/WSTimestamp.cs -Microsoft.Web.Services.Timestamp/TimestampOutputFilter.cs -Microsoft.Web.Services.Timestamp/TimestampInputFilter.cs -Microsoft.Web.Services.Timestamp/TimestampFault.cs -Microsoft.Web.Services.Timestamp/Timestamp.cs -Microsoft.Web.Services.Timestamp/Received.cs -Microsoft.Web.Services.Timestamp/ReceivedCollection.cs -Microsoft.Web.Services.Referral/Referral.cs -Microsoft.Web.Services.Referral/ReferralCollection.cs -Microsoft.Web.Services.Referral/ReferralException.cs -Microsoft.Web.Services.Referral/For.cs -Microsoft.Web.Services.Referral/If.cs -Microsoft.Web.Services.Referral/Desc.cs -Microsoft.Web.Services.Referral/ReferralInputFilter.cs -Microsoft.Web.Services.Referral/ReferralOutputFilter.cs -Microsoft.Web.Services.Policy/PolicyEnforcementException.cs -Microsoft.Web.Services.Messaging/ISoapFormatter.cs -Microsoft.Web.Services.Messaging/ISoapTransport.cs -Microsoft.Web.Services.Messaging/SoapPort.cs -Microsoft.Web.Services.Messaging/SoapReceiver.cs -Microsoft.Web.Services.Dime/DimeAttachment.cs -Microsoft.Web.Services.Dime/DimeAttachmentCollection.cs -Microsoft.Web.Services.Dime/DimeReader.cs -Microsoft.Web.Services.Dime/DimeRecord.cs -Microsoft.Web.Services.Dime/DimeFormatException.cs -Microsoft.Web.Services.Dime/TypeFormatEnum.cs -Microsoft.Web.Services.Addressing/AddressingFormatException.cs -Microsoft.Web.Services.Routing/Path.cs -Microsoft.Web.Services.Routing/RoutingFormatException.cs -Microsoft.Web.Services.Routing/Via.cs -Microsoft.Web.Services.Routing/ViaCollection.cs -Microsoft.Web.Services.Routing/RoutingInputFilter.cs -Microsoft.Web.Services.Routing/RoutingOutputFilter.cs -Microsoft.Web.Services.Security/AsymmetricDecryptionKey.cs -Microsoft.Web.Services.Security/AsymmetricEncryptionKey.cs -Microsoft.Web.Services.Security/AuthenticationKey.cs -Microsoft.Web.Services.Security/BinarySecurityToken.cs -Microsoft.Web.Services.Security/DecryptionKey.cs -Microsoft.Web.Services.Security/DecryptionKeyProvider.cs -Microsoft.Web.Services.Security/EncryptedData.cs -Microsoft.Web.Services.Security/EncryptedKey.cs -Microsoft.Web.Services.Security/EncryptionKey.cs -Microsoft.Web.Services.Security/IDecryptionKeyProvider.cs -Microsoft.Web.Services.Security/IPasswordProvider.cs -Microsoft.Web.Services.Security/ISecurityElement.cs -Microsoft.Web.Services.Security/KeyIdentifier.cs -Microsoft.Web.Services.Security/Nonce.cs -Microsoft.Web.Services.Security/PasswordOption.cs -Microsoft.Web.Services.Security/Reference.cs -Microsoft.Web.Services.Security/ReferenceList.cs -Microsoft.Web.Services.Security/Security.cs -Microsoft.Web.Services.Security/SecurityCollection.cs -Microsoft.Web.Services.Security/SecurityElementCollection.cs -Microsoft.Web.Services.Security/SecurityFormatException.cs -Microsoft.Web.Services.Security/SecurityInputFilter.cs -Microsoft.Web.Services.Security/SecurityOutputFilter.cs -Microsoft.Web.Services.Security/SecurityToken.cs -Microsoft.Web.Services.Security/SecurityTokenCollection.cs -Microsoft.Web.Services.Security/SecurityTokenReference.cs -Microsoft.Web.Services.Security/Signature.cs -Microsoft.Web.Services.Security/SignatureKey.cs -Microsoft.Web.Services.Security/SignatureOptions.cs -Microsoft.Web.Services.Security/SignedInfo.cs -Microsoft.Web.Services.Security/SignedXml.cs -Microsoft.Web.Services.Security/SignedXmlSignature.cs -Microsoft.Web.Services.Security/SymmetricDecryptionKey.cs -Microsoft.Web.Services.Security/SymmetricEncryptionKey.cs -Microsoft.Web.Services.Security/SecurityFault.cs -Microsoft.Web.Services.Security/TransformChain.cs -Microsoft.Web.Services.Security/UsernameToken.cs -Microsoft.Web.Services.Security/WSSecurity.cs -Microsoft.Web.Services.Security/X509SecurityToken.cs -Microsoft.Web.Services.Security/XmlDsigExcC14NTransform.cs -Microsoft.Web.Services.Security/XmlDsigExcC14NWithCommentsTransform.cs -Microsoft.Web.Services.Security/XmlEncryption.cs -Microsoft.Web.Services.Security/XmlSignature.cs -Microsoft.Web.Services.Security.X509/ICertificateStore.cs -Microsoft.Web.Services.Security.X509/MemoryCertificateStore.cs -Microsoft.Web.Services.Security.X509/X509Certificate.cs -Microsoft.Web.Services.Security.X509/X509CertificateCollection.cs -Microsoft.Web.Services.Security.X509/X509CertificateStore.cs diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/ChangeLog b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/ChangeLog deleted file mode 100755 index ded7b70621e..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/ChangeLog +++ /dev/null @@ -1,3 +0,0 @@ -2003-09-06 Sebastien Pouliot <spouliot@videotron.ca> - - * Pipeline.cs: Uncommented Microsoft.Web.Services.Configuration; diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/HttpSoapContext.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/HttpSoapContext.cs deleted file mode 100644 index bf9f6ced529..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/HttpSoapContext.cs +++ /dev/null @@ -1,29 +0,0 @@ -//
-// HttpSoapContext.cs: Http Soap Contexts
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-
-using System;
-
-namespace Microsoft.Web.Services {
-
- public sealed class HttpSoapContext {
-
- // must have an internal one or a public one will be created (winchurn)
- internal HttpSoapContext () {}
-
- [MonoTODO("ASP.NET related")]
- public static SoapContext RequestContext {
- get { return null; }
- }
-
- [MonoTODO("ASP.NET related")]
- public static SoapContext ResponseContext {
- get { return null; }
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/IXmlElement.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/IXmlElement.cs deleted file mode 100644 index 6d2d46a1d3f..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/IXmlElement.cs +++ /dev/null @@ -1,20 +0,0 @@ -//
-// IXmlElement.cs: Interface IXmlElement
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-
-using System.Xml;
-
-namespace Microsoft.Web.Services {
-
- public interface IXmlElement {
-
- XmlElement GetXml (XmlDocument document);
-
- void LoadXml (XmlElement element);
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/Pipeline.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/Pipeline.cs deleted file mode 100644 index 4c6c47e155b..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/Pipeline.cs +++ /dev/null @@ -1,71 +0,0 @@ -// -// Pipeline.cs: Soap Filter Pipeline -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using Microsoft.Web.Services.Configuration; - -namespace Microsoft.Web.Services { - - // Reference: - // 1. Inside the Web Services Enhancements Pipeline - // http://msdn.microsoft.com/library/en-us/dnwebsrv/html/insidewsepipe.asp - - public class Pipeline { - - private SoapInputFilterCollection input; - private SoapOutputFilterCollection output; - - public Pipeline() - { - // set to defaults - input = (SoapInputFilterCollection) WebServicesConfiguration.FilterConfiguration.InputFilters.Clone (); - output = (SoapOutputFilterCollection) WebServicesConfiguration.FilterConfiguration.OutputFilters.Clone (); - } - - public Pipeline (Pipeline pipeline) - { - if (pipeline == null) - throw new ArgumentNullException ("pipeline"); - input = (SoapInputFilterCollection) pipeline.InputFilters.Clone (); - output = (SoapOutputFilterCollection) pipeline.OutputFilters.Clone (); - } - - public Pipeline (SoapInputFilterCollection inputFilters, SoapOutputFilterCollection outputFilters) - { - if (inputFilters == null) - throw new ArgumentNullException ("inputFilters"); - if (outputFilters == null) - throw new ArgumentNullException ("outputFilters"); - input = (SoapInputFilterCollection) inputFilters.Clone (); - output = (SoapOutputFilterCollection) outputFilters.Clone (); - } - - public SoapInputFilterCollection InputFilters { - get { return input; } - } - - public SoapOutputFilterCollection OutputFilters { - get { return output; } - } - - public void ProcessInputMessage (SoapEnvelope envelope) - { - // in normal order - for (int x=0; x < input.Count; x++) - input [x].ProcessMessage (envelope); - } - - public void ProcessOutputMessage (SoapEnvelope envelope) - { - // in reverse order - see reference [1] - for (int x=output.Count - 1; x >= 0; x++) - output [x].ProcessMessage (envelope); - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/Soap.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/Soap.cs deleted file mode 100644 index b653ab4cbe5..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/Soap.cs +++ /dev/null @@ -1,50 +0,0 @@ -//
-// Soap.cs: SOAP definitions for WSE
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-
-using System;
-
-namespace Microsoft.Web.Services {
-
- public class Soap {
-
- public class AttributeNames {
-
- public const string Actor = "actor";
- public const string MustUnderstand = "mustUnderstand";
-
- public AttributeNames() {}
- }
-
- public class ElementNames {
- public const string Body = "Body";
- public const string Envelope = "Envelope";
- public const string Fault = "Fault";
- public const string FaultActor = "faultactor";
- public const string FaultCode = "faultcode";
- public const string FaultDetail = "detail";
- public const string FaultString = "faultstring";
- public const string Header = "Header";
- public const string Message = "Message";
- public const string StackTrace = "StackTrace";
-
- public ElementNames () {}
- }
-
- public const string ActorNext = "http://schemas.xmlsoap.org/soap/actor/next";
- public static readonly Uri ActorNextURI = new Uri (ActorNext);
-
- public const string DimeContentType = "application/dime";
- public const string FaultNamespaceURI = "http://schemas.microsoft.com/wsdk/2002/10/";
- public const string NamespaceURI = "http://schemas.xmlsoap.org/soap/envelope/";
- public const string Prefix = "soap";
- public const string SoapContentType = "text/xml";
-
- public Soap() {}
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapContext.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapContext.cs deleted file mode 100644 index 88a01b40dc8..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapContext.cs +++ /dev/null @@ -1,160 +0,0 @@ -//
-// SoapContext.cs: SOAP Context
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-
-using Microsoft.Web.Services.Dime;
-using Microsoft.Web.Services.Referral;
-using Microsoft.Web.Services.Routing;
-using Microsoft.Web.Services.Security;
-using Microsoft.Web.Services.Timestamp;
-
-using System;
-using System.Collections;
-
-namespace Microsoft.Web.Services {
-
- public sealed class SoapContext {
-
- private SoapEnvelope envelope;
- private Uri actor;
- private Microsoft.Web.Services.Timestamp.Timestamp timestamp;
- private Microsoft.Web.Services.Security.Security security;
- private Hashtable table;
-
- internal SoapContext ()
- {
- timestamp = new Microsoft.Web.Services.Timestamp.Timestamp ();
- table = new Hashtable ();
- }
-
- internal SoapContext (SoapEnvelope env)
- {
- envelope = env;
- timestamp = new Microsoft.Web.Services.Timestamp.Timestamp ();
- table = new Hashtable ();
- }
-
- public Uri Actor {
- get { return actor; }
- }
-
- public DimeAttachmentCollection Attachments {
- get { return null; }
- }
-
- public string ContentType {
- get { return null; }
- }
-
- public SoapEnvelope Envelope {
- get { return envelope; }
- }
-
- public SecurityCollection ExtendedSecurity {
- get { return null; }
- }
-
- public object this [string key] {
- get { return table [key]; }
- set {
- if (key == null)
- throw new ArgumentNullException ("key");
- table [key] = value;
- }
- }
-
- public Path Path {
- get { return null; }
- set {;}
- }
-
- public ReferralCollection Referrals {
- get { return null; }
- }
-
- public Microsoft.Web.Services.Security.Security Security {
- get {
- if ((security == null) && (actor != null))
- security = new Microsoft.Web.Services.Security.Security (actor.ToString ());
- return security;
- }
- }
-
- public Microsoft.Web.Services.Timestamp.Timestamp Timestamp {
- get { return timestamp; }
- }
-
- internal bool IsReserved (string key)
- {
- switch (key) {
- case "Actor":
- case "Attachments":
- case "ContentType":
- case "Envelope":
- case "ExtendedSecurity":
- case "IsInbound":
- case "IsIntermediary":
- case "Referrals":
- case "Path":
- case "Security":
- case "Timestamp":
- case "WebRequest":
- case "WebResponse":
- return true;
- default:
- return false;
- }
- }
-
- public void Add (string key, object value)
- {
- if (key == null)
- throw new ArgumentNullException ("key");
- if (IsReserved (key))
- throw new ArgumentException ("reserved key");
- table.Add (key, value);
- }
-
- public void Clear ()
- {
- foreach (DictionaryEntry entry in table) {
- string key = (string) entry.Key;
- // remove all except reserved names
- if (!IsReserved (key))
- table.Remove (key);
- }
- }
-
- public bool Contains (string key)
- {
- if (key == null)
- throw new ArgumentNullException ("key");
- return table.Contains (key);
- }
-
- public void CopyTo (SoapContext context)
- {
- if (context == null)
- throw new ArgumentNullException ("context");
- }
-
- public IDictionaryEnumerator GetEnumerator ()
- {
- return table.GetEnumerator ();
- }
-
- public void Remove (string key)
- {
- if (key == null)
- throw new ArgumentNullException ("key");
- if (IsReserved (key))
- throw new ArgumentException ("reserved key");
- table.Remove (key);
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapEnvelope.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapEnvelope.cs deleted file mode 100755 index a2e6e0d98c2..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapEnvelope.cs +++ /dev/null @@ -1,123 +0,0 @@ -//
-// SoapEnvelope.cs: Soap Envelope
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-
-using System;
-using System.IO;
-using System.Xml;
-
-namespace Microsoft.Web.Services {
-
- public class SoapEnvelope : XmlDocument {
-
- private SoapContext context;
- private XmlElement envelope;
- private XmlElement body;
- private XmlElement header;
-
- public SoapEnvelope ()
- {
- envelope = CreateElement (Soap.Prefix, Soap.ElementNames.Envelope, Soap.NamespaceURI);
- AppendChild (envelope);
- }
-
- public XmlElement Body {
- get {
- if (body == null) {
- XmlNodeList xnl = GetElementsByTagName (Soap.ElementNames.Body, Soap.NamespaceURI);
- body = (XmlElement)xnl[0];
- }
- return body;
- }
- }
-
- public SoapContext Context {
- get {
- if (context == null)
- context = new SoapContext (this);
- return context;
- }
- }
-
- public XmlElement Envelope {
- get { return envelope; }
- }
-
- public XmlElement Header {
- get {
- if (header == null) {
- XmlNodeList xnl = GetElementsByTagName (Soap.ElementNames.Header, Soap.NamespaceURI);
- header = (XmlElement)xnl[0];
- }
- return header;
- }
- }
-
- public XmlElement CreateBody ()
- {
- if (body == null) {
- body = CreateElement (Soap.Prefix, Soap.ElementNames.Body, Soap.NamespaceURI);
- DocumentElement.AppendChild (body);
- }
- return body;
- }
-
- public XmlElement CreateHeader ()
- {
- if (header == null) {
- header = CreateElement (Soap.Prefix, Soap.ElementNames.Header, Soap.NamespaceURI);
- // be sure Header comes before the Body
- DocumentElement.PrependChild (header);
- }
- return header;
- }
-
- private void InvalidateCache ()
- {
- envelope = DocumentElement;
- header = null;
- body = null;
- }
-
- public override void Load (Stream stream)
- {
- base.Load (stream);
- InvalidateCache ();
- }
-
- public override void Load (string filename)
- {
- base.Load (filename);
- InvalidateCache ();
- }
-
- public override void Load (TextReader txtReader)
- {
- base.Load (txtReader);
- InvalidateCache ();
- }
-
- public override void Load (XmlReader xmlReader)
- {
- base.Load (xmlReader);
- InvalidateCache ();
- }
-
- [MonoTODO("why?")]
- public override void Save (Stream stream)
- {
- base.Save (stream);
- }
-
- [MonoTODO("why?")]
- public override void Save (string str)
- {
- base.Save (str);
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapFault.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapFault.cs deleted file mode 100644 index 387cdc9319c..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapFault.cs +++ /dev/null @@ -1,23 +0,0 @@ -//
-// SoapFault.cs: Implements SoapFault
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-
-using System;
-
-namespace Microsoft.Web.Services {
-
- [Serializable]
- public class SoapFault {
-
- public const string InvalidSoapMessage = "Invalid Soap Message";
- public const string InvalidXmlMessage = "Invalid Xml Message";
- public const string ServerUnavailable = "Server Unavailable";
-
- public SoapFault () {}
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapFormatException.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapFormatException.cs deleted file mode 100755 index 3fa037b099b..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapFormatException.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Microsoft.Web.Services.SoapFormatException.cs -// -// Author: Daniel Kornhauser <dkor@alum.mit.edu> -// -// (C) Ximian, Inc. 2003. - -using System; -using System.Web.Services.Protocols; -using System.Xml; - -namespace Microsoft.Web.Services { - - [Serializable] - public class SoapFormatException : SoapHeaderException - { - public SoapFormatException () - : base (String.Empty, XmlQualifiedName.Empty) - { - } - - public SoapFormatException (string message) - : base (message, XmlQualifiedName.Empty) - { - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapInputFilter.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapInputFilter.cs deleted file mode 100644 index caffff6ccce..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapInputFilter.cs +++ /dev/null @@ -1,39 +0,0 @@ -//
-// SoapIntputFilter.cs: SOAP Input Filter
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-
-using System;
-using System.Xml;
-
-namespace Microsoft.Web.Services {
-
- public abstract class SoapInputFilter {
-
- public SoapInputFilter () {}
-
- [MonoTODO("always return true - for now")]
- protected virtual bool CanProcessHeader (XmlElement header, SoapContext context)
- {
- if (header == null)
- throw new ArgumentNullException ("header");
- if (context == null)
- throw new ArgumentNullException ("context");
- // The header can be processed if any of the following conditions are true:
- // 1. Actor is equal to ActorNext.
- if (context.Actor.AbsoluteUri == Soap.ActorNext)
- return true;
- // 2. Actor matches this node.
- // 3. Actor is empty and the IsIntermediary property of context is false.
- //if ((context.Actor == null) && (context.IsIntermediary))
- return true;
- //return false;
- }
-
- public abstract void ProcessMessage (SoapEnvelope envelope);
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapInputFilterCollection.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapInputFilterCollection.cs deleted file mode 100644 index d40788637ff..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapInputFilterCollection.cs +++ /dev/null @@ -1,110 +0,0 @@ -//
-// SoapInputFilterCollection.cs: Soap Input Filter Collection
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-
-using System;
-using System.Collections;
-
-namespace Microsoft.Web.Services {
-
- public class SoapInputFilterCollection : CollectionBase, ICloneable {
-
- public SoapInputFilterCollection () {}
-
- public SoapInputFilter this [int index] {
- get { return (SoapInputFilter) InnerList [index]; }
- }
-
- public int Add (SoapInputFilter filter)
- {
- if (filter == null)
- throw new ArgumentNullException ("filter");
- return InnerList.Add (filter);
- }
-
- public void AddRange (ICollection filters)
- {
- // can't use list.AddRange because we must check every items
- // in the collection
- foreach (object o in filters) {
- if (! (o is SoapInputFilter))
- throw new ArgumentException ("not SoapInputFilter");
- // we'll get the ArgumentNullException in Add
- InnerList.Add (o as SoapInputFilter);
- }
- }
-
- // LAMESPEC: Shallow (implemented) or deep clone (todo)
- public object Clone ()
- {
- return InnerList.Clone ();
- }
-
- public bool Contains (SoapInputFilter filter)
- {
- if (filter == null)
- throw new ArgumentNullException ("filter");
- return InnerList.Contains (filter);
- }
-
- public bool Contains (Type filterType)
- {
- foreach (object o in InnerList) {
- if (o.GetType () == filterType)
- return true;
- }
- return false;
- }
-
- public int IndexOf (SoapInputFilter filter)
- {
- if (filter == null)
- throw new ArgumentNullException ("filter");
- return InnerList.IndexOf (filter);
- }
-
- public int IndexOf (Type filterType)
- {
- if (filterType == null)
- throw new ArgumentNullException ("filterType");
- int i = 0;
- foreach (object o in InnerList) {
- if (o.GetType () == filterType)
- return i;
- i++;
- }
- return -1;
- }
-
- public void Insert (int index, SoapInputFilter filter)
- {
- if (filter == null)
- throw new ArgumentNullException ("filter");
- InnerList.Insert (index, filter);
- }
-
- public void Remove (SoapInputFilter filter)
- {
- if (filter == null)
- throw new ArgumentNullException ("filter");
- InnerList.Remove (filter);
- }
-
- public void Remove (Type filterType)
- {
- if (filterType == null)
- throw new ArgumentNullException ("filterType");
- int i = 0;
- foreach (object o in InnerList) {
- if (o.GetType () == filterType)
- InnerList.RemoveAt (i);
- i++;
- }
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapOutputFilter.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapOutputFilter.cs deleted file mode 100644 index af2dcf0447a..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapOutputFilter.cs +++ /dev/null @@ -1,20 +0,0 @@ -//
-// SoapOutputFilter.cs: SOAP Output Filter
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-
-using System;
-
-namespace Microsoft.Web.Services {
-
- public abstract class SoapOutputFilter {
-
- public SoapOutputFilter () {}
-
- public abstract void ProcessMessage (SoapEnvelope envelope);
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapOutputFilterCollection.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapOutputFilterCollection.cs deleted file mode 100644 index f5ab80d1c3c..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapOutputFilterCollection.cs +++ /dev/null @@ -1,111 +0,0 @@ -//
-// SoapInputFilterCollection.cs: Soap Input Filter Collection
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-
-using Microsoft.Web.Services;
-using System;
-using System.Collections;
-
-namespace Microsoft.Web.Services {
-
- public class SoapOutputFilterCollection : CollectionBase, ICloneable {
-
- public SoapOutputFilterCollection () {}
-
- public SoapOutputFilter this [int index] {
- get { return (SoapOutputFilter) InnerList [index]; }
- }
-
- public int Add (SoapOutputFilter filter)
- {
- if (filter == null)
- throw new ArgumentNullException ("filter");
- return InnerList.Add (filter);
- }
-
- public void AddRange (ICollection filters)
- {
- // can't use list.AddRange because we must check every items
- // in the collection
- foreach (object o in filters) {
- if (! (o is SoapOutputFilter))
- throw new ArgumentException ("not SoapOutputFilter");
- // we'll get the ArgumentNullException in Add
- InnerList.Add (o);
- }
- }
-
- // LAMESPEC: Shallow (implemented) or deep clone (todo)
- public object Clone ()
- {
- return InnerList.Clone ();
- }
-
- public bool Contains (SoapOutputFilter filter)
- {
- if (filter == null)
- throw new ArgumentNullException ("filter");
- return InnerList.Contains (filter);
- }
-
- public bool Contains (Type filterType)
- {
- foreach (object o in InnerList) {
- if (o.GetType () == filterType)
- return true;
- }
- return false;
- }
-
- public int IndexOf (SoapOutputFilter filter)
- {
- if (filter == null)
- throw new ArgumentNullException ("filter");
- return InnerList.IndexOf (filter);
- }
-
- public int IndexOf (Type filterType)
- {
- if (filterType == null)
- throw new ArgumentNullException ("filterType");
- int i = 0;
- foreach (object o in InnerList) {
- if (o.GetType () == filterType)
- return i;
- i++;
- }
- return -1;
- }
-
- public void Insert (int index, SoapOutputFilter filter)
- {
- if (filter == null)
- throw new ArgumentNullException ("filter");
- InnerList.Insert (index, filter);
- }
-
- public void Remove (SoapOutputFilter filter)
- {
- if (filter == null)
- throw new ArgumentNullException ("filter");
- InnerList.Remove (filter);
- }
-
- public void Remove (Type filterType)
- {
- if (filterType == null)
- throw new ArgumentNullException ("filterType");
- int i = 0;
- foreach (object o in InnerList) {
- if (o.GetType () == filterType)
- InnerList.RemoveAt (i);
- i++;
- }
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapWebRequest.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapWebRequest.cs deleted file mode 100644 index e66536630f9..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapWebRequest.cs +++ /dev/null @@ -1,129 +0,0 @@ -//
-// SoapWebRequest.cs: Soap Web Request
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-
-using System;
-using System.IO;
-using System.Net;
-
-namespace Microsoft.Web.Services {
-
- public class SoapWebRequest : WebRequest {
-
- private Uri uri;
- private SoapContext context;
- private Pipeline pipeline;
-
- public SoapWebRequest (string uri) : this (new Uri (uri)) {}
-
- public SoapWebRequest (Uri uri) : base ()
- {
- this.uri = uri;
- context = new SoapContext (null);
- }
-
- [MonoTODO("incomplete - only call base class")]
- public override IAsyncResult BeginGetRequestStream (AsyncCallback cb, object state)
- {
- return base.BeginGetRequestStream (cb, state);
- }
-
- [MonoTODO("incomplete - only call base class")]
- public override IAsyncResult BeginGetResponse (AsyncCallback cb, object state)
- {
- return base.BeginGetResponse (cb, state);
- }
-
- [MonoTODO("incomplete - only call base class")]
- public override Stream EndGetRequestStream (IAsyncResult asyncResult)
- {
- return base.EndGetRequestStream (asyncResult);
- }
-
- [MonoTODO("incomplete - only call base class")]
- public override WebResponse EndGetResponse (IAsyncResult asyncResult)
- {
- return base.EndGetResponse (asyncResult);
- }
-
- [MonoTODO("incomplete - only call base class")]
- public override Stream GetRequestStream ()
- {
- return base.GetRequestStream ();
- }
-
- [MonoTODO("incomplete - only call base class")]
- public override WebResponse GetResponse ()
- {
- return base.GetResponse ();
- }
-
- [MonoTODO("incomplete - only call base class")]
- public override string ConnectionGroupName {
- get { return base.ConnectionGroupName; }
- set { base.ConnectionGroupName = value; }
- }
-
- [MonoTODO("incomplete - only call base class")]
- public override string ContentType {
- get { return base.ContentType; }
- set { base.ContentType = value; }
- }
-
- [MonoTODO("incomplete - only call base class")]
- public override ICredentials Credentials {
- get { return base.Credentials; }
- set { base.Credentials = value; }
- }
-
- [MonoTODO("incomplete - only call base class")]
- public override WebHeaderCollection Headers {
- get { return base.Headers; }
- }
-
- [MonoTODO("incomplete - only call base class")]
- public override string Method {
- get { return base.Method; }
- set { base.Method = value; }
- }
-
- public Pipeline Pipeline {
- get {
- // if none set, then get the default pipeline
- if (pipeline == null)
- pipeline = new Pipeline ();
- return pipeline;
- }
- set { pipeline = value; }
- }
-
- [MonoTODO("incomplete - only call base class")]
- public override bool PreAuthenticate {
- get { return base.PreAuthenticate; }
- set { base.PreAuthenticate = value; }
- }
-
- public WebRequest Request {
- get { return null; }
- }
-
- public override Uri RequestUri {
- get { return uri; }
- }
-
- public SoapContext SoapContext {
- get { return context; }
- }
-
- [MonoTODO("incomplete - only call base class")]
- public override int Timeout {
- get { return base.Timeout; }
- set { base.Timeout = value; }
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapWebResponse.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapWebResponse.cs deleted file mode 100644 index 4cb89699ea8..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/SoapWebResponse.cs +++ /dev/null @@ -1,51 +0,0 @@ -//
-// SoapWebResponse.cs: Soap Web Response List
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-
-using Microsoft.Web.Services;
-using System;
-using System.IO;
-using System.Net;
-
-namespace Microsoft.Web.Services {
-
- public class SoapWebResponse : WebResponse {
-
- private SoapWebRequest request;
- private Stream stream;
- private WebResponse response;
-
- internal SoapWebResponse (SoapWebRequest soapRequest)
- {
- request = soapRequest;
- response = soapRequest.GetResponse ();
- stream = response.GetResponseStream ();
- }
-
- public override Stream GetResponseStream ()
- {
- return stream;
- }
-
- public override long ContentLength {
- get { return stream.Length; }
- }
-
- public override string ContentType {
- get { return request.Request.ContentType; }
- }
-
- public override WebHeaderCollection Headers {
- get { return response.Headers; }
- }
-
- public SoapContext SoapContext {
- get { return null; }
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/TODOAttribute.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/TODOAttribute.cs deleted file mode 100755 index 816c4a39fc4..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/TODOAttribute.cs +++ /dev/null @@ -1,34 +0,0 @@ -// -// TODOAttribute.cs -// -// Author: -// Ravi Pratap (ravi@ximian.com) -// -// (C) Ximian, Inc. http://www.ximian.com -// - -using System; - -namespace Microsoft.Web.Services { - - /// <summary> - /// The TODO attribute is used to flag all incomplete bits in our class libraries - /// </summary> - /// - /// <remarks> - /// Use this to decorate any element which you think is not complete - /// </remarks> - [AttributeUsage (AttributeTargets.All)] - internal class MonoTODOAttribute : Attribute { - - string comment; - - public MonoTODOAttribute () - {} - - public MonoTODOAttribute (string comment) - { - this.comment = comment; - } - } -} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/UriList.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/UriList.cs deleted file mode 100644 index af8bed317f8..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/UriList.cs +++ /dev/null @@ -1,89 +0,0 @@ -//
-// UriList.cs: Uri List
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-
-using System;
-using System.Collections;
-
-namespace Microsoft.Web.Services {
-
- public class UriList : ICollection {
-
- private ArrayList list;
-
- public UriList ()
- {
- list = new ArrayList ();
- }
-
- public int Add (Uri uri)
- {
- return list.Add (uri);
- }
-
- public bool Contains (Uri uri)
- {
- return list.Contains (uri);
- }
-
- public void CopyTo (Array array, int index)
- {
- list.CopyTo (array, index);
- }
-
- public IEnumerator GetEnumerator ()
- {
- return list.GetEnumerator ();
- }
-
- public int IndexOf (Uri uri)
- {
- return list.IndexOf (uri);
- }
-
- public void Insert (int index, Uri uri)
- {
- list.Insert (index, uri);
- }
-
- public void Remove (Uri uri)
- {
- list.Remove (uri);
- }
-
- public void RemoveAt (int index)
- {
- list.RemoveAt (index);
- }
-
- public int Count {
- get { return list.Count; }
- }
-
- public bool IsFixedSize {
- get { return list.IsFixedSize; }
- }
-
- public bool IsReadOnly {
- get { return list.IsReadOnly; }
- }
-
- public bool IsSynchronized {
- get { return list.IsSynchronized; }
- }
-
- public Uri this [int index] {
- get { return (Uri) list [index]; }
- set { list [index] = value; }
- }
-
- public object SyncRoot {
- get { return list.SyncRoot; }
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/WebServicesClientProtocol.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/WebServicesClientProtocol.cs deleted file mode 100644 index 62735eb28ce..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/WebServicesClientProtocol.cs +++ /dev/null @@ -1,82 +0,0 @@ -//
-// WebServicesClientProtocol.cs: Web Services Client Protocol
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-
-using System;
-using System.Net;
-using System.Web.Services.Protocols;
-
-namespace Microsoft.Web.Services {
-
- public class WebServicesClientProtocol : SoapHttpClientProtocol {
-
- private Pipeline _pipeline;
- private SoapContext _requestContext;
- private SoapContext _responseContext;
-
- public WebServicesClientProtocol () {}
-
- public Pipeline Pipeline {
- get {
- if (_pipeline == null)
- _pipeline = new Pipeline ();
- return _pipeline;
- }
- set {
- if (value == null)
- throw new System.ArgumentNullException ("value");
- _pipeline = value;
- }
- }
-
- public SoapContext RequestSoapContext {
- get {
- if (_requestContext == null)
- _requestContext = new SoapContext ();
- return _requestContext;
- }
- }
-
- public SoapContext ResponseSoapContext {
- get {
- if (_responseContext == null)
- _responseContext = new SoapContext ();
- return _responseContext;
- }
- }
-
- [MonoTODO("something is missing")]
- public new string Url {
- get { return base.Url; }
- set { base.Url = value; }
- }
-
- protected override WebRequest GetWebRequest (Uri uri)
- {
- SoapWebRequest request = new SoapWebRequest (uri);
- RequestSoapContext.CopyTo (request.SoapContext);
- request.Pipeline = _pipeline;
- return request;
- }
-
- protected override WebResponse GetWebResponse (WebRequest request)
- {
- SoapWebResponse response = (SoapWebResponse) request.GetResponse ();
- response.SoapContext.CopyTo (ResponseSoapContext);
- return response;
- }
-
- [MonoTODO("do not support IAsyncResult")]
- protected override WebResponse GetWebResponse (WebRequest request, IAsyncResult result)
- {
- SoapWebResponse response = (SoapWebResponse) request.GetResponse ();
- response.SoapContext.CopyTo (ResponseSoapContext);
- return response;
- }
- }
-}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/WebServicesExtension.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/WebServicesExtension.cs deleted file mode 100644 index d3ce27b93eb..00000000000 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services/WebServicesExtension.cs +++ /dev/null @@ -1,60 +0,0 @@ -//
-// WebServicesExtension.cs: Web Service Extension
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-
-using System;
-using System.IO;
-using System.Web.Services.Protocols;
-
-namespace Microsoft.Web.Services {
-
- public class WebServicesExtension : SoapExtension {
-
- public WebServicesExtension () {}
-
- public override Stream ChainStream (Stream stream)
- {
- return null;
- }
-
- public override object GetInitializer (LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute)
- {
- return null;
- }
-
- public override object GetInitializer (Type type)
- {
- return null;
- }
-
- public override void Initialize (object initializer)
- {
- }
-
- public override void ProcessMessage (SoapMessage message)
- {
- if (message == null)
- throw new ArgumentNullException ("message");
-
- switch (message.Stage) {
- case SoapMessageStage.BeforeSerialize:
- // TODO
- break;
- case SoapMessageStage.AfterSerialize:
- // TODO
- break;
- case SoapMessageStage.BeforeDeserialize:
- // TODO
- break;
- case SoapMessageStage.AfterDeserialize:
- // TODO
- break;
- }
- }
- }
-}
diff --git a/mcs/class/Mono.CSharp.Debugger/ChangeLog b/mcs/class/Mono.CSharp.Debugger/ChangeLog index 348459340f0..4913726e82f 100644 --- a/mcs/class/Mono.CSharp.Debugger/ChangeLog +++ b/mcs/class/Mono.CSharp.Debugger/ChangeLog @@ -1,7 +1,3 @@ -2003-09-06 Martin Baulig <martin@ximian.com> - - * MonoSymbolFile.cs: Removed debugging output. - 2003-08-05 Martin Baulig <martin@ximian.com> * MonoSymbolTable.cs (MethodEntry.Index): New public field. diff --git a/mcs/class/Mono.CSharp.Debugger/MonoSymbolFile.cs b/mcs/class/Mono.CSharp.Debugger/MonoSymbolFile.cs index 92de8a46dd6..f44a2f60e87 100644 --- a/mcs/class/Mono.CSharp.Debugger/MonoSymbolFile.cs +++ b/mcs/class/Mono.CSharp.Debugger/MonoSymbolFile.cs @@ -306,6 +306,12 @@ namespace Mono.CSharp.Debugger using (MyMemoryStream stream = new MyMemoryStream ()) { Write (new BinaryWriter (stream)); + Console.WriteLine ("WROTE SYMFILE: {0} sources, {1} methods, {2} types, " + + "{3} line numbers, {4} locals, {5} namespaces, " + + "{6} bytes of string data", + SourceCount, MethodCount, TypeCount, LineNumberCount, + LocalCount, NamespaceCount, StringSize); + Console.WriteLine (ot); return stream.GetContents (); } } diff --git a/mcs/class/Mono.Cairo/ChangeLog b/mcs/class/Mono.Cairo/ChangeLog index e9e6d3ca4a4..0aa1663b123 100644 --- a/mcs/class/Mono.Cairo/ChangeLog +++ b/mcs/class/Mono.Cairo/ChangeLog @@ -1,19 +1,3 @@ -2003-09-05 Duncan Mak <duncan@ximian.com> - - * Mono.Cairo/Object.cs (Tolerance): Fix typo. - -2003-09-04 Duncan Mak <duncan@ximian.com> - - * Mono.Cairo/Cairo.cs: Update to the new API in CVS. Change all - *_get_* to *_current_*. - (cairo_set_target_drawable): - (cairo_surface_create_for_drawable): Add CLSCompliantAttribute. - (cairo_current_tolerance): - (cairo_set_tolerance): Fix typo. Thanks Alp. - - * Mono.Cairo/Object.cs: Update binding to reflect changes in the - API. - 2003-08-12 Duncan Mak <duncan@ximian.com> * Mono.Cairo/Cairo.cs: csc was having trouble resolving the type diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/Cairo.cs b/mcs/class/Mono.Cairo/Mono.Cairo/Cairo.cs index 13dd9847417..f3145010cbe 100644 --- a/mcs/class/Mono.Cairo/Mono.Cairo/Cairo.cs +++ b/mcs/class/Mono.Cairo/Mono.Cairo/Cairo.cs @@ -44,9 +44,6 @@ namespace Cairo { public static extern void cairo_set_target_image ( IntPtr cr, string data, Cairo.Format format, int width, int height, int stride); - [DllImport (CairoImp), CLSCompliant (false)] - public static extern void cairo_set_target_drawable (IntPtr cr, IntPtr dpy, ulong drawable); - [DllImport (CairoImp)] public static extern void cairo_set_operator (IntPtr cr, Cairo.Operator op); @@ -60,7 +57,7 @@ namespace Cairo { public static extern void cairo_set_pattern (IntPtr cr, IntPtr pattern); [DllImport (CairoImp)] - public static extern void cairo_set_tolerance (IntPtr cr, double tolerance); + public static extern void cairo_set_tolerence (IntPtr cr, double tolerance); [DllImport (CairoImp)] public static extern void cairo_set_fill_rule (IntPtr cr, Cairo.FillRule fill_rule); @@ -190,55 +187,55 @@ namespace Cairo { // query // [DllImport (CairoImp)] - public static extern Cairo.Operator cairo_current_operator (IntPtr cr); + public static extern Cairo.Operator cairo_get_operator (IntPtr cr); [DllImport (CairoImp)] - public static extern void cairo_current_rgb_color ( + public static extern void cairo_get_rgb_color ( IntPtr cr, out double red, out double green, out double blue); [DllImport (CairoImp)] - public static extern double cairo_current_alpha (IntPtr cr); + public static extern double cairo_get_alpha (IntPtr cr); [DllImport (CairoImp)] - public static extern double cairo_current_tolerance (IntPtr cr); + public static extern double cairo_get_tolerence (IntPtr cr); [DllImport (CairoImp)] - public static extern void cairo_current_point ( + public static extern void cairo_get_current_point ( IntPtr cr, out double x, out double y); [DllImport (CairoImp)] - public static extern Cairo.FillRule cairo_current_fill_rule (IntPtr cr); + public static extern Cairo.FillRule cairo_get_fill_rule (IntPtr cr); [DllImport (CairoImp)] - public static extern double cairo_current_line_width (IntPtr cr); + public static extern double cairo_get_line_width (IntPtr cr); [DllImport (CairoImp)] - public static extern LineCap cairo_current_line_cap (IntPtr cr); + public static extern LineCap cairo_get_line_cap (IntPtr cr); [DllImport (CairoImp)] - public static extern LineJoin cairo_current_line_join (IntPtr cr); + public static extern LineJoin cairo_get_line_join (IntPtr cr); [DllImport (CairoImp)] - public static extern double cairo_current_miter_limit (IntPtr cr); + public static extern double cairo_get_miter_limit (IntPtr cr); [DllImport (CairoImp)] - public static extern void cairo_current_matrix ( + public static extern void cairo_get_matrix ( IntPtr cr, out double a, out double b, out double c, out double d, out double tx, out double ty); [DllImport (CairoImp)] - public static extern void cairo_current_target_surface (IntPtr cr); + public static extern void cairo_get_target_surface (IntPtr cr); // // Error status queries // [DllImport (CairoImp)] - public static extern Cairo.Status cairo_status (IntPtr cr); + public static extern Cairo.Status cairo_get_status (IntPtr cr); [DllImport (CairoImp)] - public static extern string cairo_status_string (IntPtr cr); + public static extern string cairo_get_status_string (IntPtr cr); // // Surface Manipulation @@ -248,9 +245,10 @@ namespace Cairo { // This is commented out because we don't have access // to the X11 Drawable and Visual types. // - [DllImport (CairoImp), CLSCompliant (false)] - public static extern IntPtr cairo_surface_create_for_drawable ( - IntPtr display, ulong drawable, IntPtr visual, Cairo.Format format, ulong colormap); +// [DllImport (CairoImp)] +// public static extern IntPtr cairo_surface_create_for_drawable ( +// IntPtr display, Drawable drawable, IntPtr visual, +// Cairo.Format format, Colormap colormap); [DllImport (CairoImp)] public static extern IntPtr cairo_surface_create_for_image ( diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/Object.cs b/mcs/class/Mono.Cairo/Mono.Cairo/Object.cs index 158a82ebdbc..3d23bb61ae2 100644 --- a/mcs/class/Mono.Cairo/Mono.Cairo/Object.cs +++ b/mcs/class/Mono.Cairo/Mono.Cairo/Object.cs @@ -51,13 +51,13 @@ namespace Cairo { public Cairo.Status Status { get { - return CairoAPI.cairo_status (state); + return CairoAPI.cairo_get_status (state); } } public string StatusString { get { - return CairoAPI.cairo_status_string (state); + return CairoAPI.cairo_get_status_string (state); } } @@ -73,7 +73,7 @@ namespace Cairo { } get { - return CairoAPI.cairo_current_operator (state); + return CairoAPI.cairo_get_operator (state); } } @@ -82,13 +82,13 @@ namespace Cairo { CairoAPI.cairo_set_rgb_color (state, r, g, b); } - public double Tolerance { + public double Tolerence { set { - CairoAPI.cairo_set_tolerance (state, value); + CairoAPI.cairo_set_tolerence (state, value); } get { - return CairoAPI.cairo_current_tolerance (state); + return CairoAPI.cairo_get_tolerence (state); } } @@ -98,7 +98,7 @@ namespace Cairo { } get { - return CairoAPI.cairo_current_alpha (state); + return CairoAPI.cairo_get_alpha (state); } } @@ -108,7 +108,7 @@ namespace Cairo { } get { - return CairoAPI.cairo_current_fill_rule (state); + return CairoAPI.cairo_get_fill_rule (state); } } @@ -118,7 +118,7 @@ namespace Cairo { } get { - return CairoAPI.cairo_current_line_width (state); + return CairoAPI.cairo_get_line_width (state); } } @@ -128,7 +128,7 @@ namespace Cairo { } get { - return CairoAPI.cairo_current_line_cap (state); + return CairoAPI.cairo_get_line_cap (state); } } @@ -138,7 +138,7 @@ namespace Cairo { } get { - return CairoAPI.cairo_current_line_join (state); + return CairoAPI.cairo_get_line_join (state); } } @@ -159,19 +159,19 @@ namespace Cairo { } get { - return CairoAPI.cairo_current_miter_limit (state); + return CairoAPI.cairo_get_miter_limit (state); } } public void GetCurrentPoint (out double x, out double y) { - CairoAPI.cairo_current_point (state, out x, out y); + CairoAPI.cairo_get_current_point (state, out x, out y); } public Point CurrentPoint { get { double x, y; - CairoAPI.cairo_current_point (state, out x, out y); + CairoAPI.cairo_get_current_point (state, out x, out y); return new Point ((int) x, (int) y); } } diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/ChangeLog b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/ChangeLog index 02d0d61dc86..f91ed45c0cd 100644 --- a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/ChangeLog +++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/ChangeLog @@ -1,13 +1,3 @@ -2003-08-22 Duncan Mak <duncan@ximian.com> - - * Tds.cs (ProcessEndToken): RecordsAffected was not filled - correctly. I've found out that the record count was submitted for - TdsPacketSubType.Done. So I changed the behaviour to include this - (without deeper knowledge of the TDS protocol). Patch from Jörg - Rosenkranz <joergr@voelcker.com>. - - This is part of a fix to bug #40315. - 2003-05-07 Miguel de Icaza <miguel@ximian.com> Patches from Igor Nosyryev <nosyryev@attbi.com> diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs index 557d192aab9..440364565f4 100644 --- a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs +++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs @@ -915,15 +915,10 @@ namespace Mono.Data.Tds.Protocol { moreResults = ((status & 0x01) != 0); bool cancelled = ((status & 0x20) != 0); - switch (type) { - case TdsPacketSubType.DoneProc: - doneProc = true; - goto case TdsPacketSubType.Done; - - case TdsPacketSubType.Done: - if (rowCount > 0) - recordsAffected += rowCount; - break; + if (type == TdsPacketSubType.DoneProc) { + doneProc = true; + if (rowCount > 0) + recordsAffected += rowCount; } if (moreResults) diff --git a/mcs/class/Mono.GetOptions/ArgumentProcessorAttribute.cs b/mcs/class/Mono.GetOptions/ArgumentProcessorAttribute.cs index da0e8459462..bbe235f7179 100644 --- a/mcs/class/Mono.GetOptions/ArgumentProcessorAttribute.cs +++ b/mcs/class/Mono.GetOptions/ArgumentProcessorAttribute.cs @@ -1,10 +1,3 @@ -// -// ArgumentProcessorAttribute.cs -// -// Author: Rafael Teixeira (rafaelteixeirabr@hotmail.com) -// -// (C) 2002 Rafael Teixeira -// using System; namespace Mono.GetOptions diff --git a/mcs/class/Mono.GetOptions/ChangeLog b/mcs/class/Mono.GetOptions/ChangeLog index cc5d9256a12..f3d23373345 100644 --- a/mcs/class/Mono.GetOptions/ChangeLog +++ b/mcs/class/Mono.GetOptions/ChangeLog @@ -1,7 +1,3 @@ -2003-08-25 Rafael Teixeira <rafaelteixeirabr@hotmail.com> - * ArgumentProcessorAttribute.cs, OptionAttribute.cs: - - Copyright attribute was missing - 2003-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com> * OptionDetails.cs : - Now handles correctly options specifiying maxOccurs != 1 (that was preventing mbas from being useable) diff --git a/mcs/class/Mono.GetOptions/OptionAttribute.cs b/mcs/class/Mono.GetOptions/OptionAttribute.cs index a6462ab2f7a..1602fd2e797 100644 --- a/mcs/class/Mono.GetOptions/OptionAttribute.cs +++ b/mcs/class/Mono.GetOptions/OptionAttribute.cs @@ -1,10 +1,3 @@ -// -// OptionAttribute.cs -// -// Author: Rafael Teixeira (rafaelteixeirabr@hotmail.com) -// -// (C) 2002 Rafael Teixeira -// using System; namespace Mono.GetOptions diff --git a/mcs/class/Mono.Security/ChangeLog b/mcs/class/Mono.Security/ChangeLog index 25571d19eca..cb9c778a3ba 100644 --- a/mcs/class/Mono.Security/ChangeLog +++ b/mcs/class/Mono.Security/ChangeLog @@ -1,12 +1,3 @@ -2003-09-05 Sebastien Pouliot <spouliot@videotron.ca> - - * KeyAttributesExtension.cs: New. Added for WSE. - -2003-09-01 Sebastien Pouliot <spouliot@videotron.ca> - - * Mono.Security.dll.sources: Added support for Authenticode(tm) - signatures. - 2003-07-30 Sebastien Pouliot <spouliot@videotron.ca> * Mono.Security.dll.sources: Added ExtendedKeyUsageExtension.cs diff --git a/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeBase.cs b/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeBase.cs deleted file mode 100755 index d46d0f3e86c..00000000000 --- a/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeBase.cs +++ /dev/null @@ -1,86 +0,0 @@ -// -// AuthenticodeBase.cs: Authenticode signature base class -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.IO; -using System.Security.Cryptography; - -namespace Mono.Security.Authenticode { - - // References: - // a. http://www.cs.auckland.ac.nz/~pgut001/pubs/authenticode.txt - - public enum Authority { - Individual, - Commercial, - Maximum - } - - public class AuthenticodeBase { - - public const string spcIndirectDataContext = "1.3.6.1.4.1.311.2.1.4"; - - protected byte[] rawData; - - public AuthenticodeBase () {} - - protected byte[] HashFile (string fileName, string hashName) - { - FileStream fs = new FileStream (fileName, FileMode.Open, FileAccess.Read, FileShare.Read); - byte[] file = new byte [fs.Length]; - fs.Read (file, 0, file.Length); - fs.Close (); - - // MZ - DOS header - if (BitConverter.ToUInt16 (file, 0) != 0x5A4D) - return null; - - // find offset of PE header - int peOffset = BitConverter.ToInt32 (file, 60); - if (peOffset > file.Length) - return null; - - // PE - NT header - if (BitConverter.ToUInt16 (file, peOffset) != 0x4550) - return null; - - // IMAGE_DIRECTORY_ENTRY_SECURITY - int dirSecurityOffset = BitConverter.ToInt32 (file, peOffset + 152); - int dirSecuritySize = BitConverter.ToInt32 (file, peOffset + 156); - - if (dirSecuritySize > 8) { - rawData = new byte [dirSecuritySize - 8]; - Array.Copy (file, dirSecurityOffset + 8, rawData, 0, rawData.Length); -/* DEBUG - FileStream debug = new FileStream (fileName + ".sig", FileMode.Create, FileAccess.Write); - debug.Write (rawData, 0, rawData.Length); - debug.Close ();*/ - } - else - rawData = null; - - HashAlgorithm hash = HashAlgorithm.Create (hashName); - // 0 to 215 (216) then skip 4 (checksum) - int pe = peOffset + 88; - hash.TransformBlock (file, 0, pe, file, 0); - pe += 4; - // 220 to 279 (60) then skip 8 (IMAGE_DIRECTORY_ENTRY_SECURITY) - hash.TransformBlock (file, pe, 60, file, pe); - pe += 68; - // 288 to end of file - int n = file.Length - pe; - // minus any authenticode signature (with 8 bytes header) - if (dirSecurityOffset != 0) - n -= (dirSecuritySize); - hash.TransformFinalBlock (file, pe, n); - - return hash.Hash; - } - } -} diff --git a/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeDeformatter.cs b/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeDeformatter.cs deleted file mode 100755 index 26d4f928ed7..00000000000 --- a/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeDeformatter.cs +++ /dev/null @@ -1,365 +0,0 @@ -// -// AuthenticodeSignature.cs: Authenticode signature validator and generator -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.IO; -using System.Security.Cryptography; - -using Mono.Security; -using Mono.Security.X509; - -namespace Mono.Security.Authenticode { - - // References: - // a. http://www.cs.auckland.ac.nz/~pgut001/pubs/authenticode.txt - - public class AuthenticodeDeformatter : AuthenticodeBase { - - private string filename; - private byte[] hash; - private X509CertificateCollection coll; - private ASN1 signedHash; - private DateTime timestamp; - private X509Certificate signingCertificate; - private int reason; - - private X509Chain signerChain; - private X509Chain timestampChain; - - public AuthenticodeDeformatter () : base () - { - reason = -1; - signerChain = new X509Chain (); - timestampChain = new X509Chain (); - } - - public AuthenticodeDeformatter (string fileName) : this () - { - CheckSignature (fileName); - } - - public string FileName { - get { return filename; } - set { CheckSignature (value); } - } - - public byte[] Hash { - get { - if (signedHash == null) - return null; - return signedHash.Value; - } - } - - public int Reason { - get { - if (reason == -1) - IsTrusted (); - return reason; - } - } - - public bool IsTrusted () - { - if (rawData == null) { - reason = 1; - return false; - } - - if (signingCertificate == null) { - reason = 7; - return false; - } - - if (signerChain.Root == null) { - reason = 6; - return false; - } - - if (timestamp != DateTime.MinValue) { - if (timestampChain.Root == null) { - reason = 6; - return false; - } - - // check that file was timestamped when certificates were valid - if (!signingCertificate.WasCurrent (Timestamp)) { - reason = 4; - return false; - } - } - else if (!signingCertificate.IsCurrent) { - // signature only valid if the certificate is valid - reason = 8; - return false; - } - - reason = 0; - return true; - } - - public byte[] Signature { - get { return rawData; } - } - - public DateTime Timestamp { - get { return timestamp; } - } - - public X509CertificateCollection Certificates { - get { return coll; } - } - - private bool CheckSignature (string fileName) - { - filename = fileName; - - // by default we try with MD5 - string hashName = "MD5"; - // compare the signature's hash with the hash of the file - hash = HashFile (filename, hashName); - - // is a signature present ? - if (rawData == null) - return false; - - PKCS7.ContentInfo ci = new PKCS7.ContentInfo (rawData); - if (ci.ContentType != PKCS7.signedData) - return false; - - PKCS7.SignedData sd = new PKCS7.SignedData (ci.Content); - if (sd.ContentInfo.ContentType != spcIndirectDataContext) - return false; - - coll = sd.Certificates; - - ASN1 spc = sd.ContentInfo.Content; - signedHash = spc [0][1][1]; - if (signedHash.Length == 20) { - // seems to be SHA-1, restart hashing - hashName = "SHA1"; - hash = HashFile (filename, hashName); - } - - if (!signedHash.CompareValue (hash)) - return false; - - // messageDigest is a hash of spcIndirectDataContext (which includes the file hash) - byte[] spcIDC = spc [0].Value; - HashAlgorithm ha = HashAlgorithm.Create (hashName); - byte[] messageDigest = ha.ComputeHash (spcIDC); - - return VerifySignature (sd, messageDigest, hashName); - } - - private bool CompareIssuerSerial (string issuer, byte[] serial, X509Certificate x509) - { - if (issuer != x509.IssuerName) - return false; - if (serial.Length != x509.SerialNumber.Length) - return false; - // MS shows the serial number inversed (so is Mono.Security.X509.X509Certificate) - int n = serial.Length; - for (int i=0; i < serial.Length; i++) { - if (serial [i] != x509.SerialNumber [--n]) - return false; - } - // must be true - return true; - } - - //private bool VerifySignature (ASN1 cs, byte[] calculatedMessageDigest, string hashName) - private bool VerifySignature (PKCS7.SignedData sd, byte[] calculatedMessageDigest, string hashName) - { - string contentType = null; - ASN1 messageDigest = null; - string spcStatementType = null; - string spcSpOpusInfo = null; - - for (int i=0; i < sd.SignerInfo.AuthenticatedAttributes.Count; i++) { - ASN1 attr = (ASN1) sd.SignerInfo.AuthenticatedAttributes [i]; - string oid = ASN1Convert.ToOID (attr[0]); - switch (oid) { - case "1.2.840.113549.1.9.3": - // contentType - contentType = ASN1Convert.ToOID (attr[1][0]); - break; - case "1.2.840.113549.1.9.4": - // messageDigest - messageDigest = attr[1][0]; - break; - case "1.3.6.1.4.1.311.2.1.11": - // spcStatementType (Microsoft code signing) - // possible values - // - individualCodeSigning (1 3 6 1 4 1 311 2 1 21) - // - commercialCodeSigning (1 3 6 1 4 1 311 2 1 22) - spcStatementType = ASN1Convert.ToOID (attr[1][0][0]); - break; - case "1.3.6.1.4.1.311.2.1.12": - // spcSpOpusInfo (Microsoft code signing) - try { - spcSpOpusInfo = System.Text.Encoding.UTF8.GetString (attr[1][0][1][0].Value); - } - catch { - spcSpOpusInfo = null; - } - break; - default: - break; - } - } - if (contentType != spcIndirectDataContext) - return false; - - // verify message digest - if (messageDigest == null) - return false; - if (!messageDigest.CompareValue (calculatedMessageDigest)) - return false; - - // verify signature - string hashOID = CryptoConfig.MapNameToOID (hashName); - - // change to SET OF (not [0]) as per PKCS #7 1.5 - ASN1 aa = new ASN1 (0x31); - foreach (ASN1 a in sd.SignerInfo.AuthenticatedAttributes) - aa.Add (a); - HashAlgorithm ha = HashAlgorithm.Create (hashName); - byte[] p7hash = ha.ComputeHash (aa.GetBytes ()); - - byte[] signature = sd.SignerInfo.Signature; - // we need to find the specified certificate - string issuer = sd.SignerInfo.IssuerName; - byte[] serial = sd.SignerInfo.SerialNumber; - foreach (X509Certificate x509 in coll) { - if (CompareIssuerSerial (issuer, serial, x509)) { - // don't verify is key size don't match - if (x509.PublicKey.Length > (signature.Length >> 3)) { - RSACryptoServiceProvider rsa = (RSACryptoServiceProvider) x509.RSA; - if (rsa.VerifyHash (p7hash, hashOID, signature)) { - signerChain.LoadCertificates (coll); - if (signerChain.GetChain (x509) != null) - signingCertificate = x509; - else - return false; - } - } - } - } - - for (int i=0; i < sd.SignerInfo.UnauthenticatedAttributes.Count; i++) { - ASN1 attr = (ASN1) sd.SignerInfo.UnauthenticatedAttributes [i]; - string oid = ASN1Convert.ToOID (attr [0]); - switch (oid) { - case PKCS7.countersignature: - // SEQUENCE { - // OBJECT IDENTIFIER - // countersignature (1 2 840 113549 1 9 6) - // SET { - PKCS7.SignerInfo cs = new PKCS7.SignerInfo (attr [1]); - return VerifyCounterSignature (cs, signature, hashName); - default: - // we don't support other unauthenticated attributes - break; - } - } - - return true; - } - - //private bool VerifyCounterSignature (ASN1 cs, byte[] signature, string hashName) - private bool VerifyCounterSignature (PKCS7.SignerInfo cs, byte[] signature, string hashName) - { - // SEQUENCE { - // INTEGER 1 - if (cs.Version != 1) - return false; - // SEQUENCE { - // SEQUENCE { - - string contentType = null; - ASN1 messageDigest = null; - for (int i=0; i < cs.AuthenticatedAttributes.Count; i++) { - // SEQUENCE { - // OBJECT IDENTIFIER - ASN1 attr = (ASN1) cs.AuthenticatedAttributes [i]; - string oid = ASN1Convert.ToOID (attr[0]); - switch (oid) { - case "1.2.840.113549.1.9.3": - // contentType - contentType = ASN1Convert.ToOID (attr[1][0]); - break; - case "1.2.840.113549.1.9.4": - // messageDigest - messageDigest = attr[1][0]; - break; - case "1.2.840.113549.1.9.5": - // SEQUENCE { - // OBJECT IDENTIFIER - // signingTime (1 2 840 113549 1 9 5) - // SET { - // UTCTime '030124013651Z' - // } - // } - timestamp = ASN1Convert.ToDateTime (attr[1][0]); - break; - default: - break; - } - } - - if (contentType != PKCS7.data) - return false; - - // verify message digest - if (messageDigest == null) - return false; - // TODO: must be read from the ASN.1 structure - switch (messageDigest.Length) { - case 16: - hashName = "MD5"; - break; - case 20: - hashName = "SHA1"; - break; - } - HashAlgorithm ha = HashAlgorithm.Create (hashName); - if (!messageDigest.CompareValue (ha.ComputeHash (signature))) - return false; - - // verify signature - byte[] counterSignature = cs.Signature; - string hashOID = CryptoConfig.MapNameToOID (hashName); - - // change to SET OF (not [0]) as per PKCS #7 1.5 - ASN1 aa = new ASN1 (0x31); - foreach (ASN1 a in cs.AuthenticatedAttributes) - aa.Add (a); - byte[] p7hash = ha.ComputeHash (aa.GetBytes ()); - - // we need to try all certificates - string issuer = cs.IssuerName; - byte[] serial = cs.SerialNumber; - foreach (X509Certificate x509 in coll) { - if (CompareIssuerSerial (issuer, serial, x509)) { - // don't verify is key size don't match - if (x509.PublicKey.Length > (counterSignature.Length >> 3)) { - RSACryptoServiceProvider rsa = (RSACryptoServiceProvider) x509.RSA; - if (rsa.VerifyHash (p7hash, hashOID, counterSignature)) { - timestampChain.LoadCertificates (coll); - return (timestampChain.GetChain (x509) != null); - } - } - } - } - // no certificate can verify this signature! - return false; - } - } -} diff --git a/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeFormatter.cs b/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeFormatter.cs deleted file mode 100755 index 1410cc88f62..00000000000 --- a/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeFormatter.cs +++ /dev/null @@ -1,297 +0,0 @@ -// -// AuthenticodeFormatter.cs: Authenticode signature generator -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Collections; -using System.IO; -using System.Security.Cryptography; -//using System.Security.Cryptography.X509Certificates; -using System.Text; -using System.Net; - -using Mono.Security; -using Mono.Security.X509; - -namespace Mono.Security.Authenticode { - - public class AuthenticodeFormatter : AuthenticodeBase { - - private Authority authority; - private X509CertificateCollection certs; - private ArrayList crls; - private string hash; - private RSA rsa; - private string timestamp; - private ASN1 authenticode; - private PKCS7.SignedData pkcs7; - private string description; - private string url; - - public AuthenticodeFormatter () : base () - { - certs = new X509CertificateCollection (); - crls = new ArrayList (); - authority = Authority.Maximum; - pkcs7 = new PKCS7.SignedData (); - } - - public Authority Authority { - get { return authority; } - set { authority = value; } - } - - public X509CertificateCollection Certificates { - get { return certs; } - } - - public ArrayList CRL { - get { return crls; } - } - - public string Hash { - get { - if (hash == null) - hash = "MD5"; - return hash; - } - set { - string h = value.ToUpper (); - if ((h == "MD5") || (hash == "SHA1")) - hash = value; - else - throw new ArgumentException ("Invalid Authenticode hash algorithm"); - } - } - - public RSA RSA { - get { return rsa; } - set { rsa = value; } - } - - public string TimestampURL { - get { return timestamp; } - set { timestamp = value; } // URL - } - - public string Description { - get { return description; } - set { description = value; } - } - - public string URL { - get { return url; } - set { url = value; } // URL - } - - private ASN1 AlgorithmIdentifier (string oid) - { - ASN1 ai = new ASN1 (0x30); - ai.Add (ASN1Convert.FromOID (oid)); - ai.Add (new ASN1 (0x05)); // NULL - return ai; - } - - private ASN1 Attribute (string oid, ASN1 value) - { - ASN1 attr = new ASN1 (0x30); - attr.Add (ASN1Convert.FromOID (oid)); - ASN1 aset = attr.Add (new ASN1 (0x31)); - aset.Add (value); - return attr; - } - - private ASN1 Opus (string description, string url) - { - ASN1 opus = new ASN1 (0x30); - if (description != null) { - ASN1 part1 = opus.Add (new ASN1 (0xA0)); - part1.Add (new ASN1 (0x80, Encoding.BigEndianUnicode.GetBytes (description))); - } - if (url != null) { - ASN1 part2 = opus.Add (new ASN1 (0xA1)); - part2.Add (new ASN1 (0x80, Encoding.ASCII.GetBytes (url))); - } - return opus; - } - - // pkcs 1 - private const string rsaEncryption = "1.2.840.113549.1.1.1"; - // pkcs 7 - private const string data = "1.2.840.113549.1.7.1"; - private const string signedData = "1.2.840.113549.1.7.2"; - // pkcs 9 - private const string contentType = "1.2.840.113549.1.9.3"; - private const string messageDigest = "1.2.840.113549.1.9.4"; - private const string countersignature = "1.2.840.113549.1.9.6"; - // microsoft spc (software publisher certificate) - private const string spcStatementType = "1.3.6.1.4.1.311.2.1.11"; - private const string spcSpOpusInfo = "1.3.6.1.4.1.311.2.1.12"; - private const string spcPelmageData = "1.3.6.1.4.1.311.2.1.15"; - private const string individualCodeSigning = "1.3.6.1.4.1.311.2.1.21"; - private const string commercialCodeSigning = "1.3.6.1.4.1.311.2.1.22"; - private const string timestampCountersignature = "1.3.6.1.4.1.311.3.2.1"; - - private static byte[] version = { 0x01 }; - private static byte[] obsolete = { 0x03, 0x01, 0x00, 0xA0, 0x20, 0xA2, 0x1E, 0x80, 0x1C, 0x00, 0x3C, 0x00, 0x3C, 0x00, 0x3C, 0x00, 0x4F, 0x00, 0x62, 0x00, 0x73, 0x00, 0x6F, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x74, 0x00, 0x65, 0x00, 0x3E, 0x00, 0x3E, 0x00, 0x3E }; - - private byte[] Header (byte[] fileHash, string hashAlgorithm) - { - string hashOid = CryptoConfig.MapNameToOID (hashAlgorithm); - ASN1 content = new ASN1 (0x30); - ASN1 c1 = content.Add (new ASN1 (0x30)); - c1.Add (ASN1Convert.FromOID (spcPelmageData)); - c1.Add (new ASN1 (0x30, obsolete)); - ASN1 c2 = content.Add (new ASN1 (0x30)); - c2.Add (AlgorithmIdentifier (hashOid)); - c2.Add (new ASN1 (0x04, fileHash)); - - pkcs7.HashName = hashAlgorithm; - pkcs7.Certificates.AddRange (certs); - pkcs7.ContentInfo.ContentType = spcIndirectDataContext; - pkcs7.ContentInfo.Content.Add (content); - - pkcs7.SignerInfo.Certificate = certs [0]; - pkcs7.SignerInfo.Key = rsa; - pkcs7.SignerInfo.AuthenticatedAttributes.Add (Attribute (spcSpOpusInfo, Opus (description, url))); - pkcs7.SignerInfo.AuthenticatedAttributes.Add (Attribute (contentType, ASN1Convert.FromOID (spcIndirectDataContext))); - pkcs7.SignerInfo.AuthenticatedAttributes.Add (Attribute (spcStatementType, new ASN1 (0x30, ASN1Convert.FromOID (commercialCodeSigning).GetBytes ()))); - - ASN1 temp = pkcs7.ASN1; // sign - return pkcs7.SignerInfo.Signature; - } - - public ASN1 TimestampRequest (byte[] signature) - { - PKCS7.ContentInfo ci = new PKCS7.ContentInfo (PKCS7.data); - ci.Content.Add (new ASN1 (0x04, signature)); - return PKCS7.AlgorithmIdentifier (timestampCountersignature, ci.ASN1); - } - - public void ProcessTimestamp (byte[] tsres) - { - ASN1 ts = new ASN1 (Convert.FromBase64String (Encoding.ASCII.GetString (tsres))); - // first validate the received message - // TODO - - // add the supplied certificates inside our signature - for (int i=0; i < ts[1][0][3].Count; i++) - pkcs7.Certificates.Add (new X509Certificate (ts[1][0][3][i].GetBytes ())); - - // add an unauthentified attribute to our signature - pkcs7.SignerInfo.UnauthenticatedAttributes.Add (Attribute (countersignature, ts[1][0][4][0])); - } - - public bool Sign (string fileName) - { - string hashAlgorithm = "MD5"; - FileStream fs = new FileStream (fileName, FileMode.Open, FileAccess.Read, FileShare.Read); - byte[] file = new byte [fs.Length]; - fs.Read (file, 0, file.Length); - fs.Close (); - - // MZ - DOS header - if (BitConverter.ToUInt16 (file, 0) != 0x5A4D) - return false; - - // find offset of PE header - int peOffset = BitConverter.ToInt32 (file, 60); - if (peOffset > file.Length) - return false; - - // PE - NT header - if (BitConverter.ToUInt16 (file, peOffset) != 0x4550) - return false; - - // IMAGE_DIRECTORY_ENTRY_SECURITY - int dirSecurityOffset = BitConverter.ToInt32 (file, peOffset + 152); - int dirSecuritySize = BitConverter.ToInt32 (file, peOffset + 156); - - if (dirSecuritySize > 8) { - rawData = new byte [dirSecuritySize - 8]; - Array.Copy (file, dirSecurityOffset + 8, rawData, 0, rawData.Length); - } - else - rawData = null; - - HashAlgorithm hash = HashAlgorithm.Create (hashAlgorithm); - // 0 to 215 (216) then skip 4 (checksum) - int pe = peOffset + 88; - hash.TransformBlock (file, 0, pe, file, 0); - pe += 4; - // 220 to 279 (60) then skip 8 (IMAGE_DIRECTORY_ENTRY_SECURITY) - hash.TransformBlock (file, pe, 60, file, pe); - pe += 68; - // 288 to end of file - int n = file.Length - pe; - // minus any authenticode signature (with 8 bytes header) - if (dirSecurityOffset != 0) - n -= (dirSecuritySize); - hash.TransformFinalBlock (file, pe, n); - - // - byte[] signature = Header (hash.Hash, hashAlgorithm); - if (timestamp != null) { - ASN1 tsreq = TimestampRequest (signature); - WebClient wc = new WebClient (); - wc.Headers.Add ("Content-Type", "application/octet-stream"); - wc.Headers.Add ("Accept", "application/octet-stream"); - byte[] tsdata = Encoding.ASCII.GetBytes (Convert.ToBase64String (tsreq.GetBytes ())); - byte[] tsres = wc.UploadData (timestamp, tsdata); - ProcessTimestamp (tsres); - } - PKCS7.ContentInfo sign = new PKCS7.ContentInfo (signedData); - sign.Content.Add (pkcs7.ASN1); - authenticode = sign.ASN1; - - // debug - fs = File.Open (fileName + ".sig", FileMode.Create, FileAccess.Write); - byte[] asn = authenticode.GetBytes (); - fs.Write (asn, 0, asn.Length); - fs.Close (); - - File.Copy (fileName, fileName + ".bak", true); - - fs = File.Open (fileName, FileMode.Create, FileAccess.Write); - // IMAGE_DIRECTORY_ENTRY_SECURITY (offset, size) - byte[] data = BitConverter.GetBytes (file.Length); - file [peOffset + 152] = data [0]; - file [peOffset + 153] = data [1]; - file [peOffset + 154] = data [2]; - file [peOffset + 155] = data [3]; - int size = asn.Length + 8; - // must be a multiple of 8 bytes - int addsize = (size % 8); - if (addsize > 0) - addsize = 8 - addsize; - size += addsize; - data = BitConverter.GetBytes (size); // header - file [peOffset + 156] = data [0]; - file [peOffset + 157] = data [1]; - file [peOffset + 158] = data [2]; - file [peOffset + 159] = data [3]; - fs.Write (file, 0, file.Length); - fs.Write (data, 0, data.Length); // length (again) - data = BitConverter.GetBytes (0x00020200); // magic - fs.Write (data, 0, data.Length); - fs.Write (asn, 0, asn.Length); - // fill up - byte[] fillup = new byte [addsize]; - fs.Write (fillup, 0, fillup.Length); - fs.Close (); - - return true; - } - - // in case we just want to timestamp the file - public bool Timestamp (string fileName) - { - return true; - } - } -} diff --git a/mcs/class/Mono.Security/Mono.Security.Authenticode/ChangeLog b/mcs/class/Mono.Security/Mono.Security.Authenticode/ChangeLog index caa31ff19ff..0acf2ed937c 100644 --- a/mcs/class/Mono.Security/Mono.Security.Authenticode/ChangeLog +++ b/mcs/class/Mono.Security/Mono.Security.Authenticode/ChangeLog @@ -1,14 +1,3 @@ -2003-09-01 Sebastien Pouliot <spouliot@videotron.ca> - - * AuthenticodeBase.cs: New. Base class including how to hash a - PE file. - * AuthenticodeDeformatter.cs: New. Class to decode Authenticode(tm) - signatures. - * AuthenticodeFormatter.cs: New. Class to encode a Authenticode(tm) - signature, and optionally a timestamp, into a PE file. - * SoftwarePublisherCertificate.cs: Now use Mono.Security.X509. - X509Certificate class. - 2003-06-19 Nick Drochak <ndrochak@gol.com> * PrivateKey.cs: Work around for mcs? bug 45127. diff --git a/mcs/class/Mono.Security/Mono.Security.Authenticode/SoftwarePublisherCertificate.cs b/mcs/class/Mono.Security/Mono.Security.Authenticode/SoftwarePublisherCertificate.cs index 0c7026b2519..f7bd219bf63 100644 --- a/mcs/class/Mono.Security/Mono.Security.Authenticode/SoftwarePublisherCertificate.cs +++ b/mcs/class/Mono.Security/Mono.Security.Authenticode/SoftwarePublisherCertificate.cs @@ -11,9 +11,9 @@ using System; using System.Collections; using System.IO; +using System.Security.Cryptography.X509Certificates; using Mono.Security; -using Mono.Security.X509; namespace Mono.Security.Authenticode { diff --git a/mcs/class/Mono.Security/Mono.Security.X509.Extensions/ChangeLog b/mcs/class/Mono.Security/Mono.Security.X509.Extensions/ChangeLog index a2d595df22f..5ac3fe1eb58 100644 --- a/mcs/class/Mono.Security/Mono.Security.X509.Extensions/ChangeLog +++ b/mcs/class/Mono.Security/Mono.Security.X509.Extensions/ChangeLog @@ -1,7 +1,3 @@ -2003-09-05 Sebastien Pouliot <spouliot@videotron.ca> - - * KeyAttributesExtension.cs: New. Added for WSE. - 2003-07-30 Sebastien Pouliot <spouliot@videotron.ca> * ExtendedKeyUsageExtension.cs: New. Added for makecert. diff --git a/mcs/class/Mono.Security/Mono.Security.X509.Extensions/KeyAttributesExtension.cs b/mcs/class/Mono.Security/Mono.Security.X509.Extensions/KeyAttributesExtension.cs deleted file mode 100755 index acf775fffbe..00000000000 --- a/mcs/class/Mono.Security/Mono.Security.X509.Extensions/KeyAttributesExtension.cs +++ /dev/null @@ -1,205 +0,0 @@ -// -// KeyAttributesExtension.cs: Handles X.509 *DEPRECATED* KeyAttributes extensions. -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Text; - -using Mono.Security; -using Mono.Security.X509; - -namespace Mono.Security.X509.Extensions { - // definition found @ http://groups.yahoo.com/group/ssl-talk/message/1964 - // - // keyAttributes EXTENSION ::= { - // SYNTAX KeyAttributes - // IDENTIFIED BY { id-ce 2 } } - // - // KeyAttributes ::= SEQUENCE { - // keyIdentifier KeyIdentifier OPTIONAL, - // intendedKeyUsage KeyUsage OPTIONAL, - // privateKeyUsagePeriod PrivateKeyValidity OPTIONAL - // } - // KeyUsage ::= BIT STRING { - // digitalSignature (0), - // nonRepudiation (1), - // keyEncipherment (2), - // dataEncipherment (3), - // keyAgreement (4), - // keyCertSign (5), - // offLineCRLSign (6) - // } - // PrivateKeyValidity ::= SEQUENCE { - // notBefore [0] GeneralizedTime OPTIONAL, - // notAfter [1] GeneralizedTime OPTIONAL - // } - // ( CONSTRAINED BY { -- at least one component shall be present -- }) - - public class KeyAttributesExtension : X509Extension { - - private byte[] keyId; - private int kubits; - private DateTime notBefore; - private DateTime notAfter; - - public KeyAttributesExtension () : base () - { - extnOid = "2.5.29.2"; - } - - public KeyAttributesExtension (ASN1 asn1) : base (asn1) {} - - public KeyAttributesExtension (X509Extension extension) : base (extension) {} - - protected override void Decode () - { - ASN1 seq = new ASN1 (extnValue.Value); - if (seq.Tag != 0x30) - throw new ArgumentException ("Invalid KeyAttributesExtension extension"); - int n = 0; - // check for KeyIdentifier - if (n < seq.Count) { - ASN1 item = seq [n]; - if (item.Tag == 0x04) { - n++; - keyId = item.Value; - } - } - // check for KeyUsage - if (n < seq.Count) { - ASN1 item = seq [n]; - if (item.Tag == 0x03) { - n++; - int i = 1; // byte zero has the number of unused bits (ASN1's BITSTRING) - while (i < item.Value.Length) - kubits = (kubits << 8) + item.Value [i++]; - } - } - // check for PrivateKeyValidity - if (n < seq.Count) { - ASN1 item = seq [n]; - if (item.Tag == 0x30) { - int i = 0; - if (i < item.Count) { - ASN1 dt = item [i]; - if (dt.Tag == 0x81) { - i++; - notBefore = ASN1Convert.ToDateTime (dt); - } - } - if (i < item.Count) { - ASN1 dt = item [i]; - if (dt.Tag == 0x82) - notAfter = ASN1Convert.ToDateTime (dt); - } - } - } - } - - public byte[] KeyIdentifier { - get { return keyId; } - } - - public override string Name { - get { return "Key Attributes"; } - } - - public DateTime NotAfter { - get { return notAfter; } - } - - public DateTime NotBefore { - get { return notBefore; } - } - - public bool Support (KeyUsage usage) - { - int x = Convert.ToInt32 (usage); - return ((x & kubits) == x); - } - - public override string ToString () - { - StringBuilder sb = new StringBuilder (); - if (keyId != null) { - sb.Append ("KeyID="); - int x = 0; - while (x < keyId.Length) { - sb.Append (keyId [x].ToString ("X2")); - if (x % 2 == 1) - sb.Append (" "); - x++; - } - sb.Append (Environment.NewLine); - } - - if (kubits != 0) { - sb.Append ("Key Usage="); - const string separator = " , "; - if (Support (KeyUsage.digitalSignature)) - sb.Append ("Digital Signature"); - if (Support (KeyUsage.nonRepudiation)) { - if (sb.Length > 0) - sb.Append (separator); - sb.Append ("Non-Repudiation"); - } - if (Support (KeyUsage.keyEncipherment)) { - if (sb.Length > 0) - sb.Append (separator); - sb.Append ("Key Encipherment"); - } - if (Support (KeyUsage.dataEncipherment)) { - if (sb.Length > 0) - sb.Append (separator); - sb.Append ("Data Encipherment"); - } - if (Support (KeyUsage.keyAgreement)) { - if (sb.Length > 0) - sb.Append (separator); - sb.Append ("Key Agreement"); - } - if (Support (KeyUsage.keyCertSign)) { - if (sb.Length > 0) - sb.Append (separator); - sb.Append ("Certificate Signing"); - } - if (Support (KeyUsage.cRLSign)) { - if (sb.Length > 0) - sb.Append (separator); - sb.Append ("CRL Signing"); - } - if (Support (KeyUsage.encipherOnly)) { - if (sb.Length > 0) - sb.Append (separator); - sb.Append ("Encipher Only "); // ??? - } - if (Support (KeyUsage.decipherOnly)) { - if (sb.Length > 0) - sb.Append (separator); - sb.Append ("Decipher Only"); // ??? - } - sb.Append ("("); - sb.Append (kubits.ToString ("X2")); - sb.Append (")"); - sb.Append (Environment.NewLine); - } - - if (notBefore != DateTime.MinValue) { - sb.Append ("Not Before="); - sb.Append (notBefore.ToString ()); - sb.Append (Environment.NewLine); - } - if (notAfter != DateTime.MinValue) { - sb.Append ("Not After="); - sb.Append (notAfter.ToString ()); - sb.Append (Environment.NewLine); - } - return sb.ToString (); - } - } -} diff --git a/mcs/class/Mono.Security/Mono.Security.X509/ChangeLog b/mcs/class/Mono.Security/Mono.Security.X509/ChangeLog index 10827587450..c8f9e2bae70 100644 --- a/mcs/class/Mono.Security/Mono.Security.X509/ChangeLog +++ b/mcs/class/Mono.Security/Mono.Security.X509/ChangeLog @@ -1,15 +1,3 @@ -2003-09-01 Sebastien Pouliot <spouliot@videotron.ca> - - * ITrustAnchors.cs: New. Interface to trust anchors. - * TestAnchors.cs: New. Include 2 tests anchors: Microsoft Root Agency - (for Windows compatibility) and Mono Test Root. - * TrustAnchors.cs: New. Include some widely used (commercial) code - signing root certificates. - * X509CertificateCollection.cs: New. Collection for Mono's X509 - certificates. - * X509Chain.cs: New. MINIMAL certificate chaining engine to support - Authenticode(tm). VERY PARTIAL IMPLEMENTATION!!! - 2003-03-15 Sebastien Pouliot <spouliot@videotron.ca> * X501Name.cs: New. X.501 Distinguished Names stuff diff --git a/mcs/class/Mono.Security/Mono.Security.X509/ITrustAnchors.cs b/mcs/class/Mono.Security/Mono.Security.X509/ITrustAnchors.cs deleted file mode 100755 index 3cadbec174f..00000000000 --- a/mcs/class/Mono.Security/Mono.Security.X509/ITrustAnchors.cs +++ /dev/null @@ -1,18 +0,0 @@ -// -// ITrustAnchors.cs: Trust Anchors Interface -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Mono.Security.X509 { - - public interface ITrustAnchors - { - X509CertificateCollection Anchors { get; } - } -} diff --git a/mcs/class/Mono.Security/Mono.Security.X509/TestAnchors.cs b/mcs/class/Mono.Security/Mono.Security.X509/TestAnchors.cs deleted file mode 100755 index d0470507fc3..00000000000 --- a/mcs/class/Mono.Security/Mono.Security.X509/TestAnchors.cs +++ /dev/null @@ -1,109 +0,0 @@ -// -// TestAnchors.cs: Trust Anchors for development and debugging -// include test certificates for Microsoft (root agency) and Mono -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Mono.Security.X509 { - - public class TestAnchors : TrustAnchors { - - static byte[] rootagency = { - 0x30, 0x82, 0x01, 0xCA, 0x30, 0x82, 0x01, 0x74, 0xA0, 0x03, 0x02, 0x01, - 0x02, 0x02, 0x10, 0x06, 0x37, 0x6C, 0x00, 0xAA, 0x00, 0x64, 0x8A, 0x11, - 0xCF, 0xB8, 0xD4, 0xAA, 0x5C, 0x35, 0xF4, 0x30, 0x0D, 0x06, 0x09, 0x2A, - 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x04, 0x05, 0x00, 0x30, 0x16, - 0x31, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0B, 0x52, - 0x6F, 0x6F, 0x74, 0x20, 0x41, 0x67, 0x65, 0x6E, 0x63, 0x79, 0x30, 0x1E, - 0x17, 0x0D, 0x39, 0x36, 0x30, 0x35, 0x32, 0x38, 0x32, 0x32, 0x30, 0x32, - 0x35, 0x39, 0x5A, 0x17, 0x0D, 0x33, 0x39, 0x31, 0x32, 0x33, 0x31, 0x32, - 0x33, 0x35, 0x39, 0x35, 0x39, 0x5A, 0x30, 0x16, 0x31, 0x14, 0x30, 0x12, - 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0B, 0x52, 0x6F, 0x6F, 0x74, 0x20, - 0x41, 0x67, 0x65, 0x6E, 0x63, 0x79, 0x30, 0x5B, 0x30, 0x0D, 0x06, 0x09, - 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, - 0x4A, 0x00, 0x30, 0x47, 0x02, 0x40, 0x81, 0x55, 0x22, 0xB9, 0x8A, 0xA4, - 0x6F, 0xED, 0xD6, 0xE7, 0xD9, 0x66, 0x0F, 0x55, 0xBC, 0xD7, 0xCD, 0xD5, - 0xBC, 0x4E, 0x40, 0x02, 0x21, 0xA2, 0xB1, 0xF7, 0x87, 0x30, 0x85, 0x5E, - 0xD2, 0xF2, 0x44, 0xB9, 0xDC, 0x9B, 0x75, 0xB6, 0xFB, 0x46, 0x5F, 0x42, - 0xB6, 0x9D, 0x23, 0x36, 0x0B, 0xDE, 0x54, 0x0F, 0xCD, 0xBD, 0x1F, 0x99, - 0x2A, 0x10, 0x58, 0x11, 0xCB, 0x40, 0xCB, 0xB5, 0xA7, 0x41, 0x02, 0x03, - 0x01, 0x00, 0x01, 0xA3, 0x81, 0x9E, 0x30, 0x81, 0x9B, 0x30, 0x50, 0x06, - 0x03, 0x55, 0x04, 0x03, 0x04, 0x49, 0x13, 0x47, 0x46, 0x6F, 0x72, 0x20, - 0x54, 0x65, 0x73, 0x74, 0x69, 0x6E, 0x67, 0x20, 0x50, 0x75, 0x72, 0x70, - 0x6F, 0x73, 0x65, 0x73, 0x20, 0x4F, 0x6E, 0x6C, 0x79, 0x20, 0x53, 0x61, - 0x6D, 0x70, 0x6C, 0x65, 0x20, 0x53, 0x6F, 0x66, 0x74, 0x77, 0x61, 0x72, - 0x65, 0x20, 0x50, 0x75, 0x62, 0x6C, 0x69, 0x73, 0x68, 0x69, 0x6E, 0x67, - 0x20, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6E, 0x74, 0x69, 0x61, 0x6C, 0x73, - 0x20, 0x41, 0x67, 0x65, 0x6E, 0x63, 0x79, 0x30, 0x47, 0x06, 0x03, 0x55, - 0x1D, 0x01, 0x04, 0x40, 0x30, 0x3E, 0x80, 0x10, 0x12, 0xE4, 0x09, 0x2D, - 0x06, 0x1D, 0x1D, 0x4F, 0x00, 0x8D, 0x61, 0x21, 0xDC, 0x16, 0x64, 0x63, - 0xA1, 0x18, 0x30, 0x16, 0x31, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x04, - 0x03, 0x13, 0x0B, 0x52, 0x6F, 0x6F, 0x74, 0x20, 0x41, 0x67, 0x65, 0x6E, - 0x63, 0x79, 0x82, 0x10, 0x06, 0x37, 0x6C, 0x00, 0xAA, 0x00, 0x64, 0x8A, - 0x11, 0xCF, 0xB8, 0xD4, 0xAA, 0x5C, 0x35, 0xF4, 0x30, 0x0D, 0x06, 0x09, - 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x04, 0x05, 0x00, 0x03, - 0x41, 0x00, 0x2D, 0x2E, 0x3E, 0x7B, 0x89, 0x42, 0x89, 0x3F, 0xA8, 0x21, - 0x17, 0xFA, 0xF0, 0xF5, 0xC3, 0x95, 0xDB, 0x62, 0x69, 0x5B, 0xC9, 0xDC, - 0xC1, 0xB3, 0xFA, 0xF0, 0xC4, 0x6F, 0x6F, 0x64, 0x9A, 0xBD, 0xE7, 0x1B, - 0x25, 0x68, 0x72, 0x83, 0x67, 0xBD, 0x56, 0xB0, 0x8D, 0x01, 0xBD, 0x2A, - 0xF7, 0xCC, 0x4B, 0xBD, 0x87, 0xA5, 0xBA, 0x87, 0x20, 0x4C, 0x42, 0x11, - 0x41, 0xAD, 0x10, 0x17, 0x3B, 0x8C }; - - static byte[] monoTestRoot = { - 0x30, 0x82, 0x01, 0xC2, 0x30, 0x82, 0x01, 0x2B, 0xA0, 0x03, 0x02, 0x01, - 0x02, 0x02, 0x10, 0x28, 0xF4, 0x76, 0x38, 0x91, 0x74, 0x0E, 0x48, 0x85, - 0xC7, 0x6E, 0x88, 0x4F, 0xE1, 0xB0, 0x69, 0x30, 0x0D, 0x06, 0x09, 0x2A, - 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x04, 0x05, 0x00, 0x30, 0x20, - 0x31, 0x1E, 0x30, 0x1C, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x15, 0x4D, - 0x6F, 0x6E, 0x6F, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x52, 0x6F, 0x6F, - 0x74, 0x20, 0x41, 0x67, 0x65, 0x6E, 0x63, 0x79, 0x30, 0x1E, 0x17, 0x0D, - 0x30, 0x33, 0x30, 0x39, 0x30, 0x31, 0x31, 0x35, 0x35, 0x35, 0x34, 0x38, - 0x5A, 0x17, 0x0D, 0x33, 0x39, 0x31, 0x32, 0x33, 0x31, 0x31, 0x38, 0x35, - 0x39, 0x35, 0x39, 0x5A, 0x30, 0x20, 0x31, 0x1E, 0x30, 0x1C, 0x06, 0x03, - 0x55, 0x04, 0x03, 0x13, 0x15, 0x4D, 0x6F, 0x6E, 0x6F, 0x20, 0x54, 0x65, - 0x73, 0x74, 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x20, 0x41, 0x67, 0x65, 0x6E, - 0x63, 0x79, 0x30, 0x81, 0x9E, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, - 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81, 0x8C, 0x00, - 0x30, 0x81, 0x88, 0x02, 0x81, 0x80, 0xBF, 0xFE, 0x27, 0x00, 0xB0, 0x71, - 0x08, 0x4F, 0xBD, 0x26, 0x01, 0x02, 0xD0, 0xB9, 0xC3, 0x52, 0xF2, 0xA1, - 0xE9, 0xEF, 0x7A, 0x3F, 0x04, 0xE9, 0x37, 0x84, 0x63, 0xFA, 0xF5, 0xA7, - 0xA8, 0xA4, 0xFB, 0x20, 0x0A, 0x75, 0x88, 0xAF, 0xC9, 0x8E, 0xEA, 0xAF, - 0x02, 0x0E, 0x83, 0x43, 0x6B, 0xD3, 0x7E, 0xFD, 0x1D, 0x4E, 0x5A, 0x9F, - 0x7E, 0x61, 0xC7, 0xE7, 0x53, 0xB2, 0x8A, 0x8A, 0x6B, 0x71, 0x3E, 0x67, - 0xCF, 0x17, 0x12, 0x4E, 0xC6, 0x5B, 0xFF, 0xD8, 0xDC, 0x1D, 0x27, 0x06, - 0xD2, 0xCD, 0xFF, 0x15, 0x12, 0x16, 0x9D, 0x77, 0x8B, 0x93, 0xF7, 0xE0, - 0x9B, 0xB9, 0x92, 0x62, 0x18, 0xD4, 0x68, 0x73, 0x48, 0xD2, 0x6D, 0x7F, - 0x35, 0x34, 0xE4, 0xB6, 0x2A, 0x62, 0x72, 0x32, 0xB1, 0xA3, 0xBD, 0x61, - 0x18, 0x88, 0x3D, 0xAA, 0xE7, 0x02, 0x5A, 0x70, 0xEE, 0x9B, 0xE2, 0xAB, - 0x87, 0xF9, 0x02, 0x03, 0x01, 0x00, 0x01, 0x30, 0x0D, 0x06, 0x09, 0x2A, - 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x04, 0x05, 0x00, 0x03, 0x81, - 0x81, 0x00, 0x8E, 0x08, 0xD7, 0x0F, 0x30, 0xB2, 0xFD, 0x3A, 0x5C, 0x94, - 0xA9, 0x56, 0xBE, 0x44, 0x77, 0xE3, 0xA3, 0x92, 0xBC, 0xB9, 0xE4, 0x95, - 0x68, 0xD4, 0xF4, 0xF9, 0x24, 0x4B, 0x2A, 0x79, 0x93, 0x57, 0x7E, 0x84, - 0x50, 0x3F, 0xA9, 0xC8, 0xDA, 0x9E, 0x08, 0x9C, 0x21, 0xE1, 0x10, 0xFC, - 0x1C, 0x5C, 0x4B, 0x60, 0x97, 0xBA, 0x55, 0xCB, 0x7C, 0xEA, 0xC3, 0x04, - 0x2F, 0x55, 0xBB, 0x16, 0x26, 0xCD, 0x87, 0x90, 0x30, 0x7F, 0xE0, 0xCF, - 0x24, 0x27, 0xB4, 0x3A, 0xD0, 0x9F, 0xC7, 0x55, 0xF8, 0x7C, 0xC9, 0xA0, - 0x72, 0xE4, 0x06, 0xF1, 0x4A, 0x5B, 0xBB, 0x71, 0x84, 0x8B, 0x76, 0x23, - 0x65, 0x1F, 0x1B, 0xEA, 0x96, 0x85, 0x13, 0x84, 0x0C, 0x8C, 0xCD, 0xDA, - 0x3D, 0x1F, 0xEB, 0xA9, 0xA7, 0xDF, 0xE0, 0xD1, 0xDC, 0x93, 0x21, 0x7A, - 0x10, 0xA7, 0x92, 0x63, 0x5D, 0xAB, 0xA2, 0x13, 0x37, 0xA4 }; - - static TestAnchors () - { - // add Microsoft Test Root for people who used MS makecert to create - // their Authenticode(tm) test certificates - coll.Add (new X509Certificate (rootagency)); - - // add Mono Test Root for people who used Mono makecert to create - // their Authenticode(tm) test certificates - coll.Add (new X509Certificate (monoTestRoot)); - } - } -} diff --git a/mcs/class/Mono.Security/Mono.Security.X509/TrustAnchors.cs b/mcs/class/Mono.Security/Mono.Security.X509/TrustAnchors.cs deleted file mode 100755 index 058fe1c5381..00000000000 --- a/mcs/class/Mono.Security/Mono.Security.X509/TrustAnchors.cs +++ /dev/null @@ -1,284 +0,0 @@ -// -// TrustAnchors.cs: "Official" default Trust Anchors for Mono -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Mono.Security.X509 { - - public class TrustAnchors : ITrustAnchors { - - static byte[] msroot = { - 0x30, 0x82, 0x04, 0x12, 0x30, 0x82, 0x02, 0xFA, 0xA0, 0x03, 0x02, 0x01, - 0x02, 0x02, 0x0F, 0x00, 0xC1, 0x00, 0x8B, 0x3C, 0x3C, 0x88, 0x11, 0xD1, - 0x3E, 0xF6, 0x63, 0xEC, 0xDF, 0x40, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, - 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x04, 0x05, 0x00, 0x30, 0x70, 0x31, - 0x2B, 0x30, 0x29, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x22, 0x43, 0x6F, - 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x28, 0x63, 0x29, 0x20, - 0x31, 0x39, 0x39, 0x37, 0x20, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, - 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x2E, 0x31, 0x1E, 0x30, 0x1C, - 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x15, 0x4D, 0x69, 0x63, 0x72, 0x6F, - 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x6F, 0x72, 0x61, - 0x74, 0x69, 0x6F, 0x6E, 0x31, 0x21, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x04, - 0x03, 0x13, 0x18, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, - 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6F, 0x72, - 0x69, 0x74, 0x79, 0x30, 0x1E, 0x17, 0x0D, 0x39, 0x37, 0x30, 0x31, 0x31, - 0x30, 0x30, 0x37, 0x30, 0x30, 0x30, 0x30, 0x5A, 0x17, 0x0D, 0x32, 0x30, - 0x31, 0x32, 0x33, 0x31, 0x30, 0x37, 0x30, 0x30, 0x30, 0x30, 0x5A, 0x30, - 0x70, 0x31, 0x2B, 0x30, 0x29, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x22, - 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x28, 0x63, - 0x29, 0x20, 0x31, 0x39, 0x39, 0x37, 0x20, 0x4D, 0x69, 0x63, 0x72, 0x6F, - 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x2E, 0x31, 0x1E, - 0x30, 0x1C, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x15, 0x4D, 0x69, 0x63, - 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x6F, - 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x31, 0x21, 0x30, 0x1F, 0x06, 0x03, - 0x55, 0x04, 0x03, 0x13, 0x18, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, - 0x66, 0x74, 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x20, 0x41, 0x75, 0x74, 0x68, - 0x6F, 0x72, 0x69, 0x74, 0x79, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06, - 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, - 0x03, 0x82, 0x01, 0x0F, 0x00, 0x30, 0x82, 0x01, 0x0A, 0x02, 0x82, 0x01, - 0x01, 0x00, 0xA9, 0x02, 0xBD, 0xC1, 0x70, 0xE6, 0x3B, 0xF2, 0x4E, 0x1B, - 0x28, 0x9F, 0x97, 0x78, 0x5E, 0x30, 0xEA, 0xA2, 0xA9, 0x8D, 0x25, 0x5F, - 0xF8, 0xFE, 0x95, 0x4C, 0xA3, 0xB7, 0xFE, 0x9D, 0xA2, 0x20, 0x3E, 0x7C, - 0x51, 0xA2, 0x9B, 0xA2, 0x8F, 0x60, 0x32, 0x6B, 0xD1, 0x42, 0x64, 0x79, - 0xEE, 0xAC, 0x76, 0xC9, 0x54, 0xDA, 0xF2, 0xEB, 0x9C, 0x86, 0x1C, 0x8F, - 0x9F, 0x84, 0x66, 0xB3, 0xC5, 0x6B, 0x7A, 0x62, 0x23, 0xD6, 0x1D, 0x3C, - 0xDE, 0x0F, 0x01, 0x92, 0xE8, 0x96, 0xC4, 0xBF, 0x2D, 0x66, 0x9A, 0x9A, - 0x68, 0x26, 0x99, 0xD0, 0x3A, 0x2C, 0xBF, 0x0C, 0xB5, 0x58, 0x26, 0xC1, - 0x46, 0xE7, 0x0A, 0x3E, 0x38, 0x96, 0x2C, 0xA9, 0x28, 0x39, 0xA8, 0xEC, - 0x49, 0x83, 0x42, 0xE3, 0x84, 0x0F, 0xBB, 0x9A, 0x6C, 0x55, 0x61, 0xAC, - 0x82, 0x7C, 0xA1, 0x60, 0x2D, 0x77, 0x4C, 0xE9, 0x99, 0xB4, 0x64, 0x3B, - 0x9A, 0x50, 0x1C, 0x31, 0x08, 0x24, 0x14, 0x9F, 0xA9, 0xE7, 0x91, 0x2B, - 0x18, 0xE6, 0x3D, 0x98, 0x63, 0x14, 0x60, 0x58, 0x05, 0x65, 0x9F, 0x1D, - 0x37, 0x52, 0x87, 0xF7, 0xA7, 0xEF, 0x94, 0x02, 0xC6, 0x1B, 0xD3, 0xBF, - 0x55, 0x45, 0xB3, 0x89, 0x80, 0xBF, 0x3A, 0xEC, 0x54, 0x94, 0x4E, 0xAE, - 0xFD, 0xA7, 0x7A, 0x6D, 0x74, 0x4E, 0xAF, 0x18, 0xCC, 0x96, 0x09, 0x28, - 0x21, 0x00, 0x57, 0x90, 0x60, 0x69, 0x37, 0xBB, 0x4B, 0x12, 0x07, 0x3C, - 0x56, 0xFF, 0x5B, 0xFB, 0xA4, 0x66, 0x0A, 0x08, 0xA6, 0xD2, 0x81, 0x56, - 0x57, 0xEF, 0xB6, 0x3B, 0x5E, 0x16, 0x81, 0x77, 0x04, 0xDA, 0xF6, 0xBE, - 0xAE, 0x80, 0x95, 0xFE, 0xB0, 0xCD, 0x7F, 0xD6, 0xA7, 0x1A, 0x72, 0x5C, - 0x3C, 0xCA, 0xBC, 0xF0, 0x08, 0xA3, 0x22, 0x30, 0xB3, 0x06, 0x85, 0xC9, - 0xB3, 0x20, 0x77, 0x13, 0x85, 0xDF, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, - 0x81, 0xA8, 0x30, 0x81, 0xA5, 0x30, 0x81, 0xA2, 0x06, 0x03, 0x55, 0x1D, - 0x01, 0x04, 0x81, 0x9A, 0x30, 0x81, 0x97, 0x80, 0x10, 0x5B, 0xD0, 0x70, - 0xEF, 0x69, 0x72, 0x9E, 0x23, 0x51, 0x7E, 0x14, 0xB2, 0x4D, 0x8E, 0xFF, - 0xCB, 0xA1, 0x72, 0x30, 0x70, 0x31, 0x2B, 0x30, 0x29, 0x06, 0x03, 0x55, - 0x04, 0x0B, 0x13, 0x22, 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, - 0x74, 0x20, 0x28, 0x63, 0x29, 0x20, 0x31, 0x39, 0x39, 0x37, 0x20, 0x4D, - 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, - 0x70, 0x2E, 0x31, 0x1E, 0x30, 0x1C, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, - 0x15, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, - 0x6F, 0x72, 0x70, 0x6F, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x31, 0x21, - 0x30, 0x1F, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x18, 0x4D, 0x69, 0x63, - 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x20, - 0x41, 0x75, 0x74, 0x68, 0x6F, 0x72, 0x69, 0x74, 0x79, 0x82, 0x0F, 0x00, - 0xC1, 0x00, 0x8B, 0x3C, 0x3C, 0x88, 0x11, 0xD1, 0x3E, 0xF6, 0x63, 0xEC, - 0xDF, 0x40, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, - 0x01, 0x01, 0x04, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x95, 0xE8, - 0x0B, 0xC0, 0x8D, 0xF3, 0x97, 0x18, 0x35, 0xED, 0xB8, 0x01, 0x24, 0xD8, - 0x77, 0x11, 0xF3, 0x5C, 0x60, 0x32, 0x9F, 0x9E, 0x0B, 0xCB, 0x3E, 0x05, - 0x91, 0x88, 0x8F, 0xC9, 0x3A, 0xE6, 0x21, 0xF2, 0xF0, 0x57, 0x93, 0x2C, - 0xB5, 0xA0, 0x47, 0xC8, 0x62, 0xEF, 0xFC, 0xD7, 0xCC, 0x3B, 0x3B, 0x5A, - 0xA9, 0x36, 0x54, 0x69, 0xFE, 0x24, 0x6D, 0x3F, 0xC9, 0xCC, 0xAA, 0xDE, - 0x05, 0x7C, 0xDD, 0x31, 0x8D, 0x3D, 0x9F, 0x10, 0x70, 0x6A, 0xBB, 0xFE, - 0x12, 0x4F, 0x18, 0x69, 0xC0, 0xFC, 0xD0, 0x43, 0xE3, 0x11, 0x5A, 0x20, - 0x4F, 0xEA, 0x62, 0x7B, 0xAF, 0xAA, 0x19, 0xC8, 0x2B, 0x37, 0x25, 0x2D, - 0xBE, 0x65, 0xA1, 0x12, 0x8A, 0x25, 0x0F, 0x63, 0xA3, 0xF7, 0x54, 0x1C, - 0xF9, 0x21, 0xC9, 0xD6, 0x15, 0xF3, 0x52, 0xAC, 0x6E, 0x43, 0x32, 0x07, - 0xFD, 0x82, 0x17, 0xF8, 0xE5, 0x67, 0x6C, 0x0D, 0x51, 0xF6, 0xBD, 0xF1, - 0x52, 0xC7, 0xBD, 0xE7, 0xC4, 0x30, 0xFC, 0x20, 0x31, 0x09, 0x88, 0x1D, - 0x95, 0x29, 0x1A, 0x4D, 0xD5, 0x1D, 0x02, 0xA5, 0xF1, 0x80, 0xE0, 0x03, - 0xB4, 0x5B, 0xF4, 0xB1, 0xDD, 0xC8, 0x57, 0xEE, 0x65, 0x49, 0xC7, 0x52, - 0x54, 0xB6, 0xB4, 0x03, 0x28, 0x12, 0xFF, 0x90, 0xD6, 0xF0, 0x08, 0x8F, - 0x7E, 0xB8, 0x97, 0xC5, 0xAB, 0x37, 0x2C, 0xE4, 0x7A, 0xE4, 0xA8, 0x77, - 0xE3, 0x76, 0xA0, 0x00, 0xD0, 0x6A, 0x3F, 0xC1, 0xD2, 0x36, 0x8A, 0xE0, - 0x41, 0x12, 0xA8, 0x35, 0x6A, 0x1B, 0x6A, 0xDB, 0x35, 0xE1, 0xD4, 0x1C, - 0x04, 0xE4, 0xA8, 0x45, 0x04, 0xC8, 0x5A, 0x33, 0x38, 0x6E, 0x4D, 0x1C, - 0x0D, 0x62, 0xB7, 0x0A, 0xA2, 0x8C, 0xD3, 0xD5, 0x54, 0x3F, 0x46, 0xCD, - 0x1C, 0x55, 0xA6, 0x70, 0xDB, 0x12, 0x3A, 0x87, 0x93, 0x75, 0x9F, 0xA7, - 0xD2, 0xA0 }; - - static byte[] verisign = { - 0x30, 0x82, 0x02, 0x40, 0x30, 0x82, 0x01, 0xA9, 0x02, 0x10, 0x03, 0xC7, - 0x8F, 0x37, 0xDB, 0x92, 0x28, 0xDF, 0x3C, 0xBB, 0x1A, 0xAD, 0x82, 0xFA, - 0x67, 0x10, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, - 0x01, 0x01, 0x02, 0x05, 0x00, 0x30, 0x61, 0x31, 0x11, 0x30, 0x0F, 0x06, - 0x03, 0x55, 0x04, 0x07, 0x13, 0x08, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x6E, - 0x65, 0x74, 0x31, 0x17, 0x30, 0x15, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, - 0x0E, 0x56, 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6E, 0x2C, 0x20, 0x49, - 0x6E, 0x63, 0x2E, 0x31, 0x33, 0x30, 0x31, 0x06, 0x03, 0x55, 0x04, 0x0B, - 0x13, 0x2A, 0x56, 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6E, 0x20, 0x43, - 0x6F, 0x6D, 0x6D, 0x65, 0x72, 0x63, 0x69, 0x61, 0x6C, 0x20, 0x53, 0x6F, - 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x20, 0x50, 0x75, 0x62, 0x6C, 0x69, - 0x73, 0x68, 0x65, 0x72, 0x73, 0x20, 0x43, 0x41, 0x30, 0x1E, 0x17, 0x0D, - 0x39, 0x36, 0x30, 0x34, 0x30, 0x39, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, - 0x5A, 0x17, 0x0D, 0x30, 0x34, 0x30, 0x31, 0x30, 0x37, 0x32, 0x33, 0x35, - 0x39, 0x35, 0x39, 0x5A, 0x30, 0x61, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, - 0x55, 0x04, 0x07, 0x13, 0x08, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x6E, 0x65, - 0x74, 0x31, 0x17, 0x30, 0x15, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x0E, - 0x56, 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6E, 0x2C, 0x20, 0x49, 0x6E, - 0x63, 0x2E, 0x31, 0x33, 0x30, 0x31, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, - 0x2A, 0x56, 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6E, 0x20, 0x43, 0x6F, - 0x6D, 0x6D, 0x65, 0x72, 0x63, 0x69, 0x61, 0x6C, 0x20, 0x53, 0x6F, 0x66, - 0x74, 0x77, 0x61, 0x72, 0x65, 0x20, 0x50, 0x75, 0x62, 0x6C, 0x69, 0x73, - 0x68, 0x65, 0x72, 0x73, 0x20, 0x43, 0x41, 0x30, 0x81, 0x9F, 0x30, 0x0D, - 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, - 0x00, 0x03, 0x81, 0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, - 0xC3, 0xD3, 0x69, 0x65, 0x52, 0x01, 0x94, 0x54, 0xAB, 0x28, 0xC6, 0x62, - 0x18, 0xB3, 0x54, 0x55, 0xC5, 0x44, 0x87, 0x45, 0x4A, 0x3B, 0xC2, 0x7E, - 0xD8, 0xD3, 0xD7, 0xC8, 0x80, 0x86, 0x8D, 0xD8, 0x0C, 0xF1, 0x16, 0x9C, - 0xCC, 0x6B, 0xA9, 0x29, 0xB2, 0x8F, 0x76, 0x73, 0x92, 0xC8, 0xC5, 0x62, - 0xA6, 0x3C, 0xED, 0x1E, 0x05, 0x75, 0xF0, 0x13, 0x00, 0x6C, 0x14, 0x4D, - 0xD4, 0x98, 0x90, 0x07, 0xBE, 0x69, 0x73, 0x81, 0xB8, 0x62, 0x4E, 0x31, - 0x1E, 0xD1, 0xFC, 0xC9, 0x0C, 0xEB, 0x7D, 0x90, 0xBF, 0xAE, 0xB4, 0x47, - 0x51, 0xEC, 0x6F, 0xCE, 0x64, 0x35, 0x02, 0xD6, 0x7D, 0x67, 0x05, 0x77, - 0xE2, 0x8F, 0xD9, 0x51, 0xD7, 0xFB, 0x97, 0x19, 0xBC, 0x3E, 0xD7, 0x77, - 0x81, 0xC6, 0x43, 0xDD, 0xF2, 0xDD, 0xDF, 0xCA, 0xA3, 0x83, 0x8B, 0xCB, - 0x41, 0xC1, 0x3D, 0x22, 0x48, 0x48, 0xA6, 0x19, 0x02, 0x03, 0x01, 0x00, - 0x01, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, - 0x01, 0x02, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, 0xB5, 0xBC, 0xB0, 0x75, - 0x6A, 0x89, 0xA2, 0x86, 0xBD, 0x64, 0x78, 0xC3, 0xA7, 0x32, 0x75, 0x72, - 0x11, 0xAA, 0x26, 0x02, 0x17, 0x60, 0x30, 0x4C, 0xE3, 0x48, 0x34, 0x19, - 0xB9, 0x52, 0x4A, 0x51, 0x18, 0x80, 0xFE, 0x53, 0x2D, 0x7B, 0xD5, 0x31, - 0x8C, 0xC5, 0x65, 0x99, 0x41, 0x41, 0x2F, 0xF2, 0xAE, 0x63, 0x7A, 0xE8, - 0x73, 0x99, 0x15, 0x90, 0x1A, 0x1F, 0x7A, 0x8B, 0x41, 0xD0, 0x8E, 0x3A, - 0xD0, 0xCD, 0x38, 0x34, 0x44, 0xD0, 0x75, 0xF8, 0xEA, 0x71, 0xC4, 0x81, - 0x19, 0x38, 0x17, 0x35, 0x4A, 0xAE, 0xC5, 0x3E, 0x32, 0xE6, 0x21, 0xB8, - 0x05, 0xC0, 0x93, 0xE1, 0xC7, 0x38, 0x5C, 0xD8, 0xF7, 0x93, 0x38, 0x64, - 0x90, 0xED, 0x54, 0xCE, 0xCA, 0xD3, 0xD3, 0xD0, 0x5F, 0xEF, 0x04, 0x9B, - 0xDE, 0x02, 0x82, 0xDD, 0x88, 0x29, 0xB1, 0xC3, 0x4F, 0xA5, 0xCD, 0x71, - 0x64, 0x31, 0x3C, 0x3C }; - - static byte[] verisign_ts_root = { - 0x30, 0x82, 0x02, 0xBC, 0x30, 0x82, 0x02, 0x25, 0x02, 0x10, 0x4A, 0x19, - 0xD2, 0x38, 0x8C, 0x82, 0x59, 0x1C, 0xA5, 0x5D, 0x73, 0x5F, 0x15, 0x5D, - 0xDC, 0xA3, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, - 0x01, 0x01, 0x04, 0x05, 0x00, 0x30, 0x81, 0x9E, 0x31, 0x1F, 0x30, 0x1D, - 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x16, 0x56, 0x65, 0x72, 0x69, 0x53, - 0x69, 0x67, 0x6E, 0x20, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x4E, 0x65, - 0x74, 0x77, 0x6F, 0x72, 0x6B, 0x31, 0x17, 0x30, 0x15, 0x06, 0x03, 0x55, - 0x04, 0x0B, 0x13, 0x0E, 0x56, 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6E, - 0x2C, 0x20, 0x49, 0x6E, 0x63, 0x2E, 0x31, 0x2C, 0x30, 0x2A, 0x06, 0x03, - 0x55, 0x04, 0x0B, 0x13, 0x23, 0x56, 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, - 0x6E, 0x20, 0x54, 0x69, 0x6D, 0x65, 0x20, 0x53, 0x74, 0x61, 0x6D, 0x70, - 0x69, 0x6E, 0x67, 0x20, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, - 0x52, 0x6F, 0x6F, 0x74, 0x31, 0x34, 0x30, 0x32, 0x06, 0x03, 0x55, 0x04, - 0x0B, 0x13, 0x2B, 0x4E, 0x4F, 0x20, 0x4C, 0x49, 0x41, 0x42, 0x49, 0x4C, - 0x49, 0x54, 0x59, 0x20, 0x41, 0x43, 0x43, 0x45, 0x50, 0x54, 0x45, 0x44, - 0x2C, 0x20, 0x28, 0x63, 0x29, 0x39, 0x37, 0x20, 0x56, 0x65, 0x72, 0x69, - 0x53, 0x69, 0x67, 0x6E, 0x2C, 0x20, 0x49, 0x6E, 0x63, 0x2E, 0x30, 0x1E, - 0x17, 0x0D, 0x39, 0x37, 0x30, 0x35, 0x31, 0x32, 0x30, 0x30, 0x30, 0x30, - 0x30, 0x30, 0x5A, 0x17, 0x0D, 0x30, 0x34, 0x30, 0x31, 0x30, 0x37, 0x32, - 0x33, 0x35, 0x39, 0x35, 0x39, 0x5A, 0x30, 0x81, 0x9E, 0x31, 0x1F, 0x30, - 0x1D, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x16, 0x56, 0x65, 0x72, 0x69, - 0x53, 0x69, 0x67, 0x6E, 0x20, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x4E, - 0x65, 0x74, 0x77, 0x6F, 0x72, 0x6B, 0x31, 0x17, 0x30, 0x15, 0x06, 0x03, - 0x55, 0x04, 0x0B, 0x13, 0x0E, 0x56, 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, - 0x6E, 0x2C, 0x20, 0x49, 0x6E, 0x63, 0x2E, 0x31, 0x2C, 0x30, 0x2A, 0x06, - 0x03, 0x55, 0x04, 0x0B, 0x13, 0x23, 0x56, 0x65, 0x72, 0x69, 0x53, 0x69, - 0x67, 0x6E, 0x20, 0x54, 0x69, 0x6D, 0x65, 0x20, 0x53, 0x74, 0x61, 0x6D, - 0x70, 0x69, 0x6E, 0x67, 0x20, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x31, 0x34, 0x30, 0x32, 0x06, 0x03, 0x55, - 0x04, 0x0B, 0x13, 0x2B, 0x4E, 0x4F, 0x20, 0x4C, 0x49, 0x41, 0x42, 0x49, - 0x4C, 0x49, 0x54, 0x59, 0x20, 0x41, 0x43, 0x43, 0x45, 0x50, 0x54, 0x45, - 0x44, 0x2C, 0x20, 0x28, 0x63, 0x29, 0x39, 0x37, 0x20, 0x56, 0x65, 0x72, - 0x69, 0x53, 0x69, 0x67, 0x6E, 0x2C, 0x20, 0x49, 0x6E, 0x63, 0x2E, 0x30, - 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, - 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81, 0x8D, 0x00, 0x30, 0x81, 0x89, - 0x02, 0x81, 0x81, 0x00, 0xD3, 0x2E, 0x20, 0xF0, 0x68, 0x7C, 0x2C, 0x2D, - 0x2E, 0x81, 0x1C, 0xB1, 0x06, 0xB2, 0xA7, 0x0B, 0xB7, 0x11, 0x0D, 0x57, - 0xDA, 0x53, 0xD8, 0x75, 0xE3, 0xC9, 0x33, 0x2A, 0xB2, 0xD4, 0xF6, 0x09, - 0x5B, 0x34, 0xF3, 0xE9, 0x90, 0xFE, 0x09, 0x0C, 0xD0, 0xDB, 0x1B, 0x5A, - 0xB9, 0xCD, 0xE7, 0xF6, 0x88, 0xB1, 0x9D, 0xC0, 0x87, 0x25, 0xEB, 0x7D, - 0x58, 0x10, 0x73, 0x6A, 0x78, 0xCB, 0x71, 0x15, 0xFD, 0xC6, 0x58, 0xF6, - 0x29, 0xAB, 0x58, 0x5E, 0x96, 0x04, 0xFD, 0x2D, 0x62, 0x11, 0x58, 0x81, - 0x1C, 0xCA, 0x71, 0x94, 0xD5, 0x22, 0x58, 0x2F, 0xD5, 0xCC, 0x14, 0x05, - 0x84, 0x36, 0xBA, 0x94, 0xAA, 0xB4, 0x4D, 0x4A, 0xE9, 0xEE, 0x3B, 0x22, - 0xAD, 0x56, 0x99, 0x7E, 0x21, 0x9C, 0x6C, 0x86, 0xC0, 0x4A, 0x47, 0x97, - 0x6A, 0xB4, 0xA6, 0x36, 0xD5, 0xFC, 0x09, 0x2D, 0xD3, 0xB4, 0x39, 0x9B, - 0x02, 0x03, 0x01, 0x00, 0x01, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, - 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x04, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, - 0x61, 0x55, 0x0E, 0x3E, 0x7B, 0xC7, 0x92, 0x12, 0x7E, 0x11, 0x10, 0x8E, - 0x22, 0xCC, 0xD4, 0xB3, 0x13, 0x2B, 0x5B, 0xE8, 0x44, 0xE4, 0x0B, 0x78, - 0x9E, 0xA4, 0x7E, 0xF3, 0xA7, 0x07, 0x72, 0x1E, 0xE2, 0x59, 0xEF, 0xCC, - 0x84, 0xE3, 0x89, 0x94, 0x4C, 0xDB, 0x4E, 0x61, 0xEF, 0xB3, 0xA4, 0xFB, - 0x46, 0x3D, 0x50, 0x34, 0x0B, 0x9F, 0x70, 0x56, 0xF6, 0x8E, 0x2A, 0x7F, - 0x17, 0xCE, 0xE5, 0x63, 0xBF, 0x79, 0x69, 0x07, 0x73, 0x2E, 0xB0, 0x95, - 0x28, 0x8A, 0xF5, 0xED, 0xAA, 0xA9, 0xD2, 0x5D, 0xCD, 0x0A, 0xCA, 0x10, - 0x09, 0x8F, 0xCE, 0xB3, 0xAF, 0x28, 0x96, 0xC4, 0x79, 0x29, 0x84, 0x92, - 0xDC, 0xFF, 0xBA, 0x67, 0x42, 0x48, 0xA6, 0x90, 0x10, 0xE4, 0xBF, 0x61, - 0xF8, 0x9C, 0x53, 0xE5, 0x93, 0xD1, 0x73, 0x3F, 0xF8, 0xFD, 0x9D, 0x4F, - 0x84, 0xAC, 0x55, 0xD1, 0xFD, 0x11, 0x63, 0x63 }; - - // old verisign code signing certificate (96-99) using MD2 - // still valid because of the timestamps - static byte[] oldverisign = { - 0x30, 0x82, 0x02, 0x35, 0x30, 0x82, 0x01, 0x9E, 0x02, 0x05, 0x02, 0xB4, - 0x00, 0x00, 0x01, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, - 0x0D, 0x01, 0x01, 0x02, 0x05, 0x00, 0x30, 0x61, 0x31, 0x11, 0x30, 0x0F, - 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x08, 0x49, 0x6E, 0x74, 0x65, 0x72, - 0x6E, 0x65, 0x74, 0x31, 0x17, 0x30, 0x15, 0x06, 0x03, 0x55, 0x04, 0x0A, - 0x13, 0x0E, 0x56, 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6E, 0x2C, 0x20, - 0x49, 0x6E, 0x63, 0x2E, 0x31, 0x33, 0x30, 0x31, 0x06, 0x03, 0x55, 0x04, - 0x0B, 0x13, 0x2A, 0x56, 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6E, 0x20, - 0x43, 0x6F, 0x6D, 0x6D, 0x65, 0x72, 0x63, 0x69, 0x61, 0x6C, 0x20, 0x53, - 0x6F, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x20, 0x50, 0x75, 0x62, 0x6C, - 0x69, 0x73, 0x68, 0x65, 0x72, 0x73, 0x20, 0x43, 0x41, 0x30, 0x1E, 0x17, - 0x0D, 0x39, 0x36, 0x30, 0x34, 0x30, 0x39, 0x30, 0x39, 0x33, 0x35, 0x35, - 0x39, 0x5A, 0x17, 0x0D, 0x39, 0x39, 0x31, 0x32, 0x33, 0x31, 0x30, 0x39, - 0x33, 0x35, 0x35, 0x38, 0x5A, 0x30, 0x61, 0x31, 0x11, 0x30, 0x0F, 0x06, - 0x03, 0x55, 0x04, 0x07, 0x13, 0x08, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x6E, - 0x65, 0x74, 0x31, 0x17, 0x30, 0x15, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, - 0x0E, 0x56, 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6E, 0x2C, 0x20, 0x49, - 0x6E, 0x63, 0x2E, 0x31, 0x33, 0x30, 0x31, 0x06, 0x03, 0x55, 0x04, 0x0B, - 0x13, 0x2A, 0x56, 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6E, 0x20, 0x43, - 0x6F, 0x6D, 0x6D, 0x65, 0x72, 0x63, 0x69, 0x61, 0x6C, 0x20, 0x53, 0x6F, - 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x20, 0x50, 0x75, 0x62, 0x6C, 0x69, - 0x73, 0x68, 0x65, 0x72, 0x73, 0x20, 0x43, 0x41, 0x30, 0x81, 0x9F, 0x30, - 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, - 0x05, 0x00, 0x03, 0x81, 0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, - 0x00, 0xC3, 0xD3, 0x69, 0x65, 0x52, 0x01, 0x94, 0x54, 0xAB, 0x28, 0xC6, - 0x62, 0x18, 0xB3, 0x54, 0x55, 0xC5, 0x44, 0x87, 0x45, 0x4A, 0x3B, 0xC2, - 0x7E, 0xD8, 0xD3, 0xD7, 0xC8, 0x80, 0x86, 0x8D, 0xD8, 0x0C, 0xF1, 0x16, - 0x9C, 0xCC, 0x6B, 0xA9, 0x29, 0xB2, 0x8F, 0x76, 0x73, 0x92, 0xC8, 0xC5, - 0x62, 0xA6, 0x3C, 0xED, 0x1E, 0x05, 0x75, 0xF0, 0x13, 0x00, 0x6C, 0x14, - 0x4D, 0xD4, 0x98, 0x90, 0x07, 0xBE, 0x69, 0x73, 0x81, 0xB8, 0x62, 0x4E, - 0x31, 0x1E, 0xD1, 0xFC, 0xC9, 0x0C, 0xEB, 0x7D, 0x90, 0xBF, 0xAE, 0xB4, - 0x47, 0x51, 0xEC, 0x6F, 0xCE, 0x64, 0x35, 0x02, 0xD6, 0x7D, 0x67, 0x05, - 0x77, 0xE2, 0x8F, 0xD9, 0x51, 0xD7, 0xFB, 0x97, 0x19, 0xBC, 0x3E, 0xD7, - 0x77, 0x81, 0xC6, 0x43, 0xDD, 0xF2, 0xDD, 0xDF, 0xCA, 0xA3, 0x83, 0x8B, - 0xCB, 0x41, 0xC1, 0x3D, 0x22, 0x48, 0x48, 0xA6, 0x19, 0x02, 0x03, 0x01, - 0x00, 0x01, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, - 0x01, 0x01, 0x02, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, 0x31, 0xBB, 0x30, - 0xC5, 0x6F, 0xA7, 0xBE, 0x23, 0x26, 0x6D, 0xA5, 0x99, 0x76, 0x68, 0xC5, - 0x2A, 0x03, 0x28, 0x4B, 0xF3, 0x89, 0xB0, 0x99, 0x03, 0x32, 0x5B, 0x94, - 0xA1, 0x7B, 0xC1, 0xC8, 0x19, 0xD7, 0xF4, 0x95, 0x6C, 0xAC, 0x73, 0x24, - 0x0A, 0xCB, 0x44, 0x05, 0x7D, 0x78, 0xEE, 0xFA, 0xF6, 0xA7, 0x9F, 0x87, - 0xA4, 0x7F, 0xE8, 0xF3, 0x4B, 0x4F, 0x32, 0x30, 0x30, 0x15, 0x08, 0x17, - 0x01, 0xB2, 0x80, 0xFC, 0xA1, 0xD9, 0x24, 0x87, 0xA5, 0x00, 0x5F, 0xCD, - 0xDD, 0x29, 0xC8, 0xA1, 0xA5, 0xCA, 0x58, 0x75, 0x39, 0x60, 0x45, 0x1F, - 0xDE, 0x8D, 0xD6, 0x57, 0x08, 0xD3, 0xC0, 0x1B, 0x81, 0xC2, 0xD9, 0xE2, - 0x00, 0x8C, 0xEC, 0x0A, 0x91, 0x02, 0xC6, 0x9D, 0x36, 0x74, 0x9A, 0x83, - 0x6B, 0xEF, 0x7C, 0x8C, 0xD2, 0xA5, 0x2A, 0x6A, 0xC9, 0x7E, 0xDB, 0xA9, - 0xBD, 0x2B, 0x22, 0xFF, 0x1C }; - - static internal X509CertificateCollection coll; - - static TrustAnchors () - { - coll = new X509CertificateCollection (); - coll.Add (new X509Certificate (msroot)); - coll.Add (new X509Certificate (verisign)); - coll.Add (new X509Certificate (verisign_ts_root)); - } - - public X509CertificateCollection Anchors { - get { return coll; } - } - } -} diff --git a/mcs/class/Mono.Security/Mono.Security.X509/X509CertificateCollection.cs b/mcs/class/Mono.Security/Mono.Security.X509/X509CertificateCollection.cs deleted file mode 100755 index 8962f2a8d2d..00000000000 --- a/mcs/class/Mono.Security/Mono.Security.X509/X509CertificateCollection.cs +++ /dev/null @@ -1,152 +0,0 @@ -// -// Based on System.Security.Cryptography.X509Certificates.X509CertificateCollection -// in System assembly -// -// Authors: -// Lawrence Pit (loz@cable.a2000.nl) -// Sebastien Pouliot (spouliot@motus.com) -// - -using System; -using System.Collections; - -namespace Mono.Security.X509 { - - [Serializable] - public class X509CertificateCollection : CollectionBase, IEnumerable { - - public X509CertificateCollection () {} - - public X509CertificateCollection (X509Certificate [] value) - { - AddRange (value); - } - - public X509CertificateCollection (X509CertificateCollection value) - { - AddRange (value); - } - - // Properties - - public X509Certificate this [int index] { - get { return (X509Certificate) InnerList [index]; } - set { InnerList [index] = value; } - } - - // Methods - - public int Add (X509Certificate value) - { - if (value == null) - throw new ArgumentNullException ("value"); - - return InnerList.Add (value); - } - - public void AddRange (X509Certificate [] value) - { - if (value == null) - throw new ArgumentNullException ("value"); - - for (int i = 0; i < value.Length; i++) - InnerList.Add (value [i]); - } - - public void AddRange (X509CertificateCollection value) - { - if (value == null) - throw new ArgumentNullException ("value"); - - for (int i = 0; i < value.InnerList.Count; i++) - InnerList.Add (value [i]); - } - - public bool Contains (X509Certificate value) - { - return InnerList.Contains (value); - } - - public void CopyTo (X509Certificate[] array, int index) - { - InnerList.CopyTo (array, index); - } - - public new X509CertificateEnumerator GetEnumerator () - { - return new X509CertificateEnumerator (this); - } - - IEnumerator IEnumerable.GetEnumerator () - { - return InnerList.GetEnumerator (); - } - - public override int GetHashCode () - { - return InnerList.GetHashCode (); - } - - public int IndexOf (X509Certificate value) - { - return InnerList.IndexOf (value); - } - - public void Insert (int index, X509Certificate value) - { - InnerList.Insert (index, value); - } - - public void Remove (X509Certificate value) - { - InnerList.Remove (value); - } - - // Inner Class - - public class X509CertificateEnumerator : IEnumerator { - - private IEnumerator enumerator; - - // Constructors - - public X509CertificateEnumerator (X509CertificateCollection mappings) - { - enumerator = ((IEnumerable) mappings).GetEnumerator (); - } - - // Properties - - public X509Certificate Current { - get { return (X509Certificate) enumerator.Current; } - } - - object IEnumerator.Current { - get { return enumerator.Current; } - } - - // Methods - - bool IEnumerator.MoveNext () - { - return enumerator.MoveNext (); - } - - void IEnumerator.Reset () - { - enumerator.Reset (); - } - - public bool MoveNext () - { - return enumerator.MoveNext (); - } - - public void Reset () - { - enumerator.Reset (); - } - } - } -} - diff --git a/mcs/class/Mono.Security/Mono.Security.X509/X509Chain.cs b/mcs/class/Mono.Security/Mono.Security.X509/X509Chain.cs deleted file mode 100755 index cef109c42b6..00000000000 --- a/mcs/class/Mono.Security/Mono.Security.X509/X509Chain.cs +++ /dev/null @@ -1,119 +0,0 @@ -// -// X509Chain.cs: X.509 Certificate Path -// This is a VERY simplified and minimal version (for Authenticode support) -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; - -namespace Mono.Security.X509 { - - public class X509Chain { - - private X509CertificateCollection roots; - private X509CertificateCollection certs; - private X509Certificate root; - - public X509Chain () - { - certs = new X509CertificateCollection (); - } - - public void LoadCertificate (X509Certificate x509) - { - certs.Add (x509); - } - - public void LoadCertificates (X509CertificateCollection coll) - { - certs.AddRange (coll); - } - - public X509Certificate FindByIssuerName (string issuerName) - { - foreach (X509Certificate x in certs) { - if (x.IssuerName == issuerName) - return x; - } - return null; - } - - public X509CertificateCollection GetChain (X509Certificate x509) - { - X509CertificateCollection path = new X509CertificateCollection (); - X509Certificate x = FindCertificateParent (x509); - if (x != null) { - while (x != null) { - x509 = x; - path.Add (x509); - x = FindCertificateParent (x509); - if ((x != null) && (x.IsSelfSigned)) - x = null; - } - } - // find a trusted root - x = FindCertificateRoot (x509); - if (x == null) - return null; - root = x; - return path; - } - - private X509CertificateCollection GetTrustAnchors () - { - // TODO - Load from machine.config - ITrustAnchors trust = (ITrustAnchors) new TestAnchors (); - return trust.Anchors; - } - - public X509CertificateCollection TrustAnchors { - get { return ((roots == null) ? GetTrustAnchors () : roots); } - set { roots = value; } - } - - public X509Certificate Root { - get { return root; } - } - - public void Reset () - { - // this force a reload - roots = null; - certs.Clear (); - } - - private X509Certificate FindCertificateParent (X509Certificate child) - { - foreach (X509Certificate potentialParent in certs) { - if (IsParent (child, potentialParent)) - return potentialParent; - } - return null; - } - - private X509Certificate FindCertificateRoot (X509Certificate x509) - { - // if the trusted root is in the path - if (TrustAnchors.Contains (x509)) - return x509; - - foreach (X509Certificate root in TrustAnchors) { - if (IsParent (x509, root)) - return root; - } - - return null; - } - - private bool IsParent (X509Certificate child, X509Certificate parent) - { - if (child.IssuerName != parent.SubjectName) - return false; - return (child.VerifySignature (parent.RSA)); - } - } -} diff --git a/mcs/class/Mono.Security/Mono.Security.dll.sources b/mcs/class/Mono.Security/Mono.Security.dll.sources index 0bd2b902bec..f78c720f805 100644 --- a/mcs/class/Mono.Security/Mono.Security.dll.sources +++ b/mcs/class/Mono.Security/Mono.Security.dll.sources @@ -2,9 +2,6 @@ ./Mono.Security/ASN1Convert.cs ./Mono.Security/PKCS7.cs ./Mono.Security/StrongName.cs -./Mono.Security.Authenticode/AuthenticodeBase.cs -./Mono.Security.Authenticode/AuthenticodeDeformatter.cs -./Mono.Security.Authenticode/AuthenticodeFormatter.cs ./Mono.Security.Authenticode/SoftwarePublisherCertificate.cs ./Mono.Security.Authenticode/PrivateKey.cs ./Mono.Security.Cryptography/ARC4Managed.cs @@ -12,23 +9,16 @@ ./Mono.Security.Cryptography/MD2.cs ./Mono.Security.Cryptography/MD2Managed.cs ./Mono.Security.Cryptography/RC4.cs -./Mono.Security.X509/ITrustAnchors.cs -./Mono.Security.X509/TestAnchors.cs -./Mono.Security.X509/TrustAnchors.cs ./Mono.Security.X509/X501Name.cs ./Mono.Security.X509/X509Builder.cs ./Mono.Security.X509/X509Certificate.cs -./Mono.Security.X509/X509CertificateCollection.cs ./Mono.Security.X509/X509CertificateBuilder.cs -./Mono.Security.X509/X509Chain.cs ./Mono.Security.X509/X509Extension.cs ./Mono.Security.X509/X509Extensions.cs ./Mono.Security.X509/X520Attributes.cs ./Mono.Security.X509.Extensions/BasicConstraintsExtension.cs ./Mono.Security.X509.Extensions/ExtendedKeyUsageExtension.cs -./Mono.Security.X509.Extensions/KeyAttributesExtension.cs ./Mono.Security.X509.Extensions/KeyUsageExtension.cs ./Mono.Security.X509.Extensions/SubjectAltNameExtension.cs - diff --git a/mcs/class/Mono.Security/Mono.Security/ChangeLog b/mcs/class/Mono.Security/Mono.Security/ChangeLog index a6e2b5fe831..9ee03736008 100644 --- a/mcs/class/Mono.Security/Mono.Security/ChangeLog +++ b/mcs/class/Mono.Security/Mono.Security/ChangeLog @@ -1,8 +1,3 @@ -2003-09-01 Sebastien Pouliot <spouliot@videotron.ca> - - * PKCS7.cs: Updated to use Mono.Security.X509.X509Certificate and to - support countersignatures. - 2003-06-19 Nick Drochak <ndrochak@gol.com> * StrongName.cs: Work around for mcs? bug 45127. diff --git a/mcs/class/Mono.Security/Mono.Security/PKCS7.cs b/mcs/class/Mono.Security/Mono.Security/PKCS7.cs index ea8a10a2930..89e27386732 100644 --- a/mcs/class/Mono.Security/Mono.Security/PKCS7.cs +++ b/mcs/class/Mono.Security/Mono.Security/PKCS7.cs @@ -12,8 +12,7 @@ using System; using System.Collections; using System.Security.Cryptography; - -using Mono.Security.X509; +using System.Security.Cryptography.X509Certificates; namespace Mono.Security { @@ -27,10 +26,9 @@ namespace Mono.Security { // pkcs 9 public const string contentType = "1.2.840.113549.1.9.3"; public const string messageDigest = "1.2.840.113549.1.9.4"; - public const string signingTime = "1.2.840.113549.1.9.5"; - public const string countersignature = "1.2.840.113549.1.9.6"; - public PKCS7 () {} + public PKCS7() { + } static public ASN1 Attribute (string oid, ASN1 value) { @@ -67,11 +65,11 @@ namespace Mono.Security { { ASN1 issuer = null; ASN1 serial = null; - ASN1 cert = new ASN1 (x509.RawData); + ASN1 cert = new ASN1 (x509.GetRawCertData ()); int tbs = 0; bool flag = false; - while (tbs < cert[0].Count) { - ASN1 e = cert[0][tbs++]; + while (tbs < cert[0][0].Count) { + ASN1 e = cert[0][0][tbs++]; if (e.Tag == 0x02) serial = e; else if (e.Tag == 0x30) { @@ -288,7 +286,7 @@ namespace Mono.Security { if (certs.Count > 0) { ASN1 a0 = signedData.Add (new ASN1 (0xA0)); foreach (X509Certificate x in certs) - a0.Add (new ASN1 (x.RawData)); + a0.Add (new ASN1 (x.GetRawCertData ())); } // crls [1] IMPLICIT CertificateRevocationLists OPTIONAL, if (crls.Count > 0) { @@ -329,8 +327,6 @@ namespace Mono.Security { private ArrayList authenticatedAttributes; private ArrayList unauthenticatedAttributes; private byte[] signature; - private string issuer; - private byte[] serial; public SignerInfo () { @@ -342,58 +338,16 @@ namespace Mono.Security { public SignerInfo (byte[] data) : this (new ASN1 (data)) {} - // TODO: INCOMPLETE - public SignerInfo (ASN1 asn1) : this () + public SignerInfo (ASN1 asn1) { if ((asn1[0].Tag != 0x30) || (asn1[0].Count < 5)) throw new ArgumentException ("Invalid SignedData"); - // version Version if (asn1[0][0].Tag != 0x02) throw new ArgumentException ("Invalid version"); version = asn1[0][0].Value[0]; - // issuerAndSerialNumber IssuerAndSerialNumber - ASN1 issuerAndSerialNumber = asn1 [0][1]; - issuer = X501.ToString (issuerAndSerialNumber [0]); - serial = issuerAndSerialNumber [1].Value; - - // digestAlgorithm DigestAlgorithmIdentifier - ASN1 digestAlgorithm = asn1 [0][2]; - hashAlgorithm = ASN1Convert.ToOID (digestAlgorithm [0]); - - // authenticatedAttributes [0] IMPLICIT Attributes OPTIONAL - int n = 3; - ASN1 authAttributes = asn1 [0][n]; - if (authAttributes.Tag == 0xA0) { - n++; - for (int i=0; i < authAttributes.Count; i++) - authenticatedAttributes.Add (authAttributes [i]); - } - - // digestEncryptionAlgorithm DigestEncryptionAlgorithmIdentifier - ASN1 digestEncryptionAlgorithm = asn1 [0][n++]; - string digestEncryptionAlgorithmOid = ASN1Convert.ToOID (digestEncryptionAlgorithm [0]); - - // encryptedDigest EncryptedDigest - ASN1 encryptedDigest = asn1 [0][n++]; - if (encryptedDigest.Tag == 0x04) - signature = encryptedDigest.Value; - - // unauthenticatedAttributes [1] IMPLICIT Attributes OPTIONAL - ASN1 unauthAttributes = asn1 [0][n]; - if ((unauthAttributes != null) && (unauthAttributes.Tag == 0xA1)) { - for (int i=0; i < unauthAttributes.Count; i++) - unauthenticatedAttributes.Add (unauthAttributes [i]); - } - } - - public string IssuerName { - get { return issuer; } - } - - public byte[] SerialNumber { - get { return (byte[]) serial.Clone(); } + // TODO: INCOMPLETE } public ASN1 ASN1 { @@ -411,6 +365,7 @@ namespace Mono.Security { public string HashName { get { return hashAlgorithm; } + // todo add validation set { hashAlgorithm = value; } } diff --git a/mcs/class/PEAPI/ChangeLog b/mcs/class/PEAPI/ChangeLog index c885631ef94..610a4aa6253 100644 --- a/mcs/class/PEAPI/ChangeLog +++ b/mcs/class/PEAPI/ChangeLog @@ -1,8 +1,3 @@ -2003-08-19 Jackson Harper <jackson@latitudegeo.com> - - * PEAPI.cs: Make no super method public so we can have types - with no super type. - 2003-08-03 Jackson Harper <jackson@latitudegeo.com> * PEAPI.cs: New Sentinel type. diff --git a/mcs/class/PEAPI/PEAPI.cs b/mcs/class/PEAPI/PEAPI.cs index d52483dec75..c7a56ff998a 100644 --- a/mcs/class/PEAPI/PEAPI.cs +++ b/mcs/class/PEAPI/PEAPI.cs @@ -1729,7 +1729,7 @@ namespace PEAPI typeIndex = superType.GetTypeIndex();
}
- public void SpecialNoSuper() {
+ internal void SpecialNoSuper() {
superType = null;
}
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciParameterDescriptor.cs b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciParameterDescriptor.cs index f3ef0bbebf7..72f42c45eaa 100644 --- a/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciParameterDescriptor.cs +++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciParameterDescriptor.cs @@ -65,67 +65,6 @@ namespace System.Data.OracleClient.Oci { return (OciDataType) GetAttributeInt32 (OciAttributeType.DataType, ErrorHandle); } - public string GetDataTypeName () - { - switch(GetDataType()) - { - case OciDataType.VarChar2: - return "VarChar2"; - case OciDataType.Number: - return "Number"; - case OciDataType.Integer: - return "Integer"; - case OciDataType.Float: - return "Float"; - case OciDataType.String: - return "String"; - case OciDataType.VarNum: - return "VarNum"; - case OciDataType.Long: - return "Long"; - case OciDataType.VarChar: - return "VarChar"; - case OciDataType.RowId: - return "RowId"; - case OciDataType.Date: - return "Date"; - case OciDataType.VarRaw: - return "VarRaw"; - case OciDataType.Raw: - return "Raw"; - case OciDataType.LongRaw: - return "LongRaw"; - case OciDataType.UnsignedInt: - return "UnsignedInt"; - case OciDataType.LongVarChar: - return "LongVarChar"; - case OciDataType.LongVarRaw: - return "LongVarRaw"; - case OciDataType.Char: - return "Char"; - case OciDataType.CharZ: - return "CharZ"; - case OciDataType.RowIdDescriptor: - return "RowIdDescriptor"; - case OciDataType.NamedDataType: - return "NamedDataType"; - case OciDataType.Ref: - return "Ref"; - case OciDataType.Clob: - return "Clob"; - case OciDataType.Blob: - return "Blob"; - case OciDataType.BFile: - return "BFile"; - case OciDataType.OciString: - return "OciString"; - case OciDataType.OciDate: - return "OciDate"; - default: - return "Unknown"; - } - } - public short GetPrecision () { return (short) GetAttributeByte (OciAttributeType.Precision, ErrorHandle); diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleDataReader.cs b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleDataReader.cs index c848d9891cd..08bcfd15ea9 100644 --- a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleDataReader.cs +++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleDataReader.cs @@ -127,7 +127,6 @@ namespace System.Data.OracleClient { schemaTable.Columns.Add ("AllowDBNull", booleanType); schemaTable.Columns.Add ("IsUnique", booleanType); schemaTable.Columns.Add ("IsKey", booleanType); - schemaTable.Columns.Add ("IsReadOnly", booleanType); schemaTable.Columns.Add ("BaseSchemaTable", stringType); schemaTable.Columns.Add ("BaseCatalogName", stringType); schemaTable.Columns.Add ("BaseTableName", stringType); @@ -322,7 +321,7 @@ namespace System.Data.OracleClient { { if (schemaTable.Rows != null && schemaTable.Rows.Count > 0) return schemaTable; - + dataTypeNames = new ArrayList (); for (int i = 0; i < statement.ColumnCount; i += 1) { @@ -330,8 +329,6 @@ namespace System.Data.OracleClient { OciParameterDescriptor parameter = statement.GetParameter (i); - dataTypeNames.Add(parameter.GetDataTypeName()); - row ["ColumnName"] = parameter.GetName (); row ["ColumnOrdinal"] = i + 1; row ["ColumnSize"] = parameter.GetDataSize (); @@ -342,7 +339,6 @@ namespace System.Data.OracleClient { row ["DataType"] = typeof(string); row ["AllowDBNull"] = parameter.GetIsNull (); row ["BaseColumnName"] = parameter.GetName (); - row ["IsReadOnly"] = true; schemaTable.Rows.Add (row); } diff --git a/mcs/class/System.Data/System.Data.Common/ChangeLog b/mcs/class/System.Data/System.Data.Common/ChangeLog index 2216cc125b0..a342bb057f0 100755 --- a/mcs/class/System.Data/System.Data.Common/ChangeLog +++ b/mcs/class/System.Data/System.Data.Common/ChangeLog @@ -1,8 +1,3 @@ -2003-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * DbDataAdapter.cs: provide a Type for ToArray to avoid invalid cast - exception. Thanks to Mark Easton <measton@tebiki.co.uk>. - 2003-07-31 Duncan Mak <duncan@ximian.com> * DataAdapter.cs (CloneInternals): Mark with ObsoleteAttribute for diff --git a/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs b/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs index a1e110f51e5..1da624e4939 100644 --- a/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs +++ b/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs @@ -347,7 +347,7 @@ namespace System.Data.Common { primaryKey.Add (table.Columns [dsColumnName]); } if (MissingSchemaAction == MissingSchemaAction.AddWithKey && primaryKey.Count > 0) - table.PrimaryKey = (DataColumn[])(primaryKey.ToArray(typeof (DataColumn))); + table.PrimaryKey = (DataColumn[])(primaryKey.ToArray()); } [MonoTODO] diff --git a/mcs/class/System.Data/System.Data.SqlClient/ChangeLog b/mcs/class/System.Data/System.Data.SqlClient/ChangeLog index 35a67175c8f..47b6a73cbe2 100755 --- a/mcs/class/System.Data/System.Data.SqlClient/ChangeLog +++ b/mcs/class/System.Data/System.Data.SqlClient/ChangeLog @@ -1,22 +1,3 @@ -2003-08-22 Duncan Mak <duncan@ximian.com> - - * SqlCommand.cs (ExecuteNonQuery): Return - Connection.Tds.RecordsAffected if it is successful. Patch from - Jörg Rosenkranz <joergr@voelcker.com>. - - This is part of a fix to bug #40315. - -2003-08-20 Duncan Mak <duncan@ximian.com> - - * SqlConnectionPool.cs (ReleaseConnection): A patch from Joerg - Rosenkranz <JoergR@voelcker.com>. Currently, if a connection is - closed by an external event (network problem, etc.) it is pushed - back into the connection pool. The next Open call retrieves this - invalid connection which leads to exceptions when executing - statements. - - This patch fixes this problem. This closes bug #47429. - 2003-07-04 Miguel de Icaza <miguel@ximian.com> * SqlDataReader.cs: Added extra information to the exceptions diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs index 1022a753dc0..51e51cce74f 100644 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs +++ b/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs @@ -283,7 +283,6 @@ namespace System.Data.SqlClient { try { Execute (CommandBehavior.Default, false); - result = Connection.Tds.RecordsAffected; } catch (TdsTimeoutException e) { throw SqlException.FromTdsInternalException ((TdsInternalException) e); diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlConnectionPool.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlConnectionPool.cs index 57a2b13068e..e2cfcdd732f 100644 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlConnectionPool.cs +++ b/mcs/class/System.Data/System.Data.SqlClient/SqlConnectionPool.cs @@ -139,22 +139,7 @@ namespace System.Data.SqlClient { public void ReleaseConnection (ITds tds) { - // Check if connection is still valid - try - { - // Send dummy statement to check connection - tds.Execute("select 1"); - } - catch - { - // Remove invalid connection - list.Remove(tds); - } - finally - { - // Release lock - Monitor.Exit (tds); - } + Monitor.Exit (tds); } public int IndexOf (object o) diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs index 3272903c021..c9db7a57137 100644 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs +++ b/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs @@ -187,24 +187,10 @@ namespace System.Data.SqlClient { public long GetChars (int i, long dataIndex, char[] buffer, int bufferIndex, int length) { object value = GetValue (i); - char [] valueBuffer; - - if (value is char[]) - valueBuffer = (char[])value; - else if (value is string) - valueBuffer = ((string)value).ToCharArray(); - else + if (!(value is char[])) throw new InvalidCastException ("Type is " + value.GetType ().ToString ()); - - if ( buffer == null ) { - // Return length of data - return valueBuffer.Length; - } - else { - // Copy data into buffer - Array.Copy (valueBuffer, (int) dataIndex, buffer, bufferIndex, length); - return valueBuffer.Length - dataIndex; - } + Array.Copy ((char []) value, (int) dataIndex, buffer, bufferIndex, length); + return ((char []) value).Length - dataIndex; } [MonoTODO ("Implement GetData")] diff --git a/mcs/class/System.Data/System.Data/ExpressionElement.cs b/mcs/class/System.Data/System.Data/ExpressionElement.cs index 0d0705f2a89..41234b45451 100644 --- a/mcs/class/System.Data/System.Data/ExpressionElement.cs +++ b/mcs/class/System.Data/System.Data/ExpressionElement.cs @@ -386,7 +386,7 @@ namespace System.Data int len2 = operand2.Length;
int startIndex = 0;
while ((startIndex + len2) <= operand1.Length) {
- if (String.Compare (operand1.Substring (startIndex, len2), operand2, !Row.Table.CaseSensitive) == 0)
+ if (String.Compare (operand1.Substring (0, len2), operand2, !Row.Table.CaseSensitive) == 0)
return true;
startIndex++;
}
diff --git a/mcs/class/System.Drawing/ChangeLog b/mcs/class/System.Drawing/ChangeLog index 7a6067f45d3..0286e4ac18a 100644 --- a/mcs/class/System.Drawing/ChangeLog +++ b/mcs/class/System.Drawing/ChangeLog @@ -1,11 +1,3 @@ -2003-08-31 Jerome Laban <jlaban@wanadoo.fr> - * Graphics.cs: - * win32functions.cs: Added Win32 Ellipse implementation. - -2003-08-24 Duncan Mak <duncan@ximian.com> - - * System.Drawing.dll.sources: Add Cairo implementation. - 2003-07-23 Peter Williams <peter@newton.cx> * System.Drawing.dll.sources: Add Pens.cs diff --git a/mcs/class/System.Drawing/System.Drawing.dll.sources b/mcs/class/System.Drawing/System.Drawing.dll.sources index a2c2a95f906..98ae103902a 100755 --- a/mcs/class/System.Drawing/System.Drawing.dll.sources +++ b/mcs/class/System.Drawing/System.Drawing.dll.sources @@ -58,15 +58,6 @@ System.Drawing/impl/ItfPen.cs System.Drawing/impl/ItfRegion.cs System.Drawing/impl/ItfSolidBrush.cs System.Drawing/impl/ItfTextureBrush.cs -System.Drawing/impl/cairo/Bitmap.cs -System.Drawing/impl/cairo/Font.cs -System.Drawing/impl/cairo/FontFamily.cs -System.Drawing/impl/cairo/Graphics.cs -System.Drawing/impl/cairo/Image.cs -System.Drawing/impl/cairo/Pen.cs -System.Drawing/impl/cairo/SolidBrush.cs -System.Drawing/impl/cairo/cairo-api.cs -System.Drawing/impl/cairo/gdk-helpers.cs System.Drawing/impl/gtk/Bitmap.cs System.Drawing/impl/gtk/Image.cs System.Drawing/impl/wine/Bitmap.cs diff --git a/mcs/class/System.Drawing/System.Drawing/ChangeLog b/mcs/class/System.Drawing/System.Drawing/ChangeLog index c659253a644..271a8049811 100644 --- a/mcs/class/System.Drawing/System.Drawing/ChangeLog +++ b/mcs/class/System.Drawing/System.Drawing/ChangeLog @@ -1,8 +1,3 @@ -2003-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * Color.cs: fixed FromArgb to handle alpha value correctly. Closes - bug #47727. - 2003-08-08 Duncan Mak <duncan@ximian.com> * Graphics.cs (DrawBezier): Fixed. diff --git a/mcs/class/System.Drawing/System.Drawing/Color.cs b/mcs/class/System.Drawing/System.Drawing/Color.cs index 0bb005b1426..b0031f7a9fd 100644 --- a/mcs/class/System.Drawing/System.Drawing/Color.cs +++ b/mcs/class/System.Drawing/System.Drawing/Color.cs @@ -117,7 +117,7 @@ namespace System.Drawing public static Color FromArgb (int argb) { - return FromArgb ((argb >> 24) & 0x0FF, (argb >> 16) & 0x0FF, (argb >> 8) & 0x0FF, argb & 0x0FF); + return FromArgb (argb >> 24, (argb >> 16) & 0x0FF, (argb >> 8) & 0x0FF, argb & 0x0FF); } public static Color FromKnownColor (KnownColor knownColorToConvert) diff --git a/mcs/class/System.Drawing/System.Drawing/Graphics.cs b/mcs/class/System.Drawing/System.Drawing/Graphics.cs index 14709ff3222..8273275616d 100755 --- a/mcs/class/System.Drawing/System.Drawing/Graphics.cs +++ b/mcs/class/System.Drawing/System.Drawing/Graphics.cs @@ -62,7 +62,7 @@ namespace System.Drawing [MonoTODO] public void Clear (Color color) { - implementation.Clear (color); + throw new NotImplementedException (); } [MonoTODO] diff --git a/mcs/class/System.Drawing/System.Drawing/Image.cs b/mcs/class/System.Drawing/System.Drawing/Image.cs index ce910fd1f74..5019fc4d112 100644 --- a/mcs/class/System.Drawing/System.Drawing/Image.cs +++ b/mcs/class/System.Drawing/System.Drawing/Image.cs @@ -104,6 +104,7 @@ internal class InternalImageInfo : IDisposable { int destinationPixelIncrement = (destPixelFormat == PixelFormat.Format32bppArgb) ? 1 : 0; int destStride = (Image.GetPixelFormatSize(destPixelFormat) >> 3 ) * imageSize.Width; + Console.WriteLine ("Destination stride {0}", destStride); byte[] temp = new byte [destStride * imageSize.Height]; fixed( byte *psrc = image, pbuf = temp) { byte* curSrc = psrc; diff --git a/mcs/class/System.Drawing/System.Drawing/impl/Xr/ChangeLog b/mcs/class/System.Drawing/System.Drawing/impl/Xr/ChangeLog index 9709217db16..8bb99b3ea6c 100644 --- a/mcs/class/System.Drawing/System.Drawing/impl/Xr/ChangeLog +++ b/mcs/class/System.Drawing/System.Drawing/impl/Xr/ChangeLog @@ -1,7 +1,3 @@ -2003-08-24 Duncan Mak <duncan@ximian.com> - - * Graphics.cs (FillEllipse): Implemented. - 2003-08-10 Gonzalo Paniagua Javier <gonzalo@ximian.com> * Image.cs: commented out [MonoTODO]'s to fix windows build. Why? diff --git a/mcs/class/System.Drawing/System.Drawing/impl/Xr/Graphics.cs b/mcs/class/System.Drawing/System.Drawing/impl/Xr/Graphics.cs index 6a3f4af80ad..f7b489de871 100644 --- a/mcs/class/System.Drawing/System.Drawing/impl/Xr/Graphics.cs +++ b/mcs/class/System.Drawing/System.Drawing/impl/Xr/Graphics.cs @@ -299,7 +299,7 @@ namespace System.Drawing xrPen.SetXrValues (native_object); Xr.XrMoveTo (native_object, cx + rx, cy); - + // Do an approprimation of the ellipse by drawing a curve in each quatrant Xr.XrCurveTo (native_object, cx + rx, cy - C1 * ry, @@ -1025,52 +1025,28 @@ namespace System.Drawing throw new NotImplementedException (); } + [MonoTODO] void IGraphics.FillEllipse (System.Drawing.Brush brush, Rectangle rect) { - ((IGraphics) this).FillEllipse (brush, rect.X, rect.Y, rect.Width, rect.Height); + throw new NotImplementedException (); } + [MonoTODO] void IGraphics.FillEllipse (System.Drawing.Brush brush, RectangleF rect) { - ((IGraphics) this).FillEllipse (brush, rect.X, rect.Y, rect.Width, rect.Height); + throw new NotImplementedException (); } + [MonoTODO] void IGraphics.FillEllipse (System.Drawing.Brush brush, float x, float y, float width, float height) - { - double rx = width / 2; - double ry = height / 2; - double cx = x + rx; - double cy = y + ry; - - Brush xrBrush = ConvertBrush (brush); -// xrBrush.SetXrValues (native_object); - Xr.XrMoveTo (native_object, cx + rx, cy); - - Xr.XrCurveTo (native_object, - cx + rx, cy - C1 * ry, - cx + C1 * rx, cy - ry, - cx, cy - ry); - Xr.XrCurveTo (native_object, - cx - C1 * rx, cy - ry, - cx - rx, cy - C1 * ry, - cx - rx, cy); - Xr.XrCurveTo (native_object, - cx - rx, cy + C1 * ry, - cx - C1 * rx, cy + ry, - cx, cy + ry); - Xr.XrCurveTo (native_object, - cx + C1 * rx, cy + ry, - cx + rx, cy + C1 * ry, - cx + rx, cy); - - Xr.XrClosePath (native_object); - - Xr.XrFill (native_object); + { + throw new NotImplementedException (); } + [MonoTODO] void IGraphics.FillEllipse (System.Drawing.Brush brush, int x, int y, int width, int height) { - ((IGraphics) this).FillEllipse (brush, (float) x, (float) y, (float) width, (float) height); + throw new NotImplementedException (); } [MonoTODO] diff --git a/mcs/class/System.Drawing/System.Drawing/impl/cairo/Bitmap.cs b/mcs/class/System.Drawing/System.Drawing/impl/cairo/Bitmap.cs deleted file mode 100644 index e61af54cb84..00000000000 --- a/mcs/class/System.Drawing/System.Drawing/impl/cairo/Bitmap.cs +++ /dev/null @@ -1,317 +0,0 @@ -// -// System.Drawing.Bitmap.cs -// -// (C) 2002/3 Ximian, Inc. http://www.ximian.com -// Author: Christian Meyer <Christian.Meyer@cs.tum.edu> -// Jason Perkins <jason@379.com> -// Dennis Hayes <dennish@raytek.com> -// Alexandre Pigolkine <pigolkine@gmx.de> -// -using System; -using System.IO; -using System.Runtime.InteropServices; -using System.Drawing.Imaging; - -namespace System.Drawing.Cairo { - - internal class BitmapFactory : IBitmapFactory - { - public IBitmap Bitmap (int width, int height) - { - return new Bitmap (width, height); - } - - public IBitmap Bitmap (int width, int height, System.Drawing.Graphics g) - { - return new Bitmap (width, height, (Graphics) g.implementation); - } - - public IBitmap Bitmap (int width, int height, System.Drawing.Imaging.PixelFormat format) - { - return new Bitmap (width, height, format); - } - - public IBitmap Bitmap (System.Drawing.Image original, Size newSize) - { - return new Bitmap ((System.Drawing.Cairo.Image) original.implementation, newSize); - } - - public IBitmap Bitmap (Stream stream, bool useIcm) - { - return new Bitmap (stream); - } - - public IBitmap Bitmap (string filename, bool useIcm) - { - return new Bitmap (filename, useIcm); - } - - public IBitmap Bitmap (Type type, string resource) - { - return new Bitmap (type, resource); - } - - public IBitmap Bitmap (int width, int height, int stride, - System.Drawing.Imaging.PixelFormat format, IntPtr scan0) - { - return new Bitmap (width, height, stride, format, scan0); - } - } - - internal sealed class Bitmap : Image, IBitmap { - - float horizontalResolution; - float verticalResolution; - - internal void CommonInit (int width, int height) - { - CommonInit (width, height, true); - } - - internal void CommonInit (int width, int height, bool allocNativeObject) - { - size = new Size (width, height); - imageFormat = ImageFormat.Bmp; - switch( pixelFormat) { - case PixelFormat.Format32bppArgb: - cairo_format = Format.ARGB32; - if (allocNativeObject) - state = Gdk.Pixbuf.New (0, true, 8, width, height); - break; - case PixelFormat.Format24bppRgb: - cairo_format = Format.RGB24; - if (allocNativeObject) - state = Gdk.Pixbuf.New (0, true, 8, width, height); - break; - default: - throw new NotImplementedException (); - } - - horizontalResolution = verticalResolution = 96.0F; - } - -#region constructors - /// <summary> - /// Constructors - /// </summary> - - internal Bitmap (int width, int height) - { - pixelFormat = PixelFormat.Format32bppArgb; - CommonInit (width, height); - } - - internal Bitmap (int width, int height, Graphics g) - { - // TODO: Get pixelFormat from g - CommonInit (width,height); - //TODO: use graphics to set vertial and horzontal resolution. - //TODO: that is all the spec requires or desires - } - - [MonoTODO] - internal Bitmap (int width, int height, PixelFormat format) - { - this.pixelFormat = format; - CommonInit (width, height); - } - - internal Bitmap (Image origial) - { - throw new NotImplementedException (); - //this.original = original; - } - - unsafe void InitFromStream (Stream stream) - { - InternalImageInfo info = System.Drawing.Image.Decode (stream); - if (info != null) { - imageFormat = info.RawFormat; - pixelFormat = info.PixelFormat; - CommonInit (info.Size.Width, info.Size.Height, false); - if (pixelFormat == PixelFormat.Format32bppArgb) { - state = Gdk.Pixbuf.NewFromData ( - info.UnmanagedImagePtr, Gdk.Colorspace.Rgb, true, 8, - ((IImage) this).Size.Width, ((IImage) this).Size.Height, - info.Stride, IntPtr.Zero, IntPtr.Zero); - - } else if (pixelFormat == PixelFormat.Format24bppRgb) { - info.ChangePixelFormat (PixelFormat.Format32bppArgb); - state = Gdk.Pixbuf.NewFromData ( - info.UnmanagedImagePtr, Gdk.Colorspace.Rgb, true, 8, - ((IImage) this).Size.Width, ((IImage) this).Size.Height, - info.Stride, IntPtr.Zero, IntPtr.Zero); - - } else { - throw new NotImplementedException(); - } - // FIXME: It is not safe to dispose the info here - // Memory leak!!! - //info.Dispose(); - } - } - - internal Bitmap (Stream stream) - : this (stream, false) - { - } - - - internal Bitmap (string filename) - : this (filename, false) - { - } - - internal Bitmap (Image original, Size newSize) - { - throw new NotImplementedException (); - //this.original = original; - //this.newSize = newSize; - } - - internal Bitmap (Stream stream, bool useIcm) - { - InitFromStream(stream); - } - - internal Bitmap (string filename, bool useIcm) - { - FileStream file = new FileStream(filename, FileMode.Open); - InitFromStream(file); - file.Close(); - } - - internal Bitmap (Type type, string resource) - { - throw new NotImplementedException (); - //this.type = type; - //this.resource = resource; - } - - internal Bitmap (Image original, int width, int heigth) - { - throw new NotImplementedException (); - //this.original = original; - //this.width = width; - //this.heigth = heigth; - } - - - internal Bitmap ( - int width, int height, int stride, - PixelFormat format, IntPtr scan0) - { - throw new NotImplementedException (); - //this.width = width; - //this.heigth = heigth; - //this.stride = stride; - //this.format = format; - //this.scan0 = scan0; - } -#endregion - - // methods - Color IBitmap.GetPixel (int x, int y) - { - throw new NotImplementedException (); - } - - void IBitmap.SetPixel (int x, int y, Color color) - { - throw new NotImplementedException (); - } - IBitmap IBitmap.Clone (Rectangle rect,PixelFormat format) - { - throw new NotImplementedException (); - } - - IBitmap IBitmap.Clone (RectangleF rect, PixelFormat format) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public static Bitmap FromHicon (IntPtr hicon) { - throw new NotImplementedException (); - } - - [MonoTODO] - public static Bitmap FromResource (IntPtr hinstance, string bitmapName) - { - throw new NotImplementedException (); - } - - IntPtr IBitmap.GetHbitmap () - { - throw new NotImplementedException (); - } - - IntPtr IBitmap.GetHbitmap (Color background) - { - throw new NotImplementedException (); - } - - IntPtr IBitmap.GetHicon () - { - throw new NotImplementedException (); - } - - - [MonoTODO] - BitmapData IBitmap.LockBits (Rectangle rect, ImageLockMode flags, PixelFormat format) - { - throw new NotImplementedException (); - } - - void IBitmap.MakeTransparent () - { - throw new NotImplementedException (); - } - - void IBitmap.MakeTransparent (Color transparentColor) - { - throw new NotImplementedException (); - } - - void IBitmap.SetResolution (float xDpi, float yDpi) - { - horizontalResolution = xDpi; - verticalResolution = yDpi; - } - - //Fixme: gtk should be inherited from Image - PixelFormat IImage.PixelFormat { - get { - return pixelFormat; - } - } - - void IBitmap.UnlockBits (BitmapData bitmapdata) - { - // nothing to do! - } - - // properties - // needs to be done ###FIXME### - - - /// <summary> - /// Methods - /// </summary> - protected override void Dispose (bool disposing) - { - if (selected_into_graphics == null) - Gdk.Pixbuf.Finalize (state); - - base.Dispose(disposing); - } - - //FIXME: included with gtk code. should be inherited from Image. - // [MonoTODO] - // public override void RotateFlip (RotateFlipType rotateFlipType) { - // throw new NotImplementedException(); - // } - - } -} - diff --git a/mcs/class/System.Drawing/System.Drawing/impl/cairo/ChangeLog b/mcs/class/System.Drawing/System.Drawing/impl/cairo/ChangeLog deleted file mode 100644 index a8a13679433..00000000000 --- a/mcs/class/System.Drawing/System.Drawing/impl/cairo/ChangeLog +++ /dev/null @@ -1,31 +0,0 @@ -2003-09-03 Alp Toker <alp@atoker.com> - - cairo-api.cs: typos: drawble -> drawable, tolerence -> tolerance - -2003-08-24 Duncan Mak <duncan@ximian.com> - - * cairo-api.cs: New file, replace Cairo.cs and cairo.cs. That - naming thing is just too confusing. - - * Cairo.cs: Make all references to the enums (Cairo.Foo) be just - Foo. This should (hopefully) fix the build on Windows. - -2003-08-24 Duncan Mak <duncan@ximian.com> - - Initial checkin of System.Drawing.XrImpl ported to use Cairo. - - * Graphics.cs (DrawCurve): - (DrawImageUnscaled): - (IsVisible):Implement the overloads in terms of the other overloads. - - (FillClosedCurve): Implement the simple APIs, the default tension - is 0.5, the default FillMode is FillMode.Alternate. - - * cairo.cs: A copy of the CairoAPI class from the Mono.Cairo - assembly, with some method parameter/return type changed to better - fit the usage within System.Drawing. - - * gdk-helpers.cs: Emulate some of Gdk.Pixbuf's API here, - basically the same as XrImpl's GDKfunctions.cs, but the names of - the functions are nicer, with the help of the DllImportAttribute's - EntryPoint field. diff --git a/mcs/class/System.Drawing/System.Drawing/impl/cairo/Font.cs b/mcs/class/System.Drawing/System.Drawing/impl/cairo/Font.cs deleted file mode 100644 index 7b0aadac1f6..00000000000 --- a/mcs/class/System.Drawing/System.Drawing/impl/cairo/Font.cs +++ /dev/null @@ -1,162 +0,0 @@ -// -// System.Drawing.Font.cs -// -// Author: -// Alexandre Pigolkine (pigolkine@gmx.de) -// -// (C) Ximian, Inc. http://www.ximian.com -// - -using System; -using System.Drawing; - -namespace System.Drawing.Cairo { - - internal class FontFactory : IFontFactory - { - - IFont IFontFactory.Font (FontFamily family, - float emSize, FontStyle style, - GraphicsUnit unit, byte charSet, bool isVertical) { - - return new Font (family, emSize, style, unit, charSet, isVertical); - } - - IFont IFontFactory.Font ( - string familyName, float emSize, FontStyle style, - GraphicsUnit unit, byte charSet, bool isVertical) { - - return new Font (familyName, emSize, style, unit, charSet, isVertical); - } - - IFont IFontFactory.FromHfont(IntPtr font) { - return Win32Impl.Font.FromHfont(font); - } - } - - internal sealed class Font : MarshalByRefObject, IFont - { - FontFamily fontFamily; - byte gdiCharSet; - bool gdiVerticalFont; - int height; - string name; - float size; - float sizeInPoints; - FontStyle style; - GraphicsUnit unit; - - public void Dispose () { - } - - public static Font FromHfont(IntPtr font) - { - //FIXME: how to get those values ? - Font result = new Font("Arial", (float)12.0, FontStyle.Regular, GraphicsUnit.Point, (byte)0, false); - return result; - } - - public IntPtr ToHfont () { throw new NotImplementedException(); } - - public Font(FontFamily family, float size, FontStyle style, GraphicsUnit unit, byte charSet, bool isVertical){ - fontFamily = family; - this.size = size; - this.style = style; - this.unit = unit; - this.gdiCharSet = charSet; - this.gdiVerticalFont = isVertical; - } - - public Font(string familyName, float size, FontStyle style, GraphicsUnit unit, byte charSet, bool isVertical){ - fontFamily = new FontFamily(familyName); - this.size = size; - this.style = style; - this.unit = unit; - this.gdiCharSet = charSet; - this.gdiVerticalFont = isVertical; - } - - internal void initialize (IntPtr cr) - { - Cairo.cairo_select_font (cr, fontFamily.Name + "--" + size); - } - - public bool Bold { - get { - return (style & FontStyle.Bold) == FontStyle.Bold; - } - } - - public FontFamily FontFamily { - get { - return fontFamily; - } - } - - public byte GdiCharSet { - get { - return gdiCharSet; - } - } - - public bool GdiVerticalFont { - get { - return gdiVerticalFont; - } - } - - public int Height { - get { - return height; - } - } - - public bool Italic { - get { - return (style & FontStyle.Italic) == FontStyle.Italic; - } - } - - public string Name { - get { - return name; - } - } - - public float Size { - get { - return size; - } - } - - public float SizeInPoints { - get { - return sizeInPoints; - } - } - - public bool Strikeout { - get { - return (style & FontStyle.Strikeout) == FontStyle.Strikeout; - } - } - - public FontStyle Style { - get { - return style; - } - } - - public bool Underline { - get { - return (style & FontStyle.Underline) == FontStyle.Underline; - } - } - - public GraphicsUnit Unit { - get { - return unit; - } - } - } -} diff --git a/mcs/class/System.Drawing/System.Drawing/impl/cairo/FontFamily.cs b/mcs/class/System.Drawing/System.Drawing/impl/cairo/FontFamily.cs deleted file mode 100644 index 4db9f1e60f3..00000000000 --- a/mcs/class/System.Drawing/System.Drawing/impl/cairo/FontFamily.cs +++ /dev/null @@ -1,92 +0,0 @@ -// -// System.Drawing.XrImpl.FontFamily.cs -// -// Author: -// Alexandre Pigolkine (pigolkine@gmx.de) -// -// - -using System; -using System.Drawing; -using System.Drawing.Text; - -namespace System.Drawing.Cairo { - - internal class FontFamilyFactory : IFontFamilyFactory { - - IFontFamily IFontFamilyFactory.FontFamily(GenericFontFamilies genericFamily){ - return new CairoFontFamily (genericFamily); - } - - IFontFamily IFontFamilyFactory.FontFamily(string familyName){ - return new CairoFontFamily (familyName); - } - - IFontFamily IFontFamilyFactory.FontFamily( string familyName, FontCollection collection){ - return new CairoFontFamily (familyName,collection); - } - - IFontFamily[] IFontFamilyFactory.GetFamilies(System.Drawing.Graphics graphics) { - throw new NotImplementedException(); - } - - } - - internal class CairoFontFamily : MarshalByRefObject, IFontFamily - { - string name; - static CairoFontFamily genericMonospace; - static CairoFontFamily genericSansSerif; - static CairoFontFamily genericSerif; - - public CairoFontFamily (GenericFontFamilies genericFamily) - { - throw new NotImplementedException(); - } - - public CairoFontFamily (string familyName) - { - name = familyName; - } - - public CairoFontFamily (string familyName, FontCollection collection) - { - name = familyName; - } - - public string Name { - get { - return name; - } - } - - public int GetCellAscent (FontStyle style) - { - return 0; - } - - public int GetCellDescent (FontStyle style) - { - return 0; - } - - public int GetEmHeight (FontStyle style) - { - return 0; - } - - public int GetLineSpacing (FontStyle style) - { - return 0; - } - - public bool IsStyleAvailable (FontStyle style) - { - return false; - } - - public void Dispose() - { - } - } -} diff --git a/mcs/class/System.Drawing/System.Drawing/impl/cairo/Graphics.cs b/mcs/class/System.Drawing/System.Drawing/impl/cairo/Graphics.cs deleted file mode 100644 index 980c89dc529..00000000000 --- a/mcs/class/System.Drawing/System.Drawing/impl/cairo/Graphics.cs +++ /dev/null @@ -1,1718 +0,0 @@ -//v -// System.Drawing.Bitmap.cs (Cairo implementation) -// -// (C) 2003 Ximian, Inc. http://www.ximian.com -// -// Author: Duncan Mak (duncan@ximian.com) -// -using System; -using System.Drawing; -using System.Drawing.Drawing2D; -using System.Drawing.Imaging; -using System.Drawing.Text; -using System.Runtime.InteropServices; - -namespace System.Drawing.Cairo { - - internal class GraphicsFactory : IGraphicsFactory { - - public System.Drawing.IGraphics Graphics (IntPtr nativeGraphics) - { - return new Graphics (nativeGraphics); - } - - public System.Drawing.IGraphics FromImage (System.Drawing.Image image) - { - return System.Drawing.Cairo.Graphics.FromImage (image); - } - - public System.Drawing.IGraphics FromHwnd (IntPtr hwnd) - { - return System.Drawing.Cairo.Graphics.FromHwnd (hwnd); - } - } - - - [ComVisible (false)] - internal sealed class Graphics : MarshalByRefObject, IGraphics - { - public delegate bool EnumerateMetafileProc (EmfPlusRecordType recordType, - int flags, - int dataSize, - IntPtr data, - PlayRecordCallback callbackData); - - public delegate bool DrawImageAbort (IntPtr callbackData); - - internal enum GraphicsType { - FromHDC, FromHwnd, FromImage - }; - - internal GraphicsType type; - internal IntPtr state = IntPtr.Zero; - - internal IntPtr initial_hwnd = IntPtr.Zero; - internal System.Drawing.Cairo.Image initialized_from_image = null; - - internal const double C1 = 0.552; // this is some *magic* number - - internal Graphics (IntPtr nativeGraphics) - { - state = nativeGraphics; - } - -#region Converters - internal static Pen ConvertPen (System.Drawing.Pen pen) - { - return pen.implementation as System.Drawing.Cairo.Pen; - } - - internal static Brush ConvertBrush (System.Drawing.Brush brush) - { - return brush.implementation as Brush; - } - - internal static Image ConvertImage (System.Drawing.Image image) - { - return image.implementation as System.Drawing.Cairo.Image; - } - - internal static Font ConvertFont (System.Drawing.Font font) - { - return font.implementation as System.Drawing.Cairo.Font; - } -#endregion - - [MonoTODO] - void IGraphics.AddMetafileComment (byte [] data) - { - throw new NotImplementedException (); - } - - [MonoTODO] - GraphicsContainer IGraphics.BeginContainer () - { - throw new NotImplementedException (); - } - - [MonoTODO] - GraphicsContainer IGraphics.BeginContainer (Rectangle dstrect, Rectangle srcrect, GraphicsUnit unit) - { - throw new NotImplementedException (); - } - - [MonoTODO] - GraphicsContainer IGraphics.BeginContainer (RectangleF dstrect, RectangleF srcrect, GraphicsUnit unit) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.Clear (Color color) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IDisposable.Dispose () - { - switch (type) { - case GraphicsType.FromHwnd: - break; - case GraphicsType.FromHDC: - break; - case GraphicsType.FromImage: - Cairo.cairo_destroy (state); - break; - } - } - - void IGraphics.DrawArc (System.Drawing.Pen pen, Rectangle rect, float startAngle, float sweepAngle) - { - ((IGraphics) this).DrawArc (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle); - } - - void IGraphics.DrawArc (System.Drawing.Pen pen, RectangleF rect, float startAngle, float sweepAngle) - { - ((IGraphics) this).DrawArc (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle); - } - - [MonoTODO] - void IGraphics.DrawArc (System.Drawing.Pen pen, - float x, float y, float width, float height, float startAngle, float sweepAngle) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawArc (System.Drawing.Pen pen, - int x, int y, int width, int height, int startAngle, int sweepAngle) - { - throw new NotImplementedException (); - } - - void IGraphics.DrawBezier (System.Drawing.Pen pen, PointF pt1, PointF pt2, PointF pt3, PointF pt4) - { - ((IGraphics) this).DrawBezier (pen, pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y); - } - - void IGraphics.DrawBezier (System.Drawing.Pen pen, Point pt1, Point pt2, Point pt3, Point pt4) - { - ((IGraphics) this).DrawBezier (pen, pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y); - } - - void IGraphics.DrawBezier (System.Drawing.Pen pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) - { - Pen cPen = ConvertPen (pen); - cPen.initialize (state); - - Cairo.cairo_move_to (state, x1, y1); - Cairo.cairo_curve_to (state, x2, y2, x3, y3, x4, y4); - - Cairo.cairo_stroke (state); - } - - void IGraphics.DrawBeziers (System.Drawing.Pen pen, Point [] points) - { - Pen cPen = ConvertPen (pen); - cPen.initialize (state); - - Cairo.cairo_move_to (state, points [0].X, points [0].Y); - - for (int i = 1; i < points.Length; i += 3) - Cairo.cairo_curve_to ( - state, - points [i].X, points [i].Y, - points [i + 1].X, points [i + 1].Y, - points [i + 2].X, points [i + 2].Y); - - Cairo.cairo_stroke (state); - } - - void IGraphics.DrawBeziers (System.Drawing.Pen pen, PointF [] points) - { - Pen cPen = ConvertPen (pen); - cPen.initialize (state); - - Cairo.cairo_move_to (state, points [0].X, points [0].Y); - - for (int i = 1; i < points.Length; i += 3) - Cairo.cairo_curve_to ( - state, - points [i].X, points [i].Y, - points [i + 1].X, points [i + 1].Y, - points [i + 2].X, points [i + 2].Y); - - Cairo.cairo_stroke (state); - } - - [MonoTODO] - void IGraphics.DrawClosedCurve (System.Drawing.Pen pen, PointF [] points) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawClosedCurve (System.Drawing.Pen pen, Point [] points) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawClosedCurve (System.Drawing.Pen pen, Point [] points, float tension, FillMode fillmode) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawClosedCurve (System.Drawing.Pen pen, PointF [] points, float tension, FillMode fillmode) - { - throw new NotImplementedException (); - } - - void IGraphics.DrawCurve (System.Drawing.Pen pen, Point [] points) - { - ((IGraphics) this).DrawCurve (pen, points, 0.5f); - } - - [MonoTODO] - void IGraphics.DrawCurve (System.Drawing.Pen pen, PointF [] points) - { - ((IGraphics) this).DrawCurve (pen, points, 0.5f); - } - - [MonoTODO] - void IGraphics.DrawCurve (System.Drawing.Pen pen, PointF [] points, float tension) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawCurve (System.Drawing.Pen pen, Point [] points, float tension) - { - throw new NotImplementedException (); - } - - void IGraphics.DrawCurve (System.Drawing.Pen pen, PointF [] points, int offset, int numberOfSegments) - { - ((IGraphics) this).DrawCurve (pen, points, offset, numberOfSegments, 0.5f); - } - - [MonoTODO] - void IGraphics.DrawCurve (System.Drawing.Pen pen, Point [] points, int offset, int numberOfSegments, float tension) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawCurve (System.Drawing.Pen pen, PointF [] points, int offset, int numberOfSegments, float tension) - { - throw new NotImplementedException (); - } - - void IGraphics.DrawEllipse (System.Drawing.Pen pen, Rectangle rect) - { - ((IGraphics) this).DrawEllipse (pen, rect.X, rect.Y, rect.Width, rect.Height); - } - - void IGraphics.DrawEllipse (System.Drawing.Pen pen, RectangleF rect) - { - ((IGraphics) this).DrawEllipse (pen, rect.X, rect.Y, rect.Width, rect.Height); - } - - void IGraphics.DrawEllipse (System.Drawing.Pen pen, int x, int y, int width, int height) - { - ((IGraphics) this).DrawEllipse (pen, (float) x, (float) y, (float) width, (float) height); - } - - void IGraphics.DrawEllipse (System.Drawing.Pen pen, float x, float y, float width, float height) - { - double rx = width / 2; - double ry = height / 2; - double cx = x + rx; - double cy = y + ry; - - Pen cPen = ConvertPen (pen); - - cPen.initialize (state); - Cairo.cairo_move_to (state, cx + rx, cy); - - // Do an approprimation of the ellipse by drawing a curve in each quatrant - Cairo.cairo_curve_to ( - state, - cx + rx, cy - C1 * ry, - cx + C1 * rx, cy - ry, - cx, cy - ry); - Cairo.cairo_curve_to ( - state, - cx - C1 * rx, cy - ry, - cx - rx, cy - C1 * ry, - cx - rx, cy); - Cairo.cairo_curve_to ( - state, - cx - rx, cy + C1 * ry, - cx - C1 * rx, cy + ry, - cx, cy + ry); - Cairo.cairo_curve_to ( - state, - cx + C1 * rx, cy + ry, - cx + rx, cy + C1 * ry, - cx + rx, cy); - - Cairo.cairo_close_path (state); - Cairo.cairo_stroke (state); - } - - [MonoTODO] - void IGraphics.DrawIcon (System.Drawing.Icon icon, Rectangle targetRect) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawIcon (System.Drawing.Icon icon, int x, int y) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawIconUnstretched (System.Drawing.Icon icon, Rectangle targetRect) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImage (System.Drawing.Image image, RectangleF rect) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImage (System.Drawing.Image image, PointF point) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImage (System.Drawing.Image image, Point [] destPoints) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImage (System.Drawing.Image image, Point point) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImage (System.Drawing.Image image, Rectangle rect) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImage (System.Drawing.Image image, PointF [] destPoints) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImage (System.Drawing.Image image, int x, int y) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImage (System.Drawing.Image image, float x, float y) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImage (System.Drawing.Image image, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImage (System.Drawing.Image image, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImage (System.Drawing.Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImage (System.Drawing.Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImage (System.Drawing.Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImage (System.Drawing.Image image, float x, float y, float width, float height) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImage (System.Drawing.Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImage (System.Drawing.Image image, int x, int y, Rectangle srcRect, GraphicsUnit srcUnit) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImage (System.Drawing.Image image, int x, int y, int width, int height) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImage (System.Drawing.Image image, float x, float y, RectangleF srcRect, GraphicsUnit srcUnit) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImage (System.Drawing.Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, System.Drawing.Graphics.DrawImageAbort callback) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImage (System.Drawing.Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, System.Drawing.Graphics.DrawImageAbort callback) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImage (System.Drawing.Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, System.Drawing.Graphics.DrawImageAbort callback, int callbackData) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImage (System.Drawing.Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImage (System.Drawing.Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, System.Drawing.Graphics.DrawImageAbort callback, int callbackData) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImage (System.Drawing.Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImage (System.Drawing.Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImage (System.Drawing.Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImage (System.Drawing.Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, System.Drawing.Graphics.DrawImageAbort callback) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImage (System.Drawing.Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, System.Drawing.Graphics.DrawImageAbort callback) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImage (System.Drawing.Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, System.Drawing.Graphics.DrawImageAbort callback, IntPtr callbackData) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImage (System.Drawing.Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, System.Drawing.Graphics.DrawImageAbort callback, IntPtr callbackData) - { - throw new NotImplementedException (); - } - - void IGraphics.DrawImageUnscaled (System.Drawing.Image image, Point point) - { - ((IGraphics) this).DrawImageUnscaled (image, point.X, point.Y); - } - - void IGraphics.DrawImageUnscaled (System.Drawing.Image image, Rectangle rect) - { - ((IGraphics) this).DrawImageUnscaled (image, rect.X, rect.Y, rect.Width, rect.Height); - } - - [MonoTODO] - void IGraphics.DrawImageUnscaled (System.Drawing.Image image, int x, int y) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawImageUnscaled (System.Drawing.Image image, int x, int y, int width, int height) - { - throw new NotImplementedException (); - } - - void DrawLine (Pen cPen, float x1, float y1, float x2, float y2) - { - cPen.initialize (state); - Cairo.cairo_move_to (state, (double) x1, (double) y1); - Cairo.cairo_line_to (state, (double) x2, (double) y2); - Cairo.cairo_stroke (state); - } - - [MonoTODO] - void IGraphics.DrawLine (System.Drawing.Pen pen, PointF pt1, PointF pt2) - { - DrawLine (ConvertPen (pen), pt1.X, pt1.Y, pt2.X, pt2.Y); - } - - [MonoTODO] - void IGraphics.DrawLine (System.Drawing.Pen pen, Point pt1, Point pt2) - { - DrawLine (ConvertPen (pen), - (float) pt1.X, (float) pt1.Y, - (float) pt2.X, (float) pt2.Y); - } - - [MonoTODO] - void IGraphics.DrawLine (System.Drawing.Pen pen, int x1, int y1, int x2, int y2) - { - DrawLine (ConvertPen (pen), - (float) x1, (float) y1, - (float) x2, (float) y2); - } - - [MonoTODO] - void IGraphics.DrawLine (System.Drawing.Pen pen, float x1, float y1, float x2, float y2) - { - DrawLine (ConvertPen (pen), x1, y1, x2, y2); - } - - [MonoTODO] - void IGraphics.DrawLines (System.Drawing.Pen pen, PointF [] points) - { - if (points.Length == 0) - return; - - Pen cPen = ConvertPen (pen); - cPen.initialize (state); - Cairo.cairo_move_to (state, (double) points [0].X, (double) points [0].Y); - - if (points.Length == 1) - Cairo.cairo_line_to (state, (double) points [0].X, (double) points [0].Y); - - else - for (int i = 1; i < points.Length; i++) - Cairo.cairo_line_to (state, (double) points [i].X, (double) points [i].Y); - - Cairo.cairo_stroke (state); - } - - [MonoTODO] - void IGraphics.DrawLines (System.Drawing.Pen pen, Point [] points) - { - if (points.Length == 0) - return; - - PointF [] pointsf = new PointF [points.Length]; - - for (int i = 0; i < points.Length; i++) - pointsf [i] = new PointF (points [i].X, points [i].Y); - - ((IGraphics) this).DrawLines (pen, pointsf); - } - - [MonoTODO] - void IGraphics.DrawPath (System.Drawing.Pen pen, GraphicsPath path) - { - throw new NotImplementedException (); - } - - void IGraphics.DrawPie (System.Drawing.Pen pen, Rectangle rect, float startAngle, float sweepAngle) - { - ((IGraphics) this).DrawPie (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle); - } - - void IGraphics.DrawPie (System.Drawing.Pen pen, RectangleF rect, float startAngle, float sweepAngle) - { - ((IGraphics) this).DrawPie (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle); - } - - [MonoTODO] - void IGraphics.DrawPie (System.Drawing.Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawPie (System.Drawing.Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle) - { - throw new NotImplementedException (); - } - - void IGraphics.DrawPolygon (System.Drawing.Pen pen, Point [] points) - { - Pen cPen = ConvertPen (pen); - - cPen.initialize (state); - Cairo.cairo_move_to (state, (double) points [0].X, (double) points [0].Y); - - for (int i = 1; i < points.Length; i ++) - Cairo.cairo_line_to (state, (double) points [i].X, (double) points [i].Y); - - Cairo.cairo_close_path (state); - Cairo.cairo_stroke (state); - } - - void IGraphics.DrawPolygon (System.Drawing.Pen pen, PointF [] points) - { - Pen cPen = ConvertPen (pen); - - cPen.initialize (state); - - for (int i = 0; i < points.Length; i += 2) - ((IGraphics) this).DrawLine (pen, points [i], points [i + 1]); - - Cairo.cairo_close_path (state); - Cairo.cairo_stroke (state); - } - - void IGraphics.DrawRectangle (System.Drawing.Pen pen, Rectangle rect) - { - DrawRectangle ( - ConvertPen (pen), - (double) rect.Left, (double) rect.Top, - (double) rect.Width, (double)rect.Height); - } - - [MonoTODO] - void IGraphics.DrawRectangle (System.Drawing.Pen pen, float x, float y, float width, float height) - { - DrawRectangle ( - ConvertPen (pen), - (double) x, (double) y, - (double) width, (double) height); - } - - void DrawRectangle (Pen cPen, double x, double y, double width, double height) - { - cPen.initialize (state); - - Cairo.cairo_move_to (state, x, y); - Cairo.cairo_line_to (state, x + width, y); - Cairo.cairo_line_to (state, x + width, y + height); - Cairo.cairo_line_to (state, x, y + height); - Cairo.cairo_line_to (state, x, y); - Cairo.cairo_stroke (state); - } - - void IGraphics.DrawRectangle (System.Drawing.Pen pen, int x, int y, int width, int height) - { - DrawRectangle ( - ConvertPen (pen), - (double) x, (double) y, - (double) width, (double) height); - } - - void IGraphics.DrawRectangles (System.Drawing.Pen pen, RectangleF [] rects) - { - foreach (RectangleF rc in rects) - DrawRectangle ( - ConvertPen (pen), - (double) rc.Left, (double) rc.Top, - (double) rc.Width, (double) rc.Height); - } - - void IGraphics.DrawRectangles (System.Drawing.Pen pen, Rectangle [] rects) - { - foreach (RectangleF rc in rects) - DrawRectangle ( - ConvertPen (pen), - (double) rc.Left, (double) rc.Top, - (double) rc.Width, (double) rc.Height); - } - - [MonoTODO] - void IGraphics.DrawString (string s, System.Drawing.Font font, System.Drawing.Brush brush, RectangleF layoutRectangle) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawString (string s, System.Drawing.Font font, System.Drawing.Brush brush, PointF point) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawString (string s, System.Drawing.Font font, System.Drawing.Brush brush, PointF point, StringFormat format) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawString (string s, System.Drawing.Font font, System.Drawing.Brush brush, RectangleF layoutRectangle, StringFormat format) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.DrawString (string s, System.Drawing.Font font, System.Drawing.Brush brush, float x, float y) - { - Font cFont = ConvertFont (font); - cFont.initialize (state); - Brush cBrush = ConvertBrush (brush); - if (cBrush is SolidBrush) { - SolidBrush cSolidBrush = cBrush as SolidBrush; - cSolidBrush.initialize (state); - Cairo.cairo_move_to (state, (double) x, (double) y); - Cairo.cairo_show_text (state, s); - } - } - - [MonoTODO] - void IGraphics.DrawString (string s, System.Drawing.Font font, System.Drawing.Brush brush, float x, float y, StringFormat format) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EndContainer (GraphicsContainer container) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, Point [] destPoints, System.Drawing.Graphics.EnumerateMetafileProc callback) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, RectangleF destRect, System.Drawing.Graphics.EnumerateMetafileProc callback) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, PointF [] destPoints, System.Drawing.Graphics.EnumerateMetafileProc callback) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, Rectangle destRect, System.Drawing.Graphics.EnumerateMetafileProc callback) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, Point destPoint, System.Drawing.Graphics.EnumerateMetafileProc callback) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, PointF destPoint, System.Drawing.Graphics.EnumerateMetafileProc callback) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, PointF destPoint, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, Rectangle destRect, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, PointF [] destPoints, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, Point destPoint, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, Point [] destPoints, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, RectangleF destRect, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, RectangleF destRect, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, Point destPoint, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, PointF destPoint, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, Point [] destPoints, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, PointF [] destPoints, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, Rectangle destRect, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit unit, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit unit, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit unit, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit unit, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit unit, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.EnumerateMetafile (Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit unit, System.Drawing.Graphics.EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.ExcludeClip (Rectangle rect) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.ExcludeClip (System.Drawing.Region region) - { - throw new NotImplementedException (); - } - - void IGraphics.FillClosedCurve (System.Drawing.Brush brush, PointF [] points) - { - ((IGraphics) this).FillClosedCurve (brush, points, FillMode.Alternate, 0.5f); - } - - void IGraphics.FillClosedCurve (System.Drawing.Brush brush, Point [] points) - { - ((IGraphics) this).FillClosedCurve (brush, points, FillMode.Alternate, 0.5f); - } - - void IGraphics.FillClosedCurve (System.Drawing.Brush brush, PointF [] points, FillMode fillmode) - { - ((IGraphics) this).FillClosedCurve (brush, points, fillmode, 0.5f); - } - - void IGraphics.FillClosedCurve (System.Drawing.Brush brush, Point [] points, FillMode fillmode) - { - ((IGraphics) this).FillClosedCurve (brush, points, fillmode, 0.5f); - } - - [MonoTODO] - void IGraphics.FillClosedCurve (System.Drawing.Brush brush, PointF [] points, FillMode fillmode, float tension) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.FillClosedCurve (System.Drawing.Brush brush, Point [] points, FillMode fillmode, float tension) - { - throw new NotImplementedException (); - } - - void IGraphics.FillEllipse (System.Drawing.Brush brush, Rectangle rect) - { - ((IGraphics) this).FillEllipse (brush, rect.X, rect.Y, rect.Width, rect.Height); - } - - void IGraphics.FillEllipse (System.Drawing.Brush brush, RectangleF rect) - { - ((IGraphics) this).FillEllipse (brush, rect.X, rect.Y, rect.Width, rect.Height); - } - - void IGraphics.FillEllipse (System.Drawing.Brush brush, float x, float y, float width, float height) - { - double rx = width / 2; - double ry = height / 2; - double cx = x + rx; - double cy = y + ry; - - Brush cBrush = ConvertBrush (brush); - // cBrush.initialize (state); - Cairo.cairo_move_to (state, cx + rx, cy); - - Cairo.cairo_curve_to ( - state, - cx + rx, cy - C1 * ry, - cx + C1 * rx, cy - ry, - cx, cy - ry); - - Cairo.cairo_curve_to ( - state, - cx - C1 * rx, cy - ry, - cx - rx, cy - C1 * ry, - cx - rx, cy); - - Cairo.cairo_curve_to ( - state, - cx - rx, cy + C1 * ry, - cx - C1 * rx, cy + ry, - cx, cy + ry); - - Cairo.cairo_curve_to ( - state, - cx + C1 * rx, cy + ry, - cx + rx, cy + C1 * ry, - cx + rx, cy); - - Cairo.cairo_close_path (state); - - Cairo.cairo_fill (state); - } - - void IGraphics.FillEllipse (System.Drawing.Brush brush, int x, int y, int width, int height) - { - ((IGraphics) this).FillEllipse (brush, (float) x, (float) y, (float) width, (float) height); - } - - [MonoTODO] - void IGraphics.FillPath (System.Drawing.Brush brush, GraphicsPath path) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.FillPie (System.Drawing.Brush brush, Rectangle rect, float startAngle, float sweepAngle) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.FillPie (System.Drawing.Brush brush, int x, int y, int width, int height, int startAngle, int sweepAngle) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.FillPie (System.Drawing.Brush brush, float x, float y, float width, float height, float startAngle, float sweepAngle) - { - throw new NotImplementedException (); - } - - void IGraphics.FillPolygon (System.Drawing.Brush brush, PointF [] points) - { - ((IGraphics) this).FillPolygon (brush, points, FillMode.Alternate); - } - - void IGraphics.FillPolygon (System.Drawing.Brush brush, Point [] points) - { - ((IGraphics) this).FillPolygon (brush, points, FillMode.Alternate); - } - - [MonoTODO] - void IGraphics.FillPolygon (System.Drawing.Brush brush, Point [] points, FillMode fillMode) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.FillPolygon (System.Drawing.Brush brush, PointF [] points, FillMode fillMode) - { - throw new NotImplementedException (); - } - - void IGraphics.FillRectangle (System.Drawing.Brush brush, RectangleF rect) - { - FillRectangle (ConvertBrush (brush), rect.Left, rect.Top, rect.Width, rect.Height); - } - - void IGraphics.FillRectangle (System.Drawing.Brush brush, Rectangle rect) - { - FillRectangle ( - ConvertBrush (brush), - (float) rect.Left, (float) rect.Top, - (float) rect.Width, (float) rect.Height); - } - - void FillRectangle (Brush brush, RectangleF rect) - { - FillRectangle (brush, rect.Left, rect.Top, rect.Width, rect.Height); - } - - void FillRectangle (Brush brush, Rectangle rect) - { - FillRectangle ( - brush, - (float) rect.Left, (float) rect.Top, - (float) rect.Width, (float) rect.Height); - } - - void FillRectangle (Brush brush, float x, float y, float width, float height) - { - if (brush is SolidBrush) { - SolidBrush cBrush = brush as SolidBrush; - cBrush.initialize (state); - Cairo.cairo_rectangle (state, x, y, width, height); - Cairo.cairo_fill (state); - } - } - - void IGraphics.FillRectangle (System.Drawing.Brush brush, int x, int y, int width, int height) - { - FillRectangle (brush, (float)x, (float)y, (float)width, (float)height); - } - - void IGraphics.FillRectangle (System.Drawing.Brush brush, float x, float y, float width, float height) - { - FillRectangle (ConvertBrush (brush), x, y, width, height); - } - - [MonoTODO] - void IGraphics.FillRectangles (System.Drawing.Brush brush, Rectangle [] rects) - { - if (rects == null) - return; - - foreach (Rectangle rc in rects) - FillRectangle (ConvertBrush (brush), rc); - } - - [MonoTODO] - void IGraphics.FillRectangles (System.Drawing.Brush brush, RectangleF [] rects) - { - if (rects == null) - return; - - foreach (RectangleF rc in rects) - FillRectangle (ConvertBrush (brush), rc); - } - - [MonoTODO] - void IGraphics.FillRegion (System.Drawing.Brush brush, System.Drawing.Region region) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.Flush () - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.Flush (FlushIntention intention) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public static Graphics FromHdc (IntPtr hdc) - { - Graphics result = new Graphics (hdc); - result.type = GraphicsType.FromHDC; - return result; - } - - [MonoTODO] - public static Graphics FromHdc (IntPtr hdc, IntPtr hdevice) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public static Graphics FromHdcInternal (IntPtr hdc) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public static Graphics FromHwnd (IntPtr hwnd) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public static Graphics FromHwndInternal (IntPtr hwnd) - { - throw new NotImplementedException (); - } - - // TODO - [MonoTODO] - public static Graphics FromImage (System.Drawing.Image image) - { - System.Drawing.Cairo.Image cairo_image = ConvertImage (image); - IntPtr native = Cairo.cairo_create (); - Graphics result = new Graphics (native); - - Cairo.cairo_set_target_image (native, - Gdk.Pixbuf.GetPixels (cairo_image.state), - cairo_image.cairo_format, - ((IImage) cairo_image).Width, ((IImage) cairo_image).Height, - Gdk.Pixbuf.GetRowstride (cairo_image.state)); - - cairo_image.selected_into_graphics = result; - result.initialized_from_image = cairo_image; - result.type = GraphicsType.FromImage; - return result; - } - - [MonoTODO] - public static IntPtr GetHalftonePalette () - { - throw new NotImplementedException (); - } - - [MonoTODO] - public IntPtr GetHdc () - { - return state; - } - - [MonoTODO] - public Color GetNearestColor (Color color) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.IntersectClip (System.Drawing.Region region) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.IntersectClip (RectangleF rect) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.IntersectClip (Rectangle rect) - { - throw new NotImplementedException (); - } - - public bool IsVisible (Point point) - { - return IsVisible (point.X, point.Y); - } - - public bool IsVisible (RectangleF rect) - { - return IsVisible (rect.X, rect.Y, rect.Width, rect.Height); - } - - public bool IsVisible (PointF point) - { - return IsVisible (point.X, point.Y); - } - - public bool IsVisible (Rectangle rect) - { - return IsVisible (rect.X, rect.Y, rect.Width, rect.Height); - } - - [MonoTODO] - public bool IsVisible (float x, float y) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public bool IsVisible (int x, int y) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public bool IsVisible (float x, float y, float width, float height) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public bool IsVisible (int x, int y, int width, int height) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public System.Drawing.Region [] MeasureCharacterRanges (string text, System.Drawing.Font font, RectangleF layoutRect, StringFormat stringFormat) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public SizeF MeasureString (string text, System.Drawing.Font font) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public SizeF MeasureString (string text, System.Drawing.Font font, SizeF layoutArea) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public SizeF MeasureString (string text, System.Drawing.Font font, int width) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public SizeF MeasureString (string text, System.Drawing.Font font, SizeF layoutArea, StringFormat stringFormat) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public SizeF MeasureString (string text, System.Drawing.Font font, int width, StringFormat format) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public SizeF MeasureString (string text, System.Drawing.Font font, PointF origin, StringFormat stringFormat) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public SizeF MeasureString (string text, System.Drawing.Font font, SizeF layoutArea, StringFormat stringFormat, ref int charactersFitted, ref int linesFilled) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.MultiplyTransform (Matrix matrix) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.MultiplyTransform (Matrix matrix, MatrixOrder order) - { - throw new NotImplementedException (); - } - - [MonoTODO] - internal void ReleaseHdc (IntPtr hdc) - { - } - - [MonoTODO] - void IGraphics.ReleaseHdc (IntPtr hdc) - { - } - - [MonoTODO] - void IGraphics.ReleaseHdcInternal (IntPtr hdc) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.ResetClip () - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.ResetTransform () - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.Restore (GraphicsState gstate) - { - Cairo.cairo_restore (state); - } - - void IGraphics.RotateTransform (float angle) - { - double rad = angle * Math.PI / 180.0; - Cairo.cairo_rotate (state, rad); - } - - [MonoTODO] - void IGraphics.RotateTransform (float angle, MatrixOrder order) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public GraphicsState Save () - { - Cairo.cairo_save (state); - return new GraphicsState (); - } - - [MonoTODO] - void IGraphics.ScaleTransform (float sx, float sy) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.ScaleTransform (float sx, float sy, MatrixOrder order) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.SetClip (RectangleF rect) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.SetClip (GraphicsPath path) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.SetClip (Rectangle rect) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.SetClip (System.Drawing.Graphics g) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.SetClip (System.Drawing.Graphics g, CombineMode combineMode) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.SetClip (Rectangle rect, CombineMode combineMode) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.SetClip (RectangleF rect, CombineMode combineMode) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.SetClip (System.Drawing.Region region, CombineMode combineMode) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.SetClip (GraphicsPath path, CombineMode combineMode) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.TransformPoints (CoordinateSpace destSpace, CoordinateSpace srcSpace, PointF [] pts) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.TransformPoints (CoordinateSpace destSpace, CoordinateSpace srcSpace, Point [] pts) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.TranslateClip (int dx, int dy) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.TranslateClip (float dx, float dy) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IGraphics.TranslateTransform (float dx, float dy) - { - Cairo.cairo_translate (state, (double) dx, (double) dy); - } - - [MonoTODO] - void IGraphics.TranslateTransform (float dx, float dy, MatrixOrder order) - { - throw new NotImplementedException (); - } - - System.Drawing.Region System.Drawing.IGraphics.Clip { - get { - throw new NotImplementedException (); - } - set { - //throw new NotImplementedException (); - } - } - - RectangleF IGraphics.ClipBounds { - get { - throw new NotImplementedException (); - } - } - - CompositingMode IGraphics.CompositingMode { - get { - throw new NotImplementedException (); - } - set { - throw new NotImplementedException (); - } - - } - CompositingQuality IGraphics.CompositingQuality { - get { - throw new NotImplementedException (); - } - set { - throw new NotImplementedException (); - } - } - - float IGraphics.DpiX { - get { - throw new NotImplementedException (); - } - } - - float IGraphics.DpiY { - get { - throw new NotImplementedException (); - } - } - - InterpolationMode IGraphics.InterpolationMode { - get { - throw new NotImplementedException (); - } - set { - throw new NotImplementedException (); - } - } - - bool IGraphics.IsClipEmpty { - get { - throw new NotImplementedException (); - } - } - - bool IGraphics.IsVisibleClipEmpty { - get { - throw new NotImplementedException (); - } - } - - float IGraphics.PageScale { - get { - throw new NotImplementedException (); - } - - set { - throw new NotImplementedException (); - } - } - - GraphicsUnit IGraphics.PageUnit { - get { - throw new NotImplementedException (); - } - set { - throw new NotImplementedException (); - } - } - - PixelOffsetMode IGraphics.PixelOffsetMode { - get { - throw new NotImplementedException (); - } - set { - throw new NotImplementedException (); - } - } - - Point IGraphics.RenderingOrigin { - get { - throw new NotImplementedException (); - } - set { - throw new NotImplementedException (); - } - } - - SmoothingMode IGraphics.SmoothingMode { - get { - throw new NotImplementedException (); - } - - set { - throw new NotImplementedException (); - } - } - - int IGraphics.TextContrast { - get { - throw new NotImplementedException (); - } - - set { - throw new NotImplementedException (); - } - } - - TextRenderingHint IGraphics.TextRenderingHint { - get { - throw new NotImplementedException (); - } - - set { - throw new NotImplementedException (); - } - } - - Matrix IGraphics.Transform { - get { - throw new NotImplementedException (); - } - - set { - throw new NotImplementedException (); - } - } - - RectangleF IGraphics.VisibleClipBounds { - get { - throw new NotImplementedException (); - } - } - } -} - diff --git a/mcs/class/System.Drawing/System.Drawing/impl/cairo/Image.cs b/mcs/class/System.Drawing/System.Drawing/impl/cairo/Image.cs deleted file mode 100644 index 79c094db770..00000000000 --- a/mcs/class/System.Drawing/System.Drawing/impl/cairo/Image.cs +++ /dev/null @@ -1,279 +0,0 @@ -// -// System.Drawing.Image.cs -// -// (C) 2002/3 Ximian, Inc. http://www.ximian.com -// Authors: -// Christian Meyer <Christian.Meyer@cs.tum.edu> -// Jason Perkins <jason@379.com> -// Dennis Hayes <dennish@raytek.com> -// Alexandre Pigolkine <pigolkine@gmx.de> - -using System; -using System.Runtime.Remoting; -using System.Runtime.Serialization; -using System.Drawing.Imaging; -using System.IO; -using System.Runtime.InteropServices; - -namespace System.Drawing.Cairo { - //[Serializable] - //[ComVisible(true)] - - internal abstract class Image : MarshalByRefObject, IImage /*, ICloneable, ISerializable */ - { - - internal IntPtr state; - internal Format cairo_format; - internal System.Drawing.Cairo.Graphics selected_into_graphics = null; - internal Size size; - internal PixelFormat pixelFormat; - protected ImageFormat imageFormat; - - // constructor - public Image () {} - - [MonoTODO] - public virtual object Clone() - { - throw new NotImplementedException (); - } - - // public methods - // static - public static Image FromFile (string filename) - { - // Fixme: implement me - throw new NotImplementedException (); - } - - public static Image FromFile (string filename, bool useEmbeddedColorManagement) - { - - // Fixme: implement me - throw new NotImplementedException (); - } - - public static Bitmap FromHbitmap (IntPtr hbitmap) - { - // Fixme: implement me - throw new NotImplementedException (); - } - - public static Bitmap FromHbitmap (IntPtr hbitmap, IntPtr hpalette) - { - // Fixme: implement me - throw new NotImplementedException (); - } - - [MonoTODO] - public static Image FromStream (Stream stream) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public static Image FromStream (Stream stream, bool useIcm) - { - throw new NotImplementedException (); - } - - public static int GetPixelFormatSize (PixelFormat pixfmt) - { - // Fixme: implement me - throw new NotImplementedException (); - } - - public static bool IsAlphaPixelFormat (PixelFormat pixfmt) - { - // Fixme: implement me - throw new NotImplementedException (); - } - - public static bool IsCanonicalPixelFormat (PixelFormat pixfmt) - { - // Fixme: implement me - throw new NotImplementedException (); - } - - public static bool IsExtendedPixelFormat (PixelFormat pixfmt) - { - // Fixme: implement me - throw new NotImplementedException (); - } - - // non-static - RectangleF IImage.GetBounds (ref GraphicsUnit pageUnit) - { - // Fixme: implement me - throw new NotImplementedException (); - } - - [MonoTODO] - int IImage.GetFrameCount (FrameDimension dimension) - { - throw new NotImplementedException (); - } - - [MonoTODO] - PropertyItem IImage.GetPropertyItem (int propid) - { - throw new NotImplementedException(); - } - - void IImage.RemovePropertyItem (int propid) - { - // Fixme: implement me - throw new NotImplementedException (); - } - - void IImage.RotateFlip (RotateFlipType rotateFlipType) - { - // Fixme: implement me - throw new NotImplementedException (); - } - - protected InternalImageInfo sourceImageInfo = null; - unsafe InternalImageInfo IImage.ConvertToInternalImageInfo () - { - - if (sourceImageInfo == null) { - sourceImageInfo = new InternalImageInfo(); - sourceImageInfo.Size = size; - sourceImageInfo.RawFormat = imageFormat; - sourceImageInfo.PixelFormat = PixelFormat.Format32bppArgb; - sourceImageInfo.Stride = Gdk.Pixbuf.GetRowstride (state); - sourceImageInfo.RawImageBytes = new byte[sourceImageInfo.Stride * size.Height]; - IntPtr memptr = Gdk.Pixbuf.GetPixels (state); - Marshal.Copy( memptr, sourceImageInfo.RawImageBytes, 0, sourceImageInfo.RawImageBytes.Length); - sourceImageInfo.ChangePixelFormat (pixelFormat); - } - return sourceImageInfo; - } - - void IImage.Save (string filename) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IImage.Save(Stream stream, ImageFormat format) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IImage.Save (string filename, ImageFormat format) - { - throw new NotImplementedException (); - } - - [MonoTODO] - int IImage.SelectActiveFrame (FrameDimension dimension, int frameIndex) - { - throw new NotImplementedException(); - } - - [MonoTODO] - void IImage.SetPropertyItem (PropertyItem item) - { - throw new NotImplementedException(); - } - // destructor - ~Image() {} - - // properties - int IImage.Flags { - get { - throw new NotImplementedException (); - } - } - - Guid [] IImage.FrameDimensionsList { - get { - throw new NotImplementedException (); - } - } - - int IImage.Height { - get { - return size.Height; - } - } - - float IImage.HorizontalResolution { - get { - throw new NotImplementedException (); - } - } - - ColorPalette IImage.Palette { - get { - throw new NotImplementedException (); - } - set { - throw new NotImplementedException (); - } - } - - SizeF IImage.PhysicalDimension { - get { - throw new NotImplementedException (); - } - } - - PixelFormat IImage.PixelFormat { - get { - return pixelFormat; - } - } - - int [] IImage.PropertyIdList { - get { - throw new NotImplementedException (); - } - } - - PropertyItem [] IImage.PropertyItems { - [MonoTODO] - get { - throw new NotImplementedException(); - } - } - - ImageFormat IImage.RawFormat { - [MonoTODO] - get { - return imageFormat; - } - } - - Size IImage.Size { - get { - return size; - } - } - - float IImage.VerticalResolution { - get { - throw new NotImplementedException (); - } - } - - int IImage.Width { - get { - return size.Width; - } - } - - [MonoTODO] - public void Dispose () - { - } - - [MonoTODO] - protected virtual void Dispose (bool disposing) - { - throw new NotImplementedException(); - } - } -} diff --git a/mcs/class/System.Drawing/System.Drawing/impl/cairo/Pen.cs b/mcs/class/System.Drawing/System.Drawing/impl/cairo/Pen.cs deleted file mode 100644 index 7dc4c12c8ec..00000000000 --- a/mcs/class/System.Drawing/System.Drawing/impl/cairo/Pen.cs +++ /dev/null @@ -1,141 +0,0 @@ -// -// System.Drawing.Pen.cs -// -// Author: -// Miguel de Icaza (miguel@ximian.com) -// Alexandre Pigolkine(pigolkine@gmx.de) -// -// -// (C) Ximian, Inc. http://www.ximian.com -// - -using System; - -namespace System.Drawing.Cairo { - - internal class PenFactory : IPenFactory - { - public IPen Pen (System.Drawing.Brush brush, float width) - { - return new Pen (brush, width); - } - - public IPen Pen (System.Drawing.Color color, float width) - { - return new Pen (color, width); - } - } - - public sealed class Pen : MarshalByRefObject, IPen - { - System.Drawing.Brush brush = null; - Color color = Color.Black; - float width = 1.0F; - - void CommonInit() - { - //nativeObject_ = Xr.MonoGI_CreatePen((double)color.R, (double)color.G, (double)color.B,(double)width); - } - - public Pen (System.Drawing.Brush brush) - { - this.brush = brush; - // FIXME: get color from brush - CommonInit(); - } - - public Pen (Color color) - { - this.color = color; - CommonInit(); - } - - public Pen (System.Drawing.Brush brush, float width) - { - this.width = width; - this.brush = brush; - // FIXME: get color from brush - CommonInit(); - } - - public Pen (Color color, float width) - { - this.width = width; - this.color = color; - CommonInit(); - } - - internal void initialize (IntPtr cs) - { - Cairo.cairo_set_rgb_color (cs, - (double) color.R, - (double) color.G, - (double) color.B); - - Cairo.cairo_set_line_width (cs, (double) width); - } - - // - // Properties - // - // public PenAlignment Alignment { - // get { - // return alignment; - // } - // - // set { - // alignment = value; - // } - // } - - System.Drawing.Brush IPen.Brush { - get { - return brush; - } - - set { - brush = value; - } - } - - Color IPen.Color { - get { - return color; - } - - set { - color = value; - } - } - - float IPen.Width { - get { - return width; - } - - set { - width = value; - } - } - - void IDisposable.Dispose () - { - Dispose (true); - System.GC.SuppressFinalize (this); - } - - void Dispose (bool disposing) - { - if( disposing) - { - //Xr.MonoGI_DestroyPen(nativeObject_); - } - } - - ~Pen () - { - Dispose (false); - } - } -} - diff --git a/mcs/class/System.Drawing/System.Drawing/impl/cairo/SolidBrush.cs b/mcs/class/System.Drawing/System.Drawing/impl/cairo/SolidBrush.cs deleted file mode 100644 index d94e71304ac..00000000000 --- a/mcs/class/System.Drawing/System.Drawing/impl/cairo/SolidBrush.cs +++ /dev/null @@ -1,57 +0,0 @@ - // -// System.Drawing.SolidBrush.cs -// -// Author: -// Dennis Hayes (dennish@Raytek.com) -// Alexandre Pigolkine(pigolkine@gmx.de) -// -// (C) 2002 Ximian, Inc -// -using System; - -namespace System.Drawing.Cairo { - - internal class SolidBrushFactory : ISolidBrushFactory - { - ISolidBrush ISolidBrushFactory.SolidBrush (Color color) - { - return new SolidBrush(color); - } - } - - internal class SolidBrush : Brush, ISolidBrush - { - - Color color; - - public SolidBrush (Color color) - { - this.Color = color; - } - - public Color Color { - - get { return color; } - - set { color = value; } - } - - public override object Clone () - { - return new SolidBrush (color); - } - - Color IBrush.TextColor - { - get { return Color; } - } - - internal void initialize (IntPtr cr) - { - Cairo.cairo_set_rgb_color (cr, - (double) color.R, - (double) color.G, - (double) color.B); - } - } -} diff --git a/mcs/class/System.Drawing/System.Drawing/impl/cairo/cairo-api.cs b/mcs/class/System.Drawing/System.Drawing/impl/cairo/cairo-api.cs deleted file mode 100644 index 19ab6ccdc94..00000000000 --- a/mcs/class/System.Drawing/System.Drawing/impl/cairo/cairo-api.cs +++ /dev/null @@ -1,427 +0,0 @@ -// -// Cairo.cs -// -// Author: Duncan Mak (duncan@ximian.com) -// -// (C) Ximian, Inc. 2003 -// -// This is a simplistic binding of the Cairo API to C#. All functions -// in cairo.h are transcribed into their C# equivelants and all -// enumerations are also listed here. -// - -using System; -using System.Drawing; -using System.Runtime.InteropServices; - -namespace System.Drawing.Cairo { - - public class Cairo - { - const string CairoImp = "cairo"; - // - // Manipulating state objects - // - [DllImport (CairoImp)] - public static extern IntPtr cairo_create (); - - [DllImport (CairoImp)] - public static extern IntPtr cairo_destroy (IntPtr cr); - - [DllImport (CairoImp)] - public static extern void cairo_save (IntPtr cr); - - [DllImport (CairoImp)] - public static extern void cairo_restore (IntPtr cr); - - // - // Modify state - // - [DllImport (CairoImp)] - public static extern void cairo_set_target_surface (IntPtr cr, IntPtr surface); - - [DllImport (CairoImp)] - public static extern void cairo_set_target_image ( - IntPtr cr, IntPtr data, Format format, int width, int height, int stride); - - [DllImport (CairoImp)] - [CLSCompliant(false)] - public static extern void cairo_set_target_drawable (IntPtr cr, IntPtr dpy, ulong drawable); - - [DllImport (CairoImp)] - public static extern void cairo_set_operator (IntPtr cr, Operator op); - - [DllImport (CairoImp)] - public static extern void cairo_set_rgb_color (IntPtr cr, double red, double green, double blue); - - [DllImport (CairoImp)] - public static extern void cairo_set_alpha (IntPtr cr, double alpha); - - [DllImport (CairoImp)] - public static extern void cairo_set_pattern (IntPtr cr, IntPtr pattern); - - [DllImport (CairoImp)] - public static extern void cairo_set_tolerance (IntPtr cr, double tolerance); - - [DllImport (CairoImp)] - public static extern void cairo_set_fill_rule (IntPtr cr, FillRule fill_rule); - - [DllImport (CairoImp)] - public static extern void cairo_set_line_width (IntPtr cr, double width); - - [DllImport (CairoImp)] - public static extern void cairo_set_line_cap (IntPtr cr, LineCap line_cap); - - [DllImport (CairoImp)] - public static extern void cairo_set_line_join (IntPtr cr, LineJoin line_join); - - [DllImport (CairoImp)] - public static extern void cairo_set_dash (IntPtr cr, double [] dashes, int ndash, double offset); - - [DllImport (CairoImp)] - public static extern void cairo_set_miter_limit (IntPtr cr, double limit); - - [DllImport (CairoImp)] - public static extern void cairo_translate (IntPtr cr, double tx, double ty); - - [DllImport (CairoImp)] - public static extern void cairo_scale (IntPtr cr, double sx, double sy); - - [DllImport (CairoImp)] - public static extern void cairo_rotate (IntPtr cr, double angle); - - [DllImport (CairoImp)] - public static extern void cairo_concat_matrix (IntPtr cr, IntPtr matrix); - - [DllImport (CairoImp)] - public static extern void cairo_set_matrix (IntPtr cr, IntPtr matrix); - - [DllImport (CairoImp)] - public static extern void cairo_default_matrix (IntPtr cr); - - [DllImport (CairoImp)] - public static extern void cairo_identity_matrix (IntPtr cr); - - [DllImport (CairoImp)] - public static extern void cairo_transform_point (IntPtr cr, ref double x, ref double y); - - [DllImport (CairoImp)] - public static extern void cairo_transform_distance (IntPtr cr, ref double dx, ref double dy); - - [DllImport (CairoImp)] - public static extern void cairo_inverse_transform_point (IntPtr cr, ref double x, ref double y); - - [DllImport (CairoImp)] - public static extern void cairo_inverse_transform_distance (IntPtr cr, ref double dx, ref double dy); - - // - // Path creation - // - [DllImport (CairoImp)] - public static extern void cairo_new_path (IntPtr cr); - - [DllImport (CairoImp)] - public static extern void cairo_move_to (IntPtr cr, double x, double y); - - [DllImport (CairoImp)] - public static extern void cairo_line_to (IntPtr cr, double x, double y); - - [DllImport (CairoImp)] - public static extern void cairo_curve_to ( - IntPtr cr, double x1, double y1, double x2, double y2, double x3, double y3); - - [DllImport (CairoImp)] - public static extern void cairo_rel_move_to (IntPtr cr, double dx, double dy); - - [DllImport (CairoImp)] - public static extern void cairo_rel_line_to (IntPtr cr, double dx, double dy); - - [DllImport (CairoImp)] - public static extern void cairo_rel_curve_to ( - IntPtr cr, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3); - - [DllImport (CairoImp)] - public static extern void cairo_rectangle (IntPtr cr, double x, double y, double width, double height); - - [DllImport (CairoImp)] - public static extern void cairo_close_path (IntPtr cr); - - // - // Painting - // - [DllImport (CairoImp)] - public static extern void cairo_stroke (IntPtr cr); - - [DllImport (CairoImp)] - public static extern void cairo_fill (IntPtr cr); - - [DllImport (CairoImp)] - public static extern void cairo_clip (IntPtr cr); - - // - // Font / Text - // - [DllImport (CairoImp)] - public static extern void cairo_select_font (IntPtr cr, string key); - - [DllImport (CairoImp)] - public static extern void cairo_scale_font (IntPtr cr, double scale); - - [DllImport (CairoImp)] - public static extern void cairo_transform_font ( - IntPtr cr, double a, double b, double c, double d); - - [DllImport (CairoImp)] - public static extern void cairo_text_extents ( - IntPtr cr, string utf8, - ref double x, ref double y, - ref double width, ref double height, - ref double dx, ref double dy); - - [DllImport (CairoImp)] - public static extern void cairo_show_text (IntPtr cr, string utf8); - - // - // Image - // - [DllImport (CairoImp)] - public static extern void cairo_show_surface (IntPtr cr, IntPtr surface, int width, int height); - - // - // query - // - [DllImport (CairoImp)] - public static extern Operator cairo_get_operator (IntPtr cr); - - [DllImport (CairoImp)] - public static extern void cairo_get_rgb_color ( - IntPtr cr, out double red, out double green, out double blue); - - [DllImport (CairoImp)] - public static extern double cairo_get_alpha (IntPtr cr); - - [DllImport (CairoImp)] - public static extern double cairo_get_tolerance (IntPtr cr); - - [DllImport (CairoImp)] - public static extern void cairo_get_current_point ( - IntPtr cr, out double x, out double y); - - [DllImport (CairoImp)] - public static extern FillRule cairo_get_fill_rule (IntPtr cr); - - [DllImport (CairoImp)] - public static extern double cairo_get_line_width (IntPtr cr); - - [DllImport (CairoImp)] - public static extern LineCap cairo_get_line_cap (IntPtr cr); - - [DllImport (CairoImp)] - public static extern LineJoin cairo_get_line_join (IntPtr cr); - - [DllImport (CairoImp)] - public static extern double cairo_get_miter_limit (IntPtr cr); - - [DllImport (CairoImp)] - public static extern void cairo_get_matrix ( - IntPtr cr, - out double a, out double b, - out double c, out double d, - out double tx, out double ty); - - [DllImport (CairoImp)] - public static extern void cairo_get_target_surface (IntPtr cr); - - // - // Error status queries - // - [DllImport (CairoImp)] - public static extern Status cairo_get_status (IntPtr cr); - - [DllImport (CairoImp)] - public static extern string cairo_get_status_string (IntPtr cr); - - // - // Surface Manipulation - // - - [DllImport (CairoImp)] - [CLSCompliant (false)] - public static extern IntPtr cairo_surface_create_for_drawable ( - IntPtr display, ulong drawable, IntPtr visual, - Format format, ulong colormap); - - [DllImport (CairoImp)] - public static extern IntPtr cairo_surface_create_for_image ( - string data, Format format, int width, int height, int stride); - - [DllImport (CairoImp)] - public static extern IntPtr cairo_surface_create_similar ( - IntPtr surface, Format format, int width, int height); - - [DllImport (CairoImp)] - public static extern IntPtr cairo_surface_create_similar_solid ( - IntPtr surface, Format format, - int width, int height, double red, double green, double blue, double alpha); - - [DllImport (CairoImp)] - public static extern void cairo_surface_destroy (IntPtr surface); - - [DllImport (CairoImp)] - public static extern Status cairo_surface_put_image ( - IntPtr surface, string data, int width, int height, int stride); - - [DllImport (CairoImp)] - public static extern Status cairo_surface_set_repeat ( - IntPtr surface, int repeat); - - [DllImport (CairoImp)] - public static extern Status cairo_surface_set_matrix ( - IntPtr surface, IntPtr matrix); - - [DllImport (CairoImp)] - public static extern Status cairo_surface_get_matrix ( - IntPtr surface, ref IntPtr matrix); - - [DllImport (CairoImp)] - public static extern Status cairo_surface_set_filter ( - IntPtr surface, Filter filter); - - // - // Matrix - // - - [DllImport (CairoImp)] - public static extern IntPtr cairo_matrix_create (); - - [DllImport (CairoImp)] - public static extern void cairo_matrix_destroy (IntPtr matrix); - - [DllImport (CairoImp)] - public static extern Status cairo_matrix_copy ( - IntPtr matrix, out IntPtr other); - - [DllImport (CairoImp)] - public static extern Status cairo_matrix_set_identity (IntPtr matrix); - - [DllImport (CairoImp)] - public static extern Status cairo_matrix_set_affine ( - IntPtr matrix, - double a, double b, double c, double d, double tx, double ty); - - [DllImport (CairoImp)] - public static extern Status cairo_matrix_get_affine ( - IntPtr matrix, - out double a, out double b, out double c, out double d, out double tx, out double ty); - - [DllImport (CairoImp)] - public static extern Status cairo_matrix_translate ( - IntPtr matrix, double tx, double ty); - - [DllImport (CairoImp)] - public static extern Status cairo_matrix_scale ( - IntPtr matrix, double sx, double sy); - - [DllImport (CairoImp)] - public static extern Status cairo_matrix_rotate ( - IntPtr matrix, double radians); - - [DllImport (CairoImp)] - public static extern Status cairo_matrix_invert (IntPtr matrix); - - [DllImport (CairoImp)] - public static extern Status cairo_matrix_multiply ( - out IntPtr result, IntPtr a, IntPtr b); - - [DllImport (CairoImp)] - public static extern Status cairo_matrix_transform_distance ( - IntPtr matrix, ref double dx, ref double dy); - - [DllImport (CairoImp)] - public static extern Status cairo_matrix_transform_point ( - IntPtr matrix, ref double x, ref double y); - } - - // - // Enumerations - // - public enum Format { - ARGB32 = 0, - RGB24 = 1, - A8 = 2, - A1 = 4 - } - - public enum Operator { - Clear = 0, - Src = 1, - Dst = 2, - Over = 3, - OverReverse = 4, - In = 5, - InReverse = 6, - Out = 7, - OutReverse = 8, - Atop = 9, - AtopReverse = 10, - Xor = 11, - Add = 12, - Saturate = 13, - - DisjointClear = 16, - DisjointSrc = 17, - DisjointDst = 18, - DisjointOver = 19, - DisjointOverReverse = 20, - DisjointIn = 21, - DisjointInReverse = 22, - DisjointOut = 23, - DisjointOutReverse = 24, - DisjointAtop = 25, - DisjointAtopReverse = 26, - DisjointXor = 27, - - ConjointClear = 32, - ConjointSrc = 33, - ConjointDst = 34, - ConjointOver = 35, - ConjointOverReverse = 36, - ConjointIn = 37, - ConjointInReverse = 38, - ConjointOut = 39, - ConjointOutReverse = 40, - ConjointAtop = 41, - ConjointAtopReverse = 42, - ConjointXor = 43 - } - - public enum FillRule { - Winding, - EvenOdd - } - - public enum LineCap { - Butt, Round, Square - } - - public enum LineJoin { - Miter, Round, Bevel - } - - public enum Status { - Success = 0, - NoMemory, - InvalidRestore, - InvalidPopGroup, - NoCurrentPoint, - InvalidMatrix - } - - public enum Filter { - Fast, - Good, - Best, - Nearest, - Bilinear - } -} diff --git a/mcs/class/System.Drawing/System.Drawing/impl/cairo/gdk-helpers.cs b/mcs/class/System.Drawing/System.Drawing/impl/cairo/gdk-helpers.cs deleted file mode 100644 index 54ae9dcaf9b..00000000000 --- a/mcs/class/System.Drawing/System.Drawing/impl/cairo/gdk-helpers.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace Gdk { - - internal class Pixbuf - { - const string libgdk_pixbuf = "libgdk_pixbuf-2.0.0.dll"; - - [DllImport (libgdk_pixbuf, EntryPoint="gdk_pixbuf_new")] - internal static extern IntPtr New ( - int colorspace, bool has_alpha, int bits_per_sample, - int width, int height); - - [DllImport(libgdk_pixbuf, EntryPoint = "gdk_pixbuf_new_from_data")] - internal static extern IntPtr NewFromData ( - IntPtr data, Gdk.Colorspace colorspace, bool has_alpha, int bits_per_sample, - int width, int height, int rowstride, - IntPtr destroy_fn, IntPtr destroy_fn_data); - - [DllImport(libgdk_pixbuf, EntryPoint = "gdk_pixbuf_finalize")] - internal static extern void Finalize (IntPtr pixbuf); - - [DllImport (libgdk_pixbuf, EntryPoint = "gdk_pixbuf_get_pixels")] - internal static extern IntPtr GetPixels (IntPtr pixbuf); - - [DllImport (libgdk_pixbuf, EntryPoint = "gdk_pixbuf_get_rowstride")] - internal static extern int GetRowstride (IntPtr pixbuf); - } - - internal enum Colorspace { - Rgb = 0 - } -} diff --git a/mcs/class/System.Drawing/System.Drawing/impl/wine/Bitmap.cs b/mcs/class/System.Drawing/System.Drawing/impl/wine/Bitmap.cs index ddc17b00b28..52c038bb451 100644 --- a/mcs/class/System.Drawing/System.Drawing/impl/wine/Bitmap.cs +++ b/mcs/class/System.Drawing/System.Drawing/impl/wine/Bitmap.cs @@ -72,19 +72,6 @@ namespace System.Drawing { IntPtr hdc = g.GetHdc(); nativeObject_ = Win32.CreateCompatibleBitmap(hdc, width, height); imageSize_ = new Size(width, height); - imageFormat_ = ImageFormat.Bmp; - // FIXME: shall we get pixel format from device or just set PixelFormat.Format32bppArgb - switch (Win32.GetDeviceCaps (g.GetHdc(), GetDeviceCapsParams.BITSPIXEL)){ - case 32: - pixelFormat_ = PixelFormat.Format32bppArgb; - break; - case 24: - pixelFormat_ = PixelFormat.Format24bppRgb; - break; - default: - pixelFormat_ = PixelFormat.Format32bppArgb; - break; - } g.ReleaseHdc(hdc); } @@ -92,7 +79,6 @@ namespace System.Drawing { { IntPtr hdc = Win32.GetDC(IntPtr.Zero); pixelFormat_ = format; - imageFormat_ = ImageFormat.Bmp; BITMAPINFO_FLAT bmi = new BITMAPINFO_FLAT(); bmi.bmiHeader_biSize = 40; bmi.bmiHeader_biWidth = width; diff --git a/mcs/class/System.Drawing/System.Drawing/impl/wine/ChangeLog b/mcs/class/System.Drawing/System.Drawing/impl/wine/ChangeLog index 5d64c7e1d60..c63e8ab3833 100644 --- a/mcs/class/System.Drawing/System.Drawing/impl/wine/ChangeLog +++ b/mcs/class/System.Drawing/System.Drawing/impl/wine/ChangeLog @@ -1,12 +1,3 @@ -2003-08-24 Alexandre Pigolkine - * Graphics.cs Clear, DrawImage functions - -2003-08-23 Alexandre Pigolkine - * Bitmap.cs set ImageFormat and PixelFormat in contstuctors - * win32Enums.cs - * win32functions.cs GetDeviceCaps function and parameters - - 2003-08-06 Duncan Mak <duncan@ximian.com> * Bitmap.cs: diff --git a/mcs/class/System.Drawing/System.Drawing/impl/wine/Graphics.cs b/mcs/class/System.Drawing/System.Drawing/impl/wine/Graphics.cs index 3097cf7a528..06552ba142d 100644 --- a/mcs/class/System.Drawing/System.Drawing/impl/wine/Graphics.cs +++ b/mcs/class/System.Drawing/System.Drawing/impl/wine/Graphics.cs @@ -104,18 +104,7 @@ namespace System.Drawing [MonoTODO] void IGraphics.Clear (Color color) { - Size sz = new Size(0, 0); - switch(type_) { - case GraphicsType.fromHwnd: - //FIXME: get window size - break; - case GraphicsType.fromHdc: - break; - case GraphicsType.fromImage: - sz = ((IImage)initializedFromImage_).Size; - break; - } - FillRectangle (new SolidBrush (color), 0, 0, sz.Width, sz.Height); + throw new NotImplementedException (); } [MonoTODO] @@ -254,42 +243,28 @@ namespace System.Drawing throw new NotImplementedException (); } - - void DrawEllipse(Pen winePen, int top, int left, int bottom, int right) - { - IntPtr oldBrush = Win32.SelectObject(hdc_, Win32.GetStockObject (GSO_.NULL_BRUSH)); - IntPtr oldPen = Win32.SelectObject(hdc_, winePen.hpen_); - Win32.Ellipse(hdc_, top, left, bottom, right); - Win32.SelectObject(hdc_, oldPen); - Win32.SelectObject(hdc_, oldBrush); - } - + [MonoTODO] void IGraphics.DrawEllipse (System.Drawing.Pen pen, Rectangle rect) { - DrawEllipse(ConvertPen(pen), rect.Top, rect.Left, rect.Bottom, rect.Right); + throw new NotImplementedException (); } + [MonoTODO] void IGraphics.DrawEllipse (System.Drawing.Pen pen, RectangleF rect) { - DrawEllipse(ConvertPen(pen), - (int)Math.Round(rect.Top), - (int)Math.Round(rect.Left), - (int)Math.Round(rect.Bottom), - (int)Math.Round(rect.Right)); + throw new NotImplementedException (); } + [MonoTODO] void IGraphics.DrawEllipse (System.Drawing.Pen pen, int x, int y, int width, int height) { - DrawEllipse(ConvertPen(pen), x, y, x+width, y+height); + throw new NotImplementedException (); } + [MonoTODO] void IGraphics.DrawEllipse (System.Drawing.Pen pen, float x, float y, float width, float height) { - DrawEllipse(ConvertPen(pen), - (int)Math.Round(x), - (int)Math.Round(y), - (int)Math.Round(x+width), - (int)Math.Round(y+height)); + throw new NotImplementedException (); } [MonoTODO] @@ -395,20 +370,7 @@ namespace System.Drawing [MonoTODO] void IGraphics.DrawImage (System.Drawing.Image image, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit) { - Image wineImage = ConvertImage(image); - Graphics imageGraphics = wineImage.selectedIntoGraphics_; - if( imageGraphics == null) { - IntPtr tempDC = Win32.CreateCompatibleDC (hdc_); - IntPtr oldBmp = Win32.SelectObject (tempDC, wineImage.nativeObject_); - Win32.StretchBlt(hdc_, destRect.X, destRect.Y, destRect.Width, destRect.Height, - tempDC, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, PatBltTypes.SRCCOPY); - Win32.SelectObject (tempDC, oldBmp); - Win32.DeleteDC (tempDC); - } - else { - Win32.StretchBlt(hdc_, destRect.X, destRect.Y, destRect.Width, destRect.Height, - imageGraphics.hdc_, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, PatBltTypes.SRCCOPY); - } + throw new NotImplementedException (); } [MonoTODO] diff --git a/mcs/class/System.Drawing/System.Drawing/impl/wine/win32Enums.cs b/mcs/class/System.Drawing/System.Drawing/impl/wine/win32Enums.cs index 7a2ed716007..38864634eab 100644 --- a/mcs/class/System.Drawing/System.Drawing/impl/wine/win32Enums.cs +++ b/mcs/class/System.Drawing/System.Drawing/impl/wine/win32Enums.cs @@ -2399,36 +2399,4 @@ namespace System.Drawing.Win32Impl { DIB_RGB_COLORS = 0, DIB_PAL_COLORS = 1 } - - internal enum GetDeviceCapsParams : int { - DRIVERVERSION =0, - TECHNOLOGY =2, - HORZSIZE =4, - VERTSIZE =6, - HORZRES =8, - VERTRES =10, - BITSPIXEL =12, - PLANES =14, - NUMBRUSHES =16, - NUMPENS =18, - NUMMARKERS =20, - NUMFONTS =22, - NUMCOLORS =24, - PDEVICESIZE =26, - CURVECAPS =28, - LINECAPS =30, - POLYGONALCAPS =32, - TEXTCAPS =34, - CLIPCAPS =36, - RASTERCAPS =38, - ASPECTX =40, - ASPECTY =42, - ASPECTXY =44, - LOGPIXELSX =88, - LOGPIXELSY =90, - CAPS1 =94, - SIZEPALETTE =104, - NUMRESERVED =106, - COLORRES =108 - } } diff --git a/mcs/class/System.Drawing/System.Drawing/impl/wine/win32functions.cs b/mcs/class/System.Drawing/System.Drawing/impl/wine/win32functions.cs index e7d29f6174e..8b69f7bd430 100644 --- a/mcs/class/System.Drawing/System.Drawing/impl/wine/win32functions.cs +++ b/mcs/class/System.Drawing/System.Drawing/impl/wine/win32functions.cs @@ -142,18 +142,7 @@ namespace System.Drawing.Win32Impl { [DllImport ("gdi32.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] - internal static extern int Ellipse(IntPtr hdc, int nLeftRect, int nTopRect, - int nRightRect, int nBottomRect); - - [DllImport ("gdi32.dll", - CallingConvention = CallingConvention.StdCall, - CharSet = CharSet.Ansi)] internal static extern int GdiFlush(); - - [DllImport ("gdi32.dll", - CallingConvention = CallingConvention.StdCall, - CharSet = CharSet.Ansi)] - internal static extern int GetDeviceCaps (IntPtr hdc, GetDeviceCapsParams index); #endregion @@ -166,6 +155,7 @@ namespace System.Drawing.Win32Impl { [DllImport("user32.dll", CharSet=CharSet.Auto)] internal static extern int ReleaseDC(IntPtr hwnd, IntPtr hdc); + #endregion #region Kernel32.dll functions diff --git a/mcs/class/System.Runtime.Remoting/ChangeLog b/mcs/class/System.Runtime.Remoting/ChangeLog index e5388f61dae..8258e3f096c 100644 --- a/mcs/class/System.Runtime.Remoting/ChangeLog +++ b/mcs/class/System.Runtime.Remoting/ChangeLog @@ -1,20 +1,3 @@ -2003-08-22 Lluis Sanchez Gual <lluis@ximian.com> - - * System.Runtime.Remoting_test.dll.sources: Added DelegateCalls.cs test file. - -2003-08-20 Lluis Sanchez Gual <lluis@ximian.com> - - * TcpConnectionPool.cs: Check if a connection is alive before reusing - it. Added some properties to support this. - -2003-08-20 Lluis Sanchez Gual <lluis@ximian.com> - - * System.Runtime.Remoting_test.dll.sources: Added new test files. - -2003-08-18 Lluis Sanchez Gual <lluis@ximian.com> - - * HttpClientChannel.cs, HttpServerChannel.cs: Fixed bug #47703 - 2003-07-23 Lluis Sanchez Gual <lluis@ximian.com> * Makefile: added dll extension to System.Runtime.Remoting reference diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/ChangeLog b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/ChangeLog deleted file mode 100644 index 2b9ff524380..00000000000 --- a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/ChangeLog +++ /dev/null @@ -1,34 +0,0 @@ -2003-08-22 Lluis Sanchez Gual <lluis@ximian.com> - - * HttpClientChannel.cs: Changed text for user-agent header (removed references - to MS.NET). - Removed try/catch from AsyncProcessRequest. If there is an exception it must - flow to the caller. - in AsyncRequestHandler, improved management of exceptions. HttpWebRequest - throws an exception if the result code is 400, 500. Is is not a communication - error, but an application or server error. The content of the body must be - deserialized like in normal responses. - In CreateWebRequest, if the stream being sent is a MemoryStream, use a more - efficient way of writing the content. - In SendAndRecieve, same as in AsyncRequestHandler. Also moved some code to a - new method named ReceiveResponse, so it can be reused from AsyncRequestHandler. - * HttpHelper.cs: Removed some debugging code that is not needed. - * HttpServer.cs: Improved formatting of some code. - In CheckRequest method, send a 100-continue response if the request has - the header: expect:100-continue. - Method SendResponse: the remoting formatter may include the result code and - reason phrase to use in the transport headers. Used them if provided. - * HttpServerChannel.cs: Use ThreadPool to create the thread that will answer - a request. - -2003-08-18 Lluis Sanchez Gual <lluis@ximian.com> - - * HttpClientChannel.cs, HttpServerChannel.cs: Fixed bug #47703 - -2003-06-21 Lluis Sanchez Gual <lluis@ximian.com> - - * HttpChannel.cs, HttpClientChannel.cs, HttpHelper.cs, HttpServer.cs, - HttpServerChannel.cs, HttpThread.cs: added new implementation of the HttpChannel - by Ahmad Tantawy, Ahmad Kadry and Hussein Mehanna. - * unix.args: added HttpHelper.cs,HttpServer.cs,HttpThread.cs. - diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpClientChannel.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpClientChannel.cs index 8e43472700d..165216b2ec8 100644 --- a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpClientChannel.cs +++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpClientChannel.cs @@ -28,6 +28,11 @@ using System.Text; namespace System.Runtime.Remoting.Channels.Http { + + + + + public class HttpClientChannel : IChannelSender,IChannel { // Property Keys (purposely all lower-case) @@ -198,7 +203,8 @@ namespace System.Runtime.Remoting.Channels.Http { if(sinkProvider == null) { - _sinkProvider = new SoapClientFormatterSinkProvider(); + //_sinkProvider = new SoapClientFormatterSinkProvider(); + _sinkProvider = new BinaryClientFormatterSinkProvider(); _sinkProvider.Next = new HttpClientTransportSinkProvider(); } else @@ -247,7 +253,8 @@ namespace System.Runtime.Remoting.Channels.Http private const String s_defaultVerb = "POST"; private static String s_userAgent = - "Mono Remoting Client (Mono CLR " + System.Environment.Version.ToString() + ")"; + "Mozilla/4.0+(compatible; MSIE 6.0; Windows " + + "; MS .NET Remoting; MS .NET CLR " + System.Environment.Version.ToString() + " )"; // Property keys (purposely all lower-case) private const String UserNameKey = "username"; @@ -300,6 +307,8 @@ namespace System.Runtime.Remoting.Channels.Http ITransportHeaders requestHeaders, Stream requestStream, out ITransportHeaders responseHeaders, out Stream responseStream) { + + string url = null; string uri = (string)requestHeaders[CommonTransportKeys.RequestUri]; CreateUrl(uri,out url); @@ -313,14 +322,22 @@ namespace System.Runtime.Remoting.Channels.Http public void AsyncProcessRequest(IClientChannelSinkStack sinkStack, IMessage msg, ITransportHeaders headers, Stream stream) { - string url = null; - string uri = (string)headers[CommonTransportKeys.RequestUri]; - CreateUrl(uri,out url); + try + { + string url = null; + string uri = (string)headers[CommonTransportKeys.RequestUri]; + CreateUrl(uri,out url); + + HttpWebRequest httpWebRequest = CreateWebRequest(url,headers,stream); + RequestState reqState = new RequestState(httpWebRequest,sinkStack); - HttpWebRequest httpWebRequest = CreateWebRequest(url,headers,stream); - RequestState reqState = new RequestState(httpWebRequest,sinkStack); + httpWebRequest.BeginGetResponse(new AsyncCallback(AsyncRequestHandler),reqState); - httpWebRequest.BeginGetResponse(new AsyncCallback(AsyncRequestHandler),reqState); + } + catch + { + Console.WriteLine("Error Sending Async Request"); + } } private void AsyncRequestHandler(IAsyncResult ar) @@ -329,29 +346,36 @@ namespace System.Runtime.Remoting.Channels.Http RequestState reqState = (RequestState) ar.AsyncState; HttpWebRequest httpWebRequest = reqState.webRquest; - IClientChannelSinkStack sinkStack = reqState.sinkStack; try { httpWebResponse = (HttpWebResponse) httpWebRequest.EndGetResponse(ar); - } - catch (WebException ex) - { - httpWebResponse = ex.Response as HttpWebResponse; - if (httpWebResponse == null) sinkStack.DispatchException (ex); - } + + Stream responseStream ; + ITransportHeaders responseHeaders; - Stream responseStream; - ITransportHeaders responseHeaders; + IClientChannelSinkStack sinkStack = reqState.sinkStack; + + responseStream = new MemoryStream(); + HttpHelper.CopyStream(httpWebResponse.GetResponseStream(),ref responseStream); + + + responseHeaders = new TransportHeaders(); + + for(int i=0; i < httpWebResponse.Headers.Count; ++i) + responseHeaders[httpWebResponse.Headers.Keys[i].ToString()] = httpWebResponse.Headers[i].ToString(); - try - { - ReceiveResponse (httpWebResponse, out responseHeaders, out responseStream); sinkStack.AsyncProcessResponse(responseHeaders,responseStream); + + } + catch + { + Console.WriteLine("Error Recieving Async Response"); } - catch (Exception ex) + finally { - sinkStack.DispatchException (ex); + if(httpWebResponse!=null) + httpWebResponse.Close(); } } @@ -510,6 +534,10 @@ namespace System.Runtime.Remoting.Channels.Http private HttpWebRequest CreateWebRequest(string url, ITransportHeaders requestHeaders, Stream requestStream) { + + + + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);; request.AllowAutoRedirect = _bAllowAutoRedirect; request.ContentLength = requestStream.Length; @@ -548,74 +576,57 @@ namespace System.Runtime.Remoting.Channels.Http } Stream reqStream = request.GetRequestStream(); - if (requestStream is MemoryStream) - { - MemoryStream memStream = (MemoryStream)requestStream; - reqStream.Write (memStream.GetBuffer(), 0, (int)memStream.Length); - } - else - HttpHelper.CopyStream(requestStream, reqStream); - + HttpHelper.CopyStream(requestStream,ref reqStream); + reqStream.Close(); return request; } - private void SendAndRecieve(HttpWebRequest httpRequest,out ITransportHeaders responseHeaders,out Stream responseStream) + private bool SendAndRecieve(HttpWebRequest httpRequest,out ITransportHeaders responseHeaders,out Stream responseStream) { responseStream = null; responseHeaders = null; HttpWebResponse httpWebResponse = null; - try - { - httpWebResponse = (HttpWebResponse)httpRequest.GetResponse(); - } - catch (WebException ex) - { - httpWebResponse = ex.Response as HttpWebResponse; - if (httpWebResponse == null) throw ex; - } - - ReceiveResponse (httpWebResponse, out responseHeaders, out responseStream); - } + bool returnValue = false; - private void ReceiveResponse (HttpWebResponse httpWebResponse, out ITransportHeaders responseHeaders, out Stream responseStream) - { - responseHeaders = new TransportHeaders(); try { - Stream webStream = httpWebResponse.GetResponseStream(); + httpWebResponse = (HttpWebResponse)httpRequest.GetResponse(); - if (httpWebResponse.ContentLength != -1) - { - byte[] buffer = new byte [httpWebResponse.ContentLength]; - int nr = 0; - while (nr < buffer.Length) - nr += webStream.Read (buffer, nr, buffer.Length - nr); - responseStream = new MemoryStream (buffer); - } - else - { - responseStream = new MemoryStream(); - HttpHelper.CopyStream(webStream, responseStream); - } + responseStream = new MemoryStream(); + HttpHelper.CopyStream(httpWebResponse.GetResponseStream(),ref responseStream); + + responseHeaders = new TransportHeaders(); + + //Use the two commented lines below instead of the 3 below lines when HttpWebResponse //class is fully implemented in order to support custom headers //for(int i=0; i < httpWebResponse.Headers.Count; ++i) // responseHeaders[httpWebResponse.Headers.Keys[i].ToString()] = httpWebResponse.Headers[i].ToString(); - + responseHeaders["Content-Type"] = httpWebResponse.ContentType; responseHeaders["Server"] = httpWebResponse.Server; responseHeaders["Content-Length"] = httpWebResponse.ContentLength; + + returnValue =true; } + catch(Exception e) + { + + Console.WriteLine(e); + returnValue = false; + } + finally { if(httpWebResponse!=null) - httpWebResponse.Close(); + httpWebResponse.Close(); } + return returnValue; } private void ProcessErrorCode() diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpHelper.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpHelper.cs index 5cde8444f9f..400f27908a6 100644 --- a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpHelper.cs +++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpHelper.cs @@ -22,6 +22,7 @@ namespace System.Runtime.Remoting.Channels.Http { internal class HttpHelper { + public static int d; public static string Parse(string URL , out string ObjectURI) { @@ -38,9 +39,9 @@ namespace System.Runtime.Remoting.Channels.Http Pos = URL.IndexOf("/",0); } - if(Pos >= 0) + if(Pos>0 || Pos == 0) { - ObjectURI = URL.Substring(Pos + 1); + ObjectURI = URL.Substring(Pos); return URL.Substring(0,Pos); } return URL; @@ -81,21 +82,32 @@ namespace System.Runtime.Remoting.Channels.Http return outStream; } - public static bool CopyStream(Stream inStream, Stream outStream) + public static bool CopyStream(Stream inStream,ref Stream outStream) { int temp; - + d++; try { + FileStream f=null; + if(d==2) + f = new FileStream("f.txt",System.IO.FileMode.Create); + while(true) { temp = inStream.ReadByte(); - + + + if(d==2) + f.WriteByte((byte)temp); + + if(temp==-1) break; outStream.WriteByte((byte)temp); } + if(d==2) + f.Close(); outStream.Flush(); if(outStream.CanSeek) diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpServer.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpServer.cs index 64577e879d7..e4d2c2c5f84 100644 --- a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpServer.cs +++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpServer.cs @@ -60,9 +60,11 @@ namespace System.Runtime.Remoting.Channels.Http public static void ProcessRequest(object Object) { + if(Object as RequestArguments == null) return; + Socket socket; HttpServerTransportSink snk; @@ -71,30 +73,40 @@ namespace System.Runtime.Remoting.Channels.Http socket = reqArg.socket; snk = reqArg.snk; - if(!socket.Connected) - return; + if(!socket.Connected) + return; - //Step (1) Start Reciceve the header - ArrayList Headers = RecieveHeader(socket); + //Step (1) Start Reciceve the header + ArrayList Headers = RecieveHeader(socket); - //Step (2) Start Parse the header - IDictionary HeaderFields = new Hashtable(); - IDictionary CustomHeaders = new Hashtable(); - if(!ParseHeader(socket,Headers,HeaderFields,CustomHeaders)) - return; + + //Step (2) Start Parse the header + IDictionary HeaderFields = new Hashtable(); + IDictionary CustomHeaders = new Hashtable(); + if(!ParseHeader(socket,Headers,HeaderFields,CustomHeaders)) + return; + - //Step (3) - if(!CheckRequest(socket,HeaderFields,CustomHeaders)) - return; - //Step (4) Recieve the entity body - byte [] buffer =new byte[(int)HeaderFields["content-length"]]; - if(!RecieveEntityBody(socket,buffer)) - return ; - //Step (5) - if(! SendRequestForChannel(socket,snk,HeaderFields,CustomHeaders,buffer)) - return ; + //Step (3) + if(!CheckRequest(socket,HeaderFields,CustomHeaders)) + return; + + + //Step (4) Recieve the entity body + byte [] buffer =new byte[(int)HeaderFields["content-length"]]; + if(!RecieveEntityBody(socket,buffer)) + return ; + + + + //Step (5) + + if(! SendRequestForChannel(socket,snk,HeaderFields,CustomHeaders,buffer)) + return ; + + } private static ArrayList RecieveHeader(Socket socket) @@ -105,6 +117,8 @@ namespace System.Runtime.Remoting.Channels.Http byte[] buffer = new byte[1024]; ArrayList Headers = new ArrayList(); + + int index =0; while(!bLastLine) { @@ -140,6 +154,8 @@ namespace System.Runtime.Remoting.Channels.Http continue; Headers.Add( Encoding.ASCII.GetString(buffer,0,index)); + + }//end while loop return Headers; @@ -178,9 +194,6 @@ namespace System.Runtime.Remoting.Channels.Http return false; } - if (HeaderFields["expect"].ToString() == "100-continue") - SendResponse(socket,100,null,null); - //Check for the content-length field if(HeaderFields["content-length"]==null) { @@ -193,8 +206,11 @@ namespace System.Runtime.Remoting.Channels.Http private static bool RecieveEntityBody(Socket socket, byte[] buffer) { + + try { + //Recieved = socket.Receive(buffer,0,buffer.Length,SocketFlags.None); int nr = 0; while (nr < buffer.Length) nr += socket.Receive (buffer, nr, buffer.Length - nr,SocketFlags.None); @@ -219,10 +235,14 @@ namespace System.Runtime.Remoting.Channels.Http private static bool SendRequestForChannel(Socket socket ,HttpServerTransportSink snk ,IDictionary HeaderFields , IDictionary CustomHeaders, byte[]buffer) { + + TransportHeaders THeaders = new TransportHeaders(); + Stream stream = new MemoryStream(buffer); + if(stream.Position !=0) stream.Seek(0,SeekOrigin.Begin); @@ -262,26 +282,19 @@ namespace System.Runtime.Remoting.Channels.Http byte [] headersBuffer = null; byte [] entityBuffer = null; - StringBuilder ResponseStr; + StringBuilder ResponseStr ; String Reason = GetReasonPhrase(HttpStatusCode); - if (headers != null && headers["__HttpStatusCode"] != null) { - // The formatter can override the result code - HttpStatusCode = int.Parse ((string)headers["__HttpStatusCode"]); - Reason = (string)headers["__HttpReasonPhrase"]; - } //Response Line - ResponseStr = new StringBuilder( "HTTP/1.0 " + HttpStatusCode + " " + Reason + "\r\n" ); + ResponseStr = new StringBuilder( "HTTP/1.1 " + HttpStatusCode.ToString() + " " + Reason + "\r\n" ); if(headers!=null) foreach(DictionaryEntry entry in headers) { - string key = entry.Key.ToString(); - if (key != "__HttpStatusCode" && key != "__HttpReasonPhrase") - ResponseStr.Append(key + ": " + entry.Value.ToString() + "\r\n"); + ResponseStr.Append(entry.Key.ToString()+": "+entry.Value.ToString()+"\r\n"); } - ResponseStr.Append("Server: Mono Remoting, Mono CLR " + System.Environment.Version.ToString() + "\r\n"); + ResponseStr.Append("Server: MS .NET Remoting, MS .NET CLR 1.0.3705.0\r\n"); if(responseStream != null) if(responseStream.Length!=0) @@ -330,7 +343,7 @@ namespace System.Runtime.Remoting.Channels.Http { switch (HttpStatusCode) { - case 100 : return "Continue" ; + case 100 : return " Continue" ; case 101 :return "Switching Protocols"; case 200 :return "OK"; case 201 :return "Created"; diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpServerChannel.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpServerChannel.cs index c3bcf6a87a5..f90beea3476 100644 --- a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpServerChannel.cs +++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpServerChannel.cs @@ -147,9 +147,12 @@ namespace System.Runtime.Remoting.Channels.Http _channelData = new ChannelDataStore(urls); + //Change this into BinaryFormatterSinkProvider() in mono if(_sinkProvider == null) - _sinkProvider = new SoapServerFormatterSinkProvider(); + _sinkProvider = new BinaryServerFormatterSinkProvider(); + + // collect channel data from all providers IServerChannelSinkProvider provider = _sinkProvider; while (provider != null) @@ -161,6 +164,7 @@ namespace System.Runtime.Remoting.Channels.Http // create the sink chain IServerChannelSink snk = ChannelServices.CreateServerChannelSinkChain(_sinkProvider,this); + _transportSink = new HttpServerTransportSink(snk); @@ -178,7 +182,8 @@ namespace System.Runtime.Remoting.Channels.Http { Socket socket = _tcpListener.AcceptSocket(); RequestArguments reqArg = new RequestArguments(socket,_transportSink); - ThreadPool.QueueUserWorkItem (new WaitCallback (HttpServer.ProcessRequest), reqArg); + HttpThread httpThread = new HttpThread(reqArg); + } } @@ -193,11 +198,14 @@ namespace System.Runtime.Remoting.Channels.Http ThreadStart t = new ThreadStart(this.Listen); _listenerThread = new Thread(t); _listenerThread.IsBackground = true; + } if(!_listenerThread.IsAlive) _listenerThread.Start(); + + _bListening = true; } @@ -205,7 +213,6 @@ namespace System.Runtime.Remoting.Channels.Http { if( _bListening) { - _listenerThread.Abort (); _tcpListener.Stop(); } @@ -365,7 +372,7 @@ namespace System.Runtime.Remoting.Channels.Http ITransportHeaders responseHeaders; Stream responseStream; - ServerProcessing processing = ServerProcessing.Complete; + ServerProcessing processing= ServerProcessing.Complete; try { processing = @@ -373,6 +380,8 @@ namespace System.Runtime.Remoting.Channels.Http out responseMessage, out responseHeaders, out responseStream); + + switch (processing) { case ServerProcessing.Complete: @@ -397,7 +406,10 @@ namespace System.Runtime.Remoting.Channels.Http catch(Exception ) { } - } + +} + + // diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpConnectionPool.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpConnectionPool.cs index f3e36def999..becffaf63c5 100644 --- a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpConnectionPool.cs +++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpConnectionPool.cs @@ -1,11 +1,11 @@ -//
-// System.Runtime.Remoting.Channels.Tcp.TcpConnectionPool.cs
-//
-// Author: Lluis Sanchez Gual (lluis@ideary.com)
-//
-// 2002 (C) Lluis Sanchez Gual
-//
-
+// +// System.Runtime.Remoting.Channels.Tcp.TcpConnectionPool.cs +// +// Author: Lluis Sanchez Gual (lluis@ideary.com) +// +// 2002 (C) Lluis Sanchez Gual +// + using System;
using System.Collections;
using System.Threading;
@@ -98,36 +98,15 @@ namespace System.Runtime.Remoting.Channels.Tcp }
}
- internal class ReusableTcpClient : TcpClient
- {
- public ReusableTcpClient (string host, int port): base (host, port)
- {
- }
-
- public bool IsAlive
- {
- get
- {
- // This Poll will return true if there is data pending to
- // be read. It prob. means that a client object using this
- // connection got an exception and did not finish to read
- // the data. It can also mean that the connection has been
- // closed in the server. In both cases, the connection cannot
- // be reused.
- return !Client.Poll (0, SelectMode.SelectRead);
- }
- }
- }
-
internal class TcpConnection
{
DateTime _controlTime;
Stream _stream;
- ReusableTcpClient _client;
+ TcpClient _client;
HostConnectionPool _pool;
byte[] _buffer;
- public TcpConnection (HostConnectionPool pool, ReusableTcpClient client)
+ public TcpConnection (HostConnectionPool pool, TcpClient client)
{
_pool = pool;
_client = client;
@@ -147,11 +126,6 @@ namespace System.Runtime.Remoting.Channels.Tcp set { _controlTime = value; }
}
- public bool IsAlive
- {
- get { return _client.IsAlive; }
- }
-
// This is a "thread safe" buffer that can be used by
// TcpClientTransportSink to read or send data to the stream.
// The buffer is "thread safe" since only one thread can
@@ -198,14 +172,8 @@ namespace System.Runtime.Remoting.Channels.Tcp if (_pool.Count > 0)
{
// There are available connections
-
connection = (TcpConnection)_pool[_pool.Count - 1];
_pool.RemoveAt(_pool.Count - 1);
- if (!connection.IsAlive) {
- CancelConnection (connection);
- connection = null;
- continue;
- }
}
if (connection == null && _activeConnections < TcpConnectionPool.MaxOpenConnections)
@@ -233,7 +201,7 @@ namespace System.Runtime.Remoting.Channels.Tcp {
try
{
- ReusableTcpClient client = new ReusableTcpClient(_host, _port);
+ TcpClient client = new TcpClient(_host, _port);
TcpConnection entry = new TcpConnection(this, client);
_activeConnections++;
return entry;
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/ChangeLog b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/ChangeLog index 7be4308ce83..e7c9b27ec60 100644 --- a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/ChangeLog +++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/ChangeLog @@ -1,9 +1,3 @@ -2003-08-22 Lluis Sanchez Gual <lluis@ximian.com> - - * SoapClientFormatterSink.cs: Fixed a some bugs to make async calls work. - * SoapMessageFormatter.cs: Fixed some problems with out and ref parameters. - * SoapServerFormatterSink.cs: Improved catching of exceptions. - 2003-07-23 Lluis Sanchez Gual <lluis@ximian.com> * SoapMessageFormatter.cs: ParameterInfo.Position is now zero-based. diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapClientFormatterSink.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapClientFormatterSink.cs index 60abd818da4..1d58b719ecb 100644 --- a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapClientFormatterSink.cs +++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapClientFormatterSink.cs @@ -67,7 +67,7 @@ namespace System.Runtime.Remoting.Channels SerializeMessage(msg, out requestStream, out requestHeaders, out soapMsgFormatter);
ClientChannelSinkStack stack = new ClientChannelSinkStack(replySink);
- stack.Push(this, new CallData (msg, soapMsgFormatter));
+ stack.Push(this, soapMsgFormatter);
_nextChannelSink.AsyncProcessRequest(stack, msg, requestHeaders, requestStream);
@@ -88,9 +88,10 @@ namespace System.Runtime.Remoting.Channels ITransportHeaders headers,
Stream stream)
{
- CallData data = (CallData)state;
- SoapMessageFormatter soapMsgFormatter = data.Formatter;
- IMessage replyMessage = (IMessage) DeserializeMessage(stream, headers, (IMethodCallMessage)data.Msg, soapMsgFormatter);
+ SoapMessageFormatter soapMsgFormatter = (SoapMessageFormatter)state;
+
+ IMessage replyMessage = (IMessage) DeserializeMessage(stream, headers, (IMethodCallMessage)state, soapMsgFormatter);
+
sinkStack.DispatchReplyMessage(replyMessage);
}
@@ -115,6 +116,7 @@ namespace System.Runtime.Remoting.Channels }
+// ////[MonoTODO]
public IMessage SyncProcessMessage (IMessage msg)
{
Stream requestStream, responseStream;
@@ -123,7 +125,7 @@ namespace System.Runtime.Remoting.Channels SerializeMessage(msg, out requestStream, out requestHeaders, out soapMsgFormatter);
_nextChannelSink.ProcessMessage(msg, requestHeaders, requestStream, out responseHeaders, out responseStream);
-
+
return DeserializeMessage(responseStream, responseHeaders, (IMethodCallMessage)msg, soapMsgFormatter);
}
@@ -144,6 +146,8 @@ namespace System.Runtime.Remoting.Channels if(requestStream is MemoryStream){
requestStream.Position = 0;
}
+
+
}
@@ -153,13 +157,8 @@ namespace System.Runtime.Remoting.Channels object objReturn = _deserializationFormatter.Deserialize(responseStream);
return soapMsgFormatter.FormatResponse((ISoapMessage) objReturn, mcm);
- }
-
- class CallData
- {
- public CallData (IMessage msg, SoapMessageFormatter formatter) { Msg = msg; Formatter = formatter; }
- public IMessage Msg;
- public SoapMessageFormatter Formatter;
+
+
}
}
}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapMessageFormatter.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapMessageFormatter.cs index f479dc8da38..93837e7c0ed 100644 --- a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapMessageFormatter.cs +++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapMessageFormatter.cs @@ -80,14 +80,14 @@ namespace System.Runtime.Remoting.Channels { // check if there are *out* parameters
foreach(ParameterInfo paramInfo in _methodCallParameters) {
- if(paramInfo.ParameterType.IsByRef) {
+ if(paramInfo.IsOut) {
int index = Array.IndexOf(soapMsg.ParamNames, paramInfo.Name);
nbOutParams++;
object outParam = soapMsg.ParamValues[index];
if(outParam is IConvertible)
outParam = Convert.ChangeType(
outParam,
- paramInfo.ParameterType.GetElementType());
+ paramInfo.ParameterType);
outParams.Add(outParam);
}
// else outParams.Insert(paramInfo.Position, null);
@@ -148,44 +148,40 @@ namespace System.Runtime.Remoting.Channels { // used by the server
internal IMessage BuildMethodCallFromSoapMessage(SoapMessage soapMessage, string uri) {
ArrayList headersList = new ArrayList();
+ ArrayList argsList = new ArrayList();
headersList.Add(new Header("__Uri", uri));
headersList.Add(new Header("__MethodName", soapMessage.MethodName));
string typeNamespace, assemblyName;
bool b = SoapServices.DecodeXmlNamespaceForClrTypeNamespace(soapMessage.XmlNameSpace, out typeNamespace, out assemblyName);
-
_serverType = RemotingServices.GetServerTypeForUri(uri);
-
headersList.Add(new Header("__TypeName", _serverType.FullName, false));
_xmlNamespace = soapMessage.XmlNameSpace;
+
RemMessageType messageType;
_methodCallInfo = _serverType.GetMethod(soapMessage.MethodName);
-
+
// the *out* parameters aren't serialized
// have to add them here
_methodCallParameters = _methodCallInfo.GetParameters();
- object[] args = new object[_methodCallParameters.Length];
-
- foreach(ParameterInfo paramInfo in _methodCallParameters)
- {
- Type paramType = (paramInfo.ParameterType.IsByRef ? paramInfo.ParameterType.GetElementType() : paramInfo.ParameterType);
-
+ foreach(ParameterInfo paramInfo in _methodCallParameters) {
if(paramInfo.IsOut) {
- args [paramInfo.Position] = GetNullValue (paramType);
+ argsList.Insert(paramInfo.Position, null);
}
else{
int index = Array.IndexOf(soapMessage.ParamNames, paramInfo.Name);
if(soapMessage.ParamValues[index] is IConvertible)
soapMessage.ParamValues[index] = Convert.ChangeType(
soapMessage.ParamValues[index],
- paramType);
- args [paramInfo.Position] = soapMessage.ParamValues[index];
+ paramInfo.ParameterType);
+ argsList.Insert(paramInfo.Position, soapMessage.ParamValues[index]);
}
}
+ Object[] args = (Object[])argsList.ToArray(typeof(object));
headersList.Add(new Header("__Args", args, false));
Header[] headers = (Header[])headersList.ToArray(typeof(Header));
-
+
// build the MethodCall from the headers
MethodCall mthCall = new MethodCall(headers);
return (IMessage)mthCall;
@@ -228,8 +224,8 @@ namespace System.Runtime.Remoting.Channels { }
else {
// an Exception was thrown while executing the function
- responseHeaders["__HttpStatusCode"] = "400";
- responseHeaders["__HttpReasonPhrase"] = "Bad Request";
+ responseHeaders["__HttpStatusCode"] = "500";
+ responseHeaders["__HttpReasonPhrase"] = "Internal Server Error";
// fill the transport headers
responseHeaders["Content-Type"] = "text/xml; charset=\"utf-8\"";
ServerFault serverFault = CreateServerFault(mrm.Exception);
@@ -266,25 +262,6 @@ namespace System.Runtime.Remoting.Channels { _methodCallParameters = _methodCallInfo.GetParameters();
}
- object GetNullValue (Type paramType)
- {
- switch (Type.GetTypeCode (paramType))
- {
- case TypeCode.Boolean: return false;
- case TypeCode.Byte: return (byte)0;
- case TypeCode.Char: return '\0';
- case TypeCode.Decimal: return (decimal)0;
- case TypeCode.Double: return (double)0;
- case TypeCode.Int16: return (short)0;
- case TypeCode.Int32: return (int)0;
- case TypeCode.Int64: return (long)0;
- case TypeCode.SByte: return (sbyte)0;
- case TypeCode.Single: return (float)0;
- case TypeCode.UInt16: return (ushort)0;
- case TypeCode.UInt32: return (uint)0;
- case TypeCode.UInt64: return (ulong)0;
- default: return null;
- }
- }
+
}
}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapServerFormatterSink.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapServerFormatterSink.cs index 1fb925e2640..6d7d57d4975 100644 --- a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapServerFormatterSink.cs +++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapServerFormatterSink.cs @@ -95,50 +95,46 @@ namespace System.Runtime.Remoting.Channels { responseMsg = null;
responseHeaders = null;
responseStream = null;
-
- Exception exception;
+
+ string url = (string)requestHeaders[CommonTransportKeys.RequestUri];
+ string uri;
+ _receiver.Parse(url, out uri);
+ if(uri == null) uri = url;
+ Type serverType = RemotingServices.GetServerTypeForUri(uri);
+
+ SoapMessage soapMessage = new SoapMessage();
+ _deserializationFormatter.TopObject = soapMessage;
ServerProcessing sp;
+ object rtnMessageObject;
SoapMessageFormatter soapMsgFormatter = new SoapMessageFormatter();
+ requestStream.Position = 0;
+ _deserializationFormatter.Deserialize(requestStream);
+ requestMsg = soapMsgFormatter.BuildMethodCallFromSoapMessage(soapMessage, uri);
+
sinkStack.Push(this, soapMsgFormatter);
- try {
- string url = (string)requestHeaders[CommonTransportKeys.RequestUri];
- string uri;
- _receiver.Parse(url, out uri);
- if(uri == null) uri = url;
- Type serverType = RemotingServices.GetServerTypeForUri(uri);
- if (serverType == null) throw new RemotingException ("No receiver for uri " + uri);
-
- SoapMessage soapMessage = new SoapMessage();
- _deserializationFormatter.TopObject = soapMessage;
- requestStream.Position = 0;
- _deserializationFormatter.Deserialize(requestStream);
-
- requestMsg = soapMsgFormatter.BuildMethodCallFromSoapMessage(soapMessage, uri);
-
+ try{
sp = next_sink.ProcessMessage(sinkStack, requestMsg, requestHeaders, null, out responseMsg, out responseHeaders, out responseStream);
- if(sp == ServerProcessing.Complete) {
- if(responseMsg != null && responseStream == null) {
-
- object rtnMessageObject = soapMsgFormatter.BuildSoapMessageFromMethodResponse((IMethodReturnMessage) responseMsg, out responseHeaders);
- responseStream = new MemoryStream();
- _serializationFormatter.Serialize(responseStream, rtnMessageObject);
- }
- }
}
- catch(Exception e)
- {
+ catch(Exception e) {
responseMsg = (IMethodReturnMessage)new ReturnMessage(e, (IMethodCallMessage)requestMsg);
- object rtnMessageObject = soapMsgFormatter.BuildSoapMessageFromMethodResponse((IMethodReturnMessage) responseMsg, out responseHeaders);
- responseStream = new MemoryStream();
- _serializationFormatter.Serialize(responseStream, rtnMessageObject);
sp = ServerProcessing.Complete;
}
+
+ if(sp == ServerProcessing.Complete) {
+ if(responseMsg != null && responseStream == null) {
+
+ rtnMessageObject = soapMsgFormatter.BuildSoapMessageFromMethodResponse((IMethodReturnMessage) responseMsg, out responseHeaders);
+
+ responseStream = new MemoryStream();
+
+ _serializationFormatter.Serialize(responseStream, rtnMessageObject);
+ }
- if (sp == ServerProcessing.Complete)
sinkStack.Pop(this);
-
+ }
+
return sp;
}
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting_test.dll.sources b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting_test.dll.sources index 282df16027b..9751d50591f 100644 --- a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting_test.dll.sources +++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting_test.dll.sources @@ -2,10 +2,3 @@ ServerObject.cs ContextsTest.cs CallSeq.cs ContextHookAttribute.cs -BaseCalls.cs -SyncCalls.cs -AsyncCalls.cs -ReflectionCalls.cs -DelegateCalls.cs -TcpCalls.cs -HttpCalls.cs diff --git a/mcs/class/System.Runtime.Remoting/Test/AsyncCalls.cs b/mcs/class/System.Runtime.Remoting/Test/AsyncCalls.cs deleted file mode 100644 index 706f4cd018f..00000000000 --- a/mcs/class/System.Runtime.Remoting/Test/AsyncCalls.cs +++ /dev/null @@ -1,163 +0,0 @@ -// -// MonoTests.System.Runtime.Remoting.AsyncCalls.cs -// -// Author: Lluis Sanchez Gual (lluis@ximian.com) -// -// 2003 (C) Copyright, Ximian, Inc. -// - -using System; -using System.Collections; -using System.Threading; -using NUnit.Framework; - -namespace MonoTests.System.Runtime.Remoting -{ - public abstract class AsyncCallTest : BaseCallTest - { - public override InstanceSurrogate GetInstanceSurrogate () { return new AsyncInstanceSurrogate (); } - public override AbstractSurrogate GetAbstractSurrogate () { return new AsyncAbstractSurrogate (); } - public override InterfaceSurrogate GetInterfaceSurrogate () { return new AsyncInterfaceSurrogate (); } - - public static void DoWork () - { - for (int n=0; n<10; n++) - Thread.Sleep (1); - } - } - - public delegate int DelegateSimple (); - public delegate string DelegatePrimitiveParams (int a, uint b, char c, string d); - public delegate string DelegatePrimitiveParamsInOut (ref int a1, out int a2, ref float b1, out float b2, ref char c1, out char c2, ref string d1, out string d2); - public delegate Complex DelegateComplexParams (ArrayList a, Complex b, string c); - public delegate Complex DelegateComplexParamsInOut (ref ArrayList a, out Complex b, string c); - - public class AsyncInstanceSurrogate : InstanceSurrogate - { - public override int Simple () - { - DelegateSimple de = new DelegateSimple (RemoteObject.Simple); - IAsyncResult ar = de.BeginInvoke (null,null); - AsyncCallTest.DoWork (); - return de.EndInvoke (ar); - } - - public override string PrimitiveParams (int a, uint b, char c, string d) - { - DelegatePrimitiveParams de = new DelegatePrimitiveParams (RemoteObject.PrimitiveParams); - IAsyncResult ar = de.BeginInvoke (a,b,c,d,null,null); - AsyncCallTest.DoWork (); - return de.EndInvoke (ar); - } - - public override string PrimitiveParamsInOut (ref int a1, out int a2, ref float b1, out float b2, ref char c1, out char c2, ref string d1, out string d2) - { - DelegatePrimitiveParamsInOut de = new DelegatePrimitiveParamsInOut (RemoteObject.PrimitiveParamsInOut); - IAsyncResult ar = de.BeginInvoke (ref a1, out a2, ref b1, out b2, ref c1, out c2, ref d1, out d2, null,null); - AsyncCallTest.DoWork (); - return de.EndInvoke (ref a1, out a2, ref b1, out b2, ref c1, out c2, ref d1, out d2, ar); - } - - public override Complex ComplexParams (ArrayList a, Complex b, string c) - { - DelegateComplexParams de = new DelegateComplexParams (RemoteObject.ComplexParams); - IAsyncResult ar = de.BeginInvoke (a,b,c,null,null); - AsyncCallTest.DoWork (); - return de.EndInvoke (ar); - } - - public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c) - { - DelegateComplexParamsInOut de = new DelegateComplexParamsInOut (RemoteObject.ComplexParamsInOut); - IAsyncResult ar = de.BeginInvoke (ref a, out b, c,null,null); - AsyncCallTest.DoWork (); - return de.EndInvoke (ref a, out b, ar); - } - } - - public class AsyncAbstractSurrogate : AbstractSurrogate - { - public override int Simple () - { - DelegateSimple de = new DelegateSimple (RemoteObject.Simple); - IAsyncResult ar = de.BeginInvoke (null,null); - AsyncCallTest.DoWork (); - return de.EndInvoke (ar); - } - - public override string PrimitiveParams (int a, uint b, char c, string d) - { - DelegatePrimitiveParams de = new DelegatePrimitiveParams (RemoteObject.PrimitiveParams); - IAsyncResult ar = de.BeginInvoke (a,b,c,d,null,null); - AsyncCallTest.DoWork (); - return de.EndInvoke (ar); - } - - public override string PrimitiveParamsInOut (ref int a1, out int a2, ref float b1, out float b2, ref char c1, out char c2, ref string d1, out string d2) - { - DelegatePrimitiveParamsInOut de = new DelegatePrimitiveParamsInOut (RemoteObject.PrimitiveParamsInOut); - IAsyncResult ar = de.BeginInvoke (ref a1, out a2, ref b1, out b2, ref c1, out c2, ref d1, out d2, null,null); - AsyncCallTest.DoWork (); - return de.EndInvoke (ref a1, out a2, ref b1, out b2, ref c1, out c2, ref d1, out d2, ar); - } - - public override Complex ComplexParams (ArrayList a, Complex b, string c) - { - DelegateComplexParams de = new DelegateComplexParams (RemoteObject.ComplexParams); - IAsyncResult ar = de.BeginInvoke (a,b,c,null,null); - AsyncCallTest.DoWork (); - return de.EndInvoke (ar); - } - - public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c) - { - DelegateComplexParamsInOut de = new DelegateComplexParamsInOut (RemoteObject.ComplexParamsInOut); - IAsyncResult ar = de.BeginInvoke (ref a, out b, c,null,null); - AsyncCallTest.DoWork (); - return de.EndInvoke (ref a, out b, ar); - } - } - - public class AsyncInterfaceSurrogate : InterfaceSurrogate - { - public override int Simple () - { - DelegateSimple de = new DelegateSimple (RemoteObject.Simple); - IAsyncResult ar = de.BeginInvoke (null,null); - AsyncCallTest.DoWork (); - return de.EndInvoke (ar); - } - - public override string PrimitiveParams (int a, uint b, char c, string d) - { - DelegatePrimitiveParams de = new DelegatePrimitiveParams (RemoteObject.PrimitiveParams); - IAsyncResult ar = de.BeginInvoke (a,b,c,d,null,null); - AsyncCallTest.DoWork (); - return de.EndInvoke (ar); - } - - public override string PrimitiveParamsInOut (ref int a1, out int a2, ref float b1, out float b2, ref char c1, out char c2, ref string d1, out string d2) - { - DelegatePrimitiveParamsInOut de = new DelegatePrimitiveParamsInOut (RemoteObject.PrimitiveParamsInOut); - IAsyncResult ar = de.BeginInvoke (ref a1, out a2, ref b1, out b2, ref c1, out c2, ref d1, out d2, null,null); - AsyncCallTest.DoWork (); - return de.EndInvoke (ref a1, out a2, ref b1, out b2, ref c1, out c2, ref d1, out d2, ar); - } - - public override Complex ComplexParams (ArrayList a, Complex b, string c) - { - DelegateComplexParams de = new DelegateComplexParams (RemoteObject.ComplexParams); - IAsyncResult ar = de.BeginInvoke (a,b,c,null,null); - AsyncCallTest.DoWork (); - return de.EndInvoke (ar); - } - - public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c) - { - DelegateComplexParamsInOut de = new DelegateComplexParamsInOut (RemoteObject.ComplexParamsInOut); - IAsyncResult ar = de.BeginInvoke (ref a, out b, c,null,null); - AsyncCallTest.DoWork (); - return de.EndInvoke (ref a, out b, ar); - } - } -} diff --git a/mcs/class/System.Runtime.Remoting/Test/BaseCalls.cs b/mcs/class/System.Runtime.Remoting/Test/BaseCalls.cs deleted file mode 100644 index 790c71ae9f7..00000000000 --- a/mcs/class/System.Runtime.Remoting/Test/BaseCalls.cs +++ /dev/null @@ -1,452 +0,0 @@ -// -// MonoTests.System.Runtime.Remoting.BaseCalls.cs -// -// Author: Lluis Sanchez Gual (lluis@ximian.com) -// -// 2003 (C) Copyright, Ximian, Inc. -// - -using System; -using System.Net; -using System.Threading; -using System.Collections; -using System.Runtime.Remoting; -using System.Runtime.Remoting.Channels; -using System.Runtime.Remoting.Lifetime; -using System.Runtime.Remoting.Channels.Tcp; -using System.Runtime.Remoting.Activation; -using System.Runtime.Remoting.Contexts; -using NUnit.Framework; - -namespace MonoTests.System.Runtime.Remoting -{ - public abstract class BaseCallTest : Assertion - { - IChannelSender chs; - string[] remoteUris; - CallsDomainServer server; - int remoteDomId; - - [TestFixtureSetUp] - public void Run() - { - remoteDomId = CreateServer (); - } - - [TestFixtureTearDown] - public void End () - { - ShutdownServer (); - } - - protected virtual int CreateServer () - { - ChannelManager cm = CreateChannelManager (); - chs = cm.CreateClientChannel (); - ChannelServices.RegisterChannel (chs); - - AppDomain domain = AppDomain.CreateDomain ("testdomain"); - server = (CallsDomainServer) domain.CreateInstanceAndUnwrap(GetType().Assembly.FullName,"MonoTests.System.Runtime.Remoting.CallsDomainServer"); - remoteUris = server.Start (cm); - return server.GetDomId (); - } - - protected virtual void ShutdownServer () - { - server.Stop (); - if (chs != null) - ChannelServices.UnregisterChannel (chs); - } - - protected virtual RemoteObject CreateRemoteInstance () - { - return (RemoteObject) Activator.GetObject (typeof(RemoteObject), remoteUris[0]); - } - - protected virtual AbstractRemoteObject CreateRemoteAbstract () - { - return (AbstractRemoteObject) Activator.GetObject (typeof(AbstractRemoteObject), remoteUris[1]); - } - - protected virtual IRemoteObject CreateRemoteInterface () - { - return (IRemoteObject) Activator.GetObject (typeof(IRemoteObject), remoteUris[2]); - } - - public InstanceSurrogate InternalGetInstanceSurrogate () - { - InstanceSurrogate s = GetInstanceSurrogate (); - s.RemoteObject = CreateRemoteInstance (); - return s; - } - - public AbstractSurrogate InternalGetAbstractSurrogate () - { - AbstractSurrogate s = GetAbstractSurrogate (); - s.RemoteObject = CreateRemoteAbstract (); - return s; - } - - public InterfaceSurrogate InternalGetInterfaceSurrogate () - { - InterfaceSurrogate s = GetInterfaceSurrogate (); - s.RemoteObject = CreateRemoteInterface (); - return s; - } - - public abstract InstanceSurrogate GetInstanceSurrogate (); - public abstract AbstractSurrogate GetAbstractSurrogate (); - public abstract InterfaceSurrogate GetInterfaceSurrogate (); - public abstract ChannelManager CreateChannelManager (); - - // - // The tests - // - - [Test] - public void TestInstanceSimple () - { - RunTestSimple (InternalGetInstanceSurrogate()); - } - - [Test] - public void TestAbstractSimple () - { - RunTestSimple (InternalGetAbstractSurrogate()); - } - - [Test] - public void TestInterfaceSimple () - { - RunTestSimple (InternalGetInterfaceSurrogate()); - } - - [Test] - public void TestInstancePrimitiveParams () - { - RunTestPrimitiveParams (InternalGetInstanceSurrogate()); - } - - [Test] - public void TestAbstractPrimitiveParams () - { - RunTestPrimitiveParams (InternalGetAbstractSurrogate()); - } - - [Test] - public void TestInterfacePrimitiveParams () - { - RunTestPrimitiveParams (InternalGetInterfaceSurrogate()); - } - - [Test] - public void TestInstancePrimitiveParamsInOut () - { - RunTestPrimitiveParamsInOut (InternalGetInstanceSurrogate()); - } - - [Test] - public void TestAbstractPrimitiveParamsInOut () - { - RunTestPrimitiveParamsInOut (InternalGetAbstractSurrogate()); - } - - [Test] - public void TestInterfacePrimitiveParamsInOut () - { - RunTestPrimitiveParamsInOut (InternalGetInterfaceSurrogate()); - } - - [Test] - public void TestInstanceComplexParams () - { - RunTestComplexParams (InternalGetInstanceSurrogate()); - } - - [Test] - public void TestAbstractComplexParams () - { - RunTestComplexParams (InternalGetAbstractSurrogate()); - } - - [Test] - public void TestInterfaceComplexParams () - { - RunTestComplexParams (InternalGetInterfaceSurrogate()); - } - - [Test] - public void TestInstanceComplexParamsInOut () - { - RunTestComplexParamsInOut (InternalGetInstanceSurrogate()); - } - - [Test] - public void TestAbstractComplexParamsInOut () - { - RunTestComplexParamsInOut (InternalGetAbstractSurrogate()); - } - - [Test] - public void TestInterfaceComplexParamsInOut () - { - RunTestComplexParamsInOut (InternalGetInterfaceSurrogate()); - } - - // - // The tests runners - // - - public void RunTestSimple (IRemoteObject testerSurrogate) - { - AssertEquals ("ReturnValue", 130772 + remoteDomId, testerSurrogate.Simple ()); - } - - public void RunTestPrimitiveParams (IRemoteObject testerSurrogate) - { - AssertEquals ("ReturnValue", "11-22-L-SG@"+remoteDomId, testerSurrogate.PrimitiveParams (11, 22, 'L', "SG")); - } - - public void RunTestPrimitiveParamsInOut (IRemoteObject testerSurrogate) - { - int a2, a1 = 9876543; - float b2, b1 = 82437.83f; - char c2, c1 = 's'; - string d2, d1 = "asdASDzxcZXC"; - - string res = testerSurrogate.PrimitiveParamsInOut (ref a1, out a2, ref b1, out b2, ref c1, out c2, ref d1, out d2); - - AssertEquals ("ReturnValue", "9876543-82437.83-s-asdASDzxcZXC@" + remoteDomId, res); - - AssertEquals ("a2", 12345678, a2); - AssertEquals ("b2", 53455.345f, b2); - AssertEquals ("c2", 'g', c2); - AssertEquals ("d2", "sfARREG$5345DGDfgY7656gDFG>><<dasdasd", d2); - - AssertEquals ("a1", 65748392, a1); - AssertEquals ("b1", 98395.654f, b1); - AssertEquals ("c1", 'l', c1); - AssertEquals ("d1", "aasbasbdyhasbduybo234243", d1); - } - - public void RunTestComplexParams (IRemoteObject testerSurrogate) - { - ArrayList list = new ArrayList (); - list.Add (new Complex (11,"first")); - Complex c = new Complex (22,"second"); - - Complex r = testerSurrogate.ComplexParams (list, c, "third"); - - AssertNotNull ("ReturnValue is null", r); - AssertNotNull ("ReturnValue.Child is null", r.Child); - AssertNotNull ("ReturnValue.Child.Child is null", r.Child.Child); - - AssertEquals ("ReturnValue.Id", 33, r.Id); - AssertEquals ("ReturnValue.Name", "third@"+remoteDomId, r.Name); - AssertEquals ("ReturnValue.Child.Id", 22, r.Child.Id); - AssertEquals ("ReturnValue.Child.Name", "second", r.Child.Name); - AssertEquals ("ReturnValue.Child.Child.Id", 11, r.Child.Child.Id); - AssertEquals ("ReturnValue.Child.Child.Name", "first", r.Child.Child.Name); - } - - public void RunTestComplexParamsInOut (IRemoteObject testerSurrogate) - { - ArrayList list = new ArrayList (); - list.Add (new Complex (11,"first")); - list.Add (new Complex (22,"second")); - - Complex c; - Complex r = testerSurrogate.ComplexParamsInOut (ref list, out c, "third"); - - AssertNotNull ("ReturnValue is null", r); - AssertNotNull ("c is null", c); - AssertNotNull ("list is null", list); - Assert ("Invalid list count", list.Count == 3); - AssertNotNull ("list[0] is null", list[0]); - AssertNotNull ("list[1] is null", list[1]); - AssertNotNull ("list[2] is null", list[2]); - - AssertEquals ("ReturnValue.Id", 33, r.Id); - AssertEquals ("ReturnValue.Name", "third@"+remoteDomId, r.Name); - AssertEquals ("c.Id", 33, c.Id); - AssertEquals ("c.Name", "third@"+remoteDomId, c.Name); - - AssertEquals ("list[2].Id", 33, ((Complex)list[2]).Id); - AssertEquals ("list[2].Name", "third@"+remoteDomId, ((Complex)list[2]).Name); - AssertEquals ("list[1].Id", 22, ((Complex)list[1]).Id); - AssertEquals ("list[1].Name", "second", ((Complex)list[1]).Name); - AssertEquals ("list[0].Id", 11, ((Complex)list[0]).Id); - AssertEquals ("list[0].Name", "first", ((Complex)list[0]).Name); - } - } - - // - // The server running in the remote domain - // - - class CallsDomainServer: MarshalByRefObject - { - IChannelReceiver ch; - - public string[] Start(ChannelManager cm) - { - try - { - ch = cm.CreateServerChannel (); - ChannelServices.RegisterChannel ((IChannel)ch); - RemotingConfiguration.RegisterWellKnownServiceType (typeof (RemoteObject), "test1", WellKnownObjectMode.SingleCall); - RemotingConfiguration.RegisterWellKnownServiceType (typeof (RemoteObject), "test2", WellKnownObjectMode.SingleCall); - RemotingConfiguration.RegisterWellKnownServiceType (typeof (RemoteObject), "test3", WellKnownObjectMode.SingleCall); - string[] uris = new string[3]; - uris[0] = ch.GetUrlsForUri ("test1")[0]; - uris[1] = ch.GetUrlsForUri ("test2")[0]; - uris[2] = ch.GetUrlsForUri ("test3")[0]; - return uris; - } - catch (Exception ex) - { - Console.WriteLine (ex.ToString()); - throw; - } - } - - public void Stop () - { - if (ch != null) - ChannelServices.UnregisterChannel (ch); - } - - public int GetDomId () - { - return Thread.GetDomainID(); - } - } - - [Serializable] - public abstract class ChannelManager - { - public abstract IChannelSender CreateClientChannel (); - public abstract IChannelReceiver CreateServerChannel (); - } - - - // - // Test interface - // - public interface IRemoteObject - { - int Simple (); - string PrimitiveParams (int a, uint b, char c, string d); - string PrimitiveParamsInOut (ref int a1, out int a2, ref float b1, out float b2, ref char c1, out char c2, ref string d1, out string d2); - Complex ComplexParams (ArrayList a, Complex b, string c); - Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c); - } - - // Base classes for tester surrogates - - public abstract class InstanceSurrogate : IRemoteObject - { - public RemoteObject RemoteObject; - public abstract int Simple (); - public abstract string PrimitiveParams (int a, uint b, char c, string d); - public abstract string PrimitiveParamsInOut (ref int a1, out int a2, ref float b1, out float b2, ref char c1, out char c2, ref string d1, out string d2); - public abstract Complex ComplexParams (ArrayList a, Complex b, string c); - public abstract Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c); - } - - public abstract class AbstractSurrogate : IRemoteObject - { - public AbstractRemoteObject RemoteObject; - public abstract int Simple (); - public abstract string PrimitiveParams (int a, uint b, char c, string d); - public abstract string PrimitiveParamsInOut (ref int a1, out int a2, ref float b1, out float b2, ref char c1, out char c2, ref string d1, out string d2); - public abstract Complex ComplexParams (ArrayList a, Complex b, string c); - public abstract Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c); - } - - public abstract class InterfaceSurrogate : IRemoteObject - { - public IRemoteObject RemoteObject; - public abstract int Simple (); - public abstract string PrimitiveParams (int a, uint b, char c, string d); - public abstract string PrimitiveParamsInOut (ref int a1, out int a2, ref float b1, out float b2, ref char c1, out char c2, ref string d1, out string d2); - public abstract Complex ComplexParams (ArrayList a, Complex b, string c); - public abstract Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c); - } - - - // - // Test abstract base class - // - - public abstract class AbstractRemoteObject : MarshalByRefObject - { - public abstract int Simple (); - public abstract string PrimitiveParams (int a, uint b, char c, string d); - public abstract string PrimitiveParamsInOut (ref int a1, out int a2, ref float b1, out float b2, ref char c1, out char c2, ref string d1, out string d2); - public abstract Complex ComplexParams (ArrayList a, Complex b, string c); - public abstract Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c); - } - - // - // Test class - // - - public class RemoteObject : AbstractRemoteObject, IRemoteObject - { - public override int Simple () - { - return 130772 + Thread.GetDomainID(); - } - - public override string PrimitiveParams (int a, uint b, char c, string d) - { - return "" + a + "-" + b + "-" + c + "-" + d + "@" + Thread.GetDomainID(); - } - - public override string PrimitiveParamsInOut (ref int a1, out int a2, ref float b1, out float b2, ref char c1, out char c2, ref string d1, out string d2) - { - string res = "" + a1 + "-" + b1 + "-" + c1 + "-" + d1 + "@" + Thread.GetDomainID(); - a2 = 12345678; - b2 = 53455.345f; - c2 = 'g'; - d2 = "sfARREG$5345DGDfgY7656gDFG>><<dasdasd"; - a1 = 65748392; - b1 = 98395.654f; - c1 = 'l'; - d1 = "aasbasbdyhasbduybo234243"; - return res; - } - - public override Complex ComplexParams (ArrayList a, Complex b, string c) - { - Complex cp = new Complex (33,c+ "@" + Thread.GetDomainID()); - cp.Child = b; - cp.Child.Child = (Complex)a[0]; - return cp; - } - - public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c) - { - b = new Complex (33,c+ "@" + Thread.GetDomainID()); - a.Add (b); - return b; - } - } - - [Serializable] - public class Complex - { - public Complex (int id, string name) - { - Id = id; - Name = name; - } - - public string Name; - public int Id; - public Complex Child; - } -} - - diff --git a/mcs/class/System.Runtime.Remoting/Test/CallSeq.cs b/mcs/class/System.Runtime.Remoting/Test/CallSeq.cs index 32210d7c752..5ab15951d0a 100644 --- a/mcs/class/System.Runtime.Remoting/Test/CallSeq.cs +++ b/mcs/class/System.Runtime.Remoting/Test/CallSeq.cs @@ -19,42 +19,17 @@ namespace MonoTests.System.Runtime.Remoting static int checkPos = 0;
static int writePos = 0;
static string name = "";
- static ArrayList contexts = new ArrayList ();
- static int domId = 1;
public static void Add (string msg)
{
writePos++;
-
- msg = writePos.ToString ("000") + " (d" + CommonDomainId + ",c" + CommonContextId + ") " + msg;
+ msg = writePos.ToString ("000") + " (d" + Thread.GetDomainID() + ",c" + Thread.CurrentContext.ContextID + ") " + msg;
calls.Add (msg);
}
- public static int CommonContextId
- {
- get
- {
- int id = Thread.CurrentContext.ContextID;
- int idc = contexts.IndexOf (id);
- if (idc == -1)
- {
- idc = contexts.Count;
- contexts.Add (id);
- }
- return idc;
- }
- }
-
- public static int CommonDomainId
- {
- get { return domId; }
- set { domId = value; }
- }
-
public static void Init (string str)
{
calls = new ArrayList();
- contexts = new ArrayList ();
name = str;
checkPos = 0;
writePos = 0;
diff --git a/mcs/class/System.Runtime.Remoting/Test/ChangeLog b/mcs/class/System.Runtime.Remoting/Test/ChangeLog index 005732cc370..2cedeb2afb7 100644 --- a/mcs/class/System.Runtime.Remoting/Test/ChangeLog +++ b/mcs/class/System.Runtime.Remoting/Test/ChangeLog @@ -1,27 +1,3 @@ -2003-09-01 Nick Drochak <ndrochak@gol.com> - - * AsyncCalls.cs: Fix Build breaker on .NET 1.1. - -2003-08-22 Lluis Sanchez Gual <lluis@ximian.com> - - * BaseCalls.cs: Create 3 test remote objects, one for each kind of access, - to avoid reuse of client proxies. - * CallSeq.cs: Now, "domain ID" is set manually. - * ContextsTest.cs: Added initialization of common domain id. Other small fixes. - * ReflectionCalls.cs: Get the method for the invoke for the correct type. - GetType() for a proxy to interface always return MarshalByRefObject. - * TcpCalls.cs, HttpCalls.cs: Added delegate tests. - * DelegateCalls.cs: New test suite for calls using delegates. - -2003-08-20 Lluis Sanchez Gual <lluis@ximian.com> - - * AsyncCalls.cs, BaseCalls.cs, HttpCalls.cs, ReflectionCalls.cs, SyncCalls.cs, - TcpCalls.cs: new test suite for remoting. It tests sync calls, async calls - and reflection calls using tcp and http channels. - * CallSeq.cs, ContextHookAttribute.cs: Add methods for getting a context and - domain ids that are the same between tests runs. - * ContextsTest.cs: unregister channel on test shutdown. - 2003-07-23 Lluis Sanchez Gual <lluis@ximian.com> * ContextsTest.cs, CallSeq.cs, ContextHookAttribute.cs, ServerObject.cs: Added. diff --git a/mcs/class/System.Runtime.Remoting/Test/ContextHookAttribute.cs b/mcs/class/System.Runtime.Remoting/Test/ContextHookAttribute.cs index df5f4dcd154..0c78a2bb136 100644 --- a/mcs/class/System.Runtime.Remoting/Test/ContextHookAttribute.cs +++ b/mcs/class/System.Runtime.Remoting/Test/ContextHookAttribute.cs @@ -30,13 +30,12 @@ namespace MonoTests.System.Runtime.Remoting {
id = idp;
if (id != "") id += ".";
- id += "d" + CallSeq.CommonDomainId;
+ id += "d" + Thread.GetDomainID();
this.newContext = newContext;
}
public override object TypeId
{
-
get { return "ContextHook"; }
}
diff --git a/mcs/class/System.Runtime.Remoting/Test/ContextsTest.cs b/mcs/class/System.Runtime.Remoting/Test/ContextsTest.cs index aabe7f28e63..273705d54a6 100644 --- a/mcs/class/System.Runtime.Remoting/Test/ContextsTest.cs +++ b/mcs/class/System.Runtime.Remoting/Test/ContextsTest.cs @@ -28,7 +28,6 @@ namespace MonoTests.System.Runtime.Remoting [TestFixtureSetUp]
public void Run()
{
- CallSeq.CommonDomainId = 1;
Context.RegisterDynamicProperty (new DynProperty("global"), null, null);
ch = new TcpChannel(0);
@@ -39,8 +38,7 @@ namespace MonoTests.System.Runtime.Remoting public void End ()
{
Context.UnregisterDynamicProperty ("global", null, null);
- if (ch != null)
- ChannelServices.UnregisterChannel (ch);
+// ChannelServices.UnregisterChannel (ch);
}
[Test]
@@ -59,8 +57,6 @@ namespace MonoTests.System.Runtime.Remoting [Test]
public void TestNewContext ()
{
- try
- {
CallSeq.Init("TestNewContext");
CallSeq.Add (">> TestNewContext");
object[] at = new object[] { new ContextHookAttribute ("1",true)};
@@ -70,11 +66,6 @@ namespace MonoTests.System.Runtime.Remoting RunTestObject (list);
CallSeq.Add ("<< TestNewContext");
CallSeq.Check (Checks.seqNewContext,1);
- }
- catch (Exception eX)
- {
- Console.WriteLine (eX);
- }
}
[Test]
@@ -82,31 +73,21 @@ namespace MonoTests.System.Runtime.Remoting {
AppDomain domain = AppDomain.CreateDomain ("test");
DomainServer server = (DomainServer) domain.CreateInstanceAndUnwrap(GetType().Assembly.FullName,"MonoTests.System.Runtime.Remoting.DomainServer");
- try
- {
- CallSeq.Init("TestRemoteContext");
- CallSeq.Add (">> TestRemoteContext");
- object[] at = new object[] { new ContextHookAttribute ("1",true), new UrlAttribute ("tcp://localhost:1122")};
- CallSeq.Add (">> Creating instance");
- ServerList list = (ServerList) Activator.CreateInstance (typeof (ServerList),null,at);
- CallSeq.Add ("<< Creating instance");
- RunTestObject (list);
- CallSeq.Add ("<< TestRemoteContext");
- CallSeq.Check (Checks.seqRemoteContext,1);
- CallSeq.Init ("TestRemoteContext Server");
- CallSeq.Seq = server.GetRemoteSeq ();
- CallSeq.Check (Checks.seqRemoteContext,2);
- }
- catch (Exception ex)
- {
- Console.WriteLine (ex);
- throw ex;
- }
- finally
- {
- server.Stop ();
- }
+ CallSeq.Init("TestRemoteContext");
+ CallSeq.Add (">> TestRemoteContext");
+ object[] at = new object[] { new ContextHookAttribute ("1",true), new UrlAttribute ("tcp://localhost:1122")};
+ CallSeq.Add (">> Creating instance");
+ ServerList list = (ServerList) Activator.CreateInstance (typeof (ServerList),null,at);
+ CallSeq.Add ("<< Creating instance");
+ RunTestObject (list);
+ CallSeq.Add ("<< TestRemoteContext");
+ CallSeq.Check (Checks.seqRemoteContext,1);
+
+ CallSeq.Init ("TestRemoteContext Server");
+ CallSeq.Seq = server.GetRemoteSeq ();
+ CallSeq.Check (Checks.seqRemoteContext,2);
+ server.Stop ();
// AppDomain.Unload (domain);
}
@@ -190,7 +171,7 @@ namespace MonoTests.System.Runtime.Remoting }
catch (Exception ex)
{
- // Console.WriteLine (ex.ToString());
+ Console.WriteLine (ex.ToString());
throw;
}
}
@@ -201,8 +182,7 @@ namespace MonoTests.System.Runtime.Remoting TcpChannel ch;
public DomainServer()
- {
- CallSeq.CommonDomainId = 2;
+ {
try
{
ch = new TcpChannel(1122);
@@ -225,8 +205,7 @@ namespace MonoTests.System.Runtime.Remoting public void Stop ()
{
- if (ch != null)
- ChannelServices.UnregisterChannel (ch);
+// ChannelServices.UnregisterChannel (ch);
}
}
@@ -408,7 +387,6 @@ namespace MonoTests.System.Runtime.Remoting "119 (d1,c1) --> ServerContextSink(x.d1) SyncProcessMessage FieldGetter",
"120 (d1,c1) --> ObjectSink(1.d1) SyncProcessMessage FieldGetter",
"121 (d1,c1) --> ObjectSink(x.d1) SyncProcessMessage FieldGetter",
-
"122 (d1,c1) <-- ObjectSink(x.d1) SyncProcessMessage FieldGetter",
"123 (d1,c1) <-- ObjectSink(1.d1) SyncProcessMessage FieldGetter",
"124 (d1,c1) <-- ServerContextSink(x.d1) SyncProcessMessage FieldGetter",
@@ -452,7 +430,6 @@ namespace MonoTests.System.Runtime.Remoting "162 (d1,c0) <-> defcontext DynamicSink Start ParameterTest2 client:True",
"163 (d1,c1) <-> global DynamicSink Start ParameterTest2 client:False",
"164 (d1,c1) --> ServerContextSink(1.d1) SyncProcessMessage ParameterTest2",
-
"165 (d1,c1) --> ServerContextSink(x.d1) SyncProcessMessage ParameterTest2",
"166 (d1,c1) --> ObjectSink(1.d1) SyncProcessMessage ParameterTest2",
"167 (d1,c1) --> ObjectSink(x.d1) SyncProcessMessage ParameterTest2",
@@ -631,7 +608,6 @@ namespace MonoTests.System.Runtime.Remoting "339 (d1,c1) <-> global DynamicSink Finish ProcessItems client:False",
"340 (d1,c0) <-> global DynamicSink Finish ProcessItems client:True",
"341 (d1,c0) <-> defcontext DynamicSink Finish ProcessItems client:True",
-
"342 (d1,c0) <-- EnvoySink(1.d1) SyncProcessMessage ProcessItems",
"343 (d1,c0) <-- EnvoySink(x.d1) SyncProcessMessage ProcessItems",
"344 (d1,c0) <-> proxy DynamicSink Finish ProcessItems client:True",
@@ -746,7 +722,6 @@ namespace MonoTests.System.Runtime.Remoting "034 (d1,c0) <-> defcontext DynamicSink Finish FieldSetter client:True",
"035 (d1,c0) <-- EnvoySink(1.d1) SyncProcessMessage FieldSetter",
"036 (d1,c0) <-- EnvoySink(x.d1) SyncProcessMessage FieldSetter",
-
"037 (d1,c0) <-- EnvoySink(x.d2) SyncProcessMessage FieldSetter",
"038 (d1,c0) <-> proxy DynamicSink Finish FieldSetter client:True",
diff --git a/mcs/class/System.Runtime.Remoting/Test/DelegateCalls.cs b/mcs/class/System.Runtime.Remoting/Test/DelegateCalls.cs deleted file mode 100644 index 7655ea93c62..00000000000 --- a/mcs/class/System.Runtime.Remoting/Test/DelegateCalls.cs +++ /dev/null @@ -1,120 +0,0 @@ -// -// MonoTests.System.Runtime.Remoting.DelegateCalls.cs -// -// Author: Lluis Sanchez Gual (lluis@ximian.com) -// -// 2003 (C) Copyright, Ximian, Inc. -// - -using System; -using System.Collections; -using NUnit.Framework; - -namespace MonoTests.System.Runtime.Remoting -{ - public abstract class DelegateCallTest : BaseCallTest - { - public override InstanceSurrogate GetInstanceSurrogate () { return new DelegateInstanceSurrogate (); } - public override AbstractSurrogate GetAbstractSurrogate () { return new DelegateAbstractSurrogate (); } - public override InterfaceSurrogate GetInterfaceSurrogate () { return new DelegateInterfaceSurrogate (); } - } - - public class DelegateInstanceSurrogate : InstanceSurrogate - { - public override int Simple () - { - DelegateSimple de = new DelegateSimple (RemoteObject.Simple); - return de (); - } - - public override string PrimitiveParams (int a, uint b, char c, string d) - { - DelegatePrimitiveParams de = new DelegatePrimitiveParams (RemoteObject.PrimitiveParams); - return de (a,b,c,d); - } - - public override string PrimitiveParamsInOut (ref int a1, out int a2, ref float b1, out float b2, ref char c1, out char c2, ref string d1, out string d2) - { - DelegatePrimitiveParamsInOut de = new DelegatePrimitiveParamsInOut (RemoteObject.PrimitiveParamsInOut); - return de (ref a1, out a2, ref b1, out b2, ref c1, out c2, ref d1, out d2); - } - - public override Complex ComplexParams (ArrayList a, Complex b, string c) - { - DelegateComplexParams de = new DelegateComplexParams (RemoteObject.ComplexParams); - return de (a,b,c); - } - - public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c) - { - DelegateComplexParamsInOut de = new DelegateComplexParamsInOut (RemoteObject.ComplexParamsInOut); - return de (ref a, out b, c); - } - } - - public class DelegateAbstractSurrogate : AbstractSurrogate - { - public override int Simple () - { - DelegateSimple de = new DelegateSimple (RemoteObject.Simple); - return de (); - } - - public override string PrimitiveParams (int a, uint b, char c, string d) - { - DelegatePrimitiveParams de = new DelegatePrimitiveParams (RemoteObject.PrimitiveParams); - return de (a,b,c,d); - } - - public override string PrimitiveParamsInOut (ref int a1, out int a2, ref float b1, out float b2, ref char c1, out char c2, ref string d1, out string d2) - { - DelegatePrimitiveParamsInOut de = new DelegatePrimitiveParamsInOut (RemoteObject.PrimitiveParamsInOut); - return de (ref a1, out a2, ref b1, out b2, ref c1, out c2, ref d1, out d2); - } - - public override Complex ComplexParams (ArrayList a, Complex b, string c) - { - DelegateComplexParams de = new DelegateComplexParams (RemoteObject.ComplexParams); - return de (a,b,c); - } - - public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c) - { - DelegateComplexParamsInOut de = new DelegateComplexParamsInOut (RemoteObject.ComplexParamsInOut); - return de (ref a, out b, c); - } - } - - public class DelegateInterfaceSurrogate : InterfaceSurrogate - { - public override int Simple () - { - DelegateSimple de = new DelegateSimple (RemoteObject.Simple); - return de (); - } - - public override string PrimitiveParams (int a, uint b, char c, string d) - { - DelegatePrimitiveParams de = new DelegatePrimitiveParams (RemoteObject.PrimitiveParams); - return de (a,b,c,d); - } - - public override string PrimitiveParamsInOut (ref int a1, out int a2, ref float b1, out float b2, ref char c1, out char c2, ref string d1, out string d2) - { - DelegatePrimitiveParamsInOut de = new DelegatePrimitiveParamsInOut (RemoteObject.PrimitiveParamsInOut); - return de (ref a1, out a2, ref b1, out b2, ref c1, out c2, ref d1, out d2); - } - - public override Complex ComplexParams (ArrayList a, Complex b, string c) - { - DelegateComplexParams de = new DelegateComplexParams (RemoteObject.ComplexParams); - return de (a,b,c); - } - - public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c) - { - DelegateComplexParamsInOut de = new DelegateComplexParamsInOut (RemoteObject.ComplexParamsInOut); - return de (ref a, out b, c); - } - } -} diff --git a/mcs/class/System.Runtime.Remoting/Test/HttpCalls.cs b/mcs/class/System.Runtime.Remoting/Test/HttpCalls.cs deleted file mode 100644 index 6ba81691fd9..00000000000 --- a/mcs/class/System.Runtime.Remoting/Test/HttpCalls.cs +++ /dev/null @@ -1,67 +0,0 @@ -// -// MonoTests.System.Runtime.Remoting.HttpCalls.cs -// -// Author: Lluis Sanchez Gual (lluis@ximian.com) -// -// 2003 (C) Copyright, Ximian, Inc. -// - -using System; -using System.Runtime.Remoting; -using System.Runtime.Remoting.Channels; -using System.Runtime.Remoting.Channels.Http; -using NUnit.Framework; - -namespace MonoTests.System.Runtime.Remoting -{ - [TestFixture] - public class HttpSyncCallTest : SyncCallTest - { - public override ChannelManager CreateChannelManager () - { - return new HttpChannelManager (); - } - } - - [TestFixture] - public class HttpAsyncCallTest : AsyncCallTest - { - public override ChannelManager CreateChannelManager () - { - return new HttpChannelManager (); - } - } - - [TestFixture] - public class HttpReflectionCallTest : ReflectionCallTest - { - public override ChannelManager CreateChannelManager () - { - return new HttpChannelManager (); - } - } - - [TestFixture] - public class HttpDelegateCallTest : DelegateCallTest - { - public override ChannelManager CreateChannelManager () - { - return new HttpChannelManager (); - } - } - - [Serializable] - public class HttpChannelManager : ChannelManager - { - public override IChannelSender CreateClientChannel () - { - return new HttpChannel (); - } - - public override IChannelReceiver CreateServerChannel () - { - return new HttpChannel (1133); - } - } -} - diff --git a/mcs/class/System.Runtime.Remoting/Test/ReflectionCalls.cs b/mcs/class/System.Runtime.Remoting/Test/ReflectionCalls.cs deleted file mode 100644 index e7d4b5cd253..00000000000 --- a/mcs/class/System.Runtime.Remoting/Test/ReflectionCalls.cs +++ /dev/null @@ -1,154 +0,0 @@ -// -// MonoTests.System.Runtime.Remoting.ReflectionCalls.cs -// -// Author: Lluis Sanchez Gual (lluis@ximian.com) -// -// 2003 (C) Copyright, Ximian, Inc. -// - -using System; -using System.Reflection; -using System.Collections; -using NUnit.Framework; - -namespace MonoTests.System.Runtime.Remoting -{ - public abstract class ReflectionCallTest : BaseCallTest - { - public override InstanceSurrogate GetInstanceSurrogate () { return new ReflectionInstanceSurrogate (); } - public override AbstractSurrogate GetAbstractSurrogate () { return new ReflectionAbstractSurrogate (); } - public override InterfaceSurrogate GetInterfaceSurrogate () { return new ReflectionInterfaceSurrogate (); } - - public static int Simple (Type type, object target) - { - object[] parms = new object[0]; - MethodBase m = type.GetMethod ("Simple"); - return (int) m.Invoke (target, parms); - } - - public static string PrimitiveParams (Type type, object target, int a, uint b, char c, string d) - { - object[] parms = new object[] {a,b,c,d}; - MethodBase m = type.GetMethod ("PrimitiveParams"); - return (string) m.Invoke (target, parms); - } - - public static string PrimitiveParamsInOut (Type type, object target, ref int a1, out int a2, ref float b1, out float b2, ref char c1, out char c2, ref string d1, out string d2) - { - object[] parms = new object[] {a1,0,b1,0f,c1,'\0',d1,null}; - MethodBase m = type.GetMethod ("PrimitiveParamsInOut"); - string res = (string) m.Invoke (target, parms); - a1 = (int)parms[0]; - b1 = (float)parms[2]; - c1 = (char)parms[4]; - d1 = (string)parms[6]; - a2 = (int)parms[1]; - b2 = (float)parms[3]; - c2 = (char)parms[5]; - d2 = (string)parms[7]; - return res; - } - - public static Complex ComplexParams (Type type, object target, ArrayList a, Complex b, string c) - { - object[] parms = new object[] {a,b,c}; - MethodBase m = type.GetMethod ("ComplexParams"); - return (Complex) m.Invoke (target, parms); - } - - public static Complex ComplexParamsInOut (Type type, object target, ref ArrayList a, out Complex b, string c) - { - object[] parms = new object[] {a,null,c}; - MethodBase m = type.GetMethod ("ComplexParamsInOut"); - Complex res = (Complex) m.Invoke (target, parms); - a = (ArrayList) parms[0]; - b = (Complex) parms[1]; - return res; - } - } - - public class ReflectionInstanceSurrogate : InstanceSurrogate - { - public override int Simple () - { - return ReflectionCallTest.Simple (typeof (RemoteObject), RemoteObject); - } - - public override string PrimitiveParams (int a, uint b, char c, string d) - { - return ReflectionCallTest.PrimitiveParams (typeof (RemoteObject), RemoteObject, a, b, c, d); - } - - public override string PrimitiveParamsInOut (ref int a1, out int a2, ref float b1, out float b2, ref char c1, out char c2, ref string d1, out string d2) - { - return ReflectionCallTest.PrimitiveParamsInOut (typeof (RemoteObject), RemoteObject, ref a1, out a2, ref b1, out b2, ref c1, out c2, ref d1, out d2); - } - - public override Complex ComplexParams (ArrayList a, Complex b, string c) - { - return ReflectionCallTest.ComplexParams (typeof (RemoteObject), RemoteObject, a, b, c); - } - - public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c) - { - return ReflectionCallTest.ComplexParamsInOut (typeof (RemoteObject), RemoteObject, ref a, out b, c); - } - } - - public class ReflectionAbstractSurrogate : AbstractSurrogate - { - public override int Simple () - { - return ReflectionCallTest.Simple (typeof (AbstractRemoteObject), RemoteObject); - } - - public override string PrimitiveParams (int a, uint b, char c, string d) - { - return ReflectionCallTest.PrimitiveParams (typeof (AbstractRemoteObject), RemoteObject, a, b, c, d); - } - - public override string PrimitiveParamsInOut (ref int a1, out int a2, ref float b1, out float b2, ref char c1, out char c2, ref string d1, out string d2) - { - return ReflectionCallTest.PrimitiveParamsInOut (typeof (AbstractRemoteObject), RemoteObject, ref a1, out a2, ref b1, out b2, ref c1, out c2, ref d1, out d2); - } - - public override Complex ComplexParams (ArrayList a, Complex b, string c) - { - return ReflectionCallTest.ComplexParams (typeof (AbstractRemoteObject), RemoteObject, a, b, c); - } - - public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c) - { - return ReflectionCallTest.ComplexParamsInOut (typeof (AbstractRemoteObject), RemoteObject, ref a, out b, c); - } - } - - public class ReflectionInterfaceSurrogate : InterfaceSurrogate - { - public override int Simple () - { - return ReflectionCallTest.Simple (typeof (IRemoteObject), RemoteObject); - } - - public override string PrimitiveParams (int a, uint b, char c, string d) - { - return ReflectionCallTest.PrimitiveParams (typeof (IRemoteObject), RemoteObject, a, b, c, d); - } - - public override string PrimitiveParamsInOut (ref int a1, out int a2, ref float b1, out float b2, ref char c1, out char c2, ref string d1, out string d2) - { - return ReflectionCallTest.PrimitiveParamsInOut (typeof (IRemoteObject), RemoteObject, ref a1, out a2, ref b1, out b2, ref c1, out c2, ref d1, out d2); - } - - public override Complex ComplexParams (ArrayList a, Complex b, string c) - { - return ReflectionCallTest.ComplexParams (typeof (IRemoteObject), RemoteObject, a, b, c); - } - - public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c) - { - return ReflectionCallTest.ComplexParamsInOut (typeof (IRemoteObject), RemoteObject, ref a, out b, c); - } - } -} - diff --git a/mcs/class/System.Runtime.Remoting/Test/SyncCalls.cs b/mcs/class/System.Runtime.Remoting/Test/SyncCalls.cs deleted file mode 100644 index 7b015e33de5..00000000000 --- a/mcs/class/System.Runtime.Remoting/Test/SyncCalls.cs +++ /dev/null @@ -1,106 +0,0 @@ -// -// MonoTests.System.Runtime.Remoting.SyncCalls.cs -// -// Author: Lluis Sanchez Gual (lluis@ximian.com) -// -// 2003 (C) Copyright, Ximian, Inc. -// - -using System; -using System.Collections; -using NUnit.Framework; - -namespace MonoTests.System.Runtime.Remoting -{ - public abstract class SyncCallTest : BaseCallTest - { - public override InstanceSurrogate GetInstanceSurrogate () { return new SyncInstanceSurrogate (); } - public override AbstractSurrogate GetAbstractSurrogate () { return new SyncAbstractSurrogate (); } - public override InterfaceSurrogate GetInterfaceSurrogate () { return new SyncInterfaceSurrogate (); } - } - - public class SyncInstanceSurrogate : InstanceSurrogate - { - public override int Simple () - { - return RemoteObject.Simple (); - } - - public override string PrimitiveParams (int a, uint b, char c, string d) - { - return RemoteObject.PrimitiveParams (a, b, c, d); - } - - public override string PrimitiveParamsInOut (ref int a1, out int a2, ref float b1, out float b2, ref char c1, out char c2, ref string d1, out string d2) - { - return RemoteObject.PrimitiveParamsInOut (ref a1, out a2, ref b1, out b2, ref c1, out c2, ref d1, out d2); - } - - public override Complex ComplexParams (ArrayList a, Complex b, string c) - { - return RemoteObject.ComplexParams (a, b, c); - } - - public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c) - { - return RemoteObject.ComplexParamsInOut (ref a, out b, c); - } - } - - public class SyncAbstractSurrogate : AbstractSurrogate - { - public override int Simple () - { - return RemoteObject.Simple (); - } - - public override string PrimitiveParams (int a, uint b, char c, string d) - { - return RemoteObject.PrimitiveParams (a, b, c, d); - } - - public override string PrimitiveParamsInOut (ref int a1, out int a2, ref float b1, out float b2, ref char c1, out char c2, ref string d1, out string d2) - { - return RemoteObject.PrimitiveParamsInOut (ref a1, out a2, ref b1, out b2, ref c1, out c2, ref d1, out d2); - } - - public override Complex ComplexParams (ArrayList a, Complex b, string c) - { - return RemoteObject.ComplexParams (a, b, c); - } - - public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c) - { - return RemoteObject.ComplexParamsInOut (ref a, out b, c); - } - } - - public class SyncInterfaceSurrogate : InterfaceSurrogate - { - public override int Simple () - { - return RemoteObject.Simple (); - } - - public override string PrimitiveParams (int a, uint b, char c, string d) - { - return RemoteObject.PrimitiveParams (a, b, c, d); - } - - public override string PrimitiveParamsInOut (ref int a1, out int a2, ref float b1, out float b2, ref char c1, out char c2, ref string d1, out string d2) - { - return RemoteObject.PrimitiveParamsInOut (ref a1, out a2, ref b1, out b2, ref c1, out c2, ref d1, out d2); - } - - public override Complex ComplexParams (ArrayList a, Complex b, string c) - { - return RemoteObject.ComplexParams (a, b, c); - } - - public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c) - { - return RemoteObject.ComplexParamsInOut (ref a, out b, c); - } - } -} - diff --git a/mcs/class/System.Runtime.Remoting/Test/TcpCalls.cs b/mcs/class/System.Runtime.Remoting/Test/TcpCalls.cs deleted file mode 100644 index 6639d76f6be..00000000000 --- a/mcs/class/System.Runtime.Remoting/Test/TcpCalls.cs +++ /dev/null @@ -1,67 +0,0 @@ -// -// MonoTests.System.Runtime.Remoting.TcpCalls.cs -// -// Author: Lluis Sanchez Gual (lluis@ximian.com) -// -// 2003 (C) Copyright, Ximian, Inc. -// - -using System; -using System.Runtime.Remoting; -using System.Runtime.Remoting.Channels; -using System.Runtime.Remoting.Channels.Tcp; -using NUnit.Framework; - -namespace MonoTests.System.Runtime.Remoting -{ - [TestFixture] - public class TcpSyncCallTest : SyncCallTest - { - public override ChannelManager CreateChannelManager () - { - return new TcpChannelManager (); - } - } - - [TestFixture] - public class TcpAsyncCallTest : AsyncCallTest - { - public override ChannelManager CreateChannelManager () - { - return new TcpChannelManager (); - } - } - - [TestFixture] - public class TcpReflectionCallTest : ReflectionCallTest - { - public override ChannelManager CreateChannelManager () - { - return new TcpChannelManager (); - } - } - - [TestFixture] - public class TcpDelegateCallTest : DelegateCallTest - { - public override ChannelManager CreateChannelManager () - { - return new TcpChannelManager (); - } - } - - [Serializable] - public class TcpChannelManager : ChannelManager - { - public override IChannelSender CreateClientChannel () - { - return new TcpChannel (0); - } - - public override IChannelReceiver CreateServerChannel () - { - return new TcpChannel (1122); - } - } -} - diff --git a/mcs/class/System.Runtime.Serialization.Formatters.Soap/ChangeLog b/mcs/class/System.Runtime.Serialization.Formatters.Soap/ChangeLog index 99930f6d60b..c1a3a00c632 100644 --- a/mcs/class/System.Runtime.Serialization.Formatters.Soap/ChangeLog +++ b/mcs/class/System.Runtime.Serialization.Formatters.Soap/ChangeLog @@ -1,9 +1,3 @@ -2003-08-25 Lluis Sanchez Gual <lluis@ximian.com> - - * SoapTypeMapper.cs: Added mappings for more primitive types. - * SoapWriter.cs: Use XmlSchema.Namespace and XmlSchema.InstanceNamespace - instead of string constants. - 2003-06-30 Jean-Marc Andre <jean-marc.andre@polymtl.ca> * SoapServices: removed because it is now included in the diff --git a/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapTypeMapper.cs b/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapTypeMapper.cs index bad2897af56..e5c9da532ea 100644 --- a/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapTypeMapper.cs +++ b/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapTypeMapper.cs @@ -11,7 +11,6 @@ using System.Reflection; using System.Collections;
using System.Runtime.Remoting;
using System.Xml.Serialization;
-using System.Xml.Schema;
namespace System.Runtime.Serialization.Formatters.Soap {
@@ -27,9 +26,7 @@ namespace System.Runtime.Serialization.Formatters.Soap { // returns the SoapTypeMapping corresponding to the System.Type
public static SoapTypeMapping GetSoapType(Type type) {
object rtnMapping;
-
- if (type.IsByRef) type = type.GetElementType ();
-
+
if(type.IsArray){
rtnMapping = _mappingTable[typeof(System.Array)];
@@ -38,6 +35,7 @@ namespace System.Runtime.Serialization.Formatters.Soap { rtnMapping = (object) _mappingTable[type];
if(rtnMapping == null){
+
string sTypeNamespace;
AssemblyName assName = type.Assembly.GetName();
if(assName.Name.StartsWith("mscorlib")) sTypeNamespace = "http://schemas.microsoft.com/clr/ns/"+type.Namespace;
@@ -81,13 +79,6 @@ namespace System.Runtime.Serialization.Formatters.Soap { return (Type)rtnObject;
}
-
- private static void RegisterSchemaType (Type type, string typeName, bool canBeValue, bool isPrimitive,bool isValueType,bool needId)
- {
- SoapTypeMapping mapping = new SoapTypeMapping (type, typeName, canBeValue, isPrimitive, isValueType, needId);
- _mappingTable.Add(type, mapping);
- _invertMappingTable.Add(mapping, type);
- }
// initialize the mapping tables
private static void InitMappingTable() {
@@ -97,26 +88,51 @@ namespace System.Runtime.Serialization.Formatters.Soap { mapping = new SoapTypeMapping(typeof(string), "string", true, false, false, true);
_mappingTable.Add(typeof(string),mapping);
_invertMappingTable.Add(mapping, typeof(string));
- mapping = new SoapTypeMapping(typeof(string), "string", XmlSchema.Namespace, true, false, false, true);
+ mapping = new SoapTypeMapping(typeof(string), "string", "http://www.w3.org/2001/XMLSchema", true, false, false, true);
_invertMappingTable.Add(mapping, typeof(string));
-
- RegisterSchemaType (typeof(short), "short", true, true, true, false);
- RegisterSchemaType (typeof(ushort), "unsignedShort", true, true, true, false);
- RegisterSchemaType (typeof(int), "int", true, true, true, false);
- RegisterSchemaType (typeof(uint), "unsignedInt", true, true, true, false);
- RegisterSchemaType (typeof(long), "long", true, true, true, false);
- RegisterSchemaType (typeof(ulong), "unsignedLong", true, true, true, false);
- RegisterSchemaType (typeof(decimal), "decimal", true, true, true, false);
- RegisterSchemaType (typeof(sbyte), "byte", true, true, true, false);
- RegisterSchemaType (typeof(byte), "unsignedByte", true, true, true, false);
- RegisterSchemaType (typeof(DateTime), "dateTime", true, true, true, false);
- RegisterSchemaType (typeof(TimeSpan), "duration", true, true, true, false);
- RegisterSchemaType (typeof(double), "double", true, true, true, false);
- RegisterSchemaType (typeof(Char), "char", true, true, true, false);
- RegisterSchemaType (typeof(bool), "boolean", true, true, true, false);
- RegisterSchemaType (typeof(System.Single), "float", true, true, true, false);
- RegisterSchemaType (typeof(System.Array), "Array", false, false, false, true);
- RegisterSchemaType (typeof(object), "anyType", false, false, false, true);
+
+ // the primitive type "System.Int16"
+ mapping = new SoapTypeMapping(typeof(short), "short", "http://www.w3.org/2001/XMLSchema", true, true, true, false);
+ _mappingTable.Add(typeof(short), mapping);
+ _invertMappingTable.Add(mapping, typeof(short));
+
+ // the primitive type "System.Int32"
+ mapping = new SoapTypeMapping(typeof(int), "int", "http://www.w3.org/2001/XMLSchema", true, true, true, false);
+ _mappingTable.Add(typeof(int), mapping);
+ _invertMappingTable.Add(mapping, typeof(int));
+
+ // the primitive type "System.Boolean"
+ mapping = new SoapTypeMapping(typeof(bool), "boolean", "http://www.w3.org/2001/XMLSchema", true, true, true, false);
+ _mappingTable.Add(typeof(bool), mapping);
+ _invertMappingTable.Add(mapping, typeof(bool));
+
+ // the primitive type "System.long"
+ mapping = new SoapTypeMapping(typeof(long), "long", "http://www.w3.org/2001/XMLSchema", true, true, true, false);
+ _mappingTable.Add(typeof(long), mapping);
+ _invertMappingTable.Add(mapping, typeof(long));
+
+ // the primitive type "System.double"
+ mapping = new SoapTypeMapping(typeof(double), "double", "http://www.w3.org/2001/XMLSchema", true, true, true, false);
+ _mappingTable.Add(typeof(double), mapping);
+ _invertMappingTable.Add(mapping, typeof(double));
+
+ // the primitive type "System.Char"
+ mapping = new SoapTypeMapping(typeof(Char), "Char", "http://www.w3.org/2001/XMLSchema", true, true, true, false);
+ _mappingTable.Add(typeof(Char), mapping);
+ _invertMappingTable.Add(mapping, typeof(Char));
+
+ // the primitive type "System.Single"
+ mapping = new SoapTypeMapping(typeof(System.Single), "float", "http://www.w3.org/2001/XMLSchema", true, true, true, false);
+ _mappingTable.Add(typeof(System.Single), mapping);
+ _invertMappingTable.Add(mapping, typeof(System.Single));
+
+ mapping = new SoapTypeMapping(typeof(System.Array), "Array", false, false, false, true);
+ _mappingTable.Add(typeof(System.Array), mapping);
+ _invertMappingTable.Add(mapping, typeof(System.Array));
+
+ mapping = new SoapTypeMapping(typeof(object), "anyType", "http://www.w3.org/2001/XMLSchema", false, false, false, true);
+ _mappingTable.Add(typeof(object), mapping);
+ _invertMappingTable.Add(mapping, typeof(object));
mapping = new SoapTypeMapping(typeof(System.Runtime.Serialization.Formatters.SoapFault), "Fault", "http://schemas.xmlsoap.org/soap/envelope/", false, false, false, true);
_mappingTable.Add(typeof(System.Runtime.Serialization.Formatters.SoapFault), mapping);
diff --git a/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapWriter.cs b/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapWriter.cs index acafaf8dc29..3a539d7d1ac 100755 --- a/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapWriter.cs +++ b/mcs/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapWriter.cs @@ -14,7 +14,6 @@ using System.Runtime.Remoting; using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters;
using System.Xml;
-using System.Xml.Schema;
using System.Xml.Serialization;
using System.Globalization;
@@ -108,7 +107,6 @@ namespace System.Runtime.Serialization.Formatters.Soap { soapEntry.elementType = ElementType.Id;
_objectIds[objValue] = id;
}
-
return soapEntry;
}
@@ -237,7 +235,7 @@ namespace System.Runtime.Serialization.Formatters.Soap { }
}
-
+
private void WriteElement(SoapSerializationEntry entry) {
_xmlWriter.WriteStartElement(entry.prefix, XmlConvert.EncodeNmToken(entry.elementName), entry.elementNamespace);
@@ -260,7 +258,6 @@ namespace System.Runtime.Serialization.Formatters.Soap { Done = DoneWithElementEvent;
SoapSerializationEntry entry = FillEntry(rootType, rootValue); //new SoapSerializationEntry();
if(rootType.IsArray) {
-
Done = DoneWithArray;
entry.IsArray = true;
}
@@ -308,8 +305,8 @@ namespace System.Runtime.Serialization.Formatters.Soap { ArrayList lstAttr = new ArrayList();
_xmlWriter.WriteStartElement("SOAP-ENV", "Envelope", "http://schemas.xmlsoap.org/soap/envelope/");
- _xmlWriter.WriteAttributeString("xmlns", "xsi", null, XmlSchema.InstanceNamespace);
- _xmlWriter.WriteAttributeString("xmlns", "xsd", null, XmlSchema.Namespace );
+ _xmlWriter.WriteAttributeString("xmlns", "xsi", null, "http://www.w3.org/2001/XMLSchema-instance");
+ _xmlWriter.WriteAttributeString("xmlns", "xsd", null, "http://www.w3.org/2001/XMLSchema" );
_xmlWriter.WriteAttributeString("xmlns", "SOAP-ENC", null, "http://schemas.xmlsoap.org/soap/encoding/");
_xmlWriter.WriteAttributeString("xmlns", "SOAP-ENV", null, "http://schemas.xmlsoap.org/soap/envelope/");
_xmlWriter.WriteAttributeString("xmlns", "clr", null, "http://schemas.microsoft.com/soap/encoding/clr/1.0" );
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/ChangeLog b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/ChangeLog index 04cdbc0fa97..6c3820c1e94 100644 --- a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/ChangeLog +++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/ChangeLog @@ -1,18 +1,4 @@ -2003-09-04 Gaurav Vaish <gvaish_mono AT lycos.com> - - * ControlAdapter.cs : Control property - Marked virtual - : LoadPostData(...) - Marked virtual - * HtmlCommandAdapter.cs : Implemented. - * HtmlControlAdapter.cs : RenderEndLink(...) - Correct signature - * HtmlMobileTextWriter.cs - : Added several properties, - : Stubbed several methods - -2003-09-03 Gaurav Vaish <gvaish_mono AT lycos.com> - - * HtmlControlAdapter.cs : Looks like done, at least stubbing. - 2003-08-13 Gaurav Vaish <gvaish_mono AT lycos.com> * ControlAdapter.cs : Style { get; } - Implemented. diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/ControlAdapter.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/ControlAdapter.cs index 9dbb6c50e91..fd07d5015fd 100644 --- a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/ControlAdapter.cs +++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/ControlAdapter.cs @@ -68,7 +68,7 @@ namespace System.Web.UI.MobileControls.Adapters } } - public virtual MobileControl Control + public MobileControl Control { get { @@ -120,7 +120,7 @@ namespace System.Web.UI.MobileControls.Adapters { } - public virtual bool LoadPostData(string postKey, + public bool LoadPostData(string postKey, NameValueCollection postCollection, object privateControlData, out bool dataChanged) { diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/HtmlCommandAdapter.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/HtmlCommandAdapter.cs deleted file mode 100644 index 56632063f4a..00000000000 --- a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/HtmlCommandAdapter.cs +++ /dev/null @@ -1,115 +0,0 @@ -/** - * Project : Mono - * Namespace : System.Web.UI.MobileControls.Adapters - * Class : HtmlCommandAdapter - * Author : Gaurav Vaish - * - * Copyright : 2003 with Gaurav Vaish, and with - * Ximian Inc - */ - -using System; -using System.Collections.Specialized; -using System.Web.Mobile; -using System.Web.UI.MobileControls; - -namespace System.Web.UI.MobileControls.Adapters -{ - public class HtmlCommandAdapter : HtmlControlAdapter - { - public HtmlCommandAdapter() : base() - { - } - - protected new Command Control - { - get - { - return base.Control as Command; - } - } - - public override bool LoadPostData(string postKey, - NameValueCollection data, - object privateControlData, out bool dataChanged) - { - dataChanged = false; - bool retVal = false; - if(Control != null) - { - string id = Control.UniqueID; - string ctrl = data[id + ".x"]; - string evnt = data[id + ".y"]; - if(ctrl != null && evnt != null && ctrl.Length > 0 && evnt.Length > 0) - { - dataChanged = true; - retVal = true; - } - } - return retVal; - } - - public override void Render(HtmlMobileTextWriter writer) - { - bool supportsImgSbt = false; - bool supportsJavascript = false; - Form mobileForm = null; - - if(Control != null) - { - if(Control.ImageUrl != String.Empty && Device.SupportsImageSubmit) - { - supportsImgSbt = true; - if(Control.Format == CommandFormat.Link) - { - if(Device.JavaScript) - { - supportsJavascript = true; - } - } - } - } - if(supportsJavascript) - { - writer.EnterStyle(Style); - mobileForm = Control.Form; - if(mobileForm.Action.Length > 0) - { - writer.Write("<a href=\"javascript:document."); - writer.Write(mobileForm.ClientID); - writer.Write(".submit()\""); - base.AddAttributes(writer); - writer.Write(">"); - writer.WriteText(Control.Text, false); - writer.WriteEndTag("a"); - } else - { - base.RenderBeginLink(writer, Constants.FormIDPrefix + mobileForm.UniqueID); - writer.WriteText(Control.Text, true); - base.RenderEndLink(writer); - } - writer.ExitStyle(Style, Control.BreakAfter); - } else - { - writer.EnterLayout(Style); - writer.WriteBeginTag("input"); - writer.WriteAttribute("name", Control.UniqueID); - if(supportsImgSbt) - { - writer.WriteAttribute("type", "image"); - writer.WriteAttribute("src", Control.ResolveUrl(Control.ImageUrl)); - writer.WriteAttribute("alt", Control.Text); - } else - { - writer.WriteAttribute("type", "submit"); - writer.Write("value=\""); - writer.WriteText(Control.Text, true); - } - writer.Write("\""); - base.AddAttributes(writer); - writer.Write("/>"); - writer.ExitLayout(Style, Control.BreakAfter); - } - } - } -} diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/HtmlControlAdapter.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/HtmlControlAdapter.cs index c09b1b2da66..f1f6b60edb3 100644 --- a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/HtmlControlAdapter.cs +++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/HtmlControlAdapter.cs @@ -118,12 +118,12 @@ namespace System.Web.UI.MobileControls.Adapters this.SecondaryUIMode = (int)state; } } - + public virtual void Render(HtmlMobileTextWriter writer) { base.RenderChildren(writer); } - + public override void Render(HtmlTextWriter writer) { if(writer is HtmlMobileTextWriter) @@ -131,11 +131,11 @@ namespace System.Web.UI.MobileControls.Adapters Render((HtmlMobileTextWriter)writer); } } - + protected virtual void RenderAsHiddenInputField(HtmlMobileTextWriter writer) { } - + [MonoTODO] protected void RenderBeginLink(HtmlMobileTextWriter writer, string target) @@ -151,39 +151,17 @@ namespace System.Web.UI.MobileControls.Adapters } [MonoTODO] - protected void RenderEndLink(HtmlMobileTextWriter writer) + protected void RenderEndLink(HtmlMobileTextWriter writer, + string target) { throw new NotImplementedException(); } - + [MonoTODO] protected void RenderPostBackEventAsAnchor(HtmlMobileTextWriter writer, string argument, string linkText) { throw new NotImplementedException(); } - - protected void RenderPostBackEventAsAttribute(HtmlMobileTextWriter writer, - string name, string value) - { - writer.Write(" " + name + "=\""); - RenderPostBackEventReference(writer, value); - writer.Write("\" "); - } - - protected void RenderPostBackEventReference(HtmlMobileTextWriter writer, - string argument) - { - PageAdapter.RenderPostBackEvent(writer, Control.UniqueID, argument); - } - - public override object SaveAdapterState() - { - int uiMode = SecondaryUIMode; - object retVal = null; - if(uiMode != NotSecondaryUI) - retVal = uiMode; - return retVal; - } } } diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/HtmlMobileTextWriter.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/HtmlMobileTextWriter.cs index f4017234c25..cf7b699ecaf 100644 --- a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/HtmlMobileTextWriter.cs +++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/HtmlMobileTextWriter.cs @@ -16,19 +16,6 @@ namespace System.Web.UI.MobileControls.Adapters { public class HtmlMobileTextWriter : MobileTextWriter { - private bool beforeFirstControlWritten = true; - private bool maintainState = true; - private bool renderBodyColor = true; - private bool renderBold = true; - private bool renderDivAlign = true; - private bool renderDivNoWrap = false; - private bool renderFontColor = true; - private bool renderFontName = true; - private bool renderFontSize = true; - private bool renderItalic = true; - private bool requiresNoBreak = false; - private bool shouldEnsureStyle = true; - [MonoTODO] public HtmlMobileTextWriter(TextWriter writer, MobileCapabilities capabilities) @@ -37,184 +24,10 @@ namespace System.Web.UI.MobileControls.Adapters throw new NotImplementedException(); } - public bool BeforeFirstControlWritten - { - get - { - return beforeFirstControlWritten; - } - set - { - beforeFirstControlWritten = value; - } - } - - public bool MaintainState - { - get - { - return maintainState; - } - set - { - maintainState = value; - } - } - - public bool RenderBodyColor - { - get - { - return renderBodyColor; - } - set - { - renderBodyColor = value; - } - } - - public bool RenderBold - { - get - { - return renderBold; - } - set - { - renderBold = value; - } - } - - public bool RenderDivAlign - { - get - { - return renderDivAlign; - } - set - { - renderDivAlign = value; - } - } - - public bool RenderDivNoWrap - { - get - { - return renderDivNoWrap; - } - set - { - renderDivNoWrap = value; - } - } - - public bool RenderFontColor - { - get - { - return renderFontColor; - } - set - { - renderFontColor = value; - } - } - - public bool RenderFontName - { - get - { - return renderFontName; - } - set - { - renderFontName = value; - } - } - - public bool RenderFontSize - { - get - { - return renderFontSize; - } - set - { - renderFontSize = value; - } - } - - public bool RenderItalic - { - get - { - return renderItalic; - } - set - { - renderItalic = value; - } - } - - public bool RequiresNoBreakInFormatting - { - get - { - return requiresNoBreak; - } - set - { - requiresNoBreak = value; - } - } - - public bool ShouldEnsureStyle - { - get - { - return shouldEnsureStyle; - } - set - { - shouldEnsureStyle = value; - } - } - - [MonoTODO] - public void EnterLayout(Style style) - { - throw new NotImplementedException(); - } - - [MonoTODO] - public void ExitLayout(Style style, bool breakAfter) - { - throw new NotImplementedException(); - } - [MonoTODO] public void EnterStyle(System.Web.UI.MobileControls.Style style) { throw new NotImplementedException(); } - - [MonoTODO] - public void ExitStyle(Style style, bool breakAfter) - { - throw new NotImplementedException(); - } - - [MonoTODO] - public void WriteText(string text, bool encode) - { - throw new NotImplementedException(); - } - - [MonoTODO] - public override void Write(string text) - { - throw new NotImplementedException(); - } } } diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/HtmlPageAdapter.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/HtmlPageAdapter.cs index e57fcb1f884..3424fec72a1 100644 --- a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/HtmlPageAdapter.cs +++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/HtmlPageAdapter.cs @@ -27,11 +27,5 @@ namespace System.Web.UI.MobileControls.Adapters throw new NotImplementedException(); } } - - public virtual void RenderPostBackEvent(HtmlMobileTextWriter writer, - string target, string argument) - { - writer.Write("javascript:__doPostBack('" + target + "','" + argument + "')"); - } } } diff --git a/mcs/class/System.Web.Services/ChangeLog b/mcs/class/System.Web.Services/ChangeLog index 77919818ce9..28720bb4122 100644 --- a/mcs/class/System.Web.Services/ChangeLog +++ b/mcs/class/System.Web.Services/ChangeLog @@ -1,12 +1,3 @@ -2003-08-01 Lluis Sanchez Gual <lluis@ximian.com> - - * System.Web.Services.dll.sources: Added ExtensionManager.cs, - ServiceDescriptionSerializerBase.cs - -2003-08-28 Lluis Sanchez Gual <lluis@ximian.com> - - * System.Web.Services.dll.sources: Added System.Web.Services.Protocols.SoapDocumentationHandler - 2003-07-21 Andreas Nahr <ClassDevelopment@A-SoftTech.com> * System.Web.Services.dll.sources: Added Assembly/AssemblyInfo.cs, Assembly/Locale.cs diff --git a/mcs/class/System.Web.Services/System.Web.Services.Configuration/ChangeLog b/mcs/class/System.Web.Services/System.Web.Services.Configuration/ChangeLog index 5838d482ef1..d02052eba4b 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Configuration/ChangeLog +++ b/mcs/class/System.Web.Services/System.Web.Services.Configuration/ChangeLog @@ -1,8 +1,3 @@ -2003-08-28 Lluis Sanchez Gual <lluis@ximian.com> - - * XmlFormatExtensionPointAttribute.cs: Fixed constructor. Member name - was not set. - 2003-07-08 Gonzalo Paniagua Javier <gonzalo@ximian.com> * WebServicesConfigurationSectionHandler.cs: added <soapExtensionTypes> diff --git a/mcs/class/System.Web.Services/System.Web.Services.Configuration/XmlFormatExtensionPointAttribute.cs b/mcs/class/System.Web.Services/System.Web.Services.Configuration/XmlFormatExtensionPointAttribute.cs index 4883be8ea6b..f7cac2e032f 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Configuration/XmlFormatExtensionPointAttribute.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Configuration/XmlFormatExtensionPointAttribute.cs @@ -22,7 +22,6 @@ namespace System.Web.Services.Configuration { public XmlFormatExtensionPointAttribute (string memberName)
{
- this.memberName = memberName;
allowElements = false; // FIXME
}
@@ -42,4 +41,4 @@ namespace System.Web.Services.Configuration { #endregion // Properties
}
-} +}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ChangeLog b/mcs/class/System.Web.Services/System.Web.Services.Description/ChangeLog index bc1a0d16354..8400b285230 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Description/ChangeLog +++ b/mcs/class/System.Web.Services/System.Web.Services.Description/ChangeLog @@ -1,38 +1,3 @@ -2003-09-04 Lluis Sanchez Gual <lluis@ximian.com> - - * ServiceDescription.cs: minor fixes. - * ServiceDescriptionImporter.cs: initial implementation. - * ServiceDescriptionReflector.cs: Added support for bare parameter style. - Added support for encoded format. - -2003-09-01 Lluis Sanchez Gual <lluis@ximian.com> - - * ExtensionManager.cs: Added - * ServiceDescriptionSerializerBase.cs. Added - * ServiceDescription.cs: Reenabled suspport for serialization. - * ServiceDescriptionReflector.cs: Import type and method documentation. - -2003-08-29 Lluis Sanchez Gual <lluis@ximian.com> - - * ServiceDescription.cs: Disabled suspport for serialization, until I found - an easy way of generate serialization readers and writers. - -2003-08-28 Lluis Sanchez Gual <lluis@ximian.com> - - * MessageBinding.cs: Added default value attribute for Name property. - * OperationMessage.cs: Added default value attribute for Name property. - * ServiceDescription.cs: Changed order of some properties, so they are - serialized in the right order. - Added GetNamespaceList(), which returns the namespaces to add when serializing - the document. - Implemented classes ServiceDescriptionSerializer and ServiceDescriptionWriter, - that extends the XmlSerializer by adding suport for XmlFormatExtensions. - * ServiceDescriptionReflector.cs: Basic implementation (no support for - extensions yet). - * SoapBinding.cs: Fixed namespace name. - * SoapBodyBinding.cs: Added null check in PartsString property. - * SoapOperationBinding.cs: Fixed namespace name. - 2003-07-22 Lluis Sanchez Gual <lluis@ximian.com> * Binding.cs, Import.cs, Message.cs, MessageBinding.cs, MessagePart.cs, diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ExtensionManager.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/ExtensionManager.cs deleted file mode 100644 index 6700fb200b7..00000000000 --- a/mcs/class/System.Web.Services/System.Web.Services.Description/ExtensionManager.cs +++ /dev/null @@ -1,155 +0,0 @@ -//
-// System.Web.Services.Description.ExtensionManager.cs
-//
-// Author:
-// Lluis Sanchez Gual (lluis@ximian.com)
-//
-// Copyright (C) 2003 Ximian, Inc.
-//
-
-using System.Reflection;
-using System.Collections;
-using System.Web.Services.Configuration;
-using System.Xml.Serialization;
-
-namespace System.Web.Services.Description
-{
- internal abstract class ExtensionManager
- {
- static Hashtable extensionsByName;
- static Hashtable extensionsByType;
-
- static ExtensionManager ()
- {
- extensionsByName = new Hashtable ();
- extensionsByType = new Hashtable ();
-
- RegisterExtensionType (typeof (HttpAddressBinding));
- RegisterExtensionType (typeof (HttpBinding));
- RegisterExtensionType (typeof (HttpOperationBinding));
- RegisterExtensionType (typeof (HttpUrlEncodedBinding));
- RegisterExtensionType (typeof (HttpUrlReplacementBinding));
- RegisterExtensionType (typeof (MimeContentBinding));
- RegisterExtensionType (typeof (MimeMultipartRelatedBinding));
- RegisterExtensionType (typeof (MimeTextBinding));
- RegisterExtensionType (typeof (MimeXmlBinding));
- RegisterExtensionType (typeof (SoapAddressBinding));
- RegisterExtensionType (typeof (SoapBinding));
- RegisterExtensionType (typeof (SoapBodyBinding));
- RegisterExtensionType (typeof (SoapFaultBinding));
- RegisterExtensionType (typeof (SoapHeaderBinding));
- RegisterExtensionType (typeof (SoapHeaderFaultBinding));
- RegisterExtensionType (typeof (SoapOperationBinding));
- }
-
- public static void RegisterExtensionType (Type type)
- {
- ExtensionInfo ext = new ExtensionInfo();
- ext.Type = type;
-
- object[] ats = type.GetCustomAttributes (typeof(XmlFormatExtensionPrefixAttribute), true);
- if (ats.Length > 0)
- {
- XmlFormatExtensionPrefixAttribute at = (XmlFormatExtensionPrefixAttribute)ats[0];
- ext.Prefix = at.Prefix;
- ext.Namespace = at.Namespace;
- }
-
- ats = type.GetCustomAttributes (typeof(XmlFormatExtensionAttribute), true);
- if (ats.Length > 0)
- {
- XmlFormatExtensionAttribute at = (XmlFormatExtensionAttribute)ats[0];
- ext.ElementName = at.ElementName;
- if (at.Namespace != null) ext.Namespace = at.Namespace;
- }
-
- XmlRootAttribute root = new XmlRootAttribute ();
- root.ElementName = ext.ElementName;
- if (ext.Namespace != null) root.Namespace = ext.Namespace;
-
- XmlReflectionImporter ri = new XmlReflectionImporter ();
- XmlTypeMapping map = ri.ImportTypeMapping (type, root);
-
- // TODO: use array method to create the serializers
- ext.Serializer = new XmlSerializer (map);
-
- if (ext.ElementName == null) throw new InvalidOperationException ("XmlFormatExtensionAttribute must be applied to type " + type);
- extensionsByName.Add (ext.Namespace + " " + ext.ElementName, ext);
- extensionsByType.Add (type, ext);
- }
-
- public static ExtensionInfo GetFormatExtensionInfo (string elementName, string namesp)
- {
- return (ExtensionInfo) extensionsByName [namesp + " " + elementName];
- }
-
- public static ExtensionInfo GetFormatExtensionInfo (Type extType)
- {
- return (ExtensionInfo) extensionsByType [extType];
- }
-
- public static ICollection GetFormatExtensions ()
- {
- return extensionsByName.Values;
- }
-
- public static ServiceDescriptionFormatExtensionCollection GetExtensionPoint (object ob)
- {
- Type type = ob.GetType ();
- object[] ats = type.GetCustomAttributes (typeof(XmlFormatExtensionPointAttribute), true);
- if (ats.Length == 0) return null;
-
- XmlFormatExtensionPointAttribute at = (XmlFormatExtensionPointAttribute)ats[0];
-
- PropertyInfo prop = type.GetProperty (at.MemberName);
- if (prop != null)
- return prop.GetValue (ob, null) as ServiceDescriptionFormatExtensionCollection;
- else {
- FieldInfo field = type.GetField (at.MemberName);
- if (field != null)
- return field.GetValue (ob) as ServiceDescriptionFormatExtensionCollection;
- else
- throw new InvalidOperationException ("XmlFormatExtensionPointAttribute: Member " + at.MemberName + " not found");
- }
- }
- }
-
- internal class ExtensionInfo
- {
- public string _prefix;
- public string _namespace;
- public string _elementName;
- public Type _type;
- public XmlSerializer _serializer;
-
- public string Prefix
- {
- get { return _prefix; }
- set { _prefix = value; }
- }
-
- public string Namespace
- {
- get { return _namespace; }
- set { _namespace = value; }
- }
-
- public string ElementName
- {
- get { return _elementName; }
- set { _elementName = value; }
- }
-
- public Type Type
- {
- get { return _type; }
- set { _type = value; }
- }
-
- public XmlSerializer Serializer
- {
- get { return _serializer; }
- set { _serializer = value; }
- }
- }
-} diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/MessageBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/MessageBinding.cs index c8aa912b525..bc545784661 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Description/MessageBinding.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Description/MessageBinding.cs @@ -7,7 +7,6 @@ // Copyright (C) Tim Coleman, 2002
//
-using System.ComponentModel;
using System.Xml.Serialization;
namespace System.Web.Services.Description {
@@ -37,7 +36,6 @@ namespace System.Web.Services.Description { get;
}
- [DefaultValue ("")]
[XmlAttribute ("name", DataType = "NMTOKEN")]
public string Name {
get { return name; }
@@ -51,4 +49,4 @@ namespace System.Web.Services.Description { #endregion // Properties
}
-} +}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/OperationMessage.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/OperationMessage.cs index dbb27e55b84..78d2923770c 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Description/OperationMessage.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Description/OperationMessage.cs @@ -10,7 +10,6 @@ using System.Web.Services;
using System.Xml;
using System.Xml.Serialization;
-using System.ComponentModel;
namespace System.Web.Services.Description {
public abstract class OperationMessage : DocumentableItem {
@@ -42,7 +41,6 @@ namespace System.Web.Services.Description { set { message = value; }
}
- [DefaultValue ("")]
[XmlAttribute ("name", DataType = "NMTOKEN")]
public string Name {
get { return name; }
@@ -65,4 +63,4 @@ namespace System.Web.Services.Description { #endregion // Methods
}
-} +}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescription.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescription.cs index 5d1d714b250..ee32d2c1b0c 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescription.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescription.cs @@ -3,14 +3,11 @@ //
// Author:
// Tim Coleman (tim@timcoleman.com)
-// Lluis Sanchez Gual (lluis@ximian.com)
//
// Copyright (C) Tim Coleman, 2002
//
using System.IO;
-using System.Collections;
-using System.Reflection;
using System.Web.Services;
using System.Web.Services.Configuration;
using System.Xml;
@@ -38,6 +35,7 @@ namespace System.Web.Services.Description { string targetNamespace;
Types types;
static ServiceDescriptionSerializer serializer;
+ XmlSerializerNamespaces ns;
#endregion // Fields
@@ -62,33 +60,19 @@ namespace System.Web.Services.Description { services = new ServiceCollection (this);
targetNamespace = String.Empty;
types = null;
+
+ ns = new XmlSerializerNamespaces ();
+ ns.Add ("soap", SoapBinding.Namespace);
+ ns.Add ("s", XmlSchema.Namespace);
+ ns.Add ("http", HttpBinding.Namespace);
+ ns.Add ("mime", MimeContentBinding.Namespace);
+ ns.Add ("tm", MimeTextBinding.Namespace);
}
#endregion // Constructors
#region Properties
- [XmlElement ("import")]
- public ImportCollection Imports {
- get { return imports; }
- }
-
- [XmlElement ("types")]
- public Types Types {
- get { return types; }
- set { types = value; }
- }
-
- [XmlElement ("message")]
- public MessageCollection Messages {
- get { return messages; }
- }
-
- [XmlElement ("portType")]
- public PortTypeCollection PortTypes {
- get { return portTypes; }
- }
-
[XmlElement ("binding")]
public BindingCollection Bindings {
get { return bindings; }
@@ -99,12 +83,27 @@ namespace System.Web.Services.Description { get { return extensions; }
}
+ [XmlElement ("import")]
+ public ImportCollection Imports {
+ get { return imports; }
+ }
+
+ [XmlElement ("message")]
+ public MessageCollection Messages {
+ get { return messages; }
+ }
+
[XmlAttribute ("name", DataType = "NMTOKEN")]
public string Name {
get { return name; }
set { name = value; }
}
+ [XmlElement ("portType")]
+ public PortTypeCollection PortTypes {
+ get { return portTypes; }
+ }
+
[XmlIgnore]
public string RetrievalUrl {
get { return retrievalUrl; }
@@ -136,6 +135,12 @@ namespace System.Web.Services.Description { set { targetNamespace = value; }
}
+ [XmlElement ("types")]
+ public Types Types {
+ get { return types; }
+ set { types = value; }
+ }
+
#endregion // Properties
#region Methods
@@ -167,7 +172,8 @@ namespace System.Web.Services.Description { public void Write (Stream stream)
{
- serializer.Serialize (stream, this, GetNamespaceList ());
+
+ serializer.Serialize (stream, this, ns);
}
public void Write (string fileName)
@@ -177,100 +183,49 @@ namespace System.Web.Services.Description { public void Write (TextWriter writer)
{
- serializer.Serialize (writer, this, GetNamespaceList ());
+ serializer.Serialize (writer, this, ns);
}
public void Write (XmlWriter writer)
{
- serializer.Serialize (writer, this, GetNamespaceList ());
+ serializer.Serialize (writer, this, ns);
}
internal void SetParent (ServiceDescriptionCollection serviceDescriptions)
{
this.serviceDescriptions = serviceDescriptions;
}
-
- XmlSerializerNamespaces GetNamespaceList ()
- {
+
+ #endregion
+
+ internal class ServiceDescriptionSerializer : XmlSerializer {
+
+ #region Fields
+
XmlSerializerNamespaces ns;
- ns = new XmlSerializerNamespaces ();
- ns.Add ("soap", SoapBinding.Namespace);
- ns.Add ("s", XmlSchema.Namespace);
- ns.Add ("http", HttpBinding.Namespace);
- ns.Add ("mime", MimeContentBinding.Namespace);
- ns.Add ("tm", MimeTextBinding.Namespace);
- ns.Add ("s0", TargetNamespace);
- return ns;
- }
-
- internal static void WriteExtensions (XmlWriter writer, object ob)
- {
- ServiceDescriptionFormatExtensionCollection extensions = ExtensionManager.GetExtensionPoint (ob);
- if (extensions != null)
- {
- foreach (ServiceDescriptionFormatExtension ext in extensions)
- WriteExtension (writer, ext);
- }
- }
-
- static void WriteExtension (XmlWriter writer, ServiceDescriptionFormatExtension ext)
- {
- Type type = ext.GetType ();
- ExtensionInfo info = ExtensionManager.GetFormatExtensionInfo (type);
- string prefix = info.Prefix;
-
- if (prefix == null || prefix == "") prefix = writer.LookupPrefix (info.Namespace);
-
-// if (prefix != null && prefix != "")
-// Writer.WriteStartElement (prefix, info.ElementName, info.Namespace);
-// else
-// WriteStartElement (info.ElementName, info.Namespace, false);
-
- info.Serializer.Serialize (writer, ext);
- }
-
- internal static void ReadExtension (XmlReader reader, object ob)
- {
- ServiceDescriptionFormatExtensionCollection extensions = ExtensionManager.GetExtensionPoint (ob);
- if (extensions != null)
- {
- ExtensionInfo info = ExtensionManager.GetFormatExtensionInfo (reader.LocalName, reader.NamespaceURI);
- if (info != null)
- {
- object extension = info.Serializer.Deserialize (reader);
- extensions.Add ((ServiceDescriptionFormatExtension)extension);
- return;
- }
- }
- reader.Skip ();
- }
+ #endregion
- #endregion
+ #region Constructors
- internal class ServiceDescriptionSerializer : XmlSerializer
- {
- protected override void Serialize (object o, XmlSerializationWriter writer)
+ [MonoTODO]
+ public ServiceDescriptionSerializer ()
+ : base (typeof (ServiceDescription), ServiceDescription.Namespace)
{
- ServiceDescriptionWriterBase xsWriter = writer as ServiceDescriptionWriterBase;
- xsWriter.WriteTree ((ServiceDescription)o);
+ ns = new XmlSerializerNamespaces ();
+ ns.Add ("soap", SoapBinding.Namespace);
+ ns.Add ("s", XmlSchema.Namespace);
+ ns.Add ("http", HttpBinding.Namespace);
+ ns.Add ("mime", MimeContentBinding.Namespace);
+ ns.Add ("tm", MimeTextBinding.Namespace);
}
-
- protected override object Deserialize (XmlSerializationReader reader)
- {
- ServiceDescriptionReaderBase xsReader = reader as ServiceDescriptionReaderBase;
- return xsReader.ReadTree ();
- }
-
- protected override XmlSerializationWriter CreateWriter ()
- {
- return new ServiceDescriptionWriterBase ();
- }
-
- protected override XmlSerializationReader CreateReader ()
- {
- return new ServiceDescriptionReaderBase ();
- }
- }
+
+ #endregion // Constructors
+
+ #region Methods
+
+
+ #endregion // Methods
+ }
}
-} +}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionImporter.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionImporter.cs index 7dc588ad747..491fb3a85a8 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionImporter.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionImporter.cs @@ -3,20 +3,13 @@ //
// Author:
// Tim Coleman (tim@timcoleman.com)
-// Lluis Sanchez Gual (lluis@ximian.com)
//
// Copyright (C) Tim Coleman, 2002
//
-using System;
using System.CodeDom;
using System.Web.Services;
-using System.Web.Services.Protocols;
-using System.Web.Services.Description;
using System.Xml.Serialization;
-using System.Xml;
-using System.Collections;
-using System.Configuration;
namespace System.Web.Services.Description {
public class ServiceDescriptionImporter {
@@ -27,23 +20,6 @@ namespace System.Web.Services.Description { XmlSchemas schemas;
ServiceDescriptionCollection serviceDescriptions;
ServiceDescriptionImportStyle style;
- CodeIdentifiers classIds;
- XmlSchemaImporter schemaImporter;
- XmlCodeExporter codeExporter;
-
- CodeNamespace codeNamespace;
- CodeCompileUnit codeCompileUnit;
- ServiceDescriptionImportWarnings warnings;
-
- ArrayList importInfo = new ArrayList ();
-
- class ImportInfo
- {
- public ServiceDescription ServiceDescription;
- public string AppSettingUrlKey;
- public string AppSettingBaseUrl;
- }
-
#endregion // Fields
@@ -83,506 +59,18 @@ namespace System.Web.Services.Description { #region Methods
+ [MonoTODO]
public void AddServiceDescription (ServiceDescription serviceDescription, string appSettingUrlKey, string appSettingBaseUrl)
{
- if (appSettingUrlKey != null && appSettingUrlKey == string.Empty && style == ServiceDescriptionImportStyle.Server)
- throw new InvalidOperationException ("Cannot set appSettingUrlKey if Style is Server");
-
- ImportInfo info = new ImportInfo ();
- info.ServiceDescription = serviceDescription;
- info.AppSettingUrlKey = appSettingUrlKey;
- info.AppSettingBaseUrl = appSettingBaseUrl;
- importInfo.Add (info);
- serviceDescriptions.Add (serviceDescription);
-
- if (serviceDescription.Types != null)
- schemas.Add (serviceDescription.Types.Schemas);
+ throw new NotImplementedException ();
}
+ [MonoTODO]
public ServiceDescriptionImportWarnings Import (CodeNamespace codeNamespace, CodeCompileUnit codeCompileUnit)
{
- warnings = (ServiceDescriptionImportWarnings) 0;
-
- schemaImporter = new XmlSchemaImporter (schemas);
- codeExporter = new XmlCodeExporter (codeNamespace, codeCompileUnit);
-
- this.codeNamespace = codeNamespace;
- this.codeCompileUnit = codeCompileUnit;
-
- bool classesGenerated = false;
- classIds = new CodeIdentifiers();
-
- ArrayList services = new ArrayList ();
- foreach (ImportInfo info in importInfo)
- foreach (Service service in info.ServiceDescription.Services)
- foreach (Port port in service.Ports)
- classesGenerated = ImportPortBinding (service, info, port) || classesGenerated;
-
- if (!classesGenerated) SetWarning (ServiceDescriptionImportWarnings.NoCodeGenerated);
- return warnings;
- }
-
- bool ImportPortBinding (Service service, ImportInfo iinfo, Port port)
- {
- string className = classIds.AddUnique (CodeIdentifier.MakeValid (port.Name), port);
- Binding binding = serviceDescriptions.GetBinding (port.Binding);
-
- try
- {
- PortType portType = serviceDescriptions.GetPortType (binding.Type);
- if (portType == null) throw new Exception ("Port type not found: " + binding.Type);
-
- SoapBinding sb = (SoapBinding) binding.Extensions.Find (typeof(SoapBinding));
-
- if (sb == null) throw new Exception ("None of the supported bindings was found");
-
- if (sb.Style != SoapBindingStyle.Document) throw new Exception ("Binding style not supported");
- if (sb.Transport != SoapBinding.HttpTransport) throw new Exception ("Transport namespace '" + sb.Transport + "' not supported");
-
- string url = GetServiceUrl (iinfo, port);
-
- CodeTypeDeclaration codeClass = new CodeTypeDeclaration (className);
- AddCodeType (codeClass, port.Documentation);
- codeClass.Attributes = MemberAttributes.Public;
-
- if (service.Documentation != null && service.Documentation != "")
- AddComments (codeClass, service.Documentation);
-
- CodeAttributeDeclaration att = new CodeAttributeDeclaration ("System.Diagnostics.DebuggerStepThroughAttribute");
- AddCustomAttribute (codeClass, att, true);
-
- att = new CodeAttributeDeclaration ("System.ComponentModel.DesignerCategoryAttribute");
- att.Arguments.Add (GetArg ("code"));
- AddCustomAttribute (codeClass, att, true);
-
- att = new CodeAttributeDeclaration ("System.Web.Services.WebServiceBinding");
- att.Arguments.Add (GetArg ("Name", port.Name));
- att.Arguments.Add (GetArg ("Namespace", port.Binding.Namespace));
- AddCustomAttribute (codeClass, att, true);
-
- CodeTypeReference ctr = new CodeTypeReference ("System.Web.Services.Protocols.SoapHttpClientProtocol");
- codeClass.BaseTypes.Add (ctr);
-
- CodeConstructor cc = new CodeConstructor ();
- cc.Attributes = MemberAttributes.Public;
- CodeExpression ce = new CodeFieldReferenceExpression (new CodeThisReferenceExpression(), "Url");
- CodeAssignStatement cas = new CodeAssignStatement (ce, new CodePrimitiveExpression (url));
- cc.Statements.Add (cas);
- codeClass.Members.Add (cc);
-
- if (binding.Operations.Count == 0) {
- SetWarning (ServiceDescriptionImportWarnings.NoMethodsGenerated);
- return true;
- }
-
- CodeIdentifiers memberIds = new CodeIdentifiers ();
- foreach (OperationBinding oper in binding.Operations)
- ImportOperationBinding (codeClass, memberIds, portType, oper);
- }
- catch (Exception ex)
- {
- GenerateErrorComment (binding, ex.Message);
- return false;
- }
- return true;
- }
-
- void ImportOperationBinding (CodeTypeDeclaration codeClass, CodeIdentifiers memberIds, PortType portType, OperationBinding oper)
- {
- try
- {
- SoapOperationBinding soapOper = oper.Extensions.Find (typeof (SoapOperationBinding)) as SoapOperationBinding;
- if (soapOper == null) throw new Exception ("Soap operation binding not found in operation " + oper.Name);
- if (soapOper.Style != SoapBindingStyle.Document) throw new Exception ("Operation binding style not supported in operation " + oper.Name);
-
- SoapBodyBinding isbb = oper.Input.Extensions.Find (typeof(SoapBodyBinding)) as SoapBodyBinding;
- if (isbb == null) throw new Exception ("Soap body binding not found in operation " + oper.Name);
- if (isbb.Use != SoapBindingUse.Literal) throw new Exception ("Soap binding use not supported");
- string iname = (oper.Input.Name != "") ? oper.Input.Name : oper.Name;
-
- SoapBodyBinding osbb = oper.Output.Extensions.Find (typeof(SoapBodyBinding)) as SoapBodyBinding;
- if (osbb == null) throw new Exception ("Soap body binding not found in operation " + oper.Name);
- if (osbb.Use != SoapBindingUse.Literal) throw new Exception ("Soap binding use not supported");
- string oname = (oper.Output.Name != "") ? oper.Output.Name : oper.Name;
-
- Operation ptoper = FindPortOperation (portType, oper.Name, iname, oname);
- if (ptoper == null) throw new Exception ("Operation " + oper.Name + " not found in portType " + portType.Name);
-
- XmlMembersMapping inputMembers = null;
- XmlMembersMapping outputMembers = null;
-
- foreach (OperationMessage omsg in ptoper.Messages)
- {
- Message msg = serviceDescriptions.GetMessage (omsg.Message);
- if (msg == null) throw new Exception ("Message not found: " + omsg.Message);
-
- XmlMembersMapping mems = ImportMembersMapping (msg);
- if (omsg is OperationInput) inputMembers = mems;
- else outputMembers = mems;
- }
-
- if (inputMembers == null) throw new Exception ("Input message not declared in operation " + oper.Name);
- if (outputMembers == null) throw new Exception ("Output message not declared in operation " + oper.Name);
-
- GenerateMethod (codeClass, memberIds, ptoper, soapOper, inputMembers, outputMembers);
-
- codeExporter.ExportMembersMapping (inputMembers);
- codeExporter.ExportMembersMapping (outputMembers);
- }
- catch (Exception ex)
- {
- GenerateErrorComment (oper, ex.Message);
- Console.WriteLine (ex);
- }
- }
-
- XmlMembersMapping ImportMembersMapping (Message msg)
- {
- XmlQualifiedName elem = null;
- if (msg.Parts.Count == 1 && msg.Parts[0].Name == "parameters")
- {
- // Wrapped parameter style
- return schemaImporter.ImportMembersMapping (msg.Parts[0].Element);
- }
- else
- {
- XmlQualifiedName[] pnames = new XmlQualifiedName [msg.Parts.Count];
- for (int n=0; n<pnames.Length; n++)
- pnames[n] = msg.Parts[n].Element;
-
- return schemaImporter.ImportMembersMapping (pnames);
- }
- }
-
-
- void GenerateMethod (CodeTypeDeclaration codeClass, CodeIdentifiers memberIds, Operation oper, SoapOperationBinding soapOper, XmlMembersMapping inputMembers, XmlMembersMapping outputMembers)
- {
- CodeIdentifiers pids = new CodeIdentifiers ();
- CodeMemberMethod method = new CodeMemberMethod ();
- CodeMemberMethod methodBegin = new CodeMemberMethod ();
- CodeMemberMethod methodEnd = new CodeMemberMethod ();
- method.Attributes = MemberAttributes.Public;
- methodBegin.Attributes = MemberAttributes.Public;
- methodEnd.Attributes = MemberAttributes.Public;
-
- // Find unique names for temporary variables
-
- for (int n=0; n<inputMembers.Count; n++)
- pids.AddUnique (inputMembers[n].MemberName, inputMembers[n]);
-
- for (int n=0; n<outputMembers.Count; n++)
- pids.AddUnique (outputMembers[n].MemberName, outputMembers[n]);
-
- string varAsyncResult = pids.AddUnique ("asyncResult","asyncResult");
- string varResults = pids.AddUnique ("results","results");
- string varCallback = pids.AddUnique ("callback","callback");
- string varAsyncState = pids.AddUnique ("asyncState","asyncState");
-
- string messageName = memberIds.AddUnique(CodeIdentifier.MakeValid(oper.Name),method);
-
- method.Name = oper.Name;
- methodBegin.Name = memberIds.AddUnique(CodeIdentifier.MakeValid("Begin" + memberIds.MakeRightCase(oper.Name)),method);
- methodEnd.Name = memberIds.AddUnique(CodeIdentifier.MakeValid("End" + memberIds.MakeRightCase(oper.Name)),method);
-
- method.ReturnType = new CodeTypeReference (typeof(void));
- methodEnd.ReturnType = new CodeTypeReference (typeof(void));
- methodEnd.Parameters.Add (new CodeParameterDeclarationExpression (typeof (IAsyncResult),varAsyncResult));
-
- CodeExpression[] paramArray = new CodeExpression [inputMembers.Count];
- CodeParameterDeclarationExpression[] outParams = new CodeParameterDeclarationExpression [outputMembers.Count];
-
- for (int n=0; n<inputMembers.Count; n++)
- {
- CodeParameterDeclarationExpression param = GenerateParameter (inputMembers[n], FieldDirection.In);
- method.Parameters.Add (param);
- GenerateMemberAttributes (inputMembers, inputMembers[n], param);
- methodBegin.Parameters.Add (GenerateParameter (inputMembers[n], FieldDirection.In));
- paramArray [n] = new CodeVariableReferenceExpression (param.Name);
- }
-
- for (int n=0; n<outputMembers.Count; n++)
- {
- CodeParameterDeclarationExpression cpd = GenerateParameter (outputMembers[n], FieldDirection.Out);
- outParams [n] = cpd;
-
- bool found = false;
- foreach (CodeParameterDeclarationExpression ip in method.Parameters)
- {
- if (ip.Name == cpd.Name && ip.Type.BaseType == cpd.Type.BaseType) {
- ip.Direction = FieldDirection.Ref;
- methodEnd.Parameters.Add (GenerateParameter (outputMembers[n], FieldDirection.Out));
- found = true;
- break;
- }
- }
-
- if (found) continue;
-
- if ((outputMembers [n].ElementName == oper.Name + "Result") || (inputMembers.Count==0 && outputMembers.Count==1)) {
- method.ReturnType = cpd.Type;
- methodEnd.ReturnType = cpd.Type;
- GenerateReturnAttributes (outputMembers, outputMembers[n], method);
- outParams [n] = null;
- continue;
- }
-
- method.Parameters.Add (cpd);
- GenerateMemberAttributes (outputMembers, outputMembers[n], cpd);
- methodEnd.Parameters.Add (GenerateParameter (outputMembers[n], FieldDirection.Out));
- }
-
- methodBegin.Parameters.Add (new CodeParameterDeclarationExpression (typeof (AsyncCallback),varCallback));
- methodBegin.Parameters.Add (new CodeParameterDeclarationExpression (typeof (object),varAsyncState));
- methodBegin.ReturnType = new CodeTypeReference (typeof(IAsyncResult));
-
- // Array of input parameters
-
- CodeArrayCreateExpression methodParams;
- if (paramArray.Length > 0)
- methodParams = new CodeArrayCreateExpression (typeof(object), paramArray);
- else
- methodParams = new CodeArrayCreateExpression (typeof(object), 0);
-
- // Assignment of output parameters
-
- CodeStatementCollection outAssign = new CodeStatementCollection ();
- CodeVariableReferenceExpression arrVar = new CodeVariableReferenceExpression (varResults);
- for (int n=0; n<outParams.Length; n++)
- {
- CodeExpression index = new CodePrimitiveExpression (n);
- if (outParams[n] == null)
- {
- CodeExpression res = new CodeCastExpression (method.ReturnType, new CodeArrayIndexerExpression (arrVar, index));
- outAssign.Add (new CodeMethodReturnStatement (res));
- }
- else
- {
- CodeExpression res = new CodeCastExpression (outParams[n].Type, new CodeArrayIndexerExpression (arrVar, index));
- CodeExpression var = new CodeVariableReferenceExpression (outParams[n].Name);
- outAssign.Insert (0, new CodeAssignStatement (var, res));
- }
- }
-
- // Invoke call
-
- CodeThisReferenceExpression ethis = new CodeThisReferenceExpression();
- CodePrimitiveExpression varMsgName = new CodePrimitiveExpression (messageName);
- CodeMethodInvokeExpression inv;
-
- inv = new CodeMethodInvokeExpression (ethis, "Invoke", varMsgName, methodParams);
- CodeVariableDeclarationStatement dec = new CodeVariableDeclarationStatement (typeof(object[]), varResults, inv);
- method.Statements.Add (dec);
- method.Statements.AddRange (outAssign);
-
- // Begin Invoke Call
-
- CodeExpression expCallb = new CodeVariableReferenceExpression (varCallback);
- CodeExpression expAsyncs = new CodeVariableReferenceExpression (varAsyncState);
- inv = new CodeMethodInvokeExpression (ethis, "BeginInvoke", varMsgName, methodParams, expCallb, expAsyncs);
- methodBegin.Statements.Add (new CodeMethodReturnStatement (inv));
-
- // End Invoke call
-
- CodeExpression varAsyncr = new CodeVariableReferenceExpression (varAsyncResult);
- inv = new CodeMethodInvokeExpression (ethis, "EndInvoke", varAsyncr);
- dec = new CodeVariableDeclarationStatement (typeof(object[]), varResults, inv);
- methodEnd.Statements.Add (dec);
- methodEnd.Statements.AddRange (outAssign);
-
- // Attributes
-
- if (inputMembers.ElementName == "" && outputMembers.ElementName != "" ||
- inputMembers.ElementName != "" && outputMembers.ElementName == "")
- throw new Exception ("Parameter style is not the same for the input message and output message");
-
- CodeAttributeDeclaration att = new CodeAttributeDeclaration ("System.Web.Services.Protocols.SoapDocumentMethodAttribute");
- att.Arguments.Add (GetArg (soapOper.SoapAction));
- if (inputMembers.ElementName != "") {
- if (inputMembers.ElementName != method.Name) att.Arguments.Add (GetArg ("RequestElementName", inputMembers.ElementName));
- if (outputMembers.ElementName != (method.Name + "Response")) att.Arguments.Add (GetArg ("RequestElementName", outputMembers.ElementName));
- att.Arguments.Add (GetArg ("RequestNamespace", inputMembers.Namespace));
- att.Arguments.Add (GetArg ("ResponseNamespace", outputMembers.Namespace));
- att.Arguments.Add (GetEnumArg ("ParameterStyle", "System.Web.Services.Protocols.SoapParameterStyle", "Wrapped"));
- }
- else
- att.Arguments.Add (GetEnumArg ("ParameterStyle", "System.Web.Services.Protocols.SoapParameterStyle", "Bare"));
-
- att.Arguments.Add (GetEnumArg ("Use", "System.Web.Services.Description.SoapBindingUse", "Literal"));
- AddCustomAttribute (method, att, true);
-
- att = new CodeAttributeDeclaration ("System.Web.Services.WebMethodAttribute");
- if (messageName != method.Name) att.Arguments.Add (GetArg ("MessageName",messageName));
- AddCustomAttribute (method, att, false);
-
- if (oper.Documentation != null && oper.Documentation != "")
- AddComments (method, oper.Documentation);
-
- codeClass.Members.Add (method);
- codeClass.Members.Add (methodBegin);
- codeClass.Members.Add (methodEnd);
- }
-
- CodeParameterDeclarationExpression GenerateParameter (XmlMemberMapping member, FieldDirection dir)
- {
- CodeParameterDeclarationExpression par = new CodeParameterDeclarationExpression (member.TypeFullName, member.MemberName);
- par.Direction = dir;
- return par;
- }
-
- void GenerateMemberAttributes (XmlMembersMapping members, XmlMemberMapping member, CodeParameterDeclarationExpression param)
- {
- GenerateMemberAttributes (members, member, member.MemberName, param.CustomAttributes);
- }
-
- void GenerateReturnAttributes (XmlMembersMapping members, XmlMemberMapping member, CodeMemberMethod method)
- {
- GenerateMemberAttributes (members, member, method.Name + "Result", method.ReturnTypeCustomAttributes);
+ throw new NotImplementedException ();
}
-
- void GenerateMemberAttributes (XmlMembersMapping members, XmlMemberMapping member, string memberName, CodeAttributeDeclarationCollection atts)
- {
- CodeAttributeDeclaration att;
-
- if (member.TypeFullName.EndsWith ("]") && Array.IndexOf (primitiveArrays, member.TypeName) == -1)
- {
- // Array parameter
- att = new CodeAttributeDeclaration ("System.Xml.Serialization.XmlArray");
- if (member.ElementName != memberName) att.Arguments.Add (GetArg ("ElementName", member.ElementName));
- if (member.Namespace != members.Namespace) att.Arguments.Add (GetArg ("Namespace", member.Namespace));
- if (att.Arguments.Count > 0) atts.Add (att);
- }
- else
- {
- att = new CodeAttributeDeclaration ("System.Xml.Serialization.XmlElement");
- if (member.ElementName != memberName) att.Arguments.Add (GetArg ("ElementName", member.ElementName));
- if (member.Namespace != members.Namespace) att.Arguments.Add (GetArg ("Namespace", member.Namespace));
- if (member.TypeNamespace == "" && Array.IndexOf (defaultSchemaTypes, member.TypeName) == -1) att.Arguments.Add (GetArg ("DataType", member.TypeName));
- if (att.Arguments.Count > 0) atts.Add (att);
- }
- }
-
- Operation FindPortOperation (PortType portType, string operName, string inMessage, string outMessage)
- {
- foreach (Operation oper in portType.Operations)
- {
- if (oper.Name == operName)
- {
- int hits = 0;
- foreach (OperationMessage omsg in oper.Messages)
- {
- if (omsg is OperationInput && GetOperMessageName (omsg, operName) == inMessage) hits++;
- if (omsg is OperationOutput && GetOperMessageName (omsg, operName) == outMessage) hits++;
- }
- if (hits == 2) return oper;
- }
- }
- return null;
- }
-
- string GetOperMessageName (OperationMessage msg, string operName)
- {
- if (msg.Name == "") return operName;
- else return msg.Name;
- }
-
- void GenerateErrorComment (Binding binding, string message)
- {
- AddGlobalComments ("WARNING: Could not generate proxy for binding " + binding.Name + ". " + message);
- }
-
- void GenerateErrorComment (OperationBinding oper, string message)
- {
- AddGlobalComments ("WARNING: Could not generate operation " + oper.Name + ". " + message);
- }
-
- string GetServiceUrl (ImportInfo info, Port port)
- {
- string location = null;
-
- SoapAddressBinding sab = (SoapAddressBinding) port.Extensions.Find (typeof(SoapAddressBinding));
- if (sab != null) location = sab.Location;
-
- if (info.AppSettingUrlKey == null || info.AppSettingUrlKey == string.Empty)
- return location;
- else
- {
- string url;
- if (style == ServiceDescriptionImportStyle.Server) throw new InvalidOperationException ("Cannot set appSettingUrlKey if Style is Server");
- url = ConfigurationSettings.AppSettings [info.AppSettingUrlKey];
- if (info.AppSettingBaseUrl != null && info.AppSettingBaseUrl != string.Empty)
- url += "/" + info.AppSettingBaseUrl + "/" + location;
- return url;
- }
- }
-
- void AddGlobalComments (string comments)
- {
- codeNamespace.Comments.Add (new CodeCommentStatement (comments, false));
- }
-
- void AddComments (CodeTypeMember member, string comments)
- {
- if (comments == null || comments == "") member.Comments.Add (new CodeCommentStatement ("<remarks/>", true));
- else member.Comments.Add (new CodeCommentStatement ("<remarks>\n" + comments + "\n</remarks>", true));
- }
-
- void AddCodeType (CodeTypeDeclaration type, string comments)
- {
- AddComments (type, comments);
- codeNamespace.Types.Add (type);
- }
-
- void AddCustomAttribute (CodeTypeMember ctm, CodeAttributeDeclaration att, bool addIfNoParams)
- {
- if (att.Arguments.Count == 0 && !addIfNoParams) return;
-
- if (ctm.CustomAttributes == null) ctm.CustomAttributes = new CodeAttributeDeclarationCollection ();
- ctm.CustomAttributes.Add (att);
- }
-
- void AddCustomAttribute (CodeTypeMember ctm, string name, params CodeAttributeArgument[] args)
- {
- if (ctm.CustomAttributes == null) ctm.CustomAttributes = new CodeAttributeDeclarationCollection ();
- ctm.CustomAttributes.Add (new CodeAttributeDeclaration (name, args));
- }
-
- CodeAttributeArgument GetArg (string name, object value)
- {
- return new CodeAttributeArgument (name, new CodePrimitiveExpression(value));
- }
-
- CodeAttributeArgument GetEnumArg (string name, string enumType, string enumValue)
- {
- return new CodeAttributeArgument (name, new CodeFieldReferenceExpression (new CodeTypeReferenceExpression(enumType), enumValue));
- }
-
- CodeAttributeArgument GetArg (object value)
- {
- return new CodeAttributeArgument (new CodePrimitiveExpression(value));
- }
-
- CodeAttributeArgument GetTypeArg (string name, string typeName)
- {
- return new CodeAttributeArgument (name, new CodeTypeOfExpression(typeName));
- }
-
- void SetWarning (ServiceDescriptionImportWarnings w)
- {
- warnings |= w;
- }
-
- static string[] defaultSchemaTypes = new string[]
- {
- "string", "int", "long", "short", "boolean", "dateTime", "float", "unsignedShort",
- "unsignedInt", "unsignedLong", "double", "decimal", "QName", "unsignedByte", "byte",
- "char", "duration", "base64Binary", "anyURI", "guid"
- };
-
- static string[] primitiveArrays = new string[]
- {
- "NMTOKENS", "ENTITIES", "hexBinary", "IDREFS", "base64Binary"
- };
-#endregion
+ #endregion
}
-} +}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionReflector.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionReflector.cs index 237382c48d3..d270f209823 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionReflector.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionReflector.cs @@ -3,25 +3,20 @@ //
// Author:
// Tim Coleman (tim@timcoleman.com)
-// Lluis Sanchez Gual (lluis@ximian.com)
//
// Copyright (C) Tim Coleman, 2002
//
using System.Web.Services;
using System.Xml.Serialization;
-using System.Xml;
-using System.Web.Services.Protocols;
namespace System.Web.Services.Description {
public class ServiceDescriptionReflector {
#region Fields
- Types types;
+ XmlSchemas schemas;
ServiceDescriptionCollection serviceDescriptions;
- XmlSchemaExporter schemaExporter;
- SoapSchemaExporter soapSchemaExporter;
#endregion // Fields
@@ -29,10 +24,8 @@ namespace System.Web.Services.Description { public ServiceDescriptionReflector ()
{
- types = new Types ();
+ schemas = new XmlSchemas ();
serviceDescriptions = new ServiceDescriptionCollection ();
- schemaExporter = new XmlSchemaExporter (types.Schemas);
- soapSchemaExporter = new SoapSchemaExporter (types.Schemas);
}
#endregion // Constructors
@@ -40,7 +33,7 @@ namespace System.Web.Services.Description { #region Properties
public XmlSchemas Schemas {
- get { return types.Schemas; }
+ get { return schemas; }
}
public ServiceDescriptionCollection ServiceDescriptions {
@@ -55,199 +48,9 @@ namespace System.Web.Services.Description { [MonoTODO]
public void Reflect (Type type, string url)
{
- ServiceDescription desc = new ServiceDescription ();
- serviceDescriptions.Add (desc);
-
- TypeStubInfo typeInfo = TypeStubManager.GetTypeStub (type);
- desc.TargetNamespace = typeInfo.WebServiceNamespace;
- desc.Name = typeInfo.WebServiceName;
-
- ImportService (desc, typeInfo, url);
-
- if (serviceDescriptions.Count == 1)
- desc.Types = types;
- else
- {
- foreach (ServiceDescription d in serviceDescriptions)
- {
- d.Types = new Types();
- for (int n=0; n<types.Schemas.Count; n++)
- AddImport (d, types.Schemas[n].TargetNamespace, GetSchemaUrl (url, n));
- }
- }
+ throw new NotImplementedException ();
}
-
- Service ImportService (ServiceDescription desc, TypeStubInfo typeInfo, string url)
- {
- Service service = new Service ();
- service.Name = typeInfo.WebServiceName;
- service.Documentation = typeInfo.Description;
-
- desc.Services.Add (service);
-
- foreach (BindingInfo binfo in typeInfo.Bindings)
- ImportBinding (desc, service, typeInfo, url, binfo);
-
- return service;
- }
-
- void ImportBinding (ServiceDescription desc, Service service, TypeStubInfo typeInfo, string url, BindingInfo binfo)
- {
- Port port = new Port ();
- port.Name = binfo.Name;
- port.Binding = new XmlQualifiedName (binfo.Name, binfo.Namespace);
- service.Ports.Add (port);
-
- SoapAddressBinding abind = new SoapAddressBinding ();
- abind.Location = url;
- port.Extensions.Add (abind);
-
- if (binfo.Namespace != desc.TargetNamespace)
- {
- if (binfo.Location == null || binfo.Location == string.Empty)
- {
- ServiceDescription newDesc = new ServiceDescription();
- newDesc.TargetNamespace = binfo.Namespace;
- int id = serviceDescriptions.Add (newDesc);
- AddImport (desc, binfo.Namespace, GetWsdlUrl (url,id));
- ImportBindingContent (newDesc, typeInfo, url, binfo);
- }
- else
- AddImport (desc, binfo.Namespace, binfo.Location);
- }
- else
- ImportBindingContent (desc, typeInfo, url, binfo);
- }
-
- void ImportBindingContent (ServiceDescription desc, TypeStubInfo typeInfo, string url, BindingInfo binfo)
- {
- Binding binding = new Binding ();
- binding.Name = binfo.Name;
- binding.Type = new XmlQualifiedName (binfo.Name, binfo.Namespace);
- desc.Bindings.Add (binding);
-
- SoapBinding sb = new SoapBinding ();
- sb.Transport = SoapBinding.HttpTransport;
- sb.Style = typeInfo.SoapBindingStyle;
- binding.Extensions.Add (sb);
-
- PortType ptype = new PortType ();
- ptype.Name = binding.Name;
- desc.PortTypes.Add (ptype);
-
- foreach (MethodStubInfo method in typeInfo.Methods)
- {
- if (method.Binding != binding.Name) continue;
-
- Operation oper = ImportOperation (desc, method);
- ptype.Operations.Add (oper);
- OperationBinding operb = ImportOperationBinding (desc, method);
- binding.Operations.Add (operb);
- }
- }
-
- Operation ImportOperation (ServiceDescription desc, MethodStubInfo method)
- {
- Operation oper = new Operation ();
- oper.Name = method.Name;
- oper.Documentation = method.Description;
-
- OperationInput inOp = new OperationInput ();
- inOp.Message = ImportMessage (desc, oper.Name + "In", method.InputMembersMapping, method);
- oper.Messages.Add (inOp);
-
- OperationOutput outOp = new OperationOutput ();
- outOp.Message = ImportMessage (desc, oper.Name + "Out", method.OutputMembersMapping, method);
- oper.Messages.Add (outOp);
-
- return oper;
- }
-
- OperationBinding ImportOperationBinding (ServiceDescription desc, MethodStubInfo method)
- {
- OperationBinding oper = new OperationBinding ();
- oper.Name = method.Name;
-
- SoapOperationBinding sob = new SoapOperationBinding();
- sob.SoapAction = method.Action;
- sob.Style = method.SoapBindingStyle;
- oper.Extensions.Add (sob);
-
- InputBinding inOp = new InputBinding ();
- AddOperationMsgBindings (desc, inOp, method);
- oper.Input = inOp;
-
- OutputBinding outOp = new OutputBinding ();
- AddOperationMsgBindings (desc, outOp, method);
- oper.Output = outOp;
-
- return oper;
- }
-
- void AddOperationMsgBindings (ServiceDescription desc, MessageBinding msg, MethodStubInfo method)
- {
- SoapBodyBinding sbbo = new SoapBodyBinding();
- msg.Extensions.Add (sbbo);
- sbbo.Use = method.Use;
- if (method.Use == SoapBindingUse.Encoded)
- {
- sbbo.Namespace = desc.TargetNamespace;
- sbbo.Encoding = "http://schemas.xmlsoap.org/soap/encoding/";
- }
- }
-
- XmlQualifiedName ImportMessage (ServiceDescription desc, string name, XmlMembersMapping members, MethodStubInfo method)
- {
- Message msg = new Message ();
- msg.Name = name;
-
- if (method.ParameterStyle == SoapParameterStyle.Wrapped)
- {
- MessagePart part = new MessagePart ();
- part.Name = "parameters";
- part.Element = new XmlQualifiedName (members.ElementName, members.Namespace);
- msg.Parts.Add (part);
- }
- else
- {
- for (int n=0; n<members.Count; n++)
- {
- MessagePart part = new MessagePart ();
- part.Name = members[n].MemberName;
- part.Element = new XmlQualifiedName (members[n].ElementName, members.Namespace);
- msg.Parts.Add (part);
- }
- }
-
- desc.Messages.Add (msg);
-
- if (method.Use == SoapBindingUse.Literal)
- schemaExporter.ExportMembersMapping (members);
- else
- soapSchemaExporter.ExportMembersMapping (members);
-
- return new XmlQualifiedName (name, members.Namespace);
- }
-
- void AddImport (ServiceDescription desc, string ns, string location)
- {
- Import im = new Import();
- im.Namespace = ns;
- im.Location = location;
- desc.Imports.Add (im);
- }
-
- string GetWsdlUrl (string baseUrl, int id)
- {
- return baseUrl + "?wsdl=" + id;
- }
-
- string GetSchemaUrl (string baseUrl, int id)
- {
- return baseUrl + "?schema=" + id;
- }
-
#endregion
}
-} +}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionSerializerBase.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionSerializerBase.cs deleted file mode 100644 index da3c3f4befe..00000000000 --- a/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionSerializerBase.cs +++ /dev/null @@ -1,1814 +0,0 @@ -using System; -using System.Xml; -using System.Xml.Serialization; -using System.Text; -using System.Collections; -using System.Globalization; - -namespace System.Web.Services.Description -{ - public class ServiceDescriptionReaderBase : XmlSerializationReader - { - public System.Web.Services.Description.ServiceDescription ReadTree () - { - Reader.MoveToContent(); - return ReadObject_ServiceDescription (true, true); - } - - public System.Web.Services.Description.ServiceDescription ReadObject_ServiceDescription (bool isNullable, bool checkType) - { - System.Web.Services.Description.ServiceDescription ob = null; - if (isNullable && ReadNull()) return null; - - if (checkType) - { - System.Xml.XmlQualifiedName t = GetXsiType(); - if (t != null) - { - if (t.Name != "ServiceDescription" || t.Namespace != "http://schemas.xmlsoap.org/wsdl/") - throw CreateUnknownTypeException(t); - } - } - - ob = new System.Web.Services.Description.ServiceDescription (); - - Reader.MoveToElement(); - - while (Reader.MoveToNextAttribute()) - { - if (Reader.LocalName == "name" && Reader.NamespaceURI == "") { - ob.Name = Reader.Value; - } - else if (Reader.LocalName == "targetNamespace" && Reader.NamespaceURI == "") { - ob.TargetNamespace = Reader.Value; - } - else if (IsXmlnsAttribute (Reader.Name)) { - } - else { - UnknownNode (ob); - } - } - - Reader.MoveToElement(); - if (Reader.IsEmptyElement) { - Reader.Skip (); - return ob; - } - - Reader.ReadStartElement(); - Reader.MoveToContent(); - - bool b0=false, b1=false, b2=false, b3=false, b4=false, b5=false, b6=false; - - System.Web.Services.Description.ImportCollection o8 = ob.Imports; - System.Web.Services.Description.MessageCollection o10 = ob.Messages; - System.Web.Services.Description.PortTypeCollection o12 = ob.PortTypes; - System.Web.Services.Description.BindingCollection o14 = ob.Bindings; - System.Web.Services.Description.ServiceCollection o16 = ob.Services; - int n7=0, n9=0, n11=0, n13=0, n15=0; - - while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) - { - if (Reader.NodeType == System.Xml.XmlNodeType.Element) - { - if (Reader.LocalName == "binding" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b4) { - if (o14 == null) - throw CreateReadOnlyCollectionException ("System.Web.Services.Description.BindingCollection"); - o14.Add (ReadObject_Binding (false, true)); - n13++; - } - else if (Reader.LocalName == "service" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b5) { - if (o16 == null) - throw CreateReadOnlyCollectionException ("System.Web.Services.Description.ServiceCollection"); - o16.Add (ReadObject_Service (false, true)); - n15++; - } - else if (Reader.LocalName == "import" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b0) { - if (o8 == null) - throw CreateReadOnlyCollectionException ("System.Web.Services.Description.ImportCollection"); - o8.Add (ReadObject_Import (false, true)); - n7++; - } - else if (Reader.LocalName == "documentation" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b6) { - b6 = true; - ob.Documentation = Reader.ReadElementString (); - } - else if (Reader.LocalName == "message" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b2) { - if (o10 == null) - throw CreateReadOnlyCollectionException ("System.Web.Services.Description.MessageCollection"); - o10.Add (ReadObject_Message (false, true)); - n9++; - } - else if (Reader.LocalName == "types" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b1) { - b1 = true; - ob.Types = ReadObject_Types (false, true); - } - else if (Reader.LocalName == "portType" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b3) { - if (o12 == null) - throw CreateReadOnlyCollectionException ("System.Web.Services.Description.PortTypeCollection"); - o12.Add (ReadObject_PortType (false, true)); - n11++; - } - else { - ServiceDescription.ReadExtension (Reader, ob); - } - } - else - UnknownNode(ob); - - Reader.MoveToContent(); - } - - - ReadEndElement(); - - return ob; - } - - public System.Web.Services.Description.Binding ReadObject_Binding (bool isNullable, bool checkType) - { - System.Web.Services.Description.Binding ob = null; - if (isNullable && ReadNull()) return null; - - if (checkType) - { - System.Xml.XmlQualifiedName t = GetXsiType(); - if (t != null) - { - if (t.Name != "Binding" || t.Namespace != "http://schemas.xmlsoap.org/wsdl/") - throw CreateUnknownTypeException(t); - } - } - - ob = new System.Web.Services.Description.Binding (); - - Reader.MoveToElement(); - - while (Reader.MoveToNextAttribute()) - { - if (Reader.LocalName == "name" && Reader.NamespaceURI == "") { - ob.Name = Reader.Value; - } - else if (Reader.LocalName == "type" && Reader.NamespaceURI == "") { - ob.Type = ToXmlQualifiedName (Reader.Value); - } - else if (IsXmlnsAttribute (Reader.Name)) { - } - else { - UnknownNode (ob); - } - } - - Reader.MoveToElement(); - if (Reader.IsEmptyElement) { - Reader.Skip (); - return ob; - } - - Reader.ReadStartElement(); - Reader.MoveToContent(); - - bool b17=false, b18=false; - - System.Web.Services.Description.OperationBindingCollection o20 = ob.Operations; - int n19=0; - - while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) - { - if (Reader.NodeType == System.Xml.XmlNodeType.Element) - { - if (Reader.LocalName == "operation" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b17) { - if (o20 == null) - throw CreateReadOnlyCollectionException ("System.Web.Services.Description.OperationBindingCollection"); - o20.Add (ReadObject_OperationBinding (false, true)); - n19++; - } - else if (Reader.LocalName == "documentation" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b18) { - b18 = true; - ob.Documentation = Reader.ReadElementString (); - } - else { - ServiceDescription.ReadExtension (Reader, ob); - } - } - else - UnknownNode(ob); - - Reader.MoveToContent(); - } - - - ReadEndElement(); - - return ob; - } - - public System.Web.Services.Description.Service ReadObject_Service (bool isNullable, bool checkType) - { - System.Web.Services.Description.Service ob = null; - if (isNullable && ReadNull()) return null; - - if (checkType) - { - System.Xml.XmlQualifiedName t = GetXsiType(); - if (t != null) - { - if (t.Name != "Service" || t.Namespace != "http://schemas.xmlsoap.org/wsdl/") - throw CreateUnknownTypeException(t); - } - } - - ob = new System.Web.Services.Description.Service (); - - Reader.MoveToElement(); - - while (Reader.MoveToNextAttribute()) - { - if (Reader.LocalName == "name" && Reader.NamespaceURI == "") { - ob.Name = Reader.Value; - } - else if (IsXmlnsAttribute (Reader.Name)) { - } - else { - UnknownNode (ob); - } - } - - Reader.MoveToElement(); - if (Reader.IsEmptyElement) { - Reader.Skip (); - return ob; - } - - Reader.ReadStartElement(); - Reader.MoveToContent(); - - bool b21=false, b22=false; - - System.Web.Services.Description.PortCollection o24 = ob.Ports; - int n23=0; - - while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) - { - if (Reader.NodeType == System.Xml.XmlNodeType.Element) - { - if (Reader.LocalName == "documentation" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b22) { - b22 = true; - ob.Documentation = Reader.ReadElementString (); - } - else if (Reader.LocalName == "port" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b21) { - if (o24 == null) - throw CreateReadOnlyCollectionException ("System.Web.Services.Description.PortCollection"); - o24.Add (ReadObject_Port (false, true)); - n23++; - } - else { - UnknownNode (ob); - } - } - else - UnknownNode(ob); - - Reader.MoveToContent(); - } - - - ReadEndElement(); - - return ob; - } - - public System.Web.Services.Description.Import ReadObject_Import (bool isNullable, bool checkType) - { - System.Web.Services.Description.Import ob = null; - if (isNullable && ReadNull()) return null; - - if (checkType) - { - System.Xml.XmlQualifiedName t = GetXsiType(); - if (t != null) - { - if (t.Name != "Import" || t.Namespace != "http://schemas.xmlsoap.org/wsdl/") - throw CreateUnknownTypeException(t); - } - } - - ob = new System.Web.Services.Description.Import (); - - Reader.MoveToElement(); - - while (Reader.MoveToNextAttribute()) - { - if (Reader.LocalName == "namespace" && Reader.NamespaceURI == "") { - ob.Namespace = Reader.Value; - } - else if (Reader.LocalName == "location" && Reader.NamespaceURI == "") { - ob.Location = Reader.Value; - } - else if (IsXmlnsAttribute (Reader.Name)) { - } - else { - UnknownNode (ob); - } - } - - Reader.MoveToElement(); - if (Reader.IsEmptyElement) { - Reader.Skip (); - return ob; - } - - Reader.ReadStartElement(); - Reader.MoveToContent(); - - bool b25=false; - - while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) - { - if (Reader.NodeType == System.Xml.XmlNodeType.Element) - { - if (Reader.LocalName == "documentation" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b25) { - b25 = true; - ob.Documentation = Reader.ReadElementString (); - } - else { - UnknownNode (ob); - } - } - else - UnknownNode(ob); - - Reader.MoveToContent(); - } - - ReadEndElement(); - - return ob; - } - - public System.Web.Services.Description.Message ReadObject_Message (bool isNullable, bool checkType) - { - System.Web.Services.Description.Message ob = null; - if (isNullable && ReadNull()) return null; - - if (checkType) - { - System.Xml.XmlQualifiedName t = GetXsiType(); - if (t != null) - { - if (t.Name != "Message" || t.Namespace != "http://schemas.xmlsoap.org/wsdl/") - throw CreateUnknownTypeException(t); - } - } - - ob = new System.Web.Services.Description.Message (); - - Reader.MoveToElement(); - - while (Reader.MoveToNextAttribute()) - { - if (Reader.LocalName == "name" && Reader.NamespaceURI == "") { - ob.Name = Reader.Value; - } - else if (IsXmlnsAttribute (Reader.Name)) { - } - else { - UnknownNode (ob); - } - } - - Reader.MoveToElement(); - if (Reader.IsEmptyElement) { - Reader.Skip (); - return ob; - } - - Reader.ReadStartElement(); - Reader.MoveToContent(); - - bool b26=false, b27=false; - - System.Web.Services.Description.MessagePartCollection o29 = ob.Parts; - int n28=0; - - while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) - { - if (Reader.NodeType == System.Xml.XmlNodeType.Element) - { - if (Reader.LocalName == "documentation" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b27) { - b27 = true; - ob.Documentation = Reader.ReadElementString (); - } - else if (Reader.LocalName == "part" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b26) { - if (o29 == null) - throw CreateReadOnlyCollectionException ("System.Web.Services.Description.MessagePartCollection"); - o29.Add (ReadObject_MessagePart (false, true)); - n28++; - } - else { - UnknownNode (ob); - } - } - else - UnknownNode(ob); - - Reader.MoveToContent(); - } - - - ReadEndElement(); - - return ob; - } - - public System.Web.Services.Description.Types ReadObject_Types (bool isNullable, bool checkType) - { - System.Web.Services.Description.Types ob = null; - if (isNullable && ReadNull()) return null; - - if (checkType) - { - System.Xml.XmlQualifiedName t = GetXsiType(); - if (t != null) - { - if (t.Name != "Types" || t.Namespace != "http://schemas.xmlsoap.org/wsdl/") - throw CreateUnknownTypeException(t); - } - } - - ob = new System.Web.Services.Description.Types (); - - Reader.MoveToElement(); - - while (Reader.MoveToNextAttribute()) - { - if (IsXmlnsAttribute (Reader.Name)) { - } - else { - UnknownNode (ob); - } - } - - Reader.MoveToElement(); - if (Reader.IsEmptyElement) { - Reader.Skip (); - return ob; - } - - Reader.ReadStartElement(); - Reader.MoveToContent(); - - bool b30=false, b31=false; - - System.Xml.Serialization.XmlSchemas o33 = ob.Schemas; - int n32=0; - - while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) - { - if (Reader.NodeType == System.Xml.XmlNodeType.Element) - { - if (Reader.LocalName == "documentation" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b31) { - b31 = true; - ob.Documentation = Reader.ReadElementString (); - } - else if (Reader.LocalName == "schema" && Reader.NamespaceURI == "http://www.w3.org/2001/XMLSchema" && !b30) { - if (o33 == null) - throw CreateReadOnlyCollectionException ("System.Xml.Serialization.XmlSchemas"); - o33.Add (ReadObject_XmlSchema (false, true)); - n32++; - } - else { - ServiceDescription.ReadExtension (Reader, ob); - } - } - else - UnknownNode(ob); - - Reader.MoveToContent(); - } - - - ReadEndElement(); - - return ob; - } - - public System.Web.Services.Description.PortType ReadObject_PortType (bool isNullable, bool checkType) - { - System.Web.Services.Description.PortType ob = null; - if (isNullable && ReadNull()) return null; - - if (checkType) - { - System.Xml.XmlQualifiedName t = GetXsiType(); - if (t != null) - { - if (t.Name != "PortType" || t.Namespace != "http://schemas.xmlsoap.org/wsdl/") - throw CreateUnknownTypeException(t); - } - } - - ob = new System.Web.Services.Description.PortType (); - - Reader.MoveToElement(); - - while (Reader.MoveToNextAttribute()) - { - if (Reader.LocalName == "name" && Reader.NamespaceURI == "") { - ob.Name = Reader.Value; - } - else if (IsXmlnsAttribute (Reader.Name)) { - } - else { - UnknownNode (ob); - } - } - - Reader.MoveToElement(); - if (Reader.IsEmptyElement) { - Reader.Skip (); - return ob; - } - - Reader.ReadStartElement(); - Reader.MoveToContent(); - - bool b34=false, b35=false; - - System.Web.Services.Description.OperationCollection o37 = ob.Operations; - int n36=0; - - while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) - { - if (Reader.NodeType == System.Xml.XmlNodeType.Element) - { - if (Reader.LocalName == "operation" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b34) { - if (o37 == null) - throw CreateReadOnlyCollectionException ("System.Web.Services.Description.OperationCollection"); - o37.Add (ReadObject_Operation (false, true)); - n36++; - } - else if (Reader.LocalName == "documentation" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b35) { - b35 = true; - ob.Documentation = Reader.ReadElementString (); - } - else { - UnknownNode (ob); - } - } - else - UnknownNode(ob); - - Reader.MoveToContent(); - } - - - ReadEndElement(); - - return ob; - } - - public System.Web.Services.Description.OperationBinding ReadObject_OperationBinding (bool isNullable, bool checkType) - { - System.Web.Services.Description.OperationBinding ob = null; - if (isNullable && ReadNull()) return null; - - if (checkType) - { - System.Xml.XmlQualifiedName t = GetXsiType(); - if (t != null) - { - if (t.Name != "OperationBinding" || t.Namespace != "http://schemas.xmlsoap.org/wsdl/") - throw CreateUnknownTypeException(t); - } - } - - ob = new System.Web.Services.Description.OperationBinding (); - - Reader.MoveToElement(); - - while (Reader.MoveToNextAttribute()) - { - if (Reader.LocalName == "name" && Reader.NamespaceURI == "") { - ob.Name = Reader.Value; - } - else if (IsXmlnsAttribute (Reader.Name)) { - } - else { - UnknownNode (ob); - } - } - - Reader.MoveToElement(); - if (Reader.IsEmptyElement) { - Reader.Skip (); - return ob; - } - - Reader.ReadStartElement(); - Reader.MoveToContent(); - - bool b38=false, b39=false, b40=false, b41=false; - - System.Web.Services.Description.FaultBindingCollection o43 = ob.Faults; - int n42=0; - - while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) - { - if (Reader.NodeType == System.Xml.XmlNodeType.Element) - { - if (Reader.LocalName == "input" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b39) { - b39 = true; - ob.Input = ReadObject_InputBinding (false, true); - } - else if (Reader.LocalName == "fault" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b38) { - if (o43 == null) - throw CreateReadOnlyCollectionException ("System.Web.Services.Description.FaultBindingCollection"); - o43.Add (ReadObject_FaultBinding (false, true)); - n42++; - } - else if (Reader.LocalName == "documentation" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b41) { - b41 = true; - ob.Documentation = Reader.ReadElementString (); - } - else if (Reader.LocalName == "output" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b40) { - b40 = true; - ob.Output = ReadObject_OutputBinding (false, true); - } - else { - ServiceDescription.ReadExtension (Reader, ob); - } - } - else - UnknownNode(ob); - - Reader.MoveToContent(); - } - - - ReadEndElement(); - - return ob; - } - - public System.Web.Services.Description.Port ReadObject_Port (bool isNullable, bool checkType) - { - System.Web.Services.Description.Port ob = null; - if (isNullable && ReadNull()) return null; - - if (checkType) - { - System.Xml.XmlQualifiedName t = GetXsiType(); - if (t != null) - { - if (t.Name != "Port" || t.Namespace != "http://schemas.xmlsoap.org/wsdl/") - throw CreateUnknownTypeException(t); - } - } - - ob = new System.Web.Services.Description.Port (); - - Reader.MoveToElement(); - - while (Reader.MoveToNextAttribute()) - { - if (Reader.LocalName == "name" && Reader.NamespaceURI == "") { - ob.Name = Reader.Value; - } - else if (Reader.LocalName == "binding" && Reader.NamespaceURI == "") { - ob.Binding = ToXmlQualifiedName (Reader.Value); - } - else if (IsXmlnsAttribute (Reader.Name)) { - } - else { - UnknownNode (ob); - } - } - - Reader.MoveToElement(); - if (Reader.IsEmptyElement) { - Reader.Skip (); - return ob; - } - - Reader.ReadStartElement(); - Reader.MoveToContent(); - - bool b44=false; - - while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) - { - if (Reader.NodeType == System.Xml.XmlNodeType.Element) - { - if (Reader.LocalName == "documentation" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b44) { - b44 = true; - ob.Documentation = Reader.ReadElementString (); - } - else { - ServiceDescription.ReadExtension (Reader, ob); - } - } - else - UnknownNode(ob); - - Reader.MoveToContent(); - } - - ReadEndElement(); - - return ob; - } - - public System.Web.Services.Description.MessagePart ReadObject_MessagePart (bool isNullable, bool checkType) - { - System.Web.Services.Description.MessagePart ob = null; - if (isNullable && ReadNull()) return null; - - if (checkType) - { - System.Xml.XmlQualifiedName t = GetXsiType(); - if (t != null) - { - if (t.Name != "MessagePart" || t.Namespace != "http://schemas.xmlsoap.org/wsdl/") - throw CreateUnknownTypeException(t); - } - } - - ob = new System.Web.Services.Description.MessagePart (); - - Reader.MoveToElement(); - - while (Reader.MoveToNextAttribute()) - { - if (Reader.LocalName == "name" && Reader.NamespaceURI == "") { - ob.Name = Reader.Value; - } - else if (Reader.LocalName == "element" && Reader.NamespaceURI == "") { - ob.Element = ToXmlQualifiedName (Reader.Value); - } - else if (Reader.LocalName == "type" && Reader.NamespaceURI == "") { - ob.Type = ToXmlQualifiedName (Reader.Value); - } - else if (IsXmlnsAttribute (Reader.Name)) { - } - else { - UnknownNode (ob); - } - } - - Reader.MoveToElement(); - if (Reader.IsEmptyElement) { - Reader.Skip (); - return ob; - } - - Reader.ReadStartElement(); - Reader.MoveToContent(); - - bool b45=false; - - while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) - { - if (Reader.NodeType == System.Xml.XmlNodeType.Element) - { - if (Reader.LocalName == "documentation" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b45) { - b45 = true; - ob.Documentation = Reader.ReadElementString (); - } - else { - UnknownNode (ob); - } - } - else - UnknownNode(ob); - - Reader.MoveToContent(); - } - - ReadEndElement(); - - return ob; - } - - public System.Xml.Schema.XmlSchema ReadObject_XmlSchema (bool isNullable, bool checkType) - { - System.Xml.Schema.XmlSchema ob = null; - ob = System.Xml.Schema.XmlSchema.Read (Reader, null); - return ob; - } - - public System.Web.Services.Description.Operation ReadObject_Operation (bool isNullable, bool checkType) - { - System.Web.Services.Description.Operation ob = null; - if (isNullable && ReadNull()) return null; - - if (checkType) - { - System.Xml.XmlQualifiedName t = GetXsiType(); - if (t != null) - { - if (t.Name != "Operation" || t.Namespace != "http://schemas.xmlsoap.org/wsdl/") - throw CreateUnknownTypeException(t); - } - } - - ob = new System.Web.Services.Description.Operation (); - - Reader.MoveToElement(); - - while (Reader.MoveToNextAttribute()) - { - if (Reader.LocalName == "name" && Reader.NamespaceURI == "") { - ob.Name = Reader.Value; - } - else if (Reader.LocalName == "parameterOrder" && Reader.NamespaceURI == "") { - ob.ParameterOrderString = Reader.Value; - } - else if (IsXmlnsAttribute (Reader.Name)) { - } - else { - UnknownNode (ob); - } - } - - Reader.MoveToElement(); - if (Reader.IsEmptyElement) { - Reader.Skip (); - return ob; - } - - Reader.ReadStartElement(); - Reader.MoveToContent(); - - bool b46=false, b47=false, b48=false; - - System.Web.Services.Description.OperationFaultCollection o50 = ob.Faults; - System.Web.Services.Description.OperationMessageCollection o52 = ob.Messages; - int n49=0, n51=0; - - while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) - { - if (Reader.NodeType == System.Xml.XmlNodeType.Element) - { - if (Reader.LocalName == "input" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b47) { - if (o52 == null) - throw CreateReadOnlyCollectionException ("System.Web.Services.Description.OperationMessageCollection"); - o52.Add (ReadObject_OperationInput (false, true)); - n51++; - } - else if (Reader.LocalName == "fault" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b46) { - if (o50 == null) - throw CreateReadOnlyCollectionException ("System.Web.Services.Description.OperationFaultCollection"); - o50.Add (ReadObject_OperationFault (false, true)); - n49++; - } - else if (Reader.LocalName == "documentation" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b48) { - b48 = true; - ob.Documentation = Reader.ReadElementString (); - } - else if (Reader.LocalName == "output" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b47) { - if (o52 == null) - throw CreateReadOnlyCollectionException ("System.Web.Services.Description.OperationMessageCollection"); - o52.Add (ReadObject_OperationOutput (false, true)); - n51++; - } - else { - UnknownNode (ob); - } - } - else - UnknownNode(ob); - - Reader.MoveToContent(); - } - - - ReadEndElement(); - - return ob; - } - - public System.Web.Services.Description.InputBinding ReadObject_InputBinding (bool isNullable, bool checkType) - { - System.Web.Services.Description.InputBinding ob = null; - if (isNullable && ReadNull()) return null; - - if (checkType) - { - System.Xml.XmlQualifiedName t = GetXsiType(); - if (t != null) - { - if (t.Name != "InputBinding" || t.Namespace != "http://schemas.xmlsoap.org/wsdl/") - throw CreateUnknownTypeException(t); - } - } - - ob = new System.Web.Services.Description.InputBinding (); - - Reader.MoveToElement(); - - while (Reader.MoveToNextAttribute()) - { - if (Reader.LocalName == "name" && Reader.NamespaceURI == "") { - ob.Name = Reader.Value; - } - else if (IsXmlnsAttribute (Reader.Name)) { - } - else { - UnknownNode (ob); - } - } - - Reader.MoveToElement(); - if (Reader.IsEmptyElement) { - Reader.Skip (); - return ob; - } - - Reader.ReadStartElement(); - Reader.MoveToContent(); - - bool b53=false; - - while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) - { - if (Reader.NodeType == System.Xml.XmlNodeType.Element) - { - if (Reader.LocalName == "documentation" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b53) { - b53 = true; - ob.Documentation = Reader.ReadElementString (); - } - else { - ServiceDescription.ReadExtension (Reader, ob); - } - } - else - UnknownNode(ob); - - Reader.MoveToContent(); - } - - ReadEndElement(); - - return ob; - } - - public System.Web.Services.Description.FaultBinding ReadObject_FaultBinding (bool isNullable, bool checkType) - { - System.Web.Services.Description.FaultBinding ob = null; - if (isNullable && ReadNull()) return null; - - if (checkType) - { - System.Xml.XmlQualifiedName t = GetXsiType(); - if (t != null) - { - if (t.Name != "FaultBinding" || t.Namespace != "http://schemas.xmlsoap.org/wsdl/") - throw CreateUnknownTypeException(t); - } - } - - ob = new System.Web.Services.Description.FaultBinding (); - - Reader.MoveToElement(); - - while (Reader.MoveToNextAttribute()) - { - if (Reader.LocalName == "name" && Reader.NamespaceURI == "") { - ob.Name = Reader.Value; - } - else if (IsXmlnsAttribute (Reader.Name)) { - } - else { - UnknownNode (ob); - } - } - - Reader.MoveToElement(); - if (Reader.IsEmptyElement) { - Reader.Skip (); - return ob; - } - - Reader.ReadStartElement(); - Reader.MoveToContent(); - - bool b54=false; - - while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) - { - if (Reader.NodeType == System.Xml.XmlNodeType.Element) - { - if (Reader.LocalName == "documentation" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b54) { - b54 = true; - ob.Documentation = Reader.ReadElementString (); - } - else { - ServiceDescription.ReadExtension (Reader, ob); - } - } - else - UnknownNode(ob); - - Reader.MoveToContent(); - } - - ReadEndElement(); - - return ob; - } - - public System.Web.Services.Description.OutputBinding ReadObject_OutputBinding (bool isNullable, bool checkType) - { - System.Web.Services.Description.OutputBinding ob = null; - if (isNullable && ReadNull()) return null; - - if (checkType) - { - System.Xml.XmlQualifiedName t = GetXsiType(); - if (t != null) - { - if (t.Name != "OutputBinding" || t.Namespace != "http://schemas.xmlsoap.org/wsdl/") - throw CreateUnknownTypeException(t); - } - } - - ob = new System.Web.Services.Description.OutputBinding (); - - Reader.MoveToElement(); - - while (Reader.MoveToNextAttribute()) - { - if (Reader.LocalName == "name" && Reader.NamespaceURI == "") { - ob.Name = Reader.Value; - } - else if (IsXmlnsAttribute (Reader.Name)) { - } - else { - UnknownNode (ob); - } - } - - Reader.MoveToElement(); - if (Reader.IsEmptyElement) { - Reader.Skip (); - return ob; - } - - Reader.ReadStartElement(); - Reader.MoveToContent(); - - bool b55=false; - - while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) - { - if (Reader.NodeType == System.Xml.XmlNodeType.Element) - { - if (Reader.LocalName == "documentation" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b55) { - b55 = true; - ob.Documentation = Reader.ReadElementString (); - } - else { - ServiceDescription.ReadExtension (Reader, ob); - } - } - else - UnknownNode(ob); - - Reader.MoveToContent(); - } - - ReadEndElement(); - - return ob; - } - - public System.Web.Services.Description.OperationInput ReadObject_OperationInput (bool isNullable, bool checkType) - { - System.Web.Services.Description.OperationInput ob = null; - if (isNullable && ReadNull()) return null; - - if (checkType) - { - System.Xml.XmlQualifiedName t = GetXsiType(); - if (t != null) - { - if (t.Name != "OperationInput" || t.Namespace != "http://schemas.xmlsoap.org/wsdl/") - throw CreateUnknownTypeException(t); - } - } - - ob = new System.Web.Services.Description.OperationInput (); - - Reader.MoveToElement(); - - while (Reader.MoveToNextAttribute()) - { - if (Reader.LocalName == "name" && Reader.NamespaceURI == "") { - ob.Name = Reader.Value; - } - else if (Reader.LocalName == "message" && Reader.NamespaceURI == "") { - ob.Message = ToXmlQualifiedName (Reader.Value); - } - else if (IsXmlnsAttribute (Reader.Name)) { - } - else { - UnknownNode (ob); - } - } - - Reader.MoveToElement(); - if (Reader.IsEmptyElement) { - Reader.Skip (); - return ob; - } - - Reader.ReadStartElement(); - Reader.MoveToContent(); - - bool b56=false; - - while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) - { - if (Reader.NodeType == System.Xml.XmlNodeType.Element) - { - if (Reader.LocalName == "documentation" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b56) { - b56 = true; - ob.Documentation = Reader.ReadElementString (); - } - else { - UnknownNode (ob); - } - } - else - UnknownNode(ob); - - Reader.MoveToContent(); - } - - ReadEndElement(); - - return ob; - } - - public System.Web.Services.Description.OperationFault ReadObject_OperationFault (bool isNullable, bool checkType) - { - System.Web.Services.Description.OperationFault ob = null; - if (isNullable && ReadNull()) return null; - - if (checkType) - { - System.Xml.XmlQualifiedName t = GetXsiType(); - if (t != null) - { - if (t.Name != "OperationFault" || t.Namespace != "http://schemas.xmlsoap.org/wsdl/") - throw CreateUnknownTypeException(t); - } - } - - ob = new System.Web.Services.Description.OperationFault (); - - Reader.MoveToElement(); - - while (Reader.MoveToNextAttribute()) - { - if (Reader.LocalName == "name" && Reader.NamespaceURI == "") { - ob.Name = Reader.Value; - } - else if (Reader.LocalName == "message" && Reader.NamespaceURI == "") { - ob.Message = ToXmlQualifiedName (Reader.Value); - } - else if (IsXmlnsAttribute (Reader.Name)) { - } - else { - UnknownNode (ob); - } - } - - Reader.MoveToElement(); - if (Reader.IsEmptyElement) { - Reader.Skip (); - return ob; - } - - Reader.ReadStartElement(); - Reader.MoveToContent(); - - bool b57=false; - - while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) - { - if (Reader.NodeType == System.Xml.XmlNodeType.Element) - { - if (Reader.LocalName == "documentation" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b57) { - b57 = true; - ob.Documentation = Reader.ReadElementString (); - } - else { - UnknownNode (ob); - } - } - else - UnknownNode(ob); - - Reader.MoveToContent(); - } - - ReadEndElement(); - - return ob; - } - - public System.Web.Services.Description.OperationOutput ReadObject_OperationOutput (bool isNullable, bool checkType) - { - System.Web.Services.Description.OperationOutput ob = null; - if (isNullable && ReadNull()) return null; - - if (checkType) - { - System.Xml.XmlQualifiedName t = GetXsiType(); - if (t != null) - { - if (t.Name != "OperationOutput" || t.Namespace != "http://schemas.xmlsoap.org/wsdl/") - throw CreateUnknownTypeException(t); - } - } - - ob = new System.Web.Services.Description.OperationOutput (); - - Reader.MoveToElement(); - - while (Reader.MoveToNextAttribute()) - { - if (Reader.LocalName == "name" && Reader.NamespaceURI == "") { - ob.Name = Reader.Value; - } - else if (Reader.LocalName == "message" && Reader.NamespaceURI == "") { - ob.Message = ToXmlQualifiedName (Reader.Value); - } - else if (IsXmlnsAttribute (Reader.Name)) { - } - else { - UnknownNode (ob); - } - } - - Reader.MoveToElement(); - if (Reader.IsEmptyElement) { - Reader.Skip (); - return ob; - } - - Reader.ReadStartElement(); - Reader.MoveToContent(); - - bool b58=false; - - while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) - { - if (Reader.NodeType == System.Xml.XmlNodeType.Element) - { - if (Reader.LocalName == "documentation" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b58) { - b58 = true; - ob.Documentation = Reader.ReadElementString (); - } - else { - UnknownNode (ob); - } - } - else - UnknownNode(ob); - - Reader.MoveToContent(); - } - - ReadEndElement(); - - return ob; - } - - protected override void InitCallbacks () - { - } - - protected override void InitIDs () - { - } - - } - - public class ServiceDescriptionWriterBase : XmlSerializationWriter - { - public void WriteTree (System.Web.Services.Description.ServiceDescription ob) - { - WriteStartDocument (); - TopLevelElement (); - WriteObject_ServiceDescription (ob, "definitions", "http://schemas.xmlsoap.org/wsdl/", true, false, true); - } - - void WriteObject_ServiceDescription (System.Web.Services.Description.ServiceDescription ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) - { - if (ob == null) - { - if (isNullable) - WriteNullTagLiteral(element, namesp); - return; - } - - if (writeWrappingElem) { - WriteStartElement (element, namesp, ob); - } - - if (needType) WriteXsiType("ServiceDescription", "http://schemas.xmlsoap.org/wsdl/"); - - WriteAttribute ("name", "", ob.Name.ToString()); - WriteAttribute ("targetNamespace", "", ob.TargetNamespace); - - ServiceDescription.WriteExtensions (Writer, ob); - if (ob.Imports != null) { - for (int n59 = 0; n59 < ob.Imports.Count; n59++) { - WriteObject_Import (ob.Imports[n59], "import", "http://schemas.xmlsoap.org/wsdl/", false, false, true); - } - } - WriteObject_Types (ob.Types, "types", "http://schemas.xmlsoap.org/wsdl/", false, false, true); - if (ob.Messages != null) { - for (int n60 = 0; n60 < ob.Messages.Count; n60++) { - WriteObject_Message (ob.Messages[n60], "message", "http://schemas.xmlsoap.org/wsdl/", false, false, true); - } - } - if (ob.PortTypes != null) { - for (int n61 = 0; n61 < ob.PortTypes.Count; n61++) { - WriteObject_PortType (ob.PortTypes[n61], "portType", "http://schemas.xmlsoap.org/wsdl/", false, false, true); - } - } - if (ob.Bindings != null) { - for (int n62 = 0; n62 < ob.Bindings.Count; n62++) { - WriteObject_Binding (ob.Bindings[n62], "binding", "http://schemas.xmlsoap.org/wsdl/", false, false, true); - } - } - if (ob.Services != null) { - for (int n63 = 0; n63 < ob.Services.Count; n63++) { - WriteObject_Service (ob.Services[n63], "service", "http://schemas.xmlsoap.org/wsdl/", false, false, true); - } - } - if (ob.Documentation != "") { - WriteElementString ("documentation", "http://schemas.xmlsoap.org/wsdl/", ob.Documentation); - } - if (writeWrappingElem) WriteEndElement (ob); - } - - void WriteObject_Import (System.Web.Services.Description.Import ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) - { - if (ob == null) - { - if (isNullable) - WriteNullTagLiteral(element, namesp); - return; - } - - if (writeWrappingElem) { - WriteStartElement (element, namesp, ob); - } - - if (needType) WriteXsiType("Import", "http://schemas.xmlsoap.org/wsdl/"); - - WriteAttribute ("namespace", "", ob.Namespace); - WriteAttribute ("location", "", ob.Location); - - if (ob.Documentation != "") { - WriteElementString ("documentation", "http://schemas.xmlsoap.org/wsdl/", ob.Documentation); - } - if (writeWrappingElem) WriteEndElement (ob); - } - - void WriteObject_Types (System.Web.Services.Description.Types ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) - { - if (ob == null) - { - if (isNullable) - WriteNullTagLiteral(element, namesp); - return; - } - - if (writeWrappingElem) { - WriteStartElement (element, namesp, ob); - } - - if (needType) WriteXsiType("Types", "http://schemas.xmlsoap.org/wsdl/"); - - ServiceDescription.WriteExtensions (Writer, ob); - if (ob.Schemas != null) { - for (int n64 = 0; n64 < ob.Schemas.Count; n64++) { - WriteObject_XmlSchema (ob.Schemas[n64], "schema", "http://www.w3.org/2001/XMLSchema", false, false, true); - } - } - if (ob.Documentation != "") { - WriteElementString ("documentation", "http://schemas.xmlsoap.org/wsdl/", ob.Documentation); - } - if (writeWrappingElem) WriteEndElement (ob); - } - - void WriteObject_Message (System.Web.Services.Description.Message ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) - { - if (ob == null) - { - if (isNullable) - WriteNullTagLiteral(element, namesp); - return; - } - - if (writeWrappingElem) { - WriteStartElement (element, namesp, ob); - } - - if (needType) WriteXsiType("Message", "http://schemas.xmlsoap.org/wsdl/"); - - WriteAttribute ("name", "", ob.Name.ToString()); - - if (ob.Parts != null) { - for (int n65 = 0; n65 < ob.Parts.Count; n65++) { - WriteObject_MessagePart (ob.Parts[n65], "part", "http://schemas.xmlsoap.org/wsdl/", false, false, true); - } - } - if (ob.Documentation != "") { - WriteElementString ("documentation", "http://schemas.xmlsoap.org/wsdl/", ob.Documentation); - } - if (writeWrappingElem) WriteEndElement (ob); - } - - void WriteObject_PortType (System.Web.Services.Description.PortType ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) - { - if (ob == null) - { - if (isNullable) - WriteNullTagLiteral(element, namesp); - return; - } - - if (writeWrappingElem) { - WriteStartElement (element, namesp, ob); - } - - if (needType) WriteXsiType("PortType", "http://schemas.xmlsoap.org/wsdl/"); - - WriteAttribute ("name", "", ob.Name.ToString()); - - if (ob.Operations != null) { - for (int n66 = 0; n66 < ob.Operations.Count; n66++) { - WriteObject_Operation (ob.Operations[n66], "operation", "http://schemas.xmlsoap.org/wsdl/", false, false, true); - } - } - if (ob.Documentation != "") { - WriteElementString ("documentation", "http://schemas.xmlsoap.org/wsdl/", ob.Documentation); - } - if (writeWrappingElem) WriteEndElement (ob); - } - - void WriteObject_Binding (System.Web.Services.Description.Binding ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) - { - if (ob == null) - { - if (isNullable) - WriteNullTagLiteral(element, namesp); - return; - } - - if (writeWrappingElem) { - WriteStartElement (element, namesp, ob); - } - - if (needType) WriteXsiType("Binding", "http://schemas.xmlsoap.org/wsdl/"); - - WriteAttribute ("name", "", ob.Name.ToString()); - WriteAttribute ("type", "", FromXmlQualifiedName (ob.Type)); - - ServiceDescription.WriteExtensions (Writer, ob); - if (ob.Operations != null) { - for (int n67 = 0; n67 < ob.Operations.Count; n67++) { - WriteObject_OperationBinding (ob.Operations[n67], "operation", "http://schemas.xmlsoap.org/wsdl/", false, false, true); - } - } - if (ob.Documentation != "") { - WriteElementString ("documentation", "http://schemas.xmlsoap.org/wsdl/", ob.Documentation); - } - if (writeWrappingElem) WriteEndElement (ob); - } - - void WriteObject_Service (System.Web.Services.Description.Service ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) - { - if (ob == null) - { - if (isNullable) - WriteNullTagLiteral(element, namesp); - return; - } - - if (writeWrappingElem) { - WriteStartElement (element, namesp, ob); - } - - if (needType) WriteXsiType("Service", "http://schemas.xmlsoap.org/wsdl/"); - - WriteAttribute ("name", "", ob.Name.ToString()); - - if (ob.Ports != null) { - for (int n68 = 0; n68 < ob.Ports.Count; n68++) { - WriteObject_Port (ob.Ports[n68], "port", "http://schemas.xmlsoap.org/wsdl/", false, false, true); - } - } - if (ob.Documentation != "") { - WriteElementString ("documentation", "http://schemas.xmlsoap.org/wsdl/", ob.Documentation); - } - if (writeWrappingElem) WriteEndElement (ob); - } - - void WriteObject_XmlSchema (System.Xml.Schema.XmlSchema ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) - { - ob.Write (Writer); - } - - void WriteObject_MessagePart (System.Web.Services.Description.MessagePart ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) - { - if (ob == null) - { - if (isNullable) - WriteNullTagLiteral(element, namesp); - return; - } - - if (writeWrappingElem) { - WriteStartElement (element, namesp, ob); - } - - if (needType) WriteXsiType("MessagePart", "http://schemas.xmlsoap.org/wsdl/"); - - WriteAttribute ("name", "", ob.Name.ToString()); - WriteAttribute ("element", "", FromXmlQualifiedName (ob.Element)); - WriteAttribute ("type", "", FromXmlQualifiedName (ob.Type)); - - if (ob.Documentation != "") { - WriteElementString ("documentation", "http://schemas.xmlsoap.org/wsdl/", ob.Documentation); - } - if (writeWrappingElem) WriteEndElement (ob); - } - - void WriteObject_Operation (System.Web.Services.Description.Operation ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) - { - if (ob == null) - { - if (isNullable) - WriteNullTagLiteral(element, namesp); - return; - } - - if (writeWrappingElem) { - WriteStartElement (element, namesp, ob); - } - - if (needType) WriteXsiType("Operation", "http://schemas.xmlsoap.org/wsdl/"); - - WriteAttribute ("name", "", ob.Name.ToString()); - if (ob.ParameterOrderString != "") { - WriteAttribute ("parameterOrder", "", ob.ParameterOrderString); - } - - if (ob.Faults != null) { - for (int n69 = 0; n69 < ob.Faults.Count; n69++) { - WriteObject_OperationFault (ob.Faults[n69], "fault", "http://schemas.xmlsoap.org/wsdl/", false, false, true); - } - } - if (ob.Messages != null) { - for (int n70 = 0; n70 < ob.Messages.Count; n70++) { - if (ob.Messages[n70] is System.Web.Services.Description.OperationInput) { - WriteObject_OperationInput (((System.Web.Services.Description.OperationInput) ob.Messages[n70]), "input", "http://schemas.xmlsoap.org/wsdl/", false, false, true); - } - else if (ob.Messages[n70] is System.Web.Services.Description.OperationOutput) { - WriteObject_OperationOutput (((System.Web.Services.Description.OperationOutput) ob.Messages[n70]), "output", "http://schemas.xmlsoap.org/wsdl/", false, false, true); - } - else if (ob.Messages[n70] != null) throw CreateUnknownTypeException (ob.Messages[n70]); - } - } - if (ob.Documentation != "") { - WriteElementString ("documentation", "http://schemas.xmlsoap.org/wsdl/", ob.Documentation); - } - if (writeWrappingElem) WriteEndElement (ob); - } - - void WriteObject_OperationBinding (System.Web.Services.Description.OperationBinding ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) - { - if (ob == null) - { - if (isNullable) - WriteNullTagLiteral(element, namesp); - return; - } - - if (writeWrappingElem) { - WriteStartElement (element, namesp, ob); - } - - if (needType) WriteXsiType("OperationBinding", "http://schemas.xmlsoap.org/wsdl/"); - - WriteAttribute ("name", "", ob.Name.ToString()); - - ServiceDescription.WriteExtensions (Writer, ob); - if (ob.Faults != null) { - for (int n71 = 0; n71 < ob.Faults.Count; n71++) { - WriteObject_FaultBinding (ob.Faults[n71], "fault", "http://schemas.xmlsoap.org/wsdl/", false, false, true); - } - } - WriteObject_InputBinding (ob.Input, "input", "http://schemas.xmlsoap.org/wsdl/", false, false, true); - WriteObject_OutputBinding (ob.Output, "output", "http://schemas.xmlsoap.org/wsdl/", false, false, true); - if (ob.Documentation != "") { - WriteElementString ("documentation", "http://schemas.xmlsoap.org/wsdl/", ob.Documentation); - } - if (writeWrappingElem) WriteEndElement (ob); - } - - void WriteObject_Port (System.Web.Services.Description.Port ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) - { - if (ob == null) - { - if (isNullable) - WriteNullTagLiteral(element, namesp); - return; - } - - if (writeWrappingElem) { - WriteStartElement (element, namesp, ob); - } - - if (needType) WriteXsiType("Port", "http://schemas.xmlsoap.org/wsdl/"); - - WriteAttribute ("name", "", ob.Name.ToString()); - WriteAttribute ("binding", "", FromXmlQualifiedName (ob.Binding)); - - ServiceDescription.WriteExtensions (Writer, ob); - if (ob.Documentation != "") { - WriteElementString ("documentation", "http://schemas.xmlsoap.org/wsdl/", ob.Documentation); - } - if (writeWrappingElem) WriteEndElement (ob); - } - - void WriteObject_OperationFault (System.Web.Services.Description.OperationFault ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) - { - if (ob == null) - { - if (isNullable) - WriteNullTagLiteral(element, namesp); - return; - } - - if (writeWrappingElem) { - WriteStartElement (element, namesp, ob); - } - - if (needType) WriteXsiType("OperationFault", "http://schemas.xmlsoap.org/wsdl/"); - - if (ob.Name != "") { - WriteAttribute ("name", "", ob.Name.ToString()); - } - WriteAttribute ("message", "", FromXmlQualifiedName (ob.Message)); - - if (ob.Documentation != "") { - WriteElementString ("documentation", "http://schemas.xmlsoap.org/wsdl/", ob.Documentation); - } - if (writeWrappingElem) WriteEndElement (ob); - } - - void WriteObject_OperationInput (System.Web.Services.Description.OperationInput ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) - { - if (ob == null) - { - if (isNullable) - WriteNullTagLiteral(element, namesp); - return; - } - - if (writeWrappingElem) { - WriteStartElement (element, namesp, ob); - } - - if (needType) WriteXsiType("OperationInput", "http://schemas.xmlsoap.org/wsdl/"); - - if (ob.Name != "") { - WriteAttribute ("name", "", ob.Name.ToString()); - } - WriteAttribute ("message", "", FromXmlQualifiedName (ob.Message)); - - if (ob.Documentation != "") { - WriteElementString ("documentation", "http://schemas.xmlsoap.org/wsdl/", ob.Documentation); - } - if (writeWrappingElem) WriteEndElement (ob); - } - - void WriteObject_OperationOutput (System.Web.Services.Description.OperationOutput ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) - { - if (ob == null) - { - if (isNullable) - WriteNullTagLiteral(element, namesp); - return; - } - - if (writeWrappingElem) { - WriteStartElement (element, namesp, ob); - } - - if (needType) WriteXsiType("OperationOutput", "http://schemas.xmlsoap.org/wsdl/"); - - if (ob.Name != "") { - WriteAttribute ("name", "", ob.Name.ToString()); - } - WriteAttribute ("message", "", FromXmlQualifiedName (ob.Message)); - - if (ob.Documentation != "") { - WriteElementString ("documentation", "http://schemas.xmlsoap.org/wsdl/", ob.Documentation); - } - if (writeWrappingElem) WriteEndElement (ob); - } - - void WriteObject_FaultBinding (System.Web.Services.Description.FaultBinding ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) - { - if (ob == null) - { - if (isNullable) - WriteNullTagLiteral(element, namesp); - return; - } - - if (writeWrappingElem) { - WriteStartElement (element, namesp, ob); - } - - if (needType) WriteXsiType("FaultBinding", "http://schemas.xmlsoap.org/wsdl/"); - - if (ob.Name != "") { - WriteAttribute ("name", "", ob.Name.ToString()); - } - - ServiceDescription.WriteExtensions (Writer, ob); - if (ob.Documentation != "") { - WriteElementString ("documentation", "http://schemas.xmlsoap.org/wsdl/", ob.Documentation); - } - if (writeWrappingElem) WriteEndElement (ob); - } - - void WriteObject_InputBinding (System.Web.Services.Description.InputBinding ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) - { - if (ob == null) - { - if (isNullable) - WriteNullTagLiteral(element, namesp); - return; - } - - if (writeWrappingElem) { - WriteStartElement (element, namesp, ob); - } - - if (needType) WriteXsiType("InputBinding", "http://schemas.xmlsoap.org/wsdl/"); - - if (ob.Name != "") { - WriteAttribute ("name", "", ob.Name.ToString()); - } - - ServiceDescription.WriteExtensions (Writer, ob); - if (ob.Documentation != "") { - WriteElementString ("documentation", "http://schemas.xmlsoap.org/wsdl/", ob.Documentation); - } - if (writeWrappingElem) WriteEndElement (ob); - } - - void WriteObject_OutputBinding (System.Web.Services.Description.OutputBinding ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) - { - if (ob == null) - { - if (isNullable) - WriteNullTagLiteral(element, namesp); - return; - } - - if (writeWrappingElem) { - WriteStartElement (element, namesp, ob); - } - - if (needType) WriteXsiType("OutputBinding", "http://schemas.xmlsoap.org/wsdl/"); - - if (ob.Name != "") { - WriteAttribute ("name", "", ob.Name.ToString()); - } - - ServiceDescription.WriteExtensions (Writer, ob); - if (ob.Documentation != "") { - WriteElementString ("documentation", "http://schemas.xmlsoap.org/wsdl/", ob.Documentation); - } - if (writeWrappingElem) WriteEndElement (ob); - } - - protected override void InitCallbacks () - { - } - - } -} diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapBinding.cs index 762ce5905df..05f24f0c741 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapBinding.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapBinding.cs @@ -20,7 +20,7 @@ namespace System.Web.Services.Description { #region Fields
- public const string HttpTransport = "http://schemas.xmlsoap.org/soap/http";
+ public const string HttpTransport = "http://schemas.xmlsoap.org/soap/http/";
public const string Namespace = "http://schemas.xmlsoap.org/wsdl/soap/";
SoapBindingStyle style;
@@ -58,4 +58,4 @@ namespace System.Web.Services.Description { #endregion // Properties
}
-} +}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapBodyBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapBodyBinding.cs index ba92a8bcba6..963f9d2e4de 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapBodyBinding.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapBodyBinding.cs @@ -60,7 +60,7 @@ namespace System.Web.Services.Description { [XmlAttribute ("parts", DataType = "NMTOKENS")]
public string PartsString {
- get { return (Parts != null) ? String.Join (" ", Parts) : null; }
+ get { return String.Join (" ", Parts); }
set { Parts = value.Split (' '); }
}
@@ -73,4 +73,4 @@ namespace System.Web.Services.Description { #endregion // Properties
}
-} +}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapOperationBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapOperationBinding.cs index abdfad97932..81492c78049 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapOperationBinding.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapOperationBinding.cs @@ -12,7 +12,7 @@ using System.Web.Services.Configuration; using System.Xml.Serialization;
namespace System.Web.Services.Description {
- [XmlFormatExtension ("operation", "http://schemas.xmlsoap.org/wsdl/soap/", typeof (OperationBinding))]
+ [XmlFormatExtension ("operation", "http://schema.xmlsoap.org/wsdl/soap/", typeof (OperationBinding))]
public sealed class SoapOperationBinding : ServiceDescriptionFormatExtension {
#region Fields
@@ -53,4 +53,4 @@ namespace System.Web.Services.Description { #endregion // Properties
}
-} +}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog b/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog index 1685973504b..d506fe72044 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog +++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog @@ -1,27 +1,3 @@ -2003-09-04 Lluis Sanchez Gual <lluis@ximian.com> - - * Methods.cs: Added support for bare parameter style. Fixed some defaults. - -2003-09-01 Lluis Sanchez Gual <lluis@ximian.com> - - * Methods.cs: In TypeStubInfo, added Documentation field. - -2003-07-28 Lluis Sanchez Gual <lluis@ximian.com> - - * HttpSoapWebServiceHandler.cs: - * Methods.cs: Added SoapBindingStyle, SoapBindingUse, InputMembersMapping - and OutputMembersMapping properties in MethodStubInfo. - Use default value defined in TypeStubInfo for RequestNamespace, - ResponseNamespace and other properties. - Added class BindingInfo to store information about class bindings. - In TypeStubInfo added SoapBindingStyle, DefaultBinding, Methods and - Bindings properties. - * SoapRpcMethodAttribute.cs: Use WebServiceAttribute.DefaultNamespace constant - instead of hardcoded namespace name. - * WebServiceHandlerFactory.cs: Create new SoapDocumentationHandler for - documentation requests. - * SoapDocumentationHandler.cs: new handler that generates WS documentation. - 2003-07-22 Lluis Sanchez Gual <lluis@ximian.com> * WebServiceHandler.cs: Fixed Invoke(). ParameterInfo.Position is now diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/Methods.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/Methods.cs index 986215ad545..ee47b71c5b8 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/Methods.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/Methods.cs @@ -43,8 +43,6 @@ namespace System.Web.Services.Protocols { internal bool OneWay; internal SoapParameterStyle ParameterStyle; - internal SoapBindingStyle SoapBindingStyle; - internal SoapBindingUse Use; internal bool BufferResponse; internal int CacheDuration; @@ -57,18 +55,6 @@ namespace System.Web.Services.Protocols { internal HeaderInfo[] Headers; internal SoapExtensionRuntimeConfig[] SoapExtensions; - - private XmlMembersMapping[] _membersMapping; - - internal XmlMembersMapping InputMembersMapping - { - get { return _membersMapping[0]; } - } - - internal XmlMembersMapping OutputMembersMapping - { - get { return _membersMapping[1]; } - } // // Constructor @@ -78,23 +64,23 @@ namespace System.Web.Services.Protocols { MethodInfo = source; XmlElementAttribute optional_ns = null; + SoapBindingUse use; if (kind == null) { - Use = parent.Use; + use = parent.Use; RequestName = ""; RequestNamespace = parent.WebServiceNamespace; ResponseName = ""; ResponseNamespace = parent.WebServiceNamespace; ParameterStyle = parent.ParameterStyle; - SoapBindingStyle = parent.SoapBindingStyle; OneWay = false; } else if (kind is SoapDocumentMethodAttribute){ SoapDocumentMethodAttribute dma = (SoapDocumentMethodAttribute) kind; - Use = dma.Use; - if (Use == SoapBindingUse.Default) - Use = parent.Use; + use = dma.Use; + if (use == SoapBindingUse.Default) + use = parent.Use; Action = dma.Action; Binding = dma.Binding; @@ -106,10 +92,9 @@ namespace System.Web.Services.Protocols { if (ParameterStyle == SoapParameterStyle.Default) ParameterStyle = parent.ParameterStyle; OneWay = dma.OneWay; - SoapBindingStyle = SoapBindingStyle.Document; } else { SoapRpcMethodAttribute rma = (SoapRpcMethodAttribute) kind; - Use = SoapBindingUse.Encoded; // RPC always use encoded + use = SoapBindingUse.Encoded; // RPC always use encoded Action = rma.Action; Binding = rma.Binding; @@ -117,9 +102,7 @@ namespace System.Web.Services.Protocols { RequestNamespace = rma.RequestNamespace; ResponseNamespace = rma.ResponseNamespace; ResponseName = rma.ResponseElementName; - ParameterStyle = SoapParameterStyle.Wrapped; OneWay = rma.OneWay; - SoapBindingStyle = SoapBindingStyle.Rpc; // For RPC calls, make all arguments be part of the empty namespace optional_ns = new XmlElementAttribute (); @@ -147,33 +130,28 @@ namespace System.Web.Services.Protocols { } else Name = source.Name; - if (RequestNamespace == "") RequestNamespace = parent.WebServiceNamespace; - if (ResponseNamespace == "") ResponseNamespace = parent.WebServiceNamespace; - if (RequestName == "") RequestName = Name; - if (ResponseName == "") ResponseName = Name + "Response"; - if (Binding == null) Binding = parent.DefaultBinding; - - if (Action == null || Action == "") - Action = RequestNamespace.EndsWith("/") ? (RequestNamespace + Name) : (RequestNamespace + "/" + Name); - - bool hasWrappingElem = (ParameterStyle == SoapParameterStyle.Wrapped); - + if (RequestName == "") + RequestName = Name; + + if (ResponseName == "") + ResponseName = Name + "Response"; + XmlReflectionMember [] in_members = BuildRequestReflectionMembers (optional_ns); XmlReflectionMember [] out_members = BuildResponseReflectionMembers (optional_ns); - _membersMapping = new XmlMembersMapping [2]; + XmlMembersMapping [] members = new XmlMembersMapping [2]; - if (Use == SoapBindingUse.Literal) { - _membersMapping [0] = xmlImporter.ImportMembersMapping (RequestName, RequestNamespace, in_members, hasWrappingElem); - _membersMapping [1] = xmlImporter.ImportMembersMapping (ResponseName, ResponseNamespace, out_members, hasWrappingElem); + if (use == SoapBindingUse.Literal) { + members [0] = xmlImporter.ImportMembersMapping (RequestName, RequestNamespace, in_members, true); + members [1] = xmlImporter.ImportMembersMapping (ResponseName, ResponseNamespace, out_members, true); } else { - _membersMapping [0] = soapImporter.ImportMembersMapping (RequestName, RequestNamespace, in_members, hasWrappingElem, true); - _membersMapping [1] = soapImporter.ImportMembersMapping (ResponseName, ResponseNamespace, out_members, hasWrappingElem, true); + members [0] = soapImporter.ImportMembersMapping (RequestName, RequestNamespace, in_members, true, true); + members [1] = soapImporter.ImportMembersMapping (ResponseName, ResponseNamespace, out_members, true, true); } XmlSerializer [] s = null; - s = XmlSerializer.FromMappings (_membersMapping); + s = XmlSerializer.FromMappings (members); RequestSerializer = s [0]; ResponseSerializer = s [1]; @@ -329,27 +307,6 @@ namespace System.Web.Services.Protocols { public string faultactor; public XmlNode detail; } - - internal class BindingInfo - { - public BindingInfo (WebServiceBindingAttribute at, string ns) - { - Name = at.Name; - Namespace = at.Namespace; - if (Namespace == "") Namespace = ns; - Location = at.Location; - } - - public BindingInfo (string name, string ns) - { - Name = name; - Namespace = ns; - } - - public string Name; - public string Namespace; - public string Location; - } // // Holds the metadata loaded from the type stub, as well as @@ -359,8 +316,7 @@ namespace System.Web.Services.Protocols { Hashtable name_to_method = new Hashtable (); Hashtable header_serializers = new Hashtable (); Hashtable header_serializers_byname = new Hashtable (); - ArrayList bindings = new ArrayList (); - ArrayList methods = new ArrayList (); + Hashtable bindings = new Hashtable (); // Precomputed internal SoapParameterStyle ParameterStyle; @@ -368,34 +324,28 @@ namespace System.Web.Services.Protocols { internal SoapBindingUse Use; internal string WebServiceName; internal string WebServiceNamespace; - internal string DefaultBinding; - internal string Description; internal XmlSerializer FaultSerializer; internal SoapExtensionRuntimeConfig[][] SoapExtensions; - internal SoapBindingStyle SoapBindingStyle; void GetTypeAttributes (Type t) { object [] o; + o = t.GetCustomAttributes (typeof (WebServiceBindingAttribute), false); + + foreach (WebServiceBindingAttribute at in o) + bindings.Add (((WebServiceBindingAttribute)at).Name, at); + o = t.GetCustomAttributes (typeof (WebServiceAttribute), false); if (o.Length == 1){ WebServiceAttribute a = (WebServiceAttribute) o [0]; - WebServiceName = (a.Name != string.Empty) ? a.Name : t.Name; - WebServiceNamespace = (a.Namespace != string.Empty) ? a.Namespace : WebServiceAttribute.DefaultNamespace; - Description = a.Description; + + WebServiceName = a.Name; + WebServiceNamespace = a.Namespace; } else { WebServiceName = t.Name; WebServiceNamespace = WebServiceAttribute.DefaultNamespace; } - - DefaultBinding = WebServiceName + "Soap"; - BindingInfo binfo = new BindingInfo (DefaultBinding, WebServiceNamespace); - bindings.Add (binfo); - - o = t.GetCustomAttributes (typeof (WebServiceBindingAttribute), false); - foreach (WebServiceBindingAttribute at in o) - bindings.Add (new BindingInfo (at, WebServiceNamespace)); o = t.GetCustomAttributes (typeof (SoapDocumentServiceAttribute), false); if (o.Length == 1){ @@ -404,7 +354,6 @@ namespace System.Web.Services.Protocols { ParameterStyle = a.ParameterStyle; RoutingStyle = a.RoutingStyle; Use = a.Use; - SoapBindingStyle = SoapBindingStyle.Document; } else { o = t.GetCustomAttributes (typeof (SoapRpcServiceAttribute), false); if (o.Length == 1){ @@ -412,19 +361,13 @@ namespace System.Web.Services.Protocols { ParameterStyle = SoapParameterStyle.Wrapped; RoutingStyle = srs.RoutingStyle; - Use = SoapBindingUse.Encoded; - SoapBindingStyle = SoapBindingStyle.Rpc; + Use = SoapBindingUse.Literal; } else { ParameterStyle = SoapParameterStyle.Wrapped; RoutingStyle = SoapServiceRoutingStyle.SoapAction; Use = SoapBindingUse.Literal; - SoapBindingStyle = SoapBindingStyle.Document; } } - - if (ParameterStyle == SoapParameterStyle.Default) ParameterStyle = SoapParameterStyle.Wrapped; - if (Use == SoapBindingUse.Default) Use = SoapBindingUse.Literal; - FaultSerializer = new XmlSerializer (typeof(Fault)); SoapExtensions = SoapExtension.GetTypeExtensions (t); } @@ -444,7 +387,6 @@ namespace System.Web.Services.Protocols { continue; name_to_method [msi.Name] = msi; - this.methods.Add (msi); } } @@ -462,6 +404,8 @@ namespace System.Web.Services.Protocols { return (MethodStubInfo) name_to_method [name]; } + + internal void RegisterHeaderType (Type type) { XmlSerializer s = (XmlSerializer) header_serializers [type]; @@ -484,16 +428,6 @@ namespace System.Web.Services.Protocols { { return (XmlSerializer) header_serializers_byname [qname]; } - - internal ArrayList Methods - { - get { return methods; } - } - - internal ArrayList Bindings - { - get { return bindings; } - } } // diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapDocumentationHandler.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapDocumentationHandler.cs deleted file mode 100644 index c21696759b3..00000000000 --- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapDocumentationHandler.cs +++ /dev/null @@ -1,102 +0,0 @@ -// -// System.Web.Services.Protocols.SoapDocumentationHandler.cs -// -// Author: -// Lluis Sanchez Gual (lluis@ximian.com) -// -// Copyright (C) Ximian, Inc. 2003 -// - -using System; -using System.Web; -using System.IO; -using System.Xml.Serialization; -using System.Web.Services.Description; -using System.Web.Services.Configuration; - -namespace System.Web.Services.Protocols -{ - internal class SoapDocumentationHandler: WebServiceHandler - { - Type _type; - TypeStubInfo _typeStubInfo; - ServiceDescriptionCollection _descriptions; - XmlSchemas _schemas; - string _url; - - public SoapDocumentationHandler (Type type, HttpContext context) - { - _type = type; - _url = context.Request.Url.ToString(); - int i = _url.LastIndexOf ('?'); - if (i != -1) _url = _url.Substring (0,i); - _typeStubInfo = TypeStubManager.GetTypeStub (_type); - } - - public override bool IsReusable - { - get { return false; } - } - - public override void ProcessRequest (HttpContext context) - { - HttpRequest req = context.Request; - if (req.QueryString.Count == 1) - { - string key = req.QueryString.GetKey(0).ToLower(); - if (key == "wsdl") GenerateWsdlDocument (context, req.QueryString ["wsdl"]); - else if (key == "schema") GenerateSchema (context, req.QueryString ["schema"]); - else GenerateDocumentationPage (context); - } - else - GenerateDocumentationPage (context); - } - - void GenerateDocumentationPage (HttpContext context) - { - context.Items["wsdls"] = GetDescriptions (); - context.Items["schemas"] = GetSchemas (); - context.Server.Transfer (WSConfig.Instance.WsdlHelpPage, true); - } - - void GenerateWsdlDocument (HttpContext context, string wsdlId) - { - int di = 0; - if (wsdlId != null && wsdlId != "") di = int.Parse (wsdlId); - - context.Response.ContentType = "text/xml; charset=utf-8"; - Stream outStream = context.Response.OutputStream; - GetDescriptions() [di].Write (outStream); - outStream.Close (); - } - - void GenerateSchema (HttpContext context, string schemaId) - { - int di = 0; - if (schemaId != null && schemaId != "") di = int.Parse (schemaId); - - context.Response.ContentType = "text/xml; charset=utf-8"; - Stream outStream = context.Response.OutputStream; - GetSchemas() [di].Write (outStream); - outStream.Close (); - } - - ServiceDescriptionCollection GetDescriptions () - { - if (_descriptions == null) - { - ServiceDescriptionReflector reflector = new ServiceDescriptionReflector (); - reflector.Reflect (_type,_url); - _schemas = reflector.Schemas; - _descriptions = reflector.ServiceDescriptions; - } - return _descriptions; - } - - XmlSchemas GetSchemas() - { - GetDescriptions(); - return _schemas; - } - } -} diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapRpcMethodAttribute.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapRpcMethodAttribute.cs index 37a714ac002..71a5148c0d7 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapRpcMethodAttribute.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapRpcMethodAttribute.cs @@ -31,9 +31,9 @@ namespace System.Web.Services.Protocols { binding = ""; // FIXME
oneWay = false;
requestElementName = ""; // FIXME
- requestNamespace = WebServiceAttribute.DefaultNamespace;
+ requestNamespace = "http://tempuri.org/";
responseElementName = "";
- responseNamespace = WebServiceAttribute.DefaultNamespace;
+ responseNamespace = "http://tempuri.org/";
}
public SoapRpcMethodAttribute (string action)
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHandlerFactory.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHandlerFactory.cs index 0b12c484286..91d0ec9d271 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHandlerFactory.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHandlerFactory.cs @@ -14,7 +14,6 @@ using System.Web.Services; using System.Web.Services.Configuration; using System.Web.UI; -using System.Collections.Specialized; namespace System.Web.Services.Protocols { @@ -62,7 +61,7 @@ namespace System.Web.Services.Protocols //handler = new (); break; case WSProtocol.Documentation: - handler = new SoapDocumentationHandler (type, context); + //handler = new (); break; } @@ -75,10 +74,7 @@ namespace System.Web.Services.Protocols static WSProtocol GuessProtocol (HttpContext context, string verb) { - if (context.Request.RequestType == "GET") - return WSProtocol.Documentation; - else - return WSProtocol.HttpSoap; + return WSProtocol.HttpSoap; } public void ReleaseHandler (IHttpHandler handler) diff --git a/mcs/class/System.Web.Services/System.Web.Services.dll.sources b/mcs/class/System.Web.Services/System.Web.Services.dll.sources index 88fd11ba234..43b313e9a1a 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.dll.sources +++ b/mcs/class/System.Web.Services/System.Web.Services.dll.sources @@ -64,9 +64,7 @@ System.Web.Services.Description/ServiceDescriptionFormatExtensionCollection.cs System.Web.Services.Description/ServiceDescriptionImportStyle.cs System.Web.Services.Description/ServiceDescriptionImportWarnings.cs System.Web.Services.Description/ServiceDescriptionImporter.cs -System.Web.Services.Description/ServiceDescriptionSerializerBase.cs System.Web.Services.Description/ServiceDescriptionReflector.cs -System.Web.Services.Description/ExtensionManager.cs System.Web.Services.Description/SoapAddressBinding.cs System.Web.Services.Description/SoapBinding.cs System.Web.Services.Description/SoapBindingStyle.cs @@ -106,7 +104,6 @@ System.Web.Services.Protocols/PatternMatcher.cs System.Web.Services.Protocols/ServerProtocol.cs System.Web.Services.Protocols/SoapClientMessage.cs System.Web.Services.Protocols/SoapClientMethod.cs -System.Web.Services.Protocols/SoapDocumentationHandler.cs System.Web.Services.Protocols/SoapDocumentMethodAttribute.cs System.Web.Services.Protocols/SoapDocumentServiceAttribute.cs System.Web.Services.Protocols/SoapException.cs diff --git a/mcs/class/System.Web/System.Web.Hosting/ApplicationHost.cs b/mcs/class/System.Web/System.Web.Hosting/ApplicationHost.cs index e3e9731a505..d3aad6f3de1 100644 --- a/mcs/class/System.Web/System.Web.Hosting/ApplicationHost.cs +++ b/mcs/class/System.Web/System.Web.Hosting/ApplicationHost.cs @@ -10,7 +10,6 @@ using System; using System.Collections; using System.IO; using System.Runtime.Remoting; -using System.Web.Util; namespace System.Web.Hosting { @@ -63,7 +62,8 @@ namespace System.Web.Hosting domain.SetData (key, (string) hTable [key]); domain.SetData (".hostingVirtualPath", virtualDir); - domain.SetData (".hostingInstallDir", ICalls.GetMachineInstallDirectory ()); + //FIXME: this should be the directory where dlls reside. + domain.SetData (".hostingInstallDir", "FIXME hostingInstallDir"); InitConfigInNewAppDomain (domain); ObjectHandle o = domain.CreateInstance (hostType.Assembly.FullName, hostType.FullName); diff --git a/mcs/class/System.Web/System.Web.Hosting/ChangeLog b/mcs/class/System.Web/System.Web.Hosting/ChangeLog index 96e8991afcb..6521b150df7 100644 --- a/mcs/class/System.Web/System.Web.Hosting/ChangeLog +++ b/mcs/class/System.Web/System.Web.Hosting/ChangeLog @@ -1,13 +1,3 @@ -2003-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * ApplicationHost.cs: set hostingInstallDir. - * SimpleWorkerRequest.cs: implemented a couple of properties. - -2003-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * SimpleWorkerRequest.cs: fixed GetFilePathTranslated and added a - paranoid condition to ExtractPathInfo. - 2003-06-25 Eric Lindvall <eric@5stops.com> * SimpleWorkerRequest.cs: diff --git a/mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs b/mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs index a92a1e8329d..4591e038e92 100644 --- a/mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs +++ b/mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs @@ -9,7 +9,6 @@ using System; using System.IO; using System.Text; -using System.Web.Util; namespace System.Web.Hosting { @@ -85,13 +84,16 @@ namespace System.Web.Hosting if (_HasInstallInfo) return _AppInstallPath; - return ICalls.GetMachineInstallDirectory (); + return null; } } + [MonoTODO("Get config path from Web.Config class")] public override string MachineConfigPath { - get { return ICalls.GetMachineConfigPath (); } + get { + return "MachineConfigPath"; //FIXME + } } public override void EndOfRequest () @@ -122,11 +124,10 @@ namespace System.Web.Hosting string page = _Page; if (Path.DirectorySeparatorChar != '/') + { page = _Page.Replace ('/', Path.DirectorySeparatorChar); + } - if (page [0] == Path.DirectorySeparatorChar) - page = page.Substring (1); - return (Path.Combine (_AppPhysicalPath, page)); } @@ -273,45 +274,56 @@ namespace System.Web.Hosting return sPath; } - // "The extra path information, as given by the client. In - // other words, scripts can be accessed by their virtual - // pathname, followed by extra information at the end of this - // path. The extra information is sent as PATH_INFO." - private void ExtractPagePathInfo () - { - if (_Page == null || _Page == String.Empty) - return; - - string FullPath = GetFilePathTranslated (); - int PathInfoLength = 0; - string LastFile = String.Empty; + // "The extra path information, as given by the client. In + // other words, scripts can be accessed by their virtual + // pathname, followed by extra information at the end of this + // path. The extra information is sent as PATH_INFO." + private void ExtractPagePathInfo () + { + if (_Page == null || _Page == String.Empty) + { + return; + } - while (PathInfoLength < _Page.Length) { - if (LastFile.Length > 0) { - // increase it by the length of the file plus - // a "/" - // - PathInfoLength += LastFile.Length + 1; - } + string FullPath = GetFilePathTranslated(); - if (File.Exists (FullPath) == true) - break; + int PathInfoLength = 0; - if (Directory.Exists (FullPath) == true) { - PathInfoLength -= (LastFile.Length + 1); - break; - } + string LastFile = String.Empty; - LastFile = Path.GetFileName (FullPath); - FullPath = Path.GetDirectoryName (FullPath); - } + while (PathInfoLength < _Page.Length) + { + if (LastFile.Length > 0) + { + // increase it by the length of the file plus + // a "/" + // + PathInfoLength += LastFile.Length + 1; + } + + if (File.Exists (FullPath) == true) + { + break; + } + + if (Directory.Exists (FullPath) == true) + { + PathInfoLength -= (LastFile.Length + 1); + break; + } + + LastFile = Path.GetFileName (FullPath); + FullPath = Path.GetDirectoryName (FullPath); + } - if (PathInfoLength <= 0 || PathInfoLength > _Page.Length) - return; + if (PathInfoLength > _Page.Length) + { + return; + } - _PathInfo = _Page.Substring (_Page.Length - PathInfoLength); - _Page = _Page.Substring (0, _Page.Length - PathInfoLength); - } + _PathInfo = _Page.Substring (_Page.Length - PathInfoLength); + _Page = _Page.Substring (0, _Page.Length - PathInfoLength); + } } } diff --git a/mcs/class/System.Web/System.Web.Security/ChangeLog b/mcs/class/System.Web/System.Web.Security/ChangeLog index 009d458eb32..11fe7b35129 100644 --- a/mcs/class/System.Web/System.Web.Security/ChangeLog +++ b/mcs/class/System.Web/System.Web.Security/ChangeLog @@ -1,7 +1,3 @@ -2003-08-27 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * UrlAuthorizationModule.cs: fixed description for status code. - 2003-07-31 Gonzalo Paniagua Javier <gonzalo@ximian.com> * FormsAuthenticationModule.cs: really renew the ticket. Thanks to diff --git a/mcs/class/System.Web/System.Web.Security/UrlAuthorizationModule.cs b/mcs/class/System.Web/System.Web.Security/UrlAuthorizationModule.cs index 698a10f5f0f..1463d716c56 100644 --- a/mcs/class/System.Web/System.Web.Security/UrlAuthorizationModule.cs +++ b/mcs/class/System.Web/System.Web.Security/UrlAuthorizationModule.cs @@ -41,7 +41,7 @@ namespace System.Web.Security return; if (!config.IsValidUser (context.User, context.Request.HttpMethod)) { - HttpException e = new HttpException (401, "Unauthorized"); + HttpException e = new HttpException (401, "Forbidden"); context.Response.StatusCode = 401; context.Response.Write (e.GetHtmlErrorMessage ()); diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog b/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog index 3c9c23f4aff..337eecf9941 100644 --- a/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog +++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog @@ -1,8 +1,3 @@ -2003-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * HtmlGenericControl.cs: ConstructorNeedsTag defaults to false so we - need to pass true here. Fixes bug #47918. - 2003-07-17 Andreas Nahr <ClassDevelopment@A-SoftTech.com> * HtmlContainerControl.cs: Added attributes diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlGenericControl.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlGenericControl.cs index ca8940adb1d..bd5c1432efb 100644 --- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlGenericControl.cs +++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlGenericControl.cs @@ -16,7 +16,7 @@ using System.Web.UI; namespace System.Web.UI.HtmlControls{ - [ConstructorNeedsTag(true)] + [ConstructorNeedsTag] public class HtmlGenericControl : HtmlContainerControl { public HtmlGenericControl() : this ("span") diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog b/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog index 0a081fdd7d8..91ae8f5eb90 100644 --- a/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog +++ b/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog @@ -1,44 +1,3 @@ -2003-08-31 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * Repeater.cs: fix for Items property provided by yaronsh@mainsoft.com - (Yaron Shkop). Closes bug #48060. - -2003-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * CheckBox.cs: in LoadPostData, only return - true when the new data is different from the one we had. Fixed - conditions to save Checked state. Thanks to yaronshkop@hotmail.com - (Yaron Shkop). - -2003-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * Style.cs: Font.Strikeout renders as 'line-through'. Fixes bug #47871. - -2003-08-25 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * WebControl.cs: removed dangling ^M and unneeded fields. Keep track - of Enable in ViewState. Fixes bug #47865. - -2003-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * Style.cs: the MARKED bit is not send set in ViewState unless something - is changed. Fixed TrackViewState condition. - - * WebControl.cs: save the base ViewState *after* ControlStyle is done, - because it uses the same ViewState as the control. Fixes bug #47725. - -2003-08-16 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * HyperLinkColumn.cs: patch from David Pickens <dsp@rci.rutgers.edu> - that fixes databinding when only DataTextField or DataNavigateUrlField - is set. - -2003-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * ListControl.cs: patch sent by Yaacov Akiba Slama <ya@slamail.org> on - behalf of Yaron Shkop <yaronsh@mainsoft.com> that fixes selection of - values before assigning a data source and other issues. - 2003-08-11 Gonzalo Paniagua Javier <gonzalo@ximian.com> * CheckBox.cs: save viewstate when needed and correctly handle post diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CheckBox.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CheckBox.cs index 6bf54d48105..bef20829b03 100644 --- a/mcs/class/System.Web/System.Web.UI.WebControls/CheckBox.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/CheckBox.cs @@ -74,11 +74,18 @@ namespace System.Web.UI.WebControls private bool SaveCheckedViewState { get { - if (Events [CheckedChangedEvent] != null || !Enabled) - return true; + if (Events [CheckedChangedEvent] != null){ + if (!Enabled) + return true; - Type type = GetType (); - return (type != typeof (CheckBox) && type != typeof (RadioButton)); + Type type = GetType (); + if (type == typeof (CheckBox)) + return false; + + if (type == typeof (RadioButton)) + return false; + } + return true; } } @@ -204,12 +211,13 @@ namespace System.Web.UI.WebControls bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection) { string postedVal = postCollection [postDataKey]; - bool haveData = (postedVal != null && postedVal.Length > 0); - if (haveData == Checked) - return false; - Checked = haveData; - return true;; + if (postedVal != null && postedVal.Length > 0) { + Checked = !Checked; + return true; + } + + return false; } void IPostBackDataHandler.RaisePostDataChangedEvent() diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkColumn.cs b/mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkColumn.cs index 4c06d734d29..da18a2d4b1c 100644 --- a/mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkColumn.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkColumn.cs @@ -166,41 +166,37 @@ namespace System.Web.UI.WebControls }
}
- private void OnDataBindHyperLinkColumn (object sender, EventArgs e) - { - HyperLink link = (HyperLink) sender; - object item = ((DataGridItem) link.NamingContainer).DataItem; - - PropertyDescriptorCollection properties = TypeDescriptor.GetProperties (item); - if (textFieldDescriptor == null) - textFieldDescriptor = properties.Find (DataTextField, true); - - if (urlFieldDescriptor == null) - urlFieldDescriptor = properties.Find (DataNavigateUrlField, true); - - if (DataTextField.Length > 0 && textFieldDescriptor == null && !DesignMode) - throw new HttpException (HttpRuntime.FormatResourceString ( - "Field_Not_Found", DataTextField)); - - if (DataNavigateUrlField.Length > 0 && urlFieldDescriptor == null && !DesignMode) - throw new HttpException (HttpRuntime.FormatResourceString ( - "Field_Not_Found", DataNavigateUrlField)); - - if (textFieldDescriptor != null) { - link.Text = FormatDataTextValue (textFieldDescriptor.GetValue (item)); - } else if ( Text != String.Empty ) { - link.Text = Text; - } else { - link.Text = "Sample_DataBound_Text"; - } - - if (urlFieldDescriptor != null) { - link.NavigateUrl = FormatDataNavigateUrlValue (urlFieldDescriptor.GetValue (item)); - } else { - link.NavigateUrl = "url"; - } - } - + private void OnDataBindHyperLinkColumn (object sender, EventArgs e)
+ {
+ HyperLink link = (HyperLink) sender;
+ object item = ((DataGridItem) link.NamingContainer).DataItem;
+
+ if (textFieldDescriptor == null && urlFieldDescriptor == null) {
+ PropertyDescriptorCollection properties = TypeDescriptor.GetProperties (item);
+ textFieldDescriptor = properties.Find (DataTextField, true);
+ if (textFieldDescriptor == null && !DesignMode)
+ throw new HttpException (HttpRuntime.FormatResourceString (
+ "Field_Not_Found", DataTextField));
+
+ urlFieldDescriptor = properties.Find (DataNavigateUrlField, true);
+ if (urlFieldDescriptor == null && !DesignMode)
+ throw new HttpException (HttpRuntime.FormatResourceString (
+ "Field_Not_Found", DataNavigateUrlField));
+ }
+
+ if (textFieldDescriptor != null) {
+ link.Text = FormatDataTextValue (textFieldDescriptor.GetValue (item));
+ } else {
+ link.Text = "Sample_DataBound_Text";
+ }
+
+ if (urlFieldDescriptor != null) {
+ link.NavigateUrl = FormatDataNavigateUrlValue (urlFieldDescriptor.GetValue (item));
+ } else {
+ link.NavigateUrl = "url";
+ }
+ }
+
protected virtual string FormatDataNavigateUrlValue (object dataUrlValue)
{
if (dataUrlValue == null)
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ListControl.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ListControl.cs index 1c869dca233..4b2913d3c8c 100644 --- a/mcs/class/System.Web/System.Web.UI.WebControls/ListControl.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/ListControl.cs @@ -32,7 +32,6 @@ namespace System.Web.UI.WebControls private ListItemCollection items;
private int cachedSelectedIndex = -1;
- private string cachedSelectedValue; public ListControl(): base(HtmlTextWriterTag.Select)
{
@@ -98,10 +97,14 @@ namespace System.Web.UI.WebControls }
set
{
- if(value == null || value is IListSource || value is IEnumerable) { - dataSource = value; - return; - } + if(value != null)
+ {
+ if(value is IListSource || value is IEnumerable)
+ {
+ dataSource = value;
+ return;
+ }
+ }
throw new ArgumentException(HttpRuntime.FormatResourceString(ID, "Invalid DataSource Type"));
}
}
@@ -232,14 +235,9 @@ namespace System.Web.UI.WebControls ListItem item = null;
if (value != null) {
- if (Items.Count > 0) { - item = Items.FindByValue (value); - if (item == null) - throw new ArgumentOutOfRangeException ("value"); - } else { - cachedSelectedValue = value; - return; - } + item = Items.FindByValue (value);
+ if (item == null)
+ throw new ArgumentOutOfRangeException (value);
}
ClearSelection ();
@@ -312,11 +310,11 @@ namespace System.Web.UI.WebControls Items.Clear();
- bool dontUseProperties = (dtf.Length == 0 && dvf.Length == 0);
+ bool useProperties = (dtf.Length > 0 && dvf.Length > 0);
foreach (object current in ds) {
ListItem li = new ListItem();
- if (dontUseProperties){
+ if (!useProperties){
li.Text = String.Format (dtfs, current);
li.Value = current.ToString ();
Items.Add (li);
@@ -337,22 +335,7 @@ namespace System.Web.UI.WebControls Items.Add(li);
}
}
- - if (cachedSelectedValue != null) { - int index = Items.FindByValueInternal (cachedSelectedValue); - if (index == -1) - throw new ArgumentOutOfRangeException("value"); - - if (cachedSelectedIndex != -1 && cachedSelectedIndex != index) - throw new ArgumentException(HttpRuntime.FormatResourceString( - "Attributes_mutually_exclusive", "Selected Index", "Selected Value")); - - SelectedIndex = index; - cachedSelectedIndex = -1; - cachedSelectedValue = null; - return; - } - +
if (cachedSelectedIndex != -1) {
SelectedIndex = cachedSelectedIndex;
cachedSelectedIndex = -1;
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Repeater.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Repeater.cs index 5135629c50f..908dbb217aa 100644 --- a/mcs/class/System.Web/System.Web.UI.WebControls/Repeater.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/Repeater.cs @@ -185,9 +185,9 @@ namespace System.Web.UI.WebControls {
get
{
- if(items == null)
+ if(items != null)
{
- if(itemsArrayList == null)
+ if(itemsArrayList != null)
{
EnsureChildControls();
}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Style.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Style.cs index d99e49538c3..b94de2f69c0 100644 --- a/mcs/class/System.Web/System.Web.UI.WebControls/Style.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/Style.cs @@ -7,46 +7,45 @@ // // (C) Gaurav Vaish (2002) // (C) 2003 Andreas Nahr -// - -using System; -using System.Text; -using System.Collections; -using System.Drawing; -using System.Globalization; -using System.ComponentModel; -using System.Web; -using System.Web.UI; - -namespace System.Web.UI.WebControls -{ - [ToolboxItem(false)] - [TypeConverter(typeof(ExpandableObjectConverter))] - public class Style : Component , IStateManager - { - internal static int MARKED = (0x01 << 0); - internal static int BACKCOLOR = (0x01 << 1); - internal static int BORDERCOLOR = (0x01 << 2); - internal static int BORDERSTYLE = (0x01 << 3); - internal static int BORDERWIDTH = (0x01 << 4); - internal static int CSSCLASS = (0x01 << 5); - internal static int FORECOLOR = (0x01 << 6); - internal static int HEIGHT = (0x01 << 7); - internal static int WIDTH = (0x01 << 8); - internal static int FONT_BOLD = (0x01 << 9); - internal static int FONT_ITALIC = (0x01 << 10); - internal static int FONT_NAMES = (0x01 << 11); - internal static int FONT_SIZE = (0x01 << 12); - internal static int FONT_STRIKE = (0x01 << 13); - internal static int FONT_OLINE = (0x01 << 14); - internal static int FONT_ULINE = (0x01 << 15); - - internal static string selectionBitString = "_SBS"; - - StateBag viewState; - int selectionBits; - bool selfStateBag; - bool marked; +//
+
+using System;
+using System.Text;
+using System.Collections;
+using System.Drawing;
+using System.Globalization;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [ToolboxItem(false)]
+ [TypeConverter(typeof(ExpandableObjectConverter))]
+ public class Style : Component , IStateManager
+ {
+ internal static int MARKED = (0x01 << 0);
+ internal static int BACKCOLOR = (0x01 << 1);
+ internal static int BORDERCOLOR = (0x01 << 2);
+ internal static int BORDERSTYLE = (0x01 << 3);
+ internal static int BORDERWIDTH = (0x01 << 4);
+ internal static int CSSCLASS = (0x01 << 5);
+ internal static int FORECOLOR = (0x01 << 6);
+ internal static int HEIGHT = (0x01 << 7);
+ internal static int WIDTH = (0x01 << 8);
+ internal static int FONT_BOLD = (0x01 << 9);
+ internal static int FONT_ITALIC = (0x01 << 10);
+ internal static int FONT_NAMES = (0x01 << 11);
+ internal static int FONT_SIZE = (0x01 << 12);
+ internal static int FONT_STRIKE = (0x01 << 13);
+ internal static int FONT_OLINE = (0x01 << 14);
+ internal static int FONT_ULINE = (0x01 << 15);
+
+ internal static string selectionBitString = "_SystemWebUIWebControlsStyle_SBS";
+
+ private StateBag viewState;
+ private int selectionBits;
+ private bool selfStateBag;
private FontInfo font;
@@ -87,12 +86,12 @@ namespace System.Web.UI.WebControls return ( (selectionBits & bit) != 0x00);
}
- internal virtual void Set(int bit) - { - selectionBits |= bit; - if (IsTrackingViewState) - selectionBits |= MARKED; - } + internal virtual void Set(int bit)
+ {
+ selectionBits |= bit;
+ if(IsTrackingViewState)
+ selectionBits |= MARKED;
+ }
[NotifyParentProperty (true)] [DefaultValue (null), Bindable (true), WebCategory ("Appearance")] @@ -358,7 +357,7 @@ namespace System.Web.UI.WebControls string textDecoration = String.Empty;
if(Font.Strikeout)
{
- textDecoration += " line-through";
+ textDecoration += " strikeout";
}
if(Font.Underline)
{
@@ -494,44 +493,50 @@ namespace System.Web.UI.WebControls font.Reset();
selectionBits = 0x00;
}
- - protected bool IsTrackingViewState { - get { return marked; } - } - - protected internal virtual void TrackViewState () - { - if (selfStateBag) - ViewState.TrackViewState (); - - marked = true; - } - - protected internal virtual object SaveViewState () - { - if (viewState != null) { - if (marked) - ViewState [selectionBitString] = selectionBits; - - if (selfStateBag) - return ViewState.SaveViewState (); - } - - return null; - } - - protected internal void LoadViewState(object state) - { - if (state != null && selfStateBag) - ViewState.LoadViewState (state); - - if (viewState != null) { - object o = ViewState [selectionBitString]; - if (o != null) - selectionBits = (int) o; - } - } - +
+ protected bool IsTrackingViewState
+ {
+ get
+ {
+ return ( (selectionBits & MARKED) != 0x00 );
+ }
+ }
+
+ protected internal virtual void TrackViewState()
+ {
+ if(viewState!=null)
+ ViewState.TrackViewState();
+ Set(MARKED);
+ }
+
+ protected internal virtual object SaveViewState()
+ {
+ if(viewState != null)
+ {
+ if(IsSet(MARKED))
+ {
+ ViewState[selectionBitString] = selectionBits;
+ }
+ if(selfStateBag)
+ {
+ return ViewState.SaveViewState();
+ }
+ }
+ return null;
+ }
+
+ protected internal void LoadViewState(object state)
+ {
+ if (state != null && selfStateBag)
+ ViewState.LoadViewState(state);
+
+ if (viewState != null) {
+ object o = ViewState[selectionBitString];
+ if (o != null)
+ selectionBits = (int) o;
+ }
+ }
+
void IStateManager.LoadViewState(object state)
{
LoadViewState(state);
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/WebControl.cs b/mcs/class/System.Web/System.Web.UI.WebControls/WebControl.cs index abc6dfbc032..e0aa65f74a0 100755 --- a/mcs/class/System.Web/System.Web.UI.WebControls/WebControl.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/WebControl.cs @@ -7,43 +7,59 @@ // // (C) Gaurav Vaish (2002) // (C) 2003 Andreas Nahr -// - -using System; -using System.Collections; -using System.ComponentModel; -using System.Web; -using System.Web.UI; -using System.Drawing; -using System.Collections.Specialized; - -namespace System.Web.UI.WebControls -{ - [PersistChildrenAttribute(false)] - [ParseChildrenAttribute(true)] - public class WebControl : Control, IAttributeAccessor - { - HtmlTextWriterTag tagKey; - AttributeCollection attributes; - StateBag attributeState; - Style controlStyle; - bool enabled = true; - string tagName; - - // TODO: The constructors definitions - protected WebControl () : this (HtmlTextWriterTag.Span) - { - } - - public WebControl (HtmlTextWriterTag tag) - { - tagKey = tag; - } - - protected WebControl (string tag) - { - tagName = tag; - } +//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+using System.Drawing;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.WebControls
+{
+ [PersistChildrenAttribute(false)]
+ [ParseChildrenAttribute(true)]
+ public class WebControl : Control, IAttributeAccessor
+ {
+ //TODO: A list of private members may be incomplete
+
+ private HtmlTextWriterTag tagKey;
+ private string stringTag;
+ private AttributeCollection attributes;
+ private StateBag attributeState;
+ private Style controlStyle;
+ private bool enabled;
+ private string tagName;
+
+ // TODO: The constructors definitions
+ protected WebControl () : this (HtmlTextWriterTag.Span)
+ {
+ }
+
+ public WebControl(HtmlTextWriterTag tag): base()
+ {
+ //FIXME: am i right?
+ tagKey = tag;
+ //stringTag = null;
+ Initialize();
+ }
+
+ protected WebControl(string tag): base()
+ {
+ //FIXME: am i right?
+ stringTag = tag;
+ Initialize();
+ }
+
+ private void Initialize()
+ {
+ controlStyle = null;
+ enabled = true;
+ tagName = stringTag;
+ attributeState = null;
+ }
[DefaultValue (""), Bindable (true), WebCategory ("Behavior")] [WebSysDescription ("A keyboard shortcut for the WebControl.")]
@@ -194,16 +210,18 @@ namespace System.Web.UI.WebControls }
[DefaultValue (true), Bindable (true), WebCategory ("Behavior")] - [WebSysDescription ("The activation state of this WebControl.")] - public virtual bool Enabled { - get { return enabled; } - set { - if (enabled != value) - ViewState ["Enabled"] = value; - - enabled = value; - } - } + [WebSysDescription ("The activation state of this WebControl.")]
+ public virtual bool Enabled
+ {
+ get
+ {
+ return enabled;
+ }
+ set
+ {
+ enabled = value;
+ }
+ }
[DefaultValue (null), NotifyParentProperty (true), WebCategory ("Appearance")] [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)] @@ -401,77 +419,69 @@ namespace System.Web.UI.WebControls }
}
}
- - protected virtual Style CreateControlStyle () - { - return new Style (ViewState); - } - - protected override void LoadViewState (object savedState) - { - if (savedState == null) - return; - - Triplet saved = (Triplet) savedState; - base.LoadViewState (saved.First); - if (saved.Second != null || - ViewState [System.Web.UI.WebControls.Style.selectionBitString] != null) - ControlStyle.LoadViewState (saved.Second); - - if (attributeState != null) - attributeState.LoadViewState (saved.Third); - - object e = ViewState ["Enabled"]; - if (e != null) - enabled = (bool) e; - } - - protected override void Render(HtmlTextWriter writer) - { - RenderBeginTag (writer); - RenderContents (writer); - RenderEndTag (writer); - } - - protected virtual void RenderContents(HtmlTextWriter writer) - { - base.Render (writer); - } - - protected override object SaveViewState() - { - object controlView = null; - if (ControlStyleCreated) - controlView = ControlStyle.SaveViewState (); - - object baseView = base.SaveViewState (); - object attrView = null; - if (attributeState != null) - attrView = attributeState.SaveViewState (); - - return new Triplet (baseView, controlView, attrView); - } - - protected override void TrackViewState() - { - base.TrackViewState(); - if (ControlStyleCreated) - ControlStyle.TrackViewState (); - if (attributeState != null) - attributeState.TrackViewState (); - } - - string IAttributeAccessor.GetAttribute(string key) - { - if(Attributes!=null) - return Attributes[key] as string; - return null; - } - - void IAttributeAccessor.SetAttribute(string key, string value) - { - Attributes[key] = value; - } - } -} - +
+ protected virtual Style CreateControlStyle()
+ {
+ return new Style(ViewState);
+ }
+
+ protected override void LoadViewState (object savedState)
+ {
+ if (savedState != null) {
+ Triplet saved = (Triplet) savedState;
+ base.LoadViewState (saved.First);
+ if (ControlStyleCreated)
+ ControlStyle.LoadViewState (saved.Second);
+ if (attributeState != null)
+ attributeState.LoadViewState (saved.Third);
+ }
+ }
+
+ protected override void Render(HtmlTextWriter writer)
+ {
+ RenderBeginTag(writer);
+ RenderContents(writer);
+ RenderEndTag(writer);
+ }
+
+ protected virtual void RenderContents(HtmlTextWriter writer)
+ {
+ base.Render(writer);
+ }
+
+ protected override object SaveViewState()
+ {
+ object baseView = base.SaveViewState ();
+ object controlView = null;
+ if (ControlStyleCreated)
+ controlView = ControlStyle.SaveViewState();
+
+ object attrView = null;
+ if (attributeState != null)
+ attrView = attributeState.SaveViewState();
+
+ return new Triplet (baseView, controlView, attrView);
+ }
+
+ protected override void TrackViewState()
+ {
+ base.TrackViewState();
+ if (ControlStyleCreated)
+ ControlStyle.TrackViewState ();
+ if (attributeState != null)
+ attributeState.TrackViewState ();
+ }
+
+ string IAttributeAccessor.GetAttribute(string key)
+ {
+ if(Attributes!=null)
+ return Attributes[key] as string;
+ return null;
+ }
+
+ void IAttributeAccessor.SetAttribute(string key, string value)
+ {
+ Attributes[key] = value;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/BaseParser.cs b/mcs/class/System.Web/System.Web.UI/BaseParser.cs index b907394a0a5..b0976f22003 100755 --- a/mcs/class/System.Web/System.Web.UI/BaseParser.cs +++ b/mcs/class/System.Web/System.Web.UI/BaseParser.cs @@ -108,8 +108,6 @@ namespace System.Web.UI return baseVDir; } - - set { baseVDir = value; } } } } diff --git a/mcs/class/System.Web/System.Web.UI/ChangeLog b/mcs/class/System.Web/System.Web.UI/ChangeLog index 76f9888fef5..f628f01b6e1 100644 --- a/mcs/class/System.Web/System.Web.UI/ChangeLog +++ b/mcs/class/System.Web/System.Web.UI/ChangeLog @@ -1,41 +1,3 @@ -2003-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * Page.cs: check if controls that require postback have - been changed by an event and register them to be notified of data - changed event. - -2003-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * Control.cs: patch by yaronshkop@hotmail.com (Yaron Shkop) that fixes - bug #47866. - -2003-08-21 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * LosFormatter.cs: handle Unit and FonrUnit as special cases as they - are not serializable. Fixes bug #47784. - -2003-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * Control.cs: index the viewstates saved by the control position, not - the control name. Fixes bug #47697. - -2003-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * ControlCollection.cs: - * EmptyControlCollection.cs: create a minimum ArrayList for this. - - * BaseParser.cs: added setter for BaseVirtualDir. - - * Page.cs: fixed message when restoring view state fails. - * UserControlParser.cs: set the BaseVirtualDirectory to handle the case - when a relative path to the control is given. Fixes bug #47685. - -2003-08-18 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * Control.cs: when we load the viewstate for a control that has children - viewstates and the child is not found, keep its viewstate around and - wait until the child is added to load the viewstate. Fixes bug #47697. - 2003-08-11 Gonzalo Paniagua Javier <gonzalo@ximian.com> * TemplateControl.cs: more Delegate.CreateDelegate fixes. diff --git a/mcs/class/System.Web/System.Web.UI/Control.cs b/mcs/class/System.Web/System.Web.UI/Control.cs index 9cd8a6f3fdc..1fb54707b6b 100644 --- a/mcs/class/System.Web/System.Web.UI/Control.cs +++ b/mcs/class/System.Web/System.Web.UI/Control.cs @@ -1,30 +1,100 @@ -// -// System.Web.UI.Control.cs -// -// Authors: -// Bob Smith <bob@thestuff.net> -// Gonzalo Paniagua Javier (gonzalo@ximian.com -// Andreas Nahr (ClassDevelopment@A-SoftTech.com) -// -// (C) Bob Smith -// (c) 2002,2003 Ximian, Inc. (http://www.ximian.com) -// - -using System; -using System.Collections; +//
+// System.Web.UI.Control.cs
+//
+// Authors:
+// Bob Smith <bob@thestuff.net>
+// Gonzalo Paniagua Javier (gonzalo@ximian.com) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Bob Smith
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+
+/*
+ * Maintainer: bob@thestuff.net, gvaish@iitk.ac.in
+ * (C) Bob Smith, Gaurav Vaish
+ */
+
+//notes: view state only tracks changes after OnInit method is executed for the page request. You can read from it at any time, but cant write to it during rendering.
+//even more notes: view state info in trackviewstate method description. read later.
+//Ok, enough notes: what the heck is different between enable view state, and track view state.
+//Well, maybe not. How does the ViewState know when to track changes? Does it look at the property
+//on the owning control, or does it have a method/property of its own that gets called?
+// I think this last question is solved in the Interface for it. Look into this.
+
+//cycle:
+//init is called when control is first created.
+//load view state ic called right after init to populate the view state.
+//loadpostdata is called if ipostbackdatahandler is implemented.
+//load is called when control is loaded into a page
+//raisepostdatachangedevent if ipostbackdatahandler is implemented.
+//raisepostbackevent if ipostbackeventhandler is implemented.
+//prerender is called when the server is about to render its page object
+//SaveViewState is called.
+//Unload then dispose it apears. :)
+
+//Naming Container MUST have some methods. What are they? No clue. Help? (updated: the doc says that it's just a marker interface)
+
+//read this later. http://gotdotnet.com/quickstart/aspplus/
+//This to: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguidnf/html/cpconattributesdesign-timesupport.asp
+//http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguidnf/html/cpcontracefunctionality.asp
+
+// Isnt life grand? :)
+// See the undocumented methods? Gota love um. ;)
+// ASP.test4_aspx.Page_Load(Object Sender, EventArgs e) in \\genfs2\www24\bobsmith11\test4.aspx:6
+// System.Web.UI.Control.OnLoad(EventArgs e) +67
+// System.Web.UI.Control.LoadRecursive() +73
+// System.Web.UI.Page.ProcessRequestMain() +394
+
+// ASP.test4_aspx.Page_Unload(Object Sender, EventArgs e) in \\genfs2\www24\bobsmith11\test4.aspx:6
+// System.EventHandler.Invoke(Object sender, EventArgs e) +0
+// System.Web.UI.Control.OnUnload(EventArgs e) +67
+// System.Web.UI.Control.UnloadRecursive(Boolean dispose) +78
+// System.Web.UI.Page.ProcessRequest() +194
+// System.Web.UI.Page.ProcessRequest(HttpContext context) +18
+// System.Web.CallHandlerExecutionStep.Execute() +179
+// System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +87
+
+
+// ASP.test4_aspx.Page_Unload(Object Sender, EventArgs e) in \\genfs2\www24\bobsmith11\test4.aspx:6
+// System.Web.UI.Control.OnUnload(EventArgs e) +67
+// System.Web.UI.Control.UnloadRecursive(Boolean dispose) +78
+// System.Web.UI.Page.ProcessRequest()
+
+// ASP.test4_aspx.Page_Kill(Object Sender, EventArgs e) in \\genfs2\www24\bobsmith11\test4.aspx:6
+// System.Web.UI.Control.OnPreRender(EventArgs e) +67
+// System.Web.UI.Control.PreRenderRecursiveInternal() +61
+// System.Web.UI.Page.ProcessRequestMain() +753
+
+// ASP.test4_aspx.OnInit(EventArgs e) in \\genfs2\www24\bobsmith11\test4.aspx:6
+// System.Web.UI.Control.InitRecursive(Control namingContainer) +202
+// System.Web.UI.Page.ProcessRequestMain() +120
+
+// ASP.test4_aspx.SaveViewState() in \\genfs2\www24\bobsmith11\test4.aspx:12
+// System.Web.UI.Control.SaveViewStateRecursive() +51
+// System.Web.UI.Page.SavePageViewState() +174
+// System.Web.UI.Page.ProcessRequestMain() +861
+
+// ASP.test_aspx.LoadViewState(Object t) +28
+// System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +125
+// System.Web.UI.Page.LoadPageViewState() +182
+// System.Web.UI.Page.ProcessRequestMain() +256
+
+using System;
+using System.Collections;
using System.ComponentModel; using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Web; -using System.Web.Util; - -namespace System.Web.UI +using System.ComponentModel.Design.Serialization;
+using System.Web;
+using System.Web.Util;
+
+namespace System.Web.UI
{ [DefaultProperty ("ID"), DesignerCategory ("Code"), ToolboxItemFilter ("System.Web.UI", ToolboxItemFilterType.Require)] [ToolboxItem ("System.Web.UI.Design.WebControlToolboxItem, " + Consts.AssemblySystem_Design)] [Designer ("System.Web.UI.Design.ControlDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))] - [DesignerSerializer ("Microsoft.VSDesigner.WebForms.ControlCodeDomSerializer, " + Consts.AssemblyMicrosoft_VSDesigner, "System.ComponentModel.Design.Serialization.CodeDomSerializer, " + Consts.AssemblySystem_Design)] - public class Control : IComponent, IDisposable, IParserAccessor, IDataBindingsAccessor + [DesignerSerializer ("Microsoft.VSDesigner.WebForms.ControlCodeDomSerializer, " + Consts.AssemblyMicrosoft_VSDesigner, "System.ComponentModel.Design.Serialization.CodeDomSerializer, " + Consts.AssemblySystem_Design)]
+ public class Control : IComponent, IDisposable, IParserAccessor, IDataBindingsAccessor
{
private static readonly object DataBindingEvent = new object();
private static readonly object DisposedEvent = new object();
@@ -54,16 +124,14 @@ namespace System.Web.UI private bool creatingControls = false;
private bool bindingContainer = true;
private bool autoEventWireup = true;
- - bool inited = false; - bool viewStateLoaded; - bool loaded = false; - bool prerendered = false; - int defaultNumberID = 0; - - private DataBindingCollection dataBindings = null; - Hashtable pendingVS; // may hold unused viewstate data from child controls - +
+ bool inited = false;
+ bool loaded = false;
+ bool prerendered = false;
+ int defaultNumberID = 0;
+
+ private DataBindingCollection dataBindings = null;
+
public Control()
{
if (this is INamingContainer) _isNamingContainer = true;
@@ -231,26 +299,24 @@ namespace System.Web.UI } [DefaultValue (true), Bindable (true), WebCategory ("FIXME")] - [WebSysDescription ("Visiblity state of the control.")] - public virtual bool Visible { - get { - if (_visible == false) - return false; - - if (_parent != null) - return _parent.Visible; - - return true; - } - - set { - if (value != _visible) - ViewState ["Visible"] = value; - - _visible = value; - } - } - + [WebSysDescription ("Visiblity state of the control.")]
+ public virtual bool Visible
+ {
+ get
+ {
+ if (_visible == false)
+ return false;
+
+ if (_parent != null)
+ return _parent.Visible;
+
+ return true;
+ }
+ set
+ {
+ _visible = value;
+ }
+ }
protected bool ChildControlsCreated //DIT
{
get
@@ -358,43 +424,30 @@ namespace System.Web.UI protected internal virtual void AddedControl (Control control, int index)
{
- /* Ensure the control don't have more than 1 parent */ - if (control._parent != null) - control._parent.Controls.Remove (control); - - control._parent = this; - control._page = _page; - Control nc = _isNamingContainer ? this : NamingContainer; - - if (nc != null) { - control._namingContainer = nc; - if (control.AutoID == true && control._userId == null) - control._userId = nc.GetDefaultName () + "a"; - } - - if (inited) - control.InitRecursive (nc); - - if (viewStateLoaded || loaded) { - if (pendingVS != null) { - object vs = pendingVS [index]; - if (vs != null) { - pendingVS.Remove (index); - if (pendingVS.Count == 0) - pendingVS = null; - - control.LoadViewStateRecursive (vs); - } - } - } - - if (loaded) - control.LoadRecursive (); - - if (prerendered) - control.PreRenderRecursiveInternal (); - } - + /* Ensure the control don't have more than 1 parent */
+ if (control._parent != null)
+ control._parent.Controls.Remove (control);
+
+ control._parent = this;
+ control._page = _page;
+ Control nc = _isNamingContainer ? this : NamingContainer;
+
+ if (nc != null) {
+ control._namingContainer = nc;
+ if (control.AutoID == true && control._userId == null)
+ control._userId = nc.GetDefaultName () + "a";
+ }
+
+ if (inited)
+ control.InitRecursive (nc);
+
+ if (loaded)
+ control.LoadRecursive ();
+
+ if (prerendered)
+ control.PreRenderRecursiveInternal ();
+ }
+
protected virtual void AddParsedSubObject(object obj) //DIT
{
WebTrace.PushContext ("Control.AddParsedSubobject ()");
@@ -488,18 +541,14 @@ namespace System.Web.UI return null;
return namingContainer.FindControl (id, colon + 1);
- } - - protected virtual void LoadViewState(object savedState) - { - if (savedState != null) { - ViewState.LoadViewState (savedState); - object o = ViewState ["Visible"]; - if (o != null) - _visible = (bool) o; - } - } - + }
+
+ protected virtual void LoadViewState(object savedState)
+ {
+ if (savedState != null)
+ ViewState.LoadViewState (savedState);
+ }
+
[MonoTODO("Secure?")]
protected string MapPathSecure(string virtualPath)
{
@@ -795,67 +844,56 @@ namespace System.Web.UI TrackViewState ();
inited = true;
}
- - internal object SaveViewStateRecursive () - { - if (!EnableViewState) - return null; - - ArrayList controlList = null; - ArrayList controlStates = null; - - int idx = -1; - foreach (Control ctrl in Controls) { - object ctrlState = ctrl.SaveViewStateRecursive (); - idx++; - if (ctrlState == null) - continue; - - if (controlList == null) { - controlList = new ArrayList (); - controlStates = new ArrayList (); - } - - controlList.Add (idx); - controlStates.Add (ctrlState); - } - - object thisState = SaveViewState (); - if (thisState == null && controlList == null && controlStates == null) - return null; - - return new Triplet (thisState, controlList, controlStates); - } - - internal void LoadViewStateRecursive (object savedState) - { - if (!EnableViewState || !Visible || savedState == null) - return; - - Triplet savedInfo = (Triplet) savedState; - LoadViewState (savedInfo.First); - - ArrayList controlList = savedInfo.Second as ArrayList; - if (controlList == null) - return; - ArrayList controlStates = savedInfo.Third as ArrayList; - int nControls = controlList.Count; - for (int i = 0; i < nControls; i++) { - int k = (int) controlList [i]; - if (k < Controls.Count && controlStates != null) { - Control c = Controls [k]; - c.LoadViewStateRecursive (controlStates [i]); - } else { - if (pendingVS == null) - pendingVS = new Hashtable (); - - pendingVS [k] = controlStates [i]; - } - } - - viewStateLoaded = true; - } - +
+ internal object SaveViewStateRecursive ()
+ {
+ if (!EnableViewState)
+ return null;
+
+ ArrayList controlList = null;
+ ArrayList controlStates = null;
+
+ foreach (Control ctrl in Controls) {
+ object ctrlState = ctrl.SaveViewStateRecursive ();
+ if (ctrlState == null || ctrl.ID == null)
+ continue;
+
+ if (controlList == null) {
+ controlList = new ArrayList ();
+ controlStates = new ArrayList ();
+ }
+
+ controlList.Add (ctrl.ID);
+ controlStates.Add (ctrlState);
+ }
+
+ object thisState = SaveViewState ();
+ if (thisState == null && controlList == null && controlStates == null)
+ return null;
+
+ return new Triplet (thisState, controlList, controlStates);
+ }
+
+ internal void LoadViewStateRecursive (object savedState)
+ {
+ if (!EnableViewState || !Visible || savedState == null)
+ return;
+
+ Triplet savedInfo = (Triplet) savedState;
+ LoadViewState (savedInfo.First);
+
+ ArrayList controlList = savedInfo.Second as ArrayList;
+ if (controlList == null)
+ return;
+ ArrayList controlStates = savedInfo.Third as ArrayList;
+ int nControls = controlList.Count;
+ for (int i = 0; i < nControls; i++) {
+ Control c = FindControl ((string) controlList [i]);
+ if (c != null && controlStates != null)
+ c.LoadViewStateRecursive (controlStates [i]);
+ }
+ }
+
void IParserAccessor.AddParsedSubObject(object obj)
{
AddParsedSubObject(obj);
diff --git a/mcs/class/System.Web/System.Web.UI/ControlCollection.cs b/mcs/class/System.Web/System.Web.UI/ControlCollection.cs index 2cd04ff5e8c..adfc1a2dfcb 100755 --- a/mcs/class/System.Web/System.Web.UI/ControlCollection.cs +++ b/mcs/class/System.Web/System.Web.UI/ControlCollection.cs @@ -13,7 +13,7 @@ namespace System.Web.UI { public class ControlCollection : ICollection, IEnumerable { - ArrayList list; + ArrayList list = new ArrayList (); Control owner; public ControlCollection (Control owner) @@ -21,16 +21,6 @@ namespace System.Web.UI { if (owner == null) throw new ArgumentException (); - list = new ArrayList (); - this.owner = owner; - } - - internal ControlCollection (Control owner, bool shortList) - { - if (owner == null) - throw new ArgumentException (); - - list = new ArrayList (shortList ? 1 : 0); this.owner = owner; } diff --git a/mcs/class/System.Web/System.Web.UI/EmptyControlCollection.cs b/mcs/class/System.Web/System.Web.UI/EmptyControlCollection.cs index 4ef39b980e5..9d5a039625e 100755 --- a/mcs/class/System.Web/System.Web.UI/EmptyControlCollection.cs +++ b/mcs/class/System.Web/System.Web.UI/EmptyControlCollection.cs @@ -13,7 +13,7 @@ namespace System.Web.UI { public class EmptyControlCollection : ControlCollection { public EmptyControlCollection (Control owner) - : base (owner, true) + : base (owner) { } diff --git a/mcs/class/System.Web/System.Web.UI/LosFormatter.cs b/mcs/class/System.Web/System.Web.UI/LosFormatter.cs index f42c919a045..d06317cfd97 100644 --- a/mcs/class/System.Web/System.Web.UI/LosFormatter.cs +++ b/mcs/class/System.Web/System.Web.UI/LosFormatter.cs @@ -14,7 +14,6 @@ using System.IO; using System.Runtime.Serialization.Formatters.Binary; using System.Text; using System.Web.UI; -using System.Web.UI.WebControls; using System.Web.Util; namespace System.Web.UI @@ -38,8 +37,6 @@ namespace System.Web.UI const char binaryID = 'b'; const char arrayID = 'a'; const char dateTimeID = 'd'; - const char unitID = 'u'; - const char fontUnitID = 'f'; static Hashtable specialTypes; static Hashtable idToType; @@ -55,8 +52,6 @@ namespace System.Web.UI specialTypes.Add (typeof (Hashtable), new WriteObject (WriteHashtable)); specialTypes.Add (typeof (Array), new WriteObject (WriteArray)); specialTypes.Add (typeof (DateTime), new WriteObject (WriteDateTime)); - specialTypes.Add (typeof (Unit), new WriteObject (WriteUnit)); - specialTypes.Add (typeof (FontUnit), new WriteObject (WriteFontUnit)); idToType = new Hashtable (); idToType.Add (typeof (string), stringID); @@ -71,8 +66,6 @@ namespace System.Web.UI idToType.Add (typeof (ArrayList), arrayListID); idToType.Add (typeof (Hashtable), hashtableID); idToType.Add (typeof (Array), arrayID); - idToType.Add (typeof (Unit), unitID); - idToType.Add (typeof (FontUnit), fontUnitID); } public object Deserialize (Stream stream) @@ -266,12 +259,6 @@ namespace System.Web.UI case dateTimeID: obj = new DateTime (Int64.Parse (enclosed)); break; - case unitID: - obj = Unit.Parse (enclosed); - break; - case fontUnitID: - obj = FontUnit.Parse (enclosed); - break; default: throw new ArgumentException ("input"); } @@ -419,28 +406,6 @@ namespace System.Web.UI output.Write('>'); } - static void WriteUnit (LosFormatter formatter, TextWriter output, object value) - { - if (value == null) - return; - - output.Write (unitID); - output.Write ('<'); - output.Write (((Unit) value).ToString ()); - output.Write('>'); - } - - static void WriteFontUnit (LosFormatter formatter, TextWriter output, object value) - { - if (value == null) - return; - - output.Write (fontUnitID); - output.Write ('<'); - output.Write (((FontUnit) value).ToString ()); - output.Write('>'); - } - private static string EscapeSpecialChars (string str) { if (str.IndexOfAny (specialChars) == -1) diff --git a/mcs/class/System.Web/System.Web.UI/Page.cs b/mcs/class/System.Web/System.Web.UI/Page.cs index 0e510f0a855..42c1bd0f5df 100755 --- a/mcs/class/System.Web/System.Web.UI/Page.cs +++ b/mcs/class/System.Web/System.Web.UI/Page.cs @@ -541,8 +541,6 @@ public class Page : TemplateControl, IHttpHandler if (requiresPostDataChanged == null) requiresPostDataChanged = new ArrayList (); requiresPostDataChanged.Add (pbdh); - if (_requiresPostBack != null) - _requiresPostBack.Remove (ctrl.ID); } } else if (!second) { if (secondPostData == null) @@ -550,26 +548,6 @@ public class Page : TemplateControl, IHttpHandler secondPostData.Add (real_id, data [id]); } } - - if (_requiresPostBack != null) { - string [] handlers = (string []) _requiresPostBack.ToArray (typeof (string)); - foreach (string id in handlers) { - IPostBackDataHandler pbdh = FindControl (id) as IPostBackDataHandler; - if (pbdh == null) - continue; - - _requiresPostBack.Remove (id); - if (pbdh.LoadPostData (id, data)) { - if (requiresPostDataChanged == null) - requiresPostDataChanged = new ArrayList (); - - requiresPostDataChanged.Add (pbdh); - } - } - - if (_requiresPostBack.Count == 0) - _requiresPostBack = null; - } } [EditorBrowsable (EditorBrowsableState.Never)] @@ -645,7 +623,7 @@ public class Page : TemplateControl, IHttpHandler foreach (IPostBackDataHandler ipdh in requiresPostDataChanged) ipdh.RaisePostDataChangedEvent (); - requiresPostDataChanged = null; + requiresPostDataChanged.Clear (); } [EditorBrowsable (EditorBrowsableState.Advanced)] @@ -749,7 +727,7 @@ public class Page : TemplateControl, IHttpHandler try { _savedViewState = fmt.Deserialize (view_state); } catch (Exception e) { - throw new HttpException ("Error restoring page viewstate.\n", e); + throw new HttpException ("Error restoring page viewstate.\n{0}", e); } return _savedViewState; @@ -777,10 +755,6 @@ public class Page : TemplateControl, IHttpHandler pair.First = SaveViewStateRecursive (); if (_requiresPostBack != null && _requiresPostBack.Count > 0) pair.Second = _requiresPostBack; - - if (pair.First == null && pair.Second == null) - pair = null; - SavePageStateToPersistenceMedium (pair); } diff --git a/mcs/class/System.Web/System.Web.UI/UserControlParser.cs b/mcs/class/System.Web/System.Web.UI/UserControlParser.cs index 11ed81005ff..bc1e57e4465 100644 --- a/mcs/class/System.Web/System.Web.UI/UserControlParser.cs +++ b/mcs/class/System.Web/System.Web.UI/UserControlParser.cs @@ -19,9 +19,7 @@ namespace System.Web.UI internal UserControlParser (string virtualPath, string inputFile, HttpContext context) { Context = context; - string vp = UrlUtils.Combine (virtualPath, inputFile); - BaseVirtualDir = UrlUtils.GetDirectory (vp); - InputFile = context.Request.MapPath (vp); + InputFile = context.Request.MapPath (inputFile); } public static Type GetCompiledType (string virtualPath, string inputFile, HttpContext context) diff --git a/mcs/class/System.Web/System.Web.Util/ChangeLog b/mcs/class/System.Web/System.Web.Util/ChangeLog index b3d5114b4bd..865b98ba483 100644 --- a/mcs/class/System.Web/System.Web.Util/ChangeLog +++ b/mcs/class/System.Web/System.Web.Util/ChangeLog @@ -1,11 +1,3 @@ -2003-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
-
- * ICalls.cs: holds a couple of icalls.
-
-2003-08-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
-
- * UrlUtils.cs: made Reduce work when a "/" is passed.
-
2003-05-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* UrlUtils.cs: fixed Combine and reworked Reduce.
diff --git a/mcs/class/System.Web/System.Web.Util/ICalls.cs b/mcs/class/System.Web/System.Web.Util/ICalls.cs deleted file mode 100644 index 4103ac2fd16..00000000000 --- a/mcs/class/System.Web/System.Web.Util/ICalls.cs +++ /dev/null @@ -1,24 +0,0 @@ -// -// System.Web.Util.ICalls -// -// Authors: -// Gonzalo Paniagua Javier (gonzalo@ximian.com) -// -// (C) 2003 Ximian, Inc (http://www.ximian.com) -// - -using System.Runtime.CompilerServices; -namespace System.Web.Util -{ - class ICalls - { - private ICalls () {} - - [MethodImplAttribute(MethodImplOptions.InternalCall)] - extern static public string GetMachineConfigPath (); - - [MethodImplAttribute(MethodImplOptions.InternalCall)] - extern static public string GetMachineInstallDirectory (); - } -} - diff --git a/mcs/class/System.Web/System.Web.Util/UrlUtils.cs b/mcs/class/System.Web/System.Web.Util/UrlUtils.cs index 0977ae0d622..48e1e3c31da 100644 --- a/mcs/class/System.Web/System.Web.Util/UrlUtils.cs +++ b/mcs/class/System.Web/System.Web.Util/UrlUtils.cs @@ -236,9 +236,6 @@ namespace System.Web.Util result.Add (current);
}
- if (result.Count == 0)
- return "/";
-
result.Insert (0, "");
return String.Join ("/", (string []) result.ToArray (typeof (string)));
}
diff --git a/mcs/class/System.Web/System.Web.dll.sources b/mcs/class/System.Web/System.Web.dll.sources index 7b36122aa45..f0e28125e52 100755 --- a/mcs/class/System.Web/System.Web.dll.sources +++ b/mcs/class/System.Web/System.Web.dll.sources @@ -415,7 +415,6 @@ System.Web.Util/FileChangeEventHandler.cs System.Web.Util/FileChangedEventArgs.cs System.Web.Util/FileChangesMonitor.cs System.Web.Util/FilePathParser.cs -System.Web.Util/ICalls.cs System.Web.Util/IISVersionInfo.cs System.Web.Util/NativeFileChangeEventHandler.cs System.Web.Util/UrlUtils.cs diff --git a/mcs/class/System.Web/System.Web/ChangeLog b/mcs/class/System.Web/System.Web/ChangeLog index 299ab763a3b..6c66d0f963e 100644 --- a/mcs/class/System.Web/System.Web/ChangeLog +++ b/mcs/class/System.Web/System.Web/ChangeLog @@ -1,61 +1,3 @@ -2003-09-04 Lluis Sanchez Gual <lluis@ximian.com> - - * HttpRequest.cs: Url property: use GetLocalAddress() to get the address - (this will get the address from the request headers). - -2003-09-04 Lluis Sanchez Gual <lluis@ximian.com> - - * HttpServerUtility.cs: In Transfer(), preserve the query string if - told to do so. - -2003-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * HttpApplication.cs: ensure we do all the EndRequest steps. Don't - filter the output on error. - - * HttpResponse.cs: modified DoFilter to allow bypassing filtering. - -2003-08-27 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * HttpApplication.cs: when the request is completed or an - error happens, execute all the delegates attached to EndRequest, not - only the last one. This makes xsp/test/authtest work again. - - * HttpMethodNotAllowedHandler.cs: fixed description for http - status code. - -2003-08-22 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * HttpRequest.cs: quick way of checking that the path is within the - root for the application. Thanks to Johannes for reporting. - - * HttpRuntime.cs: use the status code from teh exception when it'ss a - HttpException. - - * StaticFileHandler.cs: forbidden is 403. - -2003-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * HttpServerUtility.cs: fixed path and query. Path by Rich Alimi - <rich@velvetsea.net>. - -2003-08-19 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * HttpException.cs: make the unhandled error more like the MS one. - * HttpRuntime.cs: set a 500 error code on unhandled exceptions. - -2003-08-19 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * HttpResponse.cs: flush headers when the body length is 0. - * StaticFileHandler.cs: added If-Modified-Since handling patch slightly - modified from the original by Piers Haken <piersh@friskit.com>. - -2003-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * HttpResponse.cs: another patch from totte and me. This one prevents - writing output if the client have disconnected and filters the data - when there's a non-final Flush in the middle of the process. - 2003-08-12 Gonzalo Paniagua Javier <gonzalo@ximian.com> * HttpApplication.cs: fixed typos. Closes bug #44197. diff --git a/mcs/class/System.Web/System.Web/HttpApplication.cs b/mcs/class/System.Web/System.Web/HttpApplication.cs index 988f38c1481..1da9b945a00 100644 --- a/mcs/class/System.Web/System.Web/HttpApplication.cs +++ b/mcs/class/System.Web/System.Web/HttpApplication.cs @@ -454,7 +454,7 @@ namespace System.Web public void Execute () { - _app.Context.Response.DoFilter (true); + _app.Context.Response.DoFilter (); } public bool CompletedSynchronously { @@ -474,7 +474,6 @@ namespace System.Web IStateHandler [] _handlers; int _currentStateIdx; int _endStateIdx; - int _endRequestStateIdx; int _countSteps; int _countSyncSteps; @@ -562,7 +561,6 @@ namespace System.Web GetAsStates (HttpApplication.UpdateRequestCacheId, states); // EndRequest - _endRequestStateIdx = states.Count; if (null != _app._endRequestAsync) _app._endRequestAsync.GetAsStates (_app, states); GetAsStates (HttpApplication.EndRequestId, states); @@ -610,11 +608,9 @@ namespace System.Web } // Check if request flow is to be stopped - if ((_app.GetLastError () != null || _app._CompleteRequest) && - _currentStateIdx < _endRequestStateIdx) { - _currentStateIdx = _endRequestStateIdx; - // MS does not filter on error - _app._Context.Response.DoFilter (false); + if (_app.GetLastError () != null || _app._CompleteRequest) { + _currentStateIdx = _endStateIdx; + break; } else if (_currentStateIdx < _endStateIdx) { // Get next state handler _currentStateIdx++; diff --git a/mcs/class/System.Web/System.Web/HttpException.cs b/mcs/class/System.Web/System.Web/HttpException.cs index f172d3d6759..9cd5f6310a0 100644 --- a/mcs/class/System.Web/System.Web/HttpException.cs +++ b/mcs/class/System.Web/System.Web/HttpException.cs @@ -80,11 +80,11 @@ namespace System.Web StringBuilder builder = new StringBuilder ("<html>\n<title>"); builder.Append ("Error"); //FIXME builder.AppendFormat ("</title><body bgcolor=\"white\">" + - "<h1><font color=\"red\">Server error in '{0}' " + - "application</font></h1><hr>\n", + "<h1><font color=\"red\">Error in '{0}' " + + "Application</font></h1><hr>\n", HttpRuntime.AppDomainAppVirtualPath); - builder.AppendFormat ("<h2><font color=\"maroon\"><i>{0}</i></font></h2>\n", Message); + builder.AppendFormat ("<h2><font color=\"maroon\"><i>{0}</i></font></h2>\n", "Error"); //FIXME builder.AppendFormat ("<b>Description: </b>{0}\n<p>\n", "Error processing request."); builder.AppendFormat ("<b>Error Message: </b>{0}\n<p>\n", HtmlEncode (this.Message)); builder.AppendFormat ("<b>Stack Trace: </b>"); diff --git a/mcs/class/System.Web/System.Web/HttpMethodNotAllowedHandler.cs b/mcs/class/System.Web/System.Web/HttpMethodNotAllowedHandler.cs index c13b14f74c2..e89a6082509 100644 --- a/mcs/class/System.Web/System.Web/HttpMethodNotAllowedHandler.cs +++ b/mcs/class/System.Web/System.Web/HttpMethodNotAllowedHandler.cs @@ -13,11 +13,15 @@ namespace System.Web { public void ProcessRequest (HttpContext context) { - throw new HttpException (405, "Method not allowed"); + throw new HttpException (405, "Forbidden"); } - public bool IsReusable { - get { return true; } + + public bool IsReusable + { + get { + return true; + } } } } diff --git a/mcs/class/System.Web/System.Web/HttpRequest.cs b/mcs/class/System.Web/System.Web/HttpRequest.cs index d64ced0ce38..d5bfd23c573 100644 --- a/mcs/class/System.Web/System.Web/HttpRequest.cs +++ b/mcs/class/System.Web/System.Web/HttpRequest.cs @@ -504,11 +504,6 @@ namespace System.Web { get {
if (null == _sFilePath && null != _WorkerRequest) {
_sFilePath = _WorkerRequest.GetFilePath();
- try {
- _sFilePath = UrlUtils.Reduce (_sFilePath);
- } catch (Exception e) {
- throw new HttpException (403, "Forbidden");
- }
}
return _sFilePath;
@@ -719,9 +714,8 @@ namespace System.Web { if (rewritten)
_sPathTranslated = _WorkerRequest.GetFilePathTranslated ();
- string verifyPath = _WorkerRequest.MapPath (FilePath);
if (null == _sPathTranslated)
- _sPathTranslated = verifyPath;
+ _sPathTranslated = _WorkerRequest.MapPath (FilePath);
}
return _sPathTranslated;
@@ -832,7 +826,7 @@ namespace System.Web { qs = "?" + qs;
UriBuilder ub = new UriBuilder (_WorkerRequest.GetProtocol (),
- _WorkerRequest.GetLocalAddress (),
+ _WorkerRequest.GetServerName (),
_WorkerRequest.GetLocalPort (),
Path,
qs);
@@ -1075,4 +1069,4 @@ namespace System.Web { _oFormData = form;
}
}
-} +}
diff --git a/mcs/class/System.Web/System.Web/HttpResponse.cs b/mcs/class/System.Web/System.Web/HttpResponse.cs index dcce865f49b..63a3d8553da 100644 --- a/mcs/class/System.Web/System.Web/HttpResponse.cs +++ b/mcs/class/System.Web/System.Web/HttpResponse.cs @@ -34,7 +34,6 @@ namespace System.Web bool _bBuffering; bool _bHeadersSent; bool _bFlushing; - bool filtered; long _lContentLength; int _iStatusCode; @@ -123,12 +122,10 @@ namespace System.Web Flush (true); } - internal void DoFilter (bool really) + internal void DoFilter () { - if (really && null != _Writer) + if (null != _Writer) _Writer.FilterData (true); - - filtered = true; } [MonoTODO("We need to add cache headers also")] @@ -675,12 +672,10 @@ namespace System.Web } try { - if (_bClientDisconnected) - return; - - long length = _Writer.BufferSize; - if (!_bHeadersSent && !_bSuppressHeaders) { + long length; + if (!_bHeadersSent && !_bSuppressHeaders && !_bClientDisconnected) { if (bFinish) { + length = _Writer.BufferSize; if (length == 0 && _lContentLength == 0) _sContentType = null; @@ -709,23 +704,10 @@ namespace System.Web } } - length = _Writer.BufferSize; SendHeaders (); } } - if (!filtered) { - _Writer.FilterData (false); - length = _Writer.BufferSize; - } - - if (length == 0) { - _WorkerRequest.FlushResponse (bFinish); - if (!bFinish) - _Writer.Clear (); - return; - } - if (!_bSuppressContent && Request.HttpMethod == "HEAD") _bSuppressContent = true; diff --git a/mcs/class/System.Web/System.Web/HttpRuntime.cs b/mcs/class/System.Web/System.Web/HttpRuntime.cs index d3ce2a67101..1c337df5ed6 100644 --- a/mcs/class/System.Web/System.Web/HttpRuntime.cs +++ b/mcs/class/System.Web/System.Web/HttpRuntime.cs @@ -139,9 +139,6 @@ namespace System.Web { context.Response.ClearHeaders (); if (!(error is HttpException)) { error = new HttpException (String.Empty, error); - context.Response.StatusCode = 500; - } else { - context.Response.StatusCode = ((HttpException) error).GetHttpCode (); } context.Response.Write (((HttpException) error).GetHtmlErrorMessage ()); context.Response.FinalFlush (); diff --git a/mcs/class/System.Web/System.Web/HttpServerUtility.cs b/mcs/class/System.Web/System.Web/HttpServerUtility.cs index fbd97c89ee5..8df03fb6173 100644 --- a/mcs/class/System.Web/System.Web/HttpServerUtility.cs +++ b/mcs/class/System.Web/System.Web/HttpServerUtility.cs @@ -149,11 +149,6 @@ namespace System.Web /// <param name="writer">The TextWriter to capture the output. </param> public void Execute (string path, TextWriter writer) { - Execute (path, writer, false); - } - - public void Execute (string path, TextWriter writer, bool preserveQuery) - { if (path == null) throw new ArgumentNullException ("path"); @@ -166,8 +161,8 @@ namespace System.Web int qmark = path.IndexOf ('?'); string query; if (qmark != -1) { - query = path.Substring (qmark + 1); path = path.Substring (0, qmark); + query = path.Substring (qmark + 1); } else { query = ""; } @@ -182,8 +177,7 @@ namespace System.Web string oldFilePath = request.FilePath; request.SetFilePath (path); string oldQuery = request.QueryStringRaw; - - if (!preserveQuery) request.QueryStringRaw = query; + request.QueryStringRaw = query; IHttpHandler handler = _Context.ApplicationInstance.CreateHttpHandler (_Context, request.RequestType, path, @@ -298,7 +292,7 @@ namespace System.Web _Context.Request.SetForm (new HttpValueCollection ()); } - Execute (path, null, preserveForm); + Execute (path); if (!preserveForm) _Context.Request.SetForm (oldForm); @@ -369,3 +363,4 @@ namespace System.Web } } } + diff --git a/mcs/class/System.Web/System.Web/MimeTypes.cs b/mcs/class/System.Web/System.Web/MimeTypes.cs index dbd153aab24..ff267d853c1 100644 --- a/mcs/class/System.Web/System.Web/MimeTypes.cs +++ b/mcs/class/System.Web/System.Web/MimeTypes.cs @@ -304,7 +304,6 @@ namespace System.Web mimeTypes.Add ("roff", "application/x-troff"); mimeTypes.Add ("rp ", "image/vnd.rn-realpix"); mimeTypes.Add ("rpm", "audio/x-pn-realaudio-plugin"); - mimeTypes.Add ("rss", "text/xml"); mimeTypes.Add ("rt", "text/richtext"); mimeTypes.Add ("rtf", "text/richtext"); mimeTypes.Add ("rtx", "text/richtext"); diff --git a/mcs/class/System.Web/System.Web/StaticFileHandler.cs b/mcs/class/System.Web/System.Web/StaticFileHandler.cs index cea1c2916ba..463e9fd2e72 100644 --- a/mcs/class/System.Web/System.Web/StaticFileHandler.cs +++ b/mcs/class/System.Web/System.Web/StaticFileHandler.cs @@ -28,26 +28,12 @@ namespace System.Web return; } - string strHeader = request.Headers ["If-Modified-Since"]; + DateTime lastWT = fi.LastWriteTime; try { - if (strHeader != null) { - DateTime dtIfModifiedSince = DateTime.ParseExact (strHeader, "r", null); - DateTime ftime = fi.LastWriteTime.ToUniversalTime (); - if (ftime <= dtIfModifiedSince) { - response.StatusCode = 304; - return; - } - } - } catch { } - - try { - DateTime lastWT = fi.LastWriteTime.ToUniversalTime (); - response.AddHeader ("Last-Modified", lastWT.ToString ("r")); - response.WriteFile (fileName); response.ContentType = MimeTypes.GetMimeType (fileName); } catch (Exception e) { - throw new HttpException (403, "Forbidden"); + throw new HttpException (401, "Forbidden"); } } diff --git a/mcs/class/System.Windows.Forms/ChangeLog b/mcs/class/System.Windows.Forms/ChangeLog index a9cd14a1cd8..399e6c8b80b 100644 --- a/mcs/class/System.Windows.Forms/ChangeLog +++ b/mcs/class/System.Windows.Forms/ChangeLog @@ -1,11 +1,3 @@ -2003-08-31 Jerome Laban <jlaban@wanadoo.fr>
- * Label.cs: Fixed Text property not redrawing the label correctly.
-
-2003-08-31 Jerome Laban <jlaban@wanadoo.fr>
- * win32functions.cs: Added GetUpdateRect function.
- * Control.cs: Make sure to call OnPaint even if UserPaint style is not
- enabled. Get the appropriate DC for WM_PAINT operations.
-
2003-07-16 Peter Williams <peter@newton.cx>
* System.Windows.Forms.dll.sources: Don't build with two
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ComponentEditor.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ComponentEditor.cs index 4954365f7f5..ea69adbc175 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ComponentEditor.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/ComponentEditor.cs @@ -6,49 +6,20 @@ // (C) 2002 Ximian, Inc. http://www.ximian.com
//
using System;
-using System.ComponentModel;
+
namespace System.Windows.Forms.Design
{
/// <summary>
/// Summary description for WindowsFormsComponentEditor.
/// </summary>
- public abstract class ComponentEditor
+ public class ComponentEditor
{
public ComponentEditor()
{
//
// TODO: Add constructor logic here
//
- }
-
- public bool EditComponent(object obj)
- {
- return false;
- }
-
- public abstract bool EditComponent(ITypeDescriptorContext ctx, object obj);
- }
-
- public class WindowsFormsComponentEditor : ComponentEditor
- {
- public WindowsFormsComponentEditor()
- {
- }
-
- public override bool EditComponent(ITypeDescriptorContext ctx, object obj)
- {
- return false;
- }
-
- public bool EditComponent(object obj, IWin32Window iwnd)
- {
- return false;
- }
-
- public virtual bool EditComponent(ITypeDescriptorContext ctx, object obj, IWin32Window iwnd)
- {
- return false;
+ throw new NotImplementedException ();
}
}
-
}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/IUIService.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/IUIService.cs index 0da176ad211..649d7eed5f9 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/IUIService.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/IUIService.cs @@ -1,26 +1,11 @@ -using System; -using System.Collections; - -namespace System.Windows.Forms.Design -{ - /// <summary> - /// Summary description for IUIService. - /// </summary> - public interface IUIService - { - IDictionary Styles {get;} - - bool CanShowComponentEditor( object component); - IWin32Window GetDialogOwnerWindow(); - void SetUIDirty(); - bool ShowComponentEditor( object component, IWin32Window parent); - void ShowError(Exception ex); - void ShowError(string str); - void ShowError(Exception ex, string str); - DialogResult ShowDialog(Form form); - void ShowMessage(string str); - void ShowMessage(string str1, string str2); - DialogResult ShowMessage(string str1, string str2, MessageBoxButtons btn); - bool ShowToolWindow( Guid toolWindow); - } -} +using System;
+
+namespace System.Windows.Forms.Design
+{
+ /// <summary>
+ /// Summary description for IUIService.
+ /// </summary>
+ public interface IUIService
+ {
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/changelog b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/changelog index 5e376cd6065..fac3f51302d 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/changelog +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.Design/changelog @@ -1,7 +1,3 @@ -2003-08-30 Alexandre Pigolkine <pigolkine@gmx.de>
- * ComponentEditor.cs
- * IUIService.cs stubs added
-
2003-03-31 Alan Tam <Tam@SiuLung.com>
* UITypeEditor.cs: Removed because it shan't be here
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Application.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Application.cs index fa737910a6e..f5b28580a3e 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/Application.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Application.cs @@ -19,8 +19,7 @@ using System.Globalization; using System.Reflection; using System.Collections; using System.Runtime.CompilerServices; -namespace System.Windows.Forms
-{ +namespace System.Windows.Forms { /// <summary> /// Provides static methods and properties to manage an application, @@ -30,169 +29,131 @@ namespace System.Windows.Forms /// </summary> [MonoTODO] - public sealed class Application
- { + public sealed class Application { static private ApplicationContext applicationContext = null; static private bool messageLoopStarted = false; static private bool messageLoopStopRequest = false; static private ArrayList messageFilters = new ArrayList (); static private string safeTopLevelCaptionFormat; // --- (public) Properties --- - public static bool AllowQuit
- { + public static bool AllowQuit { // according to docs return false if embbedded in a // browser, not (yet?) embedded in a browser get { return true; } } [MonoTODO] - public static string CommonAppDataPath
- { - get
- { + public static string CommonAppDataPath { + get { //FIXME: return ""; } } [MonoTODO] - public static RegistryKey CommonAppDataRegistry
- { - get
- { + public static RegistryKey CommonAppDataRegistry { + get { throw new NotImplementedException (); } } [MonoTODO] - public static string CompanyName
- { - get
- { - AssemblyCompanyAttribute[] attrs =(AssemblyCompanyAttribute[]) Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute),true); - if (attrs != null && attrs[0] != null) - return attrs[0].Company; - return ""; + public static string CompanyName { + get { + AssemblyCompanyAttribute[] attrs =(AssemblyCompanyAttribute[]) Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute),true); + if (attrs != null && attrs[0] != null) + return attrs[0].Company; + return ""; } } [MonoTODO] - public static CultureInfo CurrentCulture
- { - get
- { + public static CultureInfo CurrentCulture { + get { return CultureInfo.CurrentCulture; } - set
- { + set { Thread.CurrentThread.CurrentCulture = value; } } [MonoTODO] - public static InputLanguage CurrentInputLanguage
- { + public static InputLanguage CurrentInputLanguage { get { throw new NotImplementedException (); } - set {return;} } [MonoTODO] - public static string ExecutablePath
- { - get
- { - return Assembly.GetExecutingAssembly().Location; - } + public static string ExecutablePath { + get { + return Assembly.GetExecutingAssembly().Location; + } } [MonoTODO] - public static string LocalUserAppDataPath
- { - get
- { + public static string LocalUserAppDataPath { + get { //FIXME: return ""; } } - public static bool MessageLoop
- { - get
- { + public static bool MessageLoop { + get { return messageLoopStarted; } } - - [MonoTODO] - //.NET version 1.1 - public static void EnableVisualStyles ()
- { - return; - } - + [MonoTODO] - public static string ProductName
- { - get
- { - AssemblyProductAttribute[] attrs =(AssemblyProductAttribute[]) Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute),true); - if (attrs != null && attrs[0] != null) - return attrs[0].Product; - return ""; + public static string ProductName { + get { + AssemblyProductAttribute[] attrs =(AssemblyProductAttribute[]) Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute),true); + if (attrs != null && attrs[0] != null) + return attrs[0].Product; + return ""; } } [MonoTODO] - public static string ProductVersion
- { - get
- { - AssemblyVersionAttribute[] attrs =(AssemblyVersionAttribute[]) Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyVersionAttribute),true); - if (attrs != null && attrs[0] != null) - return attrs[0].Version; - return ""; + public static string ProductVersion { + get { + AssemblyVersionAttribute[] attrs =(AssemblyVersionAttribute[]) Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyVersionAttribute),true); + if (attrs != null && attrs[0] != null) + return attrs[0].Version; + return ""; } } [MonoTODO] - public static string SafeTopLevelCaptionFormat
- { - get
- { + public static string SafeTopLevelCaptionFormat { + get { return safeTopLevelCaptionFormat; } - set
- { + set { safeTopLevelCaptionFormat = value; } } [MonoTODO] - public static string StartupPath
- { - get
- { + public static string StartupPath { + get { //FIXME: return ""; } } [MonoTODO] - public static string UserAppDataPath
- { - get
- { + public static string UserAppDataPath { + get { //FIXME: return ""; } } - [MonoTODO] - // Registry key not yet defined - public static RegistryKey UserAppDataRegistry
- { - get { throw new NotImplementedException (); } - } + //[MonoTODO] + // Registry key not yet defined + //public static RegistryKey UserAppDataRegistry { + // get { throw new NotImplementedException (); } + //} // --- Methods --- public static void AddMessageFilter (IMessageFilter value) @@ -206,7 +167,7 @@ namespace System.Windows.Forms MSG msg = new MSG(); while (Win32.PeekMessageA (ref msg, (IntPtr) 0, 0, 0, - (uint)PeekMessageFlags.PM_REMOVE) != 0); + (uint)PeekMessageFlags.PM_REMOVE) != 0); } //Compact Framework @@ -230,8 +191,7 @@ namespace System.Windows.Forms public static void OnThreadException (Exception t) { //FIXME: - if( Application.ThreadException != null)
- { + if( Application.ThreadException != null) { Application.ThreadException(null, new ThreadExceptionEventArgs(t)); } @@ -256,8 +216,7 @@ namespace System.Windows.Forms while (!messageLoopStopRequest && - Win32.GetMessageA (ref msg, 0, 0, 0) != 0)
- { + Win32.GetMessageA (ref msg, 0, 0, 0) != 0) { bool dispatchMessage = true; @@ -269,10 +228,9 @@ namespace System.Windows.Forms IEnumerator e = messageFilters.GetEnumerator(); - while (e.MoveNext())
- { + while (e.MoveNext()) { IMessageFilter filter = - (IMessageFilter) e.Current; + (IMessageFilter) e.Current; // if PreFilterMessage returns true // the message should not be dispatched @@ -281,22 +239,20 @@ namespace System.Windows.Forms } Control receiver = Control.FromChildHandle ( message.HWnd ); - if ( receiver != null )
- { + if ( receiver != null ) { dispatchMessage = ! receiver.PreProcessMessage ( ref message ); } - if (dispatchMessage)
- { + if (dispatchMessage) { Win32.TranslateMessage (ref msg); Win32.DispatchMessageA (ref msg); } //if (Idle != null) - //Idle (null, new EventArgs()); + //Idle (null, new EventArgs()); } //if (ApplicationExit != null) - //ApplicationExit (null, new EventArgs()); + //ApplicationExit (null, new EventArgs()); } public static void Run (ApplicationContext context) @@ -304,15 +260,15 @@ namespace System.Windows.Forms applicationContext = context; applicationContext.MainForm.Show (); applicationContext.ThreadExit += new EventHandler( ApplicationFormClosed ); - // applicationContext.MainForm.Closed += // - // new EventHandler (ApplicationFormClosed); +// applicationContext.MainForm.Closed += // +// new EventHandler (ApplicationFormClosed); Run(); } //[TypeAttributes.BeforeFieldInit] public static void Run (Form mainForm) - // Documents say this parameter name should be mainform, - // but the verifier says context. + // Documents say this parameter name should be mainform, + // but the verifier says context. { mainForm.CreateControl (); ApplicationContext context = new ApplicationContext ( @@ -320,13 +276,12 @@ namespace System.Windows.Forms Run (context); } - internal static void enterModalLoop ( Form mainForm ) + public static void enterModalLoop ( Form mainForm ) { mainForm.ExitModalLoop = false; MSG msg = new MSG(); - while( Win32.GetMessageA( ref msg, 0, 0, 0 ) != 0 )
- { + while( Win32.GetMessageA( ref msg, 0, 0, 0 ) != 0 ) { if ( mainForm.ExitModalLoop ) break; @@ -348,7 +303,7 @@ namespace System.Windows.Forms } - internal static void exitModalLoop ( Form mainForm ) + public static void exitModalLoop ( Form mainForm ) { mainForm.ExitModalLoop = true; @@ -362,4 +317,3 @@ namespace System.Windows.Forms public static event EventHandler ThreadExit; } } - diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/AxHost.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/AxHost.cs index f5c2235d551..086b709a7dc 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/AxHost.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/AxHost.cs @@ -32,6 +32,9 @@ namespace System.Windows.Forms { protected AxHost(string clsid,int flags){ } + + + /// --- public Properties --- /// Properties supporting .NET framework, only. Not stubbed out: public bool EditMode { @@ -169,7 +172,7 @@ namespace System.Windows.Forms { [MonoTODO] //FIXME - public new virtual bool RightToLeft { + public virtual bool RightToLeft { get { throw new NotImplementedException (); } @@ -390,12 +393,6 @@ namespace System.Windows.Forms { //FIXME: base.OnHandleCreated(e); } - - [MonoTODO] - protected virtual void OnInPlaceActive() { - //FIXME: - - } [MonoTODO] protected override void OnLostFocus(EventArgs e) { @@ -460,6 +457,47 @@ namespace System.Windows.Forms { base.WndProc(ref m); } + /// --- events --- + + //[MonoToDo] + //public event EventHandler BackColorChanged; + //public new event EventHandler BackgroundImageChanged; + //public new event EventHandler BindingContextChanged; + //public new event UICuesEventHandler ChangeUICues; + //public new event EventHandler Click; + //public new event EventHandler ContextMenuChanged; + //public new event EventHandler CursorChanged; + //public new event EventHandler DoubleClick; + //public new event DragEventHandler DragDrop; + //public new event DragEventHandler DragEnter; + //public new event EventHandler DragLeave; + //public new event DragEventHandler DragOver; + //public new event EventHandler EnabledChanged; + //public new event EventHandler FontChanged; + //public new event EventHandler ForeColorChanged; + //public new event GiveFeedbackEventHandler GiveFeedback; + //public new event HelpEventHandler HelpRequested; + //public new event EventHandler ImeModeChanged; + //public new event KeyEventHandler KeyDown; + //public new event KeyPressEventHandler KeyPress; + //public new event KeyEventHandler KeyUp; + //public new event LayoutEventHandler Layout; + //public new event MouseEventHandler MouseDown; + //public new event EventHandler MouseEnter; + //public new event EventHandler MouseHover; + //public new event EventHandler MouseLeave; + //public new event MouseEventHandler MouseMove; + //public new event MouseEventHandler MouseUp; + //public new event MouseEventHandler MouseWheel; + //public new event PaintEventHandler Paint; + //public new event QueryAccessibilityHelpEventHandler QueryAccessibilityHelp; + //public new event QueryContinueDragEventHandler QueryContinueDrag; + //public new event EventHandler RightToLeftChanged; + //public new event EventHandler StyleChanged; + //public new event EventHandler TabIndexChanged; + //public new event EventHandler TabStopChanged; + //public new event EventHandler TextChanged; + public event CancelEventHandler Validating; /// --- public delegates --- //[Serializable] protected delegate void AboutBoxDelegate(); @@ -573,6 +611,12 @@ namespace System.Windows.Forms { } } + AccessibleObject AccessibilityObject { + get { + throw new NotImplementedException (); + } + } + //protected bool RenderRightToLeft{ //} @@ -582,13 +626,10 @@ namespace System.Windows.Forms { PropertySet = 2 } - [MonoTODO] - public class AxComponentEditor {// add ref to swf.desing : WindowsFormsComponentEditor { - + public class AxComponentEditor { } - [MonoTODO] - public class ConnectionPointCookie { + public class ConnectionPointCookie { } public class StateConverter : System.ComponentModel.TypeConverter { @@ -599,7 +640,7 @@ namespace System.Windows.Forms { } [AttributeUsage(AttributeTargets.Assembly)] - public sealed class TypeLibraryTimeStampAttribute : Attribute{ + public sealed class TypeLibraryTimeStampAtribute : Attribute{ } diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Button.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Button.cs index 13f92abf3b2..fccc4cd8150 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/Button.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Button.cs @@ -128,7 +128,7 @@ namespace System.Windows.Forms { // base.OnMouseLeave(mevent); //} - internal override void ButtonPaint (PaintEventArgs pevent) { + protected override void OnPaint (PaintEventArgs pevent) { Rectangle paintBounds = ClientRectangle; Bitmap bmp = new Bitmap( paintBounds.Width, paintBounds.Height,pevent.Graphics); @@ -277,7 +277,15 @@ namespace System.Windows.Forms { } protected override void WndProc (ref Message m) { - base.WndProc (ref m); + switch (m.Msg) { + case Msg.WM_DRAWITEM: { + m.Result = (IntPtr)1; + } + break; + default: + base.WndProc (ref m); + break; + } } /// --- Button events --- diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ButtonBase.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ButtonBase.cs index 172aef21fe1..746bfe2a71f 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/ButtonBase.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ButtonBase.cs @@ -88,16 +88,7 @@ namespace System.Windows.Forms { Invalidate(); } } - [MonoTODO] - public ImageList ImageList { - get { - throw new NotImplementedException (); - } - set{ - //fixme: - }
- } - + public ContentAlignment ImageAlign { get { return imageAlign; } set { @@ -151,18 +142,17 @@ namespace System.Windows.Forms { } /// --- Methods --- - protected override void Dispose(bool disposing){ - base.Dispose(disposing); - } - + /// internal .NET framework supporting methods, not stubbed out: + /// - protected override void Dispose(bool); protected void ResetFlagsandPaint(){ } - protected override AccessibleObject CreateAccessibilityInstance() - { - return base.CreateAccessibilityInstance(); - } + // I do not think this is part of the spec. + //protected override AccessibleObject CreateAccessibilityInstance() + //{ + // throw new NotImplementedException (); + //} /// [methods for events] protected override void OnEnabledChanged (EventArgs e) @@ -228,13 +218,9 @@ namespace System.Windows.Forms { base.OnMouseUp (mevent); } - internal virtual void ButtonPaint (PaintEventArgs pevent) { - } - protected override void OnPaint (PaintEventArgs pevent) { base.OnPaint (pevent); - ButtonPaint (pevent); } protected override void OnParentChanged (EventArgs e) @@ -272,22 +258,6 @@ namespace System.Windows.Forms { } break; } - case Msg.WM_DRAWITEM: - m.Result = (IntPtr)1; - break; - case Msg.WM_PAINT: - PAINTSTRUCT ps = new PAINTSTRUCT (); - IntPtr hdc = Win32.BeginPaint (Handle, ref ps); - Rectangle rc = new Rectangle (); - rc.X = ps.rcPaint.left; - rc.Y = ps.rcPaint.top; - rc.Width = ps.rcPaint.right - ps.rcPaint.left; - rc.Height = ps.rcPaint.bottom - ps.rcPaint.top; - PaintEventArgs paintEventArgs = new PaintEventArgs (Graphics.FromHdc (hdc), rc); - OnPaint (paintEventArgs); - paintEventArgs.Dispose (); - Win32.EndPaint (Handle, ref ps); - break; default: base.WndProc (ref m); break; @@ -296,11 +266,6 @@ namespace System.Windows.Forms { /// --- ButtonBase.ButtonBaseAccessibleObject --- - /// the class isonly used for .NET framework - /// - //public class ButtonBaseAccessibleObject : Control.ControlAccessibleObject{ - // private ButtonBaseAccessibleObject() : base(/* need "control" parameter here. "this", "base" no go.*/){ - //} - //} + /// the class is not stubbed, cause it's only used for .NET framework } } diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ChangeLog b/mcs/class/System.Windows.Forms/System.Windows.Forms/ChangeLog index b8328580df5..eb84e3fc50f 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/ChangeLog +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ChangeLog @@ -1,2846 +1,2771 @@ -
-2003-09-01 Dennis Hayes <dennish@raytek.com>
- * Application.cs
- * DataGrid.cs
- * ControlPaint.cs
- * Control.cs
- * Label.cs
- * KeyEventArgs.cs
- * ButtonBase.cs
- * CheckBox.cs
- * CheckedListBox.cs
- * Form.cs
- * ScrollableControl.cs
- * TextBoxBase.cs
- * ScrollBar.cs
- * ListBox.cs
- * ListControl.cs
- * ComboBox.cs
-
- * Signiture fixes. Most notably marked as protected internal
- * some protected implmentation in Control.cs
-
-2003-08-31 Jerome Laban <jlaban@wanadoo.fr>
- * Timer.cs: Fixed Enabled property bebavior.
-
-2003-08-30 Alexandre Pigolkine <pigolkine@gmx.de>
- * Screen.cs small fixes and few methods implemented
-
-2003-08-26 Alexandre Pigolkine <pigolkine@gmx.de>
- * RadioButton.cs painting code and click logic updated
-
-2003-08-24 Alexandre Pigolkine <pigolkine@gmx.de>
- * CheckBox.cs modified to be compatible with specification
-
-2003-08-24 Duncan Mak <duncan@ximian.com>
-
- * ListControl.cs: Indentation, coding style fixes.
-
-2003-08-24 Duncan Mak <duncan@ximian.com>
-
- Patches from Brian Takita <brian.takita@runbox.com>
-
- * GroupBox.cs (OnPaintBackground): Commented out.
- * ListControl.cs (DataSource): Fixed visibility of property and
- field.
- * MonthCalander.cs: Should match Specs better.
-
-2003-08-24 Alexandre Pigolkine <pigolkine@gmx.de>
- * ControlPaint.cs DrawRadioButton and DrawCheckBox improved
-
-2003-08-22 Alexandre Pigolkine <pigolkine@gmx.de>
- * CheckedListBox.cs
- new keyword added to avoid warnings - Brian Takita
- <brian.takita@runbox.com>
-
- * ComboBox.cs modified SetBoundsCore to keep correct value for Height
- * Control.cs avoid Control creation in Enabled property
-
-2003-08-22 Alexandre Pigolkine <pigolkine@gmx.de>
- * Button.cs
- * ButtonBase.cs
- * CheckBox.cs
- * RadioButton.cs
- modified to be compatible with specification
-
-2003-08-22 Alexandre Pigolkine <pigolkine@gmx.de>
-
- * ComboBox.cs
- * Control.cs modofications for ComboBox sample
-
-2003-08-22 Duncan Mak <duncan@ximian.com>
-
- * ListControl.cs (DataSource): Implementation by Brian Takita
- <brian.takita@runbox.com>.
-
-2003-08-12 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * MenuItem.cs : added missing properties, so menu sample app can be compiled
-
-2003-08-11 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Control.cs : MouseButtons, PointToClient, PointToScreen were implemented.
- removed unnecessary check from UpdateBounds
- * Panel.cs : ability to change BorderStyle at runtime
-
-2003-08-11 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * TreeView.cs
- * TreeNode.cs
- * TreeNodeCollection.cs
- * win32functions.cs : more implementation added
- * button.cs : fix method signature
-
-2003-08-08 Dennis Hayes <dennish@raytek.com>
- * Control.cs
- * MonthCalander.cs
- * Signiture corections.
- * implmentation stuff changed to internal
- * event "e" params names changed to "pevent" type names
-
-2003-08-03 Alexandre Pigolkine <pigolkine@gmx.de>
- * CheckBox.cs 12x12 checkmark dimensions for a moment
- * ControlPaint.cs DrawRadioButton implemented
- * RadioButton.cs painting is in OnPaint
-
-2003-08-02 Alexandre Pigolkine <pigolkine@gmx.de>
- * CheckBox.cs painting in OnPaint implemented
- * CheckedListBox.cs changes to painting code
- * Button.cs code cleanup
- * Control.cs call to subclassed control can be controlled by mask
- * Message.cs helper properties
- * win32Enums.cs new values
-
-2003-08-01 Alexandre Pigolkine <pigolkine@gmx.de>
- * ControlPaint.cs DrawStringDisabled changed
- * Label.cs painting moved inside OnPaint function
- * Button.cs disposing Graphics in OnPaint
- * win32functions.cs StringFormat2DrawTextFormat added
-
-2003-07-31 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * TreeView.cs
- * TreeNode.cs
- * TreeNodeCollection.cs
- * win32enums.cs
- * win32functions.cs : more implementation added
-
-2003-07-31 Alexandre Pigolkine <pigolkine@gmx.de>
- * Control.cs : do not keep oldBounds if LAYOUT_SUSPENDED is true,
- call OnMouseDown/Up functions
- * Button.cs
- * ButtonBase.cs painting moved inside OnPaint function
- * NativeWindow.cs (commented) debug output added
-
-2003-07-31 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Control.cs : anchoring algorithm was fixed to avoid inaccuracies caused by rounding
- * TextBoxBase.cs : set FixedHeight style for single line edit boxes
-
-2003-07-30 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * TextBox.cs : ScrollBars, AcceptsReturn, CharacterCasing properties were implemented
-
-2003-07-29 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * TextBoxBase.cs
- * TextBox.cs
- * Control.cs : BackColor, ForeColor, PasswordChar for edit boxes
-
-2003-07-28 Miguel de Icaza <miguel@ximian.com>
-
- * NativeWindow.cs: Remove debugigng messages.
-
- * Control.cs: Remove debugging messages.
-
- * Label.cs: Use the border style.
-
- * win32functions.cs: Set the default to WineLib now on Linux.
-
-2003-07-23 Miguel de Icaza <miguel@ximian.com>
-
- * win32functions.cs: Move functions that do not exist in WineLib
- over to Win32_Wineless, so we do not trigger the warning messages
- until a function tries to use them.
-
- Win32() constructor: Set a hint on the appdomain that we would
- prefer to have the System.Drawing API use the Win32 implementation
- of the API.
-
- * *.cs: Updated sources to use this.
-
-2003-07-16 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * ColorDialog.cs : implemented
- * win32functions.cs
- * win32enums.cs
- * win32structs.cs : functions, flags and structs for ColorDialog
-
-2003-07-01 Alexandre Pigolkine <pigolkine@gmx.de>
- * win32Structs.cs some fields cannot be marshaled
- OFNOTIFY structure simplified
- * FileDialog.cs
- * win32functions.cs
- call wine_get_unix_filename from FileOpen dialog
-
- * win32functions.cs WineLib library name changed
-
- * NativeWindow.cs CLIENTCREATESTRUCT parameter for MDI
- Aleksey Ryabchuk <ryabchuk@yahoo.com>
-
-2003-06-30 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Form.cs : TopLevel, AcceptButton, CancelButton
- * Application.cs : allow keyboard messages in modal forms
- * Control.cs : basic impl. of GetTopLevel, SetTopLevel
-
-2003-06-30 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Cursors.cs : VSplit, HSplit cursors
- * Form.cs: WindowState ( not finished ), changes to Form.Close
- * Splitter.cs, Toolbar.cs : started implementation
-
-2003-06-26 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * TreeNode.cs
- * TreeNodeCollection.cs
- * TreeView.cs : more implementation added
-
-2003-06-24 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * TreeNode.cs
- * TreeNodeCollection.cs
- * TreeView.cs : more implementation added
-
-2003-06-12 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Menu.cs
- * ContextMenu.cs : create context menu using CreatePopupMenu function
-
-2003-06-12 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * TreeNode.cs
- * TreeNodeCollection.cs
- * TreeView.cs
- * win32functions.cs : started impl. of TreeView control
-
-2003-06-12 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Control.cs : don't do anything if Anchor is set to default value
- * SystemInformation.cs : return some system metrics
- * UserControl.cs : default size impl.
-
-2003-06-11 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * ContextMenu.cs : SourceControl, Show method
- * Control.cs : ContextMenu, CanSelect, force parent to perform layout when Dock property changes
- * GroupBox.cs
- * Label.cs
- * Panel.cs
- * PictureBox.cs
- * Splitter.cs
- * ProgressBar.cs : remove Selectable style
- * RadioButton.cs : set TextAlign to MiddleLeft by default
- * tooltip.cs : override Dispose method
- * win32Enums.cs
- * win32functions.cs : flags and function for context menu
-
-2003-06-09 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Conrols.cs : Disposing property, Dispose method
- * Cursor.cs : Show, Hide, Copy cursor
- * NativeWindow.cs : destructor
-
-2003-06-09 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Control.cs : Cursor property, handle WM_SETCURSOR
- * Cursor.cs : started implementation
- * Cursors.cs : load system cursor types
- * win32functions.cs : DestroyCursor function
-
-2003-06-09 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * HScrollBar.cs
- * ScrollBar.cs
- * VScrollBar.cs : implemented
- * ScrollEventArgs.cs: typo fix
-
-2003-06-09 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * AxHost.cs
- * MonthCalendar.cs : fixed issues breaking the build
-
-2003-06-09 Dennis Hayes <dennish@raytek.com>
- for Gopal V <gopalv82@symonds.net>
- * MonthCalendar.cs
- * AxHost.cs
- Fixed overrides
-
-2003-06-07 Alexandre Pigolkine <pigolkine@gmx.de>
- * Control.cs
- * Form.cs
- * ScrollableControl.cs
- DockStyle.None & AnchorStyles
-
-2003-06-06 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * HScrollBar.cs
- * ScrollBar.cs
- * VScrollBar.cs
- * win32Enums.cs : started implementation of scrollbar classes
-
-2003-06-06 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Form.cs : MaximumSize, MinimumSize, TopMost were implemented, small fixes and improvements
- * win32Structs.cs: WINDOWPOS structure
-
-2003-06-05 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Form.cs : ControlBox, HelpButton, MaximizeBox, MinimizeBox, maximumSize
- * win32Structs.cs: MINMAXINFO structure
-
-2003-06-04 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Control.cs
- * Form.cs : KeyPreview, ShowInTaskBar
-
-2003-06-02 Alexandre Pigolkine <pigolkine@gmx.de>
- * Application.cs
- * ComboBox.cs
- * Control.cs
- change to ContainsFocus/Focused properties
-
-2003-04-25 Miguel de Icaza <miguel@ximian.com>
-
- * SystemInformation.cs (ComputerName): Bug fix: we need to trim down the size
-
-2003-05-30 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * GroupBox.cs : take BackColor into account
-
-2003-05-27 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Control.cs : helper method getParentForm
- * Form.cs : ActiveForm , FormBorderStyle implemented
- * GroupBox.cs : some chages in drawing code, don't register another window class
- * FormBorderStyle.cs : fixed typo
- * win32functions.cs : UpdateWindowExStyle added, new prototypes for GetActiveWindow, GetForegroundWindow
-
-2003-05-27 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Button.cs
- * CheckBox.cs
- * CheckedListBox.cs
- * ComboBox.cs
- * HScrollBar.cs
- * ListBox.cs
- * ListView.cs
- * PrintPreviewControl.cs
- * RichTextBox.cs
- * ScrollBar.cs
- * Splitter.cs
- * ToolBar.cs
- * TreeView.cs
- * VScrollBar.cs : changed to use base implementation of CreateParams
-
-2003-05-27 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Control.cs : implemented GetChildIndex, BringToFront, UpdateZOrder, update z-order when recreating handle,
- * win32Strcuts.cs
- * win32Enums.cs : use ansi CharSet for tooltips
-
-2003-05-27 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Contols.cs : changes to SetVisibleCore, Invalidate (bool) is implemented
- * NativeWindow.cs : don't use CS_VREDRAW and CS_HREDRAW flags
- * ImageList.cs
- * ImageListStreamer.cs : small fixes
- * TabControl.cs
- * TabPage.cs : image list support was added
-
-2003-05-26 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * ImageListStreamer.cs: added deserialization code
- * win32functions.cs : added some prototypes required for ImageList impl.
- * win32strcuts.cs : added new structs, switched to CharSet.Ansi for TCITEM struct
- * win32Enums.cs : use ansi messages for tab control
-
-2003-05-20 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * win32functions.cs
- * NativeWindow.cs : fixed some issues causing problems when running SWF on Linux
-
-2003-05-20 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * FileDialog.cs : more implementation added
- * win32Enums.cs : added some error codes for common dialogs
- * win32functions.cs : added prototype for CommDlgExtendedError
-
-2003-05-19 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * CommonDialog.cs
- * FileDialog.cs
- * OpenFileDialog.cs
- * win32Enums.cs
- * win32Structs.cs : more implementation added
-
-2003-05-16 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * CommonDialog.cs
- * FileDialog.cs
- * win32Enums.cs
- * win32functions.cs : started impl. of OpenFile dialog
-
-2003-05-16 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * DomainUpDown.cs : changes to OnTextBoxKeyDown
- * UpDownBase.cs : added impl. to BackColor and BackgroundImage
-
-2003-05-12 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Control.cs : ResizeRedraw, removed some unused code
- * DomainUpDown.cs :
- * UpDownBase.cs : some improvements
-
-2003-05-12 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Application.cs
- * ContainerControl.cs
- * Control.cs
- * Form.cs
- * ScrollableControl.cs
- * StatusBar.cs
- * TabControl.cs
- * TabPage.cs : changes in the code for TAB key handling
-
-2003-05-09 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Control.cs
- * Form.cs
- * GroupBox.cs
- * Label.cs
- * UpDownBase.cs : some new stuff related to focus movement by the TAB key
-
-2003-05-08 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Control.cs : started implementation of keyboard handling
- * CroupBox.cs : set UserPaint style
- * TextBoxBase.cs : set subclass flag to allow catching of keyboard events
-
-2003-05-07 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Control.cs : static RegisterDefaultWindowClass method was added
- * ScrollableControl.cs : registration of "mono_scrollable_control" was moved to Control class
- * win32functions.cs : new constant DEFAULT_WINDOW_CLASS
- * PictureBox.cs : implemented
-
-2003-05-07 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Control.cs : use WS_OVERLAPPED instead of WS_OVERLAPPEDWINDOW, update text field in get Text property
- * TextBox.cs : use styles provided by TextBoxBase
- * TextBoxBase.cs : more methods and properties were implemented
- * win32enums.cs : messages and notifications for EDIT control
-
-2003-05-02 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Control.cs : call OnTextChange
- * UpdownBase.cs
- * DomainUpDown.cs : some more implementation
- * TextBox.cs : TextAlign, use base.CreateParams
- * TextBoxBase.cs : use base.CreateParams
- * Win32enums.cs : styles for edit box
-
-2003-04-30 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * TabControl.cs
- * TabPage.cs : prevent pages from being added to the TabControl multiple times
-
-2003-04-30 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Control.cs : some fixes, added call to OnControlAdded, update visibility flag in Show and Hide
- * GroupBox.cs
- * Label.cs
- * ButtoBase.cs : use base.CreateParams
- * PictureBox.cs : call base.OnResize
- * RadioButton.cs : implemented
- * TabControl.cs
- * TabPage.cs : some fixes
-
-2003-04-29 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Control.cs : call OnResize from OnSizeChanged
- * TabControl.cs : small fixes
- * Win32enums.cs : constants for ToolTip notifications
-
-2003-04-28 Alexandre Pigolkine <pigolkine@gmx.de>
- * monogc.c
- * makefile small improvements
-
-2003-04-26 Alexandre Pigolkine <pigolkine@gmx.de>
- * monogc.c GC stubs for Mini
- * win32functions.cs EntryPoint added for some functions
-
-2003-04-25 Miguel de Icaza <miguel@ximian.com>
-
- * SystemInformation.cs (ComputerName): Implement this.
-
-2003-04-25 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Control.cs : check if control is already in control collection, Created property,
- ControlCollection.RemoveAt reimplemented using ControlCollection.Remove
- * TabControl.cs
- * TabPage.cs : some more implementation
- * win32structs.cs: TCITEMHEADER replaced with TCITEM
-
-2003-04-24 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Control.cs: change to CreateControlInstance function
- * Panel.cs: use base CreateParams
- * TabControl.cs
- * TabPage : started implementing
- * win32Enums.cs
- * win32Structs.cs
- * win32functions.cs : messages, styles for TabControl
-
-2003-04-24 Alexandre Pigolkine <pigolkine@gmx.de>
- * Button.cs paint with Back/Fore colors
- * ComboBox.cs fix to notification handler
- * ContainerControl.cs
- * ControlStyles.cs
- * ListBox.cs
- * Panel.cs changes for ControlStyles
- * Control.cs ControlStyles, BackColor, painting logic
-
- * DrawItemEventArgs.cs temporary fix to avoid crach in jit
-
-
-2003-04-23 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Application.cs : new internal functions enterModalLoop, exitModalLoop
- * Button.cs : changes in DialogResult and OnClick
- * Control.cs : new internal getOwnerWindow method, recreate child windows in RecreateHandle as well
- * form.cs : implementation of modal forms
- * win32enums.cs : constants for GetWindow function
- * win32functions.cs : GetWindow , IsDialogMessage added
-
-2003-04-22 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Control.cs : implementation of docking
- * Form.cs : small changes regarding resizing of MDI client window
- * StatusBar.cs : update parts on Layout event, new style to prevent resizing by the system
-
-2003-04-17 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Control.cs : implementation of scale functions, bug-fix in ControlCollection.Add
- * Form.cs : implementation of ScaleCore method
-
-2003-04-17 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * ImageList.cs
- * ImageListStreamer.cs : started to implement
- * Control.cs : changes in implementation of size-related functions
- * Form.cs : small modifications to reflect changes in Contol class
-
-2003-04-15 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * NativeWindow.cs : don't assign window ID when it was already assigned by the system
-
-2003-04-11 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Control.cs : some new functions implemented, using BitVector32
- instead of declaring separate boolean varibales for every control status
-
-2003-04-11 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Control.cs
- * Form.cs
- * MainMenu.cs
- * Menu.cs
- * MenuItem.cs
- * NativeWindow.cs
- * win32functions.cs : some changes related to implementation of MDI interface
-
-2003-04-11 Aleksey Ryabchuk <ryabchuk@yahoo.com>
- * Control.cs : init bounds in ctor, invisible parking window
- * TrackBar.cs
- * ProgressBar.cs.cs
- * DateTimePicker.cs
- * StatusBar.cs : use base version of CreateParams
- * ScrollableControl.cs : use base version of CreateParams, removed CS_VREDRAW, CS_HREDRAW styles
- * Form.cs : reset parent back to zero for the main form
- * StatusBarPanel.cs : small bug-fix
-
-2003-04-6 DennisHayes <dennish@raytek.com>
- * Converted to Unix newlines
- * Changed copyright from 2002 to 2002/3
-
-2003-04-6 DennisHayes <dennish@raytek.com>
- * CheckOutList Update, removed everyone from list, active developers need to readd.
- * Binding.cs Marked some funmctions for Compact frame work
- * RadioButton.cs //removed inherited members
- * RichTextBox.cs //removed inherited members
- * Splitter.cs //removed a throw not implmented so some samples could run.
-
-2003-04-06 Alexandre Pigolkine <pigolkine@gmx.de>
- * Control.cs
- * Form.cs
- * NativeWindow.cs
- * Win32functions.cs
- * Win32structs.cs : initial implementation of MDI interface.
- Aleksey Ryabchuk <ryabchuk@yahoo.com>
-
- * Button.cs
- * CheckedListBox.cs
- * Control.cs
- * GroupBox.cs
- * ListBox.cs
- * ScrollableControl.cs
- Attempt to minimize fliker effect
- Alexandre Pigolkine
-
-2003-03-30 Alexandre Pigolkine <pigolkine@gmx.de>
- * DateTimePicker.cs
- * StatusBar.cs
- * tooltip.cs
- Fixed AllocCoTaskMem issure. Bug-fix for DTP.
- Aleksey Ryabchuk <ryabchuk@yahoo.com>
-
-2003-03-29 Alan Tam <Tam@SiuLung.com>
- * DataGrid.cs
- stubbed a missing method
-
-2003-03-26 Alexandre Pigolkine <pigolkine@gmx.de>
- * NumericUpDown.cs
- * ScrollableControl.cs
- * UpDownBase.cs
- * win32Structs.cs
- implementation of NumericUpDown
-
- * tooltip.cs
- * win32Enums.cs
- * win32functions.cs
- implementation of ToolTip control class.
- Aleksey Ryabchuk <ryabchuk@yahoo.com>
-
-2003-03-25 Alexandre Pigolkine <pigolkine@gmx.de>
- * CheckedListBox.cs
- * ListBox.cs
- Implementation of Collections
- Alexandre Pigolkine <pigolkine@gmx.de>
-
- * Control.cs
- * DateTimePicker.cs
- * win32Enums.cs
- notification handling for DateTimePicker control.
- * StatusBar.cs
- * TrackBar.cs
- small modifications.
- Aleksey Ryabchuk <ryabchuk@yahoo.com>
-
-
-2003-03-23 Alexandre Pigolkine <pigolkine@gmx.de>
- * DateTimePicker.cs
- * Form.cs
- * ProgressBar.cs
- * win32Enums.cs
- * win32Structs.cs
- Implementation of ProgressBar and DateTimePicker controls by
- Aleksey Ryabchuk <ryabchuk@yahoo.com>
-
- * Control.cs small fix to handle scroll bar messages
-
-2003-03-20 Alexandre Pigolkine <pigolkine@gmx.de
- * Control.cs
- * Form.cs
- * GroupBox.cs
- * Label.cs
- * Panel.cs
- * TrackBar.cs
- * win32functions.cs
- checkin for Aleksey Ryabchuk <ryabchuk@yahoo.com>
- implementation of Timer class and small modifications to other files
-
-2003-03-18 Alexandre Pigolkine <pigolkine@gmx.de>
- * monowinehooks.c
- * runwine
- attempt to use LD_PRELOAD to override stubs in Wine
- * monosem.c implementation of pthread_cond*
- * makefile
- * monogc.c
- * monostub.c
- small changes to files
-
-2003-03-17 Alexandre Pigolkine <pigolkine@gmx.de>
- * monogc.c
- * makefile
- original version of monogc.c by John Sohn <jsohn@columbus.rr.com>
-
-2003-03-15 Alexandre Pigolkine <pigolkine@gmx.de>
- * Control.cs
- * Panel.cs
- * StatusBar.cs
- * StatusBarPanel.cs
- * win32Enums.cs
- * win32functions.cs
- checkin for Aleksey Ryabchuk (ryabchuk@yahoo.com)
-
-2003-03-15 Alexandre Pigolkine <pigolkine@gmx.de>
- * monogc.c dynamic loader for gc-wine.dll by John Sohn <jsohn@columbus.rr.com>
- * makefile changed to build monogc
-
-2003-03-10 Alexandre Pigolkine <pigolkine@gmx.de>
- * Button.cs
- check in for Steven Stewart <stevenstewart@mindspring.com>
-
-2003-03-09 Alexandre Pigolkine <pigolkine@gmx.de>
- * Application.cs fixed line terminators
-
- * Form.cs
- * TrackBar.cs
- * win32Enums.cs
- implementation of TrackBar control by Aleksey Ryabchuk (ryabchuk@yahoo.com)
-
- * makefile
- * monostub.c
- * monosem.c
- parse command line
- run assembly not from main thread
- first implementation of pthread fuctions using Wine
-
-2003-03-01 Alexandre Pigolkine <pigolkine@gmx.de>
- * Button.cs changed painting code
- * ButtonBase.cs ContentAlignment operations implemented in separate functions
- * CheckedListBox.cs Implementation added
- * ComboBox.cs small modifications
- * Control.cs repaint on style changes
- * ControlPaint.cs Implementation added
- * Form.cs delegate Size to Control
- * ImageList.cs small modifications
- * ListBox.cs Implementation added
- * ListControl.cs small modifications
- * NativeWindow.cs fixed line terminators
- * ScrollableControl.cs small modifications
- * win32Enums.cs declaration added
- * win32functions.cs Implementation added, fixed line terminators
-
-
-2003-02-27 Reggie Burnett <reggie@bytefx.com>
- * Added several external functions to Win32funcs.cs
- * Added necessary LoadLibrary to RichTextEdit to load common control library
-
-2003-02-26 Reggie Burnett <reggie@bytefx.com>
- * Form.Close now actually destroys the Window
- * Application now closes when launching form is closed
-
- 2003-02-19 Alexandre Pigolkine <pigolkine@gmx.de>
- * Button.cs
- * CheckedListBox.cs
- * ComboBox.cs
- * Control.cs
- * ControlPaint.cs
- * Form.cs
- * ListBox.cs
- * win32functions.cs
- implementation added
-
- 2003-02-11 Alexandre Pigolkine <pigolkine@gmx.de>
- * ButtonBase.cs
- * ComboBox.cs
- * Control.cs
- * ListControl.cs
- * NativeWindow.cs
- implementation added
-
- The following sample from .Net SDK can run:
- Samples\QuickStart\winforms\samples\controlreference\comboboxctl\cs\
-
- 2003-02-09 Alexandre Pigolkine <pigolkine@gmx.de>
- * Button.cs
- * ButtonBase.cs
- * CheckBox.cs
- * ComboBox.cs
- * Control.cs
- * ControlPaint.cs
- implementation added
- * Message.cs
- bug fixed
- * win32Enums.cs
- * win32functions.cs
- * win32Structs.cs
- declarations added
-
-
- 2003-02-07 Alexandre Pigolkine <pigolkine@gmx.de>
- * Font.cs removed
- * Button.cs
- * ControlPaint.cs
- * ComboBox.cs
- modified
-
- 2003-02-06 Alexandre Pigolkine <pigolkine@gmx.de>
-
- * Button.cs Painting code is implemented
- * ButtonBase.cs TextAlign property implemented, WM_COMMAND handling is modified
- * ComboBox.cs Initial implementation of ObjectCollection, properties and WM_COMMAND
-
- * Control.cs Changes to WindProc of Control and ControlNativeWindow classes,
- to some properties, window handle creation, ControlCollection
- Initial implementation windows control subclassing, message reflection,
- ISynchrinizeInvoke interface.
-
- * ControlPaint.cs Initial implementation of DrawBorder3D and DrawButton
-
- * Form.cs Modification to constructor, window handle creation,
- WM_COMMAND handling, WndProc
-
- * ListBox.cs Implementation of DrawMode.OwnerDrawFixed and OwnerDrawVariable
- * Message.cs WParam helpers added
- * MessageBox.cs By default MessageBox.Show(string) brings TASKMODAL message box
- * NativeWindow.cs Implemented OnThreadException
- * PaintEventArgs.cs Dispose() method
- * ProgressBar.cs Small modifications to implementation
- * SystemInformation.cs CaptionHeight implemented
-
- * CheckBox.cs
- * GroupBox.cs
- * Label.cs
- * Panel.cs
- * TextBox.cs
- CreateParams property modified
-
- * win32enums.cs enums added
- * win32functions.cs functions added
- * win32struct.cs 2 structs modified
-
- * Application.cs
- * DrawItemEventArgs.cs
- line terminators fixed
-
- The following samples from .Net SDK can run:
- Samples\QuickStart\howto\samples\winforms\errorhandler\cs\
- Samples\QuickStart\howto\samples\winforms\ownerdrawlistbox\cs\
- Samples\QuickStart\howto\samples\winforms\threadmarshal\cs\
- Samples\QuickStart\winforms\samples\accessible\cs\
- Samples\QuickStart\winforms\samples\controlreference\buttonctl\cs\
-
- 2003-31-1 John Sohn <jsohn@columbus.rr.com>
- * makefile: cleaned and reduced dependencies to hard-coded paths
- * monostub.c: updated for compliance with the latest Mono and WineLib
-
- 2002-12-9 DennisHayes <dennish@raytek.com>
-
- * Form.cs
- * KeysConverter.cs
- * Label.cs
- * LinkArea.cs
- * LinkLabel.cs
- * ListBindingConverter.cs
- * ListBox.cs
- * ListControl.cs
- * ListView.cs
- * ListViewItem.cs
- * ListViewItemConverter.cs
- * MainMenu.cs
- * Menu.cs
- * MenuItem.cs
- * NativeWindow.cs
- * NumericUpDown.cs
- * OpacityConverter.cs
- * OSFeature.cs
- * PictureBox.cs
- * PrintControllerWithStatusDialog.cs
- * PrintDialog.cs
- * PrintPreviewControl.cs
- * PropertyManager.cs
- * RadioButton.cs
- * Screen.cs
- * ScrollableControl.cs
- * ScrollBar.cs
- * SendKeys.cs
- * SplitterEventArgs.cs
- * StatusBar.cs
- * SystemInformation.cs
- * TextBoxBase.cs
- * ToolBar.cs
- * TrackBar.cs
- * TreeNode.cs
- * TreeNodeCollection.cs
- * TreeNodeConverter.cs
- * TreeView.cs
-
- * cleanup, fixes, some implmentation
-
- 2002-12-6 DennisHayes <dennish@raytek.com>
-
- * checkin for Alexandre Pigolkine (pigolkine@gmx.de)
- * Form.cs
- * Menu.cs
- * MenuItem.cs
-
- * Implmentation
-
- 2002-12-6 DennisHayes <dennish@raytek.com>
-
- * Control.cs
- * Form.cs
- * MonthCalendar.cs
- * Screen.cs
- * SelectionRange.cs
- * SelectionRangeConverter.cs
- * TabPage.cs
- * TextBox.cs
- * Timer.cs
- * ToolBarButton.cs
- * TrackBar.cs
- * UpDownBase.cs
- * UserControl.cs
- * tooltip.cs
-
- * cleanup, dead code removeal, replaced throw not implmented's with //FIXME:s
-
- 2002-12-3 DennisHayes <dennish@raytek.com>
- * *.cs
- * switched to unix style line terminiators
-
-
-
- 2002-12-3 DennisHayes <dennish@raytek.com>
-
- * 140 files changed. replaced throw notimplmenteds with FIXME:s, removed dead code,
- * corrected
-
- 2002-12-1 DennisHayes <dennish@raytek.com>
-
- * AccessibleObject.cs
- * Application.cs
- * ApplicationContext.cs
- * AxHost.cs
- * Binding.cs
- * BindingContext.cs
- * Button.cs
- * CheckBox.cs
- * CheckedListBox.cs
- * Clipboard.cs
- * ColorDialog.cs
- * ColumnHeader.cs
- * ComboBox.cs
- * CommonDialog.cs
- * ContainerControl.cs
- * ContextMenu.cs
- * Control.cs
- * ControlBindingsCollection.cs
- * ControlPaint.cs
- * CreateParams.cs
- * CurrencyManager.cs
- * Cursor.cs
- * CursorConverter.cs
- * Cursors.cs
- * DataFormats.cs
- * DataGrid.cs
- * DataGridTableStyle.cs
- * DataGridTextBox.cs
- * DataGridTextBoxColumn.cs
- * DataObject.cs
- * ErrorProvider.cs
- * Form.cs
-
- * removed some throw notimplmented ecexptions
- * Some small implmentaions
- * some dead code removal
-
- 2002-11-28 DennisHayes <dennish@raytek.com>
-
- * In visual studio, I added a SWFTest project to the SWF solution.
- * Using Microsoft's swf.dll, I added one of each possible stock controls to the form.
- * I closed the form (swf design stuff i svery incomplete).
- * I Removed the reference to MS's swf.dll, and added a reference to the SWF project.
- * The result compiles, runs, and can be closed, without crashing in windows.
- * PrintPreviewDialog is the only item (other than crystal reports) on the
- * standard toolbar that is not included.
- * When run, a standard window comes up, not a dialog/form type window.
- * The form is as small as possible, just a caption bar of minimum width
- * with control bax and min/max box. It can be resized to any size fine.
- * no controls are actualy displayed. they may be of zero size, or it
- * may be due to the window not being a dialog box, or it may be anything.
-
- * ApplicationContext.cs
- * Button.cs
- * ChangeLog
- * CheckBox.cs
- * CheckedListBox.cs
- * ColorDialog.cs
- * ComboBox.cs
- * ContainerControl.cs
- * Control.cs
- * DataGrid.cs
- * DateTimePicker.cs
- * DomainUpDown.cs
- * ErrorProvider.cs
- * FileDialog.cs
- * FontDialog.cs
- * Form.cs
- * GroupBox.cs
- * HelpProvider.cs
- * HScrollBar.cs
- * ImageList.cs
- * Label.cs
- * LinkLabel.cs
- * ListBox.cs
- * ListControl.cs
- * ListView.cs
- * logfile.txt
- * MainMenu.cs
- * Menu.cs
- * MenuItem.cs
- * NativeWindow.cs
- * NotifyIcon.cs
- * NumericUpDown.cs
- * OpenFileDialog.cs
- * PageSetupDialog.cs
- * Panel.cs
- * PictureBox.cs
- * PrintDialog.cs
- * PrintPreviewControl.cs
- * PrintPreviewDialog.cs
- * ProgressBar.cs
- * RadioButton.cs
- * RichTextBox.cs
- * SaveFileDialog.cs
- * ScrollableControl.cs
- * ScrollBar.cs
- * Splitter.cs
- * StatusBar.cs
- * System.Windows.Forms.csproj
- * System.Windows.Forms.csproj.user
- * TabControl.cs
- * TextBox.cs
- * TextBoxBase.cs
- * Timer.cs
- * ToolBar.cs
- * ToolBarButton.cs
- * tooltip.cs
- * TrackBar.cs
- * TreeNode.cs
- * TreeNodeCollection.cs
- * TreeView.cs
- * UpDownBase.cs
- * UserControl.cs
- * VScrollBar.cs
- * win32Enums.cs
- * win32functions.cs
-
- 2002-11-27 DennisHayes <dennish@raytek.com>
- * checkin for Alexandre Pigolkine (pigolkine@gmx.de) with minor changes
-
- * Control.cs
- * MainMenu.cs
- * Menu.cs
- * MenuItem.cs
- * NativeWindow.cs
- * win32Enums.cs
- * win32functions.cs
-
- * WIN32 implmentation
-
- 2002-11-24 DennisHayes <dennish@raytek.com>
-
- * Application.cs
- * Control.cs
- * Form.cs
- * Message.cs
- * NativeWindow.cs
- * ScrollableControl.cs
- * win32functions.cs
- * win32Structs.cs
-
- * Fixed added more win32 stuff
- * On windows in Visual studio and runs my test program, but does
- * not display a window. the window Handle is null, so the size gets set to 0,0.
-
-
- 2002-11-23 DennisHayes <dennish@raytek.com>
- checked in for Francois-Denis Gonthier
-
- * win32functions.cs
- * win32Structs.cs
- * Menu.cs
- * ScrollableControl.cs
- * MenuItem.cs
- * NativeWindow.cs
- * Form.cs
- * move some more stuff from monostub to c#
- * converted a couple of files to unix style line end
- * some implmementation
-
- 2002-11-17 DennisHayes <dennish@raytek.com>
-
- * AccessibleObject.cs
-
- * Removed COMvisible. Docs say yes, but verifer says no
-
- 2002-11-17 DennisHayes <dennish@raytek.com>
-
- * Application.cs
- * Button.cs
- * Control.cs
- * Form.cs
- * Label.cs
- * ListBox.cs
- * Menu.cs
- * MessageBox.cs
- * NativeWindow.cs
- * PrintPreviewDialog.cs
- * ScrollableControl.cs
- * ScrollBar.cs
- * VScrollBar.cs
-
- * Made changes releated to the new win32 stuff
-
- 2002-11-17 DennisHayes <dennish@raytek.com>
- * Win32Enums.cs
- * Win32Handles.cs
- * Win32Interfaces.cs
- * Win32RegistryUtil.cs
- * Win32Structs.cs
-
- * Completed merging files from Carlos Harvey Perez
- * Moved all parts of Win32.cs to these files
- * eliminated Win32.cs.
- *
- * many things moved from win32.cs still commented out.
- * Also needs to be mono styled.
-
- * Win32.cs - removed
-
- 2002-11-12 DennisHayes <dennish@raytek.com>
-
- * Win32Enums.cs
- * Win32Handles.cs
- * Win32Interfaces.cs
- * Win32RegistryUtil.cs
- * Win32Structs.cs
-
- * Added files from Carlos Harvey Perez
- ** Thanks Carlos! **
- * Moved all parts of Win32.cs to these files
- * Execpt for functions. Will merge functions
- * and eliminate remove Win32.cs soon.
- *
- * most things moved from win32.cs still commented out.
- * Also needs to be mono styled.
-
- * Win32.cs
- * Moved stuff from win32.cs to files from Carlos.2002-11-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
-
-2002-11-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
-
- * ListBox.cs: added ItemHeight and DrawMode properties. Fixes the build
- in unix.
-
- * ListBox.cs: added ItemHeight and DrawMode properties. Fixes the build
- in unix.
-
-2002-11-02 Miguel de Icaza <miguel@ximian.com>
-
- * Win32.cs: Added IsMenu, CreateMenu, AppendMenuA, DestroyMenu entry points.
-
-2002-10-29 DennisHayes <dennish@raytek.com>
-
- * AmbientProperties.cs
- * Application.cs
- * ApplicationContext.cs
- * CheckBox.cs
- * CheckedListBox.cs
- * ColumnHeader.cs
- * ContainerControl.cs
- * ContextMenu.cs
- * Control.cs
- * Cursors.cs
- * HScrollBar.cs
- * ListBox.cs
- * MainMenu.cs
- * Menu.cs
- * MenuItem.cs
- * MessageBox.cs
- * NativeWindow.cs
- * PictureBox.cs
- * ScrollableControl.cs
- * ScrollBar.cs
- * System.Windows.Forms.csproj
- * System.Windows.Forms.csproj.user
- * VScrollBar.cs
- * Win32.cs
-
- * minor formating, bug fixes, and implmentation
-
-
- 2002-10-29 DennisHayes <dennish@raytek.com>
- * checkin for Alexandre Pigolkine (pigolkine@gmx.de)
- * Menu classes start on implmentation
-
- 2002-10-27 DennisHayes <dennish@raytek.com>
-
- * AccessibleObject.cs
- * AssemblyInfo.cs
- * AxHost.cs
- * BaseCollection.cs
- * BindingMemberInfo.cs
- * BindingsCollection.cs
- * ButtonBase.cs
- * ColumnClickEventArgs.cs
- * ComboBox.cs
- * ContainerControl.cs
- * ContentsResizedEventArgs.cs
- * Control.cs
- * ControlEventArgs.cs
- * ConvertEventArgs.cs
- * DateBoldEventArgs.cs
- * DateRangeEventArgs.cs
- * DomainUpDown.cs
- * DragEventArgs.cs
- * DrawItemEventArgs.cs
- * FolderBrowserDialog.cs
- * Form.cs
- * GiveFeedbackEventArgs.cs
- * HelpEventArgs.cs
- * InputLanguageChangedEventArgs.cs
- * InputLanguageChangingEventArgs.cs
- * InvalidateEventArgs.cs
- * ItemChangedEventArgs.cs
- * ItemCheckEventArgs.cs
- * ItemDragEventArgs.cs
- * KeyEventArgs.cs
- * KeyPressEventArgs.cs
- * Keys.cs
- * LabelEditEventArgs.cs
- * LayoutEventArgs.cs
- * LinkClickedEventArgs.cs
- * LinkLabelLinkClickedEventArgs.cs
- * ListControl.cs
- * MeasureItemEventArgs.cs
- * MouseEventArgs.cs
- * NavigateEventArgs.cs
- * NodeLabelEditEventArgs.cs
- * PaintEventArgs.cs
- * PrintPreviewDialog.cs
- * PropertyTabChangedEventArgs.cs
- * PropertyValueChangedEventArgs.cs
- * QueryAccessibilityHelpEventArgs.cs
- * QueryContinueDragEventArgs.cs
- * ScrollEventArgs.cs
- * SelectedGridItemChangedEventArgs.cs
- * SplitterEventArgs.cs
- * StatusBarDrawItemEventArgs.cs
- * StatusBarPanelClickEventArgs.cs
- * System.Windows.Forms.csproj
- * System.Windows.Forms.csproj.user
- * TextBox.cs
- * ToolBarButtonClickEventArgs.cs
- * TreeNodeConverter.cs
- * TreeViewCancelEventArgs.cs
- * UICuesEventArgs.cs
- * UpDownBase.cs
- * UpDownEventArgs.cs
- * VScrollBar.cs
-
-
- * Stubs now compliant with .NET 1.1 Beta, except for one that has dependencies.
- * Added FolderBrowserDialog.cs for .NET 1.1 beta compatibility.
- * Completed implmentation of all *Args classes.
- * Updated checkoutlist.
- * Made fixes so this will compile using Visual studio under windows.
-
-
-
- 2002-10-26 DennisHayes <dennish@raytek.com>
-
- * Added CheckOutFile to SWF one level up from here
- * to keep track of who is working on what.
-
- 2002-10-24 DennisHayes <dennish@raytek.com>
-
- * AccessibleObject.cs
- * Application.cs
- * AssemblyInfo.cs
- * BaseCollection.cs
- * BindingContext.cs
- * BindingManagerBase.cs
- * BindingsCollection.cs
- * ContainerControl.cs
- * Control.cs
- * Font.cs
- * Form.cs
- * IAccessible.cs
- * InputLanguageCollection.cs
- * Label.cs
- * MessageBox.cs
- * PropertyTabChangedEventArgs.cs
- * ScrollableControl.cs
- * Win32.cs
- * WINELib.csproj
- * WINELib.csproj.user
- * winelib.sln
-
- * Changes to get winelib version running with more methods uncommented out.
- * Especialy trying to get CE compliance.
-
-2002-10-22 DennisHayes <dennish@raytek.com>
- * Miguel moved files from WINELIB to here
- * See ochagelog for details
-
-2002-10-13 DennisHayes <dennish@raytek.com>
-
- *Application.cs
- *AxHost.cs
- *ChangeLog
- *CheckedListBox.cs
- *ComboBox.cs
- *CurrencyManager.cs
- *DateTimePicker.cs
- *DomainUpDown.cs
- *FolderBrowserDialog.cs
- *ListBox.cs
- *logfile.txt
- *StatusBarDrawItemEventArgs.cs
- *TabControl.cs
- *TextBox.cs
- *TrackBar.cs
- *UpDownBase.cs
-
- * Updated to match .NET V1.1 Beta
-
-2002-9-2 DennisHayes <dennish@raytek.com>
-
-* AccessibleObject.cs
-* AmbientProperties.cs
-* AxHost.cs
-* Button.cs
-* ButtonBase.cs
-* CheckBox.cs
-* ColorDialog.cs
-* ColumnHeader.cs
-* ComboBox.cs
-* ContainerControl.cs
-* DataGrid.cs
-* DateTimePicker.cs
-* ListControl.cs
-* PrintPreviewDialog.cs
-* Implmented any functions.
-
-* System.Windows.Forms.csproj
-* System.Windows.Forms.csproj.user
-* Added win32.cs
-
-2002-8-6 DennisHayes <dennish@raytek.com>
-* Checked in for Ginandrea Terzi (gterzi@lario.com)
-
-* MeasureItemEventArgs.cs
-* PropertyValueChangedEventArgs.cs
-* ScrollEventArgs.cs
-* ScrollEventType.cs
-* SelectionMode.cs
-* Shortcut.cs
-* TickStyle.cs
-* ToolBarButtonClickEventArgs.cs
-* TreeViewAction.cs
-* TriangleDirection.cs
-* UICues.cs
-* UICuesEventArgs.cs
-* UpDownBase.cs
-* UpDownEventHandler.cs
-* Fixed syntax errors and verifier errors
-
-2002-8-6 DennisHayes <dennish@raytek.com>
-
-* PropertyTabChangedEventArgs.cs
-* Minor sytax bug fixes.
-
-* System.Windows.Forms.csproj
-* System.Windows.Forms.csproj.user
-* System.Windows.Forms.sln
-* Added support for System.Windows.Forms.Design
-* Builds two dlls instead of one.
-* Allows compiling for now, but needs to be fixed
-
-2002-8-2 DennisHayes <dennish@raytek.com>
-* Checked in for Ginandrea Terzi (gterzi@lario.com)
-
-* AssemblyInfo.cs
-* ColumnClickEventArgs.cs
-* ContentsResizedEventArgs.cs
-* ControlEventArgs.cs
-* ConvertEventArgs.cs
-* DateBoldEventArgs.cs
-* DateRangeEventArgs.cs
-* DragEventArgs.cs
-* DrawItemEventArgs.cs
-* GiveFeedbackEventArgs.cs
-* HelpEventArgs.cs
-* InputLanguageChangedEventArgs.cs
-* InputLanguageChangingEventArgs.cs
-* InvalidateEventArgs.cs
-* ItemChangedEventArgs.cs
-* ItemCheckEventArgs.cs
-* ItemDragEventArgs.cs
-
-* KeyEventArgs.cs
-* KeyPressEventArgs.cs
-* LabelEditEventArgs.cs
-* LayoutEventArgs.cs
-* LinkClickedEventArgs.cs
-* LinkLabelLinkClickedEventArgs.cs
-* logfile.txt
-* MeasureItemEventArgs.cs
-* MouseEventArgs.cs
-* NavigateEventArgs.cs
-* NodeLabelEditEventArgs.cs
-* PaintEventArgs.cs
-* PropertyTabChangedEventArgs.cs
-* PropertyValueChangedEventArgs.cs
-* QueryAccessibilityHelpEventArgs.cs
-* QueryContinueDragEventArgs.cs
-* ScrollEventArgs.cs
-* SelectedGridItemChangedEventArgs.cs
-* SplitterEventArgs.cs
-* StatusBarDrawItemEventArgs.cs
-* StatusBarPanelClickEventArgs.cs
-* ToolBarButtonClickEventArgs.cs
-* TreeViewCancelEventArgs.cs
-* UICuesEventArgs.cs
-* UpDownEventArgs.cs
-* Improved ToString functions
-* Completed the rest of the *.args classes
-
-2002-8-1 DennisHayes <dennish@raytek.com>
-* Checked in for Ginandrea Terzi (gterzi@lario.com)
-
-* KeyEventArgs.cs
-* KeyPressEventArgs.cs
-* LabelEditEventArgs.cs
-* LayoutEventArgs.cs
-* LinkClickedEventArgs.cs
-* LinkLabelLinkClickedEventArgs.cs
-* MeasureItemEventArgs.cs
-* MouseEventArgs.cs
-* NavigateEventArgs.cs
-* NodeLabelEditEventArgs.cs
-* PaintEventArgs.cs
-* PropertyTabChangedEventArgs.cs
-* PropertyValueChangedEventArgs.cs
-* QueryAccessibilityHelpEventArgs.cs
-* QueryContinueDragEventArgs.cs
-* ScrollEventArgs.cs
-* SelectedGridItemChangedEventArgs.cs
-* SplitterEventArgs.cs
-* StatusBarDrawItemEventArgs.cs
-* StatusBarPanelClickEventArgs.cs
-* ToolBarButtonClickEventArgs.cs
-* TreeViewCancelEventArgs.cs
-* UICuesEventArgs.cs
-* UpDownEventArgs.cs
-* Corrected, cleaned up/ completed some *args.cs classes.
-* May break build, but should be easy to fix, will verifiy
-* tonight and check in any needed fixes.
-
-2002-8-1 DennisHayes <dennish@raytek.com>
-* MonthCalendar.cs
-* ButtonBase.cs
-* Form.cs
-* MonthCalendar commented out, stubbs need work
-* GTK references removed from Buttonbase and form, to make compile easier.
-* Replace GTK references as soon as build works on Windows and Linux.
-* With this, SWF should compile uder visual studio
-
-2002-8-1 DennisHayes <dennish@raytek.com>
-* TODOAttribute.cs
-* ComVisible.cs
-* added so the namespace can compile, remove when replaced with mono equivalents.
-
-2002-8-1 DennisHayes <dennish@raytek.com>
-* System.Windows.Forms.csproj
-* System.Windows.Forms.csproj.user
-* System.Windows.Forms.sln
-* AssemblyInfo.cs * Not sure if this file is needed. not a part of the namespace, just visual studio
-* Added files to compile using visual Studio
-
-2002-8-1 DennisHayes <dennish@raytek.com>
-* Getopt.cs
-* removed, file contained only trash, not needed.
-
-
-2002-7-30 DennisHayes <dennish@raytek.com>
-
-* AccessibleNavigation.cs
-* AccessibleObject.cs
-* AccessibleSelection.cs
-* AmbientProperties.cs
-* Application.cs
-* ApplicationContext.cs
-* AxHost.cs
-* BaseCollection.cs
-* Binding.cs
-* BindingContext.cs
-* BindingManagerBase.cs
-* BindingMemberInfo.cs
-* BindingsCollection.cs
-* Button.cs
-* ButtonBase.cs
-* CaptionButton.cs
-* CharacterCasing.cs
-* CheckBox.cs
-* CheckedListBox.cs
-* CheckState.cs
-* Clipboard.cs
-* ColorDialog.cs
-* ColumnClickEventArgs.cs
-* ColumnClickEventHandler.cs
-* ColumnHeader.cs
-* ComboBox.cs
-* CommonDialog.cs
-* ContainerControl.cs
-* ContentsResizedEventHandler.cs
-* ContextMenu.cs
-* Control.cs
-* ControlBindingsCollection.cs
-* ControlEventArgs.cs
-* ControlEventHandler.cs
-* ControlPaint.cs
-* ConvertEventHandler.cs
-* CreateParams.cs
-* CurrencyManager.cs
-* Cursor.cs
-* CursorConverter.cs
-* Cursors.cs
-* DataFormats.cs
-* DataGrid.cs
-* DataGridBoolColumn.cs
-* DataGridCell.cs
-* DataGridColumnStyle.cs
-* DataGridParentRowsLabelStyle.cs
-* DataGridPreferredColumnWidthTypeConverter.cs
-* DataGridTableStyle.cs
-* DataGridTextBox.cs
-* DataGridTextBoxColumn.cs
-* DataObject.cs
-* DateBoldEventArgs.cs
-* DateRangeEventArgs.cs
-* DateRangeEventHandler.cs
-* DateTimePicker.cs
-* DialogResult.cs
-* DockStyle.cs
-* DomainUpDown.cs
-* DragAction.cs
-* DragDropEffects.cs
-* DragEventArgs.cs
-* DragEventHandler.cs
-* DrawItemEventArgs.cs
-* DrawItemEventHandler.cs
-* DrawItemState.cs
-* DrawMode.cs
-* ErrorBlinkStyle.cs
-* ErrorIconAlignment.cs
-* ErrorProvider.cs
-* FeatureSupport.cs
-* FileDialog.cs
-* FlatStyle.cs
-* FontDialog.cs
-* Form.cs
-* FormBorderStyle.cs
-* FormStartPosition.cs
-* FormWindowState.cs
-* FrameStyle.cs
-* GiveFeedbackEventHandler.cs
-* GridColumnStylesCollection.cs
-* GridItemCollection.cs
-* GridTableStylesCollection.cs
-* GroupBox.cs
-* Help.cs
-* HelpEventHandler.cs
-* HelpProvider.cs
-* HScrollBar.cs
-* ImageIndexConverter.cs
-* ImageList.cs
-* ImageListStreamer.cs
-* InputLanguage.cs
-* InputLanguageChangedEventHandler.cs
-* InputLanguageChangingEventHandler.cs
-* InputLanguageCollection.cs
-* InvalidateEventHandler.cs
-* ItemChangedEventArgs.cs
-* ItemChangedEventHandler.cs
-* ItemCheckEventHandler.cs
-* ItemDragEventHandler.cs
-* KeyEventHandler.cs
-* KeyPressEventArgs.cs
-* KeyPressEventHandler.cs
-* KeysConverter.cs
-* Label.cs
-* LabelEditEventHandler.cs
-* LayoutEventHandler.cs
-* LinkArea.cs
-* LinkClickedEventHandler.cs
-* LinkLabel.cs
-* LinkLabelLinkClickedEventHandler.cs
-* ListBindingConverter.cs
-* ListBox.cs
-* ListControl.cs
-* ListView.cs
-* ListViewItem.cs
-* ListViewItemConverter.cs
-* logfile.txt
-* MainMenu.cs
-* MeasureItemEventHandler.cs
-* Menu.cs
-* MenuItem.cs
-* Message.cs
-* MessageBox.cs
-* MethodInvoker.cs
-* MonthCalendar.cs
-* MouseEventHandler.cs
-* NativeWindow.cs
-* NavigateEventHandler.cs
-* NodeLabelEditEventHandler.cs
-* NotifyIcon.cs
-* NumericUpDown.cs
-* OpacityConverter.cs
-* OpenFileDialog.cs
-* OSFeature.cs
-* PageSetupDialog.cs
-* PaintEventArgs.cs
-* PaintEventHandler.cs
-* Panel.cs
-* PrintControllerWithStatusDialog.cs
-* PrintDialog.cs
-* PrintPreviewControl.cs
-* PrintPreviewDialog.cs
-* ProgressBar.cs
-* PropertyGrid.cs
-* PropertyManager.cs
-* PropertyTabChangedEventArgs.cs
-* PropertyTabChangedEventHandler.cs
-* PropertyValueChangedEventHandler.cs
-* QueryAccessibilityHelpEventHandler.cs
-* QueryContinueDragEventHandler.cs
-* RadioButton.cs
-* RichTextBox.cs
-* SaveFileDialog.cs
-* Screen.cs
-* ScrollableControl.cs
-* ScrollBar.cs
-* ScrollEventArgs.cs
-* ScrollEventHandler.cs
-* SelectedGridItemChangedEventHandler.cs
-* SelectionRange.cs
-* SelectionRangeConverter.cs
-* SendKeys.cs
-* Splitter.cs
-* SplitterEventHandler.cs
-* StatusBar.cs
-* StatusBarDrawItemEventArgs.cs
-* StatusBarDrawItemEventHandler.cs
-* StatusBarPanel.cs
-* StatusBarPanelClickEventArgs.cs
-* StatusBarPanelClickEventHandler.cs
-* StatusBarPanelCollection.cs
-* SystemInformation.cs
-
-* TabControl.cs
-* TabPage.cs
-* TextBox.cs
-* TextBoxBase.cs
-* ThreadExceptionDialog.cs
-* Timer.cs
-* ToolBar.cs
-* ToolBarButton.cs
-* ToolBarButtonClickEventHandler.cs
-* ToolTip.cs
-* TrackBar.cs
-* TreeNode.cs
-* TreeNodeCollection.cs
-* TreeNodeConverter.cs
-* TreeView.cs
-* TreeViewCancelEventHandler.cs
-* TreeViewEventHandler.cs
-* TreeViewImageIndexConverter.cs
-* UICuesEventArgs.cs
-* UICuesEventHandler.cs
-* UpDownBase.cs
-* UpDownEventHandler.cs
-* UserControl.cs
-* VScrollBar.cs
-* Fixed errors reported by verify.exe, mostly attribute errors.
-* Added my name to author's list to files I edited in the last two weeks
-
-2002-7-22 DennisHayes <dennish@raytek.com>
-
-* DateTimePickerFormat.cs
-* Added values.
-* The NAMESPACE NOW COMPILES under windows in Visual Studio using the Microsoft version of the classes.
-* Verify.exe reports 600 errors.
-
-2002-7-21 DennisHayes <dennish@raytek.com>
-
-* AccessibleObject.cs
-* AmbientProperties.cs
-* AxHost.cs
-* BaseCollection.cs
-* BindingsCollection.cs
-* ButtonBase.cs
-* CheckBox.cs
-* CheckedListBox.cs
-* ComboBox.cs
-* ContainerControl.cs
-* ContextMenu.cs
-* Control.cs
-* ControlEventArgs.cs
-* ControlPaint.cs
-* ConvertEventArgs.cs
-* DataGrid.cs
-* DataGridColumnStyle.cs
-* DataObject.cs
-* DateTimePicker.cs
-* DomainUpDown.cs
-* DragEventArgs.cs
-* DrawItemEventArgs.cs
-* ErrorProvider.cs
-* FeatureSupport.cs
-* FileDialog.cs
-* FontDialog.cs
-* Form.cs
-* GiveFeedbackEventArgs.cs
-* GridColumnStylesCollection.cs
-* GridItem.cs
-* GridItemCollection.cs
-* GridTableStylesCollection.cs
-* GroupBox.cs
-* Help.cs
-* HelpEventArgs.cs
-* HelpProvider.cs
-* HScrollBar.cs
-* ImageIndexConverter.cs
-* ImageList.cs
-* ImageListStreamer.cs
-* InputLanguage.cs
-* InputLanguageChangedEventArgs.cs
-* InputLanguageChangingEventArgs.cs
-* InputLanguageCollection.cs
-* InvalidateEventArgs.cs
-* ItemChangedEventArgs.cs
-* ItemCheckEventArgs.cs
-* ItemDragEventArgs.cs
-* KeyEventArgs.cs
-* KeyPressEventArgs.cs
-* KeysConverter.cs
-* Label.cs
-* LabelEditEventArgs.cs
-* LayoutEventArgs.cs
-* LinkArea.cs
-* LinkClickedEventArgs.cs
-* LinkLabel.cs
-* LinkLabelLinkClickedEventArgs.cs
-* LinkLabelLinkClickedEventHandler.cs
-* ListBindingConverter.cs
-* ListBox.cs
-* ListControl.cs
-* ListView.cs
-* ListViewItem.cs
-* ListViewItemConverter.cs
-* MainMenu.cs
-* MeasureItemEventArgs.cs
-* Menu.cs
-* MenuItem.cs
-* Message.cs
-* MessageBox.cs
-* MouseEventArgs.cs
-* NativeWindow.cs
-* NavigateEventArgs.cs
-* NodeLabelEditEventArgs.cs
-* NotifyIcon.cs
-* NumericUpDown.cs
-* OpacityConverter.cs
-* OpenFileDialog.cs
-* OSFeature.cs
-* PageSetupDialog.cs
-* PaintEventArgs.cs
-* Panel.cs
-* PrintControllerWithStatusDialog.cs
-* PrintDialog.cs
-* PrintPreviewDialog.cs
-* QueryAccessibilityHelpEventArgs.cs
-* QueryContinueDragEventArgs.cs
-* RadioButton.cs
-* RichTextBox.cs
-* SaveFileDialog.cs
-* Screen.cs
-* ScrollableControl.cs
-* ScrollBar.cs
-* ScrollEventArgs.cs
-* SelectedGridItemChangedEventArgs.cs
-* SelectionRange.cs
-* SelectionRangeConverter.cs
-* SendKeys.cs
-* Splitter.cs
-* SplitterEventArgs.cs
-* StatusBar.cs
-* StatusBarDrawItemEventArgs.cs
-* StatusBarPanelCollection.cs
-* TabControl.cs
-* TabPage.cs
-* TextBox.cs
-* TextBoxBase.cs
-* ToolBar.cs
-* ToolBarButtonClickEventArgs.cs
-* ToolTip.cs
-* TrackBar.cs
-* TreeNodeCollection.cs
-* TreeView.cs
-* UserControl.cs
-* commented out inherited class that did not need to be stubbed.
-* fixed bugs, added values to one enum. Stubbed interfaces.
-* The NAMESPACE NOW COMPILES under windows in Visual Studio using the Microsoft version of the classes.
-* Verify.exe reports 600 errors.
-
-2002-7-7 DennisHayes <dennish@raytek.com>
-
-* ToolBarButtonClickEventArgs.cs
-* UpDownEventArgs.cs
-* KeyPressEventHandler.cs
-* Added new files.
-
-2002-7-7 DennisHayes <dennish@raytek.com>
-
-* AccessibleEvents.cs
-* AccessibleNavigation.cs
-* AccessibleObject.cs
-* AccessibleRole.cs
-* AccessibleSelection.cs
-* AccessibleStates.cs
-* AmbientProperties.cs
-* AnchorStyles.cs
-* Appearance.cs
-* Application.cs
-* ApplicationContext.cs
-* ArrangeDirection.cs
-* ArrangeStartingPosition.cs
-* AxHost.cs
-* BaseCollection.cs
-* Binding.cs
-* BindingContext.cs
-* BindingManagerBase.cs
-* BindingMemberInfo.cs
-* BindingsCollection.cs
-* BootMode.cs
-* Border3DSide.cs
-* Border3DStyle.cs
-* BorderStyle.cs
-* BoundsSpecified.cs
-* Button.cs
-* ButtonBase.cs
-* ButtonBorderStyle.cs
-* ButtonState.cs
-* CaptionButton.cs
-* CharacterCasing.cs
-* CheckBox.cs
-* CheckedListBox.cs
-* CheckState.cs
-* Clipboard.cs
-* ColorDepth.cs
-* ColorDialog.cs
-* ColumnClickEventArgs.cs
-* ColumnClickEventHandler.cs
-* ColumnHeader.cs
-* ColumnHeaderStyle.cs
-* ComboBox.cs
-* ComboBoxStyle.cs
-* CommonDialog.cs
-* ComVisible.cs
-* ContainerControl.cs
-* ContentsResizedEventArgs.cs
-* ContentsResizedEventHandler.cs
-* ContextMenu.cs
-* Control.cs
-* ControlBindingsCollection.cs
-* ControlEventArgs.cs
-* ControlEventHandler.cs
-* ControlPaint.cs
-* ControlStyles.cs
-* ConvertEventArgs.cs
-* ConvertEventHandler.cs
-* CreateParams.cs
-* CurrencyManager.cs
-* Cursor.cs
-* CursorConverter.cs
-* Cursors.cs
-* DataFormats.cs
-* DataGrid.cs
-* DataGridBoolColumn.cs
-* DataGridCell.cs
-* DataGridColumnStyle.cs
-* DataGridLineStyle.cs
-* DataGridParentRowsLabelStyle.cs
-* DataGridPreferredColumnWidthTypeConverter.cs
-* DataGridTableStyle.cs
-* DataGridTextBox.cs
-* DataGridTextBoxColumn.cs
-* DataObject.cs
-* DateBoldEventArgs.cs
-* DateRangeEventArgs.cs
-* DateRangeEventHandler.cs
-* DateTimePicker.cs
-* DateTimePickerFormat.cs
-* day.cs
-* DialogResult.cs
-* DockStyle.cs
-* DomainUpDown.cs
-* DragAction.cs
-* DragDropEffects.cs
-* DragEventArgs.cs
-* DragEventHandler.cs
-* DrawItemEventArgs.cs
-* DrawItemEventHandler.cs
-* DrawItemState.cs
-* DrawMode.cs
-* ErrorBlinkStyle.cs
-* ErrorIconAlignment.cs
-* ErrorProvider.cs
-* FeatureSupport.cs
-* FileDialog.cs
-* FlatStyle.cs
-* FontDialog.cs
-* Form.cs
-* FormBorderStyle.cs
-* FormStartPosition.cs
-* FormWindowState.cs
-* FrameStyle.cs
-* Getopt.cs
-* GiveFeedbackEventArgs.cs
-* GiveFeedbackEventHandler.cs
-* GridColumnStylesCollection.cs
-* GridItem.cs
-* GridItemCollection.cs
-* GridItemType.cs
-* GridTableStylesCollection.cs
-* GroupBox.cs
-* Help.cs
-* HelpEventArgs.cs
-* HelpEventHandler.cs
-* HelpNavigator.cs
-* HelpProvider.cs
-* HorizontalAlignment.cs
-* HScrollBar.cs
-* IButtonControl.cs
-* ICommandExecutor.cs
-* IComponentEditorPageSite.cs
-* IContainerControl.cs
-* IDataGridColumnStyleEditingNotificationService.cs
-* IDataGridEditingService.cs
-* IDataObject.cs
-* IFeatureSupport.cs
-* IFileReaderService.cs
-* ImageIndexConverter.cs
-* ImageList.cs
-* ImageListStreamer.cs
-* ImeMode.cs
-* IMessageFilter.cs
-* InputLanguage.cs
-* InputLanguageChangedEventArgs.cs
-* InputLanguageChangedEventHandler.cs
-* InputLanguageChangingEventArgs.cs
-* InputLanguageChangingEventHandler.cs
-* InputLanguageCollection.cs
-* InvalidateEventArgs.cs
-* InvalidateEventHandler.cs
-* ItemActivation.cs
-* ItemBoundsPortion.cs
-* ItemChangedEventArgs.cs
-* ItemChangedEventHandler.cs
-* ItemCheckEventArgs.cs
-* ItemCheckEventHandler.cs
-* ItemDragEventArgs.cs
-* ItemDragEventHandler.cs
-* IWin32Window.cs
-* IWindowTarget.cs
-* KeyEventArgs.cs
-* KeyEventHandler.cs
-* KeyPressEventArgs.cs
-* KeyPressEventHandler.cs
-* Keys.cs
-* KeysConverter.cs
-* Label.cs
-* LabelEditEventArgs.cs
-* LabelEditEventHandler.cs
-* LayoutEventArgs.cs
-* LayoutEventHandler.cs
-* LeftRightAlignment.cs
-* LinkArea.cs
-* LinkBehavior.cs
-* LinkClickedEventArgs.cs
-* LinkClickedEventHandler.cs
-* LinkLabel.cs
-* LinkLabelLinkClickedEventArgs.cs
-* LinkLabelLinkClickedEventHandler.cs
-* LinkState.cs
-* ListBindingConverter.cs
-* ListBox.cs
-* ListControl.cs
-* ListView.cs
-* ListViewAlignment.cs
-* ListViewItem.cs
-* ListViewItemConverter.cs
-* MainMenu.cs
-* MdiLayout.cs
-* MeasureItemEventArgs.cs
-* MeasureItemEventHandler.cs
-* Menu.cs
-* MenuGlyph.cs
-* MenuItem.cs
-* MenuMerge.cs
-* Message.cs
-* MessageBox.cs
-* MessageBoxButtons.cs
-* MessageBoxDefaultButton.cs
-* MessageBoxIcon.cs
-* MessageBoxOptions.cs
-* MethodInvoker.cs
-* MonthCalendar.cs
-* MouseButtons.cs
-* MouseEventArgs.cs
-* MouseEventHandler.cs
-* NativeWindow.cs
-* NavigateEventArgs.cs
-* NavigateEventHandler.cs
-* NodeLabelEditEventArgs.cs
-* NodeLabelEditEventHandler.cs
-* NotifyIcon.cs
-* NumericUpDown.cs
-* OpacityConverter.cs
-* OpenFileDialog.cs
-* Orientation.cs
-* OSFeature.cs
-* PageSetupDialog.cs
-* PaintEventArgs.cs
-* PaintEventHandler.cs
-* Panel.cs
-* PictureBoxSizeMode.cs
-* PrintControllerWithStatusDialog.cs
-* PrintDialog.cs
-* PrintPreviewControl.cs
-* PrintPreviewDialog.cs
-* ProgressBar.cs
-* PropertyGrid.cs
-* PropertyManager.cs
-* PropertySort.cs
-* PropertyTabChangedEventArgs.cs
-* PropertyTabChangedEventHandler.cs
-* PropertyValueChangedEventArgs.cs
-* PropertyValueChangedEventHandler.cs
-* QueryAccessibilityHelpEventArgs.cs
-* QueryAccessibilityHelpEventHandler.cs
-* QueryContinueDragEventArgs.cs
-* QueryContinueDragEventHandler.cs
-* RadioButton.cs
-* RichTextBox.cs
-* RichTextBoxFinds.cs
-* RichTextBoxScrollBars.cs
-* RichTextBoxSelectionAttribute.cs
-* RichTextBoxSelectionTypes.cs
-* RichTextBoxStreamType.cs
-
-* RichTextBoxWordPunctuations.cs
-* RightToLeft.cs
-* SaveFileDialog.cs
-* Screen.cs
-* ScrollableControl.cs
-* ScrollBar.cs
-* ScrollBars.cs
-* ScrollButton.cs
-
-* ScrollEventArgs.cs
-* ScrollEventHandler.cs
-* ScrollEventType.cs
-* SecurityIDType.cs
-* SelectedGridItemChangedEventArgs.cs
-* SelectedGridItemChangedEventHandler.cs
-* SelectionMode.cs
-* SelectionRange.cs
-* SelectionRangeConverter.cs
-* SendKeys.cs
-* Shortcut.cs
-* SizeGripStyle.cs
-* SortOrder.cs
-* Splitter.cs
-* SplitterEventArgs.cs
-* SplitterEventHandler.cs
-* StatusBar.cs
-* StatusBarDrawItemEventArgs.cs
-* StatusBarDrawItemEventHandler.cs
-* StatusBarPanel.cs
-* StatusBarPanelAutoSize.cs
-* StatusBarPanelBorderStyle.cs
-* StatusBarPanelClickEventArgs.cs
-* StatusBarPanelClickEventHandler.cs
-* StatusBarPanelCollection.cs
-* StatusBarPanelStyle.cs
-* StructFormat.cs
-* SystemInformation.cs
-* TabAlignment.cs
-* TabAppearance.cs
-* TabControl.cs
-* TabDrawMode.cs
-* TabPage.cs
-* TabSizeMode.cs
-* TextBox.cs
-* TextBoxBase.cs
-* ThreadExceptionDialog.cs
-* TickStyle.cs
-* Timer.cs
-* ToolBar.cs
-* ToolBarAppearance.cs
-* ToolBarButton.cs
-* ToolBarButtonClickEventArgs.cs
-* ToolBarButtonClickEventHandler.cs
-* ToolBarButtonStyle.cs
-* ToolBarTextAlign.cs
-* ToolTip.cs
-* TrackBar.cs
-* TreeNode.cs
-* TreeNodeCollection.cs
-* TreeNodeConverter.cs
-* TreeView.cs
-* TreeViewAction.cs
-* TreeViewCancelEventArgs.cs
-* TreeViewCancelEventHandler.cs
-* TreeViewEventArgs.cs
-* TreeViewEventHandler.cs
-* TreeViewImageIndexConverter.cs
-* UICues.cs
-* UICuesEventArgs.cs
-* UICuesEventHandler.cs
-* UpDownBase.cs
-* UpDownEventArgs.cs
-* UpDownEventHandler.cs
-* UserControl.cs
-* View.cs
-* VScrollBar.cs
-* Monostyled everything!
-
-
-
-2002-7-7 DennisHayes <dennish@raytek.com>
-
-* AccessibleObject.cs
-* AmbientProperties.cs
-* AxHost.cs
-* BindingsCollection.cs
-* Button.cs
-* ButtonBase.cs
-* ChangeLog
-* CheckBox.cs
-* CheckedListBox.cs
-* ColorDialog.cs
-* ComboBox.cs
-* CommonDialog.cs
-* ContainerControl.cs
-* ContextMenu.cs
-* ControlEventArgs.cs
-* CurrencyManager.cs
-* DataGrid.cs
-* DataGridBoolColumn.cs
-* DataGridColumnStyle.cs
-* DataGridTableStyle.cs
-* DataGridTextBox.cs
-* DataGridTextBoxColumn.cs
-* DateTimePickerFormat.cs
-* ErrorProvider.cs
-* FileDialog.cs
-* FontDialog.cs
-* Form.cs
-* GroupBox.cs
-* HelpProvider.cs
-* HScrollBar.cs
-* ImageList.cs
-* KeyPressEventHandler.cs
-* Label.cs
-* LinkLabel.cs
-* LinkLabelLinkClickedEventArgs.cs
-* ListBox.cs
-* ListControl.cs
-* ListView.cs
-* logfile.txt
-* MainMenu.cs
-* Menu.cs
-* MenuItem.cs
-* MonthCalendar.cs
-* NotifyIcon.cs
-* OpenFileDialog.cs
-* PageSetupDialog.cs
-* Panel.cs
-* PrintDialog.cs
-* PropertyManager.cs
-* RadioButton.cs
-* RichTextBox.cs
-* SaveFileDialog.cs
-* ScrollableControl.cs
-* ScrollBar.cs
-* Splitter.cs
-* StatusBar.cs
-* StatusBarPanel.cs
-* TabControl.cs
-* TabPage.cs
-* TextBox.cs
-* TextBoxBase.cs
-* ThreadExceptionDialog.cs
-* Timer.cs
-* ToolBar.cs
-* ToolBarButton.cs
-* TrackBar.cs
-* TreeView.cs
-* UpDownBase.cs
-* VScrollBar.cs
-* Uncommented stuff, re-commented stuff, adding usings, fixed minor syntax errors.
-
-2002-7-6 DennisHayes <dennish@raytek.com>
-
-* DragEventArgs.cs
-* PropertyValueChangedEventArgs.cs
-* InputLanguageChangedEventArgs.cs
-* added files
-
-2002-7-6 DennisHayes <dennish@raytek.com>
-
-* ToolBarButtonClickEventArgs.cs
-* UpDownEventArgs.cs
-* PropertyValueChangedEventArgs.c
-* Added new files
-
-2002-7-6 DennisHayes <dennish@raytek.com>
-
-* AccessibleObject.cs
-* AmbientProperties.cs
-* Application.cs
-* ApplicationContext.cs
-* AxHost.cs
-* BaseCollection.cs
-* Binding.cs
-* BindingContext.cs
-* BindingManagerBase.cs
-* BindingsCollection.cs
-* CaptionButton.cs
-* Clipboard.cs
-* ColumnHeader.cs
-* Control.cs
-* ControlBindingsCollection.cs
-* ControlPaint.cs
-* CreateParams.cs
-* CurrencyManager.cs
-* Cursor.cs
-* CursorConverter.cs
-* Cursors.cs
-* DataFormats.cs
-* DataGridPreferredColumnWidthTypeConverter.cs
-* DataGridTextBoxColumn.cs
-* DataObject.cs
-* DateBoldEventArgs.cs
-* DateTimePicker.cs
-* DomainUpDown.cs
-* FeatureSupport.cs
-* FontDialog.cs
-* Form.cs
-* GridColumnStylesCollection.cs
-* GridItemCollection.cs
-* GridTableStylesCollection.cs
-* Help.cs
-* IButtonControl.cs
-* IFileReaderService.cs
-* ImageIndexConverter.cs
-* ImageListStreamer.cs
-* IMessageFilter.cs
-* InputLanguage.cs
-* InputLanguageChangeEventArgs.cs
-* InputLanguageCollection.cs
-* ItemChangedEventArgs.cs
-* KeyEventArgs.cs
-* KeyPressEventArgs.cs
-* KeysConverter.cs
-* LinkLabel.cs
-* LinkLabelLinkClickedEventArgs.cs
-* LinkLabelLinkClickedEventHandler.cs
-* ListBindingConverter.cs
-* ListViewItem.cs
-* ListViewItemConverter.cs
-* logfile.txt
-* MessageBox.cs
-* NativeWindow.cs
-* NumericUpDown.cs
-* OpacityConverter.cs
-* OSFeature.cs
-* PaintEventArgs.cs
-* PrintControllerWithStatusDialog.cs
-* PropertyGrid.cs
-* PropertyTabChangedEventArgs.cs
-* PropertyTabChangedEventHandler.cs
-* PropertyValueChangedEventArgs.cs
-* Screen.cs
-* ScrollEventArgs.cs
-* SelectionRange.cs
-* SelectionRangeConverter.cs
-* SendKeys.cs
-* SplitterEventArgs.cs
-* StatusBarPanelClickEventArgs.cs
-* StatusBarPanelCollection.cs
-* SystemInformation.cs
-* ToolBarButtonClickEventArgs.cs
-* ToolTip.cs
-* TreeNode.cs
-* TreeNodeCollection.cs
-* TreeNodeConverter.cs
-* TreeViewCancelEventArgs.cs
-* TreeViewImageIndexConverter.cs
-* UICuesEventArgs.cs
-* UpDownBase.cs
-* UpDownEventArgs.cs
-* UserControl.cs
-* Added usings, corrected minor syntax errors, uncommented some stuff to flush out compile errors.
-
-2002-7-3 DennisHayes <dennish@raytek.com>
-
-* AccessibleObject.cs
-* Application.cs
-* AxHost.cs
-* Button.cs
-* Control.cs
-* Form.cs
-* GridColumnStylesCollection.cs
-* GridItemCollection.cs
-* GridTableStylesCollection.cs
-* ImageIndexConverter.cs
-* ImageListStreamer.cs
-* InputLanguageChangingEventArgs.cs
-* KeysConverter.cs
-* Label.cs
-* LinkLabel.cs
-* LinkLabelLinkClickedEventArgs.cs
-* ListBox.cs
-* ListView.cs
-* ListViewItem.cs
-* ListViewItemConverter.cs
-* Menu.cs
-* NumericUpDown.cs
-* ScrollableControl.cs
-* StatusBarDrawItemEventArgs.cs
-* StatusBarPanel.cs
-* StatusBarPanelCollection.cs
-* TabControl.cs
-* TrackBar.cs
-* TreeNodeCollection.cs
-* added usings, minor syntax corrections.
-
-2002-7-3 DennisHayes <dennish@raytek.com>
-* checked in for Jaak Simm (jaaksimm@firm.ee)
-* PrintPreviewControl.cs
-* PrintPreviewDialog.cs
-* ProgressBar.cs
-* PropertyGrid.cs
-* PropertyManager.cs
-* PropertyTabChangedEventArgs.cs
-* new files added
-
-2002-7-2 DennisHayes <dennish@raytek.com>
-* Application.cs
-* ControlEventArgs.cs
-* Form.cs
-* merged changes made by miguel and hestilow in gkt# to system.windows.forms
-
-2002-7-2 DennisHayes <dennish@raytek.com>
-* Button.cs
-* ButtonBase.cs
-* ContainerControl.cs
-* Label.cs
-* ScrollableControl.cs
-* Copied changes made by miguel and hestilow in gkt# to system.windows.forms
-
-2002-7-2 DennisHayes <dennish@raytek.com>
-* Checked in for Richard Baumann (biochem333@nyc.rr.com)
-* DataGridTextBoxColumn.cs
-* DataObject.cs
-* DateBoldEventArgs.cs
-* DateRangeEventArgs.cs
-* DateTimePicker.cs
-* DomainUpDown.cs
-* DragEventArgs.cs
-* DrawItemEventArgs.cs
-* added new files
-
-2002-7-2 DennisHayes <dennish@raytek.com>
-* checked in for Jaak Simm (jaaksimm@firm.ee)
-* DataFormats.cs
-* DataGrid.cs
-* DataGridBoolColumn.cs
-* DataGridColumnStyle.cs
-* DataGridPreferredColumnWidthTypeConverter.cs
-* DataGridTableStyle.cs
-* DataGridTextBox.cs
-* new classes added
-
-2002-7-2 DennisHayes <dennish@raytek.com>
-* Checked in for Richard Baumann (biochem333@nyc.rr.com)
-* StatusBar.cs
-* StatusBarDrawItemEventArgs.cs
-* StatusBarPanel.cs
-* StatusBarPanelClickEventArgs.cs
-* SystemInformation.cs
-* Minor changes by Rich B
-
-2002-7-1 DennisHayes <dennish@raytek.com>
-
-* AccessibleObject.cs
-* AmbientProperties.cs
-* Application.cs
-* ApplicationContext.cs
-* ArrangeDirection.cs
-* AxHost.cs BaseCollection.cs
-* Binding.cs BindingContext.cs
-* BindingManagerBase.cs
-* BindingMemberInfo.cs
-* BindingsCollection.cs
-* Button.cs
-* ButtonBase.cs
-* CheckBox.cs
-* CheckedListBox.cs
-* Clipboard.cs
-* ColorDialog.cs
-* ColumnClickEventArgs.cs
-* ColumnClickEventHandler.cs
-* ColumnHeader.cs
-* ComboBox.cs
-* CommonDialog.cs
-* ComVisible.cs
-* ContainerControl.cs
-* ContentsResizedEventArgs.cs
-* ContextMenu.cs
-* Control.cs
-* ControlBindingsCollection.cs
-* ControlEventArgs.cs
-* ControlPaint.cs
-* ConvertEventArgs.cs
-* CreateParams.cs
-* CurrencyManager.cs
-* Cursor.cs
-* CursorConverter.cs
-* Cursors.cs
-* ErrorProvider.cs
-* FeatureSupport.cs
-* FileDialog.cs
-* Form.cs
-* GiveFeedbackEventArgs.cs
-* GridColumnStylesCollection.cs
-* GridItem.cs
-* GridItemCollection.cs
-* GridTableStylesCollection.cs
-* GroupBox.cs
-* Help.cs
-* HelpEventArgs.cs
-* HelpProvider.cs
-* HScrollBar.cs
-* ImageIndexConverter.cs
-* ImageList.cs
-* ImageListStreamer.cs
-* InputLanguage.cs
-* InputLanguageChangedEventArgs.cs
-* InputLanguageChangingEventArgs.cs
-* InputLanguageCollection.cs
-* InvalidateEventArgs.cs
-* ItemChangedEventArgs.cs
-* ItemCheckEventArgs.cs
-* ItemDragEventArgs.cs
-* IWin32Window.cs
-* KeyEventArgs.cs
-* KeyPressEventArgs.cs
-* KeysConverter.cs
-* Label.cs
-* LabelEditEventArgs.cs
-* LabelEditEventHandler.cs
-* LayoutEventArgs.cs
-* LinkClickedEventArgs.cs
-* LinkLabel.cs
-* LinkLabelLinkClickedEventArgs.cs
-* ListBindingConverter.cs
-* ListBox.cs
-* ListControl.cs
-* ListView.cs
-* ListViewItem.cs
-* ListViewItemConverter.cs
-* MainMenu.cs
-* MeasureItemEventArgs.cs
-* Menu.cs MenuItem.cs
-* Message.cs
-* MessageBox.cs
-* MonthCalendar.cs
-* MouseEventArgs.cs
-* NativeWindow.cs
-* NavigateEventArgs.cs
-* NodeLabelEditEventArgs.cs
-* NotifyIcon.cs
-* NumericUpDown.cs
-* OpacityConverter.cs
-* OpenFileDialog.cs
-* OSFeature.cs
-* PageSetupDialog.cs
-* PaintEventArgs.cs
-* Panel.cs
-* PrintControllerWithStatusDialog.cs
-* PrintDialog.cs
-* QueryAccessibilityHelpEventArgs.cs
-* QueryContinueDragEventArgs.cs
-* RadioButton.cs
-* RichTextBox.cs
-* SaveFileDialog.cs
-* Screen.cs
-* ScrollableControl.cs
-* ScrollBar.cs
-* ScrollEventArgs.cs
-* SelectedGridItemChangedEventArgs.cs
-* SelectionRange.cs
-* SelectionRangeConverter.cs
-* SendKeys.cs
-* Splitter.cs
-* SplitterEventArgs.cs
-* StatusBar.cs
-* StatusBarDrawItemEventArgs.cs
-* StatusBarPanel.cs
-* StatusBarPanelClickEventArgs.cs
-* StatusBarPanelCollection.cs
-* SystemInformation.cs
-* TabControl.cs
-* TabPage.cs
-* TextBox.cs
-* TextBoxBase.cs
-* ThreadExceptionDialog.cs
-* Timer.cs
-* ToolBar.cs
-* ToolBarButton.cs
-* TrackBar.cs
-* TreeNode.cs
-* TreeNodeCollection.cs
-* TreeNodeConverter.cs
-* TreeView.cs
-* TreeViewCancelEventArgs.cs
-* TreeViewEventArgs.cs
-* TreeViewImageIndexConverter.cs
-* UICuesEventArgs.cs
-* UserControl.cs
-* VScrollBar.cs
-* Implmented some stuff, fixed some stuff, monostyled some stuff, uncommented-out some stuff.
-
-
-2002-7-1 DennisHayes <dennish@raytek.com>
-* changelog
-* reversed order, putting most recent entries at the top
-
-2002-6-24 DennisHayes <dennish@raytek.com>
-* AccessibleStates.cs
-* ArrangeDirection.cs
-* AccessibleEvents.cs
-* Added values for enums
-
-2002-6-24 DennisHayes <dennish@raytek.com>
-* BindingMemberInfo.cs
-* CaptionButton.cs
-* DataGridCell.cs
-* Message.cs
-* MessageBox.cs
-* Fixed bugs preventing compile
-
-2002-6-18 DennisHayes <dennish@raytek.com>
-* checked in for Stefan Warnke (StefanW@POBox.com)
-* UICuesEventArgs.cs
-* UpDownBase.cs
-* Better comments and formatting
-
-2002-6-18 DennisHayes <dennish@raytek.com>
-* Checked in for Jackson Harper (jackson@latitudegeo.com)
-* ToolBar.cs
-* TabControl.cs
-* TabPage.cs
-* Added sub classes
-
-2002-6-5 DennisHayes <dennish@raytek.com>
-* TabControl.cs
-* TabPage.cs
-* TextBox.cs
-* TextBoxBase.cs
-* ThreadExceptionDialog.cs
-* Timer.cs
-* added new files for Jackson Harper (jackson@latitudegeo.com)
-* needs to be mono styled, and may have other issues
-
-2002-6-5 DennisHayes <dennish@raytek.com>
-* ErrorProvider.cs
-* PrintControllerWithStatusDialog.cs
-* PrintDialog.cs
-* added new files for paul
-
-2002-6-5 DennisHayes <dennish@raytek.com>
-* StatusBarDrawItemEventArgs.cs
-* StatusBarPanel.cs
-* StatusBarPanelClickEventArgs.cs
-* StatusBarPanelCollection.cs
-* SystemInformation.cs
-* added new files for Richard Baumann (biochem333@nyc.rr.com)
-
-2002-6-5 DennisHayes <dennish@raytek.com>
-* removed, code moved to main class files, Form.cs, ImageList.cs, LinkLabel.cs,
-* ListBox.cs, ListView.cs, ListViewItem.cs, Menu.cs, MonthCalendar.cs, ScrollableControl.cs
-* Form.ControlCollectison.cs
-* ImageList.ImageCollection.c
-* LinkLabel.LinkCollection.cs
-* ListBox.ObjectCollection.cs
-* ListBox.SelectedIndexCollection.cs
-* ListBox.SelectedObjectCollection.cs
-* ListView.CheckedListViewItemCollection.cs
-* ListView.CheckedIndexCollection.cs
-* ListView.ColumnHeaderCollection.cs
-* ListView.ListViewItemCollection.cs
-* ListView.SelectedIndexCollection.cs
-* ListView.SelectedListViewItemCollection.cs
-* ListViewItem.ListViewSubItem.cs
-* ListViewItem.ListViewSubItemCollection.cs
-* Menu.MenuItemCollection.cs
-* MonthCalendar.HitTestInfo.cs
-* ScrollableControl.DockPaddingEdges.cs
-
-2002-6-5 DennisHayes <dennish@raytek.com>
-* Checked in for Jackson Harper (jackson@latitudegeo.com)
-* ToolBar.cs
-* ToolBarButton.cs
-* ToolTip.cs
-* TrackBar.cs
-* TreeNode.cs
-* TreeNodeCollection.cs
-* TreeNodeConverter.cs
-* TreeView.cs
-* TreeViewCancelEventArgs.cs
-* TreeViewEventArgs.cs
-* TreeViewImageIndexConverter.cs
-* Just stubbs
-* New files added, work in progress cleanup and mono style needed.
-
-2002-6-5 DennisHayes <dennish@raytek.com>
-* checked in for Stefan Warnke (StefanW@POBox.com)
-* UICuesEventArgs.cs
-* UpDownBase.cs
-* Just stubbs
-* New files, work in progress, needs cleanup and mono style
-
-
-
-2002-5-31 DennisHayes <dennish@raytek.com>
-* ItemChangedEventHandler.cs
-* InvalidateEventHandler.cs
-* ItemChangedEventHandler.cs
-* added new files
-
-2002-5-31 DennisHayes <dennish@raytek.com>
- Check in for Paul Osman <paul.osman@sympatico.ca>
-* Panel.cs
-* New class, Stubbed and commented out
-
-2002-5-31 DennisHayes <dennish@raytek.com>
- Check in for Paul Osman <paul.osman@sympatico.ca>
-* MonthCalendar.cs
-* MonthCalendar.HitTestInfo.cs
-* MouseEventArgs.cs
-* NativeWindow.cs
-* Removed trash byte
-
-2002-5-31 DennisHayes <dennish@raytek.com>
-* ColumnClickEventArgs.cs
-* Fully implmented.
-
-2002-5-31 DennisHayes <dennish@raytek.com>
-* Minor formating in lots of files
-
-
-2002-5-27 DennisHayes <dennish@raytek.com>
-Added structs. All structs in System.Windows.Forms done
-* BindingMemberInfo.cs
-* DataGridCell.cs
-* LinkArea.cs
-* Message.cs
-* Complete execpt for Message.cs GetLParam
-* and
-* BindingMemberInfo needs constructor.
-* All need verification of hashcodes.
-
-2002-5-27 DennisHayes <dennish@raytek.com>
-Added delegates. All delegates in System.Windows.Forms done
-* ColumnClickEventHandler.cs
-* ContentsResizedEventHandler.cs
-* ControlEventHandler.cs
-* ConvertEventHandler.cs
-* DateRangeEventHandler.cs
-* DragEventHandler.cs
-* DrawItemEventHandler.cs
-* GiveFeedbackEventHandler.cs
-* HelpEventHandler.cs
-* InputLanguageChangedEventHandler.cs
-* InputLanguageChangingEventHandler.cs
-* InvalidateEventHandler.cs
-* ItemChangedEventHandler.cs
-* ItemCheckEventHandler.cs
-* ItemDragEventHandler.cs
-* KeyEventHandler.cs
-* LabelEditEventHandler.cs
-* LayoutEventHandler.cs
-* LinkClickedEventHandler.cs
-* LinkLabelLinkClickedEventHandler.cs
-
-2002-5-27 DennisHayes <dennish@raytek.com>
- Check in for Paul Osman <paul.osman@sympatico.ca>
-* NumericUpDown.cs
-* OpacityConverter.cs
-* OpenFileDialog.cs
-* OSFeature.cs
-* PageSetupDialog.cs
-* PaintEventArgs.cs
-* MonthCalendar.HitTestInfo.cs
-* MouseEventArgs.cs
-* NativeWindow.cs
-* Stubbed and commented out
-* NativeWindow.cs, MonthCalendar.HitTestInfo.cs, MouseEventArgs.cs,
-* have bad extra byte from old skeleton, need new corrected version.
-
-* MonthCalendar.HitTestInfo.cs needs to be incorporated into MonthCalendar.
-
-2002-5-27 DennisHayes <dennish@raytek.com>
- Check in for Paul Osman <paul.osman@sympatico.ca>
-* Menu.cs
-* Menu.MenuItemCollection.cs
-* MenuItem.cs
-* MessageBox.cs
-* MonthCalendar.cs
-* Stubbed and commented out
-* MonthCalendar.cs has bad extra byte from old skeleton, need new corrected version.
-* MonthCalendar.HitTestInfo.cs needs to be incorporated into MonthCalendar.
-* Menu.MenuItemCollection.cs needs to be incorporated into Menu.cs.
-
-2002-5-27 DennisHayes <dennish@raytek.com>
- Check in for Paul Osman <paul.osman@sympatico.ca>
-* Panel.cs
-* New class, Stubbed and commented out
-
-2002-5-10 Dennis Hayes
-* added IMessageFilter
-* Interfaces complete
-
- 2002-5-8 Dennis Hayes <dennish@raytek.com>
-* RichTextBoxFinds.cs
-* RichTextBoxScrollBars.cs
-* RichTextBoxSelectionAttribute.cs
-* RichTextBoxSelectionTypes.cs
-* RichTextBoxStreamType.cs
-* RichTextBoxWordPunctuations.cs
-* RightToLeft.cs
-* ScrollBars.cs
-* ScrollButton.cs
-* ScrollEventType.cs
-* SecurityIDType.cs
-* SelectionMode.cs
-* Shortcut.cs
-* SizeGripStyle.cs
-* SortOrder.cs
-* StatusBarPanelAutoSize.cs
-* StatusBarPanelBorderStyle.cs
-* StatusBarPanelStyle.cs
-* StructFormat.cs
-* TabAlignment.cs
-* TabAppearance.cs
-* TabDrawMode.cs
-* TabSizeMode.cs
-* TickStyle.cs
-* ToolBarAppearance.cs
-* ToolBarButtonStyle.cs
-* ToolBarTextAlign.cs
-* TreeViewAction.cs
-* UICues.cs
-* View.cs
-* Added enums.
-* All System.Windows.Forms enums complete with correct values.
- 2002-5-8 Dennis Hayes <dennish@raytek.com>
-Dennis Hayes <dennish@raytek.com>
-Checking in new System.Windows.forms classes (a* to c*) for
-Jaak Simm <jaaksimm@firm.ee>
-* AmbientProperties.cs
-* Application.cs
-* ApplicationContext.cs
-* AxHost.cs
-* BaseCollection.cs
-* Binding.cs
-* BindingContext.cs
-* BindingManagerBase.cs
-* BindingsCollection.cs
-* Button.cs
-* ButtonBase.cs
-* CheckBox.cs
-* CheckedListBox.cs
-* Clipboard.cs
-* ColorDialog.cs
-* ColumnClickEventArgs.cs
-* ColumnHeader.cs
-* ComboBox.cs
-* CommonDialog.cs
-* ContainerControl.cs
-* ContentsResizedEventArgs.cs
-* ContextMenu.cs
-* Control.cs
-* ControlBindingsCollection.cs
-* ControlEventArgs.cs
-* ControlPaint.cs
-* ConvertEventArgs.cs
-* CreateParams.cs
-* CurrencyManager.cs
-* Cursor.cs
-* CursorConverter.cs
-* Cursors.cs
-* Classes stubbed and commented out.
-
- 2002-5-8 Dennis Hayes <dennish@raytek.com>
-Dennis Hayes <dennish@raytek.com>
-Checking in new System.Windows.forms classe for John Rebbeck <john@rebent.com>
-
-* UserControl.cs
-Stubbed and commented out
-
- 2002-5-8 Dennis Hayes <dennish@raytek.com>
-Dennis Hayes <dennish@raytek.com>
-Checking in new System.Windows.forms classe for Paul Osman <paul.osmand@sympatico.ca>
-
-* NavigateEventArgs.cs
-* NodeLabelEditEventArgs.cs
-* NotifyIcon.cs
-Stubbed and commented out
-
-2002-05-07 Daniel Carrera (dcarrera@math.utoronto.ca)
-* Fixed a problem with an "extra byte" problem. It caused an extra '?'
- at the beginning of some lines.
- Classes F-L and Q-R were updated.
-* Added the classes SaveFileDialog.cs and Screen.cs
-
-2002-5-7 Dennis Hayes <dennish@raytek.com>
-* Added duplicate values
-* System.Windows.Forms.Keys.cs
-
-2002-5-7 Dennis Hayes <dennish@raytek.com>
-* LeftRightAlignment.cs
-* LinkBehavior.cs
-* LinkState.cs
-* ListViewAlignment.cs
-* MdiLayout.cs
-* MenuGlyph.cs
-* MenuMerge.cs
-* MessageBoxButtons.cs
-* MessageBoxDefaultButton.cs
-* MessageBoxIcon.cs
-* MessageBoxOptions.cs
-* MouseButtons.cs
-* Orientation.cs
-* PictureBoxSizeMode.cs
-* PropertySort.cs
-* Added some more enums. All have correct values.
-
-* 5-5-2002 Dennis Hayes <dennish@raytek.com>
-* Added enums
-* GridItemType.cs
-* HelpNavigator.cs
-* HorizontalAlignment.cs
-* ImeMode.cs
-* ItemActivation.cs
-* ItemBoundsPortion.cs
-* Keys.cs
-* All correct execpt for Keys.cs which is missing a half dozen
-* duplicate entries that need correcting.
-
-2002-05-02 Daniel Carrera (dcarrera@math.utoronto.ca)
-* small update to classes [F-H]*
-* added stubbed and commented out classes for [I-L]*
-* added stubbed and commented out classes for R*
-2002-4-23 Dennis Hayes <dennish@raytek.com>
-
- * AccessibleNavigation.cs :added to cvs with bad enum values, I will correct.
- * AccessibleSelection.cs :added with good enum values.
- * ContentsResizedEventHandler.cs :Added delagate
- * MainMenu.cs
- * AccessibleObject.cs
- * MeasureItemEventArgs :added stubbed classes. Commented out.
- * IButtonControl.cs : Added interface.
-2002-4-23 Dennis Hayes <dennish@raytek.com>
-* added stubbed and commented out classes from F to G *
-
-
-2002-04-10 Duncan Mak <duncan@ximian.com>
-
- * CaptionButton.cs:
- * CharacterCasing.cs:
- * CheckState.cs:
- * DataGridParentRowsLabelStyle.cs:
- * DialogResult.cs:
- * DockStyle.cs:
- * DragAction.cs:
- * DragDropEffects.cs:
- * DrawItemState.cs:
- * DrawMode.cs:
- * ErrorBlinkStyle.cs:
- * ErrorIconAlignment.cs:
- * FlatStyle.cs:
- * FormBorderStyle.cs:
- * FormStartPosition.cs:
- * FormWindowState.cs:
- * FrameStyle.cs: Fixed enum layouts with EnumCheck.
-
-
+2003-08-12 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * MenuItem.cs : added missing properties, so menu sample app can be compiled + +2003-08-11 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Control.cs : MouseButtons, PointToClient, PointToScreen were implemented. + removed unnecessary check from UpdateBounds + * Panel.cs : ability to change BorderStyle at runtime + +2003-08-11 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * TreeView.cs + * TreeNode.cs + * TreeNodeCollection.cs + * win32functions.cs : more implementation added + * button.cs : fix method signature + +2003-08-08 Dennis Hayes <dennish@raytek.com> + * Control.cs + * MonthCalander.cs + * Signiture corections. + * implmentation stuff changed to internal + * event "e" params names changed to "pevent" type names + +2003-08-03 Alexandre Pigolkine <pigolkine@gmx.de> + * CheckBox.cs 12x12 checkmark dimensions for a moment + * ControlPaint.cs DrawRadioButton implemented + * RadioButton.cs painting is in OnPaint + +2003-08-02 Alexandre Pigolkine <pigolkine@gmx.de> + * CheckBox.cs painting in OnPaint implemented + * CheckedListBox.cs changes to painting code + * Button.cs code cleanup + * Control.cs call to subclassed control can be controlled by mask + * Message.cs helper properties + * win32Enums.cs new values + +2003-08-01 Alexandre Pigolkine <pigolkine@gmx.de> + * ControlPaint.cs DrawStringDisabled changed + * Label.cs painting moved inside OnPaint function + * Button.cs disposing Graphics in OnPaint + * win32functions.cs StringFormat2DrawTextFormat added + +2003-07-31 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * TreeView.cs + * TreeNode.cs + * TreeNodeCollection.cs + * win32enums.cs + * win32functions.cs : more implementation added + +2003-07-31 Alexandre Pigolkine <pigolkine@gmx.de> + * Control.cs : do not keep oldBounds if LAYOUT_SUSPENDED is true, + call OnMouseDown/Up functions + * Button.cs + * ButtonBase.cs painting moved inside OnPaint function + * NativeWindow.cs (commented) debug output added + +2003-07-31 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Control.cs : anchoring algorithm was fixed to avoid inaccuracies caused by rounding + * TextBoxBase.cs : set FixedHeight style for single line edit boxes + +2003-07-30 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * TextBox.cs : ScrollBars, AcceptsReturn, CharacterCasing properties were implemented + +2003-07-29 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * TextBoxBase.cs + * TextBox.cs + * Control.cs : BackColor, ForeColor, PasswordChar for edit boxes + +2003-07-28 Miguel de Icaza <miguel@ximian.com> + + * NativeWindow.cs: Remove debugigng messages. + + * Control.cs: Remove debugging messages. + + * Label.cs: Use the border style. + + * win32functions.cs: Set the default to WineLib now on Linux. + +2003-07-23 Miguel de Icaza <miguel@ximian.com> + + * win32functions.cs: Move functions that do not exist in WineLib + over to Win32_Wineless, so we do not trigger the warning messages + until a function tries to use them. + + Win32() constructor: Set a hint on the appdomain that we would + prefer to have the System.Drawing API use the Win32 implementation + of the API. + + * *.cs: Updated sources to use this. + +2003-07-16 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * ColorDialog.cs : implemented + * win32functions.cs + * win32enums.cs + * win32structs.cs : functions, flags and structs for ColorDialog + +2003-07-01 Alexandre Pigolkine <pigolkine@gmx.de> + * win32Structs.cs some fields cannot be marshaled + OFNOTIFY structure simplified + * FileDialog.cs + * win32functions.cs + call wine_get_unix_filename from FileOpen dialog + + * win32functions.cs WineLib library name changed + + * NativeWindow.cs CLIENTCREATESTRUCT parameter for MDI + Aleksey Ryabchuk <ryabchuk@yahoo.com> + +2003-06-30 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Form.cs : TopLevel, AcceptButton, CancelButton + * Application.cs : allow keyboard messages in modal forms + * Control.cs : basic impl. of GetTopLevel, SetTopLevel + +2003-06-30 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Cursors.cs : VSplit, HSplit cursors + * Form.cs: WindowState ( not finished ), changes to Form.Close + * Splitter.cs, Toolbar.cs : started implementation + +2003-06-26 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * TreeNode.cs + * TreeNodeCollection.cs + * TreeView.cs : more implementation added + +2003-06-24 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * TreeNode.cs + * TreeNodeCollection.cs + * TreeView.cs : more implementation added + +2003-06-12 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Menu.cs + * ContextMenu.cs : create context menu using CreatePopupMenu function + +2003-06-12 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * TreeNode.cs + * TreeNodeCollection.cs + * TreeView.cs + * win32functions.cs : started impl. of TreeView control + +2003-06-12 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Control.cs : don't do anything if Anchor is set to default value + * SystemInformation.cs : return some system metrics + * UserControl.cs : default size impl. + +2003-06-11 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * ContextMenu.cs : SourceControl, Show method + * Control.cs : ContextMenu, CanSelect, force parent to perform layout when Dock property changes + * GroupBox.cs + * Label.cs + * Panel.cs + * PictureBox.cs + * Splitter.cs + * ProgressBar.cs : remove Selectable style + * RadioButton.cs : set TextAlign to MiddleLeft by default + * tooltip.cs : override Dispose method + * win32Enums.cs + * win32functions.cs : flags and function for context menu + +2003-06-09 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Conrols.cs : Disposing property, Dispose method + * Cursor.cs : Show, Hide, Copy cursor + * NativeWindow.cs : destructor + +2003-06-09 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Control.cs : Cursor property, handle WM_SETCURSOR + * Cursor.cs : started implementation + * Cursors.cs : load system cursor types + * win32functions.cs : DestroyCursor function + +2003-06-09 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * HScrollBar.cs + * ScrollBar.cs + * VScrollBar.cs : implemented + * ScrollEventArgs.cs: typo fix + +2003-06-09 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * AxHost.cs + * MonthCalendar.cs : fixed issues breaking the build + +2003-06-09 Dennis Hayes <dennish@raytek.com> + for Gopal V <gopalv82@symonds.net> + * MonthCalendar.cs + * AxHost.cs + Fixed overrides + +2003-06-07 Alexandre Pigolkine <pigolkine@gmx.de> + * Control.cs + * Form.cs + * ScrollableControl.cs + DockStyle.None & AnchorStyles + +2003-06-06 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * HScrollBar.cs + * ScrollBar.cs + * VScrollBar.cs + * win32Enums.cs : started implementation of scrollbar classes + +2003-06-06 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Form.cs : MaximumSize, MinimumSize, TopMost were implemented, small fixes and improvements + * win32Structs.cs: WINDOWPOS structure + +2003-06-05 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Form.cs : ControlBox, HelpButton, MaximizeBox, MinimizeBox, maximumSize + * win32Structs.cs: MINMAXINFO structure + +2003-06-04 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Control.cs + * Form.cs : KeyPreview, ShowInTaskBar + +2003-06-02 Alexandre Pigolkine <pigolkine@gmx.de> + * Application.cs + * ComboBox.cs + * Control.cs + change to ContainsFocus/Focused properties + +2003-04-25 Miguel de Icaza <miguel@ximian.com> + + * SystemInformation.cs (ComputerName): Bug fix: we need to trim down the size + +2003-05-30 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * GroupBox.cs : take BackColor into account + +2003-05-27 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Control.cs : helper method getParentForm + * Form.cs : ActiveForm , FormBorderStyle implemented + * GroupBox.cs : some chages in drawing code, don't register another window class + * FormBorderStyle.cs : fixed typo + * win32functions.cs : UpdateWindowExStyle added, new prototypes for GetActiveWindow, GetForegroundWindow + +2003-05-27 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Button.cs + * CheckBox.cs + * CheckedListBox.cs + * ComboBox.cs + * HScrollBar.cs + * ListBox.cs + * ListView.cs + * PrintPreviewControl.cs + * RichTextBox.cs + * ScrollBar.cs + * Splitter.cs + * ToolBar.cs + * TreeView.cs + * VScrollBar.cs : changed to use base implementation of CreateParams + +2003-05-27 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Control.cs : implemented GetChildIndex, BringToFront, UpdateZOrder, update z-order when recreating handle, + * win32Strcuts.cs + * win32Enums.cs : use ansi CharSet for tooltips + +2003-05-27 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Contols.cs : changes to SetVisibleCore, Invalidate (bool) is implemented + * NativeWindow.cs : don't use CS_VREDRAW and CS_HREDRAW flags + * ImageList.cs + * ImageListStreamer.cs : small fixes + * TabControl.cs + * TabPage.cs : image list support was added + +2003-05-26 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * ImageListStreamer.cs: added deserialization code + * win32functions.cs : added some prototypes required for ImageList impl. + * win32strcuts.cs : added new structs, switched to CharSet.Ansi for TCITEM struct + * win32Enums.cs : use ansi messages for tab control + +2003-05-20 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * win32functions.cs + * NativeWindow.cs : fixed some issues causing problems when running SWF on Linux + +2003-05-20 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * FileDialog.cs : more implementation added + * win32Enums.cs : added some error codes for common dialogs + * win32functions.cs : added prototype for CommDlgExtendedError + +2003-05-19 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * CommonDialog.cs + * FileDialog.cs + * OpenFileDialog.cs + * win32Enums.cs + * win32Structs.cs : more implementation added + +2003-05-16 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * CommonDialog.cs + * FileDialog.cs + * win32Enums.cs + * win32functions.cs : started impl. of OpenFile dialog + +2003-05-16 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * DomainUpDown.cs : changes to OnTextBoxKeyDown + * UpDownBase.cs : added impl. to BackColor and BackgroundImage + +2003-05-12 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Control.cs : ResizeRedraw, removed some unused code + * DomainUpDown.cs : + * UpDownBase.cs : some improvements + +2003-05-12 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Application.cs + * ContainerControl.cs + * Control.cs + * Form.cs + * ScrollableControl.cs + * StatusBar.cs + * TabControl.cs + * TabPage.cs : changes in the code for TAB key handling + +2003-05-09 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Control.cs + * Form.cs + * GroupBox.cs + * Label.cs + * UpDownBase.cs : some new stuff related to focus movement by the TAB key + +2003-05-08 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Control.cs : started implementation of keyboard handling + * CroupBox.cs : set UserPaint style + * TextBoxBase.cs : set subclass flag to allow catching of keyboard events + +2003-05-07 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Control.cs : static RegisterDefaultWindowClass method was added + * ScrollableControl.cs : registration of "mono_scrollable_control" was moved to Control class + * win32functions.cs : new constant DEFAULT_WINDOW_CLASS + * PictureBox.cs : implemented + +2003-05-07 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Control.cs : use WS_OVERLAPPED instead of WS_OVERLAPPEDWINDOW, update text field in get Text property + * TextBox.cs : use styles provided by TextBoxBase + * TextBoxBase.cs : more methods and properties were implemented + * win32enums.cs : messages and notifications for EDIT control + +2003-05-02 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Control.cs : call OnTextChange + * UpdownBase.cs + * DomainUpDown.cs : some more implementation + * TextBox.cs : TextAlign, use base.CreateParams + * TextBoxBase.cs : use base.CreateParams + * Win32enums.cs : styles for edit box + +2003-04-30 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * TabControl.cs + * TabPage.cs : prevent pages from being added to the TabControl multiple times + +2003-04-30 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Control.cs : some fixes, added call to OnControlAdded, update visibility flag in Show and Hide + * GroupBox.cs + * Label.cs + * ButtoBase.cs : use base.CreateParams + * PictureBox.cs : call base.OnResize + * RadioButton.cs : implemented + * TabControl.cs + * TabPage.cs : some fixes + +2003-04-29 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Control.cs : call OnResize from OnSizeChanged + * TabControl.cs : small fixes + * Win32enums.cs : constants for ToolTip notifications + +2003-04-28 Alexandre Pigolkine <pigolkine@gmx.de> + * monogc.c + * makefile small improvements + +2003-04-26 Alexandre Pigolkine <pigolkine@gmx.de> + * monogc.c GC stubs for Mini + * win32functions.cs EntryPoint added for some functions + +2003-04-25 Miguel de Icaza <miguel@ximian.com> + + * SystemInformation.cs (ComputerName): Implement this. + +2003-04-25 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Control.cs : check if control is already in control collection, Created property, + ControlCollection.RemoveAt reimplemented using ControlCollection.Remove + * TabControl.cs + * TabPage.cs : some more implementation + * win32structs.cs: TCITEMHEADER replaced with TCITEM + +2003-04-24 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Control.cs: change to CreateControlInstance function + * Panel.cs: use base CreateParams + * TabControl.cs + * TabPage : started implementing + * win32Enums.cs + * win32Structs.cs + * win32functions.cs : messages, styles for TabControl + +2003-04-24 Alexandre Pigolkine <pigolkine@gmx.de> + * Button.cs paint with Back/Fore colors + * ComboBox.cs fix to notification handler + * ContainerControl.cs + * ControlStyles.cs + * ListBox.cs + * Panel.cs changes for ControlStyles + * Control.cs ControlStyles, BackColor, painting logic + + * DrawItemEventArgs.cs temporary fix to avoid crach in jit + + +2003-04-23 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Application.cs : new internal functions enterModalLoop, exitModalLoop + * Button.cs : changes in DialogResult and OnClick + * Control.cs : new internal getOwnerWindow method, recreate child windows in RecreateHandle as well + * form.cs : implementation of modal forms + * win32enums.cs : constants for GetWindow function + * win32functions.cs : GetWindow , IsDialogMessage added + +2003-04-22 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Control.cs : implementation of docking + * Form.cs : small changes regarding resizing of MDI client window + * StatusBar.cs : update parts on Layout event, new style to prevent resizing by the system + +2003-04-17 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Control.cs : implementation of scale functions, bug-fix in ControlCollection.Add + * Form.cs : implementation of ScaleCore method + +2003-04-17 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * ImageList.cs + * ImageListStreamer.cs : started to implement + * Control.cs : changes in implementation of size-related functions + * Form.cs : small modifications to reflect changes in Contol class + +2003-04-15 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * NativeWindow.cs : don't assign window ID when it was already assigned by the system + +2003-04-11 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Control.cs : some new functions implemented, using BitVector32 + instead of declaring separate boolean varibales for every control status + +2003-04-11 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Control.cs + * Form.cs + * MainMenu.cs + * Menu.cs + * MenuItem.cs + * NativeWindow.cs + * win32functions.cs : some changes related to implementation of MDI interface + +2003-04-11 Aleksey Ryabchuk <ryabchuk@yahoo.com> + * Control.cs : init bounds in ctor, invisible parking window + * TrackBar.cs + * ProgressBar.cs.cs + * DateTimePicker.cs + * StatusBar.cs : use base version of CreateParams + * ScrollableControl.cs : use base version of CreateParams, removed CS_VREDRAW, CS_HREDRAW styles + * Form.cs : reset parent back to zero for the main form + * StatusBarPanel.cs : small bug-fix + +2003-04-6 DennisHayes <dennish@raytek.com> + * Converted to Unix newlines + * Changed copyright from 2002 to 2002/3 + +2003-04-6 DennisHayes <dennish@raytek.com> + * CheckOutList Update, removed everyone from list, active developers need to readd. + * Binding.cs Marked some funmctions for Compact frame work + * RadioButton.cs //removed inherited members + * RichTextBox.cs //removed inherited members + * Splitter.cs //removed a throw not implmented so some samples could run. + +2003-04-06 Alexandre Pigolkine <pigolkine@gmx.de> + * Control.cs + * Form.cs + * NativeWindow.cs + * Win32functions.cs + * Win32structs.cs : initial implementation of MDI interface. + Aleksey Ryabchuk <ryabchuk@yahoo.com> + + * Button.cs + * CheckedListBox.cs + * Control.cs + * GroupBox.cs + * ListBox.cs + * ScrollableControl.cs + Attempt to minimize fliker effect + Alexandre Pigolkine + +2003-03-30 Alexandre Pigolkine <pigolkine@gmx.de> + * DateTimePicker.cs + * StatusBar.cs + * tooltip.cs + Fixed AllocCoTaskMem issure. Bug-fix for DTP. + Aleksey Ryabchuk <ryabchuk@yahoo.com> + +2003-03-29 Alan Tam <Tam@SiuLung.com> + * DataGrid.cs + stubbed a missing method + +2003-03-26 Alexandre Pigolkine <pigolkine@gmx.de> + * NumericUpDown.cs + * ScrollableControl.cs + * UpDownBase.cs + * win32Structs.cs + implementation of NumericUpDown + + * tooltip.cs + * win32Enums.cs + * win32functions.cs + implementation of ToolTip control class. + Aleksey Ryabchuk <ryabchuk@yahoo.com> + +2003-03-25 Alexandre Pigolkine <pigolkine@gmx.de> + * CheckedListBox.cs + * ListBox.cs + Implementation of Collections + Alexandre Pigolkine <pigolkine@gmx.de> + + * Control.cs + * DateTimePicker.cs + * win32Enums.cs + notification handling for DateTimePicker control. + * StatusBar.cs + * TrackBar.cs + small modifications. + Aleksey Ryabchuk <ryabchuk@yahoo.com> + + +2003-03-23 Alexandre Pigolkine <pigolkine@gmx.de> + * DateTimePicker.cs + * Form.cs + * ProgressBar.cs + * win32Enums.cs + * win32Structs.cs + Implementation of ProgressBar and DateTimePicker controls by + Aleksey Ryabchuk <ryabchuk@yahoo.com> + + * Control.cs small fix to handle scroll bar messages + +2003-03-20 Alexandre Pigolkine <pigolkine@gmx.de + * Control.cs + * Form.cs + * GroupBox.cs + * Label.cs + * Panel.cs + * TrackBar.cs + * win32functions.cs + checkin for Aleksey Ryabchuk <ryabchuk@yahoo.com> + implementation of Timer class and small modifications to other files + +2003-03-18 Alexandre Pigolkine <pigolkine@gmx.de> + * monowinehooks.c + * runwine + attempt to use LD_PRELOAD to override stubs in Wine + * monosem.c implementation of pthread_cond* + * makefile + * monogc.c + * monostub.c + small changes to files + +2003-03-17 Alexandre Pigolkine <pigolkine@gmx.de> + * monogc.c + * makefile + original version of monogc.c by John Sohn <jsohn@columbus.rr.com> + +2003-03-15 Alexandre Pigolkine <pigolkine@gmx.de> + * Control.cs + * Panel.cs + * StatusBar.cs + * StatusBarPanel.cs + * win32Enums.cs + * win32functions.cs + checkin for Aleksey Ryabchuk (ryabchuk@yahoo.com) + +2003-03-15 Alexandre Pigolkine <pigolkine@gmx.de> + * monogc.c dynamic loader for gc-wine.dll by John Sohn <jsohn@columbus.rr.com> + * makefile changed to build monogc + +2003-03-10 Alexandre Pigolkine <pigolkine@gmx.de> + * Button.cs + check in for Steven Stewart <stevenstewart@mindspring.com> + +2003-03-09 Alexandre Pigolkine <pigolkine@gmx.de> + * Application.cs fixed line terminators + + * Form.cs + * TrackBar.cs + * win32Enums.cs + implementation of TrackBar control by Aleksey Ryabchuk (ryabchuk@yahoo.com) + + * makefile + * monostub.c + * monosem.c + parse command line + run assembly not from main thread + first implementation of pthread fuctions using Wine + +2003-03-01 Alexandre Pigolkine <pigolkine@gmx.de> + * Button.cs changed painting code + * ButtonBase.cs ContentAlignment operations implemented in separate functions + * CheckedListBox.cs Implementation added + * ComboBox.cs small modifications + * Control.cs repaint on style changes + * ControlPaint.cs Implementation added + * Form.cs delegate Size to Control + * ImageList.cs small modifications + * ListBox.cs Implementation added + * ListControl.cs small modifications + * NativeWindow.cs fixed line terminators + * ScrollableControl.cs small modifications + * win32Enums.cs declaration added + * win32functions.cs Implementation added, fixed line terminators + + +2003-02-27 Reggie Burnett <reggie@bytefx.com> + * Added several external functions to Win32funcs.cs + * Added necessary LoadLibrary to RichTextEdit to load common control library + +2003-02-26 Reggie Burnett <reggie@bytefx.com> + * Form.Close now actually destroys the Window + * Application now closes when launching form is closed + + 2003-02-19 Alexandre Pigolkine <pigolkine@gmx.de> + * Button.cs + * CheckedListBox.cs + * ComboBox.cs + * Control.cs + * ControlPaint.cs + * Form.cs + * ListBox.cs + * win32functions.cs + implementation added + + 2003-02-11 Alexandre Pigolkine <pigolkine@gmx.de> + * ButtonBase.cs + * ComboBox.cs + * Control.cs + * ListControl.cs + * NativeWindow.cs + implementation added + + The following sample from .Net SDK can run: + Samples\QuickStart\winforms\samples\controlreference\comboboxctl\cs\ + + 2003-02-09 Alexandre Pigolkine <pigolkine@gmx.de> + * Button.cs + * ButtonBase.cs + * CheckBox.cs + * ComboBox.cs + * Control.cs + * ControlPaint.cs + implementation added + * Message.cs + bug fixed + * win32Enums.cs + * win32functions.cs + * win32Structs.cs + declarations added + + + 2003-02-07 Alexandre Pigolkine <pigolkine@gmx.de> + * Font.cs removed + * Button.cs + * ControlPaint.cs + * ComboBox.cs + modified + + 2003-02-06 Alexandre Pigolkine <pigolkine@gmx.de> + + * Button.cs Painting code is implemented + * ButtonBase.cs TextAlign property implemented, WM_COMMAND handling is modified + * ComboBox.cs Initial implementation of ObjectCollection, properties and WM_COMMAND + + * Control.cs Changes to WindProc of Control and ControlNativeWindow classes, + to some properties, window handle creation, ControlCollection + Initial implementation windows control subclassing, message reflection, + ISynchrinizeInvoke interface. + + * ControlPaint.cs Initial implementation of DrawBorder3D and DrawButton + + * Form.cs Modification to constructor, window handle creation, + WM_COMMAND handling, WndProc + + * ListBox.cs Implementation of DrawMode.OwnerDrawFixed and OwnerDrawVariable + * Message.cs WParam helpers added + * MessageBox.cs By default MessageBox.Show(string) brings TASKMODAL message box + * NativeWindow.cs Implemented OnThreadException + * PaintEventArgs.cs Dispose() method + * ProgressBar.cs Small modifications to implementation + * SystemInformation.cs CaptionHeight implemented + + * CheckBox.cs + * GroupBox.cs + * Label.cs + * Panel.cs + * TextBox.cs + CreateParams property modified + + * win32enums.cs enums added + * win32functions.cs functions added + * win32struct.cs 2 structs modified + + * Application.cs + * DrawItemEventArgs.cs + line terminators fixed + + The following samples from .Net SDK can run: + Samples\QuickStart\howto\samples\winforms\errorhandler\cs\ + Samples\QuickStart\howto\samples\winforms\ownerdrawlistbox\cs\ + Samples\QuickStart\howto\samples\winforms\threadmarshal\cs\ + Samples\QuickStart\winforms\samples\accessible\cs\ + Samples\QuickStart\winforms\samples\controlreference\buttonctl\cs\ + + 2003-31-1 John Sohn <jsohn@columbus.rr.com> + * makefile: cleaned and reduced dependencies to hard-coded paths + * monostub.c: updated for compliance with the latest Mono and WineLib + + 2002-12-9 DennisHayes <dennish@raytek.com> + + * Form.cs + * KeysConverter.cs + * Label.cs + * LinkArea.cs + * LinkLabel.cs + * ListBindingConverter.cs + * ListBox.cs + * ListControl.cs + * ListView.cs + * ListViewItem.cs + * ListViewItemConverter.cs + * MainMenu.cs + * Menu.cs + * MenuItem.cs + * NativeWindow.cs + * NumericUpDown.cs + * OpacityConverter.cs + * OSFeature.cs + * PictureBox.cs + * PrintControllerWithStatusDialog.cs + * PrintDialog.cs + * PrintPreviewControl.cs + * PropertyManager.cs + * RadioButton.cs + * Screen.cs + * ScrollableControl.cs + * ScrollBar.cs + * SendKeys.cs + * SplitterEventArgs.cs + * StatusBar.cs + * SystemInformation.cs + * TextBoxBase.cs + * ToolBar.cs + * TrackBar.cs + * TreeNode.cs + * TreeNodeCollection.cs + * TreeNodeConverter.cs + * TreeView.cs + + * cleanup, fixes, some implmentation + + 2002-12-6 DennisHayes <dennish@raytek.com> + + * checkin for Alexandre Pigolkine (pigolkine@gmx.de) + * Form.cs + * Menu.cs + * MenuItem.cs + + * Implmentation + + 2002-12-6 DennisHayes <dennish@raytek.com> + + * Control.cs + * Form.cs + * MonthCalendar.cs + * Screen.cs + * SelectionRange.cs + * SelectionRangeConverter.cs + * TabPage.cs + * TextBox.cs + * Timer.cs + * ToolBarButton.cs + * TrackBar.cs + * UpDownBase.cs + * UserControl.cs + * tooltip.cs + + * cleanup, dead code removeal, replaced throw not implmented's with //FIXME:s + + 2002-12-3 DennisHayes <dennish@raytek.com> + * *.cs + * switched to unix style line terminiators + + + + 2002-12-3 DennisHayes <dennish@raytek.com> + + * 140 files changed. replaced throw notimplmenteds with FIXME:s, removed dead code, + * corrected + + 2002-12-1 DennisHayes <dennish@raytek.com> + + * AccessibleObject.cs + * Application.cs + * ApplicationContext.cs + * AxHost.cs + * Binding.cs + * BindingContext.cs + * Button.cs + * CheckBox.cs + * CheckedListBox.cs + * Clipboard.cs + * ColorDialog.cs + * ColumnHeader.cs + * ComboBox.cs + * CommonDialog.cs + * ContainerControl.cs + * ContextMenu.cs + * Control.cs + * ControlBindingsCollection.cs + * ControlPaint.cs + * CreateParams.cs + * CurrencyManager.cs + * Cursor.cs + * CursorConverter.cs + * Cursors.cs + * DataFormats.cs + * DataGrid.cs + * DataGridTableStyle.cs + * DataGridTextBox.cs + * DataGridTextBoxColumn.cs + * DataObject.cs + * ErrorProvider.cs + * Form.cs + + * removed some throw notimplmented ecexptions + * Some small implmentaions + * some dead code removal + + 2002-11-28 DennisHayes <dennish@raytek.com> + + * In visual studio, I added a SWFTest project to the SWF solution. + * Using Microsoft's swf.dll, I added one of each possible stock controls to the form. + * I closed the form (swf design stuff i svery incomplete). + * I Removed the reference to MS's swf.dll, and added a reference to the SWF project. + * The result compiles, runs, and can be closed, without crashing in windows. + * PrintPreviewDialog is the only item (other than crystal reports) on the + * standard toolbar that is not included. + * When run, a standard window comes up, not a dialog/form type window. + * The form is as small as possible, just a caption bar of minimum width + * with control bax and min/max box. It can be resized to any size fine. + * no controls are actualy displayed. they may be of zero size, or it + * may be due to the window not being a dialog box, or it may be anything. + + * ApplicationContext.cs + * Button.cs + * ChangeLog + * CheckBox.cs + * CheckedListBox.cs + * ColorDialog.cs + * ComboBox.cs + * ContainerControl.cs + * Control.cs + * DataGrid.cs + * DateTimePicker.cs + * DomainUpDown.cs + * ErrorProvider.cs + * FileDialog.cs + * FontDialog.cs + * Form.cs + * GroupBox.cs + * HelpProvider.cs + * HScrollBar.cs + * ImageList.cs + * Label.cs + * LinkLabel.cs + * ListBox.cs + * ListControl.cs + * ListView.cs + * logfile.txt + * MainMenu.cs + * Menu.cs + * MenuItem.cs + * NativeWindow.cs + * NotifyIcon.cs + * NumericUpDown.cs + * OpenFileDialog.cs + * PageSetupDialog.cs + * Panel.cs + * PictureBox.cs + * PrintDialog.cs + * PrintPreviewControl.cs + * PrintPreviewDialog.cs + * ProgressBar.cs + * RadioButton.cs + * RichTextBox.cs + * SaveFileDialog.cs + * ScrollableControl.cs + * ScrollBar.cs + * Splitter.cs + * StatusBar.cs + * System.Windows.Forms.csproj + * System.Windows.Forms.csproj.user + * TabControl.cs + * TextBox.cs + * TextBoxBase.cs + * Timer.cs + * ToolBar.cs + * ToolBarButton.cs + * tooltip.cs + * TrackBar.cs + * TreeNode.cs + * TreeNodeCollection.cs + * TreeView.cs + * UpDownBase.cs + * UserControl.cs + * VScrollBar.cs + * win32Enums.cs + * win32functions.cs + + 2002-11-27 DennisHayes <dennish@raytek.com> + * checkin for Alexandre Pigolkine (pigolkine@gmx.de) with minor changes + + * Control.cs + * MainMenu.cs + * Menu.cs + * MenuItem.cs + * NativeWindow.cs + * win32Enums.cs + * win32functions.cs + + * WIN32 implmentation + + 2002-11-24 DennisHayes <dennish@raytek.com> + + * Application.cs + * Control.cs + * Form.cs + * Message.cs + * NativeWindow.cs + * ScrollableControl.cs + * win32functions.cs + * win32Structs.cs + + * Fixed added more win32 stuff + * On windows in Visual studio and runs my test program, but does + * not display a window. the window Handle is null, so the size gets set to 0,0. + + + 2002-11-23 DennisHayes <dennish@raytek.com> + checked in for Francois-Denis Gonthier + + * win32functions.cs + * win32Structs.cs + * Menu.cs + * ScrollableControl.cs + * MenuItem.cs + * NativeWindow.cs + * Form.cs + * move some more stuff from monostub to c# + * converted a couple of files to unix style line end + * some implmementation + + 2002-11-17 DennisHayes <dennish@raytek.com> + + * AccessibleObject.cs + + * Removed COMvisible. Docs say yes, but verifer says no + + 2002-11-17 DennisHayes <dennish@raytek.com> + + * Application.cs + * Button.cs + * Control.cs + * Form.cs + * Label.cs + * ListBox.cs + * Menu.cs + * MessageBox.cs + * NativeWindow.cs + * PrintPreviewDialog.cs + * ScrollableControl.cs + * ScrollBar.cs + * VScrollBar.cs + + * Made changes releated to the new win32 stuff + + 2002-11-17 DennisHayes <dennish@raytek.com> + * Win32Enums.cs + * Win32Handles.cs + * Win32Interfaces.cs + * Win32RegistryUtil.cs + * Win32Structs.cs + + * Completed merging files from Carlos Harvey Perez + * Moved all parts of Win32.cs to these files + * eliminated Win32.cs. + * + * many things moved from win32.cs still commented out. + * Also needs to be mono styled. + + * Win32.cs - removed + + 2002-11-12 DennisHayes <dennish@raytek.com> + + * Win32Enums.cs + * Win32Handles.cs + * Win32Interfaces.cs + * Win32RegistryUtil.cs + * Win32Structs.cs + + * Added files from Carlos Harvey Perez + ** Thanks Carlos! ** + * Moved all parts of Win32.cs to these files + * Execpt for functions. Will merge functions + * and eliminate remove Win32.cs soon. + * + * most things moved from win32.cs still commented out. + * Also needs to be mono styled. + + * Win32.cs + * Moved stuff from win32.cs to files from Carlos.2002-11-12 Gonzalo Paniagua Javier <gonzalo@ximian.com> + +2002-11-12 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * ListBox.cs: added ItemHeight and DrawMode properties. Fixes the build + in unix. + + * ListBox.cs: added ItemHeight and DrawMode properties. Fixes the build + in unix. + +2002-11-02 Miguel de Icaza <miguel@ximian.com> + + * Win32.cs: Added IsMenu, CreateMenu, AppendMenuA, DestroyMenu entry points. + +2002-10-29 DennisHayes <dennish@raytek.com> + + * AmbientProperties.cs + * Application.cs + * ApplicationContext.cs + * CheckBox.cs + * CheckedListBox.cs + * ColumnHeader.cs + * ContainerControl.cs + * ContextMenu.cs + * Control.cs + * Cursors.cs + * HScrollBar.cs + * ListBox.cs + * MainMenu.cs + * Menu.cs + * MenuItem.cs + * MessageBox.cs + * NativeWindow.cs + * PictureBox.cs + * ScrollableControl.cs + * ScrollBar.cs + * System.Windows.Forms.csproj + * System.Windows.Forms.csproj.user + * VScrollBar.cs + * Win32.cs + + * minor formating, bug fixes, and implmentation + + + 2002-10-29 DennisHayes <dennish@raytek.com> + * checkin for Alexandre Pigolkine (pigolkine@gmx.de) + * Menu classes start on implmentation + + 2002-10-27 DennisHayes <dennish@raytek.com> + + * AccessibleObject.cs + * AssemblyInfo.cs + * AxHost.cs + * BaseCollection.cs + * BindingMemberInfo.cs + * BindingsCollection.cs + * ButtonBase.cs + * ColumnClickEventArgs.cs + * ComboBox.cs + * ContainerControl.cs + * ContentsResizedEventArgs.cs + * Control.cs + * ControlEventArgs.cs + * ConvertEventArgs.cs + * DateBoldEventArgs.cs + * DateRangeEventArgs.cs + * DomainUpDown.cs + * DragEventArgs.cs + * DrawItemEventArgs.cs + * FolderBrowserDialog.cs + * Form.cs + * GiveFeedbackEventArgs.cs + * HelpEventArgs.cs + * InputLanguageChangedEventArgs.cs + * InputLanguageChangingEventArgs.cs + * InvalidateEventArgs.cs + * ItemChangedEventArgs.cs + * ItemCheckEventArgs.cs + * ItemDragEventArgs.cs + * KeyEventArgs.cs + * KeyPressEventArgs.cs + * Keys.cs + * LabelEditEventArgs.cs + * LayoutEventArgs.cs + * LinkClickedEventArgs.cs + * LinkLabelLinkClickedEventArgs.cs + * ListControl.cs + * MeasureItemEventArgs.cs + * MouseEventArgs.cs + * NavigateEventArgs.cs + * NodeLabelEditEventArgs.cs + * PaintEventArgs.cs + * PrintPreviewDialog.cs + * PropertyTabChangedEventArgs.cs + * PropertyValueChangedEventArgs.cs + * QueryAccessibilityHelpEventArgs.cs + * QueryContinueDragEventArgs.cs + * ScrollEventArgs.cs + * SelectedGridItemChangedEventArgs.cs + * SplitterEventArgs.cs + * StatusBarDrawItemEventArgs.cs + * StatusBarPanelClickEventArgs.cs + * System.Windows.Forms.csproj + * System.Windows.Forms.csproj.user + * TextBox.cs + * ToolBarButtonClickEventArgs.cs + * TreeNodeConverter.cs + * TreeViewCancelEventArgs.cs + * UICuesEventArgs.cs + * UpDownBase.cs + * UpDownEventArgs.cs + * VScrollBar.cs + + + * Stubs now compliant with .NET 1.1 Beta, except for one that has dependencies. + * Added FolderBrowserDialog.cs for .NET 1.1 beta compatibility. + * Completed implmentation of all *Args classes. + * Updated checkoutlist. + * Made fixes so this will compile using Visual studio under windows. + + + + 2002-10-26 DennisHayes <dennish@raytek.com> + + * Added CheckOutFile to SWF one level up from here + * to keep track of who is working on what. + + 2002-10-24 DennisHayes <dennish@raytek.com> + + * AccessibleObject.cs + * Application.cs + * AssemblyInfo.cs + * BaseCollection.cs + * BindingContext.cs + * BindingManagerBase.cs + * BindingsCollection.cs + * ContainerControl.cs + * Control.cs + * Font.cs + * Form.cs + * IAccessible.cs + * InputLanguageCollection.cs + * Label.cs + * MessageBox.cs + * PropertyTabChangedEventArgs.cs + * ScrollableControl.cs + * Win32.cs + * WINELib.csproj + * WINELib.csproj.user + * winelib.sln + + * Changes to get winelib version running with more methods uncommented out. + * Especialy trying to get CE compliance. + +2002-10-22 DennisHayes <dennish@raytek.com> + * Miguel moved files from WINELIB to here + * See ochagelog for details + +2002-10-13 DennisHayes <dennish@raytek.com> + + *Application.cs + *AxHost.cs + *ChangeLog + *CheckedListBox.cs + *ComboBox.cs + *CurrencyManager.cs + *DateTimePicker.cs + *DomainUpDown.cs + *FolderBrowserDialog.cs + *ListBox.cs + *logfile.txt + *StatusBarDrawItemEventArgs.cs + *TabControl.cs + *TextBox.cs + *TrackBar.cs + *UpDownBase.cs + + * Updated to match .NET V1.1 Beta + +2002-9-2 DennisHayes <dennish@raytek.com> + +* AccessibleObject.cs +* AmbientProperties.cs +* AxHost.cs +* Button.cs +* ButtonBase.cs +* CheckBox.cs +* ColorDialog.cs +* ColumnHeader.cs +* ComboBox.cs +* ContainerControl.cs +* DataGrid.cs +* DateTimePicker.cs +* ListControl.cs +* PrintPreviewDialog.cs +* Implmented any functions. + +* System.Windows.Forms.csproj +* System.Windows.Forms.csproj.user +* Added win32.cs + +2002-8-6 DennisHayes <dennish@raytek.com> +* Checked in for Ginandrea Terzi (gterzi@lario.com) + +* MeasureItemEventArgs.cs +* PropertyValueChangedEventArgs.cs +* ScrollEventArgs.cs +* ScrollEventType.cs +* SelectionMode.cs +* Shortcut.cs +* TickStyle.cs +* ToolBarButtonClickEventArgs.cs +* TreeViewAction.cs +* TriangleDirection.cs +* UICues.cs +* UICuesEventArgs.cs +* UpDownBase.cs +* UpDownEventHandler.cs +* Fixed syntax errors and verifier errors + +2002-8-6 DennisHayes <dennish@raytek.com> + +* PropertyTabChangedEventArgs.cs +* Minor sytax bug fixes. + +* System.Windows.Forms.csproj +* System.Windows.Forms.csproj.user +* System.Windows.Forms.sln +* Added support for System.Windows.Forms.Design +* Builds two dlls instead of one. +* Allows compiling for now, but needs to be fixed + +2002-8-2 DennisHayes <dennish@raytek.com> +* Checked in for Ginandrea Terzi (gterzi@lario.com) + +* AssemblyInfo.cs +* ColumnClickEventArgs.cs +* ContentsResizedEventArgs.cs +* ControlEventArgs.cs +* ConvertEventArgs.cs +* DateBoldEventArgs.cs +* DateRangeEventArgs.cs +* DragEventArgs.cs +* DrawItemEventArgs.cs +* GiveFeedbackEventArgs.cs +* HelpEventArgs.cs +* InputLanguageChangedEventArgs.cs +* InputLanguageChangingEventArgs.cs +* InvalidateEventArgs.cs +* ItemChangedEventArgs.cs +* ItemCheckEventArgs.cs +* ItemDragEventArgs.cs + +* KeyEventArgs.cs +* KeyPressEventArgs.cs +* LabelEditEventArgs.cs +* LayoutEventArgs.cs +* LinkClickedEventArgs.cs +* LinkLabelLinkClickedEventArgs.cs +* logfile.txt +* MeasureItemEventArgs.cs +* MouseEventArgs.cs +* NavigateEventArgs.cs +* NodeLabelEditEventArgs.cs +* PaintEventArgs.cs +* PropertyTabChangedEventArgs.cs +* PropertyValueChangedEventArgs.cs +* QueryAccessibilityHelpEventArgs.cs +* QueryContinueDragEventArgs.cs +* ScrollEventArgs.cs +* SelectedGridItemChangedEventArgs.cs +* SplitterEventArgs.cs +* StatusBarDrawItemEventArgs.cs +* StatusBarPanelClickEventArgs.cs +* ToolBarButtonClickEventArgs.cs +* TreeViewCancelEventArgs.cs +* UICuesEventArgs.cs +* UpDownEventArgs.cs +* Improved ToString functions +* Completed the rest of the *.args classes + +2002-8-1 DennisHayes <dennish@raytek.com> +* Checked in for Ginandrea Terzi (gterzi@lario.com) + +* KeyEventArgs.cs +* KeyPressEventArgs.cs +* LabelEditEventArgs.cs +* LayoutEventArgs.cs +* LinkClickedEventArgs.cs +* LinkLabelLinkClickedEventArgs.cs +* MeasureItemEventArgs.cs +* MouseEventArgs.cs +* NavigateEventArgs.cs +* NodeLabelEditEventArgs.cs +* PaintEventArgs.cs +* PropertyTabChangedEventArgs.cs +* PropertyValueChangedEventArgs.cs +* QueryAccessibilityHelpEventArgs.cs +* QueryContinueDragEventArgs.cs +* ScrollEventArgs.cs +* SelectedGridItemChangedEventArgs.cs +* SplitterEventArgs.cs +* StatusBarDrawItemEventArgs.cs +* StatusBarPanelClickEventArgs.cs +* ToolBarButtonClickEventArgs.cs +* TreeViewCancelEventArgs.cs +* UICuesEventArgs.cs +* UpDownEventArgs.cs +* Corrected, cleaned up/ completed some *args.cs classes. +* May break build, but should be easy to fix, will verifiy +* tonight and check in any needed fixes. + +2002-8-1 DennisHayes <dennish@raytek.com> +* MonthCalendar.cs +* ButtonBase.cs +* Form.cs +* MonthCalendar commented out, stubbs need work +* GTK references removed from Buttonbase and form, to make compile easier. +* Replace GTK references as soon as build works on Windows and Linux. +* With this, SWF should compile uder visual studio + +2002-8-1 DennisHayes <dennish@raytek.com> +* TODOAttribute.cs +* ComVisible.cs +* added so the namespace can compile, remove when replaced with mono equivalents. + +2002-8-1 DennisHayes <dennish@raytek.com> +* System.Windows.Forms.csproj +* System.Windows.Forms.csproj.user +* System.Windows.Forms.sln +* AssemblyInfo.cs * Not sure if this file is needed. not a part of the namespace, just visual studio +* Added files to compile using visual Studio + +2002-8-1 DennisHayes <dennish@raytek.com> +* Getopt.cs +* removed, file contained only trash, not needed. + + +2002-7-30 DennisHayes <dennish@raytek.com> + +* AccessibleNavigation.cs +* AccessibleObject.cs +* AccessibleSelection.cs +* AmbientProperties.cs +* Application.cs +* ApplicationContext.cs +* AxHost.cs +* BaseCollection.cs +* Binding.cs +* BindingContext.cs +* BindingManagerBase.cs +* BindingMemberInfo.cs +* BindingsCollection.cs +* Button.cs +* ButtonBase.cs +* CaptionButton.cs +* CharacterCasing.cs +* CheckBox.cs +* CheckedListBox.cs +* CheckState.cs +* Clipboard.cs +* ColorDialog.cs +* ColumnClickEventArgs.cs +* ColumnClickEventHandler.cs +* ColumnHeader.cs +* ComboBox.cs +* CommonDialog.cs +* ContainerControl.cs +* ContentsResizedEventHandler.cs +* ContextMenu.cs +* Control.cs +* ControlBindingsCollection.cs +* ControlEventArgs.cs +* ControlEventHandler.cs +* ControlPaint.cs +* ConvertEventHandler.cs +* CreateParams.cs +* CurrencyManager.cs +* Cursor.cs +* CursorConverter.cs +* Cursors.cs +* DataFormats.cs +* DataGrid.cs +* DataGridBoolColumn.cs +* DataGridCell.cs +* DataGridColumnStyle.cs +* DataGridParentRowsLabelStyle.cs +* DataGridPreferredColumnWidthTypeConverter.cs +* DataGridTableStyle.cs +* DataGridTextBox.cs +* DataGridTextBoxColumn.cs +* DataObject.cs +* DateBoldEventArgs.cs +* DateRangeEventArgs.cs +* DateRangeEventHandler.cs +* DateTimePicker.cs +* DialogResult.cs +* DockStyle.cs +* DomainUpDown.cs +* DragAction.cs +* DragDropEffects.cs +* DragEventArgs.cs +* DragEventHandler.cs +* DrawItemEventArgs.cs +* DrawItemEventHandler.cs +* DrawItemState.cs +* DrawMode.cs +* ErrorBlinkStyle.cs +* ErrorIconAlignment.cs +* ErrorProvider.cs +* FeatureSupport.cs +* FileDialog.cs +* FlatStyle.cs +* FontDialog.cs +* Form.cs +* FormBorderStyle.cs +* FormStartPosition.cs +* FormWindowState.cs +* FrameStyle.cs +* GiveFeedbackEventHandler.cs +* GridColumnStylesCollection.cs +* GridItemCollection.cs +* GridTableStylesCollection.cs +* GroupBox.cs +* Help.cs +* HelpEventHandler.cs +* HelpProvider.cs +* HScrollBar.cs +* ImageIndexConverter.cs +* ImageList.cs +* ImageListStreamer.cs +* InputLanguage.cs +* InputLanguageChangedEventHandler.cs +* InputLanguageChangingEventHandler.cs +* InputLanguageCollection.cs +* InvalidateEventHandler.cs +* ItemChangedEventArgs.cs +* ItemChangedEventHandler.cs +* ItemCheckEventHandler.cs +* ItemDragEventHandler.cs +* KeyEventHandler.cs +* KeyPressEventArgs.cs +* KeyPressEventHandler.cs +* KeysConverter.cs +* Label.cs +* LabelEditEventHandler.cs +* LayoutEventHandler.cs +* LinkArea.cs +* LinkClickedEventHandler.cs +* LinkLabel.cs +* LinkLabelLinkClickedEventHandler.cs +* ListBindingConverter.cs +* ListBox.cs +* ListControl.cs +* ListView.cs +* ListViewItem.cs +* ListViewItemConverter.cs +* logfile.txt +* MainMenu.cs +* MeasureItemEventHandler.cs +* Menu.cs +* MenuItem.cs +* Message.cs +* MessageBox.cs +* MethodInvoker.cs +* MonthCalendar.cs +* MouseEventHandler.cs +* NativeWindow.cs +* NavigateEventHandler.cs +* NodeLabelEditEventHandler.cs +* NotifyIcon.cs +* NumericUpDown.cs +* OpacityConverter.cs +* OpenFileDialog.cs +* OSFeature.cs +* PageSetupDialog.cs +* PaintEventArgs.cs +* PaintEventHandler.cs +* Panel.cs +* PrintControllerWithStatusDialog.cs +* PrintDialog.cs +* PrintPreviewControl.cs +* PrintPreviewDialog.cs +* ProgressBar.cs +* PropertyGrid.cs +* PropertyManager.cs +* PropertyTabChangedEventArgs.cs +* PropertyTabChangedEventHandler.cs +* PropertyValueChangedEventHandler.cs +* QueryAccessibilityHelpEventHandler.cs +* QueryContinueDragEventHandler.cs +* RadioButton.cs +* RichTextBox.cs +* SaveFileDialog.cs +* Screen.cs +* ScrollableControl.cs +* ScrollBar.cs +* ScrollEventArgs.cs +* ScrollEventHandler.cs +* SelectedGridItemChangedEventHandler.cs +* SelectionRange.cs +* SelectionRangeConverter.cs +* SendKeys.cs +* Splitter.cs +* SplitterEventHandler.cs +* StatusBar.cs +* StatusBarDrawItemEventArgs.cs +* StatusBarDrawItemEventHandler.cs +* StatusBarPanel.cs +* StatusBarPanelClickEventArgs.cs +* StatusBarPanelClickEventHandler.cs +* StatusBarPanelCollection.cs +* SystemInformation.cs + +* TabControl.cs +* TabPage.cs +* TextBox.cs +* TextBoxBase.cs +* ThreadExceptionDialog.cs +* Timer.cs +* ToolBar.cs +* ToolBarButton.cs +* ToolBarButtonClickEventHandler.cs +* ToolTip.cs +* TrackBar.cs +* TreeNode.cs +* TreeNodeCollection.cs +* TreeNodeConverter.cs +* TreeView.cs +* TreeViewCancelEventHandler.cs +* TreeViewEventHandler.cs +* TreeViewImageIndexConverter.cs +* UICuesEventArgs.cs +* UICuesEventHandler.cs +* UpDownBase.cs +* UpDownEventHandler.cs +* UserControl.cs +* VScrollBar.cs +* Fixed errors reported by verify.exe, mostly attribute errors. +* Added my name to author's list to files I edited in the last two weeks + +2002-7-22 DennisHayes <dennish@raytek.com> + +* DateTimePickerFormat.cs +* Added values. +* The NAMESPACE NOW COMPILES under windows in Visual Studio using the Microsoft version of the classes. +* Verify.exe reports 600 errors. + +2002-7-21 DennisHayes <dennish@raytek.com> + +* AccessibleObject.cs +* AmbientProperties.cs +* AxHost.cs +* BaseCollection.cs +* BindingsCollection.cs +* ButtonBase.cs +* CheckBox.cs +* CheckedListBox.cs +* ComboBox.cs +* ContainerControl.cs +* ContextMenu.cs +* Control.cs +* ControlEventArgs.cs +* ControlPaint.cs +* ConvertEventArgs.cs +* DataGrid.cs +* DataGridColumnStyle.cs +* DataObject.cs +* DateTimePicker.cs +* DomainUpDown.cs +* DragEventArgs.cs +* DrawItemEventArgs.cs +* ErrorProvider.cs +* FeatureSupport.cs +* FileDialog.cs +* FontDialog.cs +* Form.cs +* GiveFeedbackEventArgs.cs +* GridColumnStylesCollection.cs +* GridItem.cs +* GridItemCollection.cs +* GridTableStylesCollection.cs +* GroupBox.cs +* Help.cs +* HelpEventArgs.cs +* HelpProvider.cs +* HScrollBar.cs +* ImageIndexConverter.cs +* ImageList.cs +* ImageListStreamer.cs +* InputLanguage.cs +* InputLanguageChangedEventArgs.cs +* InputLanguageChangingEventArgs.cs +* InputLanguageCollection.cs +* InvalidateEventArgs.cs +* ItemChangedEventArgs.cs +* ItemCheckEventArgs.cs +* ItemDragEventArgs.cs +* KeyEventArgs.cs +* KeyPressEventArgs.cs +* KeysConverter.cs +* Label.cs +* LabelEditEventArgs.cs +* LayoutEventArgs.cs +* LinkArea.cs +* LinkClickedEventArgs.cs +* LinkLabel.cs +* LinkLabelLinkClickedEventArgs.cs +* LinkLabelLinkClickedEventHandler.cs +* ListBindingConverter.cs +* ListBox.cs +* ListControl.cs +* ListView.cs +* ListViewItem.cs +* ListViewItemConverter.cs +* MainMenu.cs +* MeasureItemEventArgs.cs +* Menu.cs +* MenuItem.cs +* Message.cs +* MessageBox.cs +* MouseEventArgs.cs +* NativeWindow.cs +* NavigateEventArgs.cs +* NodeLabelEditEventArgs.cs +* NotifyIcon.cs +* NumericUpDown.cs +* OpacityConverter.cs +* OpenFileDialog.cs +* OSFeature.cs +* PageSetupDialog.cs +* PaintEventArgs.cs +* Panel.cs +* PrintControllerWithStatusDialog.cs +* PrintDialog.cs +* PrintPreviewDialog.cs +* QueryAccessibilityHelpEventArgs.cs +* QueryContinueDragEventArgs.cs +* RadioButton.cs +* RichTextBox.cs +* SaveFileDialog.cs +* Screen.cs +* ScrollableControl.cs +* ScrollBar.cs +* ScrollEventArgs.cs +* SelectedGridItemChangedEventArgs.cs +* SelectionRange.cs +* SelectionRangeConverter.cs +* SendKeys.cs +* Splitter.cs +* SplitterEventArgs.cs +* StatusBar.cs +* StatusBarDrawItemEventArgs.cs +* StatusBarPanelCollection.cs +* TabControl.cs +* TabPage.cs +* TextBox.cs +* TextBoxBase.cs +* ToolBar.cs +* ToolBarButtonClickEventArgs.cs +* ToolTip.cs +* TrackBar.cs +* TreeNodeCollection.cs +* TreeView.cs +* UserControl.cs +* commented out inherited class that did not need to be stubbed. +* fixed bugs, added values to one enum. Stubbed interfaces. +* The NAMESPACE NOW COMPILES under windows in Visual Studio using the Microsoft version of the classes. +* Verify.exe reports 600 errors. + +2002-7-7 DennisHayes <dennish@raytek.com> + +* ToolBarButtonClickEventArgs.cs +* UpDownEventArgs.cs +* KeyPressEventHandler.cs +* Added new files. + +2002-7-7 DennisHayes <dennish@raytek.com> + +* AccessibleEvents.cs +* AccessibleNavigation.cs +* AccessibleObject.cs +* AccessibleRole.cs +* AccessibleSelection.cs +* AccessibleStates.cs +* AmbientProperties.cs +* AnchorStyles.cs +* Appearance.cs +* Application.cs +* ApplicationContext.cs +* ArrangeDirection.cs +* ArrangeStartingPosition.cs +* AxHost.cs +* BaseCollection.cs +* Binding.cs +* BindingContext.cs +* BindingManagerBase.cs +* BindingMemberInfo.cs +* BindingsCollection.cs +* BootMode.cs +* Border3DSide.cs +* Border3DStyle.cs +* BorderStyle.cs +* BoundsSpecified.cs +* Button.cs +* ButtonBase.cs +* ButtonBorderStyle.cs +* ButtonState.cs +* CaptionButton.cs +* CharacterCasing.cs +* CheckBox.cs +* CheckedListBox.cs +* CheckState.cs +* Clipboard.cs +* ColorDepth.cs +* ColorDialog.cs +* ColumnClickEventArgs.cs +* ColumnClickEventHandler.cs +* ColumnHeader.cs +* ColumnHeaderStyle.cs +* ComboBox.cs +* ComboBoxStyle.cs +* CommonDialog.cs +* ComVisible.cs +* ContainerControl.cs +* ContentsResizedEventArgs.cs +* ContentsResizedEventHandler.cs +* ContextMenu.cs +* Control.cs +* ControlBindingsCollection.cs +* ControlEventArgs.cs +* ControlEventHandler.cs +* ControlPaint.cs +* ControlStyles.cs +* ConvertEventArgs.cs +* ConvertEventHandler.cs +* CreateParams.cs +* CurrencyManager.cs +* Cursor.cs +* CursorConverter.cs +* Cursors.cs +* DataFormats.cs +* DataGrid.cs +* DataGridBoolColumn.cs +* DataGridCell.cs +* DataGridColumnStyle.cs +* DataGridLineStyle.cs +* DataGridParentRowsLabelStyle.cs +* DataGridPreferredColumnWidthTypeConverter.cs +* DataGridTableStyle.cs +* DataGridTextBox.cs +* DataGridTextBoxColumn.cs +* DataObject.cs +* DateBoldEventArgs.cs +* DateRangeEventArgs.cs +* DateRangeEventHandler.cs +* DateTimePicker.cs +* DateTimePickerFormat.cs +* day.cs +* DialogResult.cs +* DockStyle.cs +* DomainUpDown.cs +* DragAction.cs +* DragDropEffects.cs +* DragEventArgs.cs +* DragEventHandler.cs +* DrawItemEventArgs.cs +* DrawItemEventHandler.cs +* DrawItemState.cs +* DrawMode.cs +* ErrorBlinkStyle.cs +* ErrorIconAlignment.cs +* ErrorProvider.cs +* FeatureSupport.cs +* FileDialog.cs +* FlatStyle.cs +* FontDialog.cs +* Form.cs +* FormBorderStyle.cs +* FormStartPosition.cs +* FormWindowState.cs +* FrameStyle.cs +* Getopt.cs +* GiveFeedbackEventArgs.cs +* GiveFeedbackEventHandler.cs +* GridColumnStylesCollection.cs +* GridItem.cs +* GridItemCollection.cs +* GridItemType.cs +* GridTableStylesCollection.cs +* GroupBox.cs +* Help.cs +* HelpEventArgs.cs +* HelpEventHandler.cs +* HelpNavigator.cs +* HelpProvider.cs +* HorizontalAlignment.cs +* HScrollBar.cs +* IButtonControl.cs +* ICommandExecutor.cs +* IComponentEditorPageSite.cs +* IContainerControl.cs +* IDataGridColumnStyleEditingNotificationService.cs +* IDataGridEditingService.cs +* IDataObject.cs +* IFeatureSupport.cs +* IFileReaderService.cs +* ImageIndexConverter.cs +* ImageList.cs +* ImageListStreamer.cs +* ImeMode.cs +* IMessageFilter.cs +* InputLanguage.cs +* InputLanguageChangedEventArgs.cs +* InputLanguageChangedEventHandler.cs +* InputLanguageChangingEventArgs.cs +* InputLanguageChangingEventHandler.cs +* InputLanguageCollection.cs +* InvalidateEventArgs.cs +* InvalidateEventHandler.cs +* ItemActivation.cs +* ItemBoundsPortion.cs +* ItemChangedEventArgs.cs +* ItemChangedEventHandler.cs +* ItemCheckEventArgs.cs +* ItemCheckEventHandler.cs +* ItemDragEventArgs.cs +* ItemDragEventHandler.cs +* IWin32Window.cs +* IWindowTarget.cs +* KeyEventArgs.cs +* KeyEventHandler.cs +* KeyPressEventArgs.cs +* KeyPressEventHandler.cs +* Keys.cs +* KeysConverter.cs +* Label.cs +* LabelEditEventArgs.cs +* LabelEditEventHandler.cs +* LayoutEventArgs.cs +* LayoutEventHandler.cs +* LeftRightAlignment.cs +* LinkArea.cs +* LinkBehavior.cs +* LinkClickedEventArgs.cs +* LinkClickedEventHandler.cs +* LinkLabel.cs +* LinkLabelLinkClickedEventArgs.cs +* LinkLabelLinkClickedEventHandler.cs +* LinkState.cs +* ListBindingConverter.cs +* ListBox.cs +* ListControl.cs +* ListView.cs +* ListViewAlignment.cs +* ListViewItem.cs +* ListViewItemConverter.cs +* MainMenu.cs +* MdiLayout.cs +* MeasureItemEventArgs.cs +* MeasureItemEventHandler.cs +* Menu.cs +* MenuGlyph.cs +* MenuItem.cs +* MenuMerge.cs +* Message.cs +* MessageBox.cs +* MessageBoxButtons.cs +* MessageBoxDefaultButton.cs +* MessageBoxIcon.cs +* MessageBoxOptions.cs +* MethodInvoker.cs +* MonthCalendar.cs +* MouseButtons.cs +* MouseEventArgs.cs +* MouseEventHandler.cs +* NativeWindow.cs +* NavigateEventArgs.cs +* NavigateEventHandler.cs +* NodeLabelEditEventArgs.cs +* NodeLabelEditEventHandler.cs +* NotifyIcon.cs +* NumericUpDown.cs +* OpacityConverter.cs +* OpenFileDialog.cs +* Orientation.cs +* OSFeature.cs +* PageSetupDialog.cs +* PaintEventArgs.cs +* PaintEventHandler.cs +* Panel.cs +* PictureBoxSizeMode.cs +* PrintControllerWithStatusDialog.cs +* PrintDialog.cs +* PrintPreviewControl.cs +* PrintPreviewDialog.cs +* ProgressBar.cs +* PropertyGrid.cs +* PropertyManager.cs +* PropertySort.cs +* PropertyTabChangedEventArgs.cs +* PropertyTabChangedEventHandler.cs +* PropertyValueChangedEventArgs.cs +* PropertyValueChangedEventHandler.cs +* QueryAccessibilityHelpEventArgs.cs +* QueryAccessibilityHelpEventHandler.cs +* QueryContinueDragEventArgs.cs +* QueryContinueDragEventHandler.cs +* RadioButton.cs +* RichTextBox.cs +* RichTextBoxFinds.cs +* RichTextBoxScrollBars.cs +* RichTextBoxSelectionAttribute.cs +* RichTextBoxSelectionTypes.cs +* RichTextBoxStreamType.cs + +* RichTextBoxWordPunctuations.cs +* RightToLeft.cs +* SaveFileDialog.cs +* Screen.cs +* ScrollableControl.cs +* ScrollBar.cs +* ScrollBars.cs +* ScrollButton.cs + +* ScrollEventArgs.cs +* ScrollEventHandler.cs +* ScrollEventType.cs +* SecurityIDType.cs +* SelectedGridItemChangedEventArgs.cs +* SelectedGridItemChangedEventHandler.cs +* SelectionMode.cs +* SelectionRange.cs +* SelectionRangeConverter.cs +* SendKeys.cs +* Shortcut.cs +* SizeGripStyle.cs +* SortOrder.cs +* Splitter.cs +* SplitterEventArgs.cs +* SplitterEventHandler.cs +* StatusBar.cs +* StatusBarDrawItemEventArgs.cs +* StatusBarDrawItemEventHandler.cs +* StatusBarPanel.cs +* StatusBarPanelAutoSize.cs +* StatusBarPanelBorderStyle.cs +* StatusBarPanelClickEventArgs.cs +* StatusBarPanelClickEventHandler.cs +* StatusBarPanelCollection.cs +* StatusBarPanelStyle.cs +* StructFormat.cs +* SystemInformation.cs +* TabAlignment.cs +* TabAppearance.cs +* TabControl.cs +* TabDrawMode.cs +* TabPage.cs +* TabSizeMode.cs +* TextBox.cs +* TextBoxBase.cs +* ThreadExceptionDialog.cs +* TickStyle.cs +* Timer.cs +* ToolBar.cs +* ToolBarAppearance.cs +* ToolBarButton.cs +* ToolBarButtonClickEventArgs.cs +* ToolBarButtonClickEventHandler.cs +* ToolBarButtonStyle.cs +* ToolBarTextAlign.cs +* ToolTip.cs +* TrackBar.cs +* TreeNode.cs +* TreeNodeCollection.cs +* TreeNodeConverter.cs +* TreeView.cs +* TreeViewAction.cs +* TreeViewCancelEventArgs.cs +* TreeViewCancelEventHandler.cs +* TreeViewEventArgs.cs +* TreeViewEventHandler.cs +* TreeViewImageIndexConverter.cs +* UICues.cs +* UICuesEventArgs.cs +* UICuesEventHandler.cs +* UpDownBase.cs +* UpDownEventArgs.cs +* UpDownEventHandler.cs +* UserControl.cs +* View.cs +* VScrollBar.cs +* Monostyled everything! + + + +2002-7-7 DennisHayes <dennish@raytek.com> + +* AccessibleObject.cs +* AmbientProperties.cs +* AxHost.cs +* BindingsCollection.cs +* Button.cs +* ButtonBase.cs +* ChangeLog +* CheckBox.cs +* CheckedListBox.cs +* ColorDialog.cs +* ComboBox.cs +* CommonDialog.cs +* ContainerControl.cs +* ContextMenu.cs +* ControlEventArgs.cs +* CurrencyManager.cs +* DataGrid.cs +* DataGridBoolColumn.cs +* DataGridColumnStyle.cs +* DataGridTableStyle.cs +* DataGridTextBox.cs +* DataGridTextBoxColumn.cs +* DateTimePickerFormat.cs +* ErrorProvider.cs +* FileDialog.cs +* FontDialog.cs +* Form.cs +* GroupBox.cs +* HelpProvider.cs +* HScrollBar.cs +* ImageList.cs +* KeyPressEventHandler.cs +* Label.cs +* LinkLabel.cs +* LinkLabelLinkClickedEventArgs.cs +* ListBox.cs +* ListControl.cs +* ListView.cs +* logfile.txt +* MainMenu.cs +* Menu.cs +* MenuItem.cs +* MonthCalendar.cs +* NotifyIcon.cs +* OpenFileDialog.cs +* PageSetupDialog.cs +* Panel.cs +* PrintDialog.cs +* PropertyManager.cs +* RadioButton.cs +* RichTextBox.cs +* SaveFileDialog.cs +* ScrollableControl.cs +* ScrollBar.cs +* Splitter.cs +* StatusBar.cs +* StatusBarPanel.cs +* TabControl.cs +* TabPage.cs +* TextBox.cs +* TextBoxBase.cs +* ThreadExceptionDialog.cs +* Timer.cs +* ToolBar.cs +* ToolBarButton.cs +* TrackBar.cs +* TreeView.cs +* UpDownBase.cs +* VScrollBar.cs +* Uncommented stuff, re-commented stuff, adding usings, fixed minor syntax errors. + +2002-7-6 DennisHayes <dennish@raytek.com> + +* DragEventArgs.cs +* PropertyValueChangedEventArgs.cs +* InputLanguageChangedEventArgs.cs +* added files + +2002-7-6 DennisHayes <dennish@raytek.com> + +* ToolBarButtonClickEventArgs.cs +* UpDownEventArgs.cs +* PropertyValueChangedEventArgs.c +* Added new files + +2002-7-6 DennisHayes <dennish@raytek.com> + +* AccessibleObject.cs +* AmbientProperties.cs +* Application.cs +* ApplicationContext.cs +* AxHost.cs +* BaseCollection.cs +* Binding.cs +* BindingContext.cs +* BindingManagerBase.cs +* BindingsCollection.cs +* CaptionButton.cs +* Clipboard.cs +* ColumnHeader.cs +* Control.cs +* ControlBindingsCollection.cs +* ControlPaint.cs +* CreateParams.cs +* CurrencyManager.cs +* Cursor.cs +* CursorConverter.cs +* Cursors.cs +* DataFormats.cs +* DataGridPreferredColumnWidthTypeConverter.cs +* DataGridTextBoxColumn.cs +* DataObject.cs +* DateBoldEventArgs.cs +* DateTimePicker.cs +* DomainUpDown.cs +* FeatureSupport.cs +* FontDialog.cs +* Form.cs +* GridColumnStylesCollection.cs +* GridItemCollection.cs +* GridTableStylesCollection.cs +* Help.cs +* IButtonControl.cs +* IFileReaderService.cs +* ImageIndexConverter.cs +* ImageListStreamer.cs +* IMessageFilter.cs +* InputLanguage.cs +* InputLanguageChangeEventArgs.cs +* InputLanguageCollection.cs +* ItemChangedEventArgs.cs +* KeyEventArgs.cs +* KeyPressEventArgs.cs +* KeysConverter.cs +* LinkLabel.cs +* LinkLabelLinkClickedEventArgs.cs +* LinkLabelLinkClickedEventHandler.cs +* ListBindingConverter.cs +* ListViewItem.cs +* ListViewItemConverter.cs +* logfile.txt +* MessageBox.cs +* NativeWindow.cs +* NumericUpDown.cs +* OpacityConverter.cs +* OSFeature.cs +* PaintEventArgs.cs +* PrintControllerWithStatusDialog.cs +* PropertyGrid.cs +* PropertyTabChangedEventArgs.cs +* PropertyTabChangedEventHandler.cs +* PropertyValueChangedEventArgs.cs +* Screen.cs +* ScrollEventArgs.cs +* SelectionRange.cs +* SelectionRangeConverter.cs +* SendKeys.cs +* SplitterEventArgs.cs +* StatusBarPanelClickEventArgs.cs +* StatusBarPanelCollection.cs +* SystemInformation.cs +* ToolBarButtonClickEventArgs.cs +* ToolTip.cs +* TreeNode.cs +* TreeNodeCollection.cs +* TreeNodeConverter.cs +* TreeViewCancelEventArgs.cs +* TreeViewImageIndexConverter.cs +* UICuesEventArgs.cs +* UpDownBase.cs +* UpDownEventArgs.cs +* UserControl.cs +* Added usings, corrected minor syntax errors, uncommented some stuff to flush out compile errors. + +2002-7-3 DennisHayes <dennish@raytek.com> + +* AccessibleObject.cs +* Application.cs +* AxHost.cs +* Button.cs +* Control.cs +* Form.cs +* GridColumnStylesCollection.cs +* GridItemCollection.cs +* GridTableStylesCollection.cs +* ImageIndexConverter.cs +* ImageListStreamer.cs +* InputLanguageChangingEventArgs.cs +* KeysConverter.cs +* Label.cs +* LinkLabel.cs +* LinkLabelLinkClickedEventArgs.cs +* ListBox.cs +* ListView.cs +* ListViewItem.cs +* ListViewItemConverter.cs +* Menu.cs +* NumericUpDown.cs +* ScrollableControl.cs +* StatusBarDrawItemEventArgs.cs +* StatusBarPanel.cs +* StatusBarPanelCollection.cs +* TabControl.cs +* TrackBar.cs +* TreeNodeCollection.cs +* added usings, minor syntax corrections. + +2002-7-3 DennisHayes <dennish@raytek.com> +* checked in for Jaak Simm (jaaksimm@firm.ee) +* PrintPreviewControl.cs +* PrintPreviewDialog.cs +* ProgressBar.cs +* PropertyGrid.cs +* PropertyManager.cs +* PropertyTabChangedEventArgs.cs +* new files added + +2002-7-2 DennisHayes <dennish@raytek.com> +* Application.cs +* ControlEventArgs.cs +* Form.cs +* merged changes made by miguel and hestilow in gkt# to system.windows.forms + +2002-7-2 DennisHayes <dennish@raytek.com> +* Button.cs +* ButtonBase.cs +* ContainerControl.cs +* Label.cs +* ScrollableControl.cs +* Copied changes made by miguel and hestilow in gkt# to system.windows.forms + +2002-7-2 DennisHayes <dennish@raytek.com> +* Checked in for Richard Baumann (biochem333@nyc.rr.com) +* DataGridTextBoxColumn.cs +* DataObject.cs +* DateBoldEventArgs.cs +* DateRangeEventArgs.cs +* DateTimePicker.cs +* DomainUpDown.cs +* DragEventArgs.cs +* DrawItemEventArgs.cs +* added new files + +2002-7-2 DennisHayes <dennish@raytek.com> +* checked in for Jaak Simm (jaaksimm@firm.ee) +* DataFormats.cs +* DataGrid.cs +* DataGridBoolColumn.cs +* DataGridColumnStyle.cs +* DataGridPreferredColumnWidthTypeConverter.cs +* DataGridTableStyle.cs +* DataGridTextBox.cs +* new classes added + +2002-7-2 DennisHayes <dennish@raytek.com> +* Checked in for Richard Baumann (biochem333@nyc.rr.com) +* StatusBar.cs +* StatusBarDrawItemEventArgs.cs +* StatusBarPanel.cs +* StatusBarPanelClickEventArgs.cs +* SystemInformation.cs +* Minor changes by Rich B + +2002-7-1 DennisHayes <dennish@raytek.com> + +* AccessibleObject.cs +* AmbientProperties.cs +* Application.cs +* ApplicationContext.cs +* ArrangeDirection.cs +* AxHost.cs BaseCollection.cs +* Binding.cs BindingContext.cs +* BindingManagerBase.cs +* BindingMemberInfo.cs +* BindingsCollection.cs +* Button.cs +* ButtonBase.cs +* CheckBox.cs +* CheckedListBox.cs +* Clipboard.cs +* ColorDialog.cs +* ColumnClickEventArgs.cs +* ColumnClickEventHandler.cs +* ColumnHeader.cs +* ComboBox.cs +* CommonDialog.cs +* ComVisible.cs +* ContainerControl.cs +* ContentsResizedEventArgs.cs +* ContextMenu.cs +* Control.cs +* ControlBindingsCollection.cs +* ControlEventArgs.cs +* ControlPaint.cs +* ConvertEventArgs.cs +* CreateParams.cs +* CurrencyManager.cs +* Cursor.cs +* CursorConverter.cs +* Cursors.cs +* ErrorProvider.cs +* FeatureSupport.cs +* FileDialog.cs +* Form.cs +* GiveFeedbackEventArgs.cs +* GridColumnStylesCollection.cs +* GridItem.cs +* GridItemCollection.cs +* GridTableStylesCollection.cs +* GroupBox.cs +* Help.cs +* HelpEventArgs.cs +* HelpProvider.cs +* HScrollBar.cs +* ImageIndexConverter.cs +* ImageList.cs +* ImageListStreamer.cs +* InputLanguage.cs +* InputLanguageChangedEventArgs.cs +* InputLanguageChangingEventArgs.cs +* InputLanguageCollection.cs +* InvalidateEventArgs.cs +* ItemChangedEventArgs.cs +* ItemCheckEventArgs.cs +* ItemDragEventArgs.cs +* IWin32Window.cs +* KeyEventArgs.cs +* KeyPressEventArgs.cs +* KeysConverter.cs +* Label.cs +* LabelEditEventArgs.cs +* LabelEditEventHandler.cs +* LayoutEventArgs.cs +* LinkClickedEventArgs.cs +* LinkLabel.cs +* LinkLabelLinkClickedEventArgs.cs +* ListBindingConverter.cs +* ListBox.cs +* ListControl.cs +* ListView.cs +* ListViewItem.cs +* ListViewItemConverter.cs +* MainMenu.cs +* MeasureItemEventArgs.cs +* Menu.cs MenuItem.cs +* Message.cs +* MessageBox.cs +* MonthCalendar.cs +* MouseEventArgs.cs +* NativeWindow.cs +* NavigateEventArgs.cs +* NodeLabelEditEventArgs.cs +* NotifyIcon.cs +* NumericUpDown.cs +* OpacityConverter.cs +* OpenFileDialog.cs +* OSFeature.cs +* PageSetupDialog.cs +* PaintEventArgs.cs +* Panel.cs +* PrintControllerWithStatusDialog.cs +* PrintDialog.cs +* QueryAccessibilityHelpEventArgs.cs +* QueryContinueDragEventArgs.cs +* RadioButton.cs +* RichTextBox.cs +* SaveFileDialog.cs +* Screen.cs +* ScrollableControl.cs +* ScrollBar.cs +* ScrollEventArgs.cs +* SelectedGridItemChangedEventArgs.cs +* SelectionRange.cs +* SelectionRangeConverter.cs +* SendKeys.cs +* Splitter.cs +* SplitterEventArgs.cs +* StatusBar.cs +* StatusBarDrawItemEventArgs.cs +* StatusBarPanel.cs +* StatusBarPanelClickEventArgs.cs +* StatusBarPanelCollection.cs +* SystemInformation.cs +* TabControl.cs +* TabPage.cs +* TextBox.cs +* TextBoxBase.cs +* ThreadExceptionDialog.cs +* Timer.cs +* ToolBar.cs +* ToolBarButton.cs +* TrackBar.cs +* TreeNode.cs +* TreeNodeCollection.cs +* TreeNodeConverter.cs +* TreeView.cs +* TreeViewCancelEventArgs.cs +* TreeViewEventArgs.cs +* TreeViewImageIndexConverter.cs +* UICuesEventArgs.cs +* UserControl.cs +* VScrollBar.cs +* Implmented some stuff, fixed some stuff, monostyled some stuff, uncommented-out some stuff. + + +2002-7-1 DennisHayes <dennish@raytek.com> +* changelog +* reversed order, putting most recent entries at the top + +2002-6-24 DennisHayes <dennish@raytek.com> +* AccessibleStates.cs +* ArrangeDirection.cs +* AccessibleEvents.cs +* Added values for enums + +2002-6-24 DennisHayes <dennish@raytek.com> +* BindingMemberInfo.cs +* CaptionButton.cs +* DataGridCell.cs +* Message.cs +* MessageBox.cs +* Fixed bugs preventing compile + +2002-6-18 DennisHayes <dennish@raytek.com> +* checked in for Stefan Warnke (StefanW@POBox.com) +* UICuesEventArgs.cs +* UpDownBase.cs +* Better comments and formatting + +2002-6-18 DennisHayes <dennish@raytek.com> +* Checked in for Jackson Harper (jackson@latitudegeo.com) +* ToolBar.cs +* TabControl.cs +* TabPage.cs +* Added sub classes + +2002-6-5 DennisHayes <dennish@raytek.com> +* TabControl.cs +* TabPage.cs +* TextBox.cs +* TextBoxBase.cs +* ThreadExceptionDialog.cs +* Timer.cs +* added new files for Jackson Harper (jackson@latitudegeo.com) +* needs to be mono styled, and may have other issues + +2002-6-5 DennisHayes <dennish@raytek.com> +* ErrorProvider.cs +* PrintControllerWithStatusDialog.cs +* PrintDialog.cs +* added new files for paul + +2002-6-5 DennisHayes <dennish@raytek.com> +* StatusBarDrawItemEventArgs.cs +* StatusBarPanel.cs +* StatusBarPanelClickEventArgs.cs +* StatusBarPanelCollection.cs +* SystemInformation.cs +* added new files for Richard Baumann (biochem333@nyc.rr.com) + +2002-6-5 DennisHayes <dennish@raytek.com> +* removed, code moved to main class files, Form.cs, ImageList.cs, LinkLabel.cs, +* ListBox.cs, ListView.cs, ListViewItem.cs, Menu.cs, MonthCalendar.cs, ScrollableControl.cs +* Form.ControlCollectison.cs +* ImageList.ImageCollection.c +* LinkLabel.LinkCollection.cs +* ListBox.ObjectCollection.cs +* ListBox.SelectedIndexCollection.cs +* ListBox.SelectedObjectCollection.cs +* ListView.CheckedListViewItemCollection.cs +* ListView.CheckedIndexCollection.cs +* ListView.ColumnHeaderCollection.cs +* ListView.ListViewItemCollection.cs +* ListView.SelectedIndexCollection.cs +* ListView.SelectedListViewItemCollection.cs +* ListViewItem.ListViewSubItem.cs +* ListViewItem.ListViewSubItemCollection.cs +* Menu.MenuItemCollection.cs +* MonthCalendar.HitTestInfo.cs +* ScrollableControl.DockPaddingEdges.cs + +2002-6-5 DennisHayes <dennish@raytek.com> +* Checked in for Jackson Harper (jackson@latitudegeo.com) +* ToolBar.cs +* ToolBarButton.cs +* ToolTip.cs +* TrackBar.cs +* TreeNode.cs +* TreeNodeCollection.cs +* TreeNodeConverter.cs +* TreeView.cs +* TreeViewCancelEventArgs.cs +* TreeViewEventArgs.cs +* TreeViewImageIndexConverter.cs +* Just stubbs +* New files added, work in progress cleanup and mono style needed. + +2002-6-5 DennisHayes <dennish@raytek.com> +* checked in for Stefan Warnke (StefanW@POBox.com) +* UICuesEventArgs.cs +* UpDownBase.cs +* Just stubbs +* New files, work in progress, needs cleanup and mono style + + + +2002-5-31 DennisHayes <dennish@raytek.com> +* ItemChangedEventHandler.cs +* InvalidateEventHandler.cs +* ItemChangedEventHandler.cs +* added new files + +2002-5-31 DennisHayes <dennish@raytek.com> + Check in for Paul Osman <paul.osman@sympatico.ca> +* Panel.cs +* New class, Stubbed and commented out + +2002-5-31 DennisHayes <dennish@raytek.com> + Check in for Paul Osman <paul.osman@sympatico.ca> +* MonthCalendar.cs +* MonthCalendar.HitTestInfo.cs +* MouseEventArgs.cs +* NativeWindow.cs +* Removed trash byte + +2002-5-31 DennisHayes <dennish@raytek.com> +* ColumnClickEventArgs.cs +* Fully implmented. + +2002-5-31 DennisHayes <dennish@raytek.com> +* Minor formating in lots of files + + +2002-5-27 DennisHayes <dennish@raytek.com> +Added structs. All structs in System.Windows.Forms done +* BindingMemberInfo.cs +* DataGridCell.cs +* LinkArea.cs +* Message.cs +* Complete execpt for Message.cs GetLParam +* and +* BindingMemberInfo needs constructor. +* All need verification of hashcodes. + +2002-5-27 DennisHayes <dennish@raytek.com> +Added delegates. All delegates in System.Windows.Forms done +* ColumnClickEventHandler.cs +* ContentsResizedEventHandler.cs +* ControlEventHandler.cs +* ConvertEventHandler.cs +* DateRangeEventHandler.cs +* DragEventHandler.cs +* DrawItemEventHandler.cs +* GiveFeedbackEventHandler.cs +* HelpEventHandler.cs +* InputLanguageChangedEventHandler.cs +* InputLanguageChangingEventHandler.cs +* InvalidateEventHandler.cs +* ItemChangedEventHandler.cs +* ItemCheckEventHandler.cs +* ItemDragEventHandler.cs +* KeyEventHandler.cs +* LabelEditEventHandler.cs +* LayoutEventHandler.cs +* LinkClickedEventHandler.cs +* LinkLabelLinkClickedEventHandler.cs + +2002-5-27 DennisHayes <dennish@raytek.com> + Check in for Paul Osman <paul.osman@sympatico.ca> +* NumericUpDown.cs +* OpacityConverter.cs +* OpenFileDialog.cs +* OSFeature.cs +* PageSetupDialog.cs +* PaintEventArgs.cs +* MonthCalendar.HitTestInfo.cs +* MouseEventArgs.cs +* NativeWindow.cs +* Stubbed and commented out +* NativeWindow.cs, MonthCalendar.HitTestInfo.cs, MouseEventArgs.cs, +* have bad extra byte from old skeleton, need new corrected version. + +* MonthCalendar.HitTestInfo.cs needs to be incorporated into MonthCalendar. + +2002-5-27 DennisHayes <dennish@raytek.com> + Check in for Paul Osman <paul.osman@sympatico.ca> +* Menu.cs +* Menu.MenuItemCollection.cs +* MenuItem.cs +* MessageBox.cs +* MonthCalendar.cs +* Stubbed and commented out +* MonthCalendar.cs has bad extra byte from old skeleton, need new corrected version. +* MonthCalendar.HitTestInfo.cs needs to be incorporated into MonthCalendar. +* Menu.MenuItemCollection.cs needs to be incorporated into Menu.cs. + +2002-5-27 DennisHayes <dennish@raytek.com> + Check in for Paul Osman <paul.osman@sympatico.ca> +* Panel.cs +* New class, Stubbed and commented out + +2002-5-10 Dennis Hayes +* added IMessageFilter +* Interfaces complete + + 2002-5-8 Dennis Hayes <dennish@raytek.com> +* RichTextBoxFinds.cs +* RichTextBoxScrollBars.cs +* RichTextBoxSelectionAttribute.cs +* RichTextBoxSelectionTypes.cs +* RichTextBoxStreamType.cs +* RichTextBoxWordPunctuations.cs +* RightToLeft.cs +* ScrollBars.cs +* ScrollButton.cs +* ScrollEventType.cs +* SecurityIDType.cs +* SelectionMode.cs +* Shortcut.cs +* SizeGripStyle.cs +* SortOrder.cs +* StatusBarPanelAutoSize.cs +* StatusBarPanelBorderStyle.cs +* StatusBarPanelStyle.cs +* StructFormat.cs +* TabAlignment.cs +* TabAppearance.cs +* TabDrawMode.cs +* TabSizeMode.cs +* TickStyle.cs +* ToolBarAppearance.cs +* ToolBarButtonStyle.cs +* ToolBarTextAlign.cs +* TreeViewAction.cs +* UICues.cs +* View.cs +* Added enums. +* All System.Windows.Forms enums complete with correct values. + 2002-5-8 Dennis Hayes <dennish@raytek.com> +Dennis Hayes <dennish@raytek.com> +Checking in new System.Windows.forms classes (a* to c*) for +Jaak Simm <jaaksimm@firm.ee> +* AmbientProperties.cs +* Application.cs +* ApplicationContext.cs +* AxHost.cs +* BaseCollection.cs +* Binding.cs +* BindingContext.cs +* BindingManagerBase.cs +* BindingsCollection.cs +* Button.cs +* ButtonBase.cs +* CheckBox.cs +* CheckedListBox.cs +* Clipboard.cs +* ColorDialog.cs +* ColumnClickEventArgs.cs +* ColumnHeader.cs +* ComboBox.cs +* CommonDialog.cs +* ContainerControl.cs +* ContentsResizedEventArgs.cs +* ContextMenu.cs +* Control.cs +* ControlBindingsCollection.cs +* ControlEventArgs.cs +* ControlPaint.cs +* ConvertEventArgs.cs +* CreateParams.cs +* CurrencyManager.cs +* Cursor.cs +* CursorConverter.cs +* Cursors.cs +* Classes stubbed and commented out. + + 2002-5-8 Dennis Hayes <dennish@raytek.com> +Dennis Hayes <dennish@raytek.com> +Checking in new System.Windows.forms classe for John Rebbeck <john@rebent.com> + +* UserControl.cs +Stubbed and commented out + + 2002-5-8 Dennis Hayes <dennish@raytek.com> +Dennis Hayes <dennish@raytek.com> +Checking in new System.Windows.forms classe for Paul Osman <paul.osmand@sympatico.ca> + +* NavigateEventArgs.cs +* NodeLabelEditEventArgs.cs +* NotifyIcon.cs +Stubbed and commented out + +2002-05-07 Daniel Carrera (dcarrera@math.utoronto.ca) +* Fixed a problem with an "extra byte" problem. It caused an extra '?' + at the beginning of some lines. + Classes F-L and Q-R were updated. +* Added the classes SaveFileDialog.cs and Screen.cs + +2002-5-7 Dennis Hayes <dennish@raytek.com> +* Added duplicate values +* System.Windows.Forms.Keys.cs + +2002-5-7 Dennis Hayes <dennish@raytek.com> +* LeftRightAlignment.cs +* LinkBehavior.cs +* LinkState.cs +* ListViewAlignment.cs +* MdiLayout.cs +* MenuGlyph.cs +* MenuMerge.cs +* MessageBoxButtons.cs +* MessageBoxDefaultButton.cs +* MessageBoxIcon.cs +* MessageBoxOptions.cs +* MouseButtons.cs +* Orientation.cs +* PictureBoxSizeMode.cs +* PropertySort.cs +* Added some more enums. All have correct values. + +* 5-5-2002 Dennis Hayes <dennish@raytek.com> +* Added enums +* GridItemType.cs +* HelpNavigator.cs +* HorizontalAlignment.cs +* ImeMode.cs +* ItemActivation.cs +* ItemBoundsPortion.cs +* Keys.cs +* All correct execpt for Keys.cs which is missing a half dozen +* duplicate entries that need correcting. + +2002-05-02 Daniel Carrera (dcarrera@math.utoronto.ca) +* small update to classes [F-H]* +* added stubbed and commented out classes for [I-L]* +* added stubbed and commented out classes for R* +2002-4-23 Dennis Hayes <dennish@raytek.com> + + * AccessibleNavigation.cs :added to cvs with bad enum values, I will correct. + * AccessibleSelection.cs :added with good enum values. + * ContentsResizedEventHandler.cs :Added delagate + * MainMenu.cs + * AccessibleObject.cs + * MeasureItemEventArgs :added stubbed classes. Commented out. + * IButtonControl.cs : Added interface. +2002-4-23 Dennis Hayes <dennish@raytek.com> +* added stubbed and commented out classes from F to G * + + +2002-04-10 Duncan Mak <duncan@ximian.com> + + * CaptionButton.cs: + * CharacterCasing.cs: + * CheckState.cs: + * DataGridParentRowsLabelStyle.cs: + * DialogResult.cs: + * DockStyle.cs: + * DragAction.cs: + * DragDropEffects.cs: + * DrawItemState.cs: + * DrawMode.cs: + * ErrorBlinkStyle.cs: + * ErrorIconAlignment.cs: + * FlatStyle.cs: + * FormBorderStyle.cs: + * FormStartPosition.cs: + * FormWindowState.cs: + * FrameStyle.cs: Fixed enum layouts with EnumCheck. + + diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/CheckBox.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/CheckBox.cs index b7fe032f939..1e530d4e329 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/CheckBox.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/CheckBox.cs @@ -134,14 +134,18 @@ namespace System.Windows.Forms { public bool ThreeState { get { return threeState; } set { threeState = value; } - } + } + + + // --- CheckBox methods --- - protected override AccessibleObject CreateAccessibilityInstance() - { - throw new NotImplementedException (); - } + // I do not think this is part of the spec + //protected override AccessibleObject CreateAccessibilityInstance() + //{ + // throw new NotImplementedException (); + //} // [event methods] @@ -184,13 +188,13 @@ namespace System.Windows.Forms { Win32.SendMessage(Handle, (int)ButtonMessages.BM_SETCHECK, (int)checkState, 0); } -// protected override void OnMouseDown (MouseEventArgs e) -// { -// base.OnMouseDown (e); -// } + protected override void OnMouseDown (MouseEventArgs e) + { + base.OnMouseDown (e); + } [MonoTODO] - protected override void OnMouseUp(MouseEventArgs mevent) + protected override void OnMouseUp(MouseEventArgs e) { if (ThreeState) { switch (CheckState) { @@ -209,7 +213,7 @@ namespace System.Windows.Forms { Checked = Checked ? false : true; } Invalidate (); - base.OnMouseUp(mevent); + base.OnMouseUp(e); } // end of [event methods] @@ -233,7 +237,12 @@ namespace System.Windows.Forms { } } - internal override void ButtonPaint (PaintEventArgs e) + protected virtual void OnPaintBackground (PaintEventArgs e) + { + // just do nothing to avoid flickering + } + + protected override void OnPaint (PaintEventArgs e) { Rectangle paintBounds = ClientRectangle; Bitmap bmp = new Bitmap( paintBounds.Width, paintBounds.Height,e.Graphics); @@ -271,15 +280,24 @@ namespace System.Windows.Forms { bmp.Dispose(); } + protected override void WndProc (ref Message m) { + switch (m.Msg) { + case Msg.WM_DRAWITEM: { + m.Result = (IntPtr)1; + } + break; + default: + base.WndProc (ref m); + break; + } + } + /// --- CheckBox events --- public event EventHandler AppearanceChanged; public event EventHandler CheckedChanged; public event EventHandler CheckStateChanged; - /// --- public class CheckBox.CheckBoxAccessibleObject : AccessibleObject --- - /// the class is only used for .NET framework - /// - public class CheckBoxAccessibleObject : AccessibleObject { - } + /// --- public class CheckBox.CheckBoxAccessibleObject : ButtonBase.ButtonBaseAccessibleObject --- + /// the class is not stubbed, cause it's only used for .NET framework } } diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/CheckedListBox.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/CheckedListBox.cs index 6fd122c3565..ff70135ad1d 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/CheckedListBox.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/CheckedListBox.cs @@ -104,7 +104,7 @@ namespace System.Windows.Forms { } [MonoTODO] - public new CheckedListBox.ObjectCollection Items { + public CheckedListBox.ObjectCollection Items { get { return (CheckedListBox.ObjectCollection)base.Items; } @@ -129,9 +129,6 @@ namespace System.Windows.Forms { } public override SelectionMode SelectionMode { - get { - return base.SelectionMode; - } set { if (value!=SelectionMode.One && value!=SelectionMode.None) throw new ArgumentException(); @@ -150,19 +147,15 @@ namespace System.Windows.Forms { } // --- CheckedListBox methods --- - // following methods only support .NET framework: - protected virtual void OnItemCheck(ItemCheckEventArgs ice){ - throw new NotImplementedException (); - } - - protected override void WmReflectCommand(ref Message m){ - throw new NotImplementedException (); - } + // following methods were not stubbed out, because they only support .NET framework: + // - protected virtual void OnItemCheck(ItemCheckEventArgs ice) + // - protected override void WmReflectCommand(ref Message m) - protected override AccessibleObject CreateAccessibilityInstance() - { - throw new NotImplementedException (); - } + // I do not think this is part of the spec. + //protected override AccessibleObject CreateAccessibilityInstance() + //{ + // throw new NotImplementedException (); + //} [MonoTODO] protected override ListBox.ObjectCollection CreateItemCollection() { @@ -611,7 +604,7 @@ namespace System.Windows.Forms { /// </summary> [MonoTODO] - public new class ObjectCollection : ListBox.ObjectCollection { + public class ObjectCollection : ListBox.ObjectCollection { /// --- ObjectCollection.constructor --- [MonoTODO] diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ColorDialog.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ColorDialog.cs index c22e7fe1039..3159d0bb31b 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/ColorDialog.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ColorDialog.cs @@ -32,11 +32,6 @@ namespace System.Windows.Forms { { Reset ( ); } - - // these are show to be in the ms implmentation by winchurn - // but are not valid since they are not abstract or have any accessors. - //protected virtual IntPtr Instance { } - //protected virtual int Options { } public virtual bool AllowFullOpen { get { diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ComboBox.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ComboBox.cs index 06408e2fffd..555f6cebd90 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/ComboBox.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ComboBox.cs @@ -31,6 +31,7 @@ namespace System.Windows.Forms { bool sorted; Image backgroundImage; ControlStyles controlStyles; + string text; int selectedLength; string selectedText; int selectedIndex; @@ -52,11 +53,12 @@ namespace System.Windows.Forms { updateing = false; //controlStyles = null; drawMode = DrawMode.Normal; - dropDownStyle = ComboBoxStyle.DropDown; + dropDownStyle = ComboBoxStyle.DropDownList; droppedDown = false; integralHeight = true; sorted = false; backgroundImage = null; + text = ""; Items_ = new ComboBox.ObjectCollection(this); itemHeight_ = 13; maxDropDownItems = 8; @@ -422,13 +424,10 @@ namespace System.Windows.Forms { [MonoTODO] public override string Text { get { - return base.Text; + return text; } set { - base.Text = value; - if (value == null || value == String.Empty) { - SelectedIndex = -1; - } + text = value; } } @@ -446,8 +445,7 @@ namespace System.Windows.Forms { } } - protected override void Dispose(bool disposing) { - base.Dispose(disposing); + protected override void OnCreateControl () { } [MonoTODO] @@ -456,10 +454,7 @@ namespace System.Windows.Forms { base.OnSelectedValueChanged(e); } - [MonoTODO] - protected override void SetItemCore(int index,object value){ - } - + /// - protected override void SetItemCore(int index,object value); [MonoTODO] protected virtual void AddItemsCore(object[] value) { //FIXME: @@ -578,12 +573,7 @@ namespace System.Windows.Forms { //FIXME: base.OnHandleCreated(e); populateControl(Items_); - if (DropDownStyle != ComboBoxStyle.DropDown || Text == String.Empty) { - if (selectedIndex == -1 && Items.Count != 0) { - selectedIndex = 0; - } - Win32.SendMessage(Handle, (int)ComboBoxMessages.CB_SETCURSEL, selectedIndex, 0); - } + Win32.SendMessage(Handle, (int)ComboBoxMessages.CB_SETCURSEL, selectedIndex, 0); } [MonoTODO] @@ -629,11 +619,6 @@ namespace System.Windows.Forms { SelectedIndexChanged( this, e); } } - - [MonoTODO] - protected virtual void OnSelectedItemChanged(EventArgs e) { - - } [MonoTODO] protected virtual void OnSelectionChangeCommitted(EventArgs e) @@ -678,28 +663,7 @@ namespace System.Windows.Forms { height = DefaultSize.Height; } } - if ( (specified & BoundsSpecified.X) == 0) x = Left; - if ( (specified & BoundsSpecified.Y) == 0) y = Top; - if ( (specified & BoundsSpecified.Width) == 0) width = Width; - //if ( (specified & BoundsSpecified.Height) == 0) height = Height; - - if (IsHandleCreated){ - SetWindowPosFlags flags = SetWindowPosFlags.SWP_NOZORDER | SetWindowPosFlags.SWP_FRAMECHANGED | SetWindowPosFlags.SWP_DRAWFRAME; - Win32.SetWindowPos (Handle, SetWindowPosZOrder.HWND_NOTOPMOST, x, y, width, height, flags); - - RECT rect = new RECT(); - Win32.GetWindowRect (Handle, ref rect);
- if( Parent != null) {
- Win32.ScreenToClient(Parent.Handle, ref rect);
- }
- x = rect.left;
- y = rect.top;
- width = rect.right - rect.left;
- height = rect.bottom - rect.top;
- } - - UpdateBounds (x, y, width, height); - + base.SetBoundsCore(x,y,width,height,specified); // FIXME: this is needed, otherwise painting is not correct if( dropDownStyle == ComboBoxStyle.Simple ) { Win32.InvalidateRect(Handle, IntPtr.Zero, 0); @@ -763,27 +727,26 @@ namespace System.Windows.Forms { else { switch(m.HiWordWParam) { case (uint)ComboBoxNotification.CBN_SELCHANGE: + //OnSelectedIndexChanged(new EventArgs()); SelectedIndex = Win32.SendMessage(Handle, (int)ComboBoxMessages.CB_GETCURSEL, 0, 0); m.Result = IntPtr.Zero; + //CallControlWndProc(ref m); break; default: + Console.WriteLine("ComboBox enter default"); + //CallControlWndProc(ref m); m.Result = IntPtr.Zero; + Console.WriteLine("ComboBox exit default"); break; } } break; - case Msg.WM_CTLCOLOREDIT : - CallControlWndProc ( ref m ); - break; default: base.WndProc(ref m); break; } } - [MonoTODO] - protected override void SetItemsCore (IList value){ - } /// --- Button events --- /// commented out, cause it only supports the .NET Framework infrastructure @@ -810,12 +773,9 @@ namespace System.Windows.Forms { [MonoTODO] public event EventHandler SelectionChangeCommitted; - [MonoTODO] - public class ChildAccessibleObject : AccessibleObject { + /// --- public class ComboBox.ChildAccessibleObject : AccessibleObject --- /// the class is not stubbed, cause it's only used for .NET framework - } - /// sub-class: ComboBox.ObjectCollection /// <summary> diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ContainerControl.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ContainerControl.cs index a90375ff43d..a5d550815bb 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/ContainerControl.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ContainerControl.cs @@ -21,7 +21,7 @@ namespace System.Windows.Forms { public class ContainerControl : ScrollableControl, IContainerControl { - public ContainerControl () : base () + protected ContainerControl () : base () { controlStyles_ |= ControlStyles.ContainerControl; } @@ -37,16 +37,12 @@ namespace System.Windows.Forms { } //Compact Framework - [MonoTODO] + //[MonoTODO] // not ready for BindingContext - public override BindingContext BindingContext { - get { - throw new NotImplementedException (); - } - set { - //fixme: - } - } + //public override BindingContext BindingContext { + // get { throw new NotImplementedException (); } + // set { throw new NotImplementedException (); } + //} protected override CreateParams CreateParams { get { return base.CreateParams; } @@ -128,15 +124,11 @@ namespace System.Windows.Forms { } // Not an overridden function? - protected override void Select(bool directed,bool forward) - { - base.Select(directed, forward); - } - - protected virtual void UpdateDefaultButton() { - - } - + //protected override void Select(bool directed,bool forward) + //{ + // throw new NotImplementedException (); + //} + [MonoTODO] public bool Validate () { diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Control.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Control.cs index 14e9feb1c95..8ef2903a4bc 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/Control.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Control.cs @@ -28,7 +28,7 @@ namespace System.Windows.Forms { // Helper NativeWindow class to dispatch messages back // to the Control class // - internal class ControlNativeWindow : NativeWindow { + protected class ControlNativeWindow : NativeWindow { private Control control; @@ -56,7 +56,7 @@ namespace System.Windows.Forms { } // FIXME: not sure if dervied classes should have access - internal ControlNativeWindow window; + protected ControlNativeWindow window; private ControlCollection childControls; private Control parent; static private Hashtable controlsCollection = new Hashtable (); @@ -302,12 +302,12 @@ namespace System.Windows.Forms { set { } } - [MonoTODO] - public AccessibleObject AccessibilityObject { - get { - throw new NotImplementedException (); - } - } + [MonoTODO] + public AccessibleObject AccessibilityObject { + get { + throw new NotImplementedException (); + } + } public string AccessibleDefaultActionDescription { get { @@ -544,7 +544,7 @@ namespace System.Windows.Forms { } protected virtual CreateParams CreateParams { - get { + get { CreateParams createParams = new CreateParams (); createParams.Caption = Text; createParams.X = Left; @@ -575,7 +575,7 @@ namespace System.Windows.Forms { // This function lets Windows or/and default Windows control process message // Classes have to call it if they do not handle message in WndProc or // default handling is needed. - protected internal void CallControlWndProc (ref Message msg) { + protected void CallControlWndProc (ref Message msg) { if (ControlRealWndProc != IntPtr.Zero) { bool callControlProc = true; if ((callWinControlProcMask & CallWinControlProcMask.MOUSE_MESSAGES) == 0 && msg.IsMouseMessage) { @@ -607,7 +607,7 @@ namespace System.Windows.Forms { } } - protected internal virtual void OnWmCommand (ref Message m) { + protected virtual void OnWmCommand (ref Message m) { if (m.LParam.ToInt32 () != 0) { if (m.LParam != Handle) { // Control notification @@ -712,14 +712,12 @@ namespace System.Windows.Forms { //return Win32.IsWindowEnabled (Handle); } set { - if (enabled != value) { - if (IsHandleCreated) { - Win32.EnableWindow (Handle, value); - // FIXME: Disable/enable all children here - Invalidate (); - } - enabled = value; - } + if (enabled != value) { + Win32.EnableWindow (Handle, value); + enabled = value; + // FIXME: Disable/enable all children here + Invalidate (); + } } } @@ -934,7 +932,7 @@ namespace System.Windows.Forms { } } - protected internal static IntPtr ParkingWindowHandle { + protected static IntPtr ParkingWindowHandle { get { if (parkingWindow == null) parkingWindow = new NativeWindow (); @@ -950,7 +948,7 @@ namespace System.Windows.Forms { } } - protected internal static void RegisterDefaultWindowClass () + protected static void RegisterDefaultWindowClass () { if (!classRegistered){ WNDCLASS wndClass = new WNDCLASS (); @@ -1095,7 +1093,9 @@ namespace System.Windows.Forms { //Compact Framework public virtual string Text { get { - if (GetStyle(ControlStyles.CacheText) && IsHandleCreated){ + // CHECKME: if we really need to provide back current text of real window + // or just our copy in text member. + if (IsHandleCreated){ int len = Win32.GetWindowTextLengthA (Handle); // FIXME: len is doubled due to some strange behaviour. (of GetWindowText function ?) // instead of 10 characters we can get only 9, even if sb.Capacity is 10. @@ -2254,8 +2254,8 @@ namespace System.Windows.Forms { Win32.ClientToScreen (Handle,ref rect); return new Rectangle (rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top); } - - [MonoTODO] + + [MonoTODO] protected static bool ReflectMessage (IntPtr hWnd, ref Message m) { bool result = false; Control cntrl = Control.FromHandle (hWnd); @@ -2265,23 +2265,23 @@ namespace System.Windows.Forms { } return result; } - - public virtual void Refresh () - { - Win32.UpdateWindow (Handle); - } - - [MonoTODO] - public virtual void ResetBackColor () - { - //FIXME: - } - - [MonoTODO] - public void ResetBindings () - { - //FIXME: - } + + public virtual void Refresh () + { + Win32.UpdateWindow (Handle); + } + + [MonoTODO] + public virtual void ResetBackColor () + { + //FIXME: + } + + [MonoTODO] + public void ResetBindings () + { + //FIXME: + } [MonoTODO] public virtual void ResetFont () @@ -2458,7 +2458,7 @@ namespace System.Windows.Forms { UpdateBounds (x, y, width, height); } - protected internal virtual bool MenuPresent { + protected virtual bool MenuPresent { get { return false; } } @@ -2747,7 +2747,7 @@ namespace System.Windows.Forms { switch (m.Msg) { case Msg.WM_CREATE: - Console.WriteLine("WM_CREATE"); + Console.WriteLine ("WM_CREATE"); OnHandleCreated (eventArgs); break; case Msg.WM_LBUTTONDBLCLK: @@ -2842,7 +2842,7 @@ namespace System.Windows.Forms { //case Msg.WM_CTLCOLORSTATIC: // if ( !Control.ReflectMessage ( m.LParam, ref m ) ) // CallControlWndProc ( ref m ); - //break; + break; case Msg.WM_NOTIFY: NMHDR nmhdr = (NMHDR)Marshal.PtrToStructure (m.LParam, typeof (NMHDR)); @@ -2870,40 +2870,22 @@ namespace System.Windows.Forms { if (!GetStyle (ControlStyles.UserPaint)) { CallControlWndProc (ref m); } - - Rectangle rc = new Rectangle (); - bool beginPaint = false; - IntPtr hdc = IntPtr.Zero; - RECT updateRect = new RECT(); - PAINTSTRUCT ps = new PAINTSTRUCT (); - - if (Win32.GetUpdateRect (Handle, ref updateRect, false)) { - hdc = Win32.BeginPaint (Handle, ref ps); + else { + PAINTSTRUCT ps = new PAINTSTRUCT (); + IntPtr hdc = Win32.BeginPaint (Handle, ref ps); + Rectangle rc = new Rectangle (); rc.X = ps.rcPaint.left; rc.Y = ps.rcPaint.top; rc.Width = ps.rcPaint.right - ps.rcPaint.left; rc.Height = ps.rcPaint.bottom - ps.rcPaint.top; - beginPaint = true; - } else { - hdc = Win32.GetDC (Handle); - rc.X = updateRect.left; - rc.Y = updateRect.top; - rc.Width = updateRect.right - updateRect.left; - rc.Height = updateRect.bottom - updateRect.top; - } - - PaintEventArgs paintEventArgs = new PaintEventArgs (Graphics.FromHdc (hdc), rc); - if (GetStyle (ControlStyles.AllPaintingInWmPaint)) { - OnPaintBackground (paintEventArgs); - } - OnPaint (paintEventArgs); - paintEventArgs.Dispose (); - - if(beginPaint) + PaintEventArgs paintEventArgs = new PaintEventArgs (Graphics.FromHdc (hdc), rc); + if (GetStyle (ControlStyles.AllPaintingInWmPaint)) { + OnPaintBackground (paintEventArgs); + } + OnPaint (paintEventArgs); + paintEventArgs.Dispose (); Win32.EndPaint (Handle, ref ps); - else - Win32.ReleaseDC (Handle, hdc); - + } break; case Msg.WM_SIZE: if (GetStyle (ControlStyles.ResizeRedraw)) { @@ -3285,6 +3267,7 @@ namespace System.Windows.Forms { /// Provides information about a control that can be used by an accessibility application. /// </summary> public class ControlAccessibleObject : AccessibleObject { + // AccessibleObject not ready to be base class /// --- ControlAccessibleObject.constructor --- [MonoTODO] public ControlAccessibleObject (Control ownerControl) diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ControlPaint.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ControlPaint.cs index a8760c601ad..0ce7671a1dd 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/ControlPaint.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ControlPaint.cs @@ -19,7 +19,7 @@ namespace System.Windows.Forms { /// </summary> [MonoTODO] - public sealed class ControlPaint { + public sealed class ControlPaint { #region Properties [MonoTODO] @@ -132,29 +132,18 @@ namespace System.Windows.Forms { #region Methods /// following methods were not stubbed out, because they only support .NET framework: - - [MonoTODO] - public static IntPtr CreateHBitmap16Bit(Bitmap bitmap,Color background){ - throw new NotImplementedException (); - } - - [MonoTODO] - public static IntPtr CreateHBitmapColorMask(Bitmap bitmap,IntPtr monochromeMask){ - throw new NotImplementedException (); - } - - [MonoTODO] - public static IntPtr CreateHBitmapTransparencyMask(Bitmap bitmap){ - throw new NotImplementedException (); - } - + /// - public static IntPtr CreateHBitmap16Bit(Bitmap bitmap,Color background) + /// - public static IntPtr CreateHBitmapColorMask(Bitmap bitmap,IntPtr monochromeMask); + /// - public static IntPtr CreateHBitmapTransparencyMask(Bitmap bitmap); [MonoTODO] - public static Color Dark(Color baseColor) { + public static Color Dark(Color baseColor) + { return Dark(baseColor, 10.0f); } [MonoTODO] - public static Color Dark(Color baseColor,float percOfDarkDark) { + public static Color Dark(Color baseColor,float percOfDarkDark) + { double H, I, S; ControlPaint.Color2HIS(baseColor, out H, out I, out S); double NewIntensity = Math.Max( 0.0, I - (percOfDarkDark / 100.0)); @@ -162,7 +151,8 @@ namespace System.Windows.Forms { } [MonoTODO] - public static Color DarkDark(Color baseColor) { + public static Color DarkDark(Color baseColor) + { return Dark(baseColor, 20.0f); } @@ -214,19 +204,19 @@ namespace System.Windows.Forms { } [MonoTODO] - public static void DrawBorder3D(Graphics graphics, Rectangle rectangle, Border3DStyle style) { - DrawBorder3D(graphics, rectangle, style, Border3DSide.All); + public static void DrawBorder3D(Graphics graphics, Rectangle rectangle, Border3DStyle Style) { + DrawBorder3D(graphics, rectangle, Style, Border3DSide.All); } [MonoTODO] - public static void DrawBorder3D( Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides) { + public static void DrawBorder3D( Graphics graphics, Rectangle rectangle, Border3DStyle Style, Border3DSide Sides) { RECT rc = new RECT(); rc.left = rectangle.Left; rc.top = rectangle.Top; rc.right = rectangle.Right; rc.bottom = rectangle.Bottom; IntPtr hdc = graphics.GetHdc(); - int res = Win32.DrawEdge( hdc, ref rc, style, sides); + int res = Win32.DrawEdge( hdc, ref rc, Style, Sides); graphics.ReleaseHdc(hdc); } @@ -254,7 +244,7 @@ namespace System.Windows.Forms { [MonoTODO] public static void DrawBorder3D( Graphics graphics, int x, int y, int width, int height, - Border3DStyle style,Border3DSide sides) { + Border3DStyle style,Border3DSide sides) { DrawBorder3D( graphics, new Rectangle(x, y, width, height), style, sides); } @@ -279,8 +269,7 @@ namespace System.Windows.Forms { [MonoTODO] public static void DrawCaptionButton( Graphics graphics, - Rectangle rectangle, - ButtonState state) { + Rectangle rectangle) { //FIXME: } @@ -296,8 +285,24 @@ namespace System.Windows.Forms { //FIXME: } + [MonoTODO] public static void DrawCheckBox( Graphics graphics, Rectangle rectangle, ButtonState state) { - DrawFrameControlHelper (graphics, rectangle, (uint)DrawFrameControl.DFC_BUTTON, (uint)state | (uint)DrawFrameControl.DFCS_BUTTONCHECK); + // FIXME: (sometimes) DrawFrameControl paints control not in "desired" position ( DC coordinates transformed or something like this) + // so, we paint to the bitmap ( fresh DC, (0,0)) and then DrawImage to requested position + Bitmap bmp = new Bitmap(rectangle.Width+1, rectangle.Height+1,graphics); + Graphics g = Graphics.FromImage(bmp); + // FIXME: fill new context with some color here? + IntPtr hdc = g.GetHdc(); + RECT rc = new RECT(); + rc.left = 0; + rc.top = 0; + rc.right = rectangle.Width; + rc.bottom = rectangle.Height; + int res = Win32.DrawFrameControl( hdc, ref rc, (uint)DrawFrameControl.DFC_BUTTON, (uint)state | (uint)DrawFrameControl.DFCS_BUTTONCHECK); + g.ReleaseHdc(hdc); + g.Dispose(); + graphics.DrawImage(bmp, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height); + bmp.Dispose(); } [MonoTODO] @@ -308,8 +313,7 @@ namespace System.Windows.Forms { [MonoTODO] public static void DrawComboButton( Graphics graphics, - Rectangle rectangle, - ButtonState state) { + Rectangle rectangle) { //FIXME: } @@ -325,7 +329,8 @@ namespace System.Windows.Forms { } [MonoTODO] - public static void DrawContainerGrabHandle(Graphics graphics,Rectangle bounds) { + public static void DrawContainerGrabHandle(Graphics graphics,Rectangle bounds) + { //FIXME: } @@ -420,66 +425,23 @@ namespace System.Windows.Forms { ButtonState state) { //FIXME: } - - internal static void CopyImageTransparent (IntPtr targetDC, IntPtr sourceDC, Rectangle rectangle, Color transparentColor) { - // Monochrome mask - IntPtr maskDC = Win32.CreateCompatibleDC (sourceDC); - IntPtr maskBmp = Win32.CreateBitmap (rectangle.Width, rectangle.Height, 1, 1, IntPtr.Zero); - IntPtr oldMaskBmp = Win32.SelectObject (maskDC, maskBmp); - - uint oldColor = Win32.SetBkColor (sourceDC, (uint)Win32.RGB (transparentColor)); - Win32.StretchBlt (maskDC, 0, 0, rectangle.Width, rectangle.Height, sourceDC, - 0, 0, rectangle.Width, rectangle.Height, PatBltTypes.SRCCOPY); - Win32.SetBkColor (sourceDC, oldColor); - - Win32.StretchBlt (targetDC, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, - sourceDC, 0, 0, rectangle.Width, rectangle.Height, PatBltTypes.SRCINVERT); - - uint oldBkClr = Win32.SetBkColor (targetDC, 0xFFFFFF); - int oldTextClr = Win32.SetTextColor (targetDC, 0); - Win32.StretchBlt (targetDC, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, - maskDC, 0, 0, rectangle.Width, rectangle.Height, PatBltTypes.SRCAND); - Win32.SetTextColor (targetDC, oldTextClr); - Win32.SetBkColor (targetDC, oldBkClr); - - Win32.StretchBlt (targetDC, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, - sourceDC, 0, 0, rectangle.Width, rectangle.Height, PatBltTypes.SRCINVERT); - - Win32.SelectObject (maskDC, oldMaskBmp); - Win32.DeleteDC (maskDC); - Win32.DeleteObject (maskBmp); - } - - internal static void DrawFrameControlHelper (Graphics graphics, Rectangle rectangle, uint type, uint state) { - - IntPtr targetDC = graphics.GetHdc (); - Bitmap bmp = new Bitmap (rectangle.Width, rectangle.Height, graphics); - Graphics g = Graphics.FromImage (bmp); - IntPtr memDC = g.GetHdc (); - + + [MonoTODO] + public static void DrawRadioButton (Graphics graphics, Rectangle rectangle, ButtonState state) { + Bitmap bmp = new Bitmap(rectangle.Width+1, rectangle.Height+1,graphics); + Graphics g = Graphics.FromImage(bmp); + // FIXME: fill new context with some color here? + IntPtr hdc = g.GetHdc(); RECT rc = new RECT(); rc.left = 0; rc.top = 0; rc.right = rectangle.Width; rc.bottom = rectangle.Height; - - Color transparentColor = Color.FromArgb (0, 0, 1); - uint oldBk = Win32.SetBkColor (memDC, (uint)Win32.RGB(transparentColor)); - Win32.ExtTextOut (memDC, 0, 0, ExtTextOutFlags.ETO_OPAQUE, ref rc, 0, 0, IntPtr.Zero); - Win32.SetBkColor (memDC, oldBk); - - int res = Win32.DrawFrameControl( memDC, ref rc, type, state); - - CopyImageTransparent (targetDC, memDC, rectangle, transparentColor); - - g.ReleaseHdc(memDC); + int res = Win32.DrawFrameControl( hdc, ref rc, (uint)DrawFrameControl.DFC_BUTTON, (uint)state | (uint)DrawFrameControl.DFCS_BUTTONRADIO); + g.ReleaseHdc(hdc); g.Dispose(); + graphics.DrawImage(bmp, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height); bmp.Dispose(); - graphics.ReleaseHdc (targetDC); - } - - public static void DrawRadioButton (Graphics graphics, Rectangle rectangle, ButtonState state) { - DrawFrameControlHelper (graphics, rectangle, (uint)DrawFrameControl.DFC_BUTTON, (uint)state | (uint)DrawFrameControl.DFCS_BUTTONRADIO); } [MonoTODO] @@ -496,8 +458,7 @@ namespace System.Windows.Forms { [MonoTODO] public static void DrawReversibleFrame( Rectangle rectangle, - Color backColor, - FrameStyle style) { + Color backColor) { //FIXME: } @@ -513,8 +474,7 @@ namespace System.Windows.Forms { public static void DrawScrollButton( Graphics graphics, Rectangle rectangle, - ScrollButton button, - ButtonState state) { + ScrollButton button) { //FIXME: } @@ -543,8 +503,7 @@ namespace System.Windows.Forms { [MonoTODO] public static void DrawSizeGrip( Graphics graphics, - Color backColor, - Rectangle bounds) { + Color backColor) { //FIXME: } @@ -601,19 +560,22 @@ namespace System.Windows.Forms { } [MonoTODO] - public static Color Light(Color baseColor) { + public static Color Light(Color baseColor) + { return Light( baseColor, 10.0f); } [MonoTODO] - public static Color Light(Color baseColor,float percOfLightLight) { + public static Color Light(Color baseColor,float percOfLightLight) + { double H, I, S; ControlPaint.Color2HIS(baseColor, out H, out I, out S); double NewIntensity = Math.Min( 1.0, I + (percOfLightLight / 100.0)); return ControlPaint.HIS2Color(H, NewIntensity, S); } [MonoTODO] - public static Color LightLight(Color baseColor) { + public static Color LightLight(Color baseColor) + { return Light( baseColor, 20.0f); } #endregion diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGrid.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGrid.cs index 309328ddce3..e6f26dca260 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGrid.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGrid.cs @@ -53,7 +53,8 @@ namespace System.Windows.Forms { #region Constructors [MonoTODO] - public DataGrid() { + public DataGrid() + { // setting default values: allowNavigation=true; borderStyle = BorderStyle.FixedSingle; @@ -81,7 +82,7 @@ namespace System.Windows.Forms { } #endregion - protected override void Dispose(bool disposing) { + protected override void Dispose(bool disposing){ } @@ -436,490 +437,561 @@ namespace System.Windows.Forms { #endregion #region Methods - // Following members support the .NET Framework infrastructure and are not intended to be used directly from your code. - - [MonoTODO] - protected virtual string GetOutputTextDelimiter(){ - throw new NotImplementedException (); - } - - [MonoTODO] - public void ResetLinkHoverColor(){ - - } - - [MonoTODO] - public virtual bool BeginEdit(DataGridColumnStyle gridColumn,int rowNumber) { + /* Following members support the .NET Framework infrastructure and are not intended to be used directly from your code. + * Methods not stubbed out: + - protected virtual string GetOutputTextDelimiter() + - public void ResetLinkHoverColor() + - public void SubObjectsSiteChange(bool site) + */ + [MonoTODO] + public virtual bool BeginEdit(DataGridColumnStyle gridColumn,int rowNumber) + { throw new NotImplementedException (); } [MonoTODO] - public void BeginInit() { + public void BeginInit() + { //FIXME: } [MonoTODO] - protected virtual void CancelEditing() { + protected virtual void CancelEditing() + { //FIXME: } [MonoTODO] - public void Collapse(int row) { + public void Collapse(int row) + { //FIXME: } [MonoTODO] - protected internal virtual void ColumnStartedEditing(Control editingControl) { + protected internal virtual void ColumnStartedEditing(Control editingControl) + { //FIXME: } [MonoTODO] - protected internal virtual void ColumnStartedEditing(Rectangle bounds) { + protected internal virtual void ColumnStartedEditing(Rectangle bounds) + { //FIXME: } [MonoTODO] - protected override AccessibleObject CreateAccessibilityInstance() { + protected override AccessibleObject CreateAccessibilityInstance() + { //FIXME: return base.CreateAccessibilityInstance(); } [MonoTODO] - protected virtual DataGridColumnStyle CreateGridColumn(PropertyDescriptor prop) { + protected virtual DataGridColumnStyle CreateGridColumn(PropertyDescriptor prop) + { throw new NotImplementedException (); } [MonoTODO] - protected virtual DataGridColumnStyle CreateGridColumn(PropertyDescriptor prop,bool isDefault) { + protected virtual DataGridColumnStyle CreateGridColumn(PropertyDescriptor prop,bool isDefault) + { throw new NotImplementedException (); } [MonoTODO] - public virtual bool EndEdit(DataGridColumnStyle gridColumn,int rowNumber,bool shouldAbort) { + public virtual bool EndEdit(DataGridColumnStyle gridColumn,int rowNumber,bool shouldAbort) + { throw new NotImplementedException (); } [MonoTODO] - public void EndInit() { + public void EndInit() + { //FIXME: } [MonoTODO] - public void Expand(int row) { + public void Expand(int row) + { throw new NotImplementedException (); } [MonoTODO] - public Rectangle GetCellBounds(DataGridCell dgc) { + public Rectangle GetCellBounds(DataGridCell dgc) + { throw new NotImplementedException (); } [MonoTODO] - public Rectangle GetCellBounds(int row,int col) { + public Rectangle GetCellBounds(int row,int col) + { throw new NotImplementedException (); } [MonoTODO] - public Rectangle GetCurrentCellBounds() { + public Rectangle GetCurrentCellBounds() + { throw new NotImplementedException (); } [MonoTODO] - protected virtual void GridHScrolled(object sender,ScrollEventArgs se) { + protected virtual void GridHScrolled(object sender,ScrollEventArgs se) + { //FIXME: } [MonoTODO] - protected virtual void GridVScrolled(object sender,ScrollEventArgs se) { + protected virtual void GridVScrolled(object sender,ScrollEventArgs se) + { //FIXME: } [MonoTODO] - public HitTestInfo HitTest(Point position) { + public HitTestInfo HitTest(Point position) + { throw new NotImplementedException (); } [MonoTODO] - public HitTestInfo HitTest(int x,int y) { + public HitTestInfo HitTest(int x,int y) + { throw new NotImplementedException (); } [MonoTODO] - public bool IsExpanded(int rowNumber) { + public bool IsExpanded(int rowNumber) + { throw new NotImplementedException (); } [MonoTODO] - public bool IsSelected(int row) { + public bool IsSelected(int row) + { throw new NotImplementedException (); } [MonoTODO] - public void NavigateBack() { + public void NavigateBack() + { //FIXME: } [MonoTODO] - public void NavigateTo(int rowNumber,string relationName) { + public void NavigateTo(int rowNumber,string relationName) + { //FIXME: } [MonoTODO] - protected virtual void OnAllowNavigationChanged(EventArgs e) { + protected virtual void OnAllowNavigationChanged(EventArgs e) + { //FIXME: } [MonoTODO] - protected void OnBackButtonClicked(object sender,EventArgs e) { + protected void OnBackButtonClicked(object sender,EventArgs e) + { //FIXME: } [MonoTODO] - protected override void OnBackColorChanged(EventArgs e) { + protected override void OnBackColorChanged(EventArgs e) + { //FIXME: base.OnBackColorChanged(e); } [MonoTODO] - protected virtual void OnBackgroundColorChanged(EventArgs e) { + protected virtual void OnBackgroundColorChanged(EventArgs e) + { //FIXME: } [MonoTODO] - protected override void OnBindingContextChanged(EventArgs e) { + protected override void OnBindingContextChanged(EventArgs e) + { //FIXME: base.OnBindingContextChanged(e); } [MonoTODO] - protected virtual void OnBorderStyleChanged(EventArgs e) { + protected virtual void OnBorderStyleChanged(EventArgs e) + { //FIXME: } [MonoTODO] - protected virtual void OnCaptionVisibleChanged(EventArgs e) { + protected virtual void OnCaptionVisibleChanged(EventArgs e) + { //FIXME: } [MonoTODO] - protected virtual void OnCurrentCellChanged(EventArgs e) { + protected virtual void OnCurrentCellChanged(EventArgs e) + { //FIXME: } [MonoTODO] - protected virtual void OnDataSourceChanged(EventArgs e) { + protected virtual void OnDataSourceChanged(EventArgs e) + { //FIXME: } [MonoTODO] - protected override void OnEnter(EventArgs e) { + protected override void OnEnter(EventArgs e) + { //FIXME: base.OnEnter(e); } [MonoTODO] - protected virtual void OnFlatModeChanged(EventArgs e) { + protected virtual void OnFlatModeChanged(EventArgs e) + { //FIXME: } [MonoTODO] - protected override void OnFontChanged(EventArgs e) { + protected override void OnFontChanged(EventArgs e) + { //FIXME: base.OnFontChanged(e); } [MonoTODO] - protected override void OnForeColorChanged(EventArgs e) { + protected override void OnForeColorChanged(EventArgs e) + { //FIXME: base.OnForeColorChanged(e); } [MonoTODO] - protected override void OnHandleCreated(EventArgs e) { + protected override void OnHandleCreated(EventArgs e) + { //FIXME: base.OnHandleCreated(e); } [MonoTODO] - protected override void OnHandleDestroyed(EventArgs e) { + protected override void OnHandleDestroyed(EventArgs e) + { //FIXME: base.OnHandleDestroyed(e); } [MonoTODO] - protected override void OnKeyDown(KeyEventArgs ke) { + protected override void OnKeyDown(KeyEventArgs e) + { //FIXME: - base.OnKeyDown(ke); + base.OnKeyDown(e); } [MonoTODO] - protected override void OnKeyPress(KeyPressEventArgs kpe) { + protected override void OnKeyPress(KeyPressEventArgs kpe) + { //FIXME: base.OnKeyPress(kpe); } [MonoTODO] - protected override void OnLayout(LayoutEventArgs levent) { + protected override void OnLayout(LayoutEventArgs levent) + { //FIXME: base.OnLayout(levent); } [MonoTODO] - protected override void OnLeave(EventArgs e) { + protected override void OnLeave(EventArgs e) + { //FIXME: base.OnLeave(e); } [MonoTODO] - protected override void OnMouseDown(MouseEventArgs e) { + protected override void OnMouseDown(MouseEventArgs e) + { //FIXME: base.OnMouseDown(e); } [MonoTODO] - protected override void OnMouseLeave(EventArgs e) { + protected override void OnMouseLeave(EventArgs e) + { //FIXME: base.OnMouseLeave(e); } [MonoTODO] - protected override void OnMouseMove(MouseEventArgs e) { + protected override void OnMouseMove(MouseEventArgs e) + { //FIXME: base.OnMouseMove(e); } [MonoTODO] - protected override void OnMouseUp(MouseEventArgs e) { + protected override void OnMouseUp(MouseEventArgs e) + { //FIXME: base.OnMouseUp(e); } [MonoTODO] - protected override void OnMouseWheel(MouseEventArgs e) { + protected override void OnMouseWheel(MouseEventArgs e) + { //FIXME: base.OnMouseWheel(e); } [MonoTODO] - protected void OnNavigate(NavigateEventArgs e) { + protected void OnNavigate(NavigateEventArgs e) + { //FIXME: } [MonoTODO] - protected override void OnPaint(PaintEventArgs pe) { + protected override void OnPaint(PaintEventArgs pe) + { //FIXME: base.OnPaint(pe); } [MonoTODO] - protected override void OnPaintBackground(PaintEventArgs ebe) { + protected override void OnPaintBackground(PaintEventArgs ebe) + { //FIXME: base.OnPaintBackground(ebe); } [MonoTODO] - protected virtual void OnParentRowsLabelStyleChanged(EventArgs e) { + protected virtual void OnParentRowsLabelStyleChanged(EventArgs e) + { //FIXME: } [MonoTODO] - protected virtual void OnParentRowsVisibleChanged(EventArgs e) { + protected virtual void OnParentRowsVisibleChanged(EventArgs e) + { //FIXME: } [MonoTODO] - protected virtual void OnReadOnlyChanged(EventArgs e) { + protected virtual void OnReadOnlyChanged(EventArgs e) + { //FIXME: } - - [MonoTODO] - protected virtual void OnResize(EventArgs e) { - //FIXME: - } - [MonoTODO] - protected void OnRowHeaderClick(EventArgs e) { + protected void OnRowHeaderClick(EventArgs e) + { //FIXME: } [MonoTODO] - protected void OnScroll(EventArgs e) { + protected void OnScroll(EventArgs e) + { //FIXME: } [MonoTODO] - protected void OnShowParentDetailsButtonClicked(object sender,EventArgs e) { + protected void OnShowParentDetailsButtonClicked(object sender,EventArgs e) + { //FIXME: } [MonoTODO] - protected override bool ProcessDialogKey(Keys keyData) { + protected override bool ProcessDialogKey(Keys keyData) + { //FIXME: return base.ProcessDialogKey(keyData); } [MonoTODO] - protected bool ProcessGridKey(KeyEventArgs ke) { + protected bool ProcessGridKey(KeyEventArgs ke) + { throw new NotImplementedException (); } [MonoTODO] - protected override bool ProcessKeyPreview(ref Message m) { + protected override bool ProcessKeyPreview(ref Message m) + { //FIXME: return base.ProcessKeyPreview(ref m); } [MonoTODO] - protected bool ProcessTabKey(Keys keyData) { + protected bool ProcessTabKey(Keys keyData) + { throw new NotImplementedException (); } [MonoTODO] - public void ResetAlternatingBackColor() { + public void ResetAlternatingBackColor() + { //FIXME: } [MonoTODO] - public override void ResetBackColor() { + public override void ResetBackColor() + { //FIXME: base.ResetBackColor(); } [MonoTODO] - public override void ResetForeColor() { + public override void ResetForeColor() + { //FIXME: base.ResetForeColor(); } [MonoTODO] - public void ResetGridLineColor() { + public void ResetGridLineColor() + { //FIXME: } [MonoTODO] - public void ResetHeaderBackColor() { + public void ResetHeaderBackColor() + { //FIXME: } [MonoTODO] - public void ResetHeaderFont() { + public void ResetHeaderFont() + { //FIXME: } [MonoTODO] - public void ResetHeaderForeColor() { + public void ResetHeaderForeColor() + { //FIXME: } [MonoTODO] - public void ResetLinkColor() { + public void ResetLinkColor() + { //FIXME: } [MonoTODO] - protected void ResetSelection() { + protected void ResetSelection() + { //FIXME: } [MonoTODO] - public void ResetSelectionBackColor() { + public void ResetSelectionBackColor() + { //FIXME: } [MonoTODO] - public void ResetSelectionForeColor() { + public void ResetSelectionForeColor() + { //FIXME: } [MonoTODO] - public void Select(int row) { + public void Select(int row) + { //FIXME: } [MonoTODO] - public void SetDataBinding(object dataSource,string dataMember) { + public void SetDataBinding(object dataSource,string dataMember) + { //FIXME: } [MonoTODO] - protected virtual bool ShouldSerializeAlternatingBackColor() { + protected virtual bool ShouldSerializeAlternatingBackColor() + { throw new NotImplementedException (); } [MonoTODO] - protected virtual bool ShouldSerializeBackgroundColor() { + protected virtual bool ShouldSerializeBackgroundColor() + { throw new NotImplementedException (); } [MonoTODO] - protected virtual bool ShouldSerializeCaptionBackColor() { + protected virtual bool ShouldSerializeCaptionBackColor() + { throw new NotImplementedException (); } [MonoTODO] - protected virtual bool ShouldSerializeCaptionForeColor() { + protected virtual bool ShouldSerializeCaptionForeColor() + { throw new NotImplementedException (); } [MonoTODO] - protected virtual bool ShouldSerializeGridLineColor() { + protected virtual bool ShouldSerializeGridLineColor() + { throw new NotImplementedException (); } [MonoTODO] - protected virtual bool ShouldSerializeHeaderBackColor() { + protected virtual bool ShouldSerializeHeaderBackColor() + { throw new NotImplementedException (); } [MonoTODO] - protected bool ShouldSerializeHeaderFont() { + protected bool ShouldSerializeHeaderFont() + { throw new NotImplementedException (); } [MonoTODO] - protected virtual bool ShouldSerializeHeaderForeColor() { + protected virtual bool ShouldSerializeHeaderForeColor() + { throw new NotImplementedException (); } [MonoTODO] - protected virtual bool ShouldSerializeLinkHoverColor() { + protected virtual bool ShouldSerializeLinkHoverColor() + { throw new NotImplementedException (); } [MonoTODO] - protected virtual bool ShouldSerializeParentRowsBackColor() { + protected virtual bool ShouldSerializeParentRowsBackColor() + { throw new NotImplementedException (); } [MonoTODO] - protected virtual bool ShouldSerializeParentRowsForeColor() { + protected virtual bool ShouldSerializeParentRowsForeColor() + { throw new NotImplementedException (); } [MonoTODO] - protected bool ShouldSerializePreferredRowHeight() { + protected bool ShouldSerializePreferredRowHeight() + { throw new NotImplementedException (); } [MonoTODO] - protected bool ShouldSerializeSelectionBackColor() { + protected bool ShouldSerializeSelectionBackColor() + { throw new NotImplementedException (); } [MonoTODO] - protected virtual bool ShouldSerializeSelectionForeColor() { + protected virtual bool ShouldSerializeSelectionForeColor() + { throw new NotImplementedException (); } - - [MonoTODO] - public void SubObjectsSiteChange(bool site) { - //FIXME: - } [MonoTODO] - public void UnSelect(int row) { + public void UnSelect(int row) + { //FIXME: } #endregion diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridCell.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridCell.cs index 5c144cbf215..9fc0c2a3b23 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridCell.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridCell.cs @@ -78,7 +78,7 @@ namespace System.Windows.Forms { } } - public int ColumnNumber { + public int ColumeNumber { get{ return columnnumber; } @@ -95,12 +95,12 @@ namespace System.Windows.Forms { /// Checks equivalence of this DataGridCell and another object. /// </remarks> - public override bool Equals (object o) + public override bool Equals (object obj) { - if (!(o is DataGridCell)) + if (!(obj is DataGridCell)) return false; - return (this == (DataGridCell) o); + return (this == (DataGridCell) obj); } /// <summary> diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DateTimePicker.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DateTimePicker.cs index b9c184d0249..0cc18283117 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/DateTimePicker.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DateTimePicker.cs @@ -124,11 +124,6 @@ namespace System.Windows.Forms { } [MonoTODO] - protected override void Dispose(bool disposing){ - base.Dispose(disposing); - } - - [MonoTODO] protected override bool IsInputKey(Keys keyData) { //FIXME: diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ErrorProvider.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ErrorProvider.cs index 2302d564e3c..7fdd2db1356 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/ErrorProvider.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ErrorProvider.cs @@ -98,15 +98,6 @@ using System.ComponentModel; } // - // --- Protected Methods - // - - [MonoTODO] - protected override void Dispose(bool disposing) { // .NET V1.1 Beta - base.Dispose(disposing); - } - - // // --- Public Methods // [MonoTODO] diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Form.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Form.cs index f754d141cfc..677e798b394 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/Form.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Form.cs @@ -16,9 +16,9 @@ using System.Collections; using System.Runtime.InteropServices; - namespace System.Windows.Forms { + namespace System.Windows.Forms { - public class Form : ContainerControl { + public class Form : ContainerControl { DialogResult dialogResult; Size maximumSize; Size minimumSize; @@ -34,971 +34,958 @@ // End of temperay varibles - internal class MdiClient : Control { - public MdiClient ( Control parent ) : base (parent, "") { - } - protected override CreateParams CreateParams { - get { - CreateParams pars = new CreateParams(); - - pars.ClassName = Win32.MDICLIENTCLASSNAME; - pars.Style = (int) ( WindowStyles.WS_CHILDWINDOW | - WindowStyles.WS_CLIPCHILDREN | - WindowStyles.WS_CLIPSIBLINGS | - WindowStyles.WS_OVERLAPPED | - WindowStyles.WS_VISIBLE | - WindowStyles.WS_VSCROLL | - WindowStyles.WS_HSCROLL ); - pars.ExStyle = (int) ( WindowExStyles.WS_EX_CLIENTEDGE ); - - pars.Parent = Parent.Handle; - CLIENTCREATESTRUCT cs = new CLIENTCREATESTRUCT(); - cs.hWindowMenu = IntPtr.Zero; - cs.idFirstChild = 100; - - pars.Param = cs; + internal class MdiClient : Control { + public MdiClient ( Control parent ) : base (parent, "") { + } + protected override CreateParams CreateParams { + get { + CreateParams pars = new CreateParams(); + + pars.ClassName = Win32.MDICLIENTCLASSNAME; + pars.Style = (int) ( WindowStyles.WS_CHILDWINDOW | + WindowStyles.WS_CLIPCHILDREN | + WindowStyles.WS_CLIPSIBLINGS | + WindowStyles.WS_OVERLAPPED | + WindowStyles.WS_VISIBLE | + WindowStyles.WS_VSCROLL | + WindowStyles.WS_HSCROLL ); + pars.ExStyle = (int) ( WindowExStyles.WS_EX_CLIENTEDGE ); + + pars.Parent = Parent.Handle; + CLIENTCREATESTRUCT cs = new CLIENTCREATESTRUCT(); + cs.hWindowMenu = IntPtr.Zero; + cs.idFirstChild = 100; + + pars.Param = cs; - return pars; - } - } - public void DestroyControl ( ) { - DestroyHandle ( ); + return pars; } } - - MdiClient mdiClientWnd; - Form mdiParent; - Control dialog_owner; - bool modal; - bool exitModalLoop; - Size autoScaleBaseSize; - bool keyPreview; - bool showInTaskbar; - bool topMost; - SizeGripStyle sizeGripStyle; - FormStartPosition formStartPosition; - FormWindowState formWindowState; - IButtonControl acceptButton; - IButtonControl cancelButton; - - public Form () : base () { - opacity = 1.00; - TopLevel = true; - modal = false; - dialogResult = DialogResult.None; - autoScale = true; - formBorderStyle = FormBorderStyle.Sizable; - sizeGripStyle = SizeGripStyle.Auto; - maximizeBox = true; - minimizeBox = true; - controlBox = true; - keyPreview = false; - showInTaskbar = true; - topMost = false; - helpButton = false; - maximumSize = Size.Empty; - minimumSize = Size.Empty; - formStartPosition = FormStartPosition.WindowsDefaultLocation; - visible = false; - formWindowState = FormWindowState.Normal; - acceptButton = null; - cancelButton = null; + public void DestroyControl ( ) { + DestroyHandle ( ); } - - static Form () { + } - } + MdiClient mdiClientWnd; + Form mdiParent; + Control dialog_owner; + bool modal; + bool exitModalLoop; + Size autoScaleBaseSize; + bool keyPreview; + bool showInTaskbar; + bool topMost; + SizeGripStyle sizeGripStyle; + FormStartPosition formStartPosition; + FormWindowState formWindowState; + IButtonControl acceptButton; + IButtonControl cancelButton; + + public Form () : base () + { + opacity = 1.00; + TopLevel = true; + modal = false; + dialogResult = DialogResult.None; + autoScale = true; + formBorderStyle = FormBorderStyle.Sizable; + sizeGripStyle = SizeGripStyle.Auto; + maximizeBox = true; + minimizeBox = true; + controlBox = true; + keyPreview = false; + showInTaskbar = true; + topMost = false; + helpButton = false; + maximumSize = Size.Empty; + minimumSize = Size.Empty; + formStartPosition = FormStartPosition.WindowsDefaultLocation; + visible = false; + formWindowState = FormWindowState.Normal; + acceptButton = null; + cancelButton = null; + } - // --- Public Properties - // - [MonoTODO] - public IButtonControl AcceptButton { - get { return acceptButton; } - set { - acceptButton = value; - } - } - - [MonoTODO] - public static Form ActiveForm { - get { - Control control = Control.FromChildHandle ( Win32.GetActiveWindow ( ) ); - if ( control != null && ! ( control is Form ) ) - control = control.getParentForm ( ); - return control as Form; - } - } - - [MonoTODO] - public Form ActiveMdiChild { - get { - throw new NotImplementedException (); - } - } - - [MonoTODO] - public bool AutoScale { - get { return autoScale; } - set { autoScale = value; } - } + static Form () + { - [MonoTODO] - public virtual Size AutoScaleBaseSize { - get { - return autoScaleBaseSize; - } - set { - autoScaleBaseSize = value; - } - } - - public override bool AutoScroll { - get { - return base.AutoScroll; - } - set { - base.AutoScroll = value; - } - } - - public override Color BackColor { - get { - return base.BackColor; - } - set { - base.BackColor = value; - } - } - - [MonoTODO] - public IButtonControl CancelButton { - get { return cancelButton; } - set { - cancelButton = value; - } - } - - [MonoTODO] - public new Size ClientSize { - get { - return base.ClientSize; - } - set { - base.ClientSize = value; - } - } - - public bool ControlBox { - get { return controlBox; } - set { - int oldStyle = controlBox ? (int) WindowStyles.WS_SYSMENU : 0; - controlBox = value; - if ( IsHandleCreated ) { - int newStyle = controlBox ? (int) WindowStyles.WS_SYSMENU : 0; - Win32.UpdateWindowStyle ( Handle, oldStyle, newStyle ); - } - } - } - - [MonoTODO] - public Rectangle DesktopBounds { - get { - throw new NotImplementedException (); - } - set { + } + + // --- Public Properties + // + [MonoTODO] + public IButtonControl AcceptButton { + get { return acceptButton; } + set { + acceptButton = value; + } + } + + [MonoTODO] + public static Form ActiveForm { + get { + Control control = Control.FromChildHandle ( Win32.GetActiveWindow ( ) ); + if ( control != null && ! ( control is Form ) ) + control = control.getParentForm ( ); + return control as Form; + } + } + + [MonoTODO] + public Form ActiveMdiChild { + get { + throw new NotImplementedException (); + } + } + + [MonoTODO] + public bool AutoScale { + get { return autoScale; } + set { autoScale = value; } + } + + [MonoTODO] + public virtual Size AutoScaleBaseSize { + get { + return autoScaleBaseSize; + } + set { + autoScaleBaseSize = value; + } + } + + public override bool AutoScroll { + get { + return base.AutoScroll; + } + set { + base.AutoScroll = value; + } + } + + public override Color BackColor { + get { + return base.BackColor; + } + set { + base.BackColor = value; + } + } + + [MonoTODO] + public IButtonControl CancelButton { + get { return cancelButton; } + set { + cancelButton = value; + } + } + + [MonoTODO] + public new Size ClientSize { + get { + return base.ClientSize; + } + set { + base.ClientSize = value; + } + } + + public bool ControlBox { + get { return controlBox; } + set { + int oldStyle = controlBox ? (int) WindowStyles.WS_SYSMENU : 0; + controlBox = value; + if ( IsHandleCreated ) { + int newStyle = controlBox ? (int) WindowStyles.WS_SYSMENU : 0; + Win32.UpdateWindowStyle ( Handle, oldStyle, newStyle ); + } + } + } + + [MonoTODO] + public Rectangle DesktopBounds { + get { + throw new NotImplementedException (); + } + set { //FIXME: } - } - - [MonoTODO] - public Point DesktopLocation { - get { - throw new NotImplementedException (); - } - set { - SetDesktopLocation ( value.X, value.Y ); - } - } - - //Compact Framework - [MonoTODO] - public DialogResult DialogResult { - get { - return dialogResult; - } - set { - if ( !Enum.IsDefined ( typeof(DialogResult), value ) ) - throw new InvalidEnumArgumentException( "DialogResult", - (int)value, - typeof(DialogResult)); - - dialogResult = value; - if ( Modal && dialogResult != DialogResult.None ) { - Application.exitModalLoop ( this ); - } - } - } - - public FormBorderStyle FormBorderStyle { - get { return formBorderStyle; } - set { - if ( formBorderStyle == value ) - return; - - if ( !Enum.IsDefined ( typeof( FormBorderStyle ), value ) ) - throw new InvalidEnumArgumentException( "FormBorderStyle", - ( int )value, - typeof( FormBorderStyle ) ); - - int oldBaseStyle = 0; - int oldExStyle = 0; - getFrameStyle ( formBorderStyle, ref oldBaseStyle, ref oldExStyle ); - - formBorderStyle = value; - - int newBaseStyle = 0; - int newExStyle = 0; - getFrameStyle ( formBorderStyle, ref newBaseStyle, ref newExStyle ); + } + + [MonoTODO] + public Point DesktopLocation { + get { + throw new NotImplementedException (); + } + set { + SetDesktopLocation ( value.X, value.Y ); + } + } + + //Compact Framework + [MonoTODO] + public DialogResult DialogResult { + get { + return dialogResult; + } + set { + if ( !Enum.IsDefined ( typeof(DialogResult), value ) ) + throw new InvalidEnumArgumentException( "DialogResult", + (int)value, + typeof(DialogResult)); + + dialogResult = value; + if ( Modal && dialogResult != DialogResult.None ) { + Application.exitModalLoop ( this ); + } + } + } + + public FormBorderStyle FormBorderStyle { + get { return formBorderStyle; } + set { + if ( formBorderStyle == value ) + return; + + if ( !Enum.IsDefined ( typeof( FormBorderStyle ), value ) ) + throw new InvalidEnumArgumentException( "FormBorderStyle", + ( int )value, + typeof( FormBorderStyle ) ); + + int oldBaseStyle = 0; + int oldExStyle = 0; + getFrameStyle ( formBorderStyle, ref oldBaseStyle, ref oldExStyle ); + + formBorderStyle = value; + + int newBaseStyle = 0; + int newExStyle = 0; + getFrameStyle ( formBorderStyle, ref newBaseStyle, ref newExStyle ); - ClientSize = ClientSize; // recalculate size of client area - - if ( IsHandleCreated ) { - Win32.UpdateWindowStyle ( Handle, oldBaseStyle, newBaseStyle ); - Win32.UpdateWindowExStyle ( Handle, oldExStyle, newExStyle ); - } - } - } - - - public bool HelpButton { - get { return helpButton; } - set { - int oldExStyle = helpButton ? (int) WindowExStyles.WS_EX_CONTEXTHELP : 0; - helpButton = value; - if ( IsHandleCreated ) { - int newExStyle = 0; - if ( helpButton && !MinimizeBox && !MaximizeBox ) - newExStyle = (int) WindowExStyles.WS_EX_CONTEXTHELP; - Win32.UpdateWindowExStyle ( Handle, oldExStyle, newExStyle ); - } - - } - } - - //Compact Framework - //[MonoTODO] - public Icon Icon { - get { - throw new NotImplementedException (); - } - set { - //FIXME: - } - } - - public bool IsMdiChild { - get { return mdiParent != null; } - } + ClientSize = ClientSize; // recalculate size of client area - public bool KeyPreview { - get { return keyPreview; } - set { keyPreview = value; } - } - - public bool MaximizeBox { - get { return maximizeBox; } - set { - int oldStyle = maximizeBox ? (int) WindowStyles.WS_MAXIMIZEBOX : 0; - maximizeBox = value; - if ( IsHandleCreated ) { - int newStyle = maximizeBox ? (int) WindowStyles.WS_MAXIMIZEBOX : 0; - Win32.UpdateWindowStyle ( Handle, oldStyle, newStyle ); - // changing this property may affect the visibility of help button - HelpButton = HelpButton; - } + if ( IsHandleCreated ) { + Win32.UpdateWindowStyle ( Handle, oldBaseStyle, newBaseStyle ); + Win32.UpdateWindowExStyle ( Handle, oldExStyle, newExStyle ); } - } + } + } - [MonoTODO] - public Size MaximumSize { - get { return maximumSize; } - set { - if ( value.Width < 0 || value.Height < 0 ) - throw new ArgumentOutOfRangeException( "value" ); - if ( maximumSize != value ) { - maximumSize = value; + public bool HelpButton { + get { return helpButton; } + set { + int oldExStyle = helpButton ? (int) WindowExStyles.WS_EX_CONTEXTHELP : 0; + helpButton = value; + if ( IsHandleCreated ) { + int newExStyle = 0; + if ( helpButton && !MinimizeBox && !MaximizeBox ) + newExStyle = (int) WindowExStyles.WS_EX_CONTEXTHELP; + Win32.UpdateWindowExStyle ( Handle, oldExStyle, newExStyle ); + } + + } + } + + //Compact Framework + //[MonoTODO] + public Icon Icon { + get { + throw new NotImplementedException (); + } + set { + //FIXME: + } + } + + public bool IsMdiChild { + get { return mdiParent != null; } + } + + public bool KeyPreview { + get { return keyPreview; } + set { keyPreview = value; } + } + + public bool MaximizeBox { + get { return maximizeBox; } + set { + int oldStyle = maximizeBox ? (int) WindowStyles.WS_MAXIMIZEBOX : 0; + maximizeBox = value; + if ( IsHandleCreated ) { + int newStyle = maximizeBox ? (int) WindowStyles.WS_MAXIMIZEBOX : 0; + Win32.UpdateWindowStyle ( Handle, oldStyle, newStyle ); + // changing this property may affect the visibility of help button + HelpButton = HelpButton; + } + } + } + + [MonoTODO] + public Size MaximumSize { + get { return maximumSize; } + set { + if ( value.Width < 0 || value.Height < 0 ) + throw new ArgumentOutOfRangeException( "value" ); + + if ( maximumSize != value ) { + maximumSize = value; - if ( minimumSize != Size.Empty ) { - if ( maximumSize.Width < minimumSize.Width ) - minimumSize.Width = maximumSize.Width; - if ( maximumSize.Height < minimumSize.Height ) - minimumSize.Height = maximumSize.Height; - } - - Size = Size; - OnMaximumSizeChanged ( EventArgs.Empty ); + if ( minimumSize != Size.Empty ) { + if ( maximumSize.Width < minimumSize.Width ) + minimumSize.Width = maximumSize.Width; + if ( maximumSize.Height < minimumSize.Height ) + minimumSize.Height = maximumSize.Height; } - } - } - - [MonoTODO] - public Form[] MdiChildren { - get { - Form[] forms = new Form[0]; - return forms; - } - } - - [MonoTODO] - public Form MdiParent { - get { - return mdiParent; - } - set { - if ( !value.IsMdiContainer || ( value.IsMdiContainer && value.IsMdiChild ) ) - throw new Exception( ); - mdiParent = value; - mdiParent.MdiClientControl.Controls.Add ( this ); + Size = Size; + OnMaximumSizeChanged ( EventArgs.Empty ); + } + } + } + + [MonoTODO] + public Form[] MdiChildren { + get { + Form[] forms = new Form[0]; + return forms; + } + } + + [MonoTODO] + public Form MdiParent { + get { + return mdiParent; + } + set { + if ( !value.IsMdiContainer || ( value.IsMdiContainer && value.IsMdiChild ) ) + throw new Exception( ); + + mdiParent = value; + mdiParent.MdiClientControl.Controls.Add ( this ); - if ( mdiParent.IsHandleCreated ) - CreateControl ( ); - } + if ( mdiParent.IsHandleCreated ) + CreateControl ( ); } + } - //Compact Framework - //[MonoTODO] - private MainMenu mainMenu_ = null; + //Compact Framework + //[MonoTODO] + private MainMenu mainMenu_ = null; - private void assignMenu() { - if ( mainMenu_ != null ) - mainMenu_.setForm ( this ); + private void assignMenu() + { + if ( mainMenu_ != null ) + mainMenu_.setForm ( this ); - if( IsHandleCreated ) { + if( IsHandleCreated ) { // FIXME: If Form's window has no style for menu, probably, better to add it // if menu have to be removed, remove the style. // Attention to the repainting. - if( mainMenu_ != null) { - // //long myStyle = Win32.GetWindowLongA( Handle, Win32.GWL_STYLE); - // //myStyle |= (long)Win32.WS_OVERLAPPEDWINDOW; - // //Win32.SetWindowLongA( Handle, Win32.GWL_STYLE, myStyle); - int res = Win32.SetMenu( Handle, mainMenu_.Handle); - Console.WriteLine ("Form.assignMenu. result {0}", res); - } - else { - Win32.SetMenu( Handle, IntPtr.Zero); + if( mainMenu_ != null) { +// //long myStyle = Win32.GetWindowLongA( Handle, Win32.GWL_STYLE); +// //myStyle |= (long)Win32.WS_OVERLAPPEDWINDOW; +// //Win32.SetWindowLongA( Handle, Win32.GWL_STYLE, myStyle); + int res = Win32.SetMenu( Handle, mainMenu_.Handle); + Console.WriteLine ("Form.assignMenu. result {0}", res); + } + else { + Win32.SetMenu( Handle, IntPtr.Zero); + } } } - } - public MainMenu Menu { - get { - return mainMenu_; - } - set { - mainMenu_ = value; - assignMenu(); - // update size of the form - ClientSize = ClientSize; - } - } - - //[MonoTODO] - //public MainMenu MergedMenu { - // get { - // throw new NotImplementedException (); - // } - //} - - public bool MinimizeBox { - get { return minimizeBox; } - set { - int oldStyle = minimizeBox ? (int) WindowStyles.WS_MINIMIZEBOX : 0; - minimizeBox = value; - if ( IsHandleCreated ) { - int newStyle = minimizeBox ? (int) WindowStyles.WS_MINIMIZEBOX : 0; - Win32.UpdateWindowStyle ( Handle, oldStyle, newStyle ); - // changing this property may affect the visibility of help button - HelpButton = HelpButton; + public MainMenu Menu { + get { + return mainMenu_; + } + set { + mainMenu_ = value; + assignMenu(); + // update size of the form + ClientSize = ClientSize; + } + } + + //[MonoTODO] + //public MainMenu MergedMenu { + // get { + // throw new NotImplementedException (); + // } + //} + + public bool MinimizeBox { + get { return minimizeBox; } + set { + int oldStyle = minimizeBox ? (int) WindowStyles.WS_MINIMIZEBOX : 0; + minimizeBox = value; + if ( IsHandleCreated ) { + int newStyle = minimizeBox ? (int) WindowStyles.WS_MINIMIZEBOX : 0; + Win32.UpdateWindowStyle ( Handle, oldStyle, newStyle ); + // changing this property may affect the visibility of help button + HelpButton = HelpButton; + } + } + } + + [MonoTODO] + public Size MinimumSize { + get { return minimumSize; } + set { + if ( value.Width < 0 || value.Height < 0 ) + throw new ArgumentOutOfRangeException( "value" ); + + if ( minimumSize != value ) { + minimumSize = value; + + if ( maximumSize != Size.Empty ) { + if ( minimumSize.Width > maximumSize.Width ) + maximumSize.Width = minimumSize.Width; + if ( minimumSize.Height > maximumSize.Height ) + maximumSize.Height = minimumSize.Height; } - } - } - - [MonoTODO] - public Size MinimumSize { - get { return minimumSize; } - set { - if ( value.Width < 0 || value.Height < 0 ) - throw new ArgumentOutOfRangeException( "value" ); - - if ( minimumSize != value ) { - minimumSize = value; - - if ( maximumSize != Size.Empty ) { - if ( minimumSize.Width > maximumSize.Width ) - maximumSize.Width = minimumSize.Width; - if ( minimumSize.Height > maximumSize.Height ) - maximumSize.Height = minimumSize.Height; - } - Size = Size; - OnMinimumSizeChanged ( EventArgs.Empty ); - } + Size = Size; + OnMinimumSizeChanged ( EventArgs.Empty ); } } + } - public bool Modal { - get { return modal; } - } + public bool Modal { + get { return modal; } + } - [MonoTODO] - public double Opacity { - get { - return opacity; - } - set { - opacity = value; - } - } + [MonoTODO] + public double Opacity { + get { + return opacity; + } + set { + opacity = value; + } + } - [MonoTODO] - public bool IsMdiContainer { - get { return mdiClientWnd != null; } - set { - if ( value ) - createMdiClient ( ); - else - destroyMdiClient ( ); - } + [MonoTODO] + public bool IsMdiContainer { + get { return mdiClientWnd != null; } + set { + if ( value ) + createMdiClient ( ); + else + destroyMdiClient ( ); } + } - [MonoTODO] - public Form[] OwnedForms { - get { - throw new NotImplementedException (); - } - } - - [MonoTODO] - public Form Owner { - get { - throw new NotImplementedException (); - } - set { + [MonoTODO] + public Form[] OwnedForms { + get { + throw new NotImplementedException (); + } + } + + [MonoTODO] + public Form Owner { + get { + throw new NotImplementedException (); + } + set { //FIXME: } + } + + [MonoTODO] + public bool ShowInTaskbar { + get { return showInTaskbar; } + set { + if ( showInTaskbar != value ) { + showInTaskbar = value; + RecreateHandle ( ); + Visible = Visible; + } + } + } + + + public override ISite Site { + get { + return base.Site; + } + set { + base.Site = value; + } + } + + [MonoTODO] + public SizeGripStyle SizeGripStyle { + get { return sizeGripStyle; } + set { + if ( !Enum.IsDefined ( typeof( SizeGripStyle ), value ) ) + throw new InvalidEnumArgumentException( "SizeGripStyle", + (int)value, + typeof( SizeGripStyle ) ); + + sizeGripStyle = value; + } + } + + public FormStartPosition StartPosition { + get { return formStartPosition; } + set { + if ( !Enum.IsDefined ( typeof( FormStartPosition ), value ) ) + throw new InvalidEnumArgumentException( "StartPosition", + (int)value, + typeof( FormStartPosition ) ); + + formStartPosition = value; + } + } + + [MonoTODO] + public bool TopLevel { + get { return GetTopLevel ( ); } + set { SetTopLevel ( value ); } + } + + public bool TopMost { + get { return topMost; } + set { + topMost = value; + if ( IsHandleCreated ) + Win32.SetWindowPos ( Handle, topMost ? SetWindowPosZOrder.HWND_TOPMOST : SetWindowPosZOrder.HWND_NOTOPMOST, + 0, 0, 0, 0, SetWindowPosFlags.SWP_NOSIZE | SetWindowPosFlags.SWP_NOMOVE ); } + } - [MonoTODO] - public bool ShowInTaskbar { - get { return showInTaskbar; } - set { - if ( showInTaskbar != value ) { - showInTaskbar = value; - RecreateHandle ( ); - Visible = Visible; - } - } - } - - - public virtual ISite Site { - get { - return base.Site; - } - set { - base.Site = value; - } - } - - [MonoTODO] - public SizeGripStyle SizeGripStyle { - get { return sizeGripStyle; } - set { - if ( !Enum.IsDefined ( typeof( SizeGripStyle ), value ) ) - throw new InvalidEnumArgumentException( "SizeGripStyle", - (int)value, - typeof( SizeGripStyle ) ); - - sizeGripStyle = value; - } - } - - public FormStartPosition StartPosition { - get { return formStartPosition; } - set { - if ( !Enum.IsDefined ( typeof( FormStartPosition ), value ) ) - throw new InvalidEnumArgumentException( "StartPosition", - (int)value, - typeof( FormStartPosition ) ); - - formStartPosition = value; - } - } - - [MonoTODO] - public bool TopLevel { - get { return GetTopLevel ( ); } - set { SetTopLevel ( value ); } - } - - public bool TopMost { - get { return topMost; } - set { - topMost = value; - if ( IsHandleCreated ) - Win32.SetWindowPos ( Handle, topMost ? SetWindowPosZOrder.HWND_TOPMOST : SetWindowPosZOrder.HWND_NOTOPMOST, - 0, 0, 0, 0, SetWindowPosFlags.SWP_NOSIZE | SetWindowPosFlags.SWP_NOMOVE ); - } - } - - [MonoTODO] - public Color TransparencyKey { - get { - throw new NotImplementedException (); - } - set { + [MonoTODO] + public Color TransparencyKey { + get { + throw new NotImplementedException (); + } + set { //FIXME: } - } + } - //Compact Framework - [MonoTODO] - public FormWindowState WindowState { - get { return formWindowState; } - set { - if ( !Enum.IsDefined ( typeof( FormWindowState ), value ) ) - throw new InvalidEnumArgumentException( "WindowState", - (int)value, - typeof( FormWindowState ) ); - - formWindowState = value; - } + //Compact Framework + [MonoTODO] + public FormWindowState WindowState { + get { return formWindowState; } + set { + if ( !Enum.IsDefined ( typeof( FormWindowState ), value ) ) + throw new InvalidEnumArgumentException( "WindowState", + (int)value, + typeof( FormWindowState ) ); + + formWindowState = value; } + } - // --- Public Methods - public void Activate () { - Win32.SetActiveWindow (Handle); - } - - [MonoTODO] - public void AddOwnedForm (Form ownedForm) { + // --- Public Methods + public void Activate () + { + Win32.SetActiveWindow (Handle); + } + + [MonoTODO] + public void AddOwnedForm (Form ownedForm) + { //FIXME: } - //Compact Framework - public void Close () { - //Win32.DestroyWindow (Handle); - if ( IsHandleCreated ) - Win32.PostMessage ( Handle, Msg.WM_CLOSE, 0, 0 ); - } - - public void LayoutMdi (MdiLayout value) { - if ( IsMdiContainer && mdiClientWnd.IsHandleCreated ) { - int mes = 0; - int wp = 0; - - switch ( value ) { - case MdiLayout.Cascade: - mes = (int)Msg.WM_MDICASCADE; - break; - case MdiLayout.ArrangeIcons: - mes = (int)Msg.WM_MDIICONARRANGE; - break; - case MdiLayout.TileHorizontal: - mes = (int)Msg.WM_MDITILE; - wp = 1; - break; - case MdiLayout.TileVertical: - mes = (int)Msg.WM_MDITILE; - break; - } - - if ( mes != 0 ) - Win32.SendMessage ( mdiClientWnd.Handle, mes, wp, 0 ); + //Compact Framework + public void Close () + { + //Win32.DestroyWindow (Handle); + if ( IsHandleCreated ) + Win32.PostMessage ( Handle, Msg.WM_CLOSE, 0, 0 ); + } + + public void LayoutMdi (MdiLayout value) + { + if ( IsMdiContainer && mdiClientWnd.IsHandleCreated ) { + int mes = 0; + int wp = 0; + + switch ( value ) { + case MdiLayout.Cascade: + mes = (int)Msg.WM_MDICASCADE; + break; + case MdiLayout.ArrangeIcons: + mes = (int)Msg.WM_MDIICONARRANGE; + break; + case MdiLayout.TileHorizontal: + mes = (int)Msg.WM_MDITILE; + wp = 1; + break; + case MdiLayout.TileVertical: + mes = (int)Msg.WM_MDITILE; + break; } + + if ( mes != 0 ) + Win32.SendMessage ( mdiClientWnd.Handle, mes, wp, 0 ); } + } - [MonoTODO] - public void RemoveOwnedForm (Form ownedForm) { + [MonoTODO] + public void RemoveOwnedForm (Form ownedForm) + { //FIXME: } - public void SetDesktopLocation (int x, int y) { - Win32.SetWindowPos ((IntPtr) Handle, SetWindowPosZOrder.HWND_TOPMOST, - x, y, 0, 0, - SetWindowPosFlags.SWP_NOSIZE | - SetWindowPosFlags.SWP_NOZORDER); - } - - [MonoTODO] - public void SetDesktopBounds (int x, int y, int width, int height) { - ///implmentation from setwindow location. - ///not sure width and height were added correctly - Win32.SetWindowPos ((IntPtr) Handle, SetWindowPosZOrder.HWND_TOPMOST, - x, y, width, height, - SetWindowPosFlags.SWP_NOZORDER); - } - [MonoTODO] - public DialogResult ShowDialog (IWin32Window owner) { - //IWin32Window has 1 public prop, "Handle" - //use this knowledge to modify the () version for this version - throw new NotImplementedException(); - } - - [MonoTODO] - public DialogResult ShowDialog () { - Control owner = Control.getOwnerWindow ( this ); - Control oldOwner = dlgOwner; - dlgOwner = owner; - - // needs to be recreated because ownership can't be changed - if ( IsHandleCreated ) { - if ( oldOwner != owner ) - RecreateHandle(); - } - else - CreateControl ( ); - - if ( owner != null ) - owner.Enabled = false; - - Show ( ); + public void SetDesktopLocation (int x, int y) + { + Win32.SetWindowPos ((IntPtr) Handle, SetWindowPosZOrder.HWND_TOPMOST, + x, y, 0, 0, + SetWindowPosFlags.SWP_NOSIZE | + SetWindowPosFlags.SWP_NOZORDER); + } + + + [MonoTODO] + public DialogResult ShowDialog () + { + Control owner = Control.getOwnerWindow ( this ); + Control oldOwner = dlgOwner; + dlgOwner = owner; + + // needs to be recreated because ownership can't be changed + if ( IsHandleCreated ) { + if ( oldOwner != owner ) + RecreateHandle(); + } + else + CreateControl ( ); + + if ( owner != null ) + owner.Enabled = false; + + Show ( ); - modal = true; - Application.enterModalLoop ( this ); - modal = false; - - if ( owner != null ) { - owner.Enabled = true; - Win32.SetFocus ( owner.Handle ); - } - Hide ( ); + modal = true; + Application.enterModalLoop ( this ); + modal = false; - return DialogResult; + if ( owner != null ) { + owner.Enabled = true; + Win32.SetFocus ( owner.Handle ); } + Hide ( ); + + return DialogResult; + } - public override string ToString () { - return GetType( ).FullName.ToString( ) + ", Text: " + Text; - } + public override string ToString () + { + return GetType( ).FullName.ToString( ) + ", Text: " + Text; + } - [MonoTODO] - protected override void UpdateDefaultButton(){ - base.UpdateDefaultButton(); - } - - // --- Public Events + // --- Public Events - public event EventHandler Activated; + public event EventHandler Activated; - public event EventHandler Closed; - public event CancelEventHandler Closing; + public event EventHandler Closed; + public event CancelEventHandler Closing; - //Compact Framework - // CancelEventHandler not yet implemented/stubbed - //public event CancelEventHandler Closing; + //Compact Framework + // CancelEventHandler not yet implemented/stubbed + //public event CancelEventHandler Closing; - public event EventHandler Deactivate; - public event InputLanguageChangedEventHandler InputLanguageChanged; - public event InputLanguageChangingEventHandler InputLanguageChanging; + public event EventHandler Deactivate; + public event InputLanguageChangedEventHandler InputLanguageChanged; + public event InputLanguageChangingEventHandler InputLanguageChanging; //Compact Framework - public event EventHandler Load; + public event EventHandler Load; - public event EventHandler MaximizedBoundsChanged; - public event EventHandler MaximumSizeChanged; - public event EventHandler MdiChildActivate; - public event EventHandler MenuComplete; - public event EventHandler MenuStart; - public event EventHandler MinimumSizeChanged; + public event EventHandler MaximizedBoundsChanged; + public event EventHandler MaximumSizeChanged; + public event EventHandler MdiChildActivate; + public event EventHandler MenuComplete; + public event EventHandler MenuStart; + public event EventHandler MinimumSizeChanged; - // --- Protected Properties + // --- Protected Properties - [MonoTODO] - public bool AllowTransparency{ - get { - throw new NotImplementedException(); + protected override CreateParams CreateParams { + get { + CreateParams pars = base.CreateParams; + + int baseStyle = 0; + int exStyle = 0; + + getFrameStyle ( FormBorderStyle , ref baseStyle, ref exStyle ); + + pars.Style = baseStyle; + pars.ExStyle = exStyle; + + if ( IsMdiChild ) { + pars.Style |= (int)( WindowStyles.WS_CHILD | WindowStyles.WS_VISIBLE ); + pars.ExStyle |= (int)WindowExStyles.WS_EX_MDICHILD; } - set { - //fixme + else { + pars.Style |= (int)( WindowStyles.WS_CLIPSIBLINGS | + WindowStyles.WS_CLIPCHILDREN ); } - } + if ( TopLevel && Parent == null ) + pars.Parent = IntPtr.Zero; - protected override CreateParams CreateParams { - get { - CreateParams pars = base.CreateParams; + if ( ShowInTaskbar ) + pars.ExStyle |= (int) WindowExStyles.WS_EX_APPWINDOW; + else { + pars.ExStyle &= ~(int) WindowExStyles.WS_EX_APPWINDOW; + // should be child of the hidden window + pars.Parent = Control.ParkingWindowHandle; + } - int baseStyle = 0; - int exStyle = 0; + if ( ControlBox ) + pars.Style |= (int) WindowStyles.WS_SYSMENU; + else + pars.Style &= ~(int) WindowStyles.WS_SYSMENU; - getFrameStyle ( FormBorderStyle , ref baseStyle, ref exStyle ); + if ( MaximizeBox ) + pars.Style |= (int) WindowStyles.WS_MAXIMIZEBOX; + else + pars.Style &= ~(int) WindowStyles.WS_MAXIMIZEBOX; - pars.Style = baseStyle; - pars.ExStyle = exStyle; + if ( MinimizeBox ) + pars.Style |= (int) WindowStyles.WS_MINIMIZEBOX; + else + pars.Style &= ~(int) WindowStyles.WS_MINIMIZEBOX; - if ( IsMdiChild ) { - pars.Style |= (int)( WindowStyles.WS_CHILD | WindowStyles.WS_VISIBLE ); - pars.ExStyle |= (int)WindowExStyles.WS_EX_MDICHILD; - } - else { - pars.Style |= (int)( WindowStyles.WS_CLIPSIBLINGS | - WindowStyles.WS_CLIPCHILDREN ); - } + if ( HelpButton && !MinimizeBox && !MaximizeBox ) + pars.ExStyle |= (int) WindowExStyles.WS_EX_CONTEXTHELP; + else + pars.ExStyle &= ~(int) WindowExStyles.WS_EX_CONTEXTHELP; - if ( TopLevel && Parent == null ) - pars.Parent = IntPtr.Zero; + if ( TopMost ) + pars.ExStyle |= (int) WindowExStyles.WS_EX_TOPMOST; - if ( ShowInTaskbar ) - pars.ExStyle |= (int) WindowExStyles.WS_EX_APPWINDOW; - else { - pars.ExStyle &= ~(int) WindowExStyles.WS_EX_APPWINDOW; - // should be child of the hidden window - pars.Parent = Control.ParkingWindowHandle; - } - - if ( ControlBox ) - pars.Style |= (int) WindowStyles.WS_SYSMENU; - else - pars.Style &= ~(int) WindowStyles.WS_SYSMENU; - - if ( MaximizeBox ) - pars.Style |= (int) WindowStyles.WS_MAXIMIZEBOX; - else - pars.Style &= ~(int) WindowStyles.WS_MAXIMIZEBOX; - - if ( MinimizeBox ) - pars.Style |= (int) WindowStyles.WS_MINIMIZEBOX; - else - pars.Style &= ~(int) WindowStyles.WS_MINIMIZEBOX; - - if ( HelpButton && !MinimizeBox && !MaximizeBox ) - pars.ExStyle |= (int) WindowExStyles.WS_EX_CONTEXTHELP; - else - pars.ExStyle &= ~(int) WindowExStyles.WS_EX_CONTEXTHELP; - - if ( TopMost ) - pars.ExStyle |= (int) WindowExStyles.WS_EX_TOPMOST; - - // this property is used for modal dialogs - if ( dlgOwner != null ) - pars.Parent = dlgOwner.Handle; - - if ( !RecreatingHandle ) { - // don't change location of the form when it is being recreated - getStartPosition ( ref pars ); - } - return pars; + // this property is used for modal dialogs + if ( dlgOwner != null ) + pars.Parent = dlgOwner.Handle; + + if ( !RecreatingHandle ) { + // don't change location of the form when it is being recreated + getStartPosition ( ref pars ); } - } + return pars; + } + } - protected internal override bool MenuPresent { - get { return mainMenu_ != null; } - } + protected override bool MenuPresent { + get { return mainMenu_ != null; } + } - protected override ImeMode DefaultImeMode { - get { - return base.DefaultImeMode; - } - } + protected override ImeMode DefaultImeMode { + get { + return base.DefaultImeMode; + } + } - protected override Size DefaultSize { + protected override Size DefaultSize { get { return new Size(300,300); } } - [MonoTODO] - public new Size Size { - get { - return base.Size; - } - set { - base.Size = value; - } - } + [MonoTODO] + public new Size Size { + get { + return base.Size; + } + set { + base.Size = value; + } + } - [MonoTODO] - protected Rectangle MaximizedBounds { - get { - throw new NotImplementedException (); - } - set { + [MonoTODO] + protected Rectangle MaximizedBounds { + get { + throw new NotImplementedException (); + } + set { //FIXME: } - } + } - // --- Protected Methods + // --- Protected Methods - protected override void AdjustFormScrollbars ( - bool displayScrollbars) { - base.AdjustFormScrollbars (displayScrollbars); - } - - protected override Control.ControlCollection - CreateControlsInstance () { - return base.CreateControlsInstance (); - } - - protected override void CreateHandle () { - base.CreateHandle (); - } - - protected override void DefWndProc (ref Message m) { - if ( IsMdiChild ) - window.DefMDIChildProc ( ref m ); - else if ( IsMdiContainer && mdiClientWnd.IsHandleCreated ) { - if ( m.Msg != Msg.WM_SIZE ) - window.DefFrameProc ( ref m, mdiClientWnd ); - } - else - window.DefWndProc (ref m); - } - - [MonoTODO] - public bool IsRestrictedWindow { - get { - throw new NotImplementedException(); - } - } - - [MonoTODO] - public MainMenu MergedMenu { - get { - throw new NotImplementedException(); - } - } - - //Compact Framework - protected virtual void OnActivated (EventArgs e) { + protected override void AdjustFormScrollbars ( + bool displayScrollbars) + { + base.AdjustFormScrollbars (displayScrollbars); + } + + protected override Control.ControlCollection + CreateControlsInstance () + { + return base.CreateControlsInstance (); + } + + protected override void CreateHandle () + { + base.CreateHandle (); + } + + protected override void DefWndProc (ref Message m) + { + if ( IsMdiChild ) + window.DefMDIChildProc ( ref m ); + else if ( IsMdiContainer && mdiClientWnd.IsHandleCreated ) { + if ( m.Msg != Msg.WM_SIZE ) + window.DefFrameProc ( ref m, mdiClientWnd ); + } + else + window.DefWndProc (ref m); + } + //Compact Framework + protected virtual void OnActivated (EventArgs e) + { Activated(this,e); } - //Compact Framework - protected virtual void OnClosed (EventArgs e) { - if (Closed != null) - Closed (this, e); - } + //Compact Framework + protected virtual void OnClosed (EventArgs e) + { + if (Closed != null) + Closed (this, e); + } - //Compact Framework - protected virtual void OnClosing(CancelEventArgs e) { - if ( Closing != null ) - Closing ( this, e); + //Compact Framework + protected virtual void OnClosing(CancelEventArgs e) + { + if ( Closing != null ) + Closing ( this, e); - if ( Modal ) { - e.Cancel = true; // don't destroy modal form - DialogResult = DialogResult.Cancel; - } - } - - protected override void OnCreateControl () { - OnLoad ( EventArgs.Empty ); - base.OnCreateControl (); - Control c = getNextFocusedControl ( this, true ); - if ( c != null ) - c.Focus ( ); - } - - [MonoTODO] - protected virtual void OnDeactivate (EventArgs e) { - - } - - protected override void OnFontChanged (EventArgs e) { - base.OnFontChanged (e); + if ( Modal ) { + e.Cancel = true; // don't destroy modal form + DialogResult = DialogResult.Cancel; } + } - protected override void OnHandleCreated (EventArgs e) { - base.OnHandleCreated (e); - if ( IsMdiChild ) - activateMdiChild ( ); - Rectangle bnds = Bounds; - assignMenu(); - } + protected override void OnCreateControl () + { + OnLoad ( EventArgs.Empty ); + base.OnCreateControl (); + Control c = getNextFocusedControl ( this, true ); + if ( c != null ) + c.Focus ( ); + } + + protected override void OnFontChanged (EventArgs e) + { + base.OnFontChanged (e); + } + + protected override void OnHandleCreated (EventArgs e) + { + base.OnHandleCreated (e); + if ( IsMdiChild ) + activateMdiChild ( ); + Rectangle bnds = Bounds; + assignMenu(); + } - protected override void OnHandleDestroyed (EventArgs e) { - base.OnHandleDestroyed (e); - } + protected override void OnHandleDestroyed (EventArgs e) + { + base.OnHandleDestroyed (e); + } protected virtual void OnInputLanguageChanged ( - InputLanguageChangedEventArgs e) { - if (InputLanguageChanged != null) - InputLanguageChanged (this, e); - } - - protected virtual void OnInputLanguageChanging ( - InputLanguageChangingEventArgs e) { - if (InputLanguageChanging != null) - InputLanguageChanging (this, e); - } - - //Compact Framework - protected virtual void OnLoad (EventArgs e) { - if (Load != null) - Load (this, e); - } - - protected virtual void OnMaximizedBoundsChanged (EventArgs e) { - if (MaximizedBoundsChanged != null) - MaximizedBoundsChanged (this, e); - } - - protected virtual void OnMaximumSizeChanged (EventArgs e) { - if (MaximumSizeChanged != null) - MaximumSizeChanged (this, e); - } - - protected virtual void OnMdiChildActivate (EventArgs e) { - if (MdiChildActivate != null) - MdiChildActivate (this, e); - } - - protected virtual void OnMenuComplete (EventArgs e) { - if (MenuComplete != null) - MenuComplete (this, e); - } - - protected virtual void OnMenuStart (EventArgs e) { - if (MenuStart != null) - MenuStart (this, e); - } - - protected virtual void OnMinimumSizeChanged (EventArgs e) { - if ( MinimumSizeChanged != null ) - MinimumSizeChanged ( this, e ); - } - - //Compact Framework - protected override void OnPaint (PaintEventArgs e) { - base.OnPaint (e); - } - - //Compact Framework - protected override void OnResize (EventArgs e) { - base.OnResize (e); - // resizeMdiClient (); - } - - protected override void OnStyleChanged (EventArgs e) { - base.OnStyleChanged (e); - } - - //Compact Framework - protected override void OnTextChanged (EventArgs e) { - base.OnTextChanged (e); - } + InputLanguageChangedEventArgs e) + { + if (InputLanguageChanged != null) + InputLanguageChanged (this, e); + } + + protected virtual void OnInputLanguagedChanging ( + InputLanguageChangingEventArgs e) + { + if (InputLanguageChanging != null) + InputLanguageChanging (this, e); + } + + //Compact Framework + protected virtual void OnLoad (EventArgs e) + { + if (Load != null) + Load (this, e); + } + + protected virtual void OnMaximizedBoundsChanged (EventArgs e) + { + if (MaximizedBoundsChanged != null) + MaximizedBoundsChanged (this, e); + } + + protected virtual void OnMaximumSizeChanged (EventArgs e) + { + if (MaximumSizeChanged != null) + MaximumSizeChanged (this, e); + } + + protected virtual void OnMdiChildActivate (EventArgs e) + { + if (MdiChildActivate != null) + MdiChildActivate (this, e); + } + + protected virtual void OnMenuComplete (EventArgs e) + { + if (MenuComplete != null) + MenuComplete (this, e); + } + + protected virtual void OnMenuStart (EventArgs e) + { + if (MenuStart != null) + MenuStart (this, e); + } + + protected virtual void OnMinimumSizeChanged (EventArgs e) + { + if ( MinimumSizeChanged != null ) + MinimumSizeChanged ( this, e ); + } - protected override void OnVisibleChanged (EventArgs e) { - base.OnVisibleChanged (e); - } - - internal virtual IntPtr OnMenuCommand (uint id) { + //Compact Framework + protected override void OnPaint (PaintEventArgs e) + { + base.OnPaint (e); + } + + //Compact Framework + protected override void OnResize (EventArgs e) + { + base.OnResize (e); +// resizeMdiClient (); + } + + protected override void OnStyleChanged (EventArgs e) + { + base.OnStyleChanged (e); + } + + //Compact Framework + protected override void OnTextChanged (EventArgs e) + { + base.OnTextChanged (e); + } + + protected override void OnVisibleChanged (EventArgs e) + { + base.OnVisibleChanged (e); + } + + protected virtual IntPtr OnMenuCommand (uint id) + { IntPtr result = (IntPtr)1; System.Console.WriteLine("Form on command {0}", id); if(Menu != null) { @@ -1009,9 +996,10 @@ } } return result; - } + } - protected internal override void OnWmCommand (ref Message m) { + protected override void OnWmCommand (ref Message m) + { int wNotifyCode = (int)m.HiWordWParam; int wID = (int)m.LoWordWParam; @@ -1040,217 +1028,221 @@ } } - protected override bool ProcessCmdKey ( ref Message msg, Keys keyData) { - return base.ProcessCmdKey (ref msg, keyData); - } - - protected override bool ProcessDialogKey (Keys keyData) { - if ( keyData == Keys.Enter && AcceptButton != null ) { - AcceptButton.PerformClick ( ); - return true; - } - if ( keyData == Keys.Escape && CancelButton != null ) { - CancelButton.PerformClick ( ); - return true; - } - return base.ProcessDialogKey (keyData); - } - - protected override bool ProcessKeyPreview (ref Message m) { - if ( KeyPreview ) - return ProcessKeyEventArgs ( ref m ); + protected override bool ProcessCmdKey ( ref Message msg, Keys keyData) + { + return base.ProcessCmdKey (ref msg, keyData); + } + + protected override bool ProcessDialogKey (Keys keyData) + { + if ( keyData == Keys.Enter && AcceptButton != null ) { + AcceptButton.PerformClick ( ); + return true; + } + if ( keyData == Keys.Escape && CancelButton != null ) { + CancelButton.PerformClick ( ); + return true; + } + return base.ProcessDialogKey (keyData); + } + + protected override bool ProcessKeyPreview (ref Message m) + { + if ( KeyPreview ) + return ProcessKeyEventArgs ( ref m ); + + return false; + } + + protected override bool ProcessTabKey ( bool forward ) + { + Control newFocus = getNextFocusedControl ( this, forward ); + if ( newFocus != null ) { + return newFocus.Focus ( ); + } + return base.ProcessTabKey ( forward ); + } + + protected override void ScaleCore (float x, float y) + { + ClientSize = new Size ( (int) ( ClientSize.Width * x ), (int) ( ClientSize.Height * y) ); + } + + protected override void SetBoundsCore ( int x, int y, int width, int height, BoundsSpecified specified ) + { + if ( MaximumSize != Size.Empty ) { + if ( width > MaximumSize.Width ) + width = MaximumSize.Width; + if ( height > MaximumSize.Height ) + height = MaximumSize.Height; + } + if ( MinimumSize != Size.Empty ) { + if ( width < MinimumSize.Width ) + width = MinimumSize.Width; + if ( height < MinimumSize.Height ) + height = MinimumSize.Height; + } + + base.SetBoundsCore (x, y, width, height, specified); + } + + protected override void SetClientSizeCore (int x, int y) + { + base.SetClientSizeCore (x, y); + } + + protected override void SetVisibleCore (bool value) + { + base.SetVisibleCore (value); + } + + protected override void WndProc (ref Message m) + { + switch (m.Msg) { + case Msg.WM_CLOSE: + CancelEventArgs args = new CancelEventArgs( false ); + OnClosing( args ); + if ( !args.Cancel ) { + OnClosed ( EventArgs.Empty ); + base.WndProc ( ref m ); + } + break; + //case ?: + //OnCreateControl() + //break; + case Msg.WM_FONTCHANGE: + EventArgs fontChangedArgs = new EventArgs(); + OnFontChanged (fontChangedArgs); + break; + case Msg.WM_CREATE: + EventArgs handleCreatedArgs = new EventArgs(); + OnHandleCreated (handleCreatedArgs); + break; + case Msg.WM_DESTROY: + EventArgs destroyArgs = new EventArgs(); + OnHandleDestroyed (destroyArgs); + break; + case Msg.WM_INPUTLANGCHANGE: + //InputLanguageChangedEventArgs ilChangedArgs = + // new InputLanguageChangedEventArgs(); + //OnInputLanguageChanged (ilChangedArgs); + break; + case Msg.WM_INPUTLANGCHANGEREQUEST: + //InputLanguageChangingEventArgs ilChangingArgs = + // new InputLanguageChangingEventArgs(); + //OnInputLanguagedChanging (ilChangingArgs); + break; + /* + case Win32.WM_SHOWWINDOW: + EventArgs e; + OnLoad (e); + break; + */ + // case ?: + // OnMaximizedBoundsChanged(EventArgs e) + // break; + // case ?: + // OnMaximumSizedChanged(EventArgs e) + //break; + case Msg.WM_MDIACTIVATE: + EventArgs mdiActivateArgs = new EventArgs(); + OnMdiChildActivate (mdiActivateArgs); + base.WndProc ( ref m ); + break; + case Msg.WM_EXITMENULOOP: + EventArgs menuCompleteArgs = new EventArgs(); + OnMenuComplete (menuCompleteArgs); + break; + case Msg.WM_ENTERMENULOOP: + EventArgs enterMenuLoopArgs = new EventArgs(); + OnMenuStart (enterMenuLoopArgs); + break; + case Msg.WM_WINDOWPOSCHANGING: + if ( StartPosition == FormStartPosition.WindowsDefaultBounds && MaximumSize != Size.Empty || MinimumSize != Size.Empty) { + WINDOWPOS winpos = (WINDOWPOS) Marshal.PtrToStructure ( m.LParam, typeof ( WINDOWPOS ) ); + if ( ( winpos.flags & (uint)SetWindowPosFlags.SWP_SHOWWINDOW ) == (uint)SetWindowPosFlags.SWP_SHOWWINDOW ) { + + RECT rect = new RECT ( ); + Win32.GetWindowRect ( Handle, ref rect ); + + winpos.cx = rect.right - rect.left; + winpos.cy = rect.bottom - rect.top; - return false; - } + if ( MaximumSize != Size.Empty ) { + if ( winpos.cx > MaximumSize.Width ) + winpos.cx = MaximumSize.Width; + if ( winpos.cy > MaximumSize.Height ) + winpos.cy = MaximumSize.Height; + } - protected override bool ProcessTabKey ( bool forward ) { - Control newFocus = getNextFocusedControl ( this, forward ); - if ( newFocus != null ) { - return newFocus.Focus ( ); - } - return base.ProcessTabKey ( forward ); - } - - protected override void ScaleCore (float x, float y) { - ClientSize = new Size ( (int) ( ClientSize.Width * x ), (int) ( ClientSize.Height * y) ); - } + if ( MinimumSize != Size.Empty ) { + if ( winpos.cx < MinimumSize.Width ) + winpos.cx = MinimumSize.Width; + if ( winpos.cy < MinimumSize.Height ) + winpos.cy = MinimumSize.Height; + } - [MonoTODO] - protected override void Select(bool directed, bool forward){ - base.Select(directed, forward); - } - - protected override void SetBoundsCore ( int x, int y, int width, int height, BoundsSpecified specified ) { + winpos.flags &= ~ (uint)SetWindowPosFlags.SWP_NOSIZE; + winpos.flags |= (uint)SetWindowPosFlags.SWP_NOSENDCHANGING; + + Marshal.StructureToPtr ( winpos, m.LParam, false ); + } + } + base.WndProc ( ref m ); + break; + case Msg.WM_GETMINMAXINFO: + MINMAXINFO minmax = (MINMAXINFO) Marshal.PtrToStructure ( m.LParam, typeof ( MINMAXINFO ) ); if ( MaximumSize != Size.Empty ) { - if ( width > MaximumSize.Width ) - width = MaximumSize.Width; - if ( height > MaximumSize.Height ) - height = MaximumSize.Height; + minmax.ptMaxTrackSize.x = MaximumSize.Width; + minmax.ptMaxTrackSize.y = MaximumSize.Height; } if ( MinimumSize != Size.Empty ) { - if ( width < MinimumSize.Width ) - width = MinimumSize.Width; - if ( height < MinimumSize.Height ) - height = MinimumSize.Height; - } - - base.SetBoundsCore (x, y, width, height, specified); - } - - protected override void SetClientSizeCore (int x, int y) { - base.SetClientSizeCore (x, y); - } - - protected override void SetVisibleCore (bool value) { - base.SetVisibleCore (value); - } - - protected override void WndProc (ref Message m) { - switch (m.Msg) { - case Msg.WM_CLOSE: - CancelEventArgs args = new CancelEventArgs( false ); - OnClosing( args ); - if ( !args.Cancel ) { - OnClosed ( EventArgs.Empty ); - base.WndProc ( ref m ); - } - break; - //case ?: - //OnCreateControl() - //break; - case Msg.WM_FONTCHANGE: - EventArgs fontChangedArgs = new EventArgs(); - OnFontChanged (fontChangedArgs); - break; - case Msg.WM_CREATE: - EventArgs handleCreatedArgs = new EventArgs(); - OnHandleCreated (handleCreatedArgs); - break; - case Msg.WM_DESTROY: - EventArgs destroyArgs = new EventArgs(); - OnHandleDestroyed (destroyArgs); - break; - case Msg.WM_INPUTLANGCHANGE: - //InputLanguageChangedEventArgs ilChangedArgs = - // new InputLanguageChangedEventArgs(); - //OnInputLanguageChanged (ilChangedArgs); - break; - case Msg.WM_INPUTLANGCHANGEREQUEST: - //InputLanguageChangingEventArgs ilChangingArgs = - // new InputLanguageChangingEventArgs(); - //OnInputLanguagedChanging (ilChangingArgs); - break; - /* - case Win32.WM_SHOWWINDOW: - EventArgs e; - OnLoad (e); - break; - */ - // case ?: - // OnMaximizedBoundsChanged(EventArgs e) - // break; - // case ?: - // OnMaximumSizedChanged(EventArgs e) - //break; - case Msg.WM_MDIACTIVATE: - EventArgs mdiActivateArgs = new EventArgs(); - OnMdiChildActivate (mdiActivateArgs); - base.WndProc ( ref m ); - break; - case Msg.WM_EXITMENULOOP: - EventArgs menuCompleteArgs = new EventArgs(); - OnMenuComplete (menuCompleteArgs); - break; - case Msg.WM_ENTERMENULOOP: - EventArgs enterMenuLoopArgs = new EventArgs(); - OnMenuStart (enterMenuLoopArgs); - break; - case Msg.WM_WINDOWPOSCHANGING: - if ( StartPosition == FormStartPosition.WindowsDefaultBounds && MaximumSize != Size.Empty || MinimumSize != Size.Empty) { - WINDOWPOS winpos = (WINDOWPOS) Marshal.PtrToStructure ( m.LParam, typeof ( WINDOWPOS ) ); - if ( ( winpos.flags & (uint)SetWindowPosFlags.SWP_SHOWWINDOW ) == (uint)SetWindowPosFlags.SWP_SHOWWINDOW ) { - - RECT rect = new RECT ( ); - Win32.GetWindowRect ( Handle, ref rect ); - - winpos.cx = rect.right - rect.left; - winpos.cy = rect.bottom - rect.top; - - if ( MaximumSize != Size.Empty ) { - if ( winpos.cx > MaximumSize.Width ) - winpos.cx = MaximumSize.Width; - if ( winpos.cy > MaximumSize.Height ) - winpos.cy = MaximumSize.Height; - } - - if ( MinimumSize != Size.Empty ) { - if ( winpos.cx < MinimumSize.Width ) - winpos.cx = MinimumSize.Width; - if ( winpos.cy < MinimumSize.Height ) - winpos.cy = MinimumSize.Height; - } - - winpos.flags &= ~ (uint)SetWindowPosFlags.SWP_NOSIZE; - winpos.flags |= (uint)SetWindowPosFlags.SWP_NOSENDCHANGING; - - Marshal.StructureToPtr ( winpos, m.LParam, false ); - } - } - base.WndProc ( ref m ); - break; - case Msg.WM_GETMINMAXINFO: - MINMAXINFO minmax = (MINMAXINFO) Marshal.PtrToStructure ( m.LParam, typeof ( MINMAXINFO ) ); - if ( MaximumSize != Size.Empty ) { - minmax.ptMaxTrackSize.x = MaximumSize.Width; - minmax.ptMaxTrackSize.y = MaximumSize.Height; - } - if ( MinimumSize != Size.Empty ) { - minmax.ptMinTrackSize.x = MinimumSize.Width; - minmax.ptMinTrackSize.y = MinimumSize.Height; - } - Marshal.StructureToPtr ( minmax, m.LParam, false ); - break; - // case ?: - // OnMinimumSizeChanged(EventArgs e) - // break; - /* - case Msg.WM_PAINT: { - Rectangle rect = new Rectangle(); - PaintEventArgs paintArgs = new PaintEventArgs(CreateGraphics(), rect); - OnPaint (paintArgs); - paintArgs.Dispose(); - } - break; - case Msg.WM_SIZE: - EventArgs resizeArgs = new EventArgs(); - OnResize (resizeArgs); - break; - //case ?: - //OnStyleChanged(EventArgs e) - //break; - case Msg.WM_SETTEXT: - EventArgs textChangedArgs = new EventArgs(); - OnTextChanged (textChangedArgs); - break; - case Msg.WM_SHOWWINDOW: - EventArgs visibleChangedArgs = new EventArgs(); - OnVisibleChanged (visibleChangedArgs); - break; - */ - case Msg.WM_INITMENU: - OnWmInitMenu (ref m); - break; - case Msg.WM_INITMENUPOPUP: - OnWmInitMenuPopup (ref m); - break; - case Msg.WM_CTLCOLORLISTBOX: - Control.ReflectMessage( m.LParam, ref m); + minmax.ptMinTrackSize.x = MinimumSize.Width; + minmax.ptMinTrackSize.y = MinimumSize.Height; + } + Marshal.StructureToPtr ( minmax, m.LParam, false ); + break; + // case ?: + // OnMinimumSizeChanged(EventArgs e) + // break; +/* + case Msg.WM_PAINT: { + Rectangle rect = new Rectangle(); + PaintEventArgs paintArgs = new PaintEventArgs(CreateGraphics(), rect); + OnPaint (paintArgs); + paintArgs.Dispose(); + } break; - default: - base.WndProc (ref m); - break; - } - } + case Msg.WM_SIZE: + EventArgs resizeArgs = new EventArgs(); + OnResize (resizeArgs); + break; + //case ?: + //OnStyleChanged(EventArgs e) + //break; + case Msg.WM_SETTEXT: + EventArgs textChangedArgs = new EventArgs(); + OnTextChanged (textChangedArgs); + break; + case Msg.WM_SHOWWINDOW: + EventArgs visibleChangedArgs = new EventArgs(); + OnVisibleChanged (visibleChangedArgs); + break; +*/ + case Msg.WM_INITMENU: + OnWmInitMenu (ref m); + break; + case Msg.WM_INITMENUPOPUP: + OnWmInitMenuPopup (ref m); + break; + case Msg.WM_CTLCOLORLISTBOX: + Control.ReflectMessage( m.LParam, ref m); + break; + default: + base.WndProc (ref m); + break; + } + } #region new 11.26.2002 from Alexandre Pigolkine (pigolkine@gmx.de) protected virtual void OnWmInitMenu (ref Message m) { @@ -1268,215 +1260,185 @@ } #endregion - private void createMdiClient ( ) { - if( mdiClientWnd == null ) { - mdiClientWnd = new MdiClient ( this ); - Controls.Add ( mdiClientWnd ); - mdiClientWnd.Dock = DockStyle.Fill; - if ( IsHandleCreated ) { - mdiClientWnd.CreateControl ( ); - if ( Menu != null ) { - MenuItem mdiListItem = Menu.MdiListItem; - if ( mdiListItem != null ) - replaceMdiWindowMenu ( mdiListItem.Handle ); - } - } - } - } - - private void destroyMdiClient ( ) { - if ( mdiClientWnd != null ) { - Controls.Remove ( mdiClientWnd ); - mdiClientWnd.DestroyControl ( ); - mdiClientWnd = null; - } - } - private void resizeMdiClient ( ) { - if ( IsMdiContainer && mdiClientWnd.IsHandleCreated ) { - Win32.MoveWindow ( mdiClientWnd.Handle, - Location.X, Location.Y, - ClientSize.Width, - ClientSize.Height, true ); + private void createMdiClient ( ) { + if( mdiClientWnd == null ) { + mdiClientWnd = new MdiClient ( this ); + Controls.Add ( mdiClientWnd ); + mdiClientWnd.Dock = DockStyle.Fill; + if ( IsHandleCreated ) { + mdiClientWnd.CreateControl ( ); + if ( Menu != null ) { + MenuItem mdiListItem = Menu.MdiListItem; + if ( mdiListItem != null ) + replaceMdiWindowMenu ( mdiListItem.Handle ); + } } } + } - private void activateMdiChild ( ) { - Win32.SendMessage ( Parent.Handle, Msg.WM_MDIACTIVATE, Handle.ToInt32(), 0 ); - } - - protected void ActivateMdiChild (Form form ) { - ///function copied from above. no clue if this is what it shoul do - /// - - Win32.SendMessage ( Parent.Handle, Msg.WM_MDIACTIVATE, Handle.ToInt32(), 0 ); - } - - [MonoTODO] - protected void ApplyAutoScaling(){ - throw new NotImplementedException (); - } - - [MonoTODO] - protected void CenterToScreen(){ - throw new NotImplementedException (); + private void destroyMdiClient ( ) { + if ( mdiClientWnd != null ) { + Controls.Remove ( mdiClientWnd ); + mdiClientWnd.DestroyControl ( ); + mdiClientWnd = null; } - - [MonoTODO] - protected void CenterToParent(){ - throw new NotImplementedException (); + } + private void resizeMdiClient ( ) { + if ( IsMdiContainer && mdiClientWnd.IsHandleCreated ) { + Win32.MoveWindow ( mdiClientWnd.Handle, + Location.X, Location.Y, + ClientSize.Width, + ClientSize.Height, true ); } + } - [MonoTODO] - protected override void Dispose(bool disposing){ - base.Dispose(disposing); - } + private void activateMdiChild ( ) { + Win32.SendMessage ( Parent.Handle, Msg.WM_MDIACTIVATE, Handle.ToInt32(), 0 ); + } - internal Control MdiClientControl { - get { return this.mdiClientWnd; } - } + internal Control MdiClientControl { + get { return this.mdiClientWnd; } + } - internal void replaceMdiWindowMenu ( IntPtr hMenu ) { - Control mdiClient = MdiClientControl; - if ( mdiClient != null && mdiClient.Handle != IntPtr.Zero ) - if ( hMenu != IntPtr.Zero ) - Win32.SendMessage ( mdiClient.Handle, Msg.WM_MDISETMENU, 0, hMenu.ToInt32 ( ) ); - else - Win32.SendMessage ( mdiClient.Handle, Msg.WM_MDISETMENU, 1, 0 ); - // this probably won't work on Wine anyway - // because such behaviour is not impl. there + internal void replaceMdiWindowMenu ( IntPtr hMenu ) { + Control mdiClient = MdiClientControl; + if ( mdiClient != null && mdiClient.Handle != IntPtr.Zero ) + if ( hMenu != IntPtr.Zero ) + Win32.SendMessage ( mdiClient.Handle, Msg.WM_MDISETMENU, 0, hMenu.ToInt32 ( ) ); + else + Win32.SendMessage ( mdiClient.Handle, Msg.WM_MDISETMENU, 1, 0 ); + // this probably won't work on Wine anyway + // because such behaviour is not impl. there - if ( IsHandleCreated ) - Win32.DrawMenuBar ( Handle ); + if ( IsHandleCreated ) + Win32.DrawMenuBar ( Handle ); - } + } - internal Control dlgOwner { - get { return dialog_owner; } - set { dialog_owner = value;} - } + internal Control dlgOwner { + get { return dialog_owner; } + set { dialog_owner = value;} + } - internal bool ExitModalLoop { - get { return exitModalLoop; } - set { exitModalLoop = value; } - } + internal bool ExitModalLoop { + get { return exitModalLoop; } + set { exitModalLoop = value; } + } - private void getFrameStyle ( FormBorderStyle borderStyle, ref int baseStyle, ref int exStyle ) { - baseStyle = 0; - exStyle = 0; + private void getFrameStyle ( FormBorderStyle borderStyle, ref int baseStyle, ref int exStyle ) + { + baseStyle = 0; + exStyle = 0; - int sysStyles = getSysStyles ( ); - - switch ( borderStyle ) { - case FormBorderStyle.Fixed3D: - baseStyle = (int) ( WindowStyles.WS_CAPTION ) | sysStyles; - exStyle = (int) ( WindowExStyles.WS_EX_OVERLAPPEDWINDOW ); - break; - case FormBorderStyle.FixedDialog: - baseStyle = (int) ( WindowStyles.WS_CAPTION ) | sysStyles; - exStyle = (int) ( WindowExStyles.WS_EX_DLGMODALFRAME | WindowExStyles.WS_EX_WINDOWEDGE ); - break; - case FormBorderStyle.FixedSingle: - baseStyle = (int) ( WindowStyles.WS_CAPTION ) | sysStyles; - exStyle = (int) ( WindowExStyles.WS_EX_WINDOWEDGE ); - break; - case FormBorderStyle.FixedToolWindow: - baseStyle = (int) ( WindowStyles.WS_CAPTION ) ; - exStyle = (int) ( WindowExStyles.WS_EX_WINDOWEDGE | WindowExStyles.WS_EX_TOOLWINDOW ); - break; - case FormBorderStyle.Sizable: - baseStyle = (int) ( WindowStyles.WS_OVERLAPPEDWINDOW ) | sysStyles; - exStyle = (int) ( WindowExStyles.WS_EX_WINDOWEDGE ); - break; - case FormBorderStyle.SizableToolWindow: - baseStyle = (int) ( WindowStyles.WS_OVERLAPPEDWINDOW ); - exStyle = (int) ( WindowExStyles.WS_EX_WINDOWEDGE | WindowExStyles.WS_EX_TOOLWINDOW ); - break; - } - } - - private int getSysStyles ( ) { - int sysStyles = 0; - if ( MinimizeBox ) - sysStyles |= (int)( WindowStyles.WS_MINIMIZEBOX ); - if ( MaximizeBox ) - sysStyles |= (int)( WindowStyles.WS_MAXIMIZEBOX ); - if ( ControlBox ) - sysStyles |= (int)( WindowStyles.WS_SYSMENU ); - return sysStyles; + int sysStyles = getSysStyles ( ); + + switch ( borderStyle ) { + case FormBorderStyle.Fixed3D: + baseStyle = (int) ( WindowStyles.WS_CAPTION ) | sysStyles; + exStyle = (int) ( WindowExStyles.WS_EX_OVERLAPPEDWINDOW ); + break; + case FormBorderStyle.FixedDialog: + baseStyle = (int) ( WindowStyles.WS_CAPTION ) | sysStyles; + exStyle = (int) ( WindowExStyles.WS_EX_DLGMODALFRAME | WindowExStyles.WS_EX_WINDOWEDGE ); + break; + case FormBorderStyle.FixedSingle: + baseStyle = (int) ( WindowStyles.WS_CAPTION ) | sysStyles; + exStyle = (int) ( WindowExStyles.WS_EX_WINDOWEDGE ); + break; + case FormBorderStyle.FixedToolWindow: + baseStyle = (int) ( WindowStyles.WS_CAPTION ) ; + exStyle = (int) ( WindowExStyles.WS_EX_WINDOWEDGE | WindowExStyles.WS_EX_TOOLWINDOW ); + break; + case FormBorderStyle.Sizable: + baseStyle = (int) ( WindowStyles.WS_OVERLAPPEDWINDOW ) | sysStyles; + exStyle = (int) ( WindowExStyles.WS_EX_WINDOWEDGE ); + break; + case FormBorderStyle.SizableToolWindow: + baseStyle = (int) ( WindowStyles.WS_OVERLAPPEDWINDOW ); + exStyle = (int) ( WindowExStyles.WS_EX_WINDOWEDGE | WindowExStyles.WS_EX_TOOLWINDOW ); + break; } + } - [MonoTODO] - public static SizeF GetAutoScaleSize(Font font){ - throw new NotImplementedException (); - } + private int getSysStyles ( ) + { + int sysStyles = 0; + if ( MinimizeBox ) + sysStyles |= (int)( WindowStyles.WS_MINIMIZEBOX ); + if ( MaximizeBox ) + sysStyles |= (int)( WindowStyles.WS_MAXIMIZEBOX ); + if ( ControlBox ) + sysStyles |= (int)( WindowStyles.WS_SYSMENU ); + return sysStyles; + } - private void getStartPosition ( ref CreateParams pars ) { - switch ( StartPosition ) { - case FormStartPosition.WindowsDefaultLocation: - pars.X = pars.Y = (int)CreateWindowCoordinates.CW_USEDEFAULT; - break; - case FormStartPosition.WindowsDefaultBounds: - pars.X = pars.Y = pars.Width = pars.Height = (int)CreateWindowCoordinates.CW_USEDEFAULT; - break; - case FormStartPosition.Manual: - // use location and size ( they are set in Control.CreateParams ) - break; - case FormStartPosition.CenterScreen: - // FIXME - break; - case FormStartPosition.CenterParent: - // FIXME - break; - } + private void getStartPosition ( ref CreateParams pars ) + { + switch ( StartPosition ) { + case FormStartPosition.WindowsDefaultLocation: + pars.X = pars.Y = (int)CreateWindowCoordinates.CW_USEDEFAULT; + break; + case FormStartPosition.WindowsDefaultBounds: + pars.X = pars.Y = pars.Width = pars.Height = (int)CreateWindowCoordinates.CW_USEDEFAULT; + break; + case FormStartPosition.Manual: + // use location and size ( they are set in Control.CreateParams ) + break; + case FormStartPosition.CenterScreen: + // FIXME + break; + case FormStartPosition.CenterParent: + // FIXME + break; } + } - //sub class - //System.Windows.Forms.Form.ControlCollection.cs - // - //Author: - // stubbed out by Daniel Carrera (dcarrera@math.toronto.edu) - // - // (C) 2002 Ximian, Inc - // - // - // <summary> - // This is only a template. Nothing is implemented yet. - // - // </summary> - // TODO: implement support classes and derive from - // proper classes - // FIXME: use this or the one defined on Control? - public class ControlCollection : - System.Windows.Forms.Control.ControlCollection { - /*,ICollection*/ - - // --- Constructor - // base class not defined (yet!) - public ControlCollection (Form owner) : base(owner) { - - } + //sub class + //System.Windows.Forms.Form.ControlCollection.cs + // + //Author: + // stubbed out by Daniel Carrera (dcarrera@math.toronto.edu) + // + // (C) 2002 Ximian, Inc + // + // + // <summary> + // This is only a template. Nothing is implemented yet. + // + // </summary> + // TODO: implement support classes and derive from + // proper classes + // FIXME: use this or the one defined on Control? + public class ControlCollectionX : + System.Windows.Forms.Control.ControlCollection + /*,ICollection*/ { + + // --- Constructor + // base class not defined (yet!) + public ControlCollectionX (Form owner) : base(owner) { + + } - // --- Public Methods + // --- Public Methods - // TODO: see what causes this compile error - public override void Add(Control value) { - base.Add (value); - } + // TODO: see what causes this compile error + public override void Add(Control value) { + base.Add (value); + } - public override bool Equals (object obj) { + public override bool Equals (object obj) { //FIXME: return base.Equals(obj); - } - - public override int GetHashCode () { - //FIXME add our proprities - return base.GetHashCode (); - } - - public override void Remove(Control value) { - base.Remove (value); - } - - } // end of Subclass - } - } + } + + public override int GetHashCode () { + //FIXME add our proprities + return base.GetHashCode (); + } + + public override void Remove(Control value) { + base.Remove (value); + } + } // end of Subclass + } + } diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/GroupBox.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/GroupBox.cs index 0c9f479808e..9fa973fe5bc 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/GroupBox.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/GroupBox.cs @@ -88,6 +88,10 @@ namespace System.Windows.Forms { Invalidate ( ); } + protected virtual void OnPaintBackground (PaintEventArgs e) + { + } + public override string Text { get { return base.Text; } set { diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ImageList.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ImageList.cs index ebfaf80e366..3d2104d9ceb 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/ImageList.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ImageList.cs @@ -58,11 +58,6 @@ namespace System.Windows.Forms { } [MonoTODO] - protected override void Dispose(bool disposing){ - base.Dispose(disposing); - } - - [MonoTODO] public IntPtr Handle { get { if ( !HandleCreated ) diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/InputLanguage.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/InputLanguage.cs index 5930b05cb1a..31d6a1f4de8 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/InputLanguage.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/InputLanguage.cs @@ -62,10 +62,10 @@ namespace System.Windows.Forms { // --- Public Methods // [MonoTODO] - public override bool Equals(object value) + public override bool Equals(object obj) { //FIXME: - return base.Equals(value); + return base.Equals(obj); } [MonoTODO] diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/KeyEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/KeyEventArgs.cs index f87c491c8e0..d2aa045a4d2 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/KeyEventArgs.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/KeyEventArgs.cs @@ -99,7 +99,7 @@ namespace System.Windows.Forms { } [ComVisible(true)] - public virtual bool Shift + public bool Shift { get { return (keydata == Keys.Shift); diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Label.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Label.cs index d8e139e72cd..fdd04ca3a09 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/Label.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Label.cs @@ -135,13 +135,13 @@ namespace System.Windows.Forms { } } - public virtual int PreferredHeight { + public int PreferredHeight { get { return preferred_height; } } - public virtual int PreferredWidth { + public int PreferredWidth { get { return preferred_width; } @@ -194,7 +194,6 @@ namespace System.Windows.Forms { (int)SS_Static_Control_Types.SS_LEFT | (int)WindowStyles.WS_CLIPCHILDREN | (int)WindowStyles.WS_CLIPSIBLINGS | - (int)SS_Static_Control_Types.SS_OWNERDRAW | bs); return createParams; @@ -207,14 +206,14 @@ namespace System.Windows.Forms { } } - protected new virtual bool RenderTransparent { - get { - return render_transparent; - } - set { + protected virtual bool RenderTransparent { + get { + return render_transparent; + } + set { //FIXME: - } } + } protected override ImeMode DefaultImeMode { get { @@ -234,13 +233,8 @@ namespace System.Windows.Forms { } [MonoTODO] - protected override void Dispose(bool disposing){ - base.Dispose(disposing); - } - - [MonoTODO] - protected Rectangle CalcImageRenderBounds ( - Image image, Rectangle r, ContentAlignment align) + protected Rectangle CalcImageRenderBounds ( + Image image, Rectangle rect, ContentAlignment align) { throw new NotImplementedException (); } @@ -253,7 +247,7 @@ namespace System.Windows.Forms { } [MonoTODO] - protected void DrawImage (Graphics g, Image image, + protected void DrawImage (Graphics g, Image img, Rectangle r, ContentAlignment align) { //FIXME: @@ -351,9 +345,8 @@ namespace System.Windows.Forms { //Compact Framework protected override void OnTextChanged (EventArgs e) { + //FIXME: base.OnTextChanged (e); - Invalidate (); - Refresh (); } protected override void OnVisibleChanged (EventArgs e) @@ -366,32 +359,32 @@ namespace System.Windows.Forms { return base.ProcessMnemonic (charCode); } -// [MonoTODO] -// protected new ContentAlignment RtlTranslateAlignment ( -// ContentAlignment alignment) -// { -// throw new NotImplementedException (); -// } -// -// [MonoTODO] -// protected new HorizontalAlignment RtlTranslateAlignment ( -// HorizontalAlignment alignment) -// { -// throw new NotImplementedException (); -// } -// -// [MonoTODO] -// protected new LeftRightAlignment RtlTranslateAlignment ( -// LeftRightAlignment align) -// { -// throw new NotImplementedException (); -// } -// -// [MonoTODO] -// protected new virtual void Select (bool directed, bool forward) -// { -// //FIXME: -// } + [MonoTODO] + protected new ContentAlignment RtlTranslateAlignment ( + ContentAlignment alignment) + { + throw new NotImplementedException (); + } + + [MonoTODO] + protected new HorizontalAlignment RtlTranslateAlignment ( + HorizontalAlignment alignment) + { + throw new NotImplementedException (); + } + + [MonoTODO] + protected new LeftRightAlignment RtlTranslateAlignment ( + LeftRightAlignment align) + { + throw new NotImplementedException (); + } + + [MonoTODO] + protected new virtual void Select (bool directed, bool forward) + { + //FIXME: + } protected override void SetBoundsCore ( int x, int y, int width, int height, @@ -400,24 +393,24 @@ namespace System.Windows.Forms { base.SetBoundsCore (x, y, width, height, specified); } -// protected new void UpdateBounds() -// { -// base.UpdateBounds (); -// } -// -// protected new void UpdateBounds (int x, int y, -// int width, int height) -// { -// base.UpdateBounds (x, y, width, height); -// } -// -// -// protected new void UpdateBounds (int x, int y, int width, -// int height, int clientWidth, -// int clientHeight) -// { -// base.UpdateBounds (x, y, width, height, clientWidth, clientHeight); -// } + protected new void UpdateBounds() + { + base.UpdateBounds (); + } + + protected new void UpdateBounds (int x, int y, + int width, int height) + { + base.UpdateBounds (x, y, width, height); + } + + + protected new void UpdateBounds (int x, int y, int width, + int height, int clientWidth, + int clientHeight) + { + base.UpdateBounds (x, y, width, height, clientWidth, clientHeight); + } protected override void WndProc(ref Message m) { diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ListBox.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ListBox.cs index 204df00e907..06afa51b52d 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/ListBox.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ListBox.cs @@ -33,18 +33,18 @@ namespace System.Windows.Forms { // // --- Protected Fields // - internal int ColumnWidth_ = 0; // The columns will have default width - internal bool IntegralHeight_ = true; - internal ListBox.ObjectCollection Items_ = null; - internal ListBox.SelectedIndexCollection SelectedIndices_ = null; - internal ListBox.SelectedObjectCollection SelectedObjects_ = null; - internal DrawMode DrawMode_ = DrawMode.Normal; - internal bool UseTabStops_ = false; - internal bool MultiColumn_ = false; + protected int ColumnWidth_ = 0; // The columns will have default width + protected bool IntegralHeight_ = true; + protected ListBox.ObjectCollection Items_ = null; + protected ListBox.SelectedIndexCollection SelectedIndices_ = null; + protected ListBox.SelectedObjectCollection SelectedObjects_ = null; + protected DrawMode DrawMode_ = DrawMode.Normal; + protected bool UseTabStops_ = false; + protected bool MultiColumn_ = false; int selectedIndex = -1; - internal bool Sorted_ = false; + bool Sorted_ = false; internal int prevSelectedIndex = -1; - internal BorderStyle BorderStyle_; + BorderStyle BorderStyle_; // // --- Public Fields @@ -56,17 +56,6 @@ namespace System.Windows.Forms { // // --- Public Properties // - [MonoTODO] - public override Color ForeColor { - get { - //FIXME: - return base.ForeColor; - } - set { - //FIXME: - base.ForeColor = value; - } - } [MonoTODO] public override Color BackColor { @@ -104,16 +93,6 @@ namespace System.Windows.Forms { } } } - - [MonoTODO] - public int HorizontalExtent { - get { - throw new NotImplementedException (); - } - set { - //Fixme - } - } public bool MultiColumn { get { return MultiColumn_; @@ -156,13 +135,6 @@ namespace System.Windows.Forms { // FIXME } } - - [MonoTODO] - public int PreferredHeight { - get { - throw new NotImplementedException (); - } - } [MonoTODO] public override int SelectedIndex { @@ -430,6 +402,11 @@ namespace System.Windows.Forms { } } + protected override void OnCreateControl () + { + base.OnCreateControl(); + } + [MonoTODO] protected override Size DefaultSize { get { @@ -440,12 +417,6 @@ namespace System.Windows.Forms { // // --- Protected Methods // - - [MonoTODO] - protected virtual void AddItemsCore(object [] value) { - //Fixme - } - [MonoTODO] protected virtual ObjectCollection CreateItemCollection() { return new ListBox.ObjectCollection( this); @@ -542,23 +513,10 @@ namespace System.Windows.Forms { //FIXME: base.SetBoundsCore(x, y, width, height, specified); } - - [MonoTODO] - protected override void SetItemCore (int index, object value) { - //FIXME: - } - - protected override void SetItemsCore (IList value){ - } - [MonoTODO] protected virtual void Sort() { //FIXME: } - - protected virtual void WmReflectCommand(ref Message m){ - throw new NotImplementedException (); - } [MonoTODO] protected override void WndProc(ref Message m) { diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ListControl.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ListControl.cs index ec9345e22a7..268b39aba9b 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/ListControl.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ListControl.cs @@ -4,13 +4,11 @@ // Author: // stubbed out by Daniel Carrera (dcarrera@math.toronto.edu) // Dennis Hayes (dennish@raytek.com) -// Brian Takita (brian.takita@runbox.com) // (C) 2002/3 Ximian, Inc // using System; using System.Drawing; using System.Collections; -using System.ComponentModel; using System.Reflection; namespace System.Windows.Forms { @@ -19,11 +17,10 @@ namespace System.Windows.Forms { // // </summary> - public abstract class ListControl : Control { + public abstract class ListControl : Control { - internal string DisplayMember_ = String.Empty; + protected string DisplayMember_ = String.Empty; - internal object DataSource_; //ControlStyles controlStyles; // // --- Public Properties @@ -31,18 +28,10 @@ namespace System.Windows.Forms { [MonoTODO] public object DataSource { get { - return DataSource_; + throw new NotImplementedException (); } set { - if (DataSource_ != value) { - if ((value is IList) || (value is IListSource)) { - DataSource_ = value; - OnDataSourceChanged (new EventArgs ()); - - } else { - throw new Exception ("Complex DataBinding accepts as a data source either an IList or an IListSource"); - } - } + //FIXME: } } [MonoTODO] @@ -51,27 +40,27 @@ namespace System.Windows.Forms { return DisplayMember_; } set { - if (DisplayMember_ != value) { + if( DisplayMember_ != value) { DisplayMember_ = value; OnDisplayMemberChanged(new EventArgs()); } } } - internal string getDisplayMemberOfObj (object obj) { + internal string getDisplayMemberOfObj( object obj) { string objectString = String.Empty; Type t = obj.GetType(); - - if (DisplayMember != String.Empty) { - if (t != null) { - PropertyInfo prop = t.GetProperty (DisplayMember); - if (prop != null) - objectString = prop.GetValue (obj, null).ToString (); + if( DisplayMember != String.Empty) { + if( t != null) { + PropertyInfo prop = t.GetProperty(DisplayMember); + if( prop != null) { + objectString = prop.GetValue(obj, null).ToString(); + } } } - if (objectString == String.Empty) + if( objectString == String.Empty) { objectString = obj.ToString(); - + } return objectString; } @@ -81,9 +70,8 @@ namespace System.Windows.Forms { owner_ = owner; } - public int Compare(object x, object y) { - return owner_.getDisplayMemberOfObj(x).CompareTo (owner_.getDisplayMemberOfObj (y)); + return owner_.getDisplayMemberOfObj(x).CompareTo(owner_.getDisplayMemberOfObj(y)); } } @@ -115,7 +103,8 @@ namespace System.Windows.Forms { // [MonoTODO] - public string GetItemText (object item) { + public string GetItemText(object item) + { throw new NotImplementedException (); } @@ -131,7 +120,8 @@ namespace System.Windows.Forms { // --- Protected Constructor // [MonoTODO] - protected ListControl () { + protected ListControl() + { } @@ -148,62 +138,43 @@ namespace System.Windows.Forms { // // --- Protected Methods // - - [MonoTODO] - protected object FilterItemOnProperty(object item){ - throw new NotImplementedException (); - } - [MonoTODO] - protected object FilterItemOnProperty(object item, string field){ - throw new NotImplementedException (); - } - - [MonoTODO] - protected override bool IsInputKey (Keys keyData) { + protected override bool IsInputKey(Keys keyData) + { //FIXME: return base.IsInputKey(keyData); } [MonoTODO] - protected virtual void OnDataSourceChanged (EventArgs e) { + protected virtual void OnDataSourceChanged(EventArgs e) { //FIXME: } [MonoTODO] - protected virtual void OnDisplayMemberChanged (EventArgs e) { + protected virtual void OnDisplayMemberChanged(EventArgs e) { //FIXME: } [MonoTODO] - protected virtual void OnSelectedIndexChanged (EventArgs e) { + protected virtual void OnSelectedIndexChanged(EventArgs e) { //FIXME: } [MonoTODO] - protected virtual void OnSelectedValueChanged (EventArgs e) { + protected virtual void OnSelectedValueChanged(EventArgs e){ //FIXME: } - + public event EventHandler SelectedValueChanged; public event EventHandler ValueMemberChanged; [MonoTODO] - protected override void OnBindingContextChanged (EventArgs e) { + protected override void OnBindingContextChanged(EventArgs e) + { //FIXME: base.OnBindingContextChanged(e); } - - [MonoTODO] - protected virtual void OnValueMemberChanged (EventArgs e) { - //FIXME: - } [MonoTODO] - protected virtual void SetItemCore (int index, object value) { - //FIXME: - } - protected abstract void SetItemsCore (IList items); + protected abstract void RefreshItem(int index); - [MonoTODO] - protected abstract void RefreshItem (int index); - } + } } diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ListView.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ListView.cs index d7bff3ee6e9..4f1c44ae555 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/ListView.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ListView.cs @@ -121,12 +121,6 @@ namespace System.Windows.Forms { throw new NotImplementedException (); } } - - [MonoTODO] - protected override void Dispose(bool disposing){ - base.Dispose(disposing); - } - [MonoTODO] public override Color ForeColor { get { diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ListViewItem.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ListViewItem.cs index 391a9a9d841..a4c050eb478 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/ListViewItem.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ListViewItem.cs @@ -233,6 +233,17 @@ namespace System.Windows.Forms { //FIXME: } [MonoTODO] + public override bool Equals(object obj) + { + //FIXME: + return base.Equals(obj); + } + [MonoTODO] + public override int GetHashCode() { + //FIXME add our proprities + return base.GetHashCode(); + } + [MonoTODO] public Rectangle GetBounds(ItemBoundsPortion portion) { throw new NotImplementedException (); diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/MainMenu.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/MainMenu.cs index 656a456c3f9..e8692226d72 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/MainMenu.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/MainMenu.cs @@ -66,16 +66,6 @@ namespace System.Windows.Forms { } // - // --- protected Methods - // - - [MonoTODO] - protected override void Dispose(bool disposing){ - base.Dispose(disposing); - } - - - // // -- Public Properties // diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Menu.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Menu.cs index 64d150fb1f0..00159390da3 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/Menu.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Menu.cs @@ -25,21 +25,11 @@ namespace System.Windows.Forms { using System.ComponentModel; public abstract class Menu : Component { - // Static Constant Fields - public const int FindHandle = 0; - public const int FindShortCut = 1; - - // // -- Public Methods // [MonoTODO] - public MenuItem FindMenuItem(int type, IntPtr value) { - throw new NotImplementedException(); - } - - [MonoTODO] public ContextMenu GetContextMenu() { throw new NotImplementedException(); } @@ -77,23 +67,10 @@ namespace System.Windows.Forms { // -- Protected Methods // - - [MonoTODO] protected void CloneMenu(Menu menuSrc) { // FIXME: } - [MonoTODO] - protected override void Dispose(bool disposing) { - // FIXME: - base.Dispose(disposing); - } - - [MonoTODO] - protected int FindMergePosition(int mergeOrder) { - throw new NotImplementedException(); - } - protected Menu( MenuItem[] items) { MenuItems.AddRange ( items); } @@ -133,16 +110,11 @@ namespace System.Windows.Forms { } } - internal Menu parent_ = null; + protected Menu parent_ = null; - internal IntPtr menuHandle_ = IntPtr.Zero; - internal bool isPopupMenu = false; - -// [MonoTODO] -// protected virtual int CreateMenuHandle() { -// throw new NotImplementedException(); -// // FIXME: -// } + protected IntPtr menuHandle_ = IntPtr.Zero; + protected bool isPopupMenu = false; + internal void CreateMenuHandle() { if( menuHandle_ == IntPtr.Zero) { if ( !isPopupMenu ) diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/MenuItem.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/MenuItem.cs index 31d9bbb5a73..cd0ee3b39be 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/MenuItem.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/MenuItem.cs @@ -123,15 +123,11 @@ namespace System.Windows.Forms { MenuItems.AddRange(all_items); } } - [MonoTODO] - protected override void Dispose(bool disposing){ - base.Dispose(disposing); - } -// ~MenuItem() { -// //FIXME: free resources -// //throw new NotImplementedException (); -// } + ~MenuItem() { + //FIXME: free resources + //throw new NotImplementedException (); + } protected virtual void OnClick(EventArgs e) { if( Click != null){ diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/MonthCalendar.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/MonthCalendar.cs index e2caa72a799..ddc8b0b5f2e 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/MonthCalendar.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/MonthCalendar.cs @@ -44,6 +44,50 @@ namespace System.Windows.Forms { public void RemoveAllAnnuallyBoldedDates() { //FIXME: } + //[MonoTODO] + //public void BringToFront() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public void CreateControl() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public void Hide() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public void Invalidate() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public void Invalidate(bool b) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public void Invalidate(Rectangle r) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public void Invalidate(Region rg) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public void Invalidate(Rectangle r, bool b) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public void Invalidate(Region rg, bool b) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public void PerformLayout() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public void PerformLayout(Control ctl, string s) { + // throw new NotImplementedException (); + //} [MonoTODO] public void RemoveAllBoldedDates() { //FIXME: @@ -64,6 +108,42 @@ namespace System.Windows.Forms { public void RemoveMonthlyBoldedDate(DateTime date) { //FIXME: } + //[MonoTODO] + //public void ResetBindings() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public void ResetImeMode() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public void ResumeLayout() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public void ResumeLayout(bool b) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public void Scale(float ft) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public void Scale(float ft, float ft1) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public void Select() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public void SendToBack() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public void SetBounds(int i, int i1, int i2, int i3) { + // throw new NotImplementedException (); + //} [MonoTODO] public void SetCalendarDimensions(int x, int y) { //FIXME: @@ -76,18 +156,86 @@ namespace System.Windows.Forms { public void SetSelectionRange(DateTime date1, DateTime date2) { //FIXME: } + //[MonoTODO] + //public void Show() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public void SuspendLayout() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public void Update() { + // throw new NotImplementedException (); + //} [MonoTODO] public void UpdateBoldedDates() { //FIXME: } + //[MonoTODO] + //public IAsyncResult BeginInvoke(Delegate dels) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public IAsyncResult BeginInvoke(Delegate dels, object[] objs) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public bool Contains(Control ctl) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public Graphics CreateGraphics() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public DragDropEffects DoDragDrop(object o, DragDropEffects dde) { + // throw new NotImplementedException (); + //} [MonoTODO] public object EndEnvoke(IAsyncResult asyncResult) { throw new NotImplementedException (); } + //[MonoTODO] + //public static bool Equals(object o, object o1) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public Form FindForm() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public bool Focus() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public Control GetChildAtPoint(Point pt) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public IContainerControl GetContainerControl() { + // throw new NotImplementedException (); + //} [MonoTODO] public SelectionRange GetDisplayRange(bool visible) { throw new NotImplementedException (); } + //[MonoTODO] + //public virtual int GetHashCode() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public object GetLifetimeService() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public Control GetNextControl(Control ctl, bool b) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public Type GetType() { + // throw new NotImplementedException (); + //} [MonoTODO] public HitTestInfo HitTest(Point point) { throw new NotImplementedException (); @@ -96,16 +244,133 @@ namespace System.Windows.Forms { public HitTestInfo HitTest(int x, int y) { throw new NotImplementedException (); } + //[MonoTODO] + //public virtual object InitializeLifetimeService() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public object Invoke(Delegate d) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public object Invoke(Delegate d, object[] obj) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public Point PointToClient(Point pt) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public Point PointToScreen(Point pt) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public Rectangle RectangleToClient(Rectangle r) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public Rectangle RectangleToScreen(Rectangle r) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public bool SelectNextControl(Control ctl, bool b, bool b1, bool b2, bool b3) { + // throw new NotImplementedException (); + //} [MonoTODO] public override string ToString() { //FIXME: return base.ToString(); } + //[MonoTODO] + //public virtual ObjRef CreateObjRef(Type reqType) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public virtual bool Equals(object o) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public virtual bool PreProcessMessage(ref Message msg) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public virtual void Refresh() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public virtual void ResetBackColor() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public virtual void ResetCursor() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public virtual void ResetFont() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public virtual void ResetForeColor() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public virtual void ResetRightToLeft() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public virtual void ResetText() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //public virtual void Select(bool b, bool b1) { + // throw new NotImplementedException (); + //} // // --- Public Properties // [MonoTODO] + public AccessibleObject AccessibilityObject { + get { + throw new NotImplementedException (); + } + } + [MonoTODO] + public string AccessibleDefaultActionDescription { + get { + throw new NotImplementedException (); + } + set { + } + } + [MonoTODO] + public string AccessibleDescription { + get { + throw new NotImplementedException (); + } + set { + //FIXME: + } + } + //[MonoTODO] + //public string AccessibleName { + // get { + // throw new NotImplementedException (); + // } + // set { + // //FIXME: + // } + //} + [MonoTODO] + public AccessibleRole AccessibleRole { + get { + throw new NotImplementedException (); + } + set { + //FIXME: + } + } + [MonoTODO] public override bool AllowDrop { get { throw new NotImplementedException (); @@ -169,6 +434,21 @@ namespace System.Windows.Forms { } } [MonoTODO] + public int Bottom { + get { + throw new NotImplementedException (); + } + } + [MonoTODO] + public Rectangle Bounds { + get { + throw new NotImplementedException (); + } + set { + //FIXME: + } + } + [MonoTODO] public Size CalendarDimensions { get { throw new NotImplementedException (); @@ -178,6 +458,127 @@ namespace System.Windows.Forms { } } [MonoTODO] + public bool CanFocus { + get { + throw new NotImplementedException (); + } + } + [MonoTODO] + public bool CanSelect { + get { + throw new NotImplementedException (); + } + } + [MonoTODO] + public bool Capture { + get { + throw new NotImplementedException (); + } + set { + //FIXME: + } + } + [MonoTODO] + public bool CausesValidation { + get { + throw new NotImplementedException (); + } + set { + //FIXME: + } + } + [MonoTODO] + public Rectangle ClientRectangle { + get { + throw new NotImplementedException (); + } + } + [MonoTODO] + public Size ClientSize { + get { + throw new NotImplementedException (); + } + set { + //FIXME: + } + } + [MonoTODO] + public string CompanyName { + get { + throw new NotImplementedException (); + } + } + [MonoTODO] + public IContainer Container { + get { + throw new NotImplementedException (); + } + } + [MonoTODO] + public bool ContainsFocus { + get { + throw new NotImplementedException (); + } + } + [MonoTODO] + public override ContextMenu ContextMenu { + get { + throw new NotImplementedException (); + } + set { + //FIXME: + } + } + [MonoTODO] + public Control.ControlCollection Controls { + get { + throw new NotImplementedException (); + } + } + [MonoTODO] + public bool Created { + get { + throw new NotImplementedException (); + } + } + [MonoTODO] + public override Cursor Cursor { + get { + throw new NotImplementedException (); + } + set { + //FIXME: + } + } + [MonoTODO] + public ControlBindingsCollection DataBindings { + get { + throw new NotImplementedException (); + } + } + [MonoTODO] + public override Rectangle DisplayRectangle { + get { + throw new NotImplementedException (); + } + } + [MonoTODO] + public bool Disposing { + get { + throw new NotImplementedException (); + } + } + [MonoTODO] + public override DockStyle Dock { + get { + throw new NotImplementedException (); + } + set { + //FIXME: + } + } + + [MonoTODO] public Day FirstDayOfWeek { get { throw new NotImplementedException (); @@ -187,6 +588,21 @@ namespace System.Windows.Forms { } } [MonoTODO] + public override bool Focused { + get { + throw new NotImplementedException (); + } + } + [MonoTODO] + public override Font Font { + get { + throw new NotImplementedException (); + } + set { + //FIXME: + } + } + [MonoTODO] public override Color ForeColor { get { throw new NotImplementedException (); @@ -196,6 +612,60 @@ namespace System.Windows.Forms { } } [MonoTODO] + public bool HasChildren { + get { + throw new NotImplementedException (); + } + } + [MonoTODO] + public int Height { + get { + throw new NotImplementedException (); + } + set { + //FIXME: + } + } + [MonoTODO] + public bool IsAccessible { + get { + throw new NotImplementedException (); + } + set { + //FIXME: + } + } + [MonoTODO] + public bool IsDisposed { + get { + throw new NotImplementedException (); + } + } + [MonoTODO] + public bool IsHandleCreated { + get { + throw new NotImplementedException (); + } + } + [MonoTODO] + public int Left { + get { + throw new NotImplementedException (); + } + set { + //FIXME: + } + } + [MonoTODO] + public Point Location { + get { + throw new NotImplementedException (); + } + set { + //FIXME: + } + } + [MonoTODO] public DateTime MaxDate { get { throw new NotImplementedException (); @@ -232,6 +702,66 @@ namespace System.Windows.Forms { } } [MonoTODO] + public string Name { + get { + throw new NotImplementedException (); + } + set { + //FIXME: + } + } + [MonoTODO] + public Control Parent { + get { + throw new NotImplementedException (); + } + set { + //FIXME: + } + } + [MonoTODO] + public string ProductName { + get { + throw new NotImplementedException (); + } + } + [MonoTODO] + public string ProductVersion { + get { + throw new NotImplementedException (); + } + } + [MonoTODO] + public bool RecreatingHandle { + get { + throw new NotImplementedException (); + } + } + [MonoTODO] + public Region Region { + get { + throw new NotImplementedException (); + } + set { + //FIXME: + } + } + [MonoTODO] + public int Right { + get { + throw new NotImplementedException (); + } + } + [MonoTODO] + public override RightToLeft RightToLeft { + get { + throw new NotImplementedException (); + } + set { + //FIXME: + } + } + [MonoTODO] public int ScrollChange { get { throw new NotImplementedException (); @@ -301,6 +831,51 @@ namespace System.Windows.Forms { } } [MonoTODO] + public override ISite Site { + get { + throw new NotImplementedException (); + } + set { + //FIXME: + } + } + [MonoTODO] + public Size Size { + get { + throw new NotImplementedException (); + } + set { + //FIXME: + } + } + [MonoTODO] + public int TabIndex { + get { + throw new NotImplementedException (); + } + set { + //FIXME: + } + } + [MonoTODO] + public bool TabStop { + get { + throw new NotImplementedException (); + } + set { + //FIXME: + } + } + [MonoTODO] + public object Tag { + get { + throw new NotImplementedException (); + } + set { + //FIXME: + } + } + [MonoTODO] public override string Text { get { //FIXME: @@ -345,6 +920,21 @@ namespace System.Windows.Forms { } } [MonoTODO] + public int Top { + get { + throw new NotImplementedException (); + } + set { + //FIXME: + } + } + [MonoTODO] + public Control TopLevelControl { + get { + throw new NotImplementedException (); + } + } + [MonoTODO] public Color TrailingForeColor { get { throw new NotImplementedException (); @@ -353,6 +943,24 @@ namespace System.Windows.Forms { //FIXME: } } + [MonoTODO] + public bool Visible { + get { + throw new NotImplementedException (); + } + set { + //FIXME: + } + } + [MonoTODO] + public int Width { + get { + throw new NotImplementedException (); + } + set { + //FIXME: + } + } // // --- Protected Methods @@ -362,10 +970,22 @@ namespace System.Windows.Forms { //FIXME: base.CreateHandle(); } + //[MonoTODO] + //protected bool GetStyle(ControlStyles flag) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected bool GetTopLevel() { + // throw new NotImplementedException (); + //} [MonoTODO] protected override bool IsInputKey(Keys keyData) { throw new NotImplementedException (); } + //[MonoTODO] + //protected object MemberwiseClone() { + // throw new NotImplementedException (); + //} [MonoTODO] protected override void OnBackColorChanged(EventArgs e) { //FIXME: @@ -375,6 +995,34 @@ namespace System.Windows.Forms { //FIXME: } [MonoTODO] + protected internal virtual bool ProcessKeyMessage(ref Message m) { + throw new NotImplementedException (); + } + //[MonoTODO] + //protected ContentAlignment RtlTranslateAlignment(ContentAlignment align) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected HorizontalAlignment RtlTranslateAlignment(HorizontalAlignment align) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected LeftRightAlignment RtlTranslateAlignment(LeftRightAlignment align) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected ContentAlignment RtlTranslateContent(ContentAlignment align) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected HorizontalAlignment RtlTranslateHorizontal(HorizontalAlignment align) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected LeftRightAlignment RtlTranslateLeftRight(LeftRightAlignment align) { + // throw new NotImplementedException (); + //} + [MonoTODO] protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified) { //FIXME: } @@ -386,6 +1034,50 @@ namespace System.Windows.Forms { { //FIXME: } + //[MonoTODO] + //protected virtual void InitLayout() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnBackgroundImageChanged(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnBindingContextChanged(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnCausesValidationChanged(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnChangeUICues(UICuesEventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnClick(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnContextMenuChanged(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnControlAdded(ControlEventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnControlRemoved(ControlEventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnCreateControl() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnCursorChanged(EventArgs e) { + // throw new NotImplementedException (); + //} [MonoTODO] protected virtual void OnDateChanged(DateRangeEventArgs drevent) { //FIXME: @@ -394,6 +1086,38 @@ namespace System.Windows.Forms { protected virtual void OnDateSelected(DateRangeEventArgs drevent) { //FIXME: } + //[MonoTODO] + //protected virtual void OnDockChanged(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnDoubleClick(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnDragDrop(DragEventArgs drgevent) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnDragEnter(DragEventArgs drgevent) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnDragLeave(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnDragOver(DragEventArgs drgevent) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnEnabledChanged(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnEnter(EventArgs e) { + // throw new NotImplementedException (); + //} [MonoTODO] protected override void OnFontChanged(EventArgs e) { //FIXME: @@ -402,6 +1126,309 @@ namespace System.Windows.Forms { protected override void OnForeColorChanged(EventArgs e) { //FIXME: } + //[MonoTODO] + //protected virtual void OnGiveFeedback(GiveFeedbackEventArgs gfbevent) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnGotFocus(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnHandleDestroyed(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnHelpRequested(HelpEventArgs hevent) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnImeModeChanged(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnInvalidated(InvalidateEventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnKeyDown(KeyEventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnKeyPress(KeyPressEventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnKeyUp(KeyEventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnLayout(LayoutEventArgs levent) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnLeave(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnLocationChanged(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnLostFocus(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnMouseDown(MouseEventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnMouseEnter(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnMouseHover(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnMouseLeave(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnMouseMove(MouseEventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnMouseUp(MouseEventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnMouseWheel(MouseEventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnMove(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnNotifyMessage(Message m) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnPaint(PaintEventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnPaintBackground(PaintEventArgs pevent) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnParentBackColorChanged(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnParentBackgroundImageChanged(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnParentBindingContextChanged(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnParentChanged(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnParentEnabledChanged(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnParentFontChanged(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnParentForeColorChanged(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnParentRightToLeftChanged(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnParentVisibleChanged(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnQueryContinueDrag(QueryContinueDragEventArgs qcdevent) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnResize(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnRightToLeftChanged(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnSizeChanged(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnStyleChanged(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnSystemColorsChanged(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnTabIndexChanged(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnTabStopChanged(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnTextChanged(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnValidated(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnValidating(CancelEventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void OnVisibleChanged(EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void ScaleCore(float dx,float dy) { + // throw new NotImplementedException (); + //} + // [MonoTODO] + // protected virtual void Select(bool b, bool b1) + // { + // throw new NotImplementedException (); + // } + //[MonoTODO] + //protected virtual void SetClientSizeCore(int x, int y) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void SetVisibleCore(bool value) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected void AccessibilityNotifyClients(AccessibleEvents accEvent, int i) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected void InvokeGotFocus(Control toInvoke, EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected void InvokeLostFocus(Control toInvoke, EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected void InvokeOnClick(Control toInvoke, EventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected void InvokePaint(Control c, PaintEventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected void InvokePaintBackground(Control c, PaintEventArgs e) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected void RecreateHandle() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected void SetStyle(ControlStyles flag, bool value) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected void SetTopLevel(bool value) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected void UpdateBounds() { + // throw new NotImplementedException (); + //} + // [MonoTODO] + // protected void UpdateBounds(int x, int y, int width, int height); + // { + // throw new NotImplementedException (); + // } + // [MonoTODO] + // protected void UpdateBounds(int x, int y, int width, int height, int clientWidth, intclientHeigth); + // { + // throw new NotImplementedException (); + // } + //[MonoTODO] + //protected void UpdateStyles() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected void UpdateZOrder() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual AccessibleObject CreateAccessibilityInstance() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual ControlCollection CreateControlsInstance() { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void DefWndProc(ref Message m) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual void DestroyHandle() { + // throw new NotImplementedException (); + //} + [MonoTODO] + protected virtual object GetService(Type service) { + throw new NotImplementedException (); + } + //[MonoTODO] + //protected virtual bool IsInputChar(char charCode) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual bool ProcessCmdKey(ref Message msg, Keys keyData) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual bool ProcessDialogChar(char charCode) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual bool ProcessDialogKey(Keys keyData) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual bool ProcessKeyEventArgs(ref Message m) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual bool ProcessKeyPreview(ref Message m) { + // throw new NotImplementedException (); + //} + //[MonoTODO] + //protected virtual bool ProcessMnemonic(char charCode) { + // throw new NotImplementedException (); + //} // // --- Protected Properties @@ -425,6 +1452,48 @@ namespace System.Windows.Forms { return new Size (100, 100); } } + [MonoTODO] + protected bool DesignMode { + get { + throw new NotImplementedException (); + } + } + [MonoTODO] + protected bool ResizeRedraw { + get { + throw new NotImplementedException (); + } + set { + throw new NotImplementedException (); + } + } + [MonoTODO] + protected EventHandlerList Events { + get { + throw new NotImplementedException (); + } + } + [MonoTODO] + protected bool ShowKeyboardCues { + get { + throw new NotImplementedException (); + } + } + [MonoTODO] + protected int FontHeight { + get { + throw new NotImplementedException (); + } + set { + //FIXME: + } + } + [MonoTODO] + protected override bool ShowFocusCues { + get { + throw new NotImplementedException (); + } + } public enum HitArea { Nowhere = 0, @@ -446,8 +1515,62 @@ namespace System.Windows.Forms { // // --- Public Events // + public event EventHandler BackColorChanged; + public event EventHandler BackgroundImageChanged; + public event EventHandler BindingContextChanged; + public event EventHandler CausesValidationChanged; + public event UICuesEventHandler ChangeUICues; + public event EventHandler ContextMenuChanged; + public event ControlEventHandler ControlAdded; + public event ControlEventHandler ControlRemoved; + public event EventHandler CursorChanged; public event DateRangeEventHandler DateChanged; public event DateRangeEventHandler DateSelected; + public event EventHandler DockChanged; + public event DragEventHandler DragDrop; + public event DragEventHandler DragEnter; + public event EventHandler DragLeave; + public event DragEventHandler DragOver; + public event EventHandler EnabledChanged; + public event EventHandler Enter; + public event EventHandler FontChanged; + public event EventHandler ForeColorChanged; + public event GiveFeedbackEventHandler GiveFeedback; + public event EventHandler GotFocus; + public event EventHandler HandleCreated; + public event EventHandler HandleDestroyed; + public event HelpEventHandler HelpRequested; + public event EventHandler ImeModeChanged; + public event InvalidateEventHandler Invalidated; + public event KeyEventHandler KeyDown; + public event KeyPressEventHandler KeyPress; + public event KeyEventHandler KeyUp; + public event LayoutEventHandler Layout; + public event EventHandler Leave; + public event EventHandler LocationChanged; + public event EventHandler LostFocus; + public event MouseEventHandler MouseDown; + public event EventHandler MouseEnter; + public event EventHandler MouseHover; + public event EventHandler MouseLeave; + public event MouseEventHandler MouseMove; + public event MouseEventHandler MouseUp; + public event MouseEventHandler MouseWheel; + public event EventHandler Move; + public event EventHandler ParentChanged; + public event QueryAccessibilityHelpEventHandler QueryAccessibilityHelp; + public event QueryContinueDragEventHandler QueryContinueDrag; + public event EventHandler Resize; + public event EventHandler RightToLeftChanged; + public event EventHandler SizeChanged; + public event EventHandler StyleChanged; + public event EventHandler SystemColorsChanged; + public event EventHandler TabIndexChanged; + public event EventHandler TabStopChanged; + public event EventHandler TextChanged; + public event EventHandler Validated; + public event CancelEventHandler Validating; + public event EventHandler VisibleChanged; // // System.Windows.Forms.MonthCalendar.HitTestInfo.cs @@ -466,12 +1589,12 @@ namespace System.Windows.Forms { // // --- Public Properties // - [MonoTODO] - public MonthCalendar.HitArea HitArea { - get { - throw new NotImplementedException (); - } - } + // [MonoTODO] + // public MonthCalendar.HitArea HitArea { + // get { + // throw new NotImplementedException (); + // } + // } [MonoTODO] public Point Point { get { diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/PictureBox.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/PictureBox.cs index 0adac52abcf..1e4b8071473 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/PictureBox.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/PictureBox.cs @@ -124,38 +124,32 @@ namespace System.Windows.Forms { } } } - [MonoTODO] - protected override void Dispose(bool disposing) { - base.Dispose(disposing); - } - - [MonoTODO] protected override void OnEnabledChanged(EventArgs e) { //FIXME: base.OnEnabledChanged(e); } - protected override void OnPaint(PaintEventArgs pe) + protected override void OnPaint(PaintEventArgs pevent) { if ( Image != null ) { switch ( SizeMode ) { case PictureBoxSizeMode.StretchImage: - pe.Graphics.DrawImage ( Image, ClientRectangle ); + pevent.Graphics.DrawImage ( Image, ClientRectangle ); break; case PictureBoxSizeMode.CenterImage: int dx = (ClientRectangle.Width - Image.Width)/2; int dy = (ClientRectangle.Height- Image.Height)/2; - pe.Graphics.DrawImage ( Image, dx, dy ); + pevent.Graphics.DrawImage ( Image, dx, dy ); break; default: - pe.Graphics.DrawImage ( Image, 0, 0 ); + pevent.Graphics.DrawImage ( Image, 0, 0 ); break; } } - base.OnPaint(pe); + base.OnPaint(pevent); } protected override void OnParentChanged(EventArgs e) @@ -190,8 +184,6 @@ namespace System.Windows.Forms { base.OnVisibleChanged ( e ); } - [MonoTODO] - //this should be inherited. protected override void OnPaintBackground (PaintEventArgs e) { if ( SizeMode != PictureBoxSizeMode.StretchImage ) base.OnPaintBackground ( e ); diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyGrid.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyGrid.cs index dea25d0280e..b70d3021739 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyGrid.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyGrid.cs @@ -239,18 +239,18 @@ namespace System.Windows.Forms { throw new NotImplementedException (); } - //[MonoTODO] - //protected virtual PropertyTab CreatePropertyTab(Type tabType) { +// [MonoTODO] +// protected virtual PropertyTab CreatePropertyTab(Type tabType) { +// throw new NotImplementedException (); +// } + + //inherited + //protected override void Dispose(bool disposing) + //{ // throw new NotImplementedException (); //} [MonoTODO] - protected override void Dispose(bool disposing) - { - base.Dispose(disposing); - } - - [MonoTODO] public void ExpandAllGridItems() { throw new NotImplementedException (); diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/RadioButton.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/RadioButton.cs index 82f7e7f4a15..4d685f2bf28 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/RadioButton.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/RadioButton.cs @@ -90,8 +90,9 @@ namespace System.Windows.Forms { set { if ( checked_ != value ) { checked_ = value; + + updateCheck ( ); OnCheckedChanged ( EventArgs.Empty ); - Invalidate (); } } } @@ -104,6 +105,7 @@ namespace System.Windows.Forms { public void PerformClick() { + Checked = !Checked; OnClick ( EventArgs.Empty ); } @@ -156,15 +158,20 @@ namespace System.Windows.Forms { [MonoTODO] protected override void OnClick(EventArgs e) { - if (AutoCheck && !Checked) { - Checked = true; - foreach (Control ctr in Parent.Controls) { - RadioButton rbtn = ctr as RadioButton; - if (rbtn != null && rbtn != this) { - rbtn.Checked = false; - } - } + int res = Win32.SendMessage ( Handle, (int)ButtonMessages.BM_GETCHECK, 0, 0); + + bool check = Checked; + + if ( res == (int) NativeButtonState.BST_CHECKED ) + check = true; + else if ( res == (int) NativeButtonState.BST_UNCHECKED ) + check = false; + + if ( checked_ != check ) { + checked_ = check; + OnCheckedChanged ( EventArgs.Empty ); } + base.OnClick ( e ); } @@ -177,11 +184,18 @@ namespace System.Windows.Forms { protected override void OnHandleCreated(EventArgs e) { base.OnHandleCreated ( e ); + updateCheck ( ); } + protected override void OnMouseDown (MouseEventArgs e) + { + base.OnMouseDown (e); + } + protected override void OnMouseUp(MouseEventArgs e) { - OnClick (EventArgs.Empty); + Checked = Checked ? false : true; + Invalidate (); base.OnMouseUp(e); } @@ -201,7 +215,14 @@ namespace System.Windows.Forms { get { return (int) ( Appearance == Appearance.Normal ? 0 : ButtonStyles.BS_PUSHLIKE ); } } - internal override void ButtonPaint (PaintEventArgs e) + private void updateCheck ( ) { + if ( IsHandleCreated ) + Win32.SendMessage ( Handle, (int) ButtonMessages.BM_SETCHECK, + Checked ? (int) NativeButtonState.BST_CHECKED : + ( int ) NativeButtonState.BST_UNCHECKED, 0 ); + } + + protected override void OnPaint (PaintEventArgs e) { Rectangle paintBounds = ClientRectangle; Bitmap bmp = new Bitmap( paintBounds.Width, paintBounds.Height,e.Graphics); @@ -212,26 +233,11 @@ namespace System.Windows.Forms { sb.Dispose (); // FIXME: Width/Heigth of radiobutton are not correct - int CheckSize = 12; - Rectangle checkRect = new Rectangle (paintBounds.Left, paintBounds.Top, CheckSize, CheckSize); - Rectangle textRect = new Rectangle (checkRect.Right + 3, paintBounds.Top, paintBounds.Width - checkRect.Width - 4, paintBounds.Height); - if (0 != (CheckAlign & (ContentAlignment.BottomLeft | ContentAlignment.BottomCenter | ContentAlignment.BottomRight))) { - checkRect.Y = paintBounds.Bottom - CheckSize; - } - else if(0 != (CheckAlign & (ContentAlignment.MiddleLeft | ContentAlignment.MiddleCenter | ContentAlignment.MiddleRight))) { - checkRect.Y = paintBounds.Top + paintBounds.Height / 2 - CheckSize / 2; - } - - if (0 != (CheckAlign & (ContentAlignment.TopRight | ContentAlignment.MiddleRight | ContentAlignment.BottomRight))) { - checkRect.X = paintBounds.Right - CheckSize; - textRect.X = paintBounds.Left; - } - else if(0 != (CheckAlign & (ContentAlignment.TopCenter | ContentAlignment.MiddleCenter | ContentAlignment.BottomCenter))) { - checkRect.X = paintBounds.Left + paintBounds.Width / 2 - CheckSize / 2; - textRect.X = paintBounds.Left; - textRect.Width = paintBounds.Width; - } - + Rectangle checkRect = new Rectangle(paintBounds.Left,paintBounds.Top,12,12); + Rectangle textRect = new Rectangle( checkRect.Right,paintBounds.Top,paintBounds.Width - checkRect.Width - 1,paintBounds.Height); + //paintOn.DrawString(Text, Font, SystemBrushes.ControlText, textRect.X, textRect.Y); + Win32.DrawText(paintOn, Text, Font, ForeColor, textRect, TextAlign); + ButtonState state = ButtonState.Normal; if (FlatStyle == FlatStyle.Flat) { state |= ButtonState.Flat; @@ -243,8 +249,6 @@ namespace System.Windows.Forms { ControlPaint.DrawRadioButton (paintOn, checkRect, state); - Win32.DrawText(paintOn, Text, Font, ForeColor, textRect, TextAlign); - if (Focused) { ControlPaint.DrawFocusRectangle (paintOn, textRect); } @@ -253,5 +257,17 @@ namespace System.Windows.Forms { paintOn.Dispose (); bmp.Dispose(); } + + protected override void WndProc (ref Message m) { + switch (m.Msg) { + case Msg.WM_DRAWITEM: { + m.Result = (IntPtr)1; + } + break; + default: + base.WndProc (ref m); + break; + } + } } } diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBox.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBox.cs index b3bf59a2828..94fc3c71d2c 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBox.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBox.cs @@ -359,38 +359,42 @@ namespace System.Windows.Forms { throw new NotImplementedException (); } - [MonoTODO] - public int Find(char[] characterSet) + [MonoTODO] + public override int GetHashCode() { + //FIXME add our proprities + return base.GetHashCode(); + } [MonoTODO] + public int Find(char[] chars) { throw new NotImplementedException (); } [MonoTODO] - public int Find(string str) + public int Find(string srt) { throw new NotImplementedException (); } [MonoTODO] - public int Find(char[] characterSet, int start) + public int Find(char[] chars, int val) { throw new NotImplementedException (); } [MonoTODO] - public int Find(string str, RichTextBoxFinds options) + public int Find(string srt, RichTextBoxFinds finds) { throw new NotImplementedException (); } [MonoTODO] - public int Find(char[] characterSet, int start, int end) + public int Find(char[] chars, int val1, int val2) { throw new NotImplementedException (); } [MonoTODO] - public int Find(string str, int start, RichTextBoxFinds options) + public int Find(string srt, int val, RichTextBoxFinds finds) { throw new NotImplementedException (); } [MonoTODO] - public int Find(string str, int val1, int val2, RichTextBoxFinds finds) + public int Find(string srt, int val1, int val2, RichTextBoxFinds finds) { throw new NotImplementedException (); } @@ -411,19 +415,19 @@ namespace System.Windows.Forms { } [MonoTODO] - public void LoadFile(string path) + public void LoadFile(string str) { throw new NotImplementedException (); } [MonoTODO] - public void LoadFile(Stream path, RichTextBoxStreamType fileType) + public void LoadFile(Stream str, RichTextBoxStreamType type) { throw new NotImplementedException (); } [MonoTODO] - public void Paste(DataFormats.Format clipFormat) + public void Paste(DataFormats.Format format) { throw new NotImplementedException (); } @@ -435,17 +439,17 @@ namespace System.Windows.Forms { } [MonoTODO] - public void SaveFile(string path) + public void SaveFile(string str) { throw new NotImplementedException (); } [MonoTODO] - public void SaveFile(Stream path, RichTextBoxStreamType fileType) + public void SaveFile(Stream str, RichTextBoxStreamType type) { throw new NotImplementedException (); } [MonoTODO] - public void SaveFile(string path, RichTextBoxStreamType fileType) + public void SaveFile(string str, RichTextBoxStreamType type) { throw new NotImplementedException (); } @@ -492,9 +496,8 @@ namespace System.Windows.Forms { // // --- Protected Methods // - [MonoTODO] - protected virtual object CreateRichEditOleCallback() + protected virtual object CreateRichTextEditOleCallback() { throw new NotImplementedException (); } @@ -535,13 +538,13 @@ namespace System.Windows.Forms { } [MonoTODO] - protected virtual void OnImeChange(EventArgs e) + protected virtual void OnImeChanged(EventArgs e) { throw new NotImplementedException (); } [MonoTODO] - protected virtual void OnLinkClicked(LinkClickedEventArgs e) + protected virtual void OnClicked(LinkClickedEventArgs e) { throw new NotImplementedException (); } diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Screen.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Screen.cs index f23d63ee208..2fcbf192d8f 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/Screen.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Screen.cs @@ -9,8 +9,6 @@ // using System.Runtime.InteropServices; using System.Drawing; -using System.Collections; - namespace System.Windows.Forms { // <summary> @@ -21,31 +19,17 @@ namespace System.Windows.Forms { // // --- Public Properties // - - internal static ArrayList allScreens = new ArrayList(); - - private Rectangle bounds; - - static Screen() { - allScreens.Add (new Screen()); - } - - internal Screen() { - bounds = new Rectangle(0, 0, 1024, 768); - } - + [MonoTODO] public static Screen[] AllScreens { get { - Screen[] result = new Screen[allScreens.Count]; - allScreens.CopyTo (result, 0); - return result; + throw new NotImplementedException (); } } [MonoTODO] public Rectangle Bounds { get { - return bounds; + throw new NotImplementedException (); } } [MonoTODO] @@ -69,7 +53,7 @@ namespace System.Windows.Forms { [MonoTODO] public Rectangle WorkingArea { get { - return bounds; + throw new NotImplementedException (); } } @@ -82,22 +66,22 @@ namespace System.Windows.Forms { return base.Equals(obj); } [MonoTODO] - public static Screen FromControl(Control ctl) + public static Screen FormControl(Control ctl) { throw new NotImplementedException (); } [MonoTODO] - public static Screen FromHandle(IntPtr hwnd) + public static Screen FormHandle(IntPtr hwnd) { throw new NotImplementedException (); } [MonoTODO] - public static Screen FromPoint(Point point) + public static Screen FormPoint(Point point) { - return allScreens[0] as Screen; + throw new NotImplementedException (); } [MonoTODO] - public static Screen FromRectangle(Rectangle rect) + public static Screen FormRectangle(Rectangle rect) { throw new NotImplementedException (); } diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollBar.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollBar.cs index 4048e9e41ea..860702ca5b9 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollBar.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollBar.cs @@ -199,10 +199,6 @@ namespace System.Windows.Forms { } [MonoTODO] - protected void UpdateScrollInfo() - { - } - [MonoTODO] protected override void WndProc(ref Message m) { switch ( m.Msg ) { case Msg.WM_HSCROLL: diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollableControl.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollableControl.cs index 64ee28a1431..82870312f31 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollableControl.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollableControl.cs @@ -23,7 +23,7 @@ namespace System.Windows.Forms { protected const int ScrollStateFullDrag = 16; protected const int ScrollStateHScrollVisible = 2; - protected const int ScrollStateUserHasScrolled = 8; + protected const int ScrollStateUserHasSCrolled = 8; protected const int ScrollStateVScrollVisible = 4; @@ -92,14 +92,6 @@ namespace System.Windows.Forms { } // - // --- public methods - // - - [MonoTODO] - public void ScrollControlIntoView (Control activeControl) { - } - - // // --- Protected Properties // @@ -185,17 +177,13 @@ namespace System.Windows.Forms { } [MonoTODO] - public void SetAutoScrollMargin(int x,int y){ + protected void SetAutoScrollMargin(int x,int y){ } [MonoTODO] protected void SetScrollState(int bit,bool value){ } - [MonoTODO] - protected void SetDisplayRectLocation(int x,int y){ - } - protected override void WndProc (ref Message m) { //FIXME: base.WndProc (ref m); @@ -207,11 +195,11 @@ namespace System.Windows.Forms { public class DockPaddingEdges : ICloneable { // --- Fields --- - public int all; - public int bottom; - public int left; - public int right; - public int top; + int all; + int bottom; + int left; + int right; + int top; // --- public Properties --- @@ -340,8 +328,6 @@ namespace System.Windows.Forms { " Left = " + left.ToString(); } } - public class DockPaddingEdgeConverter : TypeConverter { - } } } diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBar.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBar.cs index 589f9e923c4..f11ccf4380d 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBar.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBar.cs @@ -57,12 +57,6 @@ namespace System.Windows.Forms { base.CreateHandle(); } - [MonoTODO] - protected override void Dispose(bool disposing) { - // FIXME: - base.Dispose(disposing); - } - protected virtual void OnDrawItem(StatusBarDrawItemEventArgs e) { if( DrawItem != null) diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanel.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanel.cs index 82600594c10..31530c06c49 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanel.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanel.cs @@ -186,12 +186,6 @@ namespace System.Windows.Forms { return Width; } - [MonoTODO] - protected override void Dispose(bool disposing) { - // FIXME: - base.Dispose(disposing); - } - private void UpdateParent ( bool UpdateParts, bool UpdateText, StatusBarPanel p ) { if ( Parent != null && suppressUpdates != true) Parent.UpdatePanels ( UpdateParts, UpdateText, p ); diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/TextBoxBase.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/TextBoxBase.cs index a7f1a95c8ef..298e9b2ed82 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/TextBoxBase.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/TextBoxBase.cs @@ -54,8 +54,6 @@ namespace System.Windows.Forms { SetStyle ( ControlStyles.FixedHeight, true ); } - [MonoTODO] - //this should be inherited ~TextBoxBase ( ) { if ( backgrBrush != IntPtr.Zero ) diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Timer.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Timer.cs index 06854e917c0..14aa2eb52c3 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/Timer.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Timer.cs @@ -40,9 +40,6 @@ namespace System.Windows.Forms { set { enabled = value; if ( enabled ) { - if ( timerid != 0 ) - Win32.KillTimer ( IntPtr.Zero , timerid ); - if ( !timerHandle.IsAllocated ) timerHandle = GCHandle.Alloc( this ); diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBar.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBar.cs index 7703055fd82..2d977d0ac5d 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBar.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBar.cs @@ -251,12 +251,6 @@ namespace System.Windows.Forms { } [MonoTODO] - protected override void Dispose(bool disposing) { - // FIXME: - base.Dispose(disposing); - } - - [MonoTODO] protected virtual void OnButtonClick(ToolBarButtonClickEventArgs e) { //FIXME: diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarButton.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarButton.cs index e77e32eb409..477ca699998 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarButton.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarButton.cs @@ -159,10 +159,5 @@ using System.ComponentModel; // --- Protected Methods // - [MonoTODO] - protected override void Dispose(bool disposing) { - // FIXME: - base.Dispose(disposing); - } } } diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeView.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeView.cs index 5ef085d4d7c..2ca910140aa 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeView.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeView.cs @@ -513,11 +513,6 @@ namespace System.Windows.Forms { base.CreateHandle(); } - [MonoTODO] - protected override void Dispose(bool disposing) { - // FIXME: - base.Dispose(disposing); - } [MonoTODO] protected override bool IsInputKey(Keys keyData) diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/UpDownBase.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/UpDownBase.cs index ab91aff40dc..1310c02321b 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/UpDownBase.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/UpDownBase.cs @@ -437,8 +437,8 @@ namespace System.Windows.Forms { } [MonoTODO] - protected override void Dispose(bool disposing) { // .NET V1.1 Beta - base.Dispose(disposing); + protected override void Dispose(bool Disposing) { // .NET V1.1 Beta + base.Dispose(Disposing); } private void EditBox_TextChanged ( object sender, EventArgs e ) diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/win32functions.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/win32functions.cs index 74bf05ed7cd..98a6f8c4c7b 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/win32functions.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/win32functions.cs @@ -34,9 +34,6 @@ using System.Drawing; using System.Runtime.InteropServices; using System.Text; using System.Diagnostics; -using System.Reflection; -using System.Xml; -using System.IO; //using UtilityLibrary.WinControls; @@ -381,9 +378,6 @@ namespace System.Windows.Forms{ internal static extern bool EndPaint(IntPtr hWnd, ref PAINTSTRUCT ps); [DllImport("user32.dll", CharSet=CharSet.Auto)] - internal static extern bool GetUpdateRect(IntPtr hwnd, ref RECT rect, bool erase); - - [DllImport("user32.dll", CharSet=CharSet.Auto)] internal static extern bool ClientToScreen(IntPtr hWnd, ref POINT pt); internal static bool ClientToScreen(IntPtr hWnd, ref RECT rect) { @@ -573,8 +567,6 @@ namespace System.Windows.Forms{ internal static extern IntPtr WindowFromPoint( POINT pt); [DllImport("user32.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Auto)] internal static extern int GetSysColor( GetSysColorIndex color); - [DllImport("user32.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Auto)] - internal static extern bool SetSysColors(int cElements, int[] lpaElements, uint[] lpaRgbValues); internal delegate void TimerProc(IntPtr hWnd, uint uMsg, uint idEvent, int dwTime); [DllImport("user32.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Auto)] @@ -1266,77 +1258,7 @@ namespace System.Windows.Forms{ [DllImport ("libwinnt.dll.so", EntryPoint="LoadLibraryA")] extern static void NTDLL_LoadLibraryA (string s); - static string[] WinColors = { - "COLOR_SCROLLBAR", - "COLOR_BACKGROUND", - "COLOR_ACTIVECAPTION", - "COLOR_INACTIVECAPTION", - "COLOR_MENU", - "COLOR_WINDOW", - "COLOR_WINDOWFRAMET", - "COLOR_MENUTEXT", - "COLOR_WINDOWTEXT", - "COLOR_CAPTIONTEXT", - "COLOR_ACTIVEBORDER", - "COLOR_INACTIVEBORDER", - "COLOR_APPWORKSPACE", - "COLOR_HIGHLIGHT", - "COLOR_HIGHLIGHTTEXT", - "COLOR_BTNFACE", - "COLOR_BTNSHADOW", - "COLOR_GRAYTEXT", - "COLOR_BTNTEXT", - "COLOR_INACTIVECAPTIONTEXT", - "COLOR_BTNHIGHLIGHT", - "COLOR_3DDKSHADOW", - "COLOR_3DLIGHT", - "COLOR_INFOTEXT", - "COLOR_INFOBK", - "COLOR_ALTERNATEBTNFACE", - "COLOR_HOTLIGHT", - "COLOR_GRADIENTACTIVECAPTION", - "COLOR_GRADIENTINACTIVECAPTION" - }; - - static uint[] GetGtkSharpColors() { - - string file = Path.Combine(Environment.GetEnvironmentVariable ("HOME"),Path.Combine(".gnome", "colors")); - - if (File.Exists(file)) { - - try { - XmlDocument doc1 = new XmlDocument(); - doc1.Load(file); - - XmlElement root = doc1.DocumentElement; - - int i = 0; - uint[] colors = new UInt32[29]; - - foreach (string colorname in WinColors) { - XmlNode node = root.SelectSingleNode("/settings/colors/color[@name=\"" + colorname + "\"]"); - if(node == null || node.InnerXml == "") - colors[i] = 255000000; - else - colors[i] = Convert.ToUInt32(node.InnerXml); - - i++; - } - - return colors; - } - catch {} - - } - else { - Console.WriteLine("WARNING: Gtk+ colors were not applied. Run 'gtkswf' first."); - } - - return null; - } - internal static bool RunningOnUnix = false; - // // Used to initialize the runtime // @@ -1363,21 +1285,11 @@ namespace System.Windows.Forms{ string [] args = new string [1]; args [0] = "mono"; - + PROCESS_InitWine (0, args); NTDLL_LoadLibraryA ("kernel32.dll"); NTDLL_LoadLibraryA ("user32.dll"); NTDLL_LoadLibraryA ("comctl32.dll"); - - string gtk_colors = Environment.GetEnvironmentVariable ("SWF_GTK_COLORS"); - if (gtk_colors == "1") { - - int[] elements = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28}; - uint[] colors = GetGtkSharpColors(); - if (colors != null) - SetSysColors(29, elements, colors); - - } } } } diff --git a/mcs/class/System.XML/ChangeLog b/mcs/class/System.XML/ChangeLog index dc8d1603308..692b1772de0 100644 --- a/mcs/class/System.XML/ChangeLog +++ b/mcs/class/System.XML/ChangeLog @@ -1,28 +1,3 @@ -2003-09-01 Lluis Sanchez Gual <lluis@ximian.com> - - * System.Xml.dll.sources: added SerializationCodeGenerator.cs, - SerializationCodeGeneratorConfiguration.cs. - -2003-08-24 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp> - - * System.Xml.dll.sources : added XsdParticleValidationState.cs - and XsdValidatingReader.cs. - * System.Xml_test.dll.sources : added XsdParticleValidationTests.cs - and XsdValidatingReaderTests.cs. - -2003-08-18 Ben Maurer <bmaurer@users.sourceforge.net> - - * System.Xml.dll.sources: add files from Oleg. - -2003-08-18 Ben Maurer <bmaurer@users.sourceforge.net> - - * System.Xml.dll.source: add System.Xml/HighWaterStack.cs. - -2003-08-14 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp> - - * System.Xml.dll.sources: Added Mono.Xml.Xsl.Operation/XslComment.cs - and Mono.Xml/IHasXmlSchemaInfo.cs - 2003-08-11 Andreas Nahr <ClassDevelopment@A-SoftTech.com> * System.Xml.dll.sources: Added Assembly/Locale.cs @@ -159,3 +134,4 @@ * ChangeLog: Add the change log to this directory * System.XML.build: Add dependancy on linux target to test target. Need to have the dll before we can test it, right? Plus is encourages other to try 'make test'. + diff --git a/mcs/class/System.XML/Makefile b/mcs/class/System.XML/Makefile index 79745b1104e..f1942c87185 100644 --- a/mcs/class/System.XML/Makefile +++ b/mcs/class/System.XML/Makefile @@ -25,9 +25,6 @@ EXTRA_DISTFILES = \ Test/XmlFiles/xsl/ChangeLog \ Test/XmlFiles/ChangeLog -System.Xml.XPath/Parser.cs: System.Xml.XPath/Parser.jay $(topdir)/jay/skeleton.cs - $(topdir)/jay/jay -ct < $(topdir)/jay/skeleton.cs $< >$@ - -CLEAN_FILES = Test/XmlFiles/xsl/result.xml System.Xml.XPath/Parser.cs +CLEAN_FILES = Test/XmlFiles/xsl/result.xml include ../../build/library.make diff --git a/mcs/class/System.XML/Mono.Xml.Schema/ChangeLog b/mcs/class/System.XML/Mono.Xml.Schema/ChangeLog deleted file mode 100644 index 720d364e4ae..00000000000 --- a/mcs/class/System.XML/Mono.Xml.Schema/ChangeLog +++ /dev/null @@ -1,4 +0,0 @@ -2003-08-24 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp> - - * XsdValidatingReader.cs, - XsdParticleValidationState.cs : Initial checkin. diff --git a/mcs/class/System.XML/Mono.Xml.Schema/XsdParticleValidationState.cs b/mcs/class/System.XML/Mono.Xml.Schema/XsdParticleValidationState.cs deleted file mode 100644 index 34ccb4bb276..00000000000 --- a/mcs/class/System.XML/Mono.Xml.Schema/XsdParticleValidationState.cs +++ /dev/null @@ -1,462 +0,0 @@ -// -// Mono.Xml.Schema.XsdParticleValidationState.cs -// -// Author: -// Atsushi Enomoto (ginga@kit.hi-ho.ne.jp) -// -// (C)2003 Atsushi Enomoto -// -using System; -using System.Collections; -using System.Xml; -using System.Xml.Schema; - - -namespace Mono.Xml -{ - public class XsdValidationStateFactory - { - Hashtable table; - - public XsdValidationStateFactory () - { - table = new Hashtable (); - } - - public XsdValidationState Get (XmlSchemaObject xsobj) - { - XsdValidationState got = table [xsobj] as XsdValidationState; - if (got == null) - got = Create (xsobj); - return got; - } - - public XsdValidationState Create (XmlSchemaObject xsobj) - { - string typeName = xsobj.GetType ().Name; - switch (typeName) { - case "XmlSchemaElement": - return AddElement ((XmlSchemaElement) xsobj); - case "XmlSchemaSequence": - return AddSequence ((XmlSchemaSequence) xsobj); - case "XmlSchemaChoice": - return AddChoice ((XmlSchemaChoice) xsobj); - case "XmlSchemaAll": - return AddAll ((XmlSchemaAll) xsobj); - case "XmlSchemaAny": - return AddAny ((XmlSchemaAny) xsobj); - case "EmptyParticle": // Microsoft.NET - case "XmlSchemaParticleEmpty": // Mono - return AddEmpty (); - default: - throw new NotImplementedException (); - } - } - - private XsdElementValidationState AddElement (XmlSchemaElement element) - { - XsdElementValidationState got = new XsdElementValidationState (element, this); - table [element] = got; - return got; - } - - private XsdSequenceValidationState AddSequence (XmlSchemaSequence sequence) - { - XsdSequenceValidationState got = new XsdSequenceValidationState (sequence, this); - table [sequence] = got; - return got; - } - - private XsdChoiceValidationState AddChoice (XmlSchemaChoice choice) - { - XsdChoiceValidationState got = new XsdChoiceValidationState (choice, this); - table [choice] = got; - return got; - } - - private XsdAllValidationState AddAll (XmlSchemaAll all) - { - XsdAllValidationState got = new XsdAllValidationState (all, this); - table [all] = got; - return got; - } - - private XsdAnyValidationState AddAny (XmlSchemaAny any) - { - XsdAnyValidationState got = new XsdAnyValidationState (any, this); - table [any] = got; - return got; - } - - private XsdEmptyValidationState AddEmpty () - { - return new XsdEmptyValidationState (this); - } - } - - public abstract class XsdValidationState - { - int occured; - XsdValidationStateFactory factory; - XmlSchemaElement currentElement; - - public XsdValidationState (XsdValidationStateFactory factory) - { - this.factory = factory; - } - - // Normally checks MaxOccurs boundary - public abstract bool EvaluateStartElement (string localName, string ns); - - // Normally checks MinOccurs boundary - public abstract bool EvaluateEndElement (); - - public abstract bool Emptiable { get; } - - public XmlSchemaDatatype Datatype { - get { - XmlSchemaDatatype dt = currentElement.ElementType as XmlSchemaDatatype; - return dt != null ? dt : ((XmlSchemaType) currentElement.ElementType).Datatype; - } - } - - public XmlSchemaElement Element { - get { return currentElement; } - } - - public XsdValidationStateFactory Factory { - get { return factory; } - } - - public int Occured { - get { return occured; } - } - - internal void IncrementOccurence () - { - occured++; - } - - internal void SetCurrentElement (XmlSchemaElement element) - { - currentElement = element; - } - - internal void SetValidResult (XsdValidationState matched) - { - this.currentElement = matched.currentElement; - } - } - - public class XsdElementValidationState : XsdValidationState - { - public XsdElementValidationState (XmlSchemaElement element, XsdValidationStateFactory factory) - : base (factory) - { - this.element = element; - this.schemaType = element.ElementType as XmlSchemaType; - this.dataType = element.ElementType as XmlSchemaDatatype; - name = element.QualifiedName.Name; - ns = element.QualifiedName.Namespace; - } - - // final fields - XmlSchemaElement element; - XmlSchemaType schemaType; - XmlSchemaDatatype dataType; - string name; - string ns; - - // Methods - - public override bool EvaluateStartElement (string name, string ns) - { - if (this.name == name && this.ns == ns) { - if (Occured >= element.MaxOccurs) - return false; - - IncrementOccurence (); - SetCurrentElement (element); - return true; - } else { - return false; - } - } - - public override bool EvaluateEndElement () - { - return (element.MinOccurs <= Occured); - } - - public override bool Emptiable { - get { return element.MinOccurs <= Occured; } - } - } - - public class XsdSequenceValidationState : XsdValidationState - { - XmlSchemaSequence seq; - int current = -1; - XsdValidationState currentAutomata; - - public XsdSequenceValidationState (XmlSchemaSequence sequence, XsdValidationStateFactory factory) - : base (factory) - { - seq = sequence; - } - - public override bool EvaluateStartElement (string localName, string ns) - { - if (Occured > seq.MaxOccurs) - return false; - - int idx = current < 0 ? 0 : current; - XsdValidationState xa = currentAutomata; - if (xa == null) - xa = Factory.Create (seq.Items [idx]); - bool increment = false; - - while (xa != null) { - if (!xa.EvaluateStartElement (localName, ns)) { - if (!xa.Emptiable) - return false; - } else { - if (increment) { - if (Occured + 1 >= seq.MaxOccurs) - return false; - IncrementOccurence (); - } - current = idx; - currentAutomata = xa; - SetValidResult (currentAutomata); - return true; - } - - idx++; - if (seq.Items.Count > idx) - xa = Factory.Create (seq.Items [idx]); - else if (current < 0) // started from top - xa = null; - else { // started from middle - idx = 0; - increment = true; - xa = (idx < current) ? - Factory.Create (seq.Items [idx]) - : null; - } - } - return false; - } - - public override bool EvaluateEndElement () - { - if (current < 0) - return (seq.MinOccurs <= Occured); - - // Then we are in the middle of the sequence. - // Check all following emptiable items. - if (!Emptiable) - return false; - - return seq.MinOccurs <= Occured + 1; - } - - public override bool Emptiable { - get { - if (seq.MinOccurs > Occured + 1) - return false; - - int idx = current; - XsdValidationState xa = currentAutomata; - if (xa == null) - xa = Factory.Create (seq.Items [idx]); - while (xa != null) { - if (!xa.Emptiable) - return false; // cannot omit following items. - idx++; - if (seq.Items.Count > idx) - xa = Factory.Create (seq.Items [idx]); - else - xa = null; - } - return true; - } - } - } - - public class XsdChoiceValidationState : XsdValidationState - { - XmlSchemaChoice choice; - XsdValidationState incomplete; - - public XsdChoiceValidationState (XmlSchemaChoice choice, XsdValidationStateFactory factory) - : base (factory) - { - this.choice = choice; - } - - public override bool EvaluateStartElement (string localName, string ns) - { - if (incomplete != null) { - if (incomplete.EvaluateStartElement (localName, ns)) - return true; - else { - if (!incomplete.Emptiable) - return false; - else - incomplete = null; - } - } - - if (Occured >= choice.MaxOccurs) - return false; - - foreach (XmlSchemaObject xsobj in choice.Items) { - XsdValidationState xa = Factory.Create (xsobj); - if (xa.EvaluateStartElement (localName, ns)) { - incomplete = xa; - this.SetValidResult (xa); - IncrementOccurence (); - return true; - } - } - - return false; - } - - public override bool EvaluateEndElement () - { - return (choice.MinOccurs <= Occured) && - (incomplete != null ? incomplete.Emptiable : true); - } - - public override bool Emptiable { - get { - return (choice.MinOccurs <= Occured) && - (incomplete != null ? incomplete.Emptiable : true); - } - } - } - - public class XsdAllValidationState : XsdValidationState - { - XmlSchemaAll all; - ArrayList consumed = new ArrayList (); - XsdValidationState incomplete; - - public XsdAllValidationState (XmlSchemaAll all, XsdValidationStateFactory factory) - : base (factory) - { - this.all = all; - } - - public override bool EvaluateStartElement (string localName, string ns) - { - if (Occured > all.MaxOccurs) - return false; - - if (incomplete != null) { - if (incomplete.EvaluateStartElement (localName, ns)) - return true; - else { - if (!incomplete.Emptiable) - return false; - else - incomplete = null; - } - } - - foreach (XmlSchemaObject xsobj in all.Items) { - if (consumed.Contains (xsobj)) - return false; - - XsdValidationState xa = Factory.Create (xsobj); - if (xa.EvaluateStartElement (localName, ns)) { - consumed.Add (xsobj); - this.SetValidResult (xa); - return true; - } - } - return false; - } - - public override bool EvaluateEndElement () - { - if (consumed.Count == 0 && all.MinOccurs > 0) - return false; - - // quick check - if (all.Items.Count == consumed.Count) - return true; - - if (incomplete != null && !incomplete.Emptiable) - return false; - - foreach (XmlSchemaParticle xsobj in all.Items) { - if (xsobj.MinOccurs > 0 && !consumed.Contains (xsobj)) - return false; // missing item was found - } - return false; - } - - public override bool Emptiable { - get { - return (all.MinOccurs <= Occured) && - (incomplete != null ? incomplete.Emptiable : true); - } - } - } - - public class XsdAnyValidationState : XsdValidationState - { - public XsdAnyValidationState (XmlSchemaAny any, XsdValidationStateFactory factory) - : base (factory) - { - this.any = any; - } - - // final fields - XmlSchemaAny any; - - // Methods - - public override bool EvaluateStartElement (string name, string ns) - { - throw new NotImplementedException (); - } - - public override bool EvaluateEndElement () - { - return (any.MinOccurs > Occured); - } - - public override bool Emptiable { - get { return any.MinOccurs <= Occured; } - } - } - - public class XsdEmptyValidationState : XsdValidationState - { - public XsdEmptyValidationState (XsdValidationStateFactory factory) - : base (factory) - { - } - - // Methods - - public override bool EvaluateStartElement (string name, string ns) - { - return false; - } - - public override bool EvaluateEndElement () - { - return true; - } - - public override bool Emptiable { - get { return true; } - } - } - -} diff --git a/mcs/class/System.XML/Mono.Xml.Schema/XsdValidatingReader.cs b/mcs/class/System.XML/Mono.Xml.Schema/XsdValidatingReader.cs deleted file mode 100644 index a4f065fbedb..00000000000 --- a/mcs/class/System.XML/Mono.Xml.Schema/XsdValidatingReader.cs +++ /dev/null @@ -1,468 +0,0 @@ -// -// Mono.Xml.Schema.XsdValidatingReader.cs -// -// Author: -// Atsushi Enomoto (ginga@kit.hi-ho.ne.jp) -// -// (C)2003 Atsushi Enomoto -// -using System; -using System.Collections; -using System.Collections.Specialized; -using System.Text; -using System.Xml; -using System.Xml.Schema; - - -namespace Mono.Xml -{ - public class XsdValidatingReader : XmlReader, IXmlLineInfo, IHasXmlSchemaInfo //, IHasXmlParserContext - { - XmlReader reader; - XmlValidatingReader xvReader; - bool laxElementValidation = true; - bool reportNoValidationError; - XmlSchemaCollection schemas = new XmlSchemaCollection (); - bool namespaces = true; - - XsdValidationState currentValidationState; -// XsdAttributeValidationStateCollection attributeValidationStates; - object elementXsiType; - StringBuilder storedCharacters = new StringBuilder (); - - // [int Depth] -> XsdAutomata. - // Some of them might be missing (See the spec section 5.3). - Hashtable automataTable = new Hashtable (); - - StringCollection defaultAttributes = new StringCollection (); - int currentDefaultAttribute; - - // Property Cache. - int attributeCount; - -#region .ctor - public XsdValidatingReader (XmlReader reader) - : this (reader, null) - { - } - - public XsdValidatingReader (XmlReader reader, XmlReader validatingReader) - { - this.reader = reader; - xvReader = validatingReader as XmlValidatingReader; - if (xvReader != null) { - if (xvReader.ValidationType == ValidationType.None) - reportNoValidationError = true; - } - } -#endregion - -// Non-overrides - - public bool Namespaces { - get { return namespaces; } - set { namespaces = value; } - } - - public XmlReader Reader { - get { return reader; } - } - - // This should be changed before the first Read() call. - public XmlSchemaCollection Schemas { - get { return schemas; } - } - - public object SchemaType { - get { - if (ReadState != ReadState.Interactive) - return null; - - switch (NodeType) { - case XmlNodeType.Element: - if (elementXsiType != null) - return elementXsiType; - else if (currentValidationState != null) - return currentValidationState.Element.ElementType; - else - return null; - case XmlNodeType.Attribute: - throw new NotImplementedException (); - default: - return null; - } - } - } - - // This property is never used in Mono. - public ValidationType ValidationType { - get { - if (reportNoValidationError) - return ValidationType.None; - else - return ValidationType.Schema; - } - } - - public XmlResolver XmlResolver { - set { throw new NotImplementedException (); } - } - - // TODO: provide XmlNamespaceManager to ParseValue() if possible - public object ReadTypedValue () - { - switch (NodeType) { - case XmlNodeType.Element: - XmlSchemaDatatype xsDatatype = currentValidationState.Datatype; - if (xsDatatype != null) - return xsDatatype.ParseValue (ReadString (), NameTable, null); - else - return null; - case XmlNodeType.Attribute: - throw new NotImplementedException (); -// xsDatatype = attributeValidationStates [LocalName, NamespaceURI].Datatype; -// if (xsDatatype != null) -// return xsDatatype.ParseValue (Value, NameTable, null); -// else -// return null; - default: - return null; - } - } - - public ValidationEventHandler ValidationEventHandler; - -// Overrided Properties - - public override int AttributeCount { - get { - if (NodeType == XmlNodeType.Element) - return attributeCount; - else if (IsDefault) - return 0; - else - return reader.AttributeCount; - } - } - - public override string BaseURI { - get { return reader.BaseURI; } - } - - // If this class is used to implement XmlValidatingReader, - // it should be left to DTDValidatingReader. In other cases, - // it depends on the reader's ability. - public override bool CanResolveEntity { - get { return reader.CanResolveEntity; } - } - - public override int Depth { - get { return reader.Depth; } - } - - public override bool EOF { - get { return reader.EOF; } - } - - public override bool HasValue { - get { throw new NotImplementedException (); } - } - - public override bool IsDefault { - // TODO: handle default node - get { return false; } - } - - public override bool IsEmptyElement { - // TODO: consider default attributes - get { return reader.IsEmptyElement; } - } - - public override string this [int i] { - get { return GetAttribute (i); } - } - - public override string this [string name] { - get { return GetAttribute (name); } - } - - public override string this [string localName, string ns] { - get { return GetAttribute (localName, ns); } - } - - int IXmlLineInfo.LineNumber { - get { throw new NotImplementedException (); } - } - - int IXmlLineInfo.LinePosition { - get { throw new NotImplementedException (); } - } - - public override string LocalName { - // TODO: handle default node - get { return reader.LocalName; } - } - - public override string Name { - // TODO: handle default node - get { return reader.Name; } - } - - public override string NamespaceURI { - // TODO: handle default node - get { return reader.NamespaceURI; } - } - - public override XmlNameTable NameTable { - get { return reader.NameTable; } - } - - public override XmlNodeType NodeType { - // TODO: handle default node - get { return reader.NodeType; } - } - - public override string Prefix { - // TODO: handle default node - get { return reader.Prefix; } - } - - public override char QuoteChar { - get { return reader.QuoteChar; } - } - - public override ReadState ReadState { - get { return reader.ReadState; } - } - - public override string Value { - // TODO: handle default node - get { return reader.Value; } - } - - public override string XmlLang { - get { throw new NotImplementedException (); } - } - - public override XmlSpace XmlSpace { - get { throw new NotImplementedException (); } - } - - private void HandleError (string error) - { - if (reportNoValidationError) - return; - - ValidationEventArgs e = new ValidationEventArgs ( - new XmlSchemaException (error, null), error, XmlSeverityType.Error); - - if (this.ValidationEventHandler != null) - this.ValidationEventHandler (this, e); - else -#if NON_MONO_ENV - this.xvReader.OnValidationEvent (this, e); -#else - throw e.Exception; -#endif - } - - private void ValidateStartElementParticle () - { - if (schemas.Count == 0) // No validation is performed. - return; - - // Creating element automata, if current does not exist. - if (currentValidationState == null) { - XmlSchemaElement root = null; - foreach (XmlSchema target in schemas) { - XmlSchema matches = target.Schemas [reader.NamespaceURI]; - if (matches != null) { - root = target.Elements [new XmlQualifiedName (reader.LocalName, reader.NamespaceURI)] as XmlSchemaElement; - if (root != null) { - XsdValidationStateFactory factory = new XsdValidationStateFactory (); - currentValidationState = factory.Create (root); - } - else - HandleError ("Invalid start element. Element declaration for " + reader.LocalName + " is missing."); - break; - } - } - if (root == null && reader.NamespaceURI != String.Empty) - HandleError ("Invalid start element. Element declaration for " + reader.LocalName + " is missing."); - } - - if (currentValidationState == null) - return; // no validation. - - if (!currentValidationState.EvaluateStartElement (reader.LocalName, reader.NamespaceURI)) - HandleError ("Invalid start element: " + reader.LocalName); - - automataTable [reader.Depth] = currentValidationState; - XmlSchemaElement el = currentValidationState.Element; - XmlSchemaComplexType ctype = el.ElementType as XmlSchemaComplexType; - if (ctype != null && ctype.ContentTypeParticle != null) { - currentValidationState = currentValidationState.Factory.Create (ctype.ContentTypeParticle); - } - - // TODO: Attribute validation - } - - private void ValidateEndElementParticle () - { - if (currentValidationState != null) { - if (!currentValidationState.EvaluateEndElement ()) { - HandleError ("Invalid end element: " + reader.Name); - } - } - currentValidationState = automataTable [reader.Depth] as XsdValidationState; - automataTable [reader.Depth + 1] = null; - } - - private void ValidateCharacters () - { - // TODO: value context validation here. - } - -// Overrided Methods - - public override void Close () - { - reader.Close (); - } - - // MonoTODO - public override string GetAttribute (int i) - { - if (reader.AttributeCount > i) - reader.GetAttribute (i); -// else if (defaultAttributes.Count) - throw new NotImplementedException (); - } - - // MonoTODO - public override string GetAttribute (string name) - { - return reader.GetAttribute (name); - } - - // MonoTODO - public override string GetAttribute (string localName, string ns) - { - return reader.GetAttribute (localName, ns); - } - - // When it is default attribute, does it works? - bool IXmlLineInfo.HasLineInfo () - { - throw new NotImplementedException (); - } - - // MonoTODO - public override string LookupNamespace (string prefix) - { - return reader.LookupNamespace (prefix); - } - - // MonoTODO - public override void MoveToAttribute (int i) - { - reader.MoveToAttribute (i); - } - - // MonoTODO - public override bool MoveToAttribute (string name) - { - return reader.MoveToAttribute (name); - } - - // MonoTODO - public override bool MoveToAttribute (string localName, string ns) - { - return reader.MoveToAttribute (localName); - } - - public override bool MoveToElement () - { - // TODO: handle default node - return reader.MoveToElement (); - } - - public override bool MoveToFirstAttribute () - { - // TODO: handle default node - return reader.MoveToFirstAttribute (); - } - - public override bool MoveToNextAttribute () - { - // TODO: handle default node - return reader.MoveToNextAttribute (); - } - - public override bool Read () - { - bool result = reader.Read (); - - switch (reader.NodeType) { - case XmlNodeType.Element: - ValidateStartElementParticle (); - // TODO: validate xsi:nil, create xsi:type, and so on. - // TODO: validate attributes - - if (reader.IsEmptyElement) - goto case XmlNodeType.EndElement; - break; - - case XmlNodeType.EndElement: - ValidateEndElementParticle (); - // TODO: validate content data type. - break; - - case XmlNodeType.CDATA: - case XmlNodeType.SignificantWhitespace: - case XmlNodeType.Text: - ValidateCharacters (); - break; - } - - return result; - } - - public override bool ReadAttributeValue () - { - // TODO: handle default node - return reader.ReadAttributeValue (); - } - -#if NET_1_0 - public override string ReadInnerXml () - { - // MS.NET 1.0 has a serious bug here. It skips validation. - return reader.ReadInnerXml (); - } - - public override string ReadOuterXml () - { - // MS.NET 1.0 has a serious bug here. It skips validation. - return reader.ReadOuterXml (); - } -#endif - - // XmlReader.ReadString() should call derived this.Read(). - public override string ReadString () - { -#if NET_1_0 - return reader.ReadString (); -#else - return base.ReadString (); -#endif - } - - // This class itself does not have this feature. - public override void ResolveEntity () - { - reader.ResolveEntity (); - } - } - -} diff --git a/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog b/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog index 1c9fae93b30..58bcee375bf 100644 --- a/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog +++ b/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog @@ -1,15 +1,3 @@ -2003-08-25 Ben Maurer <bmaurer@users.sourceforge.net> - - * DTMXPathNavigator.cs: Allocate valueBuilder on first use. - -2003-08-14 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp> - - * DTMXPathDocument.cs, - DTMXPathDocumentBuilder.cs, - DTMXPathNavigator.cs : - - Implemented ID support using XmlValidatingReader. - - Prefix should be String.Empty even if XmlReader.Prefix is null. - 2003-07-23 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp> * DTMXPathDocumentBuilder.cs : diff --git a/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocument.cs b/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocument.cs index 8498e07791f..67a4c01c13d 100644 --- a/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocument.cs +++ b/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocument.cs @@ -22,36 +22,7 @@ namespace Mono.Xml.XPath #region ctor. - public DTMXPathDocument (XmlNameTable nameTable, - int [] firstChild__, - int [] parent__, - int [] firstAttribute__, - int [] previousSibling__, - int [] nextSibling__, - int [] depth__, - int [] position__, - XPathNodeType [] nodeType__, - string [] baseUri__, - bool [] isEmptyElement__, - string [] localName__, - string [] namespaceUri__, - string [] prefix__, - string [] value__, - string [] xmlLang__, - int [] namespaceNode__, - object [] schemaType__, - int [] ownerElement__, - int [] nextAttribute__, - string [] attrLocalName__, - string [] attrPrefix__, - string [] attrNsUri__, - string [] attrValue__, - object [] attrSchemaType__, - int [] nsDeclaredElement__, - int [] nextNsNode__, - string [] nsNodeName__, - string [] nsNodeUri__, - Hashtable idTable__) + public DTMXPathDocument (XmlNameTable nameTable, int [] firstChild__, int [] parent__, int [] firstAttribute__, int [] previousSibling__, int [] nextSibling__, int [] depth__, int [] position__, XPathNodeType [] nodeType__, string [] baseUri__, bool [] isEmptyElement__, string [] localName__, string [] namespaceUri__, string [] prefix__, string [] value__, string [] xmlLang__, int [] namespaceNode__, object [] schemaType__, int [] ownerElement__, int [] nextAttribute__, string [] attrLocalName__, string [] attrPrefix__, string [] attrNsUri__, string [] attrValue__, object [] attrSchemaType__, int [] nsDeclaredElement__, int [] nextNsNode__, string [] nsNodeName__, string [] nsNodeUri__) { firstChild_ = firstChild__; parent_ = parent__; @@ -86,8 +57,6 @@ namespace Mono.Xml.XPath nsNodeName_ = nsNodeName__; nsNodeUri_ = nsNodeUri__; - idTable_ = idTable__; - this.nameTable = nameTable; } @@ -98,7 +67,7 @@ namespace Mono.Xml.XPath public XPathNavigator CreateNavigator () { if (root == null) { - root = new DTMXPathNavigator (this, nameTable, firstChild_, parent_, firstAttribute_, previousSibling_, nextSibling_, depth_, position_, nodeType_, baseUri_, isEmptyElement_, localName_, namespaceUri_, prefix_, value_, xmlLang_, namespaceNode_, schemaType_, ownerElement_, nextAttribute_, attrLocalName_, attrPrefix_, attrNsUri_, attrValue_, attrSchemaType_, nsDeclaredElement_, nextNsNode_, nsNodeName_, nsNodeUri_, idTable_); + root = new DTMXPathNavigator (this, nameTable, firstChild_, parent_, firstAttribute_, previousSibling_, nextSibling_, depth_, position_, nodeType_, baseUri_, isEmptyElement_, localName_, namespaceUri_, prefix_, value_, xmlLang_, namespaceNode_, schemaType_, ownerElement_, nextAttribute_, attrLocalName_, attrPrefix_, attrNsUri_, attrValue_, attrSchemaType_, nsDeclaredElement_, nextNsNode_, nsNodeName_, nsNodeUri_); return root; } else return root.Clone (); @@ -147,8 +116,10 @@ namespace Mono.Xml.XPath string [] nsNodeName_; // NS prefix. string [] nsNodeUri_; // NS uri. + // ID-Key + // [string attribute-name] -> idTable // idTable [string value] -> int nodeId - readonly Hashtable idTable_; + readonly Hashtable idTableTable; #endregion diff --git a/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocumentBuilder.cs b/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocumentBuilder.cs index a3af4d2317c..4a49e35ba62 100644 --- a/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocumentBuilder.cs +++ b/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocumentBuilder.cs @@ -19,43 +19,29 @@ namespace Mono.Xml.XPath public class DTMXPathDocumentBuilder { public DTMXPathDocumentBuilder (string url) - : this (url, XmlSpace.None, false) + : this (url, XmlSpace.None) { } public DTMXPathDocumentBuilder (string url, XmlSpace space) - : this (url, space, false) - { - } - - public DTMXPathDocumentBuilder (string url, XmlSpace space, bool supportID) - : this (new XmlTextReader (url), space, supportID) + : this (new XmlTextReader (url), space) { } public DTMXPathDocumentBuilder (XmlReader reader) - : this (reader, XmlSpace.None, false) + : this (reader, XmlSpace.None) { } public DTMXPathDocumentBuilder (XmlReader reader, XmlSpace space) - : this (reader, space, false) - { - } - - public DTMXPathDocumentBuilder (XmlReader reader, XmlSpace space, bool supportID) { this.xmlReader = reader; - if (supportID) - this.validatingReader = reader as XmlValidatingReader; this.xmlSpace = xmlSpace; this.nameTable = reader.NameTable; Compile (); } - bool supportID; XmlReader xmlReader; - XmlValidatingReader validatingReader; XmlSpace xmlSpace; XmlNameTable nameTable; int defaultCapacity = 100; @@ -102,9 +88,6 @@ namespace Mono.Xml.XPath int [] nextNsNode_ = new int [100]; string [] nsNodeName_ = new string [100]; string [] nsNodeUri_ = new string [100]; - - // idTable [string value] -> int nodeId - Hashtable idTable_; #endregion int nodeIndex; @@ -146,15 +129,12 @@ namespace Mono.Xml.XPath nsDeclaredElement_, nextNsNode_, nsNodeName_, - nsNodeUri_, - idTable_ + nsNodeUri_ ); } public void Compile () { - idTable_ = new Hashtable (); - // index 0 is dummy. No node (including Root) is assigned to this index // So that we can easily compare index != 0 instead of index < 0. // (Difference between jnz or jbe in 80x86.) @@ -304,31 +284,20 @@ namespace Mono.Xml.XPath if (lastNsIndexInCurrent == 0) namespaceNode_ [nodeIndex] = nsIndex; this.AddNsNode (nodeIndex, - (xmlReader.Prefix == null || xmlReader.Prefix == String.Empty) ? + xmlReader.Prefix == "" ? "" : xmlReader.LocalName, xmlReader.Value); lastNsIndexInCurrent = nsIndex; } else { // add attribute node. attributeIndex ++; - this.AddAttribute (nodeIndex, xmlReader.LocalName, xmlReader.NamespaceURI, xmlReader.Prefix != null ? xmlReader.Prefix : String.Empty, xmlReader.Value, null); + this.AddAttribute (nodeIndex, xmlReader.LocalName, xmlReader.NamespaceURI, xmlReader.Prefix, xmlReader.Value, null); if (firstAttributeIndex == 0) firstAttributeIndex = attributeIndex; else nextAttribute_ [attributeIndex - 1] = attributeIndex; // dummy for "current" attribute. nextAttribute_ [attributeIndex] = 0; - - // Identity infoset - if (validatingReader != null) { - XmlSchemaDatatype dt = validatingReader.SchemaType as XmlSchemaDatatype; - if (dt == null) { - XmlSchemaType xsType = validatingReader.SchemaType as XmlSchemaType; - dt = xsType.Datatype; - } - if (dt != null && dt.TokenizedType == XmlTokenizedType.ID) - idTable_.Add (xmlReader.Value, nodeIndex); - } } } while (xmlReader.MoveToNextAttribute ()); xmlReader.MoveToElement (); diff --git a/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator.cs b/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator.cs index 80f702ce5e8..690c373061e 100644 --- a/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator.cs +++ b/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator.cs @@ -19,23 +19,7 @@ namespace Mono.Xml.XPath { #region Copy of XPathDocument - public DTMXPathNavigator (DTMXPathDocument document, - XmlNameTable nameTable, - int [] firstChild__, int [] parent__, - int [] firstAttribute__, int [] previousSibling__, - int [] nextSibling__, int [] depth__, - int [] position__, XPathNodeType [] nodeType__, - string [] baseUri__, bool [] isEmptyElement__, - string [] localName__, string [] namespaceUri__, - string [] prefix__, string [] value__, - string [] xmlLang__, int [] namespaceNode__, - object [] schemaType__, int [] ownerElement__, - int [] nextAttribute__, string [] attrLocalName__, - string [] attrPrefix__, string [] attrNsUri__, - string [] attrValue__, object [] attrSchemaType__, - int [] nsDeclaredElement__, int [] nextNsNode__, - string [] nsNodeName__, string [] nsNodeUri__, - Hashtable idTable__) + public DTMXPathNavigator (DTMXPathDocument document, XmlNameTable nameTable, int [] firstChild__, int [] parent__, int [] firstAttribute__, int [] previousSibling__, int [] nextSibling__, int [] depth__, int [] position__, XPathNodeType [] nodeType__, string [] baseUri__, bool [] isEmptyElement__, string [] localName__, string [] namespaceUri__, string [] prefix__, string [] value__, string [] xmlLang__, int [] namespaceNode__, object [] schemaType__, int [] ownerElement__, int [] nextAttribute__, string [] attrLocalName__, string [] attrPrefix__, string [] attrNsUri__, string [] attrValue__, object [] attrSchemaType__, int [] nsDeclaredElement__, int [] nextNsNode__, string [] nsNodeName__, string [] nsNodeUri__) { firstChild_ = firstChild__; parent_ = parent__; @@ -70,8 +54,6 @@ namespace Mono.Xml.XPath nsNodeName_ = nsNodeName__; nsNodeUri_ = nsNodeUri__; - idTable_ = idTable__; - this.nameTable = nameTable; this.MoveToRoot (); this.document = document; @@ -79,17 +61,7 @@ namespace Mono.Xml.XPath // Copy constructor including position informations. public DTMXPathNavigator (DTMXPathNavigator org) - : this (org.document, org.nameTable, - org.firstChild_, org.parent_, org.firstAttribute_, - org.previousSibling_, org.nextSibling_, org.depth_, - org.position_, org.nodeType_, org.baseUri_, - org.isEmptyElement_, org.localName_, org.namespaceUri_, - org.prefix_, org.value_, org.xmlLang_, - org.namespaceNode_, org.schemaType_, org.ownerElement_, - org.nextAttribute_, org.attrLocalName_, org.attrPrefix_, - org.attrNsUri_, org.attrValue_, org.attrSchemaType_, - org.nsDeclaredElement_, org.nextNsNode_, org.nsNodeName_, - org.nsNodeUri_, org.idTable_) + : this (org.document, org.nameTable, org.firstChild_, org.parent_, org.firstAttribute_, org.previousSibling_, org.nextSibling_, org.depth_, org.position_, org.nodeType_, org.baseUri_, org.isEmptyElement_, org.localName_, org.namespaceUri_, org.prefix_, org.value_, org.xmlLang_, org.namespaceNode_, org.schemaType_, org.ownerElement_, org.nextAttribute_, org.attrLocalName_, org.attrPrefix_, org.attrNsUri_, org.attrValue_, org.attrSchemaType_, org.nsDeclaredElement_, org.nextNsNode_, org.nsNodeName_, org.nsNodeUri_) { currentIsNode = org.currentIsNode; currentIsAttr = org.currentIsAttr; @@ -138,12 +110,10 @@ namespace Mono.Xml.XPath string [] nsNodeName_; // NS prefix. string [] nsNodeUri_; // NS uri. - // ID table - Hashtable idTable_; - - // Key table (considered xsd:keyref for XPath 2.0) + // ID-Key (considered xsd:keyref for XPath 2.0) Hashtable keyRefTable; // [string key-name] -> idTable // idTable [string value] -> int nodeId + // keyname="" for ID #endregion bool currentIsNode; @@ -153,7 +123,7 @@ namespace Mono.Xml.XPath int currentAttr; int currentNs; - StringBuilder valueBuilder; + StringBuilder valueBuilder = new StringBuilder (); #region Ctor @@ -250,11 +220,6 @@ namespace Mono.Xml.XPath case XPathNodeType.SignificantWhitespace: return value_ [currentNode]; } - if (valueBuilder == null) - valueBuilder = new StringBuilder (); - else - valueBuilder.Length = 0; - int iter = firstChild_ [currentNode]; while (iter != 0 && iter < depth_.Length && depth_ [iter] > depth_ [currentNode]) { switch (nodeType_ [iter]) { @@ -267,8 +232,9 @@ namespace Mono.Xml.XPath } iter++; } - - return valueBuilder.ToString (); + string result = valueBuilder.ToString (); + valueBuilder.Length = 0; + return result; } } @@ -482,19 +448,9 @@ namespace Mono.Xml.XPath return moveToSpecifiedNamespace (cur, namespaceScope); } - // Note that this support is extension to XPathDocument. - // XPathDocument does not support ID reference. public override bool MoveToId (string id) { -// return MoveToKeyRef ("", id); - if (idTable_.ContainsKey (id)) { - currentNode = (int) idTable_ [id]; - currentIsNode = true; - currentIsAttr = false; - return true; - } - else - return false; + return MoveToKeyRef ("", id); } // This is extension for XPath 2.0 diff --git a/mcs/class/System.XML/Mono.Xml.XPath/IdPattern.cs b/mcs/class/System.XML/Mono.Xml.XPath/IdPattern.cs deleted file mode 100644 index 3fe929f6080..00000000000 --- a/mcs/class/System.XML/Mono.Xml.XPath/IdPattern.cs +++ /dev/null @@ -1,33 +0,0 @@ -// -// Mono.Xml.XPath.IdPattern -// -// Author: -// Ben Maurer (bmaurer@users.sourceforge.net) -// -// (C) 2003 Ben Maurer -// - -using System; -using System.Collections; -using System.IO; -using System.Xml; -using System.Xml.Schema; -using System.Xml.XPath; -using System.Xml.Xsl; - -namespace Mono.Xml.XPath { - internal class IdPattern : Pattern { - - string arg0; - - public IdPattern (string arg0) - { - this.arg0 = arg0; - } - - public override bool Matches (XPathNavigator node, XsltContext ctx) - { - throw new NotImplementedException (); - } - } -}
\ No newline at end of file diff --git a/mcs/class/System.XML/Mono.Xml.XPath/KeyPattern.cs b/mcs/class/System.XML/Mono.Xml.XPath/KeyPattern.cs deleted file mode 100644 index 6530c84e660..00000000000 --- a/mcs/class/System.XML/Mono.Xml.XPath/KeyPattern.cs +++ /dev/null @@ -1,34 +0,0 @@ -// -// Mono.Xml.XPath.KeyPattern -// -// Author: -// Ben Maurer (bmaurer@users.sourceforge.net) -// -// (C) 2003 Ben Maurer -// - -using System; -using System.Collections; -using System.IO; -using System.Xml; -using System.Xml.Schema; -using System.Xml.XPath; -using System.Xml.Xsl; - -namespace Mono.Xml.XPath { - internal class KeyPattern : Pattern { - - string arg0, arg1; - - public KeyPattern (string arg0, string arg1) - { - this.arg0 = arg0; - this.arg1 = arg1; - } - - public override bool Matches (XPathNavigator node, XsltContext ctx) - { - throw new NotImplementedException (); - } - } -}
\ No newline at end of file diff --git a/mcs/class/System.XML/Mono.Xml.XPath/LocationPathPattern.cs b/mcs/class/System.XML/Mono.Xml.XPath/LocationPathPattern.cs deleted file mode 100644 index 86d55db29ae..00000000000 --- a/mcs/class/System.XML/Mono.Xml.XPath/LocationPathPattern.cs +++ /dev/null @@ -1,118 +0,0 @@ -// -// Mono.Xml.XPath.LocationPathPattern -// -// Author: -// Ben Maurer (bmaurer@users.sourceforge.net) -// -// (C) 2003 Ben Maurer -// - -using System; -using System.Collections; -using System.IO; -using System.Xml; -using System.Xml.Schema; -using System.Xml.XPath; -using System.Xml.Xsl; - -namespace Mono.Xml.XPath { - internal class LocationPathPattern : Pattern { - - internal Pattern patternPrevious; - internal bool isAncestor; - internal NodeTest nodeTest; - ExprFilter filter; - - public LocationPathPattern (NodeTest nodeTest) - { - this.nodeTest = nodeTest; - } - - public LocationPathPattern (ExprFilter filter) : this ((NodeTest)filter.expr) - { - this.filter = filter; - } - - internal void SetPreviousPattern (Pattern prev, bool isAncestor) - { - this.patternPrevious = prev; - } - - public override double DefaultPriority { - get { - if (patternPrevious == null && filter == null) { - NodeNameTest t = nodeTest as NodeNameTest; - if (t != null) { - if (t.Name.Name == "*") - return -.25; - return 0; - } - - return -.5; - } - return .5; - } - } - - public override bool Matches (XPathNavigator node, XsltContext ctx) - { - if (! nodeTest.Match (ctx, node)) - return false; - - if (nodeTest is NodeTypeTest) { - // node () is different in xslt patterns - if (((NodeTypeTest)nodeTest).type == XPathNodeType.All && - (node.NodeType == XPathNodeType.Root || - node.NodeType == XPathNodeType.Attribute) - ) - return false; - } - - if (filter == null && patternPrevious == null) - return true; - - if (patternPrevious != null) { - if (!isAncestor) { - XPathNavigator parent = node.Clone (); - parent.MoveToParent (); - if (!patternPrevious.Matches (parent, ctx)) - return false; - } else { - XPathNavigator anc = node.Clone (); - while (true) { - if (!anc.MoveToParent ()) - return false; - - if (patternPrevious.Matches (anc, ctx)) - break; - } - } - } - - - if (filter == null) - return true; - - XPathNavigator p = node.Clone (); - p.MoveToParent (); - BaseIterator matches = filter.EvaluateNodeSet (new NullIterator (p, ctx)); - - while (matches.MoveNext ()) { - if (node.IsSamePosition (matches.Current)) - return true; - } - - return false; - } - - public override string ToString () - { - string ret = ""; - if (patternPrevious != null) ret = patternPrevious.ToString () + (isAncestor ? "//" : "/"); - if (filter != null) ret += filter.ToString (); - else ret += nodeTest.ToString (); - - return ret; - } - } -}
\ No newline at end of file diff --git a/mcs/class/System.XML/Mono.Xml.XPath/Pattern.cs b/mcs/class/System.XML/Mono.Xml.XPath/Pattern.cs deleted file mode 100644 index 9c84b695d89..00000000000 --- a/mcs/class/System.XML/Mono.Xml.XPath/Pattern.cs +++ /dev/null @@ -1,85 +0,0 @@ -// -// Mono.Xml.XPath.Pattern -// -// Author: -// Ben Maurer (bmaurer@users.sourceforge.net) -// -// (C) 2003 Ben Maurer -// - -using System; -using System.Collections; -using System.IO; -using System.Xml; -using System.Xml.Schema; -using System.Xml.XPath; -using System.Xml.Xsl; - -namespace Mono.Xml.XPath { - public abstract class Pattern { - - public static Pattern Compile (string s) - { - Tokenizer tokenizer = new Tokenizer (s); - XPathParser parser = new XPathParser (); - Expression expr = (Expression) parser.yyparseSafe (tokenizer); - - return Compile (expr); - } - - internal static Pattern Compile (Expression e) - { - if (e is ExprUNION) - return new UnionPattern ( - Compile (((ExprUNION)e).left), - Compile (((ExprUNION)e).right) - ); - - if (e is ExprRoot) - return new LocationPathPattern ( - new NodeTypeTest (Axes.Self, XPathNodeType.Root) - ); - - if (e is NodeTest) - return new LocationPathPattern ( - (NodeTest)e - ); - - if (e is ExprFilter) - return new LocationPathPattern ( - (ExprFilter)e - ); - - if (e is ExprSLASH) - { - Pattern p0 = Compile (((ExprSLASH)e).left); - LocationPathPattern p1 - = (LocationPathPattern)Compile (((ExprSLASH)e).right); - - p1.SetPreviousPattern (p0, false); - return p1; - } - - if (e is ExprSLASH2) - { - if (((ExprSLASH2)e).right is ExprRoot) - return Compile (((ExprSLASH2)e).right); - - Pattern p0 = Compile (((ExprSLASH2)e).left); - LocationPathPattern p1 - = (LocationPathPattern)Compile (((ExprSLASH2)e).right); - - p1.SetPreviousPattern (p0, true); - return p1; - } - - // TODO: Handle ID/KEY - - throw new Exception ("Invalid Pattern"); - } - - public virtual double DefaultPriority { get { return 0.5; }} - - public abstract bool Matches (XPathNavigator node, XsltContext ctx); - } -}
\ No newline at end of file diff --git a/mcs/class/System.XML/Mono.Xml.XPath/UnionPattern.cs b/mcs/class/System.XML/Mono.Xml.XPath/UnionPattern.cs deleted file mode 100644 index b10ec39221d..00000000000 --- a/mcs/class/System.XML/Mono.Xml.XPath/UnionPattern.cs +++ /dev/null @@ -1,38 +0,0 @@ -// -// Mono.Xml.XPath.UnionPattern -// -// Author: -// Ben Maurer (bmaurer@users.sourceforge.net) -// -// (C) 2003 Ben Maurer -// - -using System; -using System.Collections; -using System.IO; -using System.Xml; -using System.Xml.Schema; -using System.Xml.XPath; -using System.Xml.Xsl; - -namespace Mono.Xml.XPath { - internal class UnionPattern : Pattern { - - public readonly Pattern p0, p1; - - public UnionPattern (Pattern p0, Pattern p1) - { - this.p0 = p0; - this.p1 = p1; - } - - public override bool Matches (XPathNavigator node, XsltContext ctx) - { - return p0.Matches (node, ctx) || p1.Matches (node, ctx); - } - - public override string ToString () { - return p0.ToString () + " | " + p1.ToString (); - } - } -}
\ No newline at end of file diff --git a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog index 147edf3ec3a..8eed6614f01 100644 --- a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog +++ b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog @@ -1,76 +1,3 @@ -2003-08-30 Oleg Tkachenko <oleg@tkachenko.com> - - * XslAttribute.cs: output is now done to TextOutputter, which outputs - to a StringWriter. - * XslVariable.cs: output is done to GenericOutputter. - -2003-08-21 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp> - - * XslVariable.cs : use newly introduced XmlNodeWriter.ctor(false) to - support for tree fragment, not only for single element. - -2003-08-20 Ben Maurer <bmaurer@users.sourceforge.net> - - * XslComment.cs, XslMessage.cs, XslProcessingInsturction.cs: - Ignore element contnet, per spec. (Oleg) - -2003-08-19 Ben Maurer <bmaurer@users.sourceforge.net> - - * XslNumber.cs: Better support for formatting. - -2003-08-19 Ben Maurer <bmaurer@users.sourceforge.net> - - * XslNumber.cs: Support for multiple level numbering - -2003-08-19 Ben Maurer <bmaurer@users.sourceforge.net> - - * XslNumber.cs: Initial support. - -2003-08-19 Ben Maurer <bmaurer@users.sourceforge.net> - - * XslCopyOf.cs, XslLiteralElement: Use namespace support in Outputter. - -2003-08-19 Ben Maurer <bmaurer@users.sourceforge.net> - - * XslVariable.cs: sync to API changes. - -2003-08-18 Ben Maurer <bmaurer@users.sourceforge.net> - - * *.cs: Support for xsl:output. (Oleg) - -2003-08-17 Ben Maurer <bmaurer@users.sourceforge.net> - - * XslCopyOf.cs: handle default ns - * XslFallback.cs: implement - * XslLiteralElement.cs: copy namespaces that were declared. - * XslTemplateContent.cs: handle ext elements - -2003-08-17 Ben Maurer <bmaurer@users.sourceforge.net> - - * XslComment.cs, XslTemplateContent.cs: remove dead variables. - -2003-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * XslComment.cs: patch by BenM that implements Evaluate. - -2003-08-14 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp> - - * XslCallTemplates.cs : Forgot to commit ;-) - -2003-08-14 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp> - - * XslApplyTemplates.cs, - XslCallTemplate.cs : Should accept other than element content such - as comment and PI. - * XslNumber.cs : In Compile(), 'value' might not exist. (Think about - it later if how it should be.) - * XslTemplateContent.cs : "comment" and "number" support. (I know they - are still incomplete.) - -2003-08-14 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp> - - * Added XslComment.cs. - 2003-08-05 Ben Maurer <bmaurer@users.sourceforge.net> * XslVariable.cs: Fix up how variables are evaluated. diff --git a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslApplyTemplates.cs b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslApplyTemplates.cs index 77d514df8c0..08861c0dc7a 100644 --- a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslApplyTemplates.cs +++ b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslApplyTemplates.cs @@ -31,32 +31,22 @@ namespace Mono.Xml.Xsl.Operations { if (c.Input.MoveToFirstChild ()) { do { - switch (c.Input.NodeType) { - case XPathNodeType.Comment: - case XPathNodeType.ProcessingInstruction: - case XPathNodeType.Whitespace: - continue; - case XPathNodeType.Element: - if (c.Input.NamespaceURI != XsltNamespace) - throw new Exception ("unexptected element"); // TODO: fwd compat - - switch (c.Input.LocalName) - { - case "with-param": - withParams.Add (new XslVariableInformation (c)); - break; - - case "sort": - if (select == null) - select = c.CompileExpression ("*"); - c.AddSort (select, new Sort (c)); - break; - default: - throw new Exception ("unexptected element"); // todo forwards compat - } - break; - default: - throw new Exception ("unexpected node type " + c.Input.NodeType); // todo forwards compat + if (c.Input.NamespaceURI != XsltNamespace) + throw new Exception ("unexptected element"); // TODO: fwd compat + + switch (c.Input.LocalName) + { + case "with-param": + withParams.Add (new XslVariableInformation (c)); + break; + + case "sort": + if (select == null) + select = c.CompileExpression ("*"); + c.AddSort (select, new Sort (c)); + break; + default: + throw new Exception ("unexptected element"); // todo forwards compat } } while (c.Input.MoveToNext ()); c.Input.MoveToParent (); diff --git a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslAttribute.cs b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslAttribute.cs index a3d01f8393d..b5b839e7f15 100644 --- a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslAttribute.cs +++ b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslAttribute.cs @@ -14,7 +14,6 @@ using System.Collections; using System.Xml; using System.Xml.XPath; using System.Xml.Xsl; -using System.IO; using QName = System.Xml.XmlQualifiedName; @@ -54,20 +53,13 @@ namespace Mono.Xml.Xsl.Operations { nm = calcName != null ? calcName : name.Evaluate (p); nmsp = calcNs != null ? calcNs : ns != null ? ns.Evaluate (p) : null; - if (nmsp == null) + if (nmsp != null) + p.Out.WriteStartAttribute (XslNameUtil.LocalNameOf (nm), nmsp); + else throw new NotImplementedException (); - if (value == null) - p.Out.WriteAttributeString("", XslNameUtil.LocalNameOf(nm), nmsp, ""); - else { - StringWriter sw = new StringWriter(); - Outputter outputter = new TextOutputter(sw, true); - p.PushOutput(outputter); - value.Evaluate (p); - p.PopOutput(); - outputter.Done(); - p.Out.WriteAttributeString("", XslNameUtil.LocalNameOf(nm), nmsp, sw.ToString()); - } + if (value != null) value.Evaluate (p); + p.Out.WriteEndAttribute (); } } } diff --git a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslCallTemplate.cs b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslCallTemplate.cs index 5bc4cca8747..26989010d73 100644 --- a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslCallTemplate.cs +++ b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslCallTemplate.cs @@ -28,26 +28,16 @@ namespace Mono.Xml.Xsl.Operations { if (c.Input.MoveToFirstChild ()) { do { - switch (c.Input.NodeType) { - case XPathNodeType.Comment: - case XPathNodeType.ProcessingInstruction: - case XPathNodeType.Whitespace: - continue; - case XPathNodeType.Element: - if (c.Input.NamespaceURI != XsltNamespace) - throw new Exception ("unexptected element"); // TODO: fwd compat - - switch (c.Input.LocalName) - { - case "with-param": - withParams.Add (new XslVariableInformation (c)); - break; - default: - throw new Exception ("unexptected element"); // todo forwards compat - } - break; - default: - throw new Exception ("unexptected node type " + c.Input.NodeType); // TODO: fwd compat + if (c.Input.NamespaceURI != XsltNamespace) + throw new Exception ("unexptected element"); // TODO: fwd compat + + switch (c.Input.LocalName) + { + case "with-param": + withParams.Add (new XslVariableInformation (c)); + break; + default: + throw new Exception ("unexptected element"); // todo forwards compat } } while (c.Input.MoveToNext ()); c.Input.MoveToParent (); diff --git a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslComment.cs b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslComment.cs deleted file mode 100644 index defe7cd1242..00000000000 --- a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslComment.cs +++ /dev/null @@ -1,45 +0,0 @@ -// -// XslComment.cs -// -// Authors: -// Ben Maurer (bmaurer@users.sourceforge.net) -// Atsushi Enomoto (ginga@kit.hi-ho.ne.jp) -// -// (C) 2003 Ben Maurer -// (C) 2003 Atsushi Enomoto -// - -using System; -using System.Collections; -using System.IO; -using System.Xml; -using System.Xml.XPath; -using System.Xml.Xsl; - -namespace Mono.Xml.Xsl.Operations { - public class XslComment : XslCompiledElement { - bool disableOutputEscaping = false; - XslOperation value; - - public XslComment (Compiler c) : base (c) {} - - protected override void Compile (Compiler c) - { - if (c.Input.MoveToFirstChild ()) { - value = c.CompileTemplateContent (); - c.Input.MoveToParent (); - } - } - - public override void Evaluate (XslTransformProcessor p) - { - StringWriter s = new StringWriter (); - Outputter outputter = new TextOutputter(s, true); - p.PushOutput (outputter); - value.Evaluate (p); - p.PopOutput (); - - p.Out.WriteComment (s.ToString ()); - } - } -} diff --git a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslCopyOf.cs b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslCopyOf.cs index 3fc6d785956..cace0871d22 100644 --- a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslCopyOf.cs +++ b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslCopyOf.cs @@ -25,22 +25,22 @@ namespace Mono.Xml.Xsl.Operations { select = c.CompileExpression (c.GetAttribute ("select")); } - void CopyNode (Outputter outputter, XPathNavigator nav) + void CopyNode (XmlWriter w, XPathNavigator nav) { switch (nav.NodeType) { case XPathNodeType.Root: XPathNodeIterator itr = nav.SelectChildren (XPathNodeType.All); while (itr.MoveNext ()) - CopyNode (outputter, itr.Current); + CopyNode (w, itr.Current); break; case XPathNodeType.Element: - outputter.WriteStartElement (nav.Prefix, nav.LocalName, nav.NamespaceURI); + w.WriteStartElement (nav.Prefix, nav.LocalName, nav.NamespaceURI); if (nav.MoveToFirstNamespace (XPathNamespaceScope.Local)) { do { - outputter.WriteNamespaceDecl (nav.Name, nav.Value); + w.WriteAttributeString ("xmlns", nav.Name, null, nav.Value); } while (nav.MoveToNextNamespace (XPathNamespaceScope.Local)); nav.MoveToParent (); } @@ -48,33 +48,33 @@ namespace Mono.Xml.Xsl.Operations { if (nav.MoveToFirstAttribute()) { do { - outputter.WriteStartAttribute (nav.Prefix, nav.LocalName, nav.NamespaceURI); - outputter.WriteString (nav.Value); - outputter.WriteEndAttribute (); + w.WriteStartAttribute (nav.Prefix, nav.LocalName, nav.NamespaceURI); + w.WriteString (nav.Value); + w.WriteEndAttribute (); } while (nav.MoveToNextAttribute ()); nav.MoveToParent(); } if (nav.MoveToFirstChild ()) { do { - CopyNode (outputter, nav); + CopyNode (w, nav); } while (nav.MoveToNext ()); nav.MoveToParent (); } - outputter.WriteEndElement (); + w.WriteEndElement (); break; case XPathNodeType.Whitespace: case XPathNodeType.SignificantWhitespace: case XPathNodeType.Text: - outputter.WriteString (nav.Value); + w.WriteString (nav.Value); break; case XPathNodeType.ProcessingInstruction: - outputter.WriteProcessingInstruction (nav.Name, nav.Value); + w.WriteProcessingInstruction (nav.Name, nav.Value); break; case XPathNodeType.Comment: - outputter.WriteComment (nav.Value); + w.WriteComment (nav.Value); break; } } diff --git a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslFallback.cs b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslFallback.cs index 01ff98fcfb6..a46a8dde98d 100644 --- a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslFallback.cs +++ b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslFallback.cs @@ -31,7 +31,7 @@ namespace Mono.Xml.Xsl.Operations { public override void Evaluate (XslTransformProcessor p) { - children.Evaluate (p); + throw new NotImplementedException (); } } } diff --git a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslLiteralElement.cs b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslLiteralElement.cs index d515a24c098..ca568b75cc1 100644 --- a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslLiteralElement.cs +++ b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslLiteralElement.cs @@ -21,7 +21,6 @@ namespace Mono.Xml.Xsl.Operations { string localname, prefix, nsUri; ArrayList attrs = new ArrayList (); XmlQualifiedName [] useAttributeSets; - Hashtable nsDecls; public XslLiteralElement (Compiler c) : base (c) {} @@ -50,7 +49,6 @@ namespace Mono.Xml.Xsl.Operations { this.nsUri = c.Input.NamespaceURI; this.localname = c.Input.LocalName; this.useAttributeSets = c.ParseQNameListAttribute ("use-attribute-sets", XsltNamespace); - this.nsDecls = c.GetNamespacesToCopy (); if (c.Input.MoveToFirstAttribute ()) { @@ -71,9 +69,6 @@ namespace Mono.Xml.Xsl.Operations { { p.Out.WriteStartElement (prefix, localname, nsUri); - foreach (DictionaryEntry de in nsDecls) - p.Out.WriteNamespaceDecl ((string)de.Key, (string)de.Value); - foreach (XslLiteralAttribute a in attrs) a.Evaluate (p); diff --git a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslMessage.cs b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslMessage.cs index a0e90bc86d8..50f2c6ae6a8 100644 --- a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslMessage.cs +++ b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslMessage.cs @@ -34,7 +34,7 @@ namespace Mono.Xml.Xsl.Operations { public override void Evaluate (XslTransformProcessor p) { if (children != null) { - p.PushOutput (new TextOutputter(Console.Error, true)); + p.PushOutput (new XmlTextWriter (Console.Error)); children.Evaluate (p); p.PopOutput (); } diff --git a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslNumber.cs b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslNumber.cs index ed3c777f694..25fd81b7439 100644 --- a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslNumber.cs +++ b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslNumber.cs @@ -14,8 +14,6 @@ using System.Collections; using System.Xml; using System.Xml.XPath; using System.Xml.Xsl; -using System.Text; -using Mono.Xml.XPath; namespace Mono.Xml.Xsl.Operations { public class XslNumber : XslCompiledElement { @@ -24,9 +22,9 @@ namespace Mono.Xml.Xsl.Operations { // level = "single" | "multiple" | "any" XslNumberingLevel level; // count = pattern - Pattern count; + XPathExpression count; // from = pattern - Pattern from; + XPathExpression from; // value = number-expression XPathExpression value; // format = { string } @@ -66,7 +64,7 @@ namespace Mono.Xml.Xsl.Operations { from = c.CompilePattern (c.GetAttribute ("from")); value = c.CompileExpression (c.GetAttribute ("value")); - if (value != null && value.ReturnType != XPathResultType.Number && value.ReturnType != XPathResultType.Any) + if (value.ReturnType != XPathResultType.Number && value.ReturnType != XPathResultType.Any) throw new Exception ("The expression for attribute 'value' must return a number"); format = c.ParseAvtAttribute ("format"); @@ -116,304 +114,36 @@ namespace Mono.Xml.Xsl.Operations { switch (this.level) { case XslNumberingLevel.Single: - return nf.Format (NumberSingle (p)); + throw new NotImplementedException (); case XslNumberingLevel.Multiple: - return nf.Format (NumberMultiple (p)); + throw new NotImplementedException (); case XslNumberingLevel.Any: - return nf.Format (NumberAny (p)); + throw new NotImplementedException (); default: throw new Exception ("Should not get here"); } } - int [] NumberMultiple (XslTransformProcessor p) - { - ArrayList nums = new ArrayList (); - XPathNavigator n = p.CurrentNode.Clone (); - - bool foundFrom = false; - - do { - if (MatchesFrom (n, p)) { - foundFrom = true; - break; - } - - if (MatchesCount (n, p)) { - int i = 1; - while (n.MoveToPrevious ()) { - if (MatchesCount (n, p)) i++; - } - nums.Add (i); - } - } while (n.MoveToParent ()); - - if (!foundFrom) return new int [0]; - - int [] ret = new int [nums.Count]; - int pos = nums.Count; - foreach (int num in nums) - ret [--pos] = num; - - return ret; - } - int NumberAny (XslTransformProcessor p) - { - int i = 0; - XPathNavigator n = p.CurrentNode.Clone (); - do { - do { - if (MatchesCount (n, p)) i++; - if (MatchesFrom (n, p)) return i; - } while (n.MoveToPrevious ()); - } while (n.MoveToParent ()); - return 0; - } - int NumberSingle (XslTransformProcessor p) - { - XPathNavigator n = p.CurrentNode.Clone (); - - while (!MatchesCount (n, p)) { - if (from != null && MatchesFrom (n, p)) - return 0; - - if (!n.MoveToParent ()) - return 0; - } - - if (from != null) { - XPathNavigator tmp = n.Clone (); - if (MatchesFrom (tmp, p)) - // Was not desc of closest matches from - return 0; - - bool found = false; - while (tmp.MoveToParent ()) - if (MatchesFrom (tmp, p)) { - found = true; break; - } - if (!found) - // not desc of matches from - return 0; - } - - int i = 1; - - while (n.MoveToPrevious ()) { - if (MatchesCount (n, p)) i++; - } - - return i; - } - - bool MatchesCount (XPathNavigator item, XslTransformProcessor p) - { - if (count == null) - return item.LocalName == p.CurrentNode.LocalName && - item.NamespaceURI == p.CurrentNode.NamespaceURI; - else - return p.Matches (count, item); - } - - bool MatchesFrom (XPathNavigator item, XslTransformProcessor p) - { - if (from == null) - return item.NodeType == XPathNodeType.Root; - else - return p.Matches (from, item); - } - class XslNumberFormatter { - string firstSep = "", lastSep = ""; - ArrayList fmtList = new ArrayList (); - public XslNumberFormatter (string format, string lang, string letterValue, char groupingSeparator, int groupingSize) { - // We dont do any i18n now, so we ignore lang and letterValue. - if (format == null || format == "") - fmtList.Add (FormatItem.GetItem (null, "1", groupingSeparator, groupingSize)); - else { - NumberFormatterScanner s = new NumberFormatterScanner (format); - - string sep, itm; - - sep = s.Advance (false); - itm = s.Advance (true); - - if (itm == null) { - lastSep = sep; - fmtList.Add (FormatItem.GetItem (null, "1", groupingSeparator, groupingSize)); - } else { - firstSep = sep; - sep = null; - - while (itm != null) { - fmtList.Add (FormatItem.GetItem (sep, itm, groupingSeparator, groupingSize)); - sep = s.Advance (false); - itm = s.Advance (true); - } - - lastSep = sep; - } - } + throw new NotImplementedException (); + } + + public int NumbersNeeded { + get { throw new NotImplementedException (); } } // return the format for a single value, ie, if using Single or Any public string Format (int value) { - StringBuilder b = new StringBuilder (); - if (firstSep != null) b.Append (firstSep); - ((FormatItem)fmtList [0]).Format (b, value); - if (lastSep != null) b.Append (lastSep); - - return b.ToString (); + throw new NotImplementedException (); } // format for an array of numbers. public string Format (int [] values) { - StringBuilder b = new StringBuilder (); - if (firstSep != null) b.Append (firstSep); - - int i = 0; - foreach (int v in values) { - FormatItem itm = (FormatItem)fmtList [i]; - if (i > 0) b.Append (itm.sep); - itm.Format (b, v); - - if (++i == fmtList.Count) - i--; - } - - if (lastSep != null) b.Append (lastSep); - - return b.ToString (); - } - - class NumberFormatterScanner { - int pos = 0, len; - string fmt; - - public NumberFormatterScanner (string fmt) { - this.fmt = fmt; - len = fmt.Length; - } - - public string Advance (bool alphaNum) - { - int start = pos; - while ((pos < len) && (char.IsLetterOrDigit (fmt, pos) == alphaNum)) - pos++; - - if (pos == start) - return null; - else - return fmt.Substring (start, pos - start); - } - } - - abstract class FormatItem { - public readonly string sep; - public FormatItem (string sep) - { - this.sep = sep; - } - - public abstract void Format (StringBuilder b, int num); - - public static FormatItem GetItem (string sep, string item, char gpSep, int gpSize) - { - switch (item [0]) - { - case '0': case '1': - return new DigitItem (sep, item.Length, gpSep, gpSize); - case 'a': - return new AlphaItem (sep, false); - case 'A': - return new AlphaItem (sep, true); - case 'i': - return new RomanItem (sep, false); - case 'I': - return new RomanItem (sep, true); - - default: - throw new Exception (); - } - } - } - - class AlphaItem : FormatItem { - bool uc; - static readonly char [] ucl = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'}; - static readonly char [] lcl = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}; - - public AlphaItem (string sep, bool uc) : base (sep) - { - this.uc = uc; - } - - public override void Format (StringBuilder b, int num) - { - alphaSeq (b, num, uc ? ucl : lcl); - } - - static void alphaSeq (StringBuilder b, int n, char [] alphabet) { - if (n > alphabet.Length) - alphaSeq (b, (n-1) / alphabet.Length, alphabet); - b.Append (alphabet [(n-1) % alphabet.Length]); - } - } - - class RomanItem : FormatItem { - bool uc; - public RomanItem (string sep, bool uc) : base (sep) - { - this.uc = uc; - } - static readonly string [] ucrDigits = - { "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I" }; - static readonly string [] lcrDigits = - { "m", "cm", "d", "cd", "c", "xc", "l", "xl", "x", "ix", "v", "iv", "i" }; - static readonly int [] decValues = - {1000, 900 , 500, 400 , 100, 90 , 50 , 40 , 10 , 9 , 5 , 4 , 1 }; - - public override void Format (StringBuilder b, int num) - { - if (num < 1 || num > 4999) { - b.Append (num); - return; - } - - for (int i = 0; i < decValues.Length; i++) { - while (decValues [i] <= num) { - if (uc) - b.Append (ucrDigits [i]); - else - b.Append (lcrDigits [i]); - - num -= decValues [i]; - } - if (num == 0) break; - } - } - } - - class DigitItem : FormatItem { - System.Globalization.NumberFormatInfo nfi; - - public DigitItem (string sep, int len, char gpSep, int gpSize) : base (sep) - { - nfi = new System.Globalization.NumberFormatInfo (); - nfi.NumberDecimalDigits = 0; - nfi.NumberGroupSizes = new int [] {gpSize}; - nfi.NumberGroupSeparator = gpSep.ToString (); - // TODO use len to get min number of digits. - } - - public override void Format (StringBuilder b, int num) - { - b.Append (num.ToString ("N", nfi)); - } + throw new NotImplementedException (); } } } diff --git a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslProcessingInstruction.cs b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslProcessingInstruction.cs index 462f808212a..dbcee1de283 100644 --- a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslProcessingInstruction.cs +++ b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslProcessingInstruction.cs @@ -35,8 +35,9 @@ namespace Mono.Xml.Xsl.Operations { public override void Evaluate (XslTransformProcessor p) { StringWriter s = new StringWriter (); - Outputter outputter = new TextOutputter(s, true); - p.PushOutput (outputter); + XmlWriter w = new XmlTextWriter (s); + + p.PushOutput (w); value.Evaluate (p); p.PopOutput (); diff --git a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslTemplateContent.cs b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslTemplateContent.cs index 9b66c82a174..c9a90078ccf 100644 --- a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslTemplateContent.cs +++ b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslTemplateContent.cs @@ -18,6 +18,7 @@ using System.Xml.Xsl; namespace Mono.Xml.Xsl.Operations { public class XslTemplateContent : XslCompiledElement { ArrayList content = new ArrayList (); + ArrayList variables; bool hasStack; int stackSize; @@ -52,8 +53,7 @@ namespace Mono.Xml.Xsl.Operations { content.Add (new XslChoose (c)); break; case "comment": - content.Add (new XslComment (c)); - break; + throw new NotImplementedException (); case "copy": content.Add (new XslCopy (c)); break; @@ -76,8 +76,7 @@ namespace Mono.Xml.Xsl.Operations { content.Add (new XslMessage(c)); break; case "number": - content.Add (new XslNumber(c)); - break; + throw new NotImplementedException (); case "processing-instruction": content.Add (new XslProcessingInstruction(c)); break; @@ -96,17 +95,7 @@ namespace Mono.Xml.Xsl.Operations { } break; default: - if (!c.IsExtensionNamespace (n.NamespaceURI)) - content.Add (new XslLiteralElement(c)); - else { - if (n.MoveToFirstChild ()) { - do { - if (n.NamespaceURI == XsltNamespace && n.LocalName == "fallback") - content.Add (new XslFallback (c)); - } while (n.MoveToNext ()); - n.MoveToParent (); - } - } + content.Add (new XslLiteralElement(c)); break; } break; diff --git a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslVariable.cs b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslVariable.cs index ccc723e74dd..e7cbaab37f2 100644 --- a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslVariable.cs +++ b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslVariable.cs @@ -45,9 +45,8 @@ namespace Mono.Xml.Xsl.Operations { if (select != null) { return p.Evaluate (select); } else if (content != null) { - XmlNodeWriter w = new XmlNodeWriter (false); - Outputter outputter = new GenericOutputter(w, p.Outputs); - p.PushOutput (outputter); + XmlNodeWriter w = new XmlNodeWriter (); + p.PushOutput (w); content.Evaluate (p); p.PopOutput (); return w.Document.CreateNavigator ().SelectChildren (XPathNodeType.All); diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/Attribute.cs b/mcs/class/System.XML/Mono.Xml.Xsl/Attribute.cs deleted file mode 100644 index 8fa3011bad8..00000000000 --- a/mcs/class/System.XML/Mono.Xml.Xsl/Attribute.cs +++ /dev/null @@ -1,28 +0,0 @@ -// -// Attribute.cs -// -// Authors: -// Oleg Tkachenko (oleg@tkachenko.com) -// -// (C) 2003 Oleg Tkachenko -// - -using System; -using System.Xml; - -namespace Mono.Xml.Xsl { - /// <summary> - /// XML attribute. - /// </summary> - public class Attribute { - public string Prefix; - public XmlQualifiedName QName; - public string Value; - - public Attribute(string prefix, XmlQualifiedName qName, string value){ - Prefix = prefix; - QName = qName; - Value = value; - } - } -} diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog b/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog index c53b968e5c8..ab739d44a70 100644 --- a/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog +++ b/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog @@ -1,99 +1,3 @@ -2003-08-30 Oleg Tkachenko <oleg@tkachenko.com> - - * New files: - GenericOutputter.cs - generic Outputter implementation, - Attribute.cs - represents outputted attribute, - Emitter.cs - abstract output emitter, - TextEmitter.cs - text emitter, - XmlWriterEmitter.cs - emitter to XmlWriter. - * Checking of duplicating attributes is done in GenericOutputter. - * Namespace outputting logic is implemented in GenericOutputter. - * Outputter.cs: Writing namespace declarations is delegated to - derived classes (GenericOutputter). - * XslOutput.cs: standalone flag is now 3-value enum (NONE, YES, NO). - -2003-08-21 Ben Maurer <bmaurer@users.sourceforge.net> - - * XslTransformProcessor.cs: evaluate variables at beginning - when / is current node. - -2003-08-21 Ben Maurer <bmaurer@users.sourceforge.net> - - * Compiler.cs, XsltCompiledContext.cs, XslTransformProcessorcs: - Fix up namespace handeling - -2003-08-20 Ben Maurer <bmaurer@users.sourceforge.net> - - * Compiler.cs, XslStylesheet.cs, XsltCompiledContext.cs: Stubs for - format-number. - * XslDecimalFormat.cs: Stub for decimal-format. - -2003-08-20 Ben Maurer <bmaurer@users.sourceforge.net> - - * TextOutputter.cs: Add option to ignore element content (Oleg). - -2003-08-19 Ben Maurer <bmaurer@users.sourceforge.net> - - * Compiler.cs: Really give null for blank avt's - -2003-08-19 Ben Maurer <bmaurer@users.sourceforge.net> - - * Compiler.cs: Fixed lre/lre04. - -2003-08-19 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp> - - * Compiler.cs : Fixed XslNameUtil.FromString() so that unprefixed name - won't have default namespace. See http://www.w3.org/TR/xslt#qname - -2003-08-19 Ben Maurer <bmaurer@users.sourceforge.net> - - * XslTransformProcessor.cs: add support for resolving documents. - * XsltCompiledContext: add support for document () function. - -2003-08-19 Ben Maurer <bmaurer@users.sourceforge.net> - - * Outputter.cs, TextOutputter.cs, XmlOutputter.cs: Implement some - of the abstract methods in Outputter, making them call other - functions with default values, remove impl's in derived classes. - -2003-08-19 Ben Maurer <bmaurer@users.sourceforge.net> - - * Outputter.cs: s/Close/Done - * TextOutputter.cs, XmlOutputter.cs: Flush, don't close the backing. - * XslTransformProcessor.cs: Flush output when popping, pop at end. - -2003-08-19 Ben Maurer <bmaurer@users.sourceforge.net> - - * Outputter.cs: Add support for namespaces. - -2003-08-19 Ben Maurer <bmaurer@users.sourceforge.net> - - * Compiler.cs, XslOutput.cs, XslStylesheet.cs, - XslTransformProcessor.cs: move output logic from XslStylesheet to - Compiler. - -2003-08-18 Ben Maurer <bmaurer@users.sourceforge.net> - - * XslOutput.cs: add support for encoding. - -2003-08-18 Ben Maurer <bmaurer@users.sourceforge.net> - - * *.cs: Support for xsl:output. (Oleg) - -2003-08-17 Ben Maurer <bmaurer@users.sourceforge.net> - - * Compiler.cs: handle extension and excluded namespaces. - -2003-08-17 Ben Maurer <bmaurer@users.sourceforge.net> - - * XsltCompiledContext.cs, Compiler.cs: copy the XPathNavigator - from the stylesheet for correct namespace resolution. - -2003-08-14 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp> - - * Compiler.cs : 1) Changed public .ctor() to receive Evidence argument - introduced in .NET 1.1. 2) XmlResolver object is required for 'res'. - 2003-08-07 Ben Maurer <bmaurer@users.sourceforge.net> * XslTransformProcessor.cs: Add a table to detect when an object diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/Compiler.cs b/mcs/class/System.XML/Mono.Xml.Xsl/Compiler.cs index 95d507bdd96..df22c290aca 100644 --- a/mcs/class/System.XML/Mono.Xml.Xsl/Compiler.cs +++ b/mcs/class/System.XML/Mono.Xml.Xsl/Compiler.cs @@ -13,7 +13,6 @@ using System; using System.CodeDom; using System.Collections; using System.Collections.Specialized; -using System.Security.Policy; using System.Xml; using System.Xml.Schema; using System.Xml.XPath; @@ -21,7 +20,6 @@ using System.Xml.Xsl; using System.IO; using Mono.Xml.Xsl.Operations; -using Mono.Xml.XPath; using QName = System.Xml.XmlQualifiedName; @@ -33,10 +31,8 @@ namespace Mono.Xml.Xsl { ExpressionStore exprStore; XmlNamespaceManager nsMgr; ArrayList keys; - Hashtable outputs; - Hashtable decimalFormats; - public CompiledStylesheet (XslStylesheet style, Hashtable globalVariables, Hashtable attrSets, ExpressionStore exprStore, XmlNamespaceManager nsMgr, ArrayList keys, Hashtable outputs, Hashtable decimalFormats) + public CompiledStylesheet (XslStylesheet style, Hashtable globalVariables, Hashtable attrSets, ExpressionStore exprStore, XmlNamespaceManager nsMgr, ArrayList keys) { this.style = style; this.globalVariables = globalVariables; @@ -44,23 +40,12 @@ namespace Mono.Xml.Xsl { this.exprStore = exprStore; this.nsMgr = nsMgr; this.keys = keys; - this.outputs = outputs; - this.decimalFormats = decimalFormats; } public Hashtable Variables {get{return globalVariables;}} public XslStylesheet Style { get { return style; }} public ExpressionStore ExpressionStore {get{return exprStore;}} public XmlNamespaceManager NamespaceManager {get{return nsMgr;}} public ArrayList Keys {get { return keys;}} - public Hashtable Outputs { get { return outputs; }} - - public XslDecimalFormat LookupDecimalFormat (QName name) - { - XslDecimalFormat ret = decimalFormats [name] as XslDecimalFormat; - if (ret == null && name == QName.Empty) - return XslDecimalFormat.Default; - return ret; - } public XslGeneralVariable ResolveVariable (QName name) { @@ -91,18 +76,12 @@ namespace Mono.Xml.Xsl { XmlResolver res; XslStylesheet rootStyle; - Hashtable outputs = new Hashtable (); - public CompiledStylesheet Compile (XPathNavigator nav, XmlResolver res, Evidence evidence) + public CompiledStylesheet Compile (XPathNavigator nav, XmlResolver res) { this.res = res; - if (res == null) - this.res = new XmlUrlResolver (); - if (!nav.MoveToFirstChild ()) throw new Exception ("WTF?"); - outputs [""] = new XslOutput (""); - while (nav.NodeType != XPathNodeType.Element) nav.MoveToNext(); PushInputDocument (nav); @@ -115,7 +94,7 @@ namespace Mono.Xml.Xsl { } this.rootStyle = new XslStylesheet (this); - return new CompiledStylesheet (rootStyle, globalVariables, attrSets, exprStore, nsMgr, keys, outputs, decimalFormats); + return new CompiledStylesheet (rootStyle, globalVariables, attrSets, exprStore, nsMgr, keys); } #region Input @@ -240,21 +219,16 @@ namespace Mono.Xml.Xsl { public XslAvt ParseAvt (string s) { - if (s == null || s == string.Empty) return null; + if (s == null) return null; return new XslAvt (s, this); } #endregion #region Compile - public Pattern CompilePattern (string pattern) + public XPathExpression CompilePattern (string pattern) { - if (pattern == null || pattern == "") return null; - Pattern p = Pattern.Compile (pattern); - - exprStore.AddPattern (p, this); - - return p; + return CompileExpression (pattern); // TODO validate, get priority } public XPathExpression CompileExpression (string expression) @@ -318,74 +292,6 @@ namespace Mono.Xml.Xsl { } public VariableScope CurrentVariableScope { get { return curVarScope; }} #endregion - -#region Scope (version, {excluded, extension} namespaces) - [MonoTODO ("This will work, but is *very* slow")] - public bool IsExtensionNamespace (string nsUri) - { - if (nsUri == XsltNamespace) return true; - - XPathNavigator nav = Input.Clone (); - XPathNavigator nsScope = nav.Clone (); - do { - bool isXslt = nav.NamespaceURI == XsltNamespace; - nsScope.MoveTo (nav); - if (nav.MoveToFirstAttribute ()) { - do { - if (nav.LocalName == "extension-element-prefixes" && - nav.NamespaceURI == (isXslt ? String.Empty : XsltNamespace)) - { - - foreach (string ns in nav.Value.Split (' ')) - if (nsScope.GetNamespace (ns == "#default" ? "" : ns) == nsUri) - return true; - } - } while (nav.MoveToNextAttribute ()); - nav.MoveToParent (); - } - } while (nav.MoveToParent ()); - - return false; - } - - public Hashtable GetNamespacesToCopy () - { - Hashtable ret = new Hashtable (); - - XPathNavigator nav = Input.Clone (); - XPathNavigator nsScope = nav.Clone (); - - if (nav.MoveToFirstNamespace (XPathNamespaceScope.ExcludeXml)) { - do { - if (nav.Value != XsltNamespace && !ret.Contains (nav.Name)) - ret.Add (nav.Name, nav.Value); - } while (nav.MoveToNextNamespace (XPathNamespaceScope.ExcludeXml)); - nav.MoveToParent (); - } - - do { - bool isXslt = nav.NamespaceURI == XsltNamespace; - nsScope.MoveTo (nav); - - if (nav.MoveToFirstAttribute()) { - do { - if ((nav.LocalName == "extension-element-prefixes" || nav.LocalName == "exclude-result-prefixes") && - nav.NamespaceURI == (isXslt ? String.Empty : XsltNamespace)) - { - foreach (string ns in nav.Value.Split (' ')) { - if ((string)ret [ns] == nsScope.GetNamespace (ns == "#default" ? "" : ns)) - ret.Remove (ns); - } - } - } while (nav.MoveToNextAttribute ()); - nav.MoveToParent(); - } - } while (nav.MoveToParent ()); - - return ret; - } -#endregion - #region Key ArrayList keys = new ArrayList (); @@ -394,32 +300,6 @@ namespace Mono.Xml.Xsl { keys.Add (key); } #endregion - -#region Decimal Format - Hashtable decimalFormats = new Hashtable (); - - public void CompileDecimalFormat () - { - QName nm = ParseQNameAttribute ("name"); - - if (decimalFormats.Contains (nm)) - ((XslDecimalFormat)decimalFormats [nm]).CheckSameAs (this); - else - decimalFormats [nm] = new XslDecimalFormat (this); - } -#endregion - - public void CompileOutput () - { - XPathNavigator n = Input; - string uri = n.GetAttribute ("href", ""); - XslOutput output = outputs [uri] as XslOutput; - if (output == null) { - output = new XslOutput (uri); - outputs.Add (uri, output); - } - output.Fill (n); - } } public class VariableScope { @@ -462,6 +342,7 @@ namespace Mono.Xml.Xsl { if (v.IsEvaluated (p)) return v; } + return null; } } @@ -556,28 +437,10 @@ namespace Mono.Xml.Xsl { Hashtable exprToVarCtx = new Hashtable (); Hashtable exprToSorts = new Hashtable (); - Hashtable exprToDocument = new Hashtable (); public void AddExpression (XPathExpression e, Compiler c) { exprToVarCtx [e] = c.CurrentVariableScope; - - XPathNavigator nsScope = c.Input.Clone (); - if (nsScope.NodeType == XPathNodeType.Attribute) - nsScope.MoveToParent (); - - exprToDocument [e] = nsScope; - } - - public void AddPattern (Pattern p, Compiler c) - { - exprToVarCtx [p] = c.CurrentVariableScope; - - XPathNavigator nsScope = c.Input.Clone (); - if (nsScope.NodeType == XPathNodeType.Attribute) - nsScope.MoveToParent (); - - exprToDocument [p] = nsScope; } public void AddSort (XPathExpression e, Sort s) @@ -595,7 +458,7 @@ namespace Mono.Xml.Xsl { { XPathExpression expr = e.Clone (); - expr.SetContext (new XsltCompiledContext (p, (VariableScope)exprToVarCtx [e], (XPathNavigator)exprToDocument [e])); + expr.SetContext (new XsltCompiledContext (p, (VariableScope)exprToVarCtx [e])); if (exprToSorts.Contains (e)) { foreach (Sort s in (ArrayList)exprToSorts [e]) @@ -603,13 +466,6 @@ namespace Mono.Xml.Xsl { } return expr; } - - public bool PatternMatches (Pattern p, XslTransformProcessor proc, XPathNavigator n) - { - XsltContext c = new XsltCompiledContext (proc, (VariableScope)exprToVarCtx [p], (XPathNavigator)exprToDocument [p]); - - return p.Matches (n, c); - } } public class XslNameUtil @@ -618,10 +474,9 @@ namespace Mono.Xml.Xsl { { int colon = name.IndexOf (':'); if (colon > 0) - return new QName (name.Substring (colon+ 1), current.GetNamespace (name.Substring (0, colon))); + return new QName (name.Substring (colon, name.Length - colon), current.GetNamespace (name.Substring (0, colon))); else if (colon < 0) - // Default namespace is not used for unprefixed names. - return new QName (name, ""); + return new QName (name, current.GetNamespace ("")); else throw new ArgumentException ("Invalid name: " + name); } @@ -630,10 +485,9 @@ namespace Mono.Xml.Xsl { { int colon = name.IndexOf (':'); if (colon > 0) - return new QName (name.Substring (colon + 1), ctx.LookupNamespace (name.Substring (0, colon))); + return new QName (name.Substring (colon, name.Length - colon), ctx.LookupNamespace (name.Substring (0, colon))); else if (colon < 0) - // Default namespace is not used for unprefixed names. - return new QName (name, ""); + return new QName (name, ctx.LookupNamespace ("")); else throw new ArgumentException ("Invalid name: " + name); } diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/Emitter.cs b/mcs/class/System.XML/Mono.Xml.Xsl/Emitter.cs deleted file mode 100644 index b8cedfcd325..00000000000 --- a/mcs/class/System.XML/Mono.Xml.Xsl/Emitter.cs +++ /dev/null @@ -1,34 +0,0 @@ -// -// Emitter.cs -// -// Authors: -// Oleg Tkachenko (oleg@tkachenko.com) -// -// (C) 2003 Oleg Tkachenko -// - -using System; - -namespace Mono.Xml.Xsl { - /// <summary> - /// Abstract emitter. Implementations of this class deals with outputting - /// result tree to specific output format, such as XML, HTML, Text. - /// Implementations for additional formats (e.g. XHTML) as well as custom - /// implementations may be supported either. - /// </summary> - public abstract class Emitter { - public abstract void WriteStartDocument (StandaloneType standalone); - public abstract void WriteEndDocument (); - public abstract void WriteDocType (string type, string publicId, string systemId); - public abstract void WriteStartElement (string prefix, string localName, string nsURI); - public abstract void WriteEndElement (); - public abstract void WriteAttributeString (string prefix, string localName, string nsURI, string value); - public abstract void WriteStartAttribute (string prefix, string localName, string nsURI); - public abstract void WriteEndAttribute (); - public abstract void WriteComment (string text); - public abstract void WriteProcessingInstruction (string name, string text); - public abstract void WriteString (string text); - public abstract void WriteRaw (string data); - public abstract void Done (); - } -} diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/GenericOutputter.cs b/mcs/class/System.XML/Mono.Xml.Xsl/GenericOutputter.cs deleted file mode 100644 index 92073beba8c..00000000000 --- a/mcs/class/System.XML/Mono.Xml.Xsl/GenericOutputter.cs +++ /dev/null @@ -1,220 +0,0 @@ -// -// GenericOutputter.cs -// -// Authors: -// Oleg Tkachenko (oleg@tkachenko.com) -// -// (C) 2003 Oleg Tkachenko -// - -using System; -using System.Collections; -using System.Xml; -using System.IO; - -namespace Mono.Xml.Xsl -{ - /// <summary> - /// Generic implemenatation of the Outputter. - /// Works as a buffer between Transformation classes and an Emitter. - /// Implements attributes dublicate checking, nemaspace stuff and - /// choosing of right Emitter implementation. - /// </summary> - public class GenericOutputter : Outputter { - private Hashtable _outputs; - //Current xsl:output - private XslOutput _currentOutput; - //Underlying emitter - private Emitter _emitter; - //Outputting state - private WriteState _state; - //Collection of pending attributes. Key is attribute's QName, - //value is Attribute object, which encapsulates prefix, QName and string - //value of the attribute. Subject to optimization. - private Hashtable _pendingAttrs; - //Namespace manager. Subject to optimization. - private XmlNamespaceManager _nsManager; - //Name table - private NameTable _nt; - - private GenericOutputter (Hashtable outputs) - { - _outputs = outputs; - _currentOutput = (XslOutput)outputs [String.Empty]; - _state = WriteState.Start; - _pendingAttrs = new Hashtable (); - //TODO: Optimize using nametable - _nt = new NameTable (); - _nsManager = new XmlNamespaceManager (_nt); - } - - public GenericOutputter (XmlWriter writer, Hashtable outputs) - : this (outputs) - { - _emitter = new XmlWriterEmitter (writer); - } - - public GenericOutputter (TextWriter writer, Hashtable outputs) - : this (outputs) - { - XslOutput xslOutput = (XslOutput)outputs [String.Empty]; - switch (xslOutput.Method) { - case OutputMethod.Unknown: //TODO: handle xml vs html - case OutputMethod.XML: - //TODO: XmlTextEmitter goes here - //_emitter = new XmlTextEmitter (writer); - _emitter = new XmlWriterEmitter (new XmlTextWriter (writer)); - break; - case OutputMethod.HTML: - throw new NotImplementedException ("HTML output method is not implemented yet."); - case OutputMethod.Text: - _emitter = new TextEmitter (writer); - break; - case OutputMethod.Custom: - throw new NotImplementedException ("Custom output method is not implemented yet."); - } - } - - /// <summary> - /// Checks output state and flushes pending attributes and namespaces - /// when it's appropriate. - /// </summary> - private void CheckState () - { - // this isnt being called at the right place - // <a (1)> <b /> (2)</a> - // This should be called at 1, but is really being called at 2. - #if false - if (_state == WriteState.Element) { - //Push scope to allow to unwind namespaces scope back in WriteEndElement - //Subject to optimization - avoid redundant push/pop by moving - //namespaces to WriteStartElement - _nsManager.PushScope (); - //Emit pending attributes - foreach (XmlQualifiedName qName in _pendingAttrs.Keys) { - Attribute attr = (Attribute)_pendingAttrs [qName]; - _emitter.WriteAttributeString (attr.Prefix, qName.Name, qName.Namespace, attr.Value); - } - } - #endif - } - - #region Outputter's methods implementation - - public override void WriteStartDocument () - { - if (!_currentOutput.OmitXmlDeclaration) - _emitter.WriteStartDocument (_currentOutput.Standalone); - - _state = WriteState.Prolog; - } - - public override void WriteEndDocument () - { - _emitter.WriteEndDocument (); - } - - public override void WriteStartElement (string prefix, string localName, string nsURI) - { - if (_state == WriteState.Prolog) { - //Seems to be the first element - take care of Doctype - if (_currentOutput.DoctypeSystem != null) - _emitter.WriteDocType (prefix + (prefix==null? ":" : "") + localName, - _currentOutput.DoctypePublic, _currentOutput.DoctypeSystem); - } - CheckState (); - _emitter.WriteStartElement (prefix, localName, nsURI); - _state = WriteState.Element; - _pendingAttrs.Clear (); - } - - public override void WriteEndElement () - { - CheckState (); - _emitter.WriteEndElement (); - _state = WriteState.Content; - //Pop namespace scope - _nsManager.PopScope (); - } - - public override void WriteAttributeString (string prefix, string localName, string nsURI, string value) - { - - _emitter.WriteAttributeString (prefix, localName, nsURI, value); - - // See CheckState for why i commented this out - #if false - //Put attribute to pending attributes collection, replacing namesake one - XmlQualifiedName qName = new XmlQualifiedName (localName, nsURI); - Attribute attr = (Attribute)_pendingAttrs [qName]; - if (attr == null) { - attr = new Attribute (prefix, qName, value); - _pendingAttrs.Add (qName, attr); - } else { - attr.Value = value; - //Keep prefix (e.g. when literal attribute is overriden by xsl:attribute) - if (attr.Prefix == String.Empty && prefix != String.Empty) - attr.Prefix = prefix; - } - #endif - } - - public override void WriteNamespaceDecl (string prefix, string nsUri) - { - if (prefix == String.Empty) { - //Default namespace - if (_nsManager.DefaultNamespace != nsUri) { - _nsManager.AddNamespace (prefix, nsUri); - _emitter.WriteAttributeString ("", "xmlns", "", nsUri); - } - } else if (_nsManager.LookupPrefix (nsUri) == null) { - //That's new namespace - add it to the collection and emit - _nsManager.AddNamespace (prefix, nsUri); - _emitter.WriteAttributeString ("xmlns", prefix, null, nsUri); - } - } - - public override void WriteStartAttribute (string prefix, string localName, string nsURI) - { - _emitter.WriteStartAttribute (prefix, localName, nsURI); - _state = WriteState.Attribute; - } - - public override void WriteEndAttribute () - { - _emitter.WriteEndAttribute (); - _state = WriteState.Element; - } - - public override void WriteComment (string text) - { - CheckState (); - _emitter.WriteComment (text); - } - - public override void WriteProcessingInstruction (string name, string text) - { - CheckState (); - _emitter.WriteProcessingInstruction (name, text); - } - - public override void WriteString (string text) - { - CheckState (); - _emitter.WriteString (text); - } - - public override void WriteRaw (string data) - { - CheckState (); - _emitter.WriteRaw (data); - } - - public override void Done () - { - _emitter.Done (); - _state = WriteState.Closed; - } - #endregion - } -} diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/Outputter.cs b/mcs/class/System.XML/Mono.Xml.Xsl/Outputter.cs deleted file mode 100644 index 3240863c26a..00000000000 --- a/mcs/class/System.XML/Mono.Xml.Xsl/Outputter.cs +++ /dev/null @@ -1,57 +0,0 @@ -// -// Outputter.cs -// -// Authors: -// Oleg Tkachenko (oleg@tkachenko.com) -// -// (C) 2003 Oleg Tkachenko -// - -using System; - -namespace Mono.Xml.Xsl { - /// <summary> - /// Abstract XSLT outputter. - /// Transformation classes build result tree using only with this class API. - /// Implementations of this class outputs result tree to an Emitter, which emits - /// it further down to real consumers. - /// </summary> - public abstract class Outputter { - public abstract void WriteStartDocument(); - public abstract void WriteEndDocument(); - - public void WriteStartElement(string localName, string nsURI) - { - WriteStartElement (null, localName, nsURI); - } - - public abstract void WriteStartElement(string prefix, string localName, string nsURI); - public abstract void WriteEndElement(); - - public void WriteAttributeString(string localName, string value) - { - WriteAttributeString ("", localName, "", value); - } - - public abstract void WriteAttributeString(string prefix, string localName, string nsURI, string value); - public abstract void WriteNamespaceDecl (string prefix, string nsUri); - - public void WriteStartAttribute(string localName, string nsURI) - { - WriteStartAttribute (null, localName, nsURI); - } - - //TODO: Seems like we can get rid of these two methods? - public abstract void WriteStartAttribute(string prefix, string localName, string nsURI); - public abstract void WriteEndAttribute(); - - public abstract void WriteComment(string text); - - public abstract void WriteProcessingInstruction(string name, string text); - - public abstract void WriteString(string text); - public abstract void WriteRaw(string data); - - public abstract void Done (); - } -} diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/TextEmitter.cs b/mcs/class/System.XML/Mono.Xml.Xsl/TextEmitter.cs deleted file mode 100644 index b60f37d9809..00000000000 --- a/mcs/class/System.XML/Mono.Xml.Xsl/TextEmitter.cs +++ /dev/null @@ -1,79 +0,0 @@ -// -// TextEmitter.cs -// -// Authors: -// Oleg Tkachenko (oleg@tkachenko.com) -// -// (C) 2003 Oleg Tkachenko -// - -using System; -using System.IO; - -namespace Mono.Xml.Xsl { - /// <summary> - /// Emitetr, which emits result tree according to "text" output method. - /// </summary> - public class TextEmitter : Emitter { - TextWriter writer; - - public TextEmitter (TextWriter writer) { - this.writer = writer; - } - - #region # Emitter's methods implementaion - - public override void WriteStartDocument (StandaloneType standalone) { - //Do nothing - } - - public override void WriteEndDocument () { - //Do nothing - } - - public override void WriteDocType (string type, string publicId, string systemId) { - //Do nothing - } - - public override void WriteStartElement (string prefix, string localName, string nsURI) { - //Do nothing - } - - public override void WriteEndElement () { - //Do nothing - } - - public override void WriteAttributeString (string prefix, string localName, string nsURI, string value) { - //Do nothing - } - - public override void WriteStartAttribute (string prefix, string localName, string nsURI) { - //Do nothing - } - - public override void WriteEndAttribute () { - //Do nothing - } - - public override void WriteComment (string text) { - //Do nothing - } - - public override void WriteProcessingInstruction (string name, string text) { - //Do nothing - } - - public override void WriteString (string text) { - writer.Write (text); - } - - public override void WriteRaw (string data) { - writer.Write (data); - } - - public override void Done () { - //Do nothing - } - #endregion - } -} diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/TextOutputter.cs b/mcs/class/System.XML/Mono.Xml.Xsl/TextOutputter.cs deleted file mode 100644 index 46ee97e3070..00000000000 --- a/mcs/class/System.XML/Mono.Xml.Xsl/TextOutputter.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -// TextOutputter.cs -// -// Authors: -// Oleg Tkachenko (oleg@tkachenko.com) -// -// (C) 2003 Oleg Tkachenko -// - -using System; -using System.Xml; -using System.IO; - -namespace Mono.Xml.Xsl { - /// <summary> - /// Outputter implementation for text output method. - /// </summary> - public class TextOutputter : Outputter { - private TextWriter _writer; - //Current output depth - private int _depth; - //Ignore nested text nodes - private bool _ignoreNestedText; - //Attribute value is being outputted flag - private bool _inAttribute; - - public TextOutputter(TextWriter w, bool ignoreNestedText) { - _writer = w; - _ignoreNestedText = ignoreNestedText; - } - - public override void WriteStartDocument() {} - - public override void WriteEndDocument() {} - - public override void WriteStartElement(string prefix, string localName, string nsURI) { - if (_ignoreNestedText) _depth++; - } - - public override void WriteEndElement() { - if (_ignoreNestedText) _depth--; - } - - public override void WriteAttributeString(string prefix, string localName, string nsURI, string value) {} - - public override void WriteStartAttribute(string prefix, string localName, string nsURI) { - _inAttribute = true; - } - - public override void WriteEndAttribute() { - _inAttribute = false; - } - - public override void WriteNamespaceDecl (string prefix, string nsUri) {} - - public override void WriteComment(string text) {} - - public override void WriteProcessingInstruction(string name, string text) {} - - public override void WriteString(string text) { - WriteImpl(text); - } - - public override void WriteRaw(string data) { - WriteImpl(data); - } - - private void WriteImpl(string text) { - if ((!_ignoreNestedText || _depth==0) && !_inAttribute) _writer.Write(text); - } - - public override void Done () { - _writer.Flush (); - } - } -} diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/XmlOutputter.cs b/mcs/class/System.XML/Mono.Xml.Xsl/XmlOutputter.cs deleted file mode 100644 index 81403ee91b6..00000000000 --- a/mcs/class/System.XML/Mono.Xml.Xsl/XmlOutputter.cs +++ /dev/null @@ -1,86 +0,0 @@ -// -// XmlOutputter.cs -// -// Authors: -// Oleg Tkachenko (oleg@tkachenko.com) -// -// (C) 2003 Oleg Tkachenko -// - -using System; -using System.Xml; -using System.IO; -using System.Collections; - -namespace Mono.Xml.Xsl { - /// <summary> - /// Outputter implementation for XML output method - /// </summary> - public class XmlOutputter : Outputter { - private XmlWriter _writer; - private Hashtable _outputs; - private XslOutput _currentOutput; - - public XmlOutputter(XmlWriter w, Hashtable o) { - _writer = w; - _outputs = o; - _currentOutput = (XslOutput)o[String.Empty]; - } - - public XmlOutputter(TextWriter w, Hashtable o) - : this(new XmlTextWriter(w), o) {} - - public override void WriteStartDocument() { - if (_currentOutput != null && _currentOutput.OmitXmlDeclaration) - return; - if (_currentOutput == null || _currentOutput.Standalone == null) - _writer.WriteStartDocument(); - else - _writer.WriteStartDocument(_currentOutput.Standalone == "yes"); - } - - public override void WriteEndDocument() { - _writer.WriteEndDocument(); - } - - public override void WriteStartElement(string prefix, string localName, string nsURI) { - _writer.WriteStartElement(prefix, localName, nsURI); - } - - public override void WriteEndElement() { - _writer.WriteEndElement(); - } - - public override void WriteAttributeString(string prefix, string localName, string nsURI, string value) { - _writer.WriteAttributeString(prefix, localName, nsURI, value); - } - - public override void WriteStartAttribute(string prefix, string localName, string nsURI) { - _writer.WriteStartAttribute(prefix, localName, nsURI); - } - - public override void WriteEndAttribute() { - _writer.WriteEndAttribute(); - } - - public override void WriteComment(string text) { - _writer.WriteComment(text); - } - - public override void WriteProcessingInstruction(string name, string text) { - _writer.WriteProcessingInstruction(name, text); - } - - public override void WriteString(string text) { - _writer.WriteString(text); - } - - public override void WriteRaw(string data) { - _writer.WriteRaw(data); - } - - public override void Done () { - _writer.Flush (); - } - } -} diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/XmlWriterEmitter.cs b/mcs/class/System.XML/Mono.Xml.Xsl/XmlWriterEmitter.cs deleted file mode 100644 index f269c48db8f..00000000000 --- a/mcs/class/System.XML/Mono.Xml.Xsl/XmlWriterEmitter.cs +++ /dev/null @@ -1,94 +0,0 @@ -// -// XmlWriterEmitter.cs -// -// Authors: -// Oleg Tkachenko (oleg@tkachenko.com) -// -// (C) 2003 Oleg Tkachenko -// - -using System; -using System.Xml; - -namespace Mono.Xml.Xsl { - /// <summary> - /// Emitter, which emits result tree to a XmlWriter. - /// </summary> - public class XmlWriterEmitter : Emitter { - XmlWriter writer; - - public XmlWriterEmitter (XmlWriter writer) { - this.writer = writer; - } - - #region # Emitter's methods implementaion - - public override void WriteStartDocument (StandaloneType standalone) - { - if (standalone == StandaloneType.NONE) - writer.WriteStartDocument (); - else - writer.WriteStartDocument (standalone == StandaloneType.YES); - } - - public override void WriteEndDocument () - { - writer.WriteEndDocument (); - } - - public override void WriteDocType (string type, string publicId, string systemId) - { - writer.WriteDocType (type, publicId, systemId, null); - } - - public override void WriteStartElement (string prefix, string localName, string nsURI) - { - writer.WriteStartElement (prefix, localName, nsURI); - } - - public override void WriteEndElement () - { - writer.WriteEndElement (); - } - - public override void WriteAttributeString (string prefix, string localName, string nsURI, string value) - { - writer.WriteAttributeString (prefix, localName, nsURI, value); - } - - public override void WriteStartAttribute (string prefix, string localName, string nsURI) - { - writer.WriteStartAttribute (prefix, localName, nsURI); - } - - public override void WriteEndAttribute () - { - writer.WriteEndAttribute (); - } - - public override void WriteComment (string text) { - writer.WriteComment (text); - } - - public override void WriteProcessingInstruction (string name, string text) - { - writer.WriteProcessingInstruction (name, text); - } - - public override void WriteString (string text) - { - writer.WriteString (text); - } - - public override void WriteRaw (string data) - { - writer.WriteRaw (data); - } - - public override void Done () - { - writer.Flush (); - } - #endregion - } -} diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/XslDecimalFormat.cs b/mcs/class/System.XML/Mono.Xml.Xsl/XslDecimalFormat.cs deleted file mode 100644 index 7f8186208fa..00000000000 --- a/mcs/class/System.XML/Mono.Xml.Xsl/XslDecimalFormat.cs +++ /dev/null @@ -1,90 +0,0 @@ -// -// XslDecimalFormat.cs -// -// Authors: -// Ben Maurer (bmaurer@users.sourceforge.net) -// -// (C) 2003 Ben Maurer -// - -using System; -using System.Collections; -using System.Globalization; -using System.Xml; -using System.Xml.XPath; -using System.Xml.Xsl; - -using QName = System.Xml.XmlQualifiedName; - -namespace Mono.Xml.Xsl { - public class XslDecimalFormat { - - NumberFormatInfo info = new NumberFormatInfo (); - char digit = '#', zeroDigit = '0', patternSeparator = ';'; - - public static readonly XslDecimalFormat Default = new XslDecimalFormat (); - - XslDecimalFormat () {} // Default ctor for default info. - public XslDecimalFormat (Compiler c) - { - XPathNavigator n = c.Input; - if (n.MoveToFirstAttribute ()) { - do { - if (n.NamespaceURI != Compiler.XsltNamespace) - continue; - - switch (n.LocalName) { - case "name": break; // already handled - case "decimal-separator": - info.NumberDecimalSeparator = n.Value; - break; - - case "grouping-separator": - info.NumberGroupSeparator = n.Value; - break; - - case "infinity": - info.PositiveInfinitySymbol = n.Value; - break; - case "minus-sign": - info.NegativeSign = n.Value; - break; - case "NaN": - info.NaNSymbol = n.Value; - break; - case "percent": - info.PercentSymbol = n.Value; - break; - case "per-mille": - info.PerMilleSymbol = n.Value; - break; - case "zero-digit": - digit = n.Value [0]; - break; - case "digit": - zeroDigit = n.Value [0]; - break; - case "pattern-separator": - patternSeparator = n.Value [0]; - break; - } - } while (n.MoveToNextAttribute ()); - n.MoveToParent (); - - info.NegativeInfinitySymbol = info.NegativeSign + info.PositiveInfinitySymbol; - } - } - - // check that the data in c is the same as this one, as we - // must do, per the spec. - public void CheckSameAs (Compiler c) - { - throw new NotImplementedException (); - } - - public string FormatNumber (double number, string pattern) - { - throw new NotImplementedException (); - } - } -}
\ No newline at end of file diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/XslOutput.cs b/mcs/class/System.XML/Mono.Xml.Xsl/XslOutput.cs index c6c4ff10eb2..1db059cc5da 100644 --- a/mcs/class/System.XML/Mono.Xml.Xsl/XslOutput.cs +++ b/mcs/class/System.XML/Mono.Xml.Xsl/XslOutput.cs @@ -4,11 +4,9 @@ // Authors: // Ben Maurer (bmaurer@users.sourceforge.net) // Atsushi Enomoto (ginga@kit.hi-ho.ne.jp) -// Oleg Tkachenko (oleg@tkachenko.com) // // (C) 2003 Ben Maurer // (C) 2003 Atsushi Enomoto -// (C) 2003 Oleg Tkachenko // using System;
@@ -17,36 +15,20 @@ using System.Collections; using System.Xml;
using System.Xml.Schema;
using System.Xml.XPath;
-using System.Xml.Xsl; -using System.Text; +using System.Xml.Xsl;
namespace Mono.Xml.Xsl
{
using QName = System.Xml.XmlQualifiedName;
- public enum OutputMethod { - XML, - HTML, - Text, - Custom, - Unknown - } - - public enum StandaloneType { - NONE, - YES, - NO - } -
public class XslOutput // also usable for xsl:result-document
{
string uri;
- QName customMethod; - OutputMethod method = OutputMethod.Unknown;
+ QName method;
string version;
- Encoding encoding = System.Text.Encoding.UTF8;
+ string encoding;
bool omitXmlDeclaration;
- StandaloneType standalone = StandaloneType.NONE;
+ string standalone;
string doctypePublic;
string doctypeSystem;
QName [] cdataSectionElements;
@@ -66,14 +48,15 @@ namespace Mono.Xml.Xsl this.uri = uri;
}
- public OutputMethod Method { get { return method; }} - public QName CustomMethod { get { return customMethod; }} + public QName Method {
+ get { return method; }
+ }
public string Version {
get { return version; }
}
- public Encoding Encoding {
+ public string Encoding {
get { return encoding; }
}
@@ -85,7 +68,7 @@ namespace Mono.Xml.Xsl get { return omitXmlDeclaration; }
}
- public StandaloneType Standalone {
+ public string Standalone {
get { return standalone; }
}
@@ -145,61 +128,39 @@ namespace Mono.Xml.Xsl // cdSectsList.AddRange (XslNameUtil.ParseQNames (att, nav));
att = nav.GetAttribute ("method", "");
- - if (att != String.Empty) { - switch (att) { - case "xml": - method = OutputMethod.XML; - break; - case "html": - method = OutputMethod.HTML; - break; - case "text": - method = OutputMethod.Text; - break; - default: - method = OutputMethod.Custom; - customMethod = XslNameUtil.FromString (att, nav); - if (customMethod.Namespace == String.Empty) - //TODO: how to get current line number and position? - throw new XsltCompileException(new ArgumentException("Invalid output method value: '" + att + - "'. It must be either 'xml' or 'html' or 'text' or QName."), nav.BaseURI, 1, 1); - break; - } - }
+ if (att != null)
+ this.method = XslNameUtil.FromString (att, nav);
att = nav.GetAttribute ("version", "");
- if (att != String.Empty)
+ if (att != null)
this.version = att;
att = nav.GetAttribute ("encoding", "");
- if (att != String.Empty)
- this.encoding = System.Text.Encoding.GetEncoding (att);
+ if (att != null)
+ this.encoding = att;
att = nav.GetAttribute ("standalone", "");
- if (att != String.Empty) - //TODO: Should we validate values? - this.standalone = att == "yes" ? StandaloneType.YES : StandaloneType.NO; -
+ if (att != null)
+ this.standalone = att;
att = nav.GetAttribute ("doctype-public", "");
- if (att != String.Empty)
+ if (att != null)
this.doctypePublic = att;
att = nav.GetAttribute ("doctype-system", "");
- if (att != String.Empty)
+ if (att != null)
this.doctypeSystem = att;
att = nav.GetAttribute ("media-type", "");
- if (att != String.Empty)
+ if (att != null)
this.mediaType = att;
att = nav.GetAttribute ("omit-xml-declaration", "");
- if (att != String.Empty)
+ if (att != null)
this.omitXmlDeclaration = att == "yes";
att = nav.GetAttribute ("indent", "");
- if (att != String.Empty)
+ if (att != null)
this.indent = att == "yes";
}
}
diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/XslStylesheet.cs b/mcs/class/System.XML/Mono.Xml.Xsl/XslStylesheet.cs index e4e62902027..a49934222c5 100644 --- a/mcs/class/System.XML/Mono.Xml.Xsl/XslStylesheet.cs +++ b/mcs/class/System.XML/Mono.Xml.Xsl/XslStylesheet.cs @@ -38,9 +38,13 @@ namespace Mono.Xml.Xsl { Hashtable spaceControls = new Hashtable ();
// [string stylesheet-prefix]=>string result-prefix
Hashtable namespaceAliases = new Hashtable ();
+ // [QName]=>XslDecimalFormat
+ Hashtable decimalFormats = new Hashtable ();
// [QName]=>XmlSpace
Hashtable parameters = new Hashtable ();
+ // [string href]=>XslOutput
+ Hashtable outputs = new Hashtable ();
MSXslScriptManager msScripts = new MSXslScriptManager ();
XslTemplateTable templates;
@@ -76,11 +80,19 @@ namespace Mono.Xml.Xsl { public Hashtable NamespaceAliases {
get { return namespaceAliases; }
}
- +
+ public Hashtable DecimalFormats {
+ get { return decimalFormats; }
+ }
+
public Hashtable Parameters {
get { return parameters; }
} + public Hashtable Outputs {
+ get { return outputs; }
+ }
+
public MSXslScriptManager ScriptManager{
get { return msScripts; }
}
@@ -165,11 +177,13 @@ namespace Mono.Xml.Xsl { break; case "output": - c.CompileOutput (); - break; - - case "decimal-format": - c.CompileDecimalFormat (); + string uri = n.GetAttribute ("href", ""); + XslOutput output = outputs [uri] as XslOutput; + if (output == null) { + output = new XslOutput (uri); + outputs.Add (uri, output); + } + output.Fill (n); break; case "template": diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/XslTemplate.cs b/mcs/class/System.XML/Mono.Xml.Xsl/XslTemplate.cs index f34866891cb..cfbdb4ea0df 100644 --- a/mcs/class/System.XML/Mono.Xml.Xsl/XslTemplate.cs +++ b/mcs/class/System.XML/Mono.Xml.Xsl/XslTemplate.cs @@ -15,59 +15,11 @@ using System.Xml; using System.Xml.XPath; using System.Xml.Xsl; using Mono.Xml.Xsl.Operations; -using Mono.Xml.XPath; using QName = System.Xml.XmlQualifiedName; namespace Mono.Xml.Xsl { public class XslModedTemplateTable { - - class TemplateWithPriority : IComparable { - public readonly double Priority; - public readonly XslTemplate Template; - public readonly Pattern Pattern; - public readonly int TemplateID; - - public TemplateWithPriority (XslTemplate t, Pattern p) - { - Template = t; - Pattern = p; - Priority = p.DefaultPriority; - TemplateID = t.Id; - } - - public TemplateWithPriority (XslTemplate t, double p) - { - Template = t; - Pattern = t.Match; - Priority = p; - TemplateID = t.Id; - } - - public int CompareTo (object o) - { - TemplateWithPriority a = this, - b = (TemplateWithPriority)o; - - //Debug.WriteLine (a.Pattern.ToString () + " ? " + b.Pattern.ToString ()); - //Debug.WriteLine (a.Priority + " " + b.Priority); - - int r0 = a.Priority.CompareTo (b.Priority); - //Debug.WriteLine (r0); - if (r0 != 0) return r0; - - int r1 = a.TemplateID.CompareTo (b.TemplateID); - //Debug.WriteLine (r1); - return r1; - } - - public bool Matches (XPathNavigator n, XslTransformProcessor p) - { - //Debug.WriteLine (Pattern.ToString ()); - return p.Matches (Pattern, n); - } - } - // [QName name]=>XslTemplate ArrayList unnamedTemplates = new ArrayList (); @@ -85,41 +37,16 @@ namespace Mono.Xml.Xsl { get { return mode; } } - public void Add (XslTemplate t) + public void Add (XslTemplate template) { - if (!double.IsNaN (t.Priority)) - unnamedTemplates.Add (new TemplateWithPriority (t, t.Priority)); - else - Add (t, t.Match); + unnamedTemplates.Add (template); } - public void Add (XslTemplate t, Pattern p) + public XslTemplate FindMatch (XPathNavigator node) { - if (p is UnionPattern) { - Add (t, ((UnionPattern)p).p0); - Add (t, ((UnionPattern)p).p1); - return; - } - - unnamedTemplates.Add (new TemplateWithPriority (t, p)); - } - - bool sorted = false; - - public XslTemplate FindMatch (XPathNavigator node, XslTransformProcessor p) - { - //Debug.WriteLine ("..."); - if (!sorted) { - unnamedTemplates.Sort (); - unnamedTemplates.Reverse (); - - sorted = true; - } - - foreach (TemplateWithPriority t in this.unnamedTemplates) - if (t.Matches (node, p)) - return t.Template; - + foreach (XslTemplate t in this.unnamedTemplates) + if (node.Matches (t.Match)) return t; + return null; } } @@ -172,20 +99,20 @@ namespace Mono.Xml.Xsl { templateTables.Add (table.Mode, table); } - public XslTemplate FindMatch (XPathNavigator node, XmlQualifiedName mode, XslTransformProcessor p) + public XslTemplate FindMatch (XPathNavigator node, XmlQualifiedName mode) { XslTemplate ret; if (this [mode] != null) { - ret = this [mode].FindMatch (node, p); + ret = this [mode].FindMatch (node); if (ret != null) return ret; } for (int i = parent.Imports.Count - 1; i >= 0; i--) { XslStylesheet s = (XslStylesheet)parent.Imports [i]; - ret = s.Templates.FindMatch (node, mode, p); + ret = s.Templates.FindMatch (node, mode); if (ret != null) return ret; } @@ -213,14 +140,11 @@ namespace Mono.Xml.Xsl { public class XslTemplate { XmlQualifiedName name; - Pattern match; + XPathExpression match; XmlQualifiedName mode; - double priority = double.NaN; + double priority; Hashtable parameters; XslOperation content; - - static int nextId = 0; - public readonly int Id = nextId ++; XslStylesheet style; int stackSize; @@ -236,6 +160,7 @@ namespace Mono.Xml.Xsl { if (c.Input.NamespaceURI != Compiler.XsltNamespace) { this.name = QName.Empty; this.match = null; + this.priority = 0; // ? this.mode = QName.Empty; } else { this.name = c.ParseQNameAttribute ("name"); @@ -256,7 +181,7 @@ namespace Mono.Xml.Xsl { get { return name; } } - public Pattern Match { + public XPathExpression Match { get { return match; } diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/XslTransformProcessor.cs b/mcs/class/System.XML/Mono.Xml.Xsl/XslTransformProcessor.cs index 5ccfc8d3043..afa69f01fe4 100644 --- a/mcs/class/System.XML/Mono.Xml.Xsl/XslTransformProcessor.cs +++ b/mcs/class/System.XML/Mono.Xml.Xsl/XslTransformProcessor.cs @@ -16,13 +16,11 @@ using System.Xml; using System.Xml.XPath; using System.Xml.Xsl; using Mono.Xml.Xsl.Operations; -using Mono.Xml.XPath; using QName = System.Xml.XmlQualifiedName; namespace Mono.Xml.Xsl { - public class XslTransformProcessor - { + public class XslTransformProcessor { CompiledStylesheet compiledStyle; XslStylesheet style; @@ -43,30 +41,21 @@ namespace Mono.Xml.Xsl { this.style = style.Style; } - public void Process (XPathNavigator root, Outputter outputtter, XsltArgumentList args, XmlResolver resolver) + public void Process (XPathNavigator root, XmlWriter output, XsltArgumentList args, XmlResolver resolver) { - this.args = args; - this.root = root; - this.resolver = resolver != null ? resolver : new XmlUrlResolver (); - - PushNodeset (root.Select (".")); - foreach (XslGlobalVariable v in CompiledStyle.Variables.Values) { - if (args != null && v is XslGlobalParam) { + if (v is XslGlobalParam) { object p = args.GetParam(v.Name.Name, v.Name.Namespace); if (p != null) ((XslGlobalParam)v).Override (this, p); - else - v.Evaluate (this); } - v.Evaluate (this); } - PopNodeset (); - - this.PushOutput (outputtter); + this.args = args; + this.root = root; + this.resolver = resolver != null ? resolver : new XmlUrlResolver (); + this.outputStack.Push (output); this.ApplyTemplates (root.Select ("."), QName.Empty, null); - this.PopOutput (); } public XsltContext Context { get { return ctx; }} @@ -75,49 +64,22 @@ namespace Mono.Xml.Xsl { #region Document Resolution public XmlResolver Resolver {get{return resolver;}} - - Hashtable docCache; - - public XPathNavigator GetDocument (Uri uri) - { - XPathNavigator result; - - if (docCache != null) { - result = docCache [uri] as XPathNavigator; - if (result != null) - return result.Clone(); - } else { - docCache = new Hashtable(); - } - - XmlReader rdr = new XmlTextReader (uri.ToString(), (Stream) resolver.GetEntity (uri, null, null)); - result = new XPathDocument (rdr).CreateNavigator (); - rdr.Close (); - - docCache [uri] = result.Clone (); - return result; - } - #endregion #region Output Stack outputStack = new Stack (); - public Outputter Out { get { return (Outputter)outputStack.Peek(); }} + public XmlWriter Out { get { return (XmlWriter)outputStack.Peek(); }} - public void PushOutput (Outputter newOutput) + public void PushOutput (XmlWriter newOutput) { this.outputStack.Push (newOutput); } - public Outputter PopOutput () + public XmlWriter PopOutput () { - Outputter ret = (Outputter)this.outputStack.Pop (); - ret.Done (); - return ret; + return (XmlWriter)this.outputStack.Pop (); } - - public Hashtable Outputs { get { return compiledStyle.Outputs; }} #endregion #region Templates -- Apply/Call @@ -151,7 +113,7 @@ namespace Mono.Xml.Xsl { for (int i = currentTemplate.Parent.Imports.Count - 1; i >= 0; i--) { XslStylesheet s = (XslStylesheet)currentTemplate.Parent.Imports [i]; - t = s.Templates.FindMatch (CurrentNode, currentTemplate.Mode, this); + t = s.Templates.FindMatch (CurrentNode, currentTemplate.Mode); if (t != null) { currentTemplateStack.Push (t); t.Evaluate (this); @@ -192,7 +154,7 @@ namespace Mono.Xml.Xsl { XslTemplate FindTemplate (XPathNavigator node, QName mode) { - XslTemplate ret = style.Templates.FindMatch (CurrentNode, mode, this); + XslTemplate ret = style.Templates.FindMatch (CurrentNode, mode); if (ret != null) return ret; @@ -269,12 +231,6 @@ namespace Mono.Xml.Xsl { #endregion #region Evaluate - - public bool Matches (Pattern p, XPathNavigator n) - { - return CompiledStyle.ExpressionStore.PatternMatches (p, this, n); - } - public object Evaluate (XPathExpression expr) { expr = CompiledStyle.ExpressionStore.PrepForExecution (expr, this); diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/XsltCompiledContext.cs b/mcs/class/System.XML/Mono.Xml.Xsl/XsltCompiledContext.cs index 3cfe9d3872e..905f4cc7892 100644 --- a/mcs/class/System.XML/Mono.Xml.Xsl/XsltCompiledContext.cs +++ b/mcs/class/System.XML/Mono.Xml.Xsl/XsltCompiledContext.cs @@ -45,15 +45,13 @@ namespace Mono.Xml.Xsl { XslTransformProcessor p; VariableScope v; - XPathNavigator doc; public XslTransformProcessor Processor { get { return p; }} - public XsltCompiledContext (XslTransformProcessor p, VariableScope v, XPathNavigator doc) + public XsltCompiledContext (XslTransformProcessor p, VariableScope v) { this.p = p; this.v = v; - this.doc = doc; } public override string DefaultNamespace { get { return String.Empty; }} @@ -64,7 +62,7 @@ namespace Mono.Xml.Xsl { if (prefix == "" || prefix == null) return ""; - return this.doc.GetNamespace (prefix); + return p.CompiledStyle.NamespaceManager.LookupNamespace (prefix); } public override IXsltContextFunction ResolveFunction (string prefix, string name, XPathResultType[] argTypes) @@ -153,36 +151,18 @@ namespace Mono.Xml.Xsl { public override System.Xml.Xsl.IXsltContextVariable ResolveVariable(string prefix, string name) { - QName varName = new QName (name, LookupNamespace (prefix)); - if (v != null) { - XslGeneralVariable var = v.Resolve (p, varName); + XslGeneralVariable var = v.Resolve (p, new QName (name)); if (var != null) return var; } - return p.CompiledStyle.ResolveVariable (varName); + return p.CompiledStyle.ResolveVariable (new QName (name)); } public override int CompareDocument (string baseUri, string nextBaseUri) { throw new NotImplementedException (); } public override bool PreserveWhitespace (XPathNavigator nav) { throw new NotImplementedException (); } public override bool Whitespace { get { throw new NotImplementedException (); }} - public string BaseUri { get { return doc.BaseURI; }} - public XPathNavigator Stylesheet { - get { - XPathNavigator ret = doc.Clone (); - ret.MoveToRoot (); - return ret; - } - } - - public XPathNavigator GetDocument (Uri uri) - { - if (uri.ToString () == string.Empty) - return Stylesheet; - - return p.GetDocument (uri); - } } @@ -302,59 +282,7 @@ namespace Mono.Xml.Xsl.Functions { public override object Invoke (XsltCompiledContext xsltContext, object [] args, XPathNavigator docContext) { - string baseUri = null; - if (args.Length == 2) { - XPathNodeIterator it = (XPathNodeIterator) args [1]; - if (it.MoveNext()) - baseUri = it.Current.BaseURI; - else - baseUri = VoidBaseUriFlag; - } - - if (args [0] is XPathNodeIterator) - return GetDocument (xsltContext, (XPathNodeIterator)args [0], baseUri); - else - return GetDocument (xsltContext, args [0].ToString (), baseUri); - } - - static string VoidBaseUriFlag = "&^)(*&%*^$&$VOID!BASE!URI!"; - - Uri Resolve (string thisUri, string baseUri, XslTransformProcessor p) - { - Debug.WriteLine ("THIS: " + thisUri); - Debug.WriteLine ("BASE: " + baseUri); - XmlResolver r = p.Resolver; - - Uri uriBase = null; - if (! object.ReferenceEquals (baseUri, VoidBaseUriFlag)) - uriBase = r.ResolveUri (null, baseUri); - - return r.ResolveUri (uriBase, thisUri); - } - - XPathNodeIterator GetDocument (XsltCompiledContext xsltContext, XPathNodeIterator itr, string baseUri) - { - ArrayList list = new ArrayList (); - Hashtable got = new Hashtable (); - - while (itr.MoveNext()) { - Uri uri = Resolve (itr.Current.Value, baseUri != null ? baseUri : itr.Current.BaseURI, xsltContext.Processor); - if (!got.ContainsKey (uri)) { - got.Add (uri, null); - list.Add (xsltContext.GetDocument (uri)); - } - } - - return new EnumeratorIterator (list.GetEnumerator (), xsltContext); - } - - XPathNodeIterator GetDocument (XsltCompiledContext xsltContext, string arg0, string baseUri) - { - return new SelfIterator ( - xsltContext.GetDocument ( - Resolve (arg0, baseUri != null ? baseUri : xsltContext.BaseUri, xsltContext.Processor) - ) - , null); + throw new NotImplementedException (); } } @@ -398,14 +326,7 @@ namespace Mono.Xml.Xsl.Functions { public override object Invoke (XsltCompiledContext xsltContext, object [] args, XPathNavigator docContext) { - double d = (double)args [0]; - string s = (string)args [1]; - QName nm = QName.Empty; - - if (args.Length == 3) - nm = XslNameUtil.FromString ((string)args [0], xsltContext); - - return xsltContext.Processor.CompiledStyle.LookupDecimalFormat (nm).FormatNumber (d, s); + throw new NotImplementedException (); } } diff --git a/mcs/class/System.XML/Mono.Xml/ChangeLog b/mcs/class/System.XML/Mono.Xml/ChangeLog index 40090f278a3..117d7b178e3 100644 --- a/mcs/class/System.XML/Mono.Xml/ChangeLog +++ b/mcs/class/System.XML/Mono.Xml/ChangeLog @@ -1,11 +1,3 @@ -2003-08-21 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp> - - * XmlNodeWriter.cs : Extended to support for non-document entity. - -2003-08-14 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp> - - * added IHasXmlSchemaInfo.cs. - 2003-08-07 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp> * added IHasXmlParserContext.cs. diff --git a/mcs/class/System.XML/Mono.Xml/IHasXmlSchemaInfo.cs b/mcs/class/System.XML/Mono.Xml/IHasXmlSchemaInfo.cs deleted file mode 100644 index 547ededd193..00000000000 --- a/mcs/class/System.XML/Mono.Xml/IHasXmlSchemaInfo.cs +++ /dev/null @@ -1,19 +0,0 @@ -// -// Mono.Xml.IHasXmlSchemaInfo.cs -// -// Author: -// Atsushi Enomoto (ginga@kit.hi-ho.ne.jp) -// -// (C) 2003 Atsushi Enomoto -// -// This interface is used to support XmlSchema type information. -// -using System.Xml; -
-namespace Mono.Xml
-{
- public interface IHasXmlSchemaInfo
- {
- object SchemaType { get; }
- }
-}
diff --git a/mcs/class/System.XML/Mono.Xml/XmlNodeWriter.cs b/mcs/class/System.XML/Mono.Xml/XmlNodeWriter.cs index 1ace8f9c7cd..4caebe0da0c 100644 --- a/mcs/class/System.XML/Mono.Xml/XmlNodeWriter.cs +++ b/mcs/class/System.XML/Mono.Xml/XmlNodeWriter.cs @@ -18,12 +18,12 @@ namespace Mono.Xml } // It should be public after some tests are done :-) - public XmlNodeWriter (bool isDocumentEntity) + private XmlNodeWriter (bool isDocumentEntity) { doc = new XmlDocument (); state = XmlNodeType.None; this.isDocumentEntity = isDocumentEntity; - if (!isDocumentEntity) + if (isDocumentEntity) current = fragment = doc.CreateDocumentFragment (); } @@ -46,7 +46,7 @@ namespace Mono.Xml // Properties public XmlNode Document { - get { return isDocumentEntity ? (XmlNode)doc : (XmlNode)fragment; } + get { return isDocumentEntity ? (XmlNode)fragment : (XmlNode)doc; } } public override WriteState WriteState { @@ -113,7 +113,7 @@ namespace Mono.Xml throw new InvalidOperationException (String.Format ("Current state is not acceptable for {0}.", n.NodeType)); if (state != XmlNodeType.Element) - Document.AppendChild (n); + doc.AppendChild (n); else if (attribute != null) attribute.AppendChild (n); else @@ -198,7 +198,7 @@ namespace Mono.Xml XmlElement el = doc.CreateElement (prefix, name, ns); if (current == null) { - Document.AppendChild (el); + doc.AppendChild (el); state = XmlNodeType.Element; } else { current.AppendChild (el); @@ -229,10 +229,10 @@ namespace Mono.Xml if (!forceFull && current.FirstChild == null) ((XmlElement) current).IsEmpty = true; - if (isDocumentEntity && current.ParentNode == doc) + if (current.ParentNode == doc) state = XmlNodeType.EndElement; else - current = current.ParentNode; + current = current.ParentNode as XmlElement; } // StartAttribute diff --git a/mcs/class/System.XML/System.Xml.Schema/BuiltInDatatype.cs b/mcs/class/System.XML/System.Xml.Schema/BuiltInDatatype.cs index 1d281426f3d..cf929f39067 100644 --- a/mcs/class/System.XML/System.Xml.Schema/BuiltInDatatype.cs +++ b/mcs/class/System.XML/System.Xml.Schema/BuiltInDatatype.cs @@ -621,19 +621,6 @@ namespace Mono.Xml.Schema }
}
- // xs:double
- public class XsdDouble : XsdDecimal
- {
- public override Type ValueType {
- get { return typeof (double); }
- }
-
- public override object ParseValue (string s,
- XmlNameTable nameTable, XmlNamespaceManager nsmgr)
- {
- return XmlConvert.ToDouble (Normalize (s));
- }
- }
// xs:base64Binary
public class XsdBase64Binary : XsdString
@@ -763,4 +750,4 @@ namespace Mono.Xml.Schema return DateTime.ParseExact (s, "HH:mm:ss.fffffffzzz", null);
}
}
-} +}
diff --git a/mcs/class/System.XML/System.Xml.Schema/ChangeLog b/mcs/class/System.XML/System.Xml.Schema/ChangeLog index 09fdcab452d..8a029159eab 100755 --- a/mcs/class/System.XML/System.Xml.Schema/ChangeLog +++ b/mcs/class/System.XML/System.Xml.Schema/ChangeLog @@ -1,7 +1,3 @@ -2003-08-28 Lluis Sanchez Gual <lluis@ximian.com> - - * BuiltInDatatypes.cs, XmlSchemaDatatype.cs: Added double type. - 2003-08-08 Lluis Sanchez Gual <lluis@ximian.com> * BuiltInDatatypes.cs, XmlSchemaDatatype.cs: Added XsdAnyURI, diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDatatype.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDatatype.cs index f975d15e34d..c57d4118540 100755 --- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDatatype.cs +++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDatatype.cs @@ -134,8 +134,6 @@ namespace System.Xml.Schema return datatypePositiveInteger;
case "float":
return datatypeFloat;
- case "double":
- return datatypeDouble;
case "base64Binary":
return datatypeBase64Binary;
case "boolean":
@@ -182,7 +180,6 @@ namespace System.Xml.Schema private static XsdNonPositiveInteger datatypeNonPositiveInteger = new XsdNonPositiveInteger ();
private static XsdNegativeInteger datatypeNegativeInteger = new XsdNegativeInteger ();
private static XsdFloat datatypeFloat = new XsdFloat ();
- private static XsdDouble datatypeDouble = new XsdDouble ();
private static XsdBase64Binary datatypeBase64Binary = new XsdBase64Binary ();
private static XsdBoolean datatypeBoolean = new XsdBoolean ();
private static XsdAnyURI datatypeAnyURI = new XsdAnyURI ();
@@ -190,4 +187,4 @@ namespace System.Xml.Schema private static XsdDate datatypeDate = new XsdDate ();
private static XsdTime datatypeTime = new XsdTime ();
}
-} +}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/ChangeLog b/mcs/class/System.XML/System.Xml.Serialization/ChangeLog index 03d933a0319..ae2e8ac7ac8 100755 --- a/mcs/class/System.XML/System.Xml.Serialization/ChangeLog +++ b/mcs/class/System.XML/System.Xml.Serialization/ChangeLog @@ -1,68 +1,3 @@ -2003-09-04 Lluis Sanchez Gual <lluis@ximian.com> - - * SerializationCodeGenerator.cs: Minor fixes. - * SoapReflectionImporter.cs: More fixes. - * SoapSchemaExporter.cs: implemented. - * SoapSchemaImporter.cs: Initial implementation. - * TypeTranslator.cs: new methods for dealing with encoded arrays: GetArrayName - and ParseArrayType - * XmlCodeExporter.cs: Fix. When exporting a map, export all derived maps. - * XmlMemberMapping.cs: Minor fixes. - * XmlMembersMapping.cs: added some convenient constructors. - * XmlSchemaExporter.cs: Added support for encoded format. - * XmlSchemaImporter.cs: Added support for encoded format. - * XmlSerializationReader.cs: changed some string literals by constants. - Implemented ParseWsdlArrayType. - * XmlSerializationReaderInterpreter.cs: Read typeArray attribute when serializing - custom attributes. - * XmlSerializationWriter.cs: Implemented WriteXmlAttribute. - * XmlSerializationWriterInterpreter.cs: Use WriteXmlAttribute instead of - WriteAttribute to write custom attributes. - * XmlSerializer.cs: added some namespace constants. - * XmlTypeMapping.cs: added GetSchemaArrayName method. - -2003-09-01 Lluis Sanchez Gual <lluis@ximian.com> - - * XmlSchemaImporter.cs: Implemented ImportMembersMapping. - * XmlTypeMapMemberElement.cs: Little fix. - * XmlTypeMapping.cs: Added AllElementInfos property in ClassMap. - * XmlCustomFormatter.cs: Added GenerateToXmlString and GenerateFromXmlString - methods. - * SerializationCodeGenerator.cs, SerializationCodeGeneratorConfiguration.cs: - Added. - -2003-08-29 Lluis Sanchez Gual <lluis@ximian.com> - - * SoapReflectionImporter.cs: Fixed construcion of XmlMemberMapping. - * XmlMemberMapping.cs: Changed constructor. - * XmlReflectionImporter.cs: Fixed construcion of XmlMemberMapping. - * XmlSchemaImporter.cs: Implemented ImportMembersMapping(). - * XmlSerializationReaderInterpreter.cs: Added some helper methods. Changed visibility. - * XmlSerializationWriterInterpreter.cs: Changed visibility. - -2003-08-28 Lluis Sanchez Gual <lluis@ximian.com> - - * XmlSerializer.cs: Fix in Deserialize() method. - -2003-08-28 Lluis Sanchez Gual <lluis@ximian.com> - - * XmlReflectionImporter.cs: Fill RelatedMaps property of the generated map. - * XmlSchemas.cs: Find method: make sure the returned object belongs to - the requested type. - * XmlSerializationReader.cs: Removed unneded virtual ReadObject method. - Add null checks for eventSource. - * XmlSerializationReaderInterpreter.cs: ReadObject is not virtual any more. - * XmlSerializationWriter.cs: In Initialize method, initialize the provided - namespece declarations. Virtual method WriteObject not needed any more. - In WriteStartElement, write the provided namespaces. - * XmlSerializationWriterInterpreter.cs: Write object is not virtual any more. - Added GetTypeMap method, that returns the map for a given type. Added some - virtual methods, so writer behavior can be extended at several places by - derived classes. - * XmlSerializer.cs: Changed behavior to match what MS.NET does. The virtual - methods CreateReader and CreateWriter are not called unless no type or - type mapping was provided in the constructor. - 2003-08-12 Lluis Sanchez Gual <lluis@ximian.com> * XmlSchemaImporter.cs: ImportTypeMapping doesn't need to check if the diff --git a/mcs/class/System.XML/System.Xml.Serialization/SerializationCodeGenerator.cs b/mcs/class/System.XML/System.Xml.Serialization/SerializationCodeGenerator.cs deleted file mode 100644 index db0ddc15b36..00000000000 --- a/mcs/class/System.XML/System.Xml.Serialization/SerializationCodeGenerator.cs +++ /dev/null @@ -1,2049 +0,0 @@ -// -// System.Xml.Serialization.SerializationCodeGenerator.cs: -// -// Author: -// Lluis Sanchez Gual (lluis@ximian.com) -// -// (C) 2002, 2003 Ximian, Inc. http://www.ximian.com -// - -using System.IO; -using System.Reflection; -using System.Xml.Serialization; -using System.Collections; - -namespace System.Xml.Serialization -{ - internal class SerializationCodeGenerator - { - XmlMapping _typeMap; - SerializationFormat _format; - TextWriter _writer; - int _tempVarId = 0; - int _indent = 0; - Hashtable _uniqueNames = new Hashtable(); - int _methodId = 0; - SerializerInfo _config; - ArrayList _mapsToGenerate = new ArrayList (); - - public SerializationCodeGenerator (XmlMapping typeMap): this (typeMap, null) - { - } - - public static void Generate (string configFileName, string outputPath) - { - SerializationCodeGeneratorConfiguration cnf = null; - StreamReader sr = new StreamReader (configFileName); - try - { - XmlSerializer ser = new XmlSerializer (typeof (SerializationCodeGeneratorConfiguration)); - cnf = (SerializationCodeGeneratorConfiguration) ser.Deserialize (sr); - } - finally - { - sr.Close (); - } - - if (outputPath == null) outputPath = ""; - - CodeIdentifiers ids = new CodeIdentifiers (); - if (cnf.Serializers != null) - { - foreach (SerializerInfo info in cnf.Serializers) - { - Type type; - if (info.Assembly != null) - { - Assembly asm; - try { - asm = Assembly.Load (info.Assembly); - } catch { - asm = Assembly.LoadFrom (info.Assembly); - } - type = asm.GetType (info.ClassName, true); - } - else - type = Type.GetType (info.ClassName); - - if (type == null) throw new InvalidOperationException ("Type " + info.ClassName + " not found"); - - string file = info.OutFileName; - if (file == null || file == "") { - int i = info.ClassName.LastIndexOf ("."); - if (i != -1) file = info.ClassName.Substring (i+1); - else file = info.ClassName; - file = ids.AddUnique (file, type) + "Serializer.cs"; - } - StreamWriter writer = new StreamWriter (Path.Combine (outputPath, file)); - - try - { - XmlTypeMapping map; - - if (info.SerializationFormat == SerializationFormat.Literal) { - XmlReflectionImporter ri = new XmlReflectionImporter (); - map = ri.ImportTypeMapping (type); - } - else { - SoapReflectionImporter ri = new SoapReflectionImporter (); - map = ri.ImportTypeMapping (type); - } - - SerializationCodeGenerator gen = new SerializationCodeGenerator (map, info); - gen.GenerateSerializers (writer); - } - finally - { - writer.Close (); - } - } - } - } - - public SerializationCodeGenerator (XmlMapping typeMap, SerializerInfo config) - { - _typeMap = typeMap; - _format = typeMap.Format; - - string typeName; - if (_typeMap is XmlTypeMapping) typeName = ((XmlTypeMapping)_typeMap).TypeName; - else typeName = ((XmlMembersMapping)_typeMap).ElementName; - - if (config == null) - config = new SerializerInfo(); - - if (config.ReaderClassName == null || config.ReaderClassName == "") - config.ReaderClassName = typeName + "_Reader"; - - if (config.WriterClassName == null || config.WriterClassName == "") - config.WriterClassName = typeName + "_Writer"; - - if (config.Namespace == null || config.Namespace == "") - config.Namespace = "CustomSerializers"; - - _config = config; - } - - public void GenerateSerializers (TextWriter writer) - { - _writer = writer; - - WriteLine ("using System;"); - WriteLine ("using System.Xml;"); - WriteLine ("using System.Xml.Serialization;"); - WriteLine ("using System.Text;"); - WriteLine ("using System.Collections;"); - WriteLine ("using System.Globalization;"); - WriteLine (""); - WriteLine ("namespace " + _config.Namespace); - WriteLineInd ("{"); - - GenerateReader (); - WriteLine (""); - GenerateWriter (); - - WriteLineUni ("}"); - } - - #region Writer Generation - - //******************************************************* - // Writer generation - // - - public void GenerateWriter () - { - WriteLine ("public class " + _config.WriterClassName + " : XmlSerializationWriter"); - WriteLineInd ("{"); - - _mapsToGenerate = new ArrayList (); - - InitHooks (); - GenerateWriteTree (); - - if (_typeMap is XmlMembersMapping) - GenerateWriteMessage ((XmlMembersMapping)_typeMap); - - for (int n=0; n<_mapsToGenerate.Count; n++) - { - XmlTypeMapping map = (XmlTypeMapping) _mapsToGenerate[n]; - GenerateWriteObject (map); - if (map.TypeData.SchemaType == SchemaTypes.Enum) - GenerateGetXmlEnumValue (map); - } - - GenerateWriteInitCallbacks (); - - WriteLineUni ("}"); - } - - void GenerateWriteTree () - { - WriteLine ("public void WriteTree (" + GetRootTypeName () + " ob)"); - WriteLineInd ("{"); - WriteLine ("WriteStartDocument ();"); - - if (_typeMap is XmlTypeMapping) - { - XmlTypeMapping mp = (XmlTypeMapping) _typeMap; - if (mp.TypeData.SchemaType == SchemaTypes.Class || mp.TypeData.SchemaType == SchemaTypes.Array) - WriteLine ("TopLevelElement ();"); - - if (_format == SerializationFormat.Literal) { - WriteLine (GetWriteObjectName (mp) + " (ob, " + GetLiteral(mp.ElementName) + ", " + GetLiteral(mp.Namespace) + ", true, false, true);"); - } - else - WriteLine ("WritePotentiallyReferencingElement (" + GetLiteral(mp.ElementName) + ", " + GetLiteral(mp.Namespace) + ", ob, " + GetTypeOf(mp.TypeData) + ", true, false);"); - } - else if (_typeMap is XmlMembersMapping) { - WriteLine ("WriteMessage (ob);"); - } - else - throw new InvalidOperationException ("Unknown type map"); - - if (_format == SerializationFormat.Encoded) - WriteLine ("WriteReferencedElements ();"); - - WriteLineUni ("}"); - WriteLine (""); - } - - void GenerateWriteMessage (XmlMembersMapping map) - { - } - - void GenerateGetXmlEnumValue (XmlTypeMapping map) - { - EnumMap emap = (EnumMap) map.ObjectMap; - - WriteLine ("string " + GetGetEnumValueName (map) + " (" + map.TypeFullName + " val)"); - WriteLineInd ("{"); - - WriteLine ("switch (val)"); - WriteLineInd ("{"); - foreach (EnumMap.EnumMapMember mem in emap.Members) - WriteLine ("case " + map.TypeFullName + "." + mem.EnumName + ": return " + GetLiteral (mem.XmlName) + ";"); - - if (emap.IsFlags) - { - WriteLineInd ("default:"); - WriteLine ("System.Text.StringBuilder sb = new System.Text.StringBuilder ();"); - WriteLine ("string[] enumNames = val.ToString().Split (',');"); - WriteLine ("foreach (string name in enumNames)"); - WriteLineInd ("{"); - WriteLine ("switch (name.Trim())"); - WriteLineInd ("{"); - - foreach (EnumMap.EnumMapMember mem in emap.Members) - WriteLine ("case " + GetLiteral(mem.EnumName) + ": sb.Append (" + GetLiteral(mem.XmlName) + ").Append (' '); break; "); - - WriteLine ("default: sb.Append (name.Trim()).Append (' '); break; "); - WriteLineUni ("}"); - WriteLineUni ("}"); - WriteLine ("return sb.ToString ().Trim();"); - Unindent (); - } - else - WriteLine ("default: return val.ToString();"); - - WriteLineUni ("}"); - - WriteLineUni ("}"); - WriteLine (""); - } - - void GenerateWriteObject (XmlTypeMapping typeMap) - { - WriteLine ("void " + GetWriteObjectName (typeMap) + " (" + typeMap.TypeFullName + " ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)"); - WriteLineInd ("{"); - - PushHookContext (); - - SetHookVar ("$TYPE", typeMap.TypeName); - SetHookVar ("$FULLTYPE", typeMap.TypeFullName); - SetHookVar ("$OBJECT", "ob"); - SetHookVar ("$ELEMENT", "element"); - SetHookVar ("$NAMESPACE", "namesp"); - SetHookVar ("$NULLABLE", "isNullable"); - - if (GenerateWriteHook (HookType.type, typeMap.TypeData.Type)) - { - WriteLineUni ("}"); - WriteLine (""); - PopHookContext (); - return; - } - - if (typeMap.TypeData.SchemaType != SchemaTypes.Enum) - { - WriteLine ("if (ob == null)"); - WriteLineInd ("{"); - WriteLineInd ("if (isNullable)"); - - if (_format == SerializationFormat.Literal) - WriteLine ("WriteNullTagLiteral(element, namesp);"); - else - WriteLine ("WriteNullTagEncoded (element, namesp);"); - - WriteLineUni ("return;"); - WriteLineUni ("}"); - WriteLine (""); - } - - if (typeMap.TypeData.SchemaType == SchemaTypes.XmlNode) - { - if (_format == SerializationFormat.Literal) - WriteLine ("WriteElementLiteral (ob, \"\", \"\", true, false);"); - else - WriteLine ("WriteElementEncoded (ob, \"\", \"\", true, false);"); - - GenerateEndHook (); - WriteLineUni ("}"); - WriteLine (""); - PopHookContext (); - return; - } - - if (typeMap.TypeData.SchemaType == SchemaTypes.XmlSerializable) - { - WriteLine ("WriteSerializable (ob, element, namesp, isNullable);"); - - GenerateEndHook (); - WriteLineUni ("}"); - WriteLine (""); - PopHookContext (); - return; - } - - ArrayList types = typeMap.DerivedTypes; - bool first = true; - for (int n=0; n<types.Count; n++) - { - XmlTypeMapping map = (XmlTypeMapping)types[n]; - - WriteLineInd ((first?"else ":"") + "if (ob is " + map.TypeFullName + ") { "); - WriteLine (GetWriteObjectName (map) + "((" + map.TypeFullName + ")ob, element, namesp, isNullable, true, false);"); - WriteLine ("return;"); - WriteLineUni ("}"); - first = false; - } - if (typeMap.TypeData.Type == typeof (object)) { - WriteLineInd ("else {"); - WriteLine ("WriteTypedPrimitive (element, namesp, ob, true);"); - WriteLine ("return;"); - WriteLineUni ("}"); - } - - if (types.Count > 0) - WriteLine (""); - - WriteLineInd ("if (writeWrappingElem) {"); - if (_format == SerializationFormat.Encoded) WriteLine ("needType = true;"); - WriteLine ("WriteStartElement (element, namesp, ob);"); - WriteLineUni ("}"); - WriteLine (""); - - WriteLine ("if (needType) WriteXsiType(" + GetLiteral(typeMap.XmlType) + ", " + GetLiteral(typeMap.Namespace) + ");"); - WriteLine (""); - - switch (typeMap.TypeData.SchemaType) - { - case SchemaTypes.Class: GenerateWriteObjectElement (typeMap, "ob", false); break; - case SchemaTypes.Array: GenerateWriteListElement (typeMap, "ob"); break; - case SchemaTypes.Primitive: GenerateWritePrimitiveElement (typeMap, "ob"); break; - case SchemaTypes.Enum: GenerateWriteEnumElement (typeMap, "ob"); break; - } - - WriteLine ("if (writeWrappingElem) WriteEndElement (ob);"); - - GenerateEndHook (); - WriteLineUni ("}"); - WriteLine (""); - PopHookContext (); - } - - void GenerateWriteObjectElement (XmlTypeMapping typeMap, string ob, bool isValueList) - { - ClassMap map = (ClassMap)typeMap.ObjectMap; - if (!GenerateWriteHook (HookType.attributes, typeMap.TypeData.Type)) - { - if (map.NamespaceDeclarations != null) { - WriteLine ("WriteNamespaceDeclarations ((XmlSerializerNamespaces) " + ob + "." + map.NamespaceDeclarations.Name + ");"); - WriteLine (""); - } - - ICollection attributes = map.AttributeMembers; - if (attributes != null) - { - foreach (XmlTypeMapMemberAttribute attr in attributes) - { - if (GenerateWriteMemberHook (typeMap.TypeData.Type, attr)) continue; - - string val = GenerateGetMemberValue (attr, ob, isValueList); - string cond = GenerateMemberHasValueCondition (attr, ob, isValueList); - - if (cond != null) WriteLineInd ("if (" + cond + ") {"); - - string strVal = GenerateGetStringValue (attr.MappedType, attr.TypeData, val); - WriteLine ("WriteAttribute (" + GetLiteral(attr.AttributeName) + ", " + GetLiteral(attr.Namespace) + ", " + strVal + ");"); - - if (cond != null) WriteLineUni ("}"); - GenerateEndHook (); - } - WriteLine (""); - } - - XmlTypeMapMember anyAttrMember = map.DefaultAnyAttributeMember; - if (anyAttrMember != null) - { - if (!GenerateWriteMemberHook (typeMap.TypeData.Type, anyAttrMember)) - { - string cond = GenerateMemberHasValueCondition (anyAttrMember, ob, isValueList); - if (cond != null) WriteLineInd ("if (" + cond + ") {"); - - string tmpVar = GetObTempVar (); - WriteLine ("ICollection " + tmpVar + " = " + GenerateGetMemberValue (anyAttrMember, ob, isValueList) + ";"); - WriteLineInd ("if (" + tmpVar + " != null) {"); - - string tmpVar2 = GetObTempVar (); - WriteLineInd ("foreach (XmlAttribute " + tmpVar2 + " in " + tmpVar + ")"); - WriteLine ("WriteXmlAttribute (" + tmpVar2 + ", " + ob + ");"); - Unindent (); - WriteLineUni ("}"); - - if (cond != null) WriteLineUni ("}"); - WriteLine (""); - GenerateEndHook (); - } - } - GenerateEndHook (); - } - - if (!GenerateWriteHook (HookType.elements, typeMap.TypeData.Type)) - { - ICollection members = map.ElementMembers; - if (members != null) - { - foreach (XmlTypeMapMemberElement member in members) - { - if (GenerateWriteMemberHook (typeMap.TypeData.Type, member)) continue; - - string cond = GenerateMemberHasValueCondition (member, ob, isValueList); - if (cond != null) WriteLineInd ("if (" + cond + ") {"); - - string memberValue = GenerateGetMemberValue (member, ob, isValueList); - Type memType = member.GetType(); - - if (memType == typeof(XmlTypeMapMemberList)) - { - WriteLineInd ("if (" + memberValue + " != null) {"); - GenerateWriteMemberElement ((XmlTypeMapElementInfo) member.ElementInfo[0], memberValue); - WriteLineUni ("}"); - } - else if (memType == typeof(XmlTypeMapMemberFlatList)) - { - WriteLineInd ("if (" + memberValue + " != null) {"); - GenerateWriteListContent (member.TypeData, ((XmlTypeMapMemberFlatList)member).ListMap, memberValue, false); - WriteLineUni ("}"); - } - else if (memType == typeof(XmlTypeMapMemberAnyElement)) - { - WriteLineInd ("if (" + memberValue + " != null) {"); - GenerateWriteAnyElementContent ((XmlTypeMapMemberAnyElement)member, memberValue); - WriteLineUni ("}"); - } - else if (memType == typeof(XmlTypeMapMemberAnyElement)) - { - WriteLineInd ("if (" + memberValue + " != null) {"); - GenerateWriteAnyElementContent ((XmlTypeMapMemberAnyElement)member, memberValue); - WriteLineUni ("}"); - } - else if (memType == typeof(XmlTypeMapMemberAnyAttribute)) - { - // Ignore - } - else if (memType == typeof(XmlTypeMapMemberElement)) - { - if (member.ElementInfo.Count == 1) { - GenerateWriteMemberElement ((XmlTypeMapElementInfo)member.ElementInfo[0], memberValue); - } - else if (member.ChoiceMember != null) - { - string choiceValue = ob + "." + member.ChoiceMember; - foreach (XmlTypeMapElementInfo elem in member.ElementInfo) { - WriteLineInd ("if (" + choiceValue + " == " + GetLiteral(elem.ChoiceValue) + ") {"); - GenerateWriteMemberElement (elem, GetCast(elem.TypeData, member.TypeData, memberValue)); - WriteLineUni ("}"); - } - } - else - { - // WriteLineInd ("if (" + memberValue + " == null) {"); - // GenerateWriteMemberElement ((XmlTypeMapElementInfo)member.ElementInfo[0], memberValue); - // WriteLineUni ("}"); - - bool first = true; - Type type = memberValue.GetType(); - foreach (XmlTypeMapElementInfo elem in member.ElementInfo) - { - WriteLineInd ((first?"":"else ") + "if (" + memberValue + " is " + elem.TypeData.FullTypeName + ") {"); - GenerateWriteMemberElement (elem, GetCast(elem.TypeData, member.TypeData, memberValue)); - WriteLineUni ("}"); - first = false; - } - } - } - else - throw new InvalidOperationException ("Unknown member type"); - - if (cond != null) - WriteLineUni ("}"); - - GenerateEndHook (); - } - } - GenerateEndHook (); - } - } - - void GenerateWriteMemberElement (XmlTypeMapElementInfo elem, string memberValue) - { - switch (elem.TypeData.SchemaType) - { - case SchemaTypes.XmlNode: - string elemName = elem.WrappedElement ? elem.ElementName : ""; - if (_format == SerializationFormat.Literal) - WriteMetCall ("WriteElementLiteral", memberValue, GetLiteral(elemName), GetLiteral(elem.Namespace), GetLiteral(elem.IsNullable), "false"); - else - WriteMetCall ("WriteElementEncoded", memberValue, GetLiteral(elemName), GetLiteral(elem.Namespace), GetLiteral(elem.IsNullable), "false"); - break; - - case SchemaTypes.Enum: - case SchemaTypes.Primitive: - if (_format == SerializationFormat.Literal) - GenerateWritePrimitiveValueLiteral (memberValue, elem.ElementName, elem.Namespace, elem.MappedType, elem.TypeData, elem.WrappedElement, elem.IsNullable); - else - GenerateWritePrimitiveValueEncoded (memberValue, elem.ElementName, elem.Namespace, new XmlQualifiedName (elem.TypeData.XmlType, elem.DataTypeNamespace), elem.MappedType, elem.TypeData, elem.WrappedElement, elem.IsNullable); - break; - - case SchemaTypes.Array: - if (memberValue == null) { - if (_format == SerializationFormat.Literal) - WriteMetCall ("WriteNullTagLiteral", GetLiteral(elem.ElementName), GetLiteral(elem.Namespace)); - else - WriteMetCall ("WriteNullTagEncoded", GetLiteral(elem.ElementName), GetLiteral(elem.Namespace)); - } - else if (elem.MappedType.MultiReferenceType) - WriteMetCall ("WriteReferencingElement", GetLiteral(elem.ElementName), GetLiteral(elem.Namespace), memberValue, GetLiteral(elem.IsNullable)); - else { - WriteMetCall ("WriteStartElement", GetLiteral(elem.ElementName), GetLiteral(elem.Namespace), memberValue); - GenerateWriteListContent (elem.TypeData, (ListMap) elem.MappedType.ObjectMap, memberValue, false); - WriteMetCall ("WriteEndElement", memberValue); - } - break; - - case SchemaTypes.Class: - if (elem.MappedType.MultiReferenceType) { - if (elem.MappedType.TypeData.Type == typeof(object)) - WriteMetCall ("WritePotentiallyReferencingElement", GetLiteral(elem.ElementName), GetLiteral(elem.Namespace), memberValue, "null", "false", GetLiteral(elem.IsNullable)); - else - WriteMetCall ("WriteReferencingElement", GetLiteral(elem.ElementName), GetLiteral(elem.Namespace), memberValue, GetLiteral(elem.IsNullable)); - } - else - WriteMetCall (GetWriteObjectName(elem.MappedType), memberValue, GetLiteral(elem.ElementName), GetLiteral(elem.Namespace), GetLiteral(elem.IsNullable), "false", "true"); - break; - - case SchemaTypes.XmlSerializable: - WriteMetCall ("WriteSerializable", memberValue, GetLiteral(elem.ElementName), GetLiteral(elem.Namespace), GetLiteral(elem.IsNullable)); - break; - - default: - throw new NotSupportedException ("Invalid value type"); - } - } - - void GenerateWriteListElement (XmlTypeMapping typeMap, string ob) - { - if (_format == SerializationFormat.Encoded) - { - string n, ns; - string itemCount = GenerateGetListCount (typeMap.TypeData, ob); - GenerateGetArrayType ((ListMap) typeMap.ObjectMap, itemCount, out n, out ns); - - string arrayType; - if (ns != string.Empty) - arrayType = "FromXmlQualifiedName (new XmlQualifiedName(" + n + "," + ns + "))"; - else - arrayType = GetLiteral (n); - - WriteMetCall ("WriteAttribute", GetLiteral("arrayType"), GetLiteral(XmlSerializer.WsdlNamespace), arrayType); - } - GenerateWriteListContent (typeMap.TypeData, (ListMap) typeMap.ObjectMap, ob, false); - } - - void GenerateWriteAnyElementContent (XmlTypeMapMemberAnyElement member, string memberValue) - { - bool singleElement = (member.TypeData.Type == typeof (XmlElement)); - string var; - - if (singleElement) - var = memberValue; - else { - var = GetObTempVar (); - WriteLineInd ("foreach (XmlNode " + var + " in " + memberValue + ") {"); - } - - string elem = GetObTempVar (); - WriteLine ("XmlElement " + elem + " = " + var + " as XmlElement;"); - WriteLine ("if (" + elem + " == null) throw CreateUnknownTypeException (" + elem + ");"); - - if (!member.IsDefaultAny) { - for (int n=0; n<member.ElementInfo.Count; n++) { - XmlTypeMapElementInfo info = (XmlTypeMapElementInfo)member.ElementInfo[n]; - string txt = "(" + elem + ".Name == " + GetLiteral(info.ElementName) + " && " + elem + ".NamespaceURI == " + GetLiteral(info.Namespace) + ")"; - if (n == member.ElementInfo.Count-1) txt += ") {"; - if (n == 0) WriteLineInd ("if (" + txt); - else WriteLine ("|| " + txt); - } - } - - if (_format == SerializationFormat.Literal) - WriteLine ("WriteElementLiteral (" + elem + ", \"\", \"\", false, true);"); - else - WriteLine ("WriteElementEncoded (" + elem + ", \"\", \"\", false, true);"); - - if (!member.IsDefaultAny) { - WriteLineUni ("}"); - WriteLineInd ("else"); - WriteLine ("throw CreateUnknownAnyElementException (" + elem + ".Name, " + elem + ".NamespaceURI);"); - Unindent (); - } - - if (!singleElement) - WriteLineUni ("}"); - } - - void GenerateWritePrimitiveElement (XmlTypeMapping typeMap, string ob) - { - string strVal = GenerateGetStringValue (typeMap, typeMap.TypeData, ob); - WriteLine ("Writer.WriteString (" + strVal + ");"); - } - - void GenerateWriteEnumElement (XmlTypeMapping typeMap, string ob) - { - string strVal = GenerateGetEnumXmlValue (typeMap, ob); - WriteLine ("Writer.WriteString (" + strVal + ");"); - } - - string GenerateGetStringValue (XmlTypeMapping typeMap, TypeData type, string value) - { - if (type.SchemaType == SchemaTypes.Array) { - string str = GetStrTempVar (); - WriteLine ("string " + str + " = null;"); - WriteLineInd ("if (" + value + " != null) {"); - string res = GenerateWriteListContent (typeMap.TypeData, (ListMap)typeMap.ObjectMap, value, true); - WriteLine (str + " = " + res + ".ToString ().Trim ();"); - WriteLineUni ("}"); - return str; - } - else if (type.SchemaType == SchemaTypes.Enum) { - return GenerateGetEnumXmlValue (typeMap, value); - } - else if (type.Type == typeof (XmlQualifiedName)) - return "FromXmlQualifiedName (" + value + ")"; - else if (value == null) - return null; - else - return XmlCustomFormatter.GenerateToXmlString (type, value); - } - - string GenerateGetEnumXmlValue (XmlTypeMapping typeMap, string ob) - { - return GetGetEnumValueName (typeMap) + " (" + ob + ")"; - } - - string GenerateGetListCount (TypeData listType, string ob) - { - if (listType.Type.IsArray) - return "ob.Length"; - else - return "ob.Count"; - } - - void GenerateGetArrayType (ListMap map, string itemCount, out string localName, out string ns) - { - string arrayDim; - if (itemCount != "") arrayDim = ""; - else arrayDim = "[]"; - - XmlTypeMapElementInfo info = (XmlTypeMapElementInfo) map.ItemInfo[0]; - if (info.TypeData.SchemaType == SchemaTypes.Array) - { - string nm; - GenerateGetArrayType ((ListMap)info.MappedType.ObjectMap, "", out nm, out ns); - localName = nm + arrayDim; - } - else - { - if (info.MappedType != null) - { - localName = info.MappedType.XmlType + arrayDim; - ns = info.MappedType.Namespace; - } - else - { - localName = info.TypeData.XmlType + arrayDim; - ns = info.DataTypeNamespace; - } - } - if (itemCount != "") { - localName = "\"" + localName + "[\" + " + itemCount + " + \"]\""; - ns = GetLiteral (ns); - } - } - - string GenerateWriteListContent (TypeData listType, ListMap map, string ob, bool writeToString) - { - string targetString = null; - - if (writeToString) - { - targetString = GetStrTempVar (); - WriteLine ("System.Text.StringBuilder " + targetString + " = new System.Text.StringBuilder();"); - } - - if (listType.Type.IsArray) - { - string itemVar = GetNumTempVar (); - WriteLineInd ("for (int "+itemVar+" = 0; "+itemVar+" < " + ob + ".Length; "+itemVar+"++) {"); - GenerateListLoop (map, ob + "["+itemVar+"]", listType.ListItemTypeData, targetString); - WriteLineUni ("}"); - } - else if (typeof(ICollection).IsAssignableFrom (listType.Type)) - { - string itemVar = GetNumTempVar (); - WriteLineInd ("for (int "+itemVar+" = 0; "+itemVar+" < " + ob + ".Count; "+itemVar+"++) {"); - GenerateListLoop (map, ob + "["+itemVar+"]", listType.ListItemTypeData, targetString); - WriteLineUni ("}"); - } - else if (typeof(IEnumerable).IsAssignableFrom (listType.Type)) - { - string itemVar = GetObTempVar (); - WriteLineInd ("foreach (" + listType.ListItemTypeData.FullTypeName + " " + itemVar + " in " + ob + ") {"); - GenerateListLoop (map, itemVar, listType.ListItemTypeData, targetString); - WriteLineUni ("}"); - } - else - throw new Exception ("Unsupported collection type"); - - return targetString; - } - - void GenerateListLoop (ListMap map, string item, TypeData itemTypeData, string targetString) - { - bool first = true; - foreach (XmlTypeMapElementInfo info in map.ItemInfo) - { - if (map.ItemInfo.Count > 1) - WriteLineInd ((first?"":"else ") + "if (" + item + " is " + info.TypeData.FullTypeName + ") {"); - - if (targetString == null) - GenerateWriteMemberElement (info, GetCast (info.TypeData, itemTypeData, item)); - else - { - string strVal = GenerateGetStringValue (info.MappedType, info.TypeData, GetCast (info.TypeData, itemTypeData, item)); - WriteLine (targetString + ".Append (" + strVal + ").Append (\" \");"); - } - - if (map.ItemInfo.Count > 1) - WriteLineUni ("}"); - - first = false; - } - - if (map.ItemInfo.Count > 1) - WriteLine ("else if (" + item + " != null) throw CreateUnknownTypeException (" + item + ");"); - } - - void GenerateWritePrimitiveValueLiteral (string memberValue, string name, string ns, XmlTypeMapping mappedType, TypeData typeData, bool wrapped, bool isNullable) - { - if (!wrapped) { - string strVal = GenerateGetStringValue (mappedType, typeData, memberValue); - WriteMetCall ("WriteValue", strVal); - } - else if (isNullable) { - if (typeData.Type == typeof(XmlQualifiedName)) - WriteMetCall ("WriteNullableQualifiedNameLiteral", GetLiteral(name), GetLiteral(ns), memberValue); - else { - string strVal = GenerateGetStringValue (mappedType, typeData, memberValue); - WriteMetCall ("WriteNullableStringLiteral", GetLiteral(name), GetLiteral(ns), strVal); - } - } - else { - if (typeData.Type == typeof(XmlQualifiedName)) - WriteMetCall ("WriteElementQualifiedName", GetLiteral(name), GetLiteral(ns), memberValue); - else { - string strVal = GenerateGetStringValue (mappedType, typeData, memberValue); - WriteMetCall ("WriteElementString", GetLiteral(name),GetLiteral(ns), strVal); - } - } - } - - void GenerateWritePrimitiveValueEncoded (string memberValue, string name, string ns, XmlQualifiedName xsiType, XmlTypeMapping mappedType, TypeData typeData, bool wrapped, bool isNullable) - { - if (!wrapped) { - string strVal = GenerateGetStringValue (mappedType, typeData, memberValue); - WriteMetCall ("WriteValue", strVal); - } - else if (isNullable) { - if (typeData.Type == typeof(XmlQualifiedName)) - WriteMetCall ("WriteNullableQualifiedNameEncoded", GetLiteral(name), GetLiteral(ns), memberValue, GetLiteral(xsiType)); - else { - string strVal = GenerateGetStringValue (mappedType, typeData, memberValue); - WriteMetCall ("WriteNullableStringEncoded", GetLiteral(name), GetLiteral(ns), strVal, GetLiteral(xsiType)); - } - } - else { - if (typeData.Type == typeof(XmlQualifiedName)) - WriteMetCall ("WriteElementQualifiedName", GetLiteral(name), GetLiteral(ns), memberValue, GetLiteral(xsiType)); - else { - string strVal = GenerateGetStringValue (mappedType, typeData, memberValue); - WriteMetCall ("WriteElementString", GetLiteral(name),GetLiteral(ns), strVal, GetLiteral(xsiType)); - } - } - } - - string GenerateGetMemberValue (XmlTypeMapMember member, string ob, bool isValueList) - { - if (isValueList) return ob + "[" + member.Index + "]"; - else return ob + "." + member.Name; - } - - string GenerateMemberHasValueCondition (XmlTypeMapMember member, string ob, bool isValueList) - { - if (isValueList) { - return member.Index + " < " + ob + ".Length"; - } - else if (member.DefaultValue != System.DBNull.Value) { - string mem = ob + "." + member.Name; - if (member.DefaultValue == null) - return mem + " != null"; - else if (member.TypeData.SchemaType == SchemaTypes.Enum) - return mem + " != " + GetCast (member.TypeData, GetLiteral (member.DefaultValue)); - else - return mem + " != " + GetLiteral (member.DefaultValue); - } - return null; - } - - void GenerateWriteInitCallbacks () - { - WriteLine ("protected override void InitCallbacks ()"); - WriteLineInd ("{"); - - if (_format == SerializationFormat.Encoded) - { - foreach (XmlTypeMapping map in _mapsToGenerate) { - WriteMetCall ("AddWriteCallback", GetTypeOf(map.TypeData), GetLiteral(map.XmlType), GetLiteral(map.Namespace), "new XmlSerializationWriteCallback (" + GetWriteObjectCallbackName (map) + ")"); - } - } - - WriteLineUni ("}"); - WriteLine (""); - - if (_format == SerializationFormat.Encoded) - { - foreach (XmlTypeMapping map in _mapsToGenerate) { - if (map.TypeData.SchemaType == SchemaTypes.Enum) - WriteWriteEnumCallback (map); - else - WriteWriteObjectCallback (map); - } - } - } - - void WriteWriteEnumCallback (XmlTypeMapping map) - { - WriteLine ("void " + GetWriteObjectCallbackName (map) + " (object ob)"); - WriteLineInd ("{"); - WriteMetCall (GetWriteObjectName(map), GetCast (map.TypeData, "ob"), GetLiteral(map.ElementName), GetLiteral(map.Namespace), "false", "false", "false"); - WriteLineUni ("}"); - WriteLine (""); - } - - void WriteWriteObjectCallback (XmlTypeMapping map) - { - WriteLine ("void " + GetWriteObjectCallbackName (map) + " (object ob)"); - WriteLineInd ("{"); - WriteMetCall (GetWriteObjectName(map), GetCast (map.TypeData, "ob"), GetLiteral(map.ElementName), GetLiteral(map.Namespace), "false", "true", "false"); - WriteLineUni ("}"); - WriteLine (""); - } - - #endregion - - #region Reader Generation - - //******************************************************* - // Reader generation - // - - public void GenerateReader () - { - WriteLine ("public class " + _config.ReaderClassName + " : XmlSerializationReader"); - WriteLineInd ("{"); - - _mapsToGenerate = new ArrayList (); - InitHooks (); - GenerateReadTree (); - - if (_typeMap is XmlMembersMapping) - GenerateReadMessage ((XmlMembersMapping)_typeMap); - - for (int n=0; n<_mapsToGenerate.Count; n++) - { - XmlTypeMapping map = (XmlTypeMapping) _mapsToGenerate [n]; - GenerateReadObject (map); - if (map.TypeData.SchemaType == SchemaTypes.Enum) - GenerateGetEnumValue (map); - } - - GenerateReadInitCallbacks (); - - if (_format == SerializationFormat.Encoded) - { - GenerateFixupCallbacks (); - GenerateFillerCallbacks (); - } - - WriteLineUni ("}"); - } - - void GenerateReadTree () - { - WriteLine ("public " + GetRootTypeName () + " ReadTree ()"); - WriteLineInd ("{"); - WriteLine ("Reader.MoveToContent();"); - - if (_typeMap is XmlTypeMapping) - { - XmlTypeMapping typeMap = (XmlTypeMapping) _typeMap; - - if (_format == SerializationFormat.Literal) - WriteMetCall ("return " + GetReadObjectName (typeMap), "true", "true"); - else - { - WriteLine (typeMap.TypeFullName + " ob = null;"); - WriteLine ("Reader.MoveToContent();"); - WriteLine ("if (Reader.NodeType == System.Xml.XmlNodeType.Element) "); - WriteLineInd ("{"); - WriteLineInd ("if (Reader.LocalName == " + GetLiteral(typeMap.ElementName) + " && Reader.NamespaceURI == " + GetLiteral (typeMap.Namespace) + ")"); - WriteLine ("ob = ReadReferencedElement();"); - Unindent (); - WriteLineInd ("else "); - WriteLine ("throw CreateUnknownNodeException();"); - Unindent (); - WriteLineUni ("}"); - WriteLineInd ("else "); - WriteLine ("UnknownNode(null);"); - Unindent (); - WriteLine (""); - WriteLine ("ReadReferencedElements();"); - WriteLine ("return ob;"); - } - } - else { - WriteLine ("return ReadMessage ();"); - } - - WriteLineUni ("}"); - WriteLine (""); - } - - void GenerateReadMessage (XmlMembersMapping map) - { - } - - void GenerateReadObject (XmlTypeMapping typeMap) - { - if (_format == SerializationFormat.Literal) - WriteLine ("public " + typeMap.TypeFullName + " " + GetReadObjectName (typeMap) + " (bool isNullable, bool checkType)"); - else - WriteLine ("public " + typeMap.TypeFullName + " " + GetReadObjectName (typeMap) + " ()"); - - WriteLineInd ("{"); - - PushHookContext (); - - SetHookVar ("$TYPE", typeMap.TypeName); - SetHookVar ("$FULLTYPE", typeMap.TypeFullName); - SetHookVar ("$NULLABLE", "isNullable"); - - switch (typeMap.TypeData.SchemaType) - { - case SchemaTypes.Class: GenerateReadClassInstance (typeMap, "isNullable", "checkType"); break; - case SchemaTypes.Array: - WriteLine ("return " + GenerateReadListElement (typeMap, null, "isNullable", true)); - break; - case SchemaTypes.XmlNode: GenerateReadXmlNodeElement (typeMap, "isNullable"); break; - case SchemaTypes.Primitive: GenerateReadPrimitiveElement (typeMap, "isNullable"); break; - case SchemaTypes.Enum: GenerateReadEnumElement (typeMap, "isNullable"); break; - case SchemaTypes.XmlSerializable: GenerateReadXmlSerializableElement (typeMap, "isNullable"); break; - default: throw new Exception ("Unsupported map type"); - } - - WriteLineUni ("}"); - WriteLine (""); - PopHookContext (); - } - - void GenerateReadClassInstance (XmlTypeMapping typeMap, string isNullable, string checkType) - { - WriteLine (typeMap.TypeFullName + " ob = null;"); - SetHookVar ("$OBJECT", "ob"); - - if (GenerateReadHook (HookType.type, typeMap.TypeData.Type)) { - WriteLine ("return ob;"); - return; - } - - if (_format == SerializationFormat.Literal) { - WriteLine ("if (" + isNullable + " && ReadNull()) return null;"); - WriteLine (""); - WriteLine ("if (checkType) "); - WriteLineInd ("{"); - } - else { - WriteLine ("if (ReadNull()) return null;"); - WriteLine (""); - } - - WriteLine ("System.Xml.XmlQualifiedName t = GetXsiType();"); - WriteLine ("if (t != null) "); - WriteLineInd ("{"); - - bool first = true; - foreach (XmlTypeMapping realMap in typeMap.DerivedTypes) - { - WriteLineInd ((first?"":"else ") + "if (t.Name == " + GetLiteral (realMap.XmlType) + " && t.Namespace == " + GetLiteral (realMap.Namespace) + ")"); - WriteLine ("return " + GetReadObjectName(realMap) + " (" + isNullable + ", " + checkType + ");"); - Unindent (); - first = false; - } - - WriteLine ((first?"":"else ") + "if (t.Name != " + GetLiteral (typeMap.XmlType) + " || t.Namespace != " + GetLiteral (typeMap.Namespace) + ")"); - if (typeMap.TypeData.Type == typeof(object)) - WriteLine ("\treturn ReadTypedPrimitive (t);"); - else - WriteLine ("\tthrow CreateUnknownTypeException(t);"); - - WriteLineUni ("}"); - - if (_format == SerializationFormat.Literal) - WriteLineUni ("}"); - - if (typeMap.TypeData.Type.IsAbstract) { - GenerateEndHook (); - WriteLine ("return ob;"); - return; - } - - WriteLine (""); - WriteLine ("ob = new " + typeMap.TypeFullName + " ();"); - WriteLine (""); - - WriteLine ("Reader.MoveToElement();"); - WriteLine (""); - - GenerateReadMembers (typeMap, (ClassMap)typeMap.ObjectMap, "ob", false); - - WriteLine (""); - - GenerateEndHook (); - WriteLine ("return ob;"); - } - - void GenerateReadMembers (XmlTypeMapping typeMap, ClassMap map, string ob, bool isValueList) - { - // A value list cannot have attributes - - bool first; - if (!isValueList && !GenerateReadHook (HookType.attributes, typeMap.TypeData.Type)) - { - // Reads attributes - - XmlTypeMapMember anyAttrMember = map.DefaultAnyAttributeMember; - - if (anyAttrMember != null) - { - WriteLine ("int anyAttributeIndex = 0;"); - WriteLine (anyAttrMember.TypeData.FullTypeName + " anyAttributeArray = null;"); - } - - WriteLine ("while (Reader.MoveToNextAttribute())"); - WriteLineInd ("{"); - first = true; - if (map.AttributeMembers != null) { - foreach (XmlTypeMapMemberAttribute at in map.AttributeMembers) - { - WriteLineInd ((first?"":"else ") + "if (Reader.LocalName == " + GetLiteral (at.AttributeName) + " && Reader.NamespaceURI == " + GetLiteral (at.Namespace) + ") {"); - if (!GenerateReadMemberHook (typeMap.TypeData.Type, at)) { - GenerateSetMemberValue (at, ob, GenerateGetValueFromXmlString ("Reader.Value", at.TypeData, at.MappedType), isValueList); - GenerateEndHook (); - } - WriteLineUni ("}"); - first = false; - } - } - WriteLineInd ((first?"":"else ") + "if (IsXmlnsAttribute (Reader.Name)) {"); - - // If the map has NamespaceDeclarations, - // then store this xmlns to the given member. - // If the instance doesn't exist, then create. - - if (map.NamespaceDeclarations != null) { - if (!GenerateReadMemberHook (typeMap.TypeData.Type,map.NamespaceDeclarations)) { - string nss = ob + "." + map.NamespaceDeclarations.Name; - WriteLine ("if (" + nss + " == null) " + nss + " = new XmlSerializerNamespaces ();"); - WriteLineInd ("if (Reader.Prefix == \"xmlns\")"); - WriteLine (nss + ".Add (Reader.LocalName, Reader.Value);"); - Unindent (); - WriteLineInd ("else"); - WriteLine (nss + ".Add (\"\", Reader.Value);"); - Unindent (); - GenerateEndHook (); - } - } - - WriteLineUni ("}"); - WriteLineInd ("else {"); - - if (anyAttrMember != null) - { - if (!GenerateReadArrayMemberHook (typeMap.TypeData.Type, anyAttrMember, "anyAttributeIndex")) { - WriteLine ("System.Xml.XmlAttribute attr = (System.Xml.XmlAttribute) Document.ReadNode(Reader);"); - if (typeof(System.Xml.Schema.XmlSchemaAnnotated).IsAssignableFrom (typeMap.TypeData.Type)) - WriteLine ("ParseWsdlArrayType (attr);"); - GenerateAddListValue (anyAttrMember.TypeData, "anyAttributeArray", "anyAttributeIndex", GetCast (anyAttrMember.TypeData.ListItemTypeData, "attr"), true); - GenerateEndHook (); - } - WriteLine ("anyAttributeIndex++;"); - } - else { - if (!GenerateReadHook (HookType.unknownAttribute, typeMap.TypeData.Type)) { - WriteLine ("UnknownNode (" + ob + ");"); - GenerateEndHook (); - } - } - - WriteLineUni ("}"); - WriteLineUni ("}"); - - if (anyAttrMember != null && !MemberHasReadReplaceHook (typeMap.TypeData.Type, anyAttrMember)) - { - WriteLine (""); - WriteLine("anyAttributeArray = (" + anyAttrMember.TypeData.FullTypeName + ") ShrinkArray (anyAttributeArray, anyAttributeIndex, " + GetTypeOf(anyAttrMember.TypeData.Type.GetElementType()) + ", true);"); - GenerateSetMemberValue (anyAttrMember, ob, "anyAttributeArray", isValueList); - } - WriteLine (""); - - GenerateEndHook (); - } - - WriteLine ("Reader.MoveToElement();"); - WriteLineInd ("if (Reader.IsEmptyElement) {"); - WriteLine ("Reader.Skip ();"); - WriteLine ("return " + ob + ";"); - WriteLineUni ("}"); - WriteLine (""); - - WriteLine ("Reader.ReadStartElement();"); - - // Reads elements - - WriteLine("Reader.MoveToContent();"); - WriteLine (""); - - if (!GenerateReadHook (HookType.elements, typeMap.TypeData.Type)) - { - string[] readFlag = null; - if (map.ElementMembers != null) - { - string readFlagsVars = "bool "; - readFlag = new string[map.ElementMembers.Count]; - for (int n=0; n<map.ElementMembers.Count; n++) { - readFlag[n] = GetBoolTempVar (); - if (n > 0) readFlagsVars += ", "; - readFlagsVars += readFlag[n] + "=false"; - } - if (map.ElementMembers.Count > 0) WriteLine (readFlagsVars + ";"); - WriteLine (""); - } - - string[] indexes = null; - string[] flatLists = null; - - if (map.FlatLists != null) - { - indexes = new string[map.FlatLists.Count]; - flatLists = new string[map.FlatLists.Count]; - - string code = "int "; - for (int n=0; n<map.FlatLists.Count; n++) - { - XmlTypeMapMember mem = (XmlTypeMapMember)map.FlatLists[n]; - indexes[n] = GetNumTempVar (); - if (n > 0) code += ", "; - code += indexes[n] + "=0"; - if (!MemberHasReadReplaceHook (typeMap.TypeData.Type, mem)) { - flatLists[n] = GetObTempVar (); - string rval = "null"; - if (IsReadOnly (typeMap, mem, isValueList)) rval = ob + "." + mem.Name; - WriteLine (mem.TypeData.FullTypeName + " " + flatLists[n] + " = " + rval + ";"); - } - } - WriteLine (code + ";"); - WriteLine (""); - } - - if (_format == SerializationFormat.Encoded && map.ElementMembers != null) - { - WriteLine ("Fixup fixup = new Fixup(" + ob + ", new XmlSerializationFixupCallback(" + GetFixupCallbackName (typeMap) + "), " + map.ElementMembers.Count + ");"); - WriteLine ("AddFixup (fixup);"); - WriteLine (""); - } - - WriteLine ("while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) "); - WriteLineInd ("{"); - WriteLine ("if (Reader.NodeType == System.Xml.XmlNodeType.Element) "); - WriteLineInd ("{"); - - first = true; - foreach (XmlTypeMapElementInfo info in map.AllElementInfos) - { - if (info.IsTextElement || info.IsUnnamedAnyElement) continue; - WriteLineInd ((first?"":"else ") + "if (Reader.LocalName == " + GetLiteral (info.ElementName) + " && Reader.NamespaceURI == " + GetLiteral (info.Namespace) + " && !" + readFlag[info.Member.Index] + ") {"); - - if (info.Member.GetType() == typeof (XmlTypeMapMemberList)) - { - if (_format == SerializationFormat.Encoded && info.MultiReferenceType) - { - string list = GetObTempVar (); - WriteLine ("object " + list + " = ReadReferencingElement (out fixup.Ids[" + info.Member.Index + "]);"); - WriteLineInd ("if (fixup.Ids[" + info.Member.Index + "] == null) {"); // Already read - if (IsReadOnly (typeMap, info.Member, isValueList)) - WriteLine ("throw CreateReadOnlyCollectionException (" + GetLiteral(info.TypeData.FullTypeName) + ");"); - else - GenerateSetMemberValue (info.Member, ob, GetCast (info.Member.TypeData,list), isValueList); - WriteLineUni ("}"); - - if (!info.MappedType.TypeData.Type.IsArray) - { - WriteLineInd ("else {"); - if (IsReadOnly (typeMap, info.Member, isValueList)) - WriteLine (list + " = " + GenerateGetMemberValue (info.Member, ob, isValueList) + ";"); - else { - WriteLine (list + " = " + GenerateCreateList (info.MappedType.TypeData.Type) + ";"); - GenerateSetMemberValue (info.Member, ob, list, isValueList); - } - WriteLine ("AddFixup (new CollectionFixup (" + list + ", new XmlSerializationCollectionFixupCallback (" + GetFillListName(info.Member.TypeData) + "), fixup.Ids[" + info.Member.Index + "]));"); - WriteLine ("fixup.Ids[" + info.Member.Index + "] = null;"); // The member already has the value, no further fix needed. - WriteLineUni ("}"); - } - } - else - { - if (!GenerateReadMemberHook (typeMap.TypeData.Type, info.Member)) { - if (IsReadOnly (typeMap, info.Member, isValueList)) GenerateReadListElement (info.MappedType, GenerateGetMemberValue (info.Member, ob, isValueList), GetLiteral(info.IsNullable), false); - else GenerateSetMemberValue (info.Member, ob, GenerateReadListElement (info.MappedType, null, GetLiteral(info.IsNullable), true), isValueList); - GenerateEndHook (); - } - } - WriteLine (readFlag[info.Member.Index] + " = true;"); - } - else if (info.Member.GetType() == typeof (XmlTypeMapMemberFlatList)) - { - XmlTypeMapMemberFlatList mem = (XmlTypeMapMemberFlatList)info.Member; - if (!GenerateReadArrayMemberHook (typeMap.TypeData.Type, info.Member, indexes[mem.FlatArrayIndex])) { - GenerateAddListValue (mem.TypeData, flatLists[mem.FlatArrayIndex], indexes[mem.FlatArrayIndex], GenerateReadObjectElement (info), !IsReadOnly (typeMap, info.Member, isValueList)); - GenerateEndHook (); - } - WriteLine (indexes[mem.FlatArrayIndex] + "++;"); - } - else if (info.Member.GetType() == typeof (XmlTypeMapMemberAnyElement)) - { - XmlTypeMapMemberAnyElement mem = (XmlTypeMapMemberAnyElement)info.Member; - if (mem.TypeData.IsListType) { - if (!GenerateReadArrayMemberHook (typeMap.TypeData.Type, info.Member, indexes[mem.FlatArrayIndex])) { - GenerateAddListValue (mem.TypeData, flatLists[mem.FlatArrayIndex], indexes[mem.FlatArrayIndex], "ReadXmlNode (false)", true); - GenerateEndHook (); - } - WriteLine (indexes[mem.FlatArrayIndex] + "++;"); - } - else { - if (!GenerateReadMemberHook (typeMap.TypeData.Type, info.Member)) { - GenerateSetMemberValue (mem, ob, "ReadXmlNode (false)", isValueList); - GenerateEndHook (); - } - } - } - else if (info.Member.GetType() == typeof(XmlTypeMapMemberElement)) - { - WriteLine (readFlag[info.Member.Index] + " = true;"); - if (_format == SerializationFormat.Encoded && info.MultiReferenceType) - { - string val = GetObTempVar (); - WriteLine ("object " + val + " = ReadReferencingElement (out fixup.Ids[" + info.Member.Index + "]);"); - WriteLineInd ("if (fixup.Ids[" + info.Member.Index + "] == null) {"); // already read - GenerateSetMemberValue (info.Member, ob, val, isValueList); - WriteLineUni ("}"); - } - else if (!GenerateReadMemberHook (typeMap.TypeData.Type, info.Member)) { - GenerateSetMemberValue (info.Member, ob, GenerateReadObjectElement (info), isValueList); - GenerateEndHook (); - } - } - else - throw new InvalidOperationException ("Unknown member type"); - - WriteLineUni ("}"); - first = false; - } - - if (!first) WriteLineInd ("else {"); - - if (map.DefaultAnyElementMember != null) - { - XmlTypeMapMemberAnyElement mem = map.DefaultAnyElementMember; - if (mem.TypeData.IsListType) { - if (!GenerateReadArrayMemberHook (typeMap.TypeData.Type, mem, indexes[mem.FlatArrayIndex])) { - GenerateAddListValue (mem.TypeData, flatLists[mem.FlatArrayIndex], indexes[mem.FlatArrayIndex], "ReadXmlNode (false)", true); - GenerateEndHook (); - } - WriteLine (indexes[mem.FlatArrayIndex] + "++;"); - } - else if (! GenerateReadMemberHook (typeMap.TypeData.Type, mem)) { - GenerateSetMemberValue (mem, ob, "ReadXmlNode (false)", isValueList); - GenerateEndHook (); - } - } - else { - if (!GenerateReadHook (HookType.unknownElement, typeMap.TypeData.Type)) { - WriteLine ("UnknownNode (" + ob + ");"); - GenerateEndHook (); - } - } - - if (!first) WriteLineUni ("}"); - - WriteLineUni ("}"); - - if (map.XmlTextCollector != null) - { - WriteLine ("else if (Reader.NodeType == System.Xml.XmlNodeType.Text)"); - WriteLineInd ("{"); - - if (map.XmlTextCollector is XmlTypeMapMemberExpandable) - { - XmlTypeMapMemberExpandable mem = (XmlTypeMapMemberExpandable)map.XmlTextCollector; - if (!GenerateReadArrayMemberHook (typeMap.TypeData.Type, map.XmlTextCollector, indexes[mem.FlatArrayIndex])) { - string val = (mem.TypeData.ListItemType == typeof (string)) ? "Reader.ReadString()" : "ReadXmlNode (false)"; - GenerateAddListValue (mem.TypeData, flatLists[mem.FlatArrayIndex], indexes[mem.FlatArrayIndex], val, true); - GenerateEndHook (); - } - WriteLine (indexes[mem.FlatArrayIndex] + "++;"); - } - else if (!GenerateReadMemberHook (typeMap.TypeData.Type, map.XmlTextCollector)) - { - XmlTypeMapMemberElement mem = (XmlTypeMapMemberElement) map.XmlTextCollector; - XmlTypeMapElementInfo info = (XmlTypeMapElementInfo) mem.ElementInfo [0]; - if (info.TypeData.Type == typeof (string)) - GenerateSetMemberValue (mem, ob, "ReadString (" + GenerateGetMemberValue (mem, ob, isValueList) + ")", isValueList); - else - GenerateSetMemberValue (mem, ob, GenerateGetValueFromXmlString ("Reader.ReadString()", info.TypeData, info.MappedType), isValueList); - GenerateEndHook (); - } - WriteLineUni ("}"); - } - - WriteLine ("else"); - WriteLine ("\tUnknownNode(ob);"); - WriteLine (""); - - WriteLine ("Reader.MoveToContent();"); - WriteLineUni ("}"); - - if (flatLists != null) - { - WriteLine (""); - foreach (XmlTypeMapMemberExpandable mem in map.FlatLists) - { - if (MemberHasReadReplaceHook (typeMap.TypeData.Type, mem)) continue; - - string list = flatLists[mem.FlatArrayIndex]; - if (mem.TypeData.Type.IsArray) - WriteLine (list + " = (" + mem.TypeData.FullTypeName + ") ShrinkArray (" + list + ", " + indexes[mem.FlatArrayIndex] + ", " + GetTypeOf(mem.TypeData.Type.GetElementType()) + ", true);"); - if (!IsReadOnly (typeMap, mem, isValueList)) - GenerateSetMemberValue (mem, ob, list, isValueList); - } - } - GenerateEndHook (); - } - - WriteLine (""); - WriteLine ("ReadEndElement();"); - } - - bool IsReadOnly (XmlTypeMapping map, XmlTypeMapMember member, bool isValueList) - { - if (isValueList) return false; - else return member.IsReadOnly (map.TypeData.Type); - } - - void GenerateSetMemberValue (XmlTypeMapMember member, string ob, string value, bool isValueList) - { - if (isValueList) WriteLine (ob + "[" + member.Index + "] = " + value + ";"); - else WriteLine (ob + "." + member.Name + " = " + value + ";"); - } - - object GenerateGetMemberValue (XmlTypeMapMember member, object ob, bool isValueList) - { - if (isValueList) return ob + "[" + member.Index + "]"; - else return ob + "." + member.Name; - } - - string GenerateReadObjectElement (XmlTypeMapElementInfo elem) - { - switch (elem.TypeData.SchemaType) - { - case SchemaTypes.XmlNode: - return "ReadXmlNode (true)"; - - case SchemaTypes.Primitive: - case SchemaTypes.Enum: - return GenerateReadPrimitiveValue (elem); - - case SchemaTypes.Array: - return GenerateReadListElement (elem.MappedType, null, GetLiteral(elem.IsNullable), true); - - case SchemaTypes.Class: - return GetReadObjectName(elem.MappedType) + " (" + GetLiteral(elem.IsNullable) + ", true)"; - - case SchemaTypes.XmlSerializable: - return "ReadSerializable (new " + elem.TypeData.FullTypeName + " ())"; - - default: - throw new NotSupportedException ("Invalid value type"); - } - } - - string GenerateReadPrimitiveValue (XmlTypeMapElementInfo elem) - { - if (elem.TypeData.Type == typeof (XmlQualifiedName)) { - if (elem.IsNullable) return "ReadNullableQualifiedName ()"; - else return "ReadElementQualifiedName ()"; - } - else if (elem.IsNullable) - return GenerateGetValueFromXmlString ("ReadNullableString ()", elem.TypeData, elem.MappedType); - else - return GenerateGetValueFromXmlString ("Reader.ReadElementString ()", elem.TypeData, elem.MappedType); - } - - string GenerateGetValueFromXmlString (string value, TypeData typeData, XmlTypeMapping typeMap) - { - if (typeData.SchemaType == SchemaTypes.Array) - return GenerateReadListString (typeMap, value); - else if (typeData.SchemaType == SchemaTypes.Enum) - return GenerateGetEnumValue (typeMap, value); - else if (typeData.Type == typeof (XmlQualifiedName)) - return "ToXmlQualifiedName (" + value + ")"; - else - return XmlCustomFormatter.GenerateFromXmlString (typeData, value); - } - - string GenerateReadListElement (XmlTypeMapping typeMap, string list, string isNullable, bool canCreateInstance) - { - Type listType = typeMap.TypeData.Type; - ListMap listMap = (ListMap)typeMap.ObjectMap; - - if (list == null) { - if (canCreateInstance) { - list = GetObTempVar (); - WriteLine (typeMap.TypeFullName + " " + list + " = null;"); - WriteLineInd ("if (!ReadNull()) {"); - WriteLine (list + " = " + GenerateCreateList (listType) + ";"); - } - else throw new InvalidOperationException ("Cannot assign array to read only property: " + typeMap.TypeFullName); - } - else { - WriteLineInd ("if (!ReadNull()) {"); - } - - WriteLineInd ("if (Reader.IsEmptyElement) {"); - WriteLine ("Reader.Skip();"); - if (listType.IsArray) - WriteLine (list + " = (" + typeMap.TypeFullName + ") ShrinkArray (" + list + ", 0, " + GetTypeOf(listType.GetElementType()) + ", " + isNullable + ");"); - - Unindent (); - WriteLineInd ("} else {"); - - string index = GetNumTempVar (); - WriteLine ("int " + index + " = 0;"); - WriteLine ("Reader.ReadStartElement();"); - WriteLine ("Reader.MoveToContent();"); - WriteLine (""); - - WriteLine ("while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) "); - WriteLineInd ("{"); - WriteLine ("if (Reader.NodeType == System.Xml.XmlNodeType.Element) "); - WriteLineInd ("{"); - - bool first = true; - foreach (XmlTypeMapElementInfo elemInfo in listMap.ItemInfo) - { - WriteLineInd ((first?"":"else ") + "if (Reader.LocalName == " + GetLiteral (elemInfo.ElementName) + " && Reader.NamespaceURI == " + GetLiteral (elemInfo.Namespace) + ") {"); - GenerateAddListValue (typeMap.TypeData, list, index, GenerateReadObjectElement (elemInfo), false); - WriteLine (index + "++;"); - WriteLineUni ("}"); - first = false; - } - if (!first) WriteLine ("else UnknownNode (null);"); - else WriteLine ("UnknownNode (null);"); - - WriteLineUni ("}"); - WriteLine ("else UnknownNode (null);"); - WriteLine (""); - WriteLine ("Reader.MoveToContent();"); - WriteLineUni ("}"); - - WriteLine ("ReadEndElement();"); - - if (listType.IsArray) - WriteLine (list + " = (" + typeMap.TypeFullName + ") ShrinkArray (" + list + ", " + index + ", " + GetTypeOf(listType.GetElementType()) + ", " + isNullable + ");"); - - WriteLineUni ("}"); - WriteLineUni ("}"); - - return list; - } - - string GenerateReadListString (XmlTypeMapping typeMap, string values) - { - Type listType = typeMap.TypeData.Type; - ListMap listMap = (ListMap)typeMap.ObjectMap; - string itemType = listType.GetElementType().FullName; - - string list = GetObTempVar (); - WriteLine (itemType + "[] " + list + ";"); - - string var = GetStrTempVar (); - WriteLine ("string " + var + " = " + values + ".Trim();"); - WriteLineInd ("if (" + var + " != string.Empty) {"); - - string valueArray = GetObTempVar (); - WriteLine ("string[] " + valueArray + " = " + var + ".Split (' ');"); - - WriteLine (list + " = new " + itemType + " [" + valueArray + ".Length];"); - - XmlTypeMapElementInfo info = (XmlTypeMapElementInfo)listMap.ItemInfo[0]; - - string index = GetNumTempVar (); - WriteLineInd ("for (int " + index + " = 0; " + index + " < " + valueArray + ".Length; " + index + "++)"); - WriteLine (list + "[" + index + "] = " + GenerateGetValueFromXmlString (valueArray + "[" + index + "]", info.TypeData, info.MappedType) + ";"); - Unindent (); - WriteLineUni ("}"); - WriteLine ("else"); - WriteLine ("\t" + list + " = new " + itemType + " [0];"); - - return list; - } - - void GenerateAddListValue (TypeData listType, string list, string index, string value, bool canCreateInstance) - { - Type type = listType.Type; - if (type.IsArray) - { - WriteLine (list + " = (" + type.FullName + ") EnsureArrayIndex (" + list + ", " + index + ", " + GetTypeOf(type.GetElementType()) + ");"); - WriteLine (list + "[" + index + "] = " + value + ";"); - } - else // Must be IEnumerable - { - WriteLine ("if (" + list + " == null)"); - if (canCreateInstance) - WriteLine ("\t" + list + " = new " + listType.FullTypeName + "();"); - else - WriteLine ("\tthrow CreateReadOnlyCollectionException (" + GetLiteral (listType.FullTypeName) + ");"); - - WriteLine (list + ".Add (" + value + ");"); - } - } - - string GenerateCreateList (Type listType) - { - if (listType.IsArray) - return "(" + listType.FullName + ") EnsureArrayIndex (null, 0, " + GetTypeOf(listType.GetElementType()) + ")"; - else - return "new " + listType.FullName + "()"; - } - - void GenerateFillerCallbacks () - { - foreach (TypeData td in _listsToFill) - { - string metName = GetFillListName (td); - WriteLine ("void " + metName + " (object list, object source)"); - WriteLineInd ("{"); - WriteLine ("if (list == null) throw CreateReadOnlyCollectionException (" + GetLiteral (td.FullTypeName) + ");"); - WriteLine (""); - - WriteLine (td.FullTypeName + " dest = (" + td.FullTypeName + ") list;"); - WriteLine ("foreach (object ob in (IEnumerable)source)"); - WriteLine ("\t dest.Add (ob)"); - WriteLineUni ("}"); - WriteLine (""); - } - } - - void GenerateReadXmlNodeElement (XmlTypeMapping typeMap, string isNullable) - { - WriteLine ("return ReadXmlNode (false);"); - } - - void GenerateReadPrimitiveElement (XmlTypeMapping typeMap, string isNullable) - { - WriteLine ("XmlQualifiedName t = GetXsiType();"); - WriteLine ("if (t == null) t = new XmlQualifiedName (" + GetLiteral(typeMap.XmlType) + ", " + GetLiteral(typeMap.Namespace) + ");"); - WriteLine ("return ReadTypedPrimitive (t);"); - } - - void GenerateReadEnumElement (XmlTypeMapping typeMap, string isNullable) - { - WriteLine ("Reader.ReadStartElement ();"); - WriteLine (typeMap.TypeFullName + " res = " + GenerateGetEnumValue (typeMap, "Reader.ReadString()") + ";"); - WriteLine ("Reader.ReadEndElement ();"); - WriteLine ("return res;"); - } - - string GenerateGetEnumValue (XmlTypeMapping typeMap, string val) - { - return GetGetEnumValueName (typeMap) + " (" + val + ")"; - } - - void GenerateGetEnumValue (XmlTypeMapping typeMap) - { - string metName = GetGetEnumValueName (typeMap); - EnumMap map = (EnumMap) typeMap.ObjectMap; - - if (map.IsFlags) - { - string switchMethod = metName + "_Switch"; - WriteLine (typeMap.TypeFullName + " " + metName + " (string xmlName)"); - WriteLineInd ("{"); - WriteLine ("if (xmlName.Trim().IndexOf (' ') != -1)"); - WriteLineInd ("{"); - WriteLine (typeMap.TypeFullName + " sb = (" + typeMap.TypeFullName + ")0;"); - WriteLine ("string[] enumNames = xmlName.ToString().Split (' ');"); - WriteLine ("foreach (string name in enumNames)"); - WriteLineInd ("{"); - WriteLine ("if (name == string.Empty) continue;"); - WriteLine ("sb |= " + switchMethod + " (name); "); - WriteLineUni ("}"); - WriteLine ("return sb;"); - WriteLineUni ("}"); - WriteLine ("else"); - WriteLine ("\treturn " + switchMethod + " (xmlName);"); - WriteLineUni ("}"); - metName = switchMethod; - } - - WriteLine (typeMap.TypeFullName + " " + metName + " (string xmlName)"); - WriteLineInd ("{"); - GenerateGetSingleEnumValue (typeMap, "xmlName"); - WriteLineUni ("}"); - WriteLine (""); - } - - void GenerateGetSingleEnumValue (XmlTypeMapping typeMap, string val) - { - EnumMap map = (EnumMap) typeMap.ObjectMap; - WriteLine ("switch (" + val + ")"); - WriteLineInd ("{"); - foreach (EnumMap.EnumMapMember mem in map.Members) - { - WriteLine ("case " + GetLiteral (mem.XmlName) + ": return " + typeMap.TypeFullName + "." + mem.EnumName + ";"); - } - WriteLineInd ("default:"); - WriteLineInd ("try {"); - WriteLine ("return (" + typeMap.TypeFullName + ") Int64.Parse (" + val + ");"); - WriteLineUni ("}"); - WriteLineInd ("catch {"); - WriteLine ("throw new InvalidOperationException (\"Invalid enumeration value: \" + " + val + ");"); - WriteLineUni ("}"); - Unindent (); - WriteLineUni ("}"); - } - - void GenerateReadXmlSerializableElement (XmlTypeMapping typeMap, string isNullable) - { - WriteLine ("Reader.MoveToContent ();"); - WriteLine ("if (Reader.NodeType == XmlNodeType.Element)"); - WriteLineInd ("{"); - WriteLine ("if (Reader.LocalName == " + GetLiteral (typeMap.ElementName) + " && Reader.NamespaceURI == " + GetLiteral (typeMap.Namespace) + ")"); - WriteLine ("\treturn ReadSerializable (new " + typeMap.TypeData.FullTypeName + "());"); - WriteLine ("else"); - WriteLine ("\tthrow CreateUnknownNodeException ();"); - WriteLineUni ("}"); - WriteLine ("else UnknownNode (null);"); - WriteLine (""); - WriteLine ("return null;"); - } - - void GenerateReadInitCallbacks () - { - WriteLine ("protected override void InitCallbacks ()"); - WriteLineInd ("{"); - - if (_format == SerializationFormat.Encoded) - { - foreach (XmlTypeMapping map in _mapsToGenerate) - { - if (map.TypeData.SchemaType == SchemaTypes.Class || map.TypeData.SchemaType == SchemaTypes.Enum) - { - WriteMetCall ("AddReadCallback", GetLiteral (map.XmlType), GetLiteral(map.Namespace), GetTypeOf(map.TypeData.Type), "new XmlSerializationReadCallback (" + GetReadObjectName (map) + ")"); - } - } - } - - WriteLineUni ("}"); - WriteLine (""); - - WriteLine ("protected override void InitIDs ()"); - WriteLine ("{"); - WriteLine ("}"); - WriteLine (""); - } - - void GenerateFixupCallbacks () - { - foreach (XmlTypeMapping map in _mapsToGenerate) - { - if (map.TypeData.SchemaType == SchemaTypes.Class) - { - WriteLine ("void " + GetFixupCallbackName (map) + " (object obfixup)"); - WriteLineInd ("{"); - WriteLine ("Fixup fixup = (Fixup)obfixup;"); - WriteLine (map.TypeFullName + " source = (" + map.TypeFullName + ") fixup.Source;"); - WriteLine ("string[] ids = fixup.Ids;"); - WriteLine (""); - - ClassMap cmap = (ClassMap)map.ObjectMap; - ICollection members = cmap.ElementMembers; - if (members != null) { - foreach (XmlTypeMapMember member in members) - { - WriteLineInd ("if (ids[" + member.Index + "] != null)"); - GenerateSetMemberValue (member, "source", GetCast (member.TypeData, "GetTarget(ids[" + member.Index + "])"), false); - Unindent (); - } - } - WriteLineUni ("}"); - WriteLine (""); - } - } - } - - #endregion - - #region Helper methods - - //******************************************************* - // Helper methods - // - - ArrayList _listsToFill = new ArrayList (); - Hashtable _hooks; - Hashtable _hookVariables; - Stack _hookContexts; - Stack _hookOpenHooks; - - class HookInfo { - public HookType HookType; - public Type Type; - public string Member; - public HookDir Direction; - } - - void InitHooks () - { - _hookContexts = new Stack (); - _hookOpenHooks = new Stack (); - _hookVariables = new Hashtable (); - _hooks = new Hashtable (); - } - - void PushHookContext () - { - _hookContexts.Push (_hookVariables); - _hookVariables = (Hashtable) _hookVariables.Clone (); - } - - void PopHookContext () - { - _hookVariables = (Hashtable) _hookContexts.Pop (); - } - - void SetHookVar (string var, string value) - { - _hookVariables [var] = value; - } - - bool GenerateReadHook (HookType hookType, Type type) - { - return GenerateHook (hookType, HookDir.Read, type, null); - } - - bool GenerateWriteHook (HookType hookType, Type type) - { - return GenerateHook (hookType, HookDir.Write, type, null); - } - - bool GenerateWriteMemberHook (Type type, XmlTypeMapMember member) - { - SetHookVar ("$MEMBER", member.Name); - return GenerateHook (HookType.member, HookDir.Write, type, member.Name); - } - - bool GenerateReadMemberHook (Type type, XmlTypeMapMember member) - { - SetHookVar ("$MEMBER", member.Name); - return GenerateHook (HookType.member, HookDir.Read, type, member.Name); - } - - bool GenerateReadArrayMemberHook (Type type, XmlTypeMapMember member, string index) - { - SetHookVar ("$INDEX", index); - return GenerateReadMemberHook (type, member); - } - - bool MemberHasReadReplaceHook (Type type, XmlTypeMapMember member) - { - return _config.GetHooks (HookType.member, HookDir.Read, HookAction.Replace, type, member.Name).Count > 0; - } - - bool GenerateHook (HookType hookType, HookDir dir, Type type, string member) - { - GenerateHooks (hookType, dir, type, null, HookAction.InsertBefore); - if (GenerateHooks (hookType, dir, type, null, HookAction.Replace)) - { - GenerateHooks (hookType, dir, type, null, HookAction.InsertAfter); - return true; - } - else - { - HookInfo hi = new HookInfo (); - hi.HookType = hookType; - hi.Type = type; - hi.Member = member; - hi.Direction = dir; - _hookOpenHooks.Push (hi); - return false; - } - } - - void GenerateEndHook () - { - HookInfo hi = (HookInfo) _hookOpenHooks.Pop(); - GenerateHooks (hi.HookType, hi.Direction, hi.Type, hi.Member, HookAction.InsertAfter); - } - - bool GenerateHooks (HookType hookType, HookDir dir, Type type, string member, HookAction action) - { - ArrayList hooks = _config.GetHooks (hookType, dir, action, type, null); - if (hooks.Count == 0) return false; - foreach (Hook hook in hooks) - { - string code = hook.GetCode (action); - foreach (DictionaryEntry de in _hookVariables) - code = code.Replace ((string)de.Key, (string)de.Value); - WriteMultilineCode (code); - } - return true; - } - - string GetRootTypeName () - { - if (_typeMap is XmlTypeMapping) return ((XmlTypeMapping)_typeMap).TypeFullName; - else return "object[]"; - } - - string GetNumTempVar () - { - return "n" + (_tempVarId++); - } - - string GetObTempVar () - { - return "o" + (_tempVarId++); - } - - string GetStrTempVar () - { - return "s" + (_tempVarId++); - } - - string GetBoolTempVar () - { - return "b" + (_tempVarId++); - } - - string GetUniqueName (string uniqueGroup, object ob, string name) - { - Hashtable names = (Hashtable) _uniqueNames [uniqueGroup]; - if (names == null) { - names = new Hashtable (); - _uniqueNames [uniqueGroup] = names; - } - - string res = (string) names [ob]; - if (res != null) return res; - - foreach (string n in names.Values) - if (n == name) return GetUniqueName (uniqueGroup, ob, name + (_methodId++)); - - names [ob] = name; - return name; - } - - string GetWriteObjectName (XmlTypeMapping typeMap) - { - if (!_mapsToGenerate.Contains (typeMap)) _mapsToGenerate.Add (typeMap); - return GetUniqueName ("rw", typeMap, "WriteObject_" + typeMap.XmlType); - } - - string GetReadObjectName (XmlTypeMapping typeMap) - { - if (!_mapsToGenerate.Contains (typeMap)) _mapsToGenerate.Add (typeMap); - return GetUniqueName ("rr", typeMap, "ReadObject_" + typeMap.XmlType); - } - - string GetGetEnumValueName (XmlTypeMapping typeMap) - { - if (!_mapsToGenerate.Contains (typeMap)) _mapsToGenerate.Add (typeMap); - return GetUniqueName ("ge", typeMap, "GetEnumValue_" + typeMap.XmlType); - } - - string GetWriteObjectCallbackName (XmlTypeMapping typeMap) - { - if (!_mapsToGenerate.Contains (typeMap)) _mapsToGenerate.Add (typeMap); - return GetUniqueName ("wc", typeMap, "WriteCallback_" + typeMap.XmlType); - } - - string GetFixupCallbackName (XmlTypeMapping typeMap) - { - if (!_mapsToGenerate.Contains (typeMap)) _mapsToGenerate.Add (typeMap); - return GetUniqueName ("fc", typeMap, "FixupCallback_" + typeMap.XmlType); - } - - string GetFillListName (TypeData td) - { - if (!_listsToFill.Contains (td)) _listsToFill.Add (td); - return GetUniqueName ("fl", td, "Fill_" + td.TypeName); - } - - string GetCast (TypeData td, TypeData tdval, string val) - { - if (td.FullTypeName == tdval.FullTypeName) return val; - else return GetCast (td, val); - } - - string GetCast (TypeData td, string val) - { - return "((" + td.FullTypeName + ") " + val + ")"; - } - - string GetTypeOf (TypeData td) - { - return "typeof(" + td.FullTypeName + ")"; - } - - string GetTypeOf (Type td) - { - return "typeof(" + td.FullName + ")"; - } - - string GetString (string str) - { - return "\"" + str + "\""; - } - - string GetLiteral (object ob) - { - if (ob == null) return "null"; - if (ob is string) return "\"" + ob.ToString().Replace("\"","\"\"") + "\""; - if (ob is bool) return ((bool)ob) ? "true" : "false"; - if (ob is XmlQualifiedName) { - XmlQualifiedName qn = (XmlQualifiedName)ob; - return "new XmlQualifiedName (" + GetLiteral(qn.Name) + "," + GetLiteral(qn.Namespace) + ")"; - } - else return ob.ToString (); - } - - void WriteLineInd (string code) - { - WriteLine (code); - _indent++; - } - - void WriteLineUni (string code) - { - if (_indent > 0) _indent--; - WriteLine (code); - } - - void WriteLine (string code) - { - if (code != "") _writer.Write (new String ('\t',_indent)); - _writer.WriteLine (code); - } - - void WriteMultilineCode (string code) - { - string tabs = new string ('\t',_indent); - code = code.Replace ("\r",""); - code = code.Replace ("\t",""); - while (code.StartsWith ("\n")) code = code.Substring (1); - while (code.EndsWith ("\n")) code = code.Substring (0, code.Length - 1); - code = code.Replace ("\n", "\n" + tabs); - WriteLine (code); - } - - string Params (params string[] pars) - { - string res = ""; - foreach (string p in pars) - { - if (res != "") res += ", "; - res += p; - } - return res; - } - - void WriteMetCall (string method, params string[] pars) - { - WriteLine (method + " (" + Params (pars) + ");"); - } - - void Indent () - { - _indent++; - } - - void Unindent () - { - _indent--; - } - - #endregion - - } -} diff --git a/mcs/class/System.XML/System.Xml.Serialization/SerializationCodeGeneratorConfiguration.cs b/mcs/class/System.XML/System.Xml.Serialization/SerializationCodeGeneratorConfiguration.cs deleted file mode 100644 index cf705d950be..00000000000 --- a/mcs/class/System.XML/System.Xml.Serialization/SerializationCodeGeneratorConfiguration.cs +++ /dev/null @@ -1,166 +0,0 @@ -// -// System.Xml.Serialization.SerializationCodeGeneratorConfiguration.cs: -// -// Author: -// Lluis Sanchez Gual (lluis@ximian.com) -// -// (C) 2002, 2003 Ximian, Inc. http://www.ximian.com -// - -using System; -using System.Collections; -using System.Xml.Serialization; - -namespace System.Xml.Serialization -{ - [XmlType ("configuration")] - internal class SerializationCodeGeneratorConfiguration - { - [XmlElement ("serializer")] - public SerializerInfo[] Serializers; - } - - [XmlType ("serializer")] - internal class SerializerInfo - { - [XmlAttribute ("class")] - public string ClassName; - - [XmlAttribute ("assembly")] - public string Assembly; - - [XmlElement ("reader")] - public string ReaderClassName; - - [XmlElement ("writer")] - public string WriterClassName; - - [XmlElement ("namespace")] - public string Namespace; - - [System.ComponentModel.DefaultValue (SerializationFormat.Literal)] - public SerializationFormat SerializationFormat = SerializationFormat.Literal; - - [XmlElement ("outFileName")] - public string OutFileName; - - [XmlArray ("readerHooks")] - public Hook[] ReaderHooks; - - [XmlArray ("writerHooks")] - public Hook[] WriterHooks; - - public ArrayList GetHooks (HookType hookType, HookDir dir, HookAction action, Type type, string member) - { - if (dir == HookDir.Read) - return FindHook (ReaderHooks, hookType, action, type, member); - else - return FindHook (WriterHooks, hookType, action, type, member); - } - - ArrayList FindHook (Hook[] hooks, HookType hookType, HookAction action, Type type, string member) - { - ArrayList foundHooks = new ArrayList (); - if (hooks == null) return foundHooks; - - foreach (Hook hook in hooks) - { - if (action == HookAction.InsertBefore && (hook.InsertBefore == null || hook.InsertBefore == "")) - continue; - else if (action == HookAction.InsertAfter && (hook.InsertAfter == null || hook.InsertAfter == "")) - continue; - else if (action == HookAction.Replace && (hook.Replace == null || hook.Replace == "")) - continue; - - if (hook.HookType != hookType) - continue; - - if (hook.Select != null) - { - if (hook.Select.TypeName != null && hook.Select.TypeName != "") - if (hook.Select.TypeName != type.FullName) continue; - - if (hook.Select.TypeMember != null && hook.Select.TypeMember != "") - if (hook.Select.TypeMember != member) continue; - - if (hook.Select.TypeAttributes != null && hook.Select.TypeAttributes.Length > 0) - { - object[] ats = type.GetCustomAttributes (true); - bool found = false; - foreach (object at in ats) - if (Array.IndexOf (hook.Select.TypeAttributes, at.GetType().FullName) != -1) { found = true; break; } - if (!found) continue; - } - } - foundHooks.Add (hook); - } - return foundHooks; - } - } - - [XmlType ("hook")] - internal class Hook - { - [XmlAttribute ("type")] - public HookType HookType; - - [XmlElement ("select")] - public Select Select; - - [XmlElement ("insertBefore")] - public string InsertBefore; - - [XmlElement ("insertAfter")] - public string InsertAfter; - - [XmlElement ("replace")] - public string Replace; - - public string GetCode (HookAction action) - { - if (action == HookAction.InsertBefore) - return InsertBefore; - else if (action == HookAction.InsertAfter) - return InsertAfter; - else - return Replace; - } - } - - [XmlType ("select")] - internal class Select - { - [XmlElement ("typeName")] - public string TypeName; - - [XmlElement("typeAttribute")] - public string[] TypeAttributes; - - [XmlElement ("typeMember")] - public string TypeMember; - } - - internal enum HookDir - { - Read, - Write - } - - internal enum HookAction - { - InsertBefore, - InsertAfter, - Replace - } - - [XmlType ("hookType")] - internal enum HookType - { - attributes, - elements, - unknownAttribute, - unknownElement, - member, - type - } -} diff --git a/mcs/class/System.XML/System.Xml.Serialization/SoapReflectionImporter.cs b/mcs/class/System.XML/System.Xml.Serialization/SoapReflectionImporter.cs index e702c28b57d..fe3294ba824 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/SoapReflectionImporter.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/SoapReflectionImporter.cs @@ -20,6 +20,7 @@ namespace System.Xml.Serialization { ArrayList includedTypes; ArrayList relatedMaps = new ArrayList (); ReflectionHelper helper = new ReflectionHelper(); + internal const string EncodingNamespace = "http://schemas.xmlsoap.org/soap/encoding/"; #region Constructors @@ -64,7 +65,7 @@ namespace System.Xml.Serialization { for (int n=0; n<members.Length; n++) { XmlTypeMapMember mapMem = CreateMapMember (members[n], ns); - mapping[n] = new XmlMemberMapping (members[n].MemberName, mapMem); + mapping[n] = new XmlMemberMapping (members[n], mapMem); } XmlMembersMapping mps = new XmlMembersMapping (elementName, ns, hasWrapperElement, mapping); mps.RelatedMaps = relatedMaps; @@ -187,13 +188,13 @@ namespace System.Xml.Serialization { if (type == typeof (object) && includedTypes != null) { foreach (Type intype in includedTypes) - map.DerivedTypes.Add (ImportTypeMapping (intype, defaultNamespace)); + map.DerivedTypes.Add (ImportTypeMapping (intype)); } // Register this map as a derived class of object if (typeData.Type != typeof(object)) - ImportTypeMapping (typeof(object), defaultNamespace).DerivedTypes.Add (map); + ImportTypeMapping (typeof(object)).DerivedTypes.Add (map); if (type.BaseType != null && type.BaseType != typeof(object)) map.BaseMap = ImportClassMapping (type.BaseType, defaultNamespace); @@ -229,21 +230,22 @@ namespace System.Xml.Serialization { XmlTypeMapping ImportListMapping (Type type, string defaultNamespace) { TypeData typeData = TypeTranslator.GetTypeData (type); - XmlTypeMapping map = helper.GetRegisteredClrType (type, XmlSerializer.EncodingNamespace); + XmlTypeMapping map = helper.GetRegisteredClrType (type, EncodingNamespace); if (map != null) return map; ListMap obmap = new ListMap (); - TypeData itemTypeData = typeData.ListItemTypeData; - map = CreateTypeMapping (typeData, "Array", XmlSerializer.EncodingNamespace); - helper.RegisterClrType (map, type, XmlSerializer.EncodingNamespace); + map = CreateTypeMapping (typeData, "Array", EncodingNamespace); + helper.RegisterClrType (map, type, EncodingNamespace); map.MultiReferenceType = true; map.ObjectMap = obmap; + Type itemType = typeData.ListItemType; + TypeData itemTypeData = TypeTranslator.GetTypeData (itemType); XmlTypeMapElementInfo elem = new XmlTypeMapElementInfo (null, itemTypeData); if (elem.TypeData.IsComplexType) { - elem.MappedType = ImportTypeMapping (typeData.ListItemType, defaultNamespace); + elem.MappedType = ImportTypeMapping (itemType); elem.TypeData = elem.MappedType.TypeData; } @@ -255,7 +257,7 @@ namespace System.Xml.Serialization { list.Add (elem); obmap.ItemInfo = list; - ImportTypeMapping (typeof(object), defaultNamespace).DerivedTypes.Add (map); + ImportTypeMapping (typeof(object)).DerivedTypes.Add (map); return map; } @@ -292,7 +294,7 @@ namespace System.Xml.Serialization { bool isFlags = type.GetCustomAttributes (typeof(FlagsAttribute),false).Length > 0; map.ObjectMap = new EnumMap (members, isFlags); - ImportTypeMapping (typeof(object), defaultNamespace).DerivedTypes.Add (map); + ImportTypeMapping (typeof(object)).DerivedTypes.Add (map); return map; } @@ -343,7 +345,7 @@ namespace System.Xml.Serialization { mapAttribute.Namespace = (atts.SoapAttribute.Namespace != null) ? atts.SoapAttribute.Namespace : ""; if (typeData.IsComplexType) - mapAttribute.MappedType = ImportTypeMapping (typeData.Type, defaultNamespace); + mapAttribute.MappedType = ImportTypeMapping (typeData.Type); typeData = TypeTranslator.GetTypeData (rmember.MemberType, atts.SoapAttribute.DataType); mapMember = mapAttribute; @@ -364,7 +366,7 @@ namespace System.Xml.Serialization { elem.Namespace = string.Empty; elem.IsNullable = (atts.SoapElement != null) ? atts.SoapElement.IsNullable : false; if (typeData.IsComplexType) - elem.MappedType = ImportTypeMapping (typeData.Type, defaultNamespace); + elem.MappedType = ImportTypeMapping (typeData.Type); infoList.Add (elem); ((XmlTypeMapMemberElement)mapMember).ElementInfo = infoList; diff --git a/mcs/class/System.XML/System.Xml.Serialization/SoapSchemaExporter.cs b/mcs/class/System.XML/System.Xml.Serialization/SoapSchemaExporter.cs index 6c1c8a5ddd2..f11cbe45d47 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/SoapSchemaExporter.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/SoapSchemaExporter.cs @@ -3,7 +3,6 @@ // // Authors: // Gonzalo Paniagua Javier (gonzalo@ximian.com) -// Lluis Sanchez Gual (lluis@ximian.com) // // (c) 2002 Ximian, Inc. (http://www.ximian.com) // @@ -14,16 +13,16 @@ namespace System.Xml.Serialization { public class SoapSchemaExporter { - XmlSchemaExporter _exporter; - + [MonoTODO] public SoapSchemaExporter (XmlSchemas schemas) { - _exporter = new XmlSchemaExporter(schemas, true); + throw new NotImplementedException (); } + [MonoTODO] public void ExportMembersMapping (XmlMembersMapping xmlMembersMapping) { - _exporter.ExportMembersMapping (xmlMembersMapping); + throw new NotImplementedException (); } [MonoTODO] @@ -33,9 +32,11 @@ namespace System.Xml.Serialization throw new NotImplementedException (); } + [MonoTODO] public void ExportTypeMapping (XmlTypeMapping xmlTypeMapping) { - _exporter.ExportTypeMapping (xmlTypeMapping); + throw new NotImplementedException (); } } } + diff --git a/mcs/class/System.XML/System.Xml.Serialization/SoapSchemaImporter.cs b/mcs/class/System.XML/System.Xml.Serialization/SoapSchemaImporter.cs index d3b4dafa992..baafb07716d 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/SoapSchemaImporter.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/SoapSchemaImporter.cs @@ -14,7 +14,8 @@ namespace System.Xml.Serialization { #region Fields
- XmlSchemaImporter _importer;
+ XmlSchemas schemas;
+ CodeIdentifiers typeIdentifiers;
#endregion
@@ -22,14 +23,13 @@ namespace System.Xml.Serialization { public SoapSchemaImporter (XmlSchemas schemas)
{
- _importer = new XmlSchemaImporter (schemas);
- _importer.UseEncodedFormat = true;
+ this.schemas = schemas;
}
public SoapSchemaImporter (XmlSchemas schemas, CodeIdentifiers typeIdentifiers)
+ : this (schemas)
{
- _importer = new XmlSchemaImporter (schemas, typeIdentifiers);
- _importer.UseEncodedFormat = true;
+ this.typeIdentifiers = typeIdentifiers;
}
#endregion // Constructors
@@ -68,4 +68,4 @@ namespace System.Xml.Serialization { #endregion // Methods
}
-} +}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/TypeTranslator.cs b/mcs/class/System.XML/System.Xml.Serialization/TypeTranslator.cs index e494081a1a9..3cedcfc4500 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/TypeTranslator.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/TypeTranslator.cs @@ -150,25 +150,6 @@ namespace System.Xml.Serialization { return "ArrayOf" + Char.ToUpper (elemName [0]) + elemName.Substring (1); } - - public static string GetArrayName (string elemName, int dimensions) - { - string aname = GetArrayName (elemName); - for ( ; dimensions > 1; dimensions--) - aname = "ArrayOf" + aname; - return aname; - } - - public static void ParseArrayType (string arrayType, out string type, out string ns, out string dimensions) - { - int i = arrayType.LastIndexOf (":"); - if (i == -1) ns = ""; - else ns = arrayType.Substring (0,i); - - int j = arrayType.IndexOf ("[", i+1); - if (j == -1) throw new InvalidOperationException ("Cannot parse WSDL array type: " + arrayType); - type = arrayType.Substring (i+1, j-i-1); - dimensions = arrayType.Substring (j); - } } } + diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlCodeExporter.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlCodeExporter.cs index 45c2ccb4f70..bfc9837d85d 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/XmlCodeExporter.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/XmlCodeExporter.cs @@ -135,18 +135,12 @@ namespace System.Xml.Serialization { ExportMapCode (map.BaseMap, false);
}
- ExportDerivedTypes (map, codeClass);
- }
-
- void ExportDerivedTypes (XmlTypeMapping map, CodeTypeDeclaration codeClass)
- {
foreach (XmlTypeMapping tm in map.DerivedTypes)
{
CodeAttributeDeclaration iatt = new CodeAttributeDeclaration ("System.Xml.Serialization.XmlInclude");
iatt.Arguments.Add (new CodeAttributeArgument (new CodeTypeOfExpression(tm.TypeData.FullTypeName)));
AddCustomAttribute (codeClass, iatt, true);
ExportMapCode (tm, false);
- ExportDerivedTypes (tm, codeClass);
}
}
@@ -453,4 +447,4 @@ namespace System.Xml.Serialization { #endregion // Methods
}
-} +}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlCustomFormatter.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlCustomFormatter.cs index 096a7501a94..dbf04d5d913 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/XmlCustomFormatter.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/XmlCustomFormatter.cs @@ -207,59 +207,6 @@ namespace System.Xml.Serialization { } } - internal static string GenerateToXmlString (TypeData type, string value) - { - switch (type.XmlType) - { - case "boolean": return "(" + value + "?\"true\":\"false\")"; - case "unsignedByte": return value + ".ToString()"; - case "char": return value + ".ToString()"; - case "dateTime": return value + ".ToString(\"yyyy-MM-ddTHH:mm:ss.fffffffzzz\", CultureInfo.InvariantCulture)"; - case "date": return value + ".ToString(\"yyyy-MM-dd\", CultureInfo.InvariantCulture)"; - case "time": return value + ".ToString(\"HH:mm:ss.fffffffzzz\", CultureInfo.InvariantCulture"; - case "decimal": return "XmlConvert.ToString (" + value + ")"; - case "double": return "XmlConvert.ToString (" + value + ")"; - case "short": return value + ".ToString()"; - case "int": return value + ".ToString()"; - case "long": return value + ".ToString()"; - case "byte": return value + ".ToString()"; - case "float": return "XmlConvert.ToString (" + value + ")"; - case "unsignedShort": return value + ".ToString()"; - case "unsignedInt": return value + ".ToString()"; - case "unsignedLong": return value + ".ToString()"; - case "guid": return "XmlConvert.ToString (" + value + ")"; - case "base64Binary": return "Convert.ToBase64String (" + value + ")"; - case "string": return value; - default: return value + ".ToString()"; - } - } - - internal static string GenerateFromXmlString (TypeData type, string value) - { - switch (type.XmlType) - { - case "boolean": return "XmlConvert.ToBoolean (" + value + ")"; - case "unsignedByte": return "SByte.Parse(" + value + ")"; - case "char": return "(char)Int32.Parse (" + value + ")"; - case "dateTime": return "XmlConvert.ToDateTime (" + value + ")"; - case "date": return "DateTime.ParseExact (" + value + ", \"yyyy-MM-dd\", null)"; - case "time": return "DateTime.ParseExact (" + value + ", \"HH:mm:ss.fffffffzzz\", null)"; - case "decimal": return "Decimal.Parse (" + value + ")"; - case "double": return "XmlConvert.ToDouble (" + value + ")"; - case "short": return "Int16.Parse (" + value + ")"; - case "int": return "Int32.Parse (" + value + ")"; - case "long": return "Int64.Parse (" + value + ")"; - case "byte": return "SByte.Parse (" + value + ")"; - case "float": return "XmlConvert.ToSingle (" + value + ")"; - case "unsignedShort": return "UInt16.Parse (" + value + ")"; - case "unsignedInt": return "UInt32.Parse (" + value + ")"; - case "unsignedLong": return "UInt64.Parse (" + value + ")"; - case "guid": return "XmlConvert.ToGuid (" + value + ")"; - case "base64Binary": return "Convert.FromBase64String (" + value + ")"; - default: return value; - } - } - #endregion // Methods } } diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlMemberMapping.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlMemberMapping.cs index ed04825d566..c49a019be17 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/XmlMemberMapping.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/XmlMemberMapping.cs @@ -18,10 +18,10 @@ namespace System.Xml.Serialization string _namespace; string _typeNamespace; - internal XmlMemberMapping (string memberName, XmlTypeMapMember mapMem) + internal XmlMemberMapping (XmlReflectionMember rmember, XmlTypeMapMember mapMem) { _mapMember = mapMem; - _memberName = memberName; + _memberName = rmember.MemberName; if (mapMem is XmlTypeMapMemberElement) { @@ -29,19 +29,22 @@ namespace System.Xml.Serialization _elementName = info.ElementName; _namespace = info.Namespace; if (info.MappedType != null) _typeNamespace = info.MappedType.Namespace; - else _typeNamespace = ""; + else _namespace = ""; } else { _elementName = _memberName; _namespace = ""; } + + if (_typeNamespace == null) _typeNamespace = _namespace; } #region Properties - public bool Any { - get { return _mapMember is XmlTypeMapMemberAnyElement; } + public bool Any { + [MonoTODO] + get { return false; } } public string ElementName { diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlMembersMapping.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlMembersMapping.cs index 478bc938aea..44440f7ae53 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/XmlMembersMapping.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/XmlMembersMapping.cs @@ -22,14 +22,6 @@ namespace System.Xml.Serialization { { } - internal XmlMembersMapping (XmlMemberMapping[] mapping): this ("", null, false, mapping) - { - } - - internal XmlMembersMapping (string elementName, string ns, XmlMemberMapping[] mapping): this (elementName, ns, true, mapping) - { - } - internal XmlMembersMapping (string elementName, string ns, bool hasWrapperElement, XmlMemberMapping[] mapping) { _elementName = elementName; diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs index a5dd9bc8aca..ce6a7750881 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs @@ -21,7 +21,6 @@ namespace System.Xml.Serialization { ArrayList includedTypes; ReflectionHelper helper = new ReflectionHelper(); int arrayChoiceCount = 1; - ArrayList relatedMaps = new ArrayList (); static readonly string errSimple = "Cannot serialize object of type '{0}'. Base " + "type '{1}' has simpleContent and can be only extended by adding XmlAttribute " + @@ -77,10 +76,9 @@ namespace System.Xml.Serialization { for (int n=0; n<members.Length; n++) { XmlTypeMapMember mapMem = CreateMapMember (members[n], ns); - mapping[n] = new XmlMemberMapping (members[n].MemberName, mapMem); + mapping[n] = new XmlMemberMapping (members[n], mapMem); } XmlMembersMapping mps = new XmlMembersMapping (elementName, ns, hasWrapperElement, mapping); - mps.RelatedMaps = relatedMaps; mps.Format = SerializationFormat.Literal; return mps; } @@ -124,7 +122,6 @@ namespace System.Xml.Serialization { default: throw new NotSupportedException ("Type " + type.FullName + " not supported for XML stialization"); } - map.RelatedMaps = relatedMaps; map.Format = SerializationFormat.Literal; return map; } @@ -173,7 +170,6 @@ namespace System.Xml.Serialization { if (membersNamespace == null) membersNamespace = ""; XmlTypeMapping map = new XmlTypeMapping (elementName, membersNamespace, typeData, defaultXmlType, defaultNamespace); - relatedMaps.Add (map); return map; } diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaExporter.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaExporter.cs index 5f05894f681..50a9555da4f 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaExporter.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaExporter.cs @@ -19,8 +19,6 @@ namespace System.Xml.Serialization { XmlSchemas schemas; Hashtable exportedMaps = new Hashtable(); - bool encodedFormat = false; - XmlDocument xmlDoc; #endregion @@ -31,12 +29,6 @@ namespace System.Xml.Serialization { this.schemas = schemas; } - internal XmlSchemaExporter (XmlSchemas schemas, bool encodedFormat) - { - this.encodedFormat = encodedFormat; - this.schemas = schemas; - } - #endregion // Constructors #region Methods @@ -50,41 +42,21 @@ namespace System.Xml.Serialization { public void ExportMembersMapping (XmlMembersMapping xmlMembersMapping) { XmlSchema schema = GetSchema (xmlMembersMapping.Namespace); - ClassMap cmap = (ClassMap) xmlMembersMapping.ObjectMap; - if (xmlMembersMapping.HasWrapperElement) - { - XmlSchemaElement selem = new XmlSchemaElement (); - selem.Name = xmlMembersMapping.ElementName; - schema.Items.Add (selem); - - XmlSchemaComplexType stype = new XmlSchemaComplexType (); - - XmlSchemaSequence particle; - XmlSchemaAnyAttribute anyAttribute; - ExportMembersMapSchema (schema, cmap, null, stype.Attributes, out particle, out anyAttribute); - stype.Particle = particle; - stype.AnyAttribute = anyAttribute; - - selem.SchemaType = stype; - } - else - { - ICollection members = cmap.ElementMembers; - if (members != null) - { - foreach (XmlTypeMapMemberElement member in members) - { - Type memType = member.GetType(); - if (member is XmlTypeMapMemberFlatList) - throw new InvalidOperationException ("Unwrapped arrays not supported as parameters"); - else if (memType == typeof(XmlTypeMapMemberElement)) - AddSchemaElement (schema.Items, schema, (XmlTypeMapElementInfo) member.ElementInfo [0], member.DefaultValue, false); - else - AddSchemaElement (schema.Items, schema, (XmlTypeMapElementInfo) member.ElementInfo [0], false); - } - } - } + XmlSchemaElement selem = new XmlSchemaElement (); + selem.Name = xmlMembersMapping.ElementName; + schema.Items.Add (selem); + + XmlSchemaComplexType stype = new XmlSchemaComplexType (); + + XmlSchemaSequence particle; + XmlSchemaAnyAttribute anyAttribute; + ExportMembersMapSchema (schema, (ClassMap)xmlMembersMapping.ObjectMap, null, stype.Attributes, out particle, out anyAttribute); + stype.Particle = particle; + stype.AnyAttribute = anyAttribute; + + selem.SchemaType = stype; + CompileSchemas (); } @@ -96,18 +68,13 @@ namespace System.Xml.Serialization { public void ExportTypeMapping (XmlTypeMapping xmlTypeMapping) { - if (encodedFormat) - ExportClassSchema (xmlTypeMapping); - else - { - XmlSchema schema = GetSchema (xmlTypeMapping.Namespace); - XmlTypeMapElementInfo einfo = new XmlTypeMapElementInfo (null, xmlTypeMapping.TypeData); - einfo.Namespace = xmlTypeMapping.Namespace; - einfo.ElementName = xmlTypeMapping.ElementName; - einfo.MappedType = xmlTypeMapping; - einfo.IsNullable = false; - AddSchemaElement (schema.Items, schema, einfo, false); - } + XmlSchema schema = GetSchema (xmlTypeMapping.Namespace); + XmlTypeMapElementInfo einfo = new XmlTypeMapElementInfo (null, xmlTypeMapping.TypeData); + einfo.Namespace = xmlTypeMapping.Namespace; + einfo.ElementName = xmlTypeMapping.ElementName; + einfo.MappedType = xmlTypeMapping; + einfo.IsNullable = false; + AddSchemaElement (schema.Items, schema, einfo, false); CompileSchemas (); } @@ -187,6 +154,10 @@ namespace System.Xml.Serialization { { AddSchemaArrayElement (seq.Items, schema, member.ElementInfo); } + else if (memType == typeof(XmlTypeMapMemberAnyAttribute)) + { + // Ignore + } else if (memType == typeof(XmlTypeMapMemberElement)) { XmlSchemaElement selem = (XmlSchemaElement) AddSchemaElement (seq.Items, schema, (XmlTypeMapElementInfo) member.ElementInfo [0], member.DefaultValue, true); @@ -227,7 +198,7 @@ namespace System.Xml.Serialization { ImportNamespace (currentSchema, attinfo.Namespace); XmlSchema memberSchema = GetSchema (attinfo.Namespace); - if (currentSchema == memberSchema || encodedFormat) + if (currentSchema == memberSchema) { sat.Name = attinfo.AttributeName; if (attinfo.TypeData.SchemaType == SchemaTypes.Enum) @@ -276,21 +247,15 @@ namespace System.Xml.Serialization { { selem.MaxOccurs = 1; selem.MinOccurs = einfo.IsNullable ? 1 : 0; - - if ((einfo.TypeData.Type.IsPrimitive && einfo.TypeData.Type != typeof(string)) || - einfo.TypeData.Type.IsEnum || encodedFormat) + if (einfo.TypeData.Type.IsPrimitive && einfo.TypeData.Type != typeof(string) || + einfo.TypeData.Type.IsEnum) selem.MinOccurs = 1; } - XmlSchema memberSchema = null; - - if (!encodedFormat) - { - memberSchema = GetSchema (einfo.Namespace); - ImportNamespace (currentSchema, einfo.Namespace); - } + XmlSchema memberSchema = GetSchema (einfo.Namespace); + ImportNamespace (currentSchema, einfo.Namespace); - if (currentSchema == memberSchema || encodedFormat) + if (currentSchema == memberSchema) { if (isTypeMember) selem.IsNillable = einfo.IsNullable; selem.Name = einfo.ElementName; @@ -316,19 +281,17 @@ namespace System.Xml.Serialization { break; case SchemaTypes.Array: - XmlQualifiedName atypeName = ExportArraySchema (einfo.MappedType, currentSchema.TargetNamespace); - selem.SchemaTypeName = atypeName; - ImportNamespace (currentSchema, atypeName.Namespace); + selem.SchemaTypeName = new XmlQualifiedName (einfo.MappedType.XmlType, einfo.MappedType.XmlTypeNamespace);; + ImportNamespace (currentSchema, einfo.MappedType.XmlTypeNamespace); + ExportArraySchema (einfo.MappedType); break; case SchemaTypes.Class: if (einfo.MappedType.TypeData.Type != typeof(object)) { - selem.SchemaTypeName = new XmlQualifiedName (einfo.MappedType.XmlType, einfo.MappedType.XmlTypeNamespace); + selem.SchemaTypeName = new XmlQualifiedName (einfo.MappedType.XmlType, einfo.MappedType.XmlTypeNamespace);; ImportNamespace (currentSchema, einfo.MappedType.XmlTypeNamespace); ExportClassSchema (einfo.MappedType); } - else if (encodedFormat) - selem.SchemaTypeName = new XmlQualifiedName (einfo.MappedType.XmlType, einfo.MappedType.XmlTypeNamespace); break; case SchemaTypes.Primitive: @@ -346,7 +309,7 @@ namespace System.Xml.Serialization { void ImportNamespace (XmlSchema schema, string ns) { - if (ns == "" || ns == schema.TargetNamespace || ns == XmlSchema.Namespace) return; + if (ns == "" || ns == schema.TargetNamespace) return; foreach (XmlSchemaObject sob in schema.Includes) if ((sob is XmlSchemaImport) && ((XmlSchemaImport)sob).Namespace == ns) return; @@ -449,70 +412,23 @@ namespace System.Xml.Serialization { stype.Content = rest; } - XmlQualifiedName ExportArraySchema (XmlTypeMapping map, string defaultNamespace) + void ExportArraySchema (XmlTypeMapping map) { - ListMap lmap = (ListMap) map.ObjectMap; + if (IsMapExported (map)) return; + SetMapExported (map); - if (encodedFormat) - { - string name, ns, schemaNs; - lmap.GetArrayType (-1, out name, out ns); - if (ns == XmlSchema.Namespace) schemaNs = defaultNamespace; - else schemaNs = ns; - - if (IsMapExported (map)) return new XmlQualifiedName (lmap.GetSchemaArrayName (), schemaNs); - SetMapExported (map); - - XmlSchema schema = GetSchema (schemaNs); - XmlSchemaComplexType stype = new XmlSchemaComplexType (); - stype.Name = lmap.GetSchemaArrayName (); - schema.Items.Add (stype); - - XmlSchemaComplexContent content = new XmlSchemaComplexContent(); - content.IsMixed = false; - stype.ContentModel = content; - - XmlSchemaComplexContentRestriction rest = new XmlSchemaComplexContentRestriction (); - content.Content = rest; - rest.BaseTypeName = new XmlQualifiedName ("Array", XmlSerializer.EncodingNamespace); - XmlSchemaAttribute at = new XmlSchemaAttribute (); - rest.Attributes.Add (at); - at.RefName = new XmlQualifiedName ("arrayType", XmlSerializer.EncodingNamespace); - - XmlAttribute arrayType = Document.CreateAttribute ("arrayType", XmlSerializer.WsdlNamespace); - arrayType.Value = ns + (ns != "" ? ":" : "") + name; - at.UnhandledAttributes = new XmlAttribute [] { arrayType }; - - return new XmlQualifiedName (lmap.GetSchemaArrayName (), schemaNs); - } + XmlSchema schema = GetSchema (map.Namespace); + XmlSchemaComplexType stype = new XmlSchemaComplexType (); + stype.Name = map.ElementName; + schema.Items.Add (stype); + + ListMap lmap = (ListMap) map.ObjectMap; + XmlSchemaSequence seq = new XmlSchemaSequence (); + XmlSchemaParticle spart = AddSchemaArrayElement (seq.Items, schema, lmap.ItemInfo); + if (spart is XmlSchemaChoice) + stype.Particle = spart; else - { - if (IsMapExported (map)) return new XmlQualifiedName (map.XmlType, map.XmlTypeNamespace); - - SetMapExported (map); - XmlSchema schema = GetSchema (map.Namespace); - XmlSchemaComplexType stype = new XmlSchemaComplexType (); - stype.Name = map.ElementName; - schema.Items.Add (stype); - - XmlSchemaSequence seq = new XmlSchemaSequence (); - XmlSchemaParticle spart = AddSchemaArrayElement (seq.Items, schema, lmap.ItemInfo); - if (spart is XmlSchemaChoice) - stype.Particle = spart; - else - stype.Particle = seq; - - return new XmlQualifiedName (map.XmlType, map.XmlTypeNamespace); - } - } - - XmlDocument Document - { - get - { - if (xmlDoc == null) xmlDoc = new XmlDocument (); - return xmlDoc; - } + stype.Particle = seq; } bool IsMapExported (XmlTypeMapping map) @@ -540,8 +456,7 @@ namespace System.Xml.Serialization { { schema = new XmlSchema (); schema.TargetNamespace = ns; - if (!encodedFormat) - schema.ElementFormDefault = XmlSchemaForm.Qualified; + schema.ElementFormDefault = XmlSchemaForm.Qualified; schemas.Add (schema); } return schema; diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs index d3d29b18706..42992ba13f9 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs @@ -24,12 +24,8 @@ namespace System.Xml.Serialization { Hashtable dataMappedTypes = new Hashtable ();
Queue pendingMaps = new Queue ();
Hashtable sharedAnonymousTypes = new Hashtable ();
- bool encodedFormat = false;
static readonly XmlQualifiedName anyType = new XmlQualifiedName ("anyType",XmlSchema.Namespace);
- static readonly XmlQualifiedName arrayType = new XmlQualifiedName ("Array",XmlSerializer.EncodingNamespace);
- static readonly XmlQualifiedName arrayTypeAttribute = new XmlQualifiedName ("arrayType",XmlSerializer.WsdlNamespace);
-
XmlSchemaElement anyElement = null;
class MapFixup
@@ -54,12 +50,6 @@ namespace System.Xml.Serialization { {
this.typeIdentifiers = typeIdentifiers;
}
-
- internal bool UseEncodedFormat
- {
- get { return encodedFormat; }
- set { encodedFormat = value; }
- }
#endregion // Constructors
@@ -91,68 +81,16 @@ namespace System.Xml.Serialization { throw new NotImplementedException ();
}
+ [MonoTODO]
public XmlMembersMapping ImportMembersMapping (XmlQualifiedName name)
{
- ClassMap cmap = new ClassMap ();
- XmlSchemaElement elem = (XmlSchemaElement) schemas.Find (name, typeof (XmlSchemaElement));
- if (elem == null) throw new InvalidOperationException ("Schema element '" + name + "' not found or not valid");
-
- XmlSchemaComplexType stype;
- if (elem.SchemaType != null)
- {
- stype = elem.SchemaType as XmlSchemaComplexType;
- }
- else
- {
- if (elem.SchemaTypeName.IsEmpty) return null;
- if (elem.SchemaTypeName.Namespace == XmlSchema.Namespace) return null;
- object type = schemas.Find (elem.SchemaTypeName, typeof (XmlSchemaComplexType));
- if (type == null) throw new InvalidOperationException ("Schema type '" + elem.SchemaTypeName + "' not found");
- stype = type as XmlSchemaComplexType;
- }
-
- if (stype == null)
- throw new InvalidOperationException ("Schema element '" + name + "' not found or not valid");
-
- if (stype.Particle == null)
- return new XmlMembersMapping (name.Name, name.Namespace, true, new XmlMemberMapping [0]);
-
- XmlSchemaSequence seq = stype.Particle as XmlSchemaSequence;
- if (seq == null) throw new InvalidOperationException ("Schema element '" + name + "' cannot be imported as XmlMembersMapping");
-
- CodeIdentifiers classIds = new CodeIdentifiers ();
- ImportParticleComplexContent (name, cmap, seq, classIds, false);
-
- BuildPendingMaps ();
-
- int n = 0;
- XmlMemberMapping[] mapping = new XmlMemberMapping [cmap.AllMembers.Count];
- foreach (XmlTypeMapMember mapMem in cmap.AllMembers)
- mapping[n++] = new XmlMemberMapping (mapMem.Name, mapMem);
-
- return new XmlMembersMapping (name.Name, name.Namespace, mapping);
+ throw new NotImplementedException ();
}
+ [MonoTODO]
public XmlMembersMapping ImportMembersMapping (XmlQualifiedName[] names)
{
- XmlMemberMapping[] mapping = new XmlMemberMapping [names.Length];
- for (int n=0; n<names.Length; n++)
- {
- XmlSchemaElement elem = (XmlSchemaElement) schemas.Find (names[n], typeof (XmlSchemaElement));
- if (elem == null) throw new InvalidOperationException ("Schema element '" + names[n] + "' not found");
-
- XmlQualifiedName typeQName = new XmlQualifiedName ("Message", names[n].Namespace);
- TypeData td = GetElementTypeData (typeQName, elem);
-
- XmlTypeMapMemberElement mapMem = new XmlTypeMapMemberElement ();
- mapMem.Name = elem.Name;
- mapMem.TypeData = td;
- mapMem.ElementInfo.Add (CreateElementInfo (typeQName.Namespace, mapMem, elem.Name, td, true));
-
- mapping[n] = new XmlMemberMapping (mapMem.Name, mapMem);
- }
- BuildPendingMaps ();
- return new XmlMembersMapping (mapping);
+ throw new NotImplementedException ();
}
[MonoTODO]
@@ -203,14 +141,6 @@ namespace System.Xml.Serialization { XmlSchemaType type = (XmlSchemaType) schemas.Find (name, typeof (XmlSchemaComplexType));
if (type == null) type = (XmlSchemaType) schemas.Find (name, typeof (XmlSchemaSimpleType));
-
- if (type == null)
- {
- if (name.Namespace == XmlSerializer.EncodingNamespace)
- throw new InvalidOperationException ("Referenced type '" + name + "' valid only for encoded SOAP");
- else
- throw new InvalidOperationException ("Referenced type '" + name + "' not found");
- }
return ImportType (name, type, root);
}
@@ -328,9 +258,8 @@ namespace System.Xml.Serialization { }
ImportAttributes (typeQName, cmap, stype.Attributes, stype.AnyAttribute, classIds);
- ImportExtensionTypes (typeQName);
}
-
+
void ImportAttributes (XmlQualifiedName typeQName, ClassMap cmap, XmlSchemaObjectCollection atts, XmlSchemaAnyAttribute anyat, CodeIdentifiers classIds)
{
if (anyat != null)
@@ -371,95 +300,21 @@ namespace System.Xml.Serialization { ListMap BuildArrayMap (XmlQualifiedName typeQName, XmlSchemaComplexType stype, out TypeData arrayTypeData)
{
- if (encodedFormat)
- {
- XmlSchemaComplexContent content = stype.ContentModel as XmlSchemaComplexContent;
- XmlSchemaComplexContentRestriction rest = content.Content as XmlSchemaComplexContentRestriction;
- XmlSchemaAttribute arrayTypeAt = FindArrayAttribute (rest.Attributes);
-
- XmlAttribute[] uatts = arrayTypeAt.UnhandledAttributes;
- if (uatts == null || uatts.Length == 0) throw new InvalidOperationException ("arrayType attribute not specified in array declaration: " + typeQName);
-
- XmlAttribute xat = null;
- foreach (XmlAttribute at in uatts)
- if (at.LocalName == "arrayType" && at.NamespaceURI == XmlSerializer.WsdlNamespace)
- { xat = at; break; }
-
- if (xat == null)
- throw new InvalidOperationException ("arrayType attribute not specified in array declaration: " + typeQName);
+ ClassMap cmap = new ClassMap ();
+ CodeIdentifiers classIds = new CodeIdentifiers();
+ ImportParticleComplexContent (typeQName, cmap, stype.Particle, classIds, false);
- string name, ns, dims;
- TypeTranslator.ParseArrayType (xat.Value, out name, out ns, out dims);
-
- return BuildEncodedArrayMap (name + dims, ns, out arrayTypeData);
- }
- else
+ XmlTypeMapMemberFlatList list = (cmap.AllMembers.Count == 1) ? cmap.AllMembers[0] as XmlTypeMapMemberFlatList : null;
+ if (list != null && list.ChoiceMember == null)
{
- ClassMap cmap = new ClassMap ();
- CodeIdentifiers classIds = new CodeIdentifiers();
- ImportParticleComplexContent (typeQName, cmap, stype.Particle, classIds, false);
-
- XmlTypeMapMemberFlatList list = (cmap.AllMembers.Count == 1) ? cmap.AllMembers[0] as XmlTypeMapMemberFlatList : null;
- if (list != null && list.ChoiceMember == null)
- {
- arrayTypeData = list.TypeData;
- return list.ListMap;
- }
- else
- {
- arrayTypeData = null;
- return null;
- }
- }
- }
-
- ListMap BuildEncodedArrayMap (string type, string ns, out TypeData arrayTypeData)
- {
- ListMap map = new ListMap ();
-
- int i = type.LastIndexOf ("[");
- if (i == -1) throw new InvalidOperationException ("Invalid arrayType value: " + type);
- if (type.IndexOf (",",i) != -1) throw new InvalidOperationException ("Multidimensional arrays are not supported");
-
- string itemType = type.Substring (0,i);
-
- TypeData itemTypeData;
- if (itemType.IndexOf ("[") != -1)
- {
- ListMap innerListMap = BuildEncodedArrayMap (itemType, ns, out itemTypeData);
-
- int dims = itemType.Split ('[').Length - 1;
- string name = TypeTranslator.GetArrayName (type, dims);
- XmlQualifiedName qname = new XmlQualifiedName (name, ns);
- XmlTypeMapping tmap = CreateArrayTypeMapping (qname, itemTypeData);
- tmap.ObjectMap = innerListMap;
+ arrayTypeData = list.TypeData;
+ return list.ListMap;
}
else
{
- itemTypeData = GetTypeData (new XmlQualifiedName (itemType, ns), null);
- }
-
- arrayTypeData = itemTypeData.ListTypeData;
- map.ItemInfo.Add (CreateElementInfo ("", null, "Item", itemTypeData, true));
- return map;
- }
-
- XmlSchemaAttribute FindArrayAttribute (XmlSchemaObjectCollection atts)
- {
- foreach (object ob in atts)
- {
- XmlSchemaAttribute att = ob as XmlSchemaAttribute;
- if (att != null && att.RefName == arrayTypeAttribute) return att;
-
- XmlSchemaAttributeGroupRef gref = ob as XmlSchemaAttributeGroupRef;
- if (gref != null)
- {
- XmlSchemaAttributeGroup grp = (XmlSchemaAttributeGroup) schemas.Find (gref.RefName, typeof(XmlSchemaAttributeGroup));
- att = FindArrayAttribute (grp.Attributes);
- if (att != null) return att;
- }
+ arrayTypeData = null;
+ return null;
}
- return null;
}
void ImportParticleComplexContent (XmlQualifiedName typeQName, ClassMap cmap, XmlSchemaParticle particle, CodeIdentifiers classIds, bool isMixed)
@@ -801,10 +656,11 @@ namespace System.Xml.Serialization { void ImportComplexContent (XmlQualifiedName typeQName, XmlTypeMapping map, XmlSchemaComplexContent content, CodeIdentifiers classIds, bool isMixed)
{
+ XmlSchemaComplexContentExtension ext = content.Content as XmlSchemaComplexContentExtension;
+
ClassMap cmap = (ClassMap)map.ObjectMap;
XmlQualifiedName qname;
- XmlSchemaComplexContentExtension ext = content.Content as XmlSchemaComplexContentExtension;
if (ext != null) qname = ext.BaseTypeName;
else qname = ((XmlSchemaComplexContentRestriction)content.Content).BaseTypeName;
@@ -825,8 +681,7 @@ namespace System.Xml.Serialization { if (ext != null) {
// Add the members of this map
- if (ext.Particle != null)
- ImportParticleComplexContent (typeQName, cmap, ext.Particle, classIds, isMixed);
+ ImportParticleComplexContent (typeQName, cmap, ext.Particle, classIds, isMixed);
ImportAttributes (typeQName, cmap, ext.Attributes, ext.AnyAttribute, classIds);
}
@@ -834,24 +689,6 @@ namespace System.Xml.Serialization { if (isMixed) ImportParticleComplexContent (typeQName, cmap, null, classIds, true);
}
}
-
- void ImportExtensionTypes (XmlQualifiedName qname)
- {
- foreach (XmlSchema schema in schemas) {
- foreach (XmlSchemaObject sob in schema.Items)
- {
- XmlSchemaComplexType sct = sob as XmlSchemaComplexType;
- if (sct != null && sct.ContentModel is XmlSchemaComplexContent) {
- XmlQualifiedName exqname;
- XmlSchemaComplexContentExtension ext = sct.ContentModel.Content as XmlSchemaComplexContentExtension;
- if (ext != null) exqname = ext.BaseTypeName;
- else exqname = ((XmlSchemaComplexContentRestriction)sct.ContentModel.Content).BaseTypeName;
- if (exqname == qname)
- ImportType (new XmlQualifiedName (sct.Name, schema.TargetNamespace), sct, null);
- }
- }
- }
- }
XmlTypeMapping ImportClassSimpleType (XmlQualifiedName typeQName, XmlSchemaSimpleType stype, XmlQualifiedName root)
{
@@ -915,19 +752,8 @@ namespace System.Xml.Serialization { bool CanBeArray (XmlQualifiedName typeQName, XmlSchemaComplexType stype)
{
- if (encodedFormat)
- {
- XmlSchemaComplexContent content = stype.ContentModel as XmlSchemaComplexContent;
- if (content == null) return false;
- XmlSchemaComplexContentRestriction rest = content.Content as XmlSchemaComplexContentRestriction;
- if (rest == null) return false;
- return rest.BaseTypeName == arrayType;
- }
- else
- {
- if (stype.Attributes.Count > 0 || stype.AnyAttribute != null) return false;
- else return !stype.IsMixed && CanBeArray (typeQName, stype.Particle, false);
- }
+ if (stype.Attributes.Count > 0 || stype.AnyAttribute != null) return false;
+ else return !stype.IsMixed && CanBeArray (typeQName, stype.Particle, false);
}
bool CanBeArray (XmlQualifiedName typeQName, XmlSchemaParticle particle, bool multiValue)
@@ -1077,10 +903,7 @@ namespace System.Xml.Serialization { XmlTypeMapping CreateArrayTypeMapping (XmlQualifiedName typeQName, TypeData arrayTypeData)
{
- XmlTypeMapping map;
- if (encodedFormat) map = new XmlTypeMapping ("Array", XmlSerializer.EncodingNamespace, arrayTypeData, "Array", XmlSerializer.EncodingNamespace);
- else map = new XmlTypeMapping (arrayTypeData.XmlType, typeQName.Namespace, arrayTypeData, arrayTypeData.XmlType, typeQName.Namespace);
-
+ XmlTypeMapping map = new XmlTypeMapping (arrayTypeData.XmlType, typeQName.Namespace, arrayTypeData, arrayTypeData.XmlType, typeQName.Namespace);
mappedTypes [typeQName] = map;
dataMappedTypes [arrayTypeData] = map;
@@ -1258,4 +1081,4 @@ namespace System.Xml.Serialization { #endregion // Methods
}
-} +}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSchemas.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSchemas.cs index 729b99e68ec..4d03e0117d5 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/XmlSchemas.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSchemas.cs @@ -78,7 +78,7 @@ namespace System.Xml.Serialization { if (!schema.IsCompiled) {
try {
schema.Compile (null);
- } catch (Exception ex) {
+ } catch {
throw new InvalidOperationException ("Error compiling XmlSchema " +
name.Namespace);
}
@@ -99,9 +99,7 @@ namespace System.Xml.Serialization { else if (type == typeof (XmlSchemaNotation))
tbl = schema.Notations;
- object res = (tbl != null) ? tbl [name] : null;
- if (res != null && res.GetType () != type) return null;
- else return res;
+ return (tbl != null) ? tbl [name] : null;
}
public int IndexOf (XmlSchema schema)
@@ -151,4 +149,4 @@ namespace System.Xml.Serialization { #endregion // Methods
}
-} +}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReader.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReader.cs index 800fd1eddb9..a89a79d1bfc 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReader.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReader.cs @@ -51,15 +51,15 @@ namespace System.Xml.Serialization { internal void Initialize (XmlReader reader, XmlSerializer eventSource) { - w3SchemaNS = reader.NameTable.Add (XmlSchema.Namespace); + w3SchemaNS = reader.NameTable.Add ("http://www.w3.org/2001/XMLSchema"); w3SchemaNS2000 = reader.NameTable.Add ("http://www.w3.org/2000/10/XMLSchema"); w3SchemaNS1999 = reader.NameTable.Add ("http://www.w3.org/1999/XMLSchema"); - w3InstanceNS = reader.NameTable.Add (XmlSchema.InstanceNamespace); + w3InstanceNS = reader.NameTable.Add ("http://www.w3.org/2001/XMLSchema-instance"); w3InstanceNS2000 = reader.NameTable.Add ("http://www.w3.org/2000/10/XMLSchema-instance"); w3InstanceNS1999 = reader.NameTable.Add ("http://www.w3.org/1999/XMLSchema-instance"); - soapNS = reader.NameTable.Add (XmlSerializer.EncodingNamespace); + soapNS = reader.NameTable.Add ("http://schemas.xmlsoap.org/soap/encoding/"); schema = reader.NameTable.Add ("schema"); - wsdlNS = reader.NameTable.Add (XmlSerializer.WsdlNamespace); + wsdlNS = reader.NameTable.Add ("http://schemas.xmlsoap.org/wsdl/"); wsdlArrayType = reader.NameTable.Add ("arrayType"); nullX = reader.NameTable.Add ("null"); nil = reader.NameTable.Add ("nil"); @@ -68,10 +68,15 @@ namespace System.Xml.Serialization { anyType = reader.NameTable.Add ("anyType"); this.reader = reader; this.eventSource = eventSource; - arrayQName = new XmlQualifiedName ("Array", XmlSerializer.EncodingNamespace); + arrayQName = new XmlQualifiedName ("Array", soapNS); InitIDs (); } + internal virtual object ReadObject () + { + throw new NotImplementedException (); + } + private ArrayList EnsureArrayList (ArrayList list) { if (list == null) @@ -300,15 +305,10 @@ namespace System.Xml.Serialization { return name.StartsWith ("xmlns:"); } + [MonoTODO ("Implement")] protected void ParseWsdlArrayType (XmlAttribute attr) { - if (attr.NamespaceURI == XmlSerializer.WsdlNamespace && attr.LocalName == "arrayType") - { - string ns = "", type, dimensions; - TypeTranslator.ParseArrayType (attr.Value, out type, out ns, out dimensions); - if (ns != "") ns = Reader.LookupNamespace (ns) + ":"; - attr.Value = ns + type + dimensions; - } + throw new NotImplementedException (); } protected XmlQualifiedName ReadElementQualifiedName () @@ -445,7 +445,7 @@ namespace System.Xml.Serialization { bool ReadList (out object resultList) { - string arrayType = Reader.GetAttribute ("arrayType", XmlSerializer.WsdlNamespace); + string arrayType = Reader.GetAttribute ("arrayType", soapNS); XmlQualifiedName qn = ToXmlQualifiedName (arrayType); int i = qn.Name.LastIndexOf ('['); string dim = qn.Name.Substring (i); @@ -752,9 +752,8 @@ namespace System.Xml.Serialization { line_number = 0; line_position = 0; } - - if (eventSource != null) - eventSource.OnUnknownAttribute (new XmlAttributeEventArgs (attr, line_number, line_position, o)); + + eventSource.OnUnknownAttribute (new XmlAttributeEventArgs (attr, line_number, line_position, o)); } protected void UnknownElement (object o, XmlElement elem) @@ -768,9 +767,8 @@ namespace System.Xml.Serialization { line_number = 0; line_position = 0; } - - if (eventSource != null) - eventSource.OnUnknownElement (new XmlElementEventArgs (elem, line_number, line_position,o)); + + eventSource.OnUnknownElement (new XmlElementEventArgs (elem, line_number, line_position,o)); } protected void UnknownNode (object o) @@ -784,10 +782,8 @@ namespace System.Xml.Serialization { line_number = 0; line_position = 0; } - - if (eventSource != null) - eventSource.OnUnknownNode (new XmlNodeEventArgs(line_number, line_position, Reader.LocalName, Reader.Name, Reader.NamespaceURI, Reader.NodeType, o, Reader.Value)); - + + eventSource.OnUnknownNode (new XmlNodeEventArgs(line_number, line_position, Reader.LocalName, Reader.Name, Reader.NamespaceURI, Reader.NodeType, o, Reader.Value)); if (Reader.NodeType == XmlNodeType.Attribute) { XmlAttribute att = (XmlAttribute) ReadXmlNode (false); @@ -810,8 +806,7 @@ namespace System.Xml.Serialization { protected void UnreferencedObject (string id, object o) { - if (eventSource != null) - eventSource.OnUnreferencedObject (new UnreferencedObjectEventArgs (o,id)); + eventSource.OnUnreferencedObject (new UnreferencedObjectEventArgs (o,id)); } #endregion // Methods @@ -922,3 +917,4 @@ namespace System.Xml.Serialization { } } + diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs index f432e460eaf..6a5289878b1 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs @@ -13,7 +13,7 @@ using System.Collections; namespace System.Xml.Serialization { - internal class XmlSerializationReaderInterpreter: XmlSerializationReader + public class XmlSerializationReaderInterpreter: XmlSerializationReader { XmlMapping _typeMap; SerializationFormat _format; @@ -44,18 +44,7 @@ namespace System.Xml.Serialization { } - protected XmlTypeMapping GetTypeMap (Type type) - { - ArrayList maps = _typeMap.RelatedMaps; - if (maps != null) - { - foreach (XmlTypeMapping map in maps) - if (map.TypeData.Type == type) return map; - } - throw new InvalidOperationException ("Type " + type + " not mapped"); - } - - public object ReadObject () + internal override object ReadObject () { Reader.MoveToContent(); if (_typeMap is XmlTypeMapping) @@ -87,7 +76,7 @@ namespace System.Xml.Serialization return ob; } - protected virtual object ReadMessage (XmlMembersMapping typeMap) + object ReadMessage (XmlMembersMapping typeMap) { object[] parameters = new object[typeMap.Count]; @@ -118,7 +107,7 @@ namespace System.Xml.Serialization return parameters; } - protected virtual object ReadObject (XmlTypeMapping typeMap, bool isNullable, bool checkType) + object ReadObject (XmlTypeMapping typeMap, bool isNullable, bool checkType) { switch (typeMap.TypeData.SchemaType) { @@ -132,7 +121,7 @@ namespace System.Xml.Serialization } } - protected virtual object ReadClassInstance (XmlTypeMapping typeMap, bool isNullable, bool checkType) + object ReadClassInstance (XmlTypeMapping typeMap, bool isNullable, bool checkType) { if (isNullable && ReadNull()) return null; @@ -157,7 +146,7 @@ namespace System.Xml.Serialization Reader.MoveToElement(); bool isEmpty = Reader.IsEmptyElement; - ReadClassInstanceMembers (typeMap, ob); + ReadMembers ((ClassMap) typeMap.ObjectMap, ob, false); if (isEmpty) Reader.Skip(); else ReadEndElement(); @@ -165,11 +154,6 @@ namespace System.Xml.Serialization return ob; } - protected virtual void ReadClassInstanceMembers (XmlTypeMapping typeMap, object ob) - { - ReadMembers ((ClassMap) typeMap.ObjectMap, ob, false); - } - void ReadMembers (ClassMap map, object ob, bool isValueList) { // A value list cannot have attributes @@ -209,12 +193,10 @@ namespace System.Xml.Serialization } else if (anyAttrMember != null) { - XmlAttribute attr = (XmlAttribute) Document.ReadNode(Reader); - ParseWsdlArrayType (attr); - AddListValue (anyAttrMember.TypeData, ref anyAttributeArray, anyAttributeIndex++, attr, true); + AddListValue (anyAttrMember.TypeData, ref anyAttributeArray, anyAttributeIndex++, Document.ReadNode(Reader), true); } else - ProcessUnknownAttribute(ob); + UnknownNode(ob); } if (anyAttrMember != null) @@ -232,7 +214,7 @@ namespace System.Xml.Serialization // Reads elements - bool[] readFlag = new bool[(map.ElementMembers != null) ? map.ElementMembers.Count : 0]; + bool[] readFlag = new bool[map.ElementMembers.Count]; Reader.MoveToContent(); @@ -325,7 +307,7 @@ namespace System.Xml.Serialization else SetMemberValue (mem, ob, ReadXmlNode (false), isValueList); } else - ProcessUnknownElement(ob); + UnknownNode(ob); } else if (Reader.NodeType == System.Xml.XmlNodeType.Text && map.XmlTextCollector != null) { @@ -375,16 +357,6 @@ namespace System.Xml.Serialization SetMemberValue (member, fixup.Source, GetTarget(ids[member.Index]), isValueList); } } - - protected virtual void ProcessUnknownAttribute (object target) - { - UnknownNode (target); - } - - protected virtual void ProcessUnknownElement (object target) - { - UnknownNode (target); - } bool IsReadOnly (XmlTypeMapMember member, object ob, bool isValueList) { diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriter.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriter.cs index b1af3e23f89..e32c623bbbe 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriter.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriter.cs @@ -39,17 +39,6 @@ namespace System.Xml.Serialization { { qnameCount = 0; } - - internal void Initialize (XmlWriter writer, XmlSerializerNamespaces nss) - { - this.writer = writer; - if (nss != null) - { - namespaces = new ArrayList (); - foreach (XmlQualifiedName ns in nss.ToArray()) - namespaces.Add (ns); - } - } #endregion // Constructors @@ -69,6 +58,16 @@ namespace System.Xml.Serialization { #region Methods + internal void Initialize (XmlWriter writer) + { + this.writer = writer; + } + + internal virtual void WriteObject (object ob) + { + throw new NotImplementedException (); + } + protected void AddWriteCallback (Type type, string typeName, string typeNs, XmlSerializationWriteCallback callback) { WriteCallbackInfo info = new WriteCallbackInfo (); @@ -685,12 +684,6 @@ namespace System.Xml.Serialization { WriteAttribute ("xmlns","xsd",xmlNamespace,XmlSchema.Namespace); if (Writer.LookupPrefix (XmlSchema.InstanceNamespace) == null) WriteAttribute ("xmlns","xsi",xmlNamespace,XmlSchema.InstanceNamespace); - - if (namespaces != null) - { - foreach (XmlQualifiedName qn in namespaces) - WriteAttribute ("xmlns",qn.Name,xmlNamespace,qn.Namespace); - } } topLevelElement = false; } @@ -735,25 +728,12 @@ namespace System.Xml.Serialization { WriteXmlAttribute (node, null); } + [MonoTODO ("Implement")] protected void WriteXmlAttribute (XmlNode node, object container) { - XmlAttribute attr = node as XmlAttribute; - if (attr == null) + if (!(node is XmlAttribute)) throw new InvalidOperationException ("The node must be either type XmlAttribute or a derived type."); - - if (attr.NamespaceURI == XmlSerializer.WsdlNamespace) - { - // The wsdl arrayType attribute needs special handling - if (attr.LocalName == "arrayType") { - string ns, type, dimensions; - TypeTranslator.ParseArrayType (attr.Value, out type, out ns, out dimensions); - string value = GetQualifiedName (type + dimensions, ns); - WriteAttribute (attr.Prefix, attr.LocalName, attr.NamespaceURI, value); - return; - } - } - - WriteAttribute (attr.Prefix, attr.LocalName, attr.NamespaceURI, attr.Value); + throw new NotImplementedException (); } protected void WriteXsiType (string name, string ns) diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriterInterpreter.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriterInterpreter.cs index 2fb2c1e2a60..4f3a3461de9 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriterInterpreter.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriterInterpreter.cs @@ -20,7 +20,7 @@ namespace System.Xml.Serialization XmlMapping _typeMap; SerializationFormat _format; - public XmlSerializationWriterInterpreter (XmlMapping typeMap) + public XmlSerializationWriterInterpreter(XmlMapping typeMap) { _typeMap = typeMap; _format = typeMap.Format; @@ -39,7 +39,7 @@ namespace System.Xml.Serialization } } - public void WriteObject (object ob) + internal override void WriteObject (object ob) { WriteStartDocument (); @@ -61,19 +61,8 @@ namespace System.Xml.Serialization WriteReferencedElements (); } - - protected XmlTypeMapping GetTypeMap (Type type) - { - ArrayList maps = _typeMap.RelatedMaps; - if (maps != null) - { - foreach (XmlTypeMapping map in maps) - if (map.TypeData.Type == type) return map; - } - throw new InvalidOperationException ("Type " + type + " not mapped"); - } - protected virtual void WriteObject (XmlTypeMapping typeMap, object ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) + internal void WriteObject (XmlTypeMapping typeMap, object ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) { if (ob == null) { @@ -127,7 +116,7 @@ namespace System.Xml.Serialization WriteEndElement (ob); } - protected virtual void WriteMessage (XmlMembersMapping membersMap, object[] parameters) + void WriteMessage (XmlMembersMapping membersMap, object[] parameters) { if (membersMap.HasWrapperElement) { TopLevelElement (); @@ -146,36 +135,16 @@ namespace System.Xml.Serialization WriteEndElement(); } - protected virtual void WriteObjectElement (XmlTypeMapping typeMap, object ob, string element, string namesp) + void WriteObjectElement (XmlTypeMapping typeMap, object ob, string element, string namesp) { ClassMap map = (ClassMap)typeMap.ObjectMap; if (map.NamespaceDeclarations != null) WriteNamespaceDeclarations ((XmlSerializerNamespaces) map.NamespaceDeclarations.GetValue (ob)); - - WriteObjectElementAttributes (typeMap, ob); - WriteObjectElementElements (typeMap, ob); - } - - protected virtual void WriteObjectElementAttributes (XmlTypeMapping typeMap, object ob) - { - ClassMap map = (ClassMap)typeMap.ObjectMap; - WriteAttributeMembers (map, ob, false); - } - - protected virtual void WriteObjectElementElements (XmlTypeMapping typeMap, object ob) - { - ClassMap map = (ClassMap)typeMap.ObjectMap; - WriteElementMembers (map, ob, false); + WriteMembers (map, ob, false); } void WriteMembers (ClassMap map, object ob, bool isValueList) { - WriteAttributeMembers (map, ob, isValueList); - WriteElementMembers (map, ob, isValueList); - } - - void WriteAttributeMembers (ClassMap map, object ob, bool isValueList) - { // Write attributes ICollection attributes = map.AttributeMembers; @@ -194,13 +163,12 @@ namespace System.Xml.Serialization if (extraAtts != null) { foreach (XmlAttribute attr in extraAtts) - WriteXmlAttribute (attr, ob); + WriteAttribute (attr.Prefix, attr.LocalName, attr.NamespaceURI, attr.Value); } } - } - void WriteElementMembers (ClassMap map, object ob, bool isValueList) - { + // Write elements + ICollection members = map.ElementMembers; if (members != null) { @@ -350,7 +318,7 @@ namespace System.Xml.Serialization } } - protected virtual void WriteListElement (XmlTypeMapping typeMap, object ob, string element, string namesp) + void WriteListElement (XmlTypeMapping typeMap, object ob, string element, string namesp) { if (_format == SerializationFormat.Encoded) { @@ -358,7 +326,7 @@ namespace System.Xml.Serialization int itemCount = GetListCount (typeMap.TypeData, ob); ((ListMap) typeMap.ObjectMap).GetArrayType (itemCount, out n, out ns); string arrayType = (ns != string.Empty) ? FromXmlQualifiedName (new XmlQualifiedName(n,ns)) : n; - WriteAttribute ("arrayType", XmlSerializer.WsdlNamespace, arrayType); + WriteAttribute ("arrayType", SoapReflectionImporter.EncodingNamespace, arrayType); } WriteListContent (typeMap.TypeData, (ListMap) typeMap.ObjectMap, ob, null); } @@ -439,12 +407,12 @@ namespace System.Xml.Serialization } } - protected virtual void WritePrimitiveElement (XmlTypeMapping typeMap, object ob, string element, string namesp) + void WritePrimitiveElement (XmlTypeMapping typeMap, object ob, string element, string namesp) { Writer.WriteString (GetStringValue (typeMap, typeMap.TypeData, ob)); } - protected virtual void WriteEnumElement (XmlTypeMapping typeMap, object ob, string element, string namesp) + void WriteEnumElement (XmlTypeMapping typeMap, object ob, string element, string namesp) { Writer.WriteString (GetEnumXmlValue (typeMap, ob)); } diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs index 2f16f9a1e22..eb514916e03 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs @@ -20,8 +20,6 @@ namespace System.Xml.Serialization public class XmlSerializer { - internal const string WsdlNamespace = "http://schemas.xmlsoap.org/wsdl/"; - internal const string EncodingNamespace = "http://schemas.xmlsoap.org/soap/encoding/"; #region Fields @@ -81,7 +79,7 @@ namespace System.Xml.Serialization XmlReflectionImporter importer = new XmlReflectionImporter (overrides, defaultNamespace); - if (extraTypes != null) + if (extraTypes != null)
{ foreach (Type intype in extraTypes) importer.IncludeType (intype); @@ -158,14 +156,12 @@ namespace System.Xml.Serialization protected virtual XmlSerializationReader CreateReader () { - // Must be implemented in derived class - throw new NotImplementedException (); + return new XmlSerializationReaderInterpreter (typeMapping); } protected virtual XmlSerializationWriter CreateWriter () { - // Must be implemented in derived class - throw new NotImplementedException (); + return new XmlSerializationWriterInterpreter (typeMapping); } public object Deserialize (Stream stream) @@ -182,27 +178,14 @@ namespace System.Xml.Serialization public object Deserialize (XmlReader xmlReader) { - XmlSerializationReader xsReader; - if (typeMapping == null) - xsReader = CreateReader (); - else - xsReader = new XmlSerializationReaderInterpreter (typeMapping); - + XmlSerializationReader xsReader = CreateReader (); xsReader.Initialize (xmlReader, this); return Deserialize (xsReader); } protected virtual object Deserialize (XmlSerializationReader reader) { - if (typeMapping != null) - { - XmlSerializationReaderInterpreter rd = reader as XmlSerializationReaderInterpreter; - if (rd == null) throw new InvalidOperationException (); - return rd.ReadObject (); - } - else - // Must be implemented in derived class - throw new NotImplementedException (); + return reader.ReadObject (); } public static XmlSerializer [] FromMappings (XmlMapping [] mappings) @@ -223,15 +206,7 @@ namespace System.Xml.Serialization protected virtual void Serialize (object o, XmlSerializationWriter writer) { - if (typeMapping != null) - { - XmlSerializationWriterInterpreter wr = writer as XmlSerializationWriterInterpreter; - if (wr == null) throw new InvalidOperationException (); - wr.WriteObject (o); - } - else - // Must be implemented in derived class - throw new NotImplementedException (); + writer.WriteObject (o); } public void Serialize (Stream stream, object o) @@ -270,14 +245,8 @@ namespace System.Xml.Serialization public void Serialize (XmlWriter writer, object o, XmlSerializerNamespaces namespaces) { - XmlSerializationWriter xsWriter; - - if (typeMapping == null) - xsWriter = CreateWriter (); - else - xsWriter = new XmlSerializationWriterInterpreter (typeMapping); - - xsWriter.Initialize (writer, namespaces); + XmlSerializationWriter xsWriter = CreateWriter (); + xsWriter.Initialize (writer); Serialize (o, xsWriter); writer.Flush (); } diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapMemberElement.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapMemberElement.cs index f56369a3b2b..b409c322937 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapMemberElement.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapMemberElement.cs @@ -121,7 +121,7 @@ namespace System.Xml.Serialization { foreach (XmlTypeMapElementInfo elem in ElementInfo) { - if (elem.IsUnnamedAnyElement) // Default AnyElementAttribute + if (elem.ElementName == "") // Default AnyElementAttribute return true; if (elem.ElementName == name && elem.Namespace == ns) diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapping.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapping.cs index b48c1e2187a..1c573666215 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapping.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapping.cs @@ -126,7 +126,7 @@ namespace System.Xml.Serialization internal class ClassMap: ObjectMap
{
- Hashtable _elements = new Hashtable ();
+ Hashtable _elements;
ArrayList _elementMembers;
Hashtable _attributeMembers;
ArrayList _flatLists;
@@ -212,12 +212,6 @@ namespace System.Xml.Serialization if (_elements == null) return null;
return (XmlTypeMapElementInfo)_elements[name + "/" + ns];
}
-
- public ICollection AllElementInfos
- {
- get { return _elements.Values; }
- }
-
public XmlTypeMapMember FindMember (string name)
{
@@ -256,7 +250,7 @@ namespace System.Xml.Serialization get { return _allMembers; }
}
- public ArrayList FlatLists
+ public ICollection FlatLists
{
get { return _flatLists; }
}
@@ -359,13 +353,6 @@ namespace System.Xml.Serialization if (elem.ElementName == elementName && elem.Namespace == ns) return elem;
return null;
}
-
- public string GetSchemaArrayName ()
- {
- XmlTypeMapElementInfo einfo = (XmlTypeMapElementInfo) _itemInfo[0];
- if (einfo.MappedType != null) return TypeTranslator.GetArrayName (einfo.MappedType.XmlType);
- else return TypeTranslator.GetArrayName (einfo.TypeData.XmlType);
- }
public void GetArrayType (int itemCount, out string localName, out string ns)
{
@@ -451,11 +438,6 @@ namespace System.Xml.Serialization _members = members;
_isFlags = isFlags;
}
-
- public bool IsFlags
- {
- get { return _isFlags; }
- }
public EnumMapMember[] Members
{
@@ -520,4 +502,4 @@ namespace System.Xml.Serialization }
}
}
-} +}
diff --git a/mcs/class/System.XML/System.Xml.XPath/.cvsignore b/mcs/class/System.XML/System.Xml.XPath/.cvsignore deleted file mode 100644 index 92af64b1106..00000000000 --- a/mcs/class/System.XML/System.Xml.XPath/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -Parser.cs diff --git a/mcs/class/System.XML/System.Xml.XPath/ChangeLog b/mcs/class/System.XML/System.Xml.XPath/ChangeLog index f6070cccfc9..7e067222af7 100644 --- a/mcs/class/System.XML/System.Xml.XPath/ChangeLog +++ b/mcs/class/System.XML/System.Xml.XPath/ChangeLog @@ -1,16 +1,3 @@ -2003-09-06 Ben Maurer <bmaurer@users.sourceforge.net> - - * DefaultContext.cs, Expresssion.cs, Parser.jay: Rewrite so that - system functions are actually expressions. Will allow for some - nice optimizations. - -2003-08-25 Ben Maurer <bmaurer@users.sourceforge.net> - - * XPathNavigator.cs: "Smart" behavior in Matches. Nice 8x speed - improvement in the method (5ms/call -> .7 ms / call) measured by - monodoc's rendering of N:System. - * Expression.cs: Utility methods to support above. - 2003-08-13 Piers Haken <piersh@friskit.com> * Iterator.cs: diff --git a/mcs/class/System.XML/System.Xml.XPath/DefaultContext.cs b/mcs/class/System.XML/System.Xml.XPath/DefaultContext.cs index 256ff23f0d6..ef2cfe54058 100644 --- a/mcs/class/System.XML/System.Xml.XPath/DefaultContext.cs +++ b/mcs/class/System.XML/System.Xml.XPath/DefaultContext.cs @@ -15,6 +15,111 @@ using System.Text; namespace System.Xml.XPath { + /// <summary> + /// Summary description for DefaultContext. + /// </summary> + internal class DefaultContext : XsltContext + { + protected static Hashtable _htFunctions = new Hashtable (); + + static DefaultContext() + { + Add (new XPathFunctionLast ()); + Add (new XPathFunctionPosition ()); + Add (new XPathFunctionCount ()); + Add (new XPathFunctionId ()); + Add (new XPathFunctionLocalName ()); + Add (new XPathFunctionNamespaceUri ()); + Add (new XPathFunctionName ()); + Add (new XPathFunctionString ()); + Add (new XPathFunctionConcat ()); + Add (new XPathFunctionStartsWith ()); + Add (new XPathFunctionContains ()); + Add (new XPathFunctionSubstringBefore ()); + Add (new XPathFunctionSubstringAfter ()); + Add (new XPathFunctionSubstring ()); + Add (new XPathFunctionStringLength ()); + Add (new XPathFunctionNormalizeSpace ()); + Add (new XPathFunctionTranslate ()); + Add (new XPathFunctionBoolean ()); + Add (new XPathFunctionNot ()); + Add (new XPathFunctionTrue ()); + Add (new XPathFunctionFalse ()); + Add (new XPathFunctionLang ()); + Add (new XPathFunctionNumber ()); + Add (new XPathFunctionSum ()); + Add (new XPathFunctionFloor ()); + Add (new XPathFunctionCeil ()); + Add (new XPathFunctionRound ()); + } + + [MonoTODO] + public override IXsltContextFunction ResolveFunction (string prefix, string name, XPathResultType[] ArgTypes) + { + // match the prefix + if (prefix != null && prefix != "") // TODO: should we allow some namespaces here? + return null; + + // match the function name + XPathFunction fn = (XPathFunction) _htFunctions [name]; + if (fn == null) + return null; + + // check the number of arguments + int cArgs = ArgTypes.Length; + if (cArgs < fn.Minargs || cArgs > fn.Maxargs) + return null; + + // check the types of the arguments + XPathResultType [] rgTypes = fn.ArgTypes; + if (rgTypes == null) + { + if (cArgs != 0) + return null; + } + else + { + int cTypes = rgTypes.Length; + XPathResultType [] rgTypesRequested = ArgTypes; + for (int iArg = 0; iArg < cArgs; iArg ++) + { + XPathResultType typeRequested = rgTypesRequested [iArg]; + XPathResultType typeDefined = (iArg >= cTypes) ? rgTypes [cTypes - 1] : rgTypes [iArg]; + + // if the arguments don't match... + if (typeDefined != XPathResultType.Any && + typeDefined != typeRequested) + { + // if the function requires a nodeset + // then the arg should be .Any + // other conversions are illegal + if (typeDefined == XPathResultType.NodeSet && + typeRequested != XPathResultType.Any) + { + return null; + } + } + } + } + return fn; + } + public override IXsltContextVariable ResolveVariable (string prefix, string name) + { + return null; + } + [MonoTODO] + public override int CompareDocument (string baseUri, string nextBaseUri) { throw new NotImplementedException (); } + [MonoTODO] + public override bool PreserveWhitespace (XPathNavigator nav) { throw new NotImplementedException (); } + [MonoTODO] + public override bool Whitespace { get { throw new NotImplementedException (); }} + protected static void Add (XPathFunction fn) + { + _htFunctions.Add (fn.Name, fn); + } + } + + internal class XPathFunctions { public static bool ToBoolean (object arg) @@ -83,377 +188,273 @@ namespace System.Xml.XPath } } - internal abstract class XPathFunction : Expression + internal abstract class XPathFunction : IXsltContextFunction { - public XPathFunction (FunctionArguments args) {} + public abstract XPathResultType ReturnType { get; } + public abstract int Minargs { get; } + public abstract int Maxargs { get; } + public abstract XPathResultType [] ArgTypes { get; } + public object Invoke (XsltContext xsltContext, object[] args, XPathNavigator docContext) + { + return TypesafeInvoke (xsltContext, args, docContext); + } + + public abstract string Name { get; } + public abstract object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext); } internal class XPathFunctionLast : XPathFunction { - public XPathFunctionLast (FunctionArguments args) : base (args) - { - if (args != null) - throw new XPathException ("last takes 0 args"); - } - public override XPathResultType ReturnType { get { return XPathResultType.Number; }} - - public override object Evaluate (BaseIterator iter) + public override int Minargs { get { return 0; }} + public override int Maxargs { get { return 0; }} + public override XPathResultType [] ArgTypes { get { return null; }} + public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext) { - return (double) iter.Count; + throw new NotImplementedException (); // special-cased } + public override string Name { get { return "last"; }} } internal class XPathFunctionPosition : XPathFunction { - public XPathFunctionPosition (FunctionArguments args) : base (args) - { - if (args != null) - throw new XPathException ("position takes 0 args"); - } - public override XPathResultType ReturnType { get { return XPathResultType.Number; }} - - public override object Evaluate (BaseIterator iter) + public override int Minargs { get { return 0; }} + public override int Maxargs { get { return 0; }} + public override XPathResultType [] ArgTypes { get { return null; }} + public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext) { - return (double) iter.CurrentPosition; + throw new NotImplementedException (); // special-cased } + public override string Name { get { return "position"; }} } internal class XPathFunctionCount : XPathFunction { - Expression arg0; - - public XPathFunctionCount (FunctionArguments args) : base (args) - { - if (args == null || args.Tail != null) - throw new XPathException ("count takes 1 arg"); - - arg0 = args.Arg; - } - public override XPathResultType ReturnType { get { return XPathResultType.Number; }} - - public override object Evaluate (BaseIterator iter) - { - return (double) arg0.EvaluateNodeSet (iter).Count; - } - - public override bool EvaluateBoolean (BaseIterator iter) + public override int Minargs { get { return 1; }} + public override int Maxargs { get { return 1; }} + public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.NodeSet }; }} + public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext) { - if (arg0.GetReturnType (iter) == XPathResultType.NodeSet) - return arg0.EvaluateBoolean (iter); - - return arg0.EvaluateNodeSet (iter).MoveNext (); + return (double) ((BaseIterator) args [0]).Count; } + public override string Name { get { return "count"; }} } internal class XPathFunctionId : XPathFunction { - Expression arg0; - - public XPathFunctionId (FunctionArguments args) : base (args) - { - if (args == null || args.Tail != null) - throw new XPathException ("id takes 1 arg"); - - arg0 = args.Arg; - } - private static char [] rgchWhitespace = {' ', '\t', '\r', '\n'}; public override XPathResultType ReturnType { get { return XPathResultType.NodeSet; }} - + public override int Minargs { get { return 1; }} + public override int Maxargs { get { return 1; }} + public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.Any }; }} [MonoTODO] - public override object Evaluate (BaseIterator iter) + public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext) { String strArgs; - object val = arg0.Evaluate (iter); - - BaseIterator valItr = val as BaseIterator; - if (valItr != null) + BaseIterator iter = args [0] as BaseIterator; + if (iter != null) { strArgs = ""; - while (!valItr.MoveNext ()) - strArgs += valItr.Current.Value + " "; + while (!iter.MoveNext ()) + strArgs += iter.Current.Value + " "; } else - strArgs = XPathFunctions.ToString (val); - - XPathNavigator n = iter.Current.Clone (); + strArgs = XPathFunctions.ToString (args [0]); + string [] rgstrArgs = strArgs.Split (rgchWhitespace); ArrayList rgNodes = new ArrayList (); - foreach (string strArg in strArgs.Split (rgchWhitespace)) + foreach (string strArg in rgstrArgs) { - if (n.MoveToId (strArg)) - rgNodes.Add (n.Clone ()); + if (docContext.MoveToId (strArg)) + rgNodes.Add (docContext.Clone ()); } return new EnumeratorIterator (iter, rgNodes.GetEnumerator ()); } + public override string Name { get { return "id"; }} } internal class XPathFunctionLocalName : XPathFunction { - Expression arg0; - - public XPathFunctionLocalName (FunctionArguments args) : base (args) - { - if (args != null) { - arg0 = args.Arg; - if (args.Tail != null) - throw new XPathException ("local-name takes 1 or zero args"); - } - } - public override XPathResultType ReturnType { get { return XPathResultType.String; }} - - public override object Evaluate (BaseIterator iter) - { - if (arg0 == null) - return iter.Current.LocalName; - - BaseIterator argNs = arg0.EvaluateNodeSet (iter); - if (argNs == null || !argNs.MoveNext ()) + public override int Minargs { get { return 0; }} + public override int Maxargs { get { return 1; }} + public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.NodeSet }; }} + public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext) + { + if (args.Length == 0) + return docContext.LocalName; + BaseIterator iter = (BaseIterator) args [0]; + if (iter == null || !iter.MoveNext ()) return ""; - return argNs.Current.LocalName; + return iter.Current.LocalName; } + public override string Name { get { return "local-name"; }} } internal class XPathFunctionNamespaceUri : XPathFunction { - Expression arg0; - - public XPathFunctionNamespaceUri (FunctionArguments args) : base (args) - { - if (args != null) { - arg0 = args.Arg; - if (args.Tail != null) - throw new XPathException ("namespace-uri takes 1 or zero args"); - } - } - public override XPathResultType ReturnType { get { return XPathResultType.String; }} - - public override object Evaluate (BaseIterator iter) + public override int Minargs { get { return 0; }} + public override int Maxargs { get { return 1; }} + public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.NodeSet }; }} + [MonoTODO] + public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext) { - if (arg0 == null) - return iter.Current.NamespaceURI; - - BaseIterator argNs = arg0.EvaluateNodeSet (iter); - if (argNs == null || !argNs.MoveNext ()) + if (args.Length == 0) + return docContext.NamespaceURI; + BaseIterator iter = (BaseIterator) args [0]; + if (iter == null || !iter.MoveNext ()) return ""; - return argNs.Current.NamespaceURI; + return iter.Current.NamespaceURI; // TODO: should the namespace be expanded wrt. the given context? } + public override string Name { get { return "namespace-uri"; }} } internal class XPathFunctionName : XPathFunction { - Expression arg0; - - public XPathFunctionName (FunctionArguments args) : base (args) - { - if (args != null) { - arg0 = args.Arg; - if (args.Tail != null) - throw new XPathException ("name takes 1 or zero args"); - } - } - public override XPathResultType ReturnType { get { return XPathResultType.String; }} - - public override object Evaluate (BaseIterator iter) + public override int Minargs { get { return 0; }} + public override int Maxargs { get { return 1; }} + public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.NodeSet }; }} + [MonoTODO] + public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext) { - if (arg0 == null) - return iter.Current.Name; - - BaseIterator argNs = arg0.EvaluateNodeSet (iter); - if (argNs == null || !argNs.MoveNext ()) + if (args.Length == 0) + return docContext.Name; + BaseIterator iter = (BaseIterator) args [0]; + if (iter == null || !iter.MoveNext ()) return ""; - return argNs.Current.Name; + return iter.Current.Name; } + public override string Name { get { return "name"; }} } internal class XPathFunctionString : XPathFunction { - Expression arg0; - - public XPathFunctionString (FunctionArguments args) : base (args) - { - if (args != null) { - arg0 = args.Arg; - if (args.Tail != null) - throw new XPathException ("boolean takes 1 or zero args"); - } - } - public override XPathResultType ReturnType { get { return XPathResultType.String; }} - - public override object Evaluate (BaseIterator iter) + public override int Minargs { get { return 0; }} + public override int Maxargs { get { return 1; }} + public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.Any }; }} + public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext) { - if (arg0 == null) - return iter.Current.Value; - return arg0.EvaluateString (iter); + return XPathFunctions.ToString (args [0]); } + public override string Name { get { return "string"; }} } internal class XPathFunctionConcat : XPathFunction { - ArrayList rgs; - - public XPathFunctionConcat (FunctionArguments args) : base (args) - { - if (args == null || args.Tail == null) - throw new XPathException ("concat takes 2 or more args"); - - args.ToArrayList (rgs = new ArrayList ()); - } - public override XPathResultType ReturnType { get { return XPathResultType.String; }} - - public override object Evaluate (BaseIterator iter) + public override int Minargs { get { return 2; }} + public override int Maxargs { get { return int.MaxValue; }} + public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.Any, XPathResultType.Any, XPathResultType.Any }; }} + public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext) { StringBuilder sb = new StringBuilder (); - - foreach (Expression e in rgs) - sb.Append (e.EvaluateString (iter)); - + foreach (object arg in args) + sb.Append (XPathFunctions.ToString (arg)); return sb.ToString (); } + public override string Name { get { return "concat"; }} } internal class XPathFunctionStartsWith : XPathFunction { - Expression arg0, arg1; - - public XPathFunctionStartsWith (FunctionArguments args) : base (args) - { - if (args == null || args.Tail == null || args.Tail.Tail != null) - throw new XPathException ("starts-with takes 2 args"); - - arg0 = args.Arg; - arg1 = args.Tail.Arg; - } - public override XPathResultType ReturnType { get { return XPathResultType.Boolean; }} - - public override object Evaluate (BaseIterator iter) + public override int Minargs { get { return 2; }} + public override int Maxargs { get { return 2; }} + public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.String, XPathResultType.String }; }} + public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext) { - return arg0.EvaluateString (iter).StartsWith (arg1.EvaluateString (iter)); + string str1 = (string) args [0]; + string str2 = (string) args [1]; + return str1.StartsWith (str2); } + public override string Name { get { return "starts-with"; }} } internal class XPathFunctionContains : XPathFunction { - Expression arg0, arg1; - - public XPathFunctionContains (FunctionArguments args) : base (args) - { - if (args == null || args.Tail == null || args.Tail.Tail != null) - throw new XPathException ("contains takes 2 args"); - - arg0 = args.Arg; - arg1 = args.Tail.Arg; - } - public override XPathResultType ReturnType { get { return XPathResultType.Boolean; }} - - public override object Evaluate (BaseIterator iter) + public override int Minargs { get { return 2; }} + public override int Maxargs { get { return 2; }} + public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.String, XPathResultType.String }; }} + public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext) { - return arg0.EvaluateString (iter).IndexOf (arg1.EvaluateString (iter)) != -1; + string str1 = (string) args [0]; + string str2 = (string) args [1]; + return str1.IndexOf (str2) != -1; } + public override string Name { get { return "contains"; }} } internal class XPathFunctionSubstringBefore : XPathFunction { - Expression arg0, arg1; - - public XPathFunctionSubstringBefore (FunctionArguments args) : base (args) - { - if (args == null || args.Tail == null || args.Tail.Tail != null) - throw new XPathException ("substring-before takes 2 args"); - - arg0 = args.Arg; - arg1 = args.Tail.Arg; - } - public override XPathResultType ReturnType { get { return XPathResultType.String; }} - - public override object Evaluate (BaseIterator iter) + public override int Minargs { get { return 2; }} + public override int Maxargs { get { return 2; }} + public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.String, XPathResultType.String }; }} + public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext) { - string str1 = arg0.EvaluateString (iter); - string str2 = arg1.EvaluateString (iter); + string str1 = (string) args [0]; + string str2 = (string) args [1]; int ich = str1.IndexOf (str2); if (ich <= 0) return ""; return str1.Substring (0, ich); } + public override string Name { get { return "substring-before"; }} } internal class XPathFunctionSubstringAfter : XPathFunction { - Expression arg0, arg1; - - public XPathFunctionSubstringAfter (FunctionArguments args) : base (args) - { - if (args == null || args.Tail == null || args.Tail.Tail != null) - throw new XPathException ("substring-after takes 2 args"); - - arg0 = args.Arg; - arg1 = args.Tail.Arg; - } - public override XPathResultType ReturnType { get { return XPathResultType.String; }} - - public override object Evaluate (BaseIterator iter) + public override int Minargs { get { return 2; }} + public override int Maxargs { get { return 2; }} + public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.String, XPathResultType.String }; }} + public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext) { - string str1 = arg0.EvaluateString (iter); - string str2 = arg1.EvaluateString (iter); + string str1 = (string) args [0]; + string str2 = (string) args [1]; int ich = str1.IndexOf (str2); if (ich < 0) return ""; return str1.Substring (ich + str2.Length); } + public override string Name { get { return "substring-after"; }} } internal class XPathFunctionSubstring : XPathFunction { - Expression arg0, arg1, arg2; - - public XPathFunctionSubstring (FunctionArguments args) : base (args) - { - if (args == null || args.Tail == null || (args.Tail.Tail != null && args.Tail.Tail.Tail != null)) - throw new XPathException ("substring takes 2 or 3 args"); - - arg0 = args.Arg; - arg1 = args.Tail.Arg; - if (args.Tail.Tail != null) - arg2= args.Tail.Tail.Arg; - } - public override XPathResultType ReturnType { get { return XPathResultType.String; }} - + public override int Minargs { get { return 2; }} + public override int Maxargs { get { return 3; }} + public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.String, XPathResultType.Number, XPathResultType.Number }; }} [MonoTODO] - public override object Evaluate (BaseIterator iter) + public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext) { // TODO: check this, what the hell were they smoking? - string str = arg0.EvaluateString (iter); - double ich = Math.Round (arg1.EvaluateNumber (iter)) - 1; + string str = (string) args [0]; + double ich = Math.Round ((double) args [1]) - 1; if (Double.IsNaN (ich) || ich >= (double) str.Length) return ""; - if (arg2 == null) + if (args.Length == 2) { if (ich < 0) ich = 0.0; @@ -461,7 +462,7 @@ namespace System.Xml.XPath } else { - double cch = Math.Round (arg2.EvaluateNumber (iter)); + double cch = Math.Round ((double) args [2]); if (Double.IsNaN (cch)) return ""; if (ich < 0.0 || cch < 0.0) @@ -477,59 +478,43 @@ namespace System.Xml.XPath return str.Substring ((int) ich, (int) cch); } } + public override string Name { get { return "substring"; }} } internal class XPathFunctionStringLength : XPathFunction { - Expression arg0; - - public XPathFunctionStringLength (FunctionArguments args) : base (args) - { - if (args != null) { - arg0 = args.Arg; - if (args.Tail != null) - throw new XPathException ("string-length takes 1 or zero args"); - } - } - public override XPathResultType ReturnType { get { return XPathResultType.Number; }} - - public override object Evaluate (BaseIterator iter) + public override int Minargs { get { return 0; }} + public override int Maxargs { get { return 1; }} + public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.String }; }} + public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext) { string str; - if (arg0 != null) - str = arg0.EvaluateString (iter); + if (args.Length == 1) + str = (string) args [0]; else - str = iter.Current.Value; + str = docContext.Value; return (double) str.Length; } + public override string Name { get { return "string-length"; }} } internal class XPathFunctionNormalizeSpace : XPathFunction { - Expression arg0; - - public XPathFunctionNormalizeSpace (FunctionArguments args) : base (args) - { - if (args != null) { - arg0 = args.Arg; - if (args.Tail != null) - throw new XPathException ("string-length takes 1 or zero args"); - } - } - public override XPathResultType ReturnType { get { return XPathResultType.String; }} - + public override int Minargs { get { return 0; }} + public override int Maxargs { get { return 1; }} + public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.String }; }} [MonoTODO] - public override object Evaluate (BaseIterator iter) + public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext) { string str; - if (arg0 == null) - str = arg0.EvaluateString (iter); + if (args.Length == 1) + str = (string) args [0]; else - str = iter.Current.Value; + str = docContext.Value; System.Text.StringBuilder sb = new System.Text.StringBuilder (); bool fSpace = false; foreach (char ch in str) @@ -551,237 +536,168 @@ namespace System.Xml.XPath } return sb.ToString (); } + public override string Name { get { return "normalize-space"; }} } internal class XPathFunctionTranslate : XPathFunction { - Expression arg0, arg1, arg2; - - public XPathFunctionTranslate (FunctionArguments args) : base (args) - { - if (args == null || args.Tail == null || args.Tail.Tail == null || args.Tail.Tail.Tail != null) - throw new XPathException ("translate takes 3 args"); - - arg0 = args.Arg; - arg1 = args.Tail.Arg; - arg2= args.Tail.Tail.Arg; - } - public override XPathResultType ReturnType { get { return XPathResultType.String; }} - + public override int Minargs { get { return 3; }} + public override int Maxargs { get { return 3; }} + public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.String, XPathResultType.String, XPathResultType.String }; }} [MonoTODO] - public override object Evaluate (BaseIterator iter) + public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext) { throw new NotImplementedException (); } + public override string Name { get { return "translate"; }} } internal class XPathFunctionBoolean : XPathFunction { - Expression arg0; - - public XPathFunctionBoolean (FunctionArguments args) : base (args) - { - if (args != null) { - arg0 = args.Arg; - if (args.Tail != null) - throw new XPathException ("boolean takes 1 or zero args"); - } - } - public override XPathResultType ReturnType { get { return XPathResultType.Boolean; }} - - public override object Evaluate (BaseIterator iter) + public override int Minargs { get { return 1; }} + public override int Maxargs { get { return 1; }} + public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.Any }; }} + public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext) { - if (arg0 == null) - return XPathFunctions.ToBoolean (iter.Current.Value); - return arg0.EvaluateBoolean (iter); + return XPathFunctions.ToBoolean (args [0]); } + public override string Name { get { return "boolean"; }} } internal class XPathFunctionNot : XPathFunction { - Expression arg0; - - public XPathFunctionNot (FunctionArguments args) : base (args) - { - if (args == null || args.Tail != null) - throw new XPathException ("not takes one arg"); - arg0 = args.Arg; - } - public override XPathResultType ReturnType { get { return XPathResultType.Boolean; }} - - public override object Evaluate (BaseIterator iter) + public override int Minargs { get { return 1; }} + public override int Maxargs { get { return 1; }} + public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.Any }; }} + public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext) { - return !arg0.EvaluateBoolean (iter); + return !(XPathFunctions.ToBoolean (args [0])); } + public override string Name { get { return "not"; }} } internal class XPathFunctionTrue : XPathFunction { - public XPathFunctionTrue (FunctionArguments args) : base (args) - { - if (args != null) - throw new XPathException ("true takes 0 args"); - } - public override XPathResultType ReturnType { get { return XPathResultType.Boolean; }} - - public override object Evaluate (BaseIterator iter) + public override int Minargs { get { return 0; }} + public override int Maxargs { get { return 0; }} + public override XPathResultType [] ArgTypes { get { return null; }} + public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext) { return true; } + public override string Name { get { return "true"; }} } internal class XPathFunctionFalse : XPathFunction { - public XPathFunctionFalse (FunctionArguments args) : base (args) - { - if (args != null) - throw new XPathException ("false takes 0 args"); - } public override XPathResultType ReturnType { get { return XPathResultType.Boolean; }} - - public override object Evaluate (BaseIterator iter) + public override int Minargs { get { return 0; }} + public override int Maxargs { get { return 0; }} + public override XPathResultType [] ArgTypes { get { return null; }} + public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext) { return false; } + public override string Name { get { return "false"; }} } internal class XPathFunctionLang : XPathFunction { - Expression arg0; - - public XPathFunctionLang (FunctionArguments args) : base (args) - { - if (args == null || args.Tail != null) - throw new XPathException ("lang takes one arg"); - arg0 = args.Arg; - } - public override XPathResultType ReturnType { get { return XPathResultType.Boolean; }} - - public override object Evaluate (BaseIterator iter) + public override int Minargs { get { return 1; }} + public override int Maxargs { get { return 1; }} + public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.String }; }} + public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext) { - string lang = arg0.EvaluateString (iter).ToLower (); - string actualLang = iter.Current.XmlLang.ToLower (); + string lang = ((string)args[0]).ToLower (); + string actualLang = docContext.XmlLang.ToLower (); return lang == actualLang || lang == (actualLang.Split ('-')[0]); } + public override string Name { get { return "lang"; }} } internal class XPathFunctionNumber : XPathFunction { - Expression arg0; - - public XPathFunctionNumber (FunctionArguments args) : base (args) - { - if (args != null) { - arg0 = args.Arg; - if (args.Tail != null) - throw new XPathException ("number takes 1 or zero args"); - } - } - public override XPathResultType ReturnType { get { return XPathResultType.Number; }} - - public override object Evaluate (BaseIterator iter) + public override int Minargs { get { return 0; }} + public override int Maxargs { get { return 1; }} + public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.Any }; }} + public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext) { - if (arg0 == null) - return XPathFunctions.ToNumber (iter.Current.Value); - return arg0.EvaluateNumber (iter); + return XPathFunctions.ToNumber (args [0]); } + public override string Name { get { return "number"; }} } internal class XPathFunctionSum : XPathFunction { - Expression arg0; - - public XPathFunctionSum (FunctionArguments args) : base (args) - { - if (args == null || args.Tail != null) - throw new XPathException ("sum takes one arg"); - arg0 = args.Arg; - } - public override XPathResultType ReturnType { get { return XPathResultType.Number; }} - + public override int Minargs { get { return 1; }} + public override int Maxargs { get { return 1; }} + public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.NodeSet }; }} [MonoTODO] - public override object Evaluate (BaseIterator iter) + public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext) { throw new NotImplementedException (); } + public override string Name { get { return "sum"; }} } internal class XPathFunctionFloor : XPathFunction { - Expression arg0; - - public XPathFunctionFloor (FunctionArguments args) : base (args) - { - if (args == null || args.Tail != null) - throw new XPathException ("floor takes one arg"); - arg0 = args.Arg; - } - public override XPathResultType ReturnType { get { return XPathResultType.Number; }} - - public override object Evaluate (BaseIterator iter) + public override int Minargs { get { return 1; }} + public override int Maxargs { get { return 1; }} + public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.Number }; }} + public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext) { - return Math.Floor (arg0.EvaluateNumber (iter)); + return Math.Floor ((double) args [0]); } + public override string Name { get { return "floor"; }} } internal class XPathFunctionCeil : XPathFunction { - Expression arg0; - - public XPathFunctionCeil (FunctionArguments args) : base (args) - { - if (args == null || args.Tail != null) - throw new XPathException ("ceil takes one arg"); - arg0 = args.Arg; - } - public override XPathResultType ReturnType { get { return XPathResultType.Number; }} - - public override object Evaluate (BaseIterator iter) + public override int Minargs { get { return 1; }} + public override int Maxargs { get { return 1; }} + public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.Number }; }} + public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext) { - return Math.Ceiling (arg0.EvaluateNumber (iter)); + return Math.Ceiling ((double) args [0]); } + public override string Name { get { return "ceil"; }} } internal class XPathFunctionRound : XPathFunction { - Expression arg0; - - public XPathFunctionRound (FunctionArguments args) : base (args) - { - if (args == null || args.Tail != null) - throw new XPathException ("round takes one arg"); - arg0 = args.Arg; - } - public override XPathResultType ReturnType { get { return XPathResultType.Number; }} - - public override object Evaluate (BaseIterator iter) + public override int Minargs { get { return 1; }} + public override int Maxargs { get { return 1; }} + public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.Number }; }} + public override object TypesafeInvoke (XsltContext xsltContext, object[] args, XPathNavigator docContext) { - double arg = arg0.EvaluateNumber (iter); + double arg = (double) args [0]; if (arg < -0.5 || arg > 0) return Math.Floor (arg + 0.5); return Math.Round (arg); } + public override string Name { get { return "round"; }} } } diff --git a/mcs/class/System.XML/System.Xml.XPath/Expression.cs b/mcs/class/System.XML/System.Xml.XPath/Expression.cs index f72ea0af6e9..2e9eaa3b27f 100644 --- a/mcs/class/System.XML/System.Xml.XPath/Expression.cs +++ b/mcs/class/System.XML/System.Xml.XPath/Expression.cs @@ -42,8 +42,6 @@ namespace System.Xml.XPath #else public override XPathExpression Clone () { return new CompiledExpression (this); } #endif - - public Expression ExpressionNode { get { return _expr; }} public override void SetContext (XmlNamespaceManager nsManager) { @@ -321,6 +319,7 @@ namespace System.Xml.XPath /// </summary> internal abstract class Expression { + private static XsltContext _ctxDefault = new DefaultContext (); public Expression () { } @@ -328,7 +327,7 @@ namespace System.Xml.XPath public virtual XPathResultType GetReturnType (BaseIterator iter) { return ReturnType; } public abstract object Evaluate (BaseIterator iter); - public virtual BaseIterator EvaluateNodeSet (BaseIterator iter) + public BaseIterator EvaluateNodeSet (BaseIterator iter) { XPathResultType type = GetReturnType (iter); if (type == XPathResultType.NodeSet || @@ -340,6 +339,7 @@ namespace System.Xml.XPath } throw new XPathException ("expected nodeset: "+ToString ()); } + protected static XsltContext DefaultContext { get { return _ctxDefault; } } protected static XPathResultType GetReturnType (object obj) { @@ -354,7 +354,7 @@ namespace System.Xml.XPath throw new XPathException ("invalid node type: "+obj.GetType ().ToString ()); } [MonoTODO] - public virtual double EvaluateNumber (BaseIterator iter) + public double EvaluateNumber (BaseIterator iter) { object result; XPathResultType type = GetReturnType (iter); @@ -384,7 +384,7 @@ namespace System.Xml.XPath } } [MonoTODO] - public virtual string EvaluateString (BaseIterator iter) + public string EvaluateString (BaseIterator iter) { object result = Evaluate (iter); XPathResultType type = GetReturnType (iter); @@ -410,7 +410,7 @@ namespace System.Xml.XPath } } [MonoTODO] - public virtual bool EvaluateBoolean (BaseIterator iter) + public bool EvaluateBoolean (BaseIterator iter) { object result = Evaluate (iter); XPathResultType type = GetReturnType (iter); @@ -473,17 +473,13 @@ namespace System.Xml.XPath { public ExprBoolean (Expression left, Expression right) : base (left, right) {} public override XPathResultType ReturnType { get { return XPathResultType.Boolean; }} - public override object Evaluate (BaseIterator iter) - { - return EvaluateBoolean (iter); - } } internal class ExprOR : ExprBoolean { public ExprOR (Expression left, Expression right) : base (left, right) {} protected override String Operator { get { return "or"; }} - public override bool EvaluateBoolean (BaseIterator iter) + public override object Evaluate (BaseIterator iter) { if (_left.EvaluateBoolean (iter)) return true; @@ -495,7 +491,7 @@ namespace System.Xml.XPath { public ExprAND (Expression left, Expression right) : base (left, right) {} protected override String Operator { get { return "and"; }} - public override bool EvaluateBoolean (BaseIterator iter) + public override object Evaluate (BaseIterator iter) { if (!_left.EvaluateBoolean (iter)) return false; @@ -507,7 +503,7 @@ namespace System.Xml.XPath { public EqualityExpr (Expression left, Expression right) : base (left, right) {} [MonoTODO] - public override bool EvaluateBoolean (BaseIterator iter) + public override object Evaluate (BaseIterator iter) { XPathResultType typeL = _left.GetReturnType (iter); XPathResultType typeR = _right.GetReturnType (iter); @@ -609,7 +605,7 @@ namespace System.Xml.XPath { public RelationalExpr (Expression left, Expression right) : base (left, right) {} [MonoTODO] - public override bool EvaluateBoolean (BaseIterator iter) + public override object Evaluate (BaseIterator iter) { XPathResultType typeL = _left.GetReturnType (iter); XPathResultType typeR = _right.GetReturnType (iter); @@ -728,18 +724,13 @@ namespace System.Xml.XPath { public ExprNumeric (Expression left, Expression right) : base (left, right) {} public override XPathResultType ReturnType { get { return XPathResultType.Number; }} - - public override object Evaluate (BaseIterator iter) - { - return EvaluateNumber (iter); - } } internal class ExprPLUS : ExprNumeric { public ExprPLUS (Expression left, Expression right) : base (left, right) {} protected override String Operator { get { return "+"; }} - public override double EvaluateNumber (BaseIterator iter) + public override object Evaluate (BaseIterator iter) { return _left.EvaluateNumber (iter) + _right.EvaluateNumber (iter); } @@ -749,7 +740,7 @@ namespace System.Xml.XPath { public ExprMINUS (Expression left, Expression right) : base (left, right) {} protected override String Operator { get { return "-"; }} - public override double EvaluateNumber (BaseIterator iter) + public override object Evaluate (BaseIterator iter) { return _left.EvaluateNumber (iter) - _right.EvaluateNumber (iter); } @@ -759,7 +750,7 @@ namespace System.Xml.XPath { public ExprMULT (Expression left, Expression right) : base (left, right) {} protected override String Operator { get { return "*"; }} - public override double EvaluateNumber (BaseIterator iter) + public override object Evaluate (BaseIterator iter) { return _left.EvaluateNumber (iter) * _right.EvaluateNumber (iter); } @@ -769,7 +760,7 @@ namespace System.Xml.XPath { public ExprDIV (Expression left, Expression right) : base (left, right) {} protected override String Operator { get { return " div "; }} - public override double EvaluateNumber (BaseIterator iter) + public override object Evaluate (BaseIterator iter) { return _left.EvaluateNumber (iter) / _right.EvaluateNumber (iter); } @@ -780,7 +771,7 @@ namespace System.Xml.XPath public ExprMOD (Expression left, Expression right) : base (left, right) {} protected override String Operator { get { return "%"; }} [MonoTODO] - public override double EvaluateNumber (BaseIterator iter) + public override object Evaluate (BaseIterator iter) { return _left.EvaluateNumber (iter) % _right.EvaluateNumber (iter); // TODO: spec? } @@ -799,11 +790,6 @@ namespace System.Xml.XPath { return - _expr.EvaluateNumber (iter); } - - public override double EvaluateNumber (BaseIterator iter) - { - return - _expr.EvaluateNumber (iter); - } } @@ -813,55 +799,35 @@ namespace System.Xml.XPath } internal class ExprUNION : NodeSet { - public readonly Expression left, right; + protected Expression _left, _right; public ExprUNION (Expression left, Expression right) { - this.left = left; - this.right = right; + _left = left; + _right = right; } - public override String ToString () { return left.ToString ()+ " | " + right.ToString (); } + public override String ToString () { return _left.ToString ()+ " | " + _right.ToString (); } public override object Evaluate (BaseIterator iter) { - BaseIterator iterLeft = left.EvaluateNodeSet (iter); - BaseIterator iterRight = right.EvaluateNodeSet (iter); + BaseIterator iterLeft = _left.EvaluateNodeSet (iter); + BaseIterator iterRight = _right.EvaluateNodeSet (iter); return new UnionIterator (iter, iterLeft, iterRight); } } internal class ExprSLASH : NodeSet { - public readonly Expression left; - public readonly NodeSet right; + protected Expression _left; + protected NodeSet _right; public ExprSLASH (Expression left, NodeSet right) { - this.left = left; - this.right = right; - } - public override String ToString () { return left.ToString ()+ "/" + right.ToString (); } - public override object Evaluate (BaseIterator iter) - { - BaseIterator iterLeft = left.EvaluateNodeSet (iter); - return new SlashIterator (iterLeft, right); - } - } - - internal class ExprSLASH2 : NodeSet { - public readonly Expression left; - public readonly NodeSet right; - - public ExprSLASH2 (Expression left, NodeSet right) - { - this.left = left; - this.right = right; + _left = left; + _right = right; } - public override String ToString () { return left.ToString ()+ "//" + right.ToString (); } + public override String ToString () { return _left.ToString ()+ "/" + _right.ToString (); } public override object Evaluate (BaseIterator iter) { - BaseIterator iterLeft = new DescendantOrSelfIterator( - left.EvaluateNodeSet (iter) - ); - - return new SlashIterator (iterLeft, right); + BaseIterator iterLeft = _left.EvaluateNodeSet (iter); + return new SlashIterator (iterLeft, _right); } } @@ -1004,28 +970,28 @@ namespace System.Xml.XPath internal class NodeTypeTest : NodeTest { - public readonly XPathNodeType type; + protected XPathNodeType _type; protected String _param; public NodeTypeTest (Axes axis) : base (axis) { - this.type = _axis.NodeType; + _type = _axis.NodeType; } public NodeTypeTest (Axes axis, XPathNodeType type) : base (axis) { - this.type = type; + _type = type; } [MonoTODO] public NodeTypeTest (Axes axis, XPathNodeType type, String param) : base (axis) { - this.type = type; + _type = type; _param = param; if (param != null && type != XPathNodeType.ProcessingInstruction) - throw new XPathException ("No argument allowed for "+ToString (type)+"() test"); // TODO: better description + throw new XPathException ("No argument allowed for "+ToString (_type)+"() test"); // TODO: better description } public override String ToString () { - String strType = ToString (type); - if (type == XPathNodeType.ProcessingInstruction && _param != null) + String strType = ToString (_type); + if (_type == XPathNodeType.ProcessingInstruction && _param != null) strType += "('" + _param + "')"; else strType += "()"; @@ -1054,7 +1020,7 @@ namespace System.Xml.XPath public override bool Match (XmlNamespaceManager nsm, XPathNavigator nav) { XPathNodeType nodeType = nav.NodeType; - switch (type) + switch (_type) { case XPathNodeType.All: return true; @@ -1067,7 +1033,7 @@ namespace System.Xml.XPath return true; default: - return type == nodeType; + return _type == nodeType; } } } @@ -1080,8 +1046,6 @@ namespace System.Xml.XPath _name = name; } public override String ToString () { return _axis.ToString () + "::" + _name.ToString (); } - - public XmlQualifiedName Name { get { return _name; } } [MonoTODO] public override bool Match (XmlNamespaceManager nsm, XPathNavigator nav) { @@ -1147,20 +1111,18 @@ namespace System.Xml.XPath internal class ExprFilter : NodeSet { - public readonly Expression expr, pred; - + protected Expression _expr; + protected Expression _pred; public ExprFilter (Expression expr, Expression pred) { - this.expr = expr; - this.pred = pred; + _expr = expr; + _pred = pred; } - - internal Expression LeftHandSide {get{return expr;}} - public override String ToString () { return "(" + expr.ToString () + ")[" + pred.ToString () + "]"; } + public override String ToString () { return "(" + _expr.ToString () + ")[" + _pred.ToString () + "]"; } public override object Evaluate (BaseIterator iter) { - BaseIterator iterExpr = expr.EvaluateNodeSet (iter); - return new PredicateIterator (iterExpr, pred); + BaseIterator iterExpr = _expr.EvaluateNodeSet (iter); + return new PredicateIterator (iterExpr, _pred); } } @@ -1177,11 +1139,6 @@ namespace System.Xml.XPath { return _value; } - - public override double EvaluateNumber (BaseIterator iter) - { - return _value; - } } internal class ExprLiteral : Expression @@ -1197,11 +1154,6 @@ namespace System.Xml.XPath { return _value; } - - public override string EvaluateString (BaseIterator iter) - { - return _value; - } } internal class ExprVariable : Expression @@ -1256,17 +1208,6 @@ namespace System.Xml.XPath { get { return _tail; } } - - public void ToArrayList (ArrayList a) - { - FunctionArguments cur = this; - - do { - a.Add (cur._arg); - cur = cur._tail; - } while (cur != null); - - } } internal class ExprFunctionCall : Expression @@ -1276,47 +1217,12 @@ namespace System.Xml.XPath public ExprFunctionCall (XmlQualifiedName name, FunctionArguments args) { _name = name; - if (args != null) - args.ToArrayList (_args); - } - - public static Expression Factory (XmlQualifiedName name, FunctionArguments args) - { - if (name.Namespace != null && name.Namespace != "") - return new ExprFunctionCall (name, args); - - switch (name.Name) { - case "last": return new XPathFunctionLast (args); - case "position": return new XPathFunctionPosition (args); - case "count": return new XPathFunctionCount (args); - case "id": return new XPathFunctionId (args); - case "local-name": return new XPathFunctionLocalName (args); - case "namespace-uri": return new XPathFunctionNamespaceUri (args); - case "name": return new XPathFunctionName (args); - case "string": return new XPathFunctionString (args); - case "concat": return new XPathFunctionConcat (args); - case "starts-with": return new XPathFunctionStartsWith (args); - case "contains": return new XPathFunctionContains (args); - case "substring-before": return new XPathFunctionSubstringBefore (args); - case "substring-after": return new XPathFunctionSubstringAfter (args); - case "substring": return new XPathFunctionSubstring (args); - case "string-length": return new XPathFunctionStringLength (args); - case "normalize-space": return new XPathFunctionNormalizeSpace (args); - case "translate": return new XPathFunctionTranslate (args); - case "boolean": return new XPathFunctionBoolean (args); - case "not": return new XPathFunctionNot (args); - case "true": return new XPathFunctionTrue (args); - case "false": return new XPathFunctionFalse (args); - case "lang": return new XPathFunctionLang (args); - case "number": return new XPathFunctionNumber (args); - case "sum": return new XPathFunctionSum (args); - case "floor": return new XPathFunctionFloor (args); - case "ceiling": return new XPathFunctionCeil (args); - case "round": return new XPathFunctionRound (args); + while (args != null) + { + _args.Add (args.Arg); + args = args.Tail; } - return new ExprFunctionCall (name, args); } - public override String ToString () { String strArgs = ""; @@ -1335,7 +1241,8 @@ namespace System.Xml.XPath XsltContext context = iter.NamespaceManager as XsltContext; if (context != null) func = context.ResolveFunction (_name.Namespace, _name.Name, GetArgTypes (iter)); - + if (func == null) + func = DefaultContext.ResolveFunction (_name.Namespace, _name.Name, GetArgTypes (iter)); if (func == null) throw new XPathException ("function "+_name.ToString ()+" not found"); return func.ReturnType; @@ -1350,12 +1257,29 @@ namespace System.Xml.XPath } public override object Evaluate (BaseIterator iter) { + //special-case the 'last' and 'position' functions + if (_args.Count == 0 && _name.Namespace == "") + { + if (_name.Name == "last") + { + return (double) iter.Count; + } + else if (_name.Name == "position") + { + return (double) iter.CurrentPosition; + } + } + XPathResultType [] rgTypes = GetArgTypes (iter); IXsltContextFunction func = null; XsltContext context = iter.NamespaceManager as XsltContext; if (context != null) func = context.ResolveFunction (_name.Namespace, _name.Name, rgTypes); - + if (func == null) + { + context = DefaultContext; + func = context.ResolveFunction (_name.Namespace, _name.Name, rgTypes); + } if (func == null) throw new XPathException ("function "+_name.ToString ()+" not found"); diff --git a/mcs/class/System.XML/System.Xml.XPath/Iterator.cs b/mcs/class/System.XML/System.Xml.XPath/Iterator.cs index a8380a1f761..14eeeeb58ea 100644 --- a/mcs/class/System.XML/System.Xml.XPath/Iterator.cs +++ b/mcs/class/System.XML/System.Xml.XPath/Iterator.cs @@ -148,7 +148,6 @@ namespace System.Xml.XPath { public ParentIterator (BaseIterator iter) : base (iter) {} protected ParentIterator (ParentIterator other) : base (other) {} - public ParentIterator (XPathNavigator nav, XmlNamespaceManager nsm) : base (nav, nsm) {} public override XPathNodeIterator Clone () { return new ParentIterator (this); } public override bool MoveNext () { @@ -485,13 +484,11 @@ namespace System.Xml.XPath protected BaseIterator _iter; protected Expression _pred; protected int _pos; - protected XPathResultType resType; public PredicateIterator (BaseIterator iter, Expression pred) : base (iter) { _iter = iter; _pred = pred; - resType = pred.GetReturnType (iter); } protected PredicateIterator (PredicateIterator other) : base (other) @@ -499,7 +496,6 @@ namespace System.Xml.XPath _iter = (BaseIterator) other._iter.Clone (); _pred = other._pred; _pos = other._pos; - resType = other.resType; } public override XPathNodeIterator Clone () { return new PredicateIterator (this); } @@ -508,28 +504,14 @@ namespace System.Xml.XPath while (_iter.MoveNext ()) { bool fTrue = true; - - switch (resType) { - case XPathResultType.Number: - if (_pred.EvaluateNumber (_iter) != _iter.CurrentPosition) - continue; - break; - case XPathResultType.Any: { - object result = _pred.Evaluate (_iter); - if (result is double) - { - if ((double) result != _iter.CurrentPosition) - continue; - } - else if (!XPathFunctions.ToBoolean (result)) - continue; - } - break; - default: - if (!_pred.EvaluateBoolean (_iter)) - continue; - break; + object result = _pred.Evaluate ((BaseIterator) _iter.Clone ()); + if (result is double) + { + if ((double) result != _iter.CurrentPosition) + continue; } + else if (!XPathFunctions.ToBoolean (result)) + continue; _pos ++; return true; diff --git a/mcs/class/System.XML/System.Xml.XPath/Parser.cs b/mcs/class/System.XML/System.Xml.XPath/Parser.cs new file mode 100644 index 00000000000..8fd8619b50a --- /dev/null +++ b/mcs/class/System.XML/System.Xml.XPath/Parser.cs @@ -0,0 +1,1109 @@ +// created by jay 0.7 (c) 1998 Axel.Schreiner@informatik.uni-osnabrueck.de + + // line 2 "Parser.jay" +// XPath parser +// +// Author - Piers Haken <piersh@friskit.com> +// + +using System; +using System.Xml; +using System.Xml.XPath; + +namespace Mono.Xml.XPath +{ + public class XPathParser + { + internal object yyparseSafe (Tokenizer tok) + { + return yyparseSafe (tok, null); + } + + internal object yyparseSafe (Tokenizer tok, object yyDebug) + { + //yyDebug = new yydebug.yyDebugSimple (); + try + { + Expression expr = (Expression) yyparse (tok, yyDebug); + //Console.WriteLine (expr.ToString ()); + return expr; + } + catch (XPathException e) + { + throw e; + } + catch (Exception e) + { + throw new XPathException ("Error during parse", e); + } + } + + internal object yyparseDebug (Tokenizer tok) + { + return yyparseSafe (tok, new yydebug.yyDebugSimple ()); + } + + // line 47 + + /** simplified error message. + @see <a href="#yyerror(java.lang.String, java.lang.String[])">yyerror</a> + */ + public void yyerror (string message) { + yyerror(message, null); + } + + /** (syntax) error message. + Can be overwritten to control message format. + @param message text to be displayed. + @param expected vector of acceptable tokens, if available. + */ + public void yyerror (string message, string[] expected) { + if ((expected != null) && (expected.Length > 0)) { + System.Console.Write (message+", expecting"); + for (int n = 0; n < expected.Length; ++ n) + System.Console.Write (" "+expected[n]); + System.Console.WriteLine (); + } else + System.Console.WriteLine (message); + } + + /** debugging support, requires the package jay.yydebug. + Set to null to suppress debugging messages. + */ + protected yydebug.yyDebug debug; + + protected static int yyFinal = 25; + public static string [] yyRule = { + "$accept : Expr", + "Expr : OrExpr", + "OrExpr : AndExpr", + "OrExpr : OrExpr OR AndExpr", + "AndExpr : EqualityExpr", + "AndExpr : AndExpr AND EqualityExpr", + "EqualityExpr : RelationalExpr", + "EqualityExpr : EqualityExpr EQ RelationalExpr", + "EqualityExpr : EqualityExpr NE RelationalExpr", + "RelationalExpr : AdditiveExpr", + "RelationalExpr : RelationalExpr LT AdditiveExpr", + "RelationalExpr : RelationalExpr GT AdditiveExpr", + "RelationalExpr : RelationalExpr LE AdditiveExpr", + "RelationalExpr : RelationalExpr GE AdditiveExpr", + "AdditiveExpr : MultiplicativeExpr", + "AdditiveExpr : AdditiveExpr PLUS MultiplicativeExpr", + "AdditiveExpr : AdditiveExpr MINUS MultiplicativeExpr", + "MultiplicativeExpr : UnaryExpr", + "MultiplicativeExpr : MultiplicativeExpr MULTIPLY UnaryExpr", + "MultiplicativeExpr : MultiplicativeExpr DIV UnaryExpr", + "MultiplicativeExpr : MultiplicativeExpr MOD UnaryExpr", + "UnaryExpr : UnionExpr", + "UnaryExpr : MINUS UnaryExpr", + "UnionExpr : PathExpr", + "UnionExpr : UnionExpr BAR PathExpr", + "PathExpr : LocationPath", + "PathExpr : FilterExpr", + "PathExpr : FilterExpr SLASH RelativeLocationPath", + "PathExpr : FilterExpr SLASH2 RelativeLocationPath", + "LocationPath : RelativeLocationPath", + "LocationPath : AbsoluteLocationPath", + "AbsoluteLocationPath : SLASH", + "AbsoluteLocationPath : SLASH RelativeLocationPath", + "AbsoluteLocationPath : SLASH2 RelativeLocationPath", + "RelativeLocationPath : Step", + "RelativeLocationPath : RelativeLocationPath SLASH Step", + "RelativeLocationPath : RelativeLocationPath SLASH2 Step", + "Step : PredicatedStep", + "Step : DOT", + "Step : DOT2", + "PredicatedStep : AxisTest", + "PredicatedStep : PredicatedStep Predicate", + "AxisTest : AxisSpecifier QName", + "AxisTest : AxisSpecifier ASTERISK", + "AxisTest : AxisSpecifier NodeType PAREN_OPEN OptionalLiteral PAREN_CLOSE", + "AxisSpecifier :", + "AxisSpecifier : AT", + "AxisSpecifier : AxisName COLON2", + "NodeType : COMMENT", + "NodeType : TEXT", + "NodeType : PROCESSING_INSTRUCTION", + "NodeType : NODE", + "FilterExpr : PrimaryExpr", + "FilterExpr : FilterExpr Predicate", + "PrimaryExpr : DOLLAR QName", + "PrimaryExpr : PAREN_OPEN Expr PAREN_CLOSE", + "PrimaryExpr : LITERAL", + "PrimaryExpr : NUMBER", + "PrimaryExpr : FunctionCall", + "FunctionCall : FUNCTION_NAME PAREN_OPEN OptionalArgumentList PAREN_CLOSE", + "OptionalArgumentList :", + "OptionalArgumentList : Expr OptionalArgumentListTail", + "OptionalArgumentListTail :", + "OptionalArgumentListTail : COMMA Expr OptionalArgumentListTail", + "Predicate : BRACKET_OPEN Expr BRACKET_CLOSE", + "AxisName : ANCESTOR", + "AxisName : ANCESTOR_OR_SELF", + "AxisName : ATTRIBUTE", + "AxisName : CHILD", + "AxisName : DESCENDANT", + "AxisName : DESCENDANT_OR_SELF", + "AxisName : FOLLOWING", + "AxisName : FOLLOWING_SIBLING", + "AxisName : NAMESPACE", + "AxisName : PARENT", + "AxisName : PRECEDING", + "AxisName : PRECEDING_SIBLING", + "AxisName : SELF", + "OptionalLiteral :", + "OptionalLiteral : LITERAL", + }; + protected static string [] yyName = { + "end-of-file",null,null,null,null,null,null,null,null,null,null,null, + null,null,null,null,null,null,null,null,null,null,null,null,null,null, + null,null,null,null,null,null,null,null,null,null,"'$'",null,null, + null,"'('","')'","'*'","'+'","','","'-'","'.'","'/'",null,null,null, + null,null,null,null,null,null,null,null,null,"'<'","'='","'>'",null, + "'@'",null,null,null,null,null,null,null,null,null,null,null,null, + null,null,null,null,null,null,null,null,null,null,null,null,null,null, + "'['",null,"']'",null,null,null,null,null,null,null,null,null,null, + null,null,null,null,null,null,null,null,null,null,null,null,null,null, + null,null,null,null,null,null,"'|'",null,null,null,null,null,null, + null,null,null,null,null,null,null,null,null,null,null,null,null,null, + null,null,null,null,null,null,null,null,null,null,null,null,null,null, + null,null,null,null,null,null,null,null,null,null,null,null,null,null, + null,null,null,null,null,null,null,null,null,null,null,null,null,null, + null,null,null,null,null,null,null,null,null,null,null,null,null,null, + null,null,null,null,null,null,null,null,null,null,null,null,null,null, + null,null,null,null,null,null,null,null,null,null,null,null,null,null, + null,null,null,null,null,null,null,null,null,null,null,null,null,null, + null,null,null,null,null,null,null,null,null,null,null,null,null,null, + "ERROR","EOF","SLASH","SLASH2","\"//\"","DOT","DOT2","\"..\"", + "COLON2","\"::\"","COMMA","AT","FUNCTION_NAME","BRACKET_OPEN", + "BRACKET_CLOSE","PAREN_OPEN","PAREN_CLOSE","AND","\"and\"","OR", + "\"or\"","DIV","\"div\"","MOD","\"mod\"","PLUS","MINUS","ASTERISK", + "DOLLAR","BAR","EQ","NE","\"!=\"","LE","\"<=\"","GE","\">=\"","LT", + "GT","ANCESTOR","\"ancestor\"","ANCESTOR_OR_SELF", + "\"ancstor-or-self\"","ATTRIBUTE","\"attribute\"","CHILD","\"child\"", + "DESCENDANT","\"descendant\"","DESCENDANT_OR_SELF", + "\"descendant-or-self\"","FOLLOWING","\"following\"", + "FOLLOWING_SIBLING","\"sibling\"","NAMESPACE","\"NameSpace\"", + "PARENT","\"parent\"","PRECEDING","\"preceding\"","PRECEDING_SIBLING", + "\"preceding-sibling\"","SELF","\"self\"","COMMENT","\"comment\"", + "TEXT","\"text\"","PROCESSING_INSTRUCTION", + "\"processing-instruction\"","NODE","\"node\"","MULTIPLY","NUMBER", + "LITERAL","QName", + }; + + /** index-checked interface to yyName[]. + @param token single character or %token value. + @return token name or [illegal] or [unknown]. + */ + public static string yyname (int token) { + if ((token < 0) || (token > yyName.Length)) return "[illegal]"; + string name; + if ((name = yyName[token]) != null) return name; + return "[unknown]"; + } + + /** computes list of expected tokens on error by tracing the tables. + @param state for which to compute the list. + @return list of token names. + */ + protected string[] yyExpecting (int state) { + int token, n, len = 0; + bool[] ok = new bool[yyName.Length]; + + if ((n = yySindex[state]) != 0) + for (token = n < 0 ? -n : 0; + (token < yyName.Length) && (n+token < yyTable.Length); ++ token) + if (yyCheck[n+token] == token && !ok[token] && yyName[token] != null) { + ++ len; + ok[token] = true; + } + if ((n = yyRindex[state]) != 0) + for (token = n < 0 ? -n : 0; + (token < yyName.Length) && (n+token < yyTable.Length); ++ token) + if (yyCheck[n+token] == token && !ok[token] && yyName[token] != null) { + ++ len; + ok[token] = true; + } + + string [] result = new string[len]; + for (n = token = 0; n < len; ++ token) + if (ok[token]) result[n++] = yyName[token]; + return result; + } + + /** the generated parser, with debugging messages. + Maintains a state and a value stack, currently with fixed maximum size. + @param yyLex scanner. + @param yydebug debug message writer implementing yyDebug, or null. + @return result of the last reduction, if any. + @throws yyException on irrecoverable parse error. + */ + public Object yyparse (yyParser.yyInput yyLex, Object yyd) + { + this.debug = (yydebug.yyDebug)yyd; + return yyparse(yyLex); + } + + /** initial size and increment of the state/value stack [default 256]. + This is not final so that it can be overwritten outside of invocations + of yyparse(). + */ + protected int yyMax; + + /** executed at the beginning of a reduce action. + Used as $$ = yyDefault($1), prior to the user-specified action, if any. + Can be overwritten to provide deep copy, etc. + @param first value for $1, or null. + @return first. + */ + protected Object yyDefault (Object first) { + return first; + } + + /** the generated parser. + Maintains a state and a value stack, currently with fixed maximum size. + @param yyLex scanner. + @return result of the last reduction, if any. + @throws yyException on irrecoverable parse error. + */ + public Object yyparse (yyParser.yyInput yyLex) + { + if (yyMax <= 0) yyMax = 256; // initial size + int yyState = 0; // state stack ptr + int [] yyStates = new int[yyMax]; // state stack + Object yyVal = null; // value stack ptr + Object [] yyVals = new Object[yyMax]; // value stack + int yyToken = -1; // current input + int yyErrorFlag = 0; // #tks to shift + + int yyTop = 0; + goto skip; + yyLoop: + yyTop++; + skip: + for (;; ++ yyTop) { + if (yyTop >= yyStates.Length) { // dynamically increase + int[] i = new int[yyStates.Length+yyMax]; + yyStates.CopyTo (i, 0); + yyStates = i; + Object[] o = new Object[yyVals.Length+yyMax]; + yyVals.CopyTo (o, 0); + yyVals = o; + } + yyStates[yyTop] = yyState; + yyVals[yyTop] = yyVal; + if (debug != null) debug.push(yyState, yyVal); + + yyDiscarded: for (;;) { // discarding a token does not change stack + int yyN; + if ((yyN = yyDefRed[yyState]) == 0) { // else [default] reduce (yyN) + if (yyToken < 0) { + yyToken = yyLex.advance() ? yyLex.token() : 0; + if (debug != null) + debug.lex(yyState, yyToken, yyname(yyToken), yyLex.value()); + } + if ((yyN = yySindex[yyState]) != 0 && ((yyN += yyToken) >= 0) + && (yyN < yyTable.Length) && (yyCheck[yyN] == yyToken)) { + if (debug != null) + debug.shift(yyState, yyTable[yyN], yyErrorFlag-1); + yyState = yyTable[yyN]; // shift to yyN + yyVal = yyLex.value(); + yyToken = -1; + if (yyErrorFlag > 0) -- yyErrorFlag; + goto yyLoop; + } + if ((yyN = yyRindex[yyState]) != 0 && (yyN += yyToken) >= 0 + && yyN < yyTable.Length && yyCheck[yyN] == yyToken) + yyN = yyTable[yyN]; // reduce (yyN) + else + switch (yyErrorFlag) { + + case 0: + yyerror("syntax error", yyExpecting(yyState)); + if (debug != null) debug.error("syntax error"); + goto case 1; + case 1: case 2: + yyErrorFlag = 3; + do { + if ((yyN = yySindex[yyStates[yyTop]]) != 0 + && (yyN += Token.yyErrorCode) >= 0 && yyN < yyTable.Length + && yyCheck[yyN] == Token.yyErrorCode) { + if (debug != null) + debug.shift(yyStates[yyTop], yyTable[yyN], 3); + yyState = yyTable[yyN]; + yyVal = yyLex.value(); + goto yyLoop; + } + if (debug != null) debug.pop(yyStates[yyTop]); + } while (-- yyTop >= 0); + if (debug != null) debug.reject(); + throw new yyParser.yyException("irrecoverable syntax error"); + + case 3: + if (yyToken == 0) { + if (debug != null) debug.reject(); + throw new yyParser.yyException("irrecoverable syntax error at end-of-file"); + } + if (debug != null) + debug.discard(yyState, yyToken, yyname(yyToken), + yyLex.value()); + yyToken = -1; + goto yyDiscarded; // leave stack alone + } + } + int yyV = yyTop + 1-yyLen[yyN]; + if (debug != null) + debug.reduce(yyState, yyStates[yyV-1], yyN, yyRule[yyN], yyLen[yyN]); + yyVal = yyDefault(yyV > yyTop ? null : yyVals[yyV]); + switch (yyN) { +case 3: + // line 133 "Parser.jay" + { + yyVal = new ExprOR ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + } + break; +case 5: + // line 141 "Parser.jay" + { + yyVal = new ExprAND ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + } + break; +case 7: + // line 149 "Parser.jay" + { + yyVal = new ExprEQ ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + } + break; +case 8: + // line 153 "Parser.jay" + { + yyVal = new ExprNE ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + } + break; +case 10: + // line 161 "Parser.jay" + { + yyVal = new ExprLT ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + } + break; +case 11: + // line 165 "Parser.jay" + { + yyVal = new ExprGT ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + } + break; +case 12: + // line 169 "Parser.jay" + { + yyVal = new ExprLE ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + } + break; +case 13: + // line 173 "Parser.jay" + { + yyVal = new ExprGE ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + } + break; +case 15: + // line 181 "Parser.jay" + { + yyVal = new ExprPLUS ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + } + break; +case 16: + // line 185 "Parser.jay" + { + yyVal = new ExprMINUS ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + } + break; +case 18: + // line 193 "Parser.jay" + { + yyVal = new ExprMULT ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + } + break; +case 19: + // line 197 "Parser.jay" + { + yyVal = new ExprDIV ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + } + break; +case 20: + // line 201 "Parser.jay" + { + yyVal = new ExprMOD ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + } + break; +case 22: + // line 209 "Parser.jay" + { + yyVal = new ExprNEG ((Expression) yyVals[0+yyTop]); + } + break; +case 24: + // line 217 "Parser.jay" + { + yyVal = new ExprUNION ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]); + } + break; +case 27: + // line 226 "Parser.jay" + { + yyVal = new ExprSLASH ((Expression) yyVals[-2+yyTop], (NodeSet) yyVals[0+yyTop]); + } + break; +case 28: + // line 230 "Parser.jay" + { + NodeTest test = new NodeTypeTest (Axes.DescendantOrSelf, XPathNodeType.All); + yyVal = new ExprSLASH (new ExprSLASH ((Expression) yyVals[-2+yyTop], test), (NodeSet) yyVals[0+yyTop]); + } + break; +case 31: + // line 243 "Parser.jay" + { + yyVal = new ExprRoot (); + } + break; +case 32: + // line 247 "Parser.jay" + { + yyVal = new ExprSLASH (new ExprRoot (), (NodeSet) yyVals[0+yyTop]); + } + break; +case 33: + // line 251 "Parser.jay" + { + NodeTest test = new NodeTypeTest (Axes.DescendantOrSelf, XPathNodeType.All); + yyVal = new ExprSLASH (new ExprSLASH (new ExprRoot (), test), (NodeSet) yyVals[0+yyTop]); + } + break; +case 35: + // line 260 "Parser.jay" + { + yyVal = new ExprSLASH ((NodeSet) yyVals[-2+yyTop], (NodeSet) yyVals[0+yyTop]); + } + break; +case 36: + // line 264 "Parser.jay" + { + NodeTest test = new NodeTypeTest (Axes.DescendantOrSelf, XPathNodeType.All); + yyVal = new ExprSLASH (new ExprSLASH ((NodeSet) yyVals[-2+yyTop], test), (NodeSet) yyVals[0+yyTop]); + } + break; +case 38: + // line 273 "Parser.jay" + { + yyVal = new NodeTypeTest (Axes.Self, XPathNodeType.All); + } + break; +case 39: + // line 277 "Parser.jay" + { + yyVal = new NodeTypeTest (Axes.Parent, XPathNodeType.All); + } + break; +case 41: + // line 285 "Parser.jay" + { + yyVal = new ExprFilter ((NodeSet) yyVals[-1+yyTop], (Expression) yyVals[0+yyTop]); + } + break; +case 42: + // line 292 "Parser.jay" + { + yyVal = new NodeNameTest ((Axes) yyVals[-1+yyTop], (XmlQualifiedName) yyVals[0+yyTop]); + } + break; +case 43: + // line 296 "Parser.jay" + { + yyVal = new NodeTypeTest ((Axes) yyVals[-1+yyTop]); + } + break; +case 44: + // line 300 "Parser.jay" + { + yyVal = new NodeTypeTest ((Axes) yyVals[-4+yyTop], (XPathNodeType) yyVals[-3+yyTop], (String) yyVals[-1+yyTop]); + } + break; +case 45: + // line 307 "Parser.jay" + { + yyVal = Axes.Child; + } + break; +case 46: + // line 311 "Parser.jay" + { + yyVal = Axes.Attribute; + } + break; +case 47: + // line 315 "Parser.jay" + { + yyVal = yyVals[-1+yyTop]; + } + break; +case 48: + // line 321 "Parser.jay" + { yyVal = XPathNodeType.Comment; } + break; +case 49: + // line 322 "Parser.jay" + { yyVal = XPathNodeType.Text; } + break; +case 50: + // line 323 "Parser.jay" + { yyVal = XPathNodeType.ProcessingInstruction; } + break; +case 51: + // line 324 "Parser.jay" + { yyVal = XPathNodeType.All; } + break; +case 53: + // line 331 "Parser.jay" + { + yyVal = new ExprFilter ((Expression) yyVals[-1+yyTop], (Expression) yyVals[0+yyTop]); + } + break; +case 54: + // line 338 "Parser.jay" + { + yyVal = new ExprVariable ((XmlQualifiedName) yyVals[0+yyTop]); + } + break; +case 55: + // line 342 "Parser.jay" + { + yyVal = yyVals[-1+yyTop]; + } + break; +case 56: + // line 346 "Parser.jay" + { + yyVal = new ExprLiteral ((String) yyVals[0+yyTop]); + } + break; +case 57: + // line 350 "Parser.jay" + { + yyVal = new ExprNumber ((double) yyVals[0+yyTop]); + } + break; +case 59: + // line 358 "Parser.jay" + { + yyVal = new ExprFunctionCall ((XmlQualifiedName) yyVals[-3+yyTop], (FunctionArguments) yyVals[-1+yyTop]); + } + break; +case 61: + // line 366 "Parser.jay" + { + yyVal = new FunctionArguments ((Expression) yyVals[-1+yyTop], (FunctionArguments) yyVals[0+yyTop]); + } + break; +case 63: + // line 374 "Parser.jay" + { + yyVal = new FunctionArguments ((Expression) yyVals[-1+yyTop], (FunctionArguments) yyVals[0+yyTop]); + } + break; +case 64: + // line 381 "Parser.jay" + { + yyVal = yyVals[-1+yyTop]; + } + break; +case 65: + // line 387 "Parser.jay" + { yyVal = Axes.Ancestor; } + break; +case 66: + // line 388 "Parser.jay" + { yyVal = Axes.AncestorOrSelf; } + break; +case 67: + // line 389 "Parser.jay" + { yyVal = Axes.Attribute; } + break; +case 68: + // line 390 "Parser.jay" + { yyVal = Axes.Child; } + break; +case 69: + // line 391 "Parser.jay" + { yyVal = Axes.Descendant; } + break; +case 70: + // line 392 "Parser.jay" + { yyVal = Axes.DescendantOrSelf; } + break; +case 71: + // line 393 "Parser.jay" + { yyVal = Axes.Following; } + break; +case 72: + // line 394 "Parser.jay" + { yyVal = Axes.FollowingSibling; } + break; +case 73: + // line 395 "Parser.jay" + { yyVal = Axes.Namespace; } + break; +case 74: + // line 396 "Parser.jay" + { yyVal = Axes.Parent; } + break; +case 75: + // line 397 "Parser.jay" + { yyVal = Axes.Preceding; } + break; +case 76: + // line 398 "Parser.jay" + { yyVal = Axes.PrecedingSibling; } + break; +case 77: + // line 399 "Parser.jay" + { yyVal = Axes.Self; } + break; + // line 672 + } + yyTop -= yyLen[yyN]; + yyState = yyStates[yyTop]; + int yyM = yyLhs[yyN]; + if (yyState == 0 && yyM == 0) { + if (debug != null) debug.shift(0, yyFinal); + yyState = yyFinal; + if (yyToken < 0) { + yyToken = yyLex.advance() ? yyLex.token() : 0; + if (debug != null) + debug.lex(yyState, yyToken,yyname(yyToken), yyLex.value()); + } + if (yyToken == 0) { + if (debug != null) debug.accept(yyVal); + return yyVal; + } + goto yyLoop; + } + if (((yyN = yyGindex[yyM]) != 0) && ((yyN += yyState) >= 0) + && (yyN < yyTable.Length) && (yyCheck[yyN] == yyState)) + yyState = yyTable[yyN]; + else + yyState = yyDgoto[yyM]; + if (debug != null) debug.shift(yyStates[yyTop], yyState); + goto yyLoop; + } + } + } + + static short [] yyLhs = { -1, + 0, 1, 1, 2, 2, 3, 3, 3, 4, 4, + 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, + 7, 7, 8, 8, 9, 9, 9, 9, 10, 10, + 13, 13, 13, 12, 12, 12, 14, 14, 14, 15, + 15, 16, 16, 16, 18, 18, 18, 19, 19, 19, + 19, 11, 11, 22, 22, 22, 22, 22, 23, 24, + 24, 25, 25, 17, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 20, 20, + }; + static short [] yyLen = { 2, + 1, 1, 3, 1, 3, 1, 3, 3, 1, 3, + 3, 3, 3, 1, 3, 3, 1, 3, 3, 3, + 1, 2, 1, 3, 1, 1, 3, 3, 1, 1, + 1, 2, 2, 1, 3, 3, 1, 1, 1, 1, + 2, 2, 2, 5, 0, 1, 2, 1, 1, 1, + 1, 1, 2, 2, 3, 1, 1, 1, 4, 0, + 2, 0, 3, 3, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 0, 1, + }; + static short [] yyDefRed = { 0, + 0, 0, 38, 39, 46, 0, 0, 0, 0, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 57, 56, 0, 0, 0, 0, 0, 0, + 0, 17, 0, 23, 25, 0, 0, 30, 34, 0, + 40, 0, 0, 52, 58, 0, 0, 0, 0, 22, + 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 53, 0, + 0, 41, 43, 48, 49, 50, 51, 42, 0, 47, + 0, 0, 55, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 19, 20, 18, 24, 0, 0, 0, + 35, 36, 0, 0, 61, 59, 64, 79, 0, 0, + 44, 63, + }; + protected static short [] yyDgoto = { 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 69, 42, 79, 109, + 43, 44, 45, 82, 105, + }; + protected static short [] yySindex = { -254, + -130, -130, 0, 0, 0, -270, -254, -254, -326, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, -266, -262, -271, -256, -201, + -267, 0, -258, 0, 0, -238, -169, 0, 0, -250, + 0, -178, -235, 0, 0, -169, -169, -254, -233, 0, + 0, -254, -254, -254, -254, -254, -254, -254, -254, -254, + -254, -254, -254, -254, -189, -130, -130, -254, 0, -130, + -130, 0, 0, 0, 0, 0, 0, 0, -237, 0, + -224, -228, 0, -262, -271, -256, -256, -201, -201, -201, + -201, -267, -267, 0, 0, 0, 0, -169, -169, -222, + 0, 0, -285, -254, 0, 0, 0, 0, -220, -224, + 0, 0, + }; + protected static short [] yyRindex = { -168, + 1, -168, 0, 0, 0, 0, -168, -168, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 19, 93, 37, 27, 357, + 276, 0, 250, 0, 0, 85, 114, 0, 0, 59, + 0, 0, 0, 0, 0, 140, 169, -198, 0, 0, + 0, -168, -168, -168, -168, -168, -168, -168, -168, -168, + -168, -168, -168, -168, -168, -168, -168, -168, 0, -168, + -168, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -218, 0, 0, 336, 484, 458, 476, 383, 393, 419, + 429, 302, 328, 0, 0, 0, 0, 195, 224, 0, + 0, 0, -216, -168, 0, 0, 0, 0, 0, -218, + 0, 0, + }; + protected static short [] yyGindex = { -7, + 0, -1, 12, 40, -33, 38, 25, 0, 7, 0, + 0, 2, 0, 30, 0, 0, 36, 0, 0, 0, + 0, 0, 0, 0, -43, + }; + protected static short [] yyTable = { 49, + 31, 48, 46, 47, 1, 2, 51, 3, 4, 52, + 62, 53, 63, 5, 6, 54, 55, 7, 1, 68, + 66, 67, 88, 89, 90, 91, 6, 65, 8, 80, + 9, 68, 50, 56, 103, 57, 4, 58, 59, 83, + 81, 10, 104, 11, 106, 12, 108, 13, 107, 14, + 84, 15, 111, 16, 62, 17, 78, 18, 37, 19, + 100, 20, 64, 21, 85, 22, 112, 98, 99, 1, + 2, 97, 3, 4, 60, 72, 23, 24, 5, 6, + 60, 61, 7, 0, 26, 45, 94, 95, 96, 70, + 71, 0, 2, 86, 87, 9, 110, 92, 93, 101, + 102, 0, 0, 0, 0, 73, 10, 0, 11, 0, + 12, 0, 13, 29, 14, 45, 15, 0, 16, 0, + 17, 0, 18, 45, 19, 45, 20, 45, 21, 45, + 22, 3, 4, 0, 45, 0, 0, 5, 0, 32, + 0, 23, 24, 74, 0, 75, 0, 76, 0, 77, + 0, 0, 0, 45, 78, 45, 0, 45, 0, 45, + 0, 0, 0, 0, 45, 10, 0, 11, 33, 12, + 0, 13, 0, 14, 0, 15, 0, 16, 0, 17, + 0, 18, 0, 19, 0, 20, 0, 21, 0, 22, + 0, 0, 0, 0, 27, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, + 0, 31, 0, 31, 31, 14, 31, 0, 31, 0, + 31, 0, 31, 31, 45, 1, 31, 31, 31, 1, + 31, 1, 31, 6, 31, 31, 0, 6, 0, 6, + 6, 15, 6, 4, 0, 0, 0, 4, 0, 4, + 4, 0, 4, 6, 6, 0, 0, 37, 37, 0, + 0, 0, 45, 0, 45, 37, 45, 16, 45, 37, + 31, 37, 37, 45, 37, 3, 37, 0, 37, 0, + 37, 37, 0, 0, 37, 37, 37, 0, 37, 0, + 37, 26, 37, 37, 0, 26, 9, 26, 26, 2, + 26, 0, 26, 2, 26, 2, 26, 26, 2, 0, + 26, 26, 26, 0, 26, 0, 26, 0, 26, 26, + 29, 0, 12, 0, 29, 0, 29, 29, 37, 29, + 0, 29, 13, 29, 0, 29, 29, 0, 0, 29, + 29, 29, 0, 29, 0, 29, 32, 29, 29, 0, + 32, 0, 32, 32, 26, 32, 0, 32, 10, 32, + 0, 32, 32, 0, 0, 32, 32, 32, 11, 32, + 0, 32, 0, 32, 32, 33, 0, 0, 0, 33, + 0, 33, 33, 29, 33, 0, 33, 0, 33, 0, + 33, 33, 0, 0, 33, 33, 33, 7, 33, 0, + 33, 27, 33, 33, 0, 27, 0, 27, 27, 32, + 27, 0, 27, 0, 27, 8, 27, 27, 0, 0, + 27, 27, 27, 5, 27, 0, 27, 0, 27, 27, + 28, 0, 0, 0, 28, 0, 28, 28, 33, 28, + 0, 28, 0, 28, 0, 28, 28, 0, 0, 28, + 28, 28, 0, 28, 0, 28, 21, 28, 28, 0, + 21, 0, 21, 21, 27, 21, 0, 21, 0, 21, + 0, 21, 21, 0, 0, 0, 21, 21, 0, 21, + 0, 21, 14, 21, 21, 0, 14, 0, 14, 14, + 0, 14, 0, 28, 0, 0, 0, 14, 14, 0, + 0, 0, 14, 14, 0, 14, 0, 14, 15, 14, + 14, 0, 15, 0, 15, 15, 0, 15, 0, 21, + 0, 0, 0, 15, 15, 0, 0, 0, 15, 15, + 0, 15, 0, 15, 16, 15, 15, 0, 16, 0, + 16, 16, 3, 16, 0, 0, 3, 0, 3, 16, + 16, 3, 0, 0, 16, 16, 0, 16, 0, 16, + 0, 16, 16, 9, 0, 0, 0, 9, 0, 9, + 9, 0, 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 9, 9, 0, 9, 0, 9, 12, + 9, 9, 0, 12, 0, 12, 12, 0, 12, 13, + 0, 0, 0, 13, 0, 13, 13, 0, 13, 12, + 12, 0, 12, 0, 12, 0, 12, 12, 0, 13, + 13, 0, 13, 0, 13, 10, 13, 13, 0, 10, + 0, 10, 10, 0, 10, 11, 0, 0, 0, 11, + 0, 11, 11, 0, 11, 10, 10, 0, 10, 0, + 10, 0, 10, 10, 0, 11, 11, 0, 11, 0, + 11, 0, 11, 11, 7, 0, 0, 0, 7, 0, + 7, 7, 0, 7, 0, 0, 0, 0, 0, 0, + 0, 0, 8, 0, 7, 7, 8, 0, 8, 8, + 5, 8, 0, 0, 5, 0, 5, 5, 0, 5, + 0, 0, 8, 8, + }; + protected static short [] yyCheck = { 7, + 0, 272, 1, 2, 259, 260, 333, 262, 263, 276, + 278, 274, 280, 268, 269, 287, 288, 272, 0, 270, + 259, 260, 56, 57, 58, 59, 0, 286, 283, 265, + 285, 270, 8, 290, 272, 292, 0, 294, 295, 273, + 48, 296, 267, 298, 273, 300, 332, 302, 271, 304, + 52, 306, 273, 308, 273, 310, 273, 312, 0, 314, + 68, 316, 330, 318, 53, 320, 110, 66, 67, 259, + 260, 65, 262, 263, 273, 40, 331, 332, 268, 269, + 282, 283, 272, -1, 0, 284, 62, 63, 64, 259, + 260, -1, 0, 54, 55, 285, 104, 60, 61, 70, + 71, -1, -1, -1, -1, 284, 296, -1, 298, -1, + 300, -1, 302, 0, 304, 284, 306, -1, 308, -1, + 310, -1, 312, 322, 314, 324, 316, 326, 318, 328, + 320, 262, 263, -1, 333, -1, -1, 268, -1, 0, + -1, 331, 332, 322, -1, 324, -1, 326, -1, 328, + -1, -1, -1, 322, 333, 324, -1, 326, -1, 328, + -1, -1, -1, -1, 333, 296, -1, 298, 0, 300, + -1, 302, -1, 304, -1, 306, -1, 308, -1, 310, + -1, 312, -1, 314, -1, 316, -1, 318, -1, 320, + -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 267, -1, -1, + -1, 271, -1, 273, 274, 0, 276, -1, 278, -1, + 280, -1, 282, 283, 284, 267, 286, 287, 288, 271, + 290, 273, 292, 267, 294, 295, -1, 271, -1, 273, + 274, 0, 276, 267, -1, -1, -1, 271, -1, 273, + 274, -1, 276, 287, 288, -1, -1, 259, 260, -1, + -1, -1, 322, -1, 324, 267, 326, 0, 328, 271, + 330, 273, 274, 333, 276, 0, 278, -1, 280, -1, + 282, 283, -1, -1, 286, 287, 288, -1, 290, -1, + 292, 267, 294, 295, -1, 271, 0, 273, 274, 267, + 276, -1, 278, 271, 280, 273, 282, 283, 276, -1, + 286, 287, 288, -1, 290, -1, 292, -1, 294, 295, + 267, -1, 0, -1, 271, -1, 273, 274, 330, 276, + -1, 278, 0, 280, -1, 282, 283, -1, -1, 286, + 287, 288, -1, 290, -1, 292, 267, 294, 295, -1, + 271, -1, 273, 274, 330, 276, -1, 278, 0, 280, + -1, 282, 283, -1, -1, 286, 287, 288, 0, 290, + -1, 292, -1, 294, 295, 267, -1, -1, -1, 271, + -1, 273, 274, 330, 276, -1, 278, -1, 280, -1, + 282, 283, -1, -1, 286, 287, 288, 0, 290, -1, + 292, 267, 294, 295, -1, 271, -1, 273, 274, 330, + 276, -1, 278, -1, 280, 0, 282, 283, -1, -1, + 286, 287, 288, 0, 290, -1, 292, -1, 294, 295, + 267, -1, -1, -1, 271, -1, 273, 274, 330, 276, + -1, 278, -1, 280, -1, 282, 283, -1, -1, 286, + 287, 288, -1, 290, -1, 292, 267, 294, 295, -1, + 271, -1, 273, 274, 330, 276, -1, 278, -1, 280, + -1, 282, 283, -1, -1, -1, 287, 288, -1, 290, + -1, 292, 267, 294, 295, -1, 271, -1, 273, 274, + -1, 276, -1, 330, -1, -1, -1, 282, 283, -1, + -1, -1, 287, 288, -1, 290, -1, 292, 267, 294, + 295, -1, 271, -1, 273, 274, -1, 276, -1, 330, + -1, -1, -1, 282, 283, -1, -1, -1, 287, 288, + -1, 290, -1, 292, 267, 294, 295, -1, 271, -1, + 273, 274, 267, 276, -1, -1, 271, -1, 273, 282, + 283, 276, -1, -1, 287, 288, -1, 290, -1, 292, + -1, 294, 295, 267, -1, -1, -1, 271, -1, 273, + 274, -1, 276, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 287, 288, -1, 290, -1, 292, 267, + 294, 295, -1, 271, -1, 273, 274, -1, 276, 267, + -1, -1, -1, 271, -1, 273, 274, -1, 276, 287, + 288, -1, 290, -1, 292, -1, 294, 295, -1, 287, + 288, -1, 290, -1, 292, 267, 294, 295, -1, 271, + -1, 273, 274, -1, 276, 267, -1, -1, -1, 271, + -1, 273, 274, -1, 276, 287, 288, -1, 290, -1, + 292, -1, 294, 295, -1, 287, 288, -1, 290, -1, + 292, -1, 294, 295, 267, -1, -1, -1, 271, -1, + 273, 274, -1, 276, -1, -1, -1, -1, -1, -1, + -1, -1, 267, -1, 287, 288, 271, -1, 273, 274, + 267, 276, -1, -1, 271, -1, 273, 274, -1, 276, + -1, -1, 287, 288, + }; + + // line 408 "Parser.jay" + } + // line 935 +namespace yydebug { + using System; + public interface yyDebug { + void push (int state, Object value); + void lex (int state, int token, string name, Object value); + void shift (int from, int to, int errorFlag); + void pop (int state); + void discard (int state, int token, string name, Object value); + void reduce (int from, int to, int rule, string text, int len); + void shift (int from, int to); + void accept (Object value); + void error (string message); + void reject (); + } + + class yyDebugSimple : yyDebug { + void println (string s){ + Console.WriteLine (s); + } + + public void push (int state, Object value) { + println ("push\tstate "+state+"\tvalue "+value); + } + + public void lex (int state, int token, string name, Object value) { + println("lex\tstate "+state+"\treading "+name+"\tvalue "+value); + } + + public void shift (int from, int to, int errorFlag) { + switch (errorFlag) { + default: // normally + println("shift\tfrom state "+from+" to "+to); + break; + case 0: case 1: case 2: // in error recovery + println("shift\tfrom state "+from+" to "+to + +"\t"+errorFlag+" left to recover"); + break; + case 3: // normally + println("shift\tfrom state "+from+" to "+to+"\ton error"); + break; + } + } + + public void pop (int state) { + println("pop\tstate "+state+"\ton error"); + } + + public void discard (int state, int token, string name, Object value) { + println("discard\tstate "+state+"\ttoken "+name+"\tvalue "+value); + } + + public void reduce (int from, int to, int rule, string text, int len) { + println("reduce\tstate "+from+"\tuncover "+to + +"\trule ("+rule+") "+text); + } + + public void shift (int from, int to) { + println("goto\tfrom state "+from+" to "+to); + } + + public void accept (Object value) { + println("accept\tvalue "+value); + } + + public void error (string message) { + println("error\t"+message); + } + + public void reject () { + println("reject"); + } + + } +} +// %token constants + class Token { + public const int ERROR = 257; + public const int EOF = 258; + public const int SLASH = 259; + public const int SLASH2 = 260; + public const int DOT = 262; + public const int DOT2 = 263; + public const int COLON2 = 265; + public const int COMMA = 267; + public const int AT = 268; + public const int FUNCTION_NAME = 269; + public const int BRACKET_OPEN = 270; + public const int BRACKET_CLOSE = 271; + public const int PAREN_OPEN = 272; + public const int PAREN_CLOSE = 273; + public const int AND = 274; + public const int and = 275; + public const int OR = 276; + public const int or = 277; + public const int DIV = 278; + public const int div = 279; + public const int MOD = 280; + public const int mod = 281; + public const int PLUS = 282; + public const int MINUS = 283; + public const int ASTERISK = 284; + public const int DOLLAR = 285; + public const int BAR = 286; + public const int EQ = 287; + public const int NE = 288; + public const int LE = 290; + public const int GE = 292; + public const int LT = 294; + public const int GT = 295; + public const int ANCESTOR = 296; + public const int ancestor = 297; + public const int ANCESTOR_OR_SELF = 298; + public const int ATTRIBUTE = 300; + public const int attribute = 301; + public const int CHILD = 302; + public const int child = 303; + public const int DESCENDANT = 304; + public const int descendant = 305; + public const int DESCENDANT_OR_SELF = 306; + public const int FOLLOWING = 308; + public const int following = 309; + public const int FOLLOWING_SIBLING = 310; + public const int sibling = 311; + public const int NAMESPACE = 312; + public const int NameSpace = 313; + public const int PARENT = 314; + public const int parent = 315; + public const int PRECEDING = 316; + public const int preceding = 317; + public const int PRECEDING_SIBLING = 318; + public const int SELF = 320; + public const int self = 321; + public const int COMMENT = 322; + public const int comment = 323; + public const int TEXT = 324; + public const int text = 325; + public const int PROCESSING_INSTRUCTION = 326; + public const int NODE = 328; + public const int node = 329; + public const int MULTIPLY = 330; + public const int NUMBER = 331; + public const int LITERAL = 332; + public const int QName = 333; + public const int yyErrorCode = 256; + } + namespace yyParser { + using System; + /** thrown for irrecoverable syntax errors and stack overflow. + */ + public class yyException : System.Exception { + public yyException (string message) : base (message) { + } + } + + /** must be implemented by a scanner object to supply input to the parser. + */ + public interface yyInput { + /** move on to next token. + @return false if positioned beyond tokens. + @throws IOException on input error. + */ + bool advance (); // throws java.io.IOException; + /** classifies current token. + Should not be called if advance() returned false. + @return current %token or single character. + */ + int token (); + /** associated with current token. + Should not be called if advance() returned false. + @return value for token(). + */ + Object value (); + } + } +} // close outermost namespace, that MUST HAVE BEEN opened in the prolog diff --git a/mcs/class/System.XML/System.Xml.XPath/Parser.jay b/mcs/class/System.XML/System.Xml.XPath/Parser.jay index b4428300ec8..c48e64e8b72 100644 --- a/mcs/class/System.XML/System.Xml.XPath/Parser.jay +++ b/mcs/class/System.XML/System.Xml.XPath/Parser.jay @@ -228,7 +228,8 @@ PathExpr } | FilterExpr SLASH2 RelativeLocationPath { - $$ = new ExprSLASH2 ((Expression) $1, (NodeSet) $3); + NodeTest test = new NodeTypeTest (Axes.DescendantOrSelf, XPathNodeType.All); + $$ = new ExprSLASH (new ExprSLASH ((Expression) $1, test), (NodeSet) $3); } ; @@ -248,7 +249,8 @@ AbsoluteLocationPath } | SLASH2 RelativeLocationPath { - $$ = new ExprSLASH2 (new ExprRoot (), (NodeSet) $2); + NodeTest test = new NodeTypeTest (Axes.DescendantOrSelf, XPathNodeType.All); + $$ = new ExprSLASH (new ExprSLASH (new ExprRoot (), test), (NodeSet) $2); } ; @@ -260,7 +262,8 @@ RelativeLocationPath } | RelativeLocationPath SLASH2 Step { - $$ = new ExprSLASH2 ((NodeSet) $1, (NodeSet) $3); + NodeTest test = new NodeTypeTest (Axes.DescendantOrSelf, XPathNodeType.All); + $$ = new ExprSLASH (new ExprSLASH ((NodeSet) $1, test), (NodeSet) $3); } ; @@ -353,7 +356,7 @@ PrimaryExpr FunctionCall : FUNCTION_NAME PAREN_OPEN OptionalArgumentList PAREN_CLOSE { - $$ = ExprFunctionCall.Factory ((XmlQualifiedName) $1, (FunctionArguments) $3); + $$ = new ExprFunctionCall ((XmlQualifiedName) $1, (FunctionArguments) $3); } ; diff --git a/mcs/class/System.XML/System.Xml.XPath/XPathNavigator.cs b/mcs/class/System.XML/System.Xml.XPath/XPathNavigator.cs index a41c6ae164e..602171b7807 100644 --- a/mcs/class/System.XML/System.Xml.XPath/XPathNavigator.cs +++ b/mcs/class/System.XML/System.Xml.XPath/XPathNavigator.cs @@ -245,22 +245,6 @@ namespace System.Xml.XPath [MonoTODO] // optimize... public virtual bool Matches (XPathExpression expr) { - Expression e = ((CompiledExpression)expr).ExpressionNode; - - if (e is NodeTest) - return ((NodeTest)e).Match (((CompiledExpression)expr).NamespaceManager, this); - if (e is ExprFilter) { - do { - e = ((ExprFilter)e).LeftHandSide; - } while (e is ExprFilter); - - if (e is NodeTest && !((NodeTest)e).Match (((CompiledExpression)expr).NamespaceManager, this)) - return false; - } - - //e = ((CompiledExpression)expr).ExpressionNode; - //Console.WriteLine ("Didnt filter : " + e.GetType ().ToString () + " " + e.ToString ()); - XPathNodeIterator nodes = Select (expr); while (nodes.MoveNext ()) { diff --git a/mcs/class/System.XML/System.Xml.Xsl/ChangeLog b/mcs/class/System.XML/System.Xml.Xsl/ChangeLog index 75856565c25..07204aeda8d 100644 --- a/mcs/class/System.XML/System.Xml.Xsl/ChangeLog +++ b/mcs/class/System.XML/System.Xml.Xsl/ChangeLog @@ -1,41 +1,3 @@ -2003-08-30 Oleg Tkachenko <oleg@tkachenko.com> - * ManagedXslTransform.cs: Outputter/Emitter selection logic is moved - to GenericOutputter. - -2003-08-21 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * XslTransform.cs: commented out Cleanup () because of bug #47776. - -2003-08-21 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * Multiplexer.cs: fixed infinite recursion bug. - -2003-08-20 Ben Maurer <bmaurer@users.sourceforge.net> - - * ManagedXslTransform.cs: sync API (Oleg). - -2003-08-19 Ben Maurer <bmaurer@users.sourceforge.net> - - * ManagedXslTransform.cs: sync to API changes. - -2003-08-18 Ben Maurer <bmaurer@users.sourceforge.net> - - * ManagedXslTransform.cs, XslTransformImpl.cs: Add support for - encoding. - -2003-08-18 Ben Maurer <bmaurer@users.sourceforge.net> - - * *.cs: Support for xsl:output. (Oleg) - -2003-08-17 Ben Maurer <bmaurer@users.sourceforge.net> - - * XslTransformImpl.cs: close XmlTextWriter when we create it. - -2003-08-14 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp> - - * XslTransformImpl.cs, XslTransform.cs, Multiplexer.cs, - ManagedXslTransform.cs : Added Evidence args introduced in .NET 1.1. - 2003-08-11 Andreas Nahr <ClassDevelopment@A-SoftTech.com> * XsltCompileException.cs: Fixed/ Implemented rest diff --git a/mcs/class/System.XML/System.Xml.Xsl/ManagedXslTransform.cs b/mcs/class/System.XML/System.Xml.Xsl/ManagedXslTransform.cs index b6af67c7166..898e3681441 100644 --- a/mcs/class/System.XML/System.Xml.Xsl/ManagedXslTransform.cs +++ b/mcs/class/System.XML/System.Xml.Xsl/ManagedXslTransform.cs @@ -10,7 +10,6 @@ using System; using System.Collections; using System.IO; -using System.Security.Policy; using System.Text; using System.Xml.XPath; using Mono.Xml.Xsl; @@ -21,38 +20,14 @@ namespace System.Xml.Xsl { CompiledStylesheet s; - public override void Load (XPathNavigator stylesheet, XmlResolver resolver, Evidence evidence) + public override void Load (XPathNavigator stylesheet, XmlResolver resolver) { - s = new Compiler ().Compile (stylesheet, resolver, evidence); + s = new Compiler ().Compile (stylesheet, resolver); } public override void Transform (XPathNavigator input, XsltArgumentList args, XmlWriter output, XmlResolver resolver) { - Outputter outputter = new GenericOutputter(output, s.Outputs); - bool wroteStartDocument = false; - if (output.WriteState == WriteState.Start) { - outputter.WriteStartDocument (); - wroteStartDocument = true; - } - new XslTransformProcessor (s).Process (input, outputter, args, resolver); - if (wroteStartDocument) - outputter.WriteEndDocument (); - } - - public override void Transform (XPathNavigator input, XsltArgumentList args, TextWriter output, XmlResolver resolver) { - Outputter outputter = new GenericOutputter(output, s.Outputs); - outputter.WriteStartDocument(); - new XslTransformProcessor (s).Process (input, outputter, args, resolver); - outputter.WriteEndDocument(); - } - - public override void Transform (XPathNavigator input, XsltArgumentList args, Stream output, XmlResolver resolver) - { - XslOutput xslOutput = (XslOutput)s.Outputs[String.Empty]; - if (xslOutput == null) - Transform (input, args, new StreamWriter (output), resolver); - else - Transform (input, args, new StreamWriter (output, xslOutput.Encoding), resolver); + new XslTransformProcessor (s).Process (input, output, args, resolver); } } } diff --git a/mcs/class/System.XML/System.Xml.Xsl/Multiplexer.cs b/mcs/class/System.XML/System.Xml.Xsl/Multiplexer.cs index 41dcb5cf6fe..f2648f6db66 100644 --- a/mcs/class/System.XML/System.Xml.Xsl/Multiplexer.cs +++ b/mcs/class/System.XML/System.Xml.Xsl/Multiplexer.cs @@ -13,7 +13,6 @@ using System.Collections; using System.IO;
using System.Text;
using System.Runtime.InteropServices;
-using System.Security.Policy;
using System.Xml.XPath;
namespace System.Xml.Xsl {
@@ -76,7 +75,7 @@ namespace System.Xml.Xsl { public void Transform(XPathNavigator input, XsltArgumentList args, TextWriter output) { - impl.Transform (input, args, output, xmlResolver); + impl.Transform (input, args, new XmlTextWriter (output), xmlResolver); } public void Transform (string inputfile, string outputfile) @@ -96,81 +95,34 @@ namespace System.Xml.Xsl { impl.Load (url, resolver); } -#if NET_1_1
- [Obsolete("You should pass evidence.", false)]
-#endif
public void Load (XmlReader stylesheet) { - Load (stylesheet, null, null); + Load (stylesheet, null); } -#if NET_1_1
- [Obsolete("You should pass evidence.", false)]
-#endif
public void Load (XmlReader stylesheet, XmlResolver resolver) { - Load (stylesheet, resolver, null); + impl.Load (stylesheet, resolver); } -#if NET_1_1
- [Obsolete("You should pass evidence.", false)]
-#endif
public void Load (XPathNavigator stylesheet) { - Load (stylesheet, null, null); + Load (stylesheet, null); } -#if NET_1_1
- [Obsolete("You should pass evidence.", false)]
-#endif
public void Load (XPathNavigator stylesheet, XmlResolver resolver) { - Load (stylesheet, resolver, null); + impl.Load (stylesheet, resolver); } -#if NET_1_1
- [Obsolete("You should pass evidence.", false)]
-#endif
public void Load (IXPathNavigable stylesheet) { Load (stylesheet.CreateNavigator(), null); } -#if NET_1_1
- [Obsolete("You should pass evidence.", false)]
-#endif
public void Load (IXPathNavigable stylesheet, XmlResolver resolver) { Load (stylesheet.CreateNavigator(), resolver); } - - // Introduced in .NET 1.1 -#if NET_1_1 - public void Load (IXPathNavigable stylesheet, XmlResolver resolver, Evidence evidence) -#else - internal void Load (IXPathNavigable stylesheet, XmlResolver resolver, Evidence evidence) -#endif - { - impl.Load (stylesheet.CreateNavigator(), resolver, evidence); - } - -#if NET_1_1 - public void Load (XPathNavigator stylesheet, XmlResolver resolver, Evidence evidence) -#else - internal void Load (XPathNavigator stylesheet, XmlResolver resolver, Evidence evidence) -#endif - { - impl.Load (stylesheet, resolver, evidence); - } -
-#if NET_1_1
- public void Load (XmlReader stylesheet, XmlResolver resolver, Evidence evidence) -#else - internal void Load (XmlReader stylesheet, XmlResolver resolver, Evidence evidence) -#endif - { - impl.Load (stylesheet, resolver, null); - } - }
}
diff --git a/mcs/class/System.XML/System.Xml.Xsl/XslTransform.cs b/mcs/class/System.XML/System.Xml.Xsl/XslTransform.cs index 92e1406a666..a884d5f29da 100644 --- a/mcs/class/System.XML/System.Xml.Xsl/XslTransform.cs +++ b/mcs/class/System.XML/System.Xml.Xsl/XslTransform.cs @@ -14,7 +14,6 @@ using System;
using System.Collections;
using System.IO;
-using System.Security.Policy;
using System.Text;
using System.Runtime.InteropServices;
using System.Xml.XPath;
@@ -65,7 +64,7 @@ namespace System.Xml.Xsl throw new XmlException ("Error creating stylesheet");
} - public override void Load (XmlReader stylesheet, XmlResolver resolver, Evidence evidence) + public override void Load (XmlReader stylesheet, XmlResolver resolver) { FreeStylesheetIfNeeded (); // Create a document for the stylesheet @@ -83,7 +82,7 @@ namespace System.Xml.Xsl throw new XmlException ("Error creating stylesheet"); } - public override void Load (XPathNavigator stylesheet, XmlResolver resolver, Evidence evidence) + public override void Load (XPathNavigator stylesheet, XmlResolver resolver) { FreeStylesheetIfNeeded (); StringWriter sr = new UTF8StringWriter (); @@ -202,8 +201,8 @@ namespace System.Xml.Xsl static void Cleanup ()
{
- //xsltCleanupGlobals ();
- //xmlCleanupParser ();
+ xsltCleanupGlobals ();
+ xmlCleanupParser ();
}
static string GetStringFromDocument (IntPtr doc, IntPtr stylesheet)
@@ -279,10 +278,6 @@ namespace System.Xml.Xsl output.WriteRaw (writer.GetStringBuilder ().ToString ()); output.Flush (); } - public override void Transform (XPathNavigator input, XsltArgumentList args, TextWriter output, XmlResolver resolver) - { - Transform(input, args, new XmlTextWriter(output), resolver); - } public override void Transform(string inputfile, string outputfile, XmlResolver resolver) { diff --git a/mcs/class/System.XML/System.Xml.Xsl/XslTransformImpl.cs b/mcs/class/System.XML/System.Xml.Xsl/XslTransformImpl.cs index 3754792c092..d9f9573265e 100644 --- a/mcs/class/System.XML/System.Xml.Xsl/XslTransformImpl.cs +++ b/mcs/class/System.XML/System.Xml.Xsl/XslTransformImpl.cs @@ -10,7 +10,6 @@ using System; using System.Collections; using System.IO; -using System.Security.Policy; using System.Text; using System.Xml.XPath; @@ -20,27 +19,22 @@ namespace System.Xml.Xsl { public virtual void Load (string url, XmlResolver resolver) { - Load (new XPathDocument (url).CreateNavigator (), resolver, null); + Load (new XPathDocument (url).CreateNavigator (), resolver); } - public virtual void Load (XmlReader stylesheet, XmlResolver resolver, Evidence evidence) + public virtual void Load (XmlReader stylesheet, XmlResolver resolver) { - Load (new XPathDocument (stylesheet).CreateNavigator (), resolver, evidence); + Load (new XPathDocument (stylesheet).CreateNavigator (), resolver); } - public abstract void Load (XPathNavigator stylesheet, XmlResolver resolver, Evidence evidence); + public abstract void Load (XPathNavigator stylesheet, XmlResolver resolver); public abstract void Transform (XPathNavigator input, XsltArgumentList args, XmlWriter output, XmlResolver resolver); - public abstract void Transform (XPathNavigator input, XsltArgumentList args, TextWriter output, XmlResolver resolver); - public virtual void Transform (XPathNavigator input, XsltArgumentList args, Stream output, XmlResolver resolver) - { - Transform (input, args, new StreamWriter (output), resolver); - } public virtual void Transform (string inputfile, string outputfile, XmlResolver resolver) { - using (Stream s = new FileStream (outputfile, FileMode.Create, FileAccess.ReadWrite)) { - Transform(new XPathDocument (inputfile).CreateNavigator (), null, s, resolver); + using (FileStream fs = new FileStream (outputfile, FileMode.Create, FileAccess.ReadWrite)) { + Transform(new XPathDocument (inputfile).CreateNavigator (), null, new XmlTextWriter (fs, null), resolver); } } } diff --git a/mcs/class/System.XML/System.Xml.Xsl/XsltContext.cs b/mcs/class/System.XML/System.Xml.Xsl/XsltContext.cs index 1a1ec0d0dd1..b47822ae7a3 100644 --- a/mcs/class/System.XML/System.Xml.Xsl/XsltContext.cs +++ b/mcs/class/System.XML/System.Xml.Xsl/XsltContext.cs @@ -12,7 +12,13 @@ namespace System.Xml.Xsl public abstract class XsltContext : XmlNamespaceManager
{
#region Constructors
- public XsltContext () {}
+
+ // should this really be calling new NameTable() in the
+ // base() call?
+ public XsltContext ()
+ : base (new NameTable ())
+ {
+ }
public XsltContext (NameTable table)
: base (table)
diff --git a/mcs/class/System.XML/System.Xml.dll.sources b/mcs/class/System.XML/System.Xml.dll.sources index 97b02450cc3..29d7e1bd9c0 100755 --- a/mcs/class/System.XML/System.Xml.dll.sources +++ b/mcs/class/System.XML/System.Xml.dll.sources @@ -1,22 +1,14 @@ Assembly/AssemblyInfo.cs Assembly/Locale.cs -Mono.Xml.Schema/XsdParticleValidationState.cs -Mono.Xml.Schema/XsdValidatingReader.cs Mono.Xml.XPath/DTMXPathDocument.cs Mono.Xml.XPath/DTMXPathDocumentBuilder.cs Mono.Xml.XPath/DTMXPathNavigator.cs -Mono.Xml.XPath/IdPattern.cs -Mono.Xml.XPath/KeyPattern.cs -Mono.Xml.XPath/LocationPathPattern.cs -Mono.Xml.XPath/Pattern.cs -Mono.Xml.XPath/UnionPattern.cs Mono.Xml.Xsl.Operations/XslApplyImports.cs Mono.Xml.Xsl.Operations/XslApplyTemplates.cs Mono.Xml.Xsl.Operations/XslAttribute.cs Mono.Xml.Xsl.Operations/XslAvt.cs Mono.Xml.Xsl.Operations/XslCallTemplate.cs Mono.Xml.Xsl.Operations/XslChoose.cs -Mono.Xml.Xsl.Operations/XslComment.cs Mono.Xml.Xsl.Operations/XslCompiledElement.cs Mono.Xml.Xsl.Operations/XslCopy.cs Mono.Xml.Xsl.Operations/XslCopyOf.cs @@ -33,18 +25,10 @@ Mono.Xml.Xsl.Operations/XslTemplateContent.cs Mono.Xml.Xsl.Operations/XslText.cs Mono.Xml.Xsl.Operations/XslValueOf.cs Mono.Xml.Xsl.Operations/XslVariable.cs -Mono.Xml.Xsl/Attribute.cs Mono.Xml.Xsl/Compiler.cs Mono.Xml.Xsl/Debug.cs -Mono.Xml.Xsl/Emitter.cs -Mono.Xml.Xsl/GenericOutputter.cs Mono.Xml.Xsl/MSXslScriptManager.cs -Mono.Xml.Xsl/Outputter.cs -Mono.Xml.Xsl/TextEmitter.cs -Mono.Xml.Xsl/TextOutputter.cs -Mono.Xml.Xsl/XmlWriterEmitter.cs Mono.Xml.Xsl/XslAttributeSet.cs -Mono.Xml.Xsl/XslDecimalFormat.cs Mono.Xml.Xsl/XslKey.cs Mono.Xml.Xsl/XslOutput.cs Mono.Xml.Xsl/XslStylesheet.cs @@ -52,7 +36,6 @@ Mono.Xml.Xsl/XslTemplate.cs Mono.Xml.Xsl/XslTransformProcessor.cs Mono.Xml.Xsl/XsltCompiledContext.cs Mono.Xml/IHasXmlParserContext.cs -Mono.Xml/IHasXmlSchemaInfo.cs Mono.Xml/XmlNodeWriter.cs System.Xml/IHasXmlNode.cs System.Xml/DTDAutomata.cs @@ -228,8 +211,6 @@ System.Xml.Serialization/CodeIdentifiers.cs System.Xml.Serialization/IXmlSerializable.cs System.Xml.Serialization/ReflectionHelper.cs System.Xml.Serialization/SchemaTypes.cs -System.Xml.Serialization/SerializationCodeGenerator.cs -System.Xml.Serialization/SerializationCodeGeneratorConfiguration.cs System.Xml.Serialization/SoapAttributeAttribute.cs System.Xml.Serialization/SoapAttributeOverrides.cs System.Xml.Serialization/SoapAttributes.cs diff --git a/mcs/class/System.XML/System.Xml/ChangeLog b/mcs/class/System.XML/System.Xml/ChangeLog index 2efece026e0..68f30d3843c 100644 --- a/mcs/class/System.XML/System.Xml/ChangeLog +++ b/mcs/class/System.XML/System.Xml/ChangeLog @@ -1,78 +1,3 @@ -2003-09-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp> - - * XmlNamespaceManager.cs : GetEnumerator() should return all of the - available pairs (of prefix and namespace). - * XmlQualifiedName.cs : Quick fix for NullReferenceException in case - of name (or ns) is null. (The description of the immediate previous - changes will be inserted below.) - * XmlTextWriter.cs : Fixed WriteDocType(). Removed CheckValidName(). - * XmlUrlResolver.cs : Changed not to call WebClient.Dispose() which - will release resources it had allocated. - -2003-09-01 Ben Maurer <bmaurer@users.sourceforge.net> - - * XmlDocument.cs (Save): use the encoding of the document, if - available. - -2003-08-24 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp> - - * XmlValidatingReader.cs : Implemented SchemaType. Added support for - ValidationType.Schema. Added support for XmlResolver. Fixed - ReadTypedValue() not to consume EndElement. - -2003-08-19 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp> - - * XmlDocumentNavigator.cs : Fixed MoveToFirstNamespace() that arose - infinite loop. - * XmlNamespaceManager.cs : Renamed AtomStrEq to AtomicStringEquals. - Commented out Console.Error.WriteLine(). - * XmlUrlResolver.cs : Fixed ResolveUri() and GetEntity() to support - escape and unescape for relative URI string. - -2003-08-19 Ben Maurer <bmaurer@users.sourceforge.net> - - * XmlParserContext.cs: Make each context inherit next. - -2003-08-18 Ben Maurer <bmaurer@users.sourceforge.net> - - * XmlChar.cs (IsWhitespace): Spare enumerator allocation. - * XmlTextWriter.cs (WriteWhitespace): Enumerators are very high in - fat, use low-fat loops instead. Even better, call the function - inside XmlChar for code reuse. - * HighWaterStack.cs (added): New class that acts like a Stack, but - helps with memory allocation. - * XmlNamespaceManager.cs, XmlParserContext.cs: Rewrote to use - HighWaterStack. - * XmlTextReader.cs: Remove orderedAttributesEnumerator variable, - use a variable that stores the position in the ArrayList. - -2003-08-18 Ben Maurer <bmaurer@users.sourceforge.net> - - * XmlTextWriter.cs: Begin diet. String.Format has too much - saturated fat, lets replace with the fat-free .Write () - calls. Effects best seen when Paolo's StreamWriter patch is - applied. - -2003-08-14 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp> - - * XmlNodeReader.cs : Fixed ReadAttributeValue() that might result in - vanishing current node. - -2003-08-14 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp> - - * DTDValidatingReader.cs : Added SchemaType. - Read() Assures to return to element. - * DTDObjectModel.cs : Removed DTDEntityDeclaration.BaseURI. - * XmlReader.cs : ReadString() should be virtual in NET_1_1. - * XmlTextReader.cs : 1) Depth should consider Attribute and its values. - Introduced insideAttribute field to support them. - 2) ReadAttributeValue() should consider empty string. - * XmlValidatingReader.cs : - Fixed several properties which premised as if it was already read. - Encoding and Namespaces now throws NotSupportedException for other - than XmlTextReader. - Implemented ReadTypedValue() based on IHasXmlSchemaInfo.SchemaType. - 2003-08-10 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp> * XmlInputStream.cs : Reverted CanSeek as to return false anyway. diff --git a/mcs/class/System.XML/System.Xml/DTDObjectModel.cs b/mcs/class/System.XML/System.Xml/DTDObjectModel.cs index c1148eca533..1d0419cad4c 100644 --- a/mcs/class/System.XML/System.Xml/DTDObjectModel.cs +++ b/mcs/class/System.XML/System.Xml/DTDObjectModel.cs @@ -747,6 +747,7 @@ namespace Mono.Xml public string Name; public string PublicId; public string SystemId; + public string BaseURI; public string LiteralValue; public bool LoadFailed; diff --git a/mcs/class/System.XML/System.Xml/DTDValidatingReader.cs b/mcs/class/System.XML/System.Xml/DTDValidatingReader.cs index 23e27df9f84..c4d5520637d 100644 --- a/mcs/class/System.XML/System.Xml/DTDValidatingReader.cs +++ b/mcs/class/System.XML/System.Xml/DTDValidatingReader.cs @@ -8,7 +8,7 @@ using System.Xml.Schema; namespace Mono.Xml { - public class DTDValidatingReader : XmlReader, IXmlLineInfo, IHasXmlParserContext, IHasXmlSchemaInfo + public class DTDValidatingReader : XmlReader, IXmlLineInfo, IHasXmlParserContext { public DTDValidatingReader (XmlReader reader) : this (reader, null) @@ -520,7 +520,6 @@ namespace Mono.Xml } break; } - MoveToElement (); return true; } @@ -969,16 +968,6 @@ namespace Mono.Xml } } - public object SchemaType { - get { - if (currentElement == null) - return null; - DTDAttributeDefinition def = - DTD.AttListDecls [currentElement] [currentAttribute]; - return def.Datatype; - } - } - char [] whitespaceChars = new char [] {' '}; private string FilterNormalization (string attrName, string rawValue) { diff --git a/mcs/class/System.XML/System.Xml/NameTable.cs b/mcs/class/System.XML/System.Xml/NameTable.cs index 52e1bcde202..d4bc31e73c0 100755 --- a/mcs/class/System.XML/System.Xml/NameTable.cs +++ b/mcs/class/System.XML/System.Xml/NameTable.cs @@ -66,14 +66,11 @@ namespace System.Xml { public override string Add (string key) { - if (key == null) throw new ArgumentNullException ("key"); - - int keyLen = key.Length; - if (keyLen == 0) return String.Empty; + if (key == String.Empty) return String.Empty; int h = 0; // This is from the String.Gethash () icall - for (int i = 0; i < keyLen; i++) + for (int i = 0; i < key.Length; i++) h = (h << 5) - h + key [i]; // h must be be >= 0 @@ -111,14 +108,11 @@ namespace System.Xml { } public override string Get (string value) { - if (value == null) throw new ArgumentNullException ("value"); - - int valLen = value.Length; - if (valLen == 0) return String.Empty; - + if (value == String.Empty) return value; + int h = 0; // This is from the String.Gethash () icall - for (int i = 0; i < valLen; i++) + for (int i = 0; i < value.Length; i++) h = (h << 5) - h + value [i]; // h must be be >= 0 h &= 0x7FFFFFFF; diff --git a/mcs/class/System.XML/System.Xml/XmlChar.cs b/mcs/class/System.XML/System.Xml/XmlChar.cs index faf6ef8b245..52bb5537fbd 100644 --- a/mcs/class/System.XML/System.Xml/XmlChar.cs +++ b/mcs/class/System.XML/System.Xml/XmlChar.cs @@ -19,9 +19,9 @@ namespace System.Xml internal static bool IsWhitespace (string str)
{
- for (int i = 0; i < str.Length; i++) - if (!IsWhitespace (str [i])) return false; -
+ foreach (char c in str)
+ if (!IsWhitespace (c))
+ return false;
return true;
}
diff --git a/mcs/class/System.XML/System.Xml/XmlDocument.cs b/mcs/class/System.XML/System.Xml/XmlDocument.cs index 54fcf9b2526..383cc3fd580 100644 --- a/mcs/class/System.XML/System.Xml/XmlDocument.cs +++ b/mcs/class/System.XML/System.Xml/XmlDocument.cs @@ -193,17 +193,6 @@ namespace System.Xml return XmlSpace.None; } } - - internal Encoding TextEncoding { - get { - XmlDeclaration dec = FirstChild as XmlDeclaration; - - if (dec == null || dec.Encoding == "") - return null; - - return Encoding.GetEncoding (dec.Encoding); - } - } #endregion @@ -883,7 +872,7 @@ namespace System.Xml public virtual void Save(Stream outStream) { - XmlTextWriter xmlWriter = new XmlTextWriter (outStream, TextEncoding); + XmlTextWriter xmlWriter = new XmlTextWriter (outStream, Encoding.UTF8); xmlWriter.Formatting = Formatting.Indented; WriteContentTo (xmlWriter); xmlWriter.Close (); @@ -891,7 +880,7 @@ namespace System.Xml public virtual void Save (string filename) { - XmlTextWriter xmlWriter = new XmlTextWriter (filename, TextEncoding); + XmlTextWriter xmlWriter = new XmlTextWriter (filename, Encoding.UTF8); xmlWriter.Formatting = Formatting.Indented; WriteContentTo (xmlWriter); xmlWriter.Close (); diff --git a/mcs/class/System.XML/System.Xml/XmlDocumentNavigator.cs b/mcs/class/System.XML/System.Xml/XmlDocumentNavigator.cs index 71799f35173..aa2dff117bc 100644 --- a/mcs/class/System.XML/System.Xml/XmlDocumentNavigator.cs +++ b/mcs/class/System.XML/System.Xml/XmlDocumentNavigator.cs @@ -300,7 +300,7 @@ namespace System.Xml } if (namespaceScope == XPathNamespaceScope.Local) return false; - el = el.ParentNode as XmlElement; + el = node.ParentNode as XmlElement; } while (el != null); } diff --git a/mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs b/mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs index 9026a9a5f72..3f9dc1be3cf 100644 --- a/mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs +++ b/mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs @@ -24,7 +24,6 @@ namespace System.Xml #region Constructor - internal XmlNamespaceManager () {} public XmlNamespaceManager (XmlNameTable nameTable) { this.nameTable = nameTable; @@ -37,7 +36,6 @@ namespace System.Xml PushScope (); currentScope.Namespaces = new Hashtable (); - currentScope.Namespaces.Add ("", ""); currentScope.Namespaces.Add ("xml", XmlnsXml); currentScope.Namespaces.Add ("xmlns", XmlnsXmlns); } @@ -95,29 +93,10 @@ namespace System.Xml public virtual IEnumerator GetEnumerator () { - /* if (currentScope.Namespaces == null) currentScope.Namespaces = new Hashtable (); return currentScope.Namespaces.Keys.GetEnumerator (); - */ - - // In fact it returns such table's enumerator that contains all the namespaces. - // while HasNamespace() ignores pushed namespaces. - Hashtable ht = new Hashtable (); - NamespaceScope scope = currentScope; - - while (scope != null) { - if (scope.Namespaces != null) { - IEnumerator e = scope.Namespaces.Keys.GetEnumerator (); - while (e.MoveNext ()) { - if (!ht.ContainsKey (e.Current)) - ht.Add (e.Current, scope.Namespaces [e.Current]); - } - } - scope = scope.Next; - } - return ht.Keys.GetEnumerator (); } public virtual bool HasNamespace (string prefix) diff --git a/mcs/class/System.XML/System.Xml/XmlNodeReader.cs b/mcs/class/System.XML/System.Xml/XmlNodeReader.cs index f77a2875e10..6336174eece 100755 --- a/mcs/class/System.XML/System.Xml/XmlNodeReader.cs +++ b/mcs/class/System.XML/System.Xml/XmlNodeReader.cs @@ -276,10 +276,7 @@ namespace System.Xml if (current == null) return String.Empty; - if (current.NodeType == XmlNodeType.Attribute) - return current.Prefix != String.Empty ? current.Prefix : null; - else - return current.Prefix; + return current.Prefix; } } @@ -784,10 +781,8 @@ namespace System.Xml } if (current.NodeType == XmlNodeType.Attribute) { - if (current.FirstChild == null) - return false; current = current.FirstChild; - return true; + return current != null; } else if (current.ParentNode.NodeType == XmlNodeType.Attribute) { if (current.NextSibling == null) return false; diff --git a/mcs/class/System.XML/System.Xml/XmlParserInput.cs b/mcs/class/System.XML/System.Xml/XmlParserInput.cs index df3dd42973c..b5b5da741bd 100644 --- a/mcs/class/System.XML/System.Xml/XmlParserInput.cs +++ b/mcs/class/System.XML/System.Xml/XmlParserInput.cs @@ -69,12 +69,11 @@ namespace Mono.Xml.Native public void InsertParameterEntityBuffer (string value) { this.peBuffer.Insert (0, ' ' + value + ' '); - peStored = true; } public int PeekChar () { - if (peStored) + if (peBuffer.Length > 0) return peBuffer [0]; if (can_seek) @@ -92,10 +91,9 @@ namespace Mono.Xml.Native { int ch; - if (peStored) { + if (peBuffer.Length > 0) { ch = peBuffer [0]; peBuffer.Remove (0, 1); - peStored = peBuffer.Length > 0; // I decided not to add character to currentTag with respect to PERef value return ch; } @@ -130,7 +128,7 @@ namespace Mono.Xml.Native private char [] wsChars = new char [] {' ', '\r', '\n', '\t'}; public bool HasPEBuffer { get { - if (!peStored) + if (peBuffer.Length == 0) return false; else if (peBuffer.ToString ().Trim (wsChars).Length == 0) return false; @@ -196,7 +194,6 @@ namespace Mono.Xml.Native int parsedValueEnd; StringBuilder peBuffer = new StringBuilder (); string baseURI; - bool peStored = false; private int ParseCharReference (string name) { diff --git a/mcs/class/System.XML/System.Xml/XmlQualifiedName.cs b/mcs/class/System.XML/System.Xml/XmlQualifiedName.cs index b689ef74767..838ed82242a 100644 --- a/mcs/class/System.XML/System.Xml/XmlQualifiedName.cs +++ b/mcs/class/System.XML/System.Xml/XmlQualifiedName.cs @@ -30,20 +30,21 @@ namespace System.Xml { this.name = (name == null) ? "" : name; this.ns = (ns == null) ? "" : ns; - this.hash = this.name.GetHashCode () ^ this.ns.GetHashCode (); } // Fields public static readonly XmlQualifiedName Empty = new XmlQualifiedName (); private readonly string name; private readonly string ns; - private readonly int hash; // Properties public bool IsEmpty { get { - return name.Length == 0 && ns.Length == 0; + if ((name == String.Empty) && (ns == String.Empty)) + return true; + else + return false; } } @@ -60,12 +61,18 @@ namespace System.Xml // Methods public override bool Equals (object other) { - return this == (other as XmlQualifiedName); + if(!(other is XmlQualifiedName)) + return false; + + if ((XmlQualifiedName) this == (XmlQualifiedName) other) + return true; + else + return false; } public override int GetHashCode () { - return hash; + return unchecked (name.GetHashCode () + ns.GetHashCode ()); } public override string ToString () @@ -93,7 +100,10 @@ namespace System.Xml if((Object)a == null || (Object)b == null) return false; - return (a.hash == b.hash) && (a.name == b.name) && (a.ns == b.ns); + if ((a.Name == b.Name) && (a.Namespace == b.Namespace)) + return true; + else + return false; } public static bool operator != (XmlQualifiedName a, XmlQualifiedName b) diff --git a/mcs/class/System.XML/System.Xml/XmlReader.cs b/mcs/class/System.XML/System.Xml/XmlReader.cs index acfa455ccfb..b7cbf7368ce 100644 --- a/mcs/class/System.XML/System.Xml/XmlReader.cs +++ b/mcs/class/System.XML/System.Xml/XmlReader.cs @@ -397,14 +397,7 @@ namespace System.Xml Read (); } -#if NET_1_0 public abstract string ReadString (); -#else - public virtual string ReadString () - { - return ReadStringInternal (); - } -#endif internal string ReadStringInternal () { diff --git a/mcs/class/System.XML/System.Xml/XmlTextReader.cs b/mcs/class/System.XML/System.Xml/XmlTextReader.cs index 4fd2f05cf27..8c16f275b2e 100644 --- a/mcs/class/System.XML/System.Xml/XmlTextReader.cs +++ b/mcs/class/System.XML/System.Xml/XmlTextReader.cs @@ -16,9 +16,6 @@ // Some thought needs to be given to performance. There's too many // strings being allocated. // -// If current node is on an Attribute, Prefix might be null, and -// in several fields which uses XmlReader, it should be considered. -// using System; using System.Collections; @@ -102,6 +99,7 @@ namespace System.Xml { } + [MonoTODO("TODO as same as private XmlTextReader(TextReader, XmlNodeType, XmlParserContext)")] public XmlTextReader (string xmlFragment, XmlNodeType fragType, XmlParserContext context) : this (context != null ? context.BaseURI : String.Empty, new StringReader (xmlFragment), @@ -110,6 +108,8 @@ namespace System.Xml { } + // TODO still remains as described at head of this file, + // but it might not be TODO of the constructors... XmlTextReader (string url, TextReader fragment, XmlNodeType fragType, XmlParserContext context) { InitializeContext (url, context, fragment, fragType); @@ -132,10 +132,6 @@ namespace System.Xml public override int Depth { get { - if (NodeType == XmlNodeType.Attribute) - return elementDepth + 1; - else if (insideAttribute) - return elementDepth + 2; // inside attribute value. return elementDepth; } } @@ -390,11 +386,13 @@ namespace System.Xml if (attributes == null || orderedAttributes.Count < i || i < 0) throw new ArgumentOutOfRangeException ("attribute index out of range."); - if (orderedAttributesPos == -1) { + if (orderedAttributesEnumerator == null) { SaveProperties (); } - orderedAttributesPos = i; + orderedAttributesEnumerator = orderedAttributes.GetEnumerator (); + for (int n=0; n<=i; n++) + orderedAttributesEnumerator.MoveNext(); string name = orderedAttributes [i] as string; string value = attributes [name] as string; @@ -405,7 +403,6 @@ namespace System.Xml value, // value false // clearAttributes ); - insideAttribute = true; attributeValuePos = 0; } @@ -417,15 +414,17 @@ namespace System.Xml if (attributes == null) return false; - if (orderedAttributesPos == -1) { + if (orderedAttributesEnumerator == null) { SaveProperties (); } - for (orderedAttributesPos = 0; orderedAttributesPos < orderedAttributes.Count; orderedAttributesPos++) - if (name == orderedAttributes [orderedAttributesPos] as string) { + orderedAttributesEnumerator = orderedAttributes.GetEnumerator (); + while (orderedAttributesEnumerator.MoveNext ()) { + if(name == orderedAttributesEnumerator.Current as string) { match = true; break; } + } if (match) { string value = attributes [name] as string; @@ -436,7 +435,6 @@ namespace System.Xml value, // value false // clearAttributes ); - insideAttribute = true; attributeValuePos = 0; } @@ -459,11 +457,10 @@ namespace System.Xml public override bool MoveToElement () { - if (orderedAttributesPos != -1) { - orderedAttributesPos = -1; + if (orderedAttributesEnumerator != null) { + orderedAttributesEnumerator = null; if (isPropertySaved) RestoreProperties (); - insideAttribute = false; return true; } @@ -481,12 +478,13 @@ namespace System.Xml if (attributes == null) return false; - if (orderedAttributesPos == -1) + if (orderedAttributesEnumerator == null) { SaveProperties (); + orderedAttributesEnumerator = orderedAttributes.GetEnumerator (); + } - - if (++orderedAttributesPos < orderedAttributes.Count) { - string name = orderedAttributes [orderedAttributesPos] as string; + if (orderedAttributesEnumerator.MoveNext ()) { + string name = orderedAttributesEnumerator.Current as string; string value = attributes [name] as string; SetProperties ( XmlNodeType.Attribute, // nodeType @@ -495,7 +493,6 @@ namespace System.Xml value, // value false // clearAttributes ); - insideAttribute = true; attributeValuePos = 0; return true; } @@ -508,7 +505,6 @@ namespace System.Xml bool more = false; isPropertySaved = false; readState = ReadState.Interactive; - insideAttribute = false; // It was moved from end of ReadStartTag (). if (depthUp) @@ -523,7 +519,7 @@ namespace System.Xml maybeTextDecl--; if (!more && startNodeType == XmlNodeType.Document && currentState != XmlNodeType.EndElement) - throw new XmlException ("Document element did not appear."); + throw new XmlException ("Document element was not appeared."); return more; } @@ -547,20 +543,9 @@ namespace System.Xml return false; // If not started, then initialize attributeString when parsing is at start. - if (attributeValuePos == 0) { + if (attributeValuePos == 0) attributeString = value.Substring (1, value.Length - 2); - // If it has an empty value, this method still returns true. - if (attributeString.Length == 0) { - attributeValuePos = -1; - SetProperties (XmlNodeType.Text, - "", - false, - "", - false); - return true; - } - } // It occurs when attribute dully consists of entity reference. if (attributeValuePos == attributeString.Length) @@ -764,8 +749,6 @@ namespace System.Xml private StringBuilder valueBuilder; private bool valueBuilderAvailable = false; - private bool insideAttribute; - private bool isPropertySaved; private XmlNodeType saveNodeType; private string saveName; @@ -776,7 +759,7 @@ namespace System.Xml private Hashtable attributes; private ArrayList orderedAttributes; - private int orderedAttributesPos = -1; + private IEnumerator orderedAttributesEnumerator; private bool returnEntityReference; private string entityReferenceName; @@ -797,7 +780,6 @@ namespace System.Xml private string attributeString; private int attributeValuePos; - // This should be only referenced(used) by ReadInnerXml(). Kind of flyweight pattern. private StringBuilder innerXmlBuilder; @@ -844,7 +826,7 @@ namespace System.Xml attributes = new Hashtable (); attributeString = String.Empty; orderedAttributes = new ArrayList (); - orderedAttributesPos = -1; + orderedAttributesEnumerator = null; returnEntityReference = false; entityReferenceName = String.Empty; @@ -922,7 +904,6 @@ namespace System.Xml if (indexOfColon == -1) { prefix = String.Empty; -// prefix = nodeType == XmlNodeType.Attribute ? null : String.Empty; localName = name; } else { prefix = name.Substring (0, indexOfColon); @@ -936,7 +917,6 @@ namespace System.Xml switch (nodeType) { case XmlNodeType.Attribute: if (prefix == string.Empty) namespaceURI = string.Empty; -// if (prefix == string.Empty || prefix == null) namespaceURI = string.Empty; else namespaceURI = LookupNamespace (prefix); if (localName == "xmlns" && prefix == "") namespaceURI = "http://www.w3.org/2000/xmlns/"; @@ -1007,7 +987,7 @@ namespace System.Xml orderedAttributes.Clear (); } - orderedAttributesPos = -1; + orderedAttributesEnumerator = null; } private int PeekChar () diff --git a/mcs/class/System.XML/System.Xml/XmlTextWriter.cs b/mcs/class/System.XML/System.Xml/XmlTextWriter.cs index 831f2b64d8c..d4a5c7e3d6a 100644 --- a/mcs/class/System.XML/System.Xml/XmlTextWriter.cs +++ b/mcs/class/System.XML/System.Xml/XmlTextWriter.cs @@ -345,10 +345,8 @@ namespace System.Xml CheckState (); CloseStartElement (); - - w.Write ("<![CDATA["); - w.Write (text); - w.Write ("]]>"); + + w.Write("<![CDATA[{0}]]>", text); } public override void WriteCharEntity (char ch) @@ -378,9 +376,7 @@ namespace System.Xml CheckState (); CloseStartElement (); - w.Write ("<!--"); - w.Write (text); - w.Write ("-->"); + w.Write ("<!--{0}-->", text); } public override void WriteDocType (string name, string pubid, string sysid, string subset) @@ -391,27 +387,14 @@ namespace System.Xml w.Write ("<!DOCTYPE "); w.Write (name); if (pubid != null) { - w.Write (" PUBLIC "); - w.Write (quoteChar); - w.Write (pubid); - w.Write (quoteChar); - w.Write (' '); - w.Write (quoteChar); - w.Write (sysid); - w.Write (quoteChar); + w.Write (String.Format (" PUBLIC {0}{1}{0} {0}{2}{0}", quoteChar, pubid, sysid)); } else if (sysid != null) { - w.Write (" SYSTEM "); - w.Write (quoteChar); - w.Write (sysid); - w.Write (quoteChar); + w.Write (String.Format (" SYSTEM {0}{1}{0}", quoteChar, sysid)); } - if (subset != null) { - w.Write ('['); - w.Write (subset); - w.Write (']'); - } - + if (subset != null) + w.Write ("[" + subset + "]"); + w.Write('>'); } @@ -435,7 +418,7 @@ namespace System.Xml ((XmlTextWriterOpenElement)openElements.Peek()).XmlSpace = xmlSpace; } - w.Write (quoteChar); + w.Write ("{0}", quoteChar); openAttribute = false; @@ -477,20 +460,15 @@ namespace System.Xml if (openStartElement) { if (openAttribute) WriteEndAttribute (); - if (fullEndElement) { - w.Write ("></"); - w.Write (((XmlTextWriterOpenElement)openElements.Peek ()).Name); - w.Write ('>'); - } else + if (fullEndElement) + w.Write ("></{0}>", ((XmlTextWriterOpenElement)openElements.Peek ()).Name); + else w.Write (" />"); openElements.Pop (); openStartElement = false; } else { - w.Write (indentFormatting); - w.Write ("</"); - w.Write (openElements.Pop ()); - w.Write ('>'); + w.Write ("{0}</{1}>", indentFormatting, openElements.Pop ()); } namespaceManager.PopScope(); @@ -508,19 +486,27 @@ namespace System.Xml WriteEndElementInternal (true); } - public override void WriteName (string name) + private void CheckValidName (string name, bool firstOnlyLetter) { - if (!XmlChar.IsName (name)) + if (firstOnlyLetter && !XmlConstructs.IsNameStart (name [0])) throw new ArgumentException ("There is an invalid character: '" + name [0] + "'", "name"); + foreach (char c in name) { + if (!XmlConstructs.IsName (c)) + throw new ArgumentException ("There is an invalid character: '" + c + + "'", "name"); + } + } + + public override void WriteName (string name) + { + CheckValidName (name, true); w.Write (name); } public override void WriteNmToken (string name) { - if (!XmlChar.IsNmToken (name)) - throw new ArgumentException ("There is an invalid character: '" + name [0] + - "'", "name"); + CheckValidName (name, false); w.Write (name); } @@ -533,14 +519,10 @@ namespace System.Xml CheckState (); CloseStartElement (); - w.Write (indentFormatting); - w.Write ("<?"); - w.Write (name); - w.Write (' '); - w.Write (text); - w.Write ("?>"); + w.Write ("{0}<?{1} {2}?>", indentFormatting, name, text); } + [MonoTODO] public override void WriteQualifiedName (string localName, string ns) { if (localName == null || localName == String.Empty) @@ -550,9 +532,8 @@ namespace System.Xml if (!openAttribute) CloseStartElement (); - w.Write (namespaceManager.LookupPrefix (ns)); - w.Write (':'); - w.Write (localName); + string prefix = namespaceManager.LookupPrefix (ns); + w.Write ("{0}:{1}", prefix, localName); } public override void WriteRaw (string data) @@ -624,11 +605,7 @@ namespace System.Xml // writtenAttributes.Contains (formatPrefix + localName)) // return; - w.Write (formatSpace); - w.Write (formatPrefix); - w.Write (localName); - w.Write ('='); - w.Write (quoteChar); + w.Write ("{0}{1}{2}={3}", formatSpace, formatPrefix, localName, quoteChar); if (checkMultipleAttributes) writtenAttributes.Add (formatPrefix + localName, formatPrefix + localName); @@ -705,16 +682,16 @@ namespace System.Xml if (prefix == null) prefix = String.Empty; - string formatName = localName; + string formatPrefix = ""; - if (ns != null && prefix != String.Empty) - formatName = prefix + ":" + localName; - - w.Write (indentFormatting); - w.Write ('<'); - w.Write (formatName); + if(ns != null) { + if (prefix != String.Empty) + formatPrefix = prefix + ":"; + } - openElements.Push (new XmlTextWriterOpenElement (formatName)); + w.Write ("{0}<{1}{2}", indentFormatting, formatPrefix, localName); + + openElements.Push (new XmlTextWriterOpenElement (formatPrefix + localName)); ws = WriteState.Element; openStartElement = true; openElementNS = ns; @@ -812,8 +789,10 @@ namespace System.Xml public override void WriteWhitespace (string ws) { - if (!XmlChar.IsWhitespace (ws)) - throw new ArgumentException ("Invalid Whitespace"); + foreach (char c in ws) { + if ((c != ' ') && (c != '\t') && (c != '\r') && (c != '\n')) + throw new ArgumentException (); + } CheckState (); diff --git a/mcs/class/System.XML/System.Xml/XmlUrlResolver.cs b/mcs/class/System.XML/System.Xml/XmlUrlResolver.cs index 42569949aa9..1bd2dedb340 100755 --- a/mcs/class/System.XML/System.Xml/XmlUrlResolver.cs +++ b/mcs/class/System.XML/System.Xml/XmlUrlResolver.cs @@ -39,21 +39,21 @@ namespace System.Xml }
// Methods
- [MonoTODO("Uri must be absolute.")]
+ [MonoTODO("Use Credentials; Uri must be absolute.")]
public override object GetEntity (Uri absoluteUri, string role, Type ofObjectToReturn)
{
if (absoluteUri.Scheme == "file")
- return new FileStream (UnescapeRelativeUriBody (absoluteUri.LocalPath), FileMode.Open, FileAccess.Read, FileShare.Read);
+ return new FileStream (absoluteUri.LocalPath, FileMode.Open, FileAccess.Read, FileShare.Read);
// (MS documentation says) parameter role isn't used yet.
Stream s = null;
using (s) {
WebClient wc = new WebClient ();
- wc.Credentials = credential;
+// wc.Credentials = credential;
s = wc.OpenRead (absoluteUri.ToString ());
if (s.GetType ().IsSubclassOf (ofObjectToReturn))
return s;
-// wc.Dispose ();
+ wc.Dispose ();
}
return null;
}
@@ -71,31 +71,17 @@ namespace System.Xml // extraneous "/a" is required because current Uri stuff
// seems ignorant of difference between "." and "./".
// I'd be appleciate if it is fixed with better solution.
- return new Uri (new Uri (Path.GetFullPath ("./a")), EscapeRelativeUriBody (relativeUri));
+ return new Uri (new Uri (Path.GetFullPath ("./a")), relativeUri);
}
+ // Do not expect relativeUri.Length > 2.
+// if (relativeUri.IndexOf ("://") >= 0)
+// return new Uri (relativeUri);
+
if (relativeUri == null)
return baseUri;
- return new Uri (baseUri, EscapeRelativeUriBody (relativeUri));
- }
-
- private string EscapeRelativeUriBody (string src)
- {
- return src.Replace ("<", "%3C")
- .Replace (">", "%3E")
- .Replace ("#", "%23")
- .Replace ("%", "%25")
- .Replace ("\"", "%22");
- }
-
- private string UnescapeRelativeUriBody (string src)
- {
- return src.Replace ("%3C", "<")
- .Replace ("%3E", ">")
- .Replace ("%23", "#")
- .Replace ("%25", "%")
- .Replace ("%22", "\"");
+ return new Uri (baseUri, relativeUri);
}
}
}
diff --git a/mcs/class/System.XML/System.Xml/XmlValidatingReader.cs b/mcs/class/System.XML/System.Xml/XmlValidatingReader.cs index c31cfd1e21d..d800d0e1be6 100644 --- a/mcs/class/System.XML/System.Xml/XmlValidatingReader.cs +++ b/mcs/class/System.XML/System.Xml/XmlValidatingReader.cs @@ -21,28 +21,24 @@ namespace System.Xml { EntityHandling entityHandling; XmlReader sourceReader; - XmlTextReader xmlTextReader; XmlReader validatingReader; XmlResolver resolver; - bool specifiedResolver; ValidationType validationType; XmlSchemaCollection schemas; DTDValidatingReader dtdReader; - IHasXmlSchemaInfo schemaInfo; - StringBuilder storedCharacters; #endregion // Fields #region Constructors + [MonoTODO] public XmlValidatingReader (XmlReader reader) + : base () { this.sourceReader = reader; - this.xmlTextReader = reader as XmlTextReader; entityHandling = EntityHandling.ExpandEntities; validationType = ValidationType.Auto; schemas = new XmlSchemaCollection (); - storedCharacters = new StringBuilder (); } public XmlValidatingReader (Stream xmlFragment, XmlNodeType fragType, XmlParserContext context) @@ -60,29 +56,27 @@ namespace System.Xml { #region Properties public override int AttributeCount { + [MonoTODO] get { return validatingReader == null ? 0 : validatingReader.AttributeCount; } } public override string BaseURI { + [MonoTODO] get { return validatingReader == null ? sourceReader.BaseURI : validatingReader.BaseURI; } } - // This property for this class always return true. public override bool CanResolveEntity { - get { return true; } + get { return validatingReader == null ? false : validatingReader.CanResolveEntity; } } public override int Depth { + [MonoTODO] get { return validatingReader == null ? 0 : validatingReader.Depth; } } public Encoding Encoding { - get { - if (xmlTextReader != null) - return xmlTextReader.Encoding; - else - throw new NotSupportedException ("Encoding is supported only for XmlTextReader."); - } + [MonoTODO] + get { throw new NotImplementedException (); } } public EntityHandling EntityHandling { @@ -91,35 +85,38 @@ namespace System.Xml { } public override bool EOF { + [MonoTODO] get { return validatingReader == null ? false : validatingReader.EOF; } } public override bool HasValue { + [MonoTODO] get { return validatingReader == null ? false : validatingReader.HasValue; } } public override bool IsDefault { + [MonoTODO] get { return validatingReader == null ? false : validatingReader.IsDefault; } } public override bool IsEmptyElement { + [MonoTODO] get { return validatingReader == null ? false : validatingReader.IsEmptyElement; } } public override string this [int i] { - get { - if (validatingReader == null) - throw new IndexOutOfRangeException ("Reader is not started."); - return validatingReader [i]; - } + [MonoTODO] + get { return validatingReader [i]; } } public override string this [string name] { - get { return validatingReader == null ? null : validatingReader [name]; } + [MonoTODO] + get { return validatingReader == null ? String.Empty : validatingReader [name]; } } public override string this [string localName, string namespaceName] { - get { return validatingReader == null ? null : validatingReader [localName, namespaceName]; } + [MonoTODO] + get { return validatingReader == null ? String.Empty : validatingReader [localName, namespaceName]; } } int IXmlLineInfo.LineNumber { @@ -137,73 +134,66 @@ namespace System.Xml { } public override string LocalName { - get { - if (validatingReader == null) - return String.Empty; - else if (Namespaces) - return validatingReader.LocalName; - else - return validatingReader.Name; - } + [MonoTODO] + get { return validatingReader == null ? String.Empty : validatingReader.LocalName; } } public override string Name { + [MonoTODO] get { return validatingReader == null ? String.Empty : validatingReader.Name; } } + [MonoTODO] public bool Namespaces { get { - if (xmlTextReader != null) - return xmlTextReader.Namespaces; + XmlTextReader xtr = sourceReader as XmlTextReader; + if (xtr != null) + return xtr.Namespaces; else - return true; + throw new NotImplementedException (); } set { - if (ReadState != ReadState.Initial) - throw new InvalidOperationException ("Namespaces have to be set before reading."); - - if (xmlTextReader != null) - xmlTextReader.Namespaces = value; + XmlTextReader xtr = sourceReader as XmlTextReader; + if (xtr != null) + xtr.Namespaces = value; else - throw new NotSupportedException ("Property 'Namespaces' is supported only for XmlTextReader."); + throw new NotImplementedException (); } } public override string NamespaceURI { - get { - if (validatingReader == null) - return String.Empty; - else if (Namespaces) - return validatingReader.NamespaceURI; - else - return String.Empty; - } + [MonoTODO] + get { return validatingReader == null ? String.Empty : validatingReader.NamespaceURI; } } public override XmlNameTable NameTable { - get { return validatingReader == null ? sourceReader.NameTable : validatingReader.NameTable; } + [MonoTODO] + get { return validatingReader == null ? null : validatingReader.NameTable; } } public override XmlNodeType NodeType { + [MonoTODO] get { return validatingReader == null ? XmlNodeType.None : validatingReader.NodeType; } } - public override string Prefix { + public override string Prefix { [MonoTODO] get { return validatingReader == null ? String.Empty : validatingReader.Prefix; } } public override char QuoteChar { - get { return validatingReader == null ? sourceReader.QuoteChar : validatingReader.QuoteChar; } + [MonoTODO] + get { return validatingReader == null ? '"' : validatingReader.QuoteChar; } } + [MonoTODO ("confirm which reader should be returned.")] public XmlReader Reader { get { return sourceReader; } } public override ReadState ReadState { [MonoTODO] - get { + get { if (validatingReader == null) return ReadState.Initial; return validatingReader.ReadState; @@ -215,7 +205,8 @@ namespace System.Xml { } public object SchemaType { - get { return schemaInfo.SchemaType; } + [MonoTODO] + get { throw new NotImplementedException (); } } [MonoTODO] @@ -228,9 +219,9 @@ namespace System.Xml { case ValidationType.Auto: case ValidationType.DTD: case ValidationType.None: - case ValidationType.Schema: validationType = value; break; + case ValidationType.Schema: case ValidationType.XDR: throw new NotImplementedException (); } @@ -238,23 +229,25 @@ namespace System.Xml { } public override string Value { + [MonoTODO] get { return validatingReader == null ? String.Empty : validatingReader.Value; } } public override string XmlLang { + [MonoTODO] get { return validatingReader == null ? String.Empty : validatingReader.XmlLang; } } public XmlResolver XmlResolver { + [MonoTODO] set { - specifiedResolver = true; resolver = value; - XsdValidatingReader xsvr = validatingReader as XsdValidatingReader; - if (xsvr != null) - xsvr.XmlResolver = value; DTDValidatingReader dvr = validatingReader as DTDValidatingReader; if (dvr != null) dvr.XmlResolver = value; +// XmlSchemaValidatingReader xsvr = validatingReader as XmlSchemaValidatingReader; +// if (xsvr != null) +// xsvr.XmlResolver = value; } } @@ -267,27 +260,28 @@ namespace System.Xml { #region Methods + [MonoTODO] public override void Close () { - if (validatingReader == null) - sourceReader.Close (); - else - validatingReader.Close (); + validatingReader.Close (); } + [MonoTODO] public override string GetAttribute (int i) { - return this [i]; + return validatingReader.GetAttribute (i); } + [MonoTODO] public override string GetAttribute (string name) { - return this [name]; + return validatingReader.GetAttribute (name); } + [MonoTODO] public override string GetAttribute (string localName, string namespaceName) { - return this [localName, namespaceName]; + return validatingReader.GetAttribute (localName, namespaceName); } internal XmlParserContext GetInternalParserContext () @@ -302,54 +296,45 @@ namespace System.Xml { return info != null ? info.HasLineInfo () : false; } + [MonoTODO] public override string LookupNamespace (string prefix) { - if (validatingReader != null) - return sourceReader.LookupNamespace (prefix); - else - return validatingReader.LookupNamespace (prefix); + return validatingReader.LookupNamespace (prefix); } + [MonoTODO] public override void MoveToAttribute (int i) { - if (validatingReader == null) - throw new IndexOutOfRangeException ("Reader is not started."); - else - validatingReader.MoveToAttribute (i); + validatingReader.MoveToAttribute (i); } + [MonoTODO] public override bool MoveToAttribute (string name) { - if (validatingReader == null) - return false; return validatingReader.MoveToAttribute (name); } + [MonoTODO] public override bool MoveToAttribute (string localName, string namespaceName) { - if (validatingReader == null) - return false; return validatingReader.MoveToAttribute (localName, namespaceName); } + [MonoTODO] public override bool MoveToElement () { - if (validatingReader == null) - return false; return validatingReader.MoveToElement (); } + [MonoTODO] public override bool MoveToFirstAttribute () { - if (validatingReader == null) - return false; return validatingReader.MoveToFirstAttribute (); } + [MonoTODO] public override bool MoveToNextAttribute () { - if (validatingReader == null) - return false; return validatingReader.MoveToNextAttribute (); } @@ -366,102 +351,48 @@ namespace System.Xml { goto case ValidationType.DTD; case ValidationType.DTD: validatingReader = dtdReader = new DTDValidatingReader (sourceReader, this); - if (specifiedResolver) - dtdReader.XmlResolver = resolver; break; case ValidationType.Schema: - dtdReader = new DTDValidatingReader (sourceReader, this); - XsdValidatingReader xsvr = new XsdValidatingReader (dtdReader, this); - foreach (XmlSchema schema in Schemas) - xsvr.Schemas.Add (schema); - validatingReader = xsvr; - if (specifiedResolver) { - xsvr.XmlResolver = resolver; - dtdReader.XmlResolver = resolver; - } - break; +// dtdReader = new DTDValidatingReader (sourceReader, this); +// validatingReader = new XmlSchemaValidatingReader (dtdReader, this); +// break; case ValidationType.XDR: throw new NotImplementedException (); } - schemaInfo = validatingReader as IHasXmlSchemaInfo; } return validatingReader.Read (); } + [MonoTODO] public override bool ReadAttributeValue () { - if (validatingReader == null) - return false; return validatingReader.ReadAttributeValue (); } #if NET_1_0 - // LAMESPEC: MS.NET 1.0 has critical bug here. - // After calling these methods, validation does no more work! [MonoTODO] public override string ReadInnerXml () { - if (validatingReader == null) - return ""; return validatingReader.ReadInnerXml (); } [MonoTODO] public override string ReadOuterXml () { - if (validatingReader == null) - return ""; return validatingReader.ReadOuterXml (); } #endif [MonoTODO] -#if NET_1_0 - public override string ReadString () - { - return base.ReadStringInternal (); - } -#else public override string ReadString () { - return base.ReadString (); + return validatingReader.ReadString (); } -#endif + [MonoTODO] public object ReadTypedValue () { - if (dtdReader == null) - return null; - XmlSchemaDatatype dt = schemaInfo.SchemaType as XmlSchemaDatatype; - if (dt == null) - return null; - switch (NodeType) { - case XmlNodeType.Element: - if (IsEmptyElement) - return null; - - storedCharacters.Length = 0; - bool loop = true; - do { - Read (); - switch (NodeType) { - case XmlNodeType.SignificantWhitespace: - case XmlNodeType.Text: - case XmlNodeType.CDATA: - storedCharacters.Append (Value); - break; - case XmlNodeType.Comment: - break; - default: - loop = false; - break; - } - } while (loop && !EOF); - return dt.ParseValue (storedCharacters.ToString (), NameTable, dtdReader.ParserContext.NamespaceManager); - case XmlNodeType.Attribute: - return dt.ParseValue (Value, NameTable, dtdReader.ParserContext.NamespaceManager); - } - return null; + throw new NotImplementedException (); } public override void ResolveEntity () diff --git a/mcs/class/System.XML/System.Xml_test.dll.sources b/mcs/class/System.XML/System.Xml_test.dll.sources index 998c6064aee..258a1448761 100644 --- a/mcs/class/System.XML/System.Xml_test.dll.sources +++ b/mcs/class/System.XML/System.Xml_test.dll.sources @@ -24,8 +24,6 @@ System.Xml/XmlUrlResolverTests.cs System.Xml/XmlValidatingReaderTests.cs System.Xml/XmlWhiteSpaceTests.cs System.Xml/XmlWriterTests.cs -System.Xml/XsdParticleValidationTests.cs -System.Xml/XsdValidatingReaderTests.cs System.Xml.Schema/XmlSchemaTests.cs System.Xml.Serialization/XmlSerializerTests.cs System.Xml.Serialization/XmlSerializerTestClasses.cs diff --git a/mcs/class/System.XML/Test/System.Xml/ChangeLog b/mcs/class/System.XML/Test/System.Xml/ChangeLog index b101614713e..d086d7c8591 100644 --- a/mcs/class/System.XML/Test/System.Xml/ChangeLog +++ b/mcs/class/System.XML/Test/System.Xml/ChangeLog @@ -1,18 +1,3 @@ -2003-08-24 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp> - - * XmlAttributeTests.cs : Added DefaultAttributeRemoval() and - EmptyStringHasTextNode(). - * XmlElementTests.cs : Added RemoveDoesNotRemoveDefaultAttributes(). - * XmlReaderCommonTests.cs : Added overroaded AssertNodeValues() and - ReadAttributeValue(). - * XmlTextReaderTests.cs : - Added NotAllowedCharRef() and ExpandParameterEntity(). - Also added but ignored tests: UndeclaredEntityInIntSubsetOnlyXml() - and UndeclaredEntityInStandaloneXml(). - * XmlValidatingReaderTests.cs : TestAttributeDefaultContribution() - refactory. - * Added XsdParticleValidationTests.cs and XsdValidatingReaderTests.cs. - 2003-08-05 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp> * XmlReaderCommonTests.cs : Its XmlValidatingReader.EntityHandling diff --git a/mcs/class/System.XML/Test/System.Xml/XmlAttributeTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlAttributeTests.cs index 929351cf0a7..188bcd19d14 100644 --- a/mcs/class/System.XML/Test/System.Xml/XmlAttributeTests.cs +++ b/mcs/class/System.XML/Test/System.Xml/XmlAttributeTests.cs @@ -225,7 +225,7 @@ namespace MonoTests.System.Xml doc.DocumentElement.LastChild.Attributes.SetNamedItem (attr); AssertNotNull (doc.GetElementById ("id1")); XmlElement elem2 = doc.GetElementById ("id2"); - // MS.NET BUG: it doesn't remove replaced attribute with SetNamedItem! + // MS.NET BUG: it doesn't removes replaced attribute with SetNamedItem! // AssertNull (elem2); // AssertEquals ("2", elem2.GetAttribute ("bar")); // elem2.RemoveAttribute ("foo"); @@ -258,51 +258,5 @@ namespace MonoTests.System.Xml AssertNull (doc.GetElementById ("id2")); AssertNull (doc.GetElementById ("id3")); } - - int removeAllStep; - [Test] - public void DefaultAttributeRemoval () - { - XmlDocument doc = new XmlDocument (); - doc.LoadXml ("<!DOCTYPE root [<!ELEMENT root (#PCDATA)><!ATTLIST root foo CDATA 'foo-def'>]><root></root>"); - doc.NodeInserted += new XmlNodeChangedEventHandler (OnInsert); - doc.NodeChanged += new XmlNodeChangedEventHandler (OnChange); - doc.NodeRemoved += new XmlNodeChangedEventHandler (OnRemove); - doc.DocumentElement.RemoveAll (); - } - - private void OnInsert (object o, XmlNodeChangedEventArgs e) - { - if (removeAllStep == 1) - AssertEquals (XmlNodeType.Text, e.Node.NodeType); - else if (removeAllStep == 2) { - AssertEquals ("foo", e.Node.Name); - Assert (! ((XmlAttribute) e.Node).Specified); - } - else - Fail (); - removeAllStep++; - } - private void OnChange (object o, XmlNodeChangedEventArgs e) - { - Fail ("Should not be called."); - } - private void OnRemove (object o, XmlNodeChangedEventArgs e) - { - AssertEquals (0, removeAllStep); - AssertEquals ("foo", e.Node.Name); - removeAllStep++; - } - - [Test] - public void EmptyStringHasTextNode () - { - doc.LoadXml ("<root attr=''/>"); - XmlAttribute attr = doc.DocumentElement.GetAttributeNode ("attr"); - AssertNotNull (attr); - AssertEquals (1, attr.ChildNodes.Count); - AssertEquals (XmlNodeType.Text, attr.ChildNodes [0].NodeType); - AssertEquals (String.Empty, attr.ChildNodes [0].Value); - } } } diff --git a/mcs/class/System.XML/Test/System.Xml/XmlElementTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlElementTests.cs index ed9b3ea6fb4..419ccc17d48 100644 --- a/mcs/class/System.XML/Test/System.Xml/XmlElementTests.cs +++ b/mcs/class/System.XML/Test/System.Xml/XmlElementTests.cs @@ -244,23 +244,6 @@ namespace MonoTests.System.Xml } [Test] - public void RemoveDoesNotRemoveDefaultAttributes () - { - string dtd = "<!DOCTYPE root [<!ELEMENT root EMPTY><!ATTLIST root foo CDATA 'def' bar CDATA #IMPLIED>]>"; - string xml = dtd + "<root bar='baz' />"; - XmlValidatingReader xvr = new XmlValidatingReader (xml, XmlNodeType.Document, null); - document.Load (xvr); - AssertNotNull (document.DocumentElement); - AssertEquals (2, document.DocumentElement.Attributes.Count); - AssertEquals ("baz", document.DocumentElement.GetAttribute ("bar")); - AssertEquals ("def", document.DocumentElement.GetAttribute ("foo")); - document.DocumentElement.RemoveAll (); - AssertEquals (1, document.DocumentElement.Attributes.Count); - AssertEquals ("def", document.DocumentElement.GetAttribute ("foo")); - AssertEquals (String.Empty, document.DocumentElement.GetAttribute ("bar")); - } - - [Test] public void SetAttributeNode () { XmlDocument xmlDoc = new XmlDocument (); diff --git a/mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs index a3e8d530302..909329c19f6 100644 --- a/mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs +++ b/mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs @@ -76,24 +76,8 @@ namespace MonoTests.System.Xml string value,
int attributeCount)
{
- AssertNodeValues (xmlReader, nodeType, depth, isEmptyElement, name, prefix, localName, namespaceURI, value, value != String.Empty, attributeCount, attributeCount > 0);
- }
-
- private void AssertNodeValues (
- XmlReader xmlReader,
- XmlNodeType nodeType,
- int depth,
- bool isEmptyElement,
- string name,
- string prefix,
- string localName,
- string namespaceURI,
- string value,
- bool hasValue,
- int attributeCount,
- bool hasAttributes)
- {
AssertEquals ("NodeType", nodeType, xmlReader.NodeType);
+ AssertEquals ("Depth", depth, xmlReader.Depth);
AssertEquals ("IsEmptyElement", isEmptyElement, xmlReader.IsEmptyElement);
AssertEquals ("name", name, xmlReader.Name);
@@ -104,13 +88,11 @@ namespace MonoTests.System.Xml AssertEquals ("namespaceURI", namespaceURI, xmlReader.NamespaceURI);
- AssertEquals ("Depth", depth, xmlReader.Depth);
-
- AssertEquals ("hasValue", hasValue, xmlReader.HasValue);
+ AssertEquals ("hasValue", (value != String.Empty), xmlReader.HasValue);
AssertEquals ("Value", value, xmlReader.Value);
- AssertEquals ("hasAttributes", hasAttributes, xmlReader.HasAttributes);
+ AssertEquals ("hasAttributes", attributeCount > 0, xmlReader.HasAttributes);
AssertEquals ("attributeCount", attributeCount, xmlReader.AttributeCount);
}
@@ -152,15 +134,15 @@ namespace MonoTests.System.Xml xtr = new XmlTextReader (new StringReader (xml));
method (xtr);
- xtr = new XmlTextReader (new StringReader (xml));
- XmlValidatingReader xvr = new XmlValidatingReader (xtr);
- xvr.EntityHandling = EntityHandling.ExpandCharEntities;
- method (xvr);
-
document.XmlResolver = null;
document.LoadXml (xml);
xnr = new XmlNodeReader (document);
method (xnr);
+
+ xtr = new XmlTextReader (new StringReader (xml));
+ XmlValidatingReader xvr = new XmlValidatingReader (xtr);
+ xvr.EntityHandling = EntityHandling.ExpandCharEntities;
+ method (xvr);
}
@@ -215,29 +197,6 @@ namespace MonoTests.System.Xml }
[Test]
- public void ReadAttributeValue ()
- {
- RunTest ("<root attr=''/>", new TestMethod (ReadAttributeValue));
- }
-
- public void ReadAttributeValue (XmlReader reader)
- {
- reader.Read (); // root
- Assert (reader.MoveToFirstAttribute ());
- // It looks like that MS.NET shows AttributeCount and
- // HasAttributes as the same as element node!
- this.AssertNodeValues (reader, XmlNodeType.Attribute,
- 1, false, "attr", "", "attr", "", "", true, 1, true);
- Assert (reader.ReadAttributeValue ());
- // MS.NET XmlNodeReader fails. Its Prefix returns "" instead of null.
- this.AssertNodeValues (reader, XmlNodeType.Text,
- 2, false, "", null, "", null, "", true, 1, true);
- reader.MoveToElement ();
- this.AssertNodeValues (reader, XmlNodeType.Element,
- 0, true, "root", "", "root", "", "", false, 1, true);
- }
-
- [Test]
public void ReadEmptyElement ()
{
RunTest (xml2, new TestMethod (ReadEmptyElement));
@@ -1233,7 +1192,7 @@ namespace MonoTests.System.Xml Assert (xmlReader.Read ());
AssertEquals ("1.0", xmlReader ["version"]);
AssertEquals ("1.0", xmlReader.GetAttribute ("version"));
- // .NET 1.1 BUG. XmlTextReader returns null, while XmlNodeReader returns "".
+ // XmlTextReader returns null, while XmlNodeReader returns "".
AssertEquals (null, xmlReader ["encoding"]);
AssertEquals (null, xmlReader.GetAttribute ("encoding"));
AssertEquals ("no", xmlReader ["standalone"]);
diff --git a/mcs/class/System.XML/Test/System.Xml/XmlTextReaderTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlTextReaderTests.cs index 47a452faff4..1b270705e25 100644 --- a/mcs/class/System.XML/Test/System.Xml/XmlTextReaderTests.cs +++ b/mcs/class/System.XML/Test/System.Xml/XmlTextReaderTests.cs @@ -458,188 +458,188 @@ namespace MonoTests.System.Xml AssertEquals ("initial.NodeType", XmlNodeType.None, reader.NodeType); } - [Test] - public void EntityReference () - { - string xml = "<foo>&bar;</foo>"; - XmlReader xmlReader = new XmlTextReader (new StringReader (xml)); - AssertNode ( - xmlReader, // xmlReader - XmlNodeType.Element, // nodeType - 0, //depth - false, // isEmptyElement - "foo", // name - String.Empty, // prefix - "foo", // localName - String.Empty, // namespaceURI - String.Empty, // value - 0 // attributeCount - ); - - AssertNode ( - xmlReader, // xmlReader - XmlNodeType.EntityReference, // nodeType - 1, //depth - false, // isEmptyElement - "bar", // name - String.Empty, // prefix - "bar", // localName - String.Empty, // namespaceURI - String.Empty, // value - 0 // attributeCount - ); - - AssertNode ( - xmlReader, // xmlReader - XmlNodeType.EndElement, // nodeType - 0, //depth - false, // isEmptyElement - "foo", // name - String.Empty, // prefix - "foo", // localName - String.Empty, // namespaceURI - String.Empty, // value - 0 // attributeCount - ); - - AssertEndDocument (xmlReader); - } - - [Test] - public void EntityReferenceInsideText () - { - string xml = "<foo>bar&baz;quux</foo>"; - XmlReader xmlReader = new XmlTextReader (new StringReader (xml)); - AssertNode ( - xmlReader, // xmlReader - XmlNodeType.Element, // nodeType - 0, //depth - false, // isEmptyElement - "foo", // name - String.Empty, // prefix - "foo", // localName - String.Empty, // namespaceURI - String.Empty, // value - 0 // attributeCount - ); - - AssertNode ( - xmlReader, // xmlReader - XmlNodeType.Text, // nodeType - 1, //depth - false, // isEmptyElement - String.Empty, // name - String.Empty, // prefix - String.Empty, // localName - String.Empty, // namespaceURI - "bar", // value - 0 // attributeCount - ); - - AssertNode ( - xmlReader, // xmlReader - XmlNodeType.EntityReference, // nodeType - 1, //depth - false, // isEmptyElement - "baz", // name - String.Empty, // prefix - "baz", // localName - String.Empty, // namespaceURI - String.Empty, // value - 0 // attributeCount - ); - - AssertNode ( - xmlReader, // xmlReader - XmlNodeType.Text, // nodeType - 1, //depth - false, // isEmptyElement - String.Empty, // name - String.Empty, // prefix - String.Empty, // localName - String.Empty, // namespaceURI - "quux", // value - 0 // attributeCount - ); - - AssertNode ( - xmlReader, // xmlReader - XmlNodeType.EndElement, // nodeType - 0, //depth - false, // isEmptyElement - "foo", // name - String.Empty, // prefix - "foo", // localName - String.Empty, // namespaceURI - String.Empty, // value - 0 // attributeCount - ); - - AssertEndDocument (xmlReader); - } - - [Test] - [ExpectedException (typeof (XmlException))] - public void XmlDeclAfterWhitespace () - { - XmlTextReader xtr = new XmlTextReader ( - " <?xml version='1.0' ?><root />", - XmlNodeType.Document, - null); - xtr.Read (); // ws - xtr.Read (); // not-wf xmldecl - } - - [Test] - [ExpectedException (typeof (XmlException))] - public void XmlDeclAfterComment () - { - XmlTextReader xtr = new XmlTextReader ( - "<!-- comment --><?xml version='1.0' ?><root />", - XmlNodeType.Document, - null); - xtr.Read (); // comment - xtr.Read (); // not-wf xmldecl - } - - [Test] - [ExpectedException (typeof (XmlException))] - public void XmlDeclAfterProcessingInstruction () - { - XmlTextReader xtr = new XmlTextReader ( - "<?myPI let it go ?><?xml version='1.0' ?><root />", - XmlNodeType.Document, - null); - xtr.Read (); // PI - xtr.Read (); // not-wf xmldecl - } - - [Test] - [ExpectedException (typeof (XmlException))] - public void StartsFromEndElement () - { - XmlTextReader xtr = new XmlTextReader ( - "</root>", - XmlNodeType.Document, - null); - xtr.Read (); - } - - [Test] - public void ReadAsElementContent () - { - XmlTextReader xtr = new XmlTextReader ( - "<foo /><bar />", XmlNodeType.Element, null); - xtr.Read (); - } - - [Test] - public void ReadAsAttributeContent () - { - XmlTextReader xtr = new XmlTextReader ( - "test", XmlNodeType.Attribute, null); - xtr.Read (); - } + [Test]
+ public void EntityReference ()
+ {
+ string xml = "<foo>&bar;</foo>";
+ XmlReader xmlReader = new XmlTextReader (new StringReader (xml));
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EntityReference, // nodeType
+ 1, //depth
+ false, // isEmptyElement
+ "bar", // name
+ String.Empty, // prefix
+ "bar", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EndElement, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ [Test]
+ public void EntityReferenceInsideText ()
+ {
+ string xml = "<foo>bar&baz;quux</foo>";
+ XmlReader xmlReader = new XmlTextReader (new StringReader (xml));
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Text, // nodeType
+ 1, //depth
+ false, // isEmptyElement
+ String.Empty, // name
+ String.Empty, // prefix
+ String.Empty, // localName
+ String.Empty, // namespaceURI
+ "bar", // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EntityReference, // nodeType
+ 1, //depth
+ false, // isEmptyElement
+ "baz", // name
+ String.Empty, // prefix
+ "baz", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Text, // nodeType
+ 1, //depth
+ false, // isEmptyElement
+ String.Empty, // name
+ String.Empty, // prefix
+ String.Empty, // localName
+ String.Empty, // namespaceURI
+ "quux", // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EndElement, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ [Test]
+ [ExpectedException (typeof (XmlException))]
+ public void XmlDeclAfterWhitespace ()
+ {
+ XmlTextReader xtr = new XmlTextReader (
+ " <?xml version='1.0' ?><root />",
+ XmlNodeType.Document,
+ null);
+ xtr.Read (); // ws
+ xtr.Read (); // not-wf xmldecl
+ }
+ + [Test]
+ [ExpectedException (typeof (XmlException))]
+ public void XmlDeclAfterComment ()
+ {
+ XmlTextReader xtr = new XmlTextReader (
+ "<!-- comment --><?xml version='1.0' ?><root />",
+ XmlNodeType.Document,
+ null);
+ xtr.Read (); // comment
+ xtr.Read (); // not-wf xmldecl
+ }
+ + [Test]
+ [ExpectedException (typeof (XmlException))]
+ public void XmlDeclAfterProcessingInstruction ()
+ {
+ XmlTextReader xtr = new XmlTextReader (
+ "<?myPI let it go ?><?xml version='1.0' ?><root />",
+ XmlNodeType.Document,
+ null);
+ xtr.Read (); // PI
+ xtr.Read (); // not-wf xmldecl
+ }
+ + [Test]
+ [ExpectedException (typeof (XmlException))]
+ public void StartsFromEndElement ()
+ {
+ XmlTextReader xtr = new XmlTextReader (
+ "</root>",
+ XmlNodeType.Document,
+ null);
+ xtr.Read ();
+ }
+ + [Test]
+ public void ReadAsElementContent ()
+ {
+ XmlTextReader xtr = new XmlTextReader (
+ "<foo /><bar />", XmlNodeType.Element, null);
+ xtr.Read ();
+ }
+ + [Test]
+ public void ReadAsAttributeContent ()
+ {
+ XmlTextReader xtr = new XmlTextReader (
+ "test", XmlNodeType.Attribute, null);
+ xtr.Read ();
+ }
[Test] public void ExternalDocument () @@ -647,58 +647,5 @@ namespace MonoTests.System.Xml XmlDocument doc = new XmlDocument (); doc.Load ("XmlFiles/nested-dtd-test.xml"); } - - // MS.NET 1.0 fails this test. - [Test] - [ExpectedException (typeof (XmlException))] - public void NotAllowedCharRef () - { - string xml = "<root>�</root>"; - XmlTextReader xtr = new XmlTextReader (xml, XmlNodeType.Document, null); - xtr.Read (); - xtr.Read (); - } - - [Test] - [ExpectedException (typeof (XmlException))] - [Ignore ("MS.NET 1.0 fails this test. The related spec is XML rec. 4.1")] - public void UndeclaredEntityInIntSubsetOnlyXml () - { - string ent2 = "<!ENTITY ent2 '<foo/><foo/>'>]>"; - string dtd = "<!DOCTYPE root[<!ELEMENT root (#PCDATA|foo)*>" + ent2; - string xml = dtd + "<root>&ent;&ent2;</root>"; - XmlTextReader xtr = new XmlTextReader (xml, XmlNodeType.Document, null); - while (!xtr.EOF) - xtr.Read (); - } - - [Test] - [ExpectedException (typeof (XmlException))] - [Ignore ("MS.NET 1.0 fails this test. The related spec is XML rec. 4.1")] - public void UndeclaredEntityInStandaloneXml () - { - string ent2 = "<!ENTITY ent2 '<foo/><foo/>'>]>"; - string dtd = "<!DOCTYPE root[<!ELEMENT root (#PCDATA|foo)*>" + ent2; - string xml = "<?xml version='1.0' standalone='yes' ?>" - + dtd + "<root>&ent;</root>"; - XmlTextReader xtr = new XmlTextReader (xml, XmlNodeType.Document, null); - while (!xtr.EOF) - xtr.Read (); - } - - [Test] - public void ExpandParameterEntity () - { - string ent = "<!ENTITY foo \"foo-def\">"; - string pe = "<!ENTITY % pe '" + ent + "'>"; - string eldecl = "<!ELEMENT root ANY>"; - string dtd = "<!DOCTYPE root[" + eldecl + pe + "%pe;]>"; - string xml = dtd + "<root/>"; - XmlDocument doc = new XmlDocument (); - doc.LoadXml (xml); - XmlEntity foo = doc.DocumentType.Entities.GetNamedItem ("foo") as XmlEntity; - AssertNotNull (foo); - AssertEquals ("foo-def", foo.InnerText); - } } } diff --git a/mcs/class/System.XML/Test/System.Xml/XmlValidatingReaderTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlValidatingReaderTests.cs index fc76383d39b..efd6bdf0fe8 100644 --- a/mcs/class/System.XML/Test/System.Xml/XmlValidatingReaderTests.cs +++ b/mcs/class/System.XML/Test/System.Xml/XmlValidatingReaderTests.cs @@ -347,23 +347,12 @@ namespace MonoTests.System.Xml string intSubset = "<!ELEMENT root EMPTY><!ATTLIST root foo CDATA 'foo-def' bar CDATA 'bar-def'>";
string dtd = "<!DOCTYPE root [" + intSubset + "]>";
string xml = dtd + "<root />";
-
dvr = PrepareXmlReader (xml);
dvr.ValidationType = ValidationType.DTD;
- this.TestAttributeDefaultContributionInternal (dvr);
-
- dvr = PrepareXmlReader (xml);
- dvr.ValidationType = ValidationType.None;
- this.TestAttributeDefaultContributionInternal (dvr);
- }
-
- private void TestAttributeDefaultContributionInternal (XmlReader dvr)
- {
dvr.Read (); // DTD
dvr.Read ();
AssertEquals (XmlNodeType.Element, dvr.NodeType);
AssertEquals ("root", dvr.Name);
- AssertEquals (2, dvr.AttributeCount);
// foo
Assert (dvr.MoveToFirstAttribute ());
AssertEquals ("foo", dvr.Name);
@@ -384,6 +373,36 @@ namespace MonoTests.System.Xml AssertEquals (XmlNodeType.Text, dvr.NodeType);
AssertEquals ("", dvr.Name);
AssertEquals ("bar-def", dvr.Value);
+
+ // ValidationType = None
+
+ dvr = PrepareXmlReader (xml);
+ dvr.ValidationType = ValidationType.None;
+ dvr.Read (); // DTD
+ dvr.Read ();
+ AssertEquals (XmlNodeType.Element, dvr.NodeType);
+ AssertEquals ("root", dvr.Name);
+ // foo
+ Assert (dvr.MoveToFirstAttribute ());
+ AssertEquals ("foo", dvr.Name);
+ AssertNotNull (dvr ["foo"]);
+ AssertNotNull (dvr ["bar"]);
+ AssertEquals ("foo-def", dvr.Value);
+ Assert (dvr.ReadAttributeValue ());
+ AssertEquals (XmlNodeType.Text, dvr.NodeType);
+ AssertEquals ("", dvr.Name);
+ AssertEquals ("foo-def", dvr.Value);
+ // bar
+ Assert (dvr.MoveToNextAttribute ());
+ AssertEquals ("bar", dvr.Name);
+ AssertEquals ("bar-def", dvr.Value);
+ AssertNotNull (dvr ["foo"]);
+ AssertNotNull (dvr ["bar"]);
+ AssertEquals ("bar", dvr.Name);
+ Assert (dvr.ReadAttributeValue ());
+ AssertEquals (XmlNodeType.Text, dvr.NodeType);
+ AssertEquals ("", dvr.Name);
+ AssertEquals ("bar-def", dvr.Value);
}
[Test]
diff --git a/mcs/class/System.XML/Test/System.Xml/XsdParticleValidationTests.cs b/mcs/class/System.XML/Test/System.Xml/XsdParticleValidationTests.cs deleted file mode 100644 index f6462e28197..00000000000 --- a/mcs/class/System.XML/Test/System.Xml/XsdParticleValidationTests.cs +++ /dev/null @@ -1,219 +0,0 @@ -//
-// MonoTests.System.Xml.XsdParticleValidationTests.cs
-//
-// Author:
-// Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
-//
-// (C)2003 Atsushi Enomoto
-//
-using System;
-using System.Xml;
-using System.Xml.Schema;
-using NUnit.Framework;
-
-namespace MonoTests.System.Xml
-{
-// using XmlValidatingReader = XmlTextReader;
-
- [TestFixture]
- public class XsdValidatingReaderTests : Assertion
- {
- XmlSchema schema;
- XmlReader xr;
- XmlValidatingReader xvr;
-
- private void PrepareReader1 (string xsdUrl, string xml)
- {
- schema = XmlSchema.Read (new XmlTextReader ("XmlFiles/XsdValidation/" + xsdUrl), null);
- xr = new XmlTextReader (xml, XmlNodeType.Document, null);
- xvr = new XmlValidatingReader (xr);
- xvr.Schemas.Add (schema);
-// xvr = xr as XmlValidatingReader;
- }
-
- [Test]
- public void ValidateRootElementOnlyValid ()
- {
- PrepareReader1 ("1.xsd", "<root xmlns='urn:foo' />");
- xvr.Read ();
- }
-
- [Test]
- [ExpectedException (typeof (XmlSchemaException))]
- public void ValidateRootElementOnlyInvalid ()
- {
- PrepareReader1 ("1.xsd", "<invalid xmlns='urn:foo' />");
- xvr.Read ();
- }
-
- [Test]
- [ExpectedException (typeof (XmlSchemaException))]
- public void ValidateRootElementOnlyInvalid2 ()
- {
- PrepareReader1 ("1.xsd", "<root xmlns='urn:foo'><invalid_child/></root>");
- xvr.Read ();
- xvr.Read ();
- }
-
- [Test]
- public void ValidateElementContainsElementValid1 ()
- {
- PrepareReader1 ("2.xsd", "<root xmlns='urn:foo'><child/></root>");
- while (!xvr.EOF)
- xvr.Read ();
- }
-
- [Test]
- public void ValidateElementContainsElementValid2 ()
- {
- PrepareReader1 ("2.xsd", "<root xmlns='urn:foo'><child/><child/></root>");
- while (!xvr.EOF)
- xvr.Read ();
- }
-
- [Test]
- [ExpectedException (typeof (XmlSchemaException))]
- public void ValidateElementContainsElementInvalid1 ()
- {
- PrepareReader1 ("2.xsd", "<root xmlns='urn:foo'></root>");
- while (!xvr.EOF)
- xvr.Read ();
- }
-
- [Test]
- [ExpectedException (typeof (XmlSchemaException))]
- public void ValidateElementContainsElementInvalid2 ()
- {
- PrepareReader1 ("2.xsd", "<root xmlns='urn:foo'><child/><child/><child/></root>");
- while (!xvr.EOF)
- xvr.Read ();
- }
-
- [Test]
- public void ValidateSequenceValid ()
- {
- PrepareReader1 ("3.xsd", "<root xmlns='urn:foo'><child1/><child2/></root>");
- while (!xvr.EOF)
- xvr.Read ();
-
- PrepareReader1 ("3.xsd", "<root xmlns='urn:foo'><child1/><child2/><child1/><child2/></root>");
- while (!xvr.EOF)
- xvr.Read ();
- }
-
- [Test]
- [ExpectedException (typeof (XmlSchemaException))]
- public void ValidateSequenceInvalid1 ()
- {
- PrepareReader1 ("3.xsd", "<root xmlns='urn:foo'></root>");
- while (!xvr.EOF)
- xvr.Read ();
- }
-
- [Test]
- [ExpectedException (typeof (XmlSchemaException))]
- public void ValidateSequenceInvalid2 ()
- {
- PrepareReader1 ("3.xsd", "<root xmlns='urn:foo'><child1/></root>");
- while (!xvr.EOF)
- xvr.Read ();
- }
-
- [Test]
- [ExpectedException (typeof (XmlSchemaException))]
- public void ValidateSequenceInvalid3 ()
- {
- PrepareReader1 ("3.xsd", "<root xmlns='urn:foo'><child1/><child2/><child1/></root>");
- while (!xvr.EOF)
- xvr.Read ();
- }
-
- [Test]
- [ExpectedException (typeof (XmlSchemaException))]
- public void ValidateSequenceInvalid4 ()
- {
- PrepareReader1 ("3.xsd", "<root xmlns='urn:foo'><child1/><child2/><child1/><child2/><child1/></root>");
- while (!xvr.EOF)
- xvr.Read ();
- }
-
- [Test]
- [ExpectedException (typeof (XmlSchemaException))]
- public void ValidateSequenceInvalid5 ()
- {
- PrepareReader1 ("3.xsd", "<root xmlns='urn:foo'><child1/><child2/><child1/><child2/><child1/><child2/></root>");
- while (!xvr.EOF)
- xvr.Read ();
- }
-
- [Test]
- public void ValidateChoiceValid ()
- {
- PrepareReader1 ("4.xsd", "<root xmlns='urn:foo'><child1/></root>");
- while (!xvr.EOF)
- xvr.Read ();
-
- PrepareReader1 ("4.xsd", "<root xmlns='urn:foo'><child2/></root>");
- while (!xvr.EOF)
- xvr.Read ();
-
- PrepareReader1 ("4.xsd", "<root xmlns='urn:foo'><child1/><child2/></root>");
- while (!xvr.EOF)
- xvr.Read ();
-
- PrepareReader1 ("4.xsd", "<root xmlns='urn:foo'><child2/><child2/></root>");
- while (!xvr.EOF)
- xvr.Read ();
-
- PrepareReader1 ("4.xsd", "<root xmlns='urn:foo'><child2/><child2/><child2/><child2/></root>");
- while (!xvr.EOF)
- xvr.Read ();
-
- PrepareReader1 ("4.xsd", "<root xmlns='urn:foo'><child2/><child2/><child1/></root>");
- while (!xvr.EOF)
- xvr.Read ();
-
- PrepareReader1 ("4.xsd", "<root xmlns='urn:foo'></root>");
- while (!xvr.EOF)
- xvr.Read ();
-
- }
-
- [Test]
- [ExpectedException (typeof (XmlSchemaException))]
- public void ValidateChoiceInvalid1 ()
- {
- PrepareReader1 ("4.xsd", "<root xmlns='urn:foo'><child1/><child1/><child1/></root>");
- while (!xvr.EOF)
- xvr.Read ();
- }
-
- [Test]
- [ExpectedException (typeof (XmlSchemaException))]
- public void ValidateChoiceInvalid2 ()
- {
- PrepareReader1 ("3.xsd", "<root xmlns='urn:foo'><child2/><child2/><child2/><child2/><child2/></root>");
- while (!xvr.EOF)
- xvr.Read ();
- }
-
- [Test]
- [ExpectedException (typeof (XmlSchemaException))]
- public void ValidateChoiceInvalid3 ()
- {
- PrepareReader1 ("3.xsd", "<root xmlns='urn:foo'><child2/><child2/><child2/><child1/></root>");
- while (!xvr.EOF)
- xvr.Read ();
- }
-
- [Test]
- [ExpectedException (typeof (XmlSchemaException))]
- public void ValidateChoiceInvalid4 ()
- {
- PrepareReader1 ("3.xsd", "<root xmlns='urn:foo'><child1/><child2/><child2/><child2/></root>");
- while (!xvr.EOF)
- xvr.Read ();
- }
-
- }
-}
diff --git a/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs b/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs deleted file mode 100644 index 4c7313bbf0b..00000000000 --- a/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs +++ /dev/null @@ -1,184 +0,0 @@ -//
-// MonoTests.System.Xml.XsdValidatingReaderTests.cs
-//
-// Author:
-// Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
-//
-// (C)2003 Atsushi Enomoto
-//
-using System;
-using System.Xml;
-using System.Xml.Schema;
-using NUnit.Framework;
-
-namespace MonoTests.System.Xml
-{
- [TestFixture]
- public class XsdValidationTests : Assertion
- {
- public XsdValidationTests ()
- {
- }
-
- XmlReader xtr;
- XmlValidatingReader xvr;
-
- private XmlValidatingReader PrepareXmlReader (string xml)
- {
- XmlReader reader = new XmlTextReader (xml, XmlNodeType.Document, null);
-// XmlDocument doc = new XmlDocument ();
-// doc.LoadXml (xml);
-// XmlReader reader = new XmlNodeReader (doc);
-
- return new XmlValidatingReader (reader);
- }
-
- [Test]
- public void TestEmptySchema ()
- {
- string xml = "<root/>";
- xvr = PrepareXmlReader (xml);
- xvr.ValidationType = ValidationType.Schema;
- xvr.Read (); // Is is missing schema component.
- }
-
- [Test]
- public void TestSimpleValidation ()
- {
- string xml = "<root/>";
- xvr = PrepareXmlReader (xml);
- AssertEquals (ValidationType.Auto, xvr.ValidationType);
- XmlSchema schema = new XmlSchema ();
- XmlSchemaElement elem = new XmlSchemaElement ();
- elem.Name = "root";
- schema.Items.Add (elem);
- xvr.Schemas.Add (schema);
- xvr.Read (); // root
- AssertEquals (ValidationType.Auto, xvr.ValidationType);
- xvr.Read (); // EOF
-
- xml = "<hoge/>";
- xvr = PrepareXmlReader (xml);
- xvr.Schemas.Add (schema);
- try {
- xvr.Read ();
- Fail ();
- } catch (XmlSchemaException) {
- }
-
- xml = "<hoge xmlns='urn:foo' />";
- xvr = PrepareXmlReader (xml);
- xvr.Schemas.Add (schema);
- try {
- xvr.Read ();
- Fail ();
- } catch (XmlSchemaException) {
- }
- }
-
- [Test]
- public void TestReadTypedValueSimple ()
- {
- string xml = "<root>12</root>";
- XmlSchema schema = new XmlSchema ();
- XmlSchemaElement elem = new XmlSchemaElement ();
- elem.Name = "root";
- elem.SchemaTypeName = new XmlQualifiedName ("integer", XmlSchema.Namespace);
- schema.Items.Add (elem);
-
- // Lap 1:
-
- xvr = PrepareXmlReader (xml);
- xvr.Schemas.Add (schema);
- // Read directly from root.
- object o = xvr.ReadTypedValue ();
- AssertEquals (ReadState.Initial, xvr.ReadState);
- AssertNull (o);
-
- xvr.Read (); // element root
- AssertEquals (XmlNodeType.Element, xvr.NodeType);
- o = xvr.ReadTypedValue (); // read "12"
- AssertEquals (XmlNodeType.EndElement, xvr.NodeType);
- AssertNotNull (o);
- AssertEquals (typeof (decimal), o.GetType ());
- decimal n = (decimal) o;
- AssertEquals (12, n);
- Assert (!xvr.EOF);
- AssertEquals ("root", xvr.Name);
- AssertNull (xvr.SchemaType); // EndElement's type
-
- // Lap 2:
-
- xvr = PrepareXmlReader (xml);
- xvr.Schemas.Add (schema);
- xvr.Read (); // root
- XmlSchemaDatatype dt = xvr.SchemaType as XmlSchemaDatatype;
- AssertNotNull (dt);
- AssertEquals (typeof (decimal), dt.ValueType);
- AssertEquals (XmlTokenizedType.None, dt.TokenizedType);
- xvr.Read (); // text "12"
- AssertNull (xvr.SchemaType);
- o = xvr.ReadTypedValue ();
- // ReadTypedValue is different from ReadString().
- AssertNull (o);
- }
-
- [Test]
- public void TestNamespacesFalse ()
- {
- // This tests if Namespaces=false is specified, then
- // the reader's NamespaceURI should be always string.Empty and
- // validation should be done against such schema that has target ns as "".
- string xml = "<x:root xmlns:x='urn:foo' />";
- xvr = PrepareXmlReader (xml);
- xvr.Namespaces = false;
- AssertEquals (ValidationType.Auto, xvr.ValidationType);
- XmlSchema schema = new XmlSchema ();
- schema.TargetNamespace = "urn:foo";
- XmlSchemaElement elem = new XmlSchemaElement ();
- elem.Name = "root";
- schema.Items.Add (elem);
- xvr.Schemas.Add (schema);
- xvr.Read (); // root
- Assert (!xvr.Namespaces);
- AssertEquals ("x:root", xvr.Name);
- // LocalName may contain colons.
- AssertEquals ("x:root", xvr.LocalName);
- // NamespaceURI is not supplied.
- AssertEquals ("", xvr.NamespaceURI);
- }
-
- [Test]
- public void TestReadTypedAttributeValue ()
- {
- string xml = "<root attr='12'></root>";
- XmlSchema schema = new XmlSchema ();
- XmlSchemaElement elem = new XmlSchemaElement ();
- elem.Name = "root";
- XmlSchemaComplexType ct = new XmlSchemaComplexType ();
- XmlSchemaAttribute attr = new XmlSchemaAttribute ();
- attr.Name = "attr";
- attr.SchemaTypeName = new XmlQualifiedName ("int", XmlSchema.Namespace);
- ct.Attributes.Add (attr);
- elem.SchemaType = ct;
- schema.Items.Add (elem);
-
- xvr = PrepareXmlReader (xml);
- xvr.Schemas.Add (schema);
- xvr.Read ();
- AssertEquals ("root", xvr.Name);
- Assert (xvr.MoveToNextAttribute ()); // attr
- AssertEquals ("attr", xvr.Name);
- XmlSchemaDatatype dt = xvr.SchemaType as XmlSchemaDatatype;
- AssertNotNull (dt);
- AssertEquals (typeof (int), dt.ValueType);
- AssertEquals (XmlTokenizedType.None, dt.TokenizedType);
- object o = xvr.ReadTypedValue ();
- AssertEquals (XmlNodeType.Attribute, xvr.NodeType);
- AssertEquals (typeof (int), o.GetType ());
- int n = (int) o;
- AssertEquals (12, n);
- Assert (xvr.ReadAttributeValue ()); // can read = seems not proceed.
- }
- }
-}
diff --git a/mcs/class/System.XML/Test/XmlFiles/XsdValidation/1.xsd b/mcs/class/System.XML/Test/XmlFiles/XsdValidation/1.xsd deleted file mode 100644 index 3716d11faaf..00000000000 --- a/mcs/class/System.XML/Test/XmlFiles/XsdValidation/1.xsd +++ /dev/null @@ -1,7 +0,0 @@ -<xs:schema
- xmlns:xs='http://www.w3.org/2001/XMLSchema'
- targetNamespace="urn:foo">
-
-<xs:element name="root" type="xs:string" />
-
-</xs:schema>
diff --git a/mcs/class/System.XML/Test/XmlFiles/XsdValidation/2.xsd b/mcs/class/System.XML/Test/XmlFiles/XsdValidation/2.xsd deleted file mode 100644 index fb14218655e..00000000000 --- a/mcs/class/System.XML/Test/XmlFiles/XsdValidation/2.xsd +++ /dev/null @@ -1,15 +0,0 @@ -<xs:schema
- elementFormDefault="qualified"
- xmlns:xs='http://www.w3.org/2001/XMLSchema'
- xmlns="urn:foo"
- targetNamespace="urn:foo">
-
-<xs:element name="root">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="child" minOccurs="1" maxOccurs="2" />
- </xs:sequence>
- </xs:complexType>
-</xs:element>
-
-</xs:schema>
diff --git a/mcs/class/System.XML/Test/XmlFiles/XsdValidation/3.xsd b/mcs/class/System.XML/Test/XmlFiles/XsdValidation/3.xsd deleted file mode 100644 index f382bc698a5..00000000000 --- a/mcs/class/System.XML/Test/XmlFiles/XsdValidation/3.xsd +++ /dev/null @@ -1,16 +0,0 @@ -<xs:schema
- elementFormDefault="qualified"
- xmlns:xs='http://www.w3.org/2001/XMLSchema'
- xmlns="urn:foo"
- targetNamespace="urn:foo">
-
-<xs:element name="root">
- <xs:complexType>
- <xs:sequence maxOccurs="2">
- <xs:element name="child1" />
- <xs:element name="child2" />
- </xs:sequence>
- </xs:complexType>
-</xs:element>
-
-</xs:schema>
diff --git a/mcs/class/System.XML/Test/XmlFiles/XsdValidation/4.xsd b/mcs/class/System.XML/Test/XmlFiles/XsdValidation/4.xsd deleted file mode 100644 index 246544a644f..00000000000 --- a/mcs/class/System.XML/Test/XmlFiles/XsdValidation/4.xsd +++ /dev/null @@ -1,16 +0,0 @@ -<xs:schema
- elementFormDefault="qualified"
- xmlns:xs='http://www.w3.org/2001/XMLSchema'
- xmlns="urn:foo"
- targetNamespace="urn:foo">
-
-<xs:element name="root">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="2">
- <xs:element name="child1" />
- <xs:element name="child2" maxOccurs="2" />
- </xs:choice>
- </xs:complexType>
-</xs:element>
-
-</xs:schema>
diff --git a/mcs/class/System.XML/Test/XmlFiles/XsdValidation/ChangeLog b/mcs/class/System.XML/Test/XmlFiles/XsdValidation/ChangeLog deleted file mode 100644 index 87951fe167f..00000000000 --- a/mcs/class/System.XML/Test/XmlFiles/XsdValidation/ChangeLog +++ /dev/null @@ -1,3 +0,0 @@ -2003-08-24 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp> - - * 1.xsd, 2.xsd, 3.xsd, 4.xsd : Initial checkin. diff --git a/mcs/class/System/ChangeLog b/mcs/class/System/ChangeLog index 4aeb127ec2e..61d17fbed57 100644 --- a/mcs/class/System/ChangeLog +++ b/mcs/class/System/ChangeLog @@ -1,11 +1,3 @@ -2003-09-04 Duncan Mak <duncan@ximian.com> - - * System_test.dll.sources: Add new test, ListDictionaryTest.cs. - -2003-08-31 Alexandre Pigolkine <pigolkine@gmx.de> - - * System_test.dll.sources new test added - 2003-07-27 Andreas Nahr <ClassDevelopment@A-SoftTech.com> * System.dll.sources: SRDescriptionAttribute.cs moved diff --git a/mcs/class/System/Microsoft.CSharp/CSharpCodeGenerator.cs b/mcs/class/System/Microsoft.CSharp/CSharpCodeGenerator.cs index 4411cf6a444..ab1f346e3f5 100644 --- a/mcs/class/System/Microsoft.CSharp/CSharpCodeGenerator.cs +++ b/mcs/class/System/Microsoft.CSharp/CSharpCodeGenerator.cs @@ -66,7 +66,7 @@ namespace Mono.CSharp OutputType( createType ); - output.WriteLine( "[] {" ); + output.WriteLine( " {" ); ++Indent; OutputExpressionList( initializers, true ); --Indent; @@ -202,11 +202,8 @@ namespace Mono.CSharp protected override void GenerateMethodReferenceExpression( CodeMethodReferenceExpression expression ) { - if (expression.TargetObject != null) - { - GenerateExpression( expression.TargetObject ); - Output.Write( '.' ); - }; + GenerateExpression( expression.TargetObject ); + Output.Write( '.' ); Output.Write( GetSafeName (expression.MethodName) ); } @@ -274,7 +271,6 @@ namespace Mono.CSharp { Output.Write( "throw " ); GenerateExpression( statement.ToThrow ); - Output.WriteLine(";"); } protected override void GenerateComment( CodeComment comment ) @@ -499,15 +495,9 @@ namespace Mono.CSharp if (method.CustomAttributes.Count > 0) OutputAttributeDeclarations( method.CustomAttributes ); - if (method.ReturnTypeCustomAttributes.Count > 0) - OutputAttributeDeclarations( method.ReturnTypeCustomAttributes ); - MemberAttributes attributes = method.Attributes; - if (method.PrivateImplementationType == null) - { - OutputMemberAccessModifier( attributes ); - }; + OutputMemberAccessModifier( attributes ); OutputMemberScopeModifier( attributes ); OutputType( method.ReturnType ); @@ -525,7 +515,7 @@ namespace Mono.CSharp OutputParameters( method.Parameters ); output.Write( ')' ); - if ( (attributes & MemberAttributes.ScopeMask) == MemberAttributes.Abstract || declaration.IsInterface) + if ( (attributes & MemberAttributes.ScopeMask) == MemberAttributes.Abstract ) output.WriteLine( ';' ); else { output.WriteLine( " {" ); @@ -548,50 +538,30 @@ namespace Mono.CSharp OutputMemberAccessModifier( attributes ); OutputMemberScopeModifier( attributes ); - if (property.Name == "Item") - { - // indexer - - OutputTypeNamePair( property.Type, "this"); - output.Write("["); - OutputParameters(property.Parameters); - output.Write("]"); - } - else - { - OutputTypeNamePair( property.Type, GetSafeName (property.Name)); - } + OutputTypeNamePair( property.Type, GetSafeName (property.Name)); output.WriteLine (" {"); ++Indent; - if (declaration.IsInterface) - { - if (property.HasGet) output.WriteLine("get; "); - if (property.HasSet) output.WriteLine("set; "); - } - else + if (property.HasGet) { - if (property.HasGet) - { - output.WriteLine ("get {"); - ++Indent; - - GenerateStatements (property.GetStatements); + output.WriteLine ("get {"); + ++Indent; - --Indent; - output.WriteLine ("}"); - } + GenerateStatements (property.GetStatements); - if (property.HasSet) - { - output.WriteLine ("set {"); - ++Indent; + --Indent; + output.WriteLine ("}"); + } + + if (property.HasSet) + { + output.WriteLine ("set {"); + ++Indent; - GenerateStatements (property.SetStatements); + GenerateStatements (property.SetStatements); - --Indent; - output.WriteLine ("}"); - } + --Indent; + output.WriteLine ("}"); } --Indent; @@ -604,36 +574,7 @@ namespace Mono.CSharp OutputMemberAccessModifier (constructor.Attributes); Output.Write (GetSafeName (CurrentTypeName) + " ("); OutputParameters (constructor.Parameters); - Output.Write (") "); - if (constructor.ChainedConstructorArgs.Count > 0) - { - Output.Write(": this("); - bool first = true; - foreach (CodeExpression ex in constructor.ChainedConstructorArgs) - { - if (!first) - Output.Write(", "); - first = false; - GenerateExpression(ex); - } - - Output.Write(") "); - }; - if (constructor.BaseConstructorArgs.Count > 0) - { - Output.Write(": base("); - bool first = true; - foreach (CodeExpression ex in constructor.BaseConstructorArgs) - { - if (!first) - Output.Write(", "); - first = false; - GenerateExpression(ex); - } - - Output.Write(") "); - }; - Output.WriteLine ("{"); + Output.WriteLine (") {"); Indent++; GenerateStatements (constructor.Statements); Indent--; @@ -724,9 +665,6 @@ namespace Mono.CSharp protected override void GenerateAttributeDeclarationsStart( CodeAttributeDeclarationCollection attributes ) { Output.Write( '[' ); - CodeMemberMethod met = CurrentMember as CodeMemberMethod; - if (met != null && met.ReturnTypeCustomAttributes == attributes) - Output.Write ("return: "); } protected override void GenerateAttributeDeclarationsEnd( CodeAttributeDeclarationCollection attributes ) diff --git a/mcs/class/System/Microsoft.CSharp/ChangeLog b/mcs/class/System/Microsoft.CSharp/ChangeLog index 71bf2da0ff9..3910d47b9f9 100644 --- a/mcs/class/System/Microsoft.CSharp/ChangeLog +++ b/mcs/class/System/Microsoft.CSharp/ChangeLog @@ -1,25 +1,3 @@ -2003-09-04 Lluis Sanchez Gual <lluis@ximian.com> - - * CSharpCodeGenerator.cs: Fixed generation of array construction with initializers. - Render return type custom attributes. - -2003-08-15 Jaroslaw Kowalski <jarek@atm.com.pl> - - * CSharpCodeGenerator.cs: - - - fixed support for method references where target - object is null - - fixed CodeThrowExceptionStatement - - disabled member access modifiers for private method - implementations - - disabled generation of empty method body for interface - declarations - - disabled generation of empty property accessor bodies - in interface declarations - - added support for indexers (properties named "Item") - - added support for chained constructor arguments and - base constructor arguments - 2003-08-05 Lluis Sanchez Gual <lluis@ximian.com> * CSharpCodeGenerator.cs: Added method GetSafeName() that checks if @@ -146,3 +124,5 @@ * CSharpCodeGenerator.cs: C# Code Generator. Not fully complete but doing fairly well. + + diff --git a/mcs/class/System/System.CodeDom/ChangeLog b/mcs/class/System/System.CodeDom/ChangeLog index dd4757d1e8c..772703f02d7 100644 --- a/mcs/class/System/System.CodeDom/ChangeLog +++ b/mcs/class/System/System.CodeDom/ChangeLog @@ -1,10 +1,3 @@ -2003-08-15 Jaroslaw Kowalski <jarek@atm.com.pl> - - * CodeTypeDeclaration.cs: - - - TypeAttributes of CodeTypeDeclaration now defaults to - TypeAttributes.Public (same as MS implementation) - 2003-04-25 Gonzalo Paniagua Javier <gonzalo@ximian.com> * CodeEventReferenceExpression.cs: fixed typo that prevented event diff --git a/mcs/class/System/System.CodeDom/CodeTypeDeclaration.cs b/mcs/class/System/System.CodeDom/CodeTypeDeclaration.cs index ab119e30d0e..be0fdc70cff 100755 --- a/mcs/class/System/System.CodeDom/CodeTypeDeclaration.cs +++ b/mcs/class/System/System.CodeDom/CodeTypeDeclaration.cs @@ -21,7 +21,7 @@ namespace System.CodeDom { private CodeTypeReferenceCollection baseTypes; private CodeTypeMemberCollection members; - private TypeAttributes typeAttributes = TypeAttributes.Public; + private TypeAttributes typeAttributes; private bool isEnum; private bool isStruct; diff --git a/mcs/class/System/System.Collections.Specialized/BitVector32.cs b/mcs/class/System/System.Collections.Specialized/BitVector32.cs index a1d5887e988..503e3f06865 100644 --- a/mcs/class/System/System.Collections.Specialized/BitVector32.cs +++ b/mcs/class/System/System.Collections.Specialized/BitVector32.cs @@ -98,15 +98,14 @@ namespace System.Collections.Specialized { throw new ArgumentException ("Section can't hold negative values"); if (value > section.Mask) throw new ArgumentException ("Value too large to fit in section"); - bits &= ~(section.Mask << section.Offset); + bits &= (~section.Mask << section.Offset); bits |= (value << section.Offset); } } public bool this [int mask] { get { - long tmp = (uint)bits; - return (tmp & (long)mask) == (long)mask; + return (bits & mask) == mask; } set { @@ -147,7 +146,7 @@ namespace System.Collections.Specialized { int mask = (1 << bit) - 1; int offset = previous.Offset + NumberOfSetBits (previous.Mask); - if (offset > 32) { + if (offset + NumberOfSetBits (mask) > 32) { throw new ArgumentException ("Sections cannot exceed 32 bits in total"); } diff --git a/mcs/class/System/System.Collections.Specialized/ChangeLog b/mcs/class/System/System.Collections.Specialized/ChangeLog index 0cf5154fd82..8cc984475b9 100755 --- a/mcs/class/System/System.Collections.Specialized/ChangeLog +++ b/mcs/class/System/System.Collections.Specialized/ChangeLog @@ -1,22 +1,3 @@ -2003-09-04 Duncan Mak <duncan@ximian.com> - - Patches from Alon Gazit <along@mainsoft.com>. - - * BitVector32.cs (CreateSection): Check that the new - calculated offset isn't more than 32 and not that the sum of the - new offset and the number of set bits is more than 32. - (this): Perform bitwise and with the complement of the mask - shifted version (~(section.Mask << section.Offset)) and not with - the shifted version of the mask's complement (~section.Mask << - section.Offset). - (this): Currently doesn't return the correct value when the data - in the BitVector32 instance is negative. - - * ListDictionary.cs (CopyTo): If the array is null, it should - throw ArgumentNullException. If the index is less than 0, it - should throw ArgumentOutOfRangeException. - (Remove): Throw ArgumentNullException when the parameter is null. - 2003-07-17 Andreas Nahr <ClassDevelopment@A-SoftTech.com> * StringDictionary.cs: Reworked attributes based on the new Consts scheme diff --git a/mcs/class/System/System.Collections.Specialized/ListDictionary.cs b/mcs/class/System/System.Collections.Specialized/ListDictionary.cs index c1c2b3ff125..40e6cb67581 100644 --- a/mcs/class/System/System.Collections.Specialized/ListDictionary.cs +++ b/mcs/class/System/System.Collections.Specialized/ListDictionary.cs @@ -121,14 +121,6 @@ namespace System.Collections.Specialized public void CopyTo(Array array, int index)
{
- if (array == null)
- throw new ArgumentNullException(
- "array",
- "Array cannot be null.");
-
- if (index < 0)
- throw new ArgumentOutOfRangeException("index", "index is less than 0");
-
int i = index;
foreach ( DictionaryEntry entry in this )
array.SetValue( entry, i++ );
@@ -204,12 +196,6 @@ namespace System.Collections.Specialized public void Remove(object key)
{
- if (key == null)
- throw new ArgumentNullException(
- "key",
- "Key cannot be null.");
-
-
ListEntry entry = root;
for (ListEntry prev = null; entry != null; prev = entry, entry = entry.next) {
diff --git a/mcs/class/System/System.ComponentModel.Design/Changelog b/mcs/class/System/System.ComponentModel.Design/Changelog index 1c602bd11ee..9a4c3146ac5 100644 --- a/mcs/class/System/System.ComponentModel.Design/Changelog +++ b/mcs/class/System/System.ComponentModel.Design/Changelog @@ -1,6 +1,3 @@ -2003-08-31 Alexandre Pigolkine <pigolkine@gmx.de> - * ServiceContainer.cs implemented - 2003-07-07 Andreas Nahr <ClassDevelopment@A-SoftTech.com> * DesignerTransaction.cs: Fixed signature diff --git a/mcs/class/System/System.ComponentModel.Design/ServiceContainer.cs b/mcs/class/System/System.ComponentModel.Design/ServiceContainer.cs index da171f8c87a..083d5321107 100644 --- a/mcs/class/System/System.ComponentModel.Design/ServiceContainer.cs +++ b/mcs/class/System/System.ComponentModel.Design/ServiceContainer.cs @@ -39,6 +39,7 @@ namespace System.ComponentModel.Design AddService (serviceType, callback, false); } + [MonoTODO] public void AddService (Type serviceType, object serviceInstance, bool promote) @@ -48,12 +49,11 @@ namespace System.ComponentModel.Design if (promote) if (parentProvider != null) ((IServiceContainer)parentProvider.GetService(typeof(IServiceContainer))).AddService (serviceType, serviceInstance, promote); - if (services.Contains (serviceType)) { - throw new ArgumentException (string.Format ("The service {0} already exists in the service container.", serviceType.ToString())); - } - services.Add (serviceType, serviceInstance); + // Add real implementation + throw new NotImplementedException(); } + [MonoTODO] public void AddService (Type serviceType, ServiceCreatorCallback callback, bool promote) @@ -63,10 +63,8 @@ namespace System.ComponentModel.Design if (promote) if (parentProvider != null) ((IServiceContainer)parentProvider.GetService(typeof(IServiceContainer))).AddService (serviceType, callback, promote); - if (services.Contains (serviceType)) { - throw new ArgumentException (string.Format ("The service {0} already exists in the service container.", serviceType.ToString())); - } - services.Add (serviceType, callback); + // Add real implementation + throw new NotImplementedException(); } public void RemoveService (Type serviceType) @@ -85,21 +83,10 @@ namespace System.ComponentModel.Design services.Remove (serviceType); } + [MonoTODO] public object GetService (Type serviceType) { - object result = services[serviceType]; - if (result == null && parentProvider != null){ - result = parentProvider.GetService (serviceType); - } - if (result != null) { - ServiceCreatorCallback cb = result as ServiceCreatorCallback; - if (cb != null) { - result = cb (this, serviceType); - services[serviceType] = result; - } - - } - return result; + throw new NotImplementedException(); } } } diff --git a/mcs/class/System/System.ComponentModel/ChangeLog b/mcs/class/System/System.ComponentModel/ChangeLog index 887283b1a18..1a503e2f339 100644 --- a/mcs/class/System/System.ComponentModel/ChangeLog +++ b/mcs/class/System/System.ComponentModel/ChangeLog @@ -1,6 +1,3 @@ -2003-08-31 Jerome Laban <jlaban@wanadoo.fr> - * Container.cs: A site without name cannot be duplicate. - 2003-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com> * Win32Exception.cs: added message for 10054. diff --git a/mcs/class/System/System.ComponentModel/Container.cs b/mcs/class/System/System.ComponentModel/Container.cs index c1f4e82cc23..2e35bc8c47d 100644 --- a/mcs/class/System/System.ComponentModel/Container.cs +++ b/mcs/class/System/System.ComponentModel/Container.cs @@ -115,11 +115,10 @@ namespace System.ComponentModel { protected virtual ISite CreateSite (IComponent component, string name) { - if (name != null) { - foreach (IComponent Comp in c) { - if (Comp.Site != null && Comp.Site.Name == name) - throw new ArgumentException ("duplicate component name", "name"); - } + foreach (IComponent Comp in c) { + if (Comp.Site != null) + if (Comp.Site.Name == name) + throw new ArgumentException ("duplicate component name", "name"); } return new DefaultSite (name, component, this); diff --git a/mcs/class/System/System.Net.Sockets/ChangeLog b/mcs/class/System/System.Net.Sockets/ChangeLog index efead7ffba8..2138e9a8607 100644 --- a/mcs/class/System/System.Net.Sockets/ChangeLog +++ b/mcs/class/System/System.Net.Sockets/ChangeLog @@ -1,8 +1,3 @@ -2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * TcpListener.cs: various fixes to make the new tests pass. Closes - bug #47848. - 2003-08-10 Miguel de Icaza <miguel@ximian.com> * UdpClient.cs (Receive): Fix Bug 45633; We should do a blocking diff --git a/mcs/class/System/System.Net.Sockets/TcpListener.cs b/mcs/class/System/System.Net.Sockets/TcpListener.cs index 40e3f7f6877..0a6e598b314 100755 --- a/mcs/class/System/System.Net.Sockets/TcpListener.cs +++ b/mcs/class/System/System.Net.Sockets/TcpListener.cs @@ -1,14 +1,13 @@ // System.Net.Sockets.TcpListener.cs // -// Authors: +// Author: // Phillip Pearson (pp@myelin.co.nz) -// Gonzalo Paniagua Javier (gonzalo@ximian.com) // // Copyright (C) 2001, Phillip Pearson // http://www.myelin.co.nz // -// (c) 2003 Ximian, Inc. (http://www.ximian.com) -// + +// NB: This is untested (probably buggy) code - take care using it using System; using System.Net; @@ -23,21 +22,18 @@ namespace System.Net.Sockets { // private data - bool active; - Socket server; - EndPoint savedEP; + private bool active; + private Socket server; // constructor /// <summary> /// Some code that is shared between the constructors. /// </summary> - private void Init (AddressFamily family, EndPoint ep) + private void Init (AddressFamily family) { active = false; - savedEP = ep; server = new Socket(family, SocketType.Stream, ProtocolType.Tcp); - server.Bind (ep); } /// <summary> @@ -45,15 +41,10 @@ namespace System.Net.Sockets /// </summary> /// <param name="port">The port to listen on, e.g. 80 if you /// are a web server</param> -#if NET_1_1 - [Obsolete ("Use TcpListener (IPAddress address, int port) instead")] -#endif public TcpListener (int port) { - if (port < 0 || port > 65535) - throw new ArgumentOutOfRangeException ("port"); - - Init (AddressFamily.InterNetwork, new IPEndPoint (IPAddress.Any, port)); + Init(AddressFamily.InterNetwork); + server.Bind(new IPEndPoint(IPAddress.Any, port)); } /// <summary> @@ -62,10 +53,8 @@ namespace System.Net.Sockets /// <param name="local_end_point">The endpoint</param> public TcpListener (IPEndPoint local_end_point) { - if (local_end_point == null) - throw new ArgumentNullException ("local_end_point"); - - Init (local_end_point.AddressFamily, local_end_point); + Init(local_end_point.AddressFamily); + server.Bind(local_end_point); } /// <summary> @@ -76,13 +65,8 @@ namespace System.Net.Sockets /// <param name="port">The port to listen on</param> public TcpListener (IPAddress listen_ip, int port) { - if (listen_ip == null) - throw new ArgumentNullException ("listen_ip"); - - if (port < 0 || port > 65535) - throw new ArgumentOutOfRangeException ("port"); - - Init (listen_ip.AddressFamily, new IPEndPoint(listen_ip, port)); + Init(listen_ip.AddressFamily); + server.Bind(new IPEndPoint(listen_ip, port)); } @@ -102,7 +86,7 @@ namespace System.Net.Sockets /// </summary> public EndPoint LocalEndpoint { - get { return savedEP; } + get { return server.LocalEndPoint; } } /// <summary> @@ -118,13 +102,9 @@ namespace System.Net.Sockets /// <summary> /// Accepts a pending connection - /// </summary> /// <returns>A Socket object for the new connection</returns> public Socket AcceptSocket () { - if (!active) - throw new InvalidOperationException ("Socket is not listening"); - return server.Accept(); } @@ -135,9 +115,6 @@ namespace System.Net.Sockets /// object made from the new socket.</returns> public TcpClient AcceptTcpClient () { - if (!active) - throw new InvalidOperationException ("Socket is not listening"); - TcpClient client = new TcpClient(); // use internal method SetTcpClient to make a // client with the specified socket @@ -150,8 +127,9 @@ namespace System.Net.Sockets /// </summary> ~TcpListener () { - if (active) + if (active == true) { Stop(); + } } /// <returns> @@ -160,9 +138,6 @@ namespace System.Net.Sockets /// </returns> public bool Pending () { - if (!active) - throw new InvalidOperationException ("Socket is not listening"); - return server.Poll(1000, SelectMode.SelectRead); } @@ -172,9 +147,6 @@ namespace System.Net.Sockets [MonoTODO] public void Start () { - if (active) - return; - server.Listen(5); // According to the // man page some BSD // and BSD-derived @@ -191,10 +163,7 @@ namespace System.Net.Sockets /// </summary> public void Stop () { - if (active) - server.Close (); - - Init (AddressFamily.InterNetwork, savedEP); + server.Close(); } } diff --git a/mcs/class/System/System.Net/ChangeLog b/mcs/class/System/System.Net/ChangeLog index 35484015d46..b0ac96a71c1 100644 --- a/mcs/class/System/System.Net/ChangeLog +++ b/mcs/class/System/System.Net/ChangeLog @@ -1,7 +1,3 @@ -2003-08-14 Nick Drochak <ndrochak@gol.com> - - * WebRequest.cs: Check lower case string since that is what we will add. - 2003-08-04 Jerome Laban <jlaban@wanadoo.fr> * IPHostEntry.cs: Default contructor must not initialize members. diff --git a/mcs/class/System/System.Net/WebRequest.cs b/mcs/class/System/System.Net/WebRequest.cs index 394654af3ce..93efc666455 100644 --- a/mcs/class/System/System.Net/WebRequest.cs +++ b/mcs/class/System/System.Net/WebRequest.cs @@ -156,10 +156,9 @@ namespace System.Net throw new ArgumentNullException("creator");
lock (prefixes.SyncRoot) {
- string lowerCasePrefix = prefix.ToLower ();
- if (prefixes.Contains (lowerCasePrefix))
+ if (prefixes.Contains (prefix))
return false;
- prefixes.Add (lowerCasePrefix, creator);
+ prefixes.Add (prefix.ToLower (), creator);
}
return true;
}
diff --git a/mcs/class/System/System_test.dll.sources b/mcs/class/System/System_test.dll.sources index 77445c616fc..7b72d1f2254 100644 --- a/mcs/class/System/System_test.dll.sources +++ b/mcs/class/System/System_test.dll.sources @@ -9,11 +9,9 @@ System/UriTest.cs System.Collections.Specialized/BasicOperationsTest.cs System.Collections.Specialized/BitVector32Test.cs System.Collections.Specialized/HybridDictionaryTest.cs -System.Collections.Specialized/ListDictionaryTest.cs System.Collections.Specialized/NameValueCollectionTest.cs System.Collections.Specialized/StringCollectionTest.cs System.ComponentModel/EventHandlerListTests.cs -System.ComponentModel.Design/ServiceContainerTest.cs System.Diagnostics/TraceTest.cs System.Diagnostics/SwitchesTest.cs System.Diagnostics/DiagnosticsConfigurationHandlerTest.cs diff --git a/mcs/class/System/Test/System.Collections.Specialized/BitVector32Test.cs b/mcs/class/System/Test/System.Collections.Specialized/BitVector32Test.cs index 2351d3d9025..3294d7ecc71 100644 --- a/mcs/class/System/Test/System.Collections.Specialized/BitVector32Test.cs +++ b/mcs/class/System/Test/System.Collections.Specialized/BitVector32Test.cs @@ -123,34 +123,6 @@ namespace MonoTests.System.Collections.Specialized Assertion.AssertEquals ("#10f", (short) 0x0c, s.Offset);
}
- [Test]
- public void TestNegativeIndexer ()
- {
- BitVector32 bv = new BitVector32 (-1);
- Assertion.AssertEquals ("#11a", false, bv [Int32.MinValue]);
- }
-
- [Test]
- public void TestSectionIndexer ()
- {
- BitVector32 bv = new BitVector32 (-1);
- BitVector32.Section sect = BitVector32.CreateSection (1);
- sect = BitVector32.CreateSection (Int16.MaxValue, sect);
- sect = BitVector32.CreateSection (Int16.MaxValue, sect);
- sect = BitVector32.CreateSection (1, sect);
- bv [sect] = 0;
-
- Assertion.AssertEquals ("#12a", Int32.MaxValue, bv.Data);
- }
-
- [Test, ExpectedException (typeof (ArgumentException))]
- public void TestCreateSection ()
- {
- BitVector32.Section section = BitVector32.CreateSection (Int16.MaxValue);
- section = BitVector32.CreateSection (Int16.MaxValue, section);
- Console.WriteLine (section);
- }
-
private void Print (BitVector32.Section s)
{
Console.WriteLine (s.ToString () + " : "+ s.Mask + " : " + s.Offset);
diff --git a/mcs/class/System/Test/System.Collections.Specialized/ChangeLog b/mcs/class/System/Test/System.Collections.Specialized/ChangeLog index 1021ddcf45e..233c3786c51 100644 --- a/mcs/class/System/Test/System.Collections.Specialized/ChangeLog +++ b/mcs/class/System/Test/System.Collections.Specialized/ChangeLog @@ -1,11 +1,3 @@ -2003-09-04 Duncan Mak <duncan@ximian.com> - - * BitVector32Test.cs (TestNegativeIndexer, TestSectionIndexer, - TestCreateSection): new tests from Alon Gazit <along@mainsoft.com>. - - * ListDictionaryTest.cs (CopyTo1, CopyTo2, Remove): New file, with - tests from Alon Gazit <along@mainsoft.com>. - 2002-06-24 Nick Drochak <ndrochak@gol.com> * BasicOperationsTest.cs: Make test pass on .NET 1.1. diff --git a/mcs/class/System/Test/System.Collections.Specialized/ListDictionaryTest.cs b/mcs/class/System/Test/System.Collections.Specialized/ListDictionaryTest.cs deleted file mode 100644 index fbd1ba0bdbe..00000000000 --- a/mcs/class/System/Test/System.Collections.Specialized/ListDictionaryTest.cs +++ /dev/null @@ -1,44 +0,0 @@ -// -// ListDictionaryTest.cs -// - NUnit Test Cases for System.Collections.Specialized.ListDictionary.cs -// -// Authors: -// Duncan Mak (duncan@ximian.com) -// Alon Gazit (along@mainsoft.com) -// -// -// Copyright (C) 2003 Ximian Inc. -// - -using NUnit.Framework; -using System; -using System.Collections; -using System.Collections.Specialized; - -namespace MonoTests.System.Collections.Specialized -{ - [TestFixture] - public class ListDictionaryTest : Assertion - { - [Test, ExpectedException (typeof (ArgumentNullException))] - public void CopyTo1 () - { - ListDictionary ld = new ListDictionary (); - ld.CopyTo (null, 0); - } - - [Test, ExpectedException (typeof (ArgumentOutOfRangeException))] - public void CopyTo2 () - { - ListDictionary ld = new ListDictionary (); - ld.CopyTo (new int[1],-1); - } - - [Test, ExpectedException (typeof (ArgumentNullException))] - public void Remove () - { - ListDictionary ld = new ListDictionary (); - ld.Remove (null); - } - } -} diff --git a/mcs/class/System/Test/System.ComponentModel.Design/ChangeLog b/mcs/class/System/Test/System.ComponentModel.Design/ChangeLog deleted file mode 100644 index e2240f3e133..00000000000 --- a/mcs/class/System/Test/System.ComponentModel.Design/ChangeLog +++ /dev/null @@ -1,5 +0,0 @@ -2003-08-31 Alexandre Pigolkine <pigolkine@gmx.de> - - * ChangeLog: - * ServiceContainerTest.cs new test - diff --git a/mcs/class/System/Test/System.ComponentModel.Design/ServiceContainerTest.cs b/mcs/class/System/Test/System.ComponentModel.Design/ServiceContainerTest.cs deleted file mode 100644 index 9bbe8193988..00000000000 --- a/mcs/class/System/Test/System.ComponentModel.Design/ServiceContainerTest.cs +++ /dev/null @@ -1,105 +0,0 @@ -// ServiceContainer.cs - NUnit Test Cases for System.ComponentModel.Design.ServiceContainer -// -// Alexandre Pigolkine (pigolkine@gmx.de) -// -// (C) Alexandre Pigolkine (pigolkine@gmx.de) -// - -using NUnit.Framework; -using System; -using System.ComponentModel.Design; - -namespace MonoTests.System.ComponentModel.Design -{ - -// Helper classes - - class NotInSvc - { - public NotInSvc() - { - } - } - - class Svc - { - public Svc () - { - } - - private static int objectsCreatedByCallback = 0; - - public static int TotalObjectsCreatedByCallback { - get { return objectsCreatedByCallback; } - } - - public static object ServiceCreator (IServiceContainer isc, Type tp) - { - Assertion.AssertEquals ("ServiceCreator#01", tp, typeof (Svc)); - ++objectsCreatedByCallback; - return new Svc(); - } - } - -[TestFixture] -public class ServiceContainerTest : Assertion { - - [SetUp] - public void GetReady() {} - - [TearDown] - public void Clean() {} - - [Test] - public void GeneralTest1 () - { - ServiceContainer sc = new ServiceContainer (); - - sc.AddService (typeof (Svc), new Svc()); - Svc service1 = sc.GetService (typeof (Svc)) as Svc; - Assertion.AssertNotNull ("GT1#01", service1); - Assertion.AssertEquals ("GT1#02", service1, sc.GetService (typeof (Svc))); - - bool exceptionThrown = false; - try { - sc.AddService (typeof (Svc), new Svc()); - } - catch (ArgumentException ex){ - exceptionThrown = true; - } - Assertion.AssertEquals ("GT1#03", exceptionThrown, true); - - Assertion.AssertNull ("GT1#04", sc.GetService (typeof (NotInSvc))); - } - - [Test] - public void TestServiceCreator () - { - ServiceContainer sc = new ServiceContainer (); - sc.AddService(typeof(Svc), new ServiceCreatorCallback(Svc.ServiceCreator)); - Assertion.AssertNull ("TSC#01", sc.GetService (typeof(NotInSvc))); - - Svc service1 = sc.GetService (typeof(Svc)) as Svc; - Assertion.AssertNotNull ("TSC#02", service1); - Assertion.AssertEquals ("TSC#03", Svc.TotalObjectsCreatedByCallback, 1); - - Svc service2 = sc.GetService (typeof(Svc)) as Svc; - Assertion.AssertEquals ("TSC#04", service2, service1); - Assertion.AssertEquals ("TSC#05", Svc.TotalObjectsCreatedByCallback, 1); - } - - [Test] - public void TestParentService () - { - ServiceContainer scParent = new ServiceContainer(); - ServiceContainer sc = new ServiceContainer(scParent); - - scParent.AddService(typeof(Svc), new Svc()); - - Svc service1 = sc.GetService (typeof(Svc)) as Svc; - Assertion.AssertNotNull ("TPS#01", service1); - - } - -} -} diff --git a/mcs/class/System/Test/System.Net.Sockets/ChangeLog b/mcs/class/System/Test/System.Net.Sockets/ChangeLog index 2874e2ab05a..d839c3d14e3 100644 --- a/mcs/class/System/Test/System.Net.Sockets/ChangeLog +++ b/mcs/class/System/Test/System.Net.Sockets/ChangeLog @@ -1,7 +1,3 @@ -2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * TcpListenerTest.cs: added more tests. - 2003-07-16 Peter Williams <peter@newton.cx> * TcpListenerTest.cs: Initialize outSock to null to diff --git a/mcs/class/System/Test/System.Net.Sockets/TcpListenerTest.cs b/mcs/class/System/Test/System.Net.Sockets/TcpListenerTest.cs index 08142b98448..76ff745d737 100755 --- a/mcs/class/System/Test/System.Net.Sockets/TcpListenerTest.cs +++ b/mcs/class/System/Test/System.Net.Sockets/TcpListenerTest.cs @@ -3,11 +3,9 @@ // Authors: // Phillip Pearson (pp@myelin.co.nz) // Martin Willemoes Hansen (mwh@sysrq.dk) -// Gonzalo Paniagua Javier (gonzalo@ximian.com) // // (C) Copyright 2001 Phillip Pearson (http://www.myelin.co.nz) // (C) Copyright 2003 Martin Willemoes Hansen (mwh@sysrq.dk) -// (c) 2003 Ximian, Inc. (http://www.ximian.com) // using System; @@ -15,157 +13,71 @@ using System.Net; using System.Net.Sockets; using NUnit.Framework; -namespace MonoTests.System.Net.Sockets -{ +namespace MonoTests.System.Net.Sockets { + + /// <summary> + /// Tests System.Net.Sockets.TcpListener + /// </summary> [TestFixture] - public class TcpListenerTest : Assertion - { + public class TcpListenerTest { + + /// <summary> + /// Tests the TcpListener object + /// (from System.Net.Sockets) + /// </summary> [Test] - public void TcpListener () + public void TcpListener() { // listen with a new listener (IPv4 is the default) - TcpListener inListener = new TcpListener (1234); + TcpListener inListener = new TcpListener(1234); inListener.Start(); // connect to it from a new socket - IPHostEntry hostent = Dns.GetHostByAddress (IPAddress.Loopback); + IPHostEntry hostent = Dns.GetHostByAddress("127.0.0.1"); Socket outSock = null; - foreach (IPAddress address in hostent.AddressList) { - if (address.AddressFamily == AddressFamily.InterNetwork) { - /// Only keep IPv4 addresses, our Server is in IPv4 only mode. - outSock = new Socket (address.AddressFamily, SocketType.Stream, + foreach(IPAddress address in hostent.AddressList) {
+ if(address.AddressFamily == AddressFamily.InterNetwork) {
+ /// Only keep IPv4 addresses, our Server is in IPv4 only mode.
+ outSock = new Socket(address.AddressFamily, SocketType.Stream, ProtocolType.IP); - IPEndPoint remote = new IPEndPoint (address, 1234); - outSock.Connect (remote); + IPEndPoint remote = new IPEndPoint(address, 1234); + outSock.Connect(remote); break; - } + }
} // make sure the connection arrives - Assert (inListener.Pending ()); - Socket inSock = inListener.AcceptSocket (); + Assertion.Assert(inListener.Pending()); + Socket inSock = inListener.AcceptSocket(); // now send some data and see if it comes out the other end const int len = 1024; - byte[] outBuf = new Byte [len]; + byte[] outBuf = new Byte[len]; for (int i=0; i<len; i++) - outBuf [i] = (byte) (i % 256); + { + outBuf[i] = (byte)(i % 256); + } - outSock.Send (outBuf, 0, len, 0); + outSock.Send(outBuf, 0, len, 0); byte[] inBuf = new Byte[len]; - int ret = inSock.Receive (inBuf, 0, len, 0); + int ret = inSock.Receive(inBuf, 0, len, 0); // let's see if it arrived OK - Assert(ret != 0); + Assertion.Assert(ret != 0); for (int i=0; i<len; i++) - Assert (inBuf[i] == outBuf [i]); - - // tidy up after ourselves - inSock.Close (); - - inListener.Stop (); - } - - [Test] - public void CtorInt1 () - { - int nex = 0; - try { new TcpListener (-1); } catch { nex++; } - new TcpListener (0); - new TcpListener (65535); - try { new TcpListener (65536); } catch { nex++; } - try { new TcpListener (100000); } catch { nex++; } - Assert (nex == 3); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void CtorIPEndPoint () - { - new TcpListener (null); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void CtorIPAddressInt1 () - { - new TcpListener (null, 100000); - } - - [Test] - [ExpectedException (typeof (ArgumentOutOfRangeException))] - public void CtorIPAddressInt2 () - { - new TcpListener (IPAddress.Any, 100000); - } - - class MyListener : TcpListener - { - public MyListener () - : base (IPAddress.Loopback, 5000) - { - } - - public Socket GetSocket () { - return Server; - } - - public bool IsActive { - get { return Active; } - } - } - - [Test] - public void PreStartStatus () - { - MyListener listener = new MyListener (); - AssertEquals ("#01", false, listener.IsActive); - Assert ("#02", null != listener.GetSocket ()); - try { - listener.AcceptSocket (); - Fail ("Exception not thrown"); - } catch (InvalidOperationException) { - } - - try { - listener.AcceptTcpClient (); - Fail ("Exception not thrown"); - } catch (InvalidOperationException) { + Assertion.Assert(inBuf[i] == outBuf[i]); } - try { - listener.Pending (); - Fail ("Exception not thrown"); - } catch (InvalidOperationException) { - } - - listener.Stop (); - } - [Test] - public void PostStartStatus () - { - MyListener listener = new MyListener (); - listener.Start (); - AssertEquals ("#01", true, listener.IsActive); - Assert ("#02", null != listener.GetSocket ()); - - Socket sock = listener.GetSocket (); - listener.Start (); // Start called twice - AssertEquals ("#03", true, listener.IsActive); - Assert ("#04", null != listener.GetSocket ()); - - AssertEquals ("#05", false, listener.Pending ()); + // tidy up after ourselves + inSock.Close(); - listener.Stop (); - AssertEquals ("#06", false, listener.IsActive); - Assert ("#07", null != listener.GetSocket ()); - Assert ("#08", sock != listener.GetSocket ()); + inListener.Stop(); } } } diff --git a/mcs/class/System/Test/System/ChangeLog b/mcs/class/System/Test/System/ChangeLog index ba06081be12..7427bb64021 100644 --- a/mcs/class/System/Test/System/ChangeLog +++ b/mcs/class/System/Test/System/ChangeLog @@ -1,8 +1,3 @@ -2003-08-18 Nick Drochak <ndrochak@gol.com> - - * UriBuilderTest.cs: Separated tests into NUnit v2 style. Need to track - down a test failure. - 2003-05-07 Ben Maurer <bmaurer@users.sourceforge.net> * UriTest.cs: added tests for UNIX file paths. diff --git a/mcs/class/System/Test/System/UriBuilderTest.cs b/mcs/class/System/Test/System/UriBuilderTest.cs index 1a0ed43b88a..d9451c5f58b 100644 --- a/mcs/class/System/Test/System/UriBuilderTest.cs +++ b/mcs/class/System/Test/System/UriBuilderTest.cs @@ -61,26 +61,24 @@ namespace MonoTests.System }
[Test]
- [ExpectedException (typeof (ArgumentOutOfRangeException))]
- public void BadPort1 ()
+ public void Port ()
{
- b.Port = -12345;
- }
-
- [Test]
- [ExpectedException (typeof (ArgumentOutOfRangeException))]
- public void BadPort2 ()
- {
- b.Port = 123456789;
- }
-
- [Test]
- [ExpectedException (typeof (ArgumentOutOfRangeException))]
- public void BadPort3 ()
- {
- b.Port = -1;
+ try {
+ b.Port = -12345;
+ Assertion.Fail ("#1 should've failed, illegal port.");
+ } catch (ArgumentOutOfRangeException) {}
+ try {
+ b.Port = 123456789;
+ Assertion.Fail ("#2 should've failed, illegal port.");
+ } catch (ArgumentOutOfRangeException) {}
+ try {
+ b.Port = -1;
+ Assertion.AssertEquals ("#3", -1, b.Port);
+ } catch (ArgumentOutOfRangeException) {
+ Assertion.Fail ("#4: spec should allow -1 as value.");
+ }
}
-
+
[Test]
public void Query ()
{
diff --git a/mcs/class/System/Test/system_linux_test.args b/mcs/class/System/Test/system_linux_test.args index 48b00f0b2dd..7b72d1f2254 100644 --- a/mcs/class/System/Test/system_linux_test.args +++ b/mcs/class/System/Test/system_linux_test.args @@ -9,7 +9,6 @@ System/UriTest.cs System.Collections.Specialized/BasicOperationsTest.cs System.Collections.Specialized/BitVector32Test.cs System.Collections.Specialized/HybridDictionaryTest.cs -System.Collections.Specialized/ListDictionaryTest.cs System.Collections.Specialized/NameValueCollectionTest.cs System.Collections.Specialized/StringCollectionTest.cs System.ComponentModel/EventHandlerListTests.cs diff --git a/mcs/class/corlib/ChangeLog b/mcs/class/corlib/ChangeLog index 77005b49f4a..337b7ae46c7 100644 --- a/mcs/class/corlib/ChangeLog +++ b/mcs/class/corlib/ChangeLog @@ -1,11 +1,3 @@ -2003-08-20 Duncan Mak <duncan@ximian.com> - - * corlib_test.dll.sources: Added DictionaryBaseTest.cs - -2003-08-19 Nick Drochak <ndrochak@gol.com> - - * Makefile: Turn on debug for the corlib tests on .NET. - 2003-08-06 Andreas Nahr <ClassDevelopment@A-SoftTech.com> * corlib.dll.sources: added quite some files diff --git a/mcs/class/corlib/Makefile b/mcs/class/corlib/Makefile index 44cc75f3ef1..835cccf732b 100644 --- a/mcs/class/corlib/Makefile +++ b/mcs/class/corlib/Makefile @@ -13,7 +13,7 @@ else test_against = $(reslib) endif -LOCAL_MCS_FLAGS = /nowarn:649 /nowarn:169 -d:INSIDE_CORLIB +LOCAL_MCS_FLAGS = /nowarn:649 /nowarn:169 corlib = $(topdir)/class/lib/corlib.dll testlib = corlib_test.dll cmplib = $(topdir)/class/lib/corlib_cmp.dll @@ -54,7 +54,7 @@ plattest_excludes = corlib_plattest.dll.excludes plattest_response = $(depsdir)/$(plattestlib).response plattest_makefrag = $(depsdir)/$(plattestlib).makefrag plattest_stampfile = $(depsdir)/$(plattestlib).stamp -plattest_flags = /debug+ /debug:full /nowarn:0618 /nowarn:0672 /r:$(PLATFORM_CORLIB) /r:$(topdir)/class/lib/NUnit.Framework.dll +plattest_flags = /nowarn:0618 /nowarn:0672 /r:$(PLATFORM_CORLIB) /r:$(topdir)/class/lib/NUnit.Framework.dll # Here, we make all. diff --git a/mcs/class/corlib/System.Collections/CaseInsensitiveHashCodeProvider.cs b/mcs/class/corlib/System.Collections/CaseInsensitiveHashCodeProvider.cs index 46e78113dba..1909d4aaa13 100644 --- a/mcs/class/corlib/System.Collections/CaseInsensitiveHashCodeProvider.cs +++ b/mcs/class/corlib/System.Collections/CaseInsensitiveHashCodeProvider.cs @@ -75,10 +75,15 @@ namespace System.Collections { int h = 0;
char c;
- int length = str.Length;
- for (int i = 0;i<length;i++) {
- c = Char.ToLower (str [i]);
- h = h * 31 + c;
+ if (str.Length > 0) {
+ for (int i = 0;i<str.Length;i++) {
+ c = str [i];
+
+ if (Char.IsLetter (c))
+ c = Char.ToLower (c);
+
+ h = h * 31 + c;
+ }
}
return h;
diff --git a/mcs/class/corlib/System.Collections/ChangeLog b/mcs/class/corlib/System.Collections/ChangeLog index 2f1b8c5daa6..488261b15ff 100644 --- a/mcs/class/corlib/System.Collections/ChangeLog +++ b/mcs/class/corlib/System.Collections/ChangeLog @@ -1,29 +1,3 @@ -2003-08-27 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * CaseInsensitiveHashCodeProvider.cs: small speed improvement. - -2003-08-21 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * Stack.cs: patch by JoergR@voelcker.com (Joerg Rosenkranz) that fixes - bug #47789. - -2003-08-20 Duncan Mak <duncan@ximian.com> - - * Hashtable.cs (PutImpl): Fix my previous checkin, see details - posted on bug #47692. - - I really hope I don't mess up this time, because, if I do again, - it will be really embarrassing. - -2003-08-17 Duncan Mak <duncan@ximian.com> - - * Hashtable.cs (PutImpl): Patch from Luca Barbieri <lb@lb.ods.org>. - Currently Hashtable.PutImpl has an incorrect test which causes the - key chain search to terminate as soon as a free slot is found, - causing key duplication. - - This fixes bug #47692. - 2003-08-11 Duncan Mak <duncan@ximian.com> * DictionaryBase.cs: Applied patch from Carlos Barcenilla diff --git a/mcs/class/corlib/System.Collections/Hashtable.cs b/mcs/class/corlib/System.Collections/Hashtable.cs index 24ba9cf3614..84922aa954a 100644 --- a/mcs/class/corlib/System.Collections/Hashtable.cs +++ b/mcs/class/corlib/System.Collections/Hashtable.cs @@ -598,12 +598,12 @@ namespace System.Collections { if (freeIndx == -1 && entry.key == KeyMarker.Removed - && (entry.hashMix & CHAIN_MARKER) != 0) + && (entry.hashMix & CHAIN_MARKER)!= 0) freeIndx = indx; if (entry.key == null || (entry.key == KeyMarker.Removed - && (entry.hashMix & CHAIN_MARKER) == 0)) { + && (entry.hashMix & CHAIN_MARKER)!= 0)) { if (freeIndx == -1) freeIndx = indx; diff --git a/mcs/class/corlib/System.Collections/Stack.cs b/mcs/class/corlib/System.Collections/Stack.cs index 5bf866d1ddc..0a65a818cf7 100644 --- a/mcs/class/corlib/System.Collections/Stack.cs +++ b/mcs/class/corlib/System.Collections/Stack.cs @@ -166,7 +166,6 @@ namespace System.Collections { public virtual object Clone() {
Stack stack = new Stack (contents);
stack.current = current; - stack.count = count; return stack;
}
diff --git a/mcs/class/corlib/System.Diagnostics/ChangeLog b/mcs/class/corlib/System.Diagnostics/ChangeLog index cca8c20d3a5..68657e288bb 100644 --- a/mcs/class/corlib/System.Diagnostics/ChangeLog +++ b/mcs/class/corlib/System.Diagnostics/ChangeLog @@ -1,8 +1,3 @@ -2003-09-02 Ravi Pratap <ravi@ximian.com> - - * DebuggerStepThroughAttribute.cs: Fix allowable targets to include class - and struct; remove property targets. - 2003-07-01 Zoltan Varga <vargaz@freemail.hu> * StackFrame.cs: Obtain frame info for 'fake' frames too, since this is diff --git a/mcs/class/corlib/System.Diagnostics/DebuggerStepThroughAttribute.cs b/mcs/class/corlib/System.Diagnostics/DebuggerStepThroughAttribute.cs index 53c559582e6..27d81891a1d 100644 --- a/mcs/class/corlib/System.Diagnostics/DebuggerStepThroughAttribute.cs +++ b/mcs/class/corlib/System.Diagnostics/DebuggerStepThroughAttribute.cs @@ -10,9 +10,8 @@ using System; namespace System.Diagnostics { - [AttributeUsage (AttributeTargets.Class | AttributeTargets.Struct | - AttributeTargets.Constructor | - AttributeTargets.Method)] + [AttributeUsage (AttributeTargets.Constructor | + AttributeTargets.Method | AttributeTargets.Property)] [Serializable] public sealed class DebuggerStepThroughAttribute : Attribute { diff --git a/mcs/class/corlib/System.Reflection.Emit/ChangeLog b/mcs/class/corlib/System.Reflection.Emit/ChangeLog index c9f9583e4db..8934925e62c 100644 --- a/mcs/class/corlib/System.Reflection.Emit/ChangeLog +++ b/mcs/class/corlib/System.Reflection.Emit/ChangeLog @@ -1,18 +1,3 @@ -2003-09-06 Martin Baulig <martin@ximian.com> - - * TypeBuilder.cs (TypeBuilder.IsUnboundGenericParameter): Implemented. - -2003-09-04 Martin Baulig <martin@ximian.com> - - * TypeBuilder.cs (TypeBuilder.MonoGenericParam): Make this nested - class internal, not protected. - -2003-08-29 Martin Baulig <martin@ximian.com> - - * TypeBuilder.cs (TypeBuilder.DefineGenericParameter): New public - method. We can now create generic types. - (TypeBuilder.GetGenericTypeDefinition): Override this; call the - `setup_internal_class' interncall before calling our base impl. Sat Aug 2 13:04:55 BST 2003 Malte Hildingson <malte@amy.udd.htu.se> diff --git a/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs index 90551bdf1b7..e82ce82bd00 100644 --- a/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs +++ b/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs @@ -8,7 +8,6 @@ // using System; -using System.Text; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; @@ -38,7 +37,6 @@ namespace System.Reflection.Emit { private ModuleBuilder pmodule; private int class_size; private PackingSize packing_size; - private MonoGenericParam[] generic_params; private Type created; string fullname; @@ -54,9 +52,6 @@ namespace System.Reflection.Emit { [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern void create_internal_class (TypeBuilder tb); - [MethodImplAttribute(MethodImplOptions.InternalCall)] - private extern void setup_generic_class (TypeBuilder tb); - internal TypeBuilder (ModuleBuilder mb, TypeAttributes attr) { this.parent = null; this.attrs = attr; @@ -474,18 +469,6 @@ namespace System.Reflection.Emit { /* handle nesting_type */ if (is_created) throw not_after_created (); - if (generic_params != null) { - StringBuilder sb = new StringBuilder ("<"); - for (int i = 0; i < generic_params.Length; i++) { - if (i > 0) - sb.Append (","); - sb.Append (generic_params [i].Name); - } - sb.Append (">"); - - tname = String.Concat (tname, sb.ToString ()); - fullname = GetFullName (); - } if (methods != null) { foreach (MethodBuilder method in methods) { method.fixup (); @@ -972,13 +955,6 @@ namespace System.Reflection.Emit { } #if GENERICS - public override Type GetGenericTypeDefinition () - { - setup_generic_class (this); - - return base.GetGenericTypeDefinition (); - } - public override bool HasGenericParameters { get { throw new NotImplementedException (); @@ -991,9 +967,10 @@ namespace System.Reflection.Emit { } } - public extern override bool IsUnboundGenericParameter { - [MethodImplAttribute(MethodImplOptions.InternalCall)] - get; + public override bool IsUnboundGenericParameter { + get { + throw new NotImplementedException (); + } } public override int GenericParameterPosition { @@ -1001,41 +978,6 @@ namespace System.Reflection.Emit { throw new Exception ("Unimplemented"); } } - - [MethodImplAttribute(MethodImplOptions.InternalCall)] - private extern static Type define_generic_parameter (TypeBuilder tb, MonoGenericParam param); - - public Type DefineGenericParameter (string name, Type[] constraints) - { - MonoGenericParam gparam = new MonoGenericParam (name, constraints); - - if (generic_params != null) { - MonoGenericParam[] new_generic_params = new MonoGenericParam [generic_params.Length+1]; - System.Array.Copy (generic_params, new_generic_params, generic_params.Length); - new_generic_params [generic_params.Length] = gparam; - generic_params = new_generic_params; - } else { - generic_params = new MonoGenericParam [1]; - generic_params [0] = gparam; - } - - return define_generic_parameter (this, gparam); - } #endif - - internal sealed class MonoGenericParam { - private readonly uint Handle; - - public readonly Type Type; - public readonly string Name; - public readonly int Flags; - public readonly Type[] Constraints; - - public MonoGenericParam (string name, Type[] constraints) - { - this.Name = name; - this.Constraints = constraints; - } - } } } diff --git a/mcs/class/corlib/System.Runtime.Remoting.Activation/AppDomainLevelActivator.cs b/mcs/class/corlib/System.Runtime.Remoting.Activation/AppDomainLevelActivator.cs index 8d4bd41aec7..e47464f12c7 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Activation/AppDomainLevelActivator.cs +++ b/mcs/class/corlib/System.Runtime.Remoting.Activation/AppDomainLevelActivator.cs @@ -11,7 +11,7 @@ using System.Runtime.Remoting.Messaging; namespace System.Runtime.Remoting.Activation { - internal class AppDomainLevelActivator: IActivator + public class AppDomainLevelActivator: IActivator { string _activationUrl; IActivator _next; diff --git a/mcs/class/corlib/System.Runtime.Remoting.Activation/ChangeLog b/mcs/class/corlib/System.Runtime.Remoting.Activation/ChangeLog index 1714aa34685..0d36c020dca 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Activation/ChangeLog +++ b/mcs/class/corlib/System.Runtime.Remoting.Activation/ChangeLog @@ -1,9 +1,3 @@ -2003-08-14 Lluis Sanchez Gual <lluis@ximian.com> - - * AppDomainLevelActivator.cs, ConstructionLevelActivator.cs, - ContextLevelActivator.cs, RemoteActivationAttribute.cs, - RemoteActivator.cs: Changed class from public to internal. - 2003-03-21 Lluis Sanchez Gual <lluis@ideary.com> * ActivationServices.cs: Added the method Activate that performs the forwards the diff --git a/mcs/class/corlib/System.Runtime.Remoting.Activation/ConstructionLevelActivator.cs b/mcs/class/corlib/System.Runtime.Remoting.Activation/ConstructionLevelActivator.cs index 789f54d1772..c8009e56a57 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Activation/ConstructionLevelActivator.cs +++ b/mcs/class/corlib/System.Runtime.Remoting.Activation/ConstructionLevelActivator.cs @@ -12,7 +12,7 @@ using System.Runtime.Remoting.Messaging; namespace System.Runtime.Remoting.Activation { [Serializable] - internal class ConstructionLevelActivator: IActivator + public class ConstructionLevelActivator: IActivator { IActivator _next; diff --git a/mcs/class/corlib/System.Runtime.Remoting.Activation/ContextLevelActivator.cs b/mcs/class/corlib/System.Runtime.Remoting.Activation/ContextLevelActivator.cs index b5b9fc8305e..52cf269c4a7 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Activation/ContextLevelActivator.cs +++ b/mcs/class/corlib/System.Runtime.Remoting.Activation/ContextLevelActivator.cs @@ -13,7 +13,7 @@ using System.Runtime.Remoting.Contexts; namespace System.Runtime.Remoting.Activation { [Serializable] - internal class ContextLevelActivator: IActivator + public class ContextLevelActivator: IActivator { IActivator _next; diff --git a/mcs/class/corlib/System.Runtime.Remoting.Activation/RemoteActivationAttribute.cs b/mcs/class/corlib/System.Runtime.Remoting.Activation/RemoteActivationAttribute.cs index 9ecf8710f59..c2aaca25028 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Activation/RemoteActivationAttribute.cs +++ b/mcs/class/corlib/System.Runtime.Remoting.Activation/RemoteActivationAttribute.cs @@ -13,7 +13,7 @@ using System.Collections; namespace System.Runtime.Remoting.Activation { - internal class RemoteActivationAttribute: Attribute, IContextAttribute + public class RemoteActivationAttribute: Attribute, IContextAttribute { // This activation attribute is used when creating a client activated // CBO in the server. This attribute will enforce the creation of diff --git a/mcs/class/corlib/System.Runtime.Remoting.Activation/RemoteActivator.cs b/mcs/class/corlib/System.Runtime.Remoting.Activation/RemoteActivator.cs index c8b62818e4d..c426dddf093 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Activation/RemoteActivator.cs +++ b/mcs/class/corlib/System.Runtime.Remoting.Activation/RemoteActivator.cs @@ -6,14 +6,14 @@ // (C) 2002, Lluis Sanchez Gual // -using System; +using System;
using System.Runtime.Remoting.Lifetime; -using System.Runtime.Remoting.Messaging; - -namespace System.Runtime.Remoting.Activation -{ - internal class RemoteActivator: MarshalByRefObject, IActivator - { +using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting.Activation
+{
+ public class RemoteActivator: MarshalByRefObject, IActivator
+ {
public IConstructionReturnMessage Activate (IConstructionCallMessage msg) { if (!RemotingConfiguration.IsActivationAllowed (msg.ActivationType)) @@ -28,28 +28,28 @@ namespace System.Runtime.Remoting.Activation ObjRef objref = RemotingServices.Marshal (newObject); return new ConstructionResponse (objref, null, msg); } - - public override Object InitializeLifetimeService() - { - ILease lease = (ILease)base.InitializeLifetimeService(); - if (lease.CurrentState == LeaseState.Initial) - { - lease.InitialLeaseTime = TimeSpan.FromMinutes(30); - lease.SponsorshipTimeout = TimeSpan.FromMinutes(1); - lease.RenewOnCallTime = TimeSpan.FromMinutes(10); - } - return lease; - } - - public ActivatorLevel Level +
+ public override Object InitializeLifetimeService()
+ {
+ ILease lease = (ILease)base.InitializeLifetimeService();
+ if (lease.CurrentState == LeaseState.Initial)
+ {
+ lease.InitialLeaseTime = TimeSpan.FromMinutes(30);
+ lease.SponsorshipTimeout = TimeSpan.FromMinutes(1);
+ lease.RenewOnCallTime = TimeSpan.FromMinutes(10);
+ }
+ return lease;
+ }
+
+ public ActivatorLevel Level
{ get { throw new NotSupportedException (); } } - public IActivator NextActivator + public IActivator NextActivator
{ get { throw new NotSupportedException (); } set { throw new NotSupportedException (); } } - } -} + }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/ChangeLog b/mcs/class/corlib/System.Runtime.Remoting.Channels/ChangeLog index fade3650e88..d2b105ef318 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Channels/ChangeLog +++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/ChangeLog @@ -1,12 +1,3 @@ -2003-08-25 Lluis Sanchez Gual <lluis@ximian.com> - - * ClientChannelSinkStack.cs: Implemented DispatchException. - -2003-08-14 Lluis Sanchez Gual <lluis@ximian.com> - - * ChannelServices.cs: Set call context info for the incoming - remote call, and restore the context after the call. - 2003-07-28 Duncan Mak <duncan@ximian.com> * TransportHeaders.cs: Added Serializable attribute. diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/ChannelServices.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/ChannelServices.cs index 1f7d093d4da..85241218590 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Channels/ChannelServices.cs +++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/ChannelServices.cs @@ -190,20 +190,7 @@ namespace System.Runtime.Remoting.Channels if (identity == null) return new ReturnMessage (new RemotingException ("No receiver for uri " + call.Uri), (IMethodCallMessage) msg); RemotingServices.SetMessageTargetIdentity (msg, identity); - - if (call.LogicalCallContext != null) - CallContext.SetCurrentCallContext (call.LogicalCallContext); - - try - { - IMessage response = _crossContextSink.SyncProcessMessage (msg); - response.Properties ["__CallContext"] = CallContext.CreateLogicalCallContext (); - return response; - } - finally - { - CallContext.ResetCurrentCallContext (); - } + return _crossContextSink.SyncProcessMessage (msg); } public static void UnregisterChannel (IChannel chnl) @@ -215,9 +202,12 @@ namespace System.Runtime.Remoting.Channels registeredChannels.Remove ((object) chnl); +/* + FIXME: uncomment when Thread.Abort works for windows. IChannelReceiver chnlReceiver = chnl as IChannelReceiver; if(chnlReceiver != null) chnlReceiver.StopListening(null); + */ } internal static object [] GetCurrentChannelInfo () diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels/ClientChannelSinkStack.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels/ClientChannelSinkStack.cs index b5573a4457f..5f431bf340c 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Channels/ClientChannelSinkStack.cs +++ b/mcs/class/corlib/System.Runtime.Remoting.Channels/ClientChannelSinkStack.cs @@ -44,9 +44,10 @@ namespace System.Runtime.Remoting.Channels // after its own processing } + [MonoTODO] public void DispatchException (Exception e) { - DispatchReplyMessage (new ReturnMessage (e, null)); + throw new NotImplementedException (); } public void DispatchReplyMessage (IMessage msg) diff --git a/mcs/class/corlib/System.Runtime.Remoting.Lifetime/ChangeLog b/mcs/class/corlib/System.Runtime.Remoting.Lifetime/ChangeLog index 5eda5611fdf..b6f049e3a60 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Lifetime/ChangeLog +++ b/mcs/class/corlib/System.Runtime.Remoting.Lifetime/ChangeLog @@ -1,7 +1,3 @@ -2003-08-14 Lluis Sanchez Gual <lluis@ximian.com> - - * ClientSponsor.cs: Implemented. - 2003-03-03 Lluis Sanchez Gual <lluis@ideary.com> * LeaseManager.cs: Added method for removing an object from the lease manager. diff --git a/mcs/class/corlib/System.Runtime.Remoting.Lifetime/ClientSponsor.cs b/mcs/class/corlib/System.Runtime.Remoting.Lifetime/ClientSponsor.cs index 0105e51c3cc..c6400477f75 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Lifetime/ClientSponsor.cs +++ b/mcs/class/corlib/System.Runtime.Remoting.Lifetime/ClientSponsor.cs @@ -2,13 +2,11 @@ // System.Runtime.Remoting.Lifetime.ClientSponsor.cs // // Author: Duncan Mak (duncan@ximian.com) -// Lluis Sanchez Gual (lluis@ximian.com) // // 2002 (C) Copyright. Ximian, Inc. // using System; -using System.Collections; using System.Runtime.Remoting.Lifetime; namespace System.Runtime.Remoting.Lifetime { @@ -16,7 +14,6 @@ namespace System.Runtime.Remoting.Lifetime { public class ClientSponsor : MarshalByRefObject, ISponsor { TimeSpan renewal_time; - ArrayList registered_objects = new ArrayList (); public ClientSponsor () { @@ -38,47 +35,39 @@ namespace System.Runtime.Remoting.Lifetime { } } + [MonoTODO] public void Close () { - foreach (MarshalByRefObject obj in registered_objects) - { - ILease lease = obj.GetLifetimeService () as ILease; - lease.Unregister (this); - } - registered_objects.Clear (); } + [MonoTODO] ~ClientSponsor () { - Close (); + throw new NotImplementedException (); } + [MonoTODO] public override object InitializeLifetimeService () { - return base.InitializeLifetimeService (); + throw new NotImplementedException (); } + [MonoTODO] public bool Register (MarshalByRefObject obj) { - if (registered_objects.Contains (obj)) return false; - ILease lease = obj.GetLifetimeService () as ILease; - if (lease == null) return false; - lease.Register (this); - registered_objects.Add (obj); - return true; + throw new NotImplementedException (); } + [MonoTODO] public TimeSpan Renewal (ILease lease) { - return renewal_time; + throw new NotImplementedException (); } + [MonoTODO] public void Unregister (MarshalByRefObject obj) { - if (!registered_objects.Contains (obj)) return; - ILease lease = obj.GetLifetimeService () as ILease; - lease.Unregister (this); - registered_objects.Remove (obj); + throw new NotImplementedException (); } } } diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/AsyncResult.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/AsyncResult.cs index d403f72b6d4..4ab128170ba 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Messaging/AsyncResult.cs +++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/AsyncResult.cs @@ -25,11 +25,7 @@ public class AsyncResult : IAsyncResult, IMessageSink { bool sync_completed; bool completed; bool endinvoke_called; - object[] out_args; - object ret_val; - Exception exception; IMessageCtrl message_ctrl; - IMessage reply_message; public virtual object AsyncState { @@ -88,9 +84,10 @@ public class AsyncResult : IAsyncResult, IMessageSink { throw new NotSupportedException (); } + [MonoTODO] public virtual IMessage GetReplyMessage() { - return reply_message; + throw new NotImplementedException (); } public virtual void SetMessageCtrl (IMessageCtrl mc) @@ -98,21 +95,8 @@ public class AsyncResult : IAsyncResult, IMessageSink { message_ctrl = mc; } - internal void SetCompletedSynchronously (bool completed) - { - sync_completed = completed; - } - - internal IMessage EndInvoke () - { - handle.WaitOne (); - return reply_message; - } - public virtual IMessage SyncProcessMessage (IMessage msg) { - reply_message = msg; - completed = true; NativeEventCalls.SetEvent_internal (handle.Handle); // TODO: invoke callback diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/CADMessages.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/CADMessages.cs index 88a2441d13f..8373fd26ffd 100755 --- a/mcs/class/corlib/System.Runtime.Remoting.Messaging/CADMessages.cs +++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/CADMessages.cs @@ -78,11 +78,18 @@ namespace System.Runtime.Remoting.Messaging { // We can ignore marshalling for string and primitive types private static bool IsPossibleToIgnoreMarshal (object obj) { + // until this is more tested, we disable it.... + return false; + +/* if (obj is string) + return true; + Type objType = obj.GetType(); if (objType.IsPrimitive || objType == typeof(void)) return true; return false; +*/ } // Checks an argument if it's possible to pass without marshalling and diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/CallContext.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/CallContext.cs index 1d1d7a7f3c5..b3b1dee70ad 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Messaging/CallContext.cs +++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/CallContext.cs @@ -2,18 +2,16 @@ // System.Runtime.Remoting.Messaging.CallContext.cs // // Author: Jaime Anguiano Olarra (jaime@gnome.org) -// Lluis Sanchez Gual (lluis@ximian.com) // // (c) 2002, Jaime Anguiano Olarra // +// FIXME: This is just a skeleton for practical purposes. ///<summary> ///Provides several properties that come with the execution code path. ///This class is sealed. ///</summary> using System; -using System.Threading; -using System.Collections; namespace System.Runtime.Remoting.Messaging { @@ -22,77 +20,34 @@ namespace System.Runtime.Remoting.Messaging public sealed class CallContext { // public methods + [MonoTODO] public static void FreeNamedDataSlot (string name) { - Datastore.Remove (name); + throw new NotImplementedException (); } + [MonoTODO] public static object GetData (string name) { - return Datastore [name]; + throw new NotImplementedException (); } + [MonoTODO] public static Header[] GetHeaders () { - return (Header[]) Datastore ["__Headers"]; + throw new NotImplementedException (); } + [MonoTODO] public static void SetData (string name, object data) { - Datastore [name] = data; + throw new NotImplementedException (); } + [MonoTODO] public static void SetHeaders (Header[] headers) { - Datastore ["__Headers"] = headers; + throw new NotImplementedException (); } - - internal static LogicalCallContext CreateLogicalCallContext () - { - LocalDataStoreSlot ds = Thread.GetNamedDataSlot ("__CallContext"); - Hashtable res = (Hashtable) Thread.GetData (ds); - - LogicalCallContext ctx = new LogicalCallContext(); - if (res == null) return ctx; - - foreach (DictionaryEntry entry in res) - if (entry.Value is ILogicalThreadAffinative) - ctx.SetData ((string)entry.Key, entry.Value); - - return ctx; - } - - internal static void SetCurrentCallContext (LogicalCallContext ctx) - { - Hashtable data = ctx.Datastore; - if (data == null) return; - - data.Clear (); - foreach (DictionaryEntry entry in data) - SetData ((string)entry.Key, entry.Value); - } - - internal static void ResetCurrentCallContext () - { - LocalDataStoreSlot ds = Thread.GetNamedDataSlot ("__CallContext"); - Thread.SetData (ds, null); - } - - private static Hashtable Datastore - { - get { - LocalDataStoreSlot ds = Thread.GetNamedDataSlot ("__CallContext"); - Hashtable res = (Hashtable) Thread.GetData (ds); - if (res == null) { - res = new Hashtable (); - Thread.SetData (ds, res); - } - return res; - } - } - } - - public interface ILogicalThreadAffinative - { } } diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog b/mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog index 22889874d8a..633a1d2e1aa 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog +++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog @@ -1,37 +1,3 @@ -2003-08-28 Lluis Sanchez Gual <lluis@ximian.com> - - * MonoMethodMessage.cs: Moved CallType into namespace declaration. - -2003-08-25 Lluis Sanchez Gual <lluis@ximian.com> - - * AsyncResult.cs: Added method EndInvoke(). Fixed SyncProcessMessage(). - * CallContext.cs: Clean current logical context before setting the new - values form LogicalCallContext (SetCurrentCallContext). - * MonoMethodMessage.cs: Added new CallType field and enum. - * StackBuilderSink.cs: Improved error message. - -2003-08-20 Lluis Sanchez Gual <lluis@ximian.com> - - * MethodCall.cs: Changed exception text to match MS.NET (more or less). - * AsyncResult.cs: Added new fields to store async calls results. - -2003-08-17 Lluis Sanchez Gual <lluis@ximian.com> - - * MethodCall.cs: Throw the right exception if the target object is not - found when resolving the target method. - -2003-08-17 Lluis Sanchez Gual <lluis@ximian.com> - - * CallContext.cs: Fixed bug #47686. - -2003-08-14 Lluis Sanchez Gual <lluis@ximian.com> - - * CADMessages.cs: Enabled smuggeling of primitive type parameters (as suggested - by Patrik). - * CallContext.cs: Impplemented. - * LogicalCallContext.cs: Implemented. - * MonoMethodMessage.cs: Added setter for LogicalCallContext property. - 2003-07-25 Lluis Sanchez Gual <lluis@ximian.com> * ArgInfo.cs: Use Type.IsByRef to check if a parameter is a ref or diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/LogicalCallContext.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/LogicalCallContext.cs index 686764f781c..a9e44a0ca4b 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Messaging/LogicalCallContext.cs +++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/LogicalCallContext.cs @@ -1,112 +1,43 @@ -// -// System.Runtime.Remoting.Messaging.LogicalCallContext.cs -// -// Author: -// Dan Lewis (dihlewis@yahoo.co.uk) -// Lluis Sanchez Gual (lluis@ximian.com) -// -// 2002 (C) Copyright. Ximian, Inc. -// - -using System.Collections; -using System.Runtime.Serialization; - -namespace System.Runtime.Remoting.Messaging { - - [MonoTODO] +//
+// System.Runtime.Remoting.Messaging.LogicalCallContext.cs
+//
+// Author:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+// Stubbed.
+//
+
+using System.Runtime.Serialization;
+
+namespace System.Runtime.Remoting.Messaging {
+
+ [MonoTODO]
[Serializable] - public sealed class LogicalCallContext : ISerializable, ICloneable - { - Hashtable _data; - CallContextRemotingData _remotingData = new CallContextRemotingData(); - - internal LogicalCallContext () - { - } - - internal LogicalCallContext (SerializationInfo info, StreamingContext context) - { - foreach (SerializationEntry entry in info) - { - if (entry.Name == "__RemotingData") - _remotingData = (CallContextRemotingData) entry.Value; - else - SetData (entry.Name, entry.Value); - } - } - - public bool HasInfo - { - get - { - return (_data != null && _data.Count > 0); - } - } - - public void FreeNamedDataSlot (string name) - { - if (_data != null) - _data.Remove (name); - } - - public object GetData (string name) - { - if (_data != null) return _data [name]; - else return null; - } - - public void GetObjectData (SerializationInfo info, StreamingContext context) - { - info.AddValue ("__RemotingData", _remotingData); - if (_data != null) - { - foreach (DictionaryEntry de in _data) - info.AddValue ((string)de.Key, de.Value); - } - } - - public void SetData (string name, object data) - { - if (_data == null) _data = new Hashtable (); - _data [name] = data; - } - - public object Clone () - { - LogicalCallContext nc = new LogicalCallContext (); - nc._remotingData = (CallContextRemotingData) _remotingData.Clone (); - if (_data != null) - { - nc._data = new Hashtable (); - foreach (DictionaryEntry de in _data) - nc._data [de.Key] = de.Value; - } - return nc; - } - - internal Hashtable Datastore - { - get { return _data; } - } - } - - [Serializable] - internal class CallContextRemotingData : ICloneable - { - string _logicalCallID; - - public string LogicalCallID - { - get { return _logicalCallID; } - set { _logicalCallID = value; } - } - - public object Clone () - { - CallContextRemotingData data = new CallContextRemotingData (); - data._logicalCallID = _logicalCallID; - return data; - } -} -} - + public sealed class LogicalCallContext : ISerializable, ICloneable {
+ + internal LogicalCallContext () {} + + public bool HasInfo {
+ get { return false; }
+ }
+
+ public void FreeNamedDataSlot (string name) {
+ }
+
+ public object GetData (string name) {
+ return null;
+ }
+
+ public void GetObjectData (SerializationInfo info, StreamingContext context) {
+ }
+
+ public void SetData (string name, object data) {
+ }
+
+ public object Clone () {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs index 545f63b8fd3..5ace8cd6573 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs +++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs @@ -264,7 +264,6 @@ namespace System.Runtime.Remoting.Messaging { if (_uri != null) { Type type = RemotingServices.GetServerTypeForUri (_uri); - if (type == null) throw new RemotingException ("Requested service not found. No receiver for uri " + _uri); if (CanCastTo (_typeName, type)) { diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MonoMethodMessage.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MonoMethodMessage.cs index 57ebd2c274b..48856e53bd6 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MonoMethodMessage.cs +++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MonoMethodMessage.cs @@ -34,8 +34,6 @@ namespace System.Runtime.Remoting.Messaging { AsyncResult asyncResult; - CallType call_type; - string uri; MethodCallDictionary properties; @@ -78,9 +76,6 @@ namespace System.Runtime.Remoting.Messaging { public int ArgCount { get { - if (CallType == CallType.EndInvoke) - return -1; - if (null == args) return 0; @@ -104,10 +99,6 @@ namespace System.Runtime.Remoting.Messaging { get { return ctx; } - - set { - ctx = value; - } } public MethodBase MethodBase { @@ -174,9 +165,6 @@ namespace System.Runtime.Remoting.Messaging { public int InArgCount { get { - if (CallType == CallType.EndInvoke) - return -1; - if (null == args) return 0; @@ -319,26 +307,5 @@ namespace System.Runtime.Remoting.Messaging { { get { return asyncResult; } } - - internal CallType CallType - { - get - { - // FIXME: ideally, the OneWay type would be set by the runtime - - if (call_type == CallType.Sync && RemotingServices.IsOneWay (method)) - call_type = CallType.OneWay; - return call_type; - } - } - } - - internal enum CallType: int - { - Sync = 0, - BeginInvoke = 1, - EndInvoke = 2, - OneWay = 3 } } - diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/StackBuilderSink.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/StackBuilderSink.cs index 96a4d2f2b3b..56a57b1d937 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Messaging/StackBuilderSink.cs +++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/StackBuilderSink.cs @@ -57,7 +57,7 @@ namespace System.Runtime.Remoting.Messaging if (pt.IsByRef) pt = pt.GetElementType (); if (pval != null && !pt.IsInstanceOfType (pval)) - throw new RemotingException ("Cannot cast argument " + pi.Position + " of type '" + pval.GetType().AssemblyQualifiedName + + throw new RemotingException ("Cannot cast argument of type '" + pval.GetType().AssemblyQualifiedName + "' to type '" + pt.AssemblyQualifiedName + "'"); } } diff --git a/mcs/class/corlib/System.Runtime.Remoting.Proxies/ChangeLog b/mcs/class/corlib/System.Runtime.Remoting.Proxies/ChangeLog index 9f85697f82b..31404bbf867 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Proxies/ChangeLog +++ b/mcs/class/corlib/System.Runtime.Remoting.Proxies/ChangeLog @@ -1,18 +1,3 @@ -2003-08-25 Lluis Sanchez Gual <lluis@ximian.com> - - * RemotingProxy.cs: Use CallType property to check the type of - the message. - -2003-08-24 Vladimir Vukicevic <vladimir@pobox.com> - - * RealProxy.cs, RemotingProxy.cs: move the LogicalCallContext - setup/restoration into RealProxy's PrivateInvoke, so that custom - RealProxy's get a LogicalCallContext. - -2003-08-14 Lluis Sanchez Gual <lluis@ximian.com> - - * RemotingProxy.cs: On invoke, set the LogicalCallContext of the message. - 2003-07-28 Duncan Mak <duncan@ximian.com> * RealProxy.cs (GetProxiedType): Removed 'virtual' keyword. diff --git a/mcs/class/corlib/System.Runtime.Remoting.Proxies/RealProxy.cs b/mcs/class/corlib/System.Runtime.Remoting.Proxies/RealProxy.cs index 969680f3a2b..756a816339e 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Proxies/RealProxy.cs +++ b/mcs/class/corlib/System.Runtime.Remoting.Proxies/RealProxy.cs @@ -86,14 +86,8 @@ namespace System.Runtime.Remoting.Proxies internal static object PrivateInvoke (RealProxy rp, IMessage msg, out Exception exc, out object [] out_args) { - MonoMethodMessage mMsg = (MonoMethodMessage) msg; - mMsg.LogicalCallContext = CallContext.CreateLogicalCallContext(); - IMethodReturnMessage res_msg = (IMethodReturnMessage)rp.Invoke (msg); - if (res_msg.LogicalCallContext != null) - CallContext.SetCurrentCallContext (res_msg.LogicalCallContext); - exc = res_msg.Exception; out_args = res_msg.OutArgs; diff --git a/mcs/class/corlib/System.Runtime.Remoting.Proxies/RemotingProxy.cs b/mcs/class/corlib/System.Runtime.Remoting.Proxies/RemotingProxy.cs index 73efcda9209..f8beeba6268 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Proxies/RemotingProxy.cs +++ b/mcs/class/corlib/System.Runtime.Remoting.Proxies/RemotingProxy.cs @@ -48,9 +48,6 @@ namespace System.Runtime.Remoting.Proxies { MonoMethodMessage mMsg = (MonoMethodMessage) request; - if (mMsg.CallType == CallType.EndInvoke) - return mMsg.AsyncResult.EndInvoke (); - if (mMsg.MethodBase.IsConstructor) return ActivateRemoteObject (mMsg); @@ -74,16 +71,15 @@ namespace System.Runtime.Remoting.Proxies else sink = _sink; - if (mMsg.CallType == CallType.Sync) - response = sink.SyncProcessMessage (request); - else + if (RemotingServices.IsAsyncMessage (request)) { AsyncResult ares = ((MonoMethodMessage)request).AsyncResult; IMessageCtrl mctrl = sink.AsyncProcessMessage (request, ares); if (ares != null) ares.SetMessageCtrl (mctrl); response = new ReturnMessage (null, new object[0], 0, null, mMsg); } - + else + response = sink.SyncProcessMessage (request); _objectIdentity.NotifyClientDynamicSinks (false, request, true, false); if (!(response is IConstructionReturnMessage)) diff --git a/mcs/class/corlib/System.Runtime.Remoting/ChangeLog b/mcs/class/corlib/System.Runtime.Remoting/ChangeLog index b16fbf2fe3f..7d396aa832d 100755 --- a/mcs/class/corlib/System.Runtime.Remoting/ChangeLog +++ b/mcs/class/corlib/System.Runtime.Remoting/ChangeLog @@ -1,13 +1,3 @@ -2003-08-25 Lluis Sanchez Gual <lluis@ximian.com> - - * RemotingServices.cs: Some small fixes. - -2003-08-14 Lluis Sanchez Gual <lluis@ximian.com> - - * ObjRef.cs: Implemented IsFromThisProcess(). - * RemotingServices.cs: Implemented methods GetLifetimeService and - GetEnvoyChainForProxy. Stubbed LogRemotingStage. - 2003-07-29 Lluis Sanchez Gual <lluis@ximian.com> * RemotingServices.cs: GetObjectUri(): For client proxies, return diff --git a/mcs/class/corlib/System.Runtime.Remoting/ObjRef.cs b/mcs/class/corlib/System.Runtime.Remoting/ObjRef.cs index 19f59839eb0..ec12d5710b4 100644 --- a/mcs/class/corlib/System.Runtime.Remoting/ObjRef.cs +++ b/mcs/class/corlib/System.Runtime.Remoting/ObjRef.cs @@ -47,7 +47,7 @@ namespace System.Runtime.Remoting { flags = o.flags; if (unmarshalAsProxy) flags |= MarshalledObjectRef; } - + public ObjRef (MarshalByRefObject mbr, Type type) { if (mbr == null) @@ -130,7 +130,7 @@ namespace System.Runtime.Remoting { return false; } - internal bool IsReferenceToWellKnow + public bool IsReferenceToWellKnow { get { return (flags & WellKnowObjectRef) > 0; } } @@ -199,18 +199,11 @@ namespace System.Runtime.Remoting { return identity.IsFromThisAppDomain; } + [MonoTODO] public bool IsFromThisProcess () { - foreach (object data in channel_info.ChannelData) - { - if (data is CrossAppDomainData) - { - string refProcId = ((CrossAppDomainData)data).ProcessID; - return (refProcId == RemotingConfiguration.ProcessId); - } - } - - return true; + // as yet we do not consider this optimization + return false; } internal void UpdateChannelInfo() diff --git a/mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs b/mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs index 8db9eb22b9c..b3dbef05a62 100644 --- a/mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs +++ b/mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs @@ -211,7 +211,7 @@ namespace System.Runtime.Remoting } else { - ClientActivatedIdentity identity = GetIdentityForUri (uri) as ClientActivatedIdentity; + ClientActivatedIdentity identity = uri_hash [uri] as ClientActivatedIdentity; if (identity == null || obj != identity.GetServerObject()) CreateClientActivatedServerIdentity (obj, requested_type, uri); } @@ -258,25 +258,6 @@ namespace System.Runtime.Remoting else return ident.CreateObjRef(null); } - public static object GetLifetimeService (MarshalByRefObject obj) - { - if (obj == null) return null; - return obj.GetLifetimeService (); - } - - public static IMessageSink GetEnvoyChainForProxy (MarshalByRefObject obj) - { - if (IsTransparentProxy(obj)) - return ((ClientIdentity)GetRealProxy (obj).ObjectIdentity).EnvoySink; - else - throw new ArgumentException ("obj must be a proxy","obj"); - } - - public static void LogRemotingStage (int stage) - { - throw new NotImplementedException (); - } - [MonoTODO] public static string GetSessionIdForMethodMessage(IMethodMessage msg) { @@ -486,7 +467,7 @@ namespace System.Runtime.Remoting internal static object GetProxyForRemoteObject (ObjRef objref, Type classToProxy) { - ClientActivatedIdentity identity = GetIdentityForUri (objref.URI) as ClientActivatedIdentity; + ClientActivatedIdentity identity = uri_hash [objref.URI] as ClientActivatedIdentity; if (identity != null) return identity.GetServerObject (); else return GetRemoteObject (objref, classToProxy); } @@ -525,10 +506,7 @@ namespace System.Runtime.Remoting internal static void DisposeIdentity (ServerIdentity ident) { - lock (uri_hash) - { - uri_hash.Remove (ident.ObjectUri); - } + uri_hash.Remove (ident.ObjectUri); } internal static Identity GetMessageTargetIdentity (IMessage msg) diff --git a/mcs/class/corlib/System.Security.Cryptography/ChangeLog b/mcs/class/corlib/System.Security.Cryptography/ChangeLog index e90342090b7..87edf0a8360 100644 --- a/mcs/class/corlib/System.Security.Cryptography/ChangeLog +++ b/mcs/class/corlib/System.Security.Cryptography/ChangeLog @@ -1,8 +1,3 @@ -2003-08-24 Sebastien Pouliot <spouliot@videotron.ca> - - * SymmetricAlgorithm.cs: Fixed IV length exception for stream ciphers - (e.g. RC4) which don't uses IV. This needs more tests for small IV... - 2003-08-09 Sebastien Pouliot <spouliot@videotron.ca> * SymmetricAlgorithm.cs: Re-introduced Lluis patch for PaddingMode.None diff --git a/mcs/class/corlib/System.Security.Cryptography/SymmetricAlgorithm.cs b/mcs/class/corlib/System.Security.Cryptography/SymmetricAlgorithm.cs index 7795d819121..578227afd51 100755 --- a/mcs/class/corlib/System.Security.Cryptography/SymmetricAlgorithm.cs +++ b/mcs/class/corlib/System.Security.Cryptography/SymmetricAlgorithm.cs @@ -381,7 +381,7 @@ namespace System.Security.Cryptography { if (KeySizes.IsLegalKeySize (this.LegalBlockSizesValue, value)) this.BlockSizeValue = value; else - throw new CryptographicException ("block size not supported by algorithm"); + throw new CryptographicException("block size not supported by algorithm"); } } @@ -392,7 +392,7 @@ namespace System.Security.Cryptography { get { return this.FeedbackSizeValue; } set { if (value > this.BlockSizeValue) - throw new CryptographicException ("feedback size larger than block size"); + throw new CryptographicException("feedback size larger than block size"); else this.FeedbackSizeValue = value; } @@ -404,18 +404,19 @@ namespace System.Security.Cryptography { public virtual byte[] IV { get { if (this.IVValue == null) - GenerateIV (); + GenerateIV(); return this.IVValue; } set { if (value == null) - throw new ArgumentNullException ("value"); - // compare bytes with bits - if ((value.Length << 3) > this.BlockSizeValue) - throw new CryptographicException ("IV length can't be greater than block size"); + throw new ArgumentNullException ("tried setting initial vector to null"); + + if (value.Length * 8 != this.BlockSizeValue) + throw new CryptographicException ("IV length must match block size"); - this.IVValue = (byte[]) value.Clone (); + this.IVValue = new byte [value.Length]; + Array.Copy (value, 0, this.IVValue, 0, value.Length); } } @@ -425,21 +426,20 @@ namespace System.Security.Cryptography { public virtual byte[] Key { get { if (this.KeyValue == null) - GenerateKey (); + GenerateKey(); return this.KeyValue; } set { if (value == null) - throw new ArgumentNullException ("value"); - // compare bytes with bits - int length = (value.Length << 3); + throw new ArgumentNullException ("tried setting key to null"); - if (!KeySizes.IsLegalKeySize (this.LegalKeySizesValue, length)) + if (!KeySizes.IsLegalKeySize (this.LegalKeySizesValue, value.Length * 8)) throw new CryptographicException ("key size not supported by algorithm"); - this.KeySizeValue = length; - this.KeyValue = (byte[]) value.Clone (); + this.KeySizeValue = value.Length * 8; + this.KeyValue = new byte [value.Length]; + Array.Copy (value, 0, this.KeyValue, 0, value.Length); } } @@ -477,7 +477,7 @@ namespace System.Security.Cryptography { public virtual CipherMode Mode { get { return this.ModeValue; } set { - if (Enum.IsDefined (ModeValue.GetType (), value)) + if (Enum.IsDefined( ModeValue.GetType (), value)) this.ModeValue = value; else throw new CryptographicException ("padding mode not available"); diff --git a/mcs/class/corlib/System.Text/ChangeLog b/mcs/class/corlib/System.Text/ChangeLog index 959ff311f7a..aa69f6a9989 100755 --- a/mcs/class/corlib/System.Text/ChangeLog +++ b/mcs/class/corlib/System.Text/ChangeLog @@ -1,17 +1,3 @@ -2003-09-01 Miguel de Icaza <miguel@ximian.com> - - * Encoding.cs (UTF8Unmarked): make it also not error out on - invalid input, that is what the Microsoft default is for the - StreamReader and BinaryReader expect (our main consumers). - -2003-08-21 Ben Maurer <bmaurer@users.sourceforge.net> - - * StringBuilder.cs - (AppendFormat) Use FormatHelper in System.String to avoid - allocating an extra StringBuilder. - (Append string, int, int), (Append char, int): Both were - allocating extra strings. - 2003-06-05 Nick Drochak <ndrochak@gol.com> * UTF8Encoding.cs: Cleanups according to class status page diff --git a/mcs/class/corlib/System.Text/Encoding.cs b/mcs/class/corlib/System.Text/Encoding.cs index ea1e74a1ed9..af6835e3acd 100755 --- a/mcs/class/corlib/System.Text/Encoding.cs +++ b/mcs/class/corlib/System.Text/Encoding.cs @@ -684,14 +684,14 @@ public abstract class Encoding } // - // Only internal, to be used by the class libraries: Unmarked and non-input-validating + // Only internal, to be used by the class libraries // internal static Encoding UTF8Unmarked { get { if (utf8EncodingWithoutMarkers == null) { lock (typeof (Encoding)){ if (utf8EncodingWithoutMarkers == null){ - utf8EncodingWithoutMarkers = new UTF8Encoding (false, false); + utf8EncodingWithoutMarkers = new UTF8Encoding (false, true); } } } diff --git a/mcs/class/corlib/System.Text/StringBuilder.cs b/mcs/class/corlib/System.Text/StringBuilder.cs index cd769bc77e2..09196a5ddbf 100644 --- a/mcs/class/corlib/System.Text/StringBuilder.cs +++ b/mcs/class/corlib/System.Text/StringBuilder.cs @@ -258,7 +258,7 @@ namespace System.Text { return Replace( oldValue, newValue, 0, sLength );
}
- public StringBuilder Replace( string oldValue, string newValue, int startIndex, int count ) { + public StringBuilder Replace( string oldValue, string newValue, int startIndex, int count ) {
string startString = this.ToString();
StringBuilder newStringB = new StringBuilder();
@@ -430,21 +430,9 @@ namespace System.Text { public StringBuilder Append( char value, int repeatCount ) {
if( repeatCount < 0 ) {
throw new ArgumentOutOfRangeException();
- } -
- if( sLength + repeatCount > sCapacity ) { - // Need more capacity, double the capacity StringBuilder - // and make sure we have at least enough for the value - // if that's going to go over double. - - Capacity = repeatCount + ( sCapacity + sCapacity); - } - - for (int i = 0; i < repeatCount; i++) - sString [sLength++] = value; - - thestring = null; - return this;
+ }
+
+ return Append( new String( value, repeatCount) );
}
public StringBuilder Append( char[] value, int startIndex, int charCount ) {
@@ -472,44 +460,41 @@ namespace System.Text { if( (count < 0 || startIndex < 0) ||
( startIndex + count > value.Length ) ) {
throw new ArgumentOutOfRangeException();
- } - - int new_size = sLength + count; - if (new_size > sCapacity) - Capacity = count + sCapacity * 2; - - value.CopyTo (startIndex, sString, sLength, count); - sLength = new_size; - thestring = null; - return this;
+ }
+
+ return Append (value.Substring (startIndex, count));
}
public StringBuilder AppendFormat (string format, object arg0 )
{
- return AppendFormat (null, format, new object [] { arg0 });
+ string result = String.Format (format, arg0);
+ return Append (result);
}
public StringBuilder AppendFormat (string format, params object[] args )
{
- return AppendFormat (null, format, args);
+ string result = String.Format (format, args);
+ return Append (result);
}
public StringBuilder AppendFormat (IFormatProvider provider,
string format,
params object[] args)
{
- String.FormatHelper (this, provider, format, args); - return this;
+ string result = String.Format (provider, format, args);
+ return Append (result);
}
public StringBuilder AppendFormat (string format, object arg0, object arg1 )
{
- return AppendFormat (null, format, new object [] { arg0, arg1 });
+ string result = String.Format (format, arg0, arg1);
+ return Append (result);
}
public StringBuilder AppendFormat (string format, object arg0, object arg1, object arg2 )
{
- return AppendFormat (null, format, new object [] { arg0, arg1, arg2 });
+ string result = String.Format (format, arg0, arg1, arg2);
+ return Append (result);
}
/* The Insert Functions */
diff --git a/mcs/class/corlib/System.Threading/ChangeLog b/mcs/class/corlib/System.Threading/ChangeLog index 1242777b10d..8a94a0f256a 100644 --- a/mcs/class/corlib/System.Threading/ChangeLog +++ b/mcs/class/corlib/System.Threading/ChangeLog @@ -1,14 +1,3 @@ - -Wed Aug 20 12:01:36 CEST 2003 Paolo Molaro <lupus@ximian.com> - - * Thread.cs: put all the fields at the start and add - more fields needed by the runtime. - -2003-08-14 Lluis Sanchez Gual <lluis@ximian.com> - - * Thread.cs: SetData() method: use Hashtable.Contains to check - if a dataslot has been allocated (value could be null). - 2003-07-23 Duncan Mak <duncan@ximian.com> * WaitHandle.cs (CheckDisposed): This method is not in the public diff --git a/mcs/class/corlib/System.Threading/Thread.cs b/mcs/class/corlib/System.Threading/Thread.cs index 5a6526c7b1f..b04cc1ada65 100755 --- a/mcs/class/corlib/System.Threading/Thread.cs +++ b/mcs/class/corlib/System.Threading/Thread.cs @@ -34,12 +34,6 @@ namespace System.Threading private IntPtr start_notify; private IntPtr stack_ptr; private IntPtr static_data; - private IntPtr jit_data; - private IntPtr lock_data; - - private ThreadStart threadstart; - private string thread_name=null; - public static Context CurrentContext { get { @@ -180,7 +174,7 @@ namespace System.Threading object data) { Hashtable slothash=GetTLSSlotHash(); - if(slothash.Contains(slot)) { + if(slothash[slot]!=null) { slothash.Remove(slot); } @@ -221,6 +215,8 @@ namespace System.Threading [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern IntPtr Thread_internal(ThreadStart start); + private ThreadStart threadstart; + public Thread(ThreadStart start) { if(start==null) { throw new ArgumentNullException("Null ThreadStart"); @@ -323,6 +319,8 @@ namespace System.Threading } } + private string thread_name=null; + public string Name { get { return(thread_name); diff --git a/mcs/class/corlib/System/Array.cs b/mcs/class/corlib/System/Array.cs index 055902d470d..c7379af5006 100644 --- a/mcs/class/corlib/System/Array.cs +++ b/mcs/class/corlib/System/Array.cs @@ -4,9 +4,8 @@ // Joe Shaw (joe@ximian.com) // Martin Baulig (martin@gnome.org) // Dietmar Maurer (dietmar@ximian.com) -// Gonzalo Paniagua Javier (gonzalo@ximian.com) // -// (C) 2001-2003 Ximian, Inc. http://www.ximian.com +// (C) 2001 Ximian, Inc. http://www.ximian.com // using System.Collections; @@ -50,13 +49,9 @@ namespace System // IList interface object IList.this [int index] { get { - if (unchecked ((uint) index) >= unchecked ((uint) Length)) - throw new ArgumentOutOfRangeException ("index"); return GetValueImpl (index); } set { - if (unchecked ((uint) index) >= unchecked ((uint) Length)) - throw new ArgumentOutOfRangeException ("index"); SetValueImpl (value, index); } } @@ -131,11 +126,9 @@ namespace System [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern void SetValue (object value, int[] idxs); - /* CAUTION! No bounds checking! */ [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern object GetValueImpl (int pos); - /* CAUTION! No bounds checking! */ [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern void SetValueImpl (object value, int pos); @@ -219,90 +212,6 @@ namespace System return GetValue (ind); } -#if NET_1_1 - public object GetValue (long idx) - { - if (idx < 0 || idx > Int32.MaxValue) - throw new ArgumentOutOfRangeException ("idx"); - - return GetValue ((int) idx); - } - - public object GetValue (long idx1, long idx2) - { - if (idx1 < 0 || idx1 > Int32.MaxValue) - throw new ArgumentOutOfRangeException ("idx1"); - - if (idx2 < 0 || idx2 > Int32.MaxValue) - throw new ArgumentOutOfRangeException ("idx2"); - - return GetValue ((int) idx1, (int) idx2); - } - - public object GetValue (long idx1, long idx2, long idx3) - { - if (idx1 < 0 || idx1 > Int32.MaxValue) - throw new ArgumentOutOfRangeException ("idx1"); - - if (idx2 < 0 || idx2 > Int32.MaxValue) - throw new ArgumentOutOfRangeException ("idx2"); - - if (idx3 < 0 || idx3 > Int32.MaxValue) - throw new ArgumentOutOfRangeException ("idx3"); - - return GetValue ((int) idx1, (int) idx2, (int) idx3); - } - - public void SetValue (object value, long idx) - { - if (idx < 0 || idx > Int32.MaxValue) - throw new ArgumentOutOfRangeException ("idx"); - - int[] ind = new int [1]; - - ind [0] = (int) idx; - - SetValue (value, ind); - } - - public void SetValue (object value, long idx1, long idx2) - { - if (idx1 < 0 || idx1 > Int32.MaxValue) - throw new ArgumentOutOfRangeException ("idx1"); - - if (idx2 < 0 || idx2 > Int32.MaxValue) - throw new ArgumentOutOfRangeException ("idx2"); - - int[] ind = new int [2]; - - ind [0] = (int) idx1; - ind [1] = (int) idx2; - - SetValue (value, ind); - } - - public void SetValue (object value, long idx1, long idx2, long idx3) - { - if (idx1 < 0 || idx1 > Int32.MaxValue) - throw new ArgumentOutOfRangeException ("idx1"); - - if (idx2 < 0 || idx2 > Int32.MaxValue) - throw new ArgumentOutOfRangeException ("idx2"); - - if (idx3 < 0 || idx3 > Int32.MaxValue) - throw new ArgumentOutOfRangeException ("idx3"); - - int[] ind = new int [3]; - - ind [0] = (int) idx1; - ind [1] = (int) idx2; - ind [2] = (int) idx3; - - SetValue (value, ind); - } - -#endif - // This function is currently unused, but just in case we need it later on ... */ internal int IndexToPos (int[] idxs) { @@ -424,39 +333,7 @@ namespace System return CreateInstanceImpl (elementType, lengths, bounds); } -#if NET_1_1 - - static int [] GetIntArray (long [] values) - { - int len = values.Length; - int [] ints = new int [len]; - for (int i = 0; i < len; i++) { - long current = values [i]; - if (current < 0 || current > (long) Int32.MaxValue) - throw new ArgumentOutOfRangeException ("indices", "Value too big"); - - ints [i] = (int) current; - } - - return ints; - } - - public static Array CreateInstance (Type elementType, params long [] lengths) - { - return CreateInstance (elementType, GetIntArray (lengths)); - } - - public object GetValue (long [] indices) - { - return GetValue (GetIntArray (indices)); - } - - public void SetValue (object value, long [] indices) - { - SetValue (value, GetIntArray (indices)); - } -#endif - + public static int BinarySearch (Array array, object value) { if (array == null) diff --git a/mcs/class/corlib/System/ChangeLog b/mcs/class/corlib/System/ChangeLog index c523bccf409..d89e960f4d8 100644 --- a/mcs/class/corlib/System/ChangeLog +++ b/mcs/class/corlib/System/ChangeLog @@ -1,35 +1,3 @@ -2003-09-04 Martin Baulig <martin@ximian.com> - - * Type.cs (GetGenericTypeDefinition): Make this method virtual. - -2003-08-27 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * Array.cs: added the new overloaded CreateInstance, GetValue, SetValue - taking 'longs'. All tests pass. - -2003-08-26 Ben Maurer <bmaurer@users.sourceforge.net> - - * Exception.cs: Add ClassInterface attr. Implement TargetSite and - Source. Remove MonoTODO attributes (class is 100% done). Also - passes all Rotor tests for Exception! - -2003-08-26 Ben Maurer <bmaurer@users.sourceforge.net> - - * Enum.cs: Remove [MonoTODO]'s that had been completed. - -2003-08-22 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * String.cs: fixed bug #47802. - -2003-08-21 Ben Maurer <bmaurer@users.sourceforge.net> - - * String.cs: Created method FormatHelper that does formatting, - using a StringBuilder. - -2003-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * Array.cs: patch by lb@lb.ods.org that fixes bug #47707. - 2003-08-11 Gonzalo Paniagua Javier <gonzalo@ximian.com> * Delegate.cs: CreteDelegate (Type, MethodInfo) only supports static diff --git a/mcs/class/corlib/System/Enum.cs b/mcs/class/corlib/System/Enum.cs index b3406b506a5..8e05d5e5d5b 100644 --- a/mcs/class/corlib/System/Enum.cs +++ b/mcs/class/corlib/System/Enum.cs @@ -362,6 +362,7 @@ namespace System { return ToString (format, null); } + [MonoTODO] public string ToString (String format, IFormatProvider provider) { // provider is not used for Enums @@ -619,6 +620,7 @@ namespace System { return retVal; } + [MonoTODO] public static string Format (Type enumType, object value, string format) { if (null == enumType) diff --git a/mcs/class/corlib/System/Exception.cs b/mcs/class/corlib/System/Exception.cs index 42bd49f8267..9e9d563c846 100644 --- a/mcs/class/corlib/System/Exception.cs +++ b/mcs/class/corlib/System/Exception.cs @@ -8,15 +8,14 @@ // (C) Ximian, Inc. http://www.ximian.com // -using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Reflection; -using System.Diagnostics; namespace System { [Serializable] - [ClassInterface (ClassInterfaceType.AutoDual)] + // [ClassInterface (ClassInterfaceType.AutoDual)] (no implementation yet) + [MonoTODO] public class Exception : ISerializable { IntPtr [] trace_ips; @@ -109,16 +108,14 @@ namespace System { } } + [MonoTODO] public virtual string Source { get { - if (source == null) { - StackTrace st = new StackTrace (this, true); - if (st.FrameCount > 0) - source = st.GetFrame (0).GetMethod ().DeclaringType.Assembly.GetName ().Name; - } - + // TODO: if source is null, we must return + // the name of the assembly where the error + // originated. return source; } @@ -136,14 +133,12 @@ namespace System { } } + [MonoTODO] public MethodBase TargetSite { get { - StackTrace st = new StackTrace (this, true); - if (st.FrameCount > 0) - return st.GetFrame (0).GetMethod (); - + // TODO: Implement this. return null; } } diff --git a/mcs/class/corlib/System/String.cs b/mcs/class/corlib/System/String.cs index c4f705c084e..95cf5c70614 100644 --- a/mcs/class/corlib/System/String.cs +++ b/mcs/class/corlib/System/String.cs @@ -114,7 +114,7 @@ namespace System { } public String[] Split(char[] separator, int count) { - if (null == separator || separator.Length == 0) { + if (null == separator) { separator = WhiteChars; } @@ -566,15 +566,11 @@ namespace System { } public static string Format (IFormatProvider provider, string format, params object[] args) { - StringBuilder b = new StringBuilder (); - FormatHelper (b, provider, format, args); - return b.ToString (); - } - - internal static void FormatHelper (StringBuilder result, IFormatProvider provider, string format, params object[] args) { if (format == null || args == null) throw new ArgumentNullException (); - + + StringBuilder result = new StringBuilder (); + int ptr = 0; int start = ptr; while (ptr < format.length) { @@ -642,6 +638,8 @@ namespace System { if (start < format.length) result.Append (format.Substring (start)); + + return result.ToString (); } public static String Copy (String str) { diff --git a/mcs/class/corlib/System/Type.cs b/mcs/class/corlib/System/Type.cs index b096e5842b4..3155ebab74c 100644 --- a/mcs/class/corlib/System/Type.cs +++ b/mcs/class/corlib/System/Type.cs @@ -944,7 +944,7 @@ namespace System { [MethodImplAttribute(MethodImplOptions.InternalCall)] static extern Type GetGenericTypeDefinition (Type t); - public virtual Type GetGenericTypeDefinition () + public Type GetGenericTypeDefinition () { Type res = GetGenericTypeDefinition (this); if (res == null) diff --git a/mcs/class/corlib/Test/System.Diagnostics/ChangeLog b/mcs/class/corlib/Test/System.Diagnostics/ChangeLog index 75a3b306872..94239863b35 100644 --- a/mcs/class/corlib/Test/System.Diagnostics/ChangeLog +++ b/mcs/class/corlib/Test/System.Diagnostics/ChangeLog @@ -1,8 +1,3 @@ -2003-08-19 Nick Drochak <ndrochak@gol.com>
-
- * StackFrameTest.cs: Isolate test failure by making tests finer
- grained.
-
2003-07-01 Zoltan Varga <vargaz@freemail.hu>
* StackFrameTest.cs (TestGetMethod): Remove test for method name, since
diff --git a/mcs/class/corlib/Test/System.Diagnostics/StackFrameTest.cs b/mcs/class/corlib/Test/System.Diagnostics/StackFrameTest.cs index ab612c51f36..c8a77d778f9 100644 --- a/mcs/class/corlib/Test/System.Diagnostics/StackFrameTest.cs +++ b/mcs/class/corlib/Test/System.Diagnostics/StackFrameTest.cs @@ -132,13 +132,10 @@ namespace MonoTests.System.Diagnostics { /// <summary> /// Tests whether getting file name works. /// </summary> - public void TestGetFileName1() { + public void TestGetFileName() { AssertNull("File name (1)", frame1.GetFileName()); - } - - public void TestGetFileName2() { Assert("File name (2) " + frame2.GetFileName() + " ends with StackFrameTest.cs", frame2.GetFileName().EndsWith("StackFrameTest.cs")); diff --git a/mcs/class/corlib/Test/System/ArrayTest.cs b/mcs/class/corlib/Test/System/ArrayTest.cs index c14d43f0775..5f0f85e752c 100644 --- a/mcs/class/corlib/Test/System/ArrayTest.cs +++ b/mcs/class/corlib/Test/System/ArrayTest.cs @@ -26,14 +26,6 @@ namespace MonoTests.System } } - class BClass : AClass - { - } - - class CClass : AClass - { - } - struct AStruct { public string s; @@ -552,21 +544,6 @@ public class ArrayTest : Assertion } Assert("#E79", !errorThrown); } - - { - // bug #38812 - bool errorThrown = false; - try { - CClass[] src = new CClass [] { new CClass () }; - BClass[] dest = new BClass [1]; - - src.CopyTo (dest, 0); - - } catch (ArrayTypeMismatchException) { - errorThrown = true; - } - Assert("#E80", errorThrown); - } } [Test] diff --git a/mcs/class/corlib/Test/System/ChangeLog b/mcs/class/corlib/Test/System/ChangeLog index 56f821d8210..3484ec73dfc 100644 --- a/mcs/class/corlib/Test/System/ChangeLog +++ b/mcs/class/corlib/Test/System/ChangeLog @@ -1,11 +1,3 @@ -2003-08-22 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * StringTest.cs: added a couple of tests for Split. See bug #47802. - -2003-08-21 Zoltan Varga <vargaz@freemail.hu> - - * ArrayTest.cs: Added regression test for #38812. - 2003-08-10 Miguel de Icaza <miguel@ximian.com> * ArrayTest.cs: New test from Thong (Tum) Nguyen. diff --git a/mcs/class/corlib/Test/System/StringTest.cs b/mcs/class/corlib/Test/System/StringTest.cs index 29726616e61..f7599888ef8 100644 --- a/mcs/class/corlib/Test/System/StringTest.cs +++ b/mcs/class/corlib/Test/System/StringTest.cs @@ -944,16 +944,6 @@ public class StringTest : Assertion AssertEquals("Zero split", 0, chunks.Length); } - [Test] - public void MoreSplit () - { - string test = "123 456 789"; - string [] st = test.Split (); - AssertEquals ("#01", "123", st [0]); - st = test.Split (null); - AssertEquals ("#02", "123", st [0]); - } - public void TestStartsWith() { string s1 = "original"; diff --git a/mcs/class/corlib/corlib_test.dll.sources b/mcs/class/corlib/corlib_test.dll.sources index 28e13e70eb3..0039ca30698 100755 --- a/mcs/class/corlib/corlib_test.dll.sources +++ b/mcs/class/corlib/corlib_test.dll.sources @@ -53,7 +53,6 @@ System.Collections/CaseInsensitiveComparerTest.cs System.Collections/CaseInsensitiveHashCodeProviderTest.cs System.Collections/CollectionBaseTest.cs System.Collections/ComparerTest.cs -System.Collections/DictionaryBaseTest.cs System.Collections/DictionaryEntryTest.cs System.Collections/HashtableTest.cs System.Collections/QueueTest.cs diff --git a/mcs/errors/ChangeLog b/mcs/errors/ChangeLog index 5da043e718f..67a7180ee54 100644 --- a/mcs/errors/ChangeLog +++ b/mcs/errors/ChangeLog @@ -1,11 +1,3 @@ -2003-09-06 Martin Baulig <martin@ximian.com> - - * errors.txt: Added -216. - -2003-08-28 Ben Maurer <bmaurer@users.sourceforge.net> - - * cs0666.xml: added sample xml file for monodoc error provider. - 2003-07-28 Martin Baulig <martin@ximian.com> * cs0075.cs: This test case was incorrect; according to the spec, diff --git a/mcs/errors/cs0666.xml b/mcs/errors/cs0666.xml deleted file mode 100644 index aa6d6b6a43d..00000000000 --- a/mcs/errors/cs0666.xml +++ /dev/null @@ -1,15 +0,0 @@ -<ErrorDetails> - <Summary> - <p> - It is not permissable to have a protected member - inside a struct. - </p> - </Summary> - <Details> - <p> - As structs are implicitly declared as <b>sealed</b> they - can not have protected members. Usually you can fix this - error by changing the scope of the variable. - </p> - </Details> -</ErrorDetails>
\ No newline at end of file diff --git a/mcs/errors/cs8201.cs b/mcs/errors/cs8201.cs index eca84c06da0..ce204a3559e 100644 --- a/mcs/errors/cs8201.cs +++ b/mcs/errors/cs8201.cs @@ -1,5 +1,5 @@ // -// Should report an error, as class X is defined twice +// Should report an error, as C is defined twice // class X <T> { diff --git a/mcs/errors/cs8208.cs b/mcs/errors/cs8208.cs index 89190161e65..0838f406ddc 100644 --- a/mcs/errors/cs8208.cs +++ b/mcs/errors/cs8208.cs @@ -1,5 +1,5 @@ // cs8208.cs: yield can not appear inside the finally clause. -// Line: 10 +// Line: using System.Collections; class X { diff --git a/mcs/errors/cs8209.cs b/mcs/errors/cs8209.cs index f4fbae1e599..4fbdf2585d0 100644 --- a/mcs/errors/cs8209.cs +++ b/mcs/errors/cs8209.cs @@ -1,5 +1,5 @@ // cs8209.cs: yield can not appear inside the catch clause. -// Line: 10 +// Line: using System.Collections; class X { diff --git a/mcs/errors/cs8211.cs b/mcs/errors/cs8211.cs index 1422a14c37f..5e01159b741 100644 --- a/mcs/errors/cs8211.cs +++ b/mcs/errors/cs8211.cs @@ -1,5 +1,3 @@ -// cs8211.cs: Array expression passed to attribute is not unidimensional -// Line: 14 using System; using System.Reflection; diff --git a/mcs/errors/cs8214.cs b/mcs/errors/cs8214.cs index c044ef5d758..6259130aafb 100644 --- a/mcs/errors/cs8214.cs +++ b/mcs/errors/cs8214.cs @@ -1,5 +1,4 @@ -// cs8214.cs: Generic type can not derive from Attribute class -// Line: 5 + using System; class X<T> : Attribute { diff --git a/mcs/errors/errors.txt b/mcs/errors/errors.txt index 98a6e6ed401..652496fb003 100755 --- a/mcs/errors/errors.txt +++ b/mcs/errors/errors.txt @@ -114,10 +114,4 @@ the Microsoft C# compiler: -213 This feature requires v2 support. --214 Generic class can not have attribute as its parent class - --215 Taking the address of a parameter in an iterator is not allowed. - --216 Can not use a type parameters as base class - --217 Wrong number of type parameters +-214 Generic class can not have attribute as its parent class
\ No newline at end of file diff --git a/mcs/gmcs/.cvsignore b/mcs/gmcs/.cvsignore deleted file mode 100644 index 04a6b8dc3a6..00000000000 --- a/mcs/gmcs/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -y.output -cs-parser.cs -*.dll diff --git a/mcs/gmcs/AssemblyInfo.cs b/mcs/gmcs/AssemblyInfo.cs index 19fca65f4d4..60c2d35431d 100644 --- a/mcs/gmcs/AssemblyInfo.cs +++ b/mcs/gmcs/AssemblyInfo.cs @@ -1,7 +1,7 @@ using System.Reflection; using System.Runtime.CompilerServices; -[assembly: AssemblyVersion("0.26")] +[assembly: AssemblyVersion("0.25.99")] [assembly: AssemblyTitle ("Mono C# Compiler")] [assembly: AssemblyDescription ("Mono C# Compiler with Generics")] [assembly: AssemblyCopyright ("2001, 2002, 2003 Ximian, Inc.")] diff --git a/mcs/gmcs/ChangeLog b/mcs/gmcs/ChangeLog index 8225eca6f55..88ab7258240 100755 --- a/mcs/gmcs/ChangeLog +++ b/mcs/gmcs/ChangeLog @@ -1,245 +1,3 @@ -2003-09-07 Martin Baulig <martin@ximian.com> - - * report.cs (Error, Warning): Added overloaded versions which take - a `params object[] args' and call String.Format(). - -2003-09-07 Martin Baulig <martin@ximian.com> - - * decl.cs (DeclSpace..ctor): Don't call - NamespaceEntry.DefineName() here; do it in RecordDecl() which is - called from Tree.RecordDecl(). Fixes the CS0101 reporting. - (DeclSpace.RecordDecl): New method. - - * tree.cs (Tree.RecordDecl): Call ds.RecordDecl(). - -2003-09-02 Ravi Pratap <ravi@ximian.com> - - * attribute.cs (CheckAttributeTarget): Ensure that we allow return - value attributes to be applied to ParameterBuilders. - - * class.cs (MethodCore.LabelParameters): Make static and more - generic so that it can be used from other places - like interface - methods, for instance. - - * interface.cs (Interface.Emit): Call LabelParameters before - emitting attributes on the InterfaceMethod. - -2003-09-07 Martin Baulig <martin@ximian.com> - - * generic.cs (ConstructedType.ResolveAsTypeStep): Report a CS8217 - if the number of type parameters doesn't match. - -2003-09-04 Martin Baulig <martin@ximian.com> - - * expression.cs (ComposedCast.ResolveAsTypeStep): Added support - for arrays of generic type params (ie. `!0[]'). - -2003-09-04 Martin Baulig <martin@ximian.com> - - * class.cs (TypeContainer.AsAccessible): Ignore generic parameters - for the moment. - -2003-09-04 Martin Baulig <martin@ximian.com> - - * decl.cs (DeclSpace.LookupGeneric): New method. - (DeclSpace.CheckAccessLevel): Ignore generic parameters for the - moment. - - * generic.cs (TypeParameterExpr): Take a TypeParameter as - argument, not just a string. - (TypeParameter.Define): New public method; this is called to - actually define the generic parameter; after this, you can use the - new `Type' property to get the type. - -2003-09-04 Martin Baulig <martin@ximian.com> - - * decl.cs (DeclSpace.SetParameterInfo): The `constraints' argument - is now an ArrayList; initialize the result of the `TypeParameters' - property here. - (DeclSpace.GetGenericData): Removed. - (DeclSpace.LookupGeneric): Temporarily removed; we need to - implement this in a different way. - (DeclSpace.GetTypeParameters): Removed; there's now a - `TypeParameters' property. - (DeclSpace.TypeParameters): New public property. - - * generic.cs (Constraints): Make this class public. - (TypeParameter): New public class. - -2003-09-04 Martin Baulig <martin@ximian.com> - - * decl.cs (DeclSpace.GetTypeParameters): New method to return the - generic parameters. - - * class.cs (TypeContainer.DefineType): Call - TypeBuilder.DefineGenericParameter () on all generic parameters if - this is a generic type. - -2003-08-28 Martin Baulig <martin@ximian.com> - - * sample-stack.il: Compile this with ilasm: "ilasm /dll - sample-stack.il". - - * sample-hello.cs: Compile this with gmcs: "gmcs - /r:sample-stack.dll sample-hello.cs". - -2003-08-28 Martin Baulig <martin@ximian.com> - - * generic.cs (ConstructedType.ResolveAsTypeStep): Actually bind - the parameters to the generic type. - -2003-08-28 Martin Baulig <martin@ximian.com> - - * cs-tokenizer.cs (parse_less_than): Also allow all builtin types. - -2003-08-28 Martin Baulig <martin@ximian.com> - - * cs-parser.jay (opt_type_argument_list): Use - `OP_GENERICS_LT type_arguments OP_GENERICS_GT'. - (primary_expression): Replace `qualified_identifier' with `type_name'. - (type_parameter_list): Use `OP_GENERICS_LT type_parameters OP_GENERICS_GT'. - - * cs-tokenizer.cs (is_punct): When reading a `<', invoke a custom - parser to check whether it is syntactically a type parameter list; - return OP_GENERICS_LT/OP_GENERICS_GT instead of OP_LT/OP_GT in - this case. - -2003-08-26 Martin Baulig <martin@ximian.com> - - * ecore.cs (SimpleName.SimpleNameResolve): Look for members before - resolving aliases; fixes #47927. - -2003-08-26 Martin Baulig <martin@ximian.com> - - * statement.cs (Using.DoResolve): This is internally emitting a - try/finally clause, so we need to set ec.NeedExplicitReturn if we - do not always return. Fixes #47681. - -2003-08-26 Martin Baulig <martin@ximian.com> - - * decl.cs (MemberCore): Moved WarningNotHiding(), - Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase() - into MemberBase. - (AdditionResult): Make this nested in DeclSpace. - (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry - argument; call NamespaceEntry.Define() unless we're nested in a - class or struct. - - * namespace.cs (Namespace.DefineName): New public function. This - is called from DeclSpace's .ctor to add - (Namespace.Lookup): Include DeclSpaces in the lookup. - - * class.cs (Operator): Derive from MemberBase, not MemberCore. - - * const.cs (Const): Derive from MemberBase, not MemberCore. - -2003-08-25 Martin Baulig <martin@ximian.com> - - * convert.cs (Convert.ExplicitReferenceConversion): When - converting from an interface type to a class, unbox if the target - type is a struct type. Fixes #47822. - -2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and - #47854. - -2003-08-22 Martin Baulig <martin@ximian.com> - - * class.cs (TypeManager.DefineType): When defining a nested type, - call DefineType() on our parent; fixes #47801. - -2003-08-22 Martin Baulig <martin@ximian.com> - - * class.cs (MethodData.Define): While checking if a method is an - interface implementation, improve the test a bit more to fix #47654. - -2003-08-22 Martin Baulig <martin@ximian.com> - - * expression.cs (Probe.DoResolve): Check whether `expr' resolved - correctly; fixes #47722. - -2003-08-22 Martin Baulig <martin@ximian.com> - - * expression.cs (UnaryMutator.ResolveVariable): If the target is a - LocalVariableReference, ensure it's not read-only. Fixes #47536. - - * statement.cs (Fixed.DoResolve): Make all variables read-only. - -2003-08-22 Martin Baulig <martin@ximian.com> - - * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields - can only be assigned in static constructors. Fixes #47161. - -2003-08-22 Martin Baulig <martin@ximian.com> - - Rewrote and improved the flow analysis code. - - * flowbranching.cs (FlowBranching): Make this class abstract. - (FlowBranching.CreateBranching): New static function to create a - new flow branching. - (FlowBranchingBlock, FlowBranchingException): New classes. - (FlowBranching.UsageVector.Type): New public readonly field. - (FlowBranching.UsageVector.Breaks): Removed the setter. - (FlowBranching.UsageVector.Returns): Removed the setter. - (FlowBranching.UsageVector): Added Break(), Return(), - NeverReachable() and Throw() methods to modify the reachability. - (FlowBranching.UsageVector.MergeChildren): Removed, this is now - done by FlowBranching.Merge(). - (FlowBranching.UsageVector.MergeChild): New method; merges the - merge result into the current vector. - (FlowBranching.Merge): New abstract method to merge a branching. - -2003-08-12 Martin Baulig <martin@ximian.com> - - * expression.cs (Indirection.CacheTemporaries): Create the - LocalTemporary with the pointer type, not its element type. - -2003-08-10 Miguel de Icaza <miguel@ximian.com> - - * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a - token was a keyword or not. - - Add `error' options where an IDENTIFIER was expected; Provide - CheckToken and CheckIdentifierToken convenience error reporting - functions. - - Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'. - - * decl.cs: Rename `NamespaceEntry Namespace' public field into - NameSpaceEntry NameSpaceEntry. - - (LookupInterfaceOrClass): Avoid creating a full qualified name - from namespace and name: avoid doing lookups when we know the - namespace is non-existant. Use new Tree.LookupByNamespace which - looks up DeclSpaces based on their namespace, name pair. - - * driver.cs: Provide a new `parser verbose' to display the - exception thrown during parsing. This is turned off by default - now, so the output of a failure from mcs is more graceful. - - * namespace.cs: Track all the namespaces defined in a hashtable - for quick lookup. - - (IsNamespace): New method - -2003-08-09 Miguel de Icaza <miguel@ximian.com> - - * namespace.cs: Remove redundant call; Avoid using MakeFQN when - we know that we need to concatenate (full typename can never be - null). - - * class.cs: ditto. - - * statement.cs: Use a bitfield; Do not initialize to null things - which are done by the constructor by default. - - * cs-parser.jay: bug fix, parameter was 4, not 3. - - * expression.cs: Just use the property; - - * statement.cs: No need for GetVariableInfo method. - 2003-08-08 Martin Baulig <martin@ximian.com> * flowanalysis.cs (FlowReturns): This is now nested in the diff --git a/mcs/gmcs/Makefile b/mcs/gmcs/Makefile index 56cd632fa44..d16d330b492 100644 --- a/mcs/gmcs/Makefile +++ b/mcs/gmcs/Makefile @@ -86,9 +86,5 @@ mcs2.exe: gmcs.exe mcs3.exe: mcs2.exe $(TIME) $(RUNTIME) ./mcs2.exe $(USE_MCS_FLAGS) /target:exe /out:$@ $(all_sources) -ctest: - -rm mcs2.exe mcs3.exe - make btest USE_MCS_FLAGS= - response: echo $(all_sources) > res diff --git a/mcs/gmcs/attribute.cs b/mcs/gmcs/attribute.cs index 50fa93b978e..9a2c1124323 100644 --- a/mcs/gmcs/attribute.cs +++ b/mcs/gmcs/attribute.cs @@ -540,7 +540,7 @@ namespace Mono.CSharp { }
/// <summary>
- /// Ensure that Attribute 'a' is being applied to the right language element (target)
+ /// Ensure that Attribute 'a' is being applied to the right target
/// </summary>
public static bool CheckAttributeTarget (Attribute a, object element)
{
@@ -568,7 +568,6 @@ namespace Mono.CSharp { } else
targets = attr.Targets;
-
if (element is Class) {
if ((targets & AttributeTargets.Class) != 0)
return true;
@@ -617,8 +616,7 @@ namespace Mono.CSharp { else
return false;
} else if (element is ParameterBuilder) {
- if ((targets & AttributeTargets.Parameter) != 0 ||
- (targets & AttributeTargets.ReturnValue) != 0)
+ if ((targets & AttributeTargets.Parameter) != 0)
return true;
else
return false;
diff --git a/mcs/gmcs/class.cs b/mcs/gmcs/class.cs index 0744569288f..c80cb78877c 100755 --- a/mcs/gmcs/class.cs +++ b/mcs/gmcs/class.cs @@ -134,8 +134,8 @@ namespace Mono.CSharp { // public string IndexerName; - public TypeContainer (NamespaceEntry ns, TypeContainer parent, string name, Location l) - : base (ns, parent, name, l) + public TypeContainer (TypeContainer parent, string name, Location l) + : base (parent, name, l) { string n; types = new ArrayList (); @@ -605,7 +605,7 @@ namespace Mono.CSharp { void Error_TypeParameterAsBase (TypeParameterExpr e) { Report.Error ( - -216, e.Location, + -213, e.Location, String.Format ("Type parameter `{0}' can not be used t as a base class or interface", e.Name)); } @@ -810,6 +810,7 @@ namespace Mono.CSharp { TypeAttributes type_attributes = TypeAttr; + // if (parent_builder is ModuleBuilder) { if (IsTopLevel){ if (TypeManager.NamespaceClash (Name, Location)) return null; @@ -819,16 +820,11 @@ namespace Mono.CSharp { Name, type_attributes, parent, ifaces); } else { - TypeBuilder builder = Parent.DefineType (); + TypeBuilder builder = Parent.TypeBuilder; TypeBuilder = builder.DefineNestedType ( Basename, type_attributes, parent, ifaces); } - - if (IsGeneric) { - foreach (TypeParameter type_param in TypeParameters) - type_param.Define (TypeBuilder); - } - + // // Structs with no fields need to have at least one byte. // The right thing would be to set the PackingSize in a DefineType @@ -909,7 +905,7 @@ namespace Mono.CSharp { if (idx < 0){ if (RootContext.WarningLevel >= 4){ if ((mc.ModFlags & Modifiers.NEW) != 0) - Warning_KeywordNewNotRequired (mc.Location, mc); + Warning_KewywordNewNotRequired (mc.Location, mc); } } else if (mc is MethodCore) ((MethodCore) mc).OverridesSomething = true; @@ -1053,7 +1049,7 @@ namespace Mono.CSharp { Type ptype = null; Type t = pclass.TypeBuilder.BaseType; while ((t != null) && (ptype == null)) { - pname = t.FullName + "." + Basename; + pname = MakeFQN (t.FullName, Basename); ptype = RootContext.LookupType (this, pname, true, Location.Null); t = t.BaseType; } @@ -1648,7 +1644,7 @@ namespace Mono.CSharp { mi.ReflectedType.Name + "." + mi.Name + "'"); } - public void Warning_KeywordNewNotRequired (Location l, MemberCore mc) + public void Warning_KewywordNewNotRequired (Location l, MemberCore mc) { Report.Warning ( 109, l, "The member " + MakeName (mc.Name) + " does not hide an " + @@ -1841,9 +1837,6 @@ namespace Mono.CSharp { // public bool AsAccessible (Type parent, int flags) { - if (parent.IsUnboundGenericParameter) - return true; // FIXME - while (parent.IsArray || parent.IsPointer || parent.IsByRef) parent = TypeManager.GetElementType (parent); @@ -2120,8 +2113,8 @@ namespace Mono.CSharp { Modifiers.SEALED | Modifiers.UNSAFE; - public Class (NamespaceEntry ns, TypeContainer parent, string name, int mod, Attributes attrs, Location l) - : base (ns, parent, name, l) + public Class (TypeContainer parent, string name, int mod, Attributes attrs, Location l) + : base (parent, name, l) { int accmods; @@ -2157,8 +2150,8 @@ namespace Mono.CSharp { Modifiers.UNSAFE | Modifiers.PRIVATE; - public Struct (NamespaceEntry ns, TypeContainer parent, string name, int mod, Attributes attrs, Location l) - : base (ns, parent, name, l) + public Struct (TypeContainer parent, string name, int mod, Attributes attrs, Location l) + : base (parent, name, l) { int accmods; @@ -2206,7 +2199,7 @@ namespace Mono.CSharp { public MethodCore (Expression type, int mod, int allowed_mod, string name, Attributes attrs, Parameters parameters, Location loc) - : base (type, mod, allowed_mod, Modifiers.PRIVATE, name, attrs, loc) + : base (type, mod, allowed_mod, name, attrs, loc) { Parameters = parameters; } @@ -2276,17 +2269,13 @@ namespace Mono.CSharp { // The method's attributes are passed in because we need to extract // the "return:" attribute from there to apply on the return type // - static public void LabelParameters (EmitContext ec, - MethodBase builder, - Parameters parameters, - Attributes method_attrs, - Location loc) + public void LabelParameters (EmitContext ec, MethodBase builder, Attributes method_attrs) { // // Define each type attribute (in/out/ref) and // the argument names. // - Parameter [] p = parameters.FixedParameters; + Parameter [] p = Parameters.FixedParameters; int i = 0; MethodBuilder mb = null; @@ -2315,16 +2304,16 @@ namespace Mono.CSharp { if (par_attr == ParameterAttributes.Out){ if (attr.Contains (TypeManager.in_attribute_type)) - Report.Error (36, loc, + Report.Error (36, Location, "Can not use [In] attribute on out parameter"); } } } } - if (parameters.ArrayParameter != null){ + if (Parameters.ArrayParameter != null){ ParameterBuilder pb; - Parameter array_param = parameters.ArrayParameter; + Parameter array_param = Parameters.ArrayParameter; if (mb == null) pb = cb.DefineParameter ( @@ -2365,10 +2354,9 @@ namespace Mono.CSharp { try { ret_pb = mb.DefineParameter (0, ParameterAttributes.None, ""); Attribute.ApplyAttributes (ec, ret_pb, ret_pb, ret_attrs); - - } catch (ArgumentOutOfRangeException) { + } catch (ArgumentOutOfRangeException) { Report.Warning ( - -24, loc, + -24, Location, ".NET SDK 1.0 does not permit setting custom attributes" + " on the return type of a method"); } @@ -2878,8 +2866,7 @@ namespace Mono.CSharp { ec.IsStatic = false; } - MethodCore.LabelParameters (ec, ConstructorBuilder, - Parameters, OptAttributes, Location); + LabelParameters (ec, ConstructorBuilder, OptAttributes); SymbolWriter sw = CodeGen.SymbolWriter; bool generate_debugging = false; @@ -3223,21 +3210,14 @@ namespace Mono.CSharp { Modifiers.Error_InvalidModifier (Location, "public, virtual or abstract"); implementing = null; } - } else if ((flags & MethodAttributes.MemberAccessMask) != MethodAttributes.Public){ - if (TypeManager.IsInterfaceType (implementing.DeclaringType)){ - // - // If this is an interface method implementation, - // check for public accessibility - // - implementing = null; - } else if ((flags & MethodAttributes.MemberAccessMask) == MethodAttributes.Private){ - // We may never be private. - implementing = null; - } else if ((modifiers & Modifiers.OVERRIDE) == 0){ - // - // We may be protected if we're overriding something. - // - implementing = null; + } else { + // + // If this is an interface method implementation, + // check for public accessibility + // + if ((flags & MethodAttributes.MemberAccessMask) != MethodAttributes.Public){ + if (TypeManager.IsInterfaceType (implementing.DeclaringType)) + implementing = null; } } @@ -3359,11 +3339,8 @@ namespace Mono.CSharp { Attribute.ApplyAttributes (ec, builder, kind, OptAttributes); if (member is MethodCore) - MethodCore.LabelParameters (ec, MethodBuilder, - ((MethodCore) member).Parameters, - OptAttributes, - Location); - + ((MethodCore) member).LabelParameters (ec, MethodBuilder, OptAttributes); + // // abstract or extern methods have no bodies // @@ -3515,12 +3492,12 @@ namespace Mono.CSharp { // // The constructor is only exposed to our children // - protected MemberBase (Expression type, int mod, int allowed_mod, int def_mod, string name, + protected MemberBase (Expression type, int mod, int allowed_mod, string name, Attributes attrs, Location loc) : base (name, loc) { Type = type; - ModFlags = Modifiers.Check (allowed_mod, mod, def_mod, loc); + ModFlags = Modifiers.Check (allowed_mod, mod, Modifiers.PRIVATE, loc); OptAttributes = attrs; } @@ -3538,153 +3515,6 @@ namespace Mono.CSharp { return true; } - protected void WarningNotHiding (TypeContainer parent) - { - Report.Warning ( - 109, Location, - "The member " + parent.MakeName (Name) + " does not hide an " + - "inherited member. The keyword new is not required"); - - } - - void Error_CannotChangeAccessModifiers (TypeContainer parent, MethodInfo parent_method, - string name) - { - // - // FIXME: report the old/new permissions? - // - Report.Error ( - 507, Location, parent.MakeName (Name) + - ": can't change the access modifiers when overriding inherited " + - "member `" + name + "'"); - } - - // - // Performs various checks on the MethodInfo `mb' regarding the modifier flags - // that have been defined. - // - // `name' is the user visible name for reporting errors (this is used to - // provide the right name regarding method names and properties) - // - protected bool CheckMethodAgainstBase (TypeContainer parent, MethodAttributes my_attrs, - MethodInfo mb, string name) - { - bool ok = true; - - if ((ModFlags & Modifiers.OVERRIDE) != 0){ - if (!(mb.IsAbstract || mb.IsVirtual)){ - Report.Error ( - 506, Location, parent.MakeName (Name) + - ": cannot override inherited member `" + - name + "' because it is not " + - "virtual, abstract or override"); - ok = false; - } - - // Now we check that the overriden method is not final - - if (mb.IsFinal) { - // This happens when implementing interface methods. - if (mb.IsHideBySig && mb.IsVirtual) { - Report.Error ( - 506, Location, parent.MakeName (Name) + - ": cannot override inherited member `" + - name + "' because it is not " + - "virtual, abstract or override"); - } else - Report.Error (239, Location, parent.MakeName (Name) + " : cannot " + - "override inherited member `" + name + - "' because it is sealed."); - ok = false; - } - // - // Check that the permissions are not being changed - // - MethodAttributes thisp = my_attrs & MethodAttributes.MemberAccessMask; - MethodAttributes parentp = mb.Attributes & MethodAttributes.MemberAccessMask; - - // - // special case for "protected internal" - // - - if ((parentp & MethodAttributes.FamORAssem) == MethodAttributes.FamORAssem){ - // - // when overriding protected internal, the method can be declared - // protected internal only within the same assembly - // - - if ((thisp & MethodAttributes.FamORAssem) == MethodAttributes.FamORAssem){ - if (parent.TypeBuilder.Assembly != mb.DeclaringType.Assembly){ - // - // assemblies differ - report an error - // - - Error_CannotChangeAccessModifiers (parent, mb, name); - ok = false; - } else if (thisp != parentp) { - // - // same assembly, but other attributes differ - report an error - // - - Error_CannotChangeAccessModifiers (parent, mb, name); - ok = false; - }; - } else if ((thisp & MethodAttributes.Family) != MethodAttributes.Family) { - // - // if it's not "protected internal", it must be "protected" - // - - Error_CannotChangeAccessModifiers (parent, mb, name); - ok = false; - } else if (parent.TypeBuilder.Assembly == mb.DeclaringType.Assembly) { - // - // protected within the same assembly - an error - // - Error_CannotChangeAccessModifiers (parent, mb, name); - ok = false; - } else if ((thisp & ~(MethodAttributes.Family | MethodAttributes.FamORAssem)) != - (parentp & ~(MethodAttributes.Family | MethodAttributes.FamORAssem))) { - // - // protected ok, but other attributes differ - report an error - // - Error_CannotChangeAccessModifiers (parent, mb, name); - ok = false; - } - } else { - if (thisp != parentp){ - Error_CannotChangeAccessModifiers (parent, mb, name); - ok = false; - } - } - } - - if (mb.IsVirtual || mb.IsAbstract){ - if ((ModFlags & (Modifiers.NEW | Modifiers.OVERRIDE)) == 0){ - if (Name != "Finalize"){ - Report.Warning ( - 114, 2, Location, parent.MakeName (Name) + - " hides inherited member `" + name + - "'. To make the current member override that " + - "implementation, add the override keyword, " + - "otherwise use the new keyword"); - ModFlags |= Modifiers.NEW; - } - } - } else { - if ((ModFlags & (Modifiers.NEW | Modifiers.OVERRIDE)) == 0){ - if (Name != "Finalize"){ - Report.Warning ( - 108, 1, Location, "The keyword new is required on " + - parent.MakeName (Name) + " because it hides " + - "inherited member `" + name + "'"); - ModFlags |= Modifiers.NEW; - } - } - } - - return ok; - } - protected virtual bool CheckParameters (TypeContainer container, Type [] parameters) { bool error = false; @@ -3824,7 +3654,7 @@ namespace Mono.CSharp { // protected FieldBase (Expression type, int mod, int allowed_mod, string name, object init, Attributes attrs, Location loc) - : base (type, mod, allowed_mod, Modifiers.PRIVATE, name, attrs, loc) + : base (type, mod, allowed_mod, name, attrs, loc) { this.init = init; } @@ -4775,7 +4605,7 @@ namespace Mono.CSharp { } } - public class Operator : MemberBase { + public class Operator : MemberCore { const int AllowedModifiers = Modifiers.PUBLIC | @@ -4830,24 +4660,27 @@ namespace Mono.CSharp { public readonly Expression FirstArgType, SecondArgType; public readonly string FirstArgName, SecondArgName; public Block Block; + public Attributes OptAttributes; public MethodBuilder OperatorMethodBuilder; public string MethodName; public Method OperatorMethod; - public Operator (OpType type, Expression ret_type, int mod_flags, + public Operator (OpType type, Expression ret_type, int flags, Expression arg1type, string arg1name, Expression arg2type, string arg2name, Block block, Attributes attrs, Location loc) - : base (ret_type, mod_flags, AllowedModifiers, Modifiers.PUBLIC, "", attrs, loc) + : base ("", loc) { OperatorType = type; ReturnType = ret_type; + ModFlags = Modifiers.Check (AllowedModifiers, flags, Modifiers.PUBLIC, loc); FirstArgType = arg1type; FirstArgName = arg1name; SecondArgType = arg2type; SecondArgName = arg2name; Block = block; + OptAttributes = attrs; } string Prototype (TypeContainer container) diff --git a/mcs/gmcs/codegen.cs b/mcs/gmcs/codegen.cs index df4a0f40552..7293f99df5a 100755 --- a/mcs/gmcs/codegen.cs +++ b/mcs/gmcs/codegen.cs @@ -392,7 +392,7 @@ namespace Mono.CSharp { // </summary> public FlowBranching StartFlowBranching (FlowBranching.BranchingType type, Location loc) { - FlowBranching cfb = FlowBranching.CreateBranching (CurrentBranching, type, null, loc); + FlowBranching cfb = new FlowBranching (CurrentBranching, type, null, loc); FlowStack.Push (cfb); @@ -412,7 +412,7 @@ namespace Mono.CSharp { else type = FlowBranching.BranchingType.Block; - cfb = FlowBranching.CreateBranching (CurrentBranching, type, block, block.StartLocation); + cfb = new FlowBranching (CurrentBranching, type, block, block.StartLocation); FlowStack.Push (cfb); @@ -456,8 +456,7 @@ namespace Mono.CSharp { bool old_do_flow_analysis = DoFlowAnalysis; DoFlowAnalysis = true; - FlowBranching cfb = FlowBranching.CreateBranching ( - null, FlowBranching.BranchingType.Block, block, loc); + FlowBranching cfb = new FlowBranching (block, loc); FlowStack.Push (cfb); if (!block.Resolve (this)) { diff --git a/mcs/gmcs/const.cs b/mcs/gmcs/const.cs index fc7a29f6727..4f54d70e887 100755 --- a/mcs/gmcs/const.cs +++ b/mcs/gmcs/const.cs @@ -24,9 +24,10 @@ namespace Mono.CSharp { using System.Reflection.Emit; using System.Collections; - public class Const : MemberBase { + public class Const : MemberCore { public Expression ConstantType; public Expression Expr; + public Attributes OptAttributes; public FieldBuilder FieldBuilder; EmitContext const_ec; @@ -44,11 +45,13 @@ namespace Mono.CSharp { public Const (Expression constant_type, string name, Expression expr, int mod_flags, Attributes attrs, Location loc) - : base (constant_type, mod_flags, AllowedModifiers, Modifiers.PRIVATE, name, attrs, loc) + : base (name, loc) { ConstantType = constant_type; Name = name; Expr = expr; + ModFlags = Modifiers.Check (AllowedModifiers, mod_flags, Modifiers.PRIVATE, loc); + OptAttributes = attrs; } public FieldAttributes FieldAttr { @@ -95,7 +98,7 @@ namespace Mono.CSharp { if (ptype != null) { MemberList list = TypeContainer.FindMembers ( ptype, MemberTypes.Field, BindingFlags.Public, - System.Type.FilterName, Name); + Type.FilterName, Name); if (list.Count == 0) if ((ModFlags & Modifiers.NEW) != 0) diff --git a/mcs/gmcs/convert.cs b/mcs/gmcs/convert.cs index bd04bc23620..b6dfab95c44 100644 --- a/mcs/gmcs/convert.cs +++ b/mcs/gmcs/convert.cs @@ -1514,14 +1514,10 @@ namespace Mono.CSharp { // sealed, or provided T implements S. // if (source_type.IsInterface) { - if (!target_type.IsSealed || TypeManager.ImplementsInterface (target_type, source_type)) { - if (target_type.IsClass) - return new ClassCast (source, target_type); - else - return new UnboxCast (source, target_type); - } - - return null; + if (!target_type.IsSealed || TypeManager.ImplementsInterface (target_type, source_type)) + return new ClassCast (source, target_type); + else + return null; } // From an array type S with an element type Se to an array type T with an diff --git a/mcs/gmcs/cs-parser.jay b/mcs/gmcs/cs-parser.jay index b41aaf03764..b6d36d0b5a2 100755 --- a/mcs/gmcs/cs-parser.jay +++ b/mcs/gmcs/cs-parser.jay @@ -98,7 +98,6 @@ namespace Mono.CSharp /* *These are the C# keywords */ -%token FIRST_KEYWORD %token ABSTRACT %token AS %token ADD @@ -188,8 +187,6 @@ namespace Mono.CSharp %token GET "get" %token SET "set" -%left LAST_KEYWORD - /* C# single character operators/punctuation. */ %token OPEN_BRACE "{" %token CLOSE_BRACE "}" @@ -210,7 +207,6 @@ namespace Mono.CSharp %token OP_LT "<" %token OP_GENERICS_LT "<" %token OP_GT ">" -%token OP_GENERICS_GT ">" %token BITWISE_AND "&" %token BITWISE_OR "|" %token STAR "*" @@ -314,10 +310,7 @@ using_alias_directive : USING IDENTIFIER ASSIGN namespace_or_type_name SEMICOLON { - current_namespace.UsingAlias ((string) $2, (Expression) $4, lexer.Location); - } - | USING error { - CheckIdentifierToken (yyToken); + current_namespace.UsingAlias ((string) $2, (string) $4, lexer.Location); } ; @@ -348,7 +341,7 @@ namespace_declaration + " Expected class, delegate, enum, interface, or struct"); } - current_namespace = RootContext.Tree.RecordNamespace (current_namespace, file, (string) $3, lexer.Location); + current_namespace = RootContext.Tree.RecordNamespace (current_namespace, file, (string) $3); } namespace_body opt_semicolon { @@ -440,10 +433,10 @@ type_declaration // // Enable this when we have handled all errors, because this acts as a generic fallback // -// | error { -// Console.WriteLine ("Token=" + yyToken); -// Report.Error (1518, lexer.Location, "Expected class, struct, interface, enum or delegate"); -// } + | error { + Console.WriteLine ("Token=" + yyToken); + Report.Error (1518, lexer.Location, "Expected class, struct, interface, enum or delegate"); + } ; // @@ -677,9 +670,10 @@ struct_declaration Struct new_struct; string full_struct_name = MakeName ((string) $4); - new_struct = new Struct (current_namespace, current_container, full_struct_name, - (int) $2, (Attributes) $1, lexer.Location); + new_struct = new Struct (current_container, full_struct_name, (int) $2, + (Attributes) $1, lexer.Location); current_container = new_struct; + current_container.Namespace = current_namespace; RootContext.Tree.RecordDecl (full_struct_name, new_struct); } opt_class_base @@ -695,9 +689,6 @@ struct_declaration CheckDef (current_container.AddStruct (new_struct), new_struct.Name, new_struct.Location); $$ = new_struct; } - | opt_attributes opt_modifiers STRUCT error { - CheckIdentifierToken (yyToken); - } ; struct_body @@ -984,13 +975,6 @@ fixed_parameter { $$ = new Parameter ((Expression) $3, (string) $4, (Parameter.Modifier) $2, (Attributes) $1); } - | opt_attributes - opt_parameter_modifier - type - error { - CheckIdentifierToken (yyToken); - $$ = null; - } ; opt_parameter_modifier @@ -1009,10 +993,6 @@ parameter_array $$ = new Parameter ((Expression) $3, (string) $4, Parameter.Modifier.PARAMS, (Attributes) $1); note ("type must be a single-dimension array type"); } - | opt_attributes PARAMS type error { - CheckIdentifierToken (yyToken); - $$ = null; - } ; member_name @@ -1141,13 +1121,14 @@ interface_declaration Interface new_interface; string full_interface_name = MakeName ((string) $4); - new_interface = new Interface (current_namespace, current_container, full_interface_name, - (int) $2, (Attributes) $1, lexer.Location); + new_interface = new Interface (current_container, full_interface_name, (int) $2, + (Attributes) $1, lexer.Location); if (current_interface != null) { Location l = lexer.Location; Report.Error (-2, l, "Internal compiler error: interface inside interface"); } current_interface = new_interface; + new_interface.Namespace = current_namespace; RootContext.Tree.RecordDecl (full_interface_name, new_interface); } opt_interface_base @@ -1162,9 +1143,6 @@ interface_declaration CheckDef (current_container.AddInterface (new_interface), new_interface.Name, new_interface.Location); } - | opt_attributes opt_modifiers INTERFACE error { - CheckIdentifierToken (yyToken); - } ; opt_interface_base @@ -1274,12 +1252,6 @@ interface_property_declaration (gs & 1) == 1, (gs & 2) == 2, (Attributes) $1, lexer.Location); } - | opt_attributes - opt_new - type error { - CheckIdentifierToken (yyToken); - $$ = null; - } ; interface_accesors @@ -1297,10 +1269,6 @@ interface_event_declaration $$ = new InterfaceEvent ((Expression) $4, (string) $5, (bool) $2, (Attributes) $1, lexer.Location); } - | opt_attributes opt_new EVENT type error { - CheckIdentifierToken (yyToken); - $$ = null; - } ; interface_indexer_declaration @@ -1758,8 +1726,8 @@ enum_declaration Location enum_location = lexer.Location; string full_name = MakeName ((string) $4); - Enum e = new Enum (current_namespace, current_container, (Expression) $5, (int) $2, - full_name, (Attributes) $1, enum_location); + Enum e = new Enum (current_container, (Expression) $5, (int) $2, full_name, + (Attributes) $1, enum_location); foreach (VariableDeclaration ev in (ArrayList) $6) { Location loc = (Location) ev.Location; @@ -1770,6 +1738,8 @@ enum_declaration ev.identifier, loc); } + e.Namespace = current_namespace; + CheckDef (current_container.AddEnum (e), full_name, enum_location); RootContext.Tree.RecordDecl (full_name, e); @@ -1836,10 +1806,11 @@ delegate_declaration SEMICOLON { Location l = lexer.Location; - Delegate del = new Delegate (current_namespace, current_container, (Expression) $4, - (int) $2, MakeName ((string) $5), (Parameters) $7, + Delegate del = new Delegate (current_container, (Expression) $4, (int) $2, + MakeName ((string) $5), (Parameters) $7, (Attributes) $1, l); + del.Namespace = current_namespace; CheckDef (current_container.AddDelegate (del), del.Name, l); } | opt_attributes @@ -1852,10 +1823,11 @@ delegate_declaration { Location l = lexer.Location; Delegate del = new Delegate ( - current_namespace, current_container, + current_container, TypeManager.system_void_expr, (int) $2, MakeName ((string) $5), (Parameters) $7, (Attributes) $1, l); + del.Namespace = current_namespace; CheckDef (current_container.AddDelegate (del), del.Name, l); } ; @@ -1889,10 +1861,7 @@ namespace_or_type_name // opt_type_argument_list : /* empty */ { $$ = null; } - | OP_GENERICS_LT type_arguments OP_GENERICS_GT - { - $$ = $2; - } + | OP_GENERICS_LT type_arguments OP_GT { $$ = $2; } ; type_arguments @@ -2032,9 +2001,12 @@ primary_expression // 7.5.1: Literals } - | type_name + | qualified_identifier { - $$ = $1; + string name = (string) $1; + + $$ = null; + $$ = DecomposeQI (name, lexer.Location); } | parenthesized_expression | member_access @@ -2174,9 +2146,6 @@ argument_list list.Add ($3); $$ = list; } - | argument_list error { - CheckToken (1026, yyToken, ", or ) expected"); - } ; argument @@ -2215,7 +2184,7 @@ element_access Expression expr = (Expression) $1; if (expr is ComposedCast){ $$ = new ComposedCast (expr, (string) $2, lexer.Location); - } else if (!(expr is SimpleName || expr is MemberAccess || expr is ConstructedType)){ + } else if (!(expr is SimpleName || expr is MemberAccess)){ Error_ExpectingTypeName (lexer.Location, expr); $$ = TypeManager.system_object_expr; } else { @@ -2445,7 +2414,7 @@ anonymous_method_expression Report.Error (-213, lexer.Location, "Anonymous methods are only supported in V2"); $$ = null; } else - $$ = new AnonymousMethod ((Parameters) $2, (Block) $4, lexer.Location); + $$ = new AnonymousMethod ((Parameters) $2, (Block) $3, lexer.Location); current_local_parameters = (Parameters) oob_stack.Pop (); } ; @@ -2826,9 +2795,10 @@ class_declaration name = MakeName ((string) $4); - new_class = new Class (current_namespace, current_container, name, (int) $2, + new_class = new Class (current_container, name, (int) $2, (Attributes) $1, lexer.Location); current_container = new_class; + current_container.Namespace = current_namespace; RootContext.Tree.RecordDecl (name, new_class); } opt_type_parameter_list @@ -2844,7 +2814,7 @@ class_declaration "Type parameter constraints only valid if there is a type parameter list"); if ($6 != null) - CheckDef (new_class.SetParameterInfo ((ArrayList) $6, (ArrayList) $8, new_class.Location), new_class.Name, new_class.Location); + CheckDef (new_class.SetParameterInfo ((ArrayList) $6, $8), new_class.Name, new_class.Location); if ($7 != null) new_class.Bases = (ArrayList) $7; current_container = current_container.Parent; @@ -2915,7 +2885,7 @@ opt_type_parameter_list ; type_parameter_list - : OP_GENERICS_LT type_parameters OP_GENERICS_GT { $$ = $2; } + : OP_LT type_parameters OP_GT { $$ = $2; } ; type_parameters @@ -2948,19 +2918,12 @@ opt_type_parameter_constraints_clauses type_parameter_constraints_clauses : type_parameter_constraints_clause - | type_parameter_constraints_clauses type_parameter_constraints_clause { - ArrayList constraints = (ArrayList) $1; - - constraints.Add ($2); - $$ = constraints; - } + | type_parameter_constraints_clauses type_parameter_constraints_clause ; type_parameter_constraints_clause : WHERE type_parameter COLON type_parameter_constraints { - ArrayList constraints = new ArrayList (1); - constraints.Add (new Constraints ((string) $2, (ArrayList) $4)); - $$ = constraints; + $$ = new Constraints ((string) $2, (ArrayList) $4); } ; @@ -3123,7 +3086,7 @@ local_variable_type // Blah i; Expression expr = (Expression) $1; - if (!(expr is SimpleName || expr is MemberAccess || expr is ComposedCast || expr is ConstructedType)) { + if (!(expr is SimpleName || expr is MemberAccess || expr is ComposedCast)) { Error_ExpectingTypeName (lexer.Location, expr); $$ = null; } else { @@ -3153,7 +3116,7 @@ local_variable_pointer_type Expression expr = (Expression) $1; Location l = lexer.Location; - if (!(expr is SimpleName || expr is MemberAccess || expr is ComposedCast || expr is ConstructedType)) { + if (!(expr is SimpleName || expr is MemberAccess || expr is ComposedCast)) { Error_ExpectingTypeName (l, expr); $$ = null; @@ -4012,7 +3975,7 @@ void Error_ExpectingTypeName (Location l, Expression expr) string MakeName (string class_name) { - string ns = current_namespace.FullName; + string ns = current_namespace.Name; string container_name = current_container.Name; if (container_name == ""){ @@ -4029,13 +3992,13 @@ MakeName (string class_name) // in the current declaration space // </summary> void -CheckDef (DeclSpace.AdditionResult result, string name, Location l) +CheckDef (AdditionResult result, string name, Location l) { - if (result == DeclSpace.AdditionResult.Success) + if (result == AdditionResult.Success) return; switch (result){ - case DeclSpace.AdditionResult.NameExists: + case AdditionResult.NameExists: Report.Error (102, l, "The container `" + current_container.Name + "' already contains a definition for `"+ name + "'"); @@ -4046,22 +4009,22 @@ CheckDef (DeclSpace.AdditionResult result, string name, Location l) // This is handled only for static Constructors, because // in reality we handle these by the semantic analysis later // - case DeclSpace.AdditionResult.MethodExists: + case AdditionResult.MethodExists: Report.Error ( 111, l, "Class `"+current_container.Name+ "' already defines a member called '" + name + "' with the same parameter types (more than one default constructor)"); break; - case DeclSpace.AdditionResult.EnclosingClash: + case AdditionResult.EnclosingClash: Report.Error (542, l, "Member names cannot be the same as their enclosing type"); break; - case DeclSpace.AdditionResult.NotAConstructor: + case AdditionResult.NotAConstructor: Report.Error (1520, l, "Class, struct, or interface method must have a return type"); break; - case DeclSpace.AdditionResult.Error: + case AdditionResult.Error: // Error has already been reported. break; } @@ -4072,7 +4035,7 @@ CheckDef (bool result, string name, Location l) { if (result) return; - CheckDef (DeclSpace.AdditionResult.NameExists, name, l); + CheckDef (AdditionResult.NameExists, name, l); } Expression DecomposeQI (string name, Location loc) @@ -4265,11 +4228,11 @@ public Tokenizer Lexer { public CSharpParser (SeekableStreamReader reader, SourceFile file, ArrayList defines) { - current_namespace = new NamespaceEntry (null, file, null, Location.Null); + current_namespace = new NamespaceEntry (null, file, null); this.name = file.Name; this.file = file; current_container = RootContext.Tree.Types; - current_container.NamespaceEntry = current_namespace; + current_container.Namespace = current_namespace; oob_stack = new Stack (); switch_stack = new Stack (); @@ -4289,26 +4252,10 @@ public void parse () // Please do not remove this, it is used during debugging // of the grammar // + Report.Error (-25, lexer.Location, ": Parsing error "); Console.WriteLine (e); - Report.Error (-25, lexer.Location, "Parsing error"); - if (Driver.parser_verbose) - Console.WriteLine (e); } } -void CheckToken (int error, int yyToken, string msg) -{ - if (yyToken >= Token.FIRST_KEYWORD && yyToken <= Token.LAST_KEYWORD){ - Report.Error (error, lexer.Location, String.Format ("{0}: `{1}' is a keyword", msg, yyName [yyToken].ToLower ())); - return; - } - Report.Error (error, lexer.Location, msg); -} - -void CheckIdentifierToken (int yyToken) -{ - CheckToken (1041, yyToken, "Identifier expected"); -} - /* end end end */ } diff --git a/mcs/gmcs/cs-tokenizer.cs b/mcs/gmcs/cs-tokenizer.cs index a2c490a6bd3..e759a1a1780 100755 --- a/mcs/gmcs/cs-tokenizer.cs +++ b/mcs/gmcs/cs-tokenizer.cs @@ -366,52 +366,6 @@ namespace Mono.CSharp return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_' || (c >= '0' && c <= '9') || Char.IsLetter (c);
}
- bool parse_less_than ()
- {
- start:
- int the_token = token ();
- switch (the_token) {
- case Token.IDENTIFIER:
- case Token.OBJECT:
- case Token.STRING:
- case Token.BOOL:
- case Token.DECIMAL:
- case Token.FLOAT:
- case Token.DOUBLE:
- case Token.SBYTE:
- case Token.BYTE:
- case Token.SHORT:
- case Token.USHORT:
- case Token.INT:
- case Token.UINT:
- case Token.LONG:
- case Token.ULONG:
- case Token.CHAR:
- case Token.VOID:
- break;
-
- default:
- return false;
- }
- again:
- the_token = token ();
-
- if (the_token == Token.OP_GENERICS_GT)
- return true;
- else if (the_token == Token.COMMA)
- goto start;
- else if (the_token == Token.OP_GENERICS_LT) {
- if (!parse_less_than ())
- return false;
- goto again;
- }
-
- return false;
- }
-
- bool parsing_less_than = false;
- int parsing_generic_less_than = 0;
-
int is_punct (char c, ref bool doread)
{
int d;
@@ -464,60 +418,6 @@ namespace Mono.CSharp return Token.INTERR;
}
- if (c == '<') {
- if (parsing_generic_less_than++ > 0)
- return Token.OP_GENERICS_LT;
-
- // Save current position and parse next token.
- int old = reader.Position;
- bool is_generic_lt = parse_less_than ();
- reader.Position = old;
- putback_char = -1;
-
- if (is_generic_lt) {
- parsing_generic_less_than++;
- return Token.OP_GENERICS_LT;
- } else
- parsing_generic_less_than = 0;
-
- d = peekChar ();
- if (d == '<'){
- getChar ();
- d = peekChar ();
-
- if (d == '='){
- doread = true;
- return Token.OP_SHIFT_LEFT_ASSIGN;
- }
- return Token.OP_SHIFT_LEFT;
- } else if (d == '='){
- doread = true;
- return Token.OP_LE;
- }
- return Token.OP_LT;
- } else if (c == '>') {
- if (parsing_generic_less_than > 0) {
- parsing_generic_less_than--;
- return Token.OP_GENERICS_GT;
- }
-
- d = peekChar ();
- if (d == '>'){
- getChar ();
- d = peekChar ();
-
- if (d == '='){
- doread = true;
- return Token.OP_SHIFT_RIGHT_ASSIGN;
- }
- return Token.OP_SHIFT_RIGHT;
- } else if (d == '='){
- doread = true;
- return Token.OP_GE;
- }
- return Token.OP_GT;
- }
-
d = peekChar ();
if (c == '+'){
@@ -613,37 +513,39 @@ namespace Mono.CSharp return Token.CARRET;
}
-#if FIXME
- if (c == '>'){
- if (deambiguate_greater_than == 0)
- return Token.OP_GT;
+ if (c == '<'){
+ if (d == '<'){
+ getChar ();
+ d = peekChar ();
- --deambiguate_greater_than;
+ if (d == '='){
+ doread = true;
+ return Token.OP_SHIFT_LEFT_ASSIGN;
+ }
+ return Token.OP_SHIFT_LEFT;
+ } else if (d == '='){
+ doread = true;
+ return Token.OP_LE;
+ }
+ return Token.OP_LT;
+ }
- // Save current position and parse next token.
- int old = reader.Position;
- int new_token = token ();
- reader.Position = old;
- putback_char = -1;
+ if (c == '>'){
+ if (d == '>'){
+ getChar ();
+ d = peekChar ();
- switch (new_token) {
- case Token.OPEN_PARENS:
- case Token.CLOSE_PARENS:
- case Token.CLOSE_BRACKET:
- case Token.OP_GT:
- case Token.COLON:
- case Token.SEMICOLON:
- case Token.COMMA:
- case Token.DOT:
- case Token.INTERR:
- return Token.OP_GENERICS_GT;
-
- default:
- return Token.OP_GT;
+ if (d == '='){
+ doread = true;
+ return Token.OP_SHIFT_RIGHT_ASSIGN;
+ }
+ return Token.OP_SHIFT_RIGHT;
+ } else if (d == '='){
+ doread = true;
+ return Token.OP_GE;
}
+ return Token.OP_GT;
}
-#endif
-
return Token.ERROR;
}
diff --git a/mcs/gmcs/decl.cs b/mcs/gmcs/decl.cs index f81a9f2c01f..f59b592399a 100755 --- a/mcs/gmcs/decl.cs +++ b/mcs/gmcs/decl.cs @@ -43,6 +43,153 @@ namespace Mono.CSharp { Location = loc; } + protected void WarningNotHiding (TypeContainer parent) + { + Report.Warning ( + 109, Location, + "The member " + parent.MakeName (Name) + " does not hide an " + + "inherited member. The keyword new is not required"); + + } + + void Error_CannotChangeAccessModifiers (TypeContainer parent, MethodInfo parent_method, + string name) + { + // + // FIXME: report the old/new permissions? + // + Report.Error ( + 507, Location, parent.MakeName (Name) + + ": can't change the access modifiers when overriding inherited " + + "member `" + name + "'"); + } + + // + // Performs various checks on the MethodInfo `mb' regarding the modifier flags + // that have been defined. + // + // `name' is the user visible name for reporting errors (this is used to + // provide the right name regarding method names and properties) + // + protected bool CheckMethodAgainstBase (TypeContainer parent, MethodAttributes my_attrs, + MethodInfo mb, string name) + { + bool ok = true; + + if ((ModFlags & Modifiers.OVERRIDE) != 0){ + if (!(mb.IsAbstract || mb.IsVirtual)){ + Report.Error ( + 506, Location, parent.MakeName (Name) + + ": cannot override inherited member `" + + name + "' because it is not " + + "virtual, abstract or override"); + ok = false; + } + + // Now we check that the overriden method is not final + + if (mb.IsFinal) { + // This happens when implementing interface methods. + if (mb.IsHideBySig && mb.IsVirtual) { + Report.Error ( + 506, Location, parent.MakeName (Name) + + ": cannot override inherited member `" + + name + "' because it is not " + + "virtual, abstract or override"); + } else + Report.Error (239, Location, parent.MakeName (Name) + " : cannot " + + "override inherited member `" + name + + "' because it is sealed."); + ok = false; + } + // + // Check that the permissions are not being changed + // + MethodAttributes thisp = my_attrs & MethodAttributes.MemberAccessMask; + MethodAttributes parentp = mb.Attributes & MethodAttributes.MemberAccessMask; + + // + // special case for "protected internal" + // + + if ((parentp & MethodAttributes.FamORAssem) == MethodAttributes.FamORAssem){ + // + // when overriding protected internal, the method can be declared + // protected internal only within the same assembly + // + + if ((thisp & MethodAttributes.FamORAssem) == MethodAttributes.FamORAssem){ + if (parent.TypeBuilder.Assembly != mb.DeclaringType.Assembly){ + // + // assemblies differ - report an error + // + + Error_CannotChangeAccessModifiers (parent, mb, name); + ok = false; + } else if (thisp != parentp) { + // + // same assembly, but other attributes differ - report an error + // + + Error_CannotChangeAccessModifiers (parent, mb, name); + ok = false; + }; + } else if ((thisp & MethodAttributes.Family) != MethodAttributes.Family) { + // + // if it's not "protected internal", it must be "protected" + // + + Error_CannotChangeAccessModifiers (parent, mb, name); + ok = false; + } else if (parent.TypeBuilder.Assembly == mb.DeclaringType.Assembly) { + // + // protected within the same assembly - an error + // + Error_CannotChangeAccessModifiers (parent, mb, name); + ok = false; + } else if ((thisp & ~(MethodAttributes.Family | MethodAttributes.FamORAssem)) != + (parentp & ~(MethodAttributes.Family | MethodAttributes.FamORAssem))) { + // + // protected ok, but other attributes differ - report an error + // + Error_CannotChangeAccessModifiers (parent, mb, name); + ok = false; + } + } else { + if (thisp != parentp){ + Error_CannotChangeAccessModifiers (parent, mb, name); + ok = false; + } + } + } + + if (mb.IsVirtual || mb.IsAbstract){ + if ((ModFlags & (Modifiers.NEW | Modifiers.OVERRIDE)) == 0){ + if (Name != "Finalize"){ + Report.Warning ( + 114, 2, Location, parent.MakeName (Name) + + " hides inherited member `" + name + + "'. To make the current member override that " + + "implementation, add the override keyword, " + + "otherwise use the new keyword"); + ModFlags |= Modifiers.NEW; + } + } + } else { + if ((ModFlags & (Modifiers.NEW | Modifiers.OVERRIDE)) == 0){ + if (Name != "Finalize"){ + Report.Warning ( + 108, 1, Location, "The keyword new is required on " + + parent.MakeName (Name) + " because it hides " + + "inherited member `" + name + "'"); + ModFlags |= Modifiers.NEW; + } + } + } + + return ok; + } + public abstract bool Define (TypeContainer parent); // @@ -64,6 +211,56 @@ namespace Mono.CSharp { } } + // + // FIXME: This is temporary outside DeclSpace, because I have to fix a bug + // in MCS that makes it fail the lookup for the enum + // + + /// <summary> + /// The result value from adding an declaration into + /// a struct or a class + /// </summary> + public enum AdditionResult { + /// <summary> + /// The declaration has been successfully + /// added to the declation space. + /// </summary> + Success, + + /// <summary> + /// The symbol has already been defined. + /// </summary> + NameExists, + + /// <summary> + /// Returned if the declation being added to the + /// name space clashes with its container name. + /// + /// The only exceptions for this are constructors + /// and static constructors + /// </summary> + EnclosingClash, + + /// <summary> + /// Returned if a constructor was created (because syntactically + /// it looked like a constructor) but was not (because the name + /// of the method is not the same as the container class + /// </summary> + NotAConstructor, + + /// <summary> + /// This is only used by static constructors to emit the + /// error 111, but this error for other things really + /// happens at another level for other functions. + /// </summary> + MethodExists, + + /// <summary> + /// Some other error. + /// </summary> + Error + } + /// <summary> /// Base class for structs, classes, enumerations and interfaces. /// </summary> @@ -88,7 +285,7 @@ namespace Mono.CSharp { // This is the namespace in which this typecontainer // was declared. We use this to resolve names. // - public NamespaceEntry NamespaceEntry; + public NamespaceEntry Namespace; public Hashtable Cache = new Hashtable (); @@ -103,67 +300,21 @@ namespace Mono.CSharp { // Whether we are Generic // public bool IsGeneric; - + TypeContainer parent; - public DeclSpace (NamespaceEntry ns, TypeContainer parent, string name, Location l) + public DeclSpace (TypeContainer parent, string name, Location l) : base (name, l) { - NamespaceEntry = ns; Basename = name.Substring (1 + name.LastIndexOf ('.')); defined_names = new Hashtable (); this.parent = parent; - } - - public void RecordDecl () - { - if ((NamespaceEntry != null) && (parent == RootContext.Tree.Types)) - NamespaceEntry.DefineName (Basename, this); - } - - /// <summary> - /// The result value from adding an declaration into - /// a struct or a class - /// </summary> - public enum AdditionResult { - /// <summary> - /// The declaration has been successfully - /// added to the declation space. - /// </summary> - Success, - /// <summary> - /// The symbol has already been defined. - /// </summary> - NameExists, - - /// <summary> - /// Returned if the declation being added to the - /// name space clashes with its container name. - /// - /// The only exceptions for this are constructors - /// and static constructors - /// </summary> - EnclosingClash, - - /// <summary> - /// Returned if a constructor was created (because syntactically - /// it looked like a constructor) but was not (because the name - /// of the method is not the same as the container class - /// </summary> - NotAConstructor, - - /// <summary> - /// This is only used by static constructors to emit the - /// error 111, but this error for other things really - /// happens at another level for other functions. - /// </summary> - MethodExists, - - /// <summary> - /// Some other error. - /// </summary> - Error + // + // We are generic if our parent is generic + // + if (parent != null) + IsGeneric = parent.IsGeneric; } /// <summary> @@ -237,8 +388,8 @@ namespace Mono.CSharp { /// </summary> public string LookupAlias (string name) { - if (NamespaceEntry != null) - return NamespaceEntry.LookupAlias (name); + if (Namespace != null) + return Namespace.LookupAlias (name); else return null; } @@ -376,9 +527,6 @@ namespace Mono.CSharp { { if (check_type == TypeBuilder) return true; - - if (check_type.IsUnboundGenericParameter) - return true; // FIXME TypeAttributes check_attr = check_type.Attributes & TypeAttributes.VisibilityMask; @@ -470,49 +618,27 @@ namespace Mono.CSharp { return false; } - static DoubleHash dh = new DoubleHash (); - + Type LookupInterfaceOrClass (string ns, string name, out bool error) { DeclSpace parent; Type t; - object r; - + error = false; - if (dh.Lookup (ns, name, out r)) - t = (Type) r; - else { - if (ns != ""){ - if (Namespace.IsNamespace (ns)){ - string fullname = (ns != "") ? ns + "." + name : name; - t = TypeManager.LookupType (fullname); - } else - t = null; - } else - t = TypeManager.LookupType (name); - } - + name = MakeFQN (ns, name); + + t = TypeManager.LookupType (name); if (t != null) return t; - // - // In case we are fed a composite name, normalize it. - // - int p = name.LastIndexOf ('.'); - if (p != -1){ - ns = MakeFQN (ns, name.Substring (0, p)); - name = name.Substring (p+1); - } - - parent = RootContext.Tree.LookupByNamespace (ns, name); + parent = (DeclSpace) RootContext.Tree.Decls [name]; if (parent == null) return null; - + t = parent.DefineType (); - dh.Insert (ns, name, t); if (t == null){ - Report.Error (146, Location, "Class definition is circular: `" + MakeFQN (ns, name) + "'"); + Report.Error (146, Location, "Class definition is circular: `"+name+"'"); error = true; return null; } @@ -571,8 +697,8 @@ namespace Mono.CSharp { // // Attempt to lookup the class on our namespace and all it's implicit parents // - for (NamespaceEntry ns = NamespaceEntry; ns != null; ns = ns.ImplicitParent) { - t = LookupInterfaceOrClass (ns.FullName, name, out error); + for (NamespaceEntry ns = Namespace; ns != null; ns = ns.ImplicitParent) { + t = LookupInterfaceOrClass (ns.Name, name, out error); if (error) return null; @@ -595,9 +721,9 @@ namespace Mono.CSharp { // namespaces // - for (NamespaceEntry ns = NamespaceEntry; ns != null; ns = ns.Parent){ + for (NamespaceEntry ns = Namespace; ns != null; ns = ns.Parent){ - t = LookupInterfaceOrClass (ns.FullName, name, out error); + t = LookupInterfaceOrClass (ns.Name, name, out error); if (error) return null; @@ -652,15 +778,15 @@ namespace Mono.CSharp { // // Extensions for generics // - TypeParameter[] type_params; + ArrayList type_parameter_list; /// /// Called by the parser to configure the type_parameter_list for this /// declaration space /// - public AdditionResult SetParameterInfo (ArrayList type_parameter_list, ArrayList constraints_list, Location loc) + public AdditionResult SetParameterInfo (ArrayList type_parameter_list, object constraints) { - type_params = new TypeParameter [type_parameter_list.Count]; + this.type_parameter_list = type_parameter_list; // // Mark this type as Generic @@ -670,45 +796,38 @@ namespace Mono.CSharp { // // Register all the names // - for (int i = 0; i < type_parameter_list.Count; i++) { - string name = (string) type_parameter_list [i]; - - AdditionResult res = IsValid (name, name); + foreach (string type_parameter in type_parameter_list){ + AdditionResult res = IsValid (type_parameter, type_parameter); if (res != AdditionResult.Success) return res; - Constraints constraints = null; - if (constraints_list != null) { - foreach (Constraints constraint in constraints_list) { - if (constraint.TypeParameter == name) { - constraints = constraint; - break; - } - } - } - - type_params [i] = new TypeParameter (name, constraints, loc); - - DefineName (name, type_params [i]); + DefineName (type_parameter, GetGenericData ()); } return AdditionResult.Success; } - public TypeParameter[] TypeParameters { - get { - return type_params; - } + // + // This is just something to flag the defined names for now + // + const int GENERIC_COOKIE = 20; + static object generic_flag = GENERIC_COOKIE; + + static object GetGenericData () + { + return generic_flag; } - - public TypeParameterExpr LookupGeneric (string name, Location loc) + + /// <summary> + /// Returns a GenericTypeExpr if `name' refers to a type parameter + /// </summary> + public TypeParameterExpr LookupGeneric (string name, Location l) { - foreach (TypeParameter type_param in TypeParameters) { - if (type_param.Name != name) - continue; - - return new TypeParameterExpr (type_param, loc); + foreach (string type_parameter in type_parameter_list){ + Console.WriteLine (" trying: " + type_parameter); + if (name == type_parameter) + return new TypeParameterExpr (name, l); } return null; diff --git a/mcs/gmcs/delegate.cs b/mcs/gmcs/delegate.cs index 35a9e43a0b5..f46b7c87abd 100644 --- a/mcs/gmcs/delegate.cs +++ b/mcs/gmcs/delegate.cs @@ -46,10 +46,10 @@ namespace Mono.CSharp { Modifiers.UNSAFE |
Modifiers.PRIVATE;
- public Delegate (NamespaceEntry ns, TypeContainer parent, Expression type,
- int mod_flags, string name, Parameters param_list,
+ public Delegate (TypeContainer parent, Expression type, int mod_flags,
+ string name, Parameters param_list,
Attributes attrs, Location l)
- : base (ns, parent, name, l)
+ : base (parent, name, l)
{
this.ReturnType = type;
ModFlags = Modifiers.Check (AllowedModifiers, mod_flags,
diff --git a/mcs/gmcs/driver.cs b/mcs/gmcs/driver.cs index 6418f49f471..01d12ea067c 100755 --- a/mcs/gmcs/driver.cs +++ b/mcs/gmcs/driver.cs @@ -60,7 +60,6 @@ namespace Mono.CSharp static bool timestamps = false; static bool pause = false; static bool show_counters = false; - public static bool parser_verbose = false; // // Whether to load the initial config file (what CSC.RSP has by default) @@ -577,10 +576,6 @@ namespace Mono.CSharp static bool UnixParseOption (string arg, ref string [] args, ref int i) { switch (arg){ - case "-vv": - parser_verbose = true; - return true; - case "-v": yacc_verbose = true; return true; diff --git a/mcs/gmcs/ecore.cs b/mcs/gmcs/ecore.cs index 11e047ffa3c..3e5af299637 100755 --- a/mcs/gmcs/ecore.cs +++ b/mcs/gmcs/ecore.cs @@ -1950,7 +1950,7 @@ namespace Mono.CSharp { public override Expression ResolveAsTypeStep (EmitContext ec) { DeclSpace ds = ec.DeclSpace; - NamespaceEntry ns = ds.NamespaceEntry; + NamespaceEntry ns = ds.Namespace; Type t; string alias_value; @@ -1991,12 +1991,12 @@ namespace Mono.CSharp { } if (ec.IsGeneric){ - TypeParameterExpr generic_type = ds.LookupGeneric (Name, loc); - - if (generic_type != null) - return generic_type; - } - + TypeParameterExpr generic_type = ds.LookupGeneric (Name, loc); + + if (generic_type != null) + return generic_type; + } + // // Stage 2: Lookup up if we are an alias to a type // or a namespace. @@ -2032,6 +2032,29 @@ namespace Mono.CSharp { Expression e = null; // + // Since we are cheating (is_base is our hint + // that we are the beginning of the name): we + // only do the Alias lookup for namespaces if + // the name does not include any dots in it + // + NamespaceEntry ns = ec.DeclSpace.Namespace; + if (is_base && ns != null){ + string alias_value = ns.LookupAlias (Name); + if (alias_value != null){ + Name = alias_value; + Type t; + + if ((t = TypeManager.LookupType (Name)) != null) + return new TypeExpr (t, loc); + + // No match, maybe our parent can compose us + // into something meaningful. + return this; + } + } + + + // // Stage 1: Performed by the parser (binding to locals or parameters). // Block current_block = ec.CurrentBlock; @@ -2085,31 +2108,8 @@ namespace Mono.CSharp { if (e == null && ec.ContainerType != null) e = MemberLookup (ec, ec.ContainerType, Name, loc); - if (e == null) { - // - // Since we are cheating (is_base is our hint - // that we are the beginning of the name): we - // only do the Alias lookup for namespaces if - // the name does not include any dots in it - // - NamespaceEntry ns = ec.DeclSpace.NamespaceEntry; - if (is_base && ns != null){ - string alias_value = ns.LookupAlias (Name); - if (alias_value != null){ - Name = alias_value; - Type t; - - if ((t = TypeManager.LookupType (Name)) != null) - return new TypeExpr (t, loc); - - // No match, maybe our parent can compose us - // into something meaningful. - return this; - } - } - + if (e == null) return ResolveAsTypeStep (ec); - } if (e is TypeExpr) return e; @@ -2535,9 +2535,6 @@ namespace Mono.CSharp { // if (ec.IsConstructor){ - if (IsStatic && !ec.IsStatic) - Report_AssignToReadonly (false); - if (ec.ContainerType == FieldInfo.DeclaringType) return this; } diff --git a/mcs/gmcs/enum.cs b/mcs/gmcs/enum.cs index 06f4c9e0cf7..c6f613bfadf 100755 --- a/mcs/gmcs/enum.cs +++ b/mcs/gmcs/enum.cs @@ -49,9 +49,8 @@ namespace Mono.CSharp { Modifiers.INTERNAL | Modifiers.PRIVATE; - public Enum (NamespaceEntry ns, TypeContainer parent, Expression type, int mod_flags, - string name, Attributes attrs, Location l) - : base (ns, parent, name, l) + public Enum (TypeContainer parent, Expression type, int mod_flags, string name, Attributes attrs, Location l) + : base (parent, name, l) { this.BaseType = type; ModFlags = Modifiers.Check (AllowedModifiers, mod_flags, diff --git a/mcs/gmcs/expression.cs b/mcs/gmcs/expression.cs index ad2a4d6309d..a223248ee94 100755 --- a/mcs/gmcs/expression.cs +++ b/mcs/gmcs/expression.cs @@ -700,7 +700,7 @@ namespace Mono.CSharp { public new void CacheTemporaries (EmitContext ec) { - temporary = new LocalTemporary (ec, expr.Type); + temporary = new LocalTemporary (ec, type); } public override string ToString () @@ -826,9 +826,6 @@ namespace Mono.CSharp { // type = expr_type; if (expr.eclass == ExprClass.Variable){ - LocalVariableReference var = expr as LocalVariableReference; - if ((var != null) && var.IsReadOnly) - Error (1604, "cannot assign to `" + var.Name + "' because it is readonly"); if (IsIncrementableNumber (expr_type) || expr_type == TypeManager.decimal_type){ return this; @@ -1090,8 +1087,6 @@ namespace Mono.CSharp { return null; expr = expr.Resolve (ec); - if (expr == null) - return null; return this; } @@ -3510,6 +3505,7 @@ namespace Mono.CSharp { public readonly string Name; public readonly Block Block; LocalInfo local_info; + VariableInfo variable_info; bool is_readonly; public LocalVariableReference (Block block, string name, Location l) @@ -3531,7 +3527,7 @@ namespace Mono.CSharp { } public VariableInfo VariableInfo { - get { return local_info.VariableInfo; } + get { return variable_info; } } public bool IsReadOnly { @@ -3547,11 +3543,8 @@ namespace Mono.CSharp { is_readonly = local_info.ReadOnly; } + variable_info = Block.GetVariableInfo (local_info); type = local_info.VariableType; -#if false - if (ec.InAnonymousMethod) - Block.LiftVariable (local_info); -#endif } public override Expression DoResolve (EmitContext ec) @@ -3565,7 +3558,6 @@ namespace Mono.CSharp { return e; } - VariableInfo variable_info = local_info.VariableInfo; if ((variable_info != null) && !variable_info.IsAssigned (ec, loc)) return null; @@ -3579,7 +3571,6 @@ namespace Mono.CSharp { { DoResolveBase (ec); - VariableInfo variable_info = local_info.VariableInfo; if (variable_info != null) variable_info.SetAssigned (ec); @@ -4559,11 +4550,11 @@ namespace Mono.CSharp { (applicable_type.IsSubclassOf (decl_type) || TypeManager.ImplementsInterface (applicable_type, decl_type)) && found_applicable) - continue; + continue; // Check if candidate is applicable (section 14.4.2.1) - if (IsApplicable (ec, Arguments, candidate)) { + if (!IsApplicable (ec, Arguments, candidate)) { // Candidate is applicable in normal form candidates.Add (candidate); applicable_type = candidate.DeclaringType; @@ -6308,7 +6299,7 @@ namespace Mono.CSharp { } if ((block != null) && (block.ThisVariable != null)) - variable_info = block.ThisVariable.VariableInfo; + variable_info = block.GetVariableInfo (block.ThisVariable); return true; } @@ -7982,20 +7973,6 @@ namespace Mono.CSharp { if (ltype == null) return null; - if (ltype.IsUnboundGenericParameter) { - int rank = dim.Length-2; - if ((rank < 0) || (dim [0] != '[') || (dim [rank+1] != ']')) - return null; - for (int i = 0; i < rank; i++) - if (dim [i+1] != ',') - return null; - - type = Array.CreateInstance (ltype, rank).GetType (); - - eclass = ExprClass.Type; - return this; - } - // // ltype.Fullname is already fully qualified, so we can skip // a lot of probes, and go directly to TypeManager.LookupType diff --git a/mcs/gmcs/flowanalysis.cs b/mcs/gmcs/flowanalysis.cs deleted file mode 100644 index cab8a5108a5..00000000000 --- a/mcs/gmcs/flowanalysis.cs +++ /dev/null @@ -1,1895 +0,0 @@ -// -// flowanalyis.cs: The control flow analysis code -// -// Author: -// Martin Baulig (martin@ximian.com) -// -// (C) 2001, 2002, 2003 Ximian, Inc. -// - -using System; -using System.Text; -using System.Collections; -using System.Reflection; -using System.Reflection.Emit; -using System.Diagnostics; - -namespace Mono.CSharp -{ - // <summary> - // A new instance of this class is created every time a new block is resolved - // and if there's branching in the block's control flow. - // </summary> - public abstract class FlowBranching - { - // <summary> - // The type of a FlowBranching. - // </summary> - public enum BranchingType { - // Normal (conditional or toplevel) block. - Block, - - // A loop block. - LoopBlock, - - // Try/Catch block. - Exception, - - // Switch block. - Switch, - - // Switch section. - SwitchSection - } - - // <summary> - // The type of one sibling of a branching. - // </summary> - public enum SiblingType { - Conditional, - SwitchSection, - Try, - Catch, - Finally - } - - // <summary> - // This is used in the control flow analysis code to specify whether the - // current code block may return to its enclosing block before reaching - // its end. - // </summary> - public enum FlowReturns { - Undefined = 0, - - // It can never return. - Never, - - // This means that the block contains a conditional return statement - // somewhere. - Sometimes, - - // The code always returns, ie. there's an unconditional return / break - // statement in it. - Always, - - // The code always throws an exception. - Exception, - - // The current code block is unreachable. This happens if it's immediately - // following a FlowReturns.Always block. - Unreachable - } - - public static FlowBranching CreateBranching (FlowBranching parent, BranchingType type, Block block, Location loc) - { - switch (type) { - case BranchingType.Exception: - return new FlowBranchingException (parent, type, block, loc); - - case BranchingType.Switch: - return new FlowBranchingBlock (parent, type, SiblingType.SwitchSection, block, loc); - - default: - return new FlowBranchingBlock (parent, type, SiblingType.Conditional, block, loc); - } - } - - // <summary> - // The type of this flow branching. - // </summary> - public readonly BranchingType Type; - - // <summary> - // The block this branching is contained in. This may be null if it's not - // a top-level block and it doesn't declare any local variables. - // </summary> - public readonly Block Block; - - // <summary> - // The parent of this branching or null if this is the top-block. - // </summary> - public readonly FlowBranching Parent; - - // <summary> - // Start-Location of this flow branching. - // </summary> - public readonly Location Location; - - // <summary> - // If this is an infinite loop. - // </summary> - public bool Infinite; - - // <summary> - // If we may leave the current loop. - // </summary> - public bool MayLeaveLoop; - - // - // Private - // - VariableMap param_map, local_map; - - static int next_id = 0; - int id; - - // <summary> - // Performs an `And' operation on the FlowReturns status - // (for instance, a block only returns Always if all its siblings - // always return). - // </summary> - public static FlowReturns AndFlowReturns (FlowReturns a, FlowReturns b) - { - if (a == FlowReturns.Undefined) - return b; - if (b == FlowReturns.Unreachable) - return a; - - switch (a) { - case FlowReturns.Never: - if (b == FlowReturns.Never) - return FlowReturns.Never; - else - return FlowReturns.Sometimes; - - case FlowReturns.Sometimes: - return FlowReturns.Sometimes; - - case FlowReturns.Always: - if ((b == FlowReturns.Always) || (b == FlowReturns.Exception)) - return FlowReturns.Always; - else - return FlowReturns.Sometimes; - - case FlowReturns.Exception: - if (b == FlowReturns.Exception) - return FlowReturns.Exception; - else if (b == FlowReturns.Always) - return FlowReturns.Always; - else - return FlowReturns.Sometimes; - } - - return b; - } - - // <summary> - // The vector contains a BitArray with information about which local variables - // and parameters are already initialized at the current code position. - // </summary> - public class UsageVector { - // <summary> - // The type of this branching. - // </summary> - public readonly SiblingType Type; - - // <summary> - // Start location of this branching. - // </summary> - public readonly Location Location; - - // <summary> - // If this is true, then the usage vector has been modified and must be - // merged when we're done with this branching. - // </summary> - public bool IsDirty; - - // <summary> - // The number of parameters in this block. - // </summary> - public readonly int CountParameters; - - // <summary> - // The number of locals in this block. - // </summary> - public readonly int CountLocals; - - // <summary> - // If not null, then we inherit our state from this vector and do a - // copy-on-write. If null, then we're the first sibling in a top-level - // block and inherit from the empty vector. - // </summary> - public readonly UsageVector InheritsFrom; - - // - // Private. - // - MyBitVector locals, parameters; - FlowReturns RealReturns, RealBreaks, RealReachable; - bool is_finally; - - static int next_id = 0; - int id; - - // - // Normally, you should not use any of these constructors. - // - public UsageVector (SiblingType type, UsageVector parent, Location loc, int num_params, int num_locals) - { - this.Type = type; - this.Location = loc; - this.InheritsFrom = parent; - this.CountParameters = num_params; - this.CountLocals = num_locals; - this.RealReturns = FlowReturns.Never; - this.RealBreaks = FlowReturns.Never; - this.RealReachable = FlowReturns.Always; - - if (parent != null) { - locals = new MyBitVector (parent.locals, CountLocals); - if (num_params > 0) - parameters = new MyBitVector (parent.parameters, num_params); - RealReturns = parent.Returns; - RealBreaks = parent.Breaks; - } else { - locals = new MyBitVector (null, CountLocals); - if (num_params > 0) - parameters = new MyBitVector (null, num_params); - } - - id = ++next_id; - } - - public UsageVector (SiblingType type, UsageVector parent, Location loc) - : this (type, parent, loc, parent.CountParameters, parent.CountLocals) - { } - - // <summary> - // This does a deep copy of the usage vector. - // </summary> - public UsageVector Clone () - { - UsageVector retval = new UsageVector (Type, null, Location, CountParameters, CountLocals); - - retval.locals = locals.Clone (); - if (parameters != null) - retval.parameters = parameters.Clone (); - retval.RealReturns = RealReturns; - retval.RealBreaks = RealBreaks; - retval.RealReachable = RealReachable; - - return retval; - } - - public bool IsAssigned (VariableInfo var) - { - if (!var.IsParameter && AlwaysBreaks) - return true; - - return var.IsAssigned (var.IsParameter ? parameters : locals); - } - - public void SetAssigned (VariableInfo var) - { - if (!var.IsParameter && AlwaysBreaks) - return; - - var.SetAssigned (var.IsParameter ? parameters : locals); - } - - public bool IsFieldAssigned (VariableInfo var, string name) - { - if (!var.IsParameter && AlwaysBreaks) - return true; - - return var.IsFieldAssigned (var.IsParameter ? parameters : locals, name); - } - - public void SetFieldAssigned (VariableInfo var, string name) - { - if (!var.IsParameter && AlwaysBreaks) - return; - - var.SetFieldAssigned (var.IsParameter ? parameters : locals, name); - } - - // <summary> - // Specifies when the current block returns. - // If this is FlowReturns.Unreachable, then control can never reach the - // end of the method (so that we don't need to emit a return statement). - // The same applies for FlowReturns.Exception, but in this case the return - // value will never be used. - // </summary> - public FlowReturns Returns { - get { - return RealReturns; - } - } - - // <summary> - // Specifies whether control may return to our containing block - // before reaching the end of this block. This happens if there - // is a break/continue/goto/return in it. - // This can also be used to find out whether the statement immediately - // following the current block may be reached or not. - // </summary> - public FlowReturns Breaks { - get { - return RealBreaks; - } - } - - public FlowReturns Reachable { - get { - return RealReachable; - } - } - - public bool AlwaysBreaks { - get { - return (Breaks == FlowReturns.Always) || - (Breaks == FlowReturns.Exception) || - (Breaks == FlowReturns.Unreachable); - } - } - - public bool MayBreak { - get { - return Breaks != FlowReturns.Never; - } - } - - public bool AlwaysReturns { - get { - return (Returns == FlowReturns.Always) || - (Returns == FlowReturns.Exception); - } - } - - public bool MayReturn { - get { - return (Returns == FlowReturns.Sometimes) || - (Returns == FlowReturns.Always); - } - } - - public void Break () - { - RealBreaks = FlowReturns.Always; - } - - public void Return () - { - RealReturns = FlowReturns.Always; - } - - public bool IsUnreachable { - get { - return (Reachable == FlowReturns.Exception) || - (Reachable == FlowReturns.Unreachable); - } - } - - public void Unreachable () - { - // If we're already unreachable, don't modify the reason why. - if (!IsUnreachable) - RealReachable = FlowReturns.Unreachable; - } - - public void NeverReachable () - { - // If we're already unreachable, don't modify the reason why. - if (!IsUnreachable) - RealReachable = FlowReturns.Never; - } - - public void Throw () - { - // If we're already unreachable, don't modify the reason why. - if (!IsUnreachable) - RealReachable = FlowReturns.Exception; - } - - // <summary> - // Merges a child branching. - // </summary> - public FlowReturns MergeChild (MyBitVector new_params, MyBitVector new_locals, - FlowReturns new_returns, FlowReturns new_breaks, - FlowReturns new_reachable) - { - Report.Debug (2, "MERGING CHILD", this, new_params, new_locals, new_returns, new_breaks, - new_reachable); - - RealReturns = new_returns; - RealBreaks = new_breaks; - RealReachable = new_reachable; - - // - // We've now either reached the point after the branching or we will - // never get there since we always return or always throw an exception. - // - // If we can reach the point after the branching, mark all locals and - // parameters as initialized which have been initialized in all branches - // we need to look at (see above). - // - - Report.Debug (2, "MERGING CHILD #1", this, Returns, Breaks, Reachable, new_locals, new_params); - - if ((Reachable == FlowReturns.Always) || (Reachable == FlowReturns.Sometimes) || - (Reachable == FlowReturns.Never)) { - if ((Returns == FlowReturns.Always) || (Breaks == FlowReturns.Always)) - RealReachable = FlowReturns.Never; - if ((Type == SiblingType.SwitchSection) && (Reachable != FlowReturns.Never)) { - Report.Error (163, Location, "Control cannot fall through from one " + - "case label to another"); - } - - if (new_locals != null) - locals.Or (new_locals); - - if (new_params != null) - parameters.Or (new_params); - } - - Report.Debug (2, "MERGING CHILD DONE", this); - - return Returns; - } - - // <summary> - // Tells control flow analysis that the current code position may be reached with - // a forward jump from any of the origins listed in `origin_vectors' which is a - // list of UsageVectors. - // - // This is used when resolving forward gotos - in the following example, the - // variable `a' is uninitialized in line 8 becase this line may be reached via - // the goto in line 4: - // - // 1 int a; - // - // 3 if (something) - // 4 goto World; - // - // 6 a = 5; - // - // 7 World: - // 8 Console.WriteLine (a); - // - // </summary> - public void MergeJumpOrigins (ICollection origin_vectors) - { - Report.Debug (1, "MERGING JUMP ORIGIN", this); - - RealBreaks = FlowReturns.Never; - RealReturns = FlowReturns.Never; - if (Reachable != FlowReturns.Always) - RealReachable = FlowReturns.Always; - - if (origin_vectors == null) - return; - - foreach (UsageVector vector in origin_vectors) { - Report.Debug (1, " MERGING JUMP ORIGIN", vector); - - locals.And (vector.locals); - if (parameters != null) - parameters.And (vector.parameters); - RealBreaks = AndFlowReturns (RealBreaks, vector.Breaks); - RealReturns = AndFlowReturns (RealReturns, vector.Returns); - RealReachable = AndFlowReturns (RealReachable, vector.Reachable); - } - - Report.Debug (1, "MERGING JUMP ORIGIN DONE", this); - } - - // <summary> - // This is used at the beginning of a finally block if there were - // any return statements in the try block or one of the catch blocks. - // </summary> - public void MergeFinallyOrigins (ICollection finally_vectors) - { - Report.Debug (1, "MERGING FINALLY ORIGIN", this); - - RealBreaks = FlowReturns.Never; - - foreach (UsageVector vector in finally_vectors) { - Report.Debug (1, " MERGING FINALLY ORIGIN", vector); - - if (parameters != null) - parameters.And (vector.parameters); - RealBreaks = AndFlowReturns (Breaks, vector.Breaks); - } - - is_finally = true; - - Report.Debug (1, "MERGING FINALLY ORIGIN DONE", this); - } - - public void CheckOutParameters (FlowBranching branching) - { - if (parameters != null) - branching.CheckOutParameters (parameters, branching.Location); - } - - // <summary> - // Performs an `or' operation on the locals and the parameters. - // </summary> - public void Or (UsageVector new_vector) - { - locals.Or (new_vector.locals); - if (parameters != null) - parameters.Or (new_vector.parameters); - } - - // <summary> - // Performs an `and' operation on the locals. - // </summary> - public void AndLocals (UsageVector new_vector) - { - locals.And (new_vector.locals); - } - - public bool HasParameters { - get { - return parameters != null; - } - } - - public bool HasLocals { - get { - return locals != null; - } - } - - // <summary> - // Returns a deep copy of the parameters. - // </summary> - public MyBitVector Parameters { - get { - if (parameters != null) - return parameters.Clone (); - else - return null; - } - } - - // <summary> - // Returns a deep copy of the locals. - // </summary> - public MyBitVector Locals { - get { - return locals.Clone (); - } - } - - public MyBitVector ParameterVector { - get { - return parameters; - } - } - - public MyBitVector LocalVector { - get { - return locals; - } - } - - // - // Debugging stuff. - // - - public override string ToString () - { - StringBuilder sb = new StringBuilder (); - - sb.Append ("Vector ("); - sb.Append (id); - sb.Append (","); - sb.Append (Returns); - sb.Append (","); - sb.Append (Breaks); - sb.Append (","); - sb.Append (Reachable); - if (parameters != null) { - sb.Append (" - "); - sb.Append (parameters); - } - sb.Append (" - "); - sb.Append (locals); - sb.Append (")"); - - return sb.ToString (); - } - } - - // <summary> - // Creates a new flow branching which is contained in `parent'. - // You should only pass non-null for the `block' argument if this block - // introduces any new variables - in this case, we need to create a new - // usage vector with a different size than our parent's one. - // </summary> - protected FlowBranching (FlowBranching parent, BranchingType type, SiblingType stype, - Block block, Location loc) - { - Parent = parent; - Block = block; - Location = loc; - Type = type; - id = ++next_id; - - UsageVector vector; - if (Block != null) { - param_map = Block.ParameterMap; - local_map = Block.LocalMap; - - UsageVector parent_vector = parent != null ? parent.CurrentUsageVector : null; - vector = new UsageVector (stype, parent_vector, loc, param_map.Length, local_map.Length); - } else { - param_map = Parent.param_map; - local_map = Parent.local_map; - vector = new UsageVector (stype, Parent.CurrentUsageVector, loc); - } - - AddSibling (vector); - } - - public abstract UsageVector CurrentUsageVector { - get; - } - - // <summary> - // Creates a sibling of the current usage vector. - // </summary> - public virtual void CreateSibling (SiblingType type) - { - AddSibling (new UsageVector (type, Parent.CurrentUsageVector, Location)); - - Report.Debug (1, "CREATED SIBLING", CurrentUsageVector); - } - - protected abstract void AddSibling (UsageVector uv); - - public abstract void Break (); - public abstract void Return (); - public abstract void Goto (); - public abstract void Throw (); - public abstract void Label (ArrayList origin_vectors); - - // <summary> - // Check whether all `out' parameters have been assigned. - // </summary> - public void CheckOutParameters (MyBitVector parameters, Location loc) - { - for (int i = 0; i < param_map.Count; i++) { - VariableInfo var = param_map [i]; - - if (var == null) - continue; - - if (var.IsAssigned (parameters)) - continue; - - Report.Error (177, loc, "The out parameter `" + - param_map.VariableNames [i] + "' must be " + - "assigned before control leave the current method."); - } - } - - protected class MergeResult - { - public MyBitVector Parameters; - public MyBitVector Locals; - public FlowReturns Returns; - public FlowReturns Breaks; - public FlowReturns Reachable; - public bool MayLeaveLoop; - - public MergeResult (MyBitVector parameters, MyBitVector locals, FlowReturns returns, FlowReturns breaks, - FlowReturns reachable, bool may_leave_loop) - { - this.Parameters = parameters; - this.Locals = locals; - this.Returns = returns; - this.Breaks = breaks; - this.Reachable = reachable; - this.MayLeaveLoop = may_leave_loop; - } - } - - protected MergeResult Merge (ArrayList children) - { - MyBitVector locals = null; - MyBitVector parameters = null; - - FlowReturns returns = FlowReturns.Undefined; - FlowReturns breaks = FlowReturns.Undefined; - FlowReturns reachable = FlowReturns.Undefined; - - Report.Debug (2, "MERGING CHILDREN", this, Type, children.Count); - - foreach (UsageVector child in children) { - Report.Debug (2, " MERGING CHILD", child, child.AlwaysBreaks, child.AlwaysReturns, - child.IsUnreachable, child.Locals, child.Parameters, - child.Returns, child.Breaks, child.Reachable); - - reachable = AndFlowReturns (reachable, child.Reachable); - - // Ignore unreachable children. - if (child.IsUnreachable) - continue; - - returns = AndFlowReturns (returns, child.Returns); - breaks = AndFlowReturns (breaks, child.Breaks); - - // A local variable is initialized after a flow branching if it - // has been initialized in all its branches which do neither - // always return or always throw an exception. - // - // If a branch may return, but does not always return, then we - // can treat it like a never-returning branch here: control will - // only reach the code position after the branching if we did not - // return here. - // - // It's important to distinguish between always and sometimes - // returning branches here: - // - // 1 int a; - // 2 if (something) { - // 3 return; - // 4 a = 5; - // 5 } - // 6 Console.WriteLine (a); - // - // The if block in lines 3-4 always returns, so we must not look - // at the initialization of `a' in line 4 - thus it'll still be - // uninitialized in line 6. - // - // On the other hand, the following is allowed: - // - // 1 int a; - // 2 if (something) - // 3 a = 5; - // 4 else - // 5 return; - // 6 Console.WriteLine (a); - // - // Here, `a' is initialized in line 3 and we must not look at - // line 5 since it always returns. - // - if (!child.AlwaysReturns && !child.AlwaysBreaks) - MyBitVector.And (ref locals, child.LocalVector); - - // An `out' parameter must be assigned in all branches which do - // not always throw an exception. - if ((child.Type != SiblingType.Catch) && - (child.ParameterVector != null) && (child.Breaks != FlowReturns.Exception)) - MyBitVector.And (ref parameters, child.ParameterVector); - } - - Report.Debug (2, "MERGING CHILDREN DONE", Type, parameters, locals, returns, breaks, reachable, - Infinite, MayLeaveLoop, this); - - if (Infinite && !MayLeaveLoop) { - Report.Debug (1, "INFINITE", returns, breaks, this); - - if (returns == FlowReturns.Never) { - // We're actually infinite. - breaks = FlowReturns.Unreachable; - returns = FlowReturns.Unreachable; - } else if ((returns == FlowReturns.Sometimes) || (returns == FlowReturns.Always)) { - // If we're an infinite loop and do not break, the code after - // the loop can never be reached. However, if we may return - // from the loop, then we do always return (or stay in the loop - // forever). - returns = FlowReturns.Always; - } - } - - if (returns == FlowReturns.Undefined) - returns = FlowReturns.Never; - if (breaks == FlowReturns.Undefined) - breaks = FlowReturns.Never; - - return new MergeResult (parameters, locals, returns, breaks, reachable, MayLeaveLoop); - } - - protected abstract MergeResult Merge (); - - // <summary> - // Merge a child branching. - // </summary> - public FlowReturns MergeChild (FlowBranching child) - { - MergeResult result = child.Merge (); - - CurrentUsageVector.MergeChild ( - result.Parameters, result.Locals, result.Returns, result.Breaks, result.Reachable); - - if ((child.Type != BranchingType.LoopBlock) && (child.Type != BranchingType.SwitchSection)) - MayLeaveLoop |= child.MayLeaveLoop; - - if (result.Reachable == FlowReturns.Exception) - return FlowReturns.Exception; - else - return result.Returns; - } - - // <summary> - // Does the toplevel merging. - // </summary> - public FlowReturns MergeTopBlock () - { - if ((Type != BranchingType.Block) || (Block == null)) - throw new NotSupportedException (); - - UsageVector vector = new UsageVector ( - SiblingType.Conditional, null, Location, param_map.Length, local_map.Length); - - MergeResult result = Merge (); - vector.MergeChild (result.Parameters, result.Locals, result.Returns, result.Breaks, result.Reachable); - - if (vector.Reachable != FlowReturns.Exception) - CheckOutParameters (vector.Parameters, Location); - else - return FlowReturns.Exception; - - return result.Returns; - } - - public virtual bool InTryBlock () - { - if (Parent != null) - return Parent.InTryBlock (); - else - return false; - } - - public virtual void AddFinallyVector (UsageVector vector) - { - if (Parent != null) - Parent.AddFinallyVector (vector); - else - throw new NotSupportedException (); - } - - public bool IsAssigned (VariableInfo vi) - { - return CurrentUsageVector.IsAssigned (vi); - } - - public bool IsFieldAssigned (VariableInfo vi, string field_name) - { - if (CurrentUsageVector.IsAssigned (vi)) - return true; - - return CurrentUsageVector.IsFieldAssigned (vi, field_name); - } - - public void SetAssigned (VariableInfo vi) - { - CurrentUsageVector.SetAssigned (vi); - } - - public void SetFieldAssigned (VariableInfo vi, string name) - { - CurrentUsageVector.SetFieldAssigned (vi, name); - } - - public override string ToString () - { - StringBuilder sb = new StringBuilder (); - sb.Append (GetType ()); - sb.Append (" ("); - - sb.Append (id); - sb.Append (","); - sb.Append (Type); - if (Block != null) { - sb.Append (" - "); - sb.Append (Block.ID); - sb.Append (" - "); - sb.Append (Block.StartLocation); - } - sb.Append (" - "); - // sb.Append (Siblings.Length); - // sb.Append (" - "); - sb.Append (CurrentUsageVector); - sb.Append (")"); - return sb.ToString (); - } - } - - public class FlowBranchingBlock : FlowBranching - { - UsageVector current_vector; - ArrayList siblings = new ArrayList (); - - public FlowBranchingBlock (FlowBranching parent, BranchingType type, SiblingType stype, - Block block, Location loc) - : base (parent, type, stype, block, loc) - { } - - public override UsageVector CurrentUsageVector { - get { return current_vector; } - } - - protected override void AddSibling (UsageVector sibling) - { - siblings.Add (sibling); - current_vector = sibling; - } - - public override void Break () - { - if (Type == BranchingType.SwitchSection) - CurrentUsageVector.NeverReachable (); - else { - if (Type == BranchingType.LoopBlock) - MayLeaveLoop = true; - CurrentUsageVector.Break (); - } - } - - public override void Return () - { - CurrentUsageVector.Return (); - } - - public override void Goto () - { - CurrentUsageVector.Unreachable (); - } - - public override void Throw () - { - CurrentUsageVector.Throw (); - } - - public override void Label (ArrayList origin_vectors) - { - CurrentUsageVector.MergeJumpOrigins (origin_vectors); - } - - protected override MergeResult Merge () - { - MergeResult result = Merge (siblings); - if (Type == BranchingType.LoopBlock) - result.MayLeaveLoop = false; - return result; - } - } - - public class FlowBranchingException : FlowBranching - { - ArrayList finally_vectors; - - bool has_params; - UsageVector current_vector; - UsageVector try_vector; - ArrayList catch_vectors = new ArrayList (); - UsageVector finally_vector; - - public FlowBranchingException (FlowBranching parent, BranchingType type, Block block, Location loc) - : base (parent, type, SiblingType.Try, block, loc) - { - finally_vectors = new ArrayList (); - has_params = current_vector.HasParameters; - } - - protected override void AddSibling (UsageVector sibling) - { - if (sibling.Type == SiblingType.Try) { - try_vector = sibling; - catch_vectors.Add (sibling); - } else if (sibling.Type == SiblingType.Catch) - catch_vectors.Add (sibling); - else if (sibling.Type == SiblingType.Finally) { - // sibling.MergeFinallyOrigins (finally_vectors); - finally_vector = sibling; - } else - throw new InvalidOperationException (); - - current_vector = sibling; - } - - public override UsageVector CurrentUsageVector { - get { return current_vector; } - } - - public override bool InTryBlock () - { - return true; - } - - public override void AddFinallyVector (UsageVector vector) - { - finally_vectors.Add (vector.Clone ()); - } - - public override void Break () - { - CurrentUsageVector.Break (); - } - - public override void Return () - { - CurrentUsageVector.Return (); - } - - public override void Goto () - { - CurrentUsageVector.Unreachable (); - } - - public override void Throw () - { - CurrentUsageVector.Throw (); - } - - public override void Label (ArrayList origin_vectors) - { - CurrentUsageVector.MergeJumpOrigins (origin_vectors); - } - - protected void MergeFinally (MyBitVector f_params, ref MergeResult result) - { - foreach (UsageVector vector in finally_vectors) { - MyBitVector temp_params = f_params.Clone (); - temp_params.Or (vector.Parameters); - - CheckOutParameters (temp_params, Location); - } - } - - protected override MergeResult Merge () - { - MergeResult result = Merge (catch_vectors); - - if (has_params) { - if (finally_vector != null) { - MergeFinally (finally_vector.Parameters, ref result); - MyBitVector.Or (ref result.Parameters, finally_vector.ParameterVector); - } else - MergeFinally (result.Parameters, ref result); - } - - if (finally_vector != null) - MyBitVector.Or (ref result.Locals, finally_vector.LocalVector); - - return result; - } - } - - // <summary> - // This is used by the flow analysis code to keep track of the type of local variables - // and variables. - // - // The flow code uses a BitVector to keep track of whether a variable has been assigned - // or not. This is easy for fundamental types (int, char etc.) or reference types since - // you can only assign the whole variable as such. - // - // For structs, we also need to keep track of all its fields. To do this, we allocate one - // bit for the struct itself (it's used if you assign/access the whole struct) followed by - // one bit for each of its fields. - // - // This class computes this `layout' for each type. - // </summary> - public class TypeInfo - { - public readonly Type Type; - - // <summary> - // Total number of bits a variable of this type consumes in the flow vector. - // </summary> - public readonly int TotalLength; - - // <summary> - // Number of bits the simple fields of a variable of this type consume - // in the flow vector. - // </summary> - public readonly int Length; - - // <summary> - // This is only used by sub-structs. - // </summary> - public readonly int Offset; - - // <summary> - // If this is a struct. - // </summary> - public readonly bool IsStruct; - - // <summary> - // If this is a struct, all fields which are structs theirselves. - // </summary> - public TypeInfo[] SubStructInfo; - - protected readonly StructInfo struct_info; - private static Hashtable type_hash = new Hashtable (); - - public static TypeInfo GetTypeInfo (Type type) - { - TypeInfo info = (TypeInfo) type_hash [type]; - if (info != null) - return info; - - info = new TypeInfo (type); - type_hash.Add (type, info); - return info; - } - - public static TypeInfo GetTypeInfo (TypeContainer tc) - { - TypeInfo info = (TypeInfo) type_hash [tc.TypeBuilder]; - if (info != null) - return info; - - info = new TypeInfo (tc); - type_hash.Add (tc.TypeBuilder, info); - return info; - } - - private TypeInfo (Type type) - { - this.Type = type; - - struct_info = StructInfo.GetStructInfo (type); - if (struct_info != null) { - Length = struct_info.Length; - TotalLength = struct_info.TotalLength; - SubStructInfo = struct_info.StructFields; - IsStruct = true; - } else { - Length = 0; - TotalLength = 1; - IsStruct = false; - } - } - - private TypeInfo (TypeContainer tc) - { - this.Type = tc.TypeBuilder; - - struct_info = StructInfo.GetStructInfo (tc); - if (struct_info != null) { - Length = struct_info.Length; - TotalLength = struct_info.TotalLength; - SubStructInfo = struct_info.StructFields; - IsStruct = true; - } else { - Length = 0; - TotalLength = 1; - IsStruct = false; - } - } - - protected TypeInfo (StructInfo struct_info, int offset) - { - this.struct_info = struct_info; - this.Offset = offset; - this.Length = struct_info.Length; - this.TotalLength = struct_info.TotalLength; - this.SubStructInfo = struct_info.StructFields; - this.Type = struct_info.Type; - this.IsStruct = true; - } - - public int GetFieldIndex (string name) - { - if (struct_info == null) - return 0; - - return struct_info [name]; - } - - public TypeInfo GetSubStruct (string name) - { - if (struct_info == null) - return null; - - return struct_info.GetStructField (name); - } - - // <summary> - // A struct's constructor must always assign all fields. - // This method checks whether it actually does so. - // </summary> - public bool IsFullyInitialized (FlowBranching branching, VariableInfo vi, Location loc) - { - if (struct_info == null) - return true; - - bool ok = true; - for (int i = 0; i < struct_info.Count; i++) { - FieldInfo field = struct_info.Fields [i]; - - if (!branching.IsFieldAssigned (vi, field.Name)) { - Report.Error (171, loc, - "Field `" + TypeManager.CSharpName (Type) + - "." + field.Name + "' must be fully initialized " + - "before control leaves the constructor"); - ok = false; - } - } - - return ok; - } - - public override string ToString () - { - return String.Format ("TypeInfo ({0}:{1}:{2}:{3})", - Type, Offset, Length, TotalLength); - } - - protected class StructInfo { - public readonly Type Type; - public readonly FieldInfo[] Fields; - public readonly TypeInfo[] StructFields; - public readonly int Count; - public readonly int CountPublic; - public readonly int CountNonPublic; - public readonly int Length; - public readonly int TotalLength; - public readonly bool HasStructFields; - - private static Hashtable field_type_hash = new Hashtable (); - private Hashtable struct_field_hash; - private Hashtable field_hash; - - protected bool InTransit = false; - - // Private constructor. To save memory usage, we only need to create one instance - // of this class per struct type. - private StructInfo (Type type) - { - this.Type = type; - - field_type_hash.Add (type, this); - - if (type is TypeBuilder) { - TypeContainer tc = TypeManager.LookupTypeContainer (type); - - ArrayList fields = tc.Fields; - - ArrayList public_fields = new ArrayList (); - ArrayList non_public_fields = new ArrayList (); - - if (fields != null) { - foreach (Field field in fields) { - if ((field.ModFlags & Modifiers.STATIC) != 0) - continue; - if ((field.ModFlags & Modifiers.PUBLIC) != 0) - public_fields.Add (field.FieldBuilder); - else - non_public_fields.Add (field.FieldBuilder); - } - } - - CountPublic = public_fields.Count; - CountNonPublic = non_public_fields.Count; - Count = CountPublic + CountNonPublic; - - Fields = new FieldInfo [Count]; - public_fields.CopyTo (Fields, 0); - non_public_fields.CopyTo (Fields, CountPublic); - } else { - FieldInfo[] public_fields = type.GetFields ( - BindingFlags.Instance|BindingFlags.Public); - FieldInfo[] non_public_fields = type.GetFields ( - BindingFlags.Instance|BindingFlags.NonPublic); - - CountPublic = public_fields.Length; - CountNonPublic = non_public_fields.Length; - Count = CountPublic + CountNonPublic; - - Fields = new FieldInfo [Count]; - public_fields.CopyTo (Fields, 0); - non_public_fields.CopyTo (Fields, CountPublic); - } - - struct_field_hash = new Hashtable (); - field_hash = new Hashtable (); - - Length = 0; - StructFields = new TypeInfo [Count]; - StructInfo[] sinfo = new StructInfo [Count]; - - InTransit = true; - - for (int i = 0; i < Count; i++) { - FieldInfo field = (FieldInfo) Fields [i]; - - sinfo [i] = GetStructInfo (field.FieldType); - if (sinfo [i] == null) - field_hash.Add (field.Name, ++Length); - else if (sinfo [i].InTransit) { - Report.Error (523, String.Format ( - "Struct member '{0}.{1}' of type '{2}' causes " + - "a cycle in the structure layout", - type, field.Name, sinfo [i].Type)); - sinfo [i] = null; - return; - } - } - - InTransit = false; - - TotalLength = Length + 1; - for (int i = 0; i < Count; i++) { - FieldInfo field = (FieldInfo) Fields [i]; - - if (sinfo [i] == null) - continue; - - field_hash.Add (field.Name, TotalLength); - - HasStructFields = true; - StructFields [i] = new TypeInfo (sinfo [i], TotalLength); - struct_field_hash.Add (field.Name, StructFields [i]); - TotalLength += sinfo [i].TotalLength; - } - } - - public int this [string name] { - get { - if (field_hash.Contains (name)) - return (int) field_hash [name]; - else - return 0; - } - } - - public TypeInfo GetStructField (string name) - { - return (TypeInfo) struct_field_hash [name]; - } - - public static StructInfo GetStructInfo (Type type) - { - if (!TypeManager.IsValueType (type) || TypeManager.IsEnumType (type) || - TypeManager.IsBuiltinType (type)) - return null; - - StructInfo info = (StructInfo) field_type_hash [type]; - if (info != null) - return info; - - return new StructInfo (type); - } - - public static StructInfo GetStructInfo (TypeContainer tc) - { - StructInfo info = (StructInfo) field_type_hash [tc.TypeBuilder]; - if (info != null) - return info; - - return new StructInfo (tc.TypeBuilder); - } - } - } - - // <summary> - // This is used by the flow analysis code to store information about a single local variable - // or parameter. Depending on the variable's type, we need to allocate one or more elements - // in the BitVector - if it's a fundamental or reference type, we just need to know whether - // it has been assigned or not, but for structs, we need this information for each of its fields. - // </summary> - public class VariableInfo { - public readonly string Name; - public readonly TypeInfo TypeInfo; - - // <summary> - // The bit offset of this variable in the flow vector. - // </summary> - public readonly int Offset; - - // <summary> - // The number of bits this variable needs in the flow vector. - // The first bit always specifies whether the variable as such has been assigned while - // the remaining bits contain this information for each of a struct's fields. - // </summary> - public readonly int Length; - - // <summary> - // If this is a parameter of local variable. - // </summary> - public readonly bool IsParameter; - - public readonly LocalInfo LocalInfo; - public readonly int ParameterIndex; - - readonly VariableInfo Parent; - VariableInfo[] sub_info; - - protected VariableInfo (string name, Type type, int offset) - { - this.Name = name; - this.Offset = offset; - this.TypeInfo = TypeInfo.GetTypeInfo (type); - - Length = TypeInfo.TotalLength; - - Initialize (); - } - - protected VariableInfo (VariableInfo parent, TypeInfo type) - { - this.Name = parent.Name; - this.TypeInfo = type; - this.Offset = parent.Offset + type.Offset; - this.Parent = parent; - this.Length = type.TotalLength; - - this.IsParameter = parent.IsParameter; - this.LocalInfo = parent.LocalInfo; - this.ParameterIndex = parent.ParameterIndex; - - Initialize (); - } - - protected void Initialize () - { - TypeInfo[] sub_fields = TypeInfo.SubStructInfo; - if (sub_fields != null) { - sub_info = new VariableInfo [sub_fields.Length]; - for (int i = 0; i < sub_fields.Length; i++) { - if (sub_fields [i] != null) - sub_info [i] = new VariableInfo (this, sub_fields [i]); - } - } else - sub_info = new VariableInfo [0]; - } - - public VariableInfo (LocalInfo local_info, int offset) - : this (local_info.Name, local_info.VariableType, offset) - { - this.LocalInfo = local_info; - this.IsParameter = false; - } - - public VariableInfo (string name, Type type, int param_idx, int offset) - : this (name, type, offset) - { - this.ParameterIndex = param_idx; - this.IsParameter = true; - } - - public bool IsAssigned (EmitContext ec) - { - return !ec.DoFlowAnalysis || ec.CurrentBranching.IsAssigned (this); - } - - public bool IsAssigned (EmitContext ec, Location loc) - { - if (IsAssigned (ec)) - return true; - - Report.Error (165, loc, - "Use of unassigned local variable `" + Name + "'"); - ec.CurrentBranching.SetAssigned (this); - return false; - } - - public bool IsAssigned (MyBitVector vector) - { - if (vector [Offset]) - return true; - - for (VariableInfo parent = Parent; parent != null; parent = parent.Parent) - if (vector [parent.Offset]) - return true; - - // Return unless this is a struct. - if (!TypeInfo.IsStruct) - return false; - - // Ok, so each field must be assigned. - for (int i = 0; i < TypeInfo.Length; i++) { - if (!vector [Offset + i + 1]) - return false; - } - - // Ok, now check all fields which are structs. - for (int i = 0; i < sub_info.Length; i++) { - VariableInfo sinfo = sub_info [i]; - if (sinfo == null) - continue; - - if (!sinfo.IsAssigned (vector)) - return false; - } - - vector [Offset] = true; - return true; - } - - public void SetAssigned (EmitContext ec) - { - if (ec.DoFlowAnalysis) - ec.CurrentBranching.SetAssigned (this); - } - - public void SetAssigned (MyBitVector vector) - { - vector [Offset] = true; - } - - public bool IsFieldAssigned (EmitContext ec, string name, Location loc) - { - if (!ec.DoFlowAnalysis || ec.CurrentBranching.IsFieldAssigned (this, name)) - return true; - - Report.Error (170, loc, - "Use of possibly unassigned field `" + name + "'"); - ec.CurrentBranching.SetFieldAssigned (this, name); - return false; - } - - public bool IsFieldAssigned (MyBitVector vector, string field_name) - { - int field_idx = TypeInfo.GetFieldIndex (field_name); - - if (field_idx == 0) - return true; - - return vector [Offset + field_idx]; - } - - public void SetFieldAssigned (EmitContext ec, string name) - { - if (ec.DoFlowAnalysis) - ec.CurrentBranching.SetFieldAssigned (this, name); - } - - public void SetFieldAssigned (MyBitVector vector, string field_name) - { - int field_idx = TypeInfo.GetFieldIndex (field_name); - - if (field_idx == 0) - return; - - vector [Offset + field_idx] = true; - } - - public VariableInfo GetSubStruct (string name) - { - TypeInfo type = TypeInfo.GetSubStruct (name); - - if (type == null) - return null; - - return new VariableInfo (this, type); - } - - public override string ToString () - { - return String.Format ("VariableInfo ({0}:{1}:{2}:{3}:{4})", - Name, TypeInfo, Offset, Length, IsParameter); - } - } - - // <summary> - // This is used by the flow code to hold the `layout' of the flow vector for - // all locals and all parameters (ie. we create one instance of this class for the - // locals and another one for the params). - // </summary> - public class VariableMap { - // <summary> - // The number of variables in the map. - // </summary> - public readonly int Count; - - // <summary> - // Total length of the flow vector for this map. - // <summary> - public readonly int Length; - - // <summary> - // Type and name of all the variables. - // Note that this is null for variables for which we do not need to compute - // assignment info. - // </summary> - public readonly Type[] VariableTypes; - public readonly string[] VariableNames; - - VariableInfo[] map; - - public VariableMap (InternalParameters ip) - { - Count = ip != null ? ip.Count : 0; - map = new VariableInfo [Count]; - VariableNames = new string [Count]; - VariableTypes = new Type [Count]; - Length = 0; - - for (int i = 0; i < Count; i++) { - Parameter.Modifier mod = ip.ParameterModifier (i); - - if ((mod & Parameter.Modifier.OUT) == 0) - continue; - - VariableNames [i] = ip.ParameterName (i); - VariableTypes [i] = TypeManager.GetElementType (ip.ParameterType (i)); - - map [i] = new VariableInfo (VariableNames [i], VariableTypes [i], i, Length); - Length += map [i].Length; - } - } - - public VariableMap (LocalInfo[] locals) - : this (null, locals) - { } - - public VariableMap (VariableMap parent, LocalInfo[] locals) - { - int offset = 0, start = 0; - if (parent != null) { - offset = parent.Length; - start = parent.Count; - } - - Count = locals.Length + start; - map = new VariableInfo [Count]; - VariableNames = new string [Count]; - VariableTypes = new Type [Count]; - Length = offset; - - if (parent != null) { - parent.map.CopyTo (map, 0); - parent.VariableNames.CopyTo (VariableNames, 0); - parent.VariableTypes.CopyTo (VariableTypes, 0); - } - - for (int i = start; i < Count; i++) { - LocalInfo li = locals [i-start]; - - if (li.VariableType == null) - continue; - - VariableNames [i] = li.Name; - VariableTypes [i] = li.VariableType; - - map [i] = li.VariableInfo = new VariableInfo (li, Length); - Length += map [i].Length; - } - } - - // <summary> - // Returns the VariableInfo for variable @index or null if we don't need to - // compute assignment info for this variable. - // </summary> - public VariableInfo this [int index] { - get { - return map [index]; - } - } - - public override string ToString () - { - return String.Format ("VariableMap ({0}:{1})", Count, Length); - } - } - - // <summary> - // This is a special bit vector which can inherit from another bit vector doing a - // copy-on-write strategy. The inherited vector may have a smaller size than the - // current one. - // </summary> - public class MyBitVector { - public readonly int Count; - public readonly MyBitVector InheritsFrom; - - bool is_dirty; - BitArray vector; - - public MyBitVector (int Count) - : this (null, Count) - { } - - public MyBitVector (MyBitVector InheritsFrom, int Count) - { - this.InheritsFrom = InheritsFrom; - this.Count = Count; - } - - // <summary> - // Checks whether this bit vector has been modified. After setting this to true, - // we won't use the inherited vector anymore, but our own copy of it. - // </summary> - public bool IsDirty { - get { - return is_dirty; - } - - set { - if (!is_dirty) - initialize_vector (); - } - } - - // <summary> - // Get/set bit `index' in the bit vector. - // </summary> - public bool this [int index] - { - get { - if (index > Count) - throw new ArgumentOutOfRangeException (); - - // We're doing a "copy-on-write" strategy here; as long - // as nobody writes to the array, we can use our parent's - // copy instead of duplicating the vector. - - if (vector != null) - return vector [index]; - else if (InheritsFrom != null) { - BitArray inherited = InheritsFrom.Vector; - - if (index < inherited.Count) - return inherited [index]; - else - return false; - } else - return false; - } - - set { - if (index > Count) - throw new ArgumentOutOfRangeException (); - - // Only copy the vector if we're actually modifying it. - - if (this [index] != value) { - initialize_vector (); - - vector [index] = value; - } - } - } - - // <summary> - // If you explicitly convert the MyBitVector to a BitArray, you will get a deep - // copy of the bit vector. - // </summary> - public static explicit operator BitArray (MyBitVector vector) - { - vector.initialize_vector (); - return vector.Vector; - } - - // <summary> - // Performs an `or' operation on the bit vector. The `new_vector' may have a - // different size than the current one. - // </summary> - public void Or (MyBitVector new_vector) - { - BitArray new_array = new_vector.Vector; - - initialize_vector (); - - int upper; - if (vector.Count < new_array.Count) - upper = vector.Count; - else - upper = new_array.Count; - - for (int i = 0; i < upper; i++) - vector [i] = vector [i] | new_array [i]; - } - - // <summary> - // Perfonrms an `and' operation on the bit vector. The `new_vector' may have - // a different size than the current one. - // </summary> - public void And (MyBitVector new_vector) - { - BitArray new_array = new_vector.Vector; - - initialize_vector (); - - int lower, upper; - if (vector.Count < new_array.Count) - lower = upper = vector.Count; - else { - lower = new_array.Count; - upper = vector.Count; - } - - for (int i = 0; i < lower; i++) - vector [i] = vector [i] & new_array [i]; - - for (int i = lower; i < upper; i++) - vector [i] = false; - } - - public static void And (ref MyBitVector target, MyBitVector vector) - { - if (target != null) - target.And (vector); - else - target = vector.Clone (); - } - - public static void Or (ref MyBitVector target, MyBitVector vector) - { - if (target != null) - target.Or (vector); - else - target = vector.Clone (); - } - - // <summary> - // This does a deep copy of the bit vector. - // </summary> - public MyBitVector Clone () - { - MyBitVector retval = new MyBitVector (Count); - - retval.Vector = Vector; - - return retval; - } - - BitArray Vector { - get { - if (vector != null) - return vector; - else if (!is_dirty && (InheritsFrom != null)) - return InheritsFrom.Vector; - - initialize_vector (); - - return vector; - } - - set { - initialize_vector (); - - for (int i = 0; i < System.Math.Min (vector.Count, value.Count); i++) - vector [i] = value [i]; - } - } - - void initialize_vector () - { - if (vector != null) - return; - - vector = new BitArray (Count, false); - if (InheritsFrom != null) - Vector = InheritsFrom.Vector; - - is_dirty = true; - } - - public override string ToString () - { - StringBuilder sb = new StringBuilder ("MyBitVector ("); - - BitArray vector = Vector; - sb.Append (Count); - sb.Append (","); - if (!IsDirty) - sb.Append ("INHERITED - "); - for (int i = 0; i < vector.Count; i++) { - if (i > 0) - sb.Append (","); - sb.Append (vector [i]); - } - - sb.Append (")"); - return sb.ToString (); - } - } -} diff --git a/mcs/gmcs/generic.cs b/mcs/gmcs/generic.cs index 816246adeb4..50770311dec 100644 --- a/mcs/gmcs/generic.cs +++ b/mcs/gmcs/generic.cs @@ -8,7 +8,6 @@ // using System; using System.Collections; -using System.Reflection.Emit; using System.Text; namespace Mono.CSharp { @@ -16,7 +15,7 @@ namespace Mono.CSharp { // // Tracks the constraints for a type parameter // - public class Constraints { + class Constraints { string type_parameter; ArrayList constraints; @@ -29,64 +28,6 @@ namespace Mono.CSharp { this.type_parameter = type_parameter; this.constraints = constraints; } - - public string TypeParameter { - get { - return type_parameter; - } - } - } - - // - // This type represents a generic type parameter - // - public class TypeParameter { - string name; - Constraints constraints; - Location loc; - Type type; - - public TypeParameter (string name, Constraints constraints, Location loc) - { - this.name = name; - this.constraints = constraints; - this.loc = loc; - } - - public string Name { - get { - return name; - } - } - - public Location Location { - get { - return loc; - } - } - - public Constraints Constraints { - get { - return constraints; - } - } - - public Type Type { - get { - return type; - } - } - - public Type Define (TypeBuilder tb) - { - type = tb.DefineGenericParameter (name, new Type [0]); - return type; - } - - public override string ToString () - { - return "TypeParameter[" + name + "]"; - } } // @@ -95,29 +36,23 @@ namespace Mono.CSharp { // These expressions are born in a fully resolved state. // public class TypeParameterExpr : TypeExpr { - TypeParameter type_parameter; + string type_parameter; public string Name { get { - return type_parameter.Name; - } - } - - public TypeParameter TypeParameter { - get { return type_parameter; } } - public TypeParameterExpr (TypeParameter type_parameter, Location loc) - : base (type_parameter.Type, loc) + public TypeParameterExpr (string type_parameter, Location l) + : base (typeof (object), l) { this.type_parameter = type_parameter; } public override string ToString () { - return "TypeParameterExpr[" + type_parameter.Name + "]"; + return "TypeParameter[" + type_parameter + "]"; } public void Error_CannotUseAsUnmanagedType (Location loc) @@ -139,16 +74,6 @@ namespace Mono.CSharp { args.Add (type); } - public Type[] Arguments { - get { - Type[] retval = new Type [args.Count]; - for (int i = 0; i < args.Count; i++) - retval [i] = ((TypeExpr) args [i]).Type; - - return retval; - } - } - public override string ToString () { StringBuilder s = new StringBuilder (); @@ -209,30 +134,11 @@ namespace Mono.CSharp { { if (args.Resolve (ec) == false) return null; - - // - // First, resolve the generic type. - // - SimpleName sn = new SimpleName (name, loc); - Expression resolved = sn.ResolveAsTypeStep (ec); - if (resolved == null) - return null; - - Type gt = resolved.Type.GetGenericTypeDefinition (); - - Type[] gen_params = gt.GetGenericParameters (); - if (args.Arguments.Length != gen_params.Length) { - Report.Error (-217, loc, "Generic type `" + gt.Name + "' takes " + - gen_params.Length + " type parameters, but specified " + - args.Arguments.Length + "."); - return null; - } - + // - // Now bind the parameters. + // Pretend there are not type parameters, until we get GetType support // - Type ntype = gt.BindGenericParameters (args.Arguments); - return new TypeExpr (ntype, loc); + return new SimpleName (name, loc).ResolveAsTypeStep (ec); } public override void Emit (EmitContext ec) diff --git a/mcs/gmcs/interface.cs b/mcs/gmcs/interface.cs index 6d4bc44068d..bf9e9343704 100755 --- a/mcs/gmcs/interface.cs +++ b/mcs/gmcs/interface.cs @@ -71,9 +71,8 @@ namespace Mono.CSharp { Modifiers.UNSAFE | Modifiers.PRIVATE; - public Interface (NamespaceEntry ns, TypeContainer parent, string name, int mod, - Attributes attrs, Location l) - : base (ns, parent, name, l) + public Interface (TypeContainer parent, string name, int mod, Attributes attrs, Location l) + : base (parent, name, l) { ModFlags = Modifiers.Check (AllowedModifiers, mod, Modifiers.PRIVATE, l); OptAttributes = attrs; @@ -342,13 +341,19 @@ namespace Mono.CSharp { return; } - // - // Labelling of parameters is taken care of - // during the Emit phase via - // MethodCore.LabelParameters method so I am - // removing the old code here. - // - + // + // Define each type attribute (in/out/ref) and + // the argument names. + // + p = im.Parameters.FixedParameters; + if (p != null){ + for (i = 0; i < p.Length; i++) + mb.DefineParameter (i + 1, p [i].Attributes, p [i].Name); + + if (i != arg_types.Length) + Console.WriteLine ("Implement the type definition for params"); + } + im.Builder = mb; } @@ -878,17 +883,10 @@ namespace Mono.CSharp { foreach (InterfaceMethod im in defined_method) { EmitContext ec = new EmitContext (tc, this, Location, null, im.ReturnType.Type, ModFlags, false); - - MethodCore.LabelParameters (ec, im.Builder, - im.Parameters, - im.OptAttributes, - Location); if (im.OptAttributes != null) - Attribute.ApplyAttributes (ec, im.Builder, - im, im.OptAttributes); - - } + Attribute.ApplyAttributes (ec, im.Builder, im, im.OptAttributes); + } } if (defined_properties != null) { diff --git a/mcs/gmcs/iterators.cs b/mcs/gmcs/iterators.cs index 21ac8756b1e..10be47f48a5 100644 --- a/mcs/gmcs/iterators.cs +++ b/mcs/gmcs/iterators.cs @@ -96,7 +96,8 @@ namespace Mono.CSharp { if (!Yield.CheckContext (ec, loc)) return false; - ec.CurrentBranching.Goto (); + ec.CurrentBranching.CurrentUsageVector.Breaks = FlowBranching.FlowReturns.Always; + ec.CurrentBranching.CurrentUsageVector.Returns = FlowBranching.FlowReturns.Always; return true; } diff --git a/mcs/gmcs/namespace.cs b/mcs/gmcs/namespace.cs index 764d19c69d9..83731a82e56 100755 --- a/mcs/gmcs/namespace.cs +++ b/mcs/gmcs/namespace.cs @@ -16,13 +16,11 @@ namespace Mono.CSharp { /// </summary> public class Namespace { static ArrayList all_namespaces = new ArrayList (); - static Hashtable namespaces_map = new Hashtable (); Namespace parent; string name, fullname; ArrayList entries; Hashtable namespaces; - Hashtable defined_names; /// <summary> /// Constructor Takes the current namespace and the @@ -43,19 +41,10 @@ namespace Mono.CSharp { entries = new ArrayList (); namespaces = new Hashtable (); - defined_names = new Hashtable (); all_namespaces.Add (this); - if (namespaces_map.Contains (fullname)) - return; - namespaces_map [fullname] = true; } - public static bool IsNamespace (string name) - { - return namespaces_map [name] != null; - } - public static Namespace Root = new Namespace (null, ""); public Namespace GetNamespace (string name, bool create) @@ -91,22 +80,11 @@ namespace Mono.CSharp { public object Lookup (DeclSpace ds, string name) { - object o = Lookup (name); - - Type t; - DeclSpace tdecl = o as DeclSpace; - if (tdecl != null) { - t = tdecl.DefineType (); - - if ((ds == null) || ds.CheckAccessLevel (t)) - return t; - } - Namespace ns = GetNamespace (name, false); if (ns != null) return ns; - t = TypeManager.LookupType (DeclSpace.MakeFQN (fullname, name)); + Type t = TypeManager.LookupType (DeclSpace.MakeFQN (fullname, name)); if ((t == null) || ((ds != null) && !ds.CheckAccessLevel (t))) return null; @@ -118,16 +96,6 @@ namespace Mono.CSharp { entries.Add (entry); } - public void DefineName (string name, object o) - { - defined_names.Add (name, o); - } - - public object Lookup (string name) - { - return defined_names [name]; - } - static public ArrayList UserDefinedNamespaces { get { return all_namespaces; @@ -220,6 +188,7 @@ namespace Mono.CSharp { Namespace curr_ns = NamespaceEntry.NS; while ((curr_ns != null) && (resolved_ns == null)) { + string full_name = DeclSpace.MakeFQN (curr_ns.Name, Name); resolved_ns = curr_ns.GetNamespace (Name, false); if (resolved_ns == null) @@ -270,11 +239,11 @@ namespace Mono.CSharp { } } - public NamespaceEntry (NamespaceEntry parent, SourceFile file, string name, Location loc) - : this (parent, file, name, false, loc) + public NamespaceEntry (NamespaceEntry parent, SourceFile file, string name) + : this (parent, file, name, false) { } - protected NamespaceEntry (NamespaceEntry parent, SourceFile file, string name, bool is_implicit, Location loc) + protected NamespaceEntry (NamespaceEntry parent, SourceFile file, string name, bool is_implicit) { this.parent = parent; this.file = file; @@ -290,18 +259,21 @@ namespace Mono.CSharp { ns.AddNamespaceEntry (this); if ((parent != null) && (parent.NS != ns.Parent)) - implicit_parent = new NamespaceEntry (parent, file, ns.Parent.Name, true, loc); + implicit_parent = new NamespaceEntry (parent, file, ns.Parent.Name, true); else implicit_parent = parent; - - this.FullName = ns.Name; } static int next_id = 0; - public readonly string FullName; public readonly int ID; public readonly bool IsImplicit; + public string Name { + get { + return ns.Name; + } + } + public Namespace NS { get { return ns; @@ -320,11 +292,6 @@ namespace Mono.CSharp { } } - public void DefineName (string name, object o) - { - ns.DefineName (name, o); - } - /// <summary> /// Records a new namespace for resolving name references /// </summary> @@ -335,7 +302,7 @@ namespace Mono.CSharp { return; } - if (ns == FullName) + if (ns == Name) return; if (using_clauses == null) @@ -416,7 +383,7 @@ namespace Mono.CSharp { if (ns != null) return ns.Lookup (ds, last); - Type nested = TypeManager.LookupType ((((Type) o).Name + "." + last)); + Type nested = TypeManager.LookupType (DeclSpace.MakeFQN (((Type) o).Name, last)); if ((nested == null) || ((ds != null) && !ds.CheckAccessLevel (nested))) return null; @@ -592,7 +559,7 @@ namespace Mono.CSharp { if (NS == Namespace.Root) return "NamespaceEntry (<root>)"; else - return String.Format ("NamespaceEntry ({0},{1},{2})", FullName, IsImplicit, ID); + return String.Format ("NamespaceEntry ({0},{1},{2})", Name, IsImplicit, ID); } } } diff --git a/mcs/gmcs/report.cs b/mcs/gmcs/report.cs index d7b027c6ebd..f5c90e4b4dd 100644 --- a/mcs/gmcs/report.cs +++ b/mcs/gmcs/report.cs @@ -153,26 +153,6 @@ namespace Mono.CSharp { Check (code); } - static public void Error (int code, Location loc, string format, params object[] args) - { - Error (code, loc, String.Format (format, args)); - } - - static public void Error (int code, string format, params object[] args) - { - Error (code, String.Format (format, args)); - } - - static public void Warning (int code, Location loc, string format, params object[] args) - { - Warning (code, loc, String.Format (format, args)); - } - - static public void Warning (int code, string format, params object[] args) - { - Warning (code, String.Format (format, args)); - } - static public void Message (Message m) { if (m is ErrorMessage) diff --git a/mcs/gmcs/rootcontext.cs b/mcs/gmcs/rootcontext.cs index 67ef6b9baf2..9c1c20c39c7 100755 --- a/mcs/gmcs/rootcontext.cs +++ b/mcs/gmcs/rootcontext.cs @@ -466,7 +466,7 @@ namespace Mono.CSharp { // // Try in the current namespace and all its implicit parents // - for (NamespaceEntry ns = ds.NamespaceEntry; ns != null; ns = ns.ImplicitParent) { + for (NamespaceEntry ns = ds.Namespace; ns != null; ns = ns.ImplicitParent) { object result = ns.Lookup (ds, name, loc); if (result == null) continue; @@ -705,7 +705,7 @@ namespace Mono.CSharp { // if (global_attributes.Count > 0){ AssemblyBuilder ab = CodeGen.AssemblyBuilder; - TypeContainer dummy = new TypeContainer (null, null, "", new Location (-1)); + TypeContainer dummy = new TypeContainer (null, "", new Location (-1)); EmitContext temp_ec = new EmitContext ( dummy, Mono.CSharp.Location.Null, null, null, 0, false); @@ -713,7 +713,7 @@ namespace Mono.CSharp { NamespaceEntry ns = (NamespaceEntry) de.Key; Attributes attrs = (Attributes) de.Value; - dummy.NamespaceEntry = ns; + dummy.Namespace = ns; Attribute.ApplyAttributes (temp_ec, ab, ab, attrs); } } @@ -813,7 +813,7 @@ namespace Mono.CSharp { // static public void AddGlobalAttributeSection (TypeContainer container, AttributeSection attr) { - NamespaceEntry ns = container.NamespaceEntry; + NamespaceEntry ns = container.Namespace; Attributes a = (Attributes) global_attributes [ns]; if (a == null) diff --git a/mcs/gmcs/sample-hello.cs b/mcs/gmcs/sample-hello.cs deleted file mode 100644 index af2ea1477d6..00000000000 --- a/mcs/gmcs/sample-hello.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using Generics; - -namespace Test -{ - public class Bar : Foo - { - public void Hello (Stack<int> stack) - { - Console.WriteLine ("Hello Generic World!"); - Console.WriteLine (stack); - Console.WriteLine (stack.GetType ()); - } - - public Stack<int> Test () - { - return Driver.int_stack; - } - - public static void Main () - { - Foo foo = new Bar (); - Driver.Init (foo); - Stack<int> a = Driver.int_stack; - Console.WriteLine ("STACK: {0}", a); - foo.Hello (a); - } - } -} diff --git a/mcs/gmcs/sample-stack.il b/mcs/gmcs/sample-stack.il deleted file mode 100644 index e0fb9041b5c..00000000000 --- a/mcs/gmcs/sample-stack.il +++ /dev/null @@ -1,103 +0,0 @@ -.assembly sample-stack {} - -.namespace Generics -{ - .class interface public abstract Foo - { - .method public virtual hidebysig newslot abstract instance default void Hello(class Generics.Stack<int32> stack) - { - } - } - - .class public beforefieldinit Driver extends [mscorlib]System.Object - { - .field static public class Generics.Stack<int32> int_stack - .field static public class Generics.Stack<string> string_stack - - .method public hidebysig specialname rtspecialname instance default void .ctor() - { - ldarg.0 - call instance void valuetype [corlib]System.Object::.ctor() - ret - } - - .method public static void Init (class Generics.Foo foo) - { - newobj instance void class Generics.Stack<int32>::.ctor () - stsfld class Generics.Stack<int32> Generics.Driver::int_stack - - newobj instance void class Generics.Stack<string>::.ctor () - stsfld class Generics.Stack<string> Generics.Driver::string_stack - - ldarg.0 - ldsfld class Generics.Stack<int32> Generics.Driver::int_stack - callvirt instance void class Generics.Foo::Hello(class Generics.Stack<int32>) - - ret - } - } - - .class public Stack<T> extends [mscorlib]System.Object - { - .field private int32 size - .field private !0[] data - - .method public instance void .ctor () - { - ldarg.0 - call instance void [mscorlib]System.Object::.ctor () - ldarg.0 - ldc.i4.s 100 - newarr !0 - stfld !0[] class Generics.Stack<!0>::data - ldarg.0 - ldc.i4.m1 - stfld int32 class Generics.Stack<!0>::size - ret - } - - .method public instance void Push (!0 item) - { - .locals init (int32 temp) - - ldarg.0 - ldfld !0[] class Generics.Stack<!0>::data - ldarg.0 - dup - - ldfld int32 class Generics.Stack<!0>::size - ldc.i4.1 - add - dup - stloc.0 - stfld int32 class Generics.Stack<!0>::size - ldloc.0 - ldarg.1 - stelem !0 - ret - } - - .method public instance !0 Pop () - { - .locals init (!0, int32) - - ldarg.0 - ldfld !0[] class Generics.Stack<!0>::data - ldarg.0 - dup - - ldfld int32 class Generics.Stack<!0>::size - dup - stloc.1 - ldc.i4.1 - sub - stfld int32 class Generics.Stack<!0>::size - ldloc.1 - ldelem !0 - stloc.0 - ldloc.0 - - ret - } - } -} diff --git a/mcs/gmcs/statement.cs b/mcs/gmcs/statement.cs index 1c32cbae006..8727b71ac32 100755 --- a/mcs/gmcs/statement.cs +++ b/mcs/gmcs/statement.cs @@ -605,7 +605,8 @@ namespace Mono.CSharp { else vector.CheckOutParameters (ec.CurrentBranching); - ec.CurrentBranching.Return (); + vector.Returns = FlowBranching.FlowReturns.Always; + vector.Breaks = FlowBranching.FlowReturns.Always; return true; } @@ -676,7 +677,8 @@ namespace Mono.CSharp { if (!label.IsDefined) label.AddUsageVector (ec.CurrentBranching.CurrentUsageVector); - ec.CurrentBranching.Goto (); + ec.CurrentBranching.CurrentUsageVector.Breaks = FlowBranching.FlowReturns.Always; + ec.CurrentBranching.CurrentUsageVector.Returns = FlowBranching.FlowReturns.Always; return true; } @@ -750,7 +752,12 @@ namespace Mono.CSharp { public override bool Resolve (EmitContext ec) { - ec.CurrentBranching.Label (vectors); + if (vectors != null) + ec.CurrentBranching.CurrentUsageVector.MergeJumpOrigins (vectors); + else { + ec.CurrentBranching.CurrentUsageVector.Breaks = FlowBranching.FlowReturns.Never; + ec.CurrentBranching.CurrentUsageVector.Returns = FlowBranching.FlowReturns.Never; + } referenced = true; @@ -779,7 +786,8 @@ namespace Mono.CSharp { public override bool Resolve (EmitContext ec) { - ec.CurrentBranching.Goto (); + ec.CurrentBranching.CurrentUsageVector.Breaks = FlowBranching.FlowReturns.Always; + ec.CurrentBranching.CurrentUsageVector.Returns = FlowBranching.FlowReturns.Always; return true; } @@ -845,7 +853,8 @@ namespace Mono.CSharp { label = sl.ILLabelCode; - ec.CurrentBranching.Goto (); + ec.CurrentBranching.CurrentUsageVector.Breaks = FlowBranching.FlowReturns.Unreachable; + ec.CurrentBranching.CurrentUsageVector.Returns = FlowBranching.FlowReturns.Always; return true; } @@ -892,7 +901,8 @@ namespace Mono.CSharp { } } - ec.CurrentBranching.Throw (); + ec.CurrentBranching.CurrentUsageVector.Returns = FlowBranching.FlowReturns.Exception; + ec.CurrentBranching.CurrentUsageVector.Breaks = FlowBranching.FlowReturns.Exception; return true; } @@ -928,7 +938,7 @@ namespace Mono.CSharp { public override bool Resolve (EmitContext ec) { ec.CurrentBranching.MayLeaveLoop = true; - ec.CurrentBranching.Break (); + ec.CurrentBranching.CurrentUsageVector.Breaks = FlowBranching.FlowReturns.Always; return true; } @@ -959,7 +969,7 @@ namespace Mono.CSharp { public override bool Resolve (EmitContext ec) { - ec.CurrentBranching.Goto (); + ec.CurrentBranching.CurrentUsageVector.Breaks = FlowBranching.FlowReturns.Always; return true; } @@ -1013,20 +1023,17 @@ namespace Mono.CSharp { public VariableInfo VariableInfo; - enum Flags : byte { - Used = 1, - Assigned = 2, - ReadOnly = 4, - Fixed = 8 - } - - Flags flags; - + public bool Used; + public bool Assigned; + public bool ReadOnly; + public bool is_fixed; + public LocalInfo (Expression type, string name, Block block, Location l) { Type = type; Name = name; Block = block; + LocalBuilder = null; Location = l; } @@ -1034,18 +1041,20 @@ namespace Mono.CSharp { { VariableType = tc.TypeBuilder; Block = block; + LocalBuilder = null; Location = l; } public bool IsThisAssigned (EmitContext ec, Location loc) { - if (VariableInfo == null) + VariableInfo vi = Block.GetVariableInfo (this); + if (vi == null) throw new Exception (); - if (!ec.DoFlowAnalysis || ec.CurrentBranching.IsAssigned (VariableInfo)) + if (!ec.DoFlowAnalysis || ec.CurrentBranching.IsAssigned (vi)) return true; - return VariableInfo.TypeInfo.IsFullyInitialized (ec.CurrentBranching, VariableInfo, loc); + return vi.TypeInfo.IsFullyInitialized (ec.CurrentBranching, vi, loc); } public bool Resolve (DeclSpace decl) @@ -1062,12 +1071,12 @@ namespace Mono.CSharp { public void MakePinned () { TypeManager.MakePinned (LocalBuilder); - flags |= Flags.Fixed; + is_fixed = true; } public bool IsFixed { get { - if (((flags & Flags.Fixed) != 0) || TypeManager.IsValueType (VariableType)) + if (is_fixed || TypeManager.IsValueType (VariableType)) return true; return false; @@ -1079,36 +1088,6 @@ namespace Mono.CSharp { return String.Format ("LocalInfo ({0},{1},{2},{3})", Name, Type, VariableInfo, Location); } - - public bool Used { - get { - return (flags & Flags.Used) != 0; - } - set { - flags = value ? (flags | Flags.Used) : (flags & ~Flags.Used); - } - } - - public bool Assigned { - get { - return (flags & Flags.Assigned) != 0; - } - set { - flags = value ? (flags | Flags.Assigned) : (flags & ~Flags.Assigned); - } - } - - public bool ReadOnly { - get { - return (flags & Flags.ReadOnly) != 0; - } - set { - flags = value ? (flags | Flags.ReadOnly) : (flags & ~Flags.ReadOnly); - } - } - - - } /// <summary> @@ -1469,6 +1448,11 @@ namespace Mono.CSharp { return null; } + public VariableInfo GetVariableInfo (LocalInfo li) + { + return li.VariableInfo; + } + public Expression GetVariableType (string name) { LocalInfo vi = GetLocalInfo (name); @@ -1572,11 +1556,6 @@ namespace Mono.CSharp { } } - public bool LiftVariable (LocalInfo local_info) - { - return false; - } - /// <summary> /// Emits the variable declarations and labels. /// </summary> @@ -1743,7 +1722,7 @@ namespace Mono.CSharp { if (s is LabeledStatement) unreachable = false; else - unreachable = ec.CurrentBranching.CurrentUsageVector.IsUnreachable; + unreachable = ! ec.CurrentBranching.IsReachable (); new_statements.Add (s); } @@ -1768,8 +1747,6 @@ namespace Mono.CSharp { "This label has not been referenced"); } - Report.Debug (1, "RESOLVE BLOCK DONE #2", StartLocation, returns); - if ((returns == FlowBranching.FlowReturns.Always) || (returns == FlowBranching.FlowReturns.Exception) || (returns == FlowBranching.FlowReturns.Unreachable)) @@ -2850,7 +2827,6 @@ namespace Mono.CSharp { Expression e = (Expression) p.Second; vi.VariableInfo = null; - vi.ReadOnly = true; // // The rules for the possible declarators are pretty wise, @@ -3148,6 +3124,13 @@ namespace Mono.CSharp { ok = false; ec.InCatch = old_in_catch; + + FlowBranching.UsageVector current = ec.CurrentBranching.CurrentUsageVector; + + if (!current.AlwaysReturns && !current.AlwaysBreaks) + vector.AndLocals (current); + else + vector.Or (current); } Report.Debug (1, "END OF CATCH BLOCKS", ec.CurrentBranching); @@ -3163,6 +3146,13 @@ namespace Mono.CSharp { ok = false; ec.InCatch = old_in_catch; + + FlowBranching.UsageVector current = ec.CurrentBranching.CurrentUsageVector; + + if (!current.AlwaysReturns && !current.AlwaysBreaks) + vector.AndLocals (current); + else + vector.Or (current); } Report.Debug (1, "END OF GENERAL CATCH BLOCKS", ec.CurrentBranching); @@ -3185,7 +3175,15 @@ namespace Mono.CSharp { FlowBranching.UsageVector f_vector = ec.CurrentBranching.CurrentUsageVector; - Report.Debug (1, "END OF TRY", ec.CurrentBranching, returns, vector, f_vector); + Report.Debug (1, "END OF FINALLY", ec.CurrentBranching, returns, vector, f_vector); + + if ((returns == FlowBranching.FlowReturns.Sometimes) || (returns == FlowBranching.FlowReturns.Always)) { + ec.CurrentBranching.CheckOutParameters (f_vector.Parameters, loc); + } + + ec.CurrentBranching.CurrentUsageVector.Or (vector); + + Report.Debug (1, "END OF TRY", ec.CurrentBranching); if (returns != FlowBranching.FlowReturns.Always) { // Unfortunately, System.Reflection.Emit automatically emits a leave @@ -3441,28 +3439,9 @@ namespace Mono.CSharp { if (!ResolveExpression (ec)) return false; - } - - ec.StartFlowBranching (FlowBranching.BranchingType.Block, loc); + } - bool ok = Statement.Resolve (ec); - - if (!ok) { - ec.KillFlowBranching (); - return false; - } - - FlowBranching.FlowReturns returns = ec.EndFlowBranching (); - - if (returns != FlowBranching.FlowReturns.Always) { - // Unfortunately, System.Reflection.Emit automatically emits a leave - // to the end of the finally block. This is a problem if `returns' - // is true since we may jump to a point after the end of the method. - // As a workaround, emit an explicit ret here. - ec.NeedExplicitReturn = true; - } - - return true; + return Statement.Resolve (ec); } protected override bool DoEmit (EmitContext ec) diff --git a/mcs/gmcs/support.cs b/mcs/gmcs/support.cs index 43d7e746302..64f87b51945 100755 --- a/mcs/gmcs/support.cs +++ b/mcs/gmcs/support.cs @@ -328,42 +328,4 @@ namespace Mono.CSharp { return buffer [pos++]; } } - - public class DoubleHash { - Hashtable l = new Hashtable (); - - public DoubleHash () - { - } - - public bool Lookup (object a, object b, out object res) - { - object r = l [a]; - if (r == null){ - res = null; - return false; - } - Hashtable ht = (Hashtable) r; - if (ht.Contains (b)){ - res = ht [b]; - return true; - } - res = null; - return false; - } - - public void Insert (object a, object b, object value) - { - Hashtable ht; - object r = l [a]; - if (r == null){ - ht = new Hashtable (); - l [a] = ht; - ht [b] = value; - return; - } - ht = (Hashtable) r; - ht [b] = value; - } - } } diff --git a/mcs/gmcs/symbolwriter.cs b/mcs/gmcs/symbolwriter.cs index b971e574000..a6577e4013c 100644 --- a/mcs/gmcs/symbolwriter.cs +++ b/mcs/gmcs/symbolwriter.cs @@ -60,7 +60,7 @@ namespace Mono.CSharp { public void OpenMethod (TypeContainer parent, MethodBase method, Location start, Location end) { - int ns_id = parent.NamespaceEntry.SymbolFileID; + int ns_id = parent.Namespace.SymbolFileID; open_method.Invoke (symwriter, new object[] { start.SymbolDocument, start.Row, 0, end.Row, 0, method, ns_id }); } diff --git a/mcs/gmcs/tree.cs b/mcs/gmcs/tree.cs index 0f3a2d9244a..57e4740a751 100755 --- a/mcs/gmcs/tree.cs +++ b/mcs/gmcs/tree.cs @@ -45,14 +45,12 @@ namespace Mono.CSharp public Tree () { - root_types = new TypeContainer (null, null, "", new Location (-1)); + root_types = new TypeContainer (null, "", new Location (-1)); decls = new Hashtable (); namespaces = new Hashtable (); } - DoubleHash decl_ns_name = new DoubleHash (); - public void RecordDecl (string name, DeclSpace ds) { if (decls.Contains (name)){ @@ -64,42 +62,24 @@ namespace Mono.CSharp other.Location, "(Location of symbol related to previous error)"); return; } - - ds.RecordDecl (); - - int p = name.LastIndexOf ('.'); - if (p == -1) - decl_ns_name.Insert ("", name, ds); - else { - decl_ns_name.Insert (name.Substring (0, p), name.Substring (p+1), ds); - } - decls.Add (name, ds); } - - public DeclSpace LookupByNamespace (string ns, string name) - { - object res; - - decl_ns_name.Lookup (ns, name, out res); - return (DeclSpace) res; - } - public NamespaceEntry RecordNamespace (NamespaceEntry parent, SourceFile file, string name, Location loc) + public NamespaceEntry RecordNamespace (NamespaceEntry parent, SourceFile file, string name) { - NamespaceEntry ns = new NamespaceEntry (parent, file, name, loc); + NamespaceEntry ns = new NamespaceEntry (parent, file, name); if (namespaces.Contains (file)){ Hashtable ns_ns = (Hashtable) namespaces [file]; - if (ns_ns.Contains (ns.FullName)) - return (NamespaceEntry) ns_ns [ns.FullName]; - ns_ns.Add (ns.FullName, ns); + if (ns_ns.Contains (ns.Name)) + return (NamespaceEntry) ns_ns [ns.Name]; + ns_ns.Add (ns.Name, ns); } else { Hashtable new_table = new Hashtable (); namespaces [file] = new_table; - new_table.Add (ns.FullName, ns); + new_table.Add (ns.Name, ns); } return ns; diff --git a/mcs/gmcs/typemanager.cs b/mcs/gmcs/typemanager.cs index ad07dffe0a9..e3544a31f16 100755 --- a/mcs/gmcs/typemanager.cs +++ b/mcs/gmcs/typemanager.cs @@ -2122,8 +2122,8 @@ public class TypeManager { [Flags] public enum MethodFlags { IsObsolete = 1, - IsObsoleteError = 1 << 1, - ShouldIgnore = 1 << 2 + IsObsoleteError = 2, + ShouldIgnore = 3 } // diff --git a/mcs/ilasm/ChangeLog b/mcs/ilasm/ChangeLog index a083e9ea24b..1d92701f2e6 100644 --- a/mcs/ilasm/ChangeLog +++ b/mcs/ilasm/ChangeLog @@ -1,10 +1,3 @@ -2003-08-14 Jackson Harper <jackson@latitudegeo.com> - - * Driver.cs: Report entry for each il file processed - * Report.cs: New file - All error/warning/progress reporting will - go through here. - * ilasm.exe.sources: Add report to build - 2003-08-12 Jackson Harper <jackson@latitudegeo.com> * AssemblyInfo.cs: Bump up the vizzity-version number. diff --git a/mcs/ilasm/Driver.cs b/mcs/ilasm/Driver.cs index 88798fdc7d6..fdf6c535b81 100644 --- a/mcs/ilasm/Driver.cs +++ b/mcs/ilasm/Driver.cs @@ -39,10 +39,8 @@ namespace Mono.ILASM { private class DriverMain { private ArrayList il_file_list; - private Report report; private string output_file; private Target target = Target.Exe; - private string target_string = "exe"; private bool show_tokens = false; private bool show_method_def = false; private bool show_method_ref = false; @@ -55,7 +53,6 @@ namespace Mono.ILASM { { il_file_list = new ArrayList (); ParseArgs (args); - report = new Report (); } public void Run () @@ -88,8 +85,6 @@ namespace Mono.ILASM { file_path); Environment.Exit (2); } - report.AssembleFile (file_path, null, - target_string, output_file); StreamReader reader = File.OpenText (file_path); ILTokenizer scanner = new ILTokenizer (reader); @@ -109,16 +104,16 @@ namespace Mono.ILASM { } ILParser parser = new ILParser (codegen); - try { - if (show_parser) - parser.yyparse (new ScannerAdapter (scanner), - new yydebug.yyDebugSimple ()); - else - parser.yyparse (new ScannerAdapter (scanner), null); - } catch { - Console.WriteLine ("Error at: " + scanner.Reader.Location); - throw; - } + try { + if (show_parser) + parser.yyparse (new ScannerAdapter (scanner), + new yydebug.yyDebugSimple ()); + else + parser.yyparse (new ScannerAdapter (scanner), null); + } catch { + Console.WriteLine ("Error at: " + scanner.Reader.Location); + throw; + } } public void ShowToken (object sender, NewTokenEventArgs args) @@ -161,11 +156,9 @@ namespace Mono.ILASM { break; case "exe": target = Target.Exe; - target_string = "exe"; break; case "dll": target = Target.Dll; - target_string = "dll"; break; case "scan_only": scan_only = true; @@ -227,7 +220,7 @@ namespace Mono.ILASM { ext_index = file_name.Length; return String.Format ("{0}.{1}", file_name.Substring (0, ext_index), - target_string); + target.ToString ().ToLower ()); } private void Usage () diff --git a/mcs/ilasm/Report.cs b/mcs/ilasm/Report.cs deleted file mode 100644 index 1f184afd4f5..00000000000 --- a/mcs/ilasm/Report.cs +++ /dev/null @@ -1,64 +0,0 @@ -// -// Mono.ILASM.Report -// -// Author(s): -// Jackson Harper (Jackson@LatitudeGeo.com) -// -// (C) 2003 Jackson Harper, All rights reserved -// - - -using System; -using System.IO; - -namespace Mono.ILASM { - - public class Report { - - private int error_count; - private int mark_count; - - public Report () - { - error_count = 0; - } - - public int ErrorCount { - get { return error_count; } - } - - public void Mark () - { - mark_count = error_count; - } - - public bool ErrorSinceMark () - { - return (error_count > mark_count); - } - - public void AssembleFile (string file, string listing, - string target, string output) - { - Console.WriteLine ("Assembling '{0}' , {1}, to {2} --> '{3}'", file, - GetListing (listing), target, output); - } - - public void Error (int num, string message, Location location) - { - error_count++; - Console.WriteLine ("{0} Error {1}: {2}", - num, location, message); - } - - private string GetListing (string listing) - { - if (listing == null) - return "no listing file"; - return listing; - } - - } - -} - diff --git a/mcs/ilasm/codegen/ChangeLog b/mcs/ilasm/codegen/ChangeLog index eb838fdd2a7..88cf9921ced 100644 --- a/mcs/ilasm/codegen/ChangeLog +++ b/mcs/ilasm/codegen/ChangeLog @@ -1,20 +1,3 @@ -2003-08-19 Jackson Harper <jackson@latitudegeo.com> - - * DataDef.cs: Make name public so data names can be looked up - * FieldDef.cs: Stub method for adding data values - * TypeDef.cs: Implement long form overrides, fix some backwords - variable naming, add a method to lookup data definitions. - -2003-08-19 Jackson Harper <jackson@latitudegeo.com> - - * IClassRef.cs: Removed methods that have been moved into ITypeRef - * MethodDef.cs: Make some properties public, Add method to get a - list of parameter types. This is used to build signatures. Alow - sentinels in signatures and in param lists. Fix some tabbing. - * ParamDef.cs: Expose the parameters type so they can be used when - building signatures. - * TypeDef.cs: Add and emit overrides. - 2003-08-10 Jackson Harper <jackson@latitudegeo.com> * CodeGen.cs: Fix tabbing diff --git a/mcs/ilasm/codegen/DataDef.cs b/mcs/ilasm/codegen/DataDef.cs index ad83cb476b5..b415296dd99 100644 --- a/mcs/ilasm/codegen/DataDef.cs +++ b/mcs/ilasm/codegen/DataDef.cs @@ -30,10 +30,6 @@ namespace Mono.ILASM { set { constant = value; } } - public string Name { - get { return name; } - set { name = value; } - } } } diff --git a/mcs/ilasm/codegen/FieldDef.cs b/mcs/ilasm/codegen/FieldDef.cs index f491a9b7c67..e81f93b2f44 100644 --- a/mcs/ilasm/codegen/FieldDef.cs +++ b/mcs/ilasm/codegen/FieldDef.cs @@ -62,11 +62,6 @@ namespace Mono.ILASM { this.constant = constant; } - public void AddDataValue (PEAPI.DataConstant constant) - { - - } - public PEAPI.FieldDef Resolve (CodeGen code_gen) { if (is_resolved) diff --git a/mcs/ilasm/codegen/IClassRef.cs b/mcs/ilasm/codegen/IClassRef.cs index 9321566bc91..9b639fc9917 100644 --- a/mcs/ilasm/codegen/IClassRef.cs +++ b/mcs/ilasm/codegen/IClassRef.cs @@ -15,8 +15,12 @@ namespace Mono.ILASM { PEAPI.Class PeapiClass { get; } - void MakeValueClass (); + new IMethodRef GetMethodRef (ITypeRef ret_type, PEAPI.CallConv call_conv, + string name, ITypeRef[] param); + new IFieldRef GetFieldRef (ITypeRef ret_type, string name); + + void MakeValueClass (); } } diff --git a/mcs/ilasm/codegen/MethodDef.cs b/mcs/ilasm/codegen/MethodDef.cs index b7bc2c867f9..3a1162b00c3 100644 --- a/mcs/ilasm/codegen/MethodDef.cs +++ b/mcs/ilasm/codegen/MethodDef.cs @@ -28,8 +28,8 @@ namespace Mono.ILASM { private ArrayList inst_list; private ArrayList customattr_list; private Hashtable label_table; - private Hashtable labelref_table; - private ArrayList label_list; + private Hashtable labelref_table; + private ArrayList label_list; private PEAPI.MethodDef methoddef; private bool entry_point; private bool is_resolved; @@ -38,7 +38,7 @@ namespace Mono.ILASM { private Hashtable named_local_table; private bool init_locals; private int max_stack; - + private Random label_random; public MethodDef (PEAPI.MethAttr meth_attr, PEAPI.CallConv call_conv, PEAPI.ImplAttr impl_attr, string name, @@ -54,12 +54,12 @@ namespace Mono.ILASM { inst_list = new ArrayList (); customattr_list = new ArrayList (); label_table = new Hashtable (); - labelref_table = new Hashtable (); - label_list = new ArrayList (); + labelref_table = new Hashtable (); + label_list = new ArrayList (); local_list = new ArrayList (); named_local_table = new Hashtable (); named_param_table = new Hashtable (); - + label_random = new Random (); entry_point = false; init_locals = false; max_stack = -1; @@ -78,14 +78,6 @@ namespace Mono.ILASM { get { return signature; } } - public ITypeRef RetType { - get { return ret_type; } - } - - public PEAPI.CallConv CallConv { - get { return call_conv; } - } - public PEAPI.MethodDef PeapiMethodDef { get { return methoddef; } } @@ -94,18 +86,6 @@ namespace Mono.ILASM { get { return (call_conv & PEAPI.CallConv.Vararg) != 0; } } - public ITypeRef[] ParamTypeList () { - - if (param_list == null) - return new ITypeRef[0]; - int count = 0; - ITypeRef[] type_list = new ITypeRef[param_list.Count]; - foreach (ParamDef param in param_list) { - type_list[count++] = param.Type; - } - return type_list; - } - public void AddLocals (ArrayList local_list) { int slot_pos = this.local_list.Count; @@ -171,10 +151,14 @@ namespace Mono.ILASM { if (param_list != null) { int param_count = param_list.Count; + if (IsVararg && param_list[param_count-1] == ParamDef.Ellipsis) + param_count--; param_array = new PEAPI.Param[param_count]; int count = 0; foreach (ParamDef paramdef in param_list) { + if (paramdef == ParamDef.Ellipsis) + break; paramdef.Define (code_gen); param_array[count++] = paramdef.PeapiParam; } @@ -203,10 +187,14 @@ namespace Mono.ILASM { if (param_list != null) { int param_count = param_list.Count; + if (IsVararg && param_list[param_count-1] == ParamDef.Ellipsis) + param_count--; param_array = new PEAPI.Param[param_count]; int count = 0; - + foreach (ParamDef paramdef in param_list) { + if (paramdef == ParamDef.Ellipsis) + break; paramdef.Define (code_gen); param_array[count++] = paramdef.PeapiParam; } @@ -303,34 +291,34 @@ namespace Mono.ILASM { /// probably only create the ones that need to be LabelInfo[] label_info = new LabelInfo[label_table.Count + label_list.Count]; label_table.Values.CopyTo (label_info, 0); - label_list.CopyTo (label_info, label_table.Count); + label_list.CopyTo (label_info, label_table.Count); int previous_pos = -1; LabelInfo previous_label = null; Array.Sort (label_info); foreach (LabelInfo label in label_info) { - if (label.UseOffset) { - label.Define (new PEAPI.CILLabel (label.Offset)); - continue; - } + if (label.UseOffset) { + label.Define (new PEAPI.CILLabel (label.Offset)); + continue; + } if (label.Pos == previous_pos) label.Label = previous_label.Label; else label.Define (cil.NewLabel ()); - + previous_label = label; previous_pos = label.Pos; } - // Set all the label refs - foreach (LabelInfo label in labelref_table.Values) { - LabelInfo def = (LabelInfo) label_table[label.Name]; - if (def == null) { - Console.WriteLine ("Undefined Label: " + label); - return; - } - label.Label = def.Label; - } + // Set all the label refs + foreach (LabelInfo label in labelref_table.Values) { + LabelInfo def = (LabelInfo) label_table[label.Name]; + if (def == null) { + Console.WriteLine ("Undefined Label: " + label); + return; + } + label.Label = def.Label; + } int label_pos = 0; int next_label_pos = (label_info.Length > 0 ? label_info[0].Pos : -1); @@ -341,10 +329,10 @@ namespace Mono.ILASM { cil.CodeLabel (label_info[label_pos].Label); if (label_pos < label_info.Length) { while (next_label_pos == i && ++label_pos < label_info.Length) { - if (label_info[label_pos].UseOffset) - cil.CodeLabel (label_info[label_pos].Label); + if (label_info[label_pos].UseOffset) + cil.CodeLabel (label_info[label_pos].Label); next_label_pos = label_info[label_pos].Pos; - } + } } if (label_pos >= label_info.Length) next_label_pos = -1; @@ -357,41 +345,41 @@ namespace Mono.ILASM { public LabelInfo AddLabel (string name) { LabelInfo label_info = (LabelInfo) label_table[name]; - if (label_info != null) - return label_info; - label_info = new LabelInfo (name, inst_list.Count); + if (label_info != null) + return label_info; + label_info = new LabelInfo (name, inst_list.Count); label_table.Add (name, label_info); - return label_info; - } - - public LabelInfo AddLabelRef (string name) - { - LabelInfo label_info = (LabelInfo) label_table[name]; - if (label_info != null) - return label_info; - label_info = (LabelInfo) labelref_table[name]; - if (label_info != null) - return label_info; - label_info = new LabelInfo (name, -1); - labelref_table.Add (name, label_info); - return label_info; - } - - public LabelInfo AddLabel (int offset) - { - // We go pos + 1 so this line is not counted - LabelInfo label_info = new LabelInfo (null, inst_list.Count+1, (uint) offset); - label_list.Add (label_info); - return label_info; - } - - public LabelInfo AddLabel () - { - int pos = inst_list.Count; - LabelInfo label_info = new LabelInfo (null, inst_list.Count); - label_list.Add (label_info); - return label_info; - } + return label_info; + } + + public LabelInfo AddLabelRef (string name) + { + LabelInfo label_info = (LabelInfo) label_table[name]; + if (label_info != null) + return label_info; + label_info = (LabelInfo) labelref_table[name]; + if (label_info != null) + return label_info; + label_info = new LabelInfo (name, -1); + labelref_table.Add (name, label_info); + return label_info; + } + + public LabelInfo AddLabel (int offset) + { + // We go pos + 1 so this line is not counted + LabelInfo label_info = new LabelInfo (null, inst_list.Count+1, (uint) offset); + label_list.Add (label_info); + return label_info; + } + + public LabelInfo AddLabel () + { + int pos = inst_list.Count; + LabelInfo label_info = new LabelInfo (null, inst_list.Count); + label_list.Add (label_info); + return label_info; + } public PEAPI.CILLabel GetLabelDef (string name) { @@ -400,21 +388,21 @@ namespace Mono.ILASM { return label_info.Label; } - public PEAPI.CILLabel GetLabelDef (int pos) - { - foreach (LabelInfo li in label_list) { - if (li.Pos == pos) - return li.Label; - } - return null; - } + public PEAPI.CILLabel GetLabelDef (int pos) + { + foreach (LabelInfo li in label_list) { + if (li.Pos == pos) + return li.Label; + } + return null; + } private void CreateSignature () { - if (IsVararg) - signature = CreateVarargSignature (name, param_list); - else - signature = CreateSignature (name, param_list); + if (IsVararg) + signature = CreateVarargSignature (name, param_list); + else + signature = CreateSignature (name, param_list); } public static string CreateSignature (string name, IList param_list) @@ -438,14 +426,14 @@ namespace Mono.ILASM { return builder.ToString (); } - public static string CreateVarargSignature (string name, IList param_list) + public static string CreateVarargSignature (string name, IList param_list) { StringBuilder builder = new StringBuilder (); builder.Append (name); builder.Append ('('); - bool first = true; + bool first = true; if (param_list != null) { foreach (ParamDef paramdef in param_list) { if (!first) @@ -454,12 +442,12 @@ namespace Mono.ILASM { first = false; } } - ParamDef last = (ParamDef) param_list[param_list.Count - 1]; - if (!last.IsSentinel ()) { - if (!first) - builder.Append (','); - builder.Append ("..."); - } + ParamDef last = (ParamDef) param_list[param_list.Count - 1]; + if (!last.IsSentinel ()) { + if (!first) + builder.Append (','); + builder.Append ("..."); + } builder.Append (')'); return builder.ToString (); @@ -479,8 +467,8 @@ namespace Mono.ILASM { builder.Append (','); builder.Append (param.FullName); first = false; - if (param is SentinelTypeRef) - break; + if (param is SentinelTypeRef) + break; } } builder.Append (')'); diff --git a/mcs/ilasm/codegen/ParamDef.cs b/mcs/ilasm/codegen/ParamDef.cs index 9c597f525a0..0cd9d607fab 100644 --- a/mcs/ilasm/codegen/ParamDef.cs +++ b/mcs/ilasm/codegen/ParamDef.cs @@ -34,10 +34,6 @@ namespace Mono.ILASM { is_defined = false; } - public ITypeRef Type { - get { return typeref; } - } - public string TypeName { get { return typeref.FullName; } } @@ -50,10 +46,10 @@ namespace Mono.ILASM { get { return peapi_param; } } - public bool IsSentinel () - { - return (typeref is SentinelTypeRef); - } + public bool IsSentinel () + { + return (typeref is SentinelTypeRef); + } public void Define (CodeGen code_gen) { diff --git a/mcs/ilasm/codegen/TypeDef.cs b/mcs/ilasm/codegen/TypeDef.cs index a7889e728d3..bf94e092e3b 100644 --- a/mcs/ilasm/codegen/TypeDef.cs +++ b/mcs/ilasm/codegen/TypeDef.cs @@ -30,8 +30,6 @@ namespace Mono.ILASM { private ArrayList event_list; private ArrayList property_list; private ArrayList typar_list; - private ArrayList override_list; - private ArrayList override_long_list; private Hashtable constraint_table; private TypeDef outer; @@ -41,8 +39,8 @@ namespace Mono.ILASM { private int size; private int pack; - private bool is_value_class; - private bool is_enum_class; + private bool is_value_class; + private bool is_enum_class; public TypeDef (PEAPI.TypeAttr attr, string name_space, string name, IClassRef parent, ArrayList impl_list, Location location) @@ -62,8 +60,8 @@ namespace Mono.ILASM { is_defined = false; is_intransit = false; - is_value_class = false; - is_value_class = false; + is_value_class = false; + is_value_class = false; } public string Name { @@ -103,32 +101,15 @@ namespace Mono.ILASM { get { return current_property; } } + public void MakeValueClass () + { + is_value_class = true; + } - public void AddOverride (MethodDef body, ITypeRef parent, string name) - { - if (override_list == null) - override_list = new ArrayList (); - override_list.Add (new DictionaryEntry (body, - new DictionaryEntry (parent, name))); - } - - public void AddOverride (string sig, IMethodRef decl) - { - if (override_long_list == null) - override_long_list = new ArrayList (); - override_long_list.Add (new DictionaryEntry (sig, - decl)); - } - - public void MakeValueClass () - { - is_value_class = true; - } - - public void MakeEnumClass () - { - is_enum_class = true; - } + public void MakeEnumClass () + { + is_enum_class = true; + } public void SetSize (int size) { @@ -150,15 +131,6 @@ namespace Mono.ILASM { data_list.Add (datadef); } - public DataDef GetDataDef (string name) - { - foreach (DataDef def in data_list) { - if (def.Name == name) - return def; - } - return null; - } - public void AddMethodDef (MethodDef methoddef) { method_table.Add (methoddef.Signature, methoddef); @@ -246,14 +218,14 @@ namespace Mono.ILASM { classdef = outer.PeapiType.AddNestedClass (attr, name_space, name, parent.PeapiClass); } else { - if (is_value_class) { - // Should probably confirm that the parent is System.ValueType - classdef = code_gen.PEFile.AddValueClass (attr, - name_space, name); - } else { - classdef = code_gen.PEFile.AddClass (attr, - name_space, name, parent.PeapiClass); - } + if (is_value_class) { + // Should probably confirm that the parent is System.ValueType + classdef = code_gen.PEFile.AddValueClass (attr, + name_space, name); + } else { + classdef = code_gen.PEFile.AddClass (attr, + name_space, name, parent.PeapiClass); + } } } else { if (outer != null) { @@ -262,15 +234,14 @@ namespace Mono.ILASM { classdef = outer.PeapiType.AddNestedClass (attr, name_space, name); } else { - if (is_value_class) { - classdef = code_gen.PEFile.AddValueClass (attr, - name_space, name); - } else { - classdef = code_gen.PEFile.AddClass (attr, - name_space, name); - } + if (is_value_class) { + classdef = code_gen.PEFile.AddValueClass (attr, + name_space, name); + } else { + classdef = code_gen.PEFile.AddClass (attr, + name_space, name); + } } - classdef.SpecialNoSuper (); } if (size != -1) @@ -322,32 +293,6 @@ namespace Mono.ILASM { foreach (CustomAttr customattr in customattr_list) customattr.AddTo (code_gen, classdef); } - - if (override_list != null) { - foreach (DictionaryEntry entry in override_list) { - MethodDef body = (MethodDef) entry.Key; - DictionaryEntry decl = (DictionaryEntry) entry.Value; - ITypeRef parent_type = (ITypeRef) decl.Key; - parent_type.Resolve (code_gen); - string over_name = (string) decl.Value; - IMethodRef over_meth = parent_type.GetMethodRef (body.RetType, - body.CallConv, over_name, body.ParamTypeList ()); - over_meth.Resolve (code_gen); - classdef.AddMethodOverride (over_meth.PeapiMethod, - body.PeapiMethodDef); - } - } - - if (override_long_list != null) { - foreach (DictionaryEntry entry in override_long_list) { - string sig = (string) entry.Key; - IMethodRef decl = (IMethodRef) entry.Value; - MethodDef body = (MethodDef) method_table[sig]; - decl.Resolve (code_gen); - classdef.AddMethodOverride (decl.PeapiMethod, - body.PeapiMethodDef); - } - } } public PEAPI.MethodDef ResolveMethod (string signature, CodeGen code_gen) diff --git a/mcs/ilasm/ilasm.exe.sources b/mcs/ilasm/ilasm.exe.sources index b93b7dbde71..12f255c9af0 100644 --- a/mcs/ilasm/ilasm.exe.sources +++ b/mcs/ilasm/ilasm.exe.sources @@ -1,5 +1,4 @@ Driver.cs -Report.cs AssemblyInfo.cs codegen/CodeGen.cs codegen/ExternTable.cs diff --git a/mcs/ilasm/parser/ChangeLog b/mcs/ilasm/parser/ChangeLog index fcd8b6c01b7..497944c6ad1 100644 --- a/mcs/ilasm/parser/ChangeLog +++ b/mcs/ilasm/parser/ChangeLog @@ -1,13 +1,3 @@ -2003-08-19 Jackson Harper <jackson@latitudegeo.com> - - * ILParser.jay: Implement address constants and string - constants. Add data definitions to their types, and create data - item lists. Also implement long form overrides. - -2003-08-19 Jackson Harper <jackson@latitudegeo.com> - - * ILParser.jay: Add override methods. - 2003-08-10 Jackson Harper <jackson@latitudegeo.com> * ILParser.jay: Create an empty array list for empty type diff --git a/mcs/ilasm/parser/ILParser.jay b/mcs/ilasm/parser/ILParser.jay index 736c072487b..a1492a8a4d4 100644 --- a/mcs/ilasm/parser/ILParser.jay +++ b/mcs/ilasm/parser/ILParser.jay @@ -634,30 +634,8 @@ class_decl : method_all {
codegen.CurrentTypeDef.SetPack ((int) $2);
}
- | D_OVERRIDE type_spec DOUBLE_COLON method_name K_WITH call_conv type
- type_spec DOUBLE_COLON method_name type_list
- {
- //
- // My copy of the spec didn't have a type_list but
- // it seems pretty crucial
- //
- ITypeRef owner = (ITypeRef) $2;
- ArrayList arg_list = (ArrayList) $11;
- ITypeRef[] param_list;
- IMethodRef decl;
-
- if (arg_list != null)
- param_list = (ITypeRef[]) arg_list.ToArray (typeof (ITypeRef));
- else
- param_list = new ITypeRef[0];
-
- decl = owner.GetMethodRef ((ITypeRef) $7,
- (CallConv) $6, (string) $4, param_list);
-
- string sig = MethodDef.CreateSignature ((string) $10,
- param_list);
- codegen.CurrentTypeDef.AddOverride (sig, decl);
- }
+ | D_OVERRIDE type_spec DOUBLE_COLON method_name
+ K_WITH call_conv type type_spec DOUBLE_COLON method_name
OPEN_PARENS sig_args CLOSE_PARENS
| language_decl
| constraint_decl
@@ -1090,11 +1068,11 @@ field_decl : D_FIELD repeat_opt field_attr type id at_opt init_opt if ($2 != null) {
field_def.SetOffset ((uint) $2);
}
-
+ /*
if ($6 != null) {
field_def.AddDataValue ((DataConstant) $6);
}
-
+ */
if ($7 != null) {
field_def.SetValue ((Constant) $7);
}
@@ -1173,8 +1151,8 @@ field_attr : /* EMPTY */ at_opt : /* EMPTY */
| K_AT id
{
- // DataDef def = new DataDef ((string) $2, false);
- // def.PeapiConstant = new DataConstant (DataTable.GetOffset ((string) $2));
+ // TODO: Implement DataTable
+ // $$ = new DataConstant (DataTable.GetOffset ((string) $2));
}
;
@@ -1242,6 +1220,9 @@ field_init : K_FLOAT32 OPEN_PARENS float64 CLOSE_PARENS data_decl : data_head data_body
{
+ /*
+ Console.WriteLine ("Creating data decl: '{0}' '{1}'", $1, $2);
+
DataDef datadef = (DataDef) $1;
if ($2 is ArrayList) {
@@ -1255,7 +1236,7 @@ data_decl : data_head data_body } else {
datadef.PeapiConstant = (PEAPI.Constant) $2;
}
- codegen.CurrentTypeDef.AddDataDef ((DataDef) $1);
+ */
}
;
@@ -1278,27 +1259,11 @@ data_body : OPEN_BRACE dataitem_list CLOSE_BRACE ;
dataitem_list : dataitem
- {
- ArrayList dataitem_list = new ArrayList ();
- dataitem_list.Add ($1);
- $$ = dataitem_list;
- }
| dataitem_list COMMA dataitem
- {
- ArrayList list = (ArrayList) $1;
- list.Add ($3);
- }
;
dataitem : K_CHAR STAR OPEN_PARENS comp_qstring CLOSE_PARENS
- {
- $$ = new StringConst ((string) $4);
- }
| AMPERSAND OPEN_PARENS id CLOSE_PARENS
- {
- DataDef def = codegen.CurrentTypeDef.GetDataDef ((string) $3);
- $$ = new AddressConstant ((DataConstant) def.PeapiConstant);
- }
| K_BYTEARRAY ASSIGN OPEN_PARENS bytes CLOSE_PARENS
{
$$ = new ByteArrConst ((byte[]) $4);
@@ -1603,11 +1568,6 @@ method_decl : D_EMITBYTE int32 | D_EXPORT OPEN_BRACKET int32 CLOSE_BRACKET K_AS id
| D_VTENTRY int32 COLON int32
| D_OVERRIDE type_spec DOUBLE_COLON method_name
- {
- codegen.CurrentTypeDef.AddOverride (codegen.CurrentMethodDef,
- (ITypeRef) $2, (string) $4);
-
- }
| scope_block
| D_PARAM OPEN_BRACKET int32 CLOSE_BRACKET init_opt
| id COLON
diff --git a/mcs/ilasm/tests/ChangeLog b/mcs/ilasm/tests/ChangeLog index 1be3a784145..018b60a40eb 100644 --- a/mcs/ilasm/tests/ChangeLog +++ b/mcs/ilasm/tests/ChangeLog @@ -1,8 +1,4 @@ -2003-07-12 Zoltan Varga <vargaz@freemail.hu> - * test-31.il: Added tests for static properties. Also made the code - for methods verifiable IL. - Fri Jul 25 12:27:24 CEST 2003 Paolo Molaro <lupus@ximian.com> * generics-c.il, generics-b.il: add constructors and fix code. diff --git a/mcs/ilasm/tests/test-31.il b/mcs/ilasm/tests/test-31.il index 19d7b454dc0..c82984ac051 100644 --- a/mcs/ilasm/tests/test-31.il +++ b/mcs/ilasm/tests/test-31.il @@ -14,34 +14,17 @@ .method public int32 get_foo () { - ldc.i4.1 - ret + nop } .method public void set_foo (int32) { - ret + nop } .method public void other_foo () { - ret - } - - .method static public int32 get_static_foo () - { - ldc.i4.1 - ret - } - - .method static public void set_static_foo (int32) - { - ret - } - - .method static public void other_static_foo () - { - ret + } .property int32 foo (int32) = int32 (0xFFFFFFFF) @@ -50,12 +33,5 @@ .set instance void Mono.ILASM.Tests.PropertyTest::set_foo (int32) .other instance void Mono.ILASM.Tests.PropertyTest::other_foo () } - - .property int32 static_foo () - { - .get int32 Mono.ILASM.Tests.PropertyTest::get_static_foo () - .set int32 Mono.ILASM.Tests.PropertyTest::set_static_foo (int32) - .other void Mono.ILASM.Tests.PropertyTest::other_foo () - } } } diff --git a/mcs/jay/README b/mcs/jay/README index 192a876ab70..e3995505b8a 100644 --- a/mcs/jay/README +++ b/mcs/jay/README @@ -1,6 +1,9 @@ This is a port of Jay to C#, the original Jay can be found here: http://www.informatik.uni-osnabrueck.de/bernd/jay/ +This is a temporary solution as we move to a Bison-generated parser +as it would provide better error recovery. + The original README from Jay is in `README.jay' Miguel diff --git a/mcs/mbas/ecore.cs b/mcs/mbas/ecore.cs index bc58fe7574b..9b83daf2744 100644 --- a/mcs/mbas/ecore.cs +++ b/mcs/mbas/ecore.cs @@ -333,7 +333,7 @@ namespace Mono.CSharp { return s; } - + if ((e is TypeExpr) || (e is ComposedCast)) { if ((flags & ResolveFlags.Type) == 0) { e.Error118 (flags); @@ -1743,11 +1743,7 @@ namespace Mono.CSharp { e = RTConversionExpression(ec, "ShortType.FromObject", expr, loc); break; } - break; - case TypeCode.Byte: - // Ok, this *is* broken - e = RTConversionExpression(ec, "ByteType.FromObject", expr, loc); - break; + break; } // We must examine separately some types that diff --git a/mcs/mbas/enum.cs b/mcs/mbas/enum.cs index fe94a611d9e..691fcbe6b12 100644 --- a/mcs/mbas/enum.cs +++ b/mcs/mbas/enum.cs @@ -464,8 +464,7 @@ namespace Mono.CSharp { if (val is EnumConstant){ Type etype = TypeManager.EnumToUnderlying (c.Type); - if ( (!ImplicitConversionExists (etype, UnderlyingType)) && - (!Expression.RuntimeConversionExists (ec, val, UnderlyingType)) ){ + if (!ImplicitConversionExists (etype, UnderlyingType)){ Expression.Error_CannotConvertImplicit ( loc, c.Type, UnderlyingType); return null; diff --git a/mcs/mbas/mb-parser.jay b/mcs/mbas/mb-parser.jay index fe58a4a45f4..ffd1fc24960 100644 --- a/mcs/mbas/mb-parser.jay +++ b/mcs/mbas/mb-parser.jay @@ -127,10 +127,7 @@ namespace Mono.MonoBASIC Stack tmp_blocks; Stack statement_stack; - // A stack for With expressions. - // - Stack with_stack; - + static public bool InitialOptionExplicit = false; static public bool InitialOptionStrict = false; @@ -142,8 +139,6 @@ namespace Mono.MonoBASIC static public bool UseExtendedSyntax; // for ".mbs" files - bool implicit_modifiers; - public override string[] extensions() { string [] list = { ".vb", ".mbs" }; @@ -865,10 +860,10 @@ module_declaration string name; name = MakeName((string) $2); new_module = new Module(current_container, - name, - current_modifiers, // already checks then - (Attributes) current_attributes, - lexer.Location); + name, + current_modifiers, // already checks then + (Attributes) current_attributes, + lexer.Location); current_container = new_module; current_container.Namespace = current_namespace; RootContext.Tree.RecordDecl(name, new_module); @@ -900,13 +895,10 @@ module_member_declaration opt_modifiers { current_attributes = (Attributes) $1; - current_modifiers = ((int)$2) | Modifiers.STATIC; - bool explicit_static = (((int) $2 & Modifiers.STATIC) > 0); - implicit_modifiers = (!explicit_static); + current_modifiers = (int) $2 | (int)Modifiers.STATIC; // FIXME: for type_declaration it can result in trouble } module_member_declarator { - implicit_modifiers = false; $$ = $3; } ; @@ -923,7 +915,7 @@ module_member_declarator | constant_declaration | property_declaration | event_declaration - | type_spec_declaration + | type_declaration ; constant_declaration // TODO: implement truly the logic @@ -1033,6 +1025,22 @@ sub_declaration current_local_parameters = (Parameters) $4; start_block(); + /* This is WEIRD: declaring a method (sub) in a module as static will + trigger a syntax error, but the same methods MUST be static in order + to be properly called + */ + /* THIS SHOULD NOT BE NEEDED ANYMORE + if (current_container is Module) { + if ((current_modifiers & Modifiers.STATIC) != 0) { + Report.Error (30810, lexer.Location, "Methods cannot be declared 'Static'"); + } + else + { + current_modifiers = Modifiers.STATIC; + } + + } + */ // Structure members are Public by default if ((current_container is Struct) && (current_modifiers == 0)) current_modifiers = Modifiers.PUBLIC; @@ -1067,30 +1075,42 @@ sub_declaration func_declaration : FUNCTION identifier - OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS opt_type_with_ranks opt_implement_clause EOL + OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS AS type opt_implement_clause EOL { current_local_parameters = (Parameters) $4; start_block(); - - Expression ftype = ($6 == null) ? TypeManager.system_object_expr : (Expression) $6; - + + /* This is WEIRD: declaring a method (sub) in a module as static will + trigger a syntax error, but the same methods MUST be static in order + to be properly called + */ + /* THIS SHOULD NOT BE NEEDED ANYMORE + if (current_container is Module) { + if ((current_modifiers & Modifiers.STATIC) != 0) { + Report.Error (30810, lexer.Location, "Methods cannot be declared 'Static'"); + } + else + { + current_modifiers |= Modifiers.STATIC; + } + } + */ // Structure members are Public by default if ((current_container is Struct) && (current_modifiers == 0)) current_modifiers = Modifiers.PUBLIC; // Add local var declaration // for return value ArrayList retval = new ArrayList (); - retval.Add (new VariableDeclaration ((string) $2, (Expression) ftype, lexer.Location)); - declare_local_variables ((Expression) ftype, retval, lexer.Location); + retval.Add (new VariableDeclaration ((string) $2, (Expression) $7, lexer.Location)); + declare_local_variables ((Expression) $7, retval, lexer.Location); } opt_statement_list END FUNCTION EOL { - Expression ftype = ($6 == null) ? TypeManager.system_object_expr : (Expression) $6; - Method method = new Method ((Expression) ftype, (int) current_modifiers, (string) $2, + Method method = new Method ((Expression) $7, (int) current_modifiers, (string) $2, (Parameters) current_local_parameters, null, - (Expression) ftype, lexer.Location); + (Expression) $7, lexer.Location); method.Block = end_block(); $$ = method; /*Console.WriteLine ("Declaring Function '{0}' with {1} statements and {2} arguments", @@ -1107,13 +1127,7 @@ struct_declaration { Struct new_struct; string full_struct_name = MakeName ((string) $2); - - // Module members are static by default, but structures *can't* be declared static - // so we must fix it, if mbas was the one actually responsible for this - // instead of triggering an error. - if (implicit_modifiers && ((current_modifiers & Modifiers.STATIC) != 0)) - current_modifiers = (current_modifiers & ~Modifiers.STATIC); - + new_struct = new Struct (current_container, full_struct_name, (int) current_modifiers, (Attributes) current_attributes, lexer.Location); @@ -1146,9 +1160,15 @@ struct_member_declarations ; struct_member_declaration - : opt_modifiers + : opt_attributes + opt_modifiers + { + current_attributes = (Attributes) $1; + current_modifiers = (int) $2; + } struct_member_declarator ; + struct_member_declarator : field_declaration //| constant_declaration @@ -1192,12 +1212,6 @@ enum_declaration Expression enum_type = ($3 == null) ? TypeManager.system_int32_expr : (Expression) $3; ArrayList enum_members = (ArrayList) $5; - // Module members are static by default, but enums *can't* be declared static - // so we must fix it if mbas was the one actually responsible for this - // instead of triggering an error. - if (implicit_modifiers && ((current_modifiers & Modifiers.STATIC) != 0)) - current_modifiers = (current_modifiers & ~Modifiers.STATIC); - Mono.CSharp.Enum e = new Mono.CSharp.Enum (current_container, enum_type, (int) current_modifiers, full_name, (Attributes) current_attributes, enum_location); @@ -1399,13 +1413,11 @@ interface_event_declaration ; property_declaration - : opt_access_specifier opt_modifiers PROPERTY identifier opt_property_parameters AS type opt_implement_clause EOL + : opt_access_specifier PROPERTY identifier opt_property_parameters AS type opt_implement_clause EOL { get_implicit_value_parameter_type = (Expression) $7; get_implicit_value_parameter_name = (string) $4; - current_modifiers = (int) $2; - current_local_parameters = (Parameters) $5; if (current_local_parameters != Parameters.EmptyReadOnlyParameters) { get_parameters = current_local_parameters.Copy (lexer.Location); @@ -1632,12 +1644,6 @@ delegate_declaration EOL { Location l = lexer.Location; - // Module members are static by default, but delegates *can't* be declared static - // so we must fix it, if mbas was the one actually responsible for this - // instead of triggering an error. - if (implicit_modifiers && ((current_modifiers & Modifiers.STATIC) != 0)) - current_modifiers = (current_modifiers & ~Modifiers.STATIC); - Mono.CSharp.Delegate del = new Mono.CSharp.Delegate (current_container, TypeManager.system_void_expr, (int) current_modifiers, MakeName ((string) $3), (Parameters) $5, @@ -1819,21 +1825,14 @@ fixed_parameter parameter_array : PARAM_ARRAY identifier opt_parens AS type { - string s_patype = ((Expression) $5).ToString(); - if ((bool) $3) - s_patype += "[]"; - - Expression patype = DecomposeQI (s_patype, Location.Null); - $$ = new Parameter (patype, (string) $2, Parameter.Modifier.PARAMS, null); + $$ = new Parameter ((Expression) $5, (string) $2, Parameter.Modifier.PARAMS, null); // note ("type must be a single-dimension array type"); } ; opt_parens : /* empty */ - { $$ = false; } | OPEN_PARENS CLOSE_PARENS - { $$ = true; } ; opt_parameter_modifier @@ -1870,7 +1869,7 @@ statement : current_block = (Block) $1; } } - | embedded_statement + | embedded_statement { Statement s = (Statement) $1; @@ -1885,14 +1884,8 @@ statement : { RaiseEvent ((string) $2, (ArrayList) $4); } - /* | array_handling_statement */ + | array_handling_statement /* | empty_statement */ - | with_statement - { - Statement s = (Statement) $1; - - current_block.AddStatement ((Statement) $1); - } ; labeled_statement @@ -1914,8 +1907,7 @@ embedded_statement | selection_statement | iteration_statement | try_statement - | jump_statement - | array_handling_statement + | jump_statement ; /* empty_statement @@ -1925,24 +1917,6 @@ empty_statement } ; */ - -with_statement - : WITH expression end_of_stmt /* was : WITH qualified_identifier end_of_stmt */ - { - // was : Expression e = DecomposeQI ((string) $2, lexer.Location); - Expression e = (Expression) $2; - with_stack.Push(e); - start_block(); - } - opt_statement_list - END WITH - { - Block b = end_block(); - with_stack.Pop(); - $$ = b; - } - ; - array_handling_statement : redim_statement @@ -1953,11 +1927,13 @@ redim_statement : REDIM opt_preserve redim_clauses { ArrayList list = (ArrayList) $3; - ReDim r = new ReDim (list, (bool) $2, lexer.Location); - $$ = r; - + foreach(Invocation i in list) + { + ReDim r = new ReDim (i.expr, i.Arguments, (bool) $2, lexer.Location); + current_block.AddStatement (r); + } } - ; + ; opt_preserve : /* empty */ { $$ = false; } @@ -1971,25 +1947,20 @@ redim_clauses clauses.Add ($1); $$ = clauses; - } + } | redim_clauses COMMA redim_clause { ArrayList clauses = (ArrayList) ($1); clauses.Add ($2); $$ = clauses; - } + } ; redim_clause : invocation_expression - { - Invocation i = (Invocation) $1; - RedimClause rc = new RedimClause (i.expr, i.Arguments); - $$ = rc; - } ; - + erase_statement : ERASE erase_clauses { @@ -1997,11 +1968,11 @@ erase_statement foreach(Expression e in list) { Erase r = new Erase (e, lexer.Location); - $$ = r; + current_block.AddStatement (r); } } - ; - + ; + erase_clauses : erase_clause { @@ -2009,19 +1980,20 @@ erase_clauses clauses.Add ($1); $$ = clauses; - } + } | erase_clauses COMMA erase_clause { ArrayList clauses = (ArrayList) ($1); clauses.Add ($2); $$ = clauses; - } + } ; erase_clause : primary_expression - ; + ; + jump_statement : /*break_statement @@ -2580,22 +2552,15 @@ case_sections } ; -ends - : end_of_stmt - | ends end_of_stmt - ; - - case_section - : CASE case_clauses ends + : CASE case_clauses end_of_stmt { start_block(); } opt_statement_list { - //Block topmost = current_block; - Block topmost = end_block(); - + Block topmost = current_block; + while (topmost.Implicit) topmost = topmost.Parent; @@ -2603,7 +2568,7 @@ case_section topmost.statements.Add (new Break (lexer.Location)); $$ = new SwitchSection ((ArrayList) $2, topmost); } - | CASE ELSE ends + | CASE ELSE end_of_stmt /* FIXME: we should somehow flag an error (BC30321 'Case' cannot follow a 'Case Else' in the same 'Select' statement.) @@ -2614,8 +2579,7 @@ case_section } opt_statement_list { - //Block topmost = current_block; - Block topmost = end_block(); + Block topmost = current_block; while (topmost.Implicit) topmost = topmost.Parent; @@ -2711,8 +2675,7 @@ array_creation_expression Expression atype = n.RequestedType; - if (VariableDeclaration.IndexesSpecifiedInRank(dims)) { - VariableDeclaration.VBFixIndexList (ref dims); + if (VariableDeclaration.IndexesSpecified(this)) { $$ = new ArrayCreation (atype, dims, "", (ArrayList) $2, lexer.Location); } else @@ -2805,7 +2768,7 @@ variable_declarator Report.Error (205, "End of statement expected."); ArrayList args = (ArrayList) ((Pair) $2).Second; - if (VariableDeclaration.IndexesSpecifiedInRank (args)) + if (VariableDeclaration.HasExplicitIndexes (args)) Report.Error (638, "Array bounds cannot appear in type specifiers."); string s_vartype = vartype.ToString(); @@ -2826,9 +2789,9 @@ variable_declarator and, in case, add the initializer after the array has been created. */ if (VariableDeclaration.IsArrayDecl (this)) { - if (VariableDeclaration.IndexesSpecified(current_rank_specifiers)) { + if (VariableDeclaration.IndexesSpecified(this)) { a_dims = (ArrayList) current_rank_specifiers; - VariableDeclaration.VBFixIndexLists (ref a_dims); + //varinit = new ArrayCreation (vartype, a_dims, "", (ArrayList) varinit, lexer.Location); varinit = VariableDeclaration.BuildArrayCreator(vartype, a_dims, (ArrayList) varinit, lexer.Location); } @@ -2869,15 +2832,7 @@ opt_type_spec $$ = (Expression) $2; } ; - -opt_type_with_ranks - : opt_type_spec - | AS type rank_specifiers - { - $$ = TypeManager.system_object_expr; - } - ; - + opt_type_decl : opt_type_spec { @@ -2885,7 +2840,7 @@ opt_type_decl } | AS type OPEN_PARENS opt_argument_list CLOSE_PARENS { - $$ = new Pair ($2, $4); + $$ = new Pair ($2, $4);; } | AS NEW type { @@ -2950,8 +2905,8 @@ variable_initializer_list list.Add ($3); $$ = list; } - ; - + ; + opt_rank_specifiers : /* empty */ { @@ -3104,19 +3059,7 @@ parenthesized_expression member_access : primary_expression DOT identifier { - if ($1 != null) - $$ = new MemberAccess ((Expression) $1, (string) $3, lexer.Location); - else - { - if (with_stack.Count > 0) { - Expression e = (Expression) with_stack.Peek(); - $$ = new MemberAccess (e, (string) $3, lexer.Location); - } - else - { - // OOps - } - } + $$ = new MemberAccess ((Expression) $1, (string) $3, lexer.Location); } | primary_expression DOT NEW { @@ -3124,19 +3067,7 @@ member_access } | predefined_type DOT identifier { - if ($1 != null) - $$ = new MemberAccess ((Expression) $1, (string) $3, lexer.Location); - else - { - if (with_stack.Count > 0) { - Expression e = (Expression) with_stack.Peek(); - $$ = new MemberAccess (e, (string) $3, lexer.Location); - } - else - { - // OOps - } - } + $$ = new MemberAccess ((Expression) $1, (string) $3, lexer.Location); } ; @@ -3238,27 +3169,7 @@ opt_expression : /* empty */ | expression ; - -expression_list - : expression - { - ArrayList list = new ArrayList (); - list.Add ($1); - $$ = list; - } - | expression_list COMMA expression - { - ArrayList list = (ArrayList) $1; - list.Add ($3); - $$ = list; - } - ; - -opt_expression_list - : /*empty */ { $$ = null; } - | expression_list - ; - + this_access : ME { @@ -3266,8 +3177,8 @@ this_access } | MYCLASS { - // FIXME: This is actually somewhat different from Me - // because it is for accessing static (classifier) methods/properties/fields + // FIXME: This is actually somewhat different from Me, + // because it is for acessing static (classifier) methods/properties/fields $$ = new This (current_block, lexer.Location); } ; @@ -3537,8 +3448,6 @@ type $$ = DecomposeQI ((string) $1, lexer.Location); } | builtin_types - /*| array_type - | pointer_type */ ; type_list @@ -3578,7 +3487,7 @@ builtin_types ; integral_type - : + : | BYTE { $$ = TypeManager.system_byte_expr; } | SHORT { $$ = TypeManager.system_int16_expr; } | LONG { $$ = TypeManager.system_int64_expr; } @@ -3775,31 +3684,18 @@ public class VariableDeclaration { } } - public static bool IndexesSpecifiedInRank (ArrayList IndexList) - { - bool res = false; - - if (IndexList != null) { - foreach (Expression e in IndexList) - if (!(e is EmptyExpression)) { - res = true; - break; - } - } - return (res); - } - - - public static bool IndexesSpecified (ArrayList ranks) + public static bool IndexesSpecified (Parser t) { bool res = false; + ArrayList ranks = t.current_rank_specifiers; if (ranks != null) { foreach (ArrayList IndexList in ranks) { - if (IndexesSpecifiedInRank (IndexList)) { - res = true; - break; - } + foreach (Expression e in IndexList) + if (!(e is EmptyExpression)) { + res = true; + break; + } } } return (res); @@ -3828,7 +3724,7 @@ public class VariableDeclaration { public static string StripIndexesFromDims (string dims) { StringBuilder sb = new StringBuilder(); - + // foreach (char c in dims) if (c == ',' || c == ']' || c == '[') sb.Append (c); @@ -3858,16 +3754,39 @@ public class VariableDeclaration { return res; } - public static void VBFixIndexList (ref ArrayList IndexList) + public static bool HasExplicitIndexes (ArrayList a) { - if (IndexList != null) { - for (int x = 0; x < IndexList.Count; x++) { - Expression e = (Expression) IndexList[x]; + bool res = false; + + if (a != null) { + foreach (Expression e in a) if (!(e is EmptyExpression)) { - IndexList[x] = new Binary (Binary.Operator.Addition, e, new IntLiteral(1), Location.Null); + res = true; + break; } - } + } + return res; + } + + public static ArrayList ParseIndexList (Parser t) + { + ArrayList res = new ArrayList(); + //string d = dims.Substring (1, dims.Length -2); + //Array a = d.Split (','); + + return t.current_rank_specifiers; + /* + if (a.GetLength(0) > 32) { + Report.Error (999, "Arrays cannot have more than 32 dimensions"); } + + foreach (string s in a) + if (s != "") + res.Add (new IntLiteral ((Int32) Convert.ToInt32(s) + 1)); + else + res.Add (new IntLiteral ((Int32) 0)); + + return (res);*/ } public static bool IsArrayDecl (Parser t) @@ -3876,16 +3795,6 @@ public class VariableDeclaration { return (t.current_rank_specifiers != null); } - public static void VBFixIndexLists (ref ArrayList ranks) - { - if (ranks != null) { - for (int x = 0; x < ranks.Count; x++) { - ArrayList IndexList = (ArrayList) ranks[x]; - VBFixIndexList (ref IndexList); - } - } - } - public static void FixupArrayTypes (ArrayList vars) { int varcount = vars.Count; @@ -4084,7 +3993,6 @@ public override int parse () switch_stack = new Stack (); expr_stack = new Stack (); tmp_blocks = new Stack(); - with_stack = new Stack(); statement_stack = new Stack(); UseExtendedSyntax = name.EndsWith(".mbs"); @@ -4106,7 +4014,7 @@ public override int parse () { Console.WriteLine (lexer.location + " : Parsing error in " + lexer.ref_name); Report.Error (9999, lexer.Location, "\n"); - Console.WriteLine (e); + //Console.WriteLine (e); } return Report.Errors; diff --git a/mcs/mbas/statement.cs b/mcs/mbas/statement.cs index 222c6ab09e1..749ee7ae5c6 100644 --- a/mcs/mbas/statement.cs +++ b/mcs/mbas/statement.cs @@ -5489,75 +5489,59 @@ namespace Mono.CSharp { return false; } - } + } - public class RedimClause { - public Expression Expr; - public ArrayList NewIndexes; - - public RedimClause (Expression e, ArrayList args) - { - Expr = e; - NewIndexes = args; - } - } - public class ReDim : Statement { - ArrayList RedimTargets; + Expression RedimTarget; + ArrayList NewIndexes; Type BaseType; bool Preserve; - + private StatementExpression ReDimExpr; - - public ReDim (ArrayList targets, bool opt_preserve, Location l) + + public ReDim (Expression expr, ArrayList args, bool opt_preserve, Location l) { loc = l; - RedimTargets = targets; + RedimTarget = expr; + NewIndexes = args; Preserve = opt_preserve; } - + public override bool Resolve (EmitContext ec) { - Expression RedimTarget; - ArrayList NewIndexes; - - foreach (RedimClause rc in RedimTargets) { - RedimTarget = rc.Expr; - NewIndexes = rc.NewIndexes; + RedimTarget = RedimTarget.Resolve (ec); + if (!RedimTarget.Type.IsArray) + Report.Error (49, "'ReDim' statement requires an array"); - RedimTarget = RedimTarget.Resolve (ec); - if (!RedimTarget.Type.IsArray) - Report.Error (49, "'ReDim' statement requires an array"); - - ArrayList args = new ArrayList(); - foreach (Argument a in NewIndexes) { - if (a.Resolve(ec, loc)) - args.Add (a.Expr); - } - - for (int x = 0; x < args.Count; x++) { - args[x] = new Binary (Binary.Operator.Addition, - (Expression) args[x], new IntLiteral (1), Location.Null); - } - - NewIndexes = args; - if (RedimTarget.Type.GetArrayRank() != args.Count) - Report.Error (415, "'ReDim' cannot change the number of dimensions of an array."); + ArrayList args = new ArrayList(); + foreach (Argument a in NewIndexes) { + if (a.Resolve(ec, loc)) + args.Add (a.Expr); + } + + for (int x = 0; x < args.Count; x++) { + args[x] = new Binary (Binary.Operator.Addition, + (Expression) args[x], new IntLiteral (1), Location.Null); + } - BaseType = RedimTarget.Type.GetElementType(); - Expression BaseTypeExpr = MonoBASIC.Parser.DecomposeQI(BaseType.FullName.ToString(), Location.Null); - ArrayCreation acExpr = new ArrayCreation (BaseTypeExpr, NewIndexes, "", null, Location.Null); - if (Preserve) - { - // TODO: Generate call to copying code, which has to make lots of verifications - //PreserveExpr = (ExpressionStatement) new Preserve(RedimTarget, acExpr, loc); - //ReDimExpr = (StatementExpression) new StatementExpression ((ExpressionStatement) new Assign (RedimTarget, PreserveExpr, loc), loc); - ReDimExpr = (StatementExpression) new StatementExpression ((ExpressionStatement) new Assign (RedimTarget, acExpr, loc), loc); - } - else - ReDimExpr = (StatementExpression) new StatementExpression ((ExpressionStatement) new Assign (RedimTarget, acExpr, loc), loc); - ReDimExpr.Resolve(ec); + NewIndexes = args; + if (RedimTarget.Type.GetArrayRank() != args.Count) + Report.Error (415, "'ReDim' cannot change the number of dimensions of an array."); + + BaseType = RedimTarget.Type.GetElementType(); + Expression BaseTypeExpr = MonoBASIC.Parser.DecomposeQI(BaseType.FullName.ToString(), Location.Null); + ArrayCreation acExpr = new ArrayCreation (BaseTypeExpr, NewIndexes, "", null, Location.Null); + if (Preserve) + { + // TODO: Generate call to copying code, which has to make lots of verifications + //PreserveExpr = (ExpressionStatement) new Preserve(RedimTarget, acExpr, loc); + //ReDimExpr = (StatementExpression) new StatementExpression ((ExpressionStatement) new Assign (RedimTarget, PreserveExpr, loc), loc); + ReDimExpr = (StatementExpression) new StatementExpression ((ExpressionStatement) new Assign (RedimTarget, acExpr, loc), loc); } + else + ReDimExpr = (StatementExpression) new StatementExpression ((ExpressionStatement) new Assign (RedimTarget, acExpr, loc), loc); + ReDimExpr.Resolve(ec); + return true; } diff --git a/mcs/mbas/typemanager.cs b/mcs/mbas/typemanager.cs index e1e8d6b4c18..9332c1718fc 100644 --- a/mcs/mbas/typemanager.cs +++ b/mcs/mbas/typemanager.cs @@ -464,13 +464,13 @@ public class TypeManager { Type t; foreach (Assembly a in assemblies){ - t = a.GetType (name, false, true); + t = a.GetType (name); if (t != null) return t; } foreach (ModuleBuilder mb in modules) { - t = mb.GetType (name, false, true); + t = mb.GetType (name); if (t != null){ return t; } @@ -664,7 +664,7 @@ public class TypeManager { sig.name = name; sig.args = args; - list = FindMembers (t, MemberTypes.Method, instance_and_static | BindingFlags.Public| BindingFlags.IgnoreCase, + list = FindMembers (t, MemberTypes.Method, instance_and_static | BindingFlags.Public, signature_filter, sig); if (list.Count == 0) { Report.Error (-19, "Can not find the core function `" + name + "'"); @@ -692,7 +692,7 @@ public class TypeManager { sig.args = args; list = FindMembers (t, MemberTypes.Constructor, - instance_and_static | BindingFlags.Public | BindingFlags.DeclaredOnly | BindingFlags.IgnoreCase, + instance_and_static | BindingFlags.Public | BindingFlags.DeclaredOnly, signature_filter, sig); if (list.Count == 0){ Report.Error (-19, "Can not find the core constructor for type `" + t.Name + "'"); @@ -948,7 +948,7 @@ public class TypeManager { MemberFilter filter, object criteria) { DeclSpace decl = (DeclSpace) builder_to_declspace [t]; - bf |= BindingFlags.IgnoreCase; +bf |= BindingFlags.IgnoreCase; // // `builder_to_declspace' contains all dynamic types. // @@ -974,7 +974,7 @@ public class TypeManager { // if ((bf & instance_and_static) == instance_and_static){ MemberInfo [] i_members = t.FindMembers ( - mt, (bf & ~BindingFlags.Static) | BindingFlags.IgnoreCase, filter, criteria); + mt, bf & ~BindingFlags.Static, filter, criteria); int i_len = i_members.Length; if (i_len == 1){ @@ -988,7 +988,7 @@ public class TypeManager { } MemberInfo [] s_members = t.FindMembers ( - mt, (bf & ~BindingFlags.Instance) | BindingFlags.IgnoreCase, filter, criteria); + mt, bf & ~BindingFlags.Instance, filter, criteria); int s_len = s_members.Length; if (i_len > 0 || s_len > 0) @@ -1048,7 +1048,7 @@ public class TypeManager { MemberList list; Timer.StartTimer (TimerType.FindMembers); - list = decl.FindMembers (mt, bf | BindingFlags.DeclaredOnly | BindingFlags.IgnoreCase, + list = decl.FindMembers (mt, bf | BindingFlags.DeclaredOnly, FilterWithClosure_delegate, name); Timer.StopTimer (TimerType.FindMembers); used_cache = false; @@ -2124,7 +2124,7 @@ public class TypeManager { closure_queried_type = current_type; Timer.StopTimer (TimerType.MemberLookup); -bf |= BindingFlags.IgnoreCase; + list = MemberLookup_FindMembers (current_type, mt, bf, name, out used_cache); Timer.StartTimer (TimerType.MemberLookup); @@ -2325,7 +2325,7 @@ public sealed class TypeHandle : IMemberContainer { if (mt == MemberTypes.Event) return new MemberList (type.GetEvents (bf | BindingFlags.DeclaredOnly)); else - return new MemberList (type.FindMembers (mt, bf | BindingFlags.DeclaredOnly | BindingFlags.IgnoreCase, + return new MemberList (type.FindMembers (mt, bf | BindingFlags.DeclaredOnly, null, null)); } diff --git a/mcs/mcs/ChangeLog b/mcs/mcs/ChangeLog index 4690a860f13..938e618ae73 100755 --- a/mcs/mcs/ChangeLog +++ b/mcs/mcs/ChangeLog @@ -1,115 +1,3 @@ -2003-09-07 Martin Baulig <martin@ximian.com> - - * report.cs (Error, Warning): Added overloaded versions which take - a `params object[] args' and call String.Format(). - -2003-09-07 Martin Baulig <martin@ximian.com> - - * decl.cs (DeclSpace..ctor): Don't call - NamespaceEntry.DefineName() here; do it in RecordDecl() which is - called from Tree.RecordDecl(). Fixes the CS0101 reporting. - (DeclSpace.RecordDecl): New method. - - * tree.cs (Tree.RecordDecl): Call ds.RecordDecl(). - -2003-09-02 Ravi Pratap <ravi@ximian.com> - - * attribute.cs (CheckAttributeTarget): Ensure that we allow return - value attributes to be applied to ParameterBuilders. - - * class.cs (MethodCore.LabelParameters): Make static and more - generic so that it can be used from other places - like interface - methods, for instance. - - * interface.cs (Interface.Emit): Call LabelParameters before - emitting attributes on the InterfaceMethod. - -2003-08-26 Martin Baulig <martin@ximian.com> - - * ecore.cs (SimpleName.SimpleNameResolve): Look for members before - resolving aliases; fixes #47927. - -2003-08-26 Martin Baulig <martin@ximian.com> - - * statement.cs (Using.DoResolve): This is internally emitting a - try/finally clause, so we need to set ec.NeedExplicitReturn if we - do not always return. Fixes #47681. - -2003-08-26 Martin Baulig <martin@ximian.com> - - * decl.cs (MemberCore): Moved WarningNotHiding(), - Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase() - into MemberBase. - (AdditionResult): Make this nested in DeclSpace. - (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry - argument; call NamespaceEntry.Define() unless we're nested in a - class or struct. - - * namespace.cs (Namespace.DefineName): New public function. This - is called from DeclSpace's .ctor to add - (Namespace.Lookup): Include DeclSpaces in the lookup. - - * class.cs (Operator): Derive from MemberBase, not MemberCore. - - * const.cs (Const): Derive from MemberBase, not MemberCore. - -2003-08-25 Martin Baulig <martin@ximian.com> - - * convert.cs (Convert.ExplicitReferenceConversion): When - converting from an interface type to a class, unbox if the target - type is a struct type. Fixes #47822. - -2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and - #47854. - -2003-08-22 Martin Baulig <martin@ximian.com> - - * class.cs (TypeManager.DefineType): When defining a nested type, - call DefineType() on our parent; fixes #47801. - -2003-08-22 Martin Baulig <martin@ximian.com> - - * class.cs (MethodData.Define): While checking if a method is an - interface implementation, improve the test a bit more to fix #47654. - -2003-08-22 Martin Baulig <martin@ximian.com> - - * expression.cs (Probe.DoResolve): Check whether `expr' resolved - correctly; fixes #47722. - -2003-08-22 Martin Baulig <martin@ximian.com> - - * expression.cs (UnaryMutator.ResolveVariable): If the target is a - LocalVariableReference, ensure it's not read-only. Fixes #47536. - - * statement.cs (Fixed.DoResolve): Make all variables read-only. - -2003-08-22 Martin Baulig <martin@ximian.com> - - * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields - can only be assigned in static constructors. Fixes #47161. - -2003-08-22 Martin Baulig <martin@ximian.com> - - Rewrote and improved the flow analysis code. - - * flowbranching.cs (FlowBranching): Make this class abstract. - (FlowBranching.CreateBranching): New static function to create a - new flow branching. - (FlowBranchingBlock, FlowBranchingException): New classes. - (FlowBranching.UsageVector.Type): New public readonly field. - (FlowBranching.UsageVector.Breaks): Removed the setter. - (FlowBranching.UsageVector.Returns): Removed the setter. - (FlowBranching.UsageVector): Added Break(), Return(), - NeverReachable() and Throw() methods to modify the reachability. - (FlowBranching.UsageVector.MergeChildren): Removed, this is now - done by FlowBranching.Merge(). - (FlowBranching.UsageVector.MergeChild): New method; merges the - merge result into the current vector. - (FlowBranching.Merge): New abstract method to merge a branching. - 2003-08-12 Martin Baulig <martin@ximian.com> * expression.cs (Indirection.CacheTemporaries): Create the diff --git a/mcs/mcs/attribute.cs b/mcs/mcs/attribute.cs index 5c7f5464761..4847a9c396c 100644 --- a/mcs/mcs/attribute.cs +++ b/mcs/mcs/attribute.cs @@ -529,7 +529,7 @@ namespace Mono.CSharp { }
/// <summary>
- /// Ensure that Attribute 'a' is being applied to the right language element (target)
+ /// Ensure that Attribute 'a' is being applied to the right target
/// </summary>
public static bool CheckAttributeTarget (Attribute a, object element)
{
@@ -557,7 +557,6 @@ namespace Mono.CSharp { } else
targets = attr.Targets;
-
if (element is Class) {
if ((targets & AttributeTargets.Class) != 0)
return true;
@@ -606,8 +605,7 @@ namespace Mono.CSharp { else
return false;
} else if (element is ParameterBuilder) {
- if ((targets & AttributeTargets.Parameter) != 0 ||
- (targets & AttributeTargets.ReturnValue) != 0)
+ if ((targets & AttributeTargets.Parameter) != 0)
return true;
else
return false;
diff --git a/mcs/mcs/class.cs b/mcs/mcs/class.cs index d741ab5f2fc..b76dc79d322 100755 --- a/mcs/mcs/class.cs +++ b/mcs/mcs/class.cs @@ -134,8 +134,8 @@ namespace Mono.CSharp { // public string IndexerName; - public TypeContainer (NamespaceEntry ns, TypeContainer parent, string name, Location l) - : base (ns, parent, name, l) + public TypeContainer (TypeContainer parent, string name, Location l) + : base (parent, name, l) { string n; types = new ArrayList (); @@ -791,6 +791,7 @@ namespace Mono.CSharp { TypeAttributes type_attributes = TypeAttr; + // if (parent_builder is ModuleBuilder) { if (IsTopLevel){ if (TypeManager.NamespaceClash (Name, Location)) return null; @@ -800,7 +801,7 @@ namespace Mono.CSharp { Name, type_attributes, parent, ifaces); } else { - TypeBuilder builder = Parent.DefineType (); + TypeBuilder builder = Parent.TypeBuilder; TypeBuilder = builder.DefineNestedType ( Basename, type_attributes, parent, ifaces); } @@ -885,7 +886,7 @@ namespace Mono.CSharp { if (idx < 0){ if (RootContext.WarningLevel >= 4){ if ((mc.ModFlags & Modifiers.NEW) != 0) - Warning_KeywordNewNotRequired (mc.Location, mc); + Warning_KewywordNewNotRequired (mc.Location, mc); } } else if (mc is MethodCore) ((MethodCore) mc).OverridesSomething = true; @@ -1625,7 +1626,7 @@ namespace Mono.CSharp { mi.ReflectedType.Name + "." + mi.Name + "'"); } - public void Warning_KeywordNewNotRequired (Location l, MemberCore mc) + public void Warning_KewywordNewNotRequired (Location l, MemberCore mc) { Report.Warning ( 109, l, "The member " + MakeName (mc.Name) + " does not hide an " + @@ -2095,8 +2096,8 @@ namespace Mono.CSharp { Modifiers.SEALED | Modifiers.UNSAFE; - public Class (NamespaceEntry ns, TypeContainer parent, string name, int mod, Attributes attrs, Location l) - : base (ns, parent, name, l) + public Class (TypeContainer parent, string name, int mod, Attributes attrs, Location l) + : base (parent, name, l) { int accmods; @@ -2132,8 +2133,8 @@ namespace Mono.CSharp { Modifiers.UNSAFE | Modifiers.PRIVATE; - public Struct (NamespaceEntry ns, TypeContainer parent, string name, int mod, Attributes attrs, Location l) - : base (ns, parent, name, l) + public Struct (TypeContainer parent, string name, int mod, Attributes attrs, Location l) + : base (parent, name, l) { int accmods; @@ -2181,7 +2182,7 @@ namespace Mono.CSharp { public MethodCore (Expression type, int mod, int allowed_mod, string name, Attributes attrs, Parameters parameters, Location loc) - : base (type, mod, allowed_mod, Modifiers.PRIVATE, name, attrs, loc) + : base (type, mod, allowed_mod, name, attrs, loc) { Parameters = parameters; } @@ -2251,17 +2252,13 @@ namespace Mono.CSharp { // The method's attributes are passed in because we need to extract // the "return:" attribute from there to apply on the return type // - static public void LabelParameters (EmitContext ec, - MethodBase builder, - Parameters parameters, - Attributes method_attrs, - Location loc) + public void LabelParameters (EmitContext ec, MethodBase builder, Attributes method_attrs) { // // Define each type attribute (in/out/ref) and // the argument names. // - Parameter [] p = parameters.FixedParameters; + Parameter [] p = Parameters.FixedParameters; int i = 0; MethodBuilder mb = null; @@ -2290,16 +2287,16 @@ namespace Mono.CSharp { if (par_attr == ParameterAttributes.Out){ if (attr.Contains (TypeManager.in_attribute_type)) - Report.Error (36, loc, + Report.Error (36, Location, "Can not use [In] attribute on out parameter"); } } } } - if (parameters.ArrayParameter != null){ + if (Parameters.ArrayParameter != null){ ParameterBuilder pb; - Parameter array_param = parameters.ArrayParameter; + Parameter array_param = Parameters.ArrayParameter; if (mb == null) pb = cb.DefineParameter ( @@ -2340,10 +2337,9 @@ namespace Mono.CSharp { try { ret_pb = mb.DefineParameter (0, ParameterAttributes.None, ""); Attribute.ApplyAttributes (ec, ret_pb, ret_pb, ret_attrs); - - } catch (ArgumentOutOfRangeException) { + } catch (ArgumentOutOfRangeException) { Report.Warning ( - -24, loc, + -24, Location, ".NET SDK 1.0 does not permit setting custom attributes" + " on the return type of a method"); } @@ -2848,8 +2844,7 @@ namespace Mono.CSharp { ec.IsStatic = false; } - MethodCore.LabelParameters (ec, ConstructorBuilder, - Parameters, OptAttributes, Location); + LabelParameters (ec, ConstructorBuilder, OptAttributes); SymbolWriter sw = CodeGen.SymbolWriter; bool generate_debugging = false; @@ -3193,21 +3188,14 @@ namespace Mono.CSharp { Modifiers.Error_InvalidModifier (Location, "public, virtual or abstract"); implementing = null; } - } else if ((flags & MethodAttributes.MemberAccessMask) != MethodAttributes.Public){ - if (TypeManager.IsInterfaceType (implementing.DeclaringType)){ - // - // If this is an interface method implementation, - // check for public accessibility - // - implementing = null; - } else if ((flags & MethodAttributes.MemberAccessMask) == MethodAttributes.Private){ - // We may never be private. - implementing = null; - } else if ((modifiers & Modifiers.OVERRIDE) == 0){ - // - // We may be protected if we're overriding something. - // - implementing = null; + } else { + // + // If this is an interface method implementation, + // check for public accessibility + // + if ((flags & MethodAttributes.MemberAccessMask) != MethodAttributes.Public){ + if (TypeManager.IsInterfaceType (implementing.DeclaringType)) + implementing = null; } } @@ -3329,11 +3317,8 @@ namespace Mono.CSharp { Attribute.ApplyAttributes (ec, builder, kind, OptAttributes); if (member is MethodCore) - MethodCore.LabelParameters (ec, MethodBuilder, - ((MethodCore) member).Parameters, - OptAttributes, - Location); - + ((MethodCore) member).LabelParameters (ec, MethodBuilder, OptAttributes); + // // abstract or extern methods have no bodies // @@ -3485,12 +3470,12 @@ namespace Mono.CSharp { // // The constructor is only exposed to our children // - protected MemberBase (Expression type, int mod, int allowed_mod, int def_mod, string name, + protected MemberBase (Expression type, int mod, int allowed_mod, string name, Attributes attrs, Location loc) : base (name, loc) { Type = type; - ModFlags = Modifiers.Check (allowed_mod, mod, def_mod, loc); + ModFlags = Modifiers.Check (allowed_mod, mod, Modifiers.PRIVATE, loc); OptAttributes = attrs; } @@ -3508,153 +3493,6 @@ namespace Mono.CSharp { return true; } - protected void WarningNotHiding (TypeContainer parent) - { - Report.Warning ( - 109, Location, - "The member " + parent.MakeName (Name) + " does not hide an " + - "inherited member. The keyword new is not required"); - - } - - void Error_CannotChangeAccessModifiers (TypeContainer parent, MethodInfo parent_method, - string name) - { - // - // FIXME: report the old/new permissions? - // - Report.Error ( - 507, Location, parent.MakeName (Name) + - ": can't change the access modifiers when overriding inherited " + - "member `" + name + "'"); - } - - // - // Performs various checks on the MethodInfo `mb' regarding the modifier flags - // that have been defined. - // - // `name' is the user visible name for reporting errors (this is used to - // provide the right name regarding method names and properties) - // - protected bool CheckMethodAgainstBase (TypeContainer parent, MethodAttributes my_attrs, - MethodInfo mb, string name) - { - bool ok = true; - - if ((ModFlags & Modifiers.OVERRIDE) != 0){ - if (!(mb.IsAbstract || mb.IsVirtual)){ - Report.Error ( - 506, Location, parent.MakeName (Name) + - ": cannot override inherited member `" + - name + "' because it is not " + - "virtual, abstract or override"); - ok = false; - } - - // Now we check that the overriden method is not final - - if (mb.IsFinal) { - // This happens when implementing interface methods. - if (mb.IsHideBySig && mb.IsVirtual) { - Report.Error ( - 506, Location, parent.MakeName (Name) + - ": cannot override inherited member `" + - name + "' because it is not " + - "virtual, abstract or override"); - } else - Report.Error (239, Location, parent.MakeName (Name) + " : cannot " + - "override inherited member `" + name + - "' because it is sealed."); - ok = false; - } - // - // Check that the permissions are not being changed - // - MethodAttributes thisp = my_attrs & MethodAttributes.MemberAccessMask; - MethodAttributes parentp = mb.Attributes & MethodAttributes.MemberAccessMask; - - // - // special case for "protected internal" - // - - if ((parentp & MethodAttributes.FamORAssem) == MethodAttributes.FamORAssem){ - // - // when overriding protected internal, the method can be declared - // protected internal only within the same assembly - // - - if ((thisp & MethodAttributes.FamORAssem) == MethodAttributes.FamORAssem){ - if (parent.TypeBuilder.Assembly != mb.DeclaringType.Assembly){ - // - // assemblies differ - report an error - // - - Error_CannotChangeAccessModifiers (parent, mb, name); - ok = false; - } else if (thisp != parentp) { - // - // same assembly, but other attributes differ - report an error - // - - Error_CannotChangeAccessModifiers (parent, mb, name); - ok = false; - }; - } else if ((thisp & MethodAttributes.Family) != MethodAttributes.Family) { - // - // if it's not "protected internal", it must be "protected" - // - - Error_CannotChangeAccessModifiers (parent, mb, name); - ok = false; - } else if (parent.TypeBuilder.Assembly == mb.DeclaringType.Assembly) { - // - // protected within the same assembly - an error - // - Error_CannotChangeAccessModifiers (parent, mb, name); - ok = false; - } else if ((thisp & ~(MethodAttributes.Family | MethodAttributes.FamORAssem)) != - (parentp & ~(MethodAttributes.Family | MethodAttributes.FamORAssem))) { - // - // protected ok, but other attributes differ - report an error - // - Error_CannotChangeAccessModifiers (parent, mb, name); - ok = false; - } - } else { - if (thisp != parentp){ - Error_CannotChangeAccessModifiers (parent, mb, name); - ok = false; - } - } - } - - if (mb.IsVirtual || mb.IsAbstract){ - if ((ModFlags & (Modifiers.NEW | Modifiers.OVERRIDE)) == 0){ - if (Name != "Finalize"){ - Report.Warning ( - 114, 2, Location, parent.MakeName (Name) + - " hides inherited member `" + name + - "'. To make the current member override that " + - "implementation, add the override keyword, " + - "otherwise use the new keyword"); - ModFlags |= Modifiers.NEW; - } - } - } else { - if ((ModFlags & (Modifiers.NEW | Modifiers.OVERRIDE)) == 0){ - if (Name != "Finalize"){ - Report.Warning ( - 108, 1, Location, "The keyword new is required on " + - parent.MakeName (Name) + " because it hides " + - "inherited member `" + name + "'"); - ModFlags |= Modifiers.NEW; - } - } - } - - return ok; - } - protected virtual bool CheckParameters (TypeContainer container, Type [] parameters) { bool error = false; @@ -3794,7 +3632,7 @@ namespace Mono.CSharp { // protected FieldBase (Expression type, int mod, int allowed_mod, string name, object init, Attributes attrs, Location loc) - : base (type, mod, allowed_mod, Modifiers.PRIVATE, name, attrs, loc) + : base (type, mod, allowed_mod, name, attrs, loc) { this.init = init; } @@ -4745,7 +4583,7 @@ namespace Mono.CSharp { } } - public class Operator : MemberBase { + public class Operator : MemberCore { const int AllowedModifiers = Modifiers.PUBLIC | @@ -4800,24 +4638,27 @@ namespace Mono.CSharp { public readonly Expression FirstArgType, SecondArgType; public readonly string FirstArgName, SecondArgName; public Block Block; + public Attributes OptAttributes; public MethodBuilder OperatorMethodBuilder; public string MethodName; public Method OperatorMethod; - public Operator (OpType type, Expression ret_type, int mod_flags, + public Operator (OpType type, Expression ret_type, int flags, Expression arg1type, string arg1name, Expression arg2type, string arg2name, Block block, Attributes attrs, Location loc) - : base (ret_type, mod_flags, AllowedModifiers, Modifiers.PUBLIC, "", attrs, loc) + : base ("", loc) { OperatorType = type; ReturnType = ret_type; + ModFlags = Modifiers.Check (AllowedModifiers, flags, Modifiers.PUBLIC, loc); FirstArgType = arg1type; FirstArgName = arg1name; SecondArgType = arg2type; SecondArgName = arg2name; Block = block; + OptAttributes = attrs; } string Prototype (TypeContainer container) diff --git a/mcs/mcs/codegen.cs b/mcs/mcs/codegen.cs index a8c6ca296da..b1976c59de0 100755 --- a/mcs/mcs/codegen.cs +++ b/mcs/mcs/codegen.cs @@ -381,7 +381,7 @@ namespace Mono.CSharp { // </summary> public FlowBranching StartFlowBranching (FlowBranching.BranchingType type, Location loc) { - FlowBranching cfb = FlowBranching.CreateBranching (CurrentBranching, type, null, loc); + FlowBranching cfb = new FlowBranching (CurrentBranching, type, null, loc); FlowStack.Push (cfb); @@ -401,7 +401,7 @@ namespace Mono.CSharp { else type = FlowBranching.BranchingType.Block; - cfb = FlowBranching.CreateBranching (CurrentBranching, type, block, block.StartLocation); + cfb = new FlowBranching (CurrentBranching, type, block, block.StartLocation); FlowStack.Push (cfb); @@ -445,8 +445,7 @@ namespace Mono.CSharp { bool old_do_flow_analysis = DoFlowAnalysis; DoFlowAnalysis = true; - FlowBranching cfb = FlowBranching.CreateBranching ( - null, FlowBranching.BranchingType.Block, block, loc); + FlowBranching cfb = new FlowBranching (block, loc); FlowStack.Push (cfb); if (!block.Resolve (this)) { diff --git a/mcs/mcs/const.cs b/mcs/mcs/const.cs index fc7a29f6727..4f54d70e887 100755 --- a/mcs/mcs/const.cs +++ b/mcs/mcs/const.cs @@ -24,9 +24,10 @@ namespace Mono.CSharp { using System.Reflection.Emit; using System.Collections; - public class Const : MemberBase { + public class Const : MemberCore { public Expression ConstantType; public Expression Expr; + public Attributes OptAttributes; public FieldBuilder FieldBuilder; EmitContext const_ec; @@ -44,11 +45,13 @@ namespace Mono.CSharp { public Const (Expression constant_type, string name, Expression expr, int mod_flags, Attributes attrs, Location loc) - : base (constant_type, mod_flags, AllowedModifiers, Modifiers.PRIVATE, name, attrs, loc) + : base (name, loc) { ConstantType = constant_type; Name = name; Expr = expr; + ModFlags = Modifiers.Check (AllowedModifiers, mod_flags, Modifiers.PRIVATE, loc); + OptAttributes = attrs; } public FieldAttributes FieldAttr { @@ -95,7 +98,7 @@ namespace Mono.CSharp { if (ptype != null) { MemberList list = TypeContainer.FindMembers ( ptype, MemberTypes.Field, BindingFlags.Public, - System.Type.FilterName, Name); + Type.FilterName, Name); if (list.Count == 0) if ((ModFlags & Modifiers.NEW) != 0) diff --git a/mcs/mcs/convert.cs b/mcs/mcs/convert.cs index 75b6036cdfa..04ce4a19e7d 100644 --- a/mcs/mcs/convert.cs +++ b/mcs/mcs/convert.cs @@ -1512,14 +1512,10 @@ namespace Mono.CSharp { // sealed, or provided T implements S. // if (source_type.IsInterface) { - if (!target_type.IsSealed || TypeManager.ImplementsInterface (target_type, source_type)) { - if (target_type.IsClass) - return new ClassCast (source, target_type); - else - return new UnboxCast (source, target_type); - } - - return null; + if (!target_type.IsSealed || TypeManager.ImplementsInterface (target_type, source_type)) + return new ClassCast (source, target_type); + else + return null; } // From an array type S with an element type Se to an array type T with an diff --git a/mcs/mcs/cs-parser.jay b/mcs/mcs/cs-parser.jay index e053aa6fdc6..aa61878730a 100755 --- a/mcs/mcs/cs-parser.jay +++ b/mcs/mcs/cs-parser.jay @@ -341,7 +341,7 @@ namespace_declaration + " Expected class, delegate, enum, interface, or struct"); } - current_namespace = RootContext.Tree.RecordNamespace (current_namespace, file, (string) $3, lexer.Location); + current_namespace = RootContext.Tree.RecordNamespace (current_namespace, file, (string) $3); } namespace_body opt_semicolon { @@ -667,9 +667,10 @@ struct_declaration Struct new_struct; string full_struct_name = MakeName ((string) $4); - new_struct = new Struct (current_namespace, current_container, full_struct_name, - (int) $2, (Attributes) $1, lexer.Location); + new_struct = new Struct (current_container, full_struct_name, (int) $2, + (Attributes) $1, lexer.Location); current_container = new_struct; + current_container.NamespaceEntry = current_namespace; RootContext.Tree.RecordDecl (full_struct_name, new_struct); } opt_class_base @@ -1131,13 +1132,14 @@ interface_declaration Interface new_interface; string full_interface_name = MakeName ((string) $4); - new_interface = new Interface (current_namespace, current_container, full_interface_name, - (int) $2, (Attributes) $1, lexer.Location); + new_interface = new Interface (current_container, full_interface_name, (int) $2, + (Attributes) $1, lexer.Location); if (current_interface != null) { Location l = lexer.Location; Report.Error (-2, l, "Internal compiler error: interface inside interface"); } current_interface = new_interface; + new_interface.NamespaceEntry = current_namespace; RootContext.Tree.RecordDecl (full_interface_name, new_interface); } opt_interface_base @@ -1748,8 +1750,8 @@ enum_declaration Location enum_location = lexer.Location; string full_name = MakeName ((string) $4); - Enum e = new Enum (current_namespace, current_container, (Expression) $5, (int) $2, - full_name, (Attributes) $1, enum_location); + Enum e = new Enum (current_container, (Expression) $5, (int) $2, full_name, + (Attributes) $1, enum_location); foreach (VariableDeclaration ev in (ArrayList) $6) { Location loc = (Location) ev.Location; @@ -1760,6 +1762,8 @@ enum_declaration ev.identifier, loc); } + e.NamespaceEntry = current_namespace; + CheckDef (current_container.AddEnum (e), full_name, enum_location); RootContext.Tree.RecordDecl (full_name, e); @@ -1826,10 +1830,11 @@ delegate_declaration SEMICOLON { Location l = lexer.Location; - Delegate del = new Delegate (current_namespace, current_container, (Expression) $4, - (int) $2, MakeName ((string) $5), (Parameters) $7, + Delegate del = new Delegate (current_container, (Expression) $4, (int) $2, + MakeName ((string) $5), (Parameters) $7, (Attributes) $1, l); + del.NamespaceEntry = current_namespace; CheckDef (current_container.AddDelegate (del), del.Name, l); } | opt_attributes @@ -1842,10 +1847,11 @@ delegate_declaration { Location l = lexer.Location; Delegate del = new Delegate ( - current_namespace, current_container, + current_container, TypeManager.system_void_expr, (int) $2, MakeName ((string) $5), (Parameters) $7, (Attributes) $1, l); + del.NamespaceEntry = current_namespace; CheckDef (current_container.AddDelegate (del), del.Name, l); } ; @@ -2784,9 +2790,10 @@ class_declaration name = MakeName ((string) $4); - new_class = new Class (current_namespace, current_container, name, (int) $2, + new_class = new Class (current_container, name, (int) $2, (Attributes) $1, lexer.Location); current_container = new_class; + current_container.NamespaceEntry = current_namespace; RootContext.Tree.RecordDecl (name, new_class); } opt_class_base @@ -3880,7 +3887,7 @@ void Error_ExpectingTypeName (Location l, Expression expr) string MakeName (string class_name) { - string ns = current_namespace.FullName; + string ns = current_namespace.Name; string container_name = current_container.Name; if (container_name == ""){ @@ -3897,13 +3904,13 @@ MakeName (string class_name) // in the current declaration space // </summary> void -CheckDef (DeclSpace.AdditionResult result, string name, Location l) +CheckDef (AdditionResult result, string name, Location l) { - if (result == DeclSpace.AdditionResult.Success) + if (result == AdditionResult.Success) return; switch (result){ - case DeclSpace.AdditionResult.NameExists: + case AdditionResult.NameExists: Report.Error (102, l, "The container `" + current_container.Name + "' already contains a definition for `"+ name + "'"); @@ -3914,22 +3921,22 @@ CheckDef (DeclSpace.AdditionResult result, string name, Location l) // This is handled only for static Constructors, because // in reality we handle these by the semantic analysis later // - case DeclSpace.AdditionResult.MethodExists: + case AdditionResult.MethodExists: Report.Error ( 111, l, "Class `"+current_container.Name+ "' already defines a member called '" + name + "' with the same parameter types (more than one default constructor)"); break; - case DeclSpace.AdditionResult.EnclosingClash: + case AdditionResult.EnclosingClash: Report.Error (542, l, "Member names cannot be the same as their enclosing type"); break; - case DeclSpace.AdditionResult.NotAConstructor: + case AdditionResult.NotAConstructor: Report.Error (1520, l, "Class, struct, or interface method must have a return type"); break; - case DeclSpace.AdditionResult.Error: + case AdditionResult.Error: // Error has already been reported. break; } @@ -3940,7 +3947,7 @@ CheckDef (bool result, string name, Location l) { if (result) return; - CheckDef (DeclSpace.AdditionResult.NameExists, name, l); + CheckDef (AdditionResult.NameExists, name, l); } Expression DecomposeQI (string name, Location loc) @@ -4152,7 +4159,7 @@ public Tokenizer Lexer { public CSharpParser (SeekableStreamReader reader, SourceFile file, ArrayList defines) { - current_namespace = new NamespaceEntry (null, file, null, Location.Null); + current_namespace = new NamespaceEntry (null, file, null); this.name = file.Name; this.file = file; current_container = RootContext.Tree.Types; @@ -4176,7 +4183,6 @@ public override void parse () // Please do not remove this, it is used during debugging // of the grammar // - Console.WriteLine (e); Report.Error (-25, lexer.Location, "Parsing error"); if (Driver.parser_verbose) Console.WriteLine (e); diff --git a/mcs/mcs/decl.cs b/mcs/mcs/decl.cs index 3e7d6f7c0d4..f528e1be5dc 100755 --- a/mcs/mcs/decl.cs +++ b/mcs/mcs/decl.cs @@ -43,6 +43,153 @@ namespace Mono.CSharp { Location = loc; } + protected void WarningNotHiding (TypeContainer parent) + { + Report.Warning ( + 109, Location, + "The member " + parent.MakeName (Name) + " does not hide an " + + "inherited member. The keyword new is not required"); + + } + + void Error_CannotChangeAccessModifiers (TypeContainer parent, MethodInfo parent_method, + string name) + { + // + // FIXME: report the old/new permissions? + // + Report.Error ( + 507, Location, parent.MakeName (Name) + + ": can't change the access modifiers when overriding inherited " + + "member `" + name + "'"); + } + + // + // Performs various checks on the MethodInfo `mb' regarding the modifier flags + // that have been defined. + // + // `name' is the user visible name for reporting errors (this is used to + // provide the right name regarding method names and properties) + // + protected bool CheckMethodAgainstBase (TypeContainer parent, MethodAttributes my_attrs, + MethodInfo mb, string name) + { + bool ok = true; + + if ((ModFlags & Modifiers.OVERRIDE) != 0){ + if (!(mb.IsAbstract || mb.IsVirtual)){ + Report.Error ( + 506, Location, parent.MakeName (Name) + + ": cannot override inherited member `" + + name + "' because it is not " + + "virtual, abstract or override"); + ok = false; + } + + // Now we check that the overriden method is not final + + if (mb.IsFinal) { + // This happens when implementing interface methods. + if (mb.IsHideBySig && mb.IsVirtual) { + Report.Error ( + 506, Location, parent.MakeName (Name) + + ": cannot override inherited member `" + + name + "' because it is not " + + "virtual, abstract or override"); + } else + Report.Error (239, Location, parent.MakeName (Name) + " : cannot " + + "override inherited member `" + name + + "' because it is sealed."); + ok = false; + } + // + // Check that the permissions are not being changed + // + MethodAttributes thisp = my_attrs & MethodAttributes.MemberAccessMask; + MethodAttributes parentp = mb.Attributes & MethodAttributes.MemberAccessMask; + + // + // special case for "protected internal" + // + + if ((parentp & MethodAttributes.FamORAssem) == MethodAttributes.FamORAssem){ + // + // when overriding protected internal, the method can be declared + // protected internal only within the same assembly + // + + if ((thisp & MethodAttributes.FamORAssem) == MethodAttributes.FamORAssem){ + if (parent.TypeBuilder.Assembly != mb.DeclaringType.Assembly){ + // + // assemblies differ - report an error + // + + Error_CannotChangeAccessModifiers (parent, mb, name); + ok = false; + } else if (thisp != parentp) { + // + // same assembly, but other attributes differ - report an error + // + + Error_CannotChangeAccessModifiers (parent, mb, name); + ok = false; + }; + } else if ((thisp & MethodAttributes.Family) != MethodAttributes.Family) { + // + // if it's not "protected internal", it must be "protected" + // + + Error_CannotChangeAccessModifiers (parent, mb, name); + ok = false; + } else if (parent.TypeBuilder.Assembly == mb.DeclaringType.Assembly) { + // + // protected within the same assembly - an error + // + Error_CannotChangeAccessModifiers (parent, mb, name); + ok = false; + } else if ((thisp & ~(MethodAttributes.Family | MethodAttributes.FamORAssem)) != + (parentp & ~(MethodAttributes.Family | MethodAttributes.FamORAssem))) { + // + // protected ok, but other attributes differ - report an error + // + Error_CannotChangeAccessModifiers (parent, mb, name); + ok = false; + } + } else { + if (thisp != parentp){ + Error_CannotChangeAccessModifiers (parent, mb, name); + ok = false; + } + } + } + + if (mb.IsVirtual || mb.IsAbstract){ + if ((ModFlags & (Modifiers.NEW | Modifiers.OVERRIDE)) == 0){ + if (Name != "Finalize"){ + Report.Warning ( + 114, 2, Location, parent.MakeName (Name) + + " hides inherited member `" + name + + "'. To make the current member override that " + + "implementation, add the override keyword, " + + "otherwise use the new keyword"); + ModFlags |= Modifiers.NEW; + } + } + } else { + if ((ModFlags & (Modifiers.NEW | Modifiers.OVERRIDE)) == 0){ + if (Name != "Finalize"){ + Report.Warning ( + 108, 1, Location, "The keyword new is required on " + + parent.MakeName (Name) + " because it hides " + + "inherited member `" + name + "'"); + ModFlags |= Modifiers.NEW; + } + } + } + + return ok; + } + public abstract bool Define (TypeContainer parent); // @@ -64,57 +211,10 @@ namespace Mono.CSharp { } } - /// <summary> - /// Base class for structs, classes, enumerations and interfaces. - /// </summary> - /// <remarks> - /// They all create new declaration spaces. This - /// provides the common foundation for managing those name - /// spaces. - /// </remarks> - public abstract class DeclSpace : MemberCore { - /// <summary> - /// this points to the actual definition that is being - /// created with System.Reflection.Emit - /// </summary> - public TypeBuilder TypeBuilder; - - /// <summary> - /// This variable tracks whether we have Closed the type - /// </summary> - public bool Created = false; - - // - // This is the namespace in which this typecontainer - // was declared. We use this to resolve names. - // - public NamespaceEntry NamespaceEntry; - - public Hashtable Cache = new Hashtable (); - - public string Basename; - - /// <summary> - /// defined_names is used for toplevel objects - /// </summary> - protected Hashtable defined_names; - - TypeContainer parent; - - public DeclSpace (NamespaceEntry ns, TypeContainer parent, string name, Location l) - : base (name, l) - { - NamespaceEntry = ns; - Basename = name.Substring (1 + name.LastIndexOf ('.')); - defined_names = new Hashtable (); - this.parent = parent; - } - - public void RecordDecl () - { - if ((NamespaceEntry != null) && (parent == RootContext.Tree.Types)) - NamespaceEntry.DefineName (Basename, this); - } + // + // FIXME: This is temporary outside DeclSpace, because I have to fix a bug + // in MCS that makes it fail the lookup for the enum + // /// <summary> /// The result value from adding an declaration into @@ -161,6 +261,51 @@ namespace Mono.CSharp { Error } + /// <summary> + /// Base class for structs, classes, enumerations and interfaces. + /// </summary> + /// <remarks> + /// They all create new declaration spaces. This + /// provides the common foundation for managing those name + /// spaces. + /// </remarks> + public abstract class DeclSpace : MemberCore { + /// <summary> + /// this points to the actual definition that is being + /// created with System.Reflection.Emit + /// </summary> + public TypeBuilder TypeBuilder; + + /// <summary> + /// This variable tracks whether we have Closed the type + /// </summary> + public bool Created = false; + + // + // This is the namespace in which this typecontainer + // was declared. We use this to resolve names. + // + public NamespaceEntry NamespaceEntry; + + public Hashtable Cache = new Hashtable (); + + public string Basename; + + /// <summary> + /// defined_names is used for toplevel objects + /// </summary> + protected Hashtable defined_names; + + TypeContainer parent; + + public DeclSpace (TypeContainer parent, string name, Location l) + : base (name, l) + { + Basename = name.Substring (1 + name.LastIndexOf ('.')); + defined_names = new Hashtable (); + this.parent = parent; + } + /// <summary> /// Returns a status code based purely on the name /// of the member being added @@ -563,7 +708,7 @@ namespace Mono.CSharp { // Attempt to lookup the class on our namespace and all it's implicit parents // for (NamespaceEntry ns = NamespaceEntry; ns != null; ns = ns.ImplicitParent) { - t = LookupInterfaceOrClass (ns.FullName, name, out error); + t = LookupInterfaceOrClass (ns.Name, name, out error); if (error) return null; @@ -588,7 +733,7 @@ namespace Mono.CSharp { for (NamespaceEntry ns = NamespaceEntry; ns != null; ns = ns.Parent){ - t = LookupInterfaceOrClass (ns.FullName, name, out error); + t = LookupInterfaceOrClass (ns.Name, name, out error); if (error) return null; diff --git a/mcs/mcs/delegate.cs b/mcs/mcs/delegate.cs index 35a9e43a0b5..f46b7c87abd 100644 --- a/mcs/mcs/delegate.cs +++ b/mcs/mcs/delegate.cs @@ -46,10 +46,10 @@ namespace Mono.CSharp { Modifiers.UNSAFE |
Modifiers.PRIVATE;
- public Delegate (NamespaceEntry ns, TypeContainer parent, Expression type,
- int mod_flags, string name, Parameters param_list,
+ public Delegate (TypeContainer parent, Expression type, int mod_flags,
+ string name, Parameters param_list,
Attributes attrs, Location l)
- : base (ns, parent, name, l)
+ : base (parent, name, l)
{
this.ReturnType = type;
ModFlags = Modifiers.Check (AllowedModifiers, mod_flags,
diff --git a/mcs/mcs/ecore.cs b/mcs/mcs/ecore.cs index 522051ba4dd..b4f23fe2488 100755 --- a/mcs/mcs/ecore.cs +++ b/mcs/mcs/ecore.cs @@ -2025,6 +2025,29 @@ namespace Mono.CSharp { Expression e = null; // + // Since we are cheating (is_base is our hint + // that we are the beginning of the name): we + // only do the Alias lookup for namespaces if + // the name does not include any dots in it + // + NamespaceEntry ns = ec.DeclSpace.NamespaceEntry; + if (is_base && ns != null){ + string alias_value = ns.LookupAlias (Name); + if (alias_value != null){ + Name = alias_value; + Type t; + + if ((t = TypeManager.LookupType (Name)) != null) + return new TypeExpr (t, loc); + + // No match, maybe our parent can compose us + // into something meaningful. + return this; + } + } + + + // // Stage 1: Performed by the parser (binding to locals or parameters). // Block current_block = ec.CurrentBlock; @@ -2078,31 +2101,8 @@ namespace Mono.CSharp { if (e == null && ec.ContainerType != null) e = MemberLookup (ec, ec.ContainerType, Name, loc); - if (e == null) { - // - // Since we are cheating (is_base is our hint - // that we are the beginning of the name): we - // only do the Alias lookup for namespaces if - // the name does not include any dots in it - // - NamespaceEntry ns = ec.DeclSpace.NamespaceEntry; - if (is_base && ns != null){ - string alias_value = ns.LookupAlias (Name); - if (alias_value != null){ - Name = alias_value; - Type t; - - if ((t = TypeManager.LookupType (Name)) != null) - return new TypeExpr (t, loc); - - // No match, maybe our parent can compose us - // into something meaningful. - return this; - } - } - + if (e == null) return ResolveAsTypeStep (ec); - } if (e is TypeExpr) return e; @@ -2527,9 +2527,6 @@ namespace Mono.CSharp { // if (ec.IsConstructor){ - if (IsStatic && !ec.IsStatic) - Report_AssignToReadonly (false); - if (ec.ContainerType == FieldInfo.DeclaringType) return this; } diff --git a/mcs/mcs/enum.cs b/mcs/mcs/enum.cs index 06f4c9e0cf7..c6f613bfadf 100755 --- a/mcs/mcs/enum.cs +++ b/mcs/mcs/enum.cs @@ -49,9 +49,8 @@ namespace Mono.CSharp { Modifiers.INTERNAL | Modifiers.PRIVATE; - public Enum (NamespaceEntry ns, TypeContainer parent, Expression type, int mod_flags, - string name, Attributes attrs, Location l) - : base (ns, parent, name, l) + public Enum (TypeContainer parent, Expression type, int mod_flags, string name, Attributes attrs, Location l) + : base (parent, name, l) { this.BaseType = type; ModFlags = Modifiers.Check (AllowedModifiers, mod_flags, diff --git a/mcs/mcs/expression.cs b/mcs/mcs/expression.cs index 2df3981c917..3096ef1d02a 100755 --- a/mcs/mcs/expression.cs +++ b/mcs/mcs/expression.cs @@ -826,9 +826,6 @@ namespace Mono.CSharp { // type = expr_type; if (expr.eclass == ExprClass.Variable){ - LocalVariableReference var = expr as LocalVariableReference; - if ((var != null) && var.IsReadOnly) - Error (1604, "cannot assign to `" + var.Name + "' because it is readonly"); if (IsIncrementableNumber (expr_type) || expr_type == TypeManager.decimal_type){ return this; @@ -1090,8 +1087,6 @@ namespace Mono.CSharp { return null; expr = expr.Resolve (ec); - if (expr == null) - return null; return this; } diff --git a/mcs/mcs/flowanalysis.cs b/mcs/mcs/flowanalysis.cs index cab8a5108a5..6abe2e956e6 100644 --- a/mcs/mcs/flowanalysis.cs +++ b/mcs/mcs/flowanalysis.cs @@ -20,7 +20,7 @@ namespace Mono.CSharp // A new instance of this class is created every time a new block is resolved // and if there's branching in the block's control flow. // </summary> - public abstract class FlowBranching + public class FlowBranching { // <summary> // The type of a FlowBranching. @@ -80,20 +80,6 @@ namespace Mono.CSharp Unreachable } - public static FlowBranching CreateBranching (FlowBranching parent, BranchingType type, Block block, Location loc) - { - switch (type) { - case BranchingType.Exception: - return new FlowBranchingException (parent, type, block, loc); - - case BranchingType.Switch: - return new FlowBranchingBlock (parent, type, SiblingType.SwitchSection, block, loc); - - default: - return new FlowBranchingBlock (parent, type, SiblingType.Conditional, block, loc); - } - } - // <summary> // The type of this flow branching. // </summary> @@ -116,6 +102,12 @@ namespace Mono.CSharp public readonly Location Location; // <summary> + // A list of UsageVectors. A new vector is added each time control flow may + // take a different path. + // </summary> + public UsageVector[] Siblings; + + // <summary> // If this is an infinite loop. // </summary> public bool Infinite; @@ -129,6 +121,7 @@ namespace Mono.CSharp // Private // VariableMap param_map, local_map; + ArrayList finally_vectors; static int next_id = 0; int id; @@ -140,8 +133,6 @@ namespace Mono.CSharp // </summary> public static FlowReturns AndFlowReturns (FlowReturns a, FlowReturns b) { - if (a == FlowReturns.Undefined) - return b; if (b == FlowReturns.Unreachable) return a; @@ -179,16 +170,6 @@ namespace Mono.CSharp // </summary> public class UsageVector { // <summary> - // The type of this branching. - // </summary> - public readonly SiblingType Type; - - // <summary> - // Start location of this branching. - // </summary> - public readonly Location Location; - - // <summary> // If this is true, then the usage vector has been modified and must be // merged when we're done with this branching. // </summary> @@ -215,7 +196,7 @@ namespace Mono.CSharp // Private. // MyBitVector locals, parameters; - FlowReturns RealReturns, RealBreaks, RealReachable; + FlowReturns real_returns, real_breaks; bool is_finally; static int next_id = 0; @@ -224,23 +205,20 @@ namespace Mono.CSharp // // Normally, you should not use any of these constructors. // - public UsageVector (SiblingType type, UsageVector parent, Location loc, int num_params, int num_locals) + public UsageVector (UsageVector parent, int num_params, int num_locals) { - this.Type = type; - this.Location = loc; this.InheritsFrom = parent; this.CountParameters = num_params; this.CountLocals = num_locals; - this.RealReturns = FlowReturns.Never; - this.RealBreaks = FlowReturns.Never; - this.RealReachable = FlowReturns.Always; + this.real_returns = FlowReturns.Never; + this.real_breaks = FlowReturns.Never; if (parent != null) { locals = new MyBitVector (parent.locals, CountLocals); if (num_params > 0) parameters = new MyBitVector (parent.parameters, num_params); - RealReturns = parent.Returns; - RealBreaks = parent.Breaks; + real_returns = parent.Returns; + real_breaks = parent.Breaks; } else { locals = new MyBitVector (null, CountLocals); if (num_params > 0) @@ -250,8 +228,8 @@ namespace Mono.CSharp id = ++next_id; } - public UsageVector (SiblingType type, UsageVector parent, Location loc) - : this (type, parent, loc, parent.CountParameters, parent.CountLocals) + public UsageVector (UsageVector parent) + : this (parent, parent.CountParameters, parent.CountLocals) { } // <summary> @@ -259,14 +237,13 @@ namespace Mono.CSharp // </summary> public UsageVector Clone () { - UsageVector retval = new UsageVector (Type, null, Location, CountParameters, CountLocals); + UsageVector retval = new UsageVector (null, CountParameters, CountLocals); retval.locals = locals.Clone (); if (parameters != null) retval.parameters = parameters.Clone (); - retval.RealReturns = RealReturns; - retval.RealBreaks = RealBreaks; - retval.RealReachable = RealReachable; + retval.real_returns = real_returns; + retval.real_breaks = real_breaks; return retval; } @@ -312,7 +289,11 @@ namespace Mono.CSharp // </summary> public FlowReturns Returns { get { - return RealReturns; + return real_returns; + } + + set { + real_returns = value; } } @@ -325,13 +306,11 @@ namespace Mono.CSharp // </summary> public FlowReturns Breaks { get { - return RealBreaks; + return real_breaks; } - } - public FlowReturns Reachable { - get { - return RealReachable; + set { + real_breaks = value; } } @@ -363,57 +342,141 @@ namespace Mono.CSharp } } - public void Break () + // <summary> + // Merge a child branching. + // </summary> + public FlowReturns MergeChildren (FlowBranching branching, UsageVector[] children) { - RealBreaks = FlowReturns.Always; - } + MyBitVector new_locals = null; + MyBitVector new_params = null; - public void Return () - { - RealReturns = FlowReturns.Always; - } + FlowReturns new_returns = FlowReturns.Never; + FlowReturns new_breaks = FlowReturns.Never; + bool new_returns_set = false, new_breaks_set = false; - public bool IsUnreachable { - get { - return (Reachable == FlowReturns.Exception) || - (Reachable == FlowReturns.Unreachable); - } - } + Report.Debug (2, "MERGING CHILDREN", branching, branching.Type, + this, children.Length); - public void Unreachable () - { - // If we're already unreachable, don't modify the reason why. - if (!IsUnreachable) - RealReachable = FlowReturns.Unreachable; - } + foreach (UsageVector child in children) { + Report.Debug (2, " MERGING CHILD", child, child.is_finally); + + if (!child.is_finally) { + if (child.Breaks != FlowReturns.Unreachable) { + // If Returns is already set, perform an + // `And' operation on it, otherwise just set just. + if (!new_returns_set) { + new_returns = child.Returns; + new_returns_set = true; + } else + new_returns = AndFlowReturns ( + new_returns, child.Returns); + } - public void NeverReachable () - { - // If we're already unreachable, don't modify the reason why. - if (!IsUnreachable) - RealReachable = FlowReturns.Never; - } + // If Breaks is already set, perform an + // `And' operation on it, otherwise just set just. + if (!new_breaks_set) { + new_breaks = child.Breaks; + new_breaks_set = true; + } else + new_breaks = AndFlowReturns ( + new_breaks, child.Breaks); + } - public void Throw () - { - // If we're already unreachable, don't modify the reason why. - if (!IsUnreachable) - RealReachable = FlowReturns.Exception; - } + // Ignore unreachable children. + if (child.Returns == FlowReturns.Unreachable) + continue; - // <summary> - // Merges a child branching. - // </summary> - public FlowReturns MergeChild (MyBitVector new_params, MyBitVector new_locals, - FlowReturns new_returns, FlowReturns new_breaks, - FlowReturns new_reachable) - { - Report.Debug (2, "MERGING CHILD", this, new_params, new_locals, new_returns, new_breaks, - new_reachable); + // A local variable is initialized after a flow branching if it + // has been initialized in all its branches which do neither + // always return or always throw an exception. + // + // If a branch may return, but does not always return, then we + // can treat it like a never-returning branch here: control will + // only reach the code position after the branching if we did not + // return here. + // + // It's important to distinguish between always and sometimes + // returning branches here: + // + // 1 int a; + // 2 if (something) { + // 3 return; + // 4 a = 5; + // 5 } + // 6 Console.WriteLine (a); + // + // The if block in lines 3-4 always returns, so we must not look + // at the initialization of `a' in line 4 - thus it'll still be + // uninitialized in line 6. + // + // On the other hand, the following is allowed: + // + // 1 int a; + // 2 if (something) + // 3 a = 5; + // 4 else + // 5 return; + // 6 Console.WriteLine (a); + // + // Here, `a' is initialized in line 3 and we must not look at + // line 5 since it always returns. + // + if (child.is_finally) { + if (new_locals == null) + new_locals = locals.Clone (); + new_locals.Or (child.locals); + + if (parameters != null) { + if (new_params == null) + new_params = parameters.Clone (); + new_params.Or (child.parameters); + } + } else { + if (!child.AlwaysReturns && !child.AlwaysBreaks) { + if (new_locals != null) + new_locals.And (child.locals); + else { + new_locals = locals.Clone (); + new_locals.Or (child.locals); + } + } else if (children.Length == 1) { + new_locals = locals.Clone (); + new_locals.Or (child.locals); + } - RealReturns = new_returns; - RealBreaks = new_breaks; - RealReachable = new_reachable; + // An `out' parameter must be assigned in all branches which do + // not always throw an exception. + if (parameters != null) { + bool and_params = child.Breaks != FlowReturns.Exception; + if (branching.Type == BranchingType.Exception) + and_params &= child.Returns != FlowReturns.Never; + if (and_params) { + if (new_params != null) + new_params.And (child.parameters); + else { + new_params = parameters.Clone (); + new_params.Or (child.parameters); + } + } else if ((children.Length == 1) || (new_params == null)) { + new_params = parameters.Clone (); + new_params.Or (child.parameters); + } + } + } + } + + Returns = new_returns; + if ((branching.Type == BranchingType.Block) || + (branching.Type == BranchingType.Exception) || + (new_breaks == FlowReturns.Unreachable) || + (new_breaks == FlowReturns.Exception)) + Breaks = new_breaks; + else if (branching.Type == BranchingType.SwitchSection) + Breaks = new_returns; + else if (branching.Type == BranchingType.Switch){ + if (new_breaks == FlowReturns.Always) + Breaks = FlowReturns.Always; + } // // We've now either reached the point after the branching or we will @@ -424,17 +487,10 @@ namespace Mono.CSharp // we need to look at (see above). // - Report.Debug (2, "MERGING CHILD #1", this, Returns, Breaks, Reachable, new_locals, new_params); - - if ((Reachable == FlowReturns.Always) || (Reachable == FlowReturns.Sometimes) || - (Reachable == FlowReturns.Never)) { - if ((Returns == FlowReturns.Always) || (Breaks == FlowReturns.Always)) - RealReachable = FlowReturns.Never; - if ((Type == SiblingType.SwitchSection) && (Reachable != FlowReturns.Never)) { - Report.Error (163, Location, "Control cannot fall through from one " + - "case label to another"); - } - + if (((new_breaks != FlowReturns.Always) && + (new_breaks != FlowReturns.Exception) && + (new_breaks != FlowReturns.Unreachable)) || + (children.Length == 1)) { if (new_locals != null) locals.Or (new_locals); @@ -442,9 +498,56 @@ namespace Mono.CSharp parameters.Or (new_params); } - Report.Debug (2, "MERGING CHILD DONE", this); + Report.Debug (2, "MERGING CHILDREN DONE", branching.Type, + new_params, new_locals, new_returns, new_breaks, + branching.Infinite, branching.MayLeaveLoop, this); + + if (branching.Type == BranchingType.SwitchSection) { + if ((new_breaks != FlowReturns.Always) && + (new_breaks != FlowReturns.Exception) && + (new_breaks != FlowReturns.Unreachable)) + Report.Error (163, branching.Location, + "Control cannot fall through from one " + + "case label to another"); + } + + if (branching.Infinite && !branching.MayLeaveLoop) { + Report.Debug (1, "INFINITE", new_returns, new_breaks, + Returns, Breaks, this); + + // We're actually infinite. + if (new_returns == FlowReturns.Never) { + Breaks = FlowReturns.Unreachable; + return FlowReturns.Unreachable; + } + + // If we're an infinite loop and do not break, the code after + // the loop can never be reached. However, if we may return + // from the loop, then we do always return (or stay in the loop + // forever). + if ((new_returns == FlowReturns.Sometimes) || + (new_returns == FlowReturns.Always)) { + Returns = FlowReturns.Always; + return FlowReturns.Always; + } + } + + if (branching.Type == BranchingType.LoopBlock) { + Report.Debug (2, "MERGING LOOP BLOCK DONE", branching, + branching.Infinite, branching.MayLeaveLoop, + new_breaks, new_returns); + + // If we may leave the loop, then we do not always return. + if (branching.MayLeaveLoop && (new_returns == FlowReturns.Always)) { + Returns = FlowReturns.Sometimes; + return FlowReturns.Sometimes; + } - return Returns; + // A `break' in a loop does not "break" in the outer block. + Breaks = FlowReturns.Never; + } + + return new_returns; } // <summary> @@ -471,13 +574,8 @@ namespace Mono.CSharp { Report.Debug (1, "MERGING JUMP ORIGIN", this); - RealBreaks = FlowReturns.Never; - RealReturns = FlowReturns.Never; - if (Reachable != FlowReturns.Always) - RealReachable = FlowReturns.Always; - - if (origin_vectors == null) - return; + real_breaks = FlowReturns.Never; + real_returns = FlowReturns.Never; foreach (UsageVector vector in origin_vectors) { Report.Debug (1, " MERGING JUMP ORIGIN", vector); @@ -485,9 +583,8 @@ namespace Mono.CSharp locals.And (vector.locals); if (parameters != null) parameters.And (vector.parameters); - RealBreaks = AndFlowReturns (RealBreaks, vector.Breaks); - RealReturns = AndFlowReturns (RealReturns, vector.Returns); - RealReachable = AndFlowReturns (RealReachable, vector.Reachable); + Breaks = AndFlowReturns (Breaks, vector.Breaks); + Returns = AndFlowReturns (Returns, vector.Returns); } Report.Debug (1, "MERGING JUMP ORIGIN DONE", this); @@ -501,14 +598,14 @@ namespace Mono.CSharp { Report.Debug (1, "MERGING FINALLY ORIGIN", this); - RealBreaks = FlowReturns.Never; + real_breaks = FlowReturns.Never; foreach (UsageVector vector in finally_vectors) { Report.Debug (1, " MERGING FINALLY ORIGIN", vector); if (parameters != null) parameters.And (vector.parameters); - RealBreaks = AndFlowReturns (Breaks, vector.Breaks); + Breaks = AndFlowReturns (Breaks, vector.Breaks); } is_finally = true; @@ -540,18 +637,6 @@ namespace Mono.CSharp locals.And (new_vector.locals); } - public bool HasParameters { - get { - return parameters != null; - } - } - - public bool HasLocals { - get { - return locals != null; - } - } - // <summary> // Returns a deep copy of the parameters. // </summary> @@ -573,18 +658,6 @@ namespace Mono.CSharp } } - public MyBitVector ParameterVector { - get { - return parameters; - } - } - - public MyBitVector LocalVector { - get { - return locals; - } - } - // // Debugging stuff. // @@ -599,8 +672,6 @@ namespace Mono.CSharp sb.Append (Returns); sb.Append (","); sb.Append (Breaks); - sb.Append (","); - sb.Append (Reachable); if (parameters != null) { sb.Append (" - "); sb.Append (parameters); @@ -613,64 +684,115 @@ namespace Mono.CSharp } } + FlowBranching (BranchingType type, Location loc) + { + this.Block = null; + this.Location = loc; + this.Type = type; + id = ++next_id; + } + + // <summary> + // Creates a new flow branching for `block'. + // This is used from Block.Resolve to create the top-level branching of + // the block. + // </summary> + public FlowBranching (Block block, Location loc) + : this (BranchingType.Block, loc) + { + Block = block; + Parent = null; + + param_map = block.ParameterMap; + local_map = block.LocalMap; + + UsageVector vector = new UsageVector (null, param_map.Length, local_map.Length); + + AddSibling (vector); + } + // <summary> // Creates a new flow branching which is contained in `parent'. // You should only pass non-null for the `block' argument if this block // introduces any new variables - in this case, we need to create a new // usage vector with a different size than our parent's one. // </summary> - protected FlowBranching (FlowBranching parent, BranchingType type, SiblingType stype, - Block block, Location loc) + public FlowBranching (FlowBranching parent, BranchingType type, + Block block, Location loc) + : this (type, loc) { Parent = parent; Block = block; - Location = loc; - Type = type; - id = ++next_id; UsageVector vector; if (Block != null) { param_map = Block.ParameterMap; local_map = Block.LocalMap; - UsageVector parent_vector = parent != null ? parent.CurrentUsageVector : null; - vector = new UsageVector (stype, parent_vector, loc, param_map.Length, local_map.Length); + vector = new UsageVector (parent.CurrentUsageVector, param_map.Length, + local_map.Length); } else { param_map = Parent.param_map; local_map = Parent.local_map; - vector = new UsageVector (stype, Parent.CurrentUsageVector, loc); + vector = new UsageVector (Parent.CurrentUsageVector); } AddSibling (vector); + + switch (Type) { + case BranchingType.Exception: + finally_vectors = new ArrayList (); + break; + + default: + break; + } + } + + void AddSibling (UsageVector uv) + { + if (Siblings != null) { + UsageVector[] ns = new UsageVector [Siblings.Length + 1]; + for (int i = 0; i < Siblings.Length; ++i) + ns [i] = Siblings [i]; + Siblings = ns; + } else { + Siblings = new UsageVector [1]; + } + Siblings [Siblings.Length - 1] = uv; } - public abstract UsageVector CurrentUsageVector { - get; - } + // <summary> + // Returns the branching's current usage vector. + // </summary> + public UsageVector CurrentUsageVector + { + get { + return Siblings [Siblings.Length - 1]; + } + } // <summary> // Creates a sibling of the current usage vector. // </summary> - public virtual void CreateSibling (SiblingType type) + public void CreateSibling (SiblingType type) { - AddSibling (new UsageVector (type, Parent.CurrentUsageVector, Location)); + AddSibling (new UsageVector (Parent.CurrentUsageVector)); Report.Debug (1, "CREATED SIBLING", CurrentUsageVector); - } - protected abstract void AddSibling (UsageVector uv); - - public abstract void Break (); - public abstract void Return (); - public abstract void Goto (); - public abstract void Throw (); - public abstract void Label (ArrayList origin_vectors); + if (type == SiblingType.Finally) + CurrentUsageVector.MergeFinallyOrigins (finally_vectors); + } // <summary> // Check whether all `out' parameters have been assigned. // </summary> public void CheckOutParameters (MyBitVector parameters, Location loc) { + if (InTryBlock ()) + return; + for (int i = 0; i < param_map.Count; i++) { VariableInfo var = param_map [i]; @@ -686,145 +808,20 @@ namespace Mono.CSharp } } - protected class MergeResult - { - public MyBitVector Parameters; - public MyBitVector Locals; - public FlowReturns Returns; - public FlowReturns Breaks; - public FlowReturns Reachable; - public bool MayLeaveLoop; - - public MergeResult (MyBitVector parameters, MyBitVector locals, FlowReturns returns, FlowReturns breaks, - FlowReturns reachable, bool may_leave_loop) - { - this.Parameters = parameters; - this.Locals = locals; - this.Returns = returns; - this.Breaks = breaks; - this.Reachable = reachable; - this.MayLeaveLoop = may_leave_loop; - } - } - - protected MergeResult Merge (ArrayList children) - { - MyBitVector locals = null; - MyBitVector parameters = null; - - FlowReturns returns = FlowReturns.Undefined; - FlowReturns breaks = FlowReturns.Undefined; - FlowReturns reachable = FlowReturns.Undefined; - - Report.Debug (2, "MERGING CHILDREN", this, Type, children.Count); - - foreach (UsageVector child in children) { - Report.Debug (2, " MERGING CHILD", child, child.AlwaysBreaks, child.AlwaysReturns, - child.IsUnreachable, child.Locals, child.Parameters, - child.Returns, child.Breaks, child.Reachable); - - reachable = AndFlowReturns (reachable, child.Reachable); - - // Ignore unreachable children. - if (child.IsUnreachable) - continue; - - returns = AndFlowReturns (returns, child.Returns); - breaks = AndFlowReturns (breaks, child.Breaks); - - // A local variable is initialized after a flow branching if it - // has been initialized in all its branches which do neither - // always return or always throw an exception. - // - // If a branch may return, but does not always return, then we - // can treat it like a never-returning branch here: control will - // only reach the code position after the branching if we did not - // return here. - // - // It's important to distinguish between always and sometimes - // returning branches here: - // - // 1 int a; - // 2 if (something) { - // 3 return; - // 4 a = 5; - // 5 } - // 6 Console.WriteLine (a); - // - // The if block in lines 3-4 always returns, so we must not look - // at the initialization of `a' in line 4 - thus it'll still be - // uninitialized in line 6. - // - // On the other hand, the following is allowed: - // - // 1 int a; - // 2 if (something) - // 3 a = 5; - // 4 else - // 5 return; - // 6 Console.WriteLine (a); - // - // Here, `a' is initialized in line 3 and we must not look at - // line 5 since it always returns. - // - if (!child.AlwaysReturns && !child.AlwaysBreaks) - MyBitVector.And (ref locals, child.LocalVector); - - // An `out' parameter must be assigned in all branches which do - // not always throw an exception. - if ((child.Type != SiblingType.Catch) && - (child.ParameterVector != null) && (child.Breaks != FlowReturns.Exception)) - MyBitVector.And (ref parameters, child.ParameterVector); - } - - Report.Debug (2, "MERGING CHILDREN DONE", Type, parameters, locals, returns, breaks, reachable, - Infinite, MayLeaveLoop, this); - - if (Infinite && !MayLeaveLoop) { - Report.Debug (1, "INFINITE", returns, breaks, this); - - if (returns == FlowReturns.Never) { - // We're actually infinite. - breaks = FlowReturns.Unreachable; - returns = FlowReturns.Unreachable; - } else if ((returns == FlowReturns.Sometimes) || (returns == FlowReturns.Always)) { - // If we're an infinite loop and do not break, the code after - // the loop can never be reached. However, if we may return - // from the loop, then we do always return (or stay in the loop - // forever). - returns = FlowReturns.Always; - } - } - - if (returns == FlowReturns.Undefined) - returns = FlowReturns.Never; - if (breaks == FlowReturns.Undefined) - breaks = FlowReturns.Never; - - return new MergeResult (parameters, locals, returns, breaks, reachable, MayLeaveLoop); - } - - protected abstract MergeResult Merge (); - // <summary> // Merge a child branching. // </summary> public FlowReturns MergeChild (FlowBranching child) { - MergeResult result = child.Merge (); - - CurrentUsageVector.MergeChild ( - result.Parameters, result.Locals, result.Returns, result.Breaks, result.Reachable); + FlowReturns returns = CurrentUsageVector.MergeChildren (child, child.Siblings); - if ((child.Type != BranchingType.LoopBlock) && (child.Type != BranchingType.SwitchSection)) + if ((child.Type != BranchingType.LoopBlock) && + (child.Type != BranchingType.SwitchSection)) MayLeaveLoop |= child.MayLeaveLoop; - if (result.Reachable == FlowReturns.Exception) - return FlowReturns.Exception; - else - return result.Returns; + return returns; } - + // <summary> // Does the toplevel merging. // </summary> @@ -833,30 +830,46 @@ namespace Mono.CSharp if ((Type != BranchingType.Block) || (Block == null)) throw new NotSupportedException (); - UsageVector vector = new UsageVector ( - SiblingType.Conditional, null, Location, param_map.Length, local_map.Length); + UsageVector vector = new UsageVector (null, param_map.Length, local_map.Length); - MergeResult result = Merge (); - vector.MergeChild (result.Parameters, result.Locals, result.Returns, result.Breaks, result.Reachable); + Report.Debug (1, "MERGING TOP BLOCK", Location, vector); - if (vector.Reachable != FlowReturns.Exception) - CheckOutParameters (vector.Parameters, Location); - else - return FlowReturns.Exception; + vector.MergeChildren (this, Siblings); - return result.Returns; + if (Siblings.Length == 1) + Siblings [0] = vector; + else { + Siblings = null; + AddSibling (vector); + } + + Report.Debug (1, "MERGING TOP BLOCK DONE", Location, vector); + + if (vector.Breaks != FlowReturns.Exception) { + if (!vector.AlwaysBreaks) + CheckOutParameters (CurrentUsageVector.Parameters, Location); + return vector.AlwaysBreaks ? FlowReturns.Always : vector.Returns; + } else + return FlowReturns.Exception; } - public virtual bool InTryBlock () + public bool InTryBlock () { - if (Parent != null) + if (finally_vectors != null) + return true; + else if (Parent != null) return Parent.InTryBlock (); else return false; } - public virtual void AddFinallyVector (UsageVector vector) + public void AddFinallyVector (UsageVector vector) { + if (finally_vectors != null) { + finally_vectors.Add (vector.Clone ()); + return; + } + if (Parent != null) Parent.AddFinallyVector (vector); else @@ -886,11 +899,45 @@ namespace Mono.CSharp CurrentUsageVector.SetFieldAssigned (vi, name); } + public bool IsReachable () + { + bool reachable; + + switch (Type) { + case BranchingType.SwitchSection: + // The code following a switch block is reachable unless the switch + // block always returns. + reachable = !CurrentUsageVector.AlwaysReturns; + break; + + case BranchingType.LoopBlock: + // The code following a loop is reachable unless the loop always + // returns or it's an infinite loop without any `break's in it. + reachable = !CurrentUsageVector.AlwaysReturns && + (CurrentUsageVector.Breaks != FlowReturns.Unreachable); + break; + + default: + // The code following a block or exception is reachable unless the + // block either always returns or always breaks. + if (MayLeaveLoop) + reachable = true; + else + reachable = !CurrentUsageVector.AlwaysBreaks && + !CurrentUsageVector.AlwaysReturns; + break; + } + + Report.Debug (1, "REACHABLE", this, Type, CurrentUsageVector.Returns, + CurrentUsageVector.Breaks, CurrentUsageVector, MayLeaveLoop, + reachable); + + return reachable; + } + public override string ToString () { - StringBuilder sb = new StringBuilder (); - sb.Append (GetType ()); - sb.Append (" ("); + StringBuilder sb = new StringBuilder ("FlowBranching ("); sb.Append (id); sb.Append (","); @@ -902,175 +949,14 @@ namespace Mono.CSharp sb.Append (Block.StartLocation); } sb.Append (" - "); - // sb.Append (Siblings.Length); - // sb.Append (" - "); + sb.Append (Siblings.Length); + sb.Append (" - "); sb.Append (CurrentUsageVector); sb.Append (")"); return sb.ToString (); } } - public class FlowBranchingBlock : FlowBranching - { - UsageVector current_vector; - ArrayList siblings = new ArrayList (); - - public FlowBranchingBlock (FlowBranching parent, BranchingType type, SiblingType stype, - Block block, Location loc) - : base (parent, type, stype, block, loc) - { } - - public override UsageVector CurrentUsageVector { - get { return current_vector; } - } - - protected override void AddSibling (UsageVector sibling) - { - siblings.Add (sibling); - current_vector = sibling; - } - - public override void Break () - { - if (Type == BranchingType.SwitchSection) - CurrentUsageVector.NeverReachable (); - else { - if (Type == BranchingType.LoopBlock) - MayLeaveLoop = true; - CurrentUsageVector.Break (); - } - } - - public override void Return () - { - CurrentUsageVector.Return (); - } - - public override void Goto () - { - CurrentUsageVector.Unreachable (); - } - - public override void Throw () - { - CurrentUsageVector.Throw (); - } - - public override void Label (ArrayList origin_vectors) - { - CurrentUsageVector.MergeJumpOrigins (origin_vectors); - } - - protected override MergeResult Merge () - { - MergeResult result = Merge (siblings); - if (Type == BranchingType.LoopBlock) - result.MayLeaveLoop = false; - return result; - } - } - - public class FlowBranchingException : FlowBranching - { - ArrayList finally_vectors; - - bool has_params; - UsageVector current_vector; - UsageVector try_vector; - ArrayList catch_vectors = new ArrayList (); - UsageVector finally_vector; - - public FlowBranchingException (FlowBranching parent, BranchingType type, Block block, Location loc) - : base (parent, type, SiblingType.Try, block, loc) - { - finally_vectors = new ArrayList (); - has_params = current_vector.HasParameters; - } - - protected override void AddSibling (UsageVector sibling) - { - if (sibling.Type == SiblingType.Try) { - try_vector = sibling; - catch_vectors.Add (sibling); - } else if (sibling.Type == SiblingType.Catch) - catch_vectors.Add (sibling); - else if (sibling.Type == SiblingType.Finally) { - // sibling.MergeFinallyOrigins (finally_vectors); - finally_vector = sibling; - } else - throw new InvalidOperationException (); - - current_vector = sibling; - } - - public override UsageVector CurrentUsageVector { - get { return current_vector; } - } - - public override bool InTryBlock () - { - return true; - } - - public override void AddFinallyVector (UsageVector vector) - { - finally_vectors.Add (vector.Clone ()); - } - - public override void Break () - { - CurrentUsageVector.Break (); - } - - public override void Return () - { - CurrentUsageVector.Return (); - } - - public override void Goto () - { - CurrentUsageVector.Unreachable (); - } - - public override void Throw () - { - CurrentUsageVector.Throw (); - } - - public override void Label (ArrayList origin_vectors) - { - CurrentUsageVector.MergeJumpOrigins (origin_vectors); - } - - protected void MergeFinally (MyBitVector f_params, ref MergeResult result) - { - foreach (UsageVector vector in finally_vectors) { - MyBitVector temp_params = f_params.Clone (); - temp_params.Or (vector.Parameters); - - CheckOutParameters (temp_params, Location); - } - } - - protected override MergeResult Merge () - { - MergeResult result = Merge (catch_vectors); - - if (has_params) { - if (finally_vector != null) { - MergeFinally (finally_vector.Parameters, ref result); - MyBitVector.Or (ref result.Parameters, finally_vector.ParameterVector); - } else - MergeFinally (result.Parameters, ref result); - } - - if (finally_vector != null) - MyBitVector.Or (ref result.Locals, finally_vector.LocalVector); - - return result; - } - } - // <summary> // This is used by the flow analysis code to keep track of the type of local variables // and variables. @@ -1681,6 +1567,7 @@ namespace Mono.CSharp } } + // <summary> // This is a special bit vector which can inherit from another bit vector doing a // copy-on-write strategy. The inherited vector may have a smaller size than the @@ -1813,22 +1700,6 @@ namespace Mono.CSharp vector [i] = false; } - public static void And (ref MyBitVector target, MyBitVector vector) - { - if (target != null) - target.And (vector); - else - target = vector.Clone (); - } - - public static void Or (ref MyBitVector target, MyBitVector vector) - { - if (target != null) - target.Or (vector); - else - target = vector.Clone (); - } - // <summary> // This does a deep copy of the bit vector. // </summary> diff --git a/mcs/mcs/interface.cs b/mcs/mcs/interface.cs index 8c9958a08ab..653ab1d9ebf 100755 --- a/mcs/mcs/interface.cs +++ b/mcs/mcs/interface.cs @@ -71,9 +71,8 @@ namespace Mono.CSharp { Modifiers.UNSAFE | Modifiers.PRIVATE; - public Interface (NamespaceEntry ns, TypeContainer parent, string name, int mod, - Attributes attrs, Location l) - : base (ns, parent, name, l) + public Interface (TypeContainer parent, string name, int mod, Attributes attrs, Location l) + : base (parent, name, l) { ModFlags = Modifiers.Check (AllowedModifiers, mod, Modifiers.PRIVATE, l); OptAttributes = attrs; @@ -342,13 +341,19 @@ namespace Mono.CSharp { return; } - // - // Labelling of parameters is taken care of - // during the Emit phase via - // MethodCore.LabelParameters method so I am - // removing the old code here. - // - + // + // Define each type attribute (in/out/ref) and + // the argument names. + // + p = im.Parameters.FixedParameters; + if (p != null){ + for (i = 0; i < p.Length; i++) + mb.DefineParameter (i + 1, p [i].Attributes, p [i].Name); + + if (i != arg_types.Length) + Console.WriteLine ("Implement the type definition for params"); + } + im.Builder = mb; } @@ -879,17 +884,10 @@ namespace Mono.CSharp { foreach (InterfaceMethod im in defined_method) { EmitContext ec = new EmitContext (tc, this, Location, null, im.ReturnType.Type, ModFlags, false); - - MethodCore.LabelParameters (ec, im.Builder, - im.Parameters, - im.OptAttributes, - Location); if (im.OptAttributes != null) - Attribute.ApplyAttributes (ec, im.Builder, - im, im.OptAttributes); - - } + Attribute.ApplyAttributes (ec, im.Builder, im, im.OptAttributes); + } } if (defined_properties != null) { diff --git a/mcs/mcs/iterators.cs b/mcs/mcs/iterators.cs index 21ac8756b1e..10be47f48a5 100644 --- a/mcs/mcs/iterators.cs +++ b/mcs/mcs/iterators.cs @@ -96,7 +96,8 @@ namespace Mono.CSharp { if (!Yield.CheckContext (ec, loc)) return false; - ec.CurrentBranching.Goto (); + ec.CurrentBranching.CurrentUsageVector.Breaks = FlowBranching.FlowReturns.Always; + ec.CurrentBranching.CurrentUsageVector.Returns = FlowBranching.FlowReturns.Always; return true; } diff --git a/mcs/mcs/namespace.cs b/mcs/mcs/namespace.cs index 584a20a0ff0..414249a3142 100755 --- a/mcs/mcs/namespace.cs +++ b/mcs/mcs/namespace.cs @@ -23,7 +23,6 @@ namespace Mono.CSharp { string name, fullname; ArrayList entries; Hashtable namespaces; - Hashtable defined_names; /// <summary> /// Constructor Takes the current namespace and the @@ -44,7 +43,6 @@ namespace Mono.CSharp { entries = new ArrayList (); namespaces = new Hashtable (); - defined_names = new Hashtable (); all_namespaces.Add (this); if (namespaces_map.Contains (fullname)) @@ -92,22 +90,11 @@ namespace Mono.CSharp { public object Lookup (DeclSpace ds, string name) { - object o = Lookup (name); - - Type t; - DeclSpace tdecl = o as DeclSpace; - if (tdecl != null) { - t = tdecl.DefineType (); - - if ((ds == null) || ds.CheckAccessLevel (t)) - return t; - } - Namespace ns = GetNamespace (name, false); if (ns != null) return ns; - t = TypeManager.LookupType (DeclSpace.MakeFQN (fullname, name)); + Type t = TypeManager.LookupType (DeclSpace.MakeFQN (fullname, name)); if ((t == null) || ((ds != null) && !ds.CheckAccessLevel (t))) return null; @@ -119,16 +106,6 @@ namespace Mono.CSharp { entries.Add (entry); } - public void DefineName (string name, object o) - { - defined_names.Add (name, o); - } - - public object Lookup (string name) - { - return defined_names [name]; - } - static public ArrayList UserDefinedNamespaces { get { return all_namespaces; @@ -264,11 +241,11 @@ namespace Mono.CSharp { } } - public NamespaceEntry (NamespaceEntry parent, SourceFile file, string name, Location loc) - : this (parent, file, name, false, loc) + public NamespaceEntry (NamespaceEntry parent, SourceFile file, string name) + : this (parent, file, name, false) { } - protected NamespaceEntry (NamespaceEntry parent, SourceFile file, string name, bool is_implicit, Location loc) + protected NamespaceEntry (NamespaceEntry parent, SourceFile file, string name, bool is_implicit) { this.parent = parent; this.file = file; @@ -284,18 +261,21 @@ namespace Mono.CSharp { ns.AddNamespaceEntry (this); if ((parent != null) && (parent.NS != ns.Parent)) - implicit_parent = new NamespaceEntry (parent, file, ns.Parent.Name, true, loc); + implicit_parent = new NamespaceEntry (parent, file, ns.Parent.Name, true); else implicit_parent = parent; - - this.FullName = ns.Name; } static int next_id = 0; - public readonly string FullName; public readonly int ID; public readonly bool IsImplicit; + public string Name { + get { + return ns.Name; + } + } + public Namespace NS { get { return ns; @@ -314,11 +294,6 @@ namespace Mono.CSharp { } } - public void DefineName (string name, object o) - { - ns.DefineName (name, o); - } - /// <summary> /// Records a new namespace for resolving name references /// </summary> @@ -329,7 +304,7 @@ namespace Mono.CSharp { return; } - if (ns == FullName) + if (ns == Name) return; if (using_clauses == null) @@ -586,7 +561,7 @@ namespace Mono.CSharp { if (NS == Namespace.Root) return "NamespaceEntry (<root>)"; else - return String.Format ("NamespaceEntry ({0},{1},{2})", FullName, IsImplicit, ID); + return String.Format ("NamespaceEntry ({0},{1},{2})", Name, IsImplicit, ID); } } } diff --git a/mcs/mcs/report.cs b/mcs/mcs/report.cs index d7b027c6ebd..f5c90e4b4dd 100644 --- a/mcs/mcs/report.cs +++ b/mcs/mcs/report.cs @@ -153,26 +153,6 @@ namespace Mono.CSharp { Check (code); } - static public void Error (int code, Location loc, string format, params object[] args) - { - Error (code, loc, String.Format (format, args)); - } - - static public void Error (int code, string format, params object[] args) - { - Error (code, String.Format (format, args)); - } - - static public void Warning (int code, Location loc, string format, params object[] args) - { - Warning (code, loc, String.Format (format, args)); - } - - static public void Warning (int code, string format, params object[] args) - { - Warning (code, String.Format (format, args)); - } - static public void Message (Message m) { if (m is ErrorMessage) diff --git a/mcs/mcs/rootcontext.cs b/mcs/mcs/rootcontext.cs index 67ef6b9baf2..f4a3824bb28 100755 --- a/mcs/mcs/rootcontext.cs +++ b/mcs/mcs/rootcontext.cs @@ -705,7 +705,7 @@ namespace Mono.CSharp { // if (global_attributes.Count > 0){ AssemblyBuilder ab = CodeGen.AssemblyBuilder; - TypeContainer dummy = new TypeContainer (null, null, "", new Location (-1)); + TypeContainer dummy = new TypeContainer (null, "", new Location (-1)); EmitContext temp_ec = new EmitContext ( dummy, Mono.CSharp.Location.Null, null, null, 0, false); diff --git a/mcs/mcs/statement.cs b/mcs/mcs/statement.cs index 3430fedc18e..076e9ca19d0 100755 --- a/mcs/mcs/statement.cs +++ b/mcs/mcs/statement.cs @@ -605,7 +605,8 @@ namespace Mono.CSharp { else vector.CheckOutParameters (ec.CurrentBranching); - ec.CurrentBranching.Return (); + vector.Returns = FlowBranching.FlowReturns.Always; + vector.Breaks = FlowBranching.FlowReturns.Always; return true; } @@ -676,7 +677,8 @@ namespace Mono.CSharp { if (!label.IsDefined) label.AddUsageVector (ec.CurrentBranching.CurrentUsageVector); - ec.CurrentBranching.Goto (); + ec.CurrentBranching.CurrentUsageVector.Breaks = FlowBranching.FlowReturns.Always; + ec.CurrentBranching.CurrentUsageVector.Returns = FlowBranching.FlowReturns.Always; return true; } @@ -750,7 +752,12 @@ namespace Mono.CSharp { public override bool Resolve (EmitContext ec) { - ec.CurrentBranching.Label (vectors); + if (vectors != null) + ec.CurrentBranching.CurrentUsageVector.MergeJumpOrigins (vectors); + else { + ec.CurrentBranching.CurrentUsageVector.Breaks = FlowBranching.FlowReturns.Never; + ec.CurrentBranching.CurrentUsageVector.Returns = FlowBranching.FlowReturns.Never; + } referenced = true; @@ -779,7 +786,8 @@ namespace Mono.CSharp { public override bool Resolve (EmitContext ec) { - ec.CurrentBranching.Goto (); + ec.CurrentBranching.CurrentUsageVector.Breaks = FlowBranching.FlowReturns.Always; + ec.CurrentBranching.CurrentUsageVector.Returns = FlowBranching.FlowReturns.Always; return true; } @@ -845,7 +853,8 @@ namespace Mono.CSharp { label = sl.ILLabelCode; - ec.CurrentBranching.Goto (); + ec.CurrentBranching.CurrentUsageVector.Breaks = FlowBranching.FlowReturns.Unreachable; + ec.CurrentBranching.CurrentUsageVector.Returns = FlowBranching.FlowReturns.Always; return true; } @@ -892,7 +901,8 @@ namespace Mono.CSharp { } } - ec.CurrentBranching.Throw (); + ec.CurrentBranching.CurrentUsageVector.Returns = FlowBranching.FlowReturns.Exception; + ec.CurrentBranching.CurrentUsageVector.Breaks = FlowBranching.FlowReturns.Exception; return true; } @@ -928,7 +938,7 @@ namespace Mono.CSharp { public override bool Resolve (EmitContext ec) { ec.CurrentBranching.MayLeaveLoop = true; - ec.CurrentBranching.Break (); + ec.CurrentBranching.CurrentUsageVector.Breaks = FlowBranching.FlowReturns.Always; return true; } @@ -959,7 +969,7 @@ namespace Mono.CSharp { public override bool Resolve (EmitContext ec) { - ec.CurrentBranching.Goto (); + ec.CurrentBranching.CurrentUsageVector.Breaks = FlowBranching.FlowReturns.Always; return true; } @@ -1743,7 +1753,7 @@ namespace Mono.CSharp { if (s is LabeledStatement) unreachable = false; else - unreachable = ec.CurrentBranching.CurrentUsageVector.IsUnreachable; + unreachable = ! ec.CurrentBranching.IsReachable (); new_statements.Add (s); } @@ -1768,8 +1778,6 @@ namespace Mono.CSharp { "This label has not been referenced"); } - Report.Debug (1, "RESOLVE BLOCK DONE #2", StartLocation, returns); - if ((returns == FlowBranching.FlowReturns.Always) || (returns == FlowBranching.FlowReturns.Exception) || (returns == FlowBranching.FlowReturns.Unreachable)) @@ -2850,7 +2858,6 @@ namespace Mono.CSharp { Expression e = (Expression) p.Second; vi.VariableInfo = null; - vi.ReadOnly = true; // // The rules for the possible declarators are pretty wise, @@ -3148,6 +3155,13 @@ namespace Mono.CSharp { ok = false; ec.InCatch = old_in_catch; + + FlowBranching.UsageVector current = ec.CurrentBranching.CurrentUsageVector; + + if (!current.AlwaysReturns && !current.AlwaysBreaks) + vector.AndLocals (current); + else + vector.Or (current); } Report.Debug (1, "END OF CATCH BLOCKS", ec.CurrentBranching); @@ -3163,6 +3177,13 @@ namespace Mono.CSharp { ok = false; ec.InCatch = old_in_catch; + + FlowBranching.UsageVector current = ec.CurrentBranching.CurrentUsageVector; + + if (!current.AlwaysReturns && !current.AlwaysBreaks) + vector.AndLocals (current); + else + vector.Or (current); } Report.Debug (1, "END OF GENERAL CATCH BLOCKS", ec.CurrentBranching); @@ -3185,7 +3206,15 @@ namespace Mono.CSharp { FlowBranching.UsageVector f_vector = ec.CurrentBranching.CurrentUsageVector; - Report.Debug (1, "END OF TRY", ec.CurrentBranching, returns, vector, f_vector); + Report.Debug (1, "END OF FINALLY", ec.CurrentBranching, returns, vector, f_vector); + + if ((returns == FlowBranching.FlowReturns.Sometimes) || (returns == FlowBranching.FlowReturns.Always)) { + ec.CurrentBranching.CheckOutParameters (f_vector.Parameters, loc); + } + + ec.CurrentBranching.CurrentUsageVector.Or (vector); + + Report.Debug (1, "END OF TRY", ec.CurrentBranching); if (returns != FlowBranching.FlowReturns.Always) { // Unfortunately, System.Reflection.Emit automatically emits a leave @@ -3441,28 +3470,9 @@ namespace Mono.CSharp { if (!ResolveExpression (ec)) return false; - } - - ec.StartFlowBranching (FlowBranching.BranchingType.Block, loc); - - bool ok = Statement.Resolve (ec); + } - if (!ok) { - ec.KillFlowBranching (); - return false; - } - - FlowBranching.FlowReturns returns = ec.EndFlowBranching (); - - if (returns != FlowBranching.FlowReturns.Always) { - // Unfortunately, System.Reflection.Emit automatically emits a leave - // to the end of the finally block. This is a problem if `returns' - // is true since we may jump to a point after the end of the method. - // As a workaround, emit an explicit ret here. - ec.NeedExplicitReturn = true; - } - - return true; + return Statement.Resolve (ec); } protected override bool DoEmit (EmitContext ec) diff --git a/mcs/mcs/tree.cs b/mcs/mcs/tree.cs index 0f3a2d9244a..4d571375ef3 100755 --- a/mcs/mcs/tree.cs +++ b/mcs/mcs/tree.cs @@ -45,7 +45,7 @@ namespace Mono.CSharp public Tree () { - root_types = new TypeContainer (null, null, "", new Location (-1)); + root_types = new TypeContainer (null, "", new Location (-1)); decls = new Hashtable (); namespaces = new Hashtable (); @@ -65,8 +65,6 @@ namespace Mono.CSharp return; } - ds.RecordDecl (); - int p = name.LastIndexOf ('.'); if (p == -1) decl_ns_name.Insert ("", name, ds); @@ -85,21 +83,21 @@ namespace Mono.CSharp return (DeclSpace) res; } - public NamespaceEntry RecordNamespace (NamespaceEntry parent, SourceFile file, string name, Location loc) + public NamespaceEntry RecordNamespace (NamespaceEntry parent, SourceFile file, string name) { - NamespaceEntry ns = new NamespaceEntry (parent, file, name, loc); + NamespaceEntry ns = new NamespaceEntry (parent, file, name); if (namespaces.Contains (file)){ Hashtable ns_ns = (Hashtable) namespaces [file]; - if (ns_ns.Contains (ns.FullName)) - return (NamespaceEntry) ns_ns [ns.FullName]; - ns_ns.Add (ns.FullName, ns); + if (ns_ns.Contains (ns.Name)) + return (NamespaceEntry) ns_ns [ns.Name]; + ns_ns.Add (ns.Name, ns); } else { Hashtable new_table = new Hashtable (); namespaces [file] = new_table; - new_table.Add (ns.FullName, ns); + new_table.Add (ns.Name, ns); } return ns; diff --git a/mcs/mcs/typemanager.cs b/mcs/mcs/typemanager.cs index e546267782a..e3f3c056e28 100755 --- a/mcs/mcs/typemanager.cs +++ b/mcs/mcs/typemanager.cs @@ -2113,8 +2113,8 @@ public class TypeManager { [Flags] public enum MethodFlags { IsObsolete = 1, - IsObsoleteError = 1 << 1, - ShouldIgnore = 1 << 2 + IsObsoleteError = 2, + ShouldIgnore = 3 } // diff --git a/mcs/tests/ChangeLog b/mcs/tests/ChangeLog index 1f4ea773aba..10b07dd0635 100755 --- a/mcs/tests/ChangeLog +++ b/mcs/tests/ChangeLog @@ -1,35 +1,3 @@ -2003-09-02 Ravi Pratap <ravi@ximian.com> - - * test-102.cs: Improve test. - -2003-08-28 Martin Baulig <martin@ximian.com> - - * gen-3.cs: New generics test. - -2003-08-26 Martin Baulig <martin@ximian.com> - - * test-215.cs: New test for bug #47927. - -2003-08-26 Martin Baulig <martin@ximian.com> - - * verify-7.cs: New test for bug #47681. - -2003-08-26 Martin Baulig <martin@ximian.com> - - * test-214.cs: New test for bug #47853. - -2003-08-25 Martin Baulig <martin@ximian.com> - - * test-213.cs: New test for bug #47822. - -2003-08-22 Martin Baulig <martin@ximian.com> - - * test-154.cs: Added testcase for bug #46949. - -2003-08-22 Martin Baulig <martin@ximian.com> - - * test-154.cs: Added testcase for bug #47095. - 2003-08-04 Martin Baulig <martin@ximian.com> * Makefile: Put back test-211.cs. diff --git a/mcs/tests/Makefile b/mcs/tests/Makefile index c4079ad3401..b88a4685330 100644 --- a/mcs/tests/Makefile +++ b/mcs/tests/Makefile @@ -34,7 +34,7 @@ TEST_SOURCES = \ test-181 test-182 test-183 test-184 test-185 test-186 test-187 test-188 test-189 test-190 \ test-191 test-192 test-193 test-194 test-195 test-196 test-197 test-198 test-199 test-200 \ test-201 test-202 test-203 test-204 test-205 test-206 test-207 test-208 test-209 test-210 \ - test-211 test-212 test-213 test-214 test-215 + test-211 test-212 # # C# 2.0 tests diff --git a/mcs/tests/README.tests b/mcs/tests/README.tests index 1a6308749d5..9979c023181 100644 --- a/mcs/tests/README.tests +++ b/mcs/tests/README.tests @@ -63,7 +63,7 @@ Test cases listed by Category: * Type resolution and name lookup - test-198.cs test-201.cs test-202.cs test-203.cs test-214.cs + test-198.cs test-201.cs test-202.cs test-203.cs Test cases listed by Number: ============================ @@ -364,21 +364,6 @@ test-212.cs Params overload resolution with implicit user conversion -test-213.cs ------------ - -Unboxing struct from interface type; bug #47822. - -test-214.cs ------------ - -Namespace lookups; bug #47853. - -test-215.cs ------------ - -Namespace lookups; bug #47927. - verify-1.cs ----------- Test whether we do not jump out of the method in a Try/Finally block. diff --git a/mcs/tests/gen-3.cs b/mcs/tests/gen-3.cs deleted file mode 100644 index cc1323e197b..00000000000 --- a/mcs/tests/gen-3.cs +++ /dev/null @@ -1,20 +0,0 @@ -class Stack<T> { -} - -class Test { -} - -class T { - Stack<Test> a; - Stack<Test,Test> b; - Stack<Test,Stack<Test>> c; - - public void Foo (Stack<Test> d) - { } - - static void Main() - { - Stack<Test> e; - Stack<Test,Stack<Test>> f; - } -} diff --git a/mcs/tests/test-102.cs b/mcs/tests/test-102.cs index 9787fa75795..f72af0f8778 100644 --- a/mcs/tests/test-102.cs +++ b/mcs/tests/test-102.cs @@ -17,17 +17,6 @@ namespace N1 { } } - [AttributeUsage (AttributeTargets.ReturnValue)] - public class ReturnAttribute : Attribute { - - public string name; - - public ReturnAttribute (string s) - { - name = s; - } - } - interface A { [Mine ("hello")] void Hello (); @@ -38,7 +27,7 @@ namespace N1 { int i; [Mine ("Foo")] - [return: Return ("Bar")] + [return: Mine ("Bar")] public static int Main () { Type t = typeof (Foo); @@ -53,12 +42,12 @@ namespace N1 { Console.WriteLine ("Got more than one return attribute"); return 1; } - if (!(ret_attrs [0] is ReturnAttribute)){ + if (!(ret_attrs [0] is MineAttribute)){ Console.WriteLine ("Dit not get a MineAttribute"); return 2; } - ReturnAttribute ma = (ReturnAttribute) ret_attrs [0]; + MineAttribute ma = (MineAttribute) ret_attrs [0]; if (ma.name != "Bar"){ Console.WriteLine ("The return attribute is not Bar"); return 2; diff --git a/mcs/tests/test-154.cs b/mcs/tests/test-154.cs index db7705f8301..47e31d7b71f 100644 --- a/mcs/tests/test-154.cs +++ b/mcs/tests/test-154.cs @@ -431,35 +431,4 @@ public class X } value = null; } - - // - // Bug #47095 - // - static bool test29 (out int a) - { - try { - a = 0; - return true; - } catch (System.Exception) { - a = -1; - return false; - } - } - - // - // Bug #46949 - // - public string test30 (out string outparam) - { - try { - if (true) { - outparam = ""; - return ""; - } - } catch { - } - - outparam = null; - return null; - } } diff --git a/mcs/tests/test-213.cs b/mcs/tests/test-213.cs deleted file mode 100644 index 3492c14059e..00000000000 --- a/mcs/tests/test-213.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; - -class MyTest { - public static void Main(String[] args) { - S s1 = new S(11); - I s2 = s1; // Implicit boxing S-->I - S s3 = (S)s2; // Explicit unboxing I-->S - s3.Print(); // Should print 11, does not - } -} - -interface I { - void Print(); -} - -struct S : I { - public int i; - public S(int i) { - this.i = i; - } - public void Print() { - Console.WriteLine(i); - } -} diff --git a/mcs/tests/test-214.cs b/mcs/tests/test-214.cs deleted file mode 100644 index 859aac63ae7..00000000000 --- a/mcs/tests/test-214.cs +++ /dev/null @@ -1,23 +0,0 @@ -using T1 = N1.C1; - -namespace N2 -{ - class Test : T1 - { - static int Main() - { - // Compilation-only test. - Foo (); - return 0; - } - } -} - -namespace N1 -{ - public class C1 - { - public static void Foo () - { } - } -} diff --git a/mcs/tests/test-215.cs b/mcs/tests/test-215.cs deleted file mode 100644 index 073d2f4eb11..00000000000 --- a/mcs/tests/test-215.cs +++ /dev/null @@ -1,21 +0,0 @@ -using C1 = N1.C1; - -public class Test { - private static C1 c1 = null; - - public static C1 C1 { - get { - return c1; - } - } - - public static int Main() { - C1 tmp = C1; - return 0; - } -} - -namespace N1 { - public class C1 { - } -} diff --git a/mcs/tests/test-37.cs b/mcs/tests/test-37.cs index 88f2843947c..91f54f4d9a0 100755 --- a/mcs/tests/test-37.cs +++ b/mcs/tests/test-37.cs @@ -108,8 +108,7 @@ class X { Console.WriteLine ("hello"); return 0; - -#if FIXME + v = test_int_single_dim (); if (v != 0) @@ -133,6 +132,5 @@ class X { // Console.WriteLine ("Should be: " + (i + 1) + " it is = " + a [i]); } return 0; -#endif } } diff --git a/mcs/tests/verify-7.cs b/mcs/tests/verify-7.cs deleted file mode 100644 index 6ffad0f6040..00000000000 --- a/mcs/tests/verify-7.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; - -public class TestClass : IDisposable -{ - public static void Main() - { - TestClass test = new TestClass(); - test.MyMethod(); - } - - public void Dispose() - { - - } - - public void MyMethod() - { - byte[] buffer = new byte[1500]; - - using(TestClass test = new TestClass()) - { - while(true) - { - } - } - } -} diff --git a/mcs/tools/ChangeLog b/mcs/tools/ChangeLog index a1888768a92..1b1c8e55073 100644 --- a/mcs/tools/ChangeLog +++ b/mcs/tools/ChangeLog @@ -1,7 +1,3 @@ -2003-08-28 Lluis Sanchez Gual <lluis@ximian.com> - - * Makefile: Added wsdl directory. - 2003-07-16 Peter Williams <peter@newton.cx> * Makefile (DIST_ONLY_SUBDIRS): Don't build SqlSharp, it's diff --git a/mcs/tools/Makefile b/mcs/tools/Makefile index 7d6893e2e1b..942a219a1c1 100644 --- a/mcs/tools/Makefile +++ b/mcs/tools/Makefile @@ -1,5 +1,5 @@ thisdir = tools -SUBDIRS = cilc corcompare ictool mono-xsd security wsdl +SUBDIRS = cilc corcompare ictool mono-xsd security DIST_ONLY_SUBDIRS = SqlSharp include ../build/rules.make @@ -51,3 +51,4 @@ EnumCheck.exe: EnumCheck.cs EnumCheckAssemblyCollection.cs IFaceDisco.exe: IFaceDisco.cs XMLUtil.cs $(CSCOMPILE) /target:exe /out:$@ $^ + diff --git a/mcs/tools/security/AssemblyInfo.cs b/mcs/tools/security/AssemblyInfo.cs index a8ad9369dfe..419b50ce20e 100644 --- a/mcs/tools/security/AssemblyInfo.cs +++ b/mcs/tools/security/AssemblyInfo.cs @@ -6,7 +6,7 @@ using System.Runtime.CompilerServices; [assembly: AssemblyCompany("Sébastien Pouliot, Motus Technologies")] [assembly: AssemblyProduct("Open Source Tools for .NET")] [assembly: AssemblyCopyright("Copyright 2002, 2003 Motus Technologies. Released under BSD license.")] -[assembly: AssemblyVersion("0.26.99.0")] +[assembly: AssemblyVersion("0.25.99.0")] //[assembly: AssemblyConfiguration("")] //[assembly: AssemblyTrademark("")] //[assembly: AssemblyCulture("")] diff --git a/mcs/tools/security/ChangeLog b/mcs/tools/security/ChangeLog index 51312643d79..c126e7dcd33 100644 --- a/mcs/tools/security/ChangeLog +++ b/mcs/tools/security/ChangeLog @@ -1,15 +1,3 @@ -2003-09-01 Sebastien Pouliot <spouliot@videotron.ca> - - * AssemblyInfo.cs: Updated version to 0.26.99 (all tools). - * cert2spc.cs: Updated to use Mono.Security.X509. - * chktrust.cs: Tool to validate Authenticode(tm) signatures on PE - files (including assemblies). - * signcode.cs: Tool to sign and timestamp PE files using - Authenticode(tm) compatible certificates. - * README: Updated to include a small tutorial on how to use - Authenticode(tm) to sign/verify assemblies. - * Makefile: Updated to build chktrust.exe and signcode.exe - 2003-07-30 Sebastien Pouliot <spouliot@videotron.ca> * AssemblyInfo.cs: Updated version to 0.25.99 (all tools). diff --git a/mcs/tools/security/Makefile b/mcs/tools/security/Makefile index 8fbca0c2e27..c074f055b11 100644 --- a/mcs/tools/security/Makefile +++ b/mcs/tools/security/Makefile @@ -5,7 +5,7 @@ include ../../build/rules.make LOCAL_MCS_FLAGS = /r:$(topdir)/class/lib/Mono.Security.dll -SECURITY_PROGRAMS = secutil.exe cert2spc.exe sn.exe MakeCert.exe chktrust.exe signcode.exe +SECURITY_PROGRAMS = secutil.exe cert2spc.exe sn.exe MakeCert.exe DISTFILES = \ AssemblyInfo.cs \ @@ -13,9 +13,7 @@ DISTFILES = \ MakeCert.cs \ README \ secutil.cs \ - sn.cs \ - chktrust.cs \ - signcode.cs + sn.cs all-local: $(SECURITY_PROGRAMS) diff --git a/mcs/tools/security/README b/mcs/tools/security/README index 36623787142..32f81360042 100644 --- a/mcs/tools/security/README +++ b/mcs/tools/security/README @@ -1,110 +1,13 @@ Mono's Security Tools - README -Last updated: September 1, 2003 (post mono 0.26) - -* General notes - This directory contains clones for .NET security tools; -- All tools are 100% managed code with no dependency to the Mono's runtime. -- A much as possible the same command line arguments as the original are used; +- All tools are 100% managed code with no dependency to the Mono's runtime or any other libraries. +- A much as possible the same command line arguments are used; - Documentation (man) is available for some tools; - All tools, except secutil.exe, requires the Mono.Security.dll assembly. -- Authenticode(tm) support is MINIMAL - there are still many missing - validations. - - -* Known bugs - -- If signcode.exe is executed more than once on a assembly, the signature -becomes invalid (but the assembly can still be executed). - - -* Authenticode tutorial - -1. Getting a test certificate - -The tool makecert.exe can create test certificates. The test certificates are -only trusted by Mono's security tools (i.e. the resulting signature won't be -valid on Windows [1]). For "real" certificates you must deal with (and pay) a -trusted commercial CA (or you can have your own CA inside your entreprise). - -The command: -mono makecert.exe -n "CN=your name" -sv yourkeypair.pvk yourcert.cer - -will create both a PVK file (containing your private key) and a CER file -(containing the X.509 certificate). This step will take some time (about a -minute on a P3-800) because the tools must generate your own keypair (in -this case a 1024 bits RSA keypair). - -example: -mono makecert.exe -n "CN=Sebastien Pouliot" -sv spouliot.pvk spouliot.cer - - -2. Getting a SPC file - -The certificate file (.cer) must be converted into a SPC (software publisher -certificate) file before signing any assembly (or executable file). - -The command: -mono cert2spc.exe yourcert.cer yourspc.spc - -will create your SPC file from your X.509 certificates files. - -example: -mono cert2spc.exe spouliot.cer spouliot.spc - - -3. Signing an assembly - -You need both your PVK (private key) and SPC files to sign an assembly (or -any PE file). You may also include a countersignature in your assembly using -a timestamp server (so the signature can still be verified after your -certificate is expired). - -The command: -mono signcode.exe -v yourkeypair.pvk -spc yourspc.spc -t -http://timestamp.verisign.com/scripts/timstamp.dll yourassembly.exe - -will sign the specified PE file using your private key and embed your -certificate and a timestamp. Note: there are no "e" in timstamp.dll ! - -example: -mono signcode.exe -v spouliot.pvk -spc spouliot.spc -t -http://timestamp.verisign.com/scripts/timstamp.dll small.exe - - -4. Checking an assembly - -Anyone can now validate the assembly signature using the chktrust tool. - -The command: -mono chktrust.exe yourassembly.exe - -will verify the integrity of the specified PE file. Any change to the file -will invalidate it's signature. - -example: -mono chktrust.exe small.exe - - - -[1] FOR TEST PURPOSE ONLY ON WINDOWS - -As stated you can "activate" the Mono's test certificate by doing the -following steps. - -a. Generate the Mono's root certificate - mono makecert.exe -r mono.cer -b. Double-click on the mono.cer file -c. Click on the "Install certificate..." button -d. Read everything then, if you still want to, answer YES to add the test - certificate in your TRUSTED root certificates. -Be warned that by doing so YOU ARE TRUSTING THIS TEST CERTIFICATE on your -system. This is bad for several reason, foremost that EVERYONE has access to -it's private key! Please remove the test certificate AS SOON as you have -finished testing using it. +Last updated: March 6, 2003 (post mono 0.22) ------------------ Sebastien Pouliot Security Architect, Motus Technologies, http://www.motus.com/ work: spouliot@motus.com diff --git a/mcs/tools/security/cert2spc.cs b/mcs/tools/security/cert2spc.cs index b991d3d3cec..6e01de1d2ac 100644 --- a/mcs/tools/security/cert2spc.cs +++ b/mcs/tools/security/cert2spc.cs @@ -10,10 +10,9 @@ using System; using System.IO; using System.Reflection; -//using System.Security.Cryptography.X509Certificates; +using System.Security.Cryptography.X509Certificates; using Mono.Security.Authenticode; -using Mono.Security.X509; [assembly: AssemblyTitle("Mono Cert2Spc")] [assembly: AssemblyDescription("Transform a set of X.509 certificates and CRLs into an Authenticode(TM) \"Software Publisher Certificate\"")] @@ -69,7 +68,7 @@ class Cert2Spc { switch (Path.GetExtension (args[i]).ToLower ()) { case ".cer": case ".crt": - spc.Certificates.Add (new X509Certificate (GetFile (args[i]))); + spc.Certificates.Add (X509Certificate.CreateFromCertFile (args[i])); break; case ".crl": spc.CRLs.Add (GetFile (args[i])); diff --git a/mcs/tools/security/chktrust.cs b/mcs/tools/security/chktrust.cs deleted file mode 100755 index b58f346816b..00000000000 --- a/mcs/tools/security/chktrust.cs +++ /dev/null @@ -1,163 +0,0 @@ -// -// ChkTrust.cs: chktrust clone tool -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.IO; -using System.Reflection; -using System.Security.Cryptography; - -using Mono.Security.Authenticode; - -[assembly: AssemblyTitle ("Mono CheckTrust")] -[assembly: AssemblyDescription ("Verify if an PE executable has a valid Authenticode(tm) signature")] - -namespace Mono.Tools { - - class CheckTrust { - - static private void Header () - { - Assembly a = Assembly.GetExecutingAssembly (); - AssemblyName an = a.GetName (); - - object [] att = a.GetCustomAttributes (typeof (AssemblyTitleAttribute), false); - string title = ((att.Length > 0) ? ((AssemblyTitleAttribute) att [0]).Title : "Mono ChkTrust"); - - att = a.GetCustomAttributes (typeof (AssemblyCopyrightAttribute), false); - string copyright = ((att.Length > 0) ? ((AssemblyCopyrightAttribute) att [0]).Copyright : ""); - - Console.WriteLine ("{0} {1}", title, an.Version.ToString ()); - Console.WriteLine ("{0}{1}", copyright, Environment.NewLine); - } - - static private void Help () - { - Console.WriteLine ("Usage: chktrust [options] filename{0}", Environment.NewLine); - Console.WriteLine ("\t-q\tquiet mode (no gui)"); - Console.WriteLine ("\t-v\tverbose mode (display status for every steps)"); - Console.WriteLine ("\t-?\thelp (display this help message)"); - } - - // static methods - static public int Check (string fileName, bool quiet, bool verbose) - { - AuthenticodeDeformatter a = new AuthenticodeDeformatter (fileName); - - // debug -/* FileStream fs = File.Open (fileName + ".sig", FileMode.Create, FileAccess.Write); - fs.Write (a.Signature, 0, a.Signature.Length); - fs.Close ();*/ - - // get something shorter to display - fileName = Path.GetFileName (fileName); - - if (verbose) { - Console.WriteLine ("Verifying file {0} for Authenticode(tm) signatures...{1}", fileName, Environment.NewLine); - } - - if (a.Timestamp == DateTime.MinValue) { - // signature only valid if the certificate is valid - Console.WriteLine ("WARNING! {0} is not timestamped!", fileName); - } - else if (verbose) { - Console.WriteLine ("INFO! {0} was timestamped on {1}", fileName, a.Timestamp); - } - - if (!a.IsTrusted ()) { - string msg = null; - // FAILURES - switch (a.Reason) { - case 1: - msg = "doesn't contain a digital signature"; - break; - case 2: - msg = "digital signature is invalid"; - break; - case 3: - msg = "countersignature (timestamp) is invalid"; - break; - case 4: - msg = "timestamp is outside certificate validity"; - break; - case 5: - msg = "use an unsupported hash algorithm. Verification is impossible"; - break; - case 6: - msg = "signature can't be traced back to a trusted root"; - break; - case 7: - msg = "couldn't find the certificate that signed the file"; - break; - case 8: - msg = "certificate is expired and no timestamp is present"; - break; - default: - msg = "unknown error"; - break; - } - - Console.WriteLine ("ERROR! {0} {1}!{2}", fileName, msg, Environment.NewLine); - return 1; - } - - Console.WriteLine ("SUCCESS: {0} signature is valid{1}and can be traced back to a trusted root!{2}", fileName, Environment.NewLine, Environment.NewLine); - return 0; - } - - [STAThread] - static int Main (string[] args) - { - bool verbose = false; - bool quiet = true; // always true as we don't show UI - bool help = false; - string fileName = null; - - Header(); - try { - for (int i=0; i < args.Length; i++) { - switch (args[i]) { - case "-q": - case "-quiet": - quiet = true; - break; - case "-v": - case "-verbose": - verbose = true; - break; - case "-h": - case "-help": - case "-?": - case "/?": - help = true; - break; - default: - fileName = args [i]; - break; - } - } - - if ((help) || (fileName == null)) - Help (); - else - return Check (fileName, quiet, verbose); - - } - catch (CryptographicException ce) { - Console.WriteLine ("WARNING: " + ce.Message); - Console.WriteLine ("ERROR: Trust evaluation is incomplete!"); - } - catch (Exception e) { - Console.WriteLine ("ERROR: " + e.ToString ()); - Help (); - } - Console.WriteLine (); - return 1; - } - } -} diff --git a/mcs/tools/security/signcode.cs b/mcs/tools/security/signcode.cs deleted file mode 100755 index eb44b7c9e3d..00000000000 --- a/mcs/tools/security/signcode.cs +++ /dev/null @@ -1,217 +0,0 @@ -// -// SignCode.cs: secutil clone tool -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -using System; -using System.Reflection; -using System.Security.Cryptography; -using System.Security.Cryptography.X509Certificates; -using System.Text; -using System.Threading; - -using Mono.Security.Authenticode; - -[assembly: AssemblyTitle("Mono SignCode")] -[assembly: AssemblyDescription("Sign assemblies and PE files using Authenticode(tm).")] - -namespace Mono.Tools { - - class SignCode { - - static private void Header () - { - Assembly a = Assembly.GetExecutingAssembly (); - AssemblyName an = a.GetName (); - - object [] att = a.GetCustomAttributes (typeof (AssemblyTitleAttribute), false); - string title = ((att.Length > 0) ? ((AssemblyTitleAttribute) att [0]).Title : "Mono SignCode"); - - att = a.GetCustomAttributes (typeof (AssemblyCopyrightAttribute), false); - string copyright = ((att.Length > 0) ? ((AssemblyCopyrightAttribute) att [0]).Copyright : ""); - - Console.WriteLine ("{0} {1}", title, an.Version.ToString ()); - Console.WriteLine ("{0}{1}", copyright, Environment.NewLine); - } - - static private void Help () - { - Console.WriteLine ("Usage: signcode [options] filename{0}", Environment.NewLine); - Console.WriteLine ("\t-spc spc\tSoftware Publisher Certificate file"); - Console.WriteLine ("\t-v pvk\tPrivate Key file"); - Console.WriteLine ("\t-a md5 | sha1\tHash Algorithm (default: MD5)"); - Console.WriteLine ("\t-$ indivisual | commercial\tSignature type"); - Console.WriteLine ("\t-n\tDescription for the signed file"); - Console.WriteLine ("\t-i\tURL for the signed file"); - Console.WriteLine ("Timestamp options"); - Console.WriteLine ("\t-t url\tTimestamp service http URL"); - Console.WriteLine ("\t-tr #\tNumber of retries for timestamp"); - Console.WriteLine ("\t-tw #\tDelay between retries"); - Console.WriteLine ("\t-x\tOnly timestamp (no signature)"); - Console.WriteLine ("CSP options"); - Console.WriteLine ("\t-k name\tKey Container Name"); - Console.WriteLine ("\t-p name\tProvider Name"); - Console.WriteLine ("\t-y #\tProvider Type"); - Console.WriteLine ("\t-ky [signature|exchange|#]\tKey Type"); - Console.WriteLine ("\t-r [localMachine|currentUser]\tKey Location"); - } - - [STAThread] - static int Main(string[] args) - { - Header(); - if (args.Length < 1) { - Help (); - return 1; - } - - CspParameters csp = new CspParameters (); - string pvkFilename = null; - string spcFilename = null; - int timestampRetry = 0; - int timestampDelay = 0; - bool sign = true; - - // to be signed - string tbsFilename = args [args.Length - 1]; - - AuthenticodeFormatter af = new AuthenticodeFormatter (); - - int i = 0; - while (i < args.Length) { - switch (args[i++]) { - case "-spc": - spcFilename = args [i++]; - break; - case "-v": - pvkFilename = args [i++]; - break; - case "-a": - af.Hash = args [i++]; - break; - case "-$": - string auth = args [i++].ToLower (); - switch (auth) { - case "individual": - af.Authority = Authority.Commercial; - break; - case "commercial": - af.Authority = Authority.Individual; - break; - default: - Console.WriteLine ("Unknown authority {0}", auth); - return 1; - } - break; - case "-i": - af.Description = args [i++]; - break; - case "-n": - af.URL = args [i++]; - break; - // timestamp options - case "-t": - af.TimestampURL = args [i++]; - break; - case "-tr": - timestampRetry = Convert.ToInt32 (args [i++]); - break; - case "-tw": - timestampDelay = Convert.ToInt32 (args [i++]) * 1000; - break; - case "-x": - // only timestamp - sign = false; - break; - // CSP provider options - case "-k": - csp.KeyContainerName = args [i++]; - break; - case "-p": - csp.ProviderName = args [i++]; - break; - case "-y": - csp.ProviderType = Convert.ToInt32 (args [i++]); - break; - case "-ky": - string key = args [i++]; - switch (key) { - case "signature": - csp.KeyNumber = 0; - break; - case "exchange": - csp.KeyNumber = 0; - break; - default: - csp.KeyNumber = Convert.ToInt32 (key); - break; - } - break; - case "-r": - string location = args [i++]; - switch (location) { - case "localMachine": - csp.Flags = CspProviderFlags.UseMachineKeyStore; - break; - case "currentUser": - csp.Flags = CspProviderFlags.UseDefaultKeyContainer; - break; - default: - Console.WriteLine ("Unknown location {0}", location); - return 1; - } - break; - // unsupported options - case "-j": - case "-jp": - Console.WriteLine ("Unsupported option {0}", args[i-1]); - return 1; - } - } - - if (sign) { - RSACryptoServiceProvider rsa = new RSACryptoServiceProvider (csp); - if (pvkFilename != null) { - PrivateKey pvk = PrivateKey.CreateFromFile (pvkFilename); - if (pvk.Encrypted) { - Console.WriteLine ("Enter password for {0}: ", pvkFilename); - string pvkPassword = Console.ReadLine (); - pvk = PrivateKey.CreateFromFile (pvkFilename, pvkPassword); - } - if (pvk.RSA != null) { - rsa.ImportParameters (pvk.RSA.ExportParameters (true)); - } - else { - Console.WriteLine ("Invalid password for {0}", pvkFilename); - return 1; - } - } - - SoftwarePublisherCertificate spc = null; - if (spcFilename != null) { - spc = SoftwarePublisherCertificate.CreateFromFile (spcFilename); - af.Certificates.AddRange (spc.Certificates); - // TODO CRL - } - - af.RSA = rsa; - af.Sign (tbsFilename); - } -/* TODO - if (af.TimestampURL != null) { - for (int j=0; j < timestampRetry + 1; j++) { - if (!af.Timestamp (tbsFilename)) { - Thread.Sleep (timestampDelay); - continue; - } - break; - } - }*/ - return 0; - } - } -} diff --git a/mcs/tools/wsdl/ChangeLog b/mcs/tools/wsdl/ChangeLog deleted file mode 100644 index 14bbe6bbb5c..00000000000 --- a/mcs/tools/wsdl/ChangeLog +++ /dev/null @@ -1,15 +0,0 @@ -2003-09-04 Lluis Sanchez Gual <lluis@ximian.com> - - * MonoWSDL.cs: Implemented support for WSDL documents that import other - documents and schemas. - Improved warning messages. - -2003-08-29 Lluis Sanchez Gual <lluis@ximian.com> - - * Makefile: Fixed assembly reference. - -2003-08-28 Lluis Sanchez Gual <lluis@ximian.com> - - * Makefile: added - * wsdl.exe.sources: added - * MonoWSDL.cs: Added wsdl code by Erik LeBel. diff --git a/mcs/tools/wsdl/Makefile b/mcs/tools/wsdl/Makefile deleted file mode 100644 index a64d07dde92..00000000000 --- a/mcs/tools/wsdl/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -thisdir = tools/wsdl -SUBDIRS = -include ../../build/rules.make - -LOCAL_MCS_FLAGS = /r:System.Xml.dll /r:System.Web.Services.dll -PROGRAM = wsdl.exe - -include ../../build/executable.make diff --git a/mcs/tools/wsdl/MonoWSDL.cs b/mcs/tools/wsdl/MonoWSDL.cs deleted file mode 100755 index 0485dae9760..00000000000 --- a/mcs/tools/wsdl/MonoWSDL.cs +++ /dev/null @@ -1,602 +0,0 @@ -///
-/// MonoWSDL.cs -- a WSDL to proxy code generator.
-///
-/// Author: Erik LeBel (eriklebel@yahoo.ca)
-/// Lluis Sanchez (lluis@ximian.com)
-///
-/// Copyright (C) 2003, Erik LeBel,
-///
-
-using System;
-using System.Xml;
-using System.Xml.Schema;
-using System.Collections;
-using System.CodeDom;
-using System.CodeDom.Compiler;
-using System.IO;
-using System.Net;
-using System.Text;
-using System.Web.Services.Description;
-
-using Microsoft.CSharp;
-
-namespace Mono.WebServices
-{
- ///
- /// <summary>
- /// Document retriever.
- ///
- /// By extanciating this class, and setting URL and the optional Username, Password and Domain
- /// properties, the Document property can be used to retrieve the document at the specified
- /// address.
- ///
- /// If none of Username, Password or Domain are specified the DocumentRetriever attempts
- /// to fetch the document without providing any authentication credentials. If at least one of
- /// these values is provided, then the retrieval process is attempted with an authentication
- ///
- /// </summary>
- ///
- internal class DocumentRetriever
- {
- string url = null;
- string domain = null;
- string password = null;
- string username = null;
-
- ArrayList readLocations = new ArrayList ();
-
- ///
- /// <summary>
- /// Set the URL from which the document will be retrieved.
- /// </summary>
- ///
- public string URL
- {
- set
- {
- if (url != null)
- throw new Exception("Too many document sources");
-
- url = value;
- }
- get
- {
- return url;
- }
- }
-
- ///
- /// <summary>
- /// Specify the username to be used.
- /// </summary>
- ///
- public string Username
- {
- set { username = value; }
- }
-
- ///
- /// <summary/>
- ///
- public string Password
- {
- set { password = value; }
- }
-
- ///
- /// <summary/>
- ///
- public string Domain
- {
- set { domain = value; }
- }
-
- ///
- /// <summary>
- /// This property returns the document found at the DocumentRetriever's URL.
- /// </summary>
- ///
- public Stream GetStream ()
- {
- return GetStream (url);
- }
-
- public Stream GetStream (string documentUrl)
- {
- WebClient webClient = new WebClient();
-
- if (username != null || password != null || domain != null)
- {
- NetworkCredential credentials = new NetworkCredential();
-
- if (username != null)
- credentials.UserName = username;
-
- if (password != null)
- credentials.Password = password;
-
- if (domain != null)
- credentials.Domain = domain;
-
- webClient.Credentials = credentials;
- }
-
- readLocations.Add (documentUrl);
-
- try
- {
- Console.WriteLine ("Fetching " + documentUrl);
- return webClient.OpenRead (documentUrl);
- }
- catch (Exception ex)
- {
- throw new Exception ("Could not read document from url " + documentUrl + ". " + ex.Message);
- }
- }
-
- public bool AlreadyDownloaded (string documentUrl)
- {
- return readLocations.Contains (documentUrl);
- }
- }
-
- ///
- /// <summary>
- /// Source code generator.
- /// </summary>
- ///
- class SourceGenerator
- {
- string applicationSiganture = null;
- string appSettingURLKey = null;
- string appSettingBaseURL = null;
- string language = "CS";
- string ns = null;
- string outFilename = null;
- string protocol = "Soap";
- bool server = false;
-
- ///
- /// <summary/>
- ///
- public string Language
- {
- // FIXME validate
- set { language = value; }
- }
-
- ///
- /// <summary/>
- ///
- public string Namespace
- {
- set { ns = value; }
- }
-
- ///
- /// <summary>
- /// The file to contain the generated code.
- /// </summary>
- ///
- public string Filename
- {
- set { outFilename = value; }
- }
-
- ///
- /// <summary/>
- ///
- public string Protocol
- {
- // FIXME validate
- set { protocol = value; }
- }
-
- ///
- /// <summary/>
- ///
- public string ApplicationSignature
- {
- set { applicationSiganture = value; }
- }
-
- ///
- /// <summary/>
- ///
- public string AppSettingURLKey
- {
- set { appSettingURLKey = value; }
- }
-
- ///
- /// <summary/>
- ///
- public string AppSettingBaseURL
- {
- set { appSettingBaseURL = value; }
- }
-
- ///
- /// <summary/>
- ///
- public bool Server
- {
- set { server = value; }
- }
-
- ///
- /// <summary>
- /// Generate code for the specified ServiceDescription.
- /// </summary>
- ///
- public void GenerateCode (ArrayList descriptions, ArrayList schemas)
- {
- // FIXME iterate over each serviceDescription.Services?
- CodeNamespace codeNamespace = GetCodeNamespace();
- CodeCompileUnit codeUnit = new CodeCompileUnit();
-
- codeUnit.Namespaces.Add(codeNamespace);
-
- ServiceDescriptionImporter importer = new ServiceDescriptionImporter();
- importer.ProtocolName = protocol;
- if (server)
- importer.Style = ServiceDescriptionImportStyle.Server;
-
- foreach (ServiceDescription sd in descriptions)
- importer.AddServiceDescription(sd, appSettingURLKey, appSettingBaseURL);
-
- foreach (XmlSchema sc in schemas)
- importer.Schemas.Add (sc);
-
- ServiceDescriptionImportWarnings warnings = importer.Import(codeNamespace, codeUnit);
- if (warnings != 0)
- {
- if ((warnings & ServiceDescriptionImportWarnings.NoCodeGenerated) > 0)
- Console.WriteLine ("WARNING: No proxy class was generated");
- if ((warnings & ServiceDescriptionImportWarnings.NoMethodsGenerated) > 0)
- Console.WriteLine ("WARNING: The proxy class generated includes no methods");
- if ((warnings & ServiceDescriptionImportWarnings.OptionalExtensionsIgnored) > 0)
- Console.WriteLine ("WARNING: At least one optional extension has been ignored");
- if ((warnings & ServiceDescriptionImportWarnings.RequiredExtensionsIgnored) > 0)
- Console.WriteLine ("WARNING: At least one necessary extension has been ignored");
- if ((warnings & ServiceDescriptionImportWarnings.UnsupportedBindingsIgnored) > 0)
- Console.WriteLine ("WARNING: At least one binding is of an unsupported type and has been ignored");
- if ((warnings & ServiceDescriptionImportWarnings.UnsupportedOperationsIgnored) > 0)
- Console.WriteLine ("WARNING: At least one operation is of an unsupported type and has been ignored");
- }
-
- string serviceName = ((ServiceDescription)descriptions[0]).Services[0].Name;
- WriteCodeUnit(codeUnit, serviceName);
- }
-
- ///
- /// <summary>
- /// Create the CodeNamespace with the generator's signature commented in.
- /// </summary>
- ///
- CodeNamespace GetCodeNamespace()
- {
- CodeNamespace codeNamespace = new CodeNamespace(ns);
-
- if (applicationSiganture != null)
- {
- codeNamespace.Comments.Add(new CodeCommentStatement("\n This source code was auto-generated by " + applicationSiganture + "\n"));
- }
-
- return codeNamespace;
- }
-
- ///
- /// <summary/>
- ///
- void WriteCodeUnit(CodeCompileUnit codeUnit, string serviceName)
- {
- CodeDomProvider provider = GetProvider();
- ICodeGenerator generator = provider.CreateGenerator();
- CodeGeneratorOptions options = new CodeGeneratorOptions();
-
- string filename;
- if (outFilename != null)
- filename = outFilename;
- else
- filename = serviceName + "." + provider.FileExtension;
-
- Console.WriteLine ("Writing file '{0}'", filename);
- StreamWriter writer = new StreamWriter(filename);
- generator.GenerateCodeFromCompileUnit(codeUnit, writer, options);
- writer.Close();
- }
-
- ///
- /// <summary>
- /// Fetch the Code Provider for the language specified by the 'language' members.
- /// </summary>
- ///
- private CodeDomProvider GetProvider()
- {
- // FIXME these should be loaded dynamically using reflection
- CodeDomProvider provider;
-
- switch (language.ToUpper())
- {
- case "CS":
- provider = new CSharpCodeProvider();
- break;
-
- default:
- throw new Exception("Unknow language");
- }
-
- return provider;
- }
- }
-
- ///
- /// <summary>
- /// monoWSDL's main application driver. Reads the command-line arguments and dispatch the
- /// appropriate handlers.
- /// </summary>
- ///
- public class Driver
- {
- const string ProductId = "WSDL proxy generator v0.1";
- const string UsageMessage =
- "wsdl [options] {path | URL} \n"
- + " -appsettingurlkey:key (short -urlkey)\n"
- + " -appsettingbaseurl:baseurl (short -baseurl)\n"
- + " -domain:domain (short -d) Domain of username for server authentication\n"
- + " -language:language Language of generated code. Allowed CS\n"
- + " (default) (short -l)\n"
- + " -namespace:ns The namespace of the generated code, default\n"
- + " NS if none (short -n)\n"
- + " -nologo Surpress the startup logo\n"
- + " -out:filename The target file for generated code \n"
- + " (short -o)\n"
- + " -password:pwd Password used to contact server (short -p)\n"
- + " -protocol:protocol Protocol to implement. Allowed: Soap \n"
- + " (default), HttpGet, HttpPost\n"
- + " -server Generate server instead of client proxy code.\n"
- + " -username:username Username used to contact server (short -u)\n"
- + " -? Display this message\n"
- + "\n"
- + "Options can be of the forms -option, --option or /option";
-
- DocumentRetriever retriever = null;
- SourceGenerator generator = null;
-
- ArrayList descriptions = new ArrayList ();
- ArrayList schemas = new ArrayList ();
-
- bool noLogo = false;
- bool help = false;
- bool hasURL = false;
-
- // FIXME implement these options
- // (are they are usable by the System.Net.WebProxy class???)
- string proxy = null;
- string proxyDomain = null;
- string proxyPassword = null;
- string proxyUsername = null;
-
- ///
- /// <summary>
- /// Initialize the document retrieval component and the source code generator.
- /// </summary>
- ///
- Driver()
- {
- retriever = new DocumentRetriever();
- generator = new SourceGenerator();
- generator.ApplicationSignature = ProductId;
- }
-
- ///
- /// <summary>
- /// Interperet the command-line arguments and configure the relavent components.
- /// </summary>
- ///
- void ImportArgument(string argument)
- {
- string optionValuePair;
-
- if (argument.StartsWith("--"))
- {
- optionValuePair = argument.Substring(2);
- }
- else if (argument.StartsWith("/") || argument.StartsWith("-"))
- {
- optionValuePair = argument.Substring(1);
- }
- else
- {
- hasURL = true;
- retriever.URL = argument;
- return;
- }
-
- string option;
- string value;
-
- int indexOfEquals = optionValuePair.IndexOf(':');
- if (indexOfEquals > 0)
- {
- option = optionValuePair.Substring(0, indexOfEquals);
- value = optionValuePair.Substring(indexOfEquals + 1);
- }
- else
- {
- option = optionValuePair;
- value = null;
- }
-
- switch (option)
- {
- case "appsettingurlkey":
- case "urlkey":
- generator.AppSettingURLKey = value;
- break;
-
- case "appsettingbaseurl":
- case "baseurl":
- generator.AppSettingBaseURL = value;
- break;
-
- case "d":
- case "domain":
- retriever.Domain = value;
- break;
-
- case "l":
- case "language":
- generator.Language = value;
- break;
-
- case "n":
- case "namespace":
- generator.Namespace = value;
- break;
-
- case "nologo":
- noLogo = true;
- break;
-
- case "o":
- case "out":
- generator.Filename = value;
- break;
-
- case "p":
- case "password":
- retriever.Password = value;
- break;
-
- case "protocol":
- generator.Protocol = value;
- break;
-
- case "proxy":
- proxy = value;
- break;
-
- case "proxydomain":
- case "pd":
- proxyDomain = value;
- break;
-
- case "proxypassword":
- case "pp":
- proxyPassword = value;
- break;
-
- case "proxyusername":
- case "pu":
- proxyUsername = value;
- break;
-
- case "server":
- generator.Server = true;
- break;
-
- case "u":
- case "username":
- retriever.Username = value;
- break;
-
- case "?":
- help = true;
- break;
-
- default:
- throw new Exception("Unknown option " + option);
- }
- }
-
- ///
- /// <summary>
- /// Driver's main control flow:
- /// - parse arguments
- /// - report required messages
- /// - terminate if no input
- /// - report errors
- /// </summary>
- ///
- void Run(string[] args)
- {
- try
- {
- // parse command line arguments
- foreach (string argument in args)
- {
- ImportArgument(argument);
- }
-
- if (noLogo == false)
- Console.WriteLine(ProductId);
-
- if (help || !hasURL)
- {
- Console.WriteLine(UsageMessage);
- return;
- }
-
- // fetch the document
- using (Stream stream = retriever.GetStream ())
- {
- // import the document as a ServiceDescription
- XmlTextReader xtr = new XmlTextReader (stream);
- xtr.MoveToContent ();
- if (xtr.LocalName != "definitions") throw new Exception ("The document at '" + retriever.URL + "' is not a valid WSDL document");
- ServiceDescription serviceDescription = ServiceDescription.Read (xtr);
- xtr.Close ();
- ReadDocuments (serviceDescription);
- }
-
- // generate the code
- generator.GenerateCode (descriptions, schemas);
- }
- catch (Exception exception)
- {
- Console.WriteLine("Error: {0}", exception.Message);
- // FIXME: surpress this except for when debug is enabled
- Console.WriteLine("Stack:\n {0}", exception.StackTrace);
- }
- }
-
- void ReadDocuments (ServiceDescription serviceDescription)
- {
- descriptions.Add (serviceDescription);
-
- foreach (Import import in serviceDescription.Imports)
- {
- if (retriever.AlreadyDownloaded (import.Location)) continue;
- using (Stream stream = retriever.GetStream (import.Location))
- {
- XmlTextReader reader = new XmlTextReader (stream);
- reader.MoveToContent ();
-
- if (reader.LocalName == "definitions")
- {
- ServiceDescription desc = ServiceDescription.Read (reader);
- ReadDocuments (desc);
- }
- else
- {
- XmlSchema schema = XmlSchema.Read (reader, null);
- schemas.Add (schema);
- }
- }
- }
- }
-
- ///
- /// <summary>
- /// Application entry point.
- /// </summary>
- ///
- public static void Main(string[] args)
- {
- Driver d = new Driver();
- d.Run(args);
- }
- }
-} diff --git a/mcs/tools/wsdl/wsdl.exe.sources b/mcs/tools/wsdl/wsdl.exe.sources deleted file mode 100644 index c537cf0d7a1..00000000000 --- a/mcs/tools/wsdl/wsdl.exe.sources +++ /dev/null @@ -1 +0,0 @@ -MonoWSDL.cs diff --git a/mono.pc.in b/mono.pc.in index b837aa6d784..8191c7b11ab 100644 --- a/mono.pc.in +++ b/mono.pc.in @@ -7,6 +7,6 @@ includedir=@includedir@ Name: Mono Description: Mono Runtime Version: @VERSION@ -Requires: glib-2.0 gmodule-2.0 gthread-2.0 +Requires: glib-2.0 gmodule-2.0 Libs: -L${libdir} -lmono @libmono_ldflags@ -lm Cflags: -I${includedir} @libmono_cflags@ diff --git a/mono/arch/ChangeLog b/mono/arch/ChangeLog index 32994c8d293..312838730e8 100644 --- a/mono/arch/ChangeLog +++ b/mono/arch/ChangeLog @@ -1,10 +1,3 @@ -2003-09-03 Zoltan Varga <vargaz@freemail.hu> - - * x86/tramp.c: Fixes from Bernie Solomon (bernard@ugsolutions.com). - -2003-08-21 Zoltan Varga <vargaz@freemail.hu> - - * x86/tramp.c: Fixes from Bernie Solomon (bernard@ugsolutions.com). Tue Jul 1 13:03:43 CEST 2003 Paolo Molaro <lupus@ximian.com> diff --git a/mono/arch/sparc/.cvsignore b/mono/arch/sparc/.cvsignore index 051d1bd50ba..282522db034 100644 --- a/mono/arch/sparc/.cvsignore +++ b/mono/arch/sparc/.cvsignore @@ -1,3 +1,2 @@ Makefile Makefile.in -.deps diff --git a/mono/arch/sparc/sparc-codegen.h b/mono/arch/sparc/sparc-codegen.h index b2a583684f5..04a23c35822 100644 --- a/mono/arch/sparc/sparc-codegen.h +++ b/mono/arch/sparc/sparc-codegen.h @@ -153,45 +153,28 @@ typedef enum { typedef enum { /* fop1 format */ - sparc_fitos_val = 196, - sparc_fitod_val = 200, - sparc_fitoq_val = 204, - sparc_fstoi_val = 209, - sparc_fdtoi_val = 210, - sparc_fqtoi_val = 211, - sparc_fstod_val = 201, - sparc_fstoq_val = 205, - sparc_fdtos_val = 198, - sparc_fdtoq_val = 206, - sparc_fqtos_val = 199, - sparc_fqtod_val = 203, - sparc_fmovs_val = 1, - sparc_fnegs_val = 5, - sparc_fabss_val = 9, - sparc_fsqrts_val = 41, - sparc_fsqrtd_val = 42, - sparc_fsqrtq_val = 43, - sparc_fadds_val = 65, - sparc_faddd_val = 66, - sparc_faddq_val = 67, - sparc_fsubs_val = 69, - sparc_fsubd_val = 70, - sparc_fsubq_val = 71, - sparc_fmuls_val = 73, - sparc_fmuld_val = 74, - sparc_fmulq_val = 75, - sparc_fsmuld_val = 105, - sparc_fdmulq_val = 111, - sparc_fdivs_val = 77, - sparc_fdivd_val = 78, - sparc_fdivq_val = 79, + sparc_fitos = 196, + sparc_fitod = 200, + sparc_fstoi = 209, + sparc_fdtoi = 210, + sparc_fstod = 201, + sparc_fdtos = 198, + sparc_fmov = 1, + sparc_fneg = 5, + sparc_fabs = 9, + sparc_fsqrts = 41, + sparc_fsqrtd = 42, + sparc_fadds = 65, + sparc_faddd = 66, + sparc_fsubs = 69, + sparc_fsubd = 70, + sparc_fmuls = 73, + sparc_fmuld = 74, + sparc_fdivs = 77, + sparc_fdivd = 78, /* fop2 format */ - sparc_fcmps_val = 81, - sparc_fcmpd_val = 82, - sparc_fcmpq_val = 83, - sparc_fcmpes_val = 85, - sparc_fcmped_val = 86, - sparc_fcmpeq_val = 87 + sparc_fcmps = 81, + sparc_fcmpd = 82 } SparcFOp; typedef struct { @@ -402,60 +385,6 @@ typedef struct { #define sparc_fop(ins,r1,op,r2,dest) sparc_encode_format3c((ins),2,(op),(r1),52,(r2),(dest)) #define sparc_fcmp(ins,r1,op,r2) sparc_encode_format3c((ins),2,(op),(r1),53,(r2),0) -/* format 1 fops */ -#define sparc_fadds(ins, r1, r2, dest) sparc_fop( ins, r1, sparc_fadds_val, r2, dest ) -#define sparc_faddd(ins, r1, r2, dest) sparc_fop( ins, r1, sparc_faddd_val, r2, dest ) -#define sparc_faddq(ins, r1, r2, dest) sparc_fop( ins, r1, sparc_faddq_val, r2, dest ) - -#define sparc_fsubs(ins, r1, r2, dest) sparc_fop( ins, r1, sparc_fsubs_val, r2, dest ) -#define sparc_fsubd(ins, r1, r2, dest) sparc_fop( ins, r1, sparc_fsubd_val, r2, dest ) -b#define sparc_fsubq(ins, r1, r2, dest) sparc_fop( ins, r1, sparc_fsubq_val, r2, dest ) - -#define sparc_fmuls( ins, r1, r2, dest ) sparc_fop( ins, r1, sparc_fmuls_val, r2, dest ) -#define sparc_fmuld( ins, r1, r2, dest ) sparc_fop( ins, r1, sparc_fmuld_val, r2, dest ) -#define sparc_fmulq( ins, r1, r2, dest ) sparc_fop( ins, r1, sparc_fmulq_val, r2, dest ) - -#define sparc_fsmuld( ins, r1, r2, dest ) sparc_fop( ins, r1, sparc_fsmuld_val, r2, dest ) -#define sparc_fdmulq( ins, r1, r2, dest ) sparc_fop( ins, r1, sparc_fdmulq_val, r2, dest ) - -#define sparc_fdivs( ins, r1, r2, dest ) sparc_fop( ins, r1, sparc_fdivs_val, r2, dest ) -#define sparc_fdivd( ins, r1, r2, dest ) sparc_fop( ins, r1, sparc_fdivd_val, r2, dest ) -#define sparc_fdivq( ins, r1, r2, dest ) sparc_fop( ins, r1, sparc_fdivq_val, r2, dest ) - -#define sparc_fitos( ins, r2, dest ) sparc_fop( ins, 0, sparc_fitos_val, r2, dest ) -#define sparc_fitod( ins, r2, dest ) sparc_fop( ins, 0, sparc_fitod_val, r2, dest ) -#define sparc_fitoq( ins, r2, dest ) sparc_fop( ins, 0, sparc_fitoq_val, r2, dest ) - -#define sparc_fstoi( ins, r2, dest ) sparc_fop( ins, 0, sparc_fstoi_val, r2, dest ) -#define sparc_fdtoi( ins, r2, dest ) sparc_fop( ins, 0, sparc_fdtoi_val, r2, dest ) -#define sparc_fqtoi( ins, r2, dest ) sparc_fop( ins, 0, sparc_fqtoi_val, r2, dest ) - -#define sparc_fstod( ins, r2, dest ) sparc_fop( ins, 0, sparc_fstod_val, r2, dest ) -#define sparc_fstoq( ins, r2, dest ) sparc_fop( ins, 0, sparc_fstoq_val, r2, dest ) - -#define sparc_fdtos( ins, r2, dest ) sparc_fop( ins, 0, sparc_fdtos_val, r2, dest ) -#define sparc_fdtoq( ins, r2, dest ) sparc_fop( ins, 0, sparc_fdtoq_val, r2, dest ) - -#define sparc_fqtos( ins, r2, dest ) sparc_fop( ins, 0, sparc_fqtos_val, r2, dest ) -#define sparc_fqtod( ins, r2, dest ) sparc_fop( ins, 0, sparc_fqtod_val, r2, dest ) - -#define sparc_fmovs( ins, r2, dest ) sparc_fop( ins, 0, sparc_fmovs_val, r2, dest ) -#define sparc_fnegs( ins, r2, dest ) sparc_fop( ins, 0, sparc_fnegs_val, r2, dest ) -#define sparc_fabss( ins, r2, dest ) sparc_fop( ins, 0, sparc_fabss_val, r2, dest ) - -#define sparc_fsqrts( ins, r2, dest ) sparc_fop( ins, 0, sparc_fsqrts_val, r2, dest ) -#define sparc_fsqrtd( ins, r2, dest ) sparc_fop( ins, 0, sparc_fsqrtd_val, r2, dest ) -#define sparc_fsqrtq( ins, r2, dest ) sparc_fop( ins, 0, sparc_fsqrtq_val, r2, dest ) - -/* format 2 fops */ - -#define sparc_fcmps( ins, r1, r2 ) sparc_fcmp( ins, r1, sparc_fcmps_val, r2 ) -#define sparc_fcmpd( ins, r1, r2 ) sparc_fcmp( ins, r1, sparc_fcmpd_val, r2 ) -#define sparc_fcmpq( ins, r1, r2 ) sparc_fcmp( ins, r1, sparc_fcmpq_val, r2 ) -#define sparc_fcmpes( ins, r1, r2 ) sparc_fcmpes( ins, r1, sparc_fcmpes_val, r2 ) -#define sparc_fcmped( ins, r1, r2 ) sparc_fcmped( ins, r1, sparc_fcmped_val, r2 ) -#define sparc_fcmpeq( ins, r1, r2 ) sparc_fcmpeq( ins, r1, sparc_fcmpeq_val, r2 ) - /* logical */ #define sparc_and(ins,setcc,r1,r2,dest) sparc_encode_format3a((ins),2,0,(r1),(r2),(setcc)|1,(dest)) #define sparc_and_imm(ins,setcc,r1,imm,dest) sparc_encode_format3b((ins),2,(r1),(imm),(setcc)|1,(dest)) @@ -522,6 +451,7 @@ b#define sparc_fsubq(ins, r1, r2, dest) sparc_fop( ins, r1, sparc_fsubq_val, r2, /* synthetic instructions */ #define sparc_cmp(ins,r1,r2) sparc_sub((ins),sparc_cc,(r1),(r2),sparc_g0) #define sparc_cmp_imm(ins,r1,imm) sparc_sub_imm((ins),sparc_cc,(r1),(imm),sparc_g0) + #define sparc_jmp(ins,base,disp) sparc_jmpl((ins),(base),(disp),sparc_g0) #define sparc_jmp_imm(ins,base,disp) sparc_jmpl_imm((ins),(base),(disp),sparc_g0) #define sparc_call(ins,base,disp) sparc_jmpl((ins),(base),(disp),sparc_o7) diff --git a/mono/arch/x86/tramp.c b/mono/arch/x86/tramp.c index 3a0d50ca294..b6dfeb203fe 100644 --- a/mono/arch/x86/tramp.c +++ b/mono/arch/x86/tramp.c @@ -78,6 +78,7 @@ enum_calc_size: case MONO_TYPE_I: case MONO_TYPE_U: case MONO_TYPE_PTR: + case MONO_TYPE_R4: case MONO_TYPE_SZARRAY: case MONO_TYPE_CLASS: case MONO_TYPE_OBJECT: @@ -91,7 +92,7 @@ enum_calc_size: simpletype = sig->params [i]->data.klass->enum_basetype->type; goto enum_calc_size; } - if ((size = mono_class_native_size (sig->params [i]->data.klass, NULL)) != 4) { + if ((size = mono_class_value_size (sig->params [i]->data.klass, NULL)) != 4) { stack_size += size + 3; stack_size &= ~3; code_size += 32; @@ -105,10 +106,6 @@ enum_calc_size: stack_size += 8; code_size += i < 10 ? 5 : 8; break; - case MONO_TYPE_R4: - stack_size += 4; - code_size += i < 10 ? 10 : 13; - break; case MONO_TYPE_R8: stack_size += 8; code_size += i < 10 ? 7 : 10; @@ -183,7 +180,7 @@ enum_marshal: break; case MONO_TYPE_VALUETYPE: if (!sig->params [i - 1]->data.klass->enumtype) { - int size = mono_class_native_size (sig->params [i - 1]->data.klass, NULL); + int size = mono_class_value_size (sig->params [i - 1]->data.klass, NULL); if (size == 4) { /* it's a structure that fits in 4 bytes, need to push the value pointed to */ x86_mov_reg_membase (p, X86_EAX, X86_EDX, arg_pos, 4); @@ -493,15 +490,8 @@ mono_create_method_pointer (MonoMethod *method) case MONO_TYPE_VOID: break; case MONO_TYPE_BOOLEAN: - case MONO_TYPE_I1: - case MONO_TYPE_U1: x86_mov_reg_membase (p, X86_EAX, X86_EAX, 0, 1); break; - case MONO_TYPE_CHAR: - case MONO_TYPE_I2: - case MONO_TYPE_U2: - x86_mov_reg_membase (p, X86_EAX, X86_EAX, 0, 2); - break; case MONO_TYPE_I4: case MONO_TYPE_U4: case MONO_TYPE_I: diff --git a/mono/dis/ChangeLog b/mono/dis/ChangeLog index 9895dbd8dbd..d2d0d7d12b0 100644 --- a/mono/dis/ChangeLog +++ b/mono/dis/ChangeLog @@ -1,14 +1,3 @@ -2003-08-22 Zoltan Varga <vargaz@freemail.hu> - - * main.c (dis_event_list): Same for event methods. - - * get.c (dis_stringify_method_signature): New argument specifying - whenever to return a fully qualified method name. - * dump.c main.c: Updated to work with the new function. - - * main.c (dis_property_methods): Print fully qualified method names - for property methods. Fixes #46221. - 2003-07-22 Jackson Harper <jackson@latitudegeo.com> * main.c: Dissasemble generic type parameters for type diff --git a/mono/dis/dump.c b/mono/dis/dump.c index cbb0176bc00..75cb86abbef 100644 --- a/mono/dis/dump.c +++ b/mono/dis/dump.c @@ -548,7 +548,7 @@ dump_table_method (MonoImage *m) sigblob = mono_metadata_blob_heap (m, cols [MONO_METHOD_SIGNATURE]); mono_metadata_decode_blob_size (sigblob, &sigblob); method = mono_metadata_parse_method_signature (m, i, sigblob, &sigblob); - sig = dis_stringify_method_signature (m, method, i, FALSE); + sig = dis_stringify_method_signature (m, method, i); fprintf (output, "%d: %s (param: %d)\n", i, sig, cols [MONO_METHOD_PARAMLIST]); g_free (sig); mono_metadata_free_method_signature (method); diff --git a/mono/dis/get.c b/mono/dis/get.c index 59bc08f6ee9..c4a45ecd602 100644 --- a/mono/dis/get.c +++ b/mono/dis/get.c @@ -450,7 +450,7 @@ dis_stringify_param (MonoImage *m, MonoType *param) } char* -dis_stringify_method_signature (MonoImage *m, MonoMethodSignature *method, int methoddef_row, gboolean fully_qualified) +dis_stringify_method_signature (MonoImage *m, MonoMethodSignature *method, int methoddef_row) { guint32 cols [MONO_METHOD_SIZE]; guint32 pcols [MONO_PARAM_SIZE]; @@ -458,7 +458,6 @@ dis_stringify_method_signature (MonoImage *m, MonoMethodSignature *method, int m const char *name = ""; int free_method = 0; char *retval; - char *type = NULL; GString *result = g_string_new (""); int i; @@ -466,8 +465,6 @@ dis_stringify_method_signature (MonoImage *m, MonoMethodSignature *method, int m if (methoddef_row) { mono_metadata_decode_row (&m->tables [MONO_TABLE_METHOD], methoddef_row -1, cols, MONO_METHOD_SIZE); - if (fully_qualified) - type = get_typedef (m, mono_metadata_typedef_from_method (m, methoddef_row)); name = mono_metadata_string_heap (m, cols [MONO_METHOD_NAME]); param_index = cols [MONO_METHOD_PARAMLIST]; if (!method) { @@ -482,10 +479,7 @@ dis_stringify_method_signature (MonoImage *m, MonoMethodSignature *method, int m if (method->hasthis) g_string_append (result, "instance "); g_string_append (result, map (method->call_convention, call_conv_type_map)); - g_string_sprintfa (result, " %s ", retval); - if (type) - g_string_sprintfa (result, "%s::", type); - g_string_sprintfa (result, "%s(", name); + g_string_sprintfa (result, " %s %s(", retval, name); g_free (retval); for (i = 0; i < method->param_count; ++i) { if (param_index && param_index <= m->tables [MONO_TABLE_PARAM].rows) { @@ -579,7 +573,7 @@ dis_stringify_type (MonoImage *m, MonoType *type) break; case MONO_TYPE_FNPTR: - bare = dis_stringify_method_signature (m, type->data.method, 0, FALSE); + bare = dis_stringify_method_signature (m, type->data.method, 0); break; case MONO_TYPE_PTR: { char *child_type; diff --git a/mono/dis/get.h b/mono/dis/get.h index 03eaba056f5..116549d1c5c 100644 --- a/mono/dis/get.h +++ b/mono/dis/get.h @@ -28,7 +28,7 @@ char *dis_stringify_token (MonoImage *m, guint32 token); char *dis_stringify_array (MonoImage *m, MonoArrayType *array); char *dis_stringify_modifiers (MonoImage *m, int n, MonoCustomMod *mod); char *dis_stringify_param (MonoImage *m, MonoType *param); -char *dis_stringify_method_signature (MonoImage *m, MonoMethodSignature *method, int methoddef_row, gboolean fully_qualified); +char *dis_stringify_method_signature (MonoImage *m, MonoMethodSignature *method, int methoddef_row); /* * These functions are used during the decoding of streams in the diff --git a/mono/dis/main.c b/mono/dis/main.c index 87424d397e5..525665a8ad3 100644 --- a/mono/dis/main.c +++ b/mono/dis/main.c @@ -516,7 +516,7 @@ dis_method_list (const char *klass_name, MonoImage *m, guint32 start, guint32 en sig = mono_metadata_blob_heap (m, cols [MONO_METHOD_SIGNATURE]); mono_metadata_decode_blob_size (sig, &sig); ms = mono_metadata_parse_method_signature (m, i + 1, sig, &sig); - sig_str = dis_stringify_method_signature (m, ms, i + 1, FALSE); + sig_str = dis_stringify_method_signature (m, ms, i + 1); fprintf (output, " // method line %d\n", i + 1); fprintf (output, " .method %s", flags); @@ -580,7 +580,7 @@ dis_property_methods (MonoImage *m, guint32 prop) start = mono_metadata_methods_from_property (m, prop, &end); while (start < end) { mono_metadata_decode_row (msemt, start, cols, MONO_METHOD_SEMA_SIZE); - sig = dis_stringify_method_signature (m, NULL, cols [MONO_METHOD_SEMA_METHOD], TRUE); + sig = dis_stringify_method_signature (m, NULL, cols [MONO_METHOD_SEMA_METHOD]); fprintf (output, "\t\t%s %s\n", type [cols [MONO_METHOD_SEMA_SEMANTICS]], sig); g_free (sig); ++start; @@ -683,7 +683,7 @@ dis_event_methods (MonoImage *m, guint32 event) start = mono_metadata_methods_from_event (m, event, &end); while (start < end) { mono_metadata_decode_row (msemt, start, cols, MONO_METHOD_SEMA_SIZE); - sig = dis_stringify_method_signature (m, NULL, cols [MONO_METHOD_SEMA_METHOD], TRUE); + sig = dis_stringify_method_signature (m, NULL, cols [MONO_METHOD_SEMA_METHOD]); switch (cols [MONO_METHOD_SEMA_SEMANTICS]) { case METHOD_SEMANTIC_OTHER: type = ".other"; break; diff --git a/mono/interpreter/ChangeLog b/mono/interpreter/ChangeLog index 009a3e29ce1..b0b656aa07e 100644 --- a/mono/interpreter/ChangeLog +++ b/mono/interpreter/ChangeLog @@ -1,40 +1,3 @@ -2003-08-30 Zoltan Varga <vargaz@freemail.hu> - - * interp.c: Use mono_field_from_token () in the appropriate places. - This simplifies the code and also fixes #48051. - -2003-08-27 Zoltan Varga <vargaz@freemail.hu> - - * interp.c (main): Fix the order of initialization calls so it maches - the order in the JIT.Patch by Bernie Solomon (bernard@ugsolutions.com). - Also remove the unused ms mutex. - - * interp.c: Get rid of metadata_section. - -2003-08-22 Zoltan Varga <vargaz@freemail.hu> - - * interp.c (main): Call g_thread_init () to make glib thread-safe. - Fixes #47682. Thanks to Laurent Morichetti (l_m@pacbell.net) for - reporting this. - -2003-08-18 Zoltan Varga <vargaz@freemail.hu> - - * interp.c: Get rid of duplicate definition of CHECK_MUL_OVERFLOW. - * interp.h interp.c: Get rid of VAL_VALUETA, use VAL_MP instead. Fix - the INITOBJ opcode which was the only user of VALUETA. - -2003-08-16 Zoltan Varga <vargaz@freemail.hu> - - * interp.c (ves_exec_method): Implemented mul.ovf correctly for int32 - and int64. Implement the conv.ovf opcodes for all argument types. - -2003-08-15 Zoltan Varga <vargaz@freemail.hu> - - * interp.c (ves_exec_method): Handle non-valuetypes in CEE_STOBJ. - Fixes #46781. - (ves_exec_method): Added support for the synchronized flag to the - interpreter. Also fixed the CALLI opcode, and made exception handling - work though the managed-unmanaged barrier. Fri Jul 25 19:06:27 CEST 2003 Paolo Molaro <lupus@ximian.com> diff --git a/mono/interpreter/interp.c b/mono/interpreter/interp.c index 39bb85ff9a7..1f2f81e57db 100644 --- a/mono/interpreter/interp.c +++ b/mono/interpreter/interp.c @@ -258,7 +258,7 @@ stackval_from_data (MonoType *type, stackval *result, char *data, gboolean pinvo result->type = VAL_OBJ; break; default: - result->type = VAL_MP; + result->type = VAL_VALUETA; break; } result->data.p = *(gpointer*)data; @@ -559,7 +559,7 @@ ves_array_element_address (MonoInvocation *frame) esize = mono_array_element_size (ac); ea = mono_array_addr_with_size (ao, esize, pos); - frame->retval->type = VAL_MP; + frame->retval->type = VAL_TP; frame->retval->data.p = ea; } @@ -892,6 +892,8 @@ calc_offsets (MonoImage *image, MonoMethod *method) } offsets [1] = offset; + /* FIXME: This might cause a deadlock with domain->lock */ + EnterCriticalSection (metadata_section); /* intern the strings in the method. */ ip = header->code; end = ip + header->code_size; @@ -921,7 +923,13 @@ calc_offsets (MonoImage *image, MonoMethod *method) break; case MonoInlineField: token = read32 (ip + 1); - mono_field_from_token (image, token, &class); + if (mono_metadata_token_table (token) == MONO_TABLE_MEMBERREF) { + mono_field_from_memberref (image, token, &class); + } else { + class = mono_class_get (image, + MONO_TOKEN_TYPE_DEF | mono_metadata_typedef_from_field (image, token & 0xffffff)); + } + mono_class_init (class); mono_class_vtable (domain, class); ip += 5; break; @@ -983,6 +991,7 @@ calc_offsets (MonoImage *image, MonoMethod *method) if (strcmp (method->name, "GetElementType") == 0) method->addr = GUINT_TO_POINTER (INLINE_TYPE_ELEMENT_TYPE); } + LeaveCriticalSection (metadata_section); mono_profiler_method_end_jit (method, MONO_PROFILE_OK); } @@ -1096,25 +1105,19 @@ verify_method (MonoMethod *m) /* Resolves to TRUE if the operands would overflow */ #define CHECK_MUL_OVERFLOW(a,b) \ ((gint32)(a) == 0) || ((gint32)(b) == 0) ? 0 : \ - (((gint32)(a) > 0) && ((gint32)(b) == -1)) ? FALSE : \ - (((gint32)(a) < 0) && ((gint32)(b) == -1)) ? (a == - MYGINT32_MAX) : \ - (((gint32)(a) > 0) && ((gint32)(b) > 0)) ? (gint32)(a) > ((MYGINT32_MAX) / (gint32)(b)) : \ - (((gint32)(a) > 0) && ((gint32)(b) < 0)) ? (gint32)(a) > ((MYGINT32_MIN) / (gint32)(b)) : \ - (((gint32)(a) < 0) && ((gint32)(b) > 0)) ? (gint32)(a) < ((MYGINT32_MIN) / (gint32)(b)) : \ - (gint32)(a) < ((MYGINT32_MAX) / (gint32)(b)) + (((gint32)(a) > 0) && ((gint32)(b) > 0)) || (((gint32)(a) < 0) && ((gint32)(b) < 0)) ? \ + (gint32)(b) > ((MYGINT32_MAX) / (gint32)(a)) : \ + (gint32)(b) < ((MYGINT32_MIN) / (gint32)(a)) #define CHECK_MUL_OVERFLOW_UN(a,b) \ ((guint32)(a) == 0) || ((guint32)(b) == 0) ? 0 : \ (guint32)(b) > ((MYGUINT32_MAX) / (guint32)(a)) - + #define CHECK_MUL_OVERFLOW64(a,b) \ ((gint64)(a) == 0) || ((gint64)(b) == 0) ? 0 : \ - (((gint64)(a) > 0) && ((gint64)(b) == -1)) ? FALSE : \ - (((gint64)(a) < 0) && ((gint64)(b) == -1)) ? (a == - MYGINT64_MAX) : \ - (((gint64)(a) > 0) && ((gint64)(b) > 0)) ? (gint64)(a) > ((MYGINT64_MAX) / (gint64)(b)) : \ - (((gint64)(a) > 0) && ((gint64)(b) < 0)) ? (gint64)(a) > ((MYGINT64_MIN) / (gint64)(b)) : \ - (((gint64)(a) < 0) && ((gint64)(b) > 0)) ? (gint64)(a) < ((MYGINT64_MIN) / (gint64)(b)) : \ - (gint64)(a) < ((MYGINT64_MAX) / (gint64)(b)) + (((gint64)(a) > 0) && ((gint64)(b) > 0)) || (((gint64)(a) < 0) && ((gint64)(b) < 0)) ? \ + (gint64)(b) > ((MYGINT64_MAX) / (gint64)(a)) : \ + (gint64)(b) < ((MYGINT64_MIN) / (gint64)(a)) #define CHECK_MUL_OVERFLOW64_UN(a,b) \ ((guint64)(a) == 0) || ((guint64)(b) == 0) ? 0 : \ @@ -1473,7 +1476,10 @@ ves_exec_method (MonoInvocation *frame) sp->data.vt.klass = c; sp->data.vt.vt = ARG_POS (*ip); - sp->type = VAL_MP; + if (c->valuetype) + sp->type = VAL_VALUETA; + else + sp->type = VAL_TP; ++sp; ++ip; @@ -1503,7 +1509,10 @@ ves_exec_method (MonoInvocation *frame) sp->data.vt.klass = c; sp->data.p = LOCAL_POS (*ip); - sp->type = VAL_MP; + if (c->valuetype) + sp->type = VAL_VALUETA; + else + sp->type = VAL_TP; ++sp; ++ip; @@ -1598,23 +1607,7 @@ ves_exec_method (MonoInvocation *frame) --sp; vt_free (sp); BREAK; - CASE (CEE_JMP) { - guint32 token; - - frame->ip = ip; - - ++ip; - token = read32 (ip); - ip += 4; - - child_frame.method = mono_get_method (image, token, NULL); - if (!child_frame.method) - THROW_EX (mono_get_exception_missing_method (), ip -5); - - ves_abort (); - - BREAK; - } + CASE (CEE_JMP) ves_abort(); BREAK; CASE (CEE_CALLVIRT) /* Fall through */ CASE (CEE_CALLI) /* Fall through */ CASE (CEE_CALL) { @@ -1643,13 +1636,10 @@ ves_exec_method (MonoInvocation *frame) if (frame->method->wrapper_type != MONO_WRAPPER_NONE) { csignature = (MonoMethodSignature *)mono_method_get_wrapper_data (frame->method, token); child_frame.method = NULL; + } else if ((ji = mono_jit_info_table_find (mono_root_domain, code))) { + child_frame.method = ji->method; } else { - csignature = mono_metadata_parse_signature (image, token); - if ((ji = mono_jit_info_table_find (mono_root_domain, code))) { - child_frame.method = ji->method; - } else { - g_assert_not_reached (); - } + g_assert_not_reached (); } g_assert (code); } else { @@ -1667,10 +1657,6 @@ ves_exec_method (MonoInvocation *frame) } } - if (frame->method->wrapper_type == MONO_WRAPPER_NONE) - if (child_frame.method && child_frame.method->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED) - child_frame.method = mono_marshal_get_synchronized_wrapper (child_frame.method); - g_assert (csignature->call_convention == MONO_CALL_DEFAULT); /* decrement by the actual number of args */ if (csignature->param_count) { @@ -1684,7 +1670,7 @@ ves_exec_method (MonoInvocation *frame) --sp; /* * It may also be a TP from LD(S)FLDA - * g_assert (sp->type == VAL_OBJ || sp->type == VAL_MP); + * g_assert (sp->type == VAL_OBJ || sp->type == VAL_VALUETA); */ if (sp->type == VAL_OBJ && child_frame.method && child_frame.method->klass->valuetype) /* unbox it */ @@ -1707,10 +1693,6 @@ ves_exec_method (MonoInvocation *frame) if (!child_frame.method) { g_assert (code); ves_pinvoke_method (&child_frame, csignature, (MonoFunc) code, FALSE); - if (child_frame.ex) { - frame->ex = child_frame.ex; - goto handle_exception; - } } else if (csignature->hasthis && sp->type == VAL_OBJ && ((MonoObject *)sp->data.p)->vtable->klass == mono_defaults.transparent_proxy_class) { g_assert (child_frame.method); @@ -2839,17 +2821,20 @@ array_constructed: field = mono_class_get_field (klass, token); addr = mono_load_remote_field (obj, klass, field, NULL); } else { - field = mono_field_from_token (image, token, NULL); + if (mono_metadata_token_table (token) == MONO_TABLE_MEMBERREF) + field = mono_field_from_memberref (image, token, NULL); + else + field = mono_class_get_field (obj->vtable->klass, token); addr = (char*)obj + field->offset; } } else { obj = sp [-1].data.vt.vt; - field = mono_field_from_token (image, token, NULL); + field = mono_class_get_field (sp [-1].data.vt.klass, token); addr = (char*)obj + field->offset - sizeof (MonoObject); } if (load_addr) { - sp [-1].type = VAL_MP; + sp [-1].type = VAL_TP; sp [-1].data.p = addr; sp [-1].data.vt.klass = mono_class_from_mono_type (field->type); } else { @@ -2883,14 +2868,17 @@ array_constructed: mono_store_remote_field (obj, klass, field, &sp [1].data); offset = field->offset; } else { - field = mono_field_from_token (image, token, NULL); + if (mono_metadata_token_table (token) == MONO_TABLE_MEMBERREF) + field = mono_field_from_memberref (image, token, NULL); + else + field = mono_class_get_field (obj->vtable->klass, token); offset = field->offset; stackval_to_data (field->type, &sp [1], (char*)obj + offset, FALSE); vt_free (&sp [1]); } } else { obj = sp [0].data.vt.vt; - field = mono_field_from_token (image, token, NULL); + field = mono_class_get_field (sp [0].data.vt.klass, token); offset = field->offset - sizeof (MonoObject); stackval_to_data (field->type, &sp [1], (char*)obj + offset, FALSE); vt_free (&sp [1]); @@ -2911,7 +2899,14 @@ array_constructed: token = read32 (ip); ip += 4; - field = mono_field_from_token (image, token, &klass); + /* need to handle fieldrefs */ + if (mono_metadata_token_table (token) == MONO_TABLE_MEMBERREF) { + field = mono_field_from_memberref (image, token, &klass); + } else { + klass = mono_class_get (image, + MONO_TOKEN_TYPE_DEF | mono_metadata_typedef_from_field (image, token & 0xffffff)); + field = mono_class_get_field (klass, token); + } g_assert (field); vt = mono_class_vtable (domain, klass); @@ -2923,7 +2918,7 @@ array_constructed: addr = mono_threads_get_static_data (GPOINTER_TO_UINT (addr)); if (load_addr) { - sp->type = VAL_MP; + sp->type = VAL_TP; sp->data.p = addr; sp->data.vt.klass = mono_class_from_mono_type (field->type); } else { @@ -2945,7 +2940,14 @@ array_constructed: ip += 4; --sp; - field = mono_field_from_token (image, token, &klass); + /* need to handle fieldrefs */ + if (mono_metadata_token_table (token) == MONO_TABLE_MEMBERREF) { + field = mono_field_from_memberref (image, token, &klass); + } else { + klass = mono_class_get (image, + MONO_TOKEN_TYPE_DEF | mono_metadata_typedef_from_field (image, token & 0xffffff)); + field = mono_class_get_field (klass, token); + } g_assert (field); vt = mono_class_vtable (domain, klass); @@ -2966,15 +2968,7 @@ array_constructed: vtklass = mono_class_get (image, read32 (ip)); ip += 4; sp -= 2; - - /* - * LAMESPEC: According to the spec, the stack should contain a - * pointer to a value type. In reality, it can contain anything. - */ - if (sp [1].type == VAL_VALUET) - memcpy (sp [0].data.p, sp [1].data.vt.vt, mono_class_value_size (vtklass, NULL)); - else - memcpy (sp [0].data.p, &sp [1].data, mono_class_value_size (vtklass, NULL)); + memcpy (sp [0].data.p, sp [1].data.vt.vt, mono_class_value_size (vtklass, NULL)); BREAK; } #if SIZEOF_VOID_P == 8 @@ -3075,7 +3069,7 @@ array_constructed: case CEE_CONV_OVF_I_UN: /* Fall through */ #endif case CEE_CONV_OVF_I4_UN: - if (value > MYGUINT32_MAX) + if (value > 2147483647) THROW_EX (mono_get_exception_overflow (), ip); sp [-1].data.i = value; sp [-1].type = VAL_I32; @@ -3370,87 +3364,68 @@ array_constructed: CASE (CEE_UNUSED15) CASE (CEE_UNUSED16) CASE (CEE_UNUSED17) ves_abort(); BREAK; - -#if SIZEOF_VOID_P == 4 - CASE (CEE_CONV_OVF_I) - CASE (CEE_CONV_OVF_U) -#endif CASE (CEE_CONV_OVF_I1) - CASE (CEE_CONV_OVF_I2) - CASE (CEE_CONV_OVF_I4) - CASE (CEE_CONV_OVF_U1) - CASE (CEE_CONV_OVF_U2) - CASE (CEE_CONV_OVF_U4) { - gint64 value; - switch (sp [-1].type) { - case VAL_DOUBLE: - value = (gint64)sp [-1].data.f; - break; - case VAL_I64: - value = (gint64)sp [-1].data.l; - break; - case VAL_VALUET: - ves_abort(); - case VAL_I32: - value = (gint64)sp [-1].data.i; - break; - default: - value = (gint64)sp [-1].data.nati; - break; - } - switch (*ip) { - case CEE_CONV_OVF_I1: - if (value < -128 || value > 127) - THROW_EX (mono_get_exception_overflow (), ip); - sp [-1].data.i = value; - sp [-1].type = VAL_I32; - break; - case CEE_CONV_OVF_I2: - if (value < -32768 || value > 32767) + if (sp [-1].type == VAL_I32) { + if (sp [-1].data.i < 128 || sp [-1].data.i > 127) THROW_EX (mono_get_exception_overflow (), ip); - sp [-1].data.i = value; - sp [-1].type = VAL_I32; - break; -#if SIZEOF_VOID_P == 4 - case CEE_CONV_OVF_I: /* Fall through */ -#endif - case CEE_CONV_OVF_I4: - if (value < MYGINT32_MIN || value > MYGINT32_MAX) + sp [-1].data.i = (gint8)sp [-1].data.i; + } else if (sp [-1].type == VAL_I64) { + if (sp [-1].data.l < 128 || sp [-1].data.l > 127) THROW_EX (mono_get_exception_overflow (), ip); - sp [-1].data.i = value; - sp [-1].type = VAL_I32; - break; - case CEE_CONV_OVF_U1: - if (value < 0 || value > 255) + sp [-1].data.i = (gint8)sp [-1].data.l; + } else { + ves_abort(); + } + ++ip; + BREAK; + CASE (CEE_CONV_OVF_U1) + if (sp [-1].type == VAL_I32) { + if (sp [-1].data.i < 0 || sp [-1].data.i > 255) THROW_EX (mono_get_exception_overflow (), ip); - sp [-1].data.i = value; - sp [-1].type = VAL_I32; - break; - case CEE_CONV_OVF_U2: - if (value < 0 || value > 65535) + sp [-1].data.i = (gint8)sp [-1].data.i; + } else if (sp [-1].type == VAL_I64) { + if (sp [-1].data.l < 0 || sp [-1].data.l > 255) THROW_EX (mono_get_exception_overflow (), ip); - sp [-1].data.i = value; + sp [-1].data.i = (gint8)sp [-1].data.l; + } else { + ves_abort(); + } + ++ip; + BREAK; + CASE (CEE_CONV_OVF_I2) + CASE (CEE_CONV_OVF_U2) + ++ip; + /* FIXME: handle other cases */ + if (sp [-1].type == VAL_I32) { + /* defined as NOP */ + } else { + ves_abort(); + } + BREAK; + CASE (CEE_CONV_OVF_I4) + /* FIXME: handle other cases */ + if (sp [-1].type == VAL_I32) { + /* defined as NOP */ + } else if(sp [-1].type == VAL_I64) { + sp [-1].data.i = (gint32)sp [-1].data.l; sp [-1].type = VAL_I32; - break; -#if SIZEOF_VOID_P == 4 - case CEE_CONV_OVF_U: /* Fall through */ -#endif - case CEE_CONV_OVF_U4: - if (value < 0 || value > MYGUINT32_MAX) - THROW_EX (mono_get_exception_overflow (), ip); - sp [-1].data.i = value; + } else { + ves_abort(); + } + ++ip; + BREAK; + CASE (CEE_CONV_OVF_U4) + /* FIXME: handle other cases */ + if (sp [-1].type == VAL_I32) { + /* defined as NOP */ + } else if(sp [-1].type == VAL_I64) { + sp [-1].data.i = (guint32)sp [-1].data.l; sp [-1].type = VAL_I32; - break; - default: - g_assert_not_reached (); + } else { + ves_abort(); } ++ip; BREAK; - } - -#if SIZEOF_VOID_P == 8 - CASE (CEE_CONV_OVF_I) -#endif CASE (CEE_CONV_OVF_I8) /* FIXME: handle other cases */ if (sp [-1].type == VAL_I32) { @@ -3463,10 +3438,6 @@ array_constructed: } ++ip; BREAK; - -#if SIZEOF_VOID_P == 8 - CASE (CEE_CONV_OVF_U) -#endif CASE (CEE_CONV_OVF_U8) /* FIXME: handle other cases */ if (sp [-1].type == VAL_I32) { @@ -3515,6 +3486,29 @@ array_constructed: ++sp; BREAK; } + CASE (CEE_CONV_OVF_I) + ++ip; + --sp; + /* FIXME: check overflow. */ + switch (sp->type) { + case VAL_I32: + sp->data.p = (gpointer)(mono_i) sp->data.i; + break; + case VAL_I64: + sp->data.p = (gpointer)(mono_i) sp->data.l; + break; + case VAL_NATI: + break; + case VAL_DOUBLE: + sp->data.p = (gpointer)(mono_i) sp->data.f; + break; + default: + ves_abort (); + } + sp->type = VAL_NATI; + ++sp; + BREAK; + CASE (CEE_CONV_OVF_U) ves_abort(); BREAK; CASE (CEE_ADD_OVF) --sp; /* FIXME: check overflow */ @@ -3558,6 +3552,7 @@ array_constructed: CASE (CEE_MUL_OVF) ++ip; --sp; + /* FIXME: check overflow */ if (sp->type == VAL_I32) { if (CHECK_MUL_OVERFLOW (sp [-1].data.i, GET_NATI (sp [0]))) THROW_EX (mono_get_exception_overflow (), ip); @@ -3753,7 +3748,7 @@ array_constructed: case CEE_MONO_VTADDR: { ++ip; - sp->type = VAL_MP; + sp->type = VAL_VALUETA; /* do nothing? */ break; } @@ -3985,15 +3980,6 @@ array_constructed: m = get_virtual_method (domain, m, sp); } - - /* - * This prevents infinite cycles since the wrapper contains - * an ldftn too. - */ - if (frame->method->wrapper_type != MONO_WRAPPER_SYNCHRONIZED) - if (m && m->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED) - m = mono_marshal_get_synchronized_wrapper (m); - sp->type = VAL_NATI; sp->data.p = mono_create_method_pointer (m); sp->data.vt.klass = NULL; @@ -4024,7 +4010,10 @@ array_constructed: sp->data.vt.klass = c; sp->data.vt.vt = ARG_POS (anum); - sp->type = VAL_MP; + if (c->valuetype) + sp->type = VAL_VALUETA; + else + sp->type = VAL_TP; ++sp; break; @@ -4062,7 +4051,10 @@ array_constructed: sp->data.vt.vt = LOCAL_POS (loc_pos); sp->data.vt.klass = c; - sp->type = VAL_MP; + if (c->valuetype) + sp->type = VAL_VALUETA; + else + sp->type = VAL_TP; ++sp; break; @@ -4083,7 +4075,7 @@ array_constructed: THROW_EX (mono_get_exception_execution_engine (NULL), ip - 1); ++ip; sp->data.p = alloca (sp->data.i); - sp->type = VAL_MP; + sp->type = VAL_TP; sp++; break; case CEE_UNUSED57: ves_abort(); break; @@ -4102,17 +4094,16 @@ array_constructed: break; case CEE_INITOBJ: { guint32 token; - MonoClass *class; - ++ip; token = read32 (ip); ip += 4; - - class = mono_class_get (image, token); - + /* + * we ignore the value of token (I think we can as unspecified + * behavior described in Partition II, 3.5). + */ --sp; - g_assert (sp->type == VAL_TP || sp->type == VAL_MP); - memset (sp->data.vt.vt, 0, mono_class_value_size (class, NULL)); + g_assert (sp->type == VAL_VALUETA || sp->type == VAL_TP); + memset (sp->data.vt.vt, 0, mono_class_value_size (sp->data.vt.klass, NULL)); break; } case CEE_CONSTRAINED_: { @@ -4232,7 +4223,6 @@ array_constructed: if (tracing) g_print ("* Found handler at '%s'\n", inv->method->name); #endif - /* * It seems that if the catch handler is found in the same method, * it gets executed before the finally handler. @@ -4321,7 +4311,7 @@ die_on_ex: ip_offset = frame->ip - header->code; for (i = 0; i < header->num_clauses; ++i) { clause = &header->clauses [i]; - if (clause->flags == MONO_EXCEPTION_CLAUSE_FAULT && MONO_OFFSET_IN_CLAUSE (clause, ip_offset)) { + if (clause->flags == 3 && MONO_OFFSET_IN_CLAUSE (clause, ip_offset)) { ip = header->code + clause->handler_offset; #if DEBUG_INTERP if (tracing) @@ -4349,15 +4339,8 @@ die_on_ex: ++sp; goto main_loop; } - if (!frame->parent) { - /* Pass the exception though the managed barrier if possible */ - MonoInvocation *parent = TlsGetValue (frame_thread_id); - if (parent) { - parent->ex = frame->ex; - longjmp (*(jmp_buf*)parent->locals, 1); - } + if (!frame->parent) goto die_on_ex; - } DEBUG_LEAVE (); return; } @@ -4526,6 +4509,8 @@ quit_function (MonoDomain *domain, gpointer user_data) } +static CRITICAL_SECTION ms; + int main (int argc, char *argv []) { @@ -4581,11 +4566,15 @@ main (int argc, char *argv []) g_set_prgname (file); mono_set_rootdir (); + mono_config_parse (config_file); g_log_set_always_fatal (G_LOG_LEVEL_ERROR); g_log_set_fatal_mask (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR); - g_thread_init (NULL); + mono_init_icall (); + mono_add_internal_call ("System.Diagnostics.StackFrame::get_frame_info", ves_icall_get_frame_info); + mono_add_internal_call ("System.Diagnostics.StackTrace::get_trace", ves_icall_get_trace); + mono_add_internal_call ("Mono.Runtime::mono_runtime_install_handlers", mono_runtime_install_handlers); frame_thread_id = TlsAlloc (); TlsSetValue (frame_thread_id, NULL); @@ -4598,13 +4587,9 @@ main (int argc, char *argv []) mono_install_stack_walk (interp_walk_stack); mono_runtime_install_cleanup (quit_function); + metadata_section = &ms; + InitializeCriticalSection (metadata_section); domain = mono_init (file); - mono_config_parse (config_file); - mono_init_icall (); - mono_add_internal_call ("System.Diagnostics.StackFrame::get_frame_info", ves_icall_get_frame_info); - mono_add_internal_call ("System.Diagnostics.StackTrace::get_trace", ves_icall_get_trace); - mono_add_internal_call ("Mono.Runtime::mono_runtime_install_handlers", mono_runtime_install_handlers); - mono_runtime_init (domain, NULL, NULL); main_args.domain=domain; diff --git a/mono/interpreter/interp.h b/mono/interpreter/interp.h index 4fa68268d8d..90bbbbfc185 100644 --- a/mono/interpreter/interp.h +++ b/mono/interpreter/interp.h @@ -14,6 +14,7 @@ enum { VAL_MP = 1 + VAL_POINTER, VAL_TP = 2 + VAL_POINTER, VAL_OBJ = 3 + VAL_POINTER, + VAL_VALUETA = 8 }; #if SIZEOF_VOID_P == 4 @@ -57,7 +58,6 @@ struct _MonoInvocation { char *args; stackval *stack_args; /* parent */ stackval *stack; - stackval *sp; /* For GC stack marking */ /* exception info */ int invoke_trap; const unsigned char *ip; diff --git a/mono/io-layer/ChangeLog b/mono/io-layer/ChangeLog index 02e6671d452..4277286758e 100644 --- a/mono/io-layer/ChangeLog +++ b/mono/io-layer/ChangeLog @@ -1,14 +1,3 @@ -2003-09-02 Dick Porter <dick@ximian.com> - - * io.c: Work around glib brain-dead assumptions about utf8-encoded - filenames. Fixes bug 30781. - -2003-08-28 Dick Porter <dick@ximian.com> - - * critical-sections.c: Patch from Bernie Solomon - <bernard@ugsolutions.com> to emit a warning if locking a critical - section fails. - 2003-07-23 Dick Porter <dick@ximian.com> * shared.c: diff --git a/mono/io-layer/critical-sections.c b/mono/io-layer/critical-sections.c index e3ed4613bf1..e3b4326bdc5 100644 --- a/mono/io-layer/critical-sections.c +++ b/mono/io-layer/critical-sections.c @@ -135,12 +135,7 @@ gboolean TryEnterCriticalSection(WapiCriticalSection *section) */ void EnterCriticalSection(WapiCriticalSection *section) { - int stat; - - if ((stat = mono_mutex_lock(§ion->mutex)) != 0) { - g_error (G_GNUC_PRETTY_FUNCTION - ": EnterCriticalSection failed: %s", g_strerror(stat)); - } + mono_mutex_lock(§ion->mutex); } /** diff --git a/mono/io-layer/io.c b/mono/io-layer/io.c index bf7d42f6d54..19aa84182b3 100644 --- a/mono/io-layer/io.c +++ b/mono/io-layer/io.c @@ -2356,7 +2356,6 @@ gboolean FindNextFile (gpointer handle, WapiFindData *find_data) gboolean ok; struct stat buf; const gchar *filename; - gchar *utf8_filename; gchar *base_filename; gunichar2 *utf16_basename; @@ -2401,23 +2400,6 @@ retry: } } - /* Work around glib brain-damage, where it expects all filenames - * to be validly utf8-encoded - */ - if(g_utf8_validate(filename, -1, NULL)) { - utf8_filename=g_strdup(filename); - } else { - utf8_filename=g_locale_to_utf8(filename, -1, NULL, NULL, NULL); - } - - /* Final check... */ - if(g_utf8_validate(utf8_filename, -1, NULL)==FALSE) { - /* glib can't cope with this filename, so just ignore it - * instead of crashing. - */ - g_free(utf8_filename); - goto retry; - } /* fill data block */ @@ -2444,7 +2426,7 @@ retry: find_data->dwReserved0 = 0; find_data->dwReserved1 = 0; - base_filename = g_path_get_basename (utf8_filename); + base_filename = g_path_get_basename (filename); utf16_basename = g_utf8_to_utf16 (base_filename, MAX_PATH, NULL, NULL, NULL); i = 0; @@ -2457,7 +2439,6 @@ retry: find_data->cAlternateFileName [0] = 0; /* not used */ g_free (base_filename); - g_free (utf8_filename); g_free (utf16_basename); return TRUE; } @@ -2740,41 +2721,25 @@ extern gboolean SetFileAttributes (const gunichar2 *name, guint32 attrs) */ extern guint32 GetCurrentDirectory (guint32 length, gunichar2 *buffer) { - gchar *path, *utf8_path; + gchar *path; gunichar2 *utf16_path, *ptr; glong count = 0; path = g_get_current_dir (); if (path == NULL) return 0; - - /* No, g_get_current_dir () does not return utf8 strings */ - if(g_utf8_validate(path, -1, NULL)) { - utf8_path=g_strdup(path); - } else { - utf8_path=g_locale_to_utf8(path, -1, NULL, NULL, NULL); - } - - if(g_utf8_validate(utf8_path, -1, NULL)==FALSE) { - g_free(utf8_path); - return(0); - } /* if buffer too small, return number of characters required. * this is plain dumb. */ - count = strlen (utf8_path) + 1; - if (count > length) { - g_free(utf8_path); - return (count); - } + count = strlen (path) + 1; + if (count > length) + return count; - utf16_path = g_utf8_to_utf16 (utf8_path, -1, NULL, NULL, NULL); - if (utf16_path == NULL) { - g_free(utf8_path); - return (0); - } + utf16_path = g_utf8_to_utf16 (path, -1, NULL, NULL, NULL); + if (utf16_path == NULL) + return 0; ptr = utf16_path; while (*ptr) @@ -2782,7 +2747,6 @@ extern guint32 GetCurrentDirectory (guint32 length, gunichar2 *buffer) *buffer = 0; - g_free (utf8_path); g_free (utf16_path); g_free (path); @@ -2957,7 +2921,6 @@ gboolean CreatePipe (gpointer *readpipe, gpointer *writepipe, guint32 GetTempPath (guint32 len, gunichar2 *buf) { gchar *tmpdir=g_strdup (g_get_tmp_dir ()); - gchar *utf8_tmpdir; gunichar2 *tmpdir16=NULL; glong dirlen, bytes; guint32 ret; @@ -2967,25 +2930,7 @@ guint32 GetTempPath (guint32 len, gunichar2 *buf) tmpdir=g_strdup_printf ("%s/", g_get_tmp_dir ()); } - /* g_get_tmp_dir () doesn't return utf8 either */ - if(g_utf8_validate(tmpdir, -1, NULL)) { - utf8_tmpdir=g_strdup(tmpdir); - } else { - utf8_tmpdir=g_locale_to_utf8(tmpdir, -1, NULL, NULL, NULL); - } - - if(g_utf8_validate(utf8_tmpdir, -1, NULL)==FALSE) { - /* FIXME - set error code */ -#ifdef DEBUG - g_message (G_GNUC_PRETTY_FUNCTION ": UTF8 error"); -#endif - - g_free(tmpdir); - g_free(utf8_tmpdir); - return(0); - } - - tmpdir16=g_utf8_to_utf16 (utf8_tmpdir, -1, NULL, &dirlen, NULL); + tmpdir16=g_utf8_to_utf16 (tmpdir, -1, NULL, &dirlen, NULL); if(tmpdir16==NULL) { /* FIXME - set error code */ #ifdef DEBUG @@ -3014,7 +2959,6 @@ guint32 GetTempPath (guint32 len, gunichar2 *buf) if(tmpdir16!=NULL) { g_free (tmpdir16); } - g_free (utf8_tmpdir); g_free (tmpdir); return(ret); diff --git a/mono/metadata/.cvsignore b/mono/metadata/.cvsignore index 18f33722269..75d912a3efe 100644 --- a/mono/metadata/.cvsignore +++ b/mono/metadata/.cvsignore @@ -1,7 +1,6 @@ Makefile Makefile.in pedump -monosn .libs .deps *.lo diff --git a/mono/metadata/ChangeLog b/mono/metadata/ChangeLog index 6bb2ccdab6e..5107280e8ba 100644 --- a/mono/metadata/ChangeLog +++ b/mono/metadata/ChangeLog @@ -1,305 +1,3 @@ -2003-09-08 Zoltan Varga <vargaz@freemail.hu> - - * image.c (load_class_names): Use a temporary hash table to hold the - namespaces in order to avoid doing many string comparisons. - - * image.h: Fix typo. - - * image.c class.c rawbuffer.c reflection.c threads.c verify.c domain.c: - Pass NULL instead of g_direct_equal to the GHashTable constructor - since the NULL case is short-circuited inside g_hash_table_lookup, - leading to better performance. - - * metadata.c (mono_metadata_custom_attrs_from_index): New function to - obtain the first custom attribute for a given index. Depends on the - CustomAttribute table being sorted by the parent field. - - * reflection.c (mono_custom_attrs_from_index): Use the new function - for better performance. - -2003-09-07 Martin Baulig <martin@ximian.com> - - * class.c (mono_class_init): If we're a generic instance, inflate - all our methods instead of loading them from the image. - (mono_class_from_generic): Set `class->methods = gklass->methods'. - -2003-09-07 Martin Baulig <martin@ximian.com> - - * mono-debug-debugger.c: Added support for constructors. - ->>>>>>> 1.1094 -2003-09-06 Martin Baulig <martin@ximian.com> - - * icall.c (ves_icall_TypeBuilder_get_IsUnboundGenericParameter): - New interncall. - - * reflection.c (mono_reflection_setup_generic_class): Call - ensure_runtime_vtable() to create the vtable. - -2003-09-05 Martin Baulig <martin@ximian.com> - - * class.c (mono_class_array_element_size): Added MONO_TYPE_VAR and - MONO_TYPE_MVAR. - -2003-09-04 Martin Baulig <martin@ximian.com> - - * reflection.c (mono_reflection_define_generic_parameter): Generic - parameters start with zero. - -2003-09-04 Martin Baulig <martin@ximian.com> - - * metadata.c (mono_type_size): Added MONO_TYPE_VAR and MONO_TYPE_MVAR. - - * reflection.h (MonoReflectionGenericParam): New typedef. - (MonoReflectionTypeBuilder): Added `generic_params' fields to get - the generic parameters from the managed TypeBuilder. - - * reflection.c (mono_reflection_define_generic_parameter): New function. - (mono_reflection_create_runtime_class): Encode generic parameters. - (mono_reflection_setup_generic_class): New function; this is - called after adding adding all generic params to the TypeBuilder. - (encode_type): Added MONO_TYPE_VAR. - -2003-09-04 Zoltan Varga <vargaz@freemail.hu> - - * class.h class.c (mono_class_needs_cctor_run): Moved this method - here from the JIT. - - * assembly.h assembly.c: Moved the AOT loading code into an assembly - load hook. - -2003-09-03 Zoltan Varga <vargaz@freemail.hu> - - * reflection.h reflection.c class.h class.c: Delete duplicate - definition of mono_type_get_name () from reflection.c and export the - one in class.c. - - * class.c: Class loading fixes from Bernie Solomon - (bernard@ugsolutions.com). - - * reflection.c: Endianness fixes from Bernie Solomon - (bernard@ugsolutions.com). - -2003-09-01 Zoltan Varga <vargaz@freemail.hu> - - * assembly.h assembly.c: Define a file format version for AOT - libraries. - - * assembly.c (mono_assembly_open): Fix leaking of MonoImage-s. - - * appdomain.h (MonoJitInfo): New field to determine whenever the - code is domain neutral. - -2003-08-31 Miguel de Icaza <miguel@ximian.com> - - * marshal.c (emit_struct_conv): Add MONO_TYPE_CHAR - -2003-08-30 Zoltan Varga <vargaz@freemail.hu> - - * icall.c (ves_icall_System_Web_Util_ICalls_get_machine_install_dir): - (ves_icall_System_Configuration_DefaultConfig_get_machine_config_path): - Avoid caching the result since strings must be domain specific. Fixes - #48050. - -2003-08-29 Zoltan Varga <vargaz@freemail.hu> - - * marshal.c (mono_marshal_init): Make this callable multiple times - since it is hard to find a correct place to call it. - - * object.c (mono_runtime_class_init): Execute static constructors in - the correct appdomain. - - * image.c (build_guid_table): Handle the case when multiple images have - the same GUID. - -2003-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * icall.c: added a couple of icalls for System.Web. - -2003-08-28 Martin Baulig <martin@ximian.com> - - * icall.c (ves_icall_Type_BindGenericParameters): Use - `klass->generic_inst' instead of `&klass->byval_arg' in the - mono_type_get_object() call. The returned type must be - MONO_TYPE_GENERICINST and not MONO_TYPE_CLASS. - -2003-08-27 Zoltan Varga <vargaz@freemail.hu> - - * NOTES: New file. - - * object.c (mono_class_proxy_vtable): Make it thread safe. - - * pedump.c: Fix warning. - - * object.c appdomain.h: Get rid of metadata_section. - It is no longer needed and it was causing deadlocks with domain->lock. - - * appdomain.c (add_assemblies_to_domain): Make it thread safe. - -2003-08-26 Martin Baulig <martin@ximian.com> - - * pedump.c (main): Don't call mono_image_close() if `verify_pe'. - -2003-08-26 Martin Baulig <martin@ximian.com> - - * pedump.c (main): Call mono_metadata_init(), - mono_raw_buffer_init(), mono_images_init(), mono_assemblies_init() - and mono_loader_init(). - -2003-08-26 Zoltan Varga <vargaz@freemail.hu> - - * loader.h: Add missing include to fix build. - - * image.h: mono_image_load_references is no more. - - * assembly.c: Reworked assembly loading to make it really thread safe. - After these changes, the assembly returned by mono_assembly_open is - fully initialized, i.e. all its references assemblies are loaded. - - * assembly.c (mono_image_load_references): Renamed to - mono_assembly_load_references, and made private, since clients no - longer need to call it. - - * class.c: Removed calls to mono_assembly_load_references, since it was - a source of deadlocks. - - * loader.h loader.c class.h class.c: Protect data structures using a - new lock, the loader lock. - - * class.c (mono_class_setup_vtable): Create temporary hash tables and - GPtrArrays only when needed. - - * class.c (mono_class_layout_fields): Ignore the dummy field inserted - into empty structures by mcs. Fixes pinvoke7.cs. - - * domain.c (mono_init): Call a new initialization function. - - * appdomain.c (mono_runtime_init): Call the new initializer function - of the marshal module. - - * marshal.c (mono_marshal_load_type_info): Ignore the dummy field - inserted into empty structures by mcs. Fixes pinvoke7.cs. - - * marshal.h marshal.c: Added locks around the wrapper caches to make - this module thread safe. - - * icall.c (ves_icall_InternalInvoke): Method wrappers doesn't require a - this argument. Fixes pinvoke1.exe. - -2003-08-25 Lluis Sanchez <lluis@ximian.com> - - * object.h: Added call_type field to MonoMethodMessage and the corresponding - enumeration of values. Removed fields to store remote call output values in - MonoAsyncResult. Not needed any more. - * object.c: Initialize call_type and async_result fields in mono_message_init. - * marshal.c: mono_delegate_begin_invoke(): for proxies, set call_type before - dispatching the message. - mono_delegate_end_invoke (): delegate to the proxy the work of waiting for the - async call to finish. To do it use a message with EndInvoke call type. - -2003-08-25 Zoltan Varga <vargaz@freemail.hu> - - * loader.h loader.c (mono_method_hash_marhal_info): New function which - determines whenever a method has marshalling info. - -2003-08-23 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * assembly.c: fix the build on windows. - -2003-08-22 Lluis Sanchez <lluis@ximian.com> - - * object.cs: Fixed bug #47785. - -2003-08-22 Jackson Harper <jackson@latitudegeo.com> - - * string-icalls.c (StringReplace): If their are no occurances of - the old string found return a reference to the supplied - string. This saves some memory and matches MS behavoir. - -2003-08-22 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * socket-io.c: fixed compilation for systems that define AF_INET6 - and don't define SOL_IP/SOL_IPV6. - -2003-08-21 Zoltan Varga <vargaz@freemail.hu> - - * object.c (mono_object_isinst): Fix casts to TransparentProxy in - the interpreter. Patch by Bernie Solomon (bernard@ugsolutions.com). - - * rawbuffer.c rawbuffer.h: Make this module thread safe. - - * domain.c: Make this module thread safe. - - * domain.c (mono_init): Call new initialization function. - - * icall.c (ves_icall_System_Array_SetValueImpl): Check types for - reference types too. Fixes #38812. - - * image.c (mono_image_init): Fixed warnings. - - * class.c (mono_class_from_typeref): Handle assembly load failure - correctly. - - * appdomain.c (add_assemblies_to_domain): Handle the case when - the references of an assembly are not yet loaded. - - * metadata.c image.c assembly.c: Moved initialization of global - variables to a separate function called at startup since lazy - initialization of these variables is not thread safe. - - * image.c assembly.c: Made this module thread safe by adding locks in - the appropriate places. - - * domain.c (mono_init): Call the new initialization functions of the - three modules. - -2003-08-20 Lluis Sanchez Gual <lluis@ximian.com> - - * marshal.c: mono_delegate_begin_invoke(): If the target is a proxy, - make a direct call. It is proxy's work to make the call asynchronous. - mono_delegate_end_invoke(): If the targe is a proxy, just collect - the return values. - * object.cs: mono_method_call_message_new(): read AsyncResult and - state object from parameters list, if this info is requested. - * object.h: Added fields to store remote call output values in - MonoAsyncResult. Added AsyncResult field in MonoMethodMessage. - -Wed Aug 20 12:57:42 CEST 2003 Paolo Molaro <lupus@ximian.com> - - * object.h: add needed fields to MonoThread. - * threads.c, threads.h: allow registering a function to cleanup data - allocated per thread by the JIT. - -Tue Aug 19 18:22:08 CEST 2003 Paolo Molaro <lupus@ximian.com> - - * loader.h: portability fix by Bernie Solomon - * <bernard@ugsolutions.com>. - -2003-08-16 Zoltan Varga <vargaz@freemail.hu> - - * reflection.h reflection.c (mono_param_get_objects): Changed this to - return a MonoArray. This simplifies the code and also ensures that - the cache allways contains an object reference as a value. - - * icall.c (ves_icall_get_parameter_info): Simplified using the new - function. - -2003-08-16 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * socket-io.c: patch by Bernie Solomon <bernard@ugsolutions.com> that - fixes a problem with byte ordering when getting the address family for - a socket. - -2003-08-15 Zoltan Varga <vargaz@freemail.hu> - - * .cvsignore: Added monosn. - - * reflection.h reflection.c loader.c: Added support for parameter - marshalling to dynamically created types. Fixes #47295. - -Fri Aug 15 11:42:46 CEST 2003 Paolo Molaro <lupus@ximian.com> - - * rand.c: remove useless warnings. Wed Aug 13 15:49:57 CEST 2003 Paolo Molaro <lupus@ximian.com> diff --git a/mono/metadata/appdomain.c b/mono/metadata/appdomain.c index 3c0abbe7879..03d4d3ae77a 100644 --- a/mono/metadata/appdomain.c +++ b/mono/metadata/appdomain.c @@ -23,7 +23,6 @@ #include <mono/metadata/socket-io.h> #include <mono/metadata/tabledefs.h> #include <mono/metadata/gc-internal.h> -#include <mono/metadata/marshal.h> HANDLE mono_delegate_semaphore = NULL; CRITICAL_SECTION mono_delegate_section; @@ -61,8 +60,6 @@ mono_runtime_init (MonoDomain *domain, MonoThreadStartCB start_cb, MonoAppDomainSetup *setup; MonoAppDomain *ad; MonoClass *class; - - mono_marshal_init (); mono_install_assembly_preload_hook (mono_domain_assembly_preload, NULL); mono_install_assembly_load_hook (mono_domain_fire_assembly_load, NULL); @@ -416,19 +413,15 @@ add_assemblies_to_domain (MonoDomain *domain, MonoAssembly *ass) { gint i; - mono_domain_lock (domain); - - if (g_hash_table_lookup (domain->assemblies, ass->aname.name)) { - mono_domain_unlock (domain); + if (g_hash_table_lookup (domain->assemblies, ass->aname.name)) return; /* This is ok while no lazy loading of assemblies */ - } + mono_domain_lock (domain); g_hash_table_insert (domain->assemblies, (gpointer) ass->aname.name, ass); mono_domain_unlock (domain); - if (ass->image->references) - for (i = 0; ass->image->references [i] != NULL; i++) - add_assemblies_to_domain (domain, ass->image->references [i]); + for (i = 0; ass->image->references [i] != NULL; i++) + add_assemblies_to_domain (domain, ass->image->references [i]); } static void diff --git a/mono/metadata/appdomain.h b/mono/metadata/appdomain.h index ea95d8efdf9..b946ec4f927 100644 --- a/mono/metadata/appdomain.h +++ b/mono/metadata/appdomain.h @@ -59,8 +59,6 @@ typedef struct { guint32 used_regs; unsigned num_clauses; signed exvar_offset; - /* Whenever the code is domain neutral or 'shared' */ - gboolean domain_neutral:1; MonoJitExceptionInfo *clauses; } MonoJitInfo; @@ -70,6 +68,8 @@ typedef struct { gint32 context_id; } MonoAppContext; +extern CRITICAL_SECTION *metadata_section; + typedef struct _MonoAppDomain MonoAppDomain; struct _MonoDomain { diff --git a/mono/metadata/assembly.c b/mono/metadata/assembly.c index e7305402c4d..744550f7868 100644 --- a/mono/metadata/assembly.c +++ b/mono/metadata/assembly.c @@ -22,7 +22,6 @@ #ifdef WITH_BUNDLE #include "mono-bundle.h" #endif -#include <mono/io-layer/io-layer.h> /* the default search path is just MONO_ASSEMBLIES */ static const char* @@ -32,26 +31,20 @@ default_path [] = { }; static char **assemblies_path = NULL; - -/* - * keeps track of loaded assemblies - */ -static GList *loaded_assemblies = NULL; -static MonoAssembly *corlib; - -/* This protects loaded_assemblies and image->references */ -static CRITICAL_SECTION assemblies_mutex; - -/* A hastable of thread->assembly list mappings */ -static GHashTable *assemblies_loading; +static int env_checked = 0; #ifdef PLATFORM_WIN32 +static gboolean path_inited = FALSE; static void init_default_path (void) { int i; + if (path_inited) + return; + + path_inited = TRUE; default_path [0] = g_strdup (MONO_ASSEMBLIES); for (i = strlen (MONO_ASSEMBLIES) - 1; i >= 0; i--) { if (default_path [0][i] == '/') @@ -65,6 +58,10 @@ check_env (void) { const char *path; char **splitted; + if (env_checked) + return; + env_checked = 1; + path = getenv ("MONO_PATH"); if (!path) return; @@ -74,13 +71,17 @@ check_env (void) { assemblies_path = splitted; } -/* assemblies_mutex must be held by the caller */ +/* + * keeps track of loaded assemblies + */ +static GList *loaded_assemblies = NULL; +static MonoAssembly *corlib; + static MonoAssembly* search_loaded (MonoAssemblyName* aname) { GList *tmp; MonoAssembly *ass; - GList *loading; for (tmp = loaded_assemblies; tmp; tmp = tmp->next) { ass = tmp->data; @@ -91,25 +92,8 @@ search_loaded (MonoAssemblyName* aname) if (strcmp (aname->name, ass->aname.name)) continue; /* g_print ("success\n"); */ - - return ass; - } - - /* - * The assembly might be under load by this thread. In this case, it is - * safe to return an incomplete instance to prevent loops. - */ - loading = g_hash_table_lookup (assemblies_loading, GetCurrentThread ()); - for (tmp = loading; tmp; tmp = tmp->next) { - ass = tmp->data; - if (!ass->aname.name) - continue; - if (strcmp (aname->name, ass->aname.name)) - continue; - return ass; } - return NULL; } @@ -145,38 +129,21 @@ mono_assembly_setrootdir (const char *root_dir) /* * Override the MONO_ASSEMBLIES directory configured at compile time. */ - /* Leak if called more than once */ default_path [0] = g_strdup (root_dir); -} - -/** - * mono_assemblies_init: - * - * Initialize global variables used by this module. - */ -void -mono_assemblies_init (void) -{ #ifdef PLATFORM_WIN32 - init_default_path (); + path_inited = TRUE; #endif - - check_env (); - - InitializeCriticalSection (&assemblies_mutex); - - assemblies_loading = g_hash_table_new (NULL, NULL); } -static void -mono_assembly_load_references (MonoImage *image, MonoImageOpenStatus *status) -{ +void +mono_image_load_references (MonoImage *image, MonoImageOpenStatus *status) { MonoTableInfo *t; guint32 cols [MONO_ASSEMBLYREF_SIZE]; const char *hash; int i; - *status = MONO_IMAGE_OK; + if (image->references) + return; t = &image->tables [MONO_TABLE_ASSEMBLYREF]; @@ -202,12 +169,14 @@ mono_assembly_load_references (MonoImage *image, MonoImageOpenStatus *status) aname.revision = cols [MONO_ASSEMBLYREF_REV_NUMBER]; image->references [i] = mono_assembly_load (&aname, image->assembly->basedir, status); + if (image->references [i] == NULL){ int j; for (j = 0; j < i; j++) mono_assembly_close (image->references [j]); g_free (image->references); + image->references = NULL; g_warning ("Could not find assembly %s", aname.name); *status = MONO_IMAGE_MISSING_ASSEMBLYREF; @@ -215,6 +184,7 @@ mono_assembly_load_references (MonoImage *image, MonoImageOpenStatus *status) } } image->references [i] = NULL; + } typedef struct AssemblyLoadHook AssemblyLoadHook; @@ -295,7 +265,7 @@ absolute_dir (const gchar *filename) gchar *mixed; gchar **parts; gchar *part; - GList *list, *tmp; + GSList *list, *tmp; GString *result; gchar *res; gint i; @@ -316,14 +286,14 @@ absolute_dir (const gchar *filename) if (!strcmp (part, "..")) { if (list && list->next) /* Don't remove root */ - list = g_list_delete_link (list, list); + list = g_slist_delete_link (list, list); } else { - list = g_list_prepend (list, part); + list = g_slist_prepend (list, part); } } result = g_string_new (""); - list = g_list_reverse (list); + list = g_slist_reverse (list); /* Ignores last data pointer, which should be the filename */ for (tmp = list; tmp && tmp->next != NULL; tmp = tmp->next) @@ -333,7 +303,7 @@ absolute_dir (const gchar *filename) res = result->str; g_string_free (result, FALSE); - g_list_free (list); + g_slist_free (list); g_strfreev (parts); if (*res == '\0') { g_free (res); @@ -360,10 +330,9 @@ do_mono_assembly_open (const char *filename, MonoImageOpenStatus *status) g_free (name); name = g_strdup ("mscorlib"); } - /* we do a very simple search for bundled assemblies: it's not a general - * purpose assembly loading mechanism. + /* we do a very simple search for bundled assemblies: it's not a general purpouse + * assembly loading mechanism. */ - EnterCriticalSection (&assemblies_mutex); for (tmp = loaded_assemblies; tmp; tmp = tmp->next) { ass = tmp->data; if (!ass->aname.name) @@ -373,7 +342,6 @@ do_mono_assembly_open (const char *filename, MonoImageOpenStatus *status) image = ass->image; break; } - LeaveCriticalSection (&assemblies_mutex); for (i = 0; !image && bundled_assemblies [i]; ++i) { if (strcmp (bundled_assemblies [i]->name, name) == 0) { image = mono_image_open_from_data ((char*)bundled_assemblies [i]->data, bundled_assemblies [i]->size, FALSE, status); @@ -407,10 +375,9 @@ mono_assembly_open (const char *filename, MonoImageOpenStatus *status) MonoTableInfo *t; guint32 cols [MONO_ASSEMBLY_SIZE]; int i; - char *base_dir; + char *base_dir, *aot_name; MonoImageOpenStatus def_status; gchar *fname; - GList *loading; g_return_val_if_fail (filename != NULL, NULL); @@ -428,7 +395,7 @@ mono_assembly_open (const char *filename, MonoImageOpenStatus *status) */ if (uri [7] != '/') uri = g_strdup_printf ("file:///%s", uri + 7); - + fname = g_filename_from_uri (uri, NULL, &error); if (uri != filename) g_free (uri); @@ -474,8 +441,21 @@ mono_assembly_open (const char *filename, MonoImageOpenStatus *status) ass->basedir = base_dir; ass->image = image; - + /* load aot compiled module */ + aot_name = g_strdup_printf ("%s.so", fname); g_free (fname); + ass->aot_module = g_module_open (aot_name, G_MODULE_BIND_LAZY); + g_free (aot_name); + + if (ass->aot_module) { + char *saved_guid = NULL; + g_module_symbol (ass->aot_module, "mono_assembly_guid", (gpointer *) &saved_guid); + + if (!saved_guid || strcmp (image->guid, saved_guid)) { + g_module_close (ass->aot_module); + ass->aot_module = NULL; + } + } t = &image->tables [MONO_TABLE_ASSEMBLY]; if (t->rows) { @@ -490,67 +470,33 @@ mono_assembly_open (const char *filename, MonoImageOpenStatus *status) ass->aname.minor = cols [MONO_ASSEMBLY_MINOR_VERSION]; ass->aname.build = cols [MONO_ASSEMBLY_BUILD_NUMBER]; ass->aname.revision = cols [MONO_ASSEMBLY_REV_NUMBER]; - } - /* - * Atomically search the loaded list and add ourselves to it if necessary. - */ - EnterCriticalSection (&assemblies_mutex); - if (ass->aname.name) /* avoid loading the same assembly twice for now... */ if ((ass2 = search_loaded (&ass->aname))) { g_free (ass); g_free (base_dir); - mono_image_close (image); *status = MONO_IMAGE_OK; - LeaveCriticalSection (&assemblies_mutex); return ass2; } - loading = g_hash_table_lookup (assemblies_loading, GetCurrentThread ()); - loading = g_list_prepend (loading, ass); - g_hash_table_insert (assemblies_loading, GetCurrentThread (), loading); - LeaveCriticalSection (&assemblies_mutex); + } image->assembly = ass; - /* - * We load referenced assemblies outside the lock to prevent deadlocks - * with regards to preload hooks. - */ - mono_assembly_load_references (image, status); - - EnterCriticalSection (&assemblies_mutex); + /* register right away to prevent loops */ + loaded_assemblies = g_list_prepend (loaded_assemblies, ass); - loading = g_hash_table_lookup (assemblies_loading, GetCurrentThread ()); - loading = g_list_remove (loading, ass); - if (loading == NULL) - /* Prevent memory leaks */ - g_hash_table_remove (assemblies_loading, GetCurrentThread ()); - else - g_hash_table_insert (assemblies_loading, GetCurrentThread (), loading); + mono_image_load_references (image, status); if (*status != MONO_IMAGE_OK) { - LeaveCriticalSection (&assemblies_mutex); mono_assembly_close (ass); return NULL; } - ass2 = search_loaded (&ass->aname); - if (ass2) { - /* Somebody else has loaded the assembly before us */ - LeaveCriticalSection (&assemblies_mutex); - mono_assembly_close (ass); - return ass2; - } - - loaded_assemblies = g_list_prepend (loaded_assemblies, ass); - LeaveCriticalSection (&assemblies_mutex); - /* resolve assembly references for modules */ t = &image->tables [MONO_TABLE_MODULEREF]; for (i = 0; i < t->rows; i++){ if (image->modules [i]) { image->modules [i]->assembly = ass; - mono_assembly_load_references (image->modules [i], status); + mono_image_load_references (image->modules [i], status); } /* * FIXME: what do we do here? it could be a native dll... @@ -570,6 +516,9 @@ mono_assembly_load (MonoAssemblyName *aname, const char *basedir, MonoImageOpenS MonoAssembly *result; char *fullpath, *filename; +#ifdef PLATFORM_WIN32 + init_default_path (); +#endif check_env (); result = invoke_assembly_preload_hook (aname, assemblies_path); @@ -629,13 +578,10 @@ mono_assembly_close (MonoAssembly *assembly) g_return_if_fail (assembly != NULL); - EnterCriticalSection (&assemblies_mutex); - if (--assembly->ref_count != 0) { - LeaveCriticalSection (&assemblies_mutex); + if (--assembly->ref_count != 0) return; - } + loaded_assemblies = g_list_remove (loaded_assemblies, assembly); - LeaveCriticalSection (&assemblies_mutex); image = assembly->image; if (image->references) { for (i = 0; image->references [i] != NULL; i++) @@ -652,19 +598,9 @@ mono_assembly_close (MonoAssembly *assembly) void mono_assembly_foreach (GFunc func, gpointer user_data) { - GList *copy; - - /* - * We make a copy of the list to avoid calling the callback inside the - * lock, which could lead to deadlocks. - */ - EnterCriticalSection (&assemblies_mutex); - copy = g_list_copy (loaded_assemblies); - LeaveCriticalSection (&assemblies_mutex); + /* In the future this can do locking of loaded_assemblies */ g_list_foreach (loaded_assemblies, func, user_data); - - g_list_free (copy); } /* Holds the assembly of the application, for diff --git a/mono/metadata/assembly.h b/mono/metadata/assembly.h index 6d744ac4123..8ea0515dc6d 100644 --- a/mono/metadata/assembly.h +++ b/mono/metadata/assembly.h @@ -7,7 +7,6 @@ #define CORLIB_NAME "corlib.dll" -void mono_assemblies_init (void); MonoAssembly *mono_assembly_open (const char *filename, MonoImageOpenStatus *status); MonoAssembly* mono_assembly_load (MonoAssemblyName *aname, diff --git a/mono/metadata/class.c b/mono/metadata/class.c index d868b782096..024d8abc277 100644 --- a/mono/metadata/class.c +++ b/mono/metadata/class.c @@ -60,6 +60,7 @@ mono_class_from_typeref (MonoImage *image, guint32 type_token) const char *name, *nspace; MonoClass *res; MonoAssembly **references; + MonoImageOpenStatus status; mono_metadata_decode_row (t, (type_token&0xffffff)-1, cols, MONO_TYPEREF_SIZE); @@ -91,6 +92,7 @@ mono_class_from_typeref (MonoImage *image, guint32 type_token) break; } + mono_image_load_references (image, &status); references = image->references; if (!references || !references [idx-1]) { /* @@ -167,7 +169,7 @@ mono_type_get_name_recurse (MonoType *type, GString *str) * Returns the string representation for type as required by System.Reflection. * The inverse of mono_reflection_parse_type (). */ -char* +static char* mono_type_get_name (MonoType *type) { GString* result = g_string_new (""); @@ -460,12 +462,6 @@ mono_class_layout_fields (MonoClass *class) } #endif - if ((top == 1) && (class->instance_size == sizeof (MonoObject)) && - (strcmp (class->fields [i].name, "$PRIVATE$") == 0)) { - /* This field is a hack inserted by MCS to empty structures */ - continue; - } - size = mono_type_size (class->fields [i].type, &align); /* FIXME (LAMESPEC): should we also change the min alignment according to pack? */ @@ -619,15 +615,12 @@ mono_get_unique_iid (MonoClass *class) g_assert (class->flags & TYPE_ATTRIBUTE_INTERFACE); - mono_loader_lock (); - if (!iid_hash) iid_hash = g_hash_table_new (g_str_hash, g_str_equal); str = g_strdup_printf ("%s|%s.%s\n", class->image->name, class->name_space, class->name); if (g_hash_table_lookup_extended (iid_hash, str, NULL, &value)) { - mono_loader_unlock (); g_free (str); return (guint)value; } else { @@ -635,13 +628,11 @@ mono_get_unique_iid (MonoClass *class) ++iid; } - mono_loader_unlock (); - return iid - 1; } static void -collect_implemented_interfaces_aux (MonoClass *klass, GPtrArray **res) +collect_implemented_interfaces_aux (MonoClass *klass, GPtrArray *res) { int i; MonoClass *ic; @@ -649,20 +640,18 @@ collect_implemented_interfaces_aux (MonoClass *klass, GPtrArray **res) for (i = 0; i < klass->interface_count; i++) { ic = klass->interfaces [i]; - if (*res == NULL) - *res = g_ptr_array_new (); - g_ptr_array_add (*res, ic); + g_ptr_array_add (res, ic); collect_implemented_interfaces_aux (ic, res); } } -static inline GPtrArray* +static GPtrArray* collect_implemented_interfaces (MonoClass *klass) { - GPtrArray *res = NULL; + GPtrArray *res = g_ptr_array_new (); - collect_implemented_interfaces_aux (klass, &res); + collect_implemented_interfaces_aux (klass, res); return res; } @@ -699,31 +688,27 @@ setup_interface_offsets (MonoClass *class, int cur_slot) class->interface_offsets [i] = -1; ifaces = collect_implemented_interfaces (class); - if (ifaces) { - for (i = 0; i < ifaces->len; ++i) { - ic = g_ptr_array_index (ifaces, i); - class->interface_offsets [ic->interface_id] = cur_slot; - cur_slot += ic->method.count; - } - g_ptr_array_free (ifaces, TRUE); + for (i = 0; i < ifaces->len; ++i) { + ic = g_ptr_array_index (ifaces, i); + class->interface_offsets [ic->interface_id] = cur_slot; + cur_slot += ic->method.count; } + g_ptr_array_free (ifaces, TRUE); for (k = class->parent; k ; k = k->parent) { ifaces = collect_implemented_interfaces (k); - if (ifaces) { - for (i = 0; i < ifaces->len; ++i) { - ic = g_ptr_array_index (ifaces, i); + for (i = 0; i < ifaces->len; ++i) { + ic = g_ptr_array_index (ifaces, i); - if (class->interface_offsets [ic->interface_id] == -1) { - int io = k->interface_offsets [ic->interface_id]; + if (class->interface_offsets [ic->interface_id] == -1) { + int io = k->interface_offsets [ic->interface_id]; - g_assert (io >= 0); + g_assert (io >= 0); - class->interface_offsets [ic->interface_id] = io; - } + class->interface_offsets [ic->interface_id] = io; } - g_ptr_array_free (ifaces, TRUE); } + g_ptr_array_free (ifaces, TRUE); } return cur_slot; @@ -736,7 +721,7 @@ mono_class_setup_vtable (MonoClass *class, MonoMethod **overrides, int onum) MonoMethod **vtable; int i, max_vtsize = 0, max_iid, cur_slot = 0; GPtrArray *ifaces; - MonoGHashTable *override_map = NULL; + MonoGHashTable *override_map; /* setup_vtable() must be called only once on the type */ if (class->interface_offsets) { @@ -745,13 +730,11 @@ mono_class_setup_vtable (MonoClass *class, MonoMethod **overrides, int onum) } ifaces = collect_implemented_interfaces (class); - if (ifaces) { - for (i = 0; i < ifaces->len; i++) { - MonoClass *ic = g_ptr_array_index (ifaces, i); - max_vtsize += ic->method.count; - } - g_ptr_array_free (ifaces, TRUE); + for (i = 0; i < ifaces->len; i++) { + MonoClass *ic = g_ptr_array_index (ifaces, i); + max_vtsize += ic->method.count; } + g_ptr_array_free (ifaces, TRUE); if (class->parent) { max_vtsize += class->parent->vtable_size; @@ -771,6 +754,8 @@ mono_class_setup_vtable (MonoClass *class, MonoMethod **overrides, int onum) if (class->parent && class->parent->vtable_size) memcpy (vtable, class->parent->vtable, sizeof (gpointer) * class->parent->vtable_size); + override_map = mono_g_hash_table_new (NULL, NULL); + /* override interface methods */ for (i = 0; i < onum; i++) { MonoMethod *decl = overrides [i*2]; @@ -780,19 +765,13 @@ mono_class_setup_vtable (MonoClass *class, MonoMethod **overrides, int onum) dslot = decl->slot + class->interface_offsets [decl->klass->interface_id]; vtable [dslot] = overrides [i*2 + 1]; vtable [dslot]->slot = dslot; - if (!override_map) - override_map = mono_g_hash_table_new (NULL, NULL); - mono_g_hash_table_insert (override_map, overrides [i * 2], overrides [i * 2 + 1]); } } for (k = class; k ; k = k->parent) { - int nifaces = 0; ifaces = collect_implemented_interfaces (k); - if (ifaces) - nifaces = ifaces->len; - for (i = 0; i < nifaces; i++) { + for (i = 0; i < ifaces->len; i++) { int j, l, io; ic = g_ptr_array_index (ifaces, i); @@ -933,8 +912,7 @@ mono_class_setup_vtable (MonoClass *class, MonoMethod **overrides, int onum) } } } - if (ifaces) - g_ptr_array_free (ifaces, TRUE); + g_ptr_array_free (ifaces, TRUE); } for (i = 0; i < class->method.count; ++i) { @@ -954,8 +932,6 @@ mono_class_setup_vtable (MonoClass *class, MonoMethod **overrides, int onum) mono_metadata_signature_equal (cm->signature, m1->signature)) { slot = k->methods [j]->slot; g_assert (cm->slot < max_vtsize); - if (!override_map) - override_map = mono_g_hash_table_new (NULL, NULL); mono_g_hash_table_insert (override_map, m1, cm); break; } @@ -981,8 +957,6 @@ mono_class_setup_vtable (MonoClass *class, MonoMethod **overrides, int onum) g_assert (decl->slot != -1); vtable [decl->slot] = overrides [i*2 + 1]; overrides [i * 2 + 1]->slot = decl->slot; - if (!override_map) - override_map = mono_g_hash_table_new (NULL, NULL); mono_g_hash_table_insert (override_map, decl, overrides [i * 2 + 1]); } } @@ -991,16 +965,13 @@ mono_class_setup_vtable (MonoClass *class, MonoMethod **overrides, int onum) * If a method occupies more than one place in the vtable, and it is * overriden, then change the other occurances too. */ - if (override_map) { - for (i = 0; i < max_vtsize; ++i) - if (vtable [i]) { - MonoMethod *cm = mono_g_hash_table_lookup (override_map, vtable [i]); - if (cm) - vtable [i] = cm; - } - - mono_g_hash_table_destroy (override_map); - } + for (i = 0; i < max_vtsize; ++i) + if (vtable [i]) { + MonoMethod *cm = mono_g_hash_table_lookup (override_map, vtable [i]); + if (cm) + vtable [i] = cm; + } + mono_g_hash_table_destroy (override_map); class->vtable_size = cur_slot; class->vtable = g_malloc0 (sizeof (gpointer) * class->vtable_size); @@ -1078,15 +1049,6 @@ mono_class_init (MonoClass *class) /*g_print ("Init class %s\n", class->name);*/ - /* We do everything inside the lock to prevent races */ - mono_loader_lock (); - - if (class->inited) { - mono_loader_unlock (); - /* Somebody might have gotten in before us */ - return; - } - if (class->init_pending) { /* this indicates a cyclic dependency */ g_error ("pending init %s.%s\n", class->name_space, class->name); @@ -1122,7 +1084,6 @@ mono_class_init (MonoClass *class) ctor->iflags = METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL; ctor->signature = sig; ctor->name = ".ctor"; - ctor->slot = -1; class->methods = g_new (MonoMethod*, class->method.count); class->methods [0] = ctor; if (class->rank > 1) { @@ -1138,22 +1099,20 @@ mono_class_init (MonoClass *class) ctor->iflags = METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL; ctor->signature = sig; ctor->name = ".ctor"; - ctor->slot = -1; class->methods [1] = ctor; } } else { + class->methods = g_new (MonoMethod*, class->method.count); + for (i = 0; i < class->method.count; ++i) { + class->methods [i] = mono_get_method (class->image, + MONO_TOKEN_METHOD_DEF | (i + class->method.first + 1), class); + } if (class->generic_inst) { for (i = 0; i < class->method.count; ++i) { class->methods [i] = inflate_generic_method (class->methods [i], class->generic_inst->data.generic_inst, NULL); class->methods [i]->klass = class; /*g_print ("inflated method %s in %s\n", class->methods [i]->name, class->name);*/ } - } else { - class->methods = g_new (MonoMethod*, class->method.count); - for (i = 0; i < class->method.count; ++i) { - class->methods [i] = mono_get_method (class->image, - MONO_TOKEN_METHOD_DEF | (i + class->method.first + 1), class); - } } } @@ -1183,7 +1142,6 @@ mono_class_init (MonoClass *class) * we have to setup them for interfaces, too. */ setup_interface_offsets (class, 0); - mono_loader_unlock (); return; } @@ -1245,8 +1203,6 @@ mono_class_init (MonoClass *class) class->has_finalize = 1; } - mono_loader_unlock (); - if (mono_debugger_class_init_func) mono_debugger_class_init_func (class); } @@ -1465,12 +1421,8 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token) guint icount = 0; MonoClass **interfaces; - mono_loader_lock (); - - if ((class = g_hash_table_lookup (image->class_cache, GUINT_TO_POINTER (type_token)))) { - mono_loader_unlock (); + if ((class = g_hash_table_lookup (image->class_cache, GUINT_TO_POINTER (type_token)))) return class; - } g_assert (mono_metadata_token_table (type_token) == MONO_TABLE_TYPEDEF); @@ -1553,8 +1505,6 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token) class->gen_params = mono_metadata_load_generic_params (image, class->type_token, &icount); class->num_gen_params = icount; - mono_loader_unlock (); - return class; } @@ -1590,13 +1540,9 @@ mono_class_from_generic (MonoType *gtype) MonoClass *class; MonoImage *image; - mono_loader_lock (); - image = gklass->image; - if ((class = g_hash_table_lookup (image->generics_cache, gtype))) { - mono_loader_unlock (); + if ((class = g_hash_table_lookup (image->generics_cache, gtype))) return class; - } mono_class_init (gklass); @@ -1614,15 +1560,12 @@ mono_class_from_generic (MonoType *gtype) class->field = gklass->field; class->method = gklass->method; - class->methods = gklass->methods; /*g_print ("instantiating class from %s.%s to %s\n", gklass->name_space, gklass->name, class->name); g_print ("methods: %d, fields: %d\n", class->method.count, class->field.count);*/ g_hash_table_insert (image->generics_cache, gtype, class); - mono_loader_unlock (); - return class; } @@ -1633,18 +1576,14 @@ mono_class_from_gen_param (MonoImage *image, gboolean mvar, int type_num, MonoGe int key; static GHashTable *cache = NULL; - mono_loader_lock (); - if (!cache) cache = g_hash_table_new (NULL, NULL); key = mvar? 1: 0; key |= type_num << 1; - if ((result = g_hash_table_lookup (cache, GINT_TO_POINTER (key)))) { - mono_loader_unlock (); + if ((result = g_hash_table_lookup (cache, GINT_TO_POINTER (key)))) return result; - } result = g_new0 (MonoClass, 1); result->parent = NULL; @@ -1660,8 +1599,6 @@ mono_class_from_gen_param (MonoImage *image, gboolean mvar, int type_num, MonoGe result->this_arg.byref = TRUE; g_hash_table_insert (cache, GINT_TO_POINTER (key), result); - - mono_loader_unlock (); return result; } @@ -1672,15 +1609,11 @@ mono_ptr_class_get (MonoType *type) MonoClass *el_class; static GHashTable *ptr_hash = NULL; - mono_loader_lock (); - if (!ptr_hash) - ptr_hash = g_hash_table_new (NULL, NULL); + ptr_hash = g_hash_table_new (g_direct_hash, g_direct_equal); el_class = mono_class_from_mono_type (type); - if ((result = g_hash_table_lookup (ptr_hash, el_class))) { - mono_loader_unlock (); + if ((result = g_hash_table_lookup (ptr_hash, el_class))) return result; - } result = g_new0 (MonoClass, 1); result->parent = NULL; /* no parent for PTR types */ @@ -1702,8 +1635,6 @@ mono_ptr_class_get (MonoType *type) g_hash_table_insert (ptr_hash, el_class, result); - mono_loader_unlock (); - return result; } @@ -1713,15 +1644,11 @@ mono_fnptr_class_get (MonoMethodSignature *sig) MonoClass *result; static GHashTable *ptr_hash = NULL; - mono_loader_lock (); - if (!ptr_hash) - ptr_hash = g_hash_table_new (NULL, NULL); + ptr_hash = g_hash_table_new (g_direct_hash, g_direct_equal); - if ((result = g_hash_table_lookup (ptr_hash, sig))) { - mono_loader_unlock (); + if ((result = g_hash_table_lookup (ptr_hash, sig))) return result; - } result = g_new0 (MonoClass, 1); result->parent = NULL; /* no parent for PTR types */ @@ -1743,8 +1670,6 @@ mono_fnptr_class_get (MonoMethodSignature *sig) g_hash_table_insert (ptr_hash, sig, result); - mono_loader_unlock (); - return result; } @@ -1869,15 +1794,11 @@ mono_array_class_get (MonoClass *eclass, guint32 rank) image = eclass->image; - mono_loader_lock (); - if ((rootlist = list = g_hash_table_lookup (image->array_cache, eclass))) { for (; list; list = list->next) { class = list->data; - if (class->rank == rank) { - mono_loader_unlock (); + if (class->rank == rank) return class; - } } } @@ -1891,7 +1812,7 @@ mono_array_class_get (MonoClass *eclass, guint32 rank) mono_class_init (parent); } - class = g_malloc0 (sizeof (MonoClass)); + class = g_malloc0 (sizeof (MonoClass) + parent->vtable_size * sizeof (gpointer)); class->image = image; class->name_space = eclass->name_space; @@ -1911,6 +1832,7 @@ mono_array_class_get (MonoClass *eclass, guint32 rank) class->parent = parent; class->instance_size = mono_class_instance_size (class->parent); class->class_size = 0; + class->vtable_size = parent->vtable_size; mono_class_setup_supertypes (class); class->rank = rank; @@ -1942,9 +1864,6 @@ mono_array_class_get (MonoClass *eclass, guint32 rank) list = g_slist_append (rootlist, class); g_hash_table_insert (image->array_cache, eclass, list); - - mono_loader_unlock (); - return class; } @@ -1956,7 +1875,8 @@ mono_array_class_get (MonoClass *eclass, guint32 rank) */ gint32 mono_class_instance_size (MonoClass *klass) -{ +{ + if (!klass->size_inited) mono_class_init (klass); @@ -1971,7 +1891,8 @@ mono_class_instance_size (MonoClass *klass) */ gint32 mono_class_min_align (MonoClass *klass) -{ +{ + if (!klass->size_inited) mono_class_init (klass); @@ -2013,7 +1934,8 @@ mono_class_value_size (MonoClass *klass, guint32 *align) */ gint32 mono_class_data_size (MonoClass *klass) -{ +{ + if (!klass->inited) mono_class_init (klass); @@ -2175,6 +2097,7 @@ load_file_for_image (MonoImage *image, int fileidx) if (res->modules [i] && !res->modules [i]->assembly) res->modules [i]->assembly = image->assembly; } + mono_image_load_references (image, NULL); } g_free (name); g_free (base_dir); @@ -2207,7 +2130,7 @@ mono_class_from_name (MonoImage *image, const char* name_space, const char *name { GHashTable *nspace_table; MonoImage *loaded_image; - guint32 token = 0; + guint32 token; MonoClass *class; char *nested; char buf [1024]; @@ -2223,16 +2146,9 @@ mono_class_from_name (MonoImage *image, const char* name_space, const char *name name = buf; } - mono_loader_lock (); - nspace_table = g_hash_table_lookup (image->name_cache, name_space); - - if (nspace_table) - token = GPOINTER_TO_UINT (g_hash_table_lookup (nspace_table, name)); - - mono_loader_unlock (); - if (!token) { + if (!nspace_table || !(token = GPOINTER_TO_UINT (g_hash_table_lookup (nspace_table, name)))) { MonoTableInfo *t = &image->tables [MONO_TABLE_EXPORTEDTYPE]; guint32 cols [MONO_EXP_TYPE_SIZE]; int i; @@ -2347,30 +2263,6 @@ mono_class_is_assignable_from (MonoClass *klass, MonoClass *oklass) } /* - * mono_class_needs_cctor_run: - * - * Determines whenever the class has a static constructor and whenever it - * needs to be called when executing CALLER. - */ -gboolean -mono_class_needs_cctor_run (MonoClass *klass, MonoMethod *caller) -{ - int i; - MonoMethod *method; - - for (i = 0; i < klass->method.count; ++i) { - method = klass->methods [i]; - if ((method->flags & METHOD_ATTRIBUTE_SPECIAL_NAME) && - (strcmp (".cctor", method->name) == 0)) { - if (caller == method) - return FALSE; - return TRUE; - } - } - return FALSE; -} - -/* * Returns the nnumber of bytes an element of type klass * uses when stored into an array. */ @@ -2400,9 +2292,7 @@ handle_enum: case MONO_TYPE_STRING: case MONO_TYPE_OBJECT: case MONO_TYPE_SZARRAY: - case MONO_TYPE_ARRAY: - case MONO_TYPE_VAR: - case MONO_TYPE_MVAR: + case MONO_TYPE_ARRAY: return sizeof (gpointer); case MONO_TYPE_I8: case MONO_TYPE_U8: @@ -2538,6 +2428,3 @@ mono_lookup_dynamic_token (MonoImage *image, guint32 token) { return lookup_dynamic (image, token); } - - - diff --git a/mono/metadata/class.h b/mono/metadata/class.h index f8da9c2a200..b41822f172a 100644 --- a/mono/metadata/class.h +++ b/mono/metadata/class.h @@ -225,9 +225,6 @@ typedef gpointer (*MonoTrampoline) (MonoMethod *method); typedef gpointer (*MonoLookupDynamicToken) (MonoImage *image, guint32 token); -void -mono_classes_init (void); - MonoClass * mono_class_get (MonoImage *image, guint32 type_token); @@ -322,15 +319,9 @@ mono_class_is_subclass_of (MonoClass *klass, MonoClass *klassc, gboolean mono_class_is_assignable_from (MonoClass *klass, MonoClass *oklass); -gboolean -mono_class_needs_cctor_run (MonoClass *klass, MonoMethod *caller); - gpointer mono_ldtoken (MonoImage *image, guint32 token, MonoClass **retclass); -char* -mono_type_get_name (MonoType *type); - void mono_install_trampoline (MonoTrampoline func); diff --git a/mono/metadata/domain.c b/mono/metadata/domain.c index 1f1f1fcd5b5..c5880b748e8 100644 --- a/mono/metadata/domain.c +++ b/mono/metadata/domain.c @@ -20,17 +20,14 @@ #include <mono/metadata/assembly.h> #include <mono/metadata/exception.h> #include <mono/metadata/cil-coff.h> -#include <mono/metadata/rawbuffer.h> -static guint32 appdomain_thread_id = -1; -static guint32 context_thread_id = -1; +static guint32 appdomain_thread_id = 0; +static guint32 context_thread_id = 0; static gint32 appdomain_id_counter = 0; static MonoGHashTable * appdomains_list = NULL; -static CRITICAL_SECTION appdomains_mutex; - MonoDomain *mono_root_domain = NULL; static MonoJitInfoTable * @@ -71,11 +68,8 @@ MonoJitInfo * mono_jit_info_table_find (MonoDomain *domain, char *addr) { MonoJitInfoTable *table = domain->jit_info_table; - int left = 0, right; - - mono_domain_lock (domain); + int left = 0, right = table->len; - right = table->len; while (left < right) { int pos = (left + right) / 2; MonoJitInfo *ji = g_array_index (table, gpointer, pos); @@ -86,14 +80,11 @@ mono_jit_info_table_find (MonoDomain *domain, char *addr) right = pos; else if (addr >= end) left = pos + 1; - else { - mono_domain_unlock (domain); + else return ji; - } } - mono_domain_unlock (domain); - /* maybe it is shared code, so we also search in the root domain */ + /* maybe irt is shared code, so we also search in the root domain */ if (domain != mono_root_domain) return mono_jit_info_table_find (mono_root_domain, addr); @@ -105,13 +96,9 @@ mono_jit_info_table_add (MonoDomain *domain, MonoJitInfo *ji) { MonoJitInfoTable *table = domain->jit_info_table; gpointer start = ji->code_start; - int pos; - - mono_domain_lock (domain); - pos = mono_jit_info_table_index (table, start); + int pos = mono_jit_info_table_index (table, start); g_array_insert_val (table, pos, ji); - mono_domain_unlock (domain); } static int @@ -206,9 +193,7 @@ mono_domain_create (void) InitializeCriticalSection (&domain->lock); - EnterCriticalSection (&appdomains_mutex); mono_g_hash_table_insert(appdomains_list, GINT_TO_POINTER(domain->domain_id), domain); - LeaveCriticalSection (&appdomains_mutex); return domain; } @@ -236,14 +221,6 @@ mono_init (const char *filename) appdomain_thread_id = TlsAlloc (); context_thread_id = TlsAlloc (); - InitializeCriticalSection (&appdomains_mutex); - - mono_metadata_init (); - mono_raw_buffer_init (); - mono_images_init (); - mono_assemblies_init (); - mono_loader_init (); - // FIXME: When should we release this memory? appdomains_list = mono_g_hash_table_new (g_direct_hash, g_direct_equal); @@ -504,14 +481,6 @@ typedef struct { } DomainInfo; static void -copy_hash_entry (gpointer key, gpointer data, gpointer user_data) -{ - MonoGHashTable *dest = (MonoGHashTable*)user_data; - - mono_g_hash_table_insert (dest, key, data); -} - -static void foreach_domain (gpointer key, gpointer data, gpointer user_data) { DomainInfo *dom_info = user_data; @@ -523,23 +492,10 @@ void mono_domain_foreach (MonoDomainFunc func, gpointer user_data) { DomainInfo dom_info; - MonoGHashTable *copy; - - /* - * Create a copy of the hashtable to avoid calling the user callback - * inside the lock because that could lead to deadlocks. - * We can do this because this function is not perf. critical. - */ - copy = mono_g_hash_table_new (NULL, NULL); - EnterCriticalSection (&appdomains_mutex); - mono_g_hash_table_foreach (appdomains_list, copy_hash_entry, copy); - LeaveCriticalSection (&appdomains_mutex); dom_info.func = func; dom_info.user_data = user_data; - mono_g_hash_table_foreach (copy, foreach_domain, &dom_info); - - mono_g_hash_table_destroy (copy); + mono_g_hash_table_foreach (appdomains_list, foreach_domain, &dom_info); } /** @@ -554,12 +510,8 @@ mono_domain_assembly_open (MonoDomain *domain, const char *name) { MonoAssembly *ass; - mono_domain_lock (domain); - if ((ass = g_hash_table_lookup (domain->assemblies, name))) { - mono_domain_unlock (domain); + if ((ass = g_hash_table_lookup (domain->assemblies, name))) return ass; - } - mono_domain_unlock (domain); if (!(ass = mono_assembly_open (name, NULL))) return NULL; @@ -587,9 +539,7 @@ mono_domain_unload (MonoDomain *domain, gboolean force) return; } - EnterCriticalSection (&appdomains_mutex); mono_g_hash_table_remove(appdomains_list, GINT_TO_POINTER(domain->domain_id)); - LeaveCriticalSection (&appdomains_mutex); g_free (domain->friendly_name); g_hash_table_foreach (domain->assemblies, remove_assembly, NULL); @@ -634,11 +584,10 @@ mono_domain_get_by_id (gint32 domainid) { MonoDomain * domain; - EnterCriticalSection (&appdomains_mutex); - domain = mono_g_hash_table_lookup (appdomains_list, GINT_TO_POINTER(domainid)); - LeaveCriticalSection (&appdomains_mutex); + if ((domain = mono_g_hash_table_lookup(appdomains_list, GINT_TO_POINTER(domainid)))) + return domain; - return domain; + return NULL; } void diff --git a/mono/metadata/icall.c b/mono/metadata/icall.c index fa1ef742546..81ab070ffcd 100644 --- a/mono/metadata/icall.c +++ b/mono/metadata/icall.c @@ -225,8 +225,6 @@ ves_icall_System_Array_SetValueImpl (MonoArray *this, MonoObject *value, guint32 } if (!ec->valuetype) { - if (!mono_object_isinst (value, ec)) - INVALID_CAST; *ea = (gpointer)value; return; } @@ -1075,10 +1073,22 @@ static MonoArray* ves_icall_get_parameter_info (MonoMethod *method) { MonoDomain *domain = mono_domain_get (); + MonoArray *res; + static MonoClass *System_Reflection_ParameterInfo; + MonoReflectionParameter** args; + int i; MONO_ARCH_SAVE_REGS; - return mono_param_get_objects (domain, method); + args = mono_param_get_objects (domain, method); + if (!System_Reflection_ParameterInfo) + System_Reflection_ParameterInfo = mono_class_from_name ( + mono_defaults.corlib, "System.Reflection", "ParameterInfo"); + res = mono_array_new (domain, System_Reflection_ParameterInfo, method->signature->param_count); + for (i = 0; i < method->signature->param_count; ++i) { + mono_array_set (res, gpointer, i, args [i]); + } + return res; } static MonoReflectionType* @@ -1463,14 +1473,14 @@ ves_icall_Type_BindGenericParameters (MonoReflectionType *type, MonoArray *types geninst->data.generic_inst = ginst = g_new0 (MonoGenericInst, 1); ginst->generic_type = &klass->byval_arg; ginst->type_argc = klass->num_gen_params; - ginst->type_argv = g_new0 (MonoType *, klass->num_gen_params); + ginst->type_argv = g_new0 (MonoType, klass->num_gen_params); for (i = 0; i < klass->num_gen_params; ++i) { MonoReflectionType *garg = mono_array_get (types, gpointer, i); ginst->type_argv [i] = garg->type; } klass = mono_class_from_generic (geninst); - return mono_type_get_object (mono_object_domain (type), klass->generic_inst); + return mono_type_get_object (mono_object_domain (type), &klass->byval_arg); } static MonoReflectionType* @@ -1543,18 +1553,6 @@ ves_icall_MonoType_get_HasUnboundGenericParameters (MonoReflectionType *type) return FALSE; } -static MonoBoolean -ves_icall_TypeBuilder_get_IsUnboundGenericParameter (MonoReflectionTypeBuilder *tb) -{ - MONO_ARCH_SAVE_REGS; - - if (tb->type.type->byref) - return FALSE; - if (tb->type.type->type == MONO_TYPE_VAR || tb->type.type->type == MONO_TYPE_MVAR) - return TRUE; - return FALSE; -} - static MonoObject * ves_icall_InternalInvoke (MonoReflectionMethod *method, MonoObject *this, MonoArray *params) { @@ -1572,7 +1570,7 @@ ves_icall_InternalInvoke (MonoReflectionMethod *method, MonoObject *this, MonoAr if (!mono_object_isinst (this, m->klass)) mono_raise_exception (mono_exception_from_name (mono_defaults.corlib, "System.Reflection", "TargetException")); m = mono_object_get_virtual_method (this, m); - } else if (!(m->flags & METHOD_ATTRIBUTE_STATIC) && strcmp (m->name, ".ctor") && !m->wrapper_type) + } else if (!(m->flags & METHOD_ATTRIBUTE_STATIC) && strcmp (m->name, ".ctor")) mono_raise_exception (mono_exception_from_name (mono_defaults.corlib, "System.Reflection", "TargetException")); pcount = params? mono_array_length (params): 0; @@ -3545,11 +3543,14 @@ mono_install_get_config_dir (void) static MonoString * ves_icall_System_Configuration_DefaultConfig_get_machine_config_path (void) { - MonoString *mcpath; + static MonoString *mcpath; gchar *path; MONO_ARCH_SAVE_REGS; + if (mcpath != NULL) + return mcpath; + path = g_build_path (G_DIR_SEPARATOR_S, mono_cfg_dir, "mono", "machine.config", NULL); #if defined (PLATFORM_WIN32) @@ -3567,31 +3568,6 @@ ves_icall_System_Configuration_DefaultConfig_get_machine_config_path (void) return mcpath; } -static MonoString * -ves_icall_System_Web_Util_ICalls_get_machine_install_dir (void) -{ - MonoString *ipath; - gchar *path; - - MONO_ARCH_SAVE_REGS; - - path = g_path_get_dirname (mono_cfg_dir); - -#if defined (PLATFORM_WIN32) - /* Avoid mixing '/' and '\\' */ - { - gint i; - for (i = strlen (path) - 1; i >= 0; i--) - if (path [i] == '/') - path [i] = '\\'; - } -#endif - ipath = mono_string_new (mono_domain_get (), path); - g_free (path); - - return ipath; -} - static void ves_icall_System_Diagnostics_DefaultTraceListener_WriteWindowsDebugString (MonoString *message) { @@ -3995,13 +3971,6 @@ static gconstpointer icall_map [] = { "System.Reflection.Emit.TypeBuilder::setup_internal_class", mono_reflection_setup_internal_class, "System.Reflection.Emit.TypeBuilder::create_internal_class", mono_reflection_create_internal_class, "System.Reflection.Emit.TypeBuilder::create_runtime_class", mono_reflection_create_runtime_class, - "System.Reflection.Emit.TypeBuilder::setup_generic_class", mono_reflection_setup_generic_class, - "System.Reflection.Emit.TypeBuilder::define_generic_parameter", mono_reflection_define_generic_parameter, - - /* - * TypeBuilder generics icalls. - */ - "System.Reflection.Emit.TypeBuilder::get_IsUnboundGenericParameter", ves_icall_TypeBuilder_get_IsUnboundGenericParameter, /* * MethodBuilder @@ -4433,16 +4402,6 @@ static gconstpointer icall_map [] = { */ "System.Activator::CreateInstanceInternal", ves_icall_System_Activator_CreateInstanceInternal, - - /* - * System.Web - */ - "System.Web.Util.ICalls::GetMachineConfigPath", - ves_icall_System_Configuration_DefaultConfig_get_machine_config_path, - - "System.Web.Util.ICalls::GetMachineInstallDirectory", - ves_icall_System_Web_Util_ICalls_get_machine_install_dir, - /* * add other internal calls here */ diff --git a/mono/metadata/image.c b/mono/metadata/image.c index 0a720e2297b..097ed1731c2 100644 --- a/mono/metadata/image.c +++ b/mono/metadata/image.c @@ -22,7 +22,6 @@ #include "private.h" #include "tabledefs.h" #include "tokentype.h" -#include <mono/io-layer/io-layer.h> #define INVALID_ADDRESS 0xffffffff @@ -32,8 +31,6 @@ static GHashTable *loaded_images_hash; static GHashTable *loaded_images_guid_hash; -static CRITICAL_SECTION images_mutex; - guint32 mono_cli_rva_image_map (MonoCLIImageInfo *iinfo, guint32 addr) { @@ -70,20 +67,6 @@ mono_cli_rva_map (MonoCLIImageInfo *iinfo, guint32 addr) } /** - * mono_images_init: - * - * Initialize the global variables used by this module. - */ -void -mono_images_init (void) -{ - InitializeCriticalSection (&images_mutex); - - loaded_images_hash = g_hash_table_new (g_str_hash, g_str_equal); - loaded_images_guid_hash = g_hash_table_new (g_str_hash, g_str_equal); -} - -/** * mono_image_ensure_section_idx: * @image: The image we are operating on * @section: section number that we will load/map into memory @@ -466,11 +449,7 @@ load_class_names (MonoImage *image) guint32 cols [MONO_TYPEDEF_SIZE]; const char *name; const char *nspace; - guint32 i, visib, nspace_index; - GHashTable *name_cache2, *nspace_table; - - /* Temporary hash table to avoid lookups in the nspace_table */ - name_cache2 = g_hash_table_new (NULL, NULL); + guint32 i, visib; for (i = 1; i <= t->rows; ++i) { mono_metadata_decode_row (t, i - 1, cols, MONO_TYPEDEF_SIZE); @@ -480,41 +459,15 @@ load_class_names (MonoImage *image) continue; name = mono_metadata_string_heap (image, cols [MONO_TYPEDEF_NAME]); nspace = mono_metadata_string_heap (image, cols [MONO_TYPEDEF_NAMESPACE]); - - nspace_index = cols [MONO_TYPEDEF_NAMESPACE]; - nspace_table = g_hash_table_lookup (name_cache2, GUINT_TO_POINTER (nspace_index)); - if (!nspace_table) { - nspace_table = g_hash_table_new (g_str_hash, g_str_equal); - g_hash_table_insert (image->name_cache, (char*)nspace, nspace_table); - g_hash_table_insert (name_cache2, GUINT_TO_POINTER (nspace_index), - nspace_table); - } - g_hash_table_insert (nspace_table, (char *) name, GUINT_TO_POINTER (i)); + mono_image_add_to_name_cache (image, nspace, name, i); } - - g_hash_table_destroy (name_cache2); -} - -static void -register_guid (gpointer key, gpointer value, gpointer user_data) -{ - MonoImage *image = (MonoImage*)value; - - if (!g_hash_table_lookup (loaded_images_guid_hash, image)) - g_hash_table_insert (loaded_images_guid_hash, image->guid, image); -} - -static void -build_guid_table (void) -{ - g_hash_table_foreach (loaded_images_hash, register_guid, NULL); } void mono_image_init (MonoImage *image) { - image->method_cache = g_hash_table_new (NULL, NULL); - image->class_cache = g_hash_table_new (NULL, NULL); + image->method_cache = g_hash_table_new (g_direct_hash, g_direct_equal); + image->class_cache = g_hash_table_new (g_direct_hash, g_direct_equal); image->name_cache = g_hash_table_new (g_str_hash, g_str_equal); image->array_cache = g_hash_table_new (NULL, NULL); @@ -528,13 +481,13 @@ mono_image_init (MonoImage *image) g_hash_table_new ((GHashFunc)mono_signature_hash, (GCompareFunc)mono_metadata_signature_equal); - image->runtime_invoke_cache = g_hash_table_new (NULL, NULL); - image->managed_wrapper_cache = g_hash_table_new (NULL, NULL); - image->native_wrapper_cache = g_hash_table_new (NULL, NULL); - image->remoting_invoke_cache = g_hash_table_new (NULL, NULL); - image->synchronized_cache = g_hash_table_new (NULL, NULL); + image->runtime_invoke_cache = g_hash_table_new (g_direct_hash, g_direct_equal); + image->managed_wrapper_cache = g_hash_table_new (g_direct_hash, g_direct_equal); + image->native_wrapper_cache = g_hash_table_new (g_direct_hash, g_direct_equal); + image->remoting_invoke_cache = g_hash_table_new (g_direct_hash, g_direct_equal); + image->synchronized_cache = g_hash_table_new (g_direct_hash, g_direct_equal); - image->generics_cache = g_hash_table_new ((GHashFunc)mono_metadata_type_hash, (GEqualFunc)mono_metadata_type_equal); + image->generics_cache = g_hash_table_new (mono_metadata_type_hash, mono_metadata_type_equal); } @@ -740,27 +693,19 @@ do_mono_image_open (const char *fname, MonoImageOpenStatus *status) } MonoImage * -mono_image_loaded (const char *name) -{ - MonoImage *res; - +mono_image_loaded (const char *name) { if (strcmp (name, "mscorlib") == 0) name = "corlib"; - EnterCriticalSection (&images_mutex); - res = g_hash_table_lookup (loaded_images_hash, name); - LeaveCriticalSection (&images_mutex); - return res; + if (loaded_images_hash) + return g_hash_table_lookup (loaded_images_hash, name); + return NULL; } MonoImage * -mono_image_loaded_by_guid (const char *guid) -{ - MonoImage *res; - - EnterCriticalSection (&images_mutex); - res = g_hash_table_lookup (loaded_images_guid_hash, guid); - LeaveCriticalSection (&images_mutex); - return res; +mono_image_loaded_by_guid (const char *guid) { + if (loaded_images_guid_hash) + return g_hash_table_lookup (loaded_images_guid_hash, guid); + return NULL; } MonoImage * @@ -809,49 +754,37 @@ mono_image_open_from_data (char *data, guint32 data_len, gboolean need_copy, Mon MonoImage * mono_image_open (const char *fname, MonoImageOpenStatus *status) { - MonoImage *image, *image2; + MonoImage *image; g_return_val_if_fail (fname != NULL, NULL); - /* - * The easiest solution would be to do all the loading inside the mutex, - * but that would lead to scalability problems. So we let the loading - * happen outside the mutex, and if multiple threads happen to load - * the same image, we discard all but the first copy. - */ - EnterCriticalSection (&images_mutex); - image = g_hash_table_lookup (loaded_images_hash, fname); - if (image){ - image->ref_count++; - LeaveCriticalSection (&images_mutex); - return image; + if (loaded_images_hash){ + image = g_hash_table_lookup (loaded_images_hash, fname); + if (image){ + image->ref_count++; + return image; + } } - LeaveCriticalSection (&images_mutex); image = do_mono_image_open (fname, status); if (image == NULL) return NULL; - EnterCriticalSection (&images_mutex); - image2 = g_hash_table_lookup (loaded_images_hash, fname); - if (image2) { - /* Somebody else beat us to it */ - LeaveCriticalSection (&images_mutex); - mono_image_close (image); - - return image2; - } + if (!loaded_images_hash) + loaded_images_hash = g_hash_table_new (g_str_hash, g_str_equal); g_hash_table_insert (loaded_images_hash, image->name, image); if (image->assembly_name) - g_hash_table_insert (loaded_images_hash, (char *) image->assembly_name, image); + g_hash_table_insert (loaded_images_hash, (char *) image->assembly_name, image); + + if (!loaded_images_guid_hash) + loaded_images_guid_hash = g_hash_table_new (g_str_hash, g_str_equal); g_hash_table_insert (loaded_images_guid_hash, image->guid, image); - LeaveCriticalSection (&images_mutex); return image; } static void -free_hash_table (gpointer key, gpointer val, gpointer user_data) +free_hash_table(gpointer key, gpointer val, gpointer user_data) { g_hash_table_destroy ((GHashTable*)val); } @@ -866,27 +799,15 @@ free_hash_table (gpointer key, gpointer val, gpointer user_data) void mono_image_close (MonoImage *image) { - MonoImage *image2; - g_return_if_fail (image != NULL); - EnterCriticalSection (&images_mutex); - if (--image->ref_count) { - LeaveCriticalSection (&images_mutex); + if (--image->ref_count) return; - } - image2 = g_hash_table_lookup (loaded_images_hash, image->name); - if (image == image2) { - /* This is not true if we are called from mono_image_open () */ - g_hash_table_remove (loaded_images_hash, image->name); - if (image->assembly_name) - g_hash_table_remove (loaded_images_hash, (char *) image->assembly_name); - g_hash_table_remove (loaded_images_guid_hash, image->guid); - /* Multiple images might have the same guid */ - build_guid_table (); - } - LeaveCriticalSection (&images_mutex); + if (!loaded_images_hash) + loaded_images_hash = g_hash_table_new (g_str_hash, g_str_equal); + g_hash_table_remove (loaded_images_hash, image->name); + if (image->f) fclose (image->f); if (image->raw_data_allocated) diff --git a/mono/metadata/image.h b/mono/metadata/image.h index ca8b41406ee..4cbfe5f4670 100644 --- a/mono/metadata/image.h +++ b/mono/metadata/image.h @@ -51,7 +51,7 @@ typedef struct { struct _MonoImage { int ref_count; FILE *f; - /* if f is NULL the image was loaded from raw data */ + /* if f is NULL the image was loaded rom raw data */ char *raw_data; guint32 raw_data_len; gboolean raw_data_allocated; @@ -141,8 +141,6 @@ typedef enum { MONO_IMAGE_IMAGE_INVALID } MonoImageOpenStatus; -void mono_images_init (void); - MonoImage *mono_image_open (const char *fname, MonoImageOpenStatus *status); MonoImage *mono_image_open_from_data (char *data, guint32 data_len, gboolean need_copy, @@ -161,6 +159,8 @@ int mono_image_ensure_section_idx (MonoImage *image, guint32 mono_image_get_entry_point (MonoImage *image); const char *mono_image_get_resource (MonoImage *image, guint32 offset, guint32 *size); +void mono_image_load_references (MonoImage *image, MonoImageOpenStatus *status); + /* This actually returns a MonoPEResourceDataEntry *, but declaring it * causes an include file loop. */ diff --git a/mono/metadata/loader.c b/mono/metadata/loader.c index 14171a70675..5fd49838a0b 100644 --- a/mono/metadata/loader.c +++ b/mono/metadata/loader.c @@ -37,29 +37,17 @@ static gboolean dummy_icall = TRUE; MonoDefaults mono_defaults; -CRITICAL_SECTION loader_mutex; - static GHashTable *icall_hash = NULL; void -mono_loader_init () -{ - InitializeCriticalSection (&loader_mutex); -} - -void mono_add_internal_call (const char *name, gconstpointer method) { - mono_loader_lock (); - if (!icall_hash) { dummy_icall = FALSE; icall_hash = g_hash_table_new (g_str_hash , g_str_equal); } g_hash_table_insert (icall_hash, g_strdup (name), (gpointer) method); - - mono_loader_unlock (); } static void @@ -88,8 +76,6 @@ mono_lookup_internal_call (MonoMethod *method) g_assert_not_reached (); } - mono_loader_lock (); - if (*method->klass->name_space) name = g_strconcat (method->klass->name_space, ".", method->klass->name, "::", method->name, NULL); else @@ -115,16 +101,12 @@ mono_lookup_internal_call (MonoMethod *method) g_free (name); g_free (tmpsig); - mono_loader_unlock (); - return NULL; } g_free(tmpsig); } - mono_loader_unlock (); - g_free (name); return res; @@ -466,14 +448,9 @@ mono_dllmap_lookup (const char *dll, const char* func, const char **rdll, const if (!dll_map) return 0; - - mono_loader_lock (); - map = g_hash_table_lookup (dll_map, dll); - if (!map) { - mono_loader_unlock (); + if (!map) return 0; - } *rdll = map->target? map->target: dll; for (tmp = map->next; tmp; tmp = tmp->next) { @@ -481,12 +458,10 @@ mono_dllmap_lookup (const char *dll, const char* func, const char **rdll, const *rfunc = tmp->name; if (tmp->dll) *rdll = tmp->dll; - mono_loader_unlock (); return 1; } } *rfunc = func; - mono_loader_unlock (); return 1; } @@ -494,8 +469,6 @@ void mono_dllmap_insert (const char *dll, const char *func, const char *tdll, const char *tfunc) { MonoDllMap *map, *entry; - mono_loader_lock (); - if (!dll_map) dll_map = g_hash_table_new (g_str_hash, g_str_equal); @@ -517,8 +490,6 @@ mono_dllmap_insert (const char *dll, const char *func, const char *tdll, const c entry->next = map->next; map->next = entry; } - - mono_loader_unlock (); } gpointer @@ -610,8 +581,8 @@ mono_lookup_pinvoke_call (MonoMethod *method) return method->addr; } -static MonoMethod * -mono_get_method_from_token (MonoImage *image, guint32 token, MonoClass *klass) +MonoMethod * +mono_get_method (MonoImage *image, guint32 token, MonoClass *klass) { MonoMethod *result; int table = mono_metadata_token_table (token); @@ -621,6 +592,9 @@ mono_get_method_from_token (MonoImage *image, guint32 token, MonoClass *klass) int size; guint32 cols [MONO_TYPEDEF_SIZE]; + if ((result = g_hash_table_lookup (image->method_cache, GINT_TO_POINTER (token)))) + return result; + if (image->assembly->dynamic) return mono_lookup_dynamic_token (image, token); @@ -639,7 +613,7 @@ mono_get_method_from_token (MonoImage *image, guint32 token, MonoClass *klass) g_print("got wrong token: 0x%08x\n", token); g_assert (table == MONO_TABLE_MEMBERREF); result = method_from_memberref (image, idx); - + g_hash_table_insert (image->method_cache, GINT_TO_POINTER (token), result); return result; } @@ -717,29 +691,8 @@ mono_get_method_from_token (MonoImage *image, guint32 token, MonoClass *klass) } } - return result; -} - -MonoMethod * -mono_get_method (MonoImage *image, guint32 token, MonoClass *klass) -{ - MonoMethod *result; - - /* We do everything inside the lock to prevent creation races */ - - mono_loader_lock (); - - if ((result = g_hash_table_lookup (image->method_cache, GINT_TO_POINTER (token)))) { - mono_loader_unlock (); - return result; - } - - result = mono_get_method_from_token (image, token, klass); - g_hash_table_insert (image->method_cache, GINT_TO_POINTER (token), result); - mono_loader_unlock (); - return result; } @@ -808,20 +761,6 @@ mono_method_get_marshal_info (MonoMethod *method, MonoMarshalSpec **mspecs) for (i = 0; i < method->signature->param_count + 1; ++i) mspecs [i] = NULL; - if (method->klass->image->assembly->dynamic) { - MonoMarshalSpec **dyn_specs = mono_g_hash_table_lookup ( - ((MonoDynamicAssembly*)method->klass->image->assembly->dynamic)->param_marshalling, - method); - if (dyn_specs) { - for (i = 0; i < method->signature->param_count + 1; ++i) - if (dyn_specs [i]) { - mspecs [i] = g_new0 (MonoMarshalSpec, 1); - memcpy (mspecs [i], dyn_specs [i], sizeof (MonoMarshalSpec)); - } - } - return; - } - mono_class_init (klass); methodt = &klass->image->tables [MONO_TABLE_METHOD]; @@ -854,54 +793,6 @@ mono_method_get_marshal_info (MonoMethod *method, MonoMarshalSpec **mspecs) } } -gboolean -mono_method_has_marshal_info (MonoMethod *method) -{ - int i, lastp; - MonoClass *klass = method->klass; - MonoTableInfo *methodt; - MonoTableInfo *paramt; - - if (method->klass->image->assembly->dynamic) { - MonoMarshalSpec **dyn_specs = mono_g_hash_table_lookup ( - ((MonoDynamicAssembly*)method->klass->image->assembly->dynamic)->param_marshalling, - method); - if (dyn_specs) { - for (i = 0; i < method->signature->param_count + 1; ++i) - if (dyn_specs [i]) - return TRUE; - } - return FALSE; - } - - mono_class_init (klass); - - methodt = &klass->image->tables [MONO_TABLE_METHOD]; - paramt = &klass->image->tables [MONO_TABLE_PARAM]; - - for (i = 0; i < klass->method.count; ++i) { - if (method == klass->methods [i]) { - guint32 idx = klass->method.first + i; - guint32 cols [MONO_PARAM_SIZE]; - guint param_index = mono_metadata_decode_row_col (methodt, idx, MONO_METHOD_PARAMLIST); - - if (idx + 1 < methodt->rows) - lastp = mono_metadata_decode_row_col (methodt, idx + 1, MONO_METHOD_PARAMLIST); - else - lastp = paramt->rows + 1; - - for (i = param_index; i < lastp; ++i) { - mono_metadata_decode_row (paramt, i -1, cols, MONO_PARAM_SIZE); - - if (cols [MONO_PARAM_FLAGS] & PARAM_ATTRIBUTE_HAS_FIELD_MARSHAL) - return TRUE; - } - return FALSE; - } - } - return FALSE; -} - gpointer mono_method_get_wrapper_data (MonoMethod *method, guint32 id) { diff --git a/mono/metadata/loader.h b/mono/metadata/loader.h index f44d1be13f9..5b69cc2a964 100644 --- a/mono/metadata/loader.h +++ b/mono/metadata/loader.h @@ -3,7 +3,6 @@ #include <mono/metadata/metadata.h> #include <mono/metadata/image.h> -#include <mono/io-layer/io-layer.h> typedef enum { MONO_WRAPPER_NONE, @@ -36,7 +35,7 @@ typedef struct { /* this is used by the inlining algorithm */ unsigned int inline_info:1; unsigned int uses_this:1; - unsigned int wrapper_type:4; + MonoWrapperType wrapper_type:4; unsigned int string_ctor:1; unsigned int save_lmf:1; gint16 inline_count; @@ -114,21 +113,9 @@ typedef struct { extern MonoDefaults mono_defaults; -/* - * This lock protects the hash tables inside MonoImage used by the metadata - * loading functions in class.c and loader.c. - */ -extern CRITICAL_SECTION loader_mutex; - -#define mono_loader_lock() EnterCriticalSection (&loader_mutex); -#define mono_loader_unlock() LeaveCriticalSection (&loader_mutex); - typedef gboolean (*MonoStackWalk) (MonoMethod *method, gint32 native_offset, gint32 il_offset, gboolean managed, gpointer data); typedef void (*MonoStackWalkImpl) (MonoStackWalk func, gpointer user_data); -void -mono_loader_init (void); - void mono_init_icall (void); @@ -165,9 +152,6 @@ mono_method_get_param_names (MonoMethod *method, const char **names); void mono_method_get_marshal_info (MonoMethod *method, MonoMarshalSpec **mspecs); -gboolean -mono_method_has_marshal_info (MonoMethod *method); - gpointer mono_method_get_wrapper_data (MonoMethod *method, guint32 id); diff --git a/mono/metadata/marshal.c b/mono/metadata/marshal.c index edefdd40b5e..20115dc19f7 100644 --- a/mono/metadata/marshal.c +++ b/mono/metadata/marshal.c @@ -76,20 +76,6 @@ static MonoDisHelper marshal_dh = { }; #endif -/* This mutex protects the various marshalling related caches in MonoImage */ -static CRITICAL_SECTION marshal_mutex; - -void -mono_marshal_init (void) -{ - static gboolean module_initialized = FALSE; - - if (!module_initialized) { - module_initialized = TRUE; - InitializeCriticalSection (&marshal_mutex); - } -} - gpointer mono_delegate_to_ftnptr (MonoDelegate *delegate) { @@ -126,15 +112,6 @@ mono_delegate_to_ftnptr (MonoDelegate *delegate) } gpointer -mono_get_unmanaged_thunk_for_managed_method_ptr (void *method, void *signature) -{ - MonoMethodSignature *ms; - - ms = mono_metadata_parse_method_signature (NULL, FALSE, signature, NULL); - -} - -gpointer mono_array_to_savearray (MonoArray *array) { if (!array) @@ -431,7 +408,7 @@ mono_mb_emit_i2 (MonoMethodBuilder *mb, gint16 data) void mono_mb_emit_ldstr (MonoMethodBuilder *mb, char *str) { - mono_mb_emit_byte (mb, CEE_LDSTR); + mono_mb_emit_byte (mb, CEE_LDSTR); mono_mb_emit_i4 (mb, mono_mb_add_data (mb, str)); } @@ -775,10 +752,10 @@ emit_str_to_ptr_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv con g_assert_not_reached (); } - if (eclass->valuetype) - esize = mono_class_native_size (eclass, NULL); - else - esize = sizeof (gpointer); + if (eclass->valuetype) + esize = mono_class_native_size (eclass, NULL); + else + esize = sizeof (gpointer); if (!usize) break; @@ -925,7 +902,6 @@ emit_struct_conv (MonoMethodBuilder *mb, MonoClass *klass, gboolean to_object) break; case MONO_TYPE_I2: case MONO_TYPE_U2: - case MONO_TYPE_CHAR: mono_mb_emit_byte (mb, CEE_LDLOC_1); mono_mb_emit_byte (mb, CEE_LDLOC_0); mono_mb_emit_byte (mb, CEE_LDIND_I2); @@ -996,32 +972,6 @@ mono_delegate_begin_invoke (MonoDelegate *delegate, gpointer *params) g_assert (delegate); - if (delegate->target && mono_object_class (delegate->target) == mono_defaults.transparent_proxy_class) { - - MonoTransparentProxy* tp = (MonoTransparentProxy *)delegate->target; - if (!tp->klass->contextbound || tp->rp->context != (MonoObject *) mono_context_get ()) { - - // If the target is a proxy, make a direct call. Is proxy's work - // to make the call asynchronous. - - MonoAsyncResult *ares; - MonoObject *exc; - MonoArray *out_args; - HANDLE handle; - method = delegate->method_info->method; - - msg = mono_method_call_message_new (method, params, NULL, &async_callback, &state); - handle = CreateEvent (NULL, TRUE, FALSE, NULL); - ares = mono_async_result_new (mono_domain_get (), handle, state, handle); - ares->async_delegate = (MonoObject *)async_callback; - msg->async_result = ares; - msg->call_type = CallType_BeginInvoke; - - mono_remoting_invoke ((MonoObject *)tp->rp, msg, &exc, &out_args); - return ares; - } - } - klass = delegate->object.vtable->klass; method = mono_get_delegate_invoke (klass); @@ -1036,6 +986,7 @@ mono_delegate_begin_invoke (MonoDelegate *delegate, gpointer *params) g_assert (method != NULL); im = mono_get_delegate_invoke (method->klass); + msg = mono_method_call_message_new (method, params, im, &async_callback, &state); return mono_thread_pool_add ((MonoObject *)delegate, msg, async_callback, state); @@ -1106,40 +1057,6 @@ mono_signature_to_name (MonoMethodSignature *sig, const char *prefix) return result; } -static inline MonoMethod* -mono_marshal_find_in_cache (GHashTable *cache, gpointer key) -{ - MonoMethod *res; - - EnterCriticalSection (&marshal_mutex); - res = g_hash_table_lookup (cache, key); - LeaveCriticalSection (&marshal_mutex); - return res; -} - -/* Create the method from the builder and place it in the cache */ -static inline MonoMethod* -mono_mb_create_and_cache (GHashTable *cache, gpointer key, - MonoMethodBuilder *mb, MonoMethodSignature *sig, - int max_stack) -{ - MonoMethod *res; - - EnterCriticalSection (&marshal_mutex); - res = g_hash_table_lookup (cache, key); - if (!res) { - /* This does not acquire any locks */ - res = mono_mb_create_method (mb, sig, max_stack); - g_hash_table_insert (cache, key, res); - } - else - /* Somebody created it before us */ - ; - LeaveCriticalSection (&marshal_mutex); - - return res; -} - MonoMethod * mono_marshal_get_delegate_begin_invoke (MonoMethod *method) { @@ -1157,7 +1074,7 @@ mono_marshal_get_delegate_begin_invoke (MonoMethod *method) sig = method->signature; cache = method->klass->image->delegate_begin_invoke_cache; - if ((res = mono_marshal_find_in_cache (cache, sig))) + if ((res = (MonoMethod *)g_hash_table_lookup (cache, sig))) return res; g_assert (sig->hasthis); @@ -1186,8 +1103,9 @@ mono_marshal_get_delegate_begin_invoke (MonoMethod *method) mono_mb_emit_native_call (mb, csig, mono_delegate_begin_invoke); mono_mb_emit_byte (mb, CEE_RET); - res = mono_mb_create_and_cache (cache, sig, mb, sig, sig->param_count + 16); + res = mono_mb_create_method (mb, sig, sig->param_count + 16); mono_mb_free (mb); + g_hash_table_insert (cache, sig, res); return res; } @@ -1228,16 +1146,7 @@ mono_delegate_end_invoke (MonoDelegate *delegate, gpointer *params) ares = mono_array_get (msg->args, gpointer, sig->param_count - 1); g_assert (ares); - if (delegate->target && mono_object_class (delegate->target) == mono_defaults.transparent_proxy_class) { - MonoTransparentProxy* tp = (MonoTransparentProxy *)delegate->target; - msg = (MonoMethodMessage *)mono_object_new (domain, mono_defaults.mono_method_message_class); - mono_message_init (domain, msg, delegate->method_info, NULL); - msg->call_type = CallType_EndInvoke; - msg->async_result = ares; - res = mono_remoting_invoke ((MonoObject *)tp->rp, msg, &exc, &out_args); - } - else - res = mono_thread_pool_finish (ares, &out_args, &exc); + res = mono_thread_pool_finish (ares, &out_args, &exc); if (exc) { char *strace = mono_string_to_utf8 (((MonoException*)exc)->stack_trace); @@ -1361,7 +1270,7 @@ mono_marshal_get_delegate_end_invoke (MonoMethod *method) sig = method->signature; cache = method->klass->image->delegate_end_invoke_cache; - if ((res = mono_marshal_find_in_cache (cache, sig))) + if ((res = (MonoMethod *)g_hash_table_lookup (cache, sig))) return res; g_assert (sig->hasthis); @@ -1395,9 +1304,9 @@ mono_marshal_get_delegate_end_invoke (MonoMethod *method) } else mono_mb_emit_restore_result (mb, sig->ret); - res = mono_mb_create_and_cache (cache, sig, - mb, sig, sig->param_count + 16); + res = mono_mb_create_method (mb, sig, sig->param_count + 16); mono_mb_free (mb); + g_hash_table_insert (cache, sig, res); return res; } @@ -1474,7 +1383,7 @@ mono_marshal_get_remoting_invoke (MonoMethod *method) return method; cache = method->klass->image->remoting_invoke_cache; - if ((res = mono_marshal_find_in_cache (cache, method))) + if ((res = (MonoMethod *)g_hash_table_lookup (cache, method))) return res; if (!csig) { @@ -1503,9 +1412,9 @@ mono_marshal_get_remoting_invoke (MonoMethod *method) mono_mb_emit_restore_result (mb, sig->ret); } - res = mono_mb_create_and_cache (cache, method, mb, sig, sig->param_count + 16); + res = mono_mb_create_method (mb, sig, sig->param_count + 16); mono_mb_free (mb); - + g_hash_table_insert (cache, method, res); return res; } @@ -1529,7 +1438,7 @@ mono_marshal_get_remoting_invoke_with_check (MonoMethod *method) g_assert (sig->hasthis); cache = method->klass->image->remoting_invoke_cache; - if ((res = mono_marshal_find_in_cache (cache, (char *)method + 1))) + if ((res = (MonoMethod *)g_hash_table_lookup (cache, (char *)method + 1))) return res; mb = mono_mb_new (method->klass, method->name, MONO_WRAPPER_REMOTING_INVOKE_WITH_CHECK); @@ -1553,10 +1462,9 @@ mono_marshal_get_remoting_invoke_with_check (MonoMethod *method) mono_mb_emit_managed_call (mb, method, method->signature); mono_mb_emit_byte (mb, CEE_RET); - res = mono_mb_create_and_cache (cache, (char*)method + 1, - mb, sig, sig->param_count + 16); + res = mono_mb_create_method (mb, sig, sig->param_count + 16); mono_mb_free (mb); - + g_hash_table_insert (cache, (char *)method + 1, res); return res; } @@ -1580,7 +1488,7 @@ mono_marshal_get_delegate_invoke (MonoMethod *method) sig = method->signature; cache = method->klass->image->delegate_invoke_cache; - if ((res = mono_marshal_find_in_cache (cache, sig))) + if ((res = (MonoMethod *)g_hash_table_lookup (cache, sig))) return res; sigsize = sizeof (MonoMethodSignature) + sig->param_count * sizeof (MonoType *); @@ -1667,10 +1575,11 @@ mono_marshal_get_delegate_invoke (MonoMethod *method) mono_mb_patch_addr (mb, pos1, mb->pos - (pos1 + 4)); mono_mb_emit_byte (mb, CEE_RET); - res = mono_mb_create_and_cache (cache, sig, - mb, sig, sig->param_count + 16); + res = mono_mb_create_method (mb, sig, sig->param_count + 16); mono_mb_free (mb); + g_hash_table_insert (cache, sig, res); + return res; } @@ -1695,7 +1604,7 @@ mono_marshal_get_runtime_invoke (MonoMethod *method) g_assert (method); cache = method->klass->image->runtime_invoke_cache; - if ((res = mono_marshal_find_in_cache (cache, method))) + if ((res = (MonoMethod *)g_hash_table_lookup (cache, method))) return res; /* to make it work with our special string constructors */ @@ -1908,14 +1817,15 @@ handle_enum: mono_mb_emit_ldloc (mb, 0); mono_mb_emit_byte (mb, CEE_RET); - res = mono_mb_create_and_cache (cache, method, - mb, csig, sig->param_count + 16); + res = mono_mb_create_method (mb, csig, sig->param_count + 16); mono_mb_free (mb); header = ((MonoMethodNormal *)res)->header; header->num_clauses = 1; header->clauses = clause; + g_hash_table_insert (cache, method, res); + return res; } @@ -1936,7 +1846,7 @@ mono_marshal_get_managed_wrapper (MonoMethod *method, MonoObject *this, MonoMars g_assert (!method->signature->pinvoke); cache = method->klass->image->managed_wrapper_cache; - if (!this && (res = mono_marshal_find_in_cache (cache, method))) + if (!this && (res = (MonoMethod *)g_hash_table_lookup (cache, method))) return res; if (this) { @@ -2222,13 +2132,12 @@ mono_marshal_get_managed_wrapper (MonoMethod *method, MonoObject *this, MonoMars mono_mb_emit_byte (mb, CEE_RET); } - if (!this) - res = mono_mb_create_and_cache (cache, method, - mb, csig, sig->param_count + 16); - else - res = mono_mb_create_method (mb, csig, sig->param_count + 16); + res = mono_mb_create_method (mb, csig, sig->param_count + 16); mono_mb_free (mb); + if (!this) + g_hash_table_insert (cache, method, res); + return res; } @@ -2251,6 +2160,10 @@ mono_marshal_get_ldfld_wrapper (MonoType *type) char *name; int t, pos0, pos1; + if (!ldfld_hash) + ldfld_hash = g_hash_table_new (NULL, NULL); + + t = type->type; if (!type->byref) { @@ -2274,12 +2187,7 @@ mono_marshal_get_ldfld_wrapper (MonoType *type) klass = mono_defaults.int_class; } - EnterCriticalSection (&marshal_mutex); - if (!ldfld_hash) - ldfld_hash = g_hash_table_new (NULL, NULL); - res = g_hash_table_lookup (ldfld_hash, klass); - LeaveCriticalSection (&marshal_mutex); - if (res) + if ((res = g_hash_table_lookup (ldfld_hash, klass))) return res; name = g_strdup_printf ("__ldfld_wrapper_%s.%s", klass->name_space, klass->name); @@ -2381,10 +2289,11 @@ mono_marshal_get_ldfld_wrapper (MonoType *type) mono_mb_emit_byte (mb, CEE_RET); - res = mono_mb_create_and_cache (ldfld_hash, klass, - mb, sig, sig->param_count + 16); + res = mono_mb_create_method (mb, sig, sig->param_count + 16); mono_mb_free (mb); + g_hash_table_insert (ldfld_hash, klass, res); + return res; } @@ -2407,6 +2316,9 @@ mono_marshal_get_stfld_wrapper (MonoType *type) char *name; int t, pos; + if (!stfld_hash) + stfld_hash = g_hash_table_new (NULL, NULL); + t = type->type; if (!type->byref) { @@ -2430,12 +2342,7 @@ mono_marshal_get_stfld_wrapper (MonoType *type) klass = mono_defaults.int_class; } - EnterCriticalSection (&marshal_mutex); - if (!stfld_hash) - stfld_hash = g_hash_table_new (NULL, NULL); - res = g_hash_table_lookup (stfld_hash, klass); - LeaveCriticalSection (&marshal_mutex); - if (res) + if ((res = g_hash_table_lookup (stfld_hash, klass))) return res; name = g_strdup_printf ("__stfld_wrapper_%s.%s", klass->name_space, klass->name); @@ -2534,10 +2441,11 @@ mono_marshal_get_stfld_wrapper (MonoType *type) mono_mb_emit_byte (mb, CEE_RET); - res = mono_mb_create_and_cache (stfld_hash, klass, - mb, sig, sig->param_count + 16); + res = mono_mb_create_method (mb, sig, sig->param_count + 16); mono_mb_free (mb); + g_hash_table_insert (stfld_hash, klass, res); + return res; } @@ -2583,7 +2491,7 @@ mono_marshal_get_icall_wrapper (MonoMethodSignature *sig, const char *name, gcon /* * generates IL code for the pinvoke wrapper (the generated method - * calls the unmanaged code in method->addr) + * calls the unamnage code in method->addr) */ MonoMethod * mono_marshal_get_native_wrapper (MonoMethod *method) @@ -2603,7 +2511,7 @@ mono_marshal_get_native_wrapper (MonoMethod *method) g_assert (method->signature->pinvoke); cache = method->klass->image->native_wrapper_cache; - if ((res = mono_marshal_find_in_cache (cache, method))) + if ((res = (MonoMethod *)g_hash_table_lookup (cache, method))) return res; sig = method->signature; @@ -2626,9 +2534,9 @@ mono_marshal_get_native_wrapper (MonoMethod *method) mono_mb_emit_exception (mb); csig = g_memdup (sig, sigsize); csig->pinvoke = 0; - res = mono_mb_create_and_cache (cache, method, - mb, csig, csig->param_count + 16); + res = mono_mb_create_method (mb, csig, csig->param_count + 16); mono_mb_free (mb); + g_hash_table_insert (cache, method, res); return res; } @@ -2655,9 +2563,9 @@ mono_marshal_get_native_wrapper (MonoMethod *method) csig = g_memdup (csig, sigsize); csig->pinvoke = 0; - res = mono_mb_create_and_cache (cache, method, - mb, csig, csig->param_count + 16); + res = mono_mb_create_method (mb, csig, csig->param_count + 16); mono_mb_free (mb); + g_hash_table_insert (cache, method, res); return res; } @@ -3329,10 +3237,11 @@ mono_marshal_get_native_wrapper (MonoMethod *method) csig = g_memdup (sig, sigsize); csig->pinvoke = 0; - res = mono_mb_create_and_cache (cache, method, - mb, csig, csig->param_count + 16); + res = mono_mb_create_method (mb, csig, csig->param_count + 16); mono_mb_free (mb); + g_hash_table_insert (cache, method, res); + for (i = sig->param_count; i >= 0; i--) g_free (mspecs [i]); g_free (mspecs); @@ -3491,7 +3400,7 @@ mono_marshal_get_synchronized_wrapper (MonoMethod *method) return method; cache = method->klass->image->synchronized_cache; - if ((res = mono_marshal_find_in_cache (cache, method))) + if ((res = (MonoMethod *)g_hash_table_lookup (cache, method))) return res; sig = method->signature; @@ -3576,14 +3485,15 @@ mono_marshal_get_synchronized_wrapper (MonoMethod *method) mono_mb_emit_ldloc (mb, ret_local); mono_mb_emit_byte (mb, CEE_RET); - res = mono_mb_create_and_cache (cache, method, - mb, sig, sig->param_count + 16); + res = mono_mb_create_method (mb, sig, sig->param_count + 16); mono_mb_free (mb); header = ((MonoMethodNormal *)res)->header; header->num_clauses = 1; header->clauses = clause; + g_hash_table_insert (cache, method, res); + return res; } @@ -4097,12 +4007,6 @@ mono_marshal_load_type_info (MonoClass* klass) info->fields [j].field = &klass->fields [i]; - if ((klass->field.count == 1) && (klass->instance_size == sizeof (MonoObject)) && - (strcmp (klass->fields [i].name, "$PRIVATE$") == 0)) { - /* This field is a hack inserted by MCS to empty structures */ - continue; - } - switch (layout) { case TYPE_ATTRIBUTE_AUTO_LAYOUT: case TYPE_ATTRIBUTE_SEQUENTIAL_LAYOUT: diff --git a/mono/metadata/marshal.h b/mono/metadata/marshal.h index 943e6b3508d..da3597d8d71 100644 --- a/mono/metadata/marshal.h +++ b/mono/metadata/marshal.h @@ -21,9 +21,6 @@ typedef struct _MonoMethodBuilder MonoMethodBuilder; /* marshaling helper functions */ -void -mono_marshal_init (void); - gint32 mono_class_native_size (MonoClass *klass, guint32 *align); diff --git a/mono/metadata/metadata.c b/mono/metadata/metadata.c index 162aa40198a..31f3ac2fc24 100644 --- a/mono/metadata/metadata.c +++ b/mono/metadata/metadata.c @@ -1165,22 +1165,6 @@ mono_type_equal (gconstpointer ka, gconstpointer kb) return 1; } -/** - * mono_metadata_init: - * - * Initialize the global variables of this module. - */ -void -mono_metadata_init (void) -{ - int i; - - type_cache = g_hash_table_new (mono_type_hash, mono_type_equal); - - for (i = 0; i < NBUILTIN_TYPES (); ++i) - g_hash_table_insert (type_cache, &builtin_types [i], &builtin_types [i]); -} - /* * mono_metadata_parse_type: * @m: metadata context @@ -1202,6 +1186,14 @@ mono_metadata_parse_type (MonoImage *m, MonoParseTypeMode mode, short opt_attrs, { MonoType *type, *cached; + if (!type_cache) { + int i; + type_cache = g_hash_table_new (mono_type_hash, mono_type_equal); + + for (i = 0; i < NBUILTIN_TYPES (); ++i) + g_hash_table_insert (type_cache, &builtin_types [i], &builtin_types [i]); + } + switch (mode) { case MONO_PARSE_MOD_TYPE: case MONO_PARSE_PARAM: @@ -1261,8 +1253,6 @@ mono_metadata_parse_type (MonoImage *m, MonoParseTypeMode mode, short opt_attrs, } if (rptr) *rptr = ptr; - - /* No need to use locking since nobody is modifying the hash table */ if (mode != MONO_PARSE_PARAM && !type->num_mods && (cached = g_hash_table_lookup (type_cache, type))) { mono_metadata_free_type (type); return cached; @@ -2132,39 +2122,6 @@ mono_metadata_packing_from_typedef (MonoImage *meta, guint32 index, guint32 *pac return loc.result + 1; } -/* - * mono_metadata_custom_attrs_from_index: - * @meta: metadata context - * @index: token representing the parent - * - * Returns: the 1-based index into the CustomAttribute table of the first - * attribute which belongs to the metadata object described by @index. - * Returns 0 if no such attribute is found. - */ -guint32 -mono_metadata_custom_attrs_from_index (MonoImage *meta, guint32 index) -{ - MonoTableInfo *tdef = &meta->tables [MONO_TABLE_CUSTOMATTRIBUTE]; - locator_t loc; - - if (!tdef->base) - return 0; - - loc.idx = index; - loc.col_idx = MONO_CUSTOM_ATTR_PARENT; - loc.t = tdef; - - if (!bsearch (&loc, tdef->base, tdef->rows, tdef->row_size, table_locator)) - return 0; - - /* Find the first entry by searching backwards */ - while ((loc.result > 0) && (mono_metadata_decode_row_col (tdef, loc.result - 1, MONO_CUSTOM_ATTR_PARENT) == index)) - loc.result --; - - /* loc_result is 0..1, needs to be mapped to table index (that is +1) */ - return loc.result + 1; -} - #ifdef DEBUG static void mono_backtrace (int limit) @@ -2265,10 +2222,6 @@ mono_type_size (MonoType *t, gint *align) MonoClass *iclass = mono_class_from_mono_type (t); return mono_type_size (&iclass->byval_arg, align); } - case MONO_TYPE_VAR: - case MONO_TYPE_MVAR: - *align = __alignof__(gpointer); - return sizeof (gpointer); default: g_error ("mono_type_size: type 0x%02x unknown", t->type); } diff --git a/mono/metadata/metadata.h b/mono/metadata/metadata.h index 45890cbea15..78dc7e13ad3 100644 --- a/mono/metadata/metadata.h +++ b/mono/metadata/metadata.h @@ -171,7 +171,6 @@ typedef struct { } data; } MonoMarshalSpec; -void mono_metadata_init (void); void mono_metadata_decode_row (MonoTableInfo *t, int idx, @@ -217,7 +216,6 @@ guint32 mono_metadata_properties_from_typedef (MonoImage *meta, guint32 tabl guint32 mono_metadata_methods_from_property (MonoImage *meta, guint32 table_index, guint *end); guint32 mono_metadata_packing_from_typedef (MonoImage *meta, guint32 table_index, guint32 *packing, guint32 *size); const char* mono_metadata_get_marshal_info (MonoImage *meta, guint32 idx, gboolean is_field); -guint32 mono_metadata_custom_attrs_from_index (MonoImage *meta, guint32 index); MonoMarshalSpec *mono_metadata_parse_marshal_spec (MonoImage *image, const char *ptr); diff --git a/mono/metadata/mono-debug-debugger.c b/mono/metadata/mono-debug-debugger.c index 8fefc5e9848..fc74bfcd36b 100644 --- a/mono/metadata/mono-debug-debugger.c +++ b/mono/metadata/mono-debug-debugger.c @@ -593,10 +593,9 @@ static guint32 write_class (MonoDebuggerSymbolTable *table, MonoClass *klass) { guint8 buffer [BUFSIZ], *ptr = buffer, *old_ptr; - GPtrArray *methods = NULL, *static_methods = NULL, *ctors = NULL; + GPtrArray *methods = NULL, *static_methods = NULL; int num_fields = 0, num_static_fields = 0, num_properties = 0, num_static_properties = 0; int num_methods = 0, num_static_methods = 0, num_params = 0, num_static_params = 0, base_offset = 0; - int num_ctors = 0, num_ctor_params = 0; guint32 size, data_size, offset; GHashTable *method_slots = NULL; int i; @@ -634,25 +633,16 @@ write_class (MonoDebuggerSymbolTable *table, MonoClass *klass) method_slots = g_hash_table_new (NULL, NULL); methods = g_ptr_array_new (); static_methods = g_ptr_array_new (); - ctors = g_ptr_array_new (); for (i = 0; i < klass->method.count; i++) { MonoMethod *method = klass->methods [i]; - if (!strcmp (method->name, ".cctor")) + if (strcmp (method->name, ".ctor") == 0 || strcmp (method->name, ".cctor") == 0) continue; - if (!((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC)) - continue; - - if (!strcmp (method->name, ".ctor")) { - ++num_ctors; - num_ctor_params += method->signature->param_count; - g_ptr_array_add (ctors, method); - continue; - } - if (method->flags & METHOD_ATTRIBUTE_SPECIAL_NAME) continue; + if (!((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC)) + continue; if (g_hash_table_lookup (method_slots, GUINT_TO_POINTER (method->slot))) continue; g_hash_table_insert (method_slots, GUINT_TO_POINTER (method->slot), method); @@ -670,10 +660,9 @@ write_class (MonoDebuggerSymbolTable *table, MonoClass *klass) g_hash_table_destroy (method_slots); - size = 66 + sizeof (gpointer) + num_fields * 8 + num_static_fields * 8 + num_properties * (4 + 2 * sizeof (gpointer)) + + size = 58 + sizeof (gpointer) + num_fields * 8 + num_static_fields * 8 + num_properties * (4 + 2 * sizeof (gpointer)) + num_static_properties * (4 + 2 * sizeof (gpointer)) + num_methods * (8 + sizeof (gpointer)) + num_params * 4 + - num_static_methods * (8 + sizeof (gpointer)) + num_static_params * 4 + num_ctors * (8 + sizeof (gpointer)) + - num_ctor_params * 4; + num_static_methods * (8 + sizeof (gpointer)) + num_static_params * 4; data_size = size; @@ -702,9 +691,6 @@ write_class (MonoDebuggerSymbolTable *table, MonoClass *klass) WRITE_UINT32 (ptr, num_methods * (4 + 2 * sizeof (gpointer)) + num_params * sizeof (gpointer)); WRITE_UINT32 (ptr, num_static_methods); WRITE_UINT32 (ptr, num_static_methods * (4 + 2 * sizeof (gpointer)) + num_static_params * sizeof (gpointer)); - WRITE_UINT32 (ptr, num_ctors); - WRITE_UINT32 (ptr, num_ctors * (4 + 2 * sizeof (gpointer)) + num_ctor_params * sizeof (gpointer)); - for (i = 0; i < klass->field.count; i++) { if (klass->fields [i].type->attrs & FIELD_ATTRIBUTE_STATIC) continue; @@ -775,21 +761,6 @@ write_class (MonoDebuggerSymbolTable *table, MonoClass *klass) WRITE_UINT32 (ptr, write_type (table, method->signature->params [j])); } - g_ptr_array_free (static_methods, FALSE); - - for (i = 0; i < ctors->len; i++) { - MonoMethod *ctor = g_ptr_array_index (ctors, i); - int j; - - WRITE_POINTER (ptr, ctor); - WRITE_UINT32 (ptr, 0); - WRITE_UINT32 (ptr, ctor->signature->param_count); - for (j = 0; j < ctor->signature->param_count; j++) - WRITE_UINT32 (ptr, write_type (table, ctor->signature->params [j])); - } - - g_ptr_array_free (ctors, FALSE); - if (klass->parent && (klass->parent != mono_defaults.object_class)) WRITE_UINT32 (ptr, write_class (table, klass->parent)); else @@ -1139,13 +1110,7 @@ mono_debugger_runtime_invoke (MonoMethod *method, void *obj, void **params, Mono if (method->klass->valuetype && (obj != NULL)) obj = mono_value_box (mono_domain_get (), method->klass, obj); - if (!strcmp (method->name, ".ctor")) { - retval = obj = mono_object_new (mono_domain_get (), method->klass); - - mono_runtime_invoke (method, obj, params, exc); - } else - retval = mono_runtime_invoke (method, obj, params, exc); - + retval = mono_runtime_invoke (method, obj, params, exc); if (*exc == NULL) return retval; diff --git a/mono/metadata/mono-debug.h b/mono/metadata/mono-debug.h index 4ac4e07cd64..21f22d6e861 100644 --- a/mono/metadata/mono-debug.h +++ b/mono/metadata/mono-debug.h @@ -75,7 +75,7 @@ struct _MonoDebugVarInfo { guint32 end_scope; }; -#define MONO_DEBUGGER_VERSION 38 +#define MONO_DEBUGGER_VERSION 37 #define MONO_DEBUGGER_MAGIC 0x7aff65af4253d427 extern MonoDebugFormat mono_debug_format; diff --git a/mono/metadata/object.c b/mono/metadata/object.c index 34827be62f7..d99fe80e0e0 100644 --- a/mono/metadata/object.c +++ b/mono/metadata/object.c @@ -29,6 +29,8 @@ #include "mono/metadata/profiler-private.h" #include <mono/os/gc_wrapper.h> +CRITICAL_SECTION *metadata_section = NULL; + /* * Enable experimental typed allocation using the GC_gcj_malloc function. */ @@ -72,7 +74,6 @@ mono_runtime_class_init (MonoVTable *vtable) MonoClass *klass; gchar *full_name; gboolean found; - MonoDomain *last_domain = NULL; MONO_ARCH_SAVE_REGS; @@ -93,25 +94,21 @@ mono_runtime_class_init (MonoVTable *vtable) } if (found) { + EnterCriticalSection (metadata_section); mono_domain_lock (vtable->domain); /* double check... */ if (vtable->initialized || vtable->initializing) { mono_domain_unlock (vtable->domain); + LeaveCriticalSection (metadata_section); return; } vtable->initializing = 1; - if (mono_domain_get () != vtable->domain) { - /* Transfer into the target domain */ - last_domain = mono_domain_get (); - mono_domain_set (vtable->domain); - } mono_runtime_invoke (method, NULL, NULL, (MonoObject **) &exc); - if (last_domain) - mono_domain_set (last_domain); vtable->initialized = 1; vtable->initializing = 0; /* FIXME: if the cctor fails, the type must be marked as unusable */ mono_domain_unlock (vtable->domain); + LeaveCriticalSection (metadata_section); } else { vtable->initialized = 1; return; @@ -542,15 +539,12 @@ mono_class_vtable (MonoDomain *domain, MonoClass *class) MonoVTable * mono_class_proxy_vtable (MonoDomain *domain, MonoClass *class) { - MonoVTable *vt, *pvt, *pvt2; + MonoVTable *vt, *pvt; int i, j, vtsize, interface_vtsize = 0; MonoClass* iclass = NULL; MonoClass* k; - mono_domain_lock (domain); - pvt = mono_g_hash_table_lookup (domain->proxy_vtable_hash, class); - mono_domain_unlock (domain); - if (pvt) + if ((pvt = mono_g_hash_table_lookup (domain->proxy_vtable_hash, class))) return pvt; if (class->flags & TYPE_ATTRIBUTE_INTERFACE) { @@ -637,20 +631,8 @@ mono_class_proxy_vtable (MonoDomain *domain, MonoClass *class) } } - mono_domain_lock (domain); - - pvt2 = mono_g_hash_table_lookup (domain->proxy_vtable_hash, class); - if (pvt2) { - /* Somebody got in before us */ - mono_domain_unlock (domain); - g_free (pvt); - - return pvt2; - } mono_g_hash_table_insert (domain->proxy_vtable_hash, class, pvt); - mono_domain_unlock (domain); - return pvt; } @@ -663,7 +645,7 @@ mono_object_get_virtual_method (MonoObject *obj, MonoMethod *method) { MonoClass *klass; MonoMethod **vtable; gboolean is_proxy; - MonoMethod *res = NULL; + MonoMethod *res; klass = mono_object_class (obj); if (klass == mono_defaults.transparent_proxy_class) { @@ -680,18 +662,15 @@ mono_object_get_virtual_method (MonoObject *obj, MonoMethod *method) { /* check method->slot is a valid index: perform isinstance? */ if (method->klass->flags & TYPE_ATTRIBUTE_INTERFACE) { - if (!is_proxy) - res = vtable [klass->interface_offsets [method->klass->interface_id] + method->slot]; + res = vtable [klass->interface_offsets [method->klass->interface_id] + method->slot]; } else { res = vtable [method->slot]; } - if (is_proxy) { - if (!res) res = method; /* It may be an interface or abstract class method */ - res = mono_marshal_get_remoting_invoke (res); - } - g_assert (res); + + if (is_proxy) + return mono_marshal_get_remoting_invoke (res); return res; } @@ -1766,7 +1745,7 @@ mono_object_isinst (MonoObject *obj, MonoClass *klass) if (!klass->inited) mono_class_init (klass); - if (oklass != klass && oklass == mono_defaults.transparent_proxy_class) { + if (oklass == mono_defaults.transparent_proxy_class) { /* fixme: add check for IRemotingTypeInfo */ MonoRealProxy *rp = ((MonoTransparentProxy *)obj)->rp; MonoType *type; @@ -2069,8 +2048,6 @@ mono_message_init (MonoDomain *domain, this->args = mono_array_new (domain, mono_defaults.object_class, sig->param_count); this->arg_types = mono_array_new (domain, mono_defaults.byte_class, sig->param_count); - this->async_result = NULL; - this->call_type = CallType_Sync; names = g_new (char *, sig->param_count); mono_method_get_param_names (method->method, (const char **) names); @@ -2324,7 +2301,7 @@ mono_method_call_message_new (MonoMethod *method, gpointer *params, MonoMethod * mono_array_set (msg->args, gpointer, i, arg); } - if (cb != NULL && state != NULL) { + if (invoke) { *cb = *((MonoDelegate **)params [i]); i++; *state = *((MonoObject **)params [i]); diff --git a/mono/metadata/object.h b/mono/metadata/object.h index 94858570953..bd8d635a412 100644 --- a/mono/metadata/object.h +++ b/mono/metadata/object.h @@ -197,14 +197,6 @@ typedef struct { MonoClass *klass; } MonoTransparentProxy; -/* This is a copy of System.Runtime.Remoting.Messaging.CallType */ -typedef enum { - CallType_Sync = 0, - CallType_BeginInvoke = 1, - CallType_EndInvoke = 2, - CallType_OneWay = 3 -} MonoCallType; - typedef struct { MonoObject obj; MonoReflectionMethod *method; @@ -214,8 +206,6 @@ typedef struct { MonoObject *ctx; MonoObject *rval; MonoObject *exc; - MonoAsyncResult *async_result; - guint32 call_type; } MonoMethodMessage; typedef struct { @@ -240,8 +230,6 @@ typedef struct { HANDLE start_notify; gpointer stack_ptr; gpointer *static_data; - gpointer jit_data; - gpointer lock_data; } MonoThread; typedef struct { diff --git a/mono/metadata/pedump.c b/mono/metadata/pedump.c index 5a01e8f733f..aab36a8fb89 100644 --- a/mono/metadata/pedump.c +++ b/mono/metadata/pedump.c @@ -21,7 +21,6 @@ #include <mono/metadata/tokentype.h> #include <mono/metadata/appdomain.h> #include <mono/metadata/assembly.h> -#include <mono/metadata/rawbuffer.h> #include "mono/utils/mono-digest.h" gboolean dump_data = TRUE; @@ -405,12 +404,6 @@ main (int argc, char *argv []) if (!file) usage (); - mono_metadata_init (); - mono_raw_buffer_init (); - mono_images_init (); - mono_assemblies_init (); - mono_loader_init (); - image = mono_image_open (file, NULL); if (!image){ fprintf (stderr, "Can not open image %s\n", file); @@ -437,8 +430,9 @@ main (int argc, char *argv []) mono_init (file); assembly = mono_assembly_open (file, NULL); dump_verify_info (assembly->image, f); - } else - mono_image_close (image); + } + + mono_image_close (image); return 0; } diff --git a/mono/metadata/rand.c b/mono/metadata/rand.c index 40de9289390..0e5348a161e 100644 --- a/mono/metadata/rand.c +++ b/mono/metadata/rand.c @@ -105,13 +105,18 @@ ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_InternalGetNonZe /* This needs to change when I do the Win32 support... */ #else +#ifndef _MSC_VER +#warning "No Entropy Source Found" +#endif void ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_InternalGetBytes(MonoObject *self, MonoArray *arry) { + g_warning("0K problem. We have no entropy. Badness will occur."); mono_raise_exception(mono_get_exception_not_implemented()); } void ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_InternalGetNonZeroBytes(MonoObject *self, MonoArray *arry) { + g_warning("0K problem. We have no entropy. Badness will occur."); mono_raise_exception(mono_get_exception_not_implemented()); } diff --git a/mono/metadata/rawbuffer.c b/mono/metadata/rawbuffer.c index 131e55774e6..6c97d4d6210 100644 --- a/mono/metadata/rawbuffer.c +++ b/mono/metadata/rawbuffer.c @@ -22,8 +22,6 @@ #include <glib.h> #include "rawbuffer.h" -#include <mono/io-layer/io-layer.h> - #define ROUND_DOWN(VALUE,SIZE) ((VALUE) & ~((SIZE) - 1)) #define ROUND_UP(VALUE,SIZE) (ROUND_DOWN((VALUE) + (SIZE) - 1, (SIZE))) #if SIZEOF_VOID_P == 8 @@ -34,7 +32,6 @@ static GHashTable *mmap_map = NULL; static size_t alignment = 0; -static CRITICAL_SECTION mmap_mutex; static void get_alignment (void) @@ -73,16 +70,6 @@ mono_raw_buffer_free_malloc (void *base) g_free (base); } -void -mono_raw_buffer_init (void) -{ - InitializeCriticalSection (&mmap_mutex); - - get_alignment (); - - mmap_map = g_hash_table_new (NULL, NULL); -} - static void * mono_raw_buffer_load_mmap (int fd, int is_writable, guint32 base, size_t size) { @@ -94,6 +81,8 @@ mono_raw_buffer_load_mmap (int fd, int is_writable, guint32 base, size_t size) void *ptr; HANDLE file, mapping; + if (alignment == 0) + get_alignment (); start = ROUND_DOWN (base, alignment); end = base + size; @@ -117,9 +106,10 @@ mono_raw_buffer_load_mmap (int fd, int is_writable, guint32 base, size_t size) return 0; } - EnterCriticalSection (&mmap_mutex); + if (mmap_map == NULL) + mmap_map = g_hash_table_new (g_direct_hash, g_direct_equal); + g_hash_table_insert (mmap_map, ptr, GINT_TO_POINTER (mapping)); - LeaveCriticalSection (&mmap_mutex); return ((char *)ptr) + (base - start); @@ -132,6 +122,8 @@ mono_raw_buffer_load_mmap (int fd, int is_writable, guint32 base, size_t size) int flags = 0; void *ptr; + if (alignment == 0) + get_alignment (); start = ROUND_DOWN (base, alignment); end = ROUND_UP (base + size, alignment); @@ -147,9 +139,10 @@ mono_raw_buffer_load_mmap (int fd, int is_writable, guint32 base, size_t size) if (ptr == (void *) -1) return 0; - EnterCriticalSection (&mmap_mutex); + if (mmap_map == NULL) + mmap_map = g_hash_table_new (g_direct_hash, g_direct_equal); + g_hash_table_insert (mmap_map, ptr, GINT_TO_POINTER (size)); - LeaveCriticalSection (&mmap_mutex); return ((char *)ptr) + (base - start); #endif @@ -160,9 +153,7 @@ mono_raw_buffer_free_mmap (void *base) { int value; - EnterCriticalSection (&mmap_mutex); value = GPOINTER_TO_INT (g_hash_table_lookup (mmap_map, base)); - LeaveCriticalSection (&mmap_mutex); #ifdef USE_WIN32_API UnmapViewOfFile (base); @@ -198,14 +189,10 @@ void mono_raw_buffer_update (void *buffer, size_t size) { char *mmap_base; - gboolean exists; mmap_base = (gpointer)(ROUND_DOWN ((UINTPTR_TYPE) (buffer), alignment)); - - EnterCriticalSection (&mmap_mutex); - exists = g_hash_table_lookup (mmap_map, mmap_base) != NULL; - LeaveCriticalSection (&mmap_mutex); - if (exists) + + if (mmap_map && g_hash_table_lookup (mmap_map, mmap_base)) mono_raw_buffer_update_mmap (mmap_base, size); } @@ -213,12 +200,10 @@ void mono_raw_buffer_free (void *buffer) { char *mmap_base; - gboolean exists; mmap_base = (gpointer)(ROUND_DOWN ((UINTPTR_TYPE) (buffer), alignment)); - exists = g_hash_table_lookup (mmap_map, mmap_base) != NULL; - if (exists) + if (mmap_map && g_hash_table_lookup (mmap_map, mmap_base)) mono_raw_buffer_free_mmap (mmap_base); else mono_raw_buffer_free_malloc (buffer); diff --git a/mono/metadata/rawbuffer.h b/mono/metadata/rawbuffer.h index 6ff6aef3179..47232a2639f 100644 --- a/mono/metadata/rawbuffer.h +++ b/mono/metadata/rawbuffer.h @@ -1,10 +1,4 @@ -#ifndef __MONO_RAWBUFFER_H__ -#define __MONO_RAWBUFFER_H__ - -void mono_raw_buffer_init (void); void *mono_raw_buffer_load (int fd, int writable, guint32 base, size_t size); void mono_raw_buffer_update (void *buffer, size_t size); void mono_raw_buffer_free (void *buffer); - -#endif /* __MONO_RAWBUFFER_H__ */ diff --git a/mono/metadata/reflection.c b/mono/metadata/reflection.c index 5235add3927..52160815529 100644 --- a/mono/metadata/reflection.c +++ b/mono/metadata/reflection.c @@ -95,12 +95,7 @@ const unsigned char table_sizes [64] = { MONO_EXP_TYPE_SIZE, MONO_MANIFEST_SIZE, MONO_NESTED_CLASS_SIZE, - - MONO_GENERICPARAM_SIZE, /* 0x2A */ - MONO_METHODSPEC_SIZE, - MONO_GENPARCONSTRAINT_SIZE, - - 0 /* 0x2D */ + 0 /* 0x2A */ }; /** @@ -379,11 +374,6 @@ encode_type (MonoDynamicAssembly *assembly, MonoType *type, char *p, char **endb } break; } - case MONO_TYPE_VAR: - mono_metadata_encode_value (type->type, p, &p); - mono_metadata_encode_value (type->data.type_param, p, &p); - break; - default: g_error ("need to encode type %x", type->type); } @@ -1487,50 +1477,6 @@ mono_image_get_event_info (MonoReflectionEventBuilder *eb, MonoDynamicAssembly * } } -static void -encode_constraints (MonoReflectionGenericParam *gparam, guint32 owner, MonoDynamicAssembly *assembly) -{ - MonoDynamicTable *table; - guint32 num_constraints, i; - guint32 *values; - guint32 table_idx; - - table = &assembly->tables [MONO_TABLE_GENERICPARAMCONSTRAINT]; - num_constraints = mono_array_length (gparam->constraints); - table->rows += num_constraints; - alloc_table (table, table->rows); - - for (i = 0; i < num_constraints; i++) { - MonoReflectionType *constraint = mono_array_get (gparam->constraints, gpointer, i); - - table_idx = table->next_idx ++; - values = table->values + table_idx * MONO_GENPARCONSTRAINT_SIZE; - - values [MONO_GENPARCONSTRAINT_GENERICPAR] = owner; - values [MONO_GENPARCONSTRAINT_CONSTRAINT] = mono_image_typedef_or_ref (assembly, constraint->type); - } -} - -static void -mono_image_get_generic_param_info (MonoReflectionGenericParam *gparam, guint32 owner, MonoDynamicAssembly *assembly) -{ - MonoDynamicTable *table; - guint32 *values; - guint32 table_idx; - - table = &assembly->tables [MONO_TABLE_GENERICPARAM]; - table_idx = table->next_idx ++; - values = table->values + table_idx * MONO_GENERICPARAM_SIZE; - - values [MONO_GENERICPARAM_OWNER] = owner; - values [MONO_GENERICPARAM_FLAGS] = gparam->param->flags; - values [MONO_GENERICPARAM_NUMBER] = gparam->param->num; - values [MONO_GENERICPARAM_NAME] = string_heap_insert (&assembly->sheap, gparam->param->name); - - if (gparam->constraints) - encode_constraints (gparam, table_idx, assembly); -} - static guint32 resolution_scope_from_image (MonoDynamicAssembly *assembly, MonoImage *image) { @@ -2086,17 +2032,6 @@ mono_image_get_type_info (MonoDomain *domain, MonoReflectionTypeBuilder *tb, Mon ntable->next_idx++; } } - if (tb->generic_params) { - table = &assembly->tables [MONO_TABLE_GENERICPARAM]; - table->rows += mono_array_length (tb->generic_params); - alloc_table (table, table->rows); - for (i = 0; i < mono_array_length (tb->generic_params); ++i) { - guint32 owner = MONO_TYPEORMETHOD_TYPE | (tb->table_idx << MONO_TYPEORMETHOD_BITS); - - mono_image_get_generic_param_info ( - mono_array_get (tb->generic_params, MonoReflectionGenericParam*, i), owner, assembly); - } - } } static void @@ -2962,10 +2897,10 @@ create_dynamic_mono_image (char *assembly_name, char *module_name) image->references = g_new0 (MonoAssembly*, 1); image->references [0] = NULL; - image->method_cache = g_hash_table_new (NULL, NULL); - image->class_cache = g_hash_table_new (NULL, NULL); + image->method_cache = g_hash_table_new (g_direct_hash, g_direct_equal); + image->class_cache = g_hash_table_new (g_direct_hash, g_direct_equal); image->name_cache = g_hash_table_new (g_str_hash, g_str_equal); - image->array_cache = g_hash_table_new (NULL, NULL); + image->array_cache = g_hash_table_new (g_direct_hash, g_direct_equal); image->delegate_begin_invoke_cache = g_hash_table_new ((GHashFunc)mono_signature_hash, @@ -2977,13 +2912,11 @@ create_dynamic_mono_image (char *assembly_name, char *module_name) g_hash_table_new ((GHashFunc)mono_signature_hash, (GCompareFunc)mono_metadata_signature_equal); - image->runtime_invoke_cache = g_hash_table_new (NULL, NULL); - image->managed_wrapper_cache = g_hash_table_new (NULL, NULL); - image->native_wrapper_cache = g_hash_table_new (NULL, NULL); - image->remoting_invoke_cache = g_hash_table_new (NULL, NULL); - image->synchronized_cache = g_hash_table_new (NULL, NULL); - - image->generics_cache = g_hash_table_new ((GHashFunc)mono_metadata_type_hash, (GEqualFunc)mono_metadata_type_equal); + image->runtime_invoke_cache = g_hash_table_new (g_direct_hash, g_direct_equal); + image->managed_wrapper_cache = g_hash_table_new (g_direct_hash, g_direct_equal); + image->native_wrapper_cache = g_hash_table_new (g_direct_hash, g_direct_equal); + image->remoting_invoke_cache = g_hash_table_new (g_direct_hash, g_direct_equal); + image->synchronized_cache = g_hash_table_new (g_direct_hash, g_direct_equal); return image; } @@ -3016,12 +2949,11 @@ mono_image_basic_init (MonoReflectionAssemblyBuilder *assemblyb) assembly->assembly.dynamic = assembly; assemblyb->assembly.assembly = (MonoAssembly*)assembly; - assembly->token_fixups = mono_g_hash_table_new (NULL, NULL); - assembly->method_to_table_idx = mono_g_hash_table_new (NULL, NULL); - assembly->field_to_table_idx = mono_g_hash_table_new (NULL, NULL); - assembly->param_marshalling = mono_g_hash_table_new (NULL, NULL); - assembly->handleref = g_hash_table_new (NULL, NULL); - assembly->tokens = mono_g_hash_table_new (NULL, NULL); + assembly->token_fixups = mono_g_hash_table_new (g_direct_hash, g_direct_equal); + assembly->method_to_table_idx = mono_g_hash_table_new (g_direct_hash, g_direct_equal); + assembly->field_to_table_idx = mono_g_hash_table_new (g_direct_hash, g_direct_equal); + assembly->handleref = g_hash_table_new (g_direct_hash, g_direct_equal); + assembly->tokens = mono_g_hash_table_new (g_direct_hash, g_direct_equal); assembly->typeref = g_hash_table_new ((GHashFunc)mono_metadata_type_hash, (GCompareFunc)mono_metadata_type_equal); assembly->blob_cache = mono_g_hash_table_new ((GHashFunc)mono_blob_entry_hash, (GCompareFunc)mono_blob_entry_equal); @@ -3204,16 +3136,16 @@ mono_image_create_pefile (MonoReflectionAssemblyBuilder *assemblyb) { size = assembly->sections [MONO_SECTION_TEXT].size; size += FILE_ALIGN - 1; size &= ~(FILE_ALIGN - 1); - header->pe.pe_code_size = GUINT32_FROM_LE(size); + header->pe.pe_code_size = size; size = assembly->sections [MONO_SECTION_RSRC].size; size += FILE_ALIGN - 1; size &= ~(FILE_ALIGN - 1); - header->pe.pe_data_size = GUINT32_FROM_LE(size); + header->pe.pe_data_size = size; g_assert (START_TEXT_RVA == assembly->sections [MONO_SECTION_TEXT].rva); - header->pe.pe_rva_code_base = GUINT32_FROM_LE (assembly->sections [MONO_SECTION_TEXT].rva); - header->pe.pe_rva_data_base = GUINT32_FROM_LE (assembly->sections [MONO_SECTION_RSRC].rva); + header->pe.pe_rva_code_base = assembly->sections [MONO_SECTION_TEXT].rva; + header->pe.pe_rva_data_base = assembly->sections [MONO_SECTION_RSRC].rva; /* pe_rva_entry_point always at the beginning of the text section */ - header->pe.pe_rva_entry_point = GUINT32_FROM_LE (assembly->sections [MONO_SECTION_TEXT].rva); + header->pe.pe_rva_entry_point = assembly->sections [MONO_SECTION_TEXT].rva; header->nt.pe_image_base = GUINT32_FROM_LE (virtual_base); header->nt.pe_section_align = GUINT32_FROM_LE (VIRT_ALIGN); @@ -3798,43 +3730,41 @@ mono_event_get_object (MonoDomain *domain, MonoClass *klass, MonoEvent *event) * Return an System.Reflection.ParameterInfo array object representing the parameters * in the method @method. */ -MonoArray* +MonoReflectionParameter** mono_param_get_objects (MonoDomain *domain, MonoMethod *method) { - static MonoClass *System_Reflection_ParameterInfo; - MonoArray *res = NULL; - MonoReflectionMethod *member = NULL; - MonoReflectionParameter *param = NULL; + MonoReflectionParameter **res; + MonoReflectionMethod *member; + MonoClass *oklass; char **names; int i; - if (!System_Reflection_ParameterInfo) - System_Reflection_ParameterInfo = mono_class_from_name ( - mono_defaults.corlib, "System.Reflection", "ParameterInfo"); - if (!method->signature->param_count) - return mono_array_new (domain, System_Reflection_ParameterInfo, 0); + return NULL; /* Note: the cache is based on the address of the signature into the method * since we already cache MethodInfos with the method as keys. */ - CHECK_OBJECT (MonoArray*, &(method->signature), NULL); + CHECK_OBJECT (MonoReflectionParameter**, &(method->signature), NULL); member = mono_method_get_object (domain, method, NULL); names = g_new (char *, method->signature->param_count); mono_method_get_param_names (method, (const char **) names); - - res = mono_array_new (domain, System_Reflection_ParameterInfo, method->signature->param_count); + + oklass = mono_class_from_name (mono_defaults.corlib, "System.Reflection", "ParameterInfo"); +#if HAVE_BOEHM_GC + res = GC_MALLOC (sizeof (MonoReflectionParameter*) * method->signature->param_count); +#else + res = g_new0 (MonoReflectionParameter*, method->signature->param_count); +#endif for (i = 0; i < method->signature->param_count; ++i) { - param = (MonoReflectionParameter *)mono_object_new (domain, - System_Reflection_ParameterInfo); - param->ClassImpl = mono_type_get_object (domain, method->signature->params [i]); - param->DefaultValueImpl = NULL; /* FIXME */ - param->MemberImpl = (MonoObject*)member; - param->NameImpl = mono_string_new (domain, names [i]); - param->PositionImpl = i; - param->AttrsImpl = method->signature->params [i]->attrs; - mono_array_set (res, gpointer, i, param); + res [i] = (MonoReflectionParameter *)mono_object_new (domain, oklass); + res [i]->ClassImpl = mono_type_get_object (domain, method->signature->params [i]); + res [i]->DefaultValueImpl = NULL; /* FIXME */ + res [i]->MemberImpl = (MonoObject*)member; + res [i]->NameImpl = mono_string_new (domain, names [i]); + res [i]->PositionImpl = i; + res [i]->AttrsImpl = method->signature->params [i]->attrs; } g_free (names); CACHE_OBJECT (&(method->signature), res, NULL); @@ -4060,6 +3990,64 @@ mono_reflection_parse_type (char *name, MonoTypeNameParse *info) { return 1; } +static void +mono_type_get_name_recurse (MonoType *type, GString *str) +{ + MonoClass *klass; + + switch (type->type) { + case MONO_TYPE_ARRAY: { + int i, rank = type->data.array->rank; + + mono_type_get_name_recurse (&type->data.array->eklass->byval_arg, str); + g_string_append_c (str, '['); + for (i = 1; i < rank; i++) + g_string_append_c (str, ','); + g_string_append_c (str, ']'); + break; + } + case MONO_TYPE_SZARRAY: + mono_type_get_name_recurse (&type->data.klass->byval_arg, str); + g_string_append (str, "[]"); + break; + case MONO_TYPE_PTR: + mono_type_get_name_recurse (type->data.type, str); + g_string_append_c (str, '*'); + break; + default: + klass = mono_class_from_mono_type (type); + if (klass->nested_in) { + mono_type_get_name_recurse (&klass->nested_in->byval_arg, str); + g_string_append_c (str, '+'); + } + if (*klass->name_space) { + g_string_append (str, klass->name_space); + g_string_append_c (str, '.'); + } + g_string_append (str, klass->name); + break; + } +} + +/* + * mono_type_get_name: + * @type: a type + * + * Returns the string representation for type as required by System.Reflection. + * The inverse of mono_reflection_parse_type (). + */ +char* +mono_type_get_name (MonoType *type) +{ + GString* result = g_string_new (""); + mono_type_get_name_recurse (type, result); + + if (type->byref) + g_string_append_c (result, '&'); + + return g_string_free (result, FALSE); +} + static MonoType* mono_reflection_get_type_internal (MonoImage* image, MonoTypeNameParse *info, gboolean ignorecase) { @@ -4586,18 +4574,13 @@ mono_custom_attrs_from_index (MonoImage *image, guint32 idx) MonoCustomAttrInfo *ainfo; GList *tmp, *list = NULL; const char *data; - + ca = &image->tables [MONO_TABLE_CUSTOMATTRIBUTE]; - - i = mono_metadata_custom_attrs_from_index (image, idx); - if (!i) - return NULL; - i --; - while (i < ca->rows) { + /* the table is not sorted */ + for (i = 0; i < ca->rows; ++i) { if (mono_metadata_decode_row_col (ca, i, MONO_CUSTOM_ATTR_PARENT) != idx) - break; + continue; list = g_list_prepend (list, GUINT_TO_POINTER (i)); - ++i; } len = g_list_length (list); if (!len) @@ -5284,38 +5267,6 @@ mono_reflection_setup_internal_class (MonoReflectionTypeBuilder *tb) } /* - * mono_reflection_setup_generic_class: - * @tb: a TypeBuilder object - * - * Setup the generic class after all generic parameters have been added. - */ -void -mono_reflection_setup_generic_class (MonoReflectionTypeBuilder *tb) -{ - MonoClass *klass; - int count, i; - - MONO_ARCH_SAVE_REGS; - - klass = my_mono_class_from_mono_type (tb->type.type); - - count = tb->generic_params ? mono_array_length (tb->generic_params) : 0; - - if (klass->gen_params || (count == 0)) - return; - - klass->num_gen_params = count; - klass->gen_params = g_new0 (MonoGenericParam, count); - - for (i = 0; i < count; i++) { - MonoReflectionGenericParam *gparam = mono_array_get (tb->generic_params, gpointer, i); - klass->gen_params [i] = *gparam->param; - } - - ensure_runtime_vtable (klass); -} - -/* * mono_reflection_create_internal_class: * @tb: a TypeBuilder object * @@ -5353,43 +5304,6 @@ mono_reflection_create_internal_class (MonoReflectionTypeBuilder *tb) } } -static MonoMarshalSpec* -mono_marshal_spec_from_builder (MonoAssembly *assembly, - MonoReflectionMarshal *minfo) -{ - MonoMarshalSpec *res; - - res = g_new0 (MonoMarshalSpec, 1); - res->native = minfo->type; - - switch (minfo->type) { - case MONO_NATIVE_LPARRAY: - res->data.array_data.elem_type = minfo->eltype; - res->data.array_data.param_num = 0; /* Not yet */ - res->data.array_data.num_elem = minfo->count; - break; - - case MONO_NATIVE_BYVALTSTR: - case MONO_NATIVE_BYVALARRAY: - res->data.array_data.num_elem = minfo->count; - break; - - case MONO_NATIVE_CUSTOM: - if (minfo->marshaltyperef) - res->data.custom_data.custom_name = - type_get_qualified_name (minfo->marshaltyperef->type, - assembly); - if (minfo->mcookie) - res->data.custom_data.cookie = mono_string_to_utf8 (minfo->mcookie); - break; - - default: - break; - } - - return res; -} - static MonoMethod* reflection_methodbuilder_to_mono_method (MonoClass *klass, ReflectionMethodBuilder *rmb, @@ -5397,8 +5311,6 @@ reflection_methodbuilder_to_mono_method (MonoClass *klass, { MonoMethod *m; MonoMethodNormal *pm; - MonoMarshalSpec **specs; - int i; if ((rmb->attrs & METHOD_ATTRIBUTE_PINVOKE_IMPL) || (rmb->iattrs & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL)) @@ -5485,25 +5397,6 @@ reflection_methodbuilder_to_mono_method (MonoClass *klass, pm->header = header; } - /* Parameter marshalling */ - specs = NULL; - if (rmb->pinfo) - for (i = 0; i < mono_array_length (rmb->pinfo); ++i) { - MonoReflectionParamBuilder *pb; - if ((pb = mono_array_get (rmb->pinfo, MonoReflectionParamBuilder*, i))) { - if (pb->marshal_info) { - if (specs == NULL) - specs = g_new0 (MonoMarshalSpec*, sig->param_count + 1); - specs [pb->position] = - mono_marshal_spec_from_builder (klass->image->assembly, pb->marshal_info); - } - } - } - if (specs != NULL) - mono_g_hash_table_insert ( - ((MonoDynamicAssembly*)klass->image->assembly->dynamic)->param_marshalling, - m, specs); - return m; } @@ -5810,37 +5703,6 @@ mono_reflection_create_runtime_class (MonoReflectionTypeBuilder *tb) return res; } -MonoReflectionType * -mono_reflection_define_generic_parameter (MonoReflectionTypeBuilder *tb, MonoReflectionGenericParam *gparam) -{ - MonoClass *klass; - MonoImage *image; - MonoGenericParam *param; - int count, i; - - MONO_ARCH_SAVE_REGS; - - image = tb->module->assemblyb->dynamic_assembly->assembly.image; - - param = gparam->param = g_new0 (MonoGenericParam, 1); - param->name = mono_string_to_utf8 (gparam->name); - param->num = mono_array_length (tb->generic_params) - 1; - - count = gparam->constraints ? mono_array_length (gparam->constraints) : 0; - param->constraints = g_new0 (MonoClass *, count + 1); - for (i = 0; i < count; i++) { - MonoReflectionType *constraint = mono_array_get (gparam->constraints, MonoReflectionType *, i); - - param->constraints [i] = mono_class_from_mono_type (constraint->type); - } - - klass = mono_class_from_gen_param (image, FALSE, param->num, param); - - gparam->type = mono_type_get_object (mono_object_domain (tb), &klass->byval_arg); - - return gparam->type; -} - MonoArray * mono_reflection_sighelper_get_signature_local (MonoReflectionSigHelper *sig) { diff --git a/mono/metadata/reflection.h b/mono/metadata/reflection.h index f77f80d62ee..43bff2f681c 100644 --- a/mono/metadata/reflection.h +++ b/mono/metadata/reflection.h @@ -270,7 +270,6 @@ typedef struct { MonoGHashTable *token_fixups; MonoGHashTable *method_to_table_idx; MonoGHashTable *field_to_table_idx; - MonoGHashTable *param_marshalling; gboolean run; gboolean save; char *strong_name; @@ -380,18 +379,9 @@ typedef struct { MonoReflectionModuleBuilder *module; gint32 class_size; gint32 packing_size; - MonoArray *generic_params; } MonoReflectionTypeBuilder; typedef struct { - MonoObject obj; - MonoGenericParam *param; - MonoReflectionType *type; - MonoString *name; - MonoArray *constraints; -} MonoReflectionGenericParam; - -typedef struct { MonoObject obj; MonoString *name; MonoString *codebase; @@ -476,6 +466,7 @@ typedef struct { guint32 location; } MonoManifestResourceInfo; +char* mono_type_get_name (MonoType *type); int mono_reflection_parse_type (char *name, MonoTypeNameParse *info); MonoType* mono_reflection_get_type (MonoImage* image, MonoTypeNameParse *info, gboolean ignorecase); MonoType* mono_reflection_type_from_name (char *name, MonoImage *image); @@ -495,7 +486,7 @@ MonoReflectionField* mono_field_get_object (MonoDomain *domain, MonoClass MonoReflectionProperty* mono_property_get_object (MonoDomain *domain, MonoClass *klass, MonoProperty *property); MonoReflectionEvent* mono_event_get_object (MonoDomain *domain, MonoClass *klass, MonoEvent *event); /* note: this one is slightly different: we keep the whole array of params in the cache */ -MonoArray* mono_param_get_objects (MonoDomain *domain, MonoMethod *method); +MonoReflectionParameter** mono_param_get_objects (MonoDomain *domain, MonoMethod *method); MonoArray* mono_reflection_get_custom_attrs (MonoObject *obj); MonoArray* mono_reflection_get_custom_attrs_blob (MonoObject *ctor, MonoArray *ctorArgs, MonoArray *properties, MonoArray *porpValues, MonoArray *fields, MonoArray* fieldValues); @@ -515,12 +506,8 @@ void mono_reflection_setup_internal_class (MonoReflectionTypeBuilder *tb void mono_reflection_create_internal_class (MonoReflectionTypeBuilder *tb); -void mono_reflection_setup_generic_class (MonoReflectionTypeBuilder *tb); - MonoReflectionType* mono_reflection_create_runtime_class (MonoReflectionTypeBuilder *tb); -MonoReflectionType* mono_reflection_define_generic_parameter (MonoReflectionTypeBuilder *tb, MonoReflectionGenericParam *gparam); - MonoArray *mono_reflection_sighelper_get_signature_local (MonoReflectionSigHelper *sig); MonoArray *mono_reflection_sighelper_get_signature_field (MonoReflectionSigHelper *sig); diff --git a/mono/metadata/socket-io.c b/mono/metadata/socket-io.c index aa6da979b10..fee8059af88 100644 --- a/mono/metadata/socket-io.c +++ b/mono/metadata/socket-io.c @@ -893,7 +893,7 @@ static struct sockaddr *create_sockaddr_from_object(MonoObject *saddr_obj, mono_raise_exception (mono_exception_from_name(mono_defaults.corlib, "System", "SystemException")); } - family = convert_family (mono_array_get (data, guint8, 0) + (mono_array_get (data, guint8, 1) << 8)); + family = convert_family (mono_array_get (data, guint16, 0)); if(family==AF_INET) { struct sockaddr_in *sa=g_new0(struct sockaddr_in, 1); guint16 port=(mono_array_get(data, guint8, 2) << 8) + @@ -1465,30 +1465,6 @@ void ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal(SOCKET sock, g int system_level; int system_name; int ret; -#ifdef AF_INET6 - int sol_ip; - int sol_ipv6; - -#ifdef HAVE_SOL_IPV6 - sol_ipv6 = SOL_IPV6; -#else - { - struct protoent *pent; - pent = getprotobyname ("ipv6"); - sol_ipv6 = (pent != NULL) ? pent->p_proto : 41; - } -#endif - -#ifdef HAVE_SOL_IP - sol_ip = SOL_IP; -#else - { - struct protoent *pent; - pent = getprotobyname ("ip"); - sol_ip = (pent != NULL) ? pent->p_proto : 0; - } -#endif -#endif /* AF_INET6 */ MONO_ARCH_SAVE_REGS; @@ -1534,7 +1510,7 @@ void ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal(SOCKET sock, g MonoObject *address = NULL; #ifdef AF_INET6 - if(system_level == sol_ipv6) { + if(system_level == SOL_IPV6) { struct ipv6_mreq mreq6; /* @@ -1553,7 +1529,7 @@ void ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal(SOCKET sock, g ret = setsockopt (sock, system_level, system_name, &mreq6, sizeof (mreq6)); - } else if(system_level == sol_ip) + } else if(system_level == SOL_IP) #endif /* AF_INET6 */ { #ifdef HAVE_STRUCT_IP_MREQN diff --git a/mono/metadata/string-icalls.c b/mono/metadata/string-icalls.c index e55d25a2a2e..44010157395 100644 --- a/mono/metadata/string-icalls.c +++ b/mono/metadata/string-icalls.c @@ -343,36 +343,28 @@ ves_icall_System_String_InternalReplace_Str (MonoString *me, MonoString *oldValu for (i = 0; i <= srclen - oldstrlen; i++) if (0 == memcmp(src + i, oldstr, oldstrlen * sizeof(gunichar2))) occurr++; - if (occurr == 0) - return me; + newsize = srclen + ((newstrlen - oldstrlen) * occurr); } else newsize = srclen; - ret = NULL; + ret = mono_string_new_size( mono_domain_get (), newsize); + dest = mono_string_chars(ret); + i = 0; while (i < srclen) { if (0 == memcmp(src + i, oldstr, oldstrlen * sizeof(gunichar2))) { - if (ret == NULL) { - ret = mono_string_new_size( mono_domain_get (), newsize); - dest = mono_string_chars(ret); - memcpy (dest, src, i * sizeof(gunichar2)); - } if (newstrlen > 0) { memcpy(dest + destpos, newstr, newstrlen * sizeof(gunichar2)); destpos += newstrlen; } i += oldstrlen; - continue; - } else if (ret != NULL) { + } else { dest[destpos] = src[i]; - } destpos++; i++; } - - if (ret == NULL) - return me; + } return ret; } diff --git a/mono/metadata/threads.c b/mono/metadata/threads.c index 5ea1406a8f1..9006f6b53ab 100644 --- a/mono/metadata/threads.c +++ b/mono/metadata/threads.c @@ -56,7 +56,7 @@ static CRITICAL_SECTION threads_mutex; static MonoGHashTable *threads=NULL; /* The TLS key that holds the MonoObject assigned to each thread */ -static guint32 current_object_key = -1; +static guint32 current_object_key; /* function called at thread start */ static MonoThreadStartCB mono_thread_start_cb = NULL; @@ -64,14 +64,11 @@ static MonoThreadStartCB mono_thread_start_cb = NULL; /* function called at thread attach */ static MonoThreadAttachCB mono_thread_attach_cb = NULL; -/* function called at thread cleanup */ -static MonoThreadCleanupFunc mono_thread_cleanup = NULL; - /* function called when a new thread has been created */ static MonoThreadCallbacks *mono_thread_callbacks = NULL; /* The TLS key that holds the LocalDataStoreSlot hash in each thread */ -static guint32 slothash_key = -1; +static guint32 slothash_key; static void thread_adjust_static_data (MonoThread *thread); @@ -91,7 +88,7 @@ static void handle_store(MonoThread *thread) #endif if(threads==NULL) { - threads=mono_g_hash_table_new(NULL, NULL); + threads=mono_g_hash_table_new(g_direct_hash, g_direct_equal); } /* We don't need to duplicate thread->handle, because it is @@ -136,8 +133,6 @@ static void thread_cleanup (MonoThread *thread) mono_profiler_thread_end (thread->tid); handle_remove (thread->tid); - if (mono_thread_cleanup) - mono_thread_cleanup (thread); } static guint32 start_wrapper(void *data) @@ -160,8 +155,6 @@ static guint32 start_wrapper(void *data) */ tid=thread->tid; - - TlsSetValue (current_object_key, thread); mono_domain_set (start_info->domain); @@ -187,6 +180,8 @@ static guint32 start_wrapper(void *data) GetCurrentThreadId (), thread); #endif + TlsSetValue (current_object_key, thread); + mono_profiler_thread_start (tid); if(thread->start_notify!=NULL) { @@ -930,12 +925,6 @@ void mono_thread_init (MonoThreadStartCB start_cb, GetCurrentProcess (); } -void -mono_threads_install_cleanup (MonoThreadCleanupFunc func) -{ - mono_thread_cleanup = func; -} - void mono_install_thread_callbacks (MonoThreadCallbacks *callbacks) { mono_thread_callbacks = callbacks; diff --git a/mono/metadata/threads.h b/mono/metadata/threads.h index 5a823554431..dfa962d6448 100644 --- a/mono/metadata/threads.h +++ b/mono/metadata/threads.h @@ -28,7 +28,6 @@ typedef enum { ThreadState_Aborted = 0x00000100, } MonoThreadState; -typedef void (*MonoThreadCleanupFunc) (MonoThread* thread); extern int mono_thread_get_abort_signal (void); @@ -54,8 +53,6 @@ extern void mono_thread_create (MonoDomain *domain, gpointer func, gpointer arg); extern MonoThread *mono_thread_attach (MonoDomain *domain); -void mono_threads_install_cleanup (MonoThreadCleanupFunc func); - guint32 mono_threads_alloc_static_data (guint32 size, guint32 align); gpointer mono_threads_get_static_data (guint32 offset); diff --git a/mono/metadata/verify.c b/mono/metadata/verify.c index 93394bca4de..c4dc51a1590 100644 --- a/mono/metadata/verify.c +++ b/mono/metadata/verify.c @@ -318,7 +318,7 @@ verify_constant_table (MonoImage *image, GSList *list, int level) MonoTableInfo *t = &image->tables [MONO_TABLE_CONSTANT]; guint32 cols [MONO_CONSTANT_SIZE]; guint32 value, i; - GHashTable *dups = g_hash_table_new (NULL, NULL); + GHashTable *dups = g_hash_table_new (g_direct_hash, g_direct_equal); for (i = 0; i < t->rows; ++i) { mono_metadata_decode_row (t, i, cols, MONO_CONSTANT_SIZE); @@ -388,7 +388,7 @@ verify_event_map_table (MonoImage *image, GSList *list, int level) MonoTableInfo *t = &image->tables [MONO_TABLE_EVENTMAP]; guint32 cols [MONO_EVENT_MAP_SIZE]; guint32 i, last_event; - GHashTable *dups = g_hash_table_new (NULL, NULL); + GHashTable *dups = g_hash_table_new (g_direct_hash, g_direct_equal); last_event = 0; diff --git a/mono/mini/.cvsignore b/mono/mini/.cvsignore index 3f07995d9d8..a0e16ba5bff 100644 --- a/mono/mini/.cvsignore +++ b/mono/mini/.cvsignore @@ -2,7 +2,6 @@ Makefile Makefile.in *.o *.exe -*.dll *.lo *.la .libs @@ -12,6 +11,3 @@ genmdesc inssel.c inssel.h mini.pc cpu-pentium.h -cpu-g4.h -mono -cpu-sparc.h diff --git a/mono/mini/ChangeLog b/mono/mini/ChangeLog index 0991ff5e6b1..bde5939cabf 100644 --- a/mono/mini/ChangeLog +++ b/mono/mini/ChangeLog @@ -1,177 +1,3 @@ -2003-09-08 Zoltan Varga <vargaz@freemail.hu> - - * aot.c (mono_aot_get_method_inner): Fix MONO_PATCH_INFO_IMAGE. - - * .cvsignore: Added *.dll. - - * mini.c (mono_print_tree_nl): New function callable while debugging. - - * mini.c (mono_print_code): Export this. - - * tramp-x86.c (x86_magic_trampoline): Tell valgrind to recompile the - patched code. - -2003-09-05 Zoltan Varga <vargaz@freemail.hu> - - * mini.h (MonoCompile): Added 'jit_info' field. - - * mini.c (mini_method_compile): Save the generated MonoJitInfo into - the cfg structure, since it is needed by the AOT compiler. - - * mini.h (MONO_AOT_FILE_VERSION): Bump version number. - - * aot.c: A major rewrite. Changes include: - - save exception tables for methods which have them. - - cache failed lookups in aot_get_method () to avoid the (slow) calls - to g_module_symbol. - - reworked the file format so it is now much smaller and needs - fewer relocation entries. - -2003-09-04 Zoltan Varga <vargaz@freemail.hu> - - * aot.c (load_aot_module): Fix build bustage on platforms without - Boehm GC. - -2003-09-04 Martin Baulig <martin@ximian.com> - - * Makefile.am (INCLUDES): Added $(LIBGC_CFLAGS). - -2003-09-04 Zoltan Varga <vargaz@freemail.hu> - - * TODO: Some new optimization ideas. - - * aot.c: Move AOT module loading logic here from mono_assembly_open. - - * aot.c: Save the optimization flags used to compile the code into - the AOT module. - - * mini.h mini-x86.c mini.c aot.c: Added new types of relocations to - support emitting domain specific code. - - * mini.h mini.c aot.c: Modified the JIT so the generated AOT code is - no longer domain neutral. It can be made domain neutral by compiling - with --optimize=shared. - - * aot.c (mono_aot_get_method_inner): Allow sharing of AOT methods - between appdomains. - - * driver.c mini.h mini.c: New --no-aot debugging option which disables - loading of AOT code. - - * inssel-x86.brg: Added missing AOTCONST -> OUTARG_VT rule. - - * tramp-x86.c (x86_magic_trampoline): Avoid patching the calling method - if there is no domain neutrality information. - -2003-09-01 Zoltan Varga <vargaz@freemail.hu> - - * aot.c (mono_compile_assembly): Emit a symbol containing the file - format version into the generated library. - - * mini-x86.c (mono_arch_patch_code): Do not emit the address of the - callee method into the caller since one of them could be shared. - - * mini.h mini-x86.c aot.c: Added two new relocations so throwing - system exceptions from AOT code now works. - - * tramp-x86.c (x86_magic_trampoline): Avoid patching the calling - method if it is domain neutral and the callee is not. - - * graph.c (cfg_emit_one_loop_level): Fix warning. - -2003-08-30 Zoltan Varga <vargaz@freemail.hu> - - * aot.c (mono_compile_assembly): Oops. Remove debugging cruft from - last checkin. - -2003-08-29 Zoltan Varga <vargaz@freemail.hu> - - * mini.c (mini_init): Call mono_marshal_init () explicitly since it - is needed by code which is executed before mono_runtime_init (). - Thanks to Bernie Solomon (bernard@ugsolutions.com) for noticing this. - - * mini.c (mono_thread_abort): Fix warning. - (mono_jit_compile_method): Call static constructor in the AOT case too. - - * aot.c (mono_compile_assembly): Fix warning. - -2003-08-28 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * mini.c: register a SIGINT handler if MONO_DEBUG is defined. - -2003-08-28 Zoltan Varga <vargaz@freemail.hu> - - * inssel.brg (OP_UNBOXCAST): Add support for the AOT case. - - * cpu-pentium.md: Fix the length of call opcodes so they include the - ESP restoring instruction. Fixes #47968. - -2003-08-28 Martin Baulig <martin@ximian.com> - - * mini-x86.c (mono_arch_call_opcode): Added support for - MONO_TYPE_GENERICINST. - - * mini.c (check_call_signature): Added support for MONO_TYPE_GENERICINST. - -2003-08-27 Zoltan Varga <vargaz@freemail.hu> - - * Makefile.am (BUILT_SOURCES): Fix compilation on platforms without - a JIT. Patch by Bernie Solomon (bernard@ugsolutions.com). - - * mini.c jit-icalls.c tramp-x86.c tramp-ppc.c tramp-sparc.c: Get rid of - metadata_section. - -2003-08-26 Martin Baulig <martin@ximian.com> - - * mini.c (get_basic_blocks): Added `unsigned char **pos' argument; - when reporting an error, set this to the actual error location. - (mono_method_to_ir): Report the correct error location if - get_basic_blocks() returned an error. - -2003-08-25 Zoltan Varga <vargaz@freemail.hu> - - * mini.c (mono_type_blittable): OBJECT is not blittable. - (mono_method_blittable): Methods which have marshalling descriptors - are not blittable either. Fixes #47842. - -2003-08-22 Zoltan Varga <vargaz@freemail.hu> - - * driver.c mini.c: Use an environment variable instead of a global - variable. Also fix the build. - - * mini.c (mini_init): Call g_thread_init () to make glib thread-safe. - Fixes #47682. Thanks to Laurent Morichetti (l_m@pacbell.net) for - reporting this. - - * driver.c mini.c: Added --with-valgrind option to turn off some - code which prevents mono from running under valgrind. - - * mini.c (mono_emit_call_args): Fixed warning. - - * mini.c (mono_emulate_opcode): Fixed warning. - -Thu Aug 21 19:10:08 CEST 2003 Paolo Molaro <lupus@ximian.com> - - * inssel.brg: 64bit fixes from Laurent Morichetti <l_m@pacbell.net>. - * linear-scan.c, mini-ppc.h, mini-sparc.h, mini-x86.h, mini.h, - regalloc.c, regalloc.h: specify available registers in arch-specific - code and support floats in the regallocator (patch by Laurent Morichetti - <l_m@pacbell.net>) - -Wed Aug 20 19:02:22 CEST 2003 Paolo Molaro <lupus@ximian.com> - - * mini.c: mono_thread_current() can be called only after - mono_runtime_init(): rearrange code to not call it early on. - -Wed Aug 20 13:14:31 CEST 2003 Paolo Molaro <lupus@ximian.com> - - * mini.c: allocate jump tables in the code mempools. - -Wed Aug 20 13:04:53 CEST 2003 Paolo Molaro <lupus@ximian.com> - - * mini.c, mini.h: make sure per-thread data allocated by the jit is - freed. - 2003-08-10 Miguel de Icaza <miguel@ximian.com> * cpu-pentium.md (ldtoken): Change the length for mul.ovf.un from diff --git a/mono/mini/Makefile.am b/mono/mini/Makefile.am index 0c3b38d0ab5..34f3e7e5614 100644 --- a/mono/mini/Makefile.am +++ b/mono/mini/Makefile.am @@ -13,7 +13,6 @@ RUNTIME=mono INCLUDES = \ -I$(top_srcdir) \ - $(LIBGC_CFLAGS) \ $(GMODULE_CFLAGS) \ $(GLIB_CFLAGS) @@ -193,13 +192,9 @@ pkgconfigdir = $(libdir)/pkgconfig documents=mini-doc.txt mini-porting.txt -if JIT_SUPPORTED BUILT_SOURCES= inssel.c inssel.h cpu-pentium.h cpu-g4.h cpu-sparc.h -endif - CLEANFILES= $(BUILT_SOURCES) EXTRA_DIST = $(common_BURGSRC) $(documents) inssel-x86.brg inssel-ppc.brg \ - $(x86_sources) $(ppc_sources) $(sparc_sources) \ jit-icalls.c cprop.c inssel-sparc.brg \ cpu-pentium.md cpu-g4.md ldscript cpu-sparc.md diff --git a/mono/mini/TODO b/mono/mini/TODO index b339c2a96e7..a04a7ca85a6 100644 --- a/mono/mini/TODO +++ b/mono/mini/TODO @@ -10,31 +10,4 @@ Other Ideas: * the ORP people avoids optimizations inside catch handlers - just to save memory (for example allocation of strings - instead they allocate strings when the code is executed (like the --shared option)). But there are only a few - functions using catch handlers, so I consider this a minor issue. - -* some performance critical functions should be inlined. These include: - - mono_mempool_alloc and mono_mempool_alloc0 - - EnterCriticalSection and LeaveCriticalSection - - TlsSetValue - - mono_metadata_row_col - - mono_g_hash_table_lookup - - mono_domain_get -* load_class_names can be speeded up by caching the per-namespace hash tables - in a new hash table indexed by the index of the namespace in the blob heap. -* the managed/unmanaged boundary is quite slow: - - it calls mono_get_lmf_addr, which calls TlsGetValue, which calls - pthread_getspecific (). This means that 3 function calls are needed for - each native function call. -* currently mono assumes that the CustomAttribute table is not sorted. So - lookup in this table is slow. Furthermore, this is used by - field_is_thread_static, which is called a lot of times. -* mono_find_jit_opcode_emulation is called a lot of times during compilation, - and it involves a hash table lookup. -* mcs should create AssemblyBuilders with the Run flag instead of RunAndSave, - so the runtime could avoid fully constructing the types in the dynamic - assembly. -* if a function which involves locking is called from another function which - acquires the same lock, it might be useful to create a separate _inner - version of the function which does not re-acquire the lock. This is a perf - win only if the function is called a lot of times, like mono_get_method. - + functions using catch handlers, so I consider this a minor issue.
\ No newline at end of file diff --git a/mono/mini/aot.c b/mono/mini/aot.c index a9141349f81..8316f9c1ebe 100644 --- a/mono/mini/aot.c +++ b/mono/mini/aot.c @@ -11,7 +11,6 @@ #include <sys/types.h> #include <unistd.h> #include <fcntl.h> -#include <string.h> #ifndef PLATFORM_WIN32 #include <sys/mman.h> #else @@ -29,184 +28,40 @@ #include <mono/metadata/tokentype.h> #include <mono/metadata/appdomain.h> #include <mono/metadata/debug-helpers.h> -#include <mono/metadata/assembly.h> -#include <mono/os/gc_wrapper.h> #include "mini.h" +#define ENCODE_TYPE_POS(t,l) (((t) << 24) | (l)) +#define DECODE_TYPE(v) ((v) >> 24) +#define DECODE_POS(v) ((v) & 0xffffff) + #ifdef PLATFORM_WIN32 #define SHARED_EXT ".dll" #else #define SHARED_EXT ".so" #endif -typedef struct MonoAotMethod { - MonoJitInfo *info; - MonoJumpInfo *patch_info; -} MonoAotMethod; - -typedef struct MonoAotModule { - /* Optimization flags used to compile the module */ - guint32 opts; - /* Maps MonoMethods to MonoAotMethodInfos */ - MonoGHashTable *methods; - char **icall_table; - MonoImage **image_table; - guint32* methods_present_table; -} MonoAotModule; - -typedef struct MonoAotCompile { - FILE *fp; - GHashTable *ref_hash; - GHashTable *icall_hash; - GPtrArray *icall_table; - GHashTable *image_hash; - GPtrArray *image_table; -} MonoAotCompile; - -static MonoGHashTable *aot_modules; - -static CRITICAL_SECTION aot_mutex; - static MonoClass * -decode_class_info (MonoAotModule *module, gpointer *data) +decode_class_info (gpointer *data) { MonoImage *image; MonoClass *klass; - image = module->image_table [(guint32)data [1]]; + image = mono_image_loaded_by_guid ((char *)data [1]); g_assert (image); if (data [0]) { return mono_class_get (image, (guint32)data [0]); } else { - klass = decode_class_info (module, data [3]); + klass = decode_class_info (data [3]); return mono_array_class_get (klass, (guint32)data [2]); } return NULL; } - -static void -load_aot_module (MonoAssembly *assembly, gpointer user_data) -{ - char *aot_name; - MonoAotModule *info; - gboolean usable = TRUE; - char *saved_guid = NULL; - char *aot_version = NULL; - char *opt_flags = NULL; - - if (mono_no_aot) - return; - - aot_name = g_strdup_printf ("%s.so", assembly->image->name); - - assembly->aot_module = g_module_open (aot_name, G_MODULE_BIND_LAZY); - - if (!assembly->aot_module) - return; - - g_module_symbol (assembly->aot_module, "mono_assembly_guid", (gpointer *) &saved_guid); - g_module_symbol (assembly->aot_module, "mono_aot_version", (gpointer *) &aot_version); - g_module_symbol (assembly->aot_module, "mono_aot_opt_flags", (gpointer *)&opt_flags); - - if (!aot_version || strcmp (aot_version, MONO_AOT_FILE_VERSION)) { - printf ("AOT module %s has wrong file format version (expected %s got %s)\n", aot_name, MONO_AOT_FILE_VERSION, aot_version); - usable = FALSE; - } - else - if (!saved_guid || strcmp (assembly->image->guid, saved_guid)) { - printf ("AOT module %s is out of date.\n", aot_name); - usable = FALSE; - } - - if (!usable) { - g_free (aot_name); - g_module_close (assembly->aot_module); - assembly->aot_module = NULL; - return; - } - - /* - * It seems that MonoGHashTables are in the GC heap, so structures - * containing them must be in the GC heap as well :( - */ -#ifdef HAVE_BOEHM_GC - info = GC_MALLOC (sizeof (MonoAotModule)); -#else - info = g_new0 (MonoAotModule, 1); -#endif - info->methods = mono_g_hash_table_new (NULL, NULL); - sscanf (opt_flags, "%d", &info->opts); - - /* Read image table */ - { - guint32 table_len, i; - char *table = NULL; - - g_module_symbol (assembly->aot_module, "mono_image_table", (gpointer *)&table); - g_assert (table); - - table_len = *(guint32*)table; - table += sizeof (guint32); - info->image_table = g_new0 (MonoImage*, table_len); - for (i = 0; i < table_len; ++i) { - info->image_table [i] = mono_image_loaded_by_guid (table); - if (!info->image_table [i]) { - printf ("AOT module %s is out of date.\n", aot_name); - g_free (info->methods); - g_free (info->image_table); - g_free (info); - g_free (aot_name); - g_module_close (assembly->aot_module); - assembly->aot_module = NULL; - return; - } - table += strlen (table) + 1; - } - } - - /* Read icall table */ - { - guint32 table_len, i; - char *table = NULL; - - g_module_symbol (assembly->aot_module, "mono_icall_table", (gpointer *)&table); - g_assert (table); - - table_len = *(guint32*)table; - table += sizeof (guint32); - info->icall_table = g_new0 (char*, table_len); - for (i = 0; i < table_len; ++i) { - info->icall_table [i] = table; - table += strlen (table) + 1; - } - } - - /* Read methods present table */ - g_module_symbol (assembly->aot_module, "mono_methods_present_table", (gpointer *)&info->methods_present_table); - g_assert (info->methods_present_table); - - EnterCriticalSection (&aot_mutex); - mono_g_hash_table_insert (aot_modules, assembly, info); - LeaveCriticalSection (&aot_mutex); - - printf ("Loaded AOT Module for %s.\n", assembly->image->name); -} - -void -mono_aot_init (void) -{ - InitializeCriticalSection (&aot_mutex); - - aot_modules = mono_g_hash_table_new (NULL, NULL); - - mono_install_assembly_load_hook (load_aot_module, NULL); -} -static MonoJitInfo * -mono_aot_get_method_inner (MonoDomain *domain, MonoMethod *method) +gpointer +mono_aot_get_method (MonoMethod *method) { MonoClass *klass = method->klass; MonoAssembly *ass = klass->image->assembly; @@ -216,10 +71,6 @@ mono_aot_get_method_inner (MonoDomain *domain, MonoMethod *method) guint8 *code = NULL; gpointer *info; guint code_len, used_int_regs, used_strings; - MonoAotModule *aot_module; - MonoAotMethod *minfo; - MonoJitInfo *jinfo; - MonoMethodHeader *header = ((MonoMethodNormal*)method)->header; int i; if (!module) @@ -228,151 +79,30 @@ mono_aot_get_method_inner (MonoDomain *domain, MonoMethod *method) if (!method->token) return NULL; - aot_module = (MonoAotModule*)mono_g_hash_table_lookup (aot_modules, ass); - g_assert (klass->inited); - minfo = mono_g_hash_table_lookup (aot_module->methods, method); - if (minfo) { - /* Duplicate jinfo */ - jinfo = mono_mempool_alloc0 (domain->mp, sizeof (MonoJitInfo)); - memcpy (jinfo, minfo->info, sizeof (MonoJitInfo)); - if (jinfo->clauses) { - jinfo->clauses = - mono_mempool_alloc0 (domain->mp, sizeof (MonoJitExceptionInfo) * header->num_clauses); - memcpy (jinfo->clauses, minfo->info->clauses, sizeof (MonoJitExceptionInfo) * header->num_clauses); - } - - /* This method was already loaded in another appdomain */ - if (aot_module->opts & MONO_OPT_SHARED) - /* Use the same method in the new appdomain */ - ; - else if (!minfo->patch_info) - /* Use the same method in the new appdomain */ - ; - else { - /* Create a copy of the original method and apply relocations */ - - code = mono_mempool_alloc (domain->code_mp, minfo->info->code_size); - memcpy (code, minfo->info->code_start, minfo->info->code_size); - - //printf ("REUSE METHOD: %s %p - %p.\n", mono_method_full_name (method, TRUE), code, (char*)code + code_len); - - /* Do this outside the lock to avoid deadlocks */ - LeaveCriticalSection (&aot_mutex); - mono_arch_patch_code (method, domain, code, minfo->patch_info); - EnterCriticalSection (&aot_mutex); - - /* Relocate jinfo */ - jinfo->code_start = code; - if (jinfo->clauses) { - for (i = 0; i < header->num_clauses; ++i) { - MonoJitExceptionInfo *ei = &jinfo->clauses [i]; - gint32 offset = code - (guint8*)minfo->info->code_start; - - if (ei->flags == MONO_EXCEPTION_CLAUSE_FILTER) - ei->data.filter = (guint8*)ei->data.filter + offset; - ei->try_start = (guint8*)ei->try_start + offset; - ei->try_end = (guint8*)ei->try_end + offset; - ei->handler_start = (guint8*)ei->handler_start + offset; - } - } - } - - return jinfo; - } - - /* Do a fast check to see whenever the method exists */ - { - guint32 index = mono_metadata_token_index (method->token) - 1; - guint32 w; - w = aot_module->methods_present_table [index / 32]; - if (! (w & (1 << (index % 32)))) { - //printf ("NOT FOUND: %s.\n", mono_method_full_name (method, TRUE)); - return NULL; - } - } - - method_label = g_strdup_printf ("m_%x", mono_metadata_token_index (method->token)); + method_label = g_strdup_printf ("method_%08X", method->token); if (!g_module_symbol (module, method_label, (gpointer *)&code)) { g_free (method_label); - return NULL; } - info_label = g_strdup_printf ("%s_p", method_label); + info_label = g_strdup_printf ("%s_patch_info", method_label); if (!g_module_symbol (module, info_label, (gpointer *)&info)) { g_free (method_label); g_free (info_label); - return NULL; } - { - static int count = 0; - - count ++; - - if (getenv ("MONO_LASTAOT")) { - if (count > atoi(getenv ("MONO_LASTAOT"))) { - return NULL; - } - else - if (count == atoi(getenv ("MONO_LASTAOT"))) - printf ("LAST AOT METHOD: %s.%s.%s.\n", klass->name_space, klass->name, method->name); - } - } - -#ifdef HAVE_BOEHM_GC - minfo = GC_MALLOC (sizeof (MonoAotMethod)); -#else - minfo = g_new0 (MonoAotMethod, 1); -#endif - - jinfo = mono_mempool_alloc0 (domain->mp, sizeof (MonoJitInfo)); + //printf ("FOUND AOT compiled code for %s %p %p\n", mono_method_full_name (method, TRUE), code, info); code_len = GPOINTER_TO_UINT (*((gpointer **)info)); info++; used_int_regs = GPOINTER_TO_UINT (*((gpointer **)info)); info++; - - //printf ("FOUND AOT compiled code for %s %p - %p %p\n", mono_method_full_name (method, TRUE), code, code + code_len, info); - - /* Exception table */ - if (header->num_clauses) { - jinfo->clauses = - mono_mempool_alloc0 (domain->mp, sizeof (MonoJitExceptionInfo) * header->num_clauses); - jinfo->num_clauses = header->num_clauses; - - jinfo->exvar_offset = GPOINTER_TO_UINT (*((gpointer**)info)); - info ++; - - for (i = 0; i < header->num_clauses; ++i) { - MonoExceptionClause *ec = &header->clauses [i]; - MonoJitExceptionInfo *ei = &jinfo->clauses [i]; - - ei->flags = ec->flags; - if (ei->flags == MONO_EXCEPTION_CLAUSE_FILTER) - ei->data.filter = code + GPOINTER_TO_UINT (*((gpointer**)info)); - else - ei->data.token = GPOINTER_TO_UINT (*((gpointer**)info)); - info ++; - ei->try_start = code + GPOINTER_TO_UINT (*((gpointer**)info)); - info ++; - ei->try_end = code + GPOINTER_TO_UINT (*((gpointer**)info)); - info ++; - ei->handler_start = code + GPOINTER_TO_UINT (*((gpointer**)info)); - info ++; - } - } - - if (aot_module->opts & MONO_OPT_SHARED) { - used_strings = GPOINTER_TO_UINT (*((gpointer **)info)); - info++; - } - else - used_strings = 0; + used_strings = GPOINTER_TO_UINT (*((gpointer **)info)); + info++; for (i = 0; i < used_strings; i++) { guint token = GPOINTER_TO_UINT (*((gpointer **)info)); @@ -380,81 +110,50 @@ mono_aot_get_method_inner (MonoDomain *domain, MonoMethod *method) mono_ldstr (mono_root_domain, klass->image, mono_metadata_token_index (token)); } - if (*info) { + + if (info) { MonoMemPool *mp = mono_mempool_new (); MonoImage *image; guint8 *page_start; gpointer *table; int pages; int i, err; - guint32 last_offset; - last_offset = 0; while (*info) { MonoJumpInfo *ji = mono_mempool_alloc0 (mp, sizeof (MonoJumpInfo)); - guint8 b1, b2; - - b1 = *(guint8*)info; - b2 = *((guint8*)info + 1); - - info = (gpointer*)((guint8*)info + 2); - - ji->type = b1 >> 2; - - if (((b1 & (1 + 2)) == 3) && (b2 == 255)) { - ji->ip.i = GPOINTER_TO_UINT (*info); - info ++; - } - else - ji->ip.i = (((guint32)(b1 & (1 + 2))) << 8) + b2; - - ji->ip.i += last_offset; - last_offset = ji->ip.i; - //printf ("T: %d O: %d.\n", ji->type, ji->ip.i); - gpointer *data = *((gpointer **)info); + info++; + ji->type = DECODE_TYPE (GPOINTER_TO_UINT (*info)); + ji->ip.i = DECODE_POS (GPOINTER_TO_UINT (*info)); switch (ji->type) { case MONO_PATCH_INFO_CLASS: - ji->data.klass = decode_class_info (aot_module, data); - g_assert (ji->data.klass); - mono_class_init (ji->data.klass); - break; - case MONO_PATCH_INFO_VTABLE: - ji->data.klass = decode_class_info (aot_module, data); + ji->data.klass = decode_class_info (data); g_assert (ji->data.klass); mono_class_init (ji->data.klass); break; case MONO_PATCH_INFO_IMAGE: - ji->data.image = aot_module->image_table [(guint32)data]; + ji->data.image = mono_image_loaded_by_guid ((char *)data); g_assert (ji->data.image); break; case MONO_PATCH_INFO_METHOD: - case MONO_PATCH_INFO_METHODCONST: { - guint32 image_index, token; - - image_index = (guint32)data >> 24; - token = MONO_TOKEN_METHOD_DEF | ((guint32)data & 0xffffff); - - image = aot_module->image_table [image_index]; - ji->data.method = mono_get_method (image, token, NULL); + case MONO_PATCH_INFO_METHODCONST: + image = mono_image_loaded_by_guid ((char *)data [1]); + g_assert (image); + ji->data.method = mono_get_method (image, (guint32)data [0], NULL); g_assert (ji->data.method); mono_class_init (ji->data.method->klass); - break; - } case MONO_PATCH_INFO_FIELD: - case MONO_PATCH_INFO_SFLDA: - image = aot_module->image_table [(guint32)data [1]]; + image = mono_image_loaded_by_guid ((char *)data [1]); g_assert (image); ji->data.field = mono_field_from_token (image, (guint32)data [0], NULL); mono_class_init (ji->data.field->parent); g_assert (ji->data.field); break; case MONO_PATCH_INFO_INTERNAL_METHOD: - ji->data.name = aot_module->icall_table [(guint32)data]; + ji->data.name = (char *)data; g_assert (ji->data.name); - //printf ("A: %s.\n", ji->data.name); break; case MONO_PATCH_INFO_SWITCH: ji->table_size = (int)data [0]; @@ -468,20 +167,6 @@ mono_aot_get_method_inner (MonoDomain *domain, MonoMethod *method) case MONO_PATCH_INFO_R8: ji->data.target = data; break; - case MONO_PATCH_INFO_LDSTR: - case MONO_PATCH_INFO_LDTOKEN: - case MONO_PATCH_INFO_TYPE_FROM_HANDLE: - ji->data.target = *data; - break; - case MONO_PATCH_INFO_EXC_NAME: - ji->data.klass = decode_class_info (aot_module, data); - g_assert (ji->data.klass); - mono_class_init (ji->data.klass); - ji->data.name = ji->data.klass->name; - break; - case MONO_PATCH_INFO_METHOD_REL: - ji->data.offset = (int)data [0]; - break; default: g_warning ("unhandled type %d", ji->type); g_assert_not_reached (); @@ -505,53 +190,25 @@ mono_aot_get_method_inner (MonoDomain *domain, MonoMethod *method) } #endif - /* Do this outside the lock to avoid deadlocks */ - LeaveCriticalSection (&aot_mutex); - mono_arch_patch_code (method, domain, code, patch_info); - EnterCriticalSection (&aot_mutex); - - if (aot_module->opts & MONO_OPT_SHARED) - /* No need to cache this */ - mono_mempool_destroy (mp); - else - minfo->patch_info = patch_info; + mono_arch_patch_code (method, mono_root_domain, code, patch_info); + mono_mempool_destroy (mp); } g_free (info_label); g_free (method_label); - mono_jit_stats.methods_aot++; - { - jinfo->code_size = code_len; - jinfo->used_regs = used_int_regs; - jinfo->method = method; - jinfo->code_start = code; - jinfo->domain_neutral = (aot_module->opts & MONO_OPT_SHARED) != 0; - - minfo->info = jinfo; - mono_g_hash_table_insert (aot_module->methods, method, minfo); - - return jinfo; + MonoJitInfo *info; + info = mono_mempool_alloc0 (mono_root_domain->mp, sizeof (MonoJitInfo)); + info->code_size = code_len; + info->used_regs = used_int_regs; + info->method = method; + info->code_start = code; + mono_jit_info_table_add (mono_root_domain, info); } -} - -gpointer -mono_aot_get_method (MonoDomain *domain, MonoMethod *method) -{ - MonoJitInfo *info; - - EnterCriticalSection (&aot_mutex); - info = mono_aot_get_method_inner (domain, method); - LeaveCriticalSection (&aot_mutex); + mono_jit_stats.methods_aot++; - /* Do this outside the lock */ - if (info) { - mono_jit_info_table_add (domain, info); - return info->code_start; - } - else - return NULL; + return code; } #if 0 @@ -561,7 +218,7 @@ write_data_symbol (FILE *fp, const char *name, guint8 *buf, int size, int align) int i; fprintf (fp, ".globl %s\n", name); - fprintf (fp, ".text 1 \n\t.align %d\n", align); + fprintf (fp, ".data\n\t.align %d\n", align); fprintf (fp, "\t.type %s,@object\n", name); fprintf (fp, "\t.size %s,%d\n", name, size); fprintf (fp, "%s:\n", name); @@ -573,10 +230,10 @@ write_data_symbol (FILE *fp, const char *name, guint8 *buf, int size, int align) #endif static void -write_string_symbol (FILE *fp, const char *name, const char *value) +write_string_symbol (FILE *fp, const char *name, char *value) { fprintf (fp, ".globl %s\n", name); - fprintf (fp, ".text 1\n"); + fprintf (fp, ".data\n"); fprintf (fp, "%s:\n", name); fprintf (fp, "\t.string \"%s\"\n", value); } @@ -596,383 +253,130 @@ mono_get_field_token (MonoClassField *field) return 0; } -static guint32 -get_image_index (MonoAotCompile *cfg, MonoImage *image) +static char * +cond_emit_image_label (FILE *tmpfp, GHashTable *image_hash, MonoImage *image) { - guint32 index; - - index = GPOINTER_TO_UINT (g_hash_table_lookup (cfg->image_hash, image)); - if (index) - return index - 1; - else { - index = g_hash_table_size (cfg->image_hash); - g_hash_table_insert (cfg->image_hash, image, GUINT_TO_POINTER (index + 1)); - g_ptr_array_add (cfg->image_table, image); - return index; - } + char *label; + + if ((label = g_hash_table_lookup (image_hash, image))) + return label; + + label = g_strdup_printf ("image_patch_info_%p", image); + fprintf (tmpfp, "%s:\n", label); + fprintf (tmpfp, "\t.string \"%s\"\n", image->guid); + + g_hash_table_insert (image_hash, image, label); + + return label; } -static void -emit_image_index (MonoAotCompile *cfg, MonoImage *image) +static char * +cond_emit_icall_label (FILE *tmpfp, GHashTable *hash, const char *icall_name) { - guint32 image_index; + char *label; + + if ((label = g_hash_table_lookup (hash, icall_name))) + return label; + + label = g_strdup_printf ("icall_patch_info_%s", icall_name); + fprintf (tmpfp, "%s:\n", label); + fprintf (tmpfp, "\t.string \"%s\"\n", icall_name); - image_index = get_image_index (cfg, image); + g_hash_table_insert (hash, (gpointer)icall_name, label); - fprintf (cfg->fp, "\t.long %d\n", image_index); + return label; } static char * -cond_emit_klass_label (MonoAotCompile *cfg, MonoClass *klass) +cond_emit_method_label (FILE *tmpfp, GHashTable *hash, MonoJumpInfo *patch_info) { - char *l1, *el = NULL; + MonoMethod *method = patch_info->data.method; + char *l1, *l2; - if ((l1 = g_hash_table_lookup (cfg->ref_hash, klass))) + if ((l1 = g_hash_table_lookup (hash, method))) + return l1; + + l2 = cond_emit_image_label (tmpfp, hash, method->klass->image); + fprintf (tmpfp, "\t.align %d\n", sizeof (gpointer)); + l1 = g_strdup_printf ("method_patch_info_%08x_%p", method->token, method); + fprintf (tmpfp, "%s:\n", l1); + fprintf (tmpfp, "\t.long 0x%08x\n", method->token); + g_assert (method->token); + fprintf (tmpfp, "\t.long %s\n", l2); + + g_hash_table_insert (hash, method, l1); + + return l1; +} + +static char * +cond_emit_klass_label (FILE *tmpfp, GHashTable *hash, MonoClass *klass) +{ + char *l1, *l2, *el = NULL; + + if ((l1 = g_hash_table_lookup (hash, klass))) return l1; if (!klass->type_token) { g_assert (klass->rank > 0); - el = cond_emit_klass_label (cfg, klass->element_class); + el = cond_emit_klass_label (tmpfp, hash, klass->element_class); } - fprintf (cfg->fp, "\t.align %d\n", sizeof (gpointer)); - l1 = g_strdup_printf ("klass_p_%08x_%p", klass->type_token, klass); - fprintf (cfg->fp, "%s:\n", l1); - fprintf (cfg->fp, "\t.long 0x%08x\n", klass->type_token); - emit_image_index (cfg, klass->image); + l2 = cond_emit_image_label (tmpfp, hash, klass->image); + fprintf (tmpfp, "\t.align %d\n", sizeof (gpointer)); + l1 = g_strdup_printf ("klass_patch_info_%08x_%p", klass->type_token, klass); + fprintf (tmpfp, "%s:\n", l1); + fprintf (tmpfp, "\t.long 0x%08x\n", klass->type_token); + fprintf (tmpfp, "\t.long %s\n", l2); if (el) { - fprintf (cfg->fp, "\t.long %d\n", klass->rank); - fprintf (cfg->fp, "\t.long %s\n", el); + fprintf (tmpfp, "\t.long %d\n", klass->rank); + fprintf (tmpfp, "\t.long %s\n", el); } - g_hash_table_insert (cfg->ref_hash, klass, l1); + g_hash_table_insert (hash, klass, l1); return l1; } static char * -cond_emit_field_label (MonoAotCompile *cfg, MonoJumpInfo *patch_info) +cond_emit_field_label (FILE *tmpfp, GHashTable *hash, MonoJumpInfo *patch_info) { MonoClassField *field = patch_info->data.field; - char *l1; + char *l1, *l2; guint token; - if ((l1 = g_hash_table_lookup (cfg->ref_hash, field))) + if ((l1 = g_hash_table_lookup (hash, field))) return l1; - - fprintf (cfg->fp, "\t.align %d\n", sizeof (gpointer)); + + l2 = cond_emit_image_label (tmpfp, hash, field->parent->image); + fprintf (tmpfp, "\t.align %d\n", sizeof (gpointer)); token = mono_get_field_token (field); - l1 = g_strdup_printf ("klass_p_%08x_%p", token, field); - fprintf (cfg->fp, "%s:\n", l1); - fprintf (cfg->fp, "\t.long 0x%08x\n", token); + l1 = g_strdup_printf ("klass_patch_info_%08x_%p", token, field); + fprintf (tmpfp, "%s:\n", l1); + fprintf (tmpfp, "\t.long 0x%08x\n", token); g_assert (token); - emit_image_index (cfg, field->parent->image); + fprintf (tmpfp, "\t.long %s\n", l2); - g_hash_table_insert (cfg->ref_hash, field, l1); + g_hash_table_insert (hash, field, l1); return l1; } -static gint -compare_patches (gconstpointer a, gconstpointer b) -{ - int i, j; - - i = (*(MonoJumpInfo**)a)->ip.i; - j = (*(MonoJumpInfo**)b)->ip.i; - - if (i < j) - return -1; - else - if (i > j) - return 1; - else - return 0; -} - -static void -emit_method (MonoAotCompile *acfg, MonoCompile *cfg) -{ - MonoMethod *method; - GList *l; - FILE *tmpfp; - int i, j, k, pindex; - guint8 *code, *mname; - int func_alignment = 16; - GPtrArray *patches; - MonoJumpInfo *patch_info; - MonoMethodHeader *header; - - tmpfp = acfg->fp; - method = cfg->method; - code = cfg->native_code; - header = ((MonoMethodNormal*)method)->header; - - fprintf (tmpfp, ".text 0\n"); - mname = g_strdup_printf ("m_%x", mono_metadata_token_index (method->token)); - fprintf (tmpfp, "\t.align %d\n", func_alignment); - fprintf (tmpfp, ".globl %s\n", mname); - fprintf (tmpfp, "\t.type %s,@function\n", mname); - fprintf (tmpfp, "%s:\n", mname); - - for (i = 0; i < cfg->code_len; i++) - fprintf (tmpfp, ".byte %d\n", (unsigned int) code [i]); - - fprintf (tmpfp, ".text 1\n"); - - /* Sort relocations */ - patches = g_ptr_array_new (); - for (patch_info = cfg->patch_info; patch_info; patch_info = patch_info->next) - g_ptr_array_add (patches, patch_info); - g_ptr_array_sort (patches, compare_patches); - - j = 0; - for (pindex = 0; pindex < patches->len; ++pindex) { - patch_info = g_ptr_array_index (patches, pindex); - switch (patch_info->type) { - case MONO_PATCH_INFO_LABEL: - case MONO_PATCH_INFO_BB: - /* relative jumps are no problem, there is no need to handle then here */ - break; - case MONO_PATCH_INFO_SWITCH: { - gpointer *table = (gpointer *)patch_info->data.target; - int k; - - fprintf (tmpfp, "\t.align %d\n", sizeof (gpointer)); - fprintf (tmpfp, "%s_p_%d:\n", mname, j); - fprintf (tmpfp, "\t.long %d\n", patch_info->table_size); - - for (k = 0; k < patch_info->table_size; k++) { - fprintf (tmpfp, "\t.long %d\n", (int)table [k]); - } - j++; - break; - } - case MONO_PATCH_INFO_INTERNAL_METHOD: { - guint32 icall_index; - - icall_index = (guint32)g_hash_table_lookup (acfg->icall_hash, patch_info->data.name); - if (!icall_index) { - icall_index = g_hash_table_size (acfg->icall_hash) + 1; - g_hash_table_insert (acfg->icall_hash, (gpointer)patch_info->data.name, - GUINT_TO_POINTER (icall_index)); - g_ptr_array_add (acfg->icall_table, (gpointer)patch_info->data.name); - } - patch_info->data.name = g_strdup_printf ("%d", icall_index - 1); - j++; - break; - } - case MONO_PATCH_INFO_METHODCONST: - case MONO_PATCH_INFO_METHOD: { - /* - * The majority of patches are for methods, so we emit - * them inline instead of defining a label for them to - * decrease the number of relocations. - */ - guint32 image_index = get_image_index (acfg, patch_info->data.method->klass->image); - guint32 token = patch_info->data.method->token; - g_assert (image_index < 256); - g_assert (mono_metadata_token_table (token) == MONO_TABLE_METHOD); - - patch_info->data.name = - g_strdup_printf ("%d", (image_index << 24) + (mono_metadata_token_index (token))); - j++; - break; - } - case MONO_PATCH_INFO_FIELD: - patch_info->data.name = cond_emit_field_label (acfg, patch_info); - j++; - break; - case MONO_PATCH_INFO_CLASS: - patch_info->data.name = cond_emit_klass_label (acfg, patch_info->data.klass); - j++; - break; - case MONO_PATCH_INFO_IMAGE: - patch_info->data.name = g_strdup_printf ("%d", get_image_index (acfg, patch_info->data.image)); - j++; - break; - case MONO_PATCH_INFO_EXC_NAME: { - MonoClass *ex_class; - - ex_class = - mono_class_from_name (mono_defaults.exception_class->image, - "System", patch_info->data.target); - g_assert (ex_class); - patch_info->data.name = cond_emit_klass_label (acfg, ex_class); - j++; - break; - } - case MONO_PATCH_INFO_R4: - fprintf (tmpfp, "\t.align 8\n"); - fprintf (tmpfp, "%s_p_%d:\n", mname, j); - fprintf (tmpfp, "\t.long 0x%08x\n", *((guint32 *)patch_info->data.target)); - j++; - break; - case MONO_PATCH_INFO_R8: - fprintf (tmpfp, "\t.align 8\n"); - fprintf (tmpfp, "%s_p_%d:\n", mname, j); - fprintf (tmpfp, "\t.long 0x%08x\n", *((guint32 *)patch_info->data.target)); - fprintf (tmpfp, "\t.long 0x%08x\n", *((guint32 *)patch_info->data.target + 1)); - j++; - break; - case MONO_PATCH_INFO_METHOD_REL: - fprintf (tmpfp, "\t.align %d\n", sizeof (gpointer)); - fprintf (tmpfp, "%s_p_%d:\n", mname, j); - fprintf (tmpfp, "\t.long 0x%08x\n", patch_info->data.offset); - j++; - break; - case MONO_PATCH_INFO_VTABLE: - patch_info->data.name = cond_emit_klass_label (acfg, patch_info->data.klass); - j++; - break; - case MONO_PATCH_INFO_SFLDA: - patch_info->data.name = cond_emit_field_label (acfg, patch_info); - j++; - break; - case MONO_PATCH_INFO_LDSTR: - case MONO_PATCH_INFO_LDTOKEN: - case MONO_PATCH_INFO_TYPE_FROM_HANDLE: - fprintf (tmpfp, "\t.align 8\n"); - fprintf (tmpfp, "%s_p_%d:\n", mname, j); - fprintf (tmpfp, "\t.long 0x%08x\n", patch_info->data.token); - j++; - break; - default: - g_warning ("unable to handle jump info %d", patch_info->type); - g_assert_not_reached (); - } - } - - fprintf (tmpfp, ".globl %s_p\n", mname); - fprintf (tmpfp, "\t.align %d\n", sizeof (gpointer)); - fprintf (tmpfp, "%s_p:\n", mname); - - fprintf (tmpfp, "\t.long %d\n", cfg->code_len); - fprintf (tmpfp, "\t.long %d\n", cfg->used_int_regs); - - /* Exception table */ - if (header->num_clauses) { - MonoJitInfo *jinfo = cfg->jit_info; - - fprintf (tmpfp, "\t.long %d\n", jinfo->exvar_offset); - - for (k = 0; k < header->num_clauses; ++k) { - MonoJitExceptionInfo *ei = &jinfo->clauses [k]; - - if (ei->flags == MONO_EXCEPTION_CLAUSE_FILTER) - fprintf (tmpfp, "\t.long %d\n", (guint8*)ei->data.filter - code); - else - /* fixme: tokens are not global */ - fprintf (tmpfp, "\t.long %d\n", ei->data.token); - - fprintf (tmpfp, "\t.long %d\n", (guint8*)ei->try_start - code); - fprintf (tmpfp, "\t.long %d\n", (guint8*)ei->try_end - code); - fprintf (tmpfp, "\t.long %d\n", (guint8*)ei->handler_start - code); - } - } - - /* String table */ - if (cfg->opt & MONO_OPT_SHARED) { - fprintf (tmpfp, "\t.long %d\n", g_list_length (cfg->ldstr_list)); - for (l = cfg->ldstr_list; l; l = l->next) { - fprintf (tmpfp, "\t.long 0x%08lx\n", (long)l->data); - } - } - else - /* Used only in shared mode */ - g_assert (!cfg->ldstr_list); - - //printf ("M: %s (%s).\n", mono_method_full_name (method, TRUE), mname); - - if (j) { - guint32 last_offset; - last_offset = 0; - j = 0; - for (pindex = 0; pindex < patches->len; ++pindex) { - guint32 offset; - patch_info = g_ptr_array_index (patches, pindex); - - if ((patch_info->type == MONO_PATCH_INFO_LABEL) || - (patch_info->type == MONO_PATCH_INFO_BB)) - /* Nothing to do */ - continue; - - //printf ("T: %d O: %d.\n", patch_info->type, patch_info->ip.i); - offset = patch_info->ip.i - last_offset; - last_offset = patch_info->ip.i; - - /* Encode type+position compactly */ - g_assert (patch_info->type < 64); - if (offset < 1024 - 1) { - fprintf (tmpfp, "\t.byte %d\n", (patch_info->type << 2) + (offset >> 8)); - fprintf (tmpfp, "\t.byte %d\n", offset & ((1 << 8) - 1)); - } - else { - fprintf (tmpfp, "\t.byte %d\n", (patch_info->type << 2) + 3); - fprintf (tmpfp, "\t.byte %d\n", 255); - fprintf (tmpfp, "\t.long %d\n", offset); - } - - switch (patch_info->type) { - case MONO_PATCH_INFO_METHODCONST: - case MONO_PATCH_INFO_METHOD: - case MONO_PATCH_INFO_CLASS: - case MONO_PATCH_INFO_FIELD: - case MONO_PATCH_INFO_INTERNAL_METHOD: - case MONO_PATCH_INFO_IMAGE: - case MONO_PATCH_INFO_VTABLE: - case MONO_PATCH_INFO_SFLDA: - case MONO_PATCH_INFO_EXC_NAME: - fprintf (tmpfp, "\t.long %s\n", patch_info->data.name); - j++; - break; - case MONO_PATCH_INFO_SWITCH: - case MONO_PATCH_INFO_R4: - case MONO_PATCH_INFO_R8: - case MONO_PATCH_INFO_METHOD_REL: - case MONO_PATCH_INFO_LDSTR: - case MONO_PATCH_INFO_LDTOKEN: - case MONO_PATCH_INFO_TYPE_FROM_HANDLE: - fprintf (tmpfp, "\t.long %s_p_%d\n", mname, j); - j++; - break; - case MONO_PATCH_INFO_LABEL: - case MONO_PATCH_INFO_BB: - break; - default: - g_warning ("unable to handle jump info %d", patch_info->type); - g_assert_not_reached (); - } - - } - } - - /* - * 0 is PATCH_INFO_BB, which can't be in the file. - */ - /* NULL terminated array */ - fprintf (tmpfp, "\t.long 0\n"); - - /* fixme: save the rest of the required infos */ - - g_free (mname); -} - int mono_compile_assembly (MonoAssembly *ass, guint32 opts) { MonoCompile *cfg; MonoImage *image = ass->image; MonoMethod *method; - char *com, *tmpfname, *opts_str; + GList *l; + char *com, *tmpfname; FILE *tmpfp; - int i; - guint8 *mname, *symbol; - int ccount = 0, mcount = 0, lmfcount = 0, abscount = 0, wrappercount = 0, ocount = 0; + int i, j; + guint8 *code, *mname; + int ccount = 0, mcount = 0, lmfcount = 0, ecount = 0, abscount = 0, wrappercount = 0, ocount = 0; GHashTable *ref_hash; - MonoAotCompile *acfg; - gboolean *emitted; + int func_alignment = 16; printf ("Mono AOT compiler - compiling assembly %s\n", image->name); @@ -982,24 +386,8 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts) ref_hash = g_hash_table_new (NULL, NULL); - acfg = g_new0 (MonoAotCompile, 1); - acfg->fp = tmpfp; - acfg->ref_hash = ref_hash; - acfg->icall_hash = g_hash_table_new (NULL, NULL); - acfg->icall_table = g_ptr_array_new (); - acfg->image_hash = g_hash_table_new (NULL, NULL); - acfg->image_table = g_ptr_array_new (); - write_string_symbol (tmpfp, "mono_assembly_guid" , image->guid); - - write_string_symbol (tmpfp, "mono_aot_version", MONO_AOT_FILE_VERSION); - - opts_str = g_strdup_printf ("%d", opts); - write_string_symbol (tmpfp, "mono_aot_opt_flags", opts_str); - g_free (opts_str); - - emitted = g_new0 (gboolean, image->tables [MONO_TABLE_METHOD].rows); - + for (i = 0; i < image->tables [MONO_TABLE_METHOD].rows; ++i) { MonoJumpInfo *patch_info; gboolean skip; @@ -1024,6 +412,13 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts) continue; } + /* fixme: add methods with exception tables */ + if (((MonoMethodNormal *)method)->header->num_clauses) { + //printf ("Skip (exceptions): %s\n", mono_method_full_name (method, TRUE)); + ecount++; + continue; + } + //printf ("START: %s\n", mono_method_full_name (method, TRUE)); //mono_compile_method (method); @@ -1069,68 +464,135 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts) //printf ("Compile: %s\n", mono_method_full_name (method, TRUE)); - emitted [i] = TRUE; - emit_method (acfg, cfg); + code = cfg->native_code; - g_free (mname); - mono_destroy_compile (cfg); + fprintf (tmpfp, ".text\n"); + mname = g_strdup_printf ("method_%08X", token); + fprintf (tmpfp, "\t.align %d\n", func_alignment); + fprintf (tmpfp, ".globl %s\n", mname); + fprintf (tmpfp, "\t.type %s,@function\n", mname); + fprintf (tmpfp, "%s:\n", mname); - ccount++; - } + for (j = 0; j < cfg->code_len; j++) + fprintf (tmpfp, ".byte %d\n", (unsigned int) code [j]); - /* - * The icall and image tables are small but referenced in a lot of places. - * So we emit them at once, and reference their elements by an index - * instead of an assembly label to cut back on the number of relocations. - */ - - /* Emit icall table */ - - symbol = g_strdup_printf ("mono_icall_table"); - fprintf (tmpfp, ".globl %s\n", symbol); - fprintf (tmpfp, ".text 1 \n"); - fprintf (tmpfp, "\t.align 8\n"); - fprintf (tmpfp, "%s:\n", symbol); - fprintf (tmpfp, ".long %d\n", acfg->icall_table->len); - for (i = 0; i < acfg->icall_table->len; i++) - fprintf (tmpfp, ".string \"%s\"\n", (char*)g_ptr_array_index (acfg->icall_table, i)); - - /* Emit image table */ - - symbol = g_strdup_printf ("mono_image_table"); - fprintf (tmpfp, ".globl %s\n", symbol); - fprintf (tmpfp, ".text 1 \n"); - fprintf (tmpfp, "\t.align 8\n"); - fprintf (tmpfp, "%s:\n", symbol); - fprintf (tmpfp, ".long %d\n", acfg->image_table->len); - for (i = 0; i < acfg->image_table->len; i++) - fprintf (tmpfp, ".string \"%s\"\n", ((MonoImage*)g_ptr_array_index (acfg->image_table, i))->guid); - - /* - * g_module_symbol takes a lot of time for failed lookups, so we emit - * a table which contains one bit for each method. This bit specifies - * whenever the method is emitted or not. - */ - - symbol = g_strdup_printf ("mono_methods_present_table"); - fprintf (tmpfp, ".globl %s\n", symbol); - fprintf (tmpfp, ".text 1 \n"); - fprintf (tmpfp, "\t.align 8\n"); - fprintf (tmpfp, "%s:\n", symbol); - { - guint32 k, nrows; - guint32 w; - - nrows = image->tables [MONO_TABLE_METHOD].rows; - for (i = 0; i < nrows / 32 + 1; ++i) { - w = 0; - for (k = 0; k < 32; ++k) { - if (emitted [(i * 32) + k]) - w += (1 << k); + fprintf (tmpfp, ".data\n"); + + j = 0; + for (patch_info = cfg->patch_info; patch_info; patch_info = patch_info->next) { + switch (patch_info->type) { + case MONO_PATCH_INFO_LABEL: + case MONO_PATCH_INFO_BB: + /* relative jumps are no problem, there is no need to handle then here */ + break; + case MONO_PATCH_INFO_SWITCH: { + gpointer *table = (gpointer *)patch_info->data.target; + int k; + + fprintf (tmpfp, "\t.align %d\n", sizeof (gpointer)); + fprintf (tmpfp, "%s_patch_info_%d:\n", mname, j); + fprintf (tmpfp, "\t.long %d\n", patch_info->table_size); + + for (k = 0; k < patch_info->table_size; k++) { + fprintf (tmpfp, "\t.long %d\n", (guint8 *)table [k] - code); + } + j++; + break; + } + case MONO_PATCH_INFO_INTERNAL_METHOD: + patch_info->data.name = cond_emit_icall_label (tmpfp, ref_hash, patch_info->data.name); + j++; + break; + case MONO_PATCH_INFO_METHODCONST: + case MONO_PATCH_INFO_METHOD: + patch_info->data.name = cond_emit_method_label (tmpfp, ref_hash, patch_info); + j++; + break; + case MONO_PATCH_INFO_FIELD: + patch_info->data.name = cond_emit_field_label (tmpfp, ref_hash, patch_info); + j++; + break; + case MONO_PATCH_INFO_CLASS: + patch_info->data.name = cond_emit_klass_label (tmpfp, ref_hash, patch_info->data.klass); + j++; + break; + case MONO_PATCH_INFO_IMAGE: + patch_info->data.name = cond_emit_image_label (tmpfp, ref_hash, patch_info->data.image); + j++; + break; + case MONO_PATCH_INFO_R4: + fprintf (tmpfp, "\t.align 8\n"); + fprintf (tmpfp, "%s_patch_info_%d:\n", mname, j); + fprintf (tmpfp, "\t.long 0x%08x\n", *((guint32 *)patch_info->data.target)); + + j++; + break; + case MONO_PATCH_INFO_R8: + fprintf (tmpfp, "\t.align 8\n"); + fprintf (tmpfp, "%s_patch_info_%d:\n", mname, j); + fprintf (tmpfp, "\t.long 0x%08x\n", *((guint32 *)patch_info->data.target)); + fprintf (tmpfp, "\t.long 0x%08x\n", *((guint32 *)patch_info->data.target + 1)); + + j++; + break; + default: + g_warning ("unable to handle jump info %d", patch_info->type); + g_assert_not_reached (); } - //printf ("EMITTED [%d] = %d.\n", i, b); - fprintf (tmpfp, "\t.long %d\n", w); } + + fprintf (tmpfp, ".globl %s_patch_info\n", mname); + fprintf (tmpfp, "\t.align %d\n", sizeof (gpointer)); + fprintf (tmpfp, "%s_patch_info:\n", mname); + + fprintf (tmpfp, "\t.long %d\n", cfg->code_len); + fprintf (tmpfp, "\t.long %d\n", cfg->used_int_regs); + + fprintf (tmpfp, "\t.long %d\n", g_list_length (cfg->ldstr_list)); + for (l = cfg->ldstr_list; l; l = l->next) { + fprintf (tmpfp, "\t.long 0x%08x\n", l->data); + } + + if (j) { + j = 0; + for (patch_info = cfg->patch_info; patch_info; patch_info = patch_info->next) { + switch (patch_info->type) { + case MONO_PATCH_INFO_METHODCONST: + case MONO_PATCH_INFO_METHOD: + case MONO_PATCH_INFO_CLASS: + case MONO_PATCH_INFO_FIELD: + case MONO_PATCH_INFO_INTERNAL_METHOD: + case MONO_PATCH_INFO_IMAGE: + fprintf (tmpfp, "\t.long %s\n", patch_info->data.name); + fprintf (tmpfp, "\t.long 0x%08x\n", ENCODE_TYPE_POS (patch_info->type, patch_info->ip.i)); + j++; + break; + case MONO_PATCH_INFO_SWITCH: + case MONO_PATCH_INFO_R4: + case MONO_PATCH_INFO_R8: + fprintf (tmpfp, "\t.long %s_patch_info_%d\n", mname, j); + fprintf (tmpfp, "\t.long 0x%08x\n", ENCODE_TYPE_POS (patch_info->type, patch_info->ip.i)); + j++; + break; + case MONO_PATCH_INFO_LABEL: + case MONO_PATCH_INFO_BB: + break; + default: + g_warning ("unable to handle jump info %d", patch_info->type); + g_assert_not_reached (); + } + + } + } + /* NULL terminated array */ + fprintf (tmpfp, "\t.long 0\n"); + + /* fixme: save the rest of the required infos */ + + g_free (mname); + mono_destroy_compile (cfg); + + ccount++; } fclose (tmpfp); @@ -1152,6 +614,7 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts) g_free (com);*/ printf ("Compiled %d out of %d methods (%d%%)\n", ccount, mcount, (ccount*100)/mcount); + printf ("%d methods contain exception tables (%d%%)\n", ecount, (ecount*100)/mcount); printf ("%d methods contain absolute addresses (%d%%)\n", abscount, (abscount*100)/mcount); printf ("%d methods contain wrapper references (%d%%)\n", wrappercount, (wrappercount*100)/mcount); printf ("%d methods contain lmf pointers (%d%%)\n", lmfcount, (lmfcount*100)/mcount); @@ -1160,5 +623,3 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts) return 0; } - - diff --git a/mono/mini/cpu-pentium.md b/mono/mini/cpu-pentium.md index 1521c077a23..ab011adadeb 100644 --- a/mono/mini/cpu-pentium.md +++ b/mono/mini/cpu-pentium.md @@ -301,19 +301,19 @@ setret: dest:a src1:i len:2 setlret: dest:l src1:i src2:i len:4 checkthis: src1:b len:3 voidcall: len:11 clob:c -voidcall_reg: src1:i len:11 clob:c -voidcall_membase: src1:b len:16 clob:c -fcall: dest:f len:11 clob:c -fcall_reg: dest:f src1:i len:11 clob:c -fcall_membase: dest:f src1:b len:16 clob:c -lcall: dest:l len:11 clob:c -lcall_reg: dest:l src1:i len:11 clob:c -lcall_membase: dest:l src1:b len:16 clob:c -vcall: len:11 clob:c -vcall_reg: src1:i len:11 clob:c -vcall_membase: src1:b len:16 clob:c -call_reg: dest:a src1:i len:11 clob:c -call_membase: dest:a src1:b len:16 clob:c +voidcall_reg: src1:i len:5 clob:c +voidcall_membase: src1:b len:10 clob:c +fcall: dest:f len:8 clob:c +fcall_reg: dest:f src1:i len:5 clob:c +fcall_membase: dest:f src1:b len:10 clob:c +lcall: dest:l len:8 clob:c +lcall_reg: dest:l src1:i len:5 clob:c +lcall_membase: dest:l src1:b len:10 clob:c +vcall: len:8 clob:c +vcall_reg: src1:i len:5 clob:c +vcall_membase: src1:b len:10 clob:c +call_reg: dest:a src1:i len:5 clob:c +call_membase: dest:a src1:b len:10 clob:c trap: iconst: dest:i len:5 i8const: diff --git a/mono/mini/driver.c b/mono/mini/driver.c index 047af60aa51..acbe22da131 100644 --- a/mono/mini/driver.c +++ b/mono/mini/driver.c @@ -307,7 +307,7 @@ mini_regression (MonoImage *image, int verbose, int *total_run) { if (verbose >= 2) g_print ("Running '%s' ...\n", method->name); #ifdef MONO_USE_AOT_COMPILER - if (!(func = mono_aot_get_method (mono_root_domain, method))) + if (!(func = mono_aot_get_method (method))) #endif func = (TestMethod)cfg->native_code; result = func (); @@ -477,8 +477,6 @@ mini_usage (void) " --breakonex Inserts a breakpoint on exceptions\n" " --break METHOD Inserts a breakpoint at METHOD entry\n" " --debug Enable debugging support\n" - " --stats Print statistics about the JIT operations\n" - " --no-aot Disable loading of AOT code\n" "\n" "Development:\n" " --statfile FILE Sets the stat file to FILE\n" @@ -560,8 +558,6 @@ mono_main (int argc, char* argv[]) { mono_print_vtable = TRUE; } else if (strcmp (argv [i], "--stats") == 0) { mono_jit_stats.enabled = TRUE; - } else if (strcmp (argv [i], "--no-aot") == 0) { - mono_no_aot = TRUE; } else if (strcmp (argv [i], "--aot") == 0) { mono_compile_aot = TRUE; } else if (strcmp (argv [i], "--compile-all") == 0) { diff --git a/mono/mini/graph.c b/mono/mini/graph.c index 45168cf7a7f..771b398b5a9 100644 --- a/mono/mini/graph.c +++ b/mono/mini/graph.c @@ -73,7 +73,7 @@ static void cfg_emit_one_loop_level (MonoCompile *cfg, FILE *fp, MonoBasicBlock *h) { MonoBasicBlock *bb; - int j, level = 0; + int i, j, level = 0; if (h) { level = h->nesting; diff --git a/mono/mini/inssel-x86.brg b/mono/mini/inssel-x86.brg index 5a60c7792a2..87d5922057e 100644 --- a/mono/mini/inssel-x86.brg +++ b/mono/mini/inssel-x86.brg @@ -310,12 +310,6 @@ stmt: OP_OUTARG_VT (OP_ICONST) { mono_bblock_add_inst (s->cbb, tree); } -stmt: OP_OUTARG_VT (reg) { - tree->opcode = OP_X86_PUSH; - tree->sreg1 = state->left->tree->dreg; - mono_bblock_add_inst (s->cbb, tree); -} - reg: OP_LDADDR (OP_REGOFFSET) "1" { if (state->left->tree->inst_offset) { tree->opcode = OP_X86_LEA_MEMBASE; diff --git a/mono/mini/inssel.brg b/mono/mini/inssel.brg index 2560ce39bca..5869b621619 100644 --- a/mono/mini/inssel.brg +++ b/mono/mini/inssel.brg @@ -9,10 +9,10 @@ * */ -#include <config.h> #include <string.h> #include "mini.h" +#include "mini-arch.h" #include <mono/metadata/marshal.h> #define MBTREE_TYPE MonoInst @@ -185,24 +185,6 @@ mono_bblock_add_inst ((cfg)->cbb, inst); \ } while (0) -#define MONO_EMIT_NEW_I8CONST(cfg,dr,imm) do { \ - MonoInst *inst; \ - inst = mono_mempool_alloc0 ((cfg)->mempool, sizeof (MonoInst)); \ - inst->opcode = OP_I8CONST; \ - inst->dreg = dr; \ - inst->inst_l = imm; \ - mono_bblock_add_inst ((cfg)->cbb, inst); \ - } while (0) - -#define MONO_EMIT_NEW_PCONST(cfg,dr,imm) do { \ - MonoInst *inst; \ - inst = mono_mempool_alloc0 ((cfg)->mempool, sizeof (MonoInst)); \ - inst->opcode = OP_ICONST; \ - inst->dreg = dr; \ - inst->inst_p0 = (gpointer) imm; \ - mono_bblock_add_inst ((cfg)->cbb, inst); \ - } while (0) - #define MONO_EMIT_NEW_AOTCONST(cfg,dr,imm,type) do { \ MonoInst *inst; \ inst = mono_mempool_alloc0 ((cfg)->mempool, sizeof (MonoInst)); \ @@ -282,11 +264,6 @@ base: reg "0" { //tree->inst_basereg = state->reg1; } -base: CEE_LDIND_I (OP_REGVAR) "0" { - tree->inst_offset = 0; - tree->inst_basereg = state->left->tree->dreg; -} - base: OP_REGOFFSET "0" { /* nothing to do */ } @@ -1336,15 +1313,7 @@ reg: OP_UNBOXCAST (reg) { MONO_EMIT_NEW_LOAD_MEMBASE (s, vtable_reg, obj_reg, G_STRUCT_OFFSET (MonoObject, vtable)); MONO_EMIT_NEW_LOAD_MEMBASE (s, klass_reg, vtable_reg, G_STRUCT_OFFSET (MonoVTable, klass)); MONO_EMIT_NEW_LOAD_MEMBASE (s, eclass_reg, klass_reg, G_STRUCT_OFFSET (MonoClass, element_class)); - - if (mono_compile_aot) { - int const_reg = mono_regstate_next_int (s->rs); - MONO_EMIT_NEW_CLASSCONST (s, const_reg, klass->element_class); - MONO_EMIT_NEW_BIALU (s, OP_COMPARE, -1, eclass_reg, const_reg); - } - else { - MONO_EMIT_NEW_BIALU_IMM (s, OP_COMPARE_IMM, -1, eclass_reg, klass->element_class); - } + MONO_EMIT_NEW_BIALU_IMM (s, OP_COMPARE_IMM, -1, eclass_reg, klass->element_class); MONO_EMIT_NEW_COND_EXC (s, NE_UN, "InvalidCastException"); MONO_EMIT_UNALU (s, tree, OP_MOVE, state->reg1, obj_reg); @@ -1668,12 +1637,12 @@ mini_emit_virtual_call (MonoCompile *cfg, void *st, MonoInst *tree, int novirtop int ifoffset_reg = mono_regstate_next_int (cfg->rs); slot_reg = mono_regstate_next_int (cfg->rs); MONO_EMIT_NEW_LOAD_MEMBASE (cfg, ifoffset_reg, vtable_reg, G_STRUCT_OFFSET (MonoVTable, interface_offsets)); - MONO_EMIT_NEW_LOAD_MEMBASE (cfg, slot_reg, ifoffset_reg, method->klass->interface_id * SIZEOF_VOID_P); - tree->inst_offset = method->slot * SIZEOF_VOID_P; + MONO_EMIT_NEW_LOAD_MEMBASE (cfg, slot_reg, ifoffset_reg, method->klass->interface_id << 2); + tree->inst_offset = method->slot << 2; cfg->disable_aot = TRUE; } else { slot_reg = vtable_reg; - tree->inst_offset = G_STRUCT_OFFSET (MonoVTable, vtable) + (method->slot * SIZEOF_VOID_P); + tree->inst_offset = G_STRUCT_OFFSET (MonoVTable, vtable) + (method->slot << 2); } tree->dreg = state->reg1; @@ -1695,7 +1664,7 @@ mini_emit_isninst_cast (MonoCompile *s, int klass_reg, MonoClass *klass, MonoIns MONO_EMIT_NEW_BRANCH_LABEL (s, CEE_BLT_UN, false_target); } MONO_EMIT_NEW_LOAD_MEMBASE (s, stypes_reg, klass_reg, G_STRUCT_OFFSET (MonoClass, supertypes)); - MONO_EMIT_NEW_LOAD_MEMBASE (s, stype, stypes_reg, ((klass->idepth - 1) * SIZEOF_VOID_P)); + MONO_EMIT_NEW_LOAD_MEMBASE (s, stype, stypes_reg, ((klass->idepth - 1) << 2)); if (mono_compile_aot) { int const_reg = mono_regstate_next_int (s->rs); MONO_EMIT_NEW_CLASSCONST (s, const_reg, klass); @@ -1719,7 +1688,7 @@ mini_emit_isninst_iface_cast (MonoCompile *s, int vtable_reg, MonoClass *klass, MONO_EMIT_NEW_BIALU_IMM (s, OP_COMPARE_IMM, -1, max_iid_reg, klass->interface_id); MONO_EMIT_NEW_BRANCH_LABEL (s, CEE_BLT_UN, false_target); MONO_EMIT_NEW_LOAD_MEMBASE (s, ioffset_reg, vtable_reg, G_STRUCT_OFFSET (MonoVTable, interface_offsets)); - MONO_EMIT_NEW_LOAD_MEMBASE (s, intf_reg, ioffset_reg, klass->interface_id * SIZEOF_VOID_P); + MONO_EMIT_NEW_LOAD_MEMBASE (s, intf_reg, ioffset_reg, klass->interface_id << 2); MONO_EMIT_NEW_BIALU_IMM (s, OP_COMPARE_IMM, -1, intf_reg, 0); /* the object_is_null target simply copies the input register to the output */ MONO_EMIT_NEW_BRANCH_LABEL (s, CEE_BNE_UN, true_target); @@ -1742,7 +1711,7 @@ mini_emit_isninst_iface_class_cast (MonoCompile *s, int klass_reg, MonoClass *kl MONO_EMIT_NEW_BIALU_IMM (s, OP_COMPARE_IMM, -1, max_iid_reg, klass->interface_id); MONO_EMIT_NEW_BRANCH_LABEL (s, CEE_BLT_UN, false_target); MONO_EMIT_NEW_LOAD_MEMBASE (s, ioffset_reg, klass_reg, G_STRUCT_OFFSET (MonoClass, interface_offsets)); - MONO_EMIT_NEW_LOAD_MEMBASE (s, intf_reg, ioffset_reg, klass->interface_id * SIZEOF_VOID_P); + MONO_EMIT_NEW_LOAD_MEMBASE (s, intf_reg, ioffset_reg, klass->interface_id << 2); MONO_EMIT_NEW_BIALU_IMM (s, OP_COMPARE_IMM, -1, intf_reg, 0); /* the object_is_null target simply copies the input register to the output */ MONO_EMIT_NEW_BRANCH_LABEL (s, CEE_BGE, true_target); @@ -1761,7 +1730,7 @@ mini_emit_castclass (MonoCompile *s, int klass_reg, MonoClass *klass) MONO_EMIT_NEW_COND_EXC (s, LT_UN, "InvalidCastException"); } MONO_EMIT_NEW_LOAD_MEMBASE (s, stypes_reg, klass_reg, G_STRUCT_OFFSET (MonoClass, supertypes)); - MONO_EMIT_NEW_LOAD_MEMBASE (s, stype, stypes_reg, ((klass->idepth - 1) * SIZEOF_VOID_P)); + MONO_EMIT_NEW_LOAD_MEMBASE (s, stype, stypes_reg, ((klass->idepth - 1) << 2)); if (mono_compile_aot) { int const_reg = mono_regstate_next_int (s->rs); MONO_EMIT_NEW_CLASSCONST (s, const_reg, klass); @@ -1785,7 +1754,7 @@ mini_emit_castclass_iface (MonoCompile *s, int vtable_reg, MonoClass *klass) MONO_EMIT_NEW_BIALU_IMM (s, OP_COMPARE_IMM, -1, max_iid_reg, klass->interface_id); MONO_EMIT_NEW_COND_EXC (s, LT_UN, "InvalidCastException"); MONO_EMIT_NEW_LOAD_MEMBASE (s, ioffset_reg, vtable_reg, G_STRUCT_OFFSET (MonoVTable, interface_offsets)); - MONO_EMIT_NEW_LOAD_MEMBASE (s, intf_reg, ioffset_reg, klass->interface_id * SIZEOF_VOID_P); + MONO_EMIT_NEW_LOAD_MEMBASE (s, intf_reg, ioffset_reg, klass->interface_id << 2); MONO_EMIT_NEW_BIALU_IMM (s, OP_COMPARE_IMM, -1, intf_reg, 0); MONO_EMIT_NEW_COND_EXC (s, EQ, "InvalidCastException"); } @@ -1807,7 +1776,7 @@ mini_emit_castclass_iface_class (MonoCompile *s, int klass_reg, MonoClass *klass MONO_EMIT_NEW_BIALU_IMM (s, OP_COMPARE_IMM, -1, max_iid_reg, klass->interface_id); MONO_EMIT_NEW_COND_EXC (s, LT_UN, "InvalidCastException"); MONO_EMIT_NEW_LOAD_MEMBASE (s, ioffset_reg, klass_reg, G_STRUCT_OFFSET (MonoClass, interface_offsets)); - MONO_EMIT_NEW_LOAD_MEMBASE (s, intf_reg, ioffset_reg, klass->interface_id * SIZEOF_VOID_P); + MONO_EMIT_NEW_LOAD_MEMBASE (s, intf_reg, ioffset_reg, klass->interface_id << 2); MONO_EMIT_NEW_BIALU_IMM (s, OP_COMPARE_IMM, -1, intf_reg, 0); MONO_EMIT_NEW_COND_EXC (s, EQ, "InvalidCastException"); } diff --git a/mono/mini/jit-icalls.c b/mono/mini/jit-icalls.c index 02b3dd9b429..3e2f105929d 100644 --- a/mono/mini/jit-icalls.c +++ b/mono/mini/jit-icalls.c @@ -17,7 +17,9 @@ mono_ldftn (MonoMethod *method) MONO_ARCH_SAVE_REGS; + EnterCriticalSection (metadata_section); addr = mono_compile_method (method); + LeaveCriticalSection (metadata_section); return addr; } diff --git a/mono/mini/linear-scan.c b/mono/mini/linear-scan.c index 91ed1cf2a04..3cf0775d296 100644 --- a/mono/mini/linear-scan.c +++ b/mono/mini/linear-scan.c @@ -46,12 +46,12 @@ mono_varlist_insert_sorted (MonoCompile *cfg, GList *list, MonoMethodVar *mv, in //#define DEBUG_LSCAN void -mono_linear_scan (MonoCompile *cfg, GList *vars, GList *regs, regmask_t *used_mask) +mono_linear_scan (MonoCompile *cfg, GList *vars, GList *regs, guint32 *used_mask) { GList *l, *a, *active = NULL; MonoMethodVar *vmv, *amv; - int max_regs, gains [sizeof (regmask_t) * 8]; - regmask_t used_regs = 0; + int max_regs, gains [32]; + guint32 used_regs = 0; gboolean cost_driven; cost_driven = (cfg->comp_done & MONO_COMP_LOOPS); @@ -136,14 +136,14 @@ mono_linear_scan (MonoCompile *cfg, GList *vars, GList *regs, regmask_t *used_ma vmv->reg = (int)regs->data; - used_regs |= 1LL << vmv->reg; + used_regs |= 1 << vmv->reg; regs = g_list_remove_link (regs, regs); #ifdef DEBUG_LSCAN - printf ("ADD %2d %08x %08x C%d R%d\n", vmv->idx, + printf ("ADD %2d %08x %08x C%d\n", vnum, vmv->range.first_use.abs_pos, vmv->range.last_use.abs_pos, - vmv->spill_costs, vmv->reg); + vmv->spill_costs); #endif active = mono_varlist_insert_sorted (cfg, active, vmv, TRUE); } @@ -168,13 +168,14 @@ mono_linear_scan (MonoCompile *cfg, GList *vars, GList *regs, regmask_t *used_ma vmv = l->data; if (vmv->reg >= 0) { - if (gains [vmv->reg] > 3) { + if (gains [vmv->reg] > 5) { cfg->varinfo [vmv->idx]->opcode = OP_REGVAR; cfg->varinfo [vmv->idx]->dreg = vmv->reg; - if (cfg->verbose_level > 2) - printf ("REGVAR %d C%d R%d\n", vmv->idx, vmv->spill_costs, vmv->reg); +#ifdef DEBUG_LSCAN + printf ("REGVAR %d C%d R%d\n", vmv->idx, vmv->spill_costs, vmv->reg); +#endif } else { - used_regs &= ~(1LL << vmv->reg); + used_regs &= ~(1 << vmv->reg); vmv->reg = -1; } } @@ -186,4 +187,3 @@ mono_linear_scan (MonoCompile *cfg, GList *vars, GList *regs, regmask_t *used_ma g_list_free (active); g_list_free (vars); } - diff --git a/mono/mini/mini-ppc.h b/mono/mini/mini-ppc.h index c2a6d4677de..3ce44410764 100644 --- a/mono/mini/mini-ppc.h +++ b/mono/mini/mini-ppc.h @@ -4,9 +4,6 @@ #include <mono/arch/x86/x86-codegen.h> #include <mono/arch/ppc/ppc-codegen.h> -#define MONO_MAX_IREGS 32 -#define MONO_MAX_FREGS 32 - #define MONO_ARCH_FRAME_ALIGNMENT 4 /* fixme: align to 16byte instead of 32byte (we align to 32byte to get diff --git a/mono/mini/mini-sparc.c b/mono/mini/mini-sparc.c index 4943fff5ae8..570f84368d4 100644 --- a/mono/mini/mini-sparc.c +++ b/mono/mini/mini-sparc.c @@ -2379,30 +2379,30 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) break; } case OP_FADD: - sparc_fadds( code, ins->sreg1, ins->sreg2, ins->dreg); + //ppc_fadd (code, ins->dreg, ins->sreg1, ins->sreg2); break; case OP_FSUB: - sparc_fsubs( code, ins->sreg1, ins->sreg2, ins->dreg ); + //ppc_fsub (code, ins->dreg, ins->sreg1, ins->sreg2); break; case OP_FMUL: - sparc_fmuls( code, ins->sreg1, ins->sreg2, ins->dreg ); + //ppc_fmul (code, ins->dreg, ins->sreg1, ins->sreg2); break; case OP_FDIV: - sparc_fdivs( code, ins->sreg1, ins->sreg2, ins->dreg ); + //ppc_fdiv (code, ins->dreg, ins->sreg1, ins->sreg2); break; case OP_FNEG: - sparc_fnegs( code, ins->sreg1, ins->sreg2, ins->dreg ); + //ppc_fneg (code, ins->dreg, ins->sreg1); break; case OP_FREM: g_assert_not_reached (); break; case OP_FCOMPARE: - sparc_fcmps( code, ins->sreg1, ins->sreg2 ); + g_assert_not_reached (); /* this overwrites EAX */ //EMIT_FPCOMPARE(code); break; case OP_FCEQ: - g_assert_not_reached(); + g_assert_not_reached (); /*if (ins->dreg != X86_EAX) x86_push_reg (code, X86_EAX); diff --git a/mono/mini/mini-sparc.h b/mono/mini/mini-sparc.h index 1dd575ed6fe..40b31f24b50 100644 --- a/mono/mini/mini-sparc.h +++ b/mono/mini/mini-sparc.h @@ -3,9 +3,6 @@ #include <mono/arch/sparc/sparc-codegen.h> -#define MONO_MAX_IREGS 32 -#define MONO_MAX_FREGS 32 - /* Check this for Sparc. I think it is right. */ #define MONO_ARCH_FRAME_ALIGNMENT 4 diff --git a/mono/mini/mini-x86.c b/mono/mini/mini-x86.c index 0b1069f7005..6b65cb2a03c 100644 --- a/mono/mini/mini-x86.c +++ b/mono/mini/mini-x86.c @@ -751,10 +751,6 @@ handle_enum: arg->unused = sig->pinvoke; arg->inst_imm = sizeof (MonoTypedRef); break; - case MONO_TYPE_GENERICINST: - type = ptype->data.generic_inst->generic_type->type; - goto handle_enum; - default: g_error ("unknown type 0x%02x in mono_arch_call_opcode\n", type); } @@ -3001,9 +2997,6 @@ mono_arch_patch_code (MonoMethod *method, MonoDomain *domain, guint8 *code, Mono case MONO_PATCH_INFO_IP: *((gpointer *)(ip)) = ip; continue; - case MONO_PATCH_INFO_METHOD_REL: - *((gpointer *)(ip)) = code + patch_info->data.offset; - continue; case MONO_PATCH_INFO_INTERNAL_METHOD: { MonoJitICallInfo *mi = mono_find_jit_icall_by_name (patch_info->data.name); if (!mi) { @@ -3028,20 +3021,22 @@ mono_arch_patch_code (MonoMethod *method, MonoDomain *domain, guint8 *code, Mono case MONO_PATCH_INFO_METHOD: if (patch_info->data.method == method) { target = code; - } else + } else { /* get the trampoline to the method from the domain */ - target = mono_arch_create_jit_trampoline (patch_info->data.method); + if (!(target = g_hash_table_lookup (domain->jit_code_hash, patch_info->data.method))) + target = mono_arch_create_jit_trampoline (patch_info->data.method); + } break; case MONO_PATCH_INFO_SWITCH: { - gpointer *jump_table = mono_mempool_alloc (domain->code_mp, sizeof (gpointer) * patch_info->table_size); + gpointer *table = (gpointer *)patch_info->data.target; int i; - *((gconstpointer *)(ip + 2)) = jump_table; + *((gconstpointer *)(ip + 2)) = patch_info->data.target; for (i = 0; i < patch_info->table_size; i++) { - jump_table [i] = code + (int)patch_info->data.table [i]; + table [i] = (int)patch_info->data.table [i] + code; } - /* we put into the table the absolute address, no need for x86_patch in this case */ + /* we put into the table the absolute address, no need fo x86_patch in this case */ continue; } case MONO_PATCH_INFO_METHODCONST: @@ -3050,57 +3045,10 @@ mono_arch_patch_code (MonoMethod *method, MonoDomain *domain, guint8 *code, Mono case MONO_PATCH_INFO_FIELD: *((gconstpointer *)(ip + 1)) = patch_info->data.target; continue; - case MONO_PATCH_INFO_VTABLE: - *((gconstpointer *)(ip + 1)) = mono_class_vtable (domain, patch_info->data.klass); - continue; - case MONO_PATCH_INFO_SFLDA: { - MonoVTable *vtable = mono_class_vtable (domain, patch_info->data.field->parent); - if (!vtable->initialized && !(vtable->klass->flags & TYPE_ATTRIBUTE_BEFORE_FIELD_INIT) && mono_class_needs_cctor_run (vtable->klass, method)) - /* Done by the generated code */ - ; - else { - mono_runtime_class_init (vtable); - } - *((gconstpointer *)(ip + 1)) = - (char*)vtable->data + patch_info->data.field->offset; - continue; - } case MONO_PATCH_INFO_R4: case MONO_PATCH_INFO_R8: *((gconstpointer *)(ip + 2)) = patch_info->data.target; continue; - case MONO_PATCH_INFO_EXC_NAME: - *((gconstpointer *)(ip + 1)) = patch_info->data.name; - continue; - case MONO_PATCH_INFO_LDSTR: - *((gconstpointer *)(ip + 1)) = - mono_ldstr (domain, method->klass->image, - mono_metadata_token_index (patch_info->data.token)); - continue; - case MONO_PATCH_INFO_TYPE_FROM_HANDLE: { - gpointer handle; - MonoClass *handle_class; - - handle = mono_ldtoken (method->klass->image, - patch_info->data.token, &handle_class); - mono_class_init (handle_class); - mono_class_init (mono_class_from_mono_type (handle)); - - *((gconstpointer *)(ip + 1)) = - mono_type_get_object (domain, handle); - continue; - } - case MONO_PATCH_INFO_LDTOKEN: { - gpointer handle; - MonoClass *handle_class; - - handle = mono_ldtoken (method->klass->image, - patch_info->data.token, &handle_class); - mono_class_init (handle_class); - - *((gconstpointer *)(ip + 1)) = handle; - continue; - } default: g_assert_not_reached (); } @@ -3322,9 +3270,7 @@ mono_arch_emit_epilog (MonoCompile *cfg) switch (patch_info->type) { case MONO_PATCH_INFO_EXC: x86_patch (patch_info->ip.i + cfg->native_code, code); - mono_add_patch_info (cfg, code - cfg->native_code, MONO_PATCH_INFO_EXC_NAME, patch_info->data.target); x86_push_imm (code, patch_info->data.target); - mono_add_patch_info (cfg, code + 1 - cfg->native_code, MONO_PATCH_INFO_METHOD_REL, (gpointer)patch_info->ip.i); x86_push_imm (code, patch_info->ip.i + cfg->native_code); patch_info->type = MONO_PATCH_INFO_INTERNAL_METHOD; patch_info->data.name = "mono_arch_throw_exception_by_name"; diff --git a/mono/mini/mini-x86.h b/mono/mini/mini-x86.h index 1acb3bc49b3..85e292569e0 100644 --- a/mono/mini/mini-x86.h +++ b/mono/mini/mini-x86.h @@ -3,9 +3,6 @@ #include <mono/arch/x86/x86-codegen.h> -#define MONO_MAX_IREGS 8 -#define MONO_MAX_FREGS 7 - #define MONO_ARCH_FRAME_ALIGNMENT 4 /* fixme: align to 16byte instead of 32byte (we align to 32byte to get diff --git a/mono/mini/mini.c b/mono/mini/mini.c index 4ee69541e27..d0a18d86caf 100644 --- a/mono/mini/mini.c +++ b/mono/mini/mini.c @@ -89,11 +89,10 @@ static MonoMethodSignature *helper_sig_stelem_ref = NULL; static guint32 default_opt = MONO_OPT_PEEPHOLE; -guint32 mono_jit_tls_id = -1; +guint32 mono_jit_tls_id = 0; gboolean mono_jit_trace_calls = FALSE; gboolean mono_break_on_exc = FALSE; gboolean mono_compile_aot = FALSE; -gboolean mono_no_aot = FALSE; static int mini_verbose = 0; @@ -118,10 +117,10 @@ mono_type_blittable (MonoType *type) case MONO_TYPE_R8: case MONO_TYPE_I: case MONO_TYPE_U: + case MONO_TYPE_OBJECT: return TRUE; case MONO_TYPE_VALUETYPE: case MONO_TYPE_CLASS: - case MONO_TYPE_OBJECT: return type->data.klass->blittable; break; default: @@ -156,9 +155,6 @@ mono_method_blittable (MonoMethod *method) if (!mono_type_blittable (sig->params [i])) return FALSE; - if (mono_method_has_marshal_info (method)) - return FALSE; - return TRUE; } #endif @@ -273,48 +269,8 @@ print_method_from_ip (void *ip) (dest)->type = STACK_PTR; \ } while (0) -#define NEW_VTABLECONST(cfg,dest,vtable) do { \ - (dest) = mono_mempool_alloc0 ((cfg)->mempool, sizeof (MonoInst)); \ - (dest)->opcode = mono_compile_aot ? OP_AOTCONST : OP_ICONST; \ - (dest)->inst_p0 = mono_compile_aot ? (gpointer)((vtable)->klass) : (vtable); \ - (dest)->inst_i1 = (gpointer)MONO_PATCH_INFO_VTABLE; \ - (dest)->type = STACK_PTR; \ - } while (0) - -#define NEW_SFLDACONST(cfg,dest,field) do { \ - (dest) = mono_mempool_alloc0 ((cfg)->mempool, sizeof (MonoInst)); \ - (dest)->opcode = mono_compile_aot ? OP_AOTCONST : OP_ICONST; \ - (dest)->inst_p0 = (field); \ - (dest)->inst_i1 = (gpointer)MONO_PATCH_INFO_SFLDA; \ - (dest)->type = STACK_PTR; \ - } while (0) - -#define NEW_LDSTRCONST(cfg,dest,token) do { \ - (dest) = mono_mempool_alloc0 ((cfg)->mempool, sizeof (MonoInst)); \ - (dest)->opcode = OP_AOTCONST; \ - (dest)->inst_p0 = (gpointer)(token); \ - (dest)->inst_i1 = (gpointer)MONO_PATCH_INFO_LDSTR; \ - (dest)->type = STACK_OBJ; \ - } while (0) - -#define NEW_TYPE_FROM_HANDLE_CONST(cfg,dest,token) do { \ - (dest) = mono_mempool_alloc0 ((cfg)->mempool, sizeof (MonoInst)); \ - (dest)->opcode = OP_AOTCONST; \ - (dest)->inst_p0 = (gpointer)(token); \ - (dest)->inst_i1 = (gpointer)MONO_PATCH_INFO_TYPE_FROM_HANDLE; \ - (dest)->type = STACK_OBJ; \ - } while (0) - -#define NEW_LDTOKENCONST(cfg,dest,token) do { \ - (dest) = mono_mempool_alloc0 ((cfg)->mempool, sizeof (MonoInst)); \ - (dest)->opcode = OP_AOTCONST; \ - (dest)->inst_p0 = (gpointer)(token); \ - (dest)->inst_i1 = (gpointer)MONO_PATCH_INFO_LDTOKEN; \ - (dest)->type = STACK_PTR; \ - } while (0) - #define NEW_DOMAINCONST(cfg,dest) do { \ - if (cfg->opt & MONO_OPT_SHARED) { \ + if ((cfg->opt & MONO_OPT_SHARED) || mono_compile_aot) { \ NEW_TEMPLOAD (cfg, dest, mono_get_domainvar (cfg)->inst_c0); \ } else { \ NEW_PCONST (cfg, dest, (cfg)->domain); \ @@ -1776,10 +1732,6 @@ handle_enum: if (args [i]->type != STACK_VTYPE) return 1; continue; - case MONO_TYPE_GENERICINST: - simple_type = sig->params [i]->data.generic_inst->generic_type->type; - goto handle_enum; - default: g_error ("unknown type 0x%02x in check_call_signature", simple_type); } @@ -1844,6 +1796,7 @@ mono_emit_call_args (MonoCompile *cfg, MonoBasicBlock *bblock, MonoMethodSignatu { MonoCallInst *call; MonoInst *arg; + int i; MONO_INST_NEW_CALL (cfg, call, ret_type_to_call_opcode (sig->ret, calli, virtual)); @@ -1937,9 +1890,9 @@ mono_emit_jit_icall (MonoCompile *cfg, MonoBasicBlock *bblock, gconstpointer fun static void mono_emulate_opcode (MonoCompile *cfg, MonoInst *tree, MonoInst **iargs, MonoJitICallInfo *info) { - MonoInst *ins, *temp = NULL, *store, *load, *begin; + MonoInst *ins, *temp = NULL, *store, *load; MonoInst *last_arg = NULL; - int nargs; + int i, nargs; MonoCallInst *call; /*g_print ("emulating: "); @@ -1969,19 +1922,21 @@ mono_emulate_opcode (MonoCompile *cfg, MonoInst *tree, MonoInst **iargs, MonoJit if (nargs) last_arg->next = store; - if (nargs) - begin = call->out_args; - else - begin = store; - if (cfg->prev_ins) { store->next = cfg->prev_ins->next; - cfg->prev_ins->next = begin; + if (nargs) + cfg->prev_ins->next = call->out_args; + else + cfg->prev_ins->next = store; } else { store->next = cfg->cbb->code; - cfg->cbb->code = begin; + if (nargs) + cfg->cbb->code = call->out_args; + else + cfg->cbb->code = store; } + call->fptr = info->wrapper; if (!MONO_TYPE_IS_VOID (info->sig->ret)) { @@ -2099,6 +2054,24 @@ handle_initobj (MonoCompile *cfg, MonoBasicBlock *bblock, MonoInst *dest, const #define CODE_IS_STLOC(ip) (((ip) [0] >= CEE_STLOC_0 && (ip) [0] <= CEE_STLOC_3) || ((ip) [0] == CEE_STLOC_S)) +static gboolean +needs_cctor_run (MonoClass *klass, MonoMethod *caller) +{ + int i; + MonoMethod *method; + + for (i = 0; i < klass->method.count; ++i) { + method = klass->methods [i]; + if ((method->flags & METHOD_ATTRIBUTE_SPECIAL_NAME) && + (strcmp (".cctor", method->name) == 0)) { + if (caller == method) + return FALSE; + return TRUE; + } + } + return FALSE; +} + static gboolean mono_method_check_inlining (MonoCompile *cfg, MonoMethod *method) { @@ -2135,7 +2108,7 @@ mono_method_check_inlining (MonoCompile *cfg, MonoMethod *method) vtable = mono_class_vtable (cfg->domain, method->klass); if (method->klass->flags & TYPE_ATTRIBUTE_BEFORE_FIELD_INIT) mono_runtime_class_init (vtable); - else if (!vtable->initialized && mono_class_needs_cctor_run (method->klass, NULL)) + else if (!vtable->initialized && needs_cctor_run (method->klass, NULL)) return FALSE; } else { /* @@ -2143,7 +2116,7 @@ mono_method_check_inlining (MonoCompile *cfg, MonoMethod *method) * the cctor will need to be run at aot method load time, for example, * or at the end of the compilation of the inlining method. */ - if (mono_class_needs_cctor_run (method->klass, NULL) && !((method->klass->flags & TYPE_ATTRIBUTE_BEFORE_FIELD_INIT))) + if (needs_cctor_run (method->klass, NULL) && !((method->klass->flags & TYPE_ATTRIBUTE_BEFORE_FIELD_INIT))) return FALSE; } //if (!MONO_TYPE_IS_VOID (signature->ret)) return FALSE; @@ -2382,7 +2355,7 @@ inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, #define BIG_BRANCH_OFFSET 13 static int -get_basic_blocks (MonoCompile *cfg, GHashTable *bbhash, MonoMethodHeader* header, guint real_offset, unsigned char *start, unsigned char *end, unsigned char **pos) +get_basic_blocks (MonoCompile *cfg, GHashTable *bbhash, MonoMethodHeader* header, guint real_offset, unsigned char *start, unsigned char *end) { unsigned char *ip = start; unsigned char *target; @@ -2451,7 +2424,6 @@ get_basic_blocks (MonoCompile *cfg, GHashTable *bbhash, MonoMethodHeader* header } return 0; unverified: - *pos = ip; return 1; } @@ -2486,7 +2458,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b MonoImage *image; guint32 token, ins_flag; MonoClass *klass; - unsigned char *ip, *end, *target, *err_pos; + unsigned char *ip, *end, *target; static double r8_0 = 0.0; MonoMethodSignature *sig; MonoType **param_types; @@ -2538,6 +2510,9 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b for (i = sig->hasthis + sig->param_count - 1; i >= 0; i--) arg_array [i] = cfg->varinfo [i]; + if (mono_compile_aot) + cfg->opt |= MONO_OPT_SHARED; + if (header->num_clauses) { int size = sizeof (int) * header->num_clauses; filter_lengths = alloca (size); @@ -2611,7 +2586,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b } } - if ((header->init_locals || (cfg->method == method && (cfg->opt & MONO_OPT_SHARED))) || mono_compile_aot) { + if ((header->init_locals || (cfg->method == method && (cfg->opt & MONO_OPT_SHARED)))) { /* we use a separate basic block for the initialization code */ cfg->bb_init = init_localsbb = NEW_BBLOCK (cfg); init_localsbb->real_offset = real_offset; @@ -2625,10 +2600,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b link_bblock (cfg, start_bblock, bblock); } - if (get_basic_blocks (cfg, bbhash, header, real_offset, ip, end, &err_pos)) { - ip = err_pos; + if (get_basic_blocks (cfg, bbhash, header, real_offset, ip, end)) goto unverified; - } mono_debug_init_method (cfg, bblock, breakpoint_id); @@ -3584,14 +3557,13 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b } else { - if (cfg->opt & MONO_OPT_SHARED) { + if (mono_compile_aot) { + cfg->ldstr_list = g_list_prepend (cfg->ldstr_list, (gpointer)n); + } + + if ((cfg->opt & MONO_OPT_SHARED) || mono_compile_aot) { int temp; MonoInst *iargs [3]; - - if (mono_compile_aot) { - cfg->ldstr_list = g_list_prepend (cfg->ldstr_list, (gpointer)n); - } - NEW_TEMPLOAD (cfg, iargs [0], mono_get_domainvar (cfg)->inst_c0); NEW_IMAGECONST (cfg, iargs [1], image); NEW_ICONST (cfg, iargs [2], mono_metadata_token_index (n)); @@ -3599,14 +3571,10 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b NEW_TEMPLOAD (cfg, *sp, temp); mono_ldstr (cfg->domain, image, mono_metadata_token_index (n)); } else { - if (mono_compile_aot) - NEW_LDSTRCONST (cfg, ins, n); - else { - NEW_PCONST (cfg, ins, NULL); - ins->cil_code = ip; - ins->type = STACK_OBJ; - ins->inst_p0 = mono_ldstr (cfg->domain, image, mono_metadata_token_index (n)); - } + NEW_PCONST (cfg, ins, NULL); + ins->cil_code = ip; + ins->type = STACK_OBJ; + ins->inst_p0 = mono_ldstr (cfg->domain, image, mono_metadata_token_index (n)); *sp = ins; } } @@ -3655,14 +3623,14 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b temp = iargs [0]->inst_c0; NEW_TEMPLOADA (cfg, *sp, temp); } else { - if (cfg->opt & MONO_OPT_SHARED) { + if ((cfg->opt & MONO_OPT_SHARED) || mono_compile_aot) { NEW_DOMAINCONST (cfg, iargs [0]); NEW_CLASSCONST (cfg, iargs [1], cmethod->klass); temp = mono_emit_jit_icall (cfg, bblock, mono_object_new, iargs, ip); } else { MonoVTable *vtable = mono_class_vtable (cfg->domain, cmethod->klass); - NEW_VTABLECONST (cfg, iargs [0], vtable); + NEW_PCONST (cfg, iargs [0], vtable); if (cmethod->klass->has_finalize || cmethod->klass->marshalbyref || (cfg->prof_options & MONO_PROFILE_ALLOCATIONS)) temp = mono_emit_jit_icall (cfg, bblock, mono_object_new_specific, iargs, ip); else @@ -4010,7 +3978,6 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b case CEE_LDSFLDA: case CEE_STSFLD: { MonoClassField *field; - gpointer addr = NULL; token = read32 (ip + 1); @@ -4018,11 +3985,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b mono_class_init (klass); handle_loaded_temps (cfg, bblock, stack_start, sp); - - if (cfg->domain->thread_static_fields) - addr = g_hash_table_lookup (cfg->domain->thread_static_fields, field); - - if ((cfg->opt & MONO_OPT_SHARED) || (mono_compile_aot && addr)) { + + if (((cfg->opt & MONO_OPT_SHARED) || mono_compile_aot)) { int temp; MonoInst *iargs [2]; g_assert (field->parent); @@ -4031,12 +3995,13 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b temp = mono_emit_jit_icall (cfg, bblock, mono_class_static_field_address, iargs, ip); NEW_TEMPLOAD (cfg, ins, temp); } else { + gpointer addr; MonoVTable *vtable; vtable = mono_class_vtable (cfg->domain, klass); - if (!addr) { - if ((!vtable->initialized || mono_compile_aot) && !(klass->flags & TYPE_ATTRIBUTE_BEFORE_FIELD_INIT) && mono_class_needs_cctor_run (klass, method)) { + if (!cfg->domain->thread_static_fields || !(addr = g_hash_table_lookup (cfg->domain->thread_static_fields, field))) { + if (!vtable->initialized && !(klass->flags & TYPE_ATTRIBUTE_BEFORE_FIELD_INIT) && needs_cctor_run (klass, method)) { MonoInst *iargs [1]; - NEW_VTABLECONST (cfg, iargs [0], vtable); + NEW_PCONST (cfg, iargs [0], vtable); mono_emit_jit_icall (cfg, bblock, mono_runtime_class_init, iargs, ip); if (cfg->verbose_level > 2) g_print ("class %s.%s needs init call for %s\n", klass->name_space, klass->name, field->name); @@ -4044,11 +4009,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b mono_runtime_class_init (vtable); } addr = (char*)vtable->data + field->offset; - - if (mono_compile_aot) - NEW_SFLDACONST (cfg, ins, field); - else - NEW_PCONST (cfg, ins, addr); + NEW_PCONST (cfg, ins, addr); ins->cil_code = ip; } else { /* @@ -4214,14 +4175,14 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b break; } /* much like NEWOBJ */ - if (cfg->opt & MONO_OPT_SHARED) { + if ((cfg->opt & MONO_OPT_SHARED) || mono_compile_aot) { NEW_DOMAINCONST (cfg, iargs [0]); NEW_CLASSCONST (cfg, iargs [1], klass); temp = mono_emit_jit_icall (cfg, bblock, mono_object_new, iargs, ip); } else { MonoVTable *vtable = mono_class_vtable (cfg->domain, klass); - NEW_VTABLECONST (cfg, iargs [0], vtable); + NEW_PCONST (cfg, iargs [0], vtable); if (1 || klass->has_finalize || (cfg->prof_options & MONO_PROFILE_ALLOCATIONS)) temp = mono_emit_jit_icall (cfg, bblock, mono_object_new_specific, iargs, ip); else @@ -4260,7 +4221,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b token = read32 (ip + 1); /* allocate the domainvar - becaus this is used in decompose_foreach */ - if (cfg->opt & MONO_OPT_SHARED) + if ((cfg->opt & MONO_OPT_SHARED) || mono_compile_aot) mono_get_domainvar (cfg); if (method->wrapper_type != MONO_WRAPPER_NONE) @@ -4483,7 +4444,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b handle = mono_ldtoken (image, n, &handle_class); mono_class_init (handle_class); - if (cfg->opt & MONO_OPT_SHARED) { + if (((cfg->opt & MONO_OPT_SHARED) || mono_compile_aot)) { int temp; MonoInst *res, *store, *addr, *vtvar, *iargs [2]; @@ -4503,18 +4464,12 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b (strcmp (cmethod->name, "GetTypeFromHandle") == 0)) { MonoClass *tclass = mono_class_from_mono_type (handle); mono_class_init (tclass); - if (mono_compile_aot) - NEW_TYPE_FROM_HANDLE_CONST (cfg, ins, n); - else - NEW_PCONST (cfg, ins, mono_type_get_object (cfg->domain, handle)); + NEW_PCONST (cfg, ins, mono_type_get_object (cfg->domain, handle)); ins->type = STACK_OBJ; ins->klass = cmethod->klass; ip += 5; } else { - if (mono_compile_aot) - NEW_LDTOKENCONST (cfg, ins, n); - else - NEW_PCONST (cfg, ins, handle); + NEW_PCONST (cfg, ins, handle); ins->type = STACK_VTYPE; ins->klass = handle_class; } @@ -5342,13 +5297,6 @@ mono_print_tree (MonoInst *tree) { printf (")"); } -void -mono_print_tree_nl (MonoInst *tree) -{ - mono_print_tree (tree); - printf ("\n"); -} - static void create_helper_signature (void) { @@ -5653,7 +5601,7 @@ decompose_foreach (MonoInst *tree, gpointer data) g_assert (newarr_specific_info); } - if (cfg->opt & MONO_OPT_SHARED) { + if ((cfg->opt & MONO_OPT_SHARED) || mono_compile_aot) { NEW_DOMAINCONST (cfg, iargs [0]); NEW_CLASSCONST (cfg, iargs [1], tree->inst_newa_class); iargs [2] = tree->inst_newa_len; @@ -5663,7 +5611,7 @@ decompose_foreach (MonoInst *tree, gpointer data) else { MonoVTable *vtable = mono_class_vtable (cfg->domain, mono_array_class_get (tree->inst_newa_class, 1)); - NEW_VTABLECONST (cfg, iargs [0], vtable); + NEW_PCONST (cfg, iargs [0], vtable); iargs [1] = tree->inst_newa_len; info = newarr_specific_info; @@ -5850,16 +5798,15 @@ mono_get_lmf_addr (void) static void mono_thread_abort (MonoObject *obj) { - /* MonoJitTlsData *jit_tls = TlsGetValue (mono_jit_tls_id); */ + MonoJitTlsData *jit_tls = TlsGetValue (mono_jit_tls_id); - /* handle_remove should be eventually called for this thread, too - g_free (jit_tls);*/ + g_free (jit_tls); ExitThread (-1); } -static void* -setup_jit_tls_data (gpointer stack_start, gpointer abort_func) +static void +mono_thread_start_cb (guint32 tid, gpointer stack_start, gpointer func) { MonoJitTlsData *jit_tls; MonoLMF *lmf; @@ -5868,24 +5815,13 @@ setup_jit_tls_data (gpointer stack_start, gpointer abort_func) TlsSetValue (mono_jit_tls_id, jit_tls); - jit_tls->abort_func = abort_func; + jit_tls->abort_func = mono_thread_abort; jit_tls->end_of_stack = stack_start; lmf = g_new0 (MonoLMF, 1); lmf->ebp = -1; - jit_tls->lmf = jit_tls->first_lmf = lmf; - return jit_tls; -} - -static void -mono_thread_start_cb (guint32 tid, gpointer stack_start, gpointer func) -{ - MonoThread *thread; - void *jit_tls = setup_jit_tls_data (stack_start, mono_thread_abort); - thread = mono_thread_current (); - if (thread) - thread->jit_data = jit_tls; + jit_tls->lmf = lmf; } void (*mono_thread_attach_aborted_cb ) (MonoObject *obj) = NULL; @@ -5902,23 +5838,20 @@ mono_thread_abort_dummy (MonoObject *obj) static void mono_thread_attach_cb (guint32 tid, gpointer stack_start) { - MonoThread *thread; - void *jit_tls = setup_jit_tls_data (stack_start, mono_thread_abort_dummy); - thread = mono_thread_current (); - if (thread) - thread->jit_data = jit_tls; -} + MonoJitTlsData *jit_tls; + MonoLMF *lmf; -static void -mini_thread_cleanup (MonoThread *thread) -{ - MonoJitTlsData *jit_tls = thread->jit_data; + jit_tls = g_new0 (MonoJitTlsData, 1); - if (jit_tls) { - g_free (jit_tls->first_lmf); - g_free (jit_tls); - thread->jit_data = NULL; - } + TlsSetValue (mono_jit_tls_id, jit_tls); + + jit_tls->abort_func = mono_thread_abort_dummy; + jit_tls->end_of_stack = stack_start; + + lmf = g_new0 (MonoLMF, 1); + lmf->ebp = -1; + + jit_tls->lmf = lmf; } void @@ -6302,7 +6235,8 @@ mono_compile_create_vars (MonoCompile *cfg) g_print ("locals done\n"); } -void +#if 0 +static void mono_print_code (MonoCompile *cfg) { MonoBasicBlock *bb; @@ -6324,6 +6258,7 @@ mono_print_code (MonoCompile *cfg) bb->last_ins->next = NULL; } } +#endif extern const char * const mono_burg_rule_string []; @@ -6462,7 +6397,7 @@ mini_select_instructions (MonoCompile *cfg) #endif if (!(mbstate = mono_burg_label (tree, cfg))) { - g_warning ("unable to label tree %p", tree); + g_warning ("unabled to label tree %p", tree); mono_print_tree (tree); g_print ("\n"); g_assert_not_reached (); @@ -6507,7 +6442,7 @@ mono_codegen (MonoCompile *cfg) cfg->prolog_end = cfg->code_len; mono_debug_open_method (cfg); - + /* emit code all basic blocks */ for (bb = cfg->bb_entry; bb; bb = bb->next_bb) { bb->native_offset = cfg->code_len; @@ -6551,7 +6486,7 @@ mono_codegen (MonoCompile *cfg) break; } case MONO_PATCH_INFO_SWITCH: { - gpointer *table = mono_mempool_alloc (cfg->domain->code_mp, sizeof (gpointer) * patch_info->table_size); + gpointer *table = g_new (gpointer, patch_info->table_size); patch_info->ip.i = patch_info->ip.label->inst_c0; for (i = 0; i < patch_info->table_size; i++) { table [i] = (gpointer)patch_info->data.table [i]->native_offset; @@ -6855,6 +6790,7 @@ mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, int p #define DEBUGSSA_CLASS "Tests" #ifdef DEBUGSSA + if (!header->num_clauses && !cfg->disable_ssa) { mono_local_cprop (cfg); mono_ssa_compute (cfg); @@ -6900,7 +6836,7 @@ mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, int p /* after SSA removal */ if (parts == 3) return cfg; - + decompose_pass (cfg); /* FIXME: disabled with exception clauses: bug #42136 */ @@ -6944,7 +6880,6 @@ mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, int p jinfo->code_start = cfg->native_code; jinfo->code_size = cfg->code_len; jinfo->used_regs = cfg->used_int_regs; - jinfo->domain_neutral = (cfg->opt & MONO_OPT_SHARED) != 0; if (header->num_clauses) { int i; @@ -6983,8 +6918,6 @@ mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, int p } } - cfg->jit_info = jinfo; - mono_jit_info_table_add (cfg->domain, jinfo); /* collect statistics */ @@ -7029,14 +6962,10 @@ mono_jit_compile_method (MonoMethod *method) } #ifdef MONO_USE_AOT_COMPILER - if (!mono_compile_aot && !mono_no_aot) { + if (!mono_compile_aot) { mono_class_init (method->klass); - if ((code = mono_aot_get_method (target_domain, method))) { + if ((code = mono_aot_get_method (method))) { g_hash_table_insert (jit_code_hash, method, code); - - /* make sure runtime_init is called */ - mono_runtime_class_init (mono_class_vtable (target_domain, method->klass)); - return code; } } @@ -7126,7 +7055,7 @@ mono_jit_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObjec MonoMethod *invoke; MonoObject *(*runtime_invoke) (MonoObject *this, void **params, MonoObject **exc); invoke = mono_marshal_get_runtime_invoke (method); - runtime_invoke = mono_jit_compile_method (invoke); + runtime_invoke = mono_jit_compile_method (invoke); return runtime_invoke (obj, params, exc); } @@ -7197,17 +7126,6 @@ sigquit_signal_handler (int _dummy) static void -sigint_signal_handler (int _dummy) -{ - MonoException *exc; - GET_CONTEXT - - exc = mono_get_exception_execution_engine ("Interrupted (SIGINT)."); - - mono_arch_handle_exception (ctx, exc, FALSE); -} - -static void mono_runtime_install_handlers (void) { #ifndef PLATFORM_WIN32 @@ -7219,8 +7137,6 @@ mono_runtime_install_handlers (void) win32_seh_set_handler(SIGFPE, sigfpe_signal_handler); win32_seh_set_handler(SIGILL, sigill_signal_handler); win32_seh_set_handler(SIGSEGV, sigsegv_signal_handler); - if (getenv ("MONO_DEBUG")) - win32_seh_set_handler(SIGINT, sigint_signal_handler); #else /* !PLATFORM_WIN32 */ /* libpthreads has its own implementation of sigaction(), @@ -7228,15 +7144,6 @@ mono_runtime_install_handlers (void) * handlers. If not we must call syscall directly instead * of sigaction */ - if (getenv ("MONO_DEBUG")) { - /* catch SIGINT */ - sa.sa_handler = sigint_signal_handler; - sigemptyset (&sa.sa_mask); - sa.sa_flags = 0; - //g_assert (syscall (SYS_sigaction, SIGINT, &sa, NULL) != -1); - g_assert (sigaction (SIGINT, &sa, NULL) != -1); - } - /* catch SIGFPE */ sa.sa_handler = sigfpe_signal_handler; sigemptyset (&sa.sa_mask); @@ -7262,9 +7169,7 @@ mono_runtime_install_handlers (void) sigemptyset (&sa.sa_mask); sa.sa_flags = 0; //g_assert (syscall (SYS_sigaction, SIGILL, &sa, NULL) != -1); - if (!getenv ("MONO_VALGRIND")) - /* valgrind 20030725 and earlier aborts on this call so we skip it */ - g_assert (sigaction (mono_thread_get_abort_signal (), &sa, NULL) != -1); + g_assert (sigaction (mono_thread_get_abort_signal (), &sa, NULL) != -1); #if 1 /* catch SIGSEGV */ @@ -7301,6 +7206,8 @@ mono_jit_create_remoting_trampoline (MonoMethod *method) return addr; } +static CRITICAL_SECTION ms; + MonoDomain * mini_init (const char *filename) { @@ -7308,17 +7215,15 @@ mini_init (const char *filename) mono_arch_cpu_init (); - g_thread_init (NULL); + metadata_section = &ms; + InitializeCriticalSection (metadata_section); mono_jit_tls_id = TlsAlloc (); - setup_jit_tls_data ((gpointer)-1, NULL); + mono_thread_start_cb (GetCurrentThreadId (), (gpointer)-1, NULL); mono_burg_init (); - mono_aot_init (); - mono_runtime_install_handlers (); - mono_threads_install_cleanup (mini_thread_cleanup); mono_install_compile_method (mono_jit_compile_method); mono_install_trampoline (mono_arch_create_jit_trampoline); @@ -7341,9 +7246,6 @@ mini_init (const char *filename) create_helper_signature (); - /* Needs to be called here since register_jit_icall depends on it */ - mono_marshal_init (); - mono_arch_register_lowlevel_calls (); mono_register_jit_icall (mono_profiler_method_enter, "mono_profiler_method_enter", NULL, TRUE); mono_register_jit_icall (mono_profiler_method_leave, "mono_profiler_method_leave", NULL, TRUE); @@ -7487,6 +7389,7 @@ mini_cleanup (MonoDomain *domain) mono_domain_unload (domain, TRUE); print_jit_stats (); + DeleteCriticalSection (metadata_section); } void diff --git a/mono/mini/mini.h b/mono/mini/mini.h index bd6b9e16c58..d7127def1e3 100644 --- a/mono/mini/mini.h +++ b/mono/mini/mini.h @@ -11,14 +11,12 @@ #include <mono/metadata/opcodes.h> #include <mono/metadata/tabledefs.h> #include <mono/metadata/profiler-private.h> - -#include "mini-arch.h" #include "regalloc.h" -#define MONO_USE_AOT_COMPILER +/* fixme: configure should set this */ +#define SIZEOF_VOID_P 4 -/* Version number of the AOT file format */ -#define MONO_AOT_FILE_VERSION "3" +#define MONO_USE_AOT_COMPILER #if 1 #define mono_bitset_test_fast(set,n) (((guint32*)set)[2+(n)/32] & (1 << ((n) % 32))) @@ -87,7 +85,6 @@ extern gboolean mono_jit_trace_calls; extern gboolean mono_break_on_exc; extern int mono_exc_esp_offset; extern gboolean mono_compile_aot; -extern gboolean mono_no_aot; struct MonoEdge { MonoEdge *next; @@ -191,7 +188,7 @@ struct MonoInst { union { MonoInst *src; MonoMethodVar *var; - gssize const_val; + gint32 const_val; gpointer p; MonoMethod *method; MonoMethodSignature *signature; @@ -226,8 +223,8 @@ struct MonoCallInst { MonoInst *out_args; gconstpointer fptr; guint stack_usage; - regmask_t used_iregs; - regmask_t used_fregs; + guint32 used_iregs; + guint32 used_fregs; }; /* @@ -328,7 +325,6 @@ struct MonoMethodVar { typedef struct { gpointer end_of_stack; MonoLMF *lmf; - MonoLMF *first_lmf; void (*abort_func) (MonoObject *object); } MonoJitTlsData; @@ -338,21 +334,14 @@ typedef enum { MONO_PATCH_INFO_LABEL, MONO_PATCH_INFO_METHOD, MONO_PATCH_INFO_METHOD_JUMP, - MONO_PATCH_INFO_METHOD_REL, MONO_PATCH_INFO_METHODCONST, MONO_PATCH_INFO_INTERNAL_METHOD, MONO_PATCH_INFO_SWITCH, MONO_PATCH_INFO_EXC, - MONO_PATCH_INFO_EXC_NAME, MONO_PATCH_INFO_CLASS, - MONO_PATCH_INFO_IMAGE, - MONO_PATCH_INFO_FIELD, - MONO_PATCH_INFO_VTABLE, - MONO_PATCH_INFO_SFLDA, - MONO_PATCH_INFO_LDSTR, - MONO_PATCH_INFO_LDTOKEN, - MONO_PATCH_INFO_TYPE_FROM_HANDLE, - MONO_PATCH_INFO_R4, + MONO_PATCH_INFO_IMAGE, + MONO_PATCH_INFO_FIELD, + MONO_PATCH_INFO_R4, MONO_PATCH_INFO_R8, MONO_PATCH_INFO_IP } MonoJumpInfoType; @@ -377,9 +366,7 @@ struct MonoJumpInfo { MonoClass *klass; MonoClassField *field; MonoImage *image; - MonoVTable *vtable; const char *name; - guint32 token; } data; int table_size; /* use by switch */ @@ -428,7 +415,6 @@ typedef struct { MonoBasicBlock *cbb; /* used by instruction selection */ MonoInst *prev_ins; /* in decompose */ MonoJumpInfo *patch_info; - MonoJitInfo *jit_info; guint num_bblocks; guint locals_start; guint num_varinfo; /* used items in varinfo */ @@ -452,7 +438,7 @@ typedef struct { guint code_len; guint prolog_end; guint epilog_begin; - regmask_t used_int_regs; + guint32 used_int_regs; guint32 opt; guint32 prof_options; guint32 flags; @@ -467,9 +453,6 @@ typedef struct { gpointer debug_info; guint16 *intvars; MonoProfileCoverageInfo *coverage_info; -#ifdef __ia64 - guint8 ins, locals, outs; /* reg stack region sizes */ -#endif /* __ia64 */ } MonoCompile; typedef enum { @@ -604,8 +587,6 @@ void mono_cprop_local (MonoCompile *cfg, MonoBasicBlock *b MonoInst* mono_compile_create_var (MonoCompile *cfg, MonoType *type, int opcode); void mono_blockset_print (MonoCompile *cfg, MonoBitSet *set, const char *name, guint idom); void mono_print_tree (MonoInst *tree); -void mono_print_tree_nl (MonoInst *tree); -void mono_print_code (MonoCompile *cfg); int mono_spillvar_offset (MonoCompile *cfg, int spillvar); void mono_select_instructions (MonoCompile *cfg); const char* mono_inst_name (int op); @@ -618,14 +599,12 @@ void mono_remove_patch_info (MonoCompile *cfg, int ip); gpointer mono_get_lmf_addr (void); GList *mono_varlist_insert_sorted (MonoCompile *cfg, GList *list, MonoMethodVar *mv, gboolean sort_end); void mono_analyze_liveness (MonoCompile *cfg); -void mono_linear_scan (MonoCompile *cfg, GList *vars, GList *regs, regmask_t *used_mask); +void mono_linear_scan (MonoCompile *cfg, GList *vars, GList *regs, guint32 *used_mask); void mono_create_jump_table (MonoCompile *cfg, MonoInst *label, MonoBasicBlock **bbs, int num_blocks); int mono_compile_assembly (MonoAssembly *ass, guint32 opts); MonoCompile *mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, int parts); void mono_destroy_compile (MonoCompile *cfg); -void mono_aot_init (void); -gpointer mono_aot_get_method (MonoDomain *domain, - MonoMethod *method); +gpointer mono_aot_get_method (MonoMethod *method); gboolean mono_method_blittable (MonoMethod *method); void mono_register_opcode_emulation (int opcode, const char* name, MonoMethodSignature *sig, gpointer func, gboolean no_throw); void mono_arch_register_lowlevel_calls (void); diff --git a/mono/mini/regalloc.c b/mono/mini/regalloc.c index 33635390186..850539a5d9a 100644 --- a/mono/mini/regalloc.c +++ b/mono/mini/regalloc.c @@ -41,21 +41,13 @@ mono_regstate_assign (MonoRegState *rs) { } for (; i < rs->next_vireg; ++i) rs->iassign [i] = -1; - - rs->fassign = g_malloc (MAX (MONO_MAX_FREGS, rs->next_vfreg)); - for (i = 0; i < MONO_MAX_FREGS; ++i) { - rs->fassign [i] = i; - rs->fsymbolic [i] = 0; - } - for (; i < rs->next_vfreg; ++i) - rs->fassign [i] = -1; } int -mono_regstate_alloc_int (MonoRegState *rs, regmask_t allow) +mono_regstate_alloc_int (MonoRegState *rs, guint32 allow) { int i; - regmask_t mask = allow & rs->ifree_mask; + guint32 mask = allow & rs->ifree_mask; for (i = 0; i < MONO_MAX_IREGS; ++i) { if (mask & (1 << i)) { rs->ifree_mask &= ~ (1 << i); @@ -74,29 +66,6 @@ mono_regstate_free_int (MonoRegState *rs, int reg) } } -int -mono_regstate_alloc_float (MonoRegState *rs, regmask_t allow) -{ - int i; - regmask_t mask = allow & rs->ffree_mask; - for (i = 0; i < MONO_MAX_FREGS; ++i) { - if (mask & (1 << i)) { - rs->ffree_mask &= ~ (1 << i); - return i; - } - } - return -1; -} - -void -mono_regstate_free_float (MonoRegState *rs, int reg) -{ - if (reg >= 0) { - rs->ffree_mask |= 1 << reg; - rs->fsymbolic [reg] = 0; - } -} - inline int mono_regstate_next_long (MonoRegState *rs) { diff --git a/mono/mini/regalloc.h b/mono/mini/regalloc.h index 22da79b611c..55cacbf8135 100644 --- a/mono/mini/regalloc.h +++ b/mono/mini/regalloc.h @@ -1,6 +1,4 @@ -typedef size_t regmask_t; - enum { MONO_REG_FREE, MONO_REG_FREEABLE, @@ -14,6 +12,10 @@ enum { MONO_REG_DOUBLE }; +/* make this arch-dependent */ +#define MONO_MAX_IREGS 8 +#define MONO_MAX_FREGS 7 + typedef struct { /* symbolic registers */ int next_vireg; @@ -23,8 +25,8 @@ typedef struct { int num_iregs; int num_fregs; - regmask_t ifree_mask; - regmask_t ffree_mask; + guint32 ifree_mask; + guint32 ffree_mask; /* symbolic -> hard register assignment */ char *iassign; @@ -46,9 +48,7 @@ MonoRegState* mono_regstate_new (void); void mono_regstate_free (MonoRegState *rs); void mono_regstate_reset (MonoRegState *rs); void mono_regstate_assign (MonoRegState *rs); -int mono_regstate_alloc_int (MonoRegState *rs, regmask_t allow); +int mono_regstate_alloc_int (MonoRegState *rs, guint32 allow); void mono_regstate_free_int (MonoRegState *rs, int reg); -int mono_regstate_alloc_float (MonoRegState *rs, regmask_t allow); -void mono_regstate_free_float (MonoRegState *rs, int reg); inline int mono_regstate_next_long (MonoRegState *rs); diff --git a/mono/mini/tramp-ppc.c b/mono/mini/tramp-ppc.c index 42d60a9bcf9..b178dd62601 100644 --- a/mono/mini/tramp-ppc.c +++ b/mono/mini/tramp-ppc.c @@ -85,7 +85,9 @@ ppc_magic_trampoline (MonoMethod *method, guint32 *code, char *sp) gpointer addr; int reg; + EnterCriticalSection(metadata_section); addr = mono_compile_method(method); + LeaveCriticalSection(metadata_section); g_assert(addr); /* Locate the address of the method-specific trampoline. The call using @@ -494,7 +496,9 @@ x86_magic_trampoline (int eax, int ecx, int edx, int esi, int edi, char *o; gpointer addr; + EnterCriticalSection (metadata_section); addr = mono_compile_method (m); + LeaveCriticalSection (metadata_section); g_assert (addr); /* go to the start of the call instruction diff --git a/mono/mini/tramp-sparc.c b/mono/mini/tramp-sparc.c index f2c7360b1ce..95f90e67667 100644 --- a/mono/mini/tramp-sparc.c +++ b/mono/mini/tramp-sparc.c @@ -87,7 +87,9 @@ x86_magic_trampoline (int eax, int ecx, int edx, int esi, int edi, char *o; gpointer addr; + EnterCriticalSection (metadata_section); addr = mono_compile_method (m); + LeaveCriticalSection (metadata_section); g_assert (addr); /* the method was jumped to */ diff --git a/mono/mini/tramp-x86.c b/mono/mini/tramp-x86.c index 3309827c7ee..aa894433fc0 100644 --- a/mono/mini/tramp-x86.c +++ b/mono/mini/tramp-x86.c @@ -16,10 +16,6 @@ #include <mono/arch/x86/x86-codegen.h> #include <mono/metadata/mono-debug-debugger.h> -#ifdef HAVE_VALGRIND_MEMCHECK_H -#include <valgrind/memcheck.h> -#endif - #include "mini.h" #include "mini-x86.h" @@ -88,7 +84,9 @@ x86_magic_trampoline (int eax, int ecx, int edx, int esi, int edi, char *o; gpointer addr; + EnterCriticalSection (metadata_section); addr = mono_compile_method (m); + LeaveCriticalSection (metadata_section); g_assert (addr); /* the method was jumped to */ @@ -111,22 +109,7 @@ x86_magic_trampoline (int eax, int ecx, int edx, int esi, int edi, reg = code [1] & 0x07; disp = *((gint32*)(code + 2)); } else if ((code [1] == 0xe8)) { - MonoJitInfo *ji = - mono_jit_info_table_find (mono_domain_get (), code); - MonoJitInfo *target_ji = - mono_jit_info_table_find (mono_domain_get (), addr); - - /* - * If the call was made from domain-neutral to domain-specific - * code, we can't patch the call site. - */ - if (ji && target_ji && ! (ji->domain_neutral && !target_ji->domain_neutral)) { - *((guint32*)(code + 2)) = (guint)addr - ((guint)code + 1) - 5; -#ifdef HAVE_VALGRIND_MEMCHECK_H - /* Tell valgrind to recompile the patched code */ - VALGRIND_DISCARD_TRANSLATIONS (code, code + 16); -#endif - } + *((guint32*)(code + 2)) = (guint)addr - ((guint)code + 1) - 5; return addr; } else if ((code [4] == 0xff) && (((code [5] >> 6) & 0x3) == 0) && (((code [5] >> 3) & 0x7) == 2)) { /* @@ -168,12 +151,11 @@ x86_magic_trampoline (int eax, int ecx, int edx, int esi, int edi, o += disp; - if (m->klass->valuetype) - addr = get_unbox_trampoline (m, addr); - - *((gpointer *)o) = addr; - - return addr; + if (m->klass->valuetype) { + return *((gpointer *)o) = get_unbox_trampoline (m, addr); + } else { + return *((gpointer *)o) = addr; + } } static guchar* diff --git a/mono/tests/Makefile.am b/mono/tests/Makefile.am index 4341d28c0b3..61d4c449a59 100644 --- a/mono/tests/Makefile.am +++ b/mono/tests/Makefile.am @@ -168,8 +168,7 @@ TEST_CS_SRC= \ threadpool.cs \ threadpool1.cs \ base-definition.cs \ - bug-27420.cs \ - bug-47295.cs + bug-27420.cs # These only compile with MS CSC TEST_CSC_SRC= \ @@ -254,7 +253,7 @@ testjit: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la echo "$${passed} test(s) passed. $${failed} test(s) failed."; \ if [ $$failed > 0 ]; then echo -e "\nFailed tests:\n"; for i in $${failed_tests}; do echo $${i}; done; fi; -testinterp: $(TESTSI_CS) libtest.la +testinterp: $(TESTSI_CS) $(TESTSI_IL) libtest.la @failed=0; \ passed=0; \ failed_tests="";\ diff --git a/mono/tests/checked.cs b/mono/tests/checked.cs index 87c3f2ab23b..659ed5f834c 100755 --- a/mono/tests/checked.cs +++ b/mono/tests/checked.cs @@ -93,96 +93,8 @@ namespace test { if (ui != 100000)
return -6;
-
- // Check mul.ovf
- checked {
- int l;
- int m;
-
- int[][] cases = new int [][] {
- new int [] {0, 0, 0},
- new int [] {-5, 0, 0},
- new int [] {3, -5, -15},
- new int [] {3, 5, 15},
- new int [] {-3, -5, 15},
- new int [] {-3, 5, -15},
- new int [] {-1, 32767, -32767},
- new int [] {32767, -1, -32767}};
-
-
- for (int j = 0; j < cases.Length; ++j)
- if (cases [j][0] * cases [j][1] != cases [j][2])
- return -7 - j;
- }
-
- checked {
- int j;
- int k;
-
- j = k = 0;
- if (j * k != 0)
- return -7;
-
- j = -5;
- k = 0;
- if (j * k != 0)
- return -8;
-
- j = 0;
- k = -5;
- if (j * k != 0)
- return -9;
-
- j = 3;
- k = -5;
- if (j * k != -15)
- return -10;
-
- j = 3;
- k = 5;
- if (j * k != 15)
- return -11;
-
- j = -3;
- k = -5;
- if (j * k != 15)
- return -12;
-
- j = -3;
- k = 5;
- if (j * k != -15)
- return -13;
-
- j = -1;
- k = 32767;
- if (j * k != -32767)
- return -14;
-
- j = 32767;
- k = -1;
- if (j * k != -32767)
- return -15;
- }
-
- checked {
- long l;
- long m;
-
- long[][] cases = new long [][] {
- new long [] {0, 0, 0},
- new long [] {-5, 0, 0},
- new long [] {3, -5, -15},
- new long [] {3, 5, 15},
- new long [] {-3, -5, 15},
- new long [] {-3, 5, -15},
- new long [] {-1, 2147483647, -2147483647},
- new long [] {2147483647, -1, -2147483647}};
-
- for (int j = 0; j < cases.Length; ++j)
- if (cases [j][0] * cases [j][1] != cases [j][2])
- return -15 - j;
- }
-
+
+
Console.WriteLine("test-ok");
return 0;
diff --git a/mono/tests/threadpool.cs b/mono/tests/threadpool.cs index cfcc6ee4c8a..ae64daf8137 100755 --- a/mono/tests/threadpool.cs +++ b/mono/tests/threadpool.cs @@ -8,7 +8,7 @@ public class Test { public static void test_callback (object state) { Console.WriteLine("test_casllback:" + state); Thread.Sleep (200); - Interlocked.Increment (ref csum); + csum++; } public static int Main () { diff --git a/mono/tests/threadpool1.cs b/mono/tests/threadpool1.cs index ea3014a3da7..6e2c1eff721 100755 --- a/mono/tests/threadpool1.cs +++ b/mono/tests/threadpool1.cs @@ -12,7 +12,7 @@ public class Test { Console.WriteLine("test_casllback:" + state + "ATH: " + workerThreads); Thread.Sleep (10); - Interlocked.Increment (ref csum); + csum += 1; } public static int Main () { diff --git a/mono/utils/ChangeLog b/mono/utils/ChangeLog index 050eeb8b245..16a0d6b19f4 100644 --- a/mono/utils/ChangeLog +++ b/mono/utils/ChangeLog @@ -1,19 +1,3 @@ -2003-08-26 Zoltan Varga <vargaz@freemail.hu> - - * mono-hash.h mono-hash.c (mono_g_hash_table_remap): New function used - to remap hashtable values during a copying collection. Not used at the - moment. - * mono-hash.c (g_hash_node_new): Restructured to avoid the global lock - in the common case. - * mono-hash.c (mono_g_hash_table_new_full): Enable the optimization of - the key function even if the client supplied g_direct_equal instead of - NULL. - -2003-08-22 Duncan Mak <duncan@ximian.com> - - * strtod.c: 64-bit related fixes from Laurent Morichetti - <l_m@pacbell.net>. Patch approval from Miguel. - Fri Jun 6 19:09:51 CEST 2003 Paolo Molaro <lupus@ximian.com> * mono-logger.h, mono-logger.c, Makefile.am: added diff --git a/mono/utils/mono-hash.c b/mono/utils/mono-hash.c index fa209a9c94f..c5c7a543160 100644 --- a/mono/utils/mono-hash.c +++ b/mono/utils/mono-hash.c @@ -156,7 +156,7 @@ mono_g_hash_table_new_full (GHashFunc hash_func, hash_table->size = HASH_TABLE_MIN_SIZE; hash_table->nnodes = 0; hash_table->hash_func = hash_func ? hash_func : g_direct_hash; - hash_table->key_equal_func = key_equal_func == g_direct_equal ? NULL : key_equal_func; + hash_table->key_equal_func = key_equal_func; hash_table->key_destroy_func = key_destroy_func; hash_table->value_destroy_func = value_destroy_func; #if HAVE_BOEHM_GC @@ -281,50 +281,6 @@ mono_g_hash_table_lookup_extended (MonoGHashTable *hash_table, return FALSE; } -static inline MonoGHashNode* -g_hash_node_new (gpointer key, - gpointer value) -{ - MonoGHashNode *hash_node = NULL; - -#if HAVE_BOEHM_GC - if (node_free_list) { - G_LOCK (g_hash_global); - - if (node_free_list) { - hash_node = node_free_list; - node_free_list = node_free_list->next; - } - G_UNLOCK (g_hash_global); - } - if (!hash_node) - hash_node = GC_MALLOC (sizeof (MonoGHashNode)); -#else - G_LOCK (g_hash_global); - if (node_free_list) - { - hash_node = node_free_list; - node_free_list = node_free_list->next; - } - else - { - if (!node_mem_chunk) - node_mem_chunk = g_mem_chunk_new ("hash node mem chunk", - sizeof (MonoGHashNode), - 1024, G_ALLOC_ONLY); - - hash_node = g_chunk_new (MonoGHashNode, node_mem_chunk); - } - G_UNLOCK (g_hash_global); -#endif - - hash_node->key = key; - hash_node->value = value; - hash_node->next = NULL; - - return hash_node; -} - /** * g_hash_table_insert: * @hash_table: a #GHashTable. @@ -633,30 +589,6 @@ mono_g_hash_table_size (MonoGHashTable *hash_table) return hash_table->nnodes; } -/** - * mono_g_hash_table_remap: - * - * Calls the given function for each key-value pair in the hash table, - * and replaces the value stored in the hash table by the value returned by - * the function. - * - **/ -void -mono_g_hash_table_remap (MonoGHashTable *hash_table, - MonoGRemapperFunc func, - gpointer user_data) -{ - MonoGHashNode *node; - gint i; - - g_return_if_fail (hash_table != NULL); - g_return_if_fail (func != NULL); - - for (i = 0; i < hash_table->size; i++) - for (node = hash_table->nodes[i]; node; node = node->next) - node->value = (* func) (node->key, node->value, user_data); -} - static void g_hash_table_resize (MonoGHashTable *hash_table) { @@ -695,6 +627,40 @@ g_hash_table_resize (MonoGHashTable *hash_table) hash_table->size = new_size; } +static MonoGHashNode* +g_hash_node_new (gpointer key, + gpointer value) +{ + MonoGHashNode *hash_node; + + G_LOCK (g_hash_global); + if (node_free_list) + { + hash_node = node_free_list; + node_free_list = node_free_list->next; + } + else + { +#if HAVE_BOEHM_GC + hash_node = GC_MALLOC (sizeof (MonoGHashNode)); +#else + if (!node_mem_chunk) + node_mem_chunk = g_mem_chunk_new ("hash node mem chunk", + sizeof (MonoGHashNode), + 1024, G_ALLOC_ONLY); + + hash_node = g_chunk_new (MonoGHashNode, node_mem_chunk); +#endif + } + G_UNLOCK (g_hash_global); + + hash_node->key = key; + hash_node->value = value; + hash_node->next = NULL; + + return hash_node; +} + static void g_hash_node_destroy (MonoGHashNode *hash_node, GDestroyNotify key_destroy_func, diff --git a/mono/utils/mono-hash.h b/mono/utils/mono-hash.h index 29e9c621e14..c76f7ca2620 100644 --- a/mono/utils/mono-hash.h +++ b/mono/utils/mono-hash.h @@ -39,9 +39,6 @@ G_BEGIN_DECLS typedef struct _MonoGHashTable MonoGHashTable; -typedef gpointer (*MonoGRemapperFunc) (gpointer key, gpointer value, - gpointer user_data); - /* Hash tables */ MonoGHashTable* mono_g_hash_table_new (GHashFunc hash_func, @@ -78,10 +75,6 @@ guint mono_g_hash_table_foreach_steal (MonoGHashTable *hash_table, gpointer user_data); guint mono_g_hash_table_size (MonoGHashTable *hash_table); -void mono_g_hash_table_remap (MonoGHashTable *hash_table, - MonoGRemapperFunc func, - gpointer user_data); - G_END_DECLS #endif /* __MONO_G_HASH_H__ */ diff --git a/mono/utils/strtod.c b/mono/utils/strtod.c index fa0727cd45f..c36b148b1c4 100644 --- a/mono/utils/strtod.c +++ b/mono/utils/strtod.c @@ -138,40 +138,12 @@ static char sccsid[] = "@(#)strtod.c 8.1 (Berkeley) 6/4/93"; * FLT_RADIX, FLT_ROUNDS, and DBL_MAX. */ -#if defined(i386) || defined(mips) && defined(MIPSEL) || defined (__arm__) - +#if defined(i386) || defined(mips) && defined(MIPSEL) #define IEEE_8087 -#define Long long - -#elif defined(__ia64) - -# ifndef __LP64__ -# define Long long -# else -# define Long int -# endif -# ifdef __hpux -# define IEEE_MC68k -# else -# define IEEE_8087 -# endif - -#elif defined(__hppa) - -# define IEEE_MC68k -# ifndef __LP64__ -# define Long long -# else -# define Long int -# endif - #else #define IEEE_MC68k -#define Long long #endif -#define ULong unsigned Long - #ifdef DEBUG #include "stdio.h" #define Bug(x) {fprintf(stderr, "%s\n", x); exit(1);} @@ -261,11 +233,11 @@ Exactly one of IEEE_8087, IEEE_MC68k, VAX, or IBM should be defined. #endif #ifdef IEEE_8087 -#define word0(x) ((ULong *)&x)[1] -#define word1(x) ((ULong *)&x)[0] +#define word0(x) ((unsigned long *)&x)[1] +#define word1(x) ((unsigned long *)&x)[0] #else -#define word0(x) ((ULong *)&x)[0] -#define word1(x) ((ULong *)&x)[1] +#define word0(x) ((unsigned long *)&x)[0] +#define word1(x) ((unsigned long *)&x)[1] #endif /* The following definition of Storeinc is appropriate for MIPS processors. @@ -410,7 +382,7 @@ extern "C" char *__dtoa(double d, int mode, int ndigits, Bigint { struct Bigint *next; int k, maxwds, sign, wds; - ULong x[1]; + unsigned long x[1]; }; typedef struct Bigint Bigint; @@ -427,7 +399,7 @@ Balloc Bigint *rv; x = 1 << k; - rv = (Bigint *)malloc(sizeof(Bigint) + (x-1)*sizeof(Long)); + rv = (Bigint *)malloc(sizeof(Bigint) + (x-1)*sizeof(long)); rv->k = k; rv->maxwds = x; rv->sign = rv->wds = 0; @@ -446,7 +418,7 @@ Bfree } #define Bcopy(x,y) memcpy((char *)&x->sign, (char *)&y->sign, \ -y->wds*sizeof(Long) + 2*sizeof(int)) +y->wds*sizeof(long) + 2*sizeof(int)) static Bigint * multadd @@ -457,9 +429,9 @@ multadd #endif { int i, wds; - ULong *x, y; + unsigned long *x, y; #ifdef Pack_32 - ULong xi, z; + unsigned long xi, z; #endif Bigint *b1; @@ -495,14 +467,14 @@ multadd static Bigint * s2b #ifdef KR_headers - (s, nd0, nd, y9) CONST char *s; int nd0, nd; ULong y9; + (s, nd0, nd, y9) CONST char *s; int nd0, nd; unsigned long y9; #else - (CONST char *s, int nd0, int nd, ULong y9) + (CONST char *s, int nd0, int nd, unsigned long y9) #endif { Bigint *b; int i, k; - Long x, y; + long x, y; x = (nd + 8) / 9; for (k = 0, y = 1; x > y; y <<= 1, k++) ; @@ -533,9 +505,9 @@ s2b static int hi0bits #ifdef KR_headers - (x) register ULong x; + (x) register unsigned long x; #else - (register ULong x) + (register unsigned long x) #endif { register int k = 0; @@ -567,13 +539,13 @@ hi0bits static int lo0bits #ifdef KR_headers - (y) ULong *y; + (y) unsigned long *y; #else - (ULong *y) + (unsigned long *y) #endif { register int k; - register ULong x = *y; + register unsigned long x = *y; if (x & 7) { if (x & 1) @@ -638,10 +610,10 @@ mult { Bigint *c; int k, wa, wb, wc; - ULong carry, y, z; - ULong *x, *xa, *xae, *xb, *xbe, *xc, *xc0; + unsigned long carry, y, z; + unsigned long *x, *xa, *xae, *xb, *xbe, *xc, *xc0; #ifdef Pack_32 - ULong z2; + unsigned long z2; #endif if (a->wds < b->wds) { @@ -764,7 +736,7 @@ lshift { int i, k1, n, n1; Bigint *b1; - ULong *x, *x1, *xe, z; + unsigned long *x, *x1, *xe, z; #ifdef Pack_32 n = k >> 5; @@ -821,7 +793,7 @@ cmp (Bigint *a, Bigint *b) #endif { - ULong *xa, *xa0, *xb, *xb0; + unsigned long *xa, *xa0, *xb, *xb0; int i, j; i = a->wds; @@ -857,10 +829,10 @@ diff { Bigint *c; int i, wa, wb; - Long borrow, y; /* We need signed shifts here. */ - ULong *xa, *xae, *xb, *xbe, *xc; + long borrow, y; /* We need signed shifts here. */ + unsigned long *xa, *xae, *xb, *xbe, *xc; #ifdef Pack_32 - Long z; + long z; #endif i = cmp(a,b); @@ -934,7 +906,7 @@ ulp (double x) #endif { - register Long L; + register long L; double a; L = (word0(x) & Exp_mask) - (P-1)*Exp_msk1; @@ -970,11 +942,11 @@ b2d (Bigint *a, int *e) #endif { - ULong *xa, *xa0, w, y, z; + unsigned long *xa, *xa0, w, y, z; int k; double d; #ifdef VAX - ULong d0, d1; + unsigned long d0, d1; #else #define d0 word0(d) #define d1 word1(d) @@ -1041,9 +1013,9 @@ d2b { Bigint *b; int de, i, k; - ULong *x, y, z; + unsigned long *x, y, z; #ifdef VAX - ULong d0, d1; + unsigned long d0, d1; d0 = word0(d) >> 16 | word0(d) << 16; d1 = word1(d) >> 16 | word1(d) << 16; #else @@ -1234,8 +1206,8 @@ bsd_strtod e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign; CONST char *s, *s0, *s1; double aadj, aadj1, adj, rv, rv0; - Long L; - ULong y, z; + long L; + unsigned long y, z; Bigint *bb, *bb1, *bd, *bd0, *bs, *delta; char decimal_point = '.'; @@ -1746,12 +1718,12 @@ quorem #endif { int n; - Long borrow, y; - ULong carry, q, ys; - ULong *bx, *bxe, *sx, *sxe; + long borrow, y; + unsigned long carry, q, ys; + unsigned long *bx, *bxe, *sx, *sxe; #ifdef Pack_32 - Long z; - ULong si, zs; + long z; + unsigned long si, zs; #endif n = S->wds; @@ -1922,10 +1894,10 @@ __bsd_dtoa int bbits, b2, b5, be, dig, i, ieps, ilim, ilim0, ilim1, j, j1, k, k0, k_check, leftright, m2, m5, s2, s5, spec_case, try_quick; - Long L; + long L; #ifndef Sudden_Underflow int denorm; - ULong x; + unsigned long x; #endif Bigint *b, *b1, *delta, *mlo, *mhi, *S; double d2, ds, eps; diff --git a/scripts/.cvsignore b/scripts/.cvsignore index c5f2cdd8916..0c9351957eb 100644 --- a/scripts/.cvsignore +++ b/scripts/.cvsignore @@ -1,10 +1,4 @@ Makefile Makefile.in -cilc -ilasm -mbas mcs -monoresgen -secutil -sqlsharp -xsd +mbas diff --git a/scripts/Makefile.am b/scripts/Makefile.am index d738e6b1d66..7f7b57614af 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -1,8 +1,8 @@ -EXTRA_DIST = mcs.in mbas.in ilasm.in cilc.in monoresgen.in secutil.in sqlsharp.in xsd.in wsdl.in +EXTRA_DIST = mcs.in mbas.in ilasm.in cilc.in monoresgen.in secutil.in sqlsharp.in xsd.in -bin_SCRIPTS = mcs mbas ilasm cilc monoresgen secutil sqlsharp xsd wsdl +bin_SCRIPTS = mcs mbas ilasm cilc monoresgen secutil sqlsharp xsd -CLEANFILES = mcs mbas ilasm cilc monoresgen secutil sqlsharp xsd wsdl +CLEANFILES = mcs mbas ilasm cilc monoresgen secutil sqlsharp xsd if X86 MONO_INTERP = mono @@ -42,7 +42,3 @@ sqlsharp: sqlsharp.in xsd: xsd.in sed -e 's^\@bindir\@^$(bindir)^g' -e 's^\@mono_interp\@^$(MONO_INTERP)^g' < $(srcdir)/xsd.in > xsd.tmp \ && mv xsd.tmp xsd - -wsdl: wsdl.in - sed -e 's^\@bindir\@^$(bindir)^g' -e 's^\@mono_interp\@^$(MONO_INTERP)^g' < $(srcdir)/wsdl.in > wsdl.tmp \ - && mv wsdl.tmp wsdl diff --git a/web/classlib-doc b/web/classlib-doc index 5b2c0547c2a..b002b8efd55 100644 --- a/web/classlib-doc +++ b/web/classlib-doc @@ -17,7 +17,6 @@ <ul> <li><a href="#monodoc">monodoc - A graphical documentation viewer.</a></li> - <li>xmllint: a tool used to validate a proper XML document. </ul> @@ -28,15 +27,11 @@ *** <a name="monodoc">MonoDoc</a> - The MonoDoc system offers both a GUI client as well as a <a - href="http://www.go-mono.com:8080">Web-based interface</a> to - the documentation. - - The GUI edition uses <a - href="http://gtk-sharp.sf.net">Gtk#</a> and the Web edition - uses Mono's ASP.NET implementation. + A graphical documentation viewer written in Gtk#. In the + future we will have an ASP.NET front-end to present the + documentation on the web as well. - <img src="images/Screenshot-Monodoc.png"> +** Status and Roadmap ** Get Involved diff --git a/web/contributing b/web/contributing index 0a80bcb91b1..55313175a41 100644 --- a/web/contributing +++ b/web/contributing @@ -128,10 +128,7 @@ You can review the list of current bugs by going <a href="http://bugzilla.ximian.com/buglist.cgi?product=Mono%2FClass+Libraries&product=Mono%2FMCS&product=Mono%2FRuntime&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&email1=&emailtype1=substring&emailassigned_to1=1&email2=&emailtype2=substring&emailreporter2=1&changedin=&chfieldfrom=&chfieldto=Now&chfieldvalue=&short_desc=&short_desc_type=substring&long_desc=&long_desc_type=substring&bug_file_loc=&bug_file_loc_type=substring&keywords=&keywords_type=anywords&op_sys_details=&op_sys_details_type=substring&version_details=&version_details_type=substring&cmdtype=doit&order=%27Importance%27&form_name=query">here</a> - Check our <a href="bugs.html">Bugs</a> that contains links to - easily add a bug report, or to query the existing bugs. - -<a name="goodbugreport"/> + <a name="goodbugreport"/> ** How to make good bug reports A mail from Paolo to mono-devel-list contained this check list: diff --git a/web/documentation b/web/documentation index 4cb6d0d3c5f..56721cd7777 100644 --- a/web/documentation +++ b/web/documentation @@ -25,11 +25,7 @@ libraries as well as the class libraries produced by the project). - * Tutorials on Mono and the specifics of running it - (The <a href="http://www.monohispano.org">Mono - Hispano</a> team has produced lots of <a - href="http://www.monohispano.org/tutoriales.php">tutorials - in spanish</a> + * Tutorials on Mono and the specifics of running it. * A guide to Mono as compared to the Microsoft.NET Framework SDK diff --git a/web/download b/web/download index a1bc37cefab..26f6380b3fb 100644 --- a/web/download +++ b/web/download @@ -12,113 +12,7 @@ href="http://www.go-mono.org/mono-beginning.html">Resources/Beginning section</a>, the <a href="http://www.go-mono.org/faq.html">FAQ</a>. - <table> - <tbody> - <tr bgcolor="#DDDDDD"> - <td> - <b>Release 0.26</b><br> - <a href="archive/mono-0.26.html">Release notes</a><br> - Aug 14, 2003 - </td> - <td> - <table cellspacing="1" cellpadding="3"> - <tr bgcolor="#BBBBBB"> - <td> - <b>Source Code</b> - </td> - <td> - <ul> - <li><a href="archive/mcs-0.26.tar.gz">Mono Class Libraries and C# Compiler.</a> - <li><a href="archive/mono-0.26.tar.gz">Mono Runtime</a> - <li><a href="archive/xsp-0.5.tar.gz">XSP web server (0.5)</a> - <li><a href="archive/mod_mono-0.4.tar.gz">Apache Mono module (mod_mono)</a> - <li><a href="archive/monodoc-0.6.tar.gz">MonoDoc 0.6</a> - </ul> - </td> - </tr> - <tr bgcolor="#BBBBBB"> - <td> - <b>Source RPMs</b><br> - (No RPMS for XSP). - </td> - <td> - <ul> - <li><a href="archive/redhat-90-i386/mono-0.26-1.ximian.6.1.src.rpm">mono-0.26-1.src.rpm (RH9)</a> - <li><a href="archive/redhat-90-i386/mono-0.26-1.ximian.5.1.src.rpm">mono-0.26-1.src.rpm (RH8)</a> - </ul> - </td> - </tr> - <tr> - <td></td> - </tr> - <tr> - <td bgcolor="#999999"> - <img src="images/redhat-36.gif"><b>Red Hat 9.0/x86</b> - <ul> - <li><a href="archive/redhat-90-i386/mono-0.26-1.ximian.6.1.i386.rpm">mono-0.26-1.ximian.6.1.i386.rpm</a> - <li><a href="archive/redhat-90-i386/mono-devel-0.26-1.ximian.6.1.i386.rpm">mono-devel-0.26-1.ximian.6.1.i386.rpm</a> - <li><a href="archive/redhat-90-i386/mono-debuginfo-0.26-1.ximian.6.1.i386.rpm">mono-debuginfo-0.26-1.i386.rpm</a> - <br> - <li><a href="archive/redhat-90-i386/libpixregion-0.1.0-1.ximian.6.1.i386.rpm">libpixregion-0.1.0-1.ximian.6.1.i386.rpm</a> - <li><a href="archive/redhat-90-i386/libpixregion-debuginfo-0.1.0-1.ximian.6.1.i386.rpm">libpixregion-debuginfo-0.1.0-1.ximian.6.1.i386.rpm</a> - <li><a href="archive/redhat-90-i386/libic-0.1.0-1.ximian.6.1.i386.rpm">libic-0.1.0-1.ximian.6.1.i386.rpm</a> - <li><a href="archive/redhat-90-i386/libic-debuginfo-0.1.0-1.ximian.6.1.i386.rpm">libic-debuginfo-0.1.0-1.ximian.6.1.i386.rpm</a> - <li><a href="archive/redhat-90-i386/xc-0.1.0-1.ximian.6.1.i386.rpm">xc-0.1.0-1.ximian.6.1.i386.rpm</a> - <li><a href="archive/redhat-90-i386/xc-debuginfo-0.1.0-1.ximian.6.1.i386.rpm">xc-debuginfo-0.1.0-1.ximian.6.1.i386.rpm</a> - <li><a href="archive/redhat-90-i386/xr-0.1.0-1.ximian.6.1.i386.rpm">xr-0.1.0-1.ximian.6.1.i386.rpm</a> - <li><a href="archive/redhat-90-i386/xr-debuginfo-0.1.0-1.ximian.6.1.i386.rpm">xr-debuginfo-0.1.0-1.ximian.6.1.i386.rpm</a> - <br> - <li><a href="archive/redhat-90-i386/monodoc-0.6-1.ximian.6.1.i386.rpm">monodoc-0.6-1.ximian.6.1.i386.rpm</a> (To be used only with CVS gtk-sharp) - <li><a href="archive/redhat-90-i386/monodoc-debuginfo-0.5-1.ximian.6.1.i386.rpm">monodoc-debuginfo-0.5-1.ximian.6.1.i386.rpm</a> - <li><a href="archive/redhat-90-i386/mono-wine-20030318-1.ximian.6.3.i386.rpm">mono-wine-20030318-1.ximian.6.3.i386.rpm</a> - <li><a href="archive/redhat-90-i386/mono-wine-debuginfo-20030318-1.ximian.6.2.i386.rpm">mono-wine-debuginfo-20030318-1.ximian.6.3.i386.rpm</a> - </ul> - </td> - <td bgcolor="#999999"> - <img src="images/redhat-36.gif"><b>Red Hat 8.0/x86</b> - <ul> - <li><a href="archive/redhat-80-i386/mono-0.26-2.ximian.5.1.i386.rpm">mono-0.26-2.ximian.5.1.i386.rpm</a> - <li><a href="archive/redhat-80-i386/mono-devel-0.26-2.ximian.5.1.i386.rpm">mono-devel-0.26-2.ximian.5.1.i386.rpm</a> - <br> - <li><a href="archive/redhat-80-i386/monodoc-0.5-1.ximian.5.1.i386.rpm">monodoc-0.5-1.ximian.5.1.i386.rpm</a> (To be used only with CVS gtk-sharp) - <li><a href="archive/redhat-80-i386/mono-wine-20030318-1.ximian.5.3.i386.rpm">mono-wine-20030318-1.ximian.5.3.i386.rpm</a> - </ul> - </td> - </tr> - <tr> - <td bgcolor="#999999"> - <img src="images/debian-36.gif"><b>Debian</b> - <ul> - <li><a href="h#ttp://www.debianplanet.com/mono/">Debian Packages here.</a> - </ul> - </td> - <td bgcolor="#999999"> - <img src="images/mandrake-36.gif"><b>Mandrake 9.1/x86</b> - <ul> - <li><a href="archive/mandrake-91-i586/mono-0.26-1.ximian.6.1.i586.rpm">mono-0.26-1.ximian.6.1.i586.rpm</a> - <li><a href="archive/mandrake-91-i586/mono-devel-0.26-1.ximian.6.1.i586.rpm">mono-devel-0.26-1.ximian.6.1.i586.rpm</a> -<!-- <li><a href="archive/mandrake-91-i586/monodoc-0.5-1.ximian.6.1.i586.rpm">monodoc-0.5-1.ximian.6.1.i586.rpm</a> --> - </ul> - </td> - </tr> - <tr> - <td bgcolor="#999999"> - <img src="images/suse-36.gif"><b>SuSE 8.2</b> - <ul> - <li><a href="archive/suse-82-i586/mono-0.26-2.ximian.7.1.i586.rpm">mono-0.26-2.ximian.7.1.i586.rpm</a> - <li><a href="archive/suse-82-i586/mono-devel-0.26-2.ximian.7.1.i586.rpm">mono-devel-0.26-2.ximian.7.1.i586.rpm</a> - </ul> - </td> - <td bgcolor="#999999"> - <img src="images/windows-36.gif"><b>Windows installer</b> - <ul> - <li><a href="archive/mono-0.26-win32-2.exe">mono-0.26-win32-2.exe</a> - </ul> - </td> - </tr> - </table> - </td> <table> <tbody> <tr bgcolor="#DDDDDD"> @@ -401,6 +401,13 @@ A: No. MS Passport is unrelated to running .NET compatible applications produced with the Mono tools. The only thing you will need is a just-in-time compiler (JIT). +Q: What is a 100% .NET application? + +A: A `100% .NET application' is one that only uses the APIs defined + under the System namespace and does not use PInvoke. These + applications would in theory run unmodified on Windows, Linux, + HP-UX, Solaris, MacOS X and others. + Q: If Microsoft will release a port of their .NET platform under the `Shared Source' license, why should I bother with anything else? @@ -438,6 +445,12 @@ A: No, it will not. Microsoft Office is a Windows application. To learn more about running Windows applications on Intel Unix systems refer to <a href="http://www.winehq.com">the Wine Project</a>. +Q: Will I be able to compile a Microsoft VB.NET application and execute + the resultant MSIL file under MONO on Linux without converting to C# + and recompiling? + +A: Once we have a complete VisualBasic runtime, yes. + Q: Can mono run the WebMatrix? A: No. That requires System.Windows.Forms support which is not @@ -491,9 +504,9 @@ A: Mono requires Unicode versions of Win32 APIs to run, <a name="compatibility"></a> ** Compatibility -Q: Can Mono run applications developed with the Microsoft.NET framework? +Q: Can Mono run applications developed with the Microsoft.NET fraemwork? -A: Yes, Mono can run applications developed with the Microsoft .NET Framework +A: Yes, Mono can run applications developed with the Microsft .NET Framework on Unix. There are a few caveats to keep in mind: Mono has not been completed yet, so a few API calls might be missing; And in some cases the Mono behavior *might* be incorrect. @@ -527,77 +540,6 @@ A: Sometimes they will. But sometimes a .NET application might invoke Win32 API calls, or assume certain patterns that are not correct for cross-platform applications. -Q: What is a 100% .NET application? - -A: A `100% .NET application' is one that only uses the APIs defined - under the System namespace and does not use P/Invoke. These - applications would in theory run unmodified on Windows, Linux, - HP-UX, Solaris, MacOS X and others. - - Note that this requirement also holds for all assemblies used by the - application. If one of them is Windows-specific, then the entire program - is not a 100% .NET application. - - Furthermore, a 100% .NET application must not contain non-standard data - streams in the assembly. For example, Visual Studio .NET will insert a - <tt>#-</tt> stream into assemblies built under the "Debug" target. - This stream contains debugging information for use by Visual Studio .NET; - however, this stream can not be interpreted by Mono (unless you're willing - to donate support). - - Thus, it is recommended that all Visual Studio .NET-compiled code be - compiled under the Release target before it is executed under Mono. - -Q: Can I execute my Visual Studio .NET program (Visual Basic .NET, Visual C#, - Managed Extensions for C++, etc.) under Mono? - -A: Yes, with some reservations. - - The .NET program must either be a 100% .NET application, or (somehow) have - all dependent assemblies available on all desired platforms. (How to do so - is outside the bounds of this FAQ.) - - For example, since Mono's System.Windows.Forms implementation will use - Wine, System.Windows.Forms is only as portable as Wine is. It's possible - that Mono may run on a platform, but Wine will not, in which case a - System.Windows.Forms app will not run on that platform. This is similarly - true for all assemblies that are not 100% managed code. - - Mono must also have an implementation for the .NET assemblies used. For - example the System.EnterpriseServices namespace is part of .NET, but it - has not been implemented in Mono. Thus, any applications using this - namespace will not run under Mono. - - With regards to languages, C# applications tend to be most portable. - - Visual Basic .NET applications are portable, but Mono's - Microsoft.VisualBasic.dll implementation is incomplete. It is recommended - to either avoid using this assembly in your own code, only use the - portions that Mono has implemented, or to help implement the missing - features. Additionally, you can set 'Option Strict On', which - eliminates the implicit calls to the unimplemented - Microsoft.VisualBasic.CompilerServices.ObjectType class. - (Thanks to Jörg Rosenkranz.) - - Managed Extensions for C++ is least likely to operate under Mono. Mono - does not support mixed mode assemblies (that is, assemblies containing both - managed and unmanaged code, which Managed C++ can produce). You need a - fully-managed assembly to run under Mono, and getting the Visual C++ .NET - compiler to generate such an executable can be difficult. You need to use - only the .NET-framework assemblies, not the C libraries (you can't use - <b>printf</b>(3) for example.), and you need to use - the linker options <tt>/nodefaultlib /entry:main mscoree.lib</tt> in - addition to the <tt>/clr</tt> compiler flag. You can still use certain - compiler intrinsic functions (such as <b>memcpy</b>(3)) and the STL. - You should also see <a - href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmex/html/vcgrfconvertingmanagedextensionsforcprojectsfrommixed-modetopureil.asp" - >Converting Managed Extensions for C++ Projects from Mixed Mode to Pure - Intermediate Language</a> at MSDN. - Finally, you can use PEVERIFY.EXE from the .NET SDK to determine if the - assembly is fully managed. - - Thanks to Serge Chaban for the linker flags to use. - <a name="pnpproject"></a> ** Mono and Portable.NET @@ -876,7 +818,7 @@ A: Replace the __stdcall attribute with the STDCALL macro, and include this Q: I want to be able to execute Mono binaries, without having to use the "mono" command. How can I do this? -A: From Carlos Perelló: +A: From Carlos Perelló: <i>I think that the best solution is the binfmt feature with the wrapper that exists with Debian packages at: @@ -945,7 +887,7 @@ A: Modules developed for Apache 2 are not compatible with Apache 1.3 Q: Can I run Apache 1 and Apache 2 on the same machine? - You can always keep a copy of Apache 2 running in parallel with your Apache + You can always keep a copy of Apache 2 running in paralell with your Apache 1.3 (either different port or using a reverse proxy). You can also bind the two servers to different IP addresses on the @@ -1207,7 +1149,7 @@ A: There should not be any need to recode. Q: What do I need to watch out for when programming in VB.NET so that I'm sure to be able to run those apps on Linux? -A: Not making any P/Invoke or DLL calls should and not using anything in +A: Not making any PInvoke or DLL calls should and not using anything in the Microsoft.* namespaces should suffice. Also do not use any Methods/Classes marked as "This type/method supports the .NET Framework infrastructure and is not intended to be used directly from your code." @@ -1364,7 +1306,7 @@ A: First some background information. The Mono strategy for dealing with these technologies is as follows: (1) work around the patent by using a different - implementation technique that retains the API, but changes the + implementation techinque that retains the API, but changes the mechanism; if that is not possible, we would (2) remove the pieces of code that were covered by those patents, and also (3) find prior art that would render the patent useless. @@ -1479,4 +1421,4 @@ A: It's possible to run VC++ generated apps under Mono, but we do not ** Credits - The FAQ contains material contributed by Miguel de Icaza, Jaime Anguiano, Lluis Sánchez. + The FAQ contains material contributed by Miguel de Icaza, Jaime Anguiano, Lluis Sánchez.
\ No newline at end of file diff --git a/web/index b/web/index index b006cfa09c1..7138e25e740 100644 --- a/web/index +++ b/web/index @@ -12,8 +12,10 @@ Common Language Infrastructure (also referred as the CLR) and a set of <a href="class-library.html">class libraries</a>. The runtime can be <a href="embedded-api.html">embedded</a> into your - application. It implements of both <a href="ado-net.html">ADO.NET</a> - and <a href="asp-net.html">ASP.NET</a>. + application. + + Mono has implementations of both <a href="ado-net">ADO.NET</a> + and <a href="asp-net">ASP.NET</a> as part of its distribution. You can read our <a href="rationale.html">rationale</a> for this project. If you have questions about the project, please @@ -32,9 +34,16 @@ href="http://www.gotmono.com/cgi-bin/yabb/YaBB.pl">forum</a> at <a href="http://www.gotmono.com">GotMono</a>. - Wikis: <a href="http://www.nullenvoid.com/gtksharp/wiki">Gtk# Wiki</a> - and <a href="http://www.nullenvoid.com/mono/wiki">Mono - Wiki</a> + You can contact the team at: <a + href="mailto:mono-list@ximian.com">mono-list@ximian.com</a> + + In order to follow the process of the project and to learn more + about the team members we have created the <a + href="http://monoevo.sf.net/mwn/index.html">Mono Weekly News letter</a>. + Which archives can be found <a + href="http://monoevo.sf.net/mwn/archives.html">here</a>. + We have a <a href="http://www.nullenvoid.com/gtksharp/wiki">Gtk# Wiki</a> + and a <a href="http://www.nullenvoid.com/mono/wiki">Mono Wiki</a> </td> <td> @@ -142,63 +151,6 @@ </tr> </table> -@item Sep 3rd, 2003: Authenticode; WSE - - -@item Sep 1st, 2003: Ice for Mono; XmlSerializer generators; Monodoc progress. - - <b>Ice:</b> Vladimir has checked into CVS (Module ginzu) an - implementation of <a href="http://www.zeroc.com">ZeroC's</a> - <a href="http://www.zeroc.com/ice.html">ICE</a> protocol. It - is implemented using Remoting. If you were looking for an - efficient binary protocol to use with Remoting, this is it. - - ICE is simpler to use than CORBA, and was created by people - who were deeply involved in CORBA and wanted to fix its - problems (you can see a <a - href="http://www.zeroc.com/iceVsCorba.html">list of - differences</a>). - - <b>XmlSerializer</b>: Lluis has checked in a new technology - for use in our XmlSerializer: the XmlSerializer code - generator. Currently our XmlSerializer generates a - description of instructions for serializing data, these - instructions are later interpreted while using it: Reflection - is used to pull all the data. The code generator is the first - step into turning the Serializer from an intepreter into a - compiler and improving the performance of it. - - Currently was used internally to implement the WSDL - serializer, in the future it will just be part of the standard - serialization process. - - <b>MonoDoc:</b> New providers! Thanks to <a - href="http://www.jaggersoft.com/">Jon Jagger</a> for providing - us with his master XML files for the C# specification we now - have integrated the C# spec into Monodoc. Another provider is - the Error provider: now we include all the C# compiler errors - in the help system. - - Alp has contributed various user interface improvement, and - updated our list widget for key navigation; Ben made the - matches window more useful and Joshua has helped us clean up - the ECMA provider even more. - -@item Aug 14th, 2003: Mono 0.26 has been released - - A new version of Mono is available, the new features include: - <a href="http://www.cairographics.org/">Cairo support</a>, <a - href="http://remoting-corba.sf.net">Remoting.Corba</a> - support, as well as a managed XSLT implementation. - - Existing features have been improved vastly: better - Windows.Forms, runtime, faster compiler, web services, better - compliance to the spec and more. - - Check out the <a - href="http://www.go-mono.com/archive/mono-0.26.html">Release - notes</a> for details. - @item Aug 9th, 2003: Python for .NET Preview 2 available; Mono Documentation site up. Brian Lloyd has <a @@ -442,7 +394,7 @@ that SourceGear Corporation will use Mono\x{2122} Project technology to offer cross-platform versions of its products. In addition, the companies have entered into a - development partnership under which Ximian will provide + development partnership under which Ximian® will provide custom Mono development to enable delivery of SourceGear products later this year. As a result, SourceGear will offer both UNIX and Linux clients for its SourceGear Vault source diff --git a/web/languages b/web/languages index 0f53720613b..531e8961fb4 100755 --- a/web/languages +++ b/web/languages @@ -111,7 +111,7 @@ <a href="mailto:brian@No.Spam.zope.com">Brian Lloyd</a> is working on linking the Python runtime with the .NET runtime. More information on the PS.NET project can be found <a - href="http://www.zope.org/Members/Brian/PythonNet">here</a>. + href="http://www.zope.org/Members/Brian/PythonNet/index_html">here</a>. An FAQ document is available <a href="http://www.zope.org/Members/Brian/PythonNet/FAQ.html">here</a>. diff --git a/web/mysql b/web/mysql index 7b0a4d5811b..56c5f112950 100755 --- a/web/mysql +++ b/web/mysql @@ -43,7 +43,7 @@ in the Microsoft .NET Environment</a> is an article by Mr. Venu who is a MySQL AB developer.</li> - <p>Testing for Mono's Mono.Data.MySql and ByteFX's ByteFX.Data.MySqlClient is below. + <p>Testing for Mono's Mono.Data.MySql and ByteFX's ByteFX.Data.MySQLClient is below. ** Current Status @@ -51,7 +51,7 @@ <ul> - <li>ByteFX.Data.MySqlClient + <li>ByteFX.Data.MySQLClient <ul> <li>Build and Runs on Microsoft .NET and Mono</li> <li>Works with SQL# (command-line and GTK# GUI versions)</li>
@@ -109,7 +109,7 @@ The current plan for the MySQL data providers: <ul> - <li>ByteFX.Data.MySqlClient + <li>ByteFX.Data.MySQLClient <ul> <li>Testing and fixes</li> <li>Implement missing features</li> @@ -163,7 +163,7 @@ <pre> using System; using System.Data; - using ByteFX.Data.MySqlClient; + using ByteFX.Data.MySQLClient; public class Test { @@ -175,7 +175,7 @@ "User ID=myuserid;" + "Password=mypassword;"; IDbConnection dbcon; - dbcon = new MySqlConnection(connectionString); + dbcon = new MySQLConnection(connectionString); dbcon.Open(); IDbCommand dbcmd = dbcon.CreateCommand(); // requires a table to be created named employee diff --git a/web/pending-classes.in b/web/pending-classes.in deleted file mode 100644 index 1cdb5a4cb36..00000000000 --- a/web/pending-classes.in +++ /dev/null @@ -1,246 +0,0 @@ -System.Object -System.Exception -System.ValueType -System.Delegate -System.MulticastDelegate -System.Enum -System.Activator -System.ArgIterator -System.__ComObject -System.TypedReference -System.Security.AllowPartiallyTrustedCallersAttribute -System.Runtime.Serialization.Formatter -System.Runtime.Serialization.FormatterConverter -System.Runtime.Serialization.FormatterServices -System.Runtime.Serialization.ObjectIDGenerator -System.Runtime.Serialization.ObjectManager -System.Reflection.ModuleResolveEventHandler -System.Reflection.Pointer -System.Globalization.CompareInfo -System.Globalization.HebrewCalendar -System.Globalization.HijriCalendar -System.Globalization.JapaneseCalendar -System.Globalization.KoreanCalendar -System.Globalization.SortKey -System.Globalization.StringInfo -System.Globalization.TaiwanCalendar -System.Globalization.TextElementEnumerator -System.Globalization.TextInfo -System.Globalization.ThaiBuddhistCalendar -System.IO.IsolatedStorage.IsolatedStorageFile -System.Reflection.Emit.MethodRental -System.Runtime.CompilerServices.AccessedThroughPropertyAttribute -System.Runtime.CompilerServices.CallConvCdecl -System.Runtime.CompilerServices.CallConvStdcall -System.Runtime.CompilerServices.CallConvThiscall -System.Runtime.CompilerServices.CallConvFastcall -System.Runtime.CompilerServices.CustomConstantAttribute -System.Runtime.CompilerServices.DateTimeConstantAttribute -System.Runtime.CompilerServices.DiscardableAttribute -System.Runtime.CompilerServices.DecimalConstantAttribute -System.Runtime.CompilerServices.CompilationRelaxationsAttribute -System.Runtime.CompilerServices.CompilerGlobalScopeAttribute -System.Runtime.CompilerServices.IDispatchConstantAttribute -System.Runtime.CompilerServices.IsVolatile -System.Runtime.CompilerServices.IUnknownConstantAttribute -System.Runtime.CompilerServices.RequiredAttributeAttribute -System.Runtime.InteropServices.ArrayWithOffset -System.Runtime.InteropServices.DispIdAttribute -System.Runtime.InteropServices.ClassInterfaceType -System.Runtime.InteropServices.ClassInterfaceAttribute -System.Runtime.InteropServices.ComVisibleAttribute -System.Runtime.InteropServices.LCIDConversionAttribute -System.Runtime.InteropServices.ComRegisterFunctionAttribute -System.Runtime.InteropServices.ComUnregisterFunctionAttribute -System.Runtime.InteropServices.ProgIdAttribute -System.Runtime.InteropServices.ImportedFromTypeLibAttribute -System.Runtime.InteropServices.IDispatchImplType -System.Runtime.InteropServices.IDispatchImplAttribute -System.Runtime.InteropServices.ComSourceInterfacesAttribute -System.Runtime.InteropServices.ComConversionLossAttribute -System.Runtime.InteropServices.TypeLibTypeFlags -System.Runtime.InteropServices.TypeLibFuncFlags -System.Runtime.InteropServices.TypeLibVarFlags -System.Runtime.InteropServices.TypeLibTypeAttribute -System.Runtime.InteropServices.TypeLibFuncAttribute -System.Runtime.InteropServices.TypeLibVarAttribute -System.Runtime.InteropServices.ComImportAttribute -System.Runtime.InteropServices.PreserveSigAttribute -System.Runtime.InteropServices.ComAliasNameAttribute -System.Runtime.InteropServices.AutomationProxyAttribute -System.Runtime.InteropServices.PrimaryInteropAssemblyAttribute -System.Runtime.InteropServices.CoClassAttribute -System.Runtime.InteropServices.ComEventInterfaceAttribute -System.Runtime.InteropServices.COMException -System.Runtime.InteropServices.ComMemberType -System.Runtime.InteropServices.CurrencyWrapper -System.Runtime.InteropServices.DispatchWrapper -System.Runtime.InteropServices.ErrorWrapper -System.Runtime.InteropServices.ExtensibleClassFactory -System.Runtime.InteropServices.HandleRef -System.Runtime.InteropServices.InvalidComObjectException -System.Runtime.InteropServices.InvalidOleVariantTypeException -System.Runtime.InteropServices.TypeLibImporterFlags -System.Runtime.InteropServices.ExporterEventKind -System.Runtime.InteropServices.ITypeLibExporterNotifySink -System.Runtime.InteropServices.ITypeLibConverter -System.Runtime.InteropServices.MarshalDirectiveException -System.Runtime.InteropServices.ObjectCreationDelegate -System.Runtime.InteropServices.RuntimeEnvironment -System.Runtime.InteropServices.RegistrationServices -System.Runtime.InteropServices.SafeArrayRankMismatchException -System.Runtime.InteropServices.SafeArrayTypeMismatchException -System.Runtime.InteropServices.SEHException -System.Runtime.InteropServices.TypeLibConverter -System.Runtime.InteropServices.BIND_OPTS -System.Runtime.InteropServices.UCOMIBindCtx -System.Runtime.InteropServices.UCOMIConnectionPointContainer -System.Runtime.InteropServices.UCOMIConnectionPoint -System.Runtime.InteropServices.UCOMIEnumMoniker -System.Runtime.InteropServices.CONNECTDATA -System.Runtime.InteropServices.UCOMIEnumConnections -System.Runtime.InteropServices.UCOMIEnumConnectionPoints -System.Runtime.InteropServices.UCOMIEnumString -System.Runtime.InteropServices.UCOMIEnumVARIANT -System.Runtime.InteropServices.FILETIME -System.Runtime.InteropServices.UCOMIMoniker -System.Runtime.InteropServices.UCOMIPersistFile -System.Runtime.InteropServices.UCOMIRunningObjectTable -System.Runtime.InteropServices.STATSTG -System.Runtime.InteropServices.UCOMIStream -System.Runtime.InteropServices.DESCKIND -System.Runtime.InteropServices.BINDPTR -System.Runtime.InteropServices.UCOMITypeComp -System.Runtime.InteropServices.TYPEKIND -System.Runtime.InteropServices.TYPEFLAGS -System.Runtime.InteropServices.IMPLTYPEFLAGS -System.Runtime.InteropServices.TYPEATTR -System.Runtime.InteropServices.FUNCDESC -System.Runtime.InteropServices.IDLFLAG -System.Runtime.InteropServices.IDLDESC -System.Runtime.InteropServices.PARAMFLAG -System.Runtime.InteropServices.PARAMDESC -System.Runtime.InteropServices.TYPEDESC -System.Runtime.InteropServices.ELEMDESC -System.Runtime.InteropServices.VARDESC -System.Runtime.InteropServices.DISPPARAMS -System.Runtime.InteropServices.EXCEPINFO -System.Runtime.InteropServices.FUNCKIND -System.Runtime.InteropServices.INVOKEKIND -System.Runtime.InteropServices.CALLCONV -System.Runtime.InteropServices.FUNCFLAGS -System.Runtime.InteropServices.VARFLAGS -System.Runtime.InteropServices.UCOMITypeInfo -System.Runtime.InteropServices.SYSKIND -System.Runtime.InteropServices.LIBFLAGS -System.Runtime.InteropServices.TYPELIBATTR -System.Runtime.InteropServices.UCOMITypeLib -System.Runtime.InteropServices.UnknownWrapper -System.Runtime.Remoting.IObjectHandle -System.Runtime.Remoting.IRemotingTypeInfo -System.Runtime.Remoting.IChannelInfo -System.Runtime.Remoting.IEnvoyInfo -System.Runtime.Remoting.RemotingConfiguration -System.Runtime.Remoting.TypeEntry -System.Runtime.Remoting.ActivatedClientTypeEntry -System.Runtime.Remoting.ActivatedServiceTypeEntry -System.Runtime.Remoting.WellKnownClientTypeEntry -System.Runtime.Remoting.WellKnownServiceTypeEntry -System.Runtime.Remoting.RemotingException -System.Runtime.Remoting.ServerException -System.Runtime.Remoting.RemotingTimeoutException -System.Runtime.Remoting.RemotingServices -System.Runtime.Remoting.InternalRemotingServices -System.Runtime.Remoting.SoapServices -System.Runtime.Remoting.Activation.UrlAttribute -System.Runtime.Remoting.Messaging.IMessageSink -System.Runtime.Remoting.Messaging.AsyncResult -System.Runtime.Remoting.Messaging.CallContext -System.Runtime.Remoting.Messaging.ILogicalThreadAffinative -System.Runtime.Remoting.Messaging.InternalMessageWrapper -System.Runtime.Remoting.Messaging.IMethodCallMessage -System.Runtime.Remoting.Messaging.MethodCallMessageWrapper -System.Runtime.Remoting.Messaging.HeaderHandler -System.Runtime.Remoting.Messaging.IMessageCtrl -System.Runtime.Remoting.Messaging.IRemotingFormatter -System.Runtime.Remoting.Messaging.ReturnMessage -System.Runtime.Remoting.Messaging.MethodCall -System.Runtime.Remoting.Messaging.ConstructionCall -System.Runtime.Remoting.Messaging.MethodResponse -System.Runtime.Remoting.Messaging.ConstructionResponse -System.Runtime.Remoting.Messaging.MethodReturnMessageWrapper -System.Runtime.Remoting.Messaging.OneWayAttribute -System.Runtime.Remoting.Messaging.MessageSurrogateFilter -System.Runtime.Remoting.Messaging.RemotingSurrogateSelector -System.Runtime.Remoting.Contexts.CrossContextDelegate -System.Runtime.Remoting.Contexts.ContextProperty -System.Runtime.Remoting.Contexts.IContextPropertyActivator -System.Runtime.Remoting.Contexts.IContributeClientContextSink -System.Runtime.Remoting.Contexts.IContributeDynamicSink -System.Runtime.Remoting.Contexts.IContributeEnvoySink -System.Runtime.Remoting.Contexts.IContributeObjectSink -System.Runtime.Remoting.Contexts.IContributeServerContextSink -System.Runtime.Serialization.Formatters.InternalRM -System.Runtime.Serialization.Formatters.InternalST -System.Runtime.Serialization.Formatters.SoapMessage -System.Runtime.Serialization.Formatters.SoapFault -System.Runtime.Serialization.Formatters.ServerFault -System.Runtime.Serialization.Formatters.Binary.BinaryFormatter -System.Security.Cryptography.CryptoConfig -System.Security.Cryptography.KeyedHashAlgorithm -System.Security.Cryptography.HMACSHA1 -System.Security.Cryptography.MACTripleDES -System.Security.Cryptography.MaskGenerationMethod -System.Security.Cryptography.PasswordDeriveBytes -System.Security.Cryptography.PKCS1MaskGenerationMethod -System.Security.Cryptography.RC2 -System.Security.Cryptography.RC2CryptoServiceProvider -System.Security.Cryptography.RSACryptoServiceProvider -System.Security.Cryptography.RSAOAEPKeyExchangeDeformatter -System.Security.Cryptography.RSAOAEPKeyExchangeFormatter -System.Security.Cryptography.RSAPKCS1KeyExchangeDeformatter -System.Security.Cryptography.RSAPKCS1KeyExchangeFormatter -System.Security.Cryptography.RSAPKCS1SignatureDeformatter -System.Security.Cryptography.RSAPKCS1SignatureFormatter -System.Security.Cryptography.SHA1Managed -System.Security.Cryptography.TripleDES -System.Security.Cryptography.TripleDESCryptoServiceProvider -System.Security.Permissions.EnvironmentPermission -System.Security.Permissions.FileDialogPermission -System.Security.Permissions.IsolatedStorageFilePermission -System.Security.Permissions.PrincipalPermissionAttribute -System.Security.Permissions.SecurityPermissionAttribute -System.Security.Permissions.PublisherIdentityPermissionAttribute -System.Security.Permissions.PublisherIdentityPermission -System.Security.Permissions.ReflectionPermission -System.Security.Permissions.RegistryPermission -System.Security.Permissions.PrincipalPermission -System.Security.Permissions.SiteIdentityPermission -System.Security.Permissions.StrongNameIdentityPermission -System.Security.Permissions.StrongNamePublicKeyBlob -System.Security.Permissions.UIPermission -System.Security.Permissions.UrlIdentityPermission -System.Security.Permissions.ZoneIdentityPermission -System.Security.Policy.ApplicationDirectory -System.Security.Policy.ApplicationDirectoryMembershipCondition -System.Security.Policy.FirstMatchCodeGroup -System.Security.Policy.Hash -System.Security.Policy.HashMembershipCondition -System.Security.Policy.NetCodeGroup -System.Security.Policy.PermissionRequestEvidence -System.Security.Policy.Publisher -System.Security.Policy.PublisherMembershipCondition -System.Security.Policy.Site -System.Security.Policy.SiteMembershipCondition -System.Security.Policy.StrongName -System.Security.Policy.StrongNameMembershipCondition -System.Security.Policy.UnionCodeGroup -System.Security.Policy.Url -System.Security.Policy.UrlMembershipCondition -System.Security.Policy.Zone -System.Security.Policy.ZoneMembershipCondition -System.Security.Principal.WindowsIdentity -System.Security.Principal.WindowsImpersonationContext -System.Security.Principal.WindowsPrincipal -System.Threading.CompressedStack -
diff --git a/web/web/commands b/web/web/commands index a5ed1f55b83..0990b1324b1 100644 --- a/web/web/commands +++ b/web/web/commands @@ -5,7 +5,6 @@ 1,Team,team.html,team.src 1,Other sites,other.html,other.src 1,Old News,oldnews.html,oldnews.src -1,Bug Reporting,bugs.html,bugs.src 0,Mono,rationale.html,rationale.src 1,Runtime,runtime.html,runtime.src 2,Embedding,embedded-api.html,embedded-api.src diff --git a/web/web/makefile b/web/web/makefile index c8ee16c9b53..90fe990fec1 100644 --- a/web/web/makefile +++ b/web/web/makefile @@ -64,6 +64,20 @@ OBJECTS= \ deploy/testing.html \ deploy/tools.html \ deploy/winforms.html \ + deploy/class-status.html \ + deploy/class-status-corlib.html \ + deploy/class-status-System.html \ + deploy/class-status-System.Xml.html \ + deploy/class-status-System.Drawing.html \ + deploy/class-status-System.Data.html \ + deploy/class-status-System.Web.html \ + deploy/class-status-System.Web.Services.html \ + deploy/class-status-Microsoft.VisualBasic.html \ + deploy/class-status-System.EnterpriseServices.html \ + deploy/class-status-System.Runtime.Serialization.Formatters.Soap.html \ + deploy/class-status-System.Security.html \ + deploy/class-status-System.Windows.Forms.html \ + deploy/class-status-Cscompmgd.html \ deploy/class-library.html \ deploy/classlib-doc.html @@ -77,7 +91,7 @@ NON_HTML_SOURCES= \ ../mono-build.sh \ ../mono-build-w32.sh -all: $(OBJECT) deploy/index.rss ../team +all: $(OBJECTS) deploy/index.rss ../team perl process.pl commands template.html.in deploy -mkdir deploy/team cp team/*png deploy/team @@ -112,9 +126,8 @@ clean: push: cp -f $(NON_HTML_SOURCES) deploy - #echo scp -P 2200 -r deploy/* www@www.go-mono.com:/web/cvsmodules/mono - #(cd deploy; rsync --verbose --recursive --checksum --update --rsh='ssh' . www@www.go-mono.com:/web/cvsmodules/mono ) - (cd deploy; rsync --verbose --recursive --checksum --update --rsh='ssh' . mono-web@www.go-mono.com:/web/cvsmodules/mono ) + echo scp -P 2200 -r deploy/* www@www.go-mono.com:/web/cvsmodules/mono + (cd deploy; rsync --verbose --recursive --checksum --update --rsh='ssh' . www@www.go-mono.com:/web/cvsmodules/mono ) push2: scp -r deploy/* primates:public_html/xxx diff --git a/web/web/mono-rss.cs b/web/web/mono-rss.cs index 437643d25c0..a4fdd49c365 100755 --- a/web/web/mono-rss.cs +++ b/web/web/mono-rss.cs @@ -6,21 +6,18 @@ using System; using System.IO; using System.Xml; -using System.Text; using RSS; class X { static RSS.RSS rss; static Channel c; static int item_count; - static int line; - + static void PopulateRSS (StreamReader input) { string s; while ((s = input.ReadLine ()) != null){ - line++; if (s.StartsWith ("@item ")) break; } @@ -55,7 +52,6 @@ class X { } else { description += "\n" + (s == "\n" ? "<p>" : s); } - line++; } while ((s = input.ReadLine ()) != null); if (i != null){ @@ -80,12 +76,7 @@ class X { using (FileStream fs = new FileStream (input, FileMode.Open)){ using (StreamReader input_stream = new StreamReader (fs)){ - try { - PopulateRSS (input_stream); - } catch { - Console.WriteLine ("{0} failure while loading: {1}", line, input); - throw; - } + PopulateRSS (input_stream); } } diff --git a/web/web/team.xml b/web/web/team.xml index 7444d88f082..ccc9d97a16d 100644 --- a/web/web/team.xml +++ b/web/web/team.xml @@ -1453,7 +1453,7 @@ <e-mail>peter@newton.cx</e-mail> - <image>peterw.png</image> + <image>none.png</image> <location>Cambridge, MA</location> diff --git a/web/web/template.html.in b/web/web/template.html.in index 3af630dc644..2aab918a0a5 100644 --- a/web/web/template.html.in +++ b/web/web/template.html.in @@ -15,7 +15,6 @@ .navi0 { font-size: 14px; font-weight: bold; background: #444444; } .navi1 { font-size: 14px; font-weight: bold; left-margin: 10pt} .navi2 { font-size: 10px; font-weight: bold; left-margin: 20pt} - .topmenu { font-size: 14px; font-weight: bold; } .footnote { font-size: 12px; color: #aaaaaa; } a.navi0 { color: #ffffff; text-decoration: none} @@ -30,10 +29,6 @@ a.navi2:visited { color: #cccccc; } a.navi2:hover { color: #ee9900; text-decoration: underline; } - a.topmenu { color: #ffffff; text-decoration: none; margin-left: 7px;} - a.topmenu:visited { color: #cccccc; } - a.topmenu:hover { color: #ee9900; text-decoration: underline; } - // --> </style> #CSS# @@ -43,27 +38,11 @@ <table cellpadding="0" cellspacing="0" border="0" width="100%"> <tr> - <td><img src="images/pixel.gif" alt=""></td><!-- left border - --> - <td colspan="4"> - <table> - <tr> - <td> - <a href="http://www.go-mono.com"><img - src="images/mono-new.gif" alt="mono-logo" border="0"></a> - </td> - <td> - <a class="topmenu" href="download.html">Downloads</a> | - <a class="topmenu" href="http://go-mono.com/daily">Daily snapshots</a> | - <a class="topmenu" href="screenshots.html">Screenshots</a> | - <a class="topmenu" href="http://mono.ximian.com:8080">Documentation</a> - <a class="topmenu" href="bugs.html">Bugs</a> - </td> - </tr> - </table> - </td> - <td><img src="images/pixel.gif" alt=""></td><!-- right border - --> + <td><img src="images/pixel.gif" alt=""></td><!-- left border --> + <td colspan="4"> + <a href="http://www.go-mono.com"><img src="images/mono-new.gif" + alt="mono-logo" border="0"></a></td> + <td><img src="images/pixel.gif" alt=""></td><!-- right border --> </tr> <tr> <td><img src="images/pixel.gif" width="1" height="1" alt=""></td> |